landscape-widget 0.5.0-b.1 → 0.5.0

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- define("landscape-widget",["@jupyter-widgets/base"],(t=>(()=>{var e={930:(t,e,n)=>{(e=n(364)(!1)).push([t.id,".custom-widget {\n padding: 5px;\n}\n\n.landscape-container {\n height: 100%;\n width: 100%;\n}\n",""]),t.exports=e},969:(t,e,n)=>{(e=n(364)(!1)).push([t.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",""]),t.exports=e},858:function(t){var e;e=()=>(()=>{var t={803:(t,e,n)=>{var i=n(186),r=(n(212).B,n(325).De,n(341));e.kS=function(t){var e=[];return function(t,e){if(!i(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(t.order){var n=new r(t),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),t.forEachNeighbor(r,o);e(a)}))}}(t,(function(t){e.push(t)})),e}},341:t=>{function e(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}e.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},e.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},e.prototype.forEachNodeYetUnseen=function(t){var e=this.seen,n=this.graph;n.someNode((function(i,r){return e.size===n.order||!e.has(i)&&!!t(i,r)}))},e.prototype.has=function(t){return this.seen.has(t)},e.prototype.push=function(t){var e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)},e.prototype.pushWith=function(t,e){var n=this.seen.size;return this.seen.add(t),n!==this.seen.size&&(this.stack[this.size++]=e,!0)},e.prototype.pop=function(){if(0!==this.size)return this.stack[--this.size]},t.exports=e},847:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},739:(t,e)=>{e.assign=function(t){t=t||{};var e,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(e=0,i=r.length;e<i;e++)if(r[e])for(n in r[e])t[n]=r[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.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."}},e.graphToByteArrays=function(t,e){var n,i=t.order,r=t.size,o={},a=new Float32Array(10*i),s=new Float32Array(3*r);return n=0,t.forEachNode((function(t,e){o[t]=n,a[n]=e.x,a[n+1]=e.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]=e.size||1,a[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,i,r,h,u,c,d){var l=o[r],p=o[h],f=e(t,i,r,h,u,c,d);a[l+6]+=f,a[p+6]+=f,s[n]=l,s[n+1]=p,s[n+2]=f,n+=3})),{nodes:a,edges:s}},e.assignLayoutChanges=function(t,e,n){var i=0;t.updateEachNodeAttributes((function(t,r){return r.x=e[i],r.y=e[i+1],i+=10,n?n(t,r):r}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,i){e[n]=i.x,e[n+1]=i.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var i=t.nodes(),r={},o=0,a=0,s=e.length;o<s;o+=10){if(n){var h=Object.assign({},t.getNodeAttributes(i[a]));h.x=e[o],h.y=e[o+1],h=n(i[a],h),r[i[a]]={x:h.x,y:h.y}}else r[i[a]]={x:e[o],y:e[o+1]};a++}return r},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),i=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return e.revokeObjectURL(i),r}},325:(t,e)=>{e.De=function(t,e,n,i,r,o){return o=Object.assign({},o),e?null==n?t.addUndirectedEdge(i,r,o):t.addUndirectedEdgeWithKey(n,i,r,o):null==n?t.addDirectedEdge(i,r,o):t.addDirectedEdgeWithKey(n,i,r,o)}},212:(t,e)=>{e.B=function(t,e,n){return n=Object.assign({},n),t.addNode(e,n)}},186:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},698:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function r(t,e,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(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return r(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(a,t)},o(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var s=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var i in arguments[e])t[i]=arguments[e][i];return t};function h(t,e,n,i){var r=t._nodes.get(e),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(e){return"object"===t(e)&&null!==e}function c(t){var e;for(e in t)return!1;return!0}function d(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function l(t,e,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(t,e,i)}function p(t){return!(!u(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var f,g={exports:{}},v="object"==typeof Reflect?Reflect:null,y=v&&"function"==typeof v.apply?v.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};f=v&&"function"==typeof v.ownKeys?v.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var m=Number.isNaN||function(t){return t!=t};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}N(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&N(t,"error",e,{once:!0})}(t,r)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var w=10;function x(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _(t){return void 0===t._maxListeners?b.defaultMaxListeners:t._maxListeners}function C(t,e,n,i){var r,o,a,s;if(x(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=_(t))>0&&a.length>r&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,s=h,console&&console.warn&&console.warn(s)}return t}function S(){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 E(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=S.bind(i);return r.listener=n,i.wrapFn=r,r}function k(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):A(r,r.length)}function M(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function A(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function N(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){i.once&&t.removeEventListener(e,r),n(o)}))}}function L(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(t){if("number"!=typeof t||t<0||m(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w=t}}),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(t){if("number"!=typeof t||t<0||m(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},b.prototype.getMaxListeners=function(){return _(this)},b.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=r[t];if(void 0===s)return!1;if("function"==typeof s)y(s,this,e);else{var h=s.length,u=A(s,h);for(n=0;n<h;++n)y(u[n],this,e)}return!0},b.prototype.addListener=function(t,e){return C(this,t,e,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(t,e){return C(this,t,e,!0)},b.prototype.once=function(t,e){return x(e),this.on(t,E(this,t,e)),this},b.prototype.prependOnceListener=function(t,e){return x(e),this.prependListener(t,E(this,t,e)),this},b.prototype.removeListener=function(t,e){var n,i,r,o,a;if(x(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||e)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(t){var e,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[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),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(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},b.prototype.listeners=function(t){return k(this,t,!0)},b.prototype.rawListeners=function(t){return k(this,t,!1)},b.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):M.call(t,e)},b.prototype.listenerCount=M,b.prototype.eventNames=function(){return this._eventsCount>0?f(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var t=arguments,e=t.length,n=0;return new L((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(t){var e=0,n=t.length;return new L((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},L.is=function(t){return t instanceof L||"object"==typeof t&&null!==t&&"function"==typeof t.next};var D=L,G={};G.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,G.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var P=D,F=G,B=F.ARRAY_BUFFER_SUPPORT,z=F.SYMBOL_SUPPORT,R=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||B&&ArrayBuffer.isView(t)?P.fromSequence(t):"object"!=typeof t||null===t?null:z&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},O=R,T=function(t,e){for(var n,i=arguments.length>1?e:1/0,r=i!==1/0?new Array(i):[],o=0,a=O(t);;){if(o===i)return r;if((n=a.next()).done)return o!==e&&(r.length=o),r;r[o++]=n.value}},V=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),I=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V),U=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V),j=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V);function H(t,e){this.key=t,this.attributes=e,this.clear()}function W(t,e){this.key=t,this.attributes=e,this.clear()}function Y(t,e){this.key=t,this.attributes=e,this.clear()}function X(t,e,n,i,r){this.key=e,this.attributes=r,this.undirected=t,this.source=n,this.target=i}function q(t,e,n,i,r,o,a){var s,h,u,c;if(i=""+i,0===n){if(!(s=t._nodes.get(i)))throw new U("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(h=t._edges.get(r)))throw new U("Graph.".concat(e,': 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 U("Graph.".concat(e,': 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=t._edges.get(i)))throw new U("Graph.".concat(e,': 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={}},Y.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},X.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,i=this.target.key;this.source[t][i]=this,this.undirected&&n===i||(this.target[e][n]=this)},X.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,i=this.target.key;this.undirected&&(t=e="undirected");var r=this.source[t],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[e][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[e][n]=this},X.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][e],delete this.target[i][t]},X.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[i][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[i][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){return q(this,e,n,t,i)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var a=q(this,e,n,t,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(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var a=q(this,e,n,t,i,r,o),s=a[0],h=a[1],u=a[2];if("function"!=typeof u)throw new I("Graph.".concat(e,": 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(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,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(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];if(!u(s))throw new I("Graph.".concat(e,": 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(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],h=o[1];if(!u(h))throw new I("Graph.".concat(e,": 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(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];if("function"!=typeof s)throw new I("Graph.".concat(e,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],Z=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,o=""+arguments[1];if(!(i=h(this,r,o,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(i=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(o=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" 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(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(o=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new I("Graph.".concat(e,": 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(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" 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(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new I("Graph.".concat(e,": 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(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new I("Graph.".concat(e,": 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(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new I("Graph.".concat(e,": 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=D,$=R,Q=function(){var t=arguments,e=null,n=-1;return new J((function(){for(var i=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=$(t[n])}if(!0!==(i=e.next()).done)break;e=null}return i}))},tt=[{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 et(t,e,n,i){var r=!1;for(var o in e)if(o!==i){var a=e[o];if(r=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&r)return a.key}}function nt(t,e,n,i){var r,o,a,s=!1;for(var h in e)if(h!==i){r=e[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),t&&s)return r.key;r=r.next}while(void 0!==r)}}function it(t,e){var n,i=Object.keys(t),r=i.length,o=0;return new D((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var a=i[o++];if(a===e){n=void 0;continue}n=t[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 rt(t,e,n,i){var r=e[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)&&t?r.key:void 0}}function ot(t,e,n,i){var r=e[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),t&&o)return r.key;r=r.next}while(void 0!==r)}}function at(t,e){var n=t[e];return void 0!==n.next?new D((function(){if(!n)return{done:!0};var t={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:t}})):D.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 st(t,e,n,i){if(0!==e.size)for(var r,o,a="mixed"!==n&&n!==e.type,s="undirected"===n,h=!1,u=e._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!a||o.undirected===s){var c=o,d=c.key,l=c.attributes,p=c.source,f=c.target;if(h=i(d,l,p.key,f.key,p.attributes,f.attributes,o.undirected),t&&h)return d}}function ht(t,e,n,i,r,o){var a,s=e?nt:et;if("undirected"!==n){if("out"!==i&&(a=s(t,r.in,o),t&&a))return a;if("in"!==i&&(a=s(t,r.out,o,i?void 0:r.key),t&&a))return a}if("directed"!==n&&(a=s(t,r.undirected,o),t&&a))return a}function ut(t,e,n,i,r,o,a){var s,h=n?ot:rt;if("undirected"!==e){if(void 0!==r.in&&"out"!==i&&(s=h(t,r.in,o,a),t&&s))return s;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(s=h(t,r.out,o,a),t&&s))return s}if("directed"!==e&&void 0!==r.undirected&&(s=h(t,r.undirected,o,a),t&&s))return s}var ct=[{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 dt(){this.A=null,this.B=null}function lt(t,e,n,i,r){for(var o in i){var a=i[o],s=a.source,h=a.target,u=s===n?h:s;if(!e||!e.has(u.key)){var c=r(u.key,u.attributes);if(t&&c)return u.key}}}function pt(t,e,n,i,r){if("mixed"!==e){if("undirected"===e)return lt(t,null,i,i.undirected,r);if("string"==typeof n)return lt(t,null,i,i[n],r)}var o,a=new dt;if("undirected"!==e){if("out"!==n){if(o=lt(t,null,i,i.in,r),t&&o)return o;a.wrap(i.in)}if("in"!==n){if(o=lt(t,a,i,i.out,r),t&&o)return o;a.wrap(i.out)}}if("directed"!==e&&(o=lt(t,a,i,i.undirected,r),t&&o))return o}function ft(t,e,n){var i=Object.keys(n),r=i.length,o=0;return new D((function(){var a=null;do{if(o>=r)return t&&t.wrap(n),{done:!0};var s=n[i[o++]],h=s.source,u=s.target;a=h===e?u:h,t&&t.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function gt(t,e,n,i,r){for(var o,a,s,h,u,c,d,l=i._nodes.values(),p=i.type;!0!==(o=l.next()).done;){var f=!1;if(a=o.value,"undirected"!==p)for(s in h=a.out){u=h[s];do{if(c=u.target,f=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&d)return u;u=u.next}while(u)}if("directed"!==p)for(s in h=a.undirected)if(!(e&&a.key>s)){u=h[s];do{if((c=u.target).key!==s&&(c=u.source),f=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&d)return u;u=u.next}while(u)}if(n&&!f&&(d=r(a.key,null,a.attributes,null,null,null,null),t&&d))return null}}function vt(t){if(!u(t))throw new I('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new I("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new I("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function yt(t){if(!u(t))throw new I('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new I("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new I("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new I("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new I("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}dt.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},dt.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var mt,bt=(mt=255&Math.floor(256*Math.random()),function(){return mt++}),wt=new Set(["directed","undirected","mixed"]),xt=new Set(["domain","_events","_eventsCount","_maxListeners"]),_t={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ct(t,e,n){var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}function St(t,e,n,i,r,o,a,s){if(!i&&"undirected"===t.type)throw new j("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new j("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!u(s))throw new I("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!t.allowSelfLoops&&o===a)throw new j("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h=t._nodes.get(o),c=t._nodes.get(a);if(!h)throw new U("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!c)throw new U("Graph.".concat(e,': target node "').concat(a,'" not found.'));var d={key:null,undirected:i,source:o,target:a,attributes:s};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new j("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));if(!t.multi&&(i?void 0!==h.undirected[a]:void 0!==h.out[a]))throw new j("Graph.".concat(e,': 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 X(i,r,h,c,s);t._edges.set(r,l);var p=o===a;return i?(h.undirectedDegree++,c.undirectedDegree++,p&&(h.undirectedLoops++,t._undirectedSelfLoopCount++)):(h.outDegree++,c.inDegree++,p&&(h.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),i?t._undirectedSize++:t._directedSize++,d.key=r,t.emit("edgeAdded",d),r}function Et(t,e,n,i,r,o,a,h,c){if(!i&&"undirected"===t.type)throw new j("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new j("Graph.".concat(e,": 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 I("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(h,'"'))}else if(!u(h))throw new I("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(h,'"'));var d;if(o=""+o,a=""+a,c&&(d=h,h=void 0),!t.allowSelfLoops&&o===a)throw new j("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l,p,f=t._nodes.get(o),g=t._nodes.get(a);if(!n&&(l=t._edges.get(r))){if(!(l.source.key===o&&l.target.key===a||i&&l.source.key===a&&l.target.key===o))throw new j("Graph.".concat(e,': 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,'").'));p=l}if(p||t.multi||!f||(p=i?f.undirected[a]:f.out[a]),p){var v=[p.key,!1,!1,!1];if(c?!d:!h)return v;if(c){var y=p.attributes;p.attributes=d(y),t.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else s(p.attributes,h),t.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:h});return v}h=h||{},c&&d&&(h=d(h));var m={key:null,undirected:i,source:o,target:a,attributes:h};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new j("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));var b=!1,w=!1;f||(f=Ct(t,o,{}),b=!0,o===a&&(g=f,w=!0)),g||(g=Ct(t,a,{}),w=!0),l=new X(i,r,f,g,h),t._edges.set(r,l);var x=o===a;return i?(f.undirectedDegree++,g.undirectedDegree++,x&&(f.undirectedLoops++,t._undirectedSelfLoopCount++)):(f.outDegree++,g.inDegree++,x&&(f.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),i?t._undirectedSize++:t._directedSize++,m.key=r,t.emit("edgeAdded",m),[r,!0,b,w]}function kt(t,e){t._edges.delete(e.key);var n=e.source,i=e.target,r=e.attributes,o=e.undirected,a=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:r,source:n.key,target:i.key,undirected:o})}var Mt=function(n){function i(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=s({},_t,t)).multi)throw new I("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!wt.has(t.type))throw new I('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new I("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var i="mixed"===t.type?H:"directed"===t.type?W:Y;d(a(e),"NodeDataClass",i);var r="geid_"+bt()+"_",o=0;return d(a(e),"_attributes",{}),d(a(e),"_nodes",new Map),d(a(e),"_edges",new Map),d(a(e),"_directedSize",0),d(a(e),"_undirectedSize",0),d(a(e),"_directedSelfLoopCount",0),d(a(e),"_undirectedSelfLoopCount",0),d(a(e),"_edgeKeyGenerator",(function(){var t;do{t=r+o++}while(e._edges.has(t));return t})),d(a(e),"_options",t),xt.forEach((function(t){return d(a(e),t,e[t])})),l(a(e),"order",(function(){return e._nodes.size})),l(a(e),"size",(function(){return e._edges.size})),l(a(e),"directedSize",(function(){return e._directedSize})),l(a(e),"undirectedSize",(function(){return e._undirectedSize})),l(a(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),l(a(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),l(a(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),l(a(e),"multi",e._options.multi),l(a(e),"type",e._options.type),l(a(e),"allowSelfLoops",e._options.allowSelfLoops),l(a(e),"implementation",(function(){return"graphology"})),e}e(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(t){return this._nodes.has(""+t)},r.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.out.hasOwnProperty(e)}throw new I("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(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.undirected.hasOwnProperty(e)}throw new I("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(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(e)||void 0!==i.undirected&&i.undirected.hasOwnProperty(e))}throw new I("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(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new j("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(t);if(!n)throw new U('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new j("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(t);if(!n)throw new U('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.undirected&&n.undirected[e]||void 0;return i?i.key:void 0}},r.edge=function(t,e){if(this.multi)throw new j("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},r.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},r.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},r.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},r.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},r.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},r.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},r.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},r.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},r.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},r.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},r.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},r.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},r.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},r.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},r.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},r.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,i+=e.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,i+=e.directedLoops),n-i},r.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,i+=2*e.directedLoops),n-i},r.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},r.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},r.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},r.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new U('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(t===i)return r;if(t===r)return i;throw new U('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new U('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},r.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},r.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},r.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},r.addNode=function(t,e){var n=function(t,e,n){if(n&&!u(n))throw new I('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new j('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}(this,t,e);return n.key},r.mergeNode=function(t,e){if(e&&!u(e))throw new I('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(s(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},r.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new I('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var i=n.attributes;n.attributes=e(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]},r.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new U('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){e=n.out[i];do{kt(this,e),e=e.next}while(e)}for(var r in n.in){e=n.in[r];do{kt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{kt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},r.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(e=h(this,n,i,this.type)))throw new U('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new U('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return kt(this,e),this},r.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new j("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 j("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,t=""+t,e=""+e,"directed");if(!n)throw new U('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return kt(this,n),this},r.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new j("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 j("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,t,e,"undirected");if(!n)throw new U('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return kt(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(t){return this._attributes[t]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},r.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.updateAttribute=function(t,e){if("function"!=typeof e)throw new I("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},r.replaceAttributes=function(t){if(!u(t))throw new I("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(t){if(!u(t))throw new I("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},r.updateAttributes=function(t){if("function"!=typeof t)throw new I("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new I("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!p(e))throw new I("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=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},r.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new I("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!p(e))throw new I("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=t(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},r.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new I("Graph.forEachAdjacencyEntry: expecting a callback.");gt(!1,!1,!1,this,t)},r.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new I("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!1,!0,this,t)},r.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new I("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");gt(!1,!0,!1,this,t)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new I("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!0,!0,this,t)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):T(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(t){if("function"!=typeof t)throw new I("Graph.forEachNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)},r.findNode=function(t){if("function"!=typeof t)throw new I("Graph.findNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},r.mapNodes=function(t){if("function"!=typeof t)throw new I("Graph.mapNode: expecting a callback.");for(var e,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(e=i.next()).done;)n=e.value,r[o++]=t(n.key,n.attributes);return r},r.someNode=function(t){if("function"!=typeof t)throw new I("Graph.someNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},r.everyNode=function(t){if("function"!=typeof t)throw new I("Graph.everyNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},r.filterNodes=function(t){if("function"!=typeof t)throw new I("Graph.filterNodes: expecting a callback.");for(var e,n,i=this._nodes.values(),r=[];!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(t,e){if("function"!=typeof t)throw new I("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new I("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=e,o=this._nodes.values();!0!==(n=o.next()).done;)r=t(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var t=this._nodes.values();return new D((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,i){e[n++]=function(t,e){var n={key:t};return c(e.attributes)||(n.attributes=s({},e.attributes)),n}(i,t)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,r){i[n++]=function(t,e,n){var i={key:e,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=s({},n.attributes)),"mixed"===t&&n.undirected&&(i.undirected=!0),i}(t.type,r,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}},r.import=function(t){var e,n,r,o,a,s=this,h=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof i)return t.forEachNode((function(t,e){h?s.mergeNode(t,e):s.addNode(t,e)})),t.forEachEdge((function(t,e,n,i,r,o,a){h?a?s.mergeUndirectedEdgeWithKey(t,n,i,e):s.mergeDirectedEdgeWithKey(t,n,i,e):a?s.addUndirectedEdgeWithKey(t,n,i,e):s.addDirectedEdgeWithKey(t,n,i,e)})),this;if(!u(t))throw new I("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!u(t.attributes))throw new I("Graph.import: invalid attributes. Expecting a plain object.");h?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(r=t.nodes,!Array.isArray(r))throw new I("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=r.length;e<n;e++){vt(o=r[e]);var c=o,d=c.key,l=c.attributes;h?this.mergeNode(d,l):this.addNode(d,l)}}if(t.edges){var p=!1;if("undirected"===this.type&&(p=!0),r=t.edges,!Array.isArray(r))throw new I("Graph.import: invalid edges. Expecting an array.");for(e=0,n=r.length;e<n;e++){yt(a=r[e]);var f=a,g=f.source,v=f.target,y=f.attributes,m=f.undirected,b=void 0===m?p:m;"key"in a?(h?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,v,y):(h?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,v,y)}}return this},r.nullCopy=function(t){var e=new i(s({},this._options,t));return e.replaceAttributes(s({},this.getAttributes())),e},r.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var i=s({},t.attributes);t=new e.NodeDataClass(n,i),e._nodes.set(n,t)})),e},r.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new j('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new j("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 t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new j("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 e,n,i=this.emptyCopy(t),r=this._edges.values();!0!==(e=r.next()).done;)St(i,"copy",!1,(n=e.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 e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var i={},r={};this._edges.forEach((function(t,n){var o,a=t.undirected?"--":"->",s="",h=t.source.key,u=t.target.key;t.undirected&&h>u&&(o=h,h=u,u=o);var c="(".concat(h,")").concat(a,"(").concat(u,")");n.startsWith("geid_")?e.multi&&(void 0===r[c]?r[c]=0:r[c]++,s+="".concat(r[c],". ")):s+="[".concat(n,"]: "),i[s+=c]=t.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!xt.has(a)&&"function"!=typeof this[a]&&"symbol"!==t(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&&(Mt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Mt.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),i="add"===e?St:Et;t.generateKey?Mt.prototype[n]=function(r,o,a){return i(this,n,!0,"undirected"===(t.type||this.type),null,r,o,a,"update"===e)}:Mt.prototype[n]=function(r,o,a,s){return i(this,n,!1,"undirected"===(t.type||this.type),r,o,a,s,"update"===e)}}))})),function(t){K.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Node"),0),i(t,n("Source"),1),i(t,n("Target"),2),i(t,n("Opposite"),3)}))}(Mt),function(t){Z.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Edge"),"mixed"),i(t,n("DirectedEdge"),"directed"),i(t,n("UndirectedEdge"),"undirected")}))}(Mt),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):T(t._edges.keys(),t._edges.size);for(var n,i,r="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(r),a="undirected"===e,s=t._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){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,i){var r=[];return ht(!1,t,e,n,i,(function(t){r.push(t)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,r){var o=[];return ut(!1,t,e,n,i,r,(function(t){o.push(t)})),o}(i,this.multi,r,a,e)}throw new I("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return st(!1,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!1,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!1,i,this.multi,r,s,e,n)}throw new I("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);t.prototype[a]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),t=new Array(r);var a=0;e.push((function(e,i,r,o,s,h,u){t[a++]=n(e,i,r,o,s,h,u)}))}else t=[],e.push((function(e,i,r,o,a,s,h){t.push(n(e,i,r,o,a,s,h))}));return this[o].apply(this,e),t};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,i,r,o,a,s,h){e(t,i,r,o,a,s,h)&&n.push(t)})),this[o].apply(this,t),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[h]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new I("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 I("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?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var i=e;return n.push((function(e,n,r,o,a,s,h){i=t(i,e,n,r,o,a,s,h)})),this[o].apply(this,n),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return st(!0,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!0,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!0,i,this.multi,r,s,e,n)}throw new I("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);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,a,s){return e(t,n,i,r,o,a,s)})),!!this[o].apply(this,t)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,a,s){return!e(t,n,i,r,o,a,s)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return D.empty();if(!arguments.length)return function(t,e){if(0===t.size)return D.empty();var n="mixed"!==e&&e!==t.type,i="undirected"===e,r=t._edges.values();return new D((function(){for(var t,e;;){if((t=r.next()).done)return t;if(e=t.value,!n||e.undirected===i)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,i);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var i=D.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(i=Q(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=Q(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=Q(i,it(n.undirected))),i}(i,r,n)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i){var r=D.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&i in n.in&&(r=Q(r,at(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(r=Q(r,at(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,at(n.undirected,i))),r}(i,r,a,e)}throw new I("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(Mt),function(t){ct.forEach((function(e){(function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var i=[];return pt(!1,t,e,n,(function(t){i.push(t)})),i}("mixed"===i?this.type:i,r,e)}})(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));pt(!1,"mixed"===i?this.type:i,r,n,e)}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,i){n.push(e(t,i))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,i){e(t,i)&&n.push(t)})),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[h]=function(t,e,n){if(arguments.length<3)throw new I("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](t,(function(t,n){i=e(i,t,n)})),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;t.prototype[a]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new U("Graph.".concat(a,': could not find the "').concat(t,'" node in the graph.'));return pt(!0,"mixed"===i?this.type:i,r,n,e)}};var s="some"+o;t.prototype[s]=function(t,e){return!!this[a](t,e)};var h="every"+o;t.prototype[h]=function(t,e){return!this[a](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return D.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return ft(null,n,n.undirected);if("string"==typeof e)return ft(null,n,n[e])}var i=D.empty(),r=new dt;return"undirected"!==t&&("out"!==e&&(i=Q(i,ft(r,n,n.in))),"in"!==e&&(i=Q(i,ft(r,n,n.out)))),"directed"!==t&&(i=Q(i,ft(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,e)}}(t,e)}))}(Mt);var At=function(t){function n(e){var n=s({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new I("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new I('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Nt=function(t){function n(e){var n=s({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new I("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new I('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Lt=function(t){function n(e){var n=s({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(Mt),Dt=function(t){function n(e){var n=s({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new I('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Gt=function(t){function n(e){var n=s({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new I('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt);function Pt(t){t.from=function(e,n){var i=s({},e.options,n),r=new t(i);return r.import(e),r}}return Pt(Mt),Pt(At),Pt(Nt),Pt(Lt),Pt(Dt),Pt(Gt),Mt.Graph=Mt,Mt.DirectedGraph=At,Mt.UndirectedGraph=Nt,Mt.MultiGraph=Lt,Mt.MultiDirectedGraph=Dt,Mt.MultiUndirectedGraph=Gt,Mt.InvalidArgumentsGraphError=I,Mt.NotFoundGraphError=U,Mt.UsageGraphError=j,Mt}()}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function t(t,e,n,i){var r=document.createElement("button");return r.setAttribute("data-tooltip",n),r.innerHTML=t,i&&(r.className=i),r.addEventListener("click",e),r}n.r(i),n.d(i,{ForceAtlasAnimator:()=>ht,GraphManager:()=>Bt,GraphView:()=>It,LinearAnimator:()=>Rt,MultiResolutionGraph:()=>oe,default:()=>ae,downloadSVG:()=>bt,exportGraphToSVG:()=>mt,getLayoutSettings:()=>xt,initialGraphLayout:()=>dt,relativeComponentLayout:()=>it});var e=n(186),r=n.n(e),o=n(803);function a(){var t=10,e=50,n=1e4,i=1e-4;function r(t,e,n,i){t[e+2]+=i,t[n+2]-=i}function o(t,e,n,i){t[e+3]+=i,t[n+3]-=i}function a(t,n,i,a,s,h){var u,c=t[n+0]-t[i+0],d=t[n+1]-t[i+1],l=c*c+d*d,p=t[n+8]+t[i+8],f=Math.sqrt(c*c+d*d)-p,g=Math.sqrt(l),v=a*t[n+6]*t[i+6];if(s){var y=null!=h?h:150*Math.sqrt(a);u=f>0?v/(g*f*(1+f/y)):e*v}else u=f>0?v/(g*f):e*v;r(t,n,i,c*u),o(t,n,i,d*u)}function s(t,e,n,i,a,s,h){void 0===h&&(h=2);var u=t[e+0]-t[n+0],c=t[e+1]-t[n+1],d=u*u+c*c;if(d>0){var l,p=Math.sqrt(d),f=i*t[e+6]*t[n+6];r(t,e,n,u*(l=a?f/((1+p/(null!=s?s:150*Math.sqrt(i)))*Math.pow(p,h)):f/Math.pow(p,h))),o(t,e,n,c*l)}}var h=function(t,e){var n=t?a:s;return function(t,i,r,o,a){return n(t,i,r,o,e,a)}};function u(e,n,i){var r,o=e.scalingRatio,a=e.adjustSizes,s=null!==(r=e.decayRepulsion)&&void 0!==r&&r,u=e.barnesHutThreshold,c=e.barnesHutTheta;i.forEach((function(e){if(e.length>=u)!function(e,n,i,r,o,a){void 0===a&&(a=!1),n.length;var s=function(e,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*t;s=Math.min(s,e[i+0]),h=Math.max(h,e[i+0]),u=Math.min(u,e[i+1]),c=Math.max(c,e[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 p=1;return n.forEach((function(n){var s=n*t,h=0;for(o=3;;){if(!(a[h+5]>=0)){if(a[h+0]<0){a[h+0]=s;break}a[h+5]=9*p;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,p+=4,i=e[a[h+0]+0]<a[h+1]?e[a[h+0]+1]<a[h+2]?a[h+5]:a[h+5]+9:e[a[h+0]+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+6]=e[a[h+0]+6],a[h+7]=e[a[h+0]+0],a[h+8]=e[a[h+0]+1],a[i+0]=a[h+0],a[h+0]=-1,r=e[s+0]<a[h+1]?e[s+1]<a[h+2]?a[h+5]:a[h+5]+9:e[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=e[s+0]<a[h+1]?e[s+1]<a[h+2]?a[h+5]:a[h+5]+9:e[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+7]=(a[h+7]*a[h+6]+e[s+0]*e[s+6])/(a[h+6]+e[s+6]),a[h+8]=(a[h+8]*a[h+6]+e[s+1]*e[s+6])/(a[h+6]+e[s+6]),a[h+6]+=e[s+6],h=i}})),a}(e,n),h=b(e,n);n.forEach((function(n){for(var u=n*t,c=0;;)if(s[c+5]>=0){var d=Math.pow(e[u+0]-s[c+7],2)+Math.pow(e[u+1]-s[c+8],2),l=s[c+3];if(4*l*l/d<o){var p=e[u+0]-s[c+7],f=e[u+1]-s[c+8],g=void 0,v=i*e[u+6]*s[c+6],y=Math.sqrt(d);if(!0===r?(b=y-2*e[u+8])>0?(g=a?v/(y*b*(1+b/h)):v/(b*y),e[u+2]+=p*g,e[u+3]+=f*g):b<0&&(g=v/Math.sqrt(d),e[u+2]+=p*g,e[u+3]+=f*g):d>0&&(g=a?v/((1+y/h)*d):v/d,e[u+2]+=p*g,e[u+3]+=f*g),(c=s[c+4])<0)break;continue}c=s[c+5]}else{var m=s[c+0];if(m>=0&&m!==u)if(d=(p=e[u+0]-e[m+0])*p+(f=e[u+1]-e[m+1])*f,y=Math.sqrt(d),g=void 0,v=i*e[u+6]*e[m+6],!0===r){var b=y-e[u+8]-e[m+8];Math.pow(b,2),b>0?(g=a?v/(y*b*(1+b/h)):v/(y*b),e[u+2]+=p*g,e[u+3]+=f*g):b<=0&&(g=2*v,e[u+2]+=p*g,e[u+3]+=f*g)}else d>0&&(g=a?v/((1+y/h)*d):v/d,e[u+2]+=p*g,e[u+3]+=f*g);if((c=s[c+4])<0)break}}))}(n,e,o,a,Math.pow(c,2),s);else{var i=h(a,s);!function(e,n,i,r){for(var o=b(e,n),a=0;a<n.length;a+=1)for(var s=n[a]*t,h=0;h<a;h+=1)r(e,s,n[h]*t,i,o)}(n,e,o,i)}}))}function c(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=-i;r(t,e,n,a*h),o(t,e,n,s*h)}function d(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s),u=-i*(h-t[e+8]-t[n+8])/h;r(t,e,n,a*u),o(t,e,n,s*u)}function l(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s);if(h>0){var u=-i*Math.log(1+h)/h;r(t,e,n,a*u),o(t,e,n,s*u)}}function p(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s)-t[e+8]-t[n+8];if(h>0){var u=-i*Math.log(1+h)/h;r(t,e,n,a*u),o(t,e,n,s*u)}}function f(t,e){var n=t[e+4]-t[e+2],i=t[e+5]-t[e+3];return t[e+6]*Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function g(t,e){var n=t[e+4]+t[e+2],i=t[e+5]+t[e+3];return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2}function v(n,i,r,o){for(var a=n.adjustSizes,s=n.maxForce?n.maxForce:e,h=0;h<i.length;h+=t)i[h+4]=i[h+2],i[h+5]=i[h+3],i[h+2]=0,i[h+3]=0;u(n,i,o);for(var v=r.length,y=0;y<v;y+=3){var m=r[y+0],b=r[y+1],w=r[y+2];!0===a?n.linLogMode?p(i,m,b,w):d(i,m,b,w):n.linLogMode?l(i,m,b,w):c(i,m,b,w)}if(!0===a){for(h=0;h<i.length;h+=t)if(1!==i[h+9]){var x=Math.sqrt(Math.pow(i[h+2],2)+Math.pow(i[h+3],2));x>s&&(i[h+2]=i[h+2]*e/x,i[h+3]=i[h+3]*e/x);var _=f(i,h),C=g(i,h),S=1+Math.sqrt(_),E=i[h+7]*Math.log(1+C)*.5/S;i[h+7]=Math.min(1,Math.sqrt(E*(Math.pow(i[h+2],2)+Math.pow(i[h+3],2))/S));var k=E/n.slowDown;i[h+0]+=i[h+2]*k,i[h+1]+=i[h+3]*k}}else for(h=0;h<i.length;h+=t)if(1!==i[h+9]){_=f(i,h),C=g(i,h),S=1+Math.sqrt(_),E=i[h+7]*Math.log(1+C)/S,i[h+7]=Math.min(1,Math.sqrt(E*(Math.pow(i[h+2],2)+Math.pow(i[h+3],2))/S)),k=E/n.slowDown;var M=i[h+2]*k,A=i[h+3]*k;isFinite(M)&&isFinite(A)?(i[h+0]+=M,i[h+1]+=A):(i[h+2]=0,i[h+3]=0,i[h+4]=0,i[h+5]=0)}return{}}var y=function(t,e,n,i){for(var r=e.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=e[3*u+0],d=e[3*u+1],l=t[c+8],p=t[d+8],f=t[c+0]-t[d+0],g=t[c+1]-t[d+1],v=(l+p)*i/Math.sqrt(Math.pow(f,2)+Math.pow(g,2));v>a&&(a=v),v>1&&o++}return{fracEdgesTooShort:o/Math.min(n,r),maxShortnessRatio:a}},m=function(e){for(var n=0,i=0,r=0,o=0,a=e.length,s=0;s<a;s+=t)e[s+0]<n&&(n=e[s+0]),e[s+0]>i&&(i=e[s+0]),e[s+1]<r&&(r=e[s+1]),e[s+1]>o&&(o=e[s+1]);var h=i-n,u=o-r;return{xDim:Math.max(h,1),yDim:Math.max(u,1)}},b=function(e,n){var i=function(e,n){var i=0,r=0,o=0,a=0;n.forEach((function(n){var s=n*t;e[s+0]<i&&(i=e[s+0]),e[s+0]>r&&(r=e[s+0]),e[s+1]<o&&(o=e[s+1]),e[s+1]>a&&(a=e[s+1])}));var s=r-i,h=a-o;return{xDim:Math.max(s,.1),yDim:Math.max(h,.1)}}(e,n),r=i.xDim,o=i.yDim;return Math.max(Math.max(r,o)/2,150)},w=function(e,n,i){n.forEach((function(n){n.forEach((function(n){var r=n;e[r*t+0]=e[r*t+0]*i,e[r*t+1]=e[r*t+1]*i}))}))},x=function(t,e,r,o,a){var s=m(t),h=s.xDim,u=s.yDim,c=Math.max(r/h,o/u);w(t,e,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?v(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||e,s.warmupLayout){var p=s.adjustSizes;s.adjustSizes=!1;var f=s.decayRepulsion;s.decayRepulsion=!1;for(var g=0;g<h/5;g++)v(s,r,o,a);x(r,a,d,l,s);for(var b=0;b<r.length;b+=t)r[b+2]=0,r[b+3]=0;s.adjustSizes=p,s.decayRepulsion=f,s.warmupLayout=!1}for(var _=u,C=0;C<_-1;C++){for(g=0;g<h/_;g++)v(s,r,o,a);if(s.adjustSizes){var S=y(r,o,2e3,1.2),E=S.fracEdgesTooShort,k=S.maxShortnessRatio;if(E>.002){var M=Math.min(k,5),A=Math.pow(M,2);s.scalingRatio=Math.max(Math.min(s.scalingRatio*A,n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,M)}else{var N=m(r),L=N.xDim,D=N.yDim,G=Math.min(d/L,l/D),P=Math.max(G,Math.min(k,1));s.scalingRatio=Math.max(Math.min(s.scalingRatio*Math.pow(P,2),n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,P)}}else x(r,a,d,l,s),console.log("scalingRatio",s.scalingRatio);for(b=0;b<r.length;b+=t)r[b+2]=0,r[b+3]=0}for(g=0;g<h/_;g++)v(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 s={value:()=>{}};function h(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new u(i)}function u(t){this._=t}function c(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function d(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=s,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}u.prototype=h.prototype={constructor:u,on:function(t,e){var n,i,r=this._,o=(i=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!i.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)r[n]=d(r[n],t.name,e);else if(null==e)for(n in r)r[n]=d(r[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=c(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new u(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(o=0,n=(i=this._[t]).length;o<n;++o)i[o].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};const l=h;var p,f,g=0,v=0,y=0,m=0,b=0,w=0,x="object"==typeof performance&&performance.now?performance:Date,_="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function C(){return b||(_(S),b=x.now()+w)}function S(){b=0}function E(){this._call=this._time=this._next=null}function k(t,e,n){var i=new E;return i.restart(t,e,n),i}function M(){b=(m=x.now())+w,g=v=0;try{!function(){C(),++g;for(var t,e=p;e;)(t=b-e._time)>=0&&e._call.call(void 0,t),e=e._next;--g}()}finally{g=0,function(){for(var t,e,n=p,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:p=e);f=t,N(i)}(),b=0}}function A(){var t=x.now(),e=t-m;e>1e3&&(w-=e,m=t)}function N(t){g||(v&&(v=clearTimeout(v)),t-b>24?(t<1/0&&(v=setTimeout(M,t-x.now()-w)),y&&(y=clearInterval(y))):(y||(m=x.now(),y=setInterval(A,1e3)),g=1,_(M)))}E.prototype=k.prototype={constructor:E,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?C():+n)+(null==e?0:+e),this._next||f===this||(f?f._next=this:p=this,f=this),this._call=t,this._time=n,N()},stop:function(){this._call&&(this._call=null,this._time=1/0,N())}};const L=4294967296;function D(t){return t.x}function G(t){return t.y}var P=Math.PI*(3-Math.sqrt(5));function F(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,h=k(d),u=l("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%L)/L}();function d(){p(),u.call("tick",e),n<i&&(h.stop(),u.call("end",e))}function p(i){var h,u,c=t.length;void 0===i&&(i=1);for(var d=0;d<i;++d)for(n+=(o-n)*r,s.forEach((function(t){t(n)})),h=0;h<c;++h)null==(u=t[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 e}function f(){for(var e,n=0,i=t.length;n<i;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var r=10*Math.sqrt(.5+n),o=n*P;e.x=r*Math.cos(o),e.y=r*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,c),e}return null==t&&(t=[]),f(),e={tick:p,restart:function(){return h.restart(d),e},stop:function(){return h.stop(),e},nodes:function(n){return arguments.length?(t=n,f(),s.forEach(g),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(i=+t,e):i},alphaDecay:function(t){return arguments.length?(r=+t,e):+r},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(c=t,s.forEach(g),e):c},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,g(n)),e):s.get(t)},find:function(e,n,i){var r,o,a,s,h,u=0,c=t.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=e-(s=t[u]).x)*r+(o=n-s.y)*o)<i&&(h=s,i=a);return h},on:function(t,n){return arguments.length>1?(u.on(t,n),e):u.on(t)}}}function B(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o,a,s,h,u,c,d,l,p=t._root,f={data:i},g=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((u=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(v+m)/2))?v=a:m=a,r=p,!(p=p[d=c<<1|u]))return r[d]=f,t;if(s=+t._x.call(null,p.data),h=+t._y.call(null,p.data),e===s&&n===h)return f.next=p,r?r[d]=f:t._root=f,t;do{r=r?r[d]=new Array(4):t._root=new Array(4),(u=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(v+m)/2))?v=a:m=a}while((d=c<<1|u)==(l=(h>=a)<<1|s>=o));return r[l]=p,r[d]=f,t}function z(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function R(t){return t[0]}function O(t){return t[1]}function T(t,e,n){var i=new V(null==e?R:e,null==n?O:n,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function V(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function I(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var U=T.prototype=V.prototype;function j(t){return function(){return t}}function H(t){return 1e-6*(t()-.5)}function W(){var t,e,n,i,r,o=j(-30),a=1,s=1/0,h=.81;function u(n){var r,o=t.length,a=T(t,D,G).visitAfter(d);for(i=n,r=0;r<o;++r)e=t[r],a.visit(l)}function c(){if(t){var e,n,i=t.length;for(r=new Array(i),e=0;e<i;++e)n=t[e],r[n.index]=+o(n,e,t)}}function d(t){var e,n,i,o,a,s=0,h=0;if(t.length){for(i=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,h+=n,i+=n*e.x,o+=n*e.y);t.x=i/h,t.y=o/h}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=r[e.data.index]}while(e=e.next)}t.value=s}function l(t,o,u,c){if(!t.value)return!0;var d=t.x-e.x,l=t.y-e.y,p=c-o,f=d*d+l*l;if(p*p/h<f)return f<s&&(0===d&&(f+=(d=H(n))*d),0===l&&(f+=(l=H(n))*l),f<a&&(f=Math.sqrt(a*f)),e.vx+=d*t.value*i/f,e.vy+=l*t.value*i/f),!0;if(!(t.length||f>=s)){(t.data!==e||t.next)&&(0===d&&(f+=(d=H(n))*d),0===l&&(f+=(l=H(n))*l),f<a&&(f=Math.sqrt(a*f)));do{t.data!==e&&(p=r[t.data.index]*i/f,e.vx+=d*p,e.vy+=l*p)}while(t=t.next)}}return u.initialize=function(e,i){t=e,n=i,c()},u.strength=function(t){return arguments.length?(o="function"==typeof t?t:j(+t),c(),u):o},u.distanceMin=function(t){return arguments.length?(a=t*t,u):Math.sqrt(a)},u.distanceMax=function(t){return arguments.length?(s=t*t,u):Math.sqrt(s)},u.theta=function(t){return arguments.length?(h=t*t,u):Math.sqrt(h)},u}function Y(t){var e,n,i,r=j(.1);function o(t){for(var r,o=0,a=e.length;o<a;++o)(r=e[o]).vx+=(i[o]-r.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+t(e[o],o,e))?0:+r(e[o],o,e)}}return"function"!=typeof t&&(t=j(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(r="function"==typeof t?t:j(+t),a(),o):r},o.x=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),a(),o):t},o}function X(t){var e,n,i,r=j(.1);function o(t){for(var r,o=0,a=e.length;o<a;++o)(r=e[o]).vy+=(i[o]-r.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+t(e[o],o,e))?0:+r(e[o],o,e)}}return"function"!=typeof t&&(t=j(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(r="function"==typeof t?t:j(+t),a(),o):r},o.y=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),a(),o):t},o}function q(t){return t.x+t.vx}function K(t){return t.y+t.vy}function Z(t){var e,n,i,r=1,o=1;function a(){for(var t,a,h,u,c,d,l,p=e.length,f=0;f<o;++f)for(a=T(e,q,K).visitAfter(s),t=0;t<p;++t)h=e[t],d=n[h.index],l=d*d,u=h.x+h.vx,c=h.y+h.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,p=t.r,f=d+p;if(!s)return e>u+f||o<u-f||n>c+f||a<c-f;if(s.index>h.index){var g=u-s.x-s.vx,v=c-s.y-s.vy,y=g*g+v*v;y<f*f&&(0===g&&(y+=(g=H(i))*g),0===v&&(y+=(v=H(i))*v),y=(f-(y=Math.sqrt(y)))/y*r,h.vx+=(g*=y)*(f=(p*=p)/(l+p)),h.vy+=(v*=y)*f,s.vx-=g*(f=1-f),s.vy-=v*f)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var i,r,o=e.length;for(n=new Array(o),i=0;i<o;++i)r=e[i],n[r.index]=+t(r,i,e)}}return"function"!=typeof t&&(t=j(null==t?1:+t)),a.initialize=function(t,n){e=t,i=n,h()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(r=+t,a):r},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),h(),a):t},a}function J(t,e){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-t)*i,h=(h/a-e)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=h}return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r.strength=function(t){return arguments.length?(i=+t,r):i},r}function $(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Q(t,e){return t[0]-e[0]||t[1]-e[1]}function tt(t){const e=t.length,n=[0,1];let i,r=2;for(i=2;i<e;++i){for(;r>1&&$(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}U.copy=function(){var t,e,n=new V(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=I(i),n;for(t=[{source:i,target:n._root=new Array(4)}];i=t.pop();)for(var r=0;r<4;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(4)}):i.target[r]=I(e));return n},U.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return B(this.cover(e,n),e,n,t)},U.addAll=function(t){var e,n,i,r,o=t.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,e=t[n]))||isNaN(r=+this._y.call(null,e))||(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)B(this,a[n],s[n],t[n]);return this},U.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,o=(i=Math.floor(e))+1;else{for(var a,s,h=r-n||1,u=this._root;n>t||t>=r||i>e||e>=o;)switch(s=(e<i)<<1|t<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},U.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},U.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},U.find=function(t,e,n){var i,r,o,a,s,h,u,c=this._x0,d=this._y0,l=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new z(g,c,d,l,p)),null==n?n=1/0:(c=t-n,d=e-n,l=t+n,p=e+n,n*=n);h=f.pop();)if(!(!(g=h.node)||(r=h.x0)>l||(o=h.y0)>p||(a=h.x1)<c||(s=h.y1)<d))if(g.length){var v=(r+a)/2,y=(o+s)/2;f.push(new z(g[3],v,y,a,s),new z(g[2],r,y,v,s),new z(g[1],v,o,a,y),new z(g[0],r,o,v,y)),(u=(e>=y)<<1|t>=v)&&(h=f[f.length-1],f[f.length-1]=f[f.length-1-u],f[f.length-1-u]=h)}else{var m=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),w=m*m+b*b;if(w<n){var x=Math.sqrt(n=w);c=t-x,d=e-x,l=t+x,p=e+x,i=g.data}}return i},U.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,i,r,o,a,s,h,u,c,d,l,p=this._root,f=this._x0,g=this._y0,v=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((u=o>=(s=(f+v)/2))?f=s:v=s,(c=a>=(h=(g+y)/2))?g=h:y=h,e=p,!(p=p[d=c<<1|u]))return this;if(!p.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(n=e,l=d)}for(;p.data!==t;)if(i=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,i?(r?i.next=r:delete i.next,this):e?(r?e[d]=r:delete e[d],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[l]=p:this._root=p),this):(this._root=r,this)},U.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},U.root=function(){return this._root},U.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},U.visit=function(t){var e,n,i,r,o,a,s=[],h=this._root;for(h&&s.push(new z(h,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(h=e.node,i=e.x0,r=e.y0,o=e.x1,a=e.y1)&&h.length){var u=(i+o)/2,c=(r+a)/2;(n=h[3])&&s.push(new z(n,u,c,o,a)),(n=h[2])&&s.push(new z(n,i,c,u,a)),(n=h[1])&&s.push(new z(n,u,r,o,c)),(n=h[0])&&s.push(new z(n,i,r,u,c))}return this},U.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new z(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var r=e.node;if(r.length){var o,a=e.x0,s=e.y0,h=e.x1,u=e.y1,c=(a+h)/2,d=(s+u)/2;(o=r[0])&&n.push(new z(o,a,s,c,d)),(o=r[1])&&n.push(new z(o,c,s,h,d)),(o=r[2])&&n.push(new z(o,a,d,c,u)),(o=r[3])&&n.push(new z(o,c,d,h,u))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},U.x=function(t){return arguments.length?(this._x=t,this):this._x},U.y=function(t){return arguments.length?(this._y=t,this):this._y};var et=10,nt=function(t){for(var e=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=0;o<t.length;o+=et)t[o+0]<e&&(e=t[o+0]),t[o+0]>n&&(n=t[o+0]),t[o+1]<i&&(i=t[o+1]),t[o+1]>r&&(r=t[o+1]);var a=(e+n)/2,s=(i+r)/2;for(o=0;o<t.length;o+=et)t[o+0]-=a,t[o+1]-=s},it=function(t,e,n,i,r){void 0===i&&(i=[650,410]),void 0===r&&(r=!1),console.time("component layout"),nt(t);var o=i[0],a=i[1],s=r?e.filter((function(t){return t.length>1})):e,h=r?e.filter((function(t){return t.length<=1})):[],u=h.length,c=s.reduce((function(t,e){return t+e.length}),0),d=Math.max(.04,u/(u+5*c)),l=.9*a,p=d*o;console.time("pack singletons");var f=function(t,e,n,i,r){var o={};t.forEach((function(t,e){t.forEach((function(t){o[t]=e}))}));var a,s=0,h=t.map((function(t,n){if(0==t.length)return 5;var i=e[t[0]*et+8];return s+=i,i})),u=Math.min(3*s,r),c=Math.min(3*s,i);if(r>i){var d=t.map((function(e,n){var i=Object.create(e);return i.radius=1.5*h[n],i.target=-u/2+n/t.length*u,i}));return(a=F(d).force("charge",W().strength(-1)).force("center",J(0,0)).force("gravityX",Y().strength(u/c*.2)).force("yPos",X().y((function(t){return t.target})).strength(.5)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:t.map((function(t){return t.map((function(t){return t}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}return d=t.map((function(e,n){var i=Object.create(e);return i.radius=h[n],i.target=-c/2+n/t.length*c,i})),(a=F(d).force("charge",W().strength(-1)).force("center",J(0,0)).force("gravityY",X().strength(.2*c/u)).force("xPos",Y().x((function(t){return t.target})).strength(.5)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:t.map((function(t){return t.map((function(t){return t}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}(h,t,n,p,l);console.timeEnd("pack singletons");var g=Number.MAX_VALUE,v=-Number.MAX_VALUE,y=Number.MAX_VALUE,m=-Number.MAX_VALUE;f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=t[e*et+8];v=Math.max(i+o,v),g=Math.min(i-o,g),m=Math.max(r+o,m),y=Math.min(r-o,y)}));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));f.vertices.map((function(t){var e=f.node_to_component_id[t];f.components_to_circle_pack[e].x*=x,f.components_to_circle_pack[e].y*=x})),w*=x}console.log("adjustedSingletonWidth",w);var _=o-w,C=_/a,S=s.map((function(e){var n=function(t,e){var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE;return t.forEach((function(t){var a=t,s=e[a*et+0],h=e[a*et+1],u=e[a*et+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}}(e,t),i=n.minX,r=n.maxX,o=n.minY;return(r-i)/(n.maxY-o)}));console.log("remainingAspectRatio",C),s.forEach((function(e,n){var i=S[n];(i>=1.1&&C<=.9||i<=.9&&C>=1.1)&&e.forEach((function(e){var n=e,i=t[n*et+0],r=t[n*et+1];t[n*et+0]=-r,t[n*et+1]=i}))})),console.time("pack components");var E=function(t,e,n,i,r){var o=t.map((function(t){return t.map((function(t){var n=t*et;return[e[n+0],e[n+1]]}))})),a=o.map((function(t){return function(t){if((n=t.length)<3)return null;var e,n,i=new Array(n),r=new Array(n);for(e=0;e<n;++e)i[e]=[+t[e][0],+t[e][1],e];for(i.sort(Q),e=0;e<n;++e)r[e]=[i[e][0],-i[e][1]];var o=tt(i),a=tt(r),s=a[0]===o[0],h=a[a.length-1]===o[o.length-1],u=[];for(e=o.length-1;e>=0;--e)u.push(t[i[o[e]][2]]);for(e=+s;e<a.length-h;++e)u.push(t[i[a[e]][2]]);return u}(t)})),s=a.map((function(t,e){if(null===t){var n=o[e];return 1===n.length?n[0]:[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]}return function(t){for(var e,n,i=-1,r=t.length,o=0,a=0,s=t[r-1],h=0;++i<r;)e=s,s=t[i],h+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(h*=3),a/h]}(t)})),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=t[i][0];a=Math.max(e[u*et+8]+2,6)}else{var c=h[1][0]-h[0][0],d=h[1][1]-h[0][1],l=t[i][0],p=t[i][1],f=e[l*et+8],g=e[p*et+8];a=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))/2+f+g}}else for(var v=0;v<n.length;v+=1){var y=n[v],m=(c=y[0]-r[0],d=y[1]-r[1],u=t[i][v],e[u*et+8]),b=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))+m;a=Math.max(b,a)}return Math.round(a)})),u=h.map((function(t,e){return[t,e]})).sort((function(t,e){return t[0]-e[0]})),c=function(t){return Math.max(3*t*Math.exp(t*Math.log(1/3)/500),.9*t,t-300)},d=0;u.map((function(e){var n=e[0],i=e[1],r=(t[i].length,c(n)),o=4*Math.pow(r,2);d+=o})),console.log("graphArea",d);var l=Math.sqrt(d/(i*r)),p=i*l,f=r*l;console.log("xExtent",p),console.log("yExtent",f);var g=0,v=u.map((function(e){var n=e[0],i=e[1],r=t[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=p*g/d,o.x=o.target,o.y=(f/2-a)*(2/Math.PI)*Math.asin(Math.sin(2*Math.PI*(d/s)*o.x)),g+=.5*s,o})),y=F(v).force("charge",W().strength((function(t){return-.005*d/Math.pow(t.radius,2)}))).force("xPos",Y().x((function(t){return t.target})).strength(.9)).force("gravityY",X().strength(.3)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5));y.stop(),y.tick(n);var m=t.map((function(t){return t.map((function(t){return t}))})).flat(),b={};return u.forEach((function(e,n){e[0];var i=e[1];t[i].forEach((function(t){b[t]=n}))})),{vertices:m,node_to_component_id:b,components_to_circle_pack:v,polygon_centroids_initial:s}}(s,t,n,_,a);console.timeEnd("pack components");var k=Number.MAX_VALUE,M=-Number.MAX_VALUE,A=Number.MAX_VALUE,N=-Number.MAX_VALUE;if(E.components_to_circle_pack.forEach((function(e,n){var i=e.componentID;e.forEach((function(n){var r=E.polygon_centroids_initial[i],o=e.x+t[n*et+0]-r[0],a=e.y+t[n*et+1]-r[1];t[n*et+0]=o,t[n*et+1]=a;var s=t[n*et+8];M=Math.max(M,o+s),k=Math.min(k,o-s),N=Math.max(N,a+s),A=Math.min(A,a-s)}))})),0===c)f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=p/(v-g),a=l/(m-y);t[e*et+0]=i*o,t[e*et+1]=r*a}));else{var L=(N+A)/2,D=(M-k)/_,G=D*p/(v-g),P=D*l/(m-y);console.log("singleton scale factors",G,P),v=-1/0,g=1/0,f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=k-i*G;t[e*et+0]=o;var a=L+r*P;t[e*et+1]=a;var s=t[e*et+8];v=Math.max(o+s,v),g=Math.min(o-s,g)}));var B=v-k+.1*(v-g);f.vertices.forEach((function(e){t[e*et+0]-=B}))}nt(t),console.timeEnd("component layout")},rt=function(){return rt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},rt.apply(this,arguments)},ot=n(739),at=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!0);var i=new Float32Array(t.order*et),r=new Float32Array(3*t.size),o={},a=0;return t.forEachNode((function(t,e){o[t]=a,i[a+0]=e.x,i[a+1]=e.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]=e.size,i[a+9]=e.fixed?1:0,a+=et})),a=0,t.forEachEdge((function(t,s,h,u,c,d,l){var p=o[h],f=o[u],g=e&&s.weight||1;n&&(i[p+6]+=g,i[f+6]+=g),r[a+0]=p,r[a+1]=f,r[a+2]=g,a+=3})),{nodes:i,edges:r}},st=function(t,e){var n=0;t.updateEachNodeAttributes((function(t,i){var r=i.fixed?i:rt(rt({},i),{x:e[n+0],y:e[n+1]});return n+=et,r}))},ht=function(){function t(t,e,n){var i=this;this.graph=t,this.graphComponents=(0,o.kS)(t).map((function(t){return t.map(Number)})),this.params=e,this.frameID=null,this.nextWorkerSeqId=null,this.workerTimerId=null,this.running=!1,this.graphArrays=at(t),this.graphArrays&&this.updateNodePropsArrays(this.graphArrays),this.worker=ot.createWorker(a),this.worker.onmessage=function(t){return i.onWorkerMessage(t)},this.worker.onerror=function(t){return i.onWorkerError(t)},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 t.prototype.isRunning=function(){return this.running},t.prototype.resetNIters=function(){this.niters=0},t.prototype.updateNodePropsArrays=function(t){var e=0,n=t;return this.graph.forEachNode((function(t,i){i.fixed&&(n.nodes[e+0]=i.x,n.nodes[e+1]=i.y,n.nodes[e+2]=0,n.nodes[e+3]=0),n.nodes[e+9]=i.fixed?1:0,e+=et})),n},t.prototype.forceNodePositionUpdate=function(){this.frameID||this.workerRunning?this.shouldUpdateLayoutArrays=!0:this.updateLayoutArrayNodePositions()},t.prototype.updateLayoutArrayNodePositions=function(){var t=this.graphArrays;if(t){var e=0;this.graph.forEachNode((function(n,i){t.nodes[e+0]=i.x,t.nodes[e+1]=i.y,t.nodes[e+2]=0,t.nodes[e+3]=0,t.nodes[e+4]=0,t.nodes[e+5]=0,e+=et}))}},t.prototype.hasConverged=function(){var t=0;if(!this.graphArrays)return!1;for(t=0;t<this.graphArrays.nodes.length;t+=et)if(this.graphArrays.nodes[t+7]>this.convergenceThreshold)return!1;return!0},t.prototype.onWorkerMessage=function(t){var e=t.data;this.graphArrays.nodes=new Float32Array(e.nodes),this.graphArrays.edges=new Float32Array(e.edges),this.graphArrays.nodes.length!=this.graph.order*et&&(console.log("graphArrays not the correct size. rebuilding."),this.graphArrays=at(this.graph)),this.positionsUpdated=!0,this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),this.workerRunning=!1,this.workerTimerId&&(window.clearTimeout(this.workerTimerId),this.workerTimerId=null)},t.prototype.onWorkerError=function(t){var e=this;console.log(t),this.worker.terminate(),this.worker=ot.createWorker(a),this.worker.onmessage=function(t){return e.onWorkerMessage(t)},this.worker.onerror=function(t){return e.onWorkerError(t)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.workerTimerId=null},t.prototype.runFrame=function(){var t=this;if(this.positionsUpdated&&!this.shouldUpdateLayoutArrays){st(this.graph,this.graphArrays.nodes);var e=0;this.graph.updateEachNodeAttributes((function(n,i){var r=rt(rt({},i),{trueX:Math.round(100*t.graphArrays.nodes[e*et+0])/100,trueY:Math.round(100*t.graphArrays.nodes[e*et+1])/100});return e++,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 t.onWorkerError("Worker timed out")}),500)}this.running&&(this.frameID=window.requestAnimationFrame((function(){return t.runFrame()})))},t.prototype.stop=function(){return this.running=!1,this.resetNIters(),null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},t.prototype.start=function(){this.running||(this.running=!0,this.runFrame())},t.prototype.kill=function(){this.stop(),this.workerTimerId&&window.clearTimeout(this.workerTimerId),this.worker.terminate()},t}(),ut=n(847),ct=n(739),dt=function(t,e,n){return void 0===n&&(n=!0),s=function(){var i,s,h,u,c,d,l,p;return function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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:if(!r()(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");if(i=e.iterations,s=(0,o.kS)(t).map((function(t){return t.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(h=ct.assign({},ut,e.settings),u=ct.validateSettings(h))throw new Error("graphology-layout-forceatlas2: ".concat(u.message));return c=at(t),l=ct.createWorker(a),p={iterations:i,settings:h,nodes:c.nodes.buffer,edges:c.edges.buffer,components:s,__messageId:"initialGraphLayout"},l.postMessage(p,[c.nodes.buffer,c.edges.buffer]),[4,new Promise((function(t){l.onmessage=function(e){t({nodes:new Float32Array(e.data.nodes),settings:e.data.settings}),l.terminate()}}))];case 1:return d=f.sent(),n&&it(d.nodes,s,100,h.expectedDims,h.layoutSingletonsSeparately),st(t,d.nodes),[2,d.settings]}}))},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{o(s.next(t))}catch(t){e(t)}}function r(t){try{o(s.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(t){t(o)}))).then(n,r)}o((s=s.apply(void 0,[])).next())}));var i,s},lt="\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",pt="\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",ft='\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',gt='\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',vt=function(){return vt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},vt.apply(this,arguments)},yt={width:1920,height:1080,padding:50,backgroundColor:"#ffffff",nodeStrokeWidth:0,edgeColor:"#bbbbbb",edgeWidth:1,includeLabels:!1,fontSize:12,fontFamily:"Arial, sans-serif"};function mt(t,e){void 0===e&&(e={});var n=vt(vt({},yt),e),i=1/0,r=1/0,o=-1/0,a=-1/0;t.forEachNode((function(t,e){var n=e.x||0,s=e.y||0,h=e.size||5;n-h<i&&(i=n-h),s-h<r&&(r=s-h),n+h>o&&(o=n+h),s+h>a&&(a=s+h)})),isFinite(i)||(i=0,r=0,o=100,a=100);var s=o-i,h=a-r,u=n.width-2*n.padding,c=n.height-2*n.padding,d=Math.min(u/s,c/h),l=n.padding-i*d+(u-s*d)/2,p=n.padding-r*d+(c-h*d)/2,f=[];f.push('<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(n.width,'" height="').concat(n.height,'" viewBox="0 0 ').concat(n.width," ").concat(n.height,'">')),f.push('<defs>\n <style type="text/css">\n <![CDATA[\n /* Edit these values to change appearance */\n .edge {\n stroke: '.concat(n.edgeColor,";\n stroke-width: ").concat(n.edgeWidth,";\n opacity: 0.5;\n }\n .node {\n /* Node colors are set individually via fill attribute */\n }\n .node-stroke {\n stroke: #000000;\n stroke-width: ").concat(n.nodeStrokeWidth,";\n }\n .label {\n font-size: ").concat(n.fontSize,"px;\n font-family: ").concat(n.fontFamily,";\n fill: #000000;\n }\n ]]>\n </style>\n </defs>")),f.push('<rect width="'.concat(n.width,'" height="').concat(n.height,'" fill="').concat(n.backgroundColor,'"/>')),f.push('<g id="graph">');var g=[];t.forEachEdge((function(e,i,r,o){var a=t.getNodeAttributes(r),s=t.getNodeAttributes(o),h=a.x||0,u=a.y||0,c=s.x||0,f=s.y||0,v=h*d+l,y=u*d+p,m=c*d+l,b=f*d+p,w=i.color&&i.color!==n.edgeColor,x=i.size&&i.size!==n.edgeWidth;if(w||x){var _=i.color||n.edgeColor,C=i.size||n.edgeWidth;g.push('<line class="edge" x1="'.concat(v,'" y1="').concat(y,'" x2="').concat(m,'" y2="').concat(b,'" stroke="').concat(_,'" stroke-width="').concat(C,'"/>'))}else g.push('<line class="edge" x1="'.concat(v,'" y1="').concat(y,'" x2="').concat(m,'" y2="').concat(b,'"/>'))})),f.push.apply(f,g);var v=[];return t.forEachNode((function(t,e){var i=e.x||0,r=e.y||0,o=(e.size||5)*d,a=e.color||"#999999",s=i*d+l,h=r*d+p,u=e.borderColor||"#000000",c=n.nodeStrokeWidth>0?"node node-stroke":"node",f="node-".concat(t);if(n.nodeStrokeWidth>0?v.push('<circle id="'.concat(f,'" class="').concat(c,'" cx="').concat(s,'" cy="').concat(h,'" r="').concat(o,'" fill="').concat(a,'" stroke="').concat(u,'"/>')):v.push('<circle id="'.concat(f,'" class="').concat(c,'" cx="').concat(s,'" cy="').concat(h,'" r="').concat(o,'" fill="').concat(a,'"/>')),n.includeLabels&&e.label){var g=String(e.label).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),y=h+n.fontSize/3;v.push('<text class="label" x="'.concat(s+o+3,'" y="').concat(y,'">').concat(g,"</text>"))}})),f.push.apply(f,v),f.push("</g>"),f.push("</svg>"),f.join("\n")}function bt(t,e){void 0===e&&(e="graph.svg");var n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)}var wt=[650,400],xt=function(t){return{linLogMode:!1,adjustSizes:!1,scalingRatio:t.size/t.order,slowDown:1+Math.log(t.order),barnesHutTheta:.7,barnesHutThreshold:1e3,nRepulsiveCycles:void 0,expectedDims:wt,layoutSingletonsSeparately:!1,decayRepulsion:!1}},_t=function(){function t(t){void 0===t&&(t=48),this.items=[],this.grid=new Map,this.cellSize=Math.max(1,t)}return t.prototype.clear=function(){this.items=[],this.grid.clear()},t.prototype.build=function(t){if(this.clear(),0!==t.length){this.items=t;for(var e=0;e<t.length;e+=1)for(var n=t[e],i=Math.floor((n.x-n.radius)/this.cellSize),r=Math.floor((n.x+n.radius)/this.cellSize),o=Math.floor((n.y-n.radius)/this.cellSize),a=Math.floor((n.y+n.radius)/this.cellSize),s=i;s<=r;s+=1)for(var h=o;h<=a;h+=1){var u="".concat(s,",").concat(h),c=this.grid.get(u);c?c.push(e):this.grid.set(u,[e])}}},t.prototype.pick=function(t){if(0===this.items.length)return null;var e=Math.floor(t.x/this.cellSize),n=Math.floor(t.y/this.cellSize),i=this.grid.get("".concat(e,",").concat(n));if(!i||0===i.length)return null;for(var r=null,o=Number.POSITIVE_INFINITY,a=0;a<i.length;a+=1){var s=i[a],h=this.items[s],u=h.x-t.x,c=h.y-t.y,d=Math.sqrt(u*u+c*c);d<=h.radius&&d<o&&(o=d,r=h.id)}return r},t}(),Ct=function(){return Ct=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Ct.apply(this,arguments)},St={x:[-1,1],y:[-1,1]};function Et(t,e){var n,i,r,o;if("string"!=typeof t||!t.length)return e;var a=t.match(/^#([0-9a-fA-F]{3,8})$/);if(a){var s=a[1];if(3===s.length||4===s.length){var h=s.split("").map((function(t){return parseInt(t+t,16)/255}));return[null!==(n=h[0])&&void 0!==n?n:0,null!==(i=h[1])&&void 0!==i?i:0,null!==(r=h[2])&&void 0!==r?r:0,4===s.length&&null!==(o=h[3])&&void 0!==o?o:1]}if(6===s.length||8===s.length)return[parseInt(s.slice(0,2),16)/255,parseInt(s.slice(2,4),16)/255,parseInt(s.slice(4,6),16)/255,8===s.length?parseInt(s.slice(6,8),16)/255:1]}var u=t.match(/^rgba?\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)(?:\s*,\s*([0-9.]+))?\s*\)$/i);return u?[Math.min(255,Number(u[1]))/255,Math.min(255,Number(u[2]))/255,Math.min(255,Number(u[3]))/255,void 0!==u[4]?Math.max(0,Math.min(1,Number(u[4]))):1]:e}function kt(t,e,n){var i=t.createShader(e);if(!i)return null;if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var r=e===t.VERTEX_SHADER?"VERTEX":"FRAGMENT",o=t.getShaderInfoLog(i)||"Unknown shader compile error";return console.error("GraphWebGLRenderer ".concat(r," shader compile error:"),o,n),t.deleteShader(i),null}return i}function Mt(t,e,n){var i=kt(t,t.VERTEX_SHADER,e),r=kt(t,t.FRAGMENT_SHADER,n);if(!i||!r)return null;var o=t.createProgram();if(!o)return null;if(t.attachShader(o,i),t.attachShader(o,r),t.linkProgram(o),t.deleteShader(i),t.deleteShader(r),!t.getProgramParameter(o,t.LINK_STATUS)){var a=t.getProgramInfoLog(o)||"Unknown program link error";return console.error("GraphWebGLRenderer program link error:",a),t.deleteProgram(o),null}return o}var At,Nt=function(){function t(t,e,n){var i=this;this.nodeProgram=null,this.edgeProgram=null,this.nodeBuffer=null,this.edgeBuffer=null,this.nodeSnapshots=[],this.edgeSnapshots=[],this.nodeFloatData=new Float32Array(0),this.edgeFloatData=new Float32Array(0),this.pickIndex=new _t(48),this.pickIndexDirty=!0,this.customBBox=null,this.camera={x:0,y:0,ratio:1,angle:0},this.pendingFrame=null,this.cameraAnimationFrame=null,this.hoverPickAnimationFrame=null,this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.nodeBufferUploadDirty=!0,this.edgeBufferUploadDirty=!0,this.destroyed=!1,this.listeners={},this.hoveredNode=null,this.pendingHoverPoint=null,this.resizeObserver=null,this.cssWidth=1,this.cssHeight=1,this.pixelRatio=1,this.removeWindowResizeListener=null,this.removeVisibilityListener=null,this.contextLossSignaled=!1,this.graphNodeStructureListener=function(){i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.pickIndexDirty=!0,i.refresh()},this.graphNodeAttributesListener=function(t){i.nodeDataDirty=!0,i.nodeAttributePayloadAffectsEdgeGeometry(t)&&(i.edgeDataDirty=!0),i.pickIndexDirty=!0,i.refresh()},this.graphEdgeStructureListener=function(){i.edgeDataDirty=!0,i.refresh()},this.graphEdgeAttributesListener=function(){i.edgeDataDirty=!0,i.refresh()},this.graphClearedListener=function(){i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.pickIndexDirty=!0,i.refresh()},this.handleContextLost=function(t){t.preventDefault(),i.contextLossSignaled||(i.contextLossSignaled=!0,i.emit("contextLost",void 0))},this.handleContextRestored=function(){i.contextLossSignaled=!1,i.initializePrograms(),i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.nodeBufferUploadDirty=!0,i.edgeBufferUploadDirty=!0,i.pickIndexDirty=!0,i.emit("contextRestored",void 0),i.refresh()},this.handleMouseMove=function(t){i.pendingHoverPoint=i.getViewportPointFromMouseEvent(t),null===i.hoverPickAnimationFrame&&(i.hoverPickAnimationFrame=window.requestAnimationFrame((function(){if(i.hoverPickAnimationFrame=null,i.pendingHoverPoint){var t=i.pickNodeAt(i.pendingHoverPoint);i.pendingHoverPoint=null,t!==i.hoveredNode&&(i.hoveredNode&&i.emit("leaveNode",{node:i.hoveredNode}),i.hoveredNode=t,t&&i.emit("enterNode",{node:t}))}})))},this.handleMouseDown=function(t){var e=i.pickNodeAt(i.getViewportPointFromMouseEvent(t));e&&i.emit("downNode",{node:e,event:t})},this.handleDoubleClick=function(t){var e=i.pickNodeAt(i.getViewportPointFromMouseEvent(t));e?i.emit("doubleClickNode",{node:e,event:t}):i.emit("doubleClickStage",{event:t})},this.graph=t,this.container=e,this.settings=n,this.canvas=document.createElement("canvas"),this.canvas.className="graph-render-container",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.canvas.style.touchAction="none",this.container.appendChild(this.canvas),this.syncCanvasSizeFromContainer(!1),this.gl=this.canvas.getContext("webgl",{antialias:!0,alpha:!0,preserveDrawingBuffer:!1}),this.bindGraphEvents(),this.bindMouseEvents(),this.bindContextEvents(),this.observeResize(),this.initializePrograms(),this.resetCameraToGraph(),this.refresh()}return t.prototype.getCanvas=function(){return this.canvas},t.prototype.getContainer=function(){return this.container},t.prototype.getGraph=function(){return this.graph},t.prototype.setGraph=function(t){this.graph!==t&&(this.unbindGraphEvents(),this.graph=t,this.bindGraphEvents(),this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.nodeBufferUploadDirty=!0,this.edgeBufferUploadDirty=!0,this.pickIndexDirty=!0,this.resetCameraToGraph(),this.refresh())},t.prototype.getSettings=function(){return this.settings},t.prototype.setSetting=function(t,e){var n;this.settings=Ct(Ct({},this.settings),((n={})[t]=e,n)),this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.refresh()},t.prototype.setSettings=function(t){this.settings=t,this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.refresh()},t.prototype.on=function(t,e){var n=String(t);this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(e)},t.prototype.off=function(t,e){var n=String(t),i=this.listeners[n];i&&(this.listeners[n]=i.filter((function(t){return t!==e})))},t.prototype.getDimensions=function(){return this.syncCanvasSizeFromContainer(!1),{width:this.cssWidth,height:this.cssHeight}},t.prototype.getPixelRatio=function(){return this.pixelRatio},t.prototype.isContextLost=function(){return!this.gl||"function"==typeof this.gl.isContextLost&&this.gl.isContextLost()},t.prototype.setCustomBBox=function(t){this.customBBox=t,t&&(this.camera=Ct(Ct({},this.camera),{x:(t.x[0]+t.x[1])/2,y:(t.y[0]+t.y[1])/2}),this.pickIndexDirty=!0),this.refresh()},t.prototype.getCustomBBox=function(){return this.customBBox},t.prototype.getBBox=function(){return this.computeEffectiveBBox()},t.prototype.getGraphBBox=function(){return this.computeGraphBBox()},t.prototype.getCameraState=function(){return Ct({},this.camera)},t.prototype.setCameraState=function(t){var e,n=Math.max(.01,null!==(e=t.ratio)&&void 0!==e?e:this.camera.ratio);this.camera=Ct(Ct(Ct({},this.camera),t),{ratio:n,angle:0}),this.pickIndexDirty=!0,this.refresh()},t.prototype.animateCamera=function(t,e){var n,i,r,o=this;if(!e||e<=0)return this.setCameraState(t),Promise.resolve();null!==this.cameraAnimationFrame&&window.cancelAnimationFrame(this.cameraAnimationFrame);var a=this.getCameraState(),s=null!==(n=t.x)&&void 0!==n?n:a.x,h=null!==(i=t.y)&&void 0!==i?i:a.y,u=Math.max(.01,null!==(r=t.ratio)&&void 0!==r?r:a.ratio);return new Promise((function(t){var n=performance.now(),i=function(){var r=performance.now()-n,c=Math.min(1,r/e),d=1-Math.pow(1-c,3);o.camera={x:a.x+(s-a.x)*d,y:a.y+(h-a.y)*d,ratio:a.ratio+(u-a.ratio)*d,angle:0},o.pickIndexDirty=!0,o.refresh(),c<1?o.cameraAnimationFrame=window.requestAnimationFrame(i):(o.cameraAnimationFrame=null,t())};o.cameraAnimationFrame=window.requestAnimationFrame(i)}))},t.prototype.graphToViewport=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform(),i=this.graphToFramed(t,n),r=this.graphToFramed({x:this.camera.x,y:this.camera.y},n),o=this.getDimensions(),a=o.width,s=o.height;return{x:(i.x-r.x)*e+a/2,y:(r.y-i.y)*e+s/2}},t.prototype.viewportToGraph=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform(),i=this.graphToFramed({x:this.camera.x,y:this.camera.y},n),r=this.getDimensions(),o=r.width,a=r.height,s={x:(t.x-o/2)/e+i.x,y:i.y-(t.y-a/2)/e};return Ct({},this.framedToGraph(s,n))},t.prototype.zoomAt=function(t,e){var n=Math.max(.01,e),i=this.viewportToGraph(t);this.setCameraState({ratio:n});var r=this.viewportToGraph(t);this.setCameraState({x:this.camera.x+(i.x-r.x),y:this.camera.y+(i.y-r.y)})},t.prototype.pickNodeAt=function(t){return this.pickIndexDirty&&this.rebuildPickIndex(),this.pickIndex.pick(t)},t.prototype.refresh=function(){var t=this;this.destroyed||null!==this.pendingFrame||(this.pendingFrame=window.requestAnimationFrame((function(){t.pendingFrame=null,t.render()})))},t.prototype.resetCameraToGraph=function(){var t=this.computeEffectiveBBox();this.camera=this.getCameraForBBox(t,1.1),this.pickIndexDirty=!0},t.prototype.getCameraForBBox=function(t,e){void 0===e&&(e=1);var n=Math.max(1,t.x[1]-t.x[0]),i=Math.max(1,t.y[1]-t.y[0]),r=this.getDimensions(),o=r.width,a=r.height,s=Math.max(1,o),h=Math.max(1,a),u=Math.max(1,h-80),c=Math.max(1.05*n/s,1.05*i/u),d=Number.isFinite(c)?c:1;return{x:(t.x[0]+t.x[1])/2,y:(t.y[0]+t.y[1])/2,ratio:Math.max(.01,d*Math.max(1,e)),angle:0}},t.prototype.dispose=function(){this.destroyed=!0,this.unbindGraphEvents(),this.canvas.removeEventListener("webglcontextlost",this.handleContextLost),this.canvas.removeEventListener("webglcontextrestored",this.handleContextRestored),null!==this.pendingFrame&&(window.cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),null!==this.cameraAnimationFrame&&(window.cancelAnimationFrame(this.cameraAnimationFrame),this.cameraAnimationFrame=null),null!==this.hoverPickAnimationFrame&&(window.cancelAnimationFrame(this.hoverPickAnimationFrame),this.hoverPickAnimationFrame=null),this.pickIndex.clear(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.removeWindowResizeListener&&(this.removeWindowResizeListener(),this.removeWindowResizeListener=null),this.removeVisibilityListener&&(this.removeVisibilityListener(),this.removeVisibilityListener=null),this.gl&&(this.nodeBuffer&&this.gl.deleteBuffer(this.nodeBuffer),this.edgeBuffer&&this.gl.deleteBuffer(this.edgeBuffer),this.nodeProgram&&this.gl.deleteProgram(this.nodeProgram),this.edgeProgram&&this.gl.deleteProgram(this.edgeProgram)),this.canvas.parentElement===this.container&&this.container.removeChild(this.canvas)},t.prototype.emit=function(t,e){var n=this.listeners[String(t)];n&&n.forEach((function(t){return t(e)}))},t.prototype.bindGraphEvents=function(){this.graph.on("nodeAdded",this.graphNodeStructureListener),this.graph.on("nodeDropped",this.graphNodeStructureListener),this.graph.on("edgeAdded",this.graphEdgeStructureListener),this.graph.on("edgeDropped",this.graphEdgeStructureListener),this.graph.on("cleared",this.graphClearedListener),this.graph.on("nodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.on("edgeAttributesUpdated",this.graphEdgeAttributesListener),this.graph.on("eachNodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.on("eachEdgeAttributesUpdated",this.graphEdgeAttributesListener)},t.prototype.unbindGraphEvents=function(){this.graph.off("nodeAdded",this.graphNodeStructureListener),this.graph.off("nodeDropped",this.graphNodeStructureListener),this.graph.off("edgeAdded",this.graphEdgeStructureListener),this.graph.off("edgeDropped",this.graphEdgeStructureListener),this.graph.off("cleared",this.graphClearedListener),this.graph.off("nodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.off("edgeAttributesUpdated",this.graphEdgeAttributesListener),this.graph.off("eachNodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.off("eachEdgeAttributesUpdated",this.graphEdgeAttributesListener)},t.prototype.nodeAttributePayloadAffectsEdgeGeometry=function(t){var e,n,i=null!==(e=null==t?void 0:t.attributes)&&void 0!==e?e:null===(n=null==t?void 0:t.hints)||void 0===n?void 0:n.attributes;return!Array.isArray(i)||i.includes("x")||i.includes("y")},t.prototype.bindMouseEvents=function(){this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mousedown",this.handleMouseDown),this.canvas.addEventListener("dblclick",this.handleDoubleClick)},t.prototype.bindContextEvents=function(){this.canvas.addEventListener("webglcontextlost",this.handleContextLost,{passive:!1}),this.canvas.addEventListener("webglcontextrestored",this.handleContextRestored)},t.prototype.getViewportPointFromMouseEvent=function(t){var e=this.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},t.prototype.observeResize=function(){var t=this,e=function(){t.syncCanvasSizeFromContainer(!0)};e(),"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((function(){return e()})),this.resizeObserver.observe(this.container)),window.addEventListener("resize",e),this.removeWindowResizeListener=function(){return window.removeEventListener("resize",e)};var n=function(){document.hidden||t.syncCanvasSizeFromContainer(!0)};document.addEventListener("visibilitychange",n),this.removeVisibilityListener=function(){return document.removeEventListener("visibilitychange",n)}},t.prototype.recoverCameraIfPathological=function(){var t=this.getCameraForBBox(this.computeEffectiveBBox(),1.1),e=this.camera.ratio,n=t.ratio;if(!Number.isFinite(e)||!Number.isFinite(n)||n<=0)return this.camera=t,void(this.pickIndexDirty=!0);(e>50*n||e<n/50)&&(this.camera=Ct(Ct({},this.camera),{x:t.x,y:t.y,ratio:t.ratio,angle:0}),this.pickIndexDirty=!0)},t.prototype.syncCanvasSizeFromContainer=function(t){var e=this.container.getBoundingClientRect(),n=Math.max(this.container.clientWidth,Math.round(e.width)),i=Math.max(this.container.clientHeight,Math.round(e.height)),r=Math.max(1,n),o=Math.max(1,i),a=Math.max(1,window.devicePixelRatio||1),s=Math.max(1,Math.round(r*a)),h=Math.max(1,Math.round(o*a)),u=(this.cssWidth<=1||this.cssHeight<=1)&&r>1&&o>1;(this.cssWidth!==r||this.cssHeight!==o||this.pixelRatio!==a||this.canvas.width!==s||this.canvas.height!==h)&&(this.cssWidth=r,this.cssHeight=o,this.pixelRatio=a,this.canvas.width=s,this.canvas.height=h,this.pickIndexDirty=!0,u&&this.recoverCameraIfPathological(),t&&this.refresh())},t.prototype.initializePrograms=function(){this.gl&&(this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.edgeProgram=Mt(this.gl,"\n attribute vec2 a_position;\n attribute vec2 a_other;\n attribute float a_side;\n attribute float a_thickness;\n attribute vec4 a_color;\n uniform vec2 u_camera;\n uniform vec2 u_graphMin;\n uniform vec2 u_frameOffset;\n uniform float u_invMaxExtent;\n uniform vec2 u_viewport;\n uniform float u_scale;\n uniform float u_edgeSizeScale;\n varying vec4 v_color;\n\n void main() {\n vec2 framed = vec2(\n (a_position.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_position.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 otherFramed = vec2(\n (a_other.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_other.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 screen = vec2(\n (framed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - framed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 otherScreen = vec2(\n (otherFramed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - otherFramed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 dir = otherScreen - screen;\n float dirLen = max(length(dir), 1e-6);\n vec2 normal = vec2(-dir.y, dir.x) / dirLen;\n float thickness = max(1.0, a_thickness / max(0.01, u_edgeSizeScale));\n vec2 quadScreen = screen + normal * (0.5 * thickness * a_side);\n vec2 clip = vec2(\n (quadScreen.x / u_viewport.x) * 2.0 - 1.0,\n 1.0 - (quadScreen.y / u_viewport.y) * 2.0\n );\n gl_Position = vec4(clip, 0.0, 1.0);\n v_color = a_color;\n }\n ","\n precision mediump float;\n varying vec4 v_color;\n void main() {\n gl_FragColor = v_color;\n }\n "),this.nodeProgram=Mt(this.gl,"\n attribute vec2 a_position;\n attribute float a_size;\n attribute float a_halo;\n attribute vec4 a_color;\n attribute vec4 a_borderColor;\n attribute float a_borderWidth;\n uniform vec2 u_camera;\n uniform vec2 u_graphMin;\n uniform vec2 u_frameOffset;\n uniform float u_invMaxExtent;\n uniform vec2 u_viewport;\n uniform float u_scale;\n uniform float u_nodeSizeScale;\n uniform float u_haloExpansion;\n uniform float u_haloGap;\n varying vec4 v_color;\n varying vec4 v_borderColor;\n varying float v_borderWidth;\n varying float v_pointSize;\n varying float v_halo;\n varying float v_nodeRadiusNorm;\n varying float v_haloGapNorm;\n\n void main() {\n vec2 framed = vec2(\n (a_position.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_position.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 screen = vec2(\n (framed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - framed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 clip = vec2(\n (screen.x / u_viewport.x) * 2.0 - 1.0,\n 1.0 - (screen.y / u_viewport.y) * 2.0\n );\n\n gl_Position = vec4(clip, 0.0, 1.0);\n float basePointSize = max(2.0, 2.0 * a_size * u_nodeSizeScale);\n float baseRadius = 0.5 * basePointSize;\n float haloInnerRadius = baseRadius + a_halo * max(0.0, u_haloGap);\n float haloOuterRadius = haloInnerRadius * (1.0 + a_halo * max(0.0, u_haloExpansion));\n float pointSize = max(2.0, 2.0 * haloOuterRadius);\n gl_PointSize = pointSize;\n v_color = a_color;\n v_borderColor = a_borderColor;\n v_borderWidth = a_borderWidth;\n v_pointSize = pointSize;\n v_halo = a_halo;\n v_nodeRadiusNorm = (basePointSize * 0.5) / max(1.0, pointSize);\n v_haloGapNorm = max(0.0, u_haloGap) / max(1.0, pointSize);\n }\n ","\n precision mediump float;\n varying vec4 v_color;\n varying vec4 v_borderColor;\n varying float v_borderWidth;\n varying float v_pointSize;\n varying float v_halo;\n varying float v_nodeRadiusNorm;\n varying float v_haloGapNorm;\n uniform vec4 u_haloColor;\n uniform float u_haloFadeExponent;\n\n void main() {\n vec2 c = gl_PointCoord - vec2(0.5, 0.5);\n float dist = length(c);\n float edgeSoftness = max(0.75 / max(1.0, v_pointSize), 0.0025);\n float nodeRadius = min(0.5, max(0.0, v_nodeRadiusNorm));\n float nodeMask = 1.0 - smoothstep(nodeRadius - edgeSoftness, nodeRadius + edgeSoftness, dist);\n float alphaMask = 1.0 - smoothstep(0.5 - edgeSoftness, 0.5 + edgeSoftness, dist);\n\n if (alphaMask <= 0.0) {\n discard;\n }\n\n float borderNorm = min(nodeRadius - 0.0001, v_borderWidth / max(1.0, v_pointSize));\n vec4 color = v_color;\n if (v_borderWidth > 0.0 && nodeRadius > 0.0 && borderNorm > 0.0) {\n float borderMix = smoothstep(\n nodeRadius - borderNorm - edgeSoftness,\n nodeRadius - borderNorm + edgeSoftness,\n dist\n );\n color = mix(v_color, v_borderColor, borderMix);\n }\n\n float nodeAlpha = color.a * nodeMask;\n\n float gapAlpha = 0.0;\n float haloAlpha = 0.0;\n if (v_halo > 0.5) {\n float haloInner = min(0.5, nodeRadius + v_haloGapNorm);\n float gapInnerMask = smoothstep(nodeRadius - edgeSoftness, nodeRadius + edgeSoftness, dist);\n float gapOuterMask = 1.0 - smoothstep(haloInner - edgeSoftness, haloInner + edgeSoftness, dist);\n gapAlpha = clamp(gapInnerMask * gapOuterMask * alphaMask, 0.0, 1.0);\n float haloBand = max(0.0001, 0.5 - haloInner);\n float haloBandMask = smoothstep(haloInner - edgeSoftness, haloInner + edgeSoftness, dist) * alphaMask;\n float haloT = clamp((dist - haloInner) / haloBand, 0.0, 1.0);\n haloAlpha = u_haloColor.a * pow(1.0 - haloT, max(0.01, u_haloFadeExponent)) * haloBandMask;\n }\n\n vec3 outPremulRgb = color.rgb * nodeAlpha;\n float outAlpha = nodeAlpha;\n\n outPremulRgb += vec3(1.0, 1.0, 1.0) * gapAlpha * (1.0 - outAlpha);\n outAlpha += gapAlpha * (1.0 - outAlpha);\n\n outPremulRgb += u_haloColor.rgb * haloAlpha * (1.0 - outAlpha);\n outAlpha += haloAlpha * (1.0 - outAlpha);\n\n if (outAlpha <= 0.0) {\n discard;\n }\n\n vec3 outRgb = outPremulRgb / outAlpha;\n gl_FragColor = vec4(outRgb, outAlpha);\n }\n "),this.edgeBuffer=this.gl.createBuffer(),this.nodeBuffer=this.gl.createBuffer())},t.prototype.computeGraphBBox=function(){if(!this.graph.order)return null;var t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return this.graph.forEachNode((function(r,o){var a=Number(o.x||0),s=Number(o.y||0),h=Math.max(.5,Number(o.size||1));a-h<t&&(t=a-h),a+h>n&&(n=a+h),s-h<e&&(e=s-h),s+h>i&&(i=s+h)})),isFinite(t)&&isFinite(e)&&isFinite(n)&&isFinite(i)?{x:[t-1,n+1],y:[e-1,i+1]}:null},t.prototype.computeEffectiveBBox=function(){var t=this.computeGraphBBox();return this.customBBox||t||St},t.prototype.getCurrentFramedTransform=function(){return t=this.computeEffectiveBBox(),e=Math.max(1e-9,t.x[1]-t.x[0]),n=Math.max(1e-9,t.y[1]-t.y[0]),o=.5*((i=Math.max(e,n))-e)*(r=1/i),a=.5*(i-n)*r,{minX:t.x[0],minY:t.y[0],maxExtent:i,invMaxExtent:r,offsetX:o,offsetY:a};var t,e,n,i,r,o,a},t.prototype.graphToFramed=function(t,e){return{x:(t.x-e.minX)*e.invMaxExtent+e.offsetX,y:(t.y-e.minY)*e.invMaxExtent+e.offsetY}},t.prototype.framedToGraph=function(t,e){return{x:(t.x-e.offsetX)*e.maxExtent+e.minX,y:(t.y-e.offsetY)*e.maxExtent+e.minY}},t.prototype.getScale=function(){return this.getDrawScale()},t.prototype.getCssScale=function(){return this.getCurrentFramedTransform().maxExtent/Math.max(.01,this.camera.ratio)},t.prototype.getDrawScale=function(){var t=this.getCurrentFramedTransform(),e=Math.max(1,this.pixelRatio||1);return t.maxExtent*e/Math.max(.01,this.camera.ratio)},t.prototype.getNodeSizeScreenMultiplier=function(){var t=this.settings.zoomToSizeRatioFunction;if(!t)return 1;var e=Number(t(this.camera.ratio));return Number.isFinite(e)?Math.max(.01,e):1},t.prototype.getEdgeSizeScreenMultiplier=function(){var t,e=null!==(t=this.settings.edgeZoomToSizeRatioFunction)&&void 0!==t?t:this.settings.zoomToSizeRatioFunction;if(!e)return 1;var n=Number(e(this.camera.ratio));return Number.isFinite(n)?Math.max(.01,n):1},t.prototype.getNodeScreenSize=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform();return Math.max(1,2*t*e*n.invMaxExtent*this.getNodeSizeScreenMultiplier())},t.prototype.rebuildSnapshotData=function(){var t,e,n,i,r,o=this,a=Math.max(0,Math.min(1,null!==(t=this.settings.nodeOpacity)&&void 0!==t?t:1)),s=Math.max(0,Math.min(1,null!==(e=this.settings.edgeOpacity)&&void 0!==e?e:1)),h=Math.max(1,Number(null!==(n=this.settings.edgeSize)&&void 0!==n?n:1.5)),u=Math.max(h,Number(null!==(i=this.settings.edgeMaxSize)&&void 0!==i?i:h)),c=Boolean(null!==(r=this.settings.edgeWeightToSize)&&void 0!==r&&r),d=Et(this.settings.edgeColor||"#ccc",[.8,.8,.8,1]);if(this.nodeDataDirty){var l=[];this.graph.forEachNode((function(t,e){var n=Boolean(e.highlighted),i=Boolean(e.hovered),r=Et(e.color,[.35,.52,.84,1]),o=i?"#ffffff":"",s=e.border,h="string"==typeof s,u="number"==typeof s?s:h||n||i?2:0,c=Et(h?s:o,[r[0],r[1],r[2],1]);l.push({id:t,x:Number(e.x||0),y:Number(e.y||0),size:Math.max(.5,Number(e.size||1)),halo:n?1:0,color:[r[0],r[1],r[2],a*r[3]],borderColor:c,borderWidth:u})})),this.nodeSnapshots=l,this.nodeFloatData=new Float32Array(13*l.length);for(var p=0;p<l.length;p+=1){var f=l[p],g=13*p;this.nodeFloatData[g]=f.x,this.nodeFloatData[g+1]=f.y,this.nodeFloatData[g+2]=f.size,this.nodeFloatData[g+3]=f.halo,this.nodeFloatData[g+4]=f.color[0],this.nodeFloatData[g+5]=f.color[1],this.nodeFloatData[g+6]=f.color[2],this.nodeFloatData[g+7]=f.color[3],this.nodeFloatData[g+8]=f.borderColor[0],this.nodeFloatData[g+9]=f.borderColor[1],this.nodeFloatData[g+10]=f.borderColor[2],this.nodeFloatData[g+11]=f.borderColor[3],this.nodeFloatData[g+12]=f.borderWidth}this.nodeDataDirty=!1,this.nodeBufferUploadDirty=!0,this.pickIndexDirty=!0}if(this.edgeDataDirty){var v=[],y=0;this.graph.forEachEdge((function(t,e,n,i){var r=o.graph.getNodeAttributes(n),a=o.graph.getNodeAttributes(i),h=Et(e.color,d);h[3]*=s;var u="number"==typeof e.size&&Number.isFinite(e.size)?e.size:null,c="number"==typeof e.w&&Number.isFinite(e.w)?e.w:"number"==typeof e.weight&&Number.isFinite(e.weight)?e.weight:null,l=null!==c&&c>=0?c:null;null!==l&&(y=Math.max(y,l)),v.push({sourceX:Number(r.x||0),sourceY:Number(r.y||0),targetX:Number(a.x||0),targetY:Number(a.y||0),color:h,explicitSize:u,weight:l})}));var m=[];for(p=0;p<v.length;p+=1){var b=null!==(f=v[p]).explicitSize?Math.max(1,f.explicitSize):h,w=h;c&&null!==f.weight&&y>0&&(w=h+Math.max(0,Math.min(1,f.weight/y))*(u-h));var x=Math.max(b,w);m.push({sourceX:f.sourceX,sourceY:f.sourceY,targetX:f.targetX,targetY:f.targetY,thickness:x,color:f.color})}this.edgeSnapshots=m,this.edgeFloatData=new Float32Array(60*m.length);var _=function(t){var e=m[t],n=60*t,i=function(t,e,i,r,a,s,h){o.edgeFloatData[n]=t,o.edgeFloatData[n+1]=e,o.edgeFloatData[n+2]=i,o.edgeFloatData[n+3]=r,o.edgeFloatData[n+4]=a,o.edgeFloatData[n+5]=s,o.edgeFloatData[n+6]=h[0],o.edgeFloatData[n+7]=h[1],o.edgeFloatData[n+8]=h[2],o.edgeFloatData[n+9]=h[3],n+=10};i(e.sourceX,e.sourceY,e.targetX,e.targetY,-1,e.thickness,e.color),i(e.sourceX,e.sourceY,e.targetX,e.targetY,1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,-1,e.thickness,e.color),i(e.sourceX,e.sourceY,e.targetX,e.targetY,-1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,-1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,1,e.thickness,e.color)};for(p=0;p<m.length;p+=1)_(p);this.edgeDataDirty=!1,this.edgeBufferUploadDirty=!0}},t.prototype.rebuildPickIndex=function(){var t=[];if(0===this.nodeSnapshots.length)return this.pickIndex.clear(),void(this.pickIndexDirty=!1);for(var e=this.getCurrentFramedTransform(),n=this.graphToFramed({x:this.camera.x,y:this.camera.y},e),i=this.getCssScale(),r=this.getDimensions(),o=r.width,a=r.height,s=this.getNodeSizeScreenMultiplier(),h=0;h<this.nodeSnapshots.length;h+=1){var u=this.nodeSnapshots[h],c=this.graphToFramed({x:u.x,y:u.y},e),d=(c.x-n.x)*i+o/2,l=(n.y-c.y)*i+a/2,p=Math.max(1,2*u.size*i*e.invMaxExtent*s)/2+4;t.push({id:u.id,x:d,y:l,radius:p})}this.pickIndex.build(t),this.pickIndexDirty=!1},t.prototype.render=function(){this.gl&&this.nodeProgram&&this.edgeProgram&&!this.destroyed&&(this.isContextLost()?this.contextLossSignaled||(this.contextLossSignaled=!0,this.emit("contextLost",void 0)):((this.nodeDataDirty||this.edgeDataDirty)&&this.rebuildSnapshotData(),this.pickIndexDirty&&this.rebuildPickIndex(),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.edgeFloatData.length>0&&this.edgeBuffer&&this.renderEdges(),this.nodeFloatData.length>0&&this.nodeBuffer&&this.renderNodes()))},t.prototype.renderEdges=function(){if(this.gl&&this.edgeProgram&&this.edgeBuffer){var t=this.gl;t.useProgram(this.edgeProgram),t.bindBuffer(t.ARRAY_BUFFER,this.edgeBuffer),this.edgeBufferUploadDirty&&(t.bufferData(t.ARRAY_BUFFER,this.edgeFloatData,t.DYNAMIC_DRAW),this.edgeBufferUploadDirty=!1);var e=10*Float32Array.BYTES_PER_ELEMENT,n=t.getAttribLocation(this.edgeProgram,"a_position"),i=t.getAttribLocation(this.edgeProgram,"a_other"),r=t.getAttribLocation(this.edgeProgram,"a_side"),o=t.getAttribLocation(this.edgeProgram,"a_thickness"),a=t.getAttribLocation(this.edgeProgram,"a_color");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,e,0),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,2,t.FLOAT,!1,e,2*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,1,t.FLOAT,!1,e,4*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,e,5*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(a),t.vertexAttribPointer(a,4,t.FLOAT,!1,e,6*Float32Array.BYTES_PER_ELEMENT);var s=t.getUniformLocation(this.edgeProgram,"u_camera"),h=t.getUniformLocation(this.edgeProgram,"u_graphMin"),u=t.getUniformLocation(this.edgeProgram,"u_frameOffset"),c=t.getUniformLocation(this.edgeProgram,"u_invMaxExtent"),d=t.getUniformLocation(this.edgeProgram,"u_viewport"),l=t.getUniformLocation(this.edgeProgram,"u_scale"),p=t.getUniformLocation(this.edgeProgram,"u_edgeSizeScale"),f=this.getCurrentFramedTransform(),g=this.graphToFramed({x:this.camera.x,y:this.camera.y},f);t.uniform2f(s,g.x,g.y),t.uniform2f(h,f.minX,f.minY),t.uniform2f(u,f.offsetX,f.offsetY),t.uniform1f(c,f.invMaxExtent),t.uniform2f(d,this.canvas.width,this.canvas.height),t.uniform1f(l,this.getDrawScale()),t.uniform1f(p,this.getEdgeSizeScreenMultiplier()),t.drawArrays(t.TRIANGLES,0,this.edgeFloatData.length/10)}},t.prototype.renderNodes=function(){var t,e,n,i;if(this.gl&&this.nodeProgram&&this.nodeBuffer){var r=this.gl;r.useProgram(this.nodeProgram),r.bindBuffer(r.ARRAY_BUFFER,this.nodeBuffer),this.nodeBufferUploadDirty&&(r.bufferData(r.ARRAY_BUFFER,this.nodeFloatData,r.DYNAMIC_DRAW),this.nodeBufferUploadDirty=!1);var o=13*Float32Array.BYTES_PER_ELEMENT,a=r.getAttribLocation(this.nodeProgram,"a_position"),s=r.getAttribLocation(this.nodeProgram,"a_size"),h=r.getAttribLocation(this.nodeProgram,"a_halo"),u=r.getAttribLocation(this.nodeProgram,"a_color"),c=r.getAttribLocation(this.nodeProgram,"a_borderColor"),d=r.getAttribLocation(this.nodeProgram,"a_borderWidth");r.enableVertexAttribArray(a),r.vertexAttribPointer(a,2,r.FLOAT,!1,o,0),r.enableVertexAttribArray(s),r.vertexAttribPointer(s,1,r.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(h),r.vertexAttribPointer(h,1,r.FLOAT,!1,o,3*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(u),r.vertexAttribPointer(u,4,r.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(c),r.vertexAttribPointer(c,4,r.FLOAT,!1,o,8*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(d),r.vertexAttribPointer(d,1,r.FLOAT,!1,o,12*Float32Array.BYTES_PER_ELEMENT);var l=r.getUniformLocation(this.nodeProgram,"u_camera"),p=r.getUniformLocation(this.nodeProgram,"u_graphMin"),f=r.getUniformLocation(this.nodeProgram,"u_frameOffset"),g=r.getUniformLocation(this.nodeProgram,"u_invMaxExtent"),v=r.getUniformLocation(this.nodeProgram,"u_viewport"),y=r.getUniformLocation(this.nodeProgram,"u_scale"),m=r.getUniformLocation(this.nodeProgram,"u_nodeSizeScale"),b=r.getUniformLocation(this.nodeProgram,"u_haloExpansion"),w=r.getUniformLocation(this.nodeProgram,"u_haloGap"),x=r.getUniformLocation(this.nodeProgram,"u_haloColor"),_=r.getUniformLocation(this.nodeProgram,"u_haloFadeExponent"),C=Math.max(0,Number(null!==(t=this.settings.highlightHaloExpansion)&&void 0!==t?t:.8)),S=Math.max(0,Number(null!==(e=this.settings.highlightHaloGap)&&void 0!==e?e:4)),E=Math.max(.01,Number(null!==(n=this.settings.highlightHaloFadeExponent)&&void 0!==n?n:1.8)),k=this.getCurrentFramedTransform(),M=this.graphToFramed({x:this.camera.x,y:this.camera.y},k),A=Et(null!==(i=this.settings.highlightHaloColor)&&void 0!==i?i:"rgba(0, 0, 0, 0.8)",[0,0,0,.8]);r.uniform2f(l,M.x,M.y),r.uniform2f(p,k.minX,k.minY),r.uniform2f(f,k.offsetX,k.offsetY),r.uniform1f(g,k.invMaxExtent),r.uniform2f(v,this.canvas.width,this.canvas.height),r.uniform1f(y,this.getDrawScale()),r.uniform1f(m,this.getDrawScale()*k.invMaxExtent*this.getNodeSizeScreenMultiplier()),r.uniform1f(b,C),r.uniform1f(w,S),r.uniform4f(x,A[0],A[1],A[2],A[3]),r.uniform1f(_,E),r.drawArrays(r.POINTS,0,this.nodeFloatData.length/13)}},t}(),Lt=function(){return Lt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Lt.apply(this,arguments)},Dt=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))},Gt=function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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])}}},Pt=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};!function(t){t[t.inactive=0]="inactive",t[t.lasso=1]="lasso",t[t.box=2]="box"}(At||(At={}));var Ft,Bt=function(){function e(t){var e,n,i,r,o,a,s,h,u,c,d,l,p,f,g,v,y,m,b,w,x,_,C,S=this;this.zoomFactor=1.5,this.zoomDuration=200,this.isDragging=!1,this.isPanning=!1,this.isDraggedNodeSelected=!1,this.isLassoActiveDueToModifierKey=!1,this.fullScreenButton=null,this.resetButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.playPauseButton=null,this.contextLostOverlay=null,this.hoverOverlay=null,this.previousPosition=null,this.previousPanPoint=null,this.hoveredNode=null,this.lastMousePosition=null,this.originalSizeKey="originalSize",this.handleSelectionClear=function(){S.updateSelectedNodes([])},this.handleEnterNode=function(t){S.hoveredNode=t.node,S.graph.setNodeAttribute(t.node,"hovered",!0),S.neighborHighlightingEnabled&&S.graph.forEachNeighbor(t.node,(function(e){var n=S.getUndirectedEdge(t.node,e),i=S.graph.getEdgeAttribute(n,"size");S.graph.setEdgeAttribute(n,"size",4),S.graph.setEdgeAttribute(n,S.originalSizeKey,i);var r=S.graph.getEdgeAttribute(n,"color");S.graph.setEdgeAttribute(n,"color","#aaa"),S.graph.setEdgeAttribute(n,"originalColor",r)})),S.updateHoverOverlay(t.node),S.refresh()},this.handleLeaveNode=function(t){S.hoveredNode=null,S.graph.setNodeAttribute(t.node,"hovered",void 0),S.neighborHighlightingEnabled&&S.graph.forEachNeighbor(t.node,(function(e){var n=S.getUndirectedEdge(t.node,e),i=S.graph.getEdgeAttribute(n,S.originalSizeKey);S.graph.setEdgeAttribute(n,"size",i);var r=S.graph.getEdgeAttribute(n,"originalColor");S.graph.setEdgeAttribute(n,"color",r)})),S.removeHoverOverlay(),S.refresh()},this.handleDownNode=function(t){if(S.allowNodeMovement){S.isDragging=!0,S.draggedNode=t.node;var e=Number(t.node);S.graph.setNodeAttribute(S.draggedNode,"highlighted",!0),S.isDraggedNodeSelected=S.selectedNodes.some((function(t){return t===e})),S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.updateNodeAttribute(t,"fixed",(function(){return!0}))})):S.graph.setNodeAttribute(S.draggedNode,"fixed",!0),S.previousPosition=S.renderer.viewportToGraph({x:t.event.offsetX,y:t.event.offsetY}),!S.animator.isRunning()&&S._animate&&S.animator.start(),S.animator.resetNIters(),S.refresh()}},this.handleNodeDoubleClick=function(t){t.event.preventDefault();var e=Number(t.node);S.selectedNodes.some((function(t){return t===e}))?S.updateSelectedNodes(S.selectedNodes.filter((function(t){return t!==e}))):S.addSelectedNodes([e])},this.handleMouseMoveBody=function(t){if(S.lastMousePosition={x:t.clientX,y:t.clientY},!S.hoveredNode||S.isDragging||S.isMouseEventInsideCanvas(t)){if(S.hoveredNode&&S.updateHoverOverlay(S.hoveredNode),S.isDragging&&S.draggedNode&&S.previousPosition){S.animator.resetNIters();var e=S.getViewportPointFromMouseEvent(t),n=S.renderer.viewportToGraph(e),i=n.x-S.previousPosition.x,r=n.y-S.previousPosition.y;return S.previousPosition=n,S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.updateNodeAttributes(t,(function(t){return Lt(Lt({},t),{x:t.x+i,y:t.y+r})}))})):S.graph.updateNodeAttributes(S.draggedNode,(function(t){return Lt(Lt({},t),{x:t.x+i,y:t.y+r})})),void S.refresh()}if(S.isPanning&&S.previousPanPoint){var o=S.getViewportPointFromMouseEvent(t),a=S.renderer.viewportToGraph(S.previousPanPoint),s=S.renderer.viewportToGraph(o),h=S.renderer.getCameraState();S.renderer.setCameraState({x:h.x+(a.x-s.x),y:h.y+(a.y-s.y)}),S.previousPanPoint=o}}else S.handleLeaveNode({node:S.hoveredNode})},this.handleMouseUp=function(){S.draggedNode&&(S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.removeNodeAttribute(t,"fixed")})):(S.graph.removeNodeAttribute(S.draggedNode,"fixed"),S.graph.removeNodeAttribute(S.draggedNode,"highlighted")),S.previousPosition=null),S.animator&&S.animator.forceNodePositionUpdate(),S.isDragging=!1,S.isPanning=!1,S.draggedNode=null,S.isDraggedNodeSelected=!1,S.previousPanPoint=null},this.handleMouseDown=function(t){if(document.activeElement&&document.activeElement instanceof HTMLElement){document.activeElement.blur();var e=window.getSelection();e&&e.empty()}S.mode===At.inactive&&(S.renderer.pickNodeAt({x:t.offsetX,y:t.offsetY})||(S.isPanning=!0,S.previousPanPoint={x:t.offsetX,y:t.offsetY}))},this.handleDoubleClickStage=function(){S.handleSelectionClear()},this.handleWheel=function(t){t.preventDefault();var e=S.renderer.getCameraState(),n=Math.max(-1.5,Math.min(1.5,t.deltaY/100)),i=Math.max(.01,e.ratio*(1+n/8));S.renderer.zoomAt({x:t.offsetX,y:t.offsetY},i)},this.handleLassoModifierDown=function(t){S.isLassoModifierPressed(t)&&S.mode===At.inactive&&(S.setSelectMode(At.lasso),S.isLassoActiveDueToModifierKey=!0)},this.handleLassoModifierUp=function(t){!t.altKey&&S.isLassoActiveDueToModifierKey&&(S.setSelectMode(At.inactive),S.isLassoActiveDueToModifierKey=!1)},this.handleWindowBlur=function(){S.isLassoActiveDueToModifierKey&&(S.setSelectMode(At.inactive),S.isLassoActiveDueToModifierKey=!1)},this.graphContainer=((C=document.createElement("div")).className="graph-container",C.style.width="100%",C.style.height="calc(100% - 40px)",C.style.position="relative",C.style.top="40px",C),this.rendererContainer=function(t){var e=document.createElement("div");return e.className="graph-render-container",e.style.width="100%",e.style.height="100%",t.appendChild(e),e}(this.graphContainer),this.renderSettings=Lt({},t.settings),this.renderer=new Nt(t.graph,this.rendererContainer,this.renderSettings),this.graph=t.graph,this.animator=t.animator,this._animate=!0,this.mode=t.mode,this._isFullScreen=t.isFullScreen,this.highlightedNodeColor=t.highlightedNodeColor||"#FF00FFDD",this.neighborHighlightingEnabled=t.neighborHighlightingEnabled,this.allowNodeMovement=void 0===t.allowNodeMovement||t.allowNodeMovement,this._selectedNodes=t.selectedNodes,this._highlightedNodes=t.highlightedNodes||[],this.fullScreenButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.selectionCanvas=null,this.isDrawing=!1,this.lassoDrawnPoints=[],this.boxInitialPoint=null,this.draggedNode=null,this.onSelectedNodesChange=t.onSelectedNodesChange,this.onHighlightedNodesChange=t.onHighlightedNodesChange,this.onFullScreenChange=t.onFullScreenChange,this.showButtons={zoomIn:null===(n=null===(e=t.showButtons)||void 0===e?void 0:e.zoomIn)||void 0===n||n,zoomOut:null===(r=null===(i=t.showButtons)||void 0===i?void 0:i.zoomOut)||void 0===r||r,resetZoom:null===(a=null===(o=t.showButtons)||void 0===o?void 0:o.resetZoom)||void 0===a||a,resetLayout:null===(h=null===(s=t.showButtons)||void 0===s?void 0:s.resetLayout)||void 0===h||h,fullScreen:null===(c=null===(u=t.showButtons)||void 0===u?void 0:u.fullScreen)||void 0===c||c,lassoSelect:null===(l=null===(d=t.showButtons)||void 0===d?void 0:d.lassoSelect)||void 0===l||l,boxSelect:null===(f=null===(p=t.showButtons)||void 0===p?void 0:p.boxSelect)||void 0===f||f,clearSelection:null===(v=null===(g=t.showButtons)||void 0===g?void 0:g.clearSelection)||void 0===v||v,invertSelection:null===(m=null===(y=t.showButtons)||void 0===y?void 0:y.invertSelection)||void 0===m||m,playPause:null===(w=null===(b=t.showButtons)||void 0===b?void 0:b.playPause)||void 0===w||w,downloadSVG:null===(_=null===(x=t.showButtons)||void 0===x?void 0:x.downloadSVG)||void 0===_||_},this.bindEventHandlers(),this.initializeGraphManager(),this.initializeOverlay(),document.addEventListener("keydown",this.handleLassoModifierDown),document.addEventListener("keyup",this.handleLassoModifierUp),window.addEventListener("blur",this.handleWindowBlur)}return e.prototype.bindEventHandlers=function(){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.handleRendererContextLost=this.handleRendererContextLost.bind(this),this.handleRendererContextRestored=this.handleRendererContextRestored.bind(this)},e.prototype.isLassoModifierPressed=function(t){if(t.altKey)return!0;var e=t.key,n=t.code;return"Alt"===e||"Option"===e||"AltGraph"===e||"AltLeft"===n||"AltRight"===n},e.prototype.initializeGraphManager=function(){this.initializeGraph(),this.createControls(),this.registerEvents()},e.prototype.initializeGraph=function(){var t=this;this.renderer.setGraph(this.graph);var e=this.animator.params.settings.expectedDims,n=null!=e?e:this.getGraphViewportBounds(),i=n[0],r=n[1];this.renderer.setCustomBBox({x:[-i/2,i/2],y:[-r/2,r/2]}),this.refresh(),window.requestAnimationFrame((function(){return t.resetView()}))},e.prototype.getGraphViewportBounds=function(){var t=this.renderer.getDimensions();return[t.width,t.height]},e.prototype.updateSelectedNodes=function(t){this.setSelectedNodes(t)},e.prototype.addSelectedNodes=function(t){var e=this;this.setSelectedNodes(Pt(Pt([],this.selectedNodes,!0),t.filter((function(t){return!e.selectedNodes.includes(t)})),!0))},e.prototype.getUndirectedEdge=function(t,e){if(this.graph.hasEdge(t,e))return this.graph.edge(t,e);if(this.graph.hasEdge(e,t))return this.graph.edge(e,t);throw new Error("neighbor node = ".concat(e," does not have an edge with ").concat(t))},e.prototype.registerEvents=function(){this.renderer.on("enterNode",this.handleEnterNode),this.renderer.on("leaveNode",this.handleLeaveNode),this.renderer.on("downNode",this.handleDownNode),this.renderer.on("doubleClickNode",this.handleNodeDoubleClick),this.renderer.on("doubleClickStage",this.handleDoubleClickStage),this.renderer.on("contextLost",this.handleRendererContextLost),this.renderer.on("contextRestored",this.handleRendererContextRestored);var t=this.renderer.getCanvas();t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleCanvasMouseMove),window.addEventListener("mousemove",this.handleMouseMoveBody),window.addEventListener("mouseup",this.handleMouseUp)},e.prototype.handleCanvasMouseMove=function(t){this.lastMousePosition={x:t.clientX,y:t.clientY},this.hoveredNode&&this.updateHoverOverlay(this.hoveredNode)},e.prototype.getViewportPointFromMouseEvent=function(t){var e=this.renderer.getCanvas().getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},e.prototype.isMouseEventInsideCanvas=function(t){var e=this.renderer.getCanvas().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom},e.prototype.setSelectMode=function(t){this.mode=t,this.lassoSelectButton&&this.lassoSelectButton.classList.toggle("active",t===At.lasso),this.boxSelectButton&&this.boxSelectButton.classList.toggle("active",t===At.box),this.mode===At.inactive?(this.removeSelectionCanvas(),this.lassoSelectButton&&this.lassoSelectButton.classList.remove("active"),this.boxSelectButton&&this.boxSelectButton.classList.remove("active")):this.showSelectionCanvas()},e.prototype.handleRendererContextLost=function(){this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="visible")},e.prototype.handleRendererContextRestored=function(){this.recreateRenderer(),this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="hidden")},e.prototype.recreateRenderer=function(){this.unregisterRendererEvents(),this.renderer.dispose(),this.renderer=new Nt(this.graph,this.rendererContainer,this.renderSettings),this.registerEvents(),this.refresh()},e.prototype.showSelectionCanvas=function(){var t,e,n,i;this.selectionCanvas||(this.selectionCanvas=(e=(t={offsetWidth:this.renderer.getContainer().offsetWidth,offsetHeight:this.renderer.getContainer().offsetHeight}).offsetWidth,n=t.offsetHeight,(i=document.createElement("canvas")).width=e,i.height=n,i.style.position="absolute",i.style.top="0px",i.style.cursor="crosshair",i),this.selectionCanvas.addEventListener("mousedown",this.onDrawingStart),this.selectionCanvas.addEventListener("mousemove",this.onDrawing),this.selectionCanvas.addEventListener("mouseup",this.onDrawingEnd),this.selectionCanvas.addEventListener("wheel",this.onSelectScroll),this.graphContainer.appendChild(this.selectionCanvas))},e.prototype.removeSelectionCanvas=function(){this.selectionCanvas&&(this.graphContainer.removeChild(this.selectionCanvas),this.selectionCanvas=null)},e.prototype.setDrawingStyles=function(t){t.strokeStyle="black",t.lineWidth=2,t.fillStyle="rgba(200, 200, 200, 0.25)",t.lineJoin="round",t.lineCap="round"},e.prototype.getNormalizedPosition=function(t){var e=this.selectionCanvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},e.prototype.drawSmoothFilledPath=function(t){var e=this.selectionCanvas.getContext("2d");this.setDrawingStyles(e);var n,i,r=t[0],o=t[1],a=t.length;e.beginPath(),e.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});e.quadraticCurveTo(r.x,r.y,h.x,h.y),r=t[s],o=t[s+1]}e.lineTo(r.x,r.y),e.stroke(),e.fill()},e.prototype.getGraphNodesInCurrentPath=function(){var t=this,e=this.selectionCanvas.getContext("2d"),n=[],i=this.renderer.getDimensions(),r=i.width,o=i.height;return this.graph.forEachNode((function(i,a){var s=t.renderer.graphToViewport({x:a.x,y:a.y});s.x>=0&&s.x<=r&&s.y>=0&&s.y<=o&&e.isPointInPath(s.x,s.y)&&n.push(Number(i))})),n},e.prototype.onDrawingStart=function(t){if(t.preventDefault(),document.activeElement&&document.activeElement instanceof HTMLElement){document.activeElement.blur();var e=window.getSelection();e&&e.empty()}if(this.mode!==At.inactive){this.isDrawing=!0;var n=this.getNormalizedPosition(t);this.mode===At.lasso&&(this.lassoDrawnPoints=[],this.lassoDrawnPoints.push(n)),this.mode===At.box&&(this.boxInitialPoint=n),t.stopPropagation()}},e.prototype.onDrawing=function(t){if(this.mode!==At.inactive&&this.isDrawing){var e=this.getNormalizedPosition(t),n=this.selectionCanvas.getContext("2d");if(this.setDrawingStyles(n),n.clearRect(0,0,n.canvas.width,n.canvas.height),this.mode===At.lasso&&(this.lassoDrawnPoints.push(e),this.drawSmoothFilledPath(this.lassoDrawnPoints)),this.mode===At.box&&this.boxInitialPoint){n.beginPath();var i=e.x-this.boxInitialPoint.x,r=e.y-this.boxInitialPoint.y;n.rect(this.boxInitialPoint.x,this.boxInitialPoint.y,i,r),n.fill()}t.stopPropagation()}},e.prototype.onDrawingEnd=function(t){if(this.mode!==At.inactive){var e=this.getGraphNodesInCurrentPath();this.isDrawing=!1,t.shiftKey?this.addSelectedNodes(e):this.updateSelectedNodes(e);var n=this.selectionCanvas.getContext("2d");n.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),n.beginPath(),this.mode===At.lasso&&(this.lassoDrawnPoints=[]),this.mode===At.box&&(this.boxInitialPoint=null),t.stopPropagation()}},e.prototype.onSelectScroll=function(t){this.handleWheel(t)},e.prototype.initializeOverlay=function(){var t=this;this.contextLostOverlay=function(){var e=document.createElement("div");e.className="webgl-overlay",e.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 Graph Display" 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 t.handleRendererContextRestored()})),e.appendChild(n),e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(0, 0, 0, 0.7)",e.style.color="white",e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="center",e.style.alignItems="center",e.style.zIndex="1000",e.style.visibility="hidden",e}(),this.graphContainer.appendChild(this.contextLostOverlay)},e.prototype.createControls=function(){var e=this,n=function(){var t=document.createElement("div");return t.className="controls-container",t.style.position="absolute",t.style.display="flex",t.style.bottom="10px",t.style.right="10px",t.style.zIndex="10",t}();if(this.showButtons.zoomIn){var i=t("\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 Dt(e,void 0,void 0,(function(){return Gt(this,(function(t){switch(t.label){case 0:return[4,this.zoomIn()];case 1:return[2,t.sent()]}}))}))}),"Zoom In");n.appendChild(i)}if(this.showButtons.zoomOut){var r=t("\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 Dt(e,void 0,void 0,(function(){return Gt(this,(function(t){switch(t.label){case 0:return[4,this.zoomOut()];case 1:return[2,t.sent()]}}))}))}),"Zoom Out");n.appendChild(r)}if(this.showButtons.resetZoom){var a=t("\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 Dt(e,void 0,void 0,(function(){return Gt(this,(function(t){switch(t.label){case 0:return[4,this.resetView()];case 1:return[2,t.sent()]}}))}))}),"Reset Zoom");n.appendChild(a)}if(this.showButtons.resetLayout&&(this.resetButton=t("\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 Dt(e,void 0,void 0,(function(){var e,n,i,r,a;return Gt(this,(function(s){switch(s.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=Lt(Lt(Lt({},xt(this.graph)),this.animator.params.settings),{warmupLayout:!0})).expectedDims=this.getGraphViewportBounds(),r={iterations:300,settings:i},this.animator.stop(),[4,this.applyInitialLayout(r)]);case 1:return s.sent(),[4,dt(this.graph,r,!t.altKey)];case 2:return a=s.sent(),this.animator.params.settings=a,this.animator.forceNodePositionUpdate(),[3,4];case 3:t.altKey||(this.animator.stop(),h=this.graph,u=this.getGraphViewportBounds(),c=this.animator.params.settings.layoutSingletonsSeparately,d=(0,o.kS)(h).map((function(t){return t.map(Number)})),l=at(h),it(l.nodes,d,100,u,c),st(h,l.nodes),this.animator.forceNodePositionUpdate()),s.label=4;case 4:return[4,this.resetView()];case 5:return s.sent(),e&&this.animator.start(),this.resetButton&&(this.resetButton.style.backgroundColor="#e2e4e7",n&&this.resetButton.setAttribute("data-tooltip","Reset Layout")),[2]}var h,u,c,d,l}))}))}),"Reset Layout"),n.appendChild(this.resetButton)),this.showButtons.fullScreen&&(this.fullScreenButton=t(this._isFullScreen?lt:pt,(function(){return e.toggleFullScreen()}),this._isFullScreen?"Scale back":"Expand"),n.appendChild(this.fullScreenButton)),this.showButtons.lassoSelect&&(this.lassoSelectButton=t("\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"),n.appendChild(this.lassoSelectButton)),this.showButtons.boxSelect&&(this.boxSelectButton=t("\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"),n.appendChild(this.boxSelectButton)),this.showButtons.clearSelection){var s=t("<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");n.appendChild(s)}if(this.showButtons.invertSelection){var h=t("<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");n.appendChild(h)}if(this.showButtons.playPause&&(this.playPauseButton=t(this._animate?gt:ft,(function(){return e.togglePlayPause()}),this._animate?"Pause Animation":"Play Animation"),n.appendChild(this.playPauseButton)),this.showButtons.downloadSVG){var u=t('\n<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="-4 -4 24 24">\n <path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5" stroke-width="0.7" stroke="#122239" fill="#122239"/>\n <path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z" stroke-width="0.7" stroke="#122239" fill="#122239"/>\n</svg>\n',(function(){return e.downloadGraphAsSVG()}),"Download SVG");n.appendChild(u)}this.graphContainer.appendChild(n)},e.prototype.zoomIn=function(){return Dt(this,void 0,void 0,(function(){var t;return Gt(this,(function(e){switch(e.label){case 0:return t=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:Math.max(.01,t.ratio/this.zoomFactor)},this.zoomDuration)];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomOut=function(){return Dt(this,void 0,void 0,(function(){var t;return Gt(this,(function(e){switch(e.label){case 0:return t=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:t.ratio*this.zoomFactor},this.zoomDuration)];case 1:return e.sent(),[2]}}))}))},e.prototype.unzoom=function(t,e){return Dt(this,void 0,void 0,(function(){var n;return Gt(this,(function(i){switch(i.label){case 0:return n=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:n.ratio*t},e)];case 1:return i.sent(),[2]}}))}))},e.prototype.unzoomAndShift=function(t,e,n,i){return Dt(this,void 0,void 0,(function(){var r,o,a;return Gt(this,(function(s){switch(s.label){case 0:return r=this.renderer.getCameraState(),o=n.x-e.x,a=n.y-e.y,[4,this.renderer.animateCamera({x:r.x+o,y:r.y+a,ratio:r.ratio*t},i)];case 1:return s.sent(),[2]}}))}))},e.prototype.unzoomAndShiftForLayoutBounds=function(t,e,n){return Dt(this,void 0,void 0,(function(){var i,r,o,a;return Gt(this,(function(s){switch(s.label){case 0:return i=this.layoutBoundsToRendererBBox(t),r=this.layoutBoundsToRendererBBox(e),o=this.renderer.getCameraState(),a=this.mapCameraForBBoxTransition(o,i,r),[4,this.renderer.animateCamera({x:a.x,y:a.y,ratio:a.ratio},n)];case 1:return s.sent(),[2]}}))}))},e.prototype.resetView=function(t){return Dt(this,void 0,void 0,(function(){var e,n;return Gt(this,(function(i){switch(i.label){case 0:return this.refresh(),e=this.renderer.getGraphBBox(),n=this.renderer.getCameraForBBox(e||this.renderer.getBBox(),1.1),[4,this.renderer.animateCamera(n,t||this.zoomDuration)];case 1:return i.sent(),[2]}}))}))},e.prototype.toggleFullScreen=function(){this._isFullScreen=!this._isFullScreen,this.onFullScreenChange(this._isFullScreen),this.fullScreenButton&&(this.fullScreenButton.innerHTML=this._isFullScreen?lt:pt,this.fullScreenButton.setAttribute("data-tooltip",this._isFullScreen?"Scale back":"Expand"))},e.prototype.toggleLassoSelect=function(){this.mode!==At.lasso?this.setSelectMode(At.lasso):this.setSelectMode(At.inactive)},e.prototype.toggleBoxSelect=function(){this.mode!==At.box?this.setSelectMode(At.box):this.setSelectMode(At.inactive)},e.prototype.clearSelection=function(){this.handleSelectionClear()},e.prototype.invertSelection=function(){var t=this,e=[];this.graph.forEachNode((function(n){var i=Number(n);t.selectedNodes.some((function(t){return t===i}))||e.push(i)})),this.updateSelectedNodes(e)},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?gt:ft,this.playPauseButton.setAttribute("data-tooltip",this._animate?"Pause Animation":"Play Animation")),this.updateAnimatorState()},e.prototype.downloadGraphAsSVG=function(){var t=mt(this.graph,{width:1920,height:1080,padding:100,includeLabels:!1,fontSize:14}),e=new Date,n=e.toISOString().split("T")[0],i=e.toTimeString().split(" ")[0].substring(0,5).replace(":","."),r="".concat(n,"_").concat(i);bt(t,"graph-".concat(r,".svg"))},e.prototype.parseTemplate=function(t,e){return t.replace(/\$\{(\w+)\}/g,(function(t,n){var i=e[n];return null!=i?String(i):t}))},e.prototype.updateHoverOverlay=function(t){var e,n=this.renderSettings.defaultHoverTemplate,i=this.graph.getNodeAttributes(t);if(this.hoveredNode===t){var r=n&&(i.htmlHover||this.renderSettings.showHtmlHoverDefault&&!1!==i.htmlHover),o=void 0!==i.labelToDisplay&&null!==i.labelToDisplay?String(i.labelToDisplay):void 0!==i.label&&null!==i.label?String(i.label):"";if(r||o){if(!this.hoverOverlay){var a=document.createElement("div");a.style.position="fixed",a.style.pointerEvents="none",a.style.border="1px solid #ccc",a.style.borderRadius="4px",a.style.backgroundColor="#fff",a.style.padding="4px",a.style.zIndex="10000",document.body.appendChild(a),this.hoverOverlay=a}var s=this.hoverOverlay;r?s.innerHTML=this.parseTemplate(String(n),i):s.textContent=o;var h,u,c=null!==(e=this.lastMousePosition)&&void 0!==e?e:(h=this.renderer.graphToViewport({x:Number(i.x||0),y:Number(i.y||0)}),{x:(u=this.renderer.getCanvas().getBoundingClientRect()).left+h.x,y:u.top+h.y});s.style.display="block",s.style.left="".concat(c.x+10,"px"),s.style.top="".concat(c.y+10,"px")}else this.removeHoverOverlay()}else this.removeHoverOverlay()},e.prototype.removeHoverOverlay=function(){this.hoverOverlay&&(this.hoverOverlay.style.display="none",this.hoverOverlay.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(t,e){void 0===e&&(e=!0),this._selectedNodes=t,this.updateNodeSelection(),this.removeHoverOverlay(),e&&this.onSelectedNodesChange(t),this.refresh()},e.prototype.updateNodeSelection=function(){var t=new Set(this.selectedNodes);this.graph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t.has(i);return Lt(Lt({},n),{highlighted:r})}))},Object.defineProperty(e.prototype,"highlightedNodes",{get:function(){return this._highlightedNodes},set:function(t){this._highlightedNodes=t,this.updateNodeHighlighting(),this.onHighlightedNodesChange(t),this.refresh()},enumerable:!1,configurable:!0}),e.prototype.updateHighlightedNodes=function(t){this.highlightedNodes=t},e.prototype.updateNodeHighlighting=function(){var t=this,e=new Set(this.highlightedNodes);this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=e.has(r);if(o&&(void 0!==i.border||void 0!==i.originalBorder))return i.hasOwnProperty("originalBorder")||(i.originalBorder=i.border||null),Lt(Lt({},i),{border:t.highlightedNodeColor});if(!o&&i.hasOwnProperty("originalBorder")){var a=null===i.originalBorder?void 0:i.originalBorder;return delete i.originalBorder,Lt(Lt({},i),{border:a})}return i}))},Object.defineProperty(e.prototype,"isFullScreen",{get:function(){return this._isFullScreen},set:function(t){this._isFullScreen=t,this.onFullScreenChange(t)},enumerable:!1,configurable:!0}),e.prototype.updateGraph=function(t,e){void 0===e&&(e=!1);var n=this.renderer.getBBox(),i=this.renderer.getCameraState();if(this.graph=t,this.renderer.setGraph(t),e)this.renderer.setCameraState(i);else{var r=this.renderer.getBBox(),o=this.mapCameraForBBoxTransition(i,n,r);this.renderer.setCameraState({x:o.x,y:o.y,ratio:o.ratio})}this.refresh()},e.prototype.layoutBoundsToRendererBBox=function(t){return{x:[t.minX,t.maxX],y:[t.minY,t.maxY]}},e.prototype.mapCameraForBBoxTransition=function(t,e,n){var i=this.renderer.getCameraForBBox(e,1),r=this.renderer.getCameraForBBox(n,1),o=Math.max(.01,i.ratio),a=r.ratio/o,s=Math.min(20,Math.max(.05,a));return{x:r.x+(t.x-i.x)*s,y:r.y+(t.y-i.y)*s,ratio:Math.max(.01,t.ratio*s),angle:0}},e.prototype.updateAnimator=function(t){this.animator&&this.animator.kill(),this.animator=t},e.prototype.resetCamera=function(){return Dt(this,void 0,void 0,(function(){return Gt(this,(function(t){switch(t.label){case 0:return[4,this.resetView()];case 1:return t.sent(),[2]}}))}))},e.prototype.zoomInAndOut=function(){return Dt(this,void 0,void 0,(function(){return Gt(this,(function(t){switch(t.label){case 0:return[4,this.zoomOut()];case 1:return t.sent(),[4,this.zoomIn()];case 2:return t.sent(),[2]}}))}))},e.prototype.updateRenderSettings=function(t){var e=this;this.renderSettings=Lt(Lt({},this.renderSettings),t),Object.keys(t).forEach((function(n){var i=n;e.renderer.setSetting(i,t[i])})),this.refresh()},e.prototype.resetGraphBounds=function(){this.renderer.setCustomBBox({x:[-350,350],y:[-220,220]})},e.prototype.refresh=function(){this.renderer.isContextLost()?this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="visible"):this.renderer.refresh()},e.prototype.unregisterRendererEvents=function(){this.renderer.off("enterNode",this.handleEnterNode),this.renderer.off("leaveNode",this.handleLeaveNode),this.renderer.off("downNode",this.handleDownNode),this.renderer.off("doubleClickNode",this.handleNodeDoubleClick),this.renderer.off("doubleClickStage",this.handleDoubleClickStage),this.renderer.off("contextLost",this.handleRendererContextLost),this.renderer.off("contextRestored",this.handleRendererContextRestored);var t=this.renderer.getCanvas();t.removeEventListener("wheel",this.handleWheel),t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleCanvasMouseMove),window.removeEventListener("mousemove",this.handleMouseMoveBody),window.removeEventListener("mouseup",this.handleMouseUp)},e.prototype.cleanup=function(){this.unregisterRendererEvents(),document.removeEventListener("keydown",this.handleLassoModifierDown),document.removeEventListener("keyup",this.handleLassoModifierUp),window.removeEventListener("blur",this.handleWindowBlur),this.hoveredNode=null,this.removeHoverOverlay(),this.hoverOverlay&&(this.hoverOverlay.remove(),this.hoverOverlay=null)},e.prototype.dispose=function(){this.cleanup(),this.renderer.dispose()},e.prototype.applyInitialLayout=function(t){return Dt(this,void 0,void 0,(function(){return Gt(this,(function(t){return[2]}))}))},e}(),zt=function(){return zt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},zt.apply(this,arguments)},Rt=function(){function t(t,e,n,i){var r=this;this.callback=null,this.graph=t,this.endPositions=e,this.animation_type=n,this.frameID=null,this.running=!1,this.startPositions=new Array(t.nodes().length),this.graph.forEachNode((function(t,e){var n=Number(t);r.startPositions[n]={x:e.x,y:e.y}})),this.duration=i}return t.prototype.isRunning=function(){return this.running},t.prototype.updateNodePositions=function(t){var e=this;this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=e.endPositions[r],a=e.startPositions[r],s=(o.x-a.x)*t,h=(o.y-a.y)*t;return zt(zt({},i),{x:a.x+s,y:a.y+h})}))},t.prototype.runFrame=function(){var t=this;this.startTime||(this.startTime=Date.now());var e=Math.min((Date.now()-this.startTime)/this.duration,1);this.updateNodePositions(e),1===e?this._kill():this.frameID=window.requestAnimationFrame((function(){return t.runFrame()}))},t.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},t.prototype.run=function(t){this.callback=t,this.running||(this.startTime=Date.now(),this.running=!0,this.runFrame())},t.prototype._kill=function(){this._stop()},t}(),Ot=function(){return Ot=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Ot.apply(this,arguments)},Tt=function(){function t(t){var e=this;this.sliderValues={},this.sliderConfigs=[],this.views=[],this.listeners={},this.sliderConfigs=t,t.forEach((function(t){e.sliderValues[t.label]=t.initialValue,e.listeners[t.label]=[]}))}return t.prototype.callListeners=function(t){var e=this;this.listeners[t].forEach((function(n){n(e.sliderValues[t])}))},t.prototype.getView=function(t){var e=this,n=this.sliderConfigs.map((function(t,n){return Ot(Ot({},t),{initialValue:e.getSliderValue(t.label)||t.initialValue})})),i=new Vt(t,n);return Object.keys(this.sliderValues).forEach((function(t){i.addListener(t,(function(n){var i=Number(n.target.value);e.setSliderValue(t,i),e.callListeners(t)}))})),this.views.push(i),i},t.prototype.deleteView=function(t){this.views=this.views.filter((function(e){return e!==t}))},t.prototype.getSliderValue=function(t){return this.sliderValues[t]||null},t.prototype.setSliderValue=function(t,e){this.sliderValues[t]=e,this.views.forEach((function(n){n.setSliderValue(t,e)}))},t.prototype.addListener=function(t,e){this.listeners[t].push(e)},t}(),Vt=function(){function t(t,e){var n=this;this.sliders={},this.sliderValues={};var i=this.createSliderContainer();t.appendChild(i),e.forEach((function(t){var e=n.createSliderWrapper(t),r=e.wrapper,o=e.slider,a=e.labelElement;i.appendChild(r),n.sliders[t.label]=o,n.sliderValues[t.label]=a,o.addEventListener("input",(function(){a.textContent=o.value}))}))}return t.prototype.createSliderContainer=function(){var t=document.createElement("div");return t.className="slider-container",t},t.prototype.createSliderWrapper=function(t){var e=document.createElement("div");e.className="slider-wrapper";var n=document.createElement("label");n.className="slider-label",n.textContent="".concat(t.label,":");var i=document.createElement("input");i.type="range",i.className="slider",i.min=t.minValue.toString(),i.max=t.maxValue.toString(),i.step=t.step.toString(),i.value=t.initialValue.toString();var r=document.createElement("span");return r.className="slider-value",r.textContent=t.initialValue.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(r),{wrapper:e,slider:i,labelElement:r}},t.prototype.setSliderValue=function(t,e){this.sliders[t].value=e.toString(),this.sliderValues[t].textContent=e.toString()},t.prototype.addListener=function(t,e){this.sliders[t].addEventListener("change",e)},t}(),It=function(){function t(t,e,n){this.container=t,this.graphManager=new Bt(n),this.initializeSliderView(e)}return t.prototype.initializeSliderView=function(t){this.sliderView=t.getView(this.container)},t.prototype.appendGraphToContainer=function(){this.container.appendChild(this.graphManager.getGraphContainer())},t}(),Ut=n(698),jt=n.n(Ut);class Ht{static _xfnv1a(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return()=>(e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,(e+=e<<5)>>>0)}}class Wt extends Ht{constructor(t){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=Wt._xfnv1a(t)()}next(){let t=this.a+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}class Yt extends Ht{constructor(t){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 e=Yt._xfnv1a(t);this.a=e(),this.b=e(),this.c=e(),this.d=e()}next(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;let t=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,t=t+this.d|0,this.c=this.c+t|0,(t>>>0)/4294967296}}class Xt extends Ht{constructor(t){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 e=Xt._xfnv1a(t);this.a=e(),this.b=e(),this.c=e(),this.d=e()}next(){const t=this.b<<9;let e=5*this.b;return e=9*(e<<7|e>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=t,this.d=this.d<<11|this.d>>>21,(e>>>0)/4294967296}}!function(t){t.sfc32="sfc32",t.mulberry32="mulberry32",t.xoshiro128ss="xoshiro128ss"}(Ft||(Ft={}));class qt{constructor(t,e=Ft.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=t,this.prng=e,this.generator=this._initializeGenerator()}next(){return this.generator.next()}_initializeGenerator(){if((t=>null===t)(t=this.str)||(t=>void 0===t)(t))return this.wrap();var t;switch(this.prng){case"sfc32":return new Yt(this.str);case"mulberry32":return new Wt(this.str);case"xoshiro128ss":return new Xt(this.str);default:return this.wrap()}}wrap(){return{next:()=>Math.random()}}}var Kt=function(){return Kt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Kt.apply(this,arguments)},Zt=n(739),Jt=function(t,e,n){return t.reduce((function(t,i){var r,o=null===(r=e[n])||void 0===r?void 0:r.nodes[i];return o&&t.push.apply(t,o.points),t}),[])},$t=function(t,e,n){var i=new Set,r=n[t];return e.forEach((function(t){i.add(r[t])})),Array.from(i)},Qt=function(t){var e=1/0,n=1/0,i=-1/0,r=-1/0;return t.forEachNode((function(t,o){var a=o.x,s=o.y;a<e&&(e=a),s<n&&(n=s),a>i&&(i=a),s>r&&(r=s)})),{minX:e,minY:n,maxX:i,maxY:r}},te=function(t,e){var n=new(jt()),i=new qt("nodes-".concat(t.nodes.length,"-edges-").concat(t.edges.length));t.nodes.forEach((function(t,e){var r,o;n.addNode(e,Kt(Kt({},t),{x:null!==(r=t.x)&&void 0!==r?r:100*i.next(),y:null!==(o=t.y)&&void 0!==o?o:100*i.next()}))}));var r=t.nodes.length,o=Math.ceil(e*r/2);return t.edges.slice(0,o).forEach((function(t){var e;n.addEdge(t.s,t.t,Kt(Kt({},t),{weight:null!==(e=t.weight)&&void 0!==e?e:t.w}))})),n},ee=function(t){return{label:t.label,minValue:t.minValue,maxValue:t.maxValue,initialValue:t.initialValue,step:t.step}},ne=function(){return ne=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},ne.apply(this,arguments)},ie=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))},re=function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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])}}},oe=function(){function t(t){var e=this;this.views=[],this.selectedNodes=[],this.selectedPoints=[],this.initialLayoutPromise=null;var n=t.graphData,i=t.sliderConfig,r=t.renderSettings,o=t.onSelectedNodesChange,a=t.onSelectedPointsChange,s=t.onFullScreenChange,h=t.onCoarsenessChange,u=t.onConnectivityChange,c=t.nodeColors,d=t.nodeLabels,l=t.nodeHoverLabels,p=t.nodeAttrs,f=t.defaultHoverTemplate,g=t.layoutConfig,v=t.showButtons,y=t.isFullScreen,m=t.highlightHoverNeighbors;this.graphData=n,this.sliderConfig=i,this.renderSettings=ne({defaultHoverTemplate:f},r),this.nodeColors=c,this.nodeLabels=d,this.nodeHoverLabels=l,this.nodeAttrs=p,this.defaultHoverTemplate=f,this.layoutConfig=g||{},this.showButtons=v,this.isFullScreen=y,this.highlightHoverNeighbors=null!=m&&m,this.onSelectedNodesChange=o,this.onSelectedPointsChange=a,this.onFullScreenChange=s,this.onCoarsenessChange=h,this.onConnectivityChange=u,this.selectedLevel=this.sliderConfig.selectedLevel,this.sliderManager=new Tt([ee(i.coarseness),ee(i.connectivity)]),this.addSliderListeners(),this.nDataPoints=Math.max.apply(Math,this.graphData[this.selectedLevel].nodes.map((function(t){return Math.max.apply(Math,t.points)})))+1,this.dataPointMaps=function(t,e){var n={};return Object.keys(t).forEach((function(i){n[i]=function(t,e){var n=Array(e);return t.forEach((function(t,e){t.forEach((function(t){n[t]=e}))})),n}(t[i].nodes.map((function(t){return t.points})),e)})),n}(this.graphData,this.nDataPoints),this.currentGraph=te(this.graphData[this.selectedLevel],this.sliderConfig.connectivity.initialValue);var b=ne(ne({},xt(this.currentGraph)),this.layoutConfig);this.initialLayoutPromise=this.runInitialLayout({iterations:300,settings:ne(ne({},b),{warmupLayout:!0})}).then((function(){e.resetAllGraphViews(),e.initialLayoutPromise=null})),this.updateNodeAttributes()}return t.prototype.getView=function(t){return ie(this,void 0,void 0,(function(){var e,n,i=this;return re(this,(function(r){switch(r.label){case 0:return!this.initialLayoutPromise&&this.animator?[3,2]:[4,this.initialLayoutPromise];case 1:r.sent(),r.label=2;case 2:if(this.pruneDisconnectedViews(),e=this.views.find((function(e){return e.container===t})))return[2,e];if(!this.animator)throw Error("Animator does not exist. Cannot get GraphView.");return n=new It(t,this.sliderManager,{graph:this.currentGraph,animator:this.animator,mode:At.inactive,settings:this.renderSettings,isFullScreen:this.isFullScreen,neighborHighlightingEnabled:this.highlightHoverNeighbors,selectedNodes:[],onSelectedNodesChange:function(t){i.selectedNodes=t,i.selectedPoints=Jt(i.selectedNodes,i.graphData,i.selectedLevel),i.onSelectedNodesChange(t),i.onSelectedPointsChange(i.selectedPoints)},onFullScreenChange:function(t){return i.onFullScreenChange(t)},onHighlightedNodesChange:function(){},showButtons:this.showButtons}),this.views.push(n),n.appendGraphToContainer(),this.animator.start(),[4,n.graphManager.resetView()];case 3:return r.sent(),[2,n]}}))}))},t.prototype.deleteView=function(t){this.views=this.views.filter((function(e){return e!==t}))},t.prototype.pruneDisconnectedViews=function(){var t=this,e=this.views.filter((function(t){return!t.container.isConnected}));0!==e.length&&(e.forEach((function(e){e.graphManager.cleanup(),e.graphManager.dispose(),t.sliderManager.deleteView(e.sliderView)})),this.views=this.views.filter((function(t){return t.container.isConnected})))},t.prototype.setConnectivityLevel=function(t){var e=this,n=this.graphData[this.selectedLevel];this.currentGraph.clearEdges();var i=n.nodes.length,r=Math.ceil(t*i/2);n.edges.slice(0,r).forEach((function(t){var n;e.currentGraph.addEdge(t.s,t.t,ne(ne({},t),{weight:null!==(n=t.weight)&&void 0!==n?n:t.w}))})),this.resetAnimator()},t.prototype.setCoarsenessLevel=function(t,e){return void 0===e&&(e=!1),ie(this,void 0,void 0,(function(){var n,i,r;return re(this,(function(o){return t==this.selectedLevel||(n=this.selectedPoints,i=this.initializeNewGraph(t),r=$t(t,n,this.dataPointMaps),this.updateGraphAndViewsWithNewGraph(i,r,e)),[2]}))}))},t.prototype.setIsFullScreen=function(t){this.isFullScreen=t,this.views.forEach((function(e){e.graphManager.isFullScreen=t}))},t.prototype.setNodeColors=function(t){this.nodeColors=t,this.updateNodeColors()},t.prototype.setNodeLabels=function(t){this.nodeLabels=t,this.updateNodeLabels()},t.prototype.setNodeHoverLabels=function(t){this.nodeHoverLabels=t,this.updateNodeHoverLabels()},t.prototype.setNodeAttrs=function(t){this.nodeAttrs=t,this.updateNodeAttributes()},t.prototype.setNodeHoverTemplate=function(t){this.defaultHoverTemplate=t,this.renderSettings.defaultHoverTemplate=t,this.updateAllGraphRenderSettings()},t.prototype.setSelectedNodes=function(t){this.selectedNodes=t,this.selectedPoints=Jt(this.selectedNodes,this.graphData,this.selectedLevel),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes),this.onSelectedPointsChange(this.selectedPoints)},t.prototype.setSelectedPoints=function(t){this.selectedPoints=t,this.selectedNodes=$t(this.selectedLevel,t,this.dataPointMaps),this.onSelectedPointsChange(t),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes)},t.prototype.resetView=function(){var t=this;this.views.forEach((function(e){return ie(t,void 0,void 0,(function(){return re(this,(function(t){switch(t.label){case 0:return[4,e.graphManager.resetView()];case 1:return t.sent(),[2]}}))}))}))},t.prototype.cleanup=function(){var t;this.views.forEach((function(t){t.graphManager.cleanup()})),null===(t=this.animator)||void 0===t||t.kill()},t.prototype.dispose=function(){var t;this.views.forEach((function(t){t.graphManager.dispose()})),null===(t=this.animator)||void 0===t||t.kill()},t.prototype.initializeNewGraph=function(t){var e=this.dataPointMaps[this.selectedLevel],n=this.currentGraph;this.selectedLevel=t;var i=Number(this.sliderManager.getSliderValue(this.sliderConfig.connectivity.label)),r=te(this.graphData[t],i),o=function(t,e){var n=new Array(e.nodes().length);return e.forEachNode((function(e,i){var r=Number(e),o=i.points,a=new Set;o.forEach((function(e){a.add(t[e])})),n[r]=Array.from(a)})),n}(e,r);return function(t,e,n){var i=Qt(t),r=i.minX,o=i.minY,a=i.maxX,s=i.maxY,h=e.order/t.order,u=Math.max(10,a-r)/100,c=Math.max(10,s-o)/100,d=Math.max(u,c);e.updateEachNodeAttributes((function(e,i){var r=Number(e),o=n[r],a=o.map((function(e){try{return t.getNodeAttribute(e,"x")}catch(t){return 0}})),s=o.map((function(e){try{return t.getNodeAttribute(e,"y")}catch(t){return 0}})),u=0,c=a.reduce((function(t,e){return isFinite(e)?(u+=1,t+e):t}),0),l=c/Math.max(u,1),p=0,f=s.reduce((function(t,e){return isFinite(e)?(p+=1,t+e):t}),0),g=f/Math.max(p,1);return Kt(Kt({},i),{x:h*(l+d*Math.random()),y:h*(g+d*Math.random())})}))}(n,r,o),r},t.prototype.updateGraphAndViewsWithNewGraph=function(t,e,n){var i,r=this;this.normalizeNewGraphScaleBeforeTransition(t),this.selectedNodes=e,this.onSelectedNodesChange(e);var s=ne(ne(ne({},xt(t)),this.layoutConfig),null===(i=this.animator)||void 0===i?void 0:i.params.settings),h=Qt(t);(function(t,e){return void 0===e&&(e={}),i=function(){var n,i,r,s,h,u,c,d,l,p,f;return function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(g){switch(g.label){case 0:return n=Kt(Kt(Kt({},xt(t)),e),{warmupLayout:!0}),i=(0,o.kS)(t).map((function(t){return t.map(Number)})),r=at(t),s=Zt.createWorker(a),h={iterations:100,nAnnealingSteps:4,settings:n,nodes:r.nodes.buffer,edges:r.edges.buffer,components:i,__messageId:"initialGraphLayout"},console.log("getStableLayout settings",n),s.postMessage(h,[r.nodes.buffer,r.edges.buffer]),[4,new Promise((function(t){s.onmessage=function(e){t({nodes:new Float32Array(e.data.nodes),settings:e.data.settings}),s.terminate()}}))];case 1:for(u=g.sent(),c=t.nodes().length,d=[],l=0;l<c;l++)p=u.nodes[10*l],f=u.nodes[10*l+1],d.push({x:p,y:f});return[2,{endPositions:d,settings:u.settings}]}}))},new((n=void 0)||(n=Promise))((function(t,e){function r(t){try{a(i.next(t))}catch(t){e(t)}}function o(t){try{a(i.throw(t))}catch(t){e(t)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(t){t(i)}))).then(r,o)}a((i=i.apply(void 0,[])).next())}));var n,i})(t,s).then((function(i){var o,a,s,u,c,d=i.endPositions,l=i.settings,p=d,f=(a=1/0,s=1/0,u=-1/0,c=-1/0,d.forEach((function(t){var e=t.x,n=t.y;e<a&&(a=e),n<s&&(s=n),e>u&&(u=e),n>c&&(c=n)})),{minX:a,minY:s,maxX:u,maxY:c});r.layoutConfig=l,r.currentGraph.updateEachNodeAttributes((function(t,e){return ne(ne({},e),{highlighted:!1})})),r.updateAllGraphViews(t,e),r.updateNodeAttributes(),r.views.forEach((function(t){t.graphManager.unzoomAndShiftForLayoutBounds(h,f,500)}));var g=new Rt(r.currentGraph,p,"linear",500);null===(o=r.animator)||void 0===o||o.kill(),g.run((function(){var t=r.getNewAnimator(l);r.animator=t,r.views.forEach((function(e){n&&e.graphManager.resetView(),e.graphManager.updateAnimator(t)})),r.animator.start()}))}))},t.prototype.updateNodeColors=function(){if(this.nodeColors){var t=this.nodeColors[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return ne(ne({},n),{color:r||n.color})}))}},t.prototype.updateNodeLabels=function(){if(this.nodeLabels){var t=this.nodeLabels[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return ne(ne({},n),{label:r||n.label})}))}},t.prototype.updateNodeHoverLabels=function(){if(this.nodeHoverLabels){var t=this.nodeHoverLabels[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return ne(ne({},n),{labelToDisplay:r||n.labelToDisplay})}))}},t.prototype.updateViewsSelectedNodes=function(){var t=this;this.views.forEach((function(e){e.graphManager.setSelectedNodes(t.selectedNodes,!1)}))},t.prototype.updateNodeAttributes=function(){if(this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.nodeAttrs){var t=this.nodeAttrs[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return ne(ne({},n),r||{})}))}},t.prototype.runInitialLayout=function(t){return ie(this,void 0,void 0,(function(){var e;return re(this,(function(n){switch(n.label){case 0:return[4,dt(this.currentGraph,t)];case 1:return e=n.sent(),console.log("runInitialLayout returned settings",e),this.animator&&this.animator.kill(),this.animator=this.getNewAnimator(),this.animator.params.settings=e,this.layoutConfig=e,this.animator.forceNodePositionUpdate(),this.startAnimator(),[2]}}))}))},t.prototype.resetAnimator=function(){var t;null===(t=this.animator)||void 0===t||t.kill(),this.animator=this.getNewAnimator(),this.startAnimator()},t.prototype.startAnimator=function(){if(this.animator){this.animator.start();var t=this.animator;this.views.forEach((function(e){e.graphManager.updateAnimator(t)}))}},t.prototype.getNewAnimator=function(t){var e;return new ht(this.currentGraph,{settings:ne(ne(ne(ne({},xt(this.currentGraph)),this.layoutConfig),null===(e=this.animator)||void 0===e?void 0:e.params.settings),t||{})},{maxiters:1500,miniters:200,convergenceThreshold:.1})},t.prototype.addSliderListeners=function(){var t=this;this.sliderManager.addListener(this.sliderConfig.coarseness.label,(function(e){return ie(t,void 0,void 0,(function(){return re(this,(function(t){switch(t.label){case 0:return[4,this.handleCoarsenessChange(e)];case 1:return t.sent(),this.onCoarsenessChange(e),[2]}}))}))})),this.sliderManager.addListener(this.sliderConfig.connectivity.label,(function(e){t.handleConnectivityChange(e),t.onConnectivityChange(e)}))},t.prototype.handleCoarsenessChange=function(t){return ie(this,void 0,void 0,(function(){return re(this,(function(e){switch(e.label){case 0:return[4,this.setCoarsenessLevel(t.toString())];case 1:return e.sent(),[2]}}))}))},t.prototype.handleConnectivityChange=function(t){this.setConnectivityLevel(t)},t.prototype.updateAllGraphViews=function(t,e){this.currentGraph=t,this.views.forEach((function(e){e.graphManager.updateGraph(t,!0)})),this.selectedNodes=e,this.updateViewsSelectedNodes()},t.prototype.updateAllGraphRenderSettings=function(){var t=this;this.views.forEach((function(e){e.graphManager.updateRenderSettings(t.renderSettings)}))},t.prototype.normalizeNewGraphScaleBeforeTransition=function(t){var e=Math.max(1,this.currentGraph.order),n=Math.max(1,t.order)/e;if(Number.isFinite(n)&&!(n<=0)&&!(Math.abs(n-1)<1e-9)){var i=1/n;t.updateEachNodeAttributes((function(t,e){var n=Number(e.x),r=Number(e.y);return ne(ne({},e),{x:Number.isFinite(n)?n*i:n,y:Number.isFinite(r)?r*i:r})}))}},t.prototype.resetAllGraphViews=function(){this.views.forEach((function(t){t.graphManager.resetView()}))},t}();const ae={GraphManager:Bt,MultiResolutionGraph:oe,GraphView:It,initialGraphLayout:dt,relativeComponentLayout:it,getLayoutSettings:xt,ForceAtlasAnimator:ht,LinearAnimator:Rt,exportGraphToSVG:mt,downloadSVG:bt}})(),i})(),t.exports=e()},364:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n,i,r,o=t[1]||"",a=t[3];if(!a)return o;if(e&&"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(t){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(t," */")}));return[o].concat(h).concat([s]).join("\n")}return[o].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);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<t.length;s++){var h=[].concat(t[s]);i&&r[h[0]]||(n&&(h[2]?h[2]="".concat(n," and ").concat(h[2]):h[2]=n),e.push(h))}},e}},463:(t,e,n)=>{var i=n(72),r=n(930);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.id,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},356:(t,e,n)=>{var i=n(72),r=n(969);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.id,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},72:(t,e,n)=>{"use strict";var i,r=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),o=[];function a(t){for(var e=-1,n=0;n<o.length;n++)if(o[n].identifier===t){e=n;break}return e}function s(t,e){for(var n={},i=[],r=0;r<t.length;r++){var s=t[r],h=e.base?s[0]+e.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,e),references:1}),i.push(c)}return i}function h(t){var e=document.createElement("style"),i=t.attributes||{};if(void 0===i.nonce){var o=n.nc;o&&(i.nonce=o)}if(Object.keys(i).forEach((function(t){e.setAttribute(t,i[t])})),"function"==typeof t.insert)t.insert(e);else{var a=r(t.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(e)}return e}var u,c=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function d(t,e,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(t.styleSheet)t.styleSheet.cssText=c(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function l(t,e,n){var i=n.css,r=n.media,o=n.sourceMap;if(r?t.setAttribute("media",r):t.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}var p=null,f=0;function g(t,e){var n,i,r;if(e.singleton){var o=f++;n=p||(p=h(e)),i=d.bind(null,n,o,!1),r=d.bind(null,n,o,!0)}else n=h(e),i=l.bind(null,n,e),r=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=s(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var i=0;i<n.length;i++){var r=a(n[i]);o[r].references--}for(var h=s(t,e),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:e=>{"use strict";e.exports=t},330:t=>{"use strict";t.exports=JSON.parse('{"name":"landscape-widget","version":"0.5.0-b.1","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(t){var r=n[t];if(void 0!==r)return r.exports;var o=n[t]={id:t,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__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:()=>e});const t=i(330),e=t.version,n=t.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(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)});function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var c,d=function(){function t(){}return t._xfnv1a=function(t){for(var e=2166136261,n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return function(){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,(e+=e<<5)>>>0}},t}(),l=function(t){function e(n){var i=t.call(this)||this;return i.a=e._xfnv1a(n)(),i}return u(e,t),e.prototype.next=function(){var t=this.a+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},e}(d),p=function(t){function e(n){var i=t.call(this)||this,r=e._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(e,t),e.prototype.next=function(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;var t=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,t=t+this.d|0,this.c=this.c+t|0,(t>>>0)/4294967296},e}(d),f=function(t){function e(n){var i=t.call(this)||this,r=e._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(e,t),e.prototype.next=function(){var t=this.b<<9,e=5*this.a;return e=e<<7|9*(e>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=t,this.d=this.d<<11|this.d>>>21,(e>>>0)/4294967296},e}(d);!function(t){t.sfc32="sfc32",t.mulberry32="mulberry32",t.xoshiro128ss="xoshiro128ss"}(c||(c={}));var g=function(){function t(t,e){void 0===e&&(e=c.sfc32),this.str=t,this.prng=e,this.generator=this._initializeGenerator()}return t.prototype.next=function(){return this.generator.next()},t.prototype._initializeGenerator=function(){if(function(t){return null===t}(t=this.str)||function(t){return void 0===t}(t))return this.wrap();var t;switch(this.prng){case"sfc32":return new p(this.str);case"mulberry32":return new l(this.str);case"xoshiro128ss":return new f(this.str);default:return this.wrap()}},t.prototype.wrap=function(){return{next:function(){return Math.random()}}},t}(),v=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const y={allowInvalidContainer:!0,zoomToSizeRatioFunction:t=>t<=1?Math.max(Math.sqrt(t),.05):Math.min(Math.sqrt(t),3),edgeZoomToSizeRatioFunction:t=>t<=1?Math.max(Math.sqrt(t),.5):Math.min(Math.sqrt(t),3),showHtmlHoverDefault:!0,edgeSize:1,edgeMaxSize:4,edgeWeightToSize:!1,highlightHaloColor:"rgba(0, 0, 0, 0.8)",highlightHaloExpansion:.8,highlightHaloGap:4,highlightHaloFadeExponent:1.8,highlightHoverNeighbors:!1},m={adjustSizes:!0};class b extends o.DOMWidgetModel{initialize(t,e){super.initialize(t,e),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("change:is_expanded_layout",this.updateExpandedLayoutButton,this),this.on("msg:custom",this.handleCustomMessage,this),this.loadGraph()}loadGraph(){return v(this,void 0,void 0,(function*(){const t=this.get("graph"),e=this.get("node_labels"),n=this.get("node_hover_labels"),i=Object.keys(t).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 t=String(u.width),e=String(u.height);if(t.endsWith("px")&&e.endsWith("px")){const n=Number(t.slice(0,t.length-2)),i=Number(e.slice(0,e.length-2));c.expectedDims=[n,i]}}const d=Object.assign(Object.assign({},y),this.get("sigma_settings")||{});this.multiResolutionGraph=new s.MultiResolutionGraph({graphData:t,sliderConfig:h,renderSettings:d,onSelectedNodesChange:()=>{},onSelectedPointsChange:this.setSelectedPoints.bind(this),onFullScreenChange:this.toggleExpandedLayout.bind(this),onCoarsenessChange:this.setCoarsenessLevel.bind(this),onConnectivityChange:this.setConnectivityLevel.bind(this),nodeLabels:e,nodeHoverLabels:n,layoutConfig:Object.assign(Object.assign({adjustSizes:!0},c),this.get("layout_config")),showButtons:this.get("show_buttons"),isFullScreen:this.get("is_expanded_layout"),highlightHoverNeighbors:d.highlightHoverNeighbors}),this.updateNodeProperties(),this.updateHoverTemplate()}))}updateNodeProperties(){this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.updateNodeAttrs()}setSelectedPoints(t){this.set("selected_points",t),this.save_changes()}toggleExpandedLayout(t){this.set("is_expanded_layout",t),this.save_changes()}setCoarsenessLevel(t){this.set("selected_level",t),this.save_changes()}setConnectivityLevel(t){this.set("avg_degree",t),this.save_changes()}updateNodeColors(){if(!this.multiResolutionGraph)return;const t=this.get("colors");t&&this.multiResolutionGraph.setNodeColors(t)}updateNodeLabels(){if(!this.multiResolutionGraph)return;const t=this.get("node_labels");t&&this.multiResolutionGraph.setNodeLabels(t)}updateNodeHoverLabels(){if(!this.multiResolutionGraph)return;const t=this.get("node_hover_labels");t&&this.multiResolutionGraph.setNodeHoverLabels(t)}updateNodeAttrs(){if(!this.multiResolutionGraph)return;const t=this.get("node_attrs");t&&this.multiResolutionGraph.setNodeAttrs(t)}updateExpandedLayoutButton(){const t=this.get("is_expanded_layout");this.multiResolutionGraph.setIsFullScreen(t)}updateHoverTemplate(){if(!this.multiResolutionGraph)return;const t=this.get("rich_node_hover_template");t&&this.multiResolutionGraph.setNodeHoverTemplate(t)}updateSelectedLevel(){return v(this,void 0,void 0,(function*(){if(!this.multiResolutionGraph)return;const t=this.get("selected_level");t&&String(t)!==String(this.multiResolutionGraph.selectedLevel)&&(yield this.multiResolutionGraph.setCoarsenessLevel(t),this.multiResolutionGraph.sliderManager.setSliderValue("Coarseness",t))}))}updateAvgDegree(){if(!this.multiResolutionGraph)return;const t=this.get("avg_degree");(t||0===t)&&(this.multiResolutionGraph.setConnectivityLevel(t),this.multiResolutionGraph.sliderManager.setSliderValue("Connectivity",t))}updateSelectedPoints(){if(!this.multiResolutionGraph)return;const t=this.get("selected_points");t&&this.multiResolutionGraph.setSelectedPoints(t)}disposeGraph(){this.multiResolutionGraph.cleanup(),this.multiResolutionGraph.dispose()}resetView(){this.multiResolutionGraph.resetView()}handleCustomMessage(t){"dispose_graph"===t.event_type?this.disposeGraph():"reset_view"===t.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:y,background_color:null,is_expanded_layout:!1,layout_settings:m})}}b.serializers=Object.assign(Object.assign({},o.DOMWidgetModel.serializers),{colors:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},graph:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_labels:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_hover_labels:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_attrs:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)}}),b.model_name="LandscapeModel",b.model_module=n,b.model_module_version=e,b.view_name="LandscapeView",b.view_module=n,b.view_module_version=e;class w extends o.DOMWidgetView{constructor(t){super(t),this.setupRequestId=0,this.setupRetryTimer=null,this.removed=!1,this.view=null;const e=new g;this.containerId=`landscape-container-${e.next().toString(36).substring(2)}`}render(){this.removed=!1,this.createLandscapeContainer(),this.setupRequestId+=1,this.setupGraphManager(this.setupRequestId),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(t){return v(this,void 0,void 0,(function*(){if(this.removed||t!==this.setupRequestId)return;const e=document.getElementById(this.containerId);if(e&&this.model.multiResolutionGraph){const n=yield this.model.multiResolutionGraph.getView(e);if(this.removed||t!==this.setupRequestId)return void this.disposeTrackedView(n);this.view=n,yield this.view.graphManager.resetView()}else this.setupRetryTimer=window.setTimeout((()=>{this.setupGraphManager(t)}),100)}))}disposeTrackedView(t){t.graphManager.cleanup(),t.graphManager.dispose(),this.model.multiResolutionGraph&&(this.model.multiResolutionGraph.deleteView(t),this.model.multiResolutionGraph.sliderManager.deleteView(t.sliderView))}setBackgroundColor(){const t=this.model.get("background_color");t&&(this.el.style.backgroundColor=t,this._landscapeContainer.style.backgroundColor=t,this._landscapeContainer.style.setProperty("--sigma-background-color",t))}remove(){var t,e;this.removed=!0,this.setupRequestId+=1,null!==this.setupRetryTimer&&(window.clearTimeout(this.setupRetryTimer),this.setupRetryTimer=null),this.model.off("change:background_color",this.setBackgroundColor,this);const n=null!==(t=this.view)&&void 0!==t?t:null===(e=this.model.multiResolutionGraph)||void 0===e?void 0:e.views.find((t=>t.container.id===this.containerId));return n&&(this.disposeTrackedView(n),this.view=null),this.el.querySelectorAll("canvas").forEach((t=>{t.width=1,t.height=1})),super.remove()}}})(),r})()));
1
+ define("landscape-widget",["@jupyter-widgets/base"],(t=>(()=>{var e={930:(t,e,n)=>{(e=n(364)(!1)).push([t.id,".custom-widget {\n padding: 5px;\n}\n\n.landscape-container {\n height: 100%;\n width: 100%;\n}\n",""]),t.exports=e},969:(t,e,n)=>{(e=n(364)(!1)).push([t.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",""]),t.exports=e},858:function(t){var e;e=()=>(()=>{var t={803:(t,e,n)=>{var i=n(186),r=(n(212).B,n(325).De,n(341));e.kS=function(t){var e=[];return function(t,e){if(!i(t))throw new Error("graphology-components: the given graph is not a valid graphology instance.");if(t.order){var n=new r(t),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),t.forEachNeighbor(r,o);e(a)}))}}(t,(function(t){e.push(t)})),e}},341:t=>{function e(t){this.graph=t,this.stack=new Array(t.order),this.seen=new Set,this.size=0}e.prototype.hasAlreadySeenEverything=function(){return this.seen.size===this.graph.order},e.prototype.countUnseenNodes=function(){return this.graph.order-this.seen.size},e.prototype.forEachNodeYetUnseen=function(t){var e=this.seen,n=this.graph;n.someNode((function(i,r){return e.size===n.order||!e.has(i)&&!!t(i,r)}))},e.prototype.has=function(t){return this.seen.has(t)},e.prototype.push=function(t){var e=this.seen.size;return this.seen.add(t),e!==this.seen.size&&(this.stack[this.size++]=t,!0)},e.prototype.pushWith=function(t,e){var n=this.seen.size;return this.seen.add(t),n!==this.seen.size&&(this.stack[this.size++]=e,!0)},e.prototype.pop=function(){if(0!==this.size)return this.stack[--this.size]},t.exports=e},847:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},739:(t,e)=>{e.assign=function(t){t=t||{};var e,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(e=0,i=r.length;e<i;e++)if(r[e])for(n in r[e])t[n]=r[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.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."}},e.graphToByteArrays=function(t,e){var n,i=t.order,r=t.size,o={},a=new Float32Array(10*i),s=new Float32Array(3*r);return n=0,t.forEachNode((function(t,e){o[t]=n,a[n]=e.x,a[n+1]=e.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]=e.size||1,a[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,i,r,h,u,c,d){var l=o[r],p=o[h],f=e(t,i,r,h,u,c,d);a[l+6]+=f,a[p+6]+=f,s[n]=l,s[n+1]=p,s[n+2]=f,n+=3})),{nodes:a,edges:s}},e.assignLayoutChanges=function(t,e,n){var i=0;t.updateEachNodeAttributes((function(t,r){return r.x=e[i],r.y=e[i+1],i+=10,n?n(t,r):r}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,i){e[n]=i.x,e[n+1]=i.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var i=t.nodes(),r={},o=0,a=0,s=e.length;o<s;o+=10){if(n){var h=Object.assign({},t.getNodeAttributes(i[a]));h.x=e[o],h.y=e[o+1],h=n(i[a],h),r[i[a]]={x:h.x,y:h.y}}else r[i[a]]={x:e[o],y:e[o+1]};a++}return r},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),i=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return e.revokeObjectURL(i),r}},325:(t,e)=>{e.De=function(t,e,n,i,r,o){return o=Object.assign({},o),e?null==n?t.addUndirectedEdge(i,r,o):t.addUndirectedEdgeWithKey(n,i,r,o):null==n?t.addDirectedEdge(i,r,o):t.addDirectedEdgeWithKey(n,i,r,o)}},212:(t,e)=>{e.B=function(t,e,n){return n=Object.assign({},n),t.addNode(e,n)}},186:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},698:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function r(t,e,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(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return r(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),i(a,t)},o(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var s=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var i in arguments[e])t[i]=arguments[e][i];return t};function h(t,e,n,i){var r=t._nodes.get(e),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(e){return"object"===t(e)&&null!==e}function c(t){var e;for(e in t)return!1;return!0}function d(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function l(t,e,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(t,e,i)}function p(t){return!(!u(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var f,g={exports:{}},v="object"==typeof Reflect?Reflect:null,y=v&&"function"==typeof v.apply?v.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};f=v&&"function"==typeof v.ownKeys?v.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var m=Number.isNaN||function(t){return t!=t};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}A(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&A(t,"error",e,{once:!0})}(t,r)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var w=10;function x(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _(t){return void 0===t._maxListeners?b.defaultMaxListeners:t._maxListeners}function C(t,e,n,i){var r,o,a,s;if(x(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=_(t))>0&&a.length>r&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,s=h,console&&console.warn&&console.warn(s)}return t}function S(){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 E(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=S.bind(i);return r.listener=n,i.wrapFn=r,r}function M(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):N(r,r.length)}function k(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function N(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function A(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){i.once&&t.removeEventListener(e,r),n(o)}))}}function L(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(t){if("number"!=typeof t||t<0||m(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w=t}}),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(t){if("number"!=typeof t||t<0||m(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},b.prototype.getMaxListeners=function(){return _(this)},b.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=r[t];if(void 0===s)return!1;if("function"==typeof s)y(s,this,e);else{var h=s.length,u=N(s,h);for(n=0;n<h;++n)y(u[n],this,e)}return!0},b.prototype.addListener=function(t,e){return C(this,t,e,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(t,e){return C(this,t,e,!0)},b.prototype.once=function(t,e){return x(e),this.on(t,E(this,t,e)),this},b.prototype.prependOnceListener=function(t,e){return x(e),this.prependListener(t,E(this,t,e)),this},b.prototype.removeListener=function(t,e){var n,i,r,o,a;if(x(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||e)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(t){var e,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[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),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(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},b.prototype.listeners=function(t){return M(this,t,!0)},b.prototype.rawListeners=function(t){return M(this,t,!1)},b.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):k.call(t,e)},b.prototype.listenerCount=k,b.prototype.eventNames=function(){return this._eventsCount>0?f(this._events):[]},"undefined"!=typeof Symbol&&(L.prototype[Symbol.iterator]=function(){return this}),L.of=function(){var t=arguments,e=t.length,n=0;return new L((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},L.empty=function(){return new L((function(){return{done:!0}}))},L.fromSequence=function(t){var e=0,n=t.length;return new L((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},L.is=function(t){return t instanceof L||"object"==typeof t&&null!==t&&"function"==typeof t.next};var D=L,G={};G.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,G.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var P=D,F=G,B=F.ARRAY_BUFFER_SUPPORT,z=F.SYMBOL_SUPPORT,R=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||B&&ArrayBuffer.isView(t)?P.fromSequence(t):"object"!=typeof t||null===t?null:z&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},O=R,T=function(t,e){for(var n,i=arguments.length>1?e:1/0,r=i!==1/0?new Array(i):[],o=0,a=O(t);;){if(o===i)return r;if((n=a.next()).done)return o!==e&&(r.length=o),r;r[o++]=n.value}},V=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),I=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V),U=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V),j=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),n.prototype.constructor),i}return e(n,t),n}(V);function H(t,e){this.key=t,this.attributes=e,this.clear()}function W(t,e){this.key=t,this.attributes=e,this.clear()}function Y(t,e){this.key=t,this.attributes=e,this.clear()}function X(t,e,n,i,r){this.key=e,this.attributes=r,this.undirected=t,this.source=n,this.target=i}function q(t,e,n,i,r,o,a){var s,h,u,c;if(i=""+i,0===n){if(!(s=t._nodes.get(i)))throw new U("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(h=t._edges.get(r)))throw new U("Graph.".concat(e,': 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 U("Graph.".concat(e,': 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=t._edges.get(i)))throw new U("Graph.".concat(e,': 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={}},Y.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},X.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,i=this.target.key;this.source[t][i]=this,this.undirected&&n===i||(this.target[e][n]=this)},X.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,i=this.target.key;this.undirected&&(t=e="undirected");var r=this.source[t],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[e][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[e][n]=this},X.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][e],delete this.target[i][t]},X.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[i][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[i][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){return q(this,e,n,t,i)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var a=q(this,e,n,t,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(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var a=q(this,e,n,t,i,r,o),s=a[0],h=a[1],u=a[2];if("function"!=typeof u)throw new I("Graph.".concat(e,": 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(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,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(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];if(!u(s))throw new I("Graph.".concat(e,": 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(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],h=o[1];if(!u(h))throw new I("Graph.".concat(e,": 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(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=q(this,e,n,t,i,r),a=o[0],s=o[1];if("function"!=typeof s)throw new I("Graph.".concat(e,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],Z=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,o=""+arguments[1];if(!(i=h(this,r,o,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(i=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(o=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" 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(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,s=""+i;if(i=arguments[2],r=arguments[3],!(o=h(this,a,s,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(o=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new I("Graph.".concat(e,": 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(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" 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(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new I("Graph.".concat(e,": 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(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new I("Graph.".concat(e,": 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(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new j("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new j("Graph.".concat(e,": 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=""+t,a=""+i;if(i=arguments[2],!(r=h(this,o,a,n)))throw new U("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new j("Graph.".concat(e,": 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(t=""+t,!(r=this._edges.get(t)))throw new U("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new I("Graph.".concat(e,": 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=D,$=R,Q=function(){var t=arguments,e=null,n=-1;return new J((function(){for(var i=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=$(t[n])}if(!0!==(i=e.next()).done)break;e=null}return i}))},tt=[{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 et(t,e,n,i){var r=!1;for(var o in e)if(o!==i){var a=e[o];if(r=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&r)return a.key}}function nt(t,e,n,i){var r,o,a,s=!1;for(var h in e)if(h!==i){r=e[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),t&&s)return r.key;r=r.next}while(void 0!==r)}}function it(t,e){var n,i=Object.keys(t),r=i.length,o=0;return new D((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var a=i[o++];if(a===e){n=void 0;continue}n=t[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 rt(t,e,n,i){var r=e[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)&&t?r.key:void 0}}function ot(t,e,n,i){var r=e[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),t&&o)return r.key;r=r.next}while(void 0!==r)}}function at(t,e){var n=t[e];return void 0!==n.next?new D((function(){if(!n)return{done:!0};var t={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:t}})):D.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 st(t,e,n,i){if(0!==e.size)for(var r,o,a="mixed"!==n&&n!==e.type,s="undirected"===n,h=!1,u=e._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!a||o.undirected===s){var c=o,d=c.key,l=c.attributes,p=c.source,f=c.target;if(h=i(d,l,p.key,f.key,p.attributes,f.attributes,o.undirected),t&&h)return d}}function ht(t,e,n,i,r,o){var a,s=e?nt:et;if("undirected"!==n){if("out"!==i&&(a=s(t,r.in,o),t&&a))return a;if("in"!==i&&(a=s(t,r.out,o,i?void 0:r.key),t&&a))return a}if("directed"!==n&&(a=s(t,r.undirected,o),t&&a))return a}function ut(t,e,n,i,r,o,a){var s,h=n?ot:rt;if("undirected"!==e){if(void 0!==r.in&&"out"!==i&&(s=h(t,r.in,o,a),t&&s))return s;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(s=h(t,r.out,o,a),t&&s))return s}if("directed"!==e&&void 0!==r.undirected&&(s=h(t,r.undirected,o,a),t&&s))return s}var ct=[{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 dt(){this.A=null,this.B=null}function lt(t,e,n,i,r){for(var o in i){var a=i[o],s=a.source,h=a.target,u=s===n?h:s;if(!e||!e.has(u.key)){var c=r(u.key,u.attributes);if(t&&c)return u.key}}}function pt(t,e,n,i,r){if("mixed"!==e){if("undirected"===e)return lt(t,null,i,i.undirected,r);if("string"==typeof n)return lt(t,null,i,i[n],r)}var o,a=new dt;if("undirected"!==e){if("out"!==n){if(o=lt(t,null,i,i.in,r),t&&o)return o;a.wrap(i.in)}if("in"!==n){if(o=lt(t,a,i,i.out,r),t&&o)return o;a.wrap(i.out)}}if("directed"!==e&&(o=lt(t,a,i,i.undirected,r),t&&o))return o}function ft(t,e,n){var i=Object.keys(n),r=i.length,o=0;return new D((function(){var a=null;do{if(o>=r)return t&&t.wrap(n),{done:!0};var s=n[i[o++]],h=s.source,u=s.target;a=h===e?u:h,t&&t.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function gt(t,e,n,i,r){for(var o,a,s,h,u,c,d,l=i._nodes.values(),p=i.type;!0!==(o=l.next()).done;){var f=!1;if(a=o.value,"undirected"!==p)for(s in h=a.out){u=h[s];do{if(c=u.target,f=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&d)return u;u=u.next}while(u)}if("directed"!==p)for(s in h=a.undirected)if(!(e&&a.key>s)){u=h[s];do{if((c=u.target).key!==s&&(c=u.source),f=!0,d=r(a.key,c.key,a.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&d)return u;u=u.next}while(u)}if(n&&!f&&(d=r(a.key,null,a.attributes,null,null,null,null),t&&d))return null}}function vt(t){if(!u(t))throw new I('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new I("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new I("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function yt(t){if(!u(t))throw new I('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new I("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new I("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new I("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new I("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}dt.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},dt.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var mt,bt=(mt=255&Math.floor(256*Math.random()),function(){return mt++}),wt=new Set(["directed","undirected","mixed"]),xt=new Set(["domain","_events","_eventsCount","_maxListeners"]),_t={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ct(t,e,n){var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}function St(t,e,n,i,r,o,a,s){if(!i&&"undirected"===t.type)throw new j("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new j("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!u(s))throw new I("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!t.allowSelfLoops&&o===a)throw new j("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h=t._nodes.get(o),c=t._nodes.get(a);if(!h)throw new U("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!c)throw new U("Graph.".concat(e,': target node "').concat(a,'" not found.'));var d={key:null,undirected:i,source:o,target:a,attributes:s};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new j("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));if(!t.multi&&(i?void 0!==h.undirected[a]:void 0!==h.out[a]))throw new j("Graph.".concat(e,': 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 X(i,r,h,c,s);t._edges.set(r,l);var p=o===a;return i?(h.undirectedDegree++,c.undirectedDegree++,p&&(h.undirectedLoops++,t._undirectedSelfLoopCount++)):(h.outDegree++,c.inDegree++,p&&(h.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),i?t._undirectedSize++:t._directedSize++,d.key=r,t.emit("edgeAdded",d),r}function Et(t,e,n,i,r,o,a,h,c){if(!i&&"undirected"===t.type)throw new j("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new j("Graph.".concat(e,": 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 I("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(h,'"'))}else if(!u(h))throw new I("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(h,'"'));var d;if(o=""+o,a=""+a,c&&(d=h,h=void 0),!t.allowSelfLoops&&o===a)throw new j("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l,p,f=t._nodes.get(o),g=t._nodes.get(a);if(!n&&(l=t._edges.get(r))){if(!(l.source.key===o&&l.target.key===a||i&&l.source.key===a&&l.target.key===o))throw new j("Graph.".concat(e,': 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,'").'));p=l}if(p||t.multi||!f||(p=i?f.undirected[a]:f.out[a]),p){var v=[p.key,!1,!1,!1];if(c?!d:!h)return v;if(c){var y=p.attributes;p.attributes=d(y),t.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else s(p.attributes,h),t.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:h});return v}h=h||{},c&&d&&(h=d(h));var m={key:null,undirected:i,source:o,target:a,attributes:h};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new j("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));var b=!1,w=!1;f||(f=Ct(t,o,{}),b=!0,o===a&&(g=f,w=!0)),g||(g=Ct(t,a,{}),w=!0),l=new X(i,r,f,g,h),t._edges.set(r,l);var x=o===a;return i?(f.undirectedDegree++,g.undirectedDegree++,x&&(f.undirectedLoops++,t._undirectedSelfLoopCount++)):(f.outDegree++,g.inDegree++,x&&(f.directedLoops++,t._directedSelfLoopCount++)),t.multi?l.attachMulti():l.attach(),i?t._undirectedSize++:t._directedSize++,m.key=r,t.emit("edgeAdded",m),[r,!0,b,w]}function Mt(t,e){t._edges.delete(e.key);var n=e.source,i=e.target,r=e.attributes,o=e.undirected,a=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:r,source:n.key,target:i.key,undirected:o})}var kt=function(n){function i(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=s({},_t,t)).multi)throw new I("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!wt.has(t.type))throw new I('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new I("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var i="mixed"===t.type?H:"directed"===t.type?W:Y;d(a(e),"NodeDataClass",i);var r="geid_"+bt()+"_",o=0;return d(a(e),"_attributes",{}),d(a(e),"_nodes",new Map),d(a(e),"_edges",new Map),d(a(e),"_directedSize",0),d(a(e),"_undirectedSize",0),d(a(e),"_directedSelfLoopCount",0),d(a(e),"_undirectedSelfLoopCount",0),d(a(e),"_edgeKeyGenerator",(function(){var t;do{t=r+o++}while(e._edges.has(t));return t})),d(a(e),"_options",t),xt.forEach((function(t){return d(a(e),t,e[t])})),l(a(e),"order",(function(){return e._nodes.size})),l(a(e),"size",(function(){return e._edges.size})),l(a(e),"directedSize",(function(){return e._directedSize})),l(a(e),"undirectedSize",(function(){return e._undirectedSize})),l(a(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),l(a(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),l(a(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),l(a(e),"multi",e._options.multi),l(a(e),"type",e._options.type),l(a(e),"allowSelfLoops",e._options.allowSelfLoops),l(a(e),"implementation",(function(){return"graphology"})),e}e(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(t){return this._nodes.has(""+t)},r.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.out.hasOwnProperty(e)}throw new I("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(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.undirected.hasOwnProperty(e)}throw new I("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(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(e)||void 0!==i.undirected&&i.undirected.hasOwnProperty(e))}throw new I("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(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new j("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(t);if(!n)throw new U('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new j("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(t);if(!n)throw new U('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.undirected&&n.undirected[e]||void 0;return i?i.key:void 0}},r.edge=function(t,e){if(this.multi)throw new j("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},r.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},r.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},r.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},r.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},r.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},r.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new U('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},r.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},r.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},r.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},r.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},r.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},r.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},r.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},r.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},r.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},r.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,i+=e.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,i+=e.directedLoops),n-i},r.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new U('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,i+=2*e.directedLoops),n-i},r.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},r.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},r.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},r.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new U('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(t===i)return r;if(t===r)return i;throw new U('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new U('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},r.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},r.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},r.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new U('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},r.addNode=function(t,e){var n=function(t,e,n){if(n&&!u(n))throw new I('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new j('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}(this,t,e);return n.key},r.mergeNode=function(t,e){if(e&&!u(e))throw new I('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(s(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},r.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new I('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var i=n.attributes;n.attributes=e(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]},r.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new U('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){e=n.out[i];do{Mt(this,e),e=e.next}while(e)}for(var r in n.in){e=n.in[r];do{Mt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{Mt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},r.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(e=h(this,n,i,this.type)))throw new U('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new U('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Mt(this,e),this},r.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new j("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 j("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,t=""+t,e=""+e,"directed");if(!n)throw new U('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Mt(this,n),this},r.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new j("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 j("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,t,e,"undirected");if(!n)throw new U('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Mt(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(t){return this._attributes[t]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},r.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.updateAttribute=function(t,e){if("function"!=typeof e)throw new I("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},r.replaceAttributes=function(t){if(!u(t))throw new I("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(t){if(!u(t))throw new I("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},r.updateAttributes=function(t){if("function"!=typeof t)throw new I("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new I("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!p(e))throw new I("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=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},r.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new I("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!p(e))throw new I("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=t(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},r.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new I("Graph.forEachAdjacencyEntry: expecting a callback.");gt(!1,!1,!1,this,t)},r.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new I("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!1,!0,this,t)},r.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new I("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");gt(!1,!0,!1,this,t)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new I("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!0,!0,this,t)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):T(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(t){if("function"!=typeof t)throw new I("Graph.forEachNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)},r.findNode=function(t){if("function"!=typeof t)throw new I("Graph.findNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},r.mapNodes=function(t){if("function"!=typeof t)throw new I("Graph.mapNode: expecting a callback.");for(var e,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(e=i.next()).done;)n=e.value,r[o++]=t(n.key,n.attributes);return r},r.someNode=function(t){if("function"!=typeof t)throw new I("Graph.someNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},r.everyNode=function(t){if("function"!=typeof t)throw new I("Graph.everyNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},r.filterNodes=function(t){if("function"!=typeof t)throw new I("Graph.filterNodes: expecting a callback.");for(var e,n,i=this._nodes.values(),r=[];!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(t,e){if("function"!=typeof t)throw new I("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new I("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=e,o=this._nodes.values();!0!==(n=o.next()).done;)r=t(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var t=this._nodes.values();return new D((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,i){e[n++]=function(t,e){var n={key:t};return c(e.attributes)||(n.attributes=s({},e.attributes)),n}(i,t)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,r){i[n++]=function(t,e,n){var i={key:e,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=s({},n.attributes)),"mixed"===t&&n.undirected&&(i.undirected=!0),i}(t.type,r,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}},r.import=function(t){var e,n,r,o,a,s=this,h=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof i)return t.forEachNode((function(t,e){h?s.mergeNode(t,e):s.addNode(t,e)})),t.forEachEdge((function(t,e,n,i,r,o,a){h?a?s.mergeUndirectedEdgeWithKey(t,n,i,e):s.mergeDirectedEdgeWithKey(t,n,i,e):a?s.addUndirectedEdgeWithKey(t,n,i,e):s.addDirectedEdgeWithKey(t,n,i,e)})),this;if(!u(t))throw new I("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!u(t.attributes))throw new I("Graph.import: invalid attributes. Expecting a plain object.");h?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(r=t.nodes,!Array.isArray(r))throw new I("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=r.length;e<n;e++){vt(o=r[e]);var c=o,d=c.key,l=c.attributes;h?this.mergeNode(d,l):this.addNode(d,l)}}if(t.edges){var p=!1;if("undirected"===this.type&&(p=!0),r=t.edges,!Array.isArray(r))throw new I("Graph.import: invalid edges. Expecting an array.");for(e=0,n=r.length;e<n;e++){yt(a=r[e]);var f=a,g=f.source,v=f.target,y=f.attributes,m=f.undirected,b=void 0===m?p:m;"key"in a?(h?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,v,y):(h?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,v,y)}}return this},r.nullCopy=function(t){var e=new i(s({},this._options,t));return e.replaceAttributes(s({},this.getAttributes())),e},r.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var i=s({},t.attributes);t=new e.NodeDataClass(n,i),e._nodes.set(n,t)})),e},r.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new j('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new j("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 t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new j("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 e,n,i=this.emptyCopy(t),r=this._edges.values();!0!==(e=r.next()).done;)St(i,"copy",!1,(n=e.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 e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var i={},r={};this._edges.forEach((function(t,n){var o,a=t.undirected?"--":"->",s="",h=t.source.key,u=t.target.key;t.undirected&&h>u&&(o=h,h=u,u=o);var c="(".concat(h,")").concat(a,"(").concat(u,")");n.startsWith("geid_")?e.multi&&(void 0===r[c]?r[c]=0:r[c]++,s+="".concat(r[c],". ")):s+="[".concat(n,"]: "),i[s+=c]=t.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!xt.has(a)&&"function"!=typeof this[a]&&"symbol"!==t(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&&(kt.prototype[Symbol.for("nodejs.util.inspect.custom")]=kt.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),i="add"===e?St:Et;t.generateKey?kt.prototype[n]=function(r,o,a){return i(this,n,!0,"undirected"===(t.type||this.type),null,r,o,a,"update"===e)}:kt.prototype[n]=function(r,o,a,s){return i(this,n,!1,"undirected"===(t.type||this.type),r,o,a,s,"update"===e)}}))})),function(t){K.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Node"),0),i(t,n("Source"),1),i(t,n("Target"),2),i(t,n("Opposite"),3)}))}(kt),function(t){Z.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Edge"),"mixed"),i(t,n("DirectedEdge"),"directed"),i(t,n("UndirectedEdge"),"undirected")}))}(kt),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):T(t._edges.keys(),t._edges.size);for(var n,i,r="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(r),a="undirected"===e,s=t._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){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,i){var r=[];return ht(!1,t,e,n,i,(function(t){r.push(t)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,r){var o=[];return ut(!1,t,e,n,i,r,(function(t){o.push(t)})),o}(i,this.multi,r,a,e)}throw new I("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return st(!1,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!1,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!1,i,this.multi,r,s,e,n)}throw new I("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);t.prototype[a]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),t=new Array(r);var a=0;e.push((function(e,i,r,o,s,h,u){t[a++]=n(e,i,r,o,s,h,u)}))}else t=[],e.push((function(e,i,r,o,a,s,h){t.push(n(e,i,r,o,a,s,h))}));return this[o].apply(this,e),t};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,i,r,o,a,s,h){e(t,i,r,o,a,s,h)&&n.push(t)})),this[o].apply(this,t),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[h]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new I("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 I("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?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var i=e;return n.push((function(e,n,r,o,a,s,h){i=t(i,e,n,r,o,a,s,h)})),this[o].apply(this,n),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return st(!0,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ht(!0,this.multi,"mixed"===i?this.type:i,r,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!0,i,this.multi,r,s,e,n)}throw new I("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);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,a,s){return e(t,n,i,r,o,a,s)})),!!this[o].apply(this,t)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,a,s){return!e(t,n,i,r,o,a,s)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return D.empty();if(!arguments.length)return function(t,e){if(0===t.size)return D.empty();var n="mixed"!==e&&e!==t.type,i="undirected"===e,r=t._edges.values();return new D((function(){for(var t,e;;){if((t=r.next()).done)return t;if(e=t.value,!n||e.undirected===i)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,i);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var i=D.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(i=Q(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=Q(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=Q(i,it(n.undirected))),i}(i,r,n)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new U("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i){var r=D.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&i in n.in&&(r=Q(r,at(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(r=Q(r,at(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(r=Q(r,at(n.undirected,i))),r}(i,r,a,e)}throw new I("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(kt),function(t){ct.forEach((function(e){(function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new U("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var i=[];return pt(!1,t,e,n,(function(t){i.push(t)})),i}("mixed"===i?this.type:i,r,e)}})(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));pt(!1,"mixed"===i?this.type:i,r,n,e)}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,i){n.push(e(t,i))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,i){e(t,i)&&n.push(t)})),n};var h="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[h]=function(t,e,n){if(arguments.length<3)throw new I("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](t,(function(t,n){i=e(i,t,n)})),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;t.prototype[a]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new U("Graph.".concat(a,': could not find the "').concat(t,'" node in the graph.'));return pt(!0,"mixed"===i?this.type:i,r,n,e)}};var s="some"+o;t.prototype[s]=function(t,e){return!!this[a](t,e)};var h="every"+o;t.prototype[h]=function(t,e){return!this[a](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return D.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new U("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return ft(null,n,n.undirected);if("string"==typeof e)return ft(null,n,n[e])}var i=D.empty(),r=new dt;return"undirected"!==t&&("out"!==e&&(i=Q(i,ft(r,n,n.in))),"in"!==e&&(i=Q(i,ft(r,n,n.out)))),"directed"!==t&&(i=Q(i,ft(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,e)}}(t,e)}))}(kt);var Nt=function(t){function n(e){var n=s({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new I("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new I('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(kt),At=function(t){function n(e){var n=s({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new I("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new I('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(kt),Lt=function(t){function n(e){var n=s({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(kt),Dt=function(t){function n(e){var n=s({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new I('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(kt),Gt=function(t){function n(e){var n=s({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new I("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new I('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(kt);function Pt(t){t.from=function(e,n){var i=s({},e.options,n),r=new t(i);return r.import(e),r}}return Pt(kt),Pt(Nt),Pt(At),Pt(Lt),Pt(Dt),Pt(Gt),kt.Graph=kt,kt.DirectedGraph=Nt,kt.UndirectedGraph=At,kt.MultiGraph=Lt,kt.MultiDirectedGraph=Dt,kt.MultiUndirectedGraph=Gt,kt.InvalidArgumentsGraphError=I,kt.NotFoundGraphError=U,kt.UsageGraphError=j,kt}()}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";function t(t,e,n,i){var r=document.createElement("button");return r.setAttribute("data-tooltip",n),r.innerHTML=t,i&&(r.className=i),r.addEventListener("click",e),r}n.r(i),n.d(i,{ForceAtlasAnimator:()=>ut,GraphManager:()=>Rt,GraphView:()=>jt,LinearAnimator:()=>Tt,MultiResolutionGraph:()=>se,default:()=>he,downloadSVG:()=>xt,exportGraphToSVG:()=>wt,getLayoutSettings:()=>Ct,initialGraphLayout:()=>pt,relativeComponentLayout:()=>rt});var e=n(186),r=n.n(e),o=n(803);function a(){var t=10,e=50,n=1e4,i=1e-4;function r(t,e,n,i){t[e+2]+=i,t[n+2]-=i}function o(t,e,n,i){t[e+3]+=i,t[n+3]-=i}function a(t,n,i,a,s,h){var u,c=t[n+0]-t[i+0],d=t[n+1]-t[i+1],l=c*c+d*d,p=t[n+8]+t[i+8],f=Math.sqrt(c*c+d*d)-p,g=Math.sqrt(l),v=a*t[n+6]*t[i+6];if(s){var y=null!=h?h:150*Math.sqrt(a);u=f>0?v/(g*f*(1+f/y)):e*v}else u=f>0?v/(g*f):e*v;r(t,n,i,c*u),o(t,n,i,d*u)}function s(t,e,n,i,a,s,h){void 0===h&&(h=2);var u=t[e+0]-t[n+0],c=t[e+1]-t[n+1],d=u*u+c*c;if(d>0){var l,p=Math.sqrt(d),f=i*t[e+6]*t[n+6];r(t,e,n,u*(l=a?f/((1+p/(null!=s?s:150*Math.sqrt(i)))*Math.pow(p,h)):f/Math.pow(p,h))),o(t,e,n,c*l)}}var h=function(t,e){var n=t?a:s;return function(t,i,r,o,a){return n(t,i,r,o,e,a)}};function u(e,n,i){var r,o=e.scalingRatio,a=e.adjustSizes,s=null!==(r=e.decayRepulsion)&&void 0!==r&&r,u=e.barnesHutThreshold,c=e.barnesHutTheta;i.forEach((function(e){if(e.length>=u)!function(e,n,i,r,o,a){void 0===a&&(a=!1),n.length;var s=function(e,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*t;s=Math.min(s,e[i+0]),h=Math.max(h,e[i+0]),u=Math.min(u,e[i+1]),c=Math.max(c,e[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 p=1;return n.forEach((function(n){var s=n*t,h=0;for(o=3;;){if(!(a[h+5]>=0)){if(a[h+0]<0){a[h+0]=s;break}a[h+5]=9*p;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,p+=4,i=e[a[h+0]+0]<a[h+1]?e[a[h+0]+1]<a[h+2]?a[h+5]:a[h+5]+9:e[a[h+0]+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+6]=e[a[h+0]+6],a[h+7]=e[a[h+0]+0],a[h+8]=e[a[h+0]+1],a[i+0]=a[h+0],a[h+0]=-1,r=e[s+0]<a[h+1]?e[s+1]<a[h+2]?a[h+5]:a[h+5]+9:e[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=e[s+0]<a[h+1]?e[s+1]<a[h+2]?a[h+5]:a[h+5]+9:e[s+1]<a[h+2]?a[h+5]+18:a[h+5]+27,a[h+7]=(a[h+7]*a[h+6]+e[s+0]*e[s+6])/(a[h+6]+e[s+6]),a[h+8]=(a[h+8]*a[h+6]+e[s+1]*e[s+6])/(a[h+6]+e[s+6]),a[h+6]+=e[s+6],h=i}})),a}(e,n),h=b(e,n);n.forEach((function(n){for(var u=n*t,c=0;;)if(s[c+5]>=0){var d=Math.pow(e[u+0]-s[c+7],2)+Math.pow(e[u+1]-s[c+8],2),l=s[c+3];if(4*l*l/d<o){var p=e[u+0]-s[c+7],f=e[u+1]-s[c+8],g=void 0,v=i*e[u+6]*s[c+6],y=Math.sqrt(d);if(!0===r?(b=y-2*e[u+8])>0?(g=a?v/(y*b*(1+b/h)):v/(b*y),e[u+2]+=p*g,e[u+3]+=f*g):b<0&&(g=v/Math.sqrt(d),e[u+2]+=p*g,e[u+3]+=f*g):d>0&&(g=a?v/((1+y/h)*d):v/d,e[u+2]+=p*g,e[u+3]+=f*g),(c=s[c+4])<0)break;continue}c=s[c+5]}else{var m=s[c+0];if(m>=0&&m!==u)if(d=(p=e[u+0]-e[m+0])*p+(f=e[u+1]-e[m+1])*f,y=Math.sqrt(d),g=void 0,v=i*e[u+6]*e[m+6],!0===r){var b=y-e[u+8]-e[m+8];Math.pow(b,2),b>0?(g=a?v/(y*b*(1+b/h)):v/(y*b),e[u+2]+=p*g,e[u+3]+=f*g):b<=0&&(g=2*v,e[u+2]+=p*g,e[u+3]+=f*g)}else d>0&&(g=a?v/((1+y/h)*d):v/d,e[u+2]+=p*g,e[u+3]+=f*g);if((c=s[c+4])<0)break}}))}(n,e,o,a,Math.pow(c,2),s);else{var i=h(a,s);!function(e,n,i,r){for(var o=b(e,n),a=0;a<n.length;a+=1)for(var s=n[a]*t,h=0;h<a;h+=1)r(e,s,n[h]*t,i,o)}(n,e,o,i)}}))}function c(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=-i;r(t,e,n,a*h),o(t,e,n,s*h)}function d(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s),u=-i*(h-t[e+8]-t[n+8])/h;r(t,e,n,a*u),o(t,e,n,s*u)}function l(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s);if(h>0){var u=-i*Math.log(1+h)/h;r(t,e,n,a*u),o(t,e,n,s*u)}}function p(t,e,n,i){var a=t[e+0]-t[n+0],s=t[e+1]-t[n+1],h=Math.sqrt(a*a+s*s)-t[e+8]-t[n+8];if(h>0){var u=-i*Math.log(1+h)/h;r(t,e,n,a*u),o(t,e,n,s*u)}}function f(t,e){var n=t[e+4]-t[e+2],i=t[e+5]-t[e+3];return t[e+6]*Math.sqrt(Math.pow(n,2)+Math.pow(i,2))}function g(t,e){var n=t[e+4]+t[e+2],i=t[e+5]+t[e+3];return Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2}function v(n,i,r,o){for(var a=n.adjustSizes,s=n.maxForce?n.maxForce:e,h=0;h<i.length;h+=t)i[h+4]=i[h+2],i[h+5]=i[h+3],i[h+2]=0,i[h+3]=0;u(n,i,o);for(var v=r.length,y=0;y<v;y+=3){var m=r[y+0],b=r[y+1],w=r[y+2];!0===a?n.linLogMode?p(i,m,b,w):d(i,m,b,w):n.linLogMode?l(i,m,b,w):c(i,m,b,w)}if(!0===a){for(h=0;h<i.length;h+=t)if(1!==i[h+9]){var x=Math.sqrt(Math.pow(i[h+2],2)+Math.pow(i[h+3],2));x>s&&(i[h+2]=i[h+2]*e/x,i[h+3]=i[h+3]*e/x);var _=f(i,h),C=g(i,h),S=1+Math.sqrt(_),E=i[h+7]*Math.log(1+C)*.5/S;i[h+7]=Math.min(1,Math.sqrt(E*(Math.pow(i[h+2],2)+Math.pow(i[h+3],2))/S));var M=E/n.slowDown;i[h+0]+=i[h+2]*M,i[h+1]+=i[h+3]*M}}else for(h=0;h<i.length;h+=t)if(1!==i[h+9]){_=f(i,h),C=g(i,h),S=1+Math.sqrt(_),E=i[h+7]*Math.log(1+C)/S,i[h+7]=Math.min(1,Math.sqrt(E*(Math.pow(i[h+2],2)+Math.pow(i[h+3],2))/S)),M=E/n.slowDown;var k=i[h+2]*M,N=i[h+3]*M;isFinite(k)&&isFinite(N)?(i[h+0]+=k,i[h+1]+=N):(i[h+2]=0,i[h+3]=0,i[h+4]=0,i[h+5]=0)}return{}}var y=function(t,e,n,i){for(var r=e.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=e[3*u+0],d=e[3*u+1],l=t[c+8],p=t[d+8],f=t[c+0]-t[d+0],g=t[c+1]-t[d+1],v=(l+p)*i/Math.sqrt(Math.pow(f,2)+Math.pow(g,2));v>a&&(a=v),v>1&&o++}return{fracEdgesTooShort:o/Math.min(n,r),maxShortnessRatio:a}},m=function(e){for(var n=0,i=0,r=0,o=0,a=e.length,s=0;s<a;s+=t)e[s+0]<n&&(n=e[s+0]),e[s+0]>i&&(i=e[s+0]),e[s+1]<r&&(r=e[s+1]),e[s+1]>o&&(o=e[s+1]);var h=i-n,u=o-r;return{xDim:Math.max(h,1),yDim:Math.max(u,1)}},b=function(e,n){var i=function(e,n){var i=0,r=0,o=0,a=0;n.forEach((function(n){var s=n*t;e[s+0]<i&&(i=e[s+0]),e[s+0]>r&&(r=e[s+0]),e[s+1]<o&&(o=e[s+1]),e[s+1]>a&&(a=e[s+1])}));var s=r-i,h=a-o;return{xDim:Math.max(s,.1),yDim:Math.max(h,.1)}}(e,n),r=i.xDim,o=i.yDim;return Math.max(Math.max(r,o)/2,150)},w=function(e,n,i){n.forEach((function(n){n.forEach((function(n){var r=n;e[r*t+0]=e[r*t+0]*i,e[r*t+1]=e[r*t+1]*i}))}))},x=function(t,e,r,o,a){var s=m(t),h=s.xDim,u=s.yDim,c=Math.max(r/h,o/u);w(t,e,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?v(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||e,s.warmupLayout){var p=s.adjustSizes;s.adjustSizes=!1;var f=s.decayRepulsion;s.decayRepulsion=!1;for(var g=0;g<h/5;g++)v(s,r,o,a);x(r,a,d,l,s);for(var b=0;b<r.length;b+=t)r[b+2]=0,r[b+3]=0;s.adjustSizes=p,s.decayRepulsion=f,s.warmupLayout=!1}for(var _=u,C=0;C<_-1;C++){for(g=0;g<h/_;g++)v(s,r,o,a);if(s.adjustSizes){var S=y(r,o,2e3,1.2),E=S.fracEdgesTooShort,M=S.maxShortnessRatio;if(E>.002){var k=Math.min(M,5),N=Math.pow(k,2);s.scalingRatio=Math.max(Math.min(s.scalingRatio*N,n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,k)}else{var A=m(r),L=A.xDim,D=A.yDim,G=Math.min(d/L,l/D),P=Math.max(G,Math.min(M,1));s.scalingRatio=Math.max(Math.min(s.scalingRatio*Math.pow(P,2),n),i),console.log("scalingRatio",s.scalingRatio),w(r,a,P)}}else x(r,a,d,l,s),console.log("scalingRatio",s.scalingRatio);for(b=0;b<r.length;b+=t)r[b+2]=0,r[b+3]=0}for(g=0;g<h/_;g++)v(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 s={value:()=>{}};function h(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new u(i)}function u(t){this._=t}function c(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function d(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=s,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}u.prototype=h.prototype={constructor:u,on:function(t,e){var n,i,r=this._,o=(i=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!i.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)r[n]=d(r[n],t.name,e);else if(null==e)for(n in r)r[n]=d(r[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=c(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new u(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(o=0,n=(i=this._[t]).length;o<n;++o)i[o].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};const l=h;var p,f,g=0,v=0,y=0,m=0,b=0,w=0,x="object"==typeof performance&&performance.now?performance:Date,_="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function C(){return b||(_(S),b=x.now()+w)}function S(){b=0}function E(){this._call=this._time=this._next=null}function M(t,e,n){var i=new E;return i.restart(t,e,n),i}function k(){b=(m=x.now())+w,g=v=0;try{!function(){C(),++g;for(var t,e=p;e;)(t=b-e._time)>=0&&e._call.call(void 0,t),e=e._next;--g}()}finally{g=0,function(){for(var t,e,n=p,i=1/0;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:p=e);f=t,A(i)}(),b=0}}function N(){var t=x.now(),e=t-m;e>1e3&&(w-=e,m=t)}function A(t){g||(v&&(v=clearTimeout(v)),t-b>24?(t<1/0&&(v=setTimeout(k,t-x.now()-w)),y&&(y=clearInterval(y))):(y||(m=x.now(),y=setInterval(N,1e3)),g=1,_(k)))}E.prototype=M.prototype={constructor:E,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?C():+n)+(null==e?0:+e),this._next||f===this||(f?f._next=this:p=this,f=this),this._call=t,this._time=n,A()},stop:function(){this._call&&(this._call=null,this._time=1/0,A())}};const L=4294967296;function D(t){return t.x}function G(t){return t.y}var P=Math.PI*(3-Math.sqrt(5));function F(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,h=M(d),u=l("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%L)/L}();function d(){p(),u.call("tick",e),n<i&&(h.stop(),u.call("end",e))}function p(i){var h,u,c=t.length;void 0===i&&(i=1);for(var d=0;d<i;++d)for(n+=(o-n)*r,s.forEach((function(t){t(n)})),h=0;h<c;++h)null==(u=t[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 e}function f(){for(var e,n=0,i=t.length;n<i;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var r=10*Math.sqrt(.5+n),o=n*P;e.x=r*Math.cos(o),e.y=r*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,c),e}return null==t&&(t=[]),f(),e={tick:p,restart:function(){return h.restart(d),e},stop:function(){return h.stop(),e},nodes:function(n){return arguments.length?(t=n,f(),s.forEach(g),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(i=+t,e):i},alphaDecay:function(t){return arguments.length?(r=+t,e):+r},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(c=t,s.forEach(g),e):c},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,g(n)),e):s.get(t)},find:function(e,n,i){var r,o,a,s,h,u=0,c=t.length;for(null==i?i=1/0:i*=i,u=0;u<c;++u)(a=(r=e-(s=t[u]).x)*r+(o=n-s.y)*o)<i&&(h=s,i=a);return h},on:function(t,n){return arguments.length>1?(u.on(t,n),e):u.on(t)}}}function B(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o,a,s,h,u,c,d,l,p=t._root,f={data:i},g=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((u=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(v+m)/2))?v=a:m=a,r=p,!(p=p[d=c<<1|u]))return r[d]=f,t;if(s=+t._x.call(null,p.data),h=+t._y.call(null,p.data),e===s&&n===h)return f.next=p,r?r[d]=f:t._root=f,t;do{r=r?r[d]=new Array(4):t._root=new Array(4),(u=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(v+m)/2))?v=a:m=a}while((d=c<<1|u)==(l=(h>=a)<<1|s>=o));return r[l]=p,r[d]=f,t}function z(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function R(t){return t[0]}function O(t){return t[1]}function T(t,e,n){var i=new V(null==e?R:e,null==n?O:n,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function V(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function I(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var U=T.prototype=V.prototype;function j(t){return function(){return t}}function H(t){return 1e-6*(t()-.5)}function W(){var t,e,n,i,r,o=j(-30),a=1,s=1/0,h=.81;function u(n){var r,o=t.length,a=T(t,D,G).visitAfter(d);for(i=n,r=0;r<o;++r)e=t[r],a.visit(l)}function c(){if(t){var e,n,i=t.length;for(r=new Array(i),e=0;e<i;++e)n=t[e],r[n.index]=+o(n,e,t)}}function d(t){var e,n,i,o,a,s=0,h=0;if(t.length){for(i=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,h+=n,i+=n*e.x,o+=n*e.y);t.x=i/h,t.y=o/h}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=r[e.data.index]}while(e=e.next)}t.value=s}function l(t,o,u,c){if(!t.value)return!0;var d=t.x-e.x,l=t.y-e.y,p=c-o,f=d*d+l*l;if(p*p/h<f)return f<s&&(0===d&&(f+=(d=H(n))*d),0===l&&(f+=(l=H(n))*l),f<a&&(f=Math.sqrt(a*f)),e.vx+=d*t.value*i/f,e.vy+=l*t.value*i/f),!0;if(!(t.length||f>=s)){(t.data!==e||t.next)&&(0===d&&(f+=(d=H(n))*d),0===l&&(f+=(l=H(n))*l),f<a&&(f=Math.sqrt(a*f)));do{t.data!==e&&(p=r[t.data.index]*i/f,e.vx+=d*p,e.vy+=l*p)}while(t=t.next)}}return u.initialize=function(e,i){t=e,n=i,c()},u.strength=function(t){return arguments.length?(o="function"==typeof t?t:j(+t),c(),u):o},u.distanceMin=function(t){return arguments.length?(a=t*t,u):Math.sqrt(a)},u.distanceMax=function(t){return arguments.length?(s=t*t,u):Math.sqrt(s)},u.theta=function(t){return arguments.length?(h=t*t,u):Math.sqrt(h)},u}function Y(t){var e,n,i,r=j(.1);function o(t){for(var r,o=0,a=e.length;o<a;++o)(r=e[o]).vx+=(i[o]-r.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+t(e[o],o,e))?0:+r(e[o],o,e)}}return"function"!=typeof t&&(t=j(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(r="function"==typeof t?t:j(+t),a(),o):r},o.x=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),a(),o):t},o}function X(t){var e,n,i,r=j(.1);function o(t){for(var r,o=0,a=e.length;o<a;++o)(r=e[o]).vy+=(i[o]-r.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+t(e[o],o,e))?0:+r(e[o],o,e)}}return"function"!=typeof t&&(t=j(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(r="function"==typeof t?t:j(+t),a(),o):r},o.y=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),a(),o):t},o}function q(t){return t.x+t.vx}function K(t){return t.y+t.vy}function Z(t){var e,n,i,r=1,o=1;function a(){for(var t,a,h,u,c,d,l,p=e.length,f=0;f<o;++f)for(a=T(e,q,K).visitAfter(s),t=0;t<p;++t)h=e[t],d=n[h.index],l=d*d,u=h.x+h.vx,c=h.y+h.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,p=t.r,f=d+p;if(!s)return e>u+f||o<u-f||n>c+f||a<c-f;if(s.index>h.index){var g=u-s.x-s.vx,v=c-s.y-s.vy,y=g*g+v*v;y<f*f&&(0===g&&(y+=(g=H(i))*g),0===v&&(y+=(v=H(i))*v),y=(f-(y=Math.sqrt(y)))/y*r,h.vx+=(g*=y)*(f=(p*=p)/(l+p)),h.vy+=(v*=y)*f,s.vx-=g*(f=1-f),s.vy-=v*f)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function h(){if(e){var i,r,o=e.length;for(n=new Array(o),i=0;i<o;++i)r=e[i],n[r.index]=+t(r,i,e)}}return"function"!=typeof t&&(t=j(null==t?1:+t)),a.initialize=function(t,n){e=t,i=n,h()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(r=+t,a):r},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:j(+e),h(),a):t},a}function J(t,e){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-t)*i,h=(h/a-e)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=h}return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r.strength=function(t){return arguments.length?(i=+t,r):i},r}function $(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Q(t,e){return t[0]-e[0]||t[1]-e[1]}function tt(t){const e=t.length,n=[0,1];let i,r=2;for(i=2;i<e;++i){for(;r>1&&$(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}U.copy=function(){var t,e,n=new V(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=I(i),n;for(t=[{source:i,target:n._root=new Array(4)}];i=t.pop();)for(var r=0;r<4;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(4)}):i.target[r]=I(e));return n},U.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return B(this.cover(e,n),e,n,t)},U.addAll=function(t){var e,n,i,r,o=t.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,e=t[n]))||isNaN(r=+this._y.call(null,e))||(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)B(this,a[n],s[n],t[n]);return this},U.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,o=(i=Math.floor(e))+1;else{for(var a,s,h=r-n||1,u=this._root;n>t||t>=r||i>e||e>=o;)switch(s=(e<i)<<1|t<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},U.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},U.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},U.find=function(t,e,n){var i,r,o,a,s,h,u,c=this._x0,d=this._y0,l=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new z(g,c,d,l,p)),null==n?n=1/0:(c=t-n,d=e-n,l=t+n,p=e+n,n*=n);h=f.pop();)if(!(!(g=h.node)||(r=h.x0)>l||(o=h.y0)>p||(a=h.x1)<c||(s=h.y1)<d))if(g.length){var v=(r+a)/2,y=(o+s)/2;f.push(new z(g[3],v,y,a,s),new z(g[2],r,y,v,s),new z(g[1],v,o,a,y),new z(g[0],r,o,v,y)),(u=(e>=y)<<1|t>=v)&&(h=f[f.length-1],f[f.length-1]=f[f.length-1-u],f[f.length-1-u]=h)}else{var m=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),w=m*m+b*b;if(w<n){var x=Math.sqrt(n=w);c=t-x,d=e-x,l=t+x,p=e+x,i=g.data}}return i},U.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,i,r,o,a,s,h,u,c,d,l,p=this._root,f=this._x0,g=this._y0,v=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((u=o>=(s=(f+v)/2))?f=s:v=s,(c=a>=(h=(g+y)/2))?g=h:y=h,e=p,!(p=p[d=c<<1|u]))return this;if(!p.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(n=e,l=d)}for(;p.data!==t;)if(i=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,i?(r?i.next=r:delete i.next,this):e?(r?e[d]=r:delete e[d],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[l]=p:this._root=p),this):(this._root=r,this)},U.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},U.root=function(){return this._root},U.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},U.visit=function(t){var e,n,i,r,o,a,s=[],h=this._root;for(h&&s.push(new z(h,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(h=e.node,i=e.x0,r=e.y0,o=e.x1,a=e.y1)&&h.length){var u=(i+o)/2,c=(r+a)/2;(n=h[3])&&s.push(new z(n,u,c,o,a)),(n=h[2])&&s.push(new z(n,i,c,u,a)),(n=h[1])&&s.push(new z(n,u,r,o,c)),(n=h[0])&&s.push(new z(n,i,r,u,c))}return this},U.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new z(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var r=e.node;if(r.length){var o,a=e.x0,s=e.y0,h=e.x1,u=e.y1,c=(a+h)/2,d=(s+u)/2;(o=r[0])&&n.push(new z(o,a,s,c,d)),(o=r[1])&&n.push(new z(o,c,s,h,d)),(o=r[2])&&n.push(new z(o,a,d,c,u)),(o=r[3])&&n.push(new z(o,c,d,h,u))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},U.x=function(t){return arguments.length?(this._x=t,this):this._x},U.y=function(t){return arguments.length?(this._y=t,this):this._y};var et=10,nt=function(t,e){return void 0===e&&(e=1),!Number.isFinite(t)||Math.abs(t)<1e-9?e:t},it=function(t){for(var e=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=Number.MAX_VALUE,r=-Number.MAX_VALUE,o=0;o<t.length;o+=et)t[o+0]<e&&(e=t[o+0]),t[o+0]>n&&(n=t[o+0]),t[o+1]<i&&(i=t[o+1]),t[o+1]>r&&(r=t[o+1]);var a=(e+n)/2,s=(i+r)/2;for(o=0;o<t.length;o+=et)t[o+0]-=a,t[o+1]-=s},rt=function(t,e,n,i,r){void 0===i&&(i=[650,410]),void 0===r&&(r=!1),console.time("component layout"),it(t);var o=i[0],a=i[1],s=r?e.filter((function(t){return t.length>1})):e,h=r?e.filter((function(t){return t.length<=1})):[],u=h.length,c=s.reduce((function(t,e){return t+e.length}),0),d=Math.max(.04,u/(u+5*c)),l=.9*a,p=d*o;console.time("pack singletons");var f=function(t,e,n,i,r){var o={};t.forEach((function(t,e){t.forEach((function(t){o[t]=e}))}));var a,s=0,h=t.map((function(t,n){if(0==t.length)return 5;var i=e[t[0]*et+8];return s+=i,i})),u=Math.min(3*s,r),c=Math.min(3*s,i);if(r>i){var d=t.map((function(e,n){var i=Object.create(e);return i.radius=1.5*h[n],i.target=-u/2+n/t.length*u,i}));return(a=F(d).force("charge",W().strength(-1)).force("center",J(0,0)).force("gravityX",Y().strength(u/c*.2)).force("yPos",X().y((function(t){return t.target})).strength(.5)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:t.map((function(t){return t.map((function(t){return t}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}return d=t.map((function(e,n){var i=Object.create(e);return i.radius=h[n],i.target=-c/2+n/t.length*c,i})),(a=F(d).force("charge",W().strength(-1)).force("center",J(0,0)).force("gravityY",X().strength(.2*c/u)).force("xPos",Y().x((function(t){return t.target})).strength(.5)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5))).stop(),a.tick(n),{vertices:t.map((function(t){return t.map((function(t){return t}))})).flat(),node_to_component_id:o,components_to_circle_pack:d}}(h,t,n,p,l);console.timeEnd("pack singletons");var g=Number.MAX_VALUE,v=-Number.MAX_VALUE,y=Number.MAX_VALUE,m=-Number.MAX_VALUE;f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=t[e*et+8];v=Math.max(i+o,v),g=Math.min(i-o,g),m=Math.max(r+o,m),y=Math.min(r-o,y)}));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));f.vertices.map((function(t){var e=f.node_to_component_id[t];f.components_to_circle_pack[e].x*=x,f.components_to_circle_pack[e].y*=x})),w*=x}console.log("adjustedSingletonWidth",w);var _=o-w,C=_/nt(a),S=s.map((function(e){var n=function(t,e){var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,o=-Number.MAX_VALUE;return t.forEach((function(t){var a=t,s=e[a*et+0],h=e[a*et+1],u=e[a*et+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}}(e,t),i=n.minX,r=n.maxX,o=n.minY,a=n.maxY;return(r-i)/nt(a-o)}));console.log("remainingAspectRatio",C),s.forEach((function(e,n){var i=S[n];(i>=1.1&&C<=.9||i<=.9&&C>=1.1)&&e.forEach((function(e){var n=e,i=t[n*et+0],r=t[n*et+1];t[n*et+0]=-r,t[n*et+1]=i}))})),console.time("pack components");var E=function(t,e,n,i,r){var o=t.map((function(t){return t.map((function(t){var n=t*et;return[e[n+0],e[n+1]]}))})),a=o.map((function(t){return function(t){if((n=t.length)<3)return null;var e,n,i=new Array(n),r=new Array(n);for(e=0;e<n;++e)i[e]=[+t[e][0],+t[e][1],e];for(i.sort(Q),e=0;e<n;++e)r[e]=[i[e][0],-i[e][1]];var o=tt(i),a=tt(r),s=a[0]===o[0],h=a[a.length-1]===o[o.length-1],u=[];for(e=o.length-1;e>=0;--e)u.push(t[i[o[e]][2]]);for(e=+s;e<a.length-h;++e)u.push(t[i[a[e]][2]]);return u}(t)})),s=a.map((function(t,e){if(null===t){var n=o[e];return 1===n.length?n[0]:[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]}return function(t){for(var e,n,i=-1,r=t.length,o=0,a=0,s=t[r-1],h=0;++i<r;)e=s,s=t[i],h+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(h*=3),a/h]}(t)})),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=t[i][0];a=Math.max(e[u*et+8]+2,6)}else{var c=h[1][0]-h[0][0],d=h[1][1]-h[0][1],l=t[i][0],p=t[i][1],f=e[l*et+8],g=e[p*et+8];a=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))/2+f+g}}else for(var v=0;v<n.length;v+=1){var y=n[v],m=(c=y[0]-r[0],d=y[1]-r[1],u=t[i][v],e[u*et+8]),b=Math.sqrt(Math.pow(c,2)+Math.pow(d,2))+m;a=Math.max(b,a)}return Math.round(a)})),u=h.map((function(t,e){return[t,e]})).sort((function(t,e){return t[0]-e[0]})),c=function(t){return Math.max(3*t*Math.exp(t*Math.log(1/3)/500),.9*t,t-300)},d=0;u.map((function(e){var n=e[0],i=e[1],r=(t[i].length,c(n)),o=4*Math.pow(r,2);d+=o})),console.log("graphArea",d);var l=Math.sqrt(d/nt(i*r)),p=i*l,f=r*l;console.log("xExtent",p),console.log("yExtent",f);var g=0,v=u.map((function(e){var n=e[0],i=e[1],r=t[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=p*g/nt(d),o.x=o.target,o.y=(f/2-a)*(2/Math.PI)*Math.asin(Math.sin(2*Math.PI*(d/s)*o.x)),g+=.5*s,o})),y=F(v).force("charge",W().strength((function(t){return-.005*d/Math.pow(t.radius,2)}))).force("xPos",Y().x((function(t){return t.target})).strength(.9)).force("gravityY",X().strength(.3)).force("collision",Z().radius((function(t){return t.radius})).strength(1).iterations(5));y.stop(),y.tick(n);var m=t.map((function(t){return t.map((function(t){return t}))})).flat(),b={};return u.forEach((function(e,n){e[0];var i=e[1];t[i].forEach((function(t){b[t]=n}))})),{vertices:m,node_to_component_id:b,components_to_circle_pack:v,polygon_centroids_initial:s}}(s,t,n,_,a);console.timeEnd("pack components");var M=Number.MAX_VALUE,k=-Number.MAX_VALUE,N=Number.MAX_VALUE,A=-Number.MAX_VALUE;if(E.components_to_circle_pack.forEach((function(e,n){var i=e.componentID;e.forEach((function(n){var r=E.polygon_centroids_initial[i],o=e.x+t[n*et+0]-r[0],a=e.y+t[n*et+1]-r[1];t[n*et+0]=o,t[n*et+1]=a;var s=t[n*et+8];k=Math.max(k,o+s),M=Math.min(M,o-s),A=Math.max(A,a+s),N=Math.min(N,a-s)}))})),0===c)f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=p/nt(v-g),a=l/nt(m-y);t[e*et+0]=i*o,t[e*et+1]=r*a}));else{var L=(A+N)/2,D=(k-M)/nt(_),G=D*p/nt(v-g),P=D*l/nt(m-y);console.log("singleton scale factors",G,P),v=-1/0,g=1/0,f.vertices.forEach((function(e){var n=f.node_to_component_id[e],i=f.components_to_circle_pack[n].x,r=f.components_to_circle_pack[n].y,o=M-i*G;t[e*et+0]=o;var a=L+r*P;t[e*et+1]=a;var s=t[e*et+8];v=Math.max(o+s,v),g=Math.min(o-s,g)}));var B=v-M+.1*(v-g);f.vertices.forEach((function(e){t[e*et+0]-=B}))}it(t),console.timeEnd("component layout")},ot=function(){return ot=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},ot.apply(this,arguments)},at=n(739),st=function(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!0);var i=new Float32Array(t.order*et),r=new Float32Array(3*t.size),o={},a=0;return t.forEachNode((function(t,e){o[t]=a,i[a+0]=e.x,i[a+1]=e.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]=e.size,i[a+9]=e.fixed?1:0,a+=et})),a=0,t.forEachEdge((function(t,s,h,u,c,d,l){var p=o[h],f=o[u],g=e&&s.weight||1;n&&(i[p+6]+=g,i[f+6]+=g),r[a+0]=p,r[a+1]=f,r[a+2]=g,a+=3})),{nodes:i,edges:r}},ht=function(t,e){var n=0;t.updateEachNodeAttributes((function(t,i){var r=i.fixed?i:ot(ot({},i),{x:e[n+0],y:e[n+1]});return n+=et,r}))},ut=function(){function t(t,e,n){var i=this;this.graph=t,this.graphComponents=(0,o.kS)(t).map((function(t){return t.map(Number)})),this.params=e,this.frameID=null,this.nextWorkerSeqId=null,this.workerTimerId=null,this.running=!1,this.graphArrays=st(t),this.graphArrays&&this.updateNodePropsArrays(this.graphArrays),this.worker=at.createWorker(a),this.worker.onmessage=function(t){return i.onWorkerMessage(t)},this.worker.onerror=function(t){return i.onWorkerError(t)},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 t.prototype.isRunning=function(){return this.running},t.prototype.resetNIters=function(){this.niters=0},t.prototype.updateNodePropsArrays=function(t){var e=0,n=t;return this.graph.forEachNode((function(t,i){i.fixed&&(n.nodes[e+0]=i.x,n.nodes[e+1]=i.y,n.nodes[e+2]=0,n.nodes[e+3]=0),n.nodes[e+9]=i.fixed?1:0,e+=et})),n},t.prototype.forceNodePositionUpdate=function(){this.frameID||this.workerRunning?this.shouldUpdateLayoutArrays=!0:this.updateLayoutArrayNodePositions()},t.prototype.updateLayoutArrayNodePositions=function(){var t=this.graphArrays;if(t){var e=0;this.graph.forEachNode((function(n,i){t.nodes[e+0]=i.x,t.nodes[e+1]=i.y,t.nodes[e+2]=0,t.nodes[e+3]=0,t.nodes[e+4]=0,t.nodes[e+5]=0,e+=et}))}},t.prototype.hasConverged=function(){var t=0;if(!this.graphArrays)return!1;for(t=0;t<this.graphArrays.nodes.length;t+=et)if(this.graphArrays.nodes[t+7]>this.convergenceThreshold)return!1;return!0},t.prototype.onWorkerMessage=function(t){var e=t.data;this.graphArrays.nodes=new Float32Array(e.nodes),this.graphArrays.edges=new Float32Array(e.edges),this.graphArrays.nodes.length!=this.graph.order*et&&(console.log("graphArrays not the correct size. rebuilding."),this.graphArrays=st(this.graph)),this.positionsUpdated=!0,this.shouldUpdateLayoutArrays&&(this.updateLayoutArrayNodePositions(),this.shouldUpdateLayoutArrays=!1),this.workerRunning=!1,this.workerTimerId&&(window.clearTimeout(this.workerTimerId),this.workerTimerId=null)},t.prototype.onWorkerError=function(t){var e=this;console.log(t),this.worker.terminate(),this.worker=at.createWorker(a),this.worker.onmessage=function(t){return e.onWorkerMessage(t)},this.worker.onerror=function(t){return e.onWorkerError(t)},this.shouldUpdateLayoutArrays=!1,this.workerRunning=!1,this.positionsUpdated=!1,this.workerTimerId=null},t.prototype.runFrame=function(){var t=this;if(this.positionsUpdated&&!this.shouldUpdateLayoutArrays){ht(this.graph,this.graphArrays.nodes);var e=0;this.graph.updateEachNodeAttributes((function(n,i){var r=ot(ot({},i),{trueX:Math.round(100*t.graphArrays.nodes[e*et+0])/100,trueY:Math.round(100*t.graphArrays.nodes[e*et+1])/100});return e++,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 t.onWorkerError("Worker timed out")}),500)}this.running&&(this.frameID=window.requestAnimationFrame((function(){return t.runFrame()})))},t.prototype.stop=function(){return this.running=!1,this.resetNIters(),null!==this.frameID&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},t.prototype.start=function(){this.running||(this.running=!0,this.runFrame())},t.prototype.kill=function(){this.stop(),this.workerTimerId&&window.clearTimeout(this.workerTimerId),this.worker.terminate()},t}(),ct=n(847),dt=n(739);function lt(t){if(!t)return[650,410];var e=t[0],n=t[1];return!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0?[650,410]:[Math.max(1,e),Math.max(1,n)]}var pt=function(t,e,n){return void 0===n&&(n=!0),s=function(){var i,s,h,u,c,d,l,p;return function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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:if(!r()(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");if(i=e.iterations,s=(0,o.kS)(t).map((function(t){return t.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((h=dt.assign({},ct,e.settings)).expectedDims=lt(h.expectedDims),u=dt.validateSettings(h))throw new Error("graphology-layout-forceatlas2: ".concat(u.message));return c=st(t),l=dt.createWorker(a),p={iterations:i,settings:h,nodes:c.nodes.buffer,edges:c.edges.buffer,components:s,__messageId:"initialGraphLayout"},l.postMessage(p,[c.nodes.buffer,c.edges.buffer]),[4,new Promise((function(t){l.onmessage=function(e){t({nodes:new Float32Array(e.data.nodes),settings:e.data.settings}),l.terminate()}}))];case 1:return d=f.sent(),n&&rt(d.nodes,s,100,lt(h.expectedDims),h.layoutSingletonsSeparately),ht(t,d.nodes),[2,d.settings]}}))},new((i=void 0)||(i=Promise))((function(t,e){function n(t){try{o(s.next(t))}catch(t){e(t)}}function r(t){try{o(s.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(t){t(o)}))).then(n,r)}o((s=s.apply(void 0,[])).next())}));var i,s},ft="\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",gt="\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",vt='\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',yt='\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',mt=function(){return mt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},mt.apply(this,arguments)},bt={width:1920,height:1080,padding:50,backgroundColor:"#ffffff",nodeStrokeWidth:0,edgeColor:"#bbbbbb",edgeWidth:1,includeLabels:!1,fontSize:12,fontFamily:"Arial, sans-serif"};function wt(t,e){void 0===e&&(e={});var n=mt(mt({},bt),e),i=1/0,r=1/0,o=-1/0,a=-1/0;t.forEachNode((function(t,e){var n=e.x||0,s=e.y||0,h=e.size||5;n-h<i&&(i=n-h),s-h<r&&(r=s-h),n+h>o&&(o=n+h),s+h>a&&(a=s+h)})),isFinite(i)||(i=0,r=0,o=100,a=100);var s=o-i,h=a-r,u=n.width-2*n.padding,c=n.height-2*n.padding,d=Math.min(u/s,c/h),l=n.padding-i*d+(u-s*d)/2,p=n.padding-r*d+(c-h*d)/2,f=[];f.push('<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(n.width,'" height="').concat(n.height,'" viewBox="0 0 ').concat(n.width," ").concat(n.height,'">')),f.push('<defs>\n <style type="text/css">\n <![CDATA[\n /* Edit these values to change appearance */\n .edge {\n stroke: '.concat(n.edgeColor,";\n stroke-width: ").concat(n.edgeWidth,";\n opacity: 0.5;\n }\n .node {\n /* Node colors are set individually via fill attribute */\n }\n .node-stroke {\n stroke: #000000;\n stroke-width: ").concat(n.nodeStrokeWidth,";\n }\n .label {\n font-size: ").concat(n.fontSize,"px;\n font-family: ").concat(n.fontFamily,";\n fill: #000000;\n }\n ]]>\n </style>\n </defs>")),f.push('<rect width="'.concat(n.width,'" height="').concat(n.height,'" fill="').concat(n.backgroundColor,'"/>')),f.push('<g id="graph">');var g=[];t.forEachEdge((function(e,i,r,o){var a=t.getNodeAttributes(r),s=t.getNodeAttributes(o),h=a.x||0,u=a.y||0,c=s.x||0,f=s.y||0,v=h*d+l,y=u*d+p,m=c*d+l,b=f*d+p,w=i.color&&i.color!==n.edgeColor,x=i.size&&i.size!==n.edgeWidth;if(w||x){var _=i.color||n.edgeColor,C=i.size||n.edgeWidth;g.push('<line class="edge" x1="'.concat(v,'" y1="').concat(y,'" x2="').concat(m,'" y2="').concat(b,'" stroke="').concat(_,'" stroke-width="').concat(C,'"/>'))}else g.push('<line class="edge" x1="'.concat(v,'" y1="').concat(y,'" x2="').concat(m,'" y2="').concat(b,'"/>'))})),f.push.apply(f,g);var v=[];return t.forEachNode((function(t,e){var i=e.x||0,r=e.y||0,o=(e.size||5)*d,a=e.color||"#999999",s=i*d+l,h=r*d+p,u=e.borderColor||"#000000",c=n.nodeStrokeWidth>0?"node node-stroke":"node",f="node-".concat(t);if(n.nodeStrokeWidth>0?v.push('<circle id="'.concat(f,'" class="').concat(c,'" cx="').concat(s,'" cy="').concat(h,'" r="').concat(o,'" fill="').concat(a,'" stroke="').concat(u,'"/>')):v.push('<circle id="'.concat(f,'" class="').concat(c,'" cx="').concat(s,'" cy="').concat(h,'" r="').concat(o,'" fill="').concat(a,'"/>')),n.includeLabels&&e.label){var g=String(e.label).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),y=h+n.fontSize/3;v.push('<text class="label" x="'.concat(s+o+3,'" y="').concat(y,'">').concat(g,"</text>"))}})),f.push.apply(f,v),f.push("</g>"),f.push("</svg>"),f.join("\n")}function xt(t,e){void 0===e&&(e="graph.svg");var n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)}var _t=[650,400],Ct=function(t){return{linLogMode:!1,adjustSizes:!1,scalingRatio:t.size/t.order,slowDown:1+Math.log(t.order),barnesHutTheta:.7,barnesHutThreshold:1e3,nRepulsiveCycles:void 0,expectedDims:_t,layoutSingletonsSeparately:!1,decayRepulsion:!1}},St=function(){function t(t){void 0===t&&(t=48),this.items=[],this.grid=new Map,this.cellSize=Math.max(1,t)}return t.prototype.clear=function(){this.items=[],this.grid.clear()},t.prototype.build=function(t){if(this.clear(),0!==t.length){this.items=t;for(var e=0;e<t.length;e+=1)for(var n=t[e],i=Math.floor((n.x-n.radius)/this.cellSize),r=Math.floor((n.x+n.radius)/this.cellSize),o=Math.floor((n.y-n.radius)/this.cellSize),a=Math.floor((n.y+n.radius)/this.cellSize),s=i;s<=r;s+=1)for(var h=o;h<=a;h+=1){var u="".concat(s,",").concat(h),c=this.grid.get(u);c?c.push(e):this.grid.set(u,[e])}}},t.prototype.pick=function(t){if(0===this.items.length)return null;var e=Math.floor(t.x/this.cellSize),n=Math.floor(t.y/this.cellSize),i=this.grid.get("".concat(e,",").concat(n));if(!i||0===i.length)return null;for(var r=null,o=Number.POSITIVE_INFINITY,a=0;a<i.length;a+=1){var s=i[a],h=this.items[s],u=h.x-t.x,c=h.y-t.y,d=Math.sqrt(u*u+c*c);d<=h.radius&&d<o&&(o=d,r=h.id)}return r},t}(),Et=function(){return Et=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Et.apply(this,arguments)},Mt={x:[-1,1],y:[-1,1]};function kt(t,e){var n,i,r,o;if("string"!=typeof t||!t.length)return e;var a=t.match(/^#([0-9a-fA-F]{3,8})$/);if(a){var s=a[1];if(3===s.length||4===s.length){var h=s.split("").map((function(t){return parseInt(t+t,16)/255}));return[null!==(n=h[0])&&void 0!==n?n:0,null!==(i=h[1])&&void 0!==i?i:0,null!==(r=h[2])&&void 0!==r?r:0,4===s.length&&null!==(o=h[3])&&void 0!==o?o:1]}if(6===s.length||8===s.length)return[parseInt(s.slice(0,2),16)/255,parseInt(s.slice(2,4),16)/255,parseInt(s.slice(4,6),16)/255,8===s.length?parseInt(s.slice(6,8),16)/255:1]}var u=t.match(/^rgba?\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)(?:\s*,\s*([0-9.]+))?\s*\)$/i);return u?[Math.min(255,Number(u[1]))/255,Math.min(255,Number(u[2]))/255,Math.min(255,Number(u[3]))/255,void 0!==u[4]?Math.max(0,Math.min(1,Number(u[4]))):1]:e}function Nt(t,e,n){var i=t.createShader(e);if(!i)return null;if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var r=e===t.VERTEX_SHADER?"VERTEX":"FRAGMENT",o=t.getShaderInfoLog(i)||"Unknown shader compile error";return console.error("GraphWebGLRenderer ".concat(r," shader compile error:"),o,n),t.deleteShader(i),null}return i}function At(t,e,n){var i=Nt(t,t.VERTEX_SHADER,e),r=Nt(t,t.FRAGMENT_SHADER,n);if(!i||!r)return null;var o=t.createProgram();if(!o)return null;if(t.attachShader(o,i),t.attachShader(o,r),t.linkProgram(o),t.deleteShader(i),t.deleteShader(r),!t.getProgramParameter(o,t.LINK_STATUS)){var a=t.getProgramInfoLog(o)||"Unknown program link error";return console.error("GraphWebGLRenderer program link error:",a),t.deleteProgram(o),null}return o}var Lt,Dt=function(){function t(t,e,n){var i=this;this.nodeProgram=null,this.edgeProgram=null,this.nodeBuffer=null,this.edgeBuffer=null,this.nodeSnapshots=[],this.edgeSnapshots=[],this.nodeFloatData=new Float32Array(0),this.edgeFloatData=new Float32Array(0),this.pickIndex=new St(48),this.pickIndexDirty=!0,this.customBBox=null,this.camera={x:0,y:0,ratio:1,angle:0},this.pendingFrame=null,this.cameraAnimationFrame=null,this.hoverPickAnimationFrame=null,this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.nodeBufferUploadDirty=!0,this.edgeBufferUploadDirty=!0,this.destroyed=!1,this.listeners={},this.hoveredNode=null,this.pendingHoverPoint=null,this.resizeObserver=null,this.cssWidth=1,this.cssHeight=1,this.pixelRatio=1,this.removeWindowResizeListener=null,this.removeVisibilityListener=null,this.contextLossSignaled=!1,this.graphNodeStructureListener=function(){i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.pickIndexDirty=!0,i.refresh()},this.graphNodeAttributesListener=function(t){i.nodeDataDirty=!0,i.nodeAttributePayloadAffectsEdgeGeometry(t)&&(i.edgeDataDirty=!0),i.pickIndexDirty=!0,i.refresh()},this.graphEdgeStructureListener=function(){i.edgeDataDirty=!0,i.refresh()},this.graphEdgeAttributesListener=function(){i.edgeDataDirty=!0,i.refresh()},this.graphClearedListener=function(){i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.pickIndexDirty=!0,i.refresh()},this.handleContextLost=function(t){t.preventDefault(),i.contextLossSignaled||(i.contextLossSignaled=!0,i.emit("contextLost",void 0))},this.handleContextRestored=function(){i.contextLossSignaled=!1,i.initializePrograms(),i.nodeDataDirty=!0,i.edgeDataDirty=!0,i.nodeBufferUploadDirty=!0,i.edgeBufferUploadDirty=!0,i.pickIndexDirty=!0,i.emit("contextRestored",void 0),i.refresh()},this.handleMouseMove=function(t){i.pendingHoverPoint=i.getViewportPointFromMouseEvent(t),null===i.hoverPickAnimationFrame&&(i.hoverPickAnimationFrame=window.requestAnimationFrame((function(){if(i.hoverPickAnimationFrame=null,i.pendingHoverPoint){var t=i.pickNodeAt(i.pendingHoverPoint);i.pendingHoverPoint=null,t!==i.hoveredNode&&(i.hoveredNode&&i.emit("leaveNode",{node:i.hoveredNode}),i.hoveredNode=t,t&&i.emit("enterNode",{node:t}))}})))},this.handleMouseDown=function(t){var e=i.pickNodeAt(i.getViewportPointFromMouseEvent(t));e&&i.emit("downNode",{node:e,event:t})},this.handleDoubleClick=function(t){var e=i.pickNodeAt(i.getViewportPointFromMouseEvent(t));e?i.emit("doubleClickNode",{node:e,event:t}):i.emit("doubleClickStage",{event:t})},this.graph=t,this.container=e,this.settings=n,this.canvas=document.createElement("canvas"),this.canvas.className="graph-render-container",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.canvas.style.touchAction="none",this.container.appendChild(this.canvas),this.syncCanvasSizeFromContainer(!1),this.gl=this.canvas.getContext("webgl",{antialias:!0,alpha:!0,preserveDrawingBuffer:!1}),this.bindGraphEvents(),this.bindMouseEvents(),this.bindContextEvents(),this.observeResize(),this.initializePrograms(),this.resetCameraToGraph(),this.refresh()}return t.prototype.getCanvas=function(){return this.canvas},t.prototype.getContainer=function(){return this.container},t.prototype.getGraph=function(){return this.graph},t.prototype.setGraph=function(t){this.graph!==t&&(this.unbindGraphEvents(),this.graph=t,this.bindGraphEvents(),this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.nodeBufferUploadDirty=!0,this.edgeBufferUploadDirty=!0,this.pickIndexDirty=!0,this.resetCameraToGraph(),this.refresh())},t.prototype.getSettings=function(){return this.settings},t.prototype.setSetting=function(t,e){var n;this.settings=Et(Et({},this.settings),((n={})[t]=e,n)),this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.refresh()},t.prototype.setSettings=function(t){this.settings=t,this.nodeDataDirty=!0,this.edgeDataDirty=!0,this.refresh()},t.prototype.on=function(t,e){var n=String(t);this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push(e)},t.prototype.off=function(t,e){var n=String(t),i=this.listeners[n];i&&(this.listeners[n]=i.filter((function(t){return t!==e})))},t.prototype.getDimensions=function(){return this.syncCanvasSizeFromContainer(!1),{width:this.cssWidth,height:this.cssHeight}},t.prototype.getPixelRatio=function(){return this.pixelRatio},t.prototype.isContextLost=function(){return!this.gl||"function"==typeof this.gl.isContextLost&&this.gl.isContextLost()},t.prototype.setCustomBBox=function(t){this.customBBox=t,t&&(this.camera=Et(Et({},this.camera),{x:(t.x[0]+t.x[1])/2,y:(t.y[0]+t.y[1])/2}),this.pickIndexDirty=!0),this.refresh()},t.prototype.getCustomBBox=function(){return this.customBBox},t.prototype.getBBox=function(){return this.computeEffectiveBBox()},t.prototype.getGraphBBox=function(){return this.computeGraphBBox()},t.prototype.getCameraState=function(){return Et({},this.camera)},t.prototype.setCameraState=function(t){var e,n=Math.max(.01,null!==(e=t.ratio)&&void 0!==e?e:this.camera.ratio);this.camera=Et(Et(Et({},this.camera),t),{ratio:n,angle:0}),this.pickIndexDirty=!0,this.refresh()},t.prototype.animateCamera=function(t,e){var n,i,r,o=this;if(!e||e<=0)return this.setCameraState(t),Promise.resolve();null!==this.cameraAnimationFrame&&window.cancelAnimationFrame(this.cameraAnimationFrame);var a=this.getCameraState(),s=null!==(n=t.x)&&void 0!==n?n:a.x,h=null!==(i=t.y)&&void 0!==i?i:a.y,u=Math.max(.01,null!==(r=t.ratio)&&void 0!==r?r:a.ratio);return new Promise((function(t){var n=performance.now(),i=function(){var r=performance.now()-n,c=Math.min(1,r/e),d=1-Math.pow(1-c,3);o.camera={x:a.x+(s-a.x)*d,y:a.y+(h-a.y)*d,ratio:a.ratio+(u-a.ratio)*d,angle:0},o.pickIndexDirty=!0,o.refresh(),c<1?o.cameraAnimationFrame=window.requestAnimationFrame(i):(o.cameraAnimationFrame=null,t())};o.cameraAnimationFrame=window.requestAnimationFrame(i)}))},t.prototype.graphToViewport=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform(),i=this.graphToFramed(t,n),r=this.graphToFramed({x:this.camera.x,y:this.camera.y},n),o=this.getDimensions(),a=o.width,s=o.height;return{x:(i.x-r.x)*e+a/2,y:(r.y-i.y)*e+s/2}},t.prototype.viewportToGraph=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform(),i=this.graphToFramed({x:this.camera.x,y:this.camera.y},n),r=this.getDimensions(),o=r.width,a=r.height,s={x:(t.x-o/2)/e+i.x,y:i.y-(t.y-a/2)/e};return Et({},this.framedToGraph(s,n))},t.prototype.zoomAt=function(t,e){var n=Math.max(.01,e),i=this.viewportToGraph(t);this.setCameraState({ratio:n});var r=this.viewportToGraph(t);this.setCameraState({x:this.camera.x+(i.x-r.x),y:this.camera.y+(i.y-r.y)})},t.prototype.pickNodeAt=function(t){return this.pickIndexDirty&&this.rebuildPickIndex(),this.pickIndex.pick(t)},t.prototype.refresh=function(){var t=this;this.destroyed||null!==this.pendingFrame||(this.pendingFrame=window.requestAnimationFrame((function(){t.pendingFrame=null,t.render()})))},t.prototype.resetCameraToGraph=function(){var t=this.computeEffectiveBBox();this.camera=this.getCameraForBBox(t,1.1),this.pickIndexDirty=!0},t.prototype.getCameraForBBox=function(t,e){void 0===e&&(e=1);var n=Math.max(1,t.x[1]-t.x[0]),i=Math.max(1,t.y[1]-t.y[0]),r=this.getDimensions(),o=r.width,a=r.height,s=Math.max(1,o),h=Math.max(1,a),u=Math.max(1,h-80),c=Math.max(1.05*n/s,1.05*i/u),d=Number.isFinite(c)?c:1;return{x:(t.x[0]+t.x[1])/2,y:(t.y[0]+t.y[1])/2,ratio:Math.max(.01,d*Math.max(1,e)),angle:0}},t.prototype.dispose=function(){this.destroyed=!0,this.unbindGraphEvents(),this.canvas.removeEventListener("webglcontextlost",this.handleContextLost),this.canvas.removeEventListener("webglcontextrestored",this.handleContextRestored),null!==this.pendingFrame&&(window.cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),null!==this.cameraAnimationFrame&&(window.cancelAnimationFrame(this.cameraAnimationFrame),this.cameraAnimationFrame=null),null!==this.hoverPickAnimationFrame&&(window.cancelAnimationFrame(this.hoverPickAnimationFrame),this.hoverPickAnimationFrame=null),this.pickIndex.clear(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.removeWindowResizeListener&&(this.removeWindowResizeListener(),this.removeWindowResizeListener=null),this.removeVisibilityListener&&(this.removeVisibilityListener(),this.removeVisibilityListener=null),this.gl&&(this.nodeBuffer&&this.gl.deleteBuffer(this.nodeBuffer),this.edgeBuffer&&this.gl.deleteBuffer(this.edgeBuffer),this.nodeProgram&&this.gl.deleteProgram(this.nodeProgram),this.edgeProgram&&this.gl.deleteProgram(this.edgeProgram)),this.canvas.parentElement===this.container&&this.container.removeChild(this.canvas)},t.prototype.emit=function(t,e){var n=this.listeners[String(t)];n&&n.forEach((function(t){return t(e)}))},t.prototype.bindGraphEvents=function(){this.graph.on("nodeAdded",this.graphNodeStructureListener),this.graph.on("nodeDropped",this.graphNodeStructureListener),this.graph.on("edgeAdded",this.graphEdgeStructureListener),this.graph.on("edgeDropped",this.graphEdgeStructureListener),this.graph.on("cleared",this.graphClearedListener),this.graph.on("nodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.on("edgeAttributesUpdated",this.graphEdgeAttributesListener),this.graph.on("eachNodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.on("eachEdgeAttributesUpdated",this.graphEdgeAttributesListener)},t.prototype.unbindGraphEvents=function(){this.graph.off("nodeAdded",this.graphNodeStructureListener),this.graph.off("nodeDropped",this.graphNodeStructureListener),this.graph.off("edgeAdded",this.graphEdgeStructureListener),this.graph.off("edgeDropped",this.graphEdgeStructureListener),this.graph.off("cleared",this.graphClearedListener),this.graph.off("nodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.off("edgeAttributesUpdated",this.graphEdgeAttributesListener),this.graph.off("eachNodeAttributesUpdated",this.graphNodeAttributesListener),this.graph.off("eachEdgeAttributesUpdated",this.graphEdgeAttributesListener)},t.prototype.nodeAttributePayloadAffectsEdgeGeometry=function(t){var e,n,i=null!==(e=null==t?void 0:t.attributes)&&void 0!==e?e:null===(n=null==t?void 0:t.hints)||void 0===n?void 0:n.attributes;return!Array.isArray(i)||i.includes("x")||i.includes("y")},t.prototype.bindMouseEvents=function(){this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mousedown",this.handleMouseDown),this.canvas.addEventListener("dblclick",this.handleDoubleClick)},t.prototype.bindContextEvents=function(){this.canvas.addEventListener("webglcontextlost",this.handleContextLost,{passive:!1}),this.canvas.addEventListener("webglcontextrestored",this.handleContextRestored)},t.prototype.getViewportPointFromMouseEvent=function(t){var e=this.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},t.prototype.observeResize=function(){var t=this,e=function(){t.syncCanvasSizeFromContainer(!0)};e(),"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((function(){return e()})),this.resizeObserver.observe(this.container)),window.addEventListener("resize",e),this.removeWindowResizeListener=function(){return window.removeEventListener("resize",e)};var n=function(){document.hidden||t.syncCanvasSizeFromContainer(!0)};document.addEventListener("visibilitychange",n),this.removeVisibilityListener=function(){return document.removeEventListener("visibilitychange",n)}},t.prototype.recoverCameraIfPathological=function(){var t=this.getCameraForBBox(this.computeEffectiveBBox(),1.1),e=this.camera.ratio,n=t.ratio;if(!Number.isFinite(e)||!Number.isFinite(n)||n<=0)return this.camera=t,void(this.pickIndexDirty=!0);(e>50*n||e<n/50)&&(this.camera=Et(Et({},this.camera),{x:t.x,y:t.y,ratio:t.ratio,angle:0}),this.pickIndexDirty=!0)},t.prototype.syncCanvasSizeFromContainer=function(t){var e=this.container.getBoundingClientRect(),n=Math.max(this.container.clientWidth,Math.round(e.width)),i=Math.max(this.container.clientHeight,Math.round(e.height)),r=Math.max(1,n),o=Math.max(1,i),a=Math.max(1,window.devicePixelRatio||1),s=Math.max(1,Math.round(r*a)),h=Math.max(1,Math.round(o*a)),u=(this.cssWidth<=1||this.cssHeight<=1)&&r>1&&o>1;(this.cssWidth!==r||this.cssHeight!==o||this.pixelRatio!==a||this.canvas.width!==s||this.canvas.height!==h)&&(this.cssWidth=r,this.cssHeight=o,this.pixelRatio=a,this.canvas.width=s,this.canvas.height=h,this.pickIndexDirty=!0,u&&this.recoverCameraIfPathological(),t&&this.refresh())},t.prototype.initializePrograms=function(){this.gl&&(this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.edgeProgram=At(this.gl,"\n attribute vec2 a_position;\n attribute vec2 a_other;\n attribute float a_side;\n attribute float a_thickness;\n attribute vec4 a_color;\n uniform vec2 u_camera;\n uniform vec2 u_graphMin;\n uniform vec2 u_frameOffset;\n uniform float u_invMaxExtent;\n uniform vec2 u_viewport;\n uniform float u_scale;\n uniform float u_edgeSizeScale;\n varying vec4 v_color;\n\n void main() {\n vec2 framed = vec2(\n (a_position.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_position.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 otherFramed = vec2(\n (a_other.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_other.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 screen = vec2(\n (framed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - framed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 otherScreen = vec2(\n (otherFramed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - otherFramed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 dir = otherScreen - screen;\n float dirLen = max(length(dir), 1e-6);\n vec2 normal = vec2(-dir.y, dir.x) / dirLen;\n float thickness = max(1.0, a_thickness / max(0.01, u_edgeSizeScale));\n vec2 quadScreen = screen + normal * (0.5 * thickness * a_side);\n vec2 clip = vec2(\n (quadScreen.x / u_viewport.x) * 2.0 - 1.0,\n 1.0 - (quadScreen.y / u_viewport.y) * 2.0\n );\n gl_Position = vec4(clip, 0.0, 1.0);\n v_color = a_color;\n }\n ","\n precision mediump float;\n varying vec4 v_color;\n void main() {\n gl_FragColor = v_color;\n }\n "),this.nodeProgram=At(this.gl,"\n attribute vec2 a_position;\n attribute float a_size;\n attribute float a_halo;\n attribute vec4 a_color;\n attribute vec4 a_borderColor;\n attribute float a_borderWidth;\n uniform vec2 u_camera;\n uniform vec2 u_graphMin;\n uniform vec2 u_frameOffset;\n uniform float u_invMaxExtent;\n uniform vec2 u_viewport;\n uniform float u_scale;\n uniform float u_nodeSizeScale;\n uniform float u_haloExpansion;\n uniform float u_haloGap;\n varying vec4 v_color;\n varying vec4 v_borderColor;\n varying float v_borderWidth;\n varying float v_pointSize;\n varying float v_halo;\n varying float v_nodeRadiusNorm;\n varying float v_haloGapNorm;\n\n void main() {\n vec2 framed = vec2(\n (a_position.x - u_graphMin.x) * u_invMaxExtent + u_frameOffset.x,\n (a_position.y - u_graphMin.y) * u_invMaxExtent + u_frameOffset.y\n );\n vec2 screen = vec2(\n (framed.x - u_camera.x) * u_scale + u_viewport.x * 0.5,\n (u_camera.y - framed.y) * u_scale + u_viewport.y * 0.5\n );\n vec2 clip = vec2(\n (screen.x / u_viewport.x) * 2.0 - 1.0,\n 1.0 - (screen.y / u_viewport.y) * 2.0\n );\n\n gl_Position = vec4(clip, 0.0, 1.0);\n float basePointSize = max(2.0, 2.0 * a_size * u_nodeSizeScale);\n float baseRadius = 0.5 * basePointSize;\n float haloInnerRadius = baseRadius + a_halo * max(0.0, u_haloGap);\n float haloOuterRadius = haloInnerRadius * (1.0 + a_halo * max(0.0, u_haloExpansion));\n float pointSize = max(2.0, 2.0 * haloOuterRadius);\n gl_PointSize = pointSize;\n v_color = a_color;\n v_borderColor = a_borderColor;\n v_borderWidth = a_borderWidth;\n v_pointSize = pointSize;\n v_halo = a_halo;\n v_nodeRadiusNorm = (basePointSize * 0.5) / max(1.0, pointSize);\n v_haloGapNorm = max(0.0, u_haloGap) / max(1.0, pointSize);\n }\n ","\n precision mediump float;\n varying vec4 v_color;\n varying vec4 v_borderColor;\n varying float v_borderWidth;\n varying float v_pointSize;\n varying float v_halo;\n varying float v_nodeRadiusNorm;\n varying float v_haloGapNorm;\n uniform vec4 u_haloColor;\n uniform float u_haloFadeExponent;\n\n void main() {\n vec2 c = gl_PointCoord - vec2(0.5, 0.5);\n float dist = length(c);\n float edgeSoftness = max(0.75 / max(1.0, v_pointSize), 0.0025);\n float nodeRadius = min(0.5, max(0.0, v_nodeRadiusNorm));\n float nodeMask = 1.0 - smoothstep(nodeRadius - edgeSoftness, nodeRadius + edgeSoftness, dist);\n float alphaMask = 1.0 - smoothstep(0.5 - edgeSoftness, 0.5 + edgeSoftness, dist);\n\n if (alphaMask <= 0.0) {\n discard;\n }\n\n float borderNorm = min(nodeRadius - 0.0001, v_borderWidth / max(1.0, v_pointSize));\n vec4 color = v_color;\n if (v_borderWidth > 0.0 && nodeRadius > 0.0 && borderNorm > 0.0) {\n float borderMix = smoothstep(\n nodeRadius - borderNorm - edgeSoftness,\n nodeRadius - borderNorm + edgeSoftness,\n dist\n );\n color = mix(v_color, v_borderColor, borderMix);\n }\n\n float nodeAlpha = color.a * nodeMask;\n\n float gapAlpha = 0.0;\n float haloAlpha = 0.0;\n if (v_halo > 0.5) {\n float haloInner = min(0.5, nodeRadius + v_haloGapNorm);\n float gapInnerMask = smoothstep(nodeRadius - edgeSoftness, nodeRadius + edgeSoftness, dist);\n float gapOuterMask = 1.0 - smoothstep(haloInner - edgeSoftness, haloInner + edgeSoftness, dist);\n gapAlpha = clamp(gapInnerMask * gapOuterMask * alphaMask, 0.0, 1.0);\n float haloBand = max(0.0001, 0.5 - haloInner);\n float haloBandMask = smoothstep(haloInner - edgeSoftness, haloInner + edgeSoftness, dist) * alphaMask;\n float haloT = clamp((dist - haloInner) / haloBand, 0.0, 1.0);\n haloAlpha = u_haloColor.a * pow(1.0 - haloT, max(0.01, u_haloFadeExponent)) * haloBandMask;\n }\n\n vec3 outPremulRgb = color.rgb * nodeAlpha;\n float outAlpha = nodeAlpha;\n\n outPremulRgb += vec3(1.0, 1.0, 1.0) * gapAlpha * (1.0 - outAlpha);\n outAlpha += gapAlpha * (1.0 - outAlpha);\n\n outPremulRgb += u_haloColor.rgb * haloAlpha * (1.0 - outAlpha);\n outAlpha += haloAlpha * (1.0 - outAlpha);\n\n if (outAlpha <= 0.0) {\n discard;\n }\n\n vec3 outRgb = outPremulRgb / outAlpha;\n gl_FragColor = vec4(outRgb, outAlpha);\n }\n "),this.edgeBuffer=this.gl.createBuffer(),this.nodeBuffer=this.gl.createBuffer())},t.prototype.computeGraphBBox=function(){if(!this.graph.order)return null;var t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return this.graph.forEachNode((function(r,o){var a=Number(o.x||0),s=Number(o.y||0),h=Math.max(.5,Number(o.size||1));a-h<t&&(t=a-h),a+h>n&&(n=a+h),s-h<e&&(e=s-h),s+h>i&&(i=s+h)})),isFinite(t)&&isFinite(e)&&isFinite(n)&&isFinite(i)?{x:[t-1,n+1],y:[e-1,i+1]}:null},t.prototype.computeEffectiveBBox=function(){var t=this.computeGraphBBox();return this.customBBox||t||Mt},t.prototype.getCurrentFramedTransform=function(){return t=this.computeEffectiveBBox(),e=Math.max(1e-9,t.x[1]-t.x[0]),n=Math.max(1e-9,t.y[1]-t.y[0]),o=.5*((i=Math.max(e,n))-e)*(r=1/i),a=.5*(i-n)*r,{minX:t.x[0],minY:t.y[0],maxExtent:i,invMaxExtent:r,offsetX:o,offsetY:a};var t,e,n,i,r,o,a},t.prototype.graphToFramed=function(t,e){return{x:(t.x-e.minX)*e.invMaxExtent+e.offsetX,y:(t.y-e.minY)*e.invMaxExtent+e.offsetY}},t.prototype.framedToGraph=function(t,e){return{x:(t.x-e.offsetX)*e.maxExtent+e.minX,y:(t.y-e.offsetY)*e.maxExtent+e.minY}},t.prototype.getScale=function(){return this.getDrawScale()},t.prototype.getCssScale=function(){return this.getCurrentFramedTransform().maxExtent/Math.max(.01,this.camera.ratio)},t.prototype.getDrawScale=function(){var t=this.getCurrentFramedTransform(),e=Math.max(1,this.pixelRatio||1);return t.maxExtent*e/Math.max(.01,this.camera.ratio)},t.prototype.getNodeSizeScreenMultiplier=function(){var t=this.settings.zoomToSizeRatioFunction;if(!t)return 1;var e=Number(t(this.camera.ratio));return Number.isFinite(e)?Math.max(.01,e):1},t.prototype.getEdgeSizeScreenMultiplier=function(){var t,e=null!==(t=this.settings.edgeZoomToSizeRatioFunction)&&void 0!==t?t:this.settings.zoomToSizeRatioFunction;if(!e)return 1;var n=Number(e(this.camera.ratio));return Number.isFinite(n)?Math.max(.01,n):1},t.prototype.getNodeScreenSize=function(t){var e=this.getCssScale(),n=this.getCurrentFramedTransform();return Math.max(1,2*t*e*n.invMaxExtent*this.getNodeSizeScreenMultiplier())},t.prototype.rebuildSnapshotData=function(){var t,e,n,i,r,o=this,a=Math.max(0,Math.min(1,null!==(t=this.settings.nodeOpacity)&&void 0!==t?t:1)),s=Math.max(0,Math.min(1,null!==(e=this.settings.edgeOpacity)&&void 0!==e?e:1)),h=Math.max(1,Number(null!==(n=this.settings.edgeSize)&&void 0!==n?n:1.5)),u=Math.max(h,Number(null!==(i=this.settings.edgeMaxSize)&&void 0!==i?i:h)),c=Boolean(null!==(r=this.settings.edgeWeightToSize)&&void 0!==r&&r),d=kt(this.settings.edgeColor||"#ccc",[.8,.8,.8,1]);if(this.nodeDataDirty){var l=[];this.graph.forEachNode((function(t,e){var n=Boolean(e.highlighted),i=Boolean(e.hovered),r=kt(e.color,[.35,.52,.84,1]),o=i?"#ffffff":"",s=e.border,h="string"==typeof s,u="number"==typeof s?s:h||n||i?2:0,c=kt(h?s:o,[r[0],r[1],r[2],1]);l.push({id:t,x:Number(e.x||0),y:Number(e.y||0),size:Math.max(.5,Number(e.size||1)),halo:n?1:0,color:[r[0],r[1],r[2],a*r[3]],borderColor:c,borderWidth:u})})),this.nodeSnapshots=l,this.nodeFloatData=new Float32Array(13*l.length);for(var p=0;p<l.length;p+=1){var f=l[p],g=13*p;this.nodeFloatData[g]=f.x,this.nodeFloatData[g+1]=f.y,this.nodeFloatData[g+2]=f.size,this.nodeFloatData[g+3]=f.halo,this.nodeFloatData[g+4]=f.color[0],this.nodeFloatData[g+5]=f.color[1],this.nodeFloatData[g+6]=f.color[2],this.nodeFloatData[g+7]=f.color[3],this.nodeFloatData[g+8]=f.borderColor[0],this.nodeFloatData[g+9]=f.borderColor[1],this.nodeFloatData[g+10]=f.borderColor[2],this.nodeFloatData[g+11]=f.borderColor[3],this.nodeFloatData[g+12]=f.borderWidth}this.nodeDataDirty=!1,this.nodeBufferUploadDirty=!0,this.pickIndexDirty=!0}if(this.edgeDataDirty){var v=[],y=0;this.graph.forEachEdge((function(t,e,n,i){var r=o.graph.getNodeAttributes(n),a=o.graph.getNodeAttributes(i),h=kt(e.color,d);h[3]*=s;var u="number"==typeof e.size&&Number.isFinite(e.size)?e.size:null,c="number"==typeof e.w&&Number.isFinite(e.w)?e.w:"number"==typeof e.weight&&Number.isFinite(e.weight)?e.weight:null,l=null!==c&&c>=0?c:null;null!==l&&(y=Math.max(y,l)),v.push({sourceX:Number(r.x||0),sourceY:Number(r.y||0),targetX:Number(a.x||0),targetY:Number(a.y||0),color:h,explicitSize:u,weight:l})}));var m=[];for(p=0;p<v.length;p+=1){var b=null!==(f=v[p]).explicitSize?Math.max(1,f.explicitSize):h,w=h;c&&null!==f.weight&&y>0&&(w=h+Math.max(0,Math.min(1,f.weight/y))*(u-h));var x=Math.max(b,w);m.push({sourceX:f.sourceX,sourceY:f.sourceY,targetX:f.targetX,targetY:f.targetY,thickness:x,color:f.color})}this.edgeSnapshots=m,this.edgeFloatData=new Float32Array(60*m.length);var _=function(t){var e=m[t],n=60*t,i=function(t,e,i,r,a,s,h){o.edgeFloatData[n]=t,o.edgeFloatData[n+1]=e,o.edgeFloatData[n+2]=i,o.edgeFloatData[n+3]=r,o.edgeFloatData[n+4]=a,o.edgeFloatData[n+5]=s,o.edgeFloatData[n+6]=h[0],o.edgeFloatData[n+7]=h[1],o.edgeFloatData[n+8]=h[2],o.edgeFloatData[n+9]=h[3],n+=10};i(e.sourceX,e.sourceY,e.targetX,e.targetY,-1,e.thickness,e.color),i(e.sourceX,e.sourceY,e.targetX,e.targetY,1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,-1,e.thickness,e.color),i(e.sourceX,e.sourceY,e.targetX,e.targetY,-1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,-1,e.thickness,e.color),i(e.targetX,e.targetY,e.sourceX,e.sourceY,1,e.thickness,e.color)};for(p=0;p<m.length;p+=1)_(p);this.edgeDataDirty=!1,this.edgeBufferUploadDirty=!0}},t.prototype.rebuildPickIndex=function(){var t=[];if(0===this.nodeSnapshots.length)return this.pickIndex.clear(),void(this.pickIndexDirty=!1);for(var e=this.getCurrentFramedTransform(),n=this.graphToFramed({x:this.camera.x,y:this.camera.y},e),i=this.getCssScale(),r=this.getDimensions(),o=r.width,a=r.height,s=this.getNodeSizeScreenMultiplier(),h=0;h<this.nodeSnapshots.length;h+=1){var u=this.nodeSnapshots[h],c=this.graphToFramed({x:u.x,y:u.y},e),d=(c.x-n.x)*i+o/2,l=(n.y-c.y)*i+a/2,p=Math.max(1,2*u.size*i*e.invMaxExtent*s)/2+4;t.push({id:u.id,x:d,y:l,radius:p})}this.pickIndex.build(t),this.pickIndexDirty=!1},t.prototype.render=function(){this.gl&&this.nodeProgram&&this.edgeProgram&&!this.destroyed&&(this.isContextLost()?this.contextLossSignaled||(this.contextLossSignaled=!0,this.emit("contextLost",void 0)):((this.nodeDataDirty||this.edgeDataDirty)&&this.rebuildSnapshotData(),this.pickIndexDirty&&this.rebuildPickIndex(),this.gl.viewport(0,0,this.canvas.width,this.canvas.height),this.gl.clearColor(0,0,0,0),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.edgeFloatData.length>0&&this.edgeBuffer&&this.renderEdges(),this.nodeFloatData.length>0&&this.nodeBuffer&&this.renderNodes()))},t.prototype.renderEdges=function(){if(this.gl&&this.edgeProgram&&this.edgeBuffer){var t=this.gl;t.useProgram(this.edgeProgram),t.bindBuffer(t.ARRAY_BUFFER,this.edgeBuffer),this.edgeBufferUploadDirty&&(t.bufferData(t.ARRAY_BUFFER,this.edgeFloatData,t.DYNAMIC_DRAW),this.edgeBufferUploadDirty=!1);var e=10*Float32Array.BYTES_PER_ELEMENT,n=t.getAttribLocation(this.edgeProgram,"a_position"),i=t.getAttribLocation(this.edgeProgram,"a_other"),r=t.getAttribLocation(this.edgeProgram,"a_side"),o=t.getAttribLocation(this.edgeProgram,"a_thickness"),a=t.getAttribLocation(this.edgeProgram,"a_color");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,e,0),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,2,t.FLOAT,!1,e,2*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,1,t.FLOAT,!1,e,4*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(o),t.vertexAttribPointer(o,1,t.FLOAT,!1,e,5*Float32Array.BYTES_PER_ELEMENT),t.enableVertexAttribArray(a),t.vertexAttribPointer(a,4,t.FLOAT,!1,e,6*Float32Array.BYTES_PER_ELEMENT);var s=t.getUniformLocation(this.edgeProgram,"u_camera"),h=t.getUniformLocation(this.edgeProgram,"u_graphMin"),u=t.getUniformLocation(this.edgeProgram,"u_frameOffset"),c=t.getUniformLocation(this.edgeProgram,"u_invMaxExtent"),d=t.getUniformLocation(this.edgeProgram,"u_viewport"),l=t.getUniformLocation(this.edgeProgram,"u_scale"),p=t.getUniformLocation(this.edgeProgram,"u_edgeSizeScale"),f=this.getCurrentFramedTransform(),g=this.graphToFramed({x:this.camera.x,y:this.camera.y},f);t.uniform2f(s,g.x,g.y),t.uniform2f(h,f.minX,f.minY),t.uniform2f(u,f.offsetX,f.offsetY),t.uniform1f(c,f.invMaxExtent),t.uniform2f(d,this.canvas.width,this.canvas.height),t.uniform1f(l,this.getDrawScale()),t.uniform1f(p,this.getEdgeSizeScreenMultiplier()),t.drawArrays(t.TRIANGLES,0,this.edgeFloatData.length/10)}},t.prototype.renderNodes=function(){var t,e,n,i;if(this.gl&&this.nodeProgram&&this.nodeBuffer){var r=this.gl;r.useProgram(this.nodeProgram),r.bindBuffer(r.ARRAY_BUFFER,this.nodeBuffer),this.nodeBufferUploadDirty&&(r.bufferData(r.ARRAY_BUFFER,this.nodeFloatData,r.DYNAMIC_DRAW),this.nodeBufferUploadDirty=!1);var o=13*Float32Array.BYTES_PER_ELEMENT,a=r.getAttribLocation(this.nodeProgram,"a_position"),s=r.getAttribLocation(this.nodeProgram,"a_size"),h=r.getAttribLocation(this.nodeProgram,"a_halo"),u=r.getAttribLocation(this.nodeProgram,"a_color"),c=r.getAttribLocation(this.nodeProgram,"a_borderColor"),d=r.getAttribLocation(this.nodeProgram,"a_borderWidth");r.enableVertexAttribArray(a),r.vertexAttribPointer(a,2,r.FLOAT,!1,o,0),r.enableVertexAttribArray(s),r.vertexAttribPointer(s,1,r.FLOAT,!1,o,2*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(h),r.vertexAttribPointer(h,1,r.FLOAT,!1,o,3*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(u),r.vertexAttribPointer(u,4,r.FLOAT,!1,o,4*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(c),r.vertexAttribPointer(c,4,r.FLOAT,!1,o,8*Float32Array.BYTES_PER_ELEMENT),r.enableVertexAttribArray(d),r.vertexAttribPointer(d,1,r.FLOAT,!1,o,12*Float32Array.BYTES_PER_ELEMENT);var l=r.getUniformLocation(this.nodeProgram,"u_camera"),p=r.getUniformLocation(this.nodeProgram,"u_graphMin"),f=r.getUniformLocation(this.nodeProgram,"u_frameOffset"),g=r.getUniformLocation(this.nodeProgram,"u_invMaxExtent"),v=r.getUniformLocation(this.nodeProgram,"u_viewport"),y=r.getUniformLocation(this.nodeProgram,"u_scale"),m=r.getUniformLocation(this.nodeProgram,"u_nodeSizeScale"),b=r.getUniformLocation(this.nodeProgram,"u_haloExpansion"),w=r.getUniformLocation(this.nodeProgram,"u_haloGap"),x=r.getUniformLocation(this.nodeProgram,"u_haloColor"),_=r.getUniformLocation(this.nodeProgram,"u_haloFadeExponent"),C=Math.max(0,Number(null!==(t=this.settings.highlightHaloExpansion)&&void 0!==t?t:.8)),S=Math.max(0,Number(null!==(e=this.settings.highlightHaloGap)&&void 0!==e?e:4)),E=Math.max(.01,Number(null!==(n=this.settings.highlightHaloFadeExponent)&&void 0!==n?n:1.8)),M=this.getCurrentFramedTransform(),k=this.graphToFramed({x:this.camera.x,y:this.camera.y},M),N=kt(null!==(i=this.settings.highlightHaloColor)&&void 0!==i?i:"rgba(0, 0, 0, 0.8)",[0,0,0,.8]);r.uniform2f(l,k.x,k.y),r.uniform2f(p,M.minX,M.minY),r.uniform2f(f,M.offsetX,M.offsetY),r.uniform1f(g,M.invMaxExtent),r.uniform2f(v,this.canvas.width,this.canvas.height),r.uniform1f(y,this.getDrawScale()),r.uniform1f(m,this.getDrawScale()*M.invMaxExtent*this.getNodeSizeScreenMultiplier()),r.uniform1f(b,C),r.uniform1f(w,S),r.uniform4f(x,N[0],N[1],N[2],N[3]),r.uniform1f(_,E),r.drawArrays(r.POINTS,0,this.nodeFloatData.length/13)}},t}(),Gt=function(){return Gt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Gt.apply(this,arguments)},Pt=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))},Ft=function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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])}}},Bt=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))};!function(t){t[t.inactive=0]="inactive",t[t.lasso=1]="lasso",t[t.box=2]="box"}(Lt||(Lt={}));var zt,Rt=function(){function e(t){var e,n,i,r,o,a,s,h,u,c,d,l,p,f,g,v,y,m,b,w,x,_,C,S=this;this.zoomFactor=1.5,this.zoomDuration=200,this.isDragging=!1,this.isPanning=!1,this.isDraggedNodeSelected=!1,this.isLassoActiveDueToModifierKey=!1,this.fullScreenButton=null,this.resetButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.playPauseButton=null,this.contextLostOverlay=null,this.hoverOverlay=null,this.previousPosition=null,this.previousPanPoint=null,this.hoveredNode=null,this.lastMousePosition=null,this.originalSizeKey="originalSize",this.handleSelectionClear=function(){S.updateSelectedNodes([])},this.handleEnterNode=function(t){S.hoveredNode=t.node,S.graph.setNodeAttribute(t.node,"hovered",!0),S.neighborHighlightingEnabled&&S.graph.forEachNeighbor(t.node,(function(e){var n=S.getUndirectedEdge(t.node,e),i=S.graph.getEdgeAttribute(n,"size");S.graph.setEdgeAttribute(n,"size",4),S.graph.setEdgeAttribute(n,S.originalSizeKey,i);var r=S.graph.getEdgeAttribute(n,"color");S.graph.setEdgeAttribute(n,"color","#aaa"),S.graph.setEdgeAttribute(n,"originalColor",r)})),S.updateHoverOverlay(t.node),S.refresh()},this.handleLeaveNode=function(t){S.hoveredNode=null,S.graph.setNodeAttribute(t.node,"hovered",void 0),S.neighborHighlightingEnabled&&S.graph.forEachNeighbor(t.node,(function(e){var n=S.getUndirectedEdge(t.node,e),i=S.graph.getEdgeAttribute(n,S.originalSizeKey);S.graph.setEdgeAttribute(n,"size",i);var r=S.graph.getEdgeAttribute(n,"originalColor");S.graph.setEdgeAttribute(n,"color",r)})),S.removeHoverOverlay(),S.refresh()},this.handleDownNode=function(t){if(S.allowNodeMovement){S.isDragging=!0,S.draggedNode=t.node;var e=Number(t.node);S.graph.setNodeAttribute(S.draggedNode,"highlighted",!0),S.isDraggedNodeSelected=S.selectedNodes.some((function(t){return t===e})),S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.updateNodeAttribute(t,"fixed",(function(){return!0}))})):S.graph.setNodeAttribute(S.draggedNode,"fixed",!0),S.previousPosition=S.renderer.viewportToGraph({x:t.event.offsetX,y:t.event.offsetY}),!S.animator.isRunning()&&S._animate&&S.animator.start(),S.animator.resetNIters(),S.refresh()}},this.handleNodeDoubleClick=function(t){t.event.preventDefault();var e=Number(t.node);S.selectedNodes.some((function(t){return t===e}))?S.updateSelectedNodes(S.selectedNodes.filter((function(t){return t!==e}))):S.addSelectedNodes([e])},this.handleMouseMoveBody=function(t){if(S.lastMousePosition={x:t.clientX,y:t.clientY},!S.hoveredNode||S.isDragging||S.isMouseEventInsideCanvas(t)){if(S.hoveredNode&&S.updateHoverOverlay(S.hoveredNode),S.isDragging&&S.draggedNode&&S.previousPosition){S.animator.resetNIters();var e=S.getViewportPointFromMouseEvent(t),n=S.renderer.viewportToGraph(e),i=n.x-S.previousPosition.x,r=n.y-S.previousPosition.y;return S.previousPosition=n,S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.updateNodeAttributes(t,(function(t){return Gt(Gt({},t),{x:t.x+i,y:t.y+r})}))})):S.graph.updateNodeAttributes(S.draggedNode,(function(t){return Gt(Gt({},t),{x:t.x+i,y:t.y+r})})),void S.refresh()}if(S.isPanning&&S.previousPanPoint){var o=S.getViewportPointFromMouseEvent(t),a=S.renderer.viewportToGraph(S.previousPanPoint),s=S.renderer.viewportToGraph(o),h=S.renderer.getCameraState();S.renderer.setCameraState({x:h.x+(a.x-s.x),y:h.y+(a.y-s.y)}),S.previousPanPoint=o}}else S.handleLeaveNode({node:S.hoveredNode})},this.handleMouseUp=function(){S.draggedNode&&(S.isDraggedNodeSelected?S.selectedNodes.map((function(t){return S.graph.removeNodeAttribute(t,"fixed")})):(S.graph.removeNodeAttribute(S.draggedNode,"fixed"),S.graph.removeNodeAttribute(S.draggedNode,"highlighted")),S.previousPosition=null),S.animator&&S.animator.forceNodePositionUpdate(),S.isDragging=!1,S.isPanning=!1,S.draggedNode=null,S.isDraggedNodeSelected=!1,S.previousPanPoint=null},this.handleMouseDown=function(t){if(document.activeElement&&document.activeElement instanceof HTMLElement){document.activeElement.blur();var e=window.getSelection();e&&e.empty()}S.mode===Lt.inactive&&(S.renderer.pickNodeAt({x:t.offsetX,y:t.offsetY})||(S.isPanning=!0,S.previousPanPoint={x:t.offsetX,y:t.offsetY}))},this.handleDoubleClickStage=function(){S.handleSelectionClear()},this.handleWheel=function(t){t.preventDefault();var e=S.renderer.getCameraState(),n=Math.max(-1.5,Math.min(1.5,t.deltaY/100)),i=Math.max(.01,e.ratio*(1+n/8));S.renderer.zoomAt({x:t.offsetX,y:t.offsetY},i)},this.handleLassoModifierDown=function(t){S.isLassoModifierPressed(t)&&S.mode===Lt.inactive&&(S.setSelectMode(Lt.lasso),S.isLassoActiveDueToModifierKey=!0)},this.handleLassoModifierUp=function(t){!t.altKey&&S.isLassoActiveDueToModifierKey&&(S.setSelectMode(Lt.inactive),S.isLassoActiveDueToModifierKey=!1)},this.handleWindowBlur=function(){S.isLassoActiveDueToModifierKey&&(S.setSelectMode(Lt.inactive),S.isLassoActiveDueToModifierKey=!1)},this.graphContainer=((C=document.createElement("div")).className="graph-container",C.style.width="100%",C.style.height="calc(100% - 40px)",C.style.position="relative",C.style.top="40px",C),this.rendererContainer=function(t){var e=document.createElement("div");return e.className="graph-render-container",e.style.width="100%",e.style.height="100%",t.appendChild(e),e}(this.graphContainer),this.renderSettings=Gt({},t.settings),this.renderer=new Dt(t.graph,this.rendererContainer,this.renderSettings),this.graph=t.graph,this.animator=t.animator,this._animate=!0,this.mode=t.mode,this._isFullScreen=t.isFullScreen,this.highlightedNodeColor=t.highlightedNodeColor||"#FF00FFDD",this.neighborHighlightingEnabled=t.neighborHighlightingEnabled,this.allowNodeMovement=void 0===t.allowNodeMovement||t.allowNodeMovement,this._selectedNodes=t.selectedNodes,this._highlightedNodes=t.highlightedNodes||[],this.fullScreenButton=null,this.lassoSelectButton=null,this.boxSelectButton=null,this.selectionCanvas=null,this.isDrawing=!1,this.lassoDrawnPoints=[],this.boxInitialPoint=null,this.draggedNode=null,this.onSelectedNodesChange=t.onSelectedNodesChange,this.onHighlightedNodesChange=t.onHighlightedNodesChange,this.onFullScreenChange=t.onFullScreenChange,this.showButtons={zoomIn:null===(n=null===(e=t.showButtons)||void 0===e?void 0:e.zoomIn)||void 0===n||n,zoomOut:null===(r=null===(i=t.showButtons)||void 0===i?void 0:i.zoomOut)||void 0===r||r,resetZoom:null===(a=null===(o=t.showButtons)||void 0===o?void 0:o.resetZoom)||void 0===a||a,resetLayout:null===(h=null===(s=t.showButtons)||void 0===s?void 0:s.resetLayout)||void 0===h||h,fullScreen:null===(c=null===(u=t.showButtons)||void 0===u?void 0:u.fullScreen)||void 0===c||c,lassoSelect:null===(l=null===(d=t.showButtons)||void 0===d?void 0:d.lassoSelect)||void 0===l||l,boxSelect:null===(f=null===(p=t.showButtons)||void 0===p?void 0:p.boxSelect)||void 0===f||f,clearSelection:null===(v=null===(g=t.showButtons)||void 0===g?void 0:g.clearSelection)||void 0===v||v,invertSelection:null===(m=null===(y=t.showButtons)||void 0===y?void 0:y.invertSelection)||void 0===m||m,playPause:null===(w=null===(b=t.showButtons)||void 0===b?void 0:b.playPause)||void 0===w||w,downloadSVG:null===(_=null===(x=t.showButtons)||void 0===x?void 0:x.downloadSVG)||void 0===_||_},this.bindEventHandlers(),this.initializeGraphManager(),this.initializeOverlay(),document.addEventListener("keydown",this.handleLassoModifierDown),document.addEventListener("keyup",this.handleLassoModifierUp),window.addEventListener("blur",this.handleWindowBlur)}return e.prototype.bindEventHandlers=function(){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.handleRendererContextLost=this.handleRendererContextLost.bind(this),this.handleRendererContextRestored=this.handleRendererContextRestored.bind(this)},e.prototype.isLassoModifierPressed=function(t){if(t.altKey)return!0;var e=t.key,n=t.code;return"Alt"===e||"Option"===e||"AltGraph"===e||"AltLeft"===n||"AltRight"===n},e.prototype.initializeGraphManager=function(){this.initializeGraph(),this.createControls(),this.registerEvents()},e.prototype.initializeGraph=function(){var t=this;this.renderer.setGraph(this.graph);var e=this.getSanitizedDims(this.animator.params.settings.expectedDims),n=null!=e?e:this.getGraphViewportBounds(),i=n[0],r=n[1];this.renderer.setCustomBBox({x:[-i/2,i/2],y:[-r/2,r/2]}),this.refresh(),window.requestAnimationFrame((function(){return t.resetView()}))},e.prototype.getGraphViewportBounds=function(){var t,e=this.renderer.getDimensions(),n=e.width,i=e.height;return null!==(t=this.getSanitizedDims([n,i]))&&void 0!==t?t:[650,410]},e.prototype.getSanitizedDims=function(t){if(!t)return null;var e=t[0],n=t[1];return!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0?null:[Math.max(1,e),Math.max(1,n)]},e.prototype.updateSelectedNodes=function(t){this.setSelectedNodes(t)},e.prototype.addSelectedNodes=function(t){var e=this;this.setSelectedNodes(Bt(Bt([],this.selectedNodes,!0),t.filter((function(t){return!e.selectedNodes.includes(t)})),!0))},e.prototype.getUndirectedEdge=function(t,e){if(this.graph.hasEdge(t,e))return this.graph.edge(t,e);if(this.graph.hasEdge(e,t))return this.graph.edge(e,t);throw new Error("neighbor node = ".concat(e," does not have an edge with ").concat(t))},e.prototype.registerEvents=function(){this.renderer.on("enterNode",this.handleEnterNode),this.renderer.on("leaveNode",this.handleLeaveNode),this.renderer.on("downNode",this.handleDownNode),this.renderer.on("doubleClickNode",this.handleNodeDoubleClick),this.renderer.on("doubleClickStage",this.handleDoubleClickStage),this.renderer.on("contextLost",this.handleRendererContextLost),this.renderer.on("contextRestored",this.handleRendererContextRestored);var t=this.renderer.getCanvas();t.addEventListener("wheel",this.handleWheel,{passive:!1}),t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleCanvasMouseMove),window.addEventListener("mousemove",this.handleMouseMoveBody),window.addEventListener("mouseup",this.handleMouseUp)},e.prototype.handleCanvasMouseMove=function(t){this.lastMousePosition={x:t.clientX,y:t.clientY},this.hoveredNode&&this.updateHoverOverlay(this.hoveredNode)},e.prototype.getViewportPointFromMouseEvent=function(t){var e=this.renderer.getCanvas().getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},e.prototype.isMouseEventInsideCanvas=function(t){var e=this.renderer.getCanvas().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom},e.prototype.setSelectMode=function(t){this.mode=t,this.lassoSelectButton&&this.lassoSelectButton.classList.toggle("active",t===Lt.lasso),this.boxSelectButton&&this.boxSelectButton.classList.toggle("active",t===Lt.box),this.mode===Lt.inactive?(this.removeSelectionCanvas(),this.lassoSelectButton&&this.lassoSelectButton.classList.remove("active"),this.boxSelectButton&&this.boxSelectButton.classList.remove("active")):this.showSelectionCanvas()},e.prototype.handleRendererContextLost=function(){this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="visible")},e.prototype.handleRendererContextRestored=function(){this.recreateRenderer(),this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="hidden")},e.prototype.recreateRenderer=function(){this.unregisterRendererEvents(),this.renderer.dispose(),this.renderer=new Dt(this.graph,this.rendererContainer,this.renderSettings),this.registerEvents(),this.refresh()},e.prototype.showSelectionCanvas=function(){var t,e,n,i;this.selectionCanvas||(this.selectionCanvas=(e=(t={offsetWidth:this.renderer.getContainer().offsetWidth,offsetHeight:this.renderer.getContainer().offsetHeight}).offsetWidth,n=t.offsetHeight,(i=document.createElement("canvas")).width=e,i.height=n,i.style.position="absolute",i.style.top="0px",i.style.cursor="crosshair",i),this.selectionCanvas.addEventListener("mousedown",this.onDrawingStart),this.selectionCanvas.addEventListener("mousemove",this.onDrawing),this.selectionCanvas.addEventListener("mouseup",this.onDrawingEnd),this.selectionCanvas.addEventListener("wheel",this.onSelectScroll),this.graphContainer.appendChild(this.selectionCanvas))},e.prototype.removeSelectionCanvas=function(){this.selectionCanvas&&(this.graphContainer.removeChild(this.selectionCanvas),this.selectionCanvas=null)},e.prototype.setDrawingStyles=function(t){t.strokeStyle="black",t.lineWidth=2,t.fillStyle="rgba(200, 200, 200, 0.25)",t.lineJoin="round",t.lineCap="round"},e.prototype.getNormalizedPosition=function(t){var e=this.selectionCanvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}},e.prototype.drawSmoothFilledPath=function(t){var e=this.selectionCanvas.getContext("2d");this.setDrawingStyles(e);var n,i,r=t[0],o=t[1],a=t.length;e.beginPath(),e.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});e.quadraticCurveTo(r.x,r.y,h.x,h.y),r=t[s],o=t[s+1]}e.lineTo(r.x,r.y),e.stroke(),e.fill()},e.prototype.getGraphNodesInCurrentPath=function(){var t=this,e=this.selectionCanvas.getContext("2d"),n=[],i=this.renderer.getDimensions(),r=i.width,o=i.height;return this.graph.forEachNode((function(i,a){var s=t.renderer.graphToViewport({x:a.x,y:a.y});s.x>=0&&s.x<=r&&s.y>=0&&s.y<=o&&e.isPointInPath(s.x,s.y)&&n.push(Number(i))})),n},e.prototype.onDrawingStart=function(t){if(t.preventDefault(),document.activeElement&&document.activeElement instanceof HTMLElement){document.activeElement.blur();var e=window.getSelection();e&&e.empty()}if(this.mode!==Lt.inactive){this.isDrawing=!0;var n=this.getNormalizedPosition(t);this.mode===Lt.lasso&&(this.lassoDrawnPoints=[],this.lassoDrawnPoints.push(n)),this.mode===Lt.box&&(this.boxInitialPoint=n),t.stopPropagation()}},e.prototype.onDrawing=function(t){if(this.mode!==Lt.inactive&&this.isDrawing){var e=this.getNormalizedPosition(t),n=this.selectionCanvas.getContext("2d");if(this.setDrawingStyles(n),n.clearRect(0,0,n.canvas.width,n.canvas.height),this.mode===Lt.lasso&&(this.lassoDrawnPoints.push(e),this.drawSmoothFilledPath(this.lassoDrawnPoints)),this.mode===Lt.box&&this.boxInitialPoint){n.beginPath();var i=e.x-this.boxInitialPoint.x,r=e.y-this.boxInitialPoint.y;n.rect(this.boxInitialPoint.x,this.boxInitialPoint.y,i,r),n.fill()}t.stopPropagation()}},e.prototype.onDrawingEnd=function(t){if(this.mode!==Lt.inactive){var e=this.getGraphNodesInCurrentPath();this.isDrawing=!1,t.shiftKey?this.addSelectedNodes(e):this.updateSelectedNodes(e);var n=this.selectionCanvas.getContext("2d");n.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),n.beginPath(),this.mode===Lt.lasso&&(this.lassoDrawnPoints=[]),this.mode===Lt.box&&(this.boxInitialPoint=null),t.stopPropagation()}},e.prototype.onSelectScroll=function(t){this.handleWheel(t)},e.prototype.initializeOverlay=function(){var t=this;this.contextLostOverlay=function(){var e=document.createElement("div");e.className="webgl-overlay",e.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 Graph Display" 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 t.handleRendererContextRestored()})),e.appendChild(n),e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(0, 0, 0, 0.7)",e.style.color="white",e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="center",e.style.alignItems="center",e.style.zIndex="1000",e.style.visibility="hidden",e}(),this.graphContainer.appendChild(this.contextLostOverlay)},e.prototype.createControls=function(){var e=this,n=function(){var t=document.createElement("div");return t.className="controls-container",t.style.position="absolute",t.style.display="flex",t.style.bottom="10px",t.style.right="10px",t.style.zIndex="10",t}();if(this.showButtons.zoomIn){var i=t("\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 Pt(e,void 0,void 0,(function(){return Ft(this,(function(t){switch(t.label){case 0:return[4,this.zoomIn()];case 1:return[2,t.sent()]}}))}))}),"Zoom In");n.appendChild(i)}if(this.showButtons.zoomOut){var r=t("\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 Pt(e,void 0,void 0,(function(){return Ft(this,(function(t){switch(t.label){case 0:return[4,this.zoomOut()];case 1:return[2,t.sent()]}}))}))}),"Zoom Out");n.appendChild(r)}if(this.showButtons.resetZoom){var a=t("\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 Pt(e,void 0,void 0,(function(){return Ft(this,(function(t){switch(t.label){case 0:return[4,this.resetView()];case 1:return[2,t.sent()]}}))}))}),"Reset Zoom");n.appendChild(a)}if(this.showButtons.resetLayout&&(this.resetButton=t("\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 Pt(e,void 0,void 0,(function(){var e,n,i,r,a;return Ft(this,(function(s){switch(s.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=Gt(Gt(Gt({},Ct(this.graph)),this.animator.params.settings),{warmupLayout:!0})).expectedDims=this.getGraphViewportBounds(),r={iterations:300,settings:i},this.animator.stop(),[4,this.applyInitialLayout(r)]);case 1:return s.sent(),[4,pt(this.graph,r,!t.altKey)];case 2:return a=s.sent(),this.animator.params.settings=a,this.animator.forceNodePositionUpdate(),[3,4];case 3:t.altKey||(this.animator.stop(),h=this.graph,u=this.getGraphViewportBounds(),c=this.animator.params.settings.layoutSingletonsSeparately,d=(0,o.kS)(h).map((function(t){return t.map(Number)})),l=st(h),rt(l.nodes,d,100,lt(u),c),ht(h,l.nodes),this.animator.forceNodePositionUpdate()),s.label=4;case 4:return[4,this.resetView()];case 5:return s.sent(),e&&this.animator.start(),this.resetButton&&(this.resetButton.style.backgroundColor="#e2e4e7",n&&this.resetButton.setAttribute("data-tooltip","Reset Layout")),[2]}var h,u,c,d,l}))}))}),"Reset Layout"),n.appendChild(this.resetButton)),this.showButtons.fullScreen&&(this.fullScreenButton=t(this._isFullScreen?ft:gt,(function(){return e.toggleFullScreen()}),this._isFullScreen?"Scale back":"Expand"),n.appendChild(this.fullScreenButton)),this.showButtons.lassoSelect&&(this.lassoSelectButton=t("\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"),n.appendChild(this.lassoSelectButton)),this.showButtons.boxSelect&&(this.boxSelectButton=t("\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"),n.appendChild(this.boxSelectButton)),this.showButtons.clearSelection){var s=t("<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");n.appendChild(s)}if(this.showButtons.invertSelection){var h=t("<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");n.appendChild(h)}if(this.showButtons.playPause&&(this.playPauseButton=t(this._animate?yt:vt,(function(){return e.togglePlayPause()}),this._animate?"Pause Animation":"Play Animation"),n.appendChild(this.playPauseButton)),this.showButtons.downloadSVG){var u=t('\n<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none" viewBox="-4 -4 24 24">\n <path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5" stroke-width="0.7" stroke="#122239" fill="#122239"/>\n <path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z" stroke-width="0.7" stroke="#122239" fill="#122239"/>\n</svg>\n',(function(){return e.downloadGraphAsSVG()}),"Download SVG");n.appendChild(u)}this.graphContainer.appendChild(n)},e.prototype.zoomIn=function(){return Pt(this,void 0,void 0,(function(){var t;return Ft(this,(function(e){switch(e.label){case 0:return t=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:Math.max(.01,t.ratio/this.zoomFactor)},this.zoomDuration)];case 1:return e.sent(),[2]}}))}))},e.prototype.zoomOut=function(){return Pt(this,void 0,void 0,(function(){var t;return Ft(this,(function(e){switch(e.label){case 0:return t=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:t.ratio*this.zoomFactor},this.zoomDuration)];case 1:return e.sent(),[2]}}))}))},e.prototype.unzoom=function(t,e){return Pt(this,void 0,void 0,(function(){var n;return Ft(this,(function(i){switch(i.label){case 0:return n=this.renderer.getCameraState(),[4,this.renderer.animateCamera({ratio:n.ratio*t},e)];case 1:return i.sent(),[2]}}))}))},e.prototype.unzoomAndShift=function(t,e,n,i){return Pt(this,void 0,void 0,(function(){var r,o,a;return Ft(this,(function(s){switch(s.label){case 0:return r=this.renderer.getCameraState(),o=n.x-e.x,a=n.y-e.y,[4,this.renderer.animateCamera({x:r.x+o,y:r.y+a,ratio:r.ratio*t},i)];case 1:return s.sent(),[2]}}))}))},e.prototype.unzoomAndShiftForLayoutBounds=function(t,e,n){return Pt(this,void 0,void 0,(function(){var i,r,o,a;return Ft(this,(function(s){switch(s.label){case 0:return i=this.layoutBoundsToRendererBBox(t),r=this.layoutBoundsToRendererBBox(e),o=this.renderer.getCameraState(),a=this.mapCameraForBBoxTransition(o,i,r),[4,this.renderer.animateCamera({x:a.x,y:a.y,ratio:a.ratio},n)];case 1:return s.sent(),[2]}}))}))},e.prototype.resetView=function(t){return Pt(this,void 0,void 0,(function(){var e,n;return Ft(this,(function(i){switch(i.label){case 0:return this.refresh(),e=this.renderer.getGraphBBox(),n=this.renderer.getCameraForBBox(e||this.renderer.getBBox(),1.1),[4,this.renderer.animateCamera(n,t||this.zoomDuration)];case 1:return i.sent(),[2]}}))}))},e.prototype.toggleFullScreen=function(){this._isFullScreen=!this._isFullScreen,this.onFullScreenChange(this._isFullScreen),this.fullScreenButton&&(this.fullScreenButton.innerHTML=this._isFullScreen?ft:gt,this.fullScreenButton.setAttribute("data-tooltip",this._isFullScreen?"Scale back":"Expand"))},e.prototype.toggleLassoSelect=function(){this.mode!==Lt.lasso?this.setSelectMode(Lt.lasso):this.setSelectMode(Lt.inactive)},e.prototype.toggleBoxSelect=function(){this.mode!==Lt.box?this.setSelectMode(Lt.box):this.setSelectMode(Lt.inactive)},e.prototype.clearSelection=function(){this.handleSelectionClear()},e.prototype.invertSelection=function(){var t=this,e=[];this.graph.forEachNode((function(n){var i=Number(n);t.selectedNodes.some((function(t){return t===i}))||e.push(i)})),this.updateSelectedNodes(e)},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?yt:vt,this.playPauseButton.setAttribute("data-tooltip",this._animate?"Pause Animation":"Play Animation")),this.updateAnimatorState()},e.prototype.downloadGraphAsSVG=function(){var t=wt(this.graph,{width:1920,height:1080,padding:100,includeLabels:!1,fontSize:14}),e=new Date,n=e.toISOString().split("T")[0],i=e.toTimeString().split(" ")[0].substring(0,5).replace(":","."),r="".concat(n,"_").concat(i);xt(t,"graph-".concat(r,".svg"))},e.prototype.parseTemplate=function(t,e){return t.replace(/\$\{(\w+)\}/g,(function(t,n){var i=e[n];return null!=i?String(i):t}))},e.prototype.updateHoverOverlay=function(t){var e,n=this.renderSettings.defaultHoverTemplate,i=this.graph.getNodeAttributes(t);if(this.hoveredNode===t){var r=n&&(i.htmlHover||this.renderSettings.showHtmlHoverDefault&&!1!==i.htmlHover),o=void 0!==i.labelToDisplay&&null!==i.labelToDisplay?String(i.labelToDisplay):void 0!==i.label&&null!==i.label?String(i.label):"";if(r||o){if(!this.hoverOverlay){var a=document.createElement("div");a.style.position="fixed",a.style.pointerEvents="none",a.style.border="1px solid #ccc",a.style.borderRadius="4px",a.style.backgroundColor="#fff",a.style.padding="4px",a.style.zIndex="10000",document.body.appendChild(a),this.hoverOverlay=a}var s=this.hoverOverlay;r?s.innerHTML=this.parseTemplate(String(n),i):s.textContent=o;var h,u,c=null!==(e=this.lastMousePosition)&&void 0!==e?e:(h=this.renderer.graphToViewport({x:Number(i.x||0),y:Number(i.y||0)}),{x:(u=this.renderer.getCanvas().getBoundingClientRect()).left+h.x,y:u.top+h.y});s.style.display="block",s.style.left="".concat(c.x+10,"px"),s.style.top="".concat(c.y+10,"px")}else this.removeHoverOverlay()}else this.removeHoverOverlay()},e.prototype.removeHoverOverlay=function(){this.hoverOverlay&&(this.hoverOverlay.style.display="none",this.hoverOverlay.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(t,e){void 0===e&&(e=!0),this._selectedNodes=t,this.updateNodeSelection(),this.removeHoverOverlay(),e&&this.onSelectedNodesChange(t),this.refresh()},e.prototype.updateNodeSelection=function(){var t=new Set(this.selectedNodes);this.graph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t.has(i);return Gt(Gt({},n),{highlighted:r})}))},Object.defineProperty(e.prototype,"highlightedNodes",{get:function(){return this._highlightedNodes},set:function(t){this._highlightedNodes=t,this.updateNodeHighlighting(),this.onHighlightedNodesChange(t),this.refresh()},enumerable:!1,configurable:!0}),e.prototype.updateHighlightedNodes=function(t){this.highlightedNodes=t},e.prototype.updateNodeHighlighting=function(){var t=this,e=new Set(this.highlightedNodes);this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=e.has(r);if(o&&(void 0!==i.border||void 0!==i.originalBorder))return i.hasOwnProperty("originalBorder")||(i.originalBorder=i.border||null),Gt(Gt({},i),{border:t.highlightedNodeColor});if(!o&&i.hasOwnProperty("originalBorder")){var a=null===i.originalBorder?void 0:i.originalBorder;return delete i.originalBorder,Gt(Gt({},i),{border:a})}return i}))},Object.defineProperty(e.prototype,"isFullScreen",{get:function(){return this._isFullScreen},set:function(t){this._isFullScreen=t,this.onFullScreenChange(t)},enumerable:!1,configurable:!0}),e.prototype.updateGraph=function(t,e){void 0===e&&(e=!1);var n=this.renderer.getBBox(),i=this.renderer.getCameraState();if(this.graph=t,this.renderer.setGraph(t),e)this.renderer.setCameraState(i);else{var r=this.renderer.getBBox(),o=this.mapCameraForBBoxTransition(i,n,r);this.renderer.setCameraState({x:o.x,y:o.y,ratio:o.ratio})}this.refresh()},e.prototype.layoutBoundsToRendererBBox=function(t){return{x:[t.minX,t.maxX],y:[t.minY,t.maxY]}},e.prototype.mapCameraForBBoxTransition=function(t,e,n){var i=this.renderer.getCameraForBBox(e,1),r=this.renderer.getCameraForBBox(n,1),o=Math.max(.01,i.ratio),a=r.ratio/o,s=Math.min(20,Math.max(.05,a));return{x:r.x+(t.x-i.x)*s,y:r.y+(t.y-i.y)*s,ratio:Math.max(.01,t.ratio*s),angle:0}},e.prototype.updateAnimator=function(t){this.animator&&this.animator.kill(),this.animator=t},e.prototype.resetCamera=function(){return Pt(this,void 0,void 0,(function(){return Ft(this,(function(t){switch(t.label){case 0:return[4,this.resetView()];case 1:return t.sent(),[2]}}))}))},e.prototype.zoomInAndOut=function(){return Pt(this,void 0,void 0,(function(){return Ft(this,(function(t){switch(t.label){case 0:return[4,this.zoomOut()];case 1:return t.sent(),[4,this.zoomIn()];case 2:return t.sent(),[2]}}))}))},e.prototype.updateRenderSettings=function(t){var e=this;this.renderSettings=Gt(Gt({},this.renderSettings),t),Object.keys(t).forEach((function(n){var i=n;e.renderer.setSetting(i,t[i])})),this.refresh()},e.prototype.resetGraphBounds=function(){this.renderer.setCustomBBox({x:[-350,350],y:[-220,220]})},e.prototype.refresh=function(){this.renderer.isContextLost()?this.contextLostOverlay&&(this.contextLostOverlay.style.visibility="visible"):this.renderer.refresh()},e.prototype.unregisterRendererEvents=function(){this.renderer.off("enterNode",this.handleEnterNode),this.renderer.off("leaveNode",this.handleLeaveNode),this.renderer.off("downNode",this.handleDownNode),this.renderer.off("doubleClickNode",this.handleNodeDoubleClick),this.renderer.off("doubleClickStage",this.handleDoubleClickStage),this.renderer.off("contextLost",this.handleRendererContextLost),this.renderer.off("contextRestored",this.handleRendererContextRestored);var t=this.renderer.getCanvas();t.removeEventListener("wheel",this.handleWheel),t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleCanvasMouseMove),window.removeEventListener("mousemove",this.handleMouseMoveBody),window.removeEventListener("mouseup",this.handleMouseUp)},e.prototype.cleanup=function(){this.unregisterRendererEvents(),document.removeEventListener("keydown",this.handleLassoModifierDown),document.removeEventListener("keyup",this.handleLassoModifierUp),window.removeEventListener("blur",this.handleWindowBlur),this.hoveredNode=null,this.removeHoverOverlay(),this.hoverOverlay&&(this.hoverOverlay.remove(),this.hoverOverlay=null)},e.prototype.dispose=function(){this.cleanup(),this.renderer.dispose()},e.prototype.applyInitialLayout=function(t){return Pt(this,void 0,void 0,(function(){return Ft(this,(function(t){return[2]}))}))},e}(),Ot=function(){return Ot=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Ot.apply(this,arguments)},Tt=function(){function t(t,e,n,i){var r=this;this.callback=null,this.graph=t,this.endPositions=e,this.animation_type=n,this.frameID=null,this.running=!1,this.startPositions=new Array(t.nodes().length),this.graph.forEachNode((function(t,e){var n=Number(t);r.startPositions[n]={x:e.x,y:e.y}})),this.duration=i}return t.prototype.isRunning=function(){return this.running},t.prototype.updateNodePositions=function(t){var e=this;this.graph.updateEachNodeAttributes((function(n,i){var r=Number(n),o=e.endPositions[r],a=e.startPositions[r],s=(o.x-a.x)*t,h=(o.y-a.y)*t;return Ot(Ot({},i),{x:a.x+s,y:a.y+h})}))},t.prototype.runFrame=function(){var t=this;this.startTime||(this.startTime=Date.now());var e=Math.min((Date.now()-this.startTime)/this.duration,1);this.updateNodePositions(e),1===e?this._kill():this.frameID=window.requestAnimationFrame((function(){return t.runFrame()}))},t.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},t.prototype.run=function(t){this.callback=t,this.running||(this.startTime=Date.now(),this.running=!0,this.runFrame())},t.prototype._kill=function(){this._stop()},t}(),Vt=function(){return Vt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Vt.apply(this,arguments)},It=function(){function t(t){var e=this;this.sliderValues={},this.sliderConfigs=[],this.views=[],this.listeners={},this.sliderConfigs=t,t.forEach((function(t){e.sliderValues[t.label]=t.initialValue,e.listeners[t.label]=[]}))}return t.prototype.callListeners=function(t){var e=this;this.listeners[t].forEach((function(n){n(e.sliderValues[t])}))},t.prototype.getView=function(t){var e=this,n=this.sliderConfigs.map((function(t,n){return Vt(Vt({},t),{initialValue:e.getSliderValue(t.label)||t.initialValue})})),i=new Ut(t,n);return Object.keys(this.sliderValues).forEach((function(t){i.addListener(t,(function(n){var i=Number(n.target.value);e.setSliderValue(t,i),e.callListeners(t)}))})),this.views.push(i),i},t.prototype.deleteView=function(t){this.views=this.views.filter((function(e){return e!==t}))},t.prototype.getSliderValue=function(t){return this.sliderValues[t]||null},t.prototype.setSliderValue=function(t,e){this.sliderValues[t]=e,this.views.forEach((function(n){n.setSliderValue(t,e)}))},t.prototype.addListener=function(t,e){this.listeners[t].push(e)},t}(),Ut=function(){function t(t,e){var n=this;this.sliders={},this.sliderValues={};var i=this.createSliderContainer();t.appendChild(i),e.forEach((function(t){var e=n.createSliderWrapper(t),r=e.wrapper,o=e.slider,a=e.labelElement;i.appendChild(r),n.sliders[t.label]=o,n.sliderValues[t.label]=a,o.addEventListener("input",(function(){a.textContent=o.value}))}))}return t.prototype.createSliderContainer=function(){var t=document.createElement("div");return t.className="slider-container",t},t.prototype.createSliderWrapper=function(t){var e=document.createElement("div");e.className="slider-wrapper";var n=document.createElement("label");n.className="slider-label",n.textContent="".concat(t.label,":");var i=document.createElement("input");i.type="range",i.className="slider",i.min=t.minValue.toString(),i.max=t.maxValue.toString(),i.step=t.step.toString(),i.value=t.initialValue.toString();var r=document.createElement("span");return r.className="slider-value",r.textContent=t.initialValue.toString(),e.appendChild(n),e.appendChild(i),e.appendChild(r),{wrapper:e,slider:i,labelElement:r}},t.prototype.setSliderValue=function(t,e){this.sliders[t].value=e.toString(),this.sliderValues[t].textContent=e.toString()},t.prototype.addListener=function(t,e){this.sliders[t].addEventListener("change",e)},t}(),jt=function(){function t(t,e,n){this.container=t,this.graphManager=new Rt(n),this.initializeSliderView(e)}return t.prototype.initializeSliderView=function(t){this.sliderView=t.getView(this.container)},t.prototype.appendGraphToContainer=function(){this.container.appendChild(this.graphManager.getGraphContainer())},t}(),Ht=n(698),Wt=n.n(Ht);class Yt{static _xfnv1a(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return()=>(e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,(e+=e<<5)>>>0)}}class Xt extends Yt{constructor(t){super(),Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=Xt._xfnv1a(t)()}next(){let t=this.a+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}class qt extends Yt{constructor(t){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 e=qt._xfnv1a(t);this.a=e(),this.b=e(),this.c=e(),this.d=e()}next(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;let t=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,t=t+this.d|0,this.c=this.c+t|0,(t>>>0)/4294967296}}class Kt extends Yt{constructor(t){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 e=Kt._xfnv1a(t);this.a=e(),this.b=e(),this.c=e(),this.d=e()}next(){const t=this.b<<9;let e=5*this.b;return e=9*(e<<7|e>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=t,this.d=this.d<<11|this.d>>>21,(e>>>0)/4294967296}}!function(t){t.sfc32="sfc32",t.mulberry32="mulberry32",t.xoshiro128ss="xoshiro128ss"}(zt||(zt={}));class Zt{constructor(t,e=zt.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=t,this.prng=e,this.generator=this._initializeGenerator()}next(){return this.generator.next()}_initializeGenerator(){if((t=>null===t)(t=this.str)||(t=>void 0===t)(t))return this.wrap();var t;switch(this.prng){case"sfc32":return new qt(this.str);case"mulberry32":return new Xt(this.str);case"xoshiro128ss":return new Kt(this.str);default:return this.wrap()}}wrap(){return{next:()=>Math.random()}}}var Jt=function(){return Jt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Jt.apply(this,arguments)},$t=n(739),Qt=function(t,e,n){return t.reduce((function(t,i){var r,o=null===(r=e[n])||void 0===r?void 0:r.nodes[i];return o&&t.push.apply(t,o.points),t}),[])},te=function(t,e,n){var i=new Set,r=n[t];return e.forEach((function(t){i.add(r[t])})),Array.from(i)},ee=function(t){var e=1/0,n=1/0,i=-1/0,r=-1/0;return t.forEachNode((function(t,o){var a=o.x,s=o.y;a<e&&(e=a),s<n&&(n=s),a>i&&(i=a),s>r&&(r=s)})),{minX:e,minY:n,maxX:i,maxY:r}},ne=function(t,e){var n=new(Wt()),i=new Zt("nodes-".concat(t.nodes.length,"-edges-").concat(t.edges.length));t.nodes.forEach((function(t,e){var r,o;n.addNode(e,Jt(Jt({},t),{x:null!==(r=t.x)&&void 0!==r?r:100*i.next(),y:null!==(o=t.y)&&void 0!==o?o:100*i.next()}))}));var r=t.nodes.length,o=Math.ceil(e*r/2);return t.edges.slice(0,o).forEach((function(t){var e;n.addEdge(t.s,t.t,Jt(Jt({},t),{weight:null!==(e=t.weight)&&void 0!==e?e:t.w}))})),n},ie=function(t){return{label:t.label,minValue:t.minValue,maxValue:t.maxValue,initialValue:t.initialValue,step:t.step}},re=function(){return re=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},re.apply(this,arguments)},oe=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))},ae=function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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])}}},se=function(){function t(t){var e=this;this.views=[],this.selectedNodes=[],this.selectedPoints=[],this.initialLayoutPromise=null;var n=t.graphData,i=t.sliderConfig,r=t.renderSettings,o=t.onSelectedNodesChange,a=t.onSelectedPointsChange,s=t.onFullScreenChange,h=t.onCoarsenessChange,u=t.onConnectivityChange,c=t.nodeColors,d=t.nodeLabels,l=t.nodeHoverLabels,p=t.nodeAttrs,f=t.defaultHoverTemplate,g=t.layoutConfig,v=t.showButtons,y=t.isFullScreen,m=t.highlightHoverNeighbors;this.graphData=n,this.sliderConfig=i,this.renderSettings=re({defaultHoverTemplate:f},r),this.nodeColors=c,this.nodeLabels=d,this.nodeHoverLabels=l,this.nodeAttrs=p,this.defaultHoverTemplate=f,this.layoutConfig=g||{},this.showButtons=v,this.isFullScreen=y,this.highlightHoverNeighbors=null!=m&&m,this.onSelectedNodesChange=o,this.onSelectedPointsChange=a,this.onFullScreenChange=s,this.onCoarsenessChange=h,this.onConnectivityChange=u,this.selectedLevel=this.sliderConfig.selectedLevel,this.sliderManager=new It([ie(i.coarseness),ie(i.connectivity)]),this.addSliderListeners(),this.nDataPoints=Math.max.apply(Math,this.graphData[this.selectedLevel].nodes.map((function(t){return Math.max.apply(Math,t.points)})))+1,this.dataPointMaps=function(t,e){var n={};return Object.keys(t).forEach((function(i){n[i]=function(t,e){var n=Array(e);return t.forEach((function(t,e){t.forEach((function(t){n[t]=e}))})),n}(t[i].nodes.map((function(t){return t.points})),e)})),n}(this.graphData,this.nDataPoints),this.currentGraph=ne(this.graphData[this.selectedLevel],this.sliderConfig.connectivity.initialValue);var b=re(re({},Ct(this.currentGraph)),this.layoutConfig);this.initialLayoutPromise=this.runInitialLayout({iterations:300,settings:re(re({},b),{warmupLayout:!0})}).then((function(){e.resetAllGraphViews(),e.initialLayoutPromise=null})),this.updateNodeAttributes()}return t.prototype.getView=function(t){return oe(this,void 0,void 0,(function(){var e,n,i=this;return ae(this,(function(r){switch(r.label){case 0:return!this.initialLayoutPromise&&this.animator?[3,2]:[4,this.initialLayoutPromise];case 1:r.sent(),r.label=2;case 2:if(this.pruneDisconnectedViews(),e=this.views.find((function(e){return e.container===t})))return[2,e];if(!this.animator)throw Error("Animator does not exist. Cannot get GraphView.");return n=new jt(t,this.sliderManager,{graph:this.currentGraph,animator:this.animator,mode:Lt.inactive,settings:this.renderSettings,isFullScreen:this.isFullScreen,neighborHighlightingEnabled:this.highlightHoverNeighbors,selectedNodes:[],onSelectedNodesChange:function(t){i.selectedNodes=t,i.selectedPoints=Qt(i.selectedNodes,i.graphData,i.selectedLevel),i.onSelectedNodesChange(t),i.onSelectedPointsChange(i.selectedPoints)},onFullScreenChange:function(t){return i.onFullScreenChange(t)},onHighlightedNodesChange:function(){},showButtons:this.showButtons}),this.views.push(n),n.appendGraphToContainer(),this.animator.start(),[4,n.graphManager.resetView()];case 3:return r.sent(),[2,n]}}))}))},t.prototype.deleteView=function(t){this.views=this.views.filter((function(e){return e!==t}))},t.prototype.pruneDisconnectedViews=function(){var t=this,e=this.views.filter((function(t){return!t.container.isConnected}));0!==e.length&&(e.forEach((function(e){e.graphManager.cleanup(),e.graphManager.dispose(),t.sliderManager.deleteView(e.sliderView)})),this.views=this.views.filter((function(t){return t.container.isConnected})))},t.prototype.setConnectivityLevel=function(t){var e=this,n=this.graphData[this.selectedLevel];this.currentGraph.clearEdges();var i=n.nodes.length,r=Math.ceil(t*i/2);n.edges.slice(0,r).forEach((function(t){var n;e.currentGraph.addEdge(t.s,t.t,re(re({},t),{weight:null!==(n=t.weight)&&void 0!==n?n:t.w}))})),this.resetAnimator()},t.prototype.setCoarsenessLevel=function(t,e){return void 0===e&&(e=!1),oe(this,void 0,void 0,(function(){var n,i,r;return ae(this,(function(o){return t==this.selectedLevel||(n=this.selectedPoints,i=this.initializeNewGraph(t),r=te(t,n,this.dataPointMaps),this.updateGraphAndViewsWithNewGraph(i,r,e)),[2]}))}))},t.prototype.setIsFullScreen=function(t){this.isFullScreen=t,this.views.forEach((function(e){e.graphManager.isFullScreen=t}))},t.prototype.setNodeColors=function(t){this.nodeColors=t,this.updateNodeColors()},t.prototype.setNodeLabels=function(t){this.nodeLabels=t,this.updateNodeLabels()},t.prototype.setNodeHoverLabels=function(t){this.nodeHoverLabels=t,this.updateNodeHoverLabels()},t.prototype.setNodeAttrs=function(t){this.nodeAttrs=t,this.updateNodeAttributes()},t.prototype.setNodeHoverTemplate=function(t){this.defaultHoverTemplate=t,this.renderSettings.defaultHoverTemplate=t,this.updateAllGraphRenderSettings()},t.prototype.setSelectedNodes=function(t){this.selectedNodes=t,this.selectedPoints=Qt(this.selectedNodes,this.graphData,this.selectedLevel),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes),this.onSelectedPointsChange(this.selectedPoints)},t.prototype.setSelectedPoints=function(t){this.selectedPoints=t,this.selectedNodes=te(this.selectedLevel,t,this.dataPointMaps),this.onSelectedPointsChange(t),this.updateViewsSelectedNodes(),this.onSelectedNodesChange(this.selectedNodes)},t.prototype.resetView=function(){var t=this;this.views.forEach((function(e){return oe(t,void 0,void 0,(function(){return ae(this,(function(t){switch(t.label){case 0:return[4,e.graphManager.resetView()];case 1:return t.sent(),[2]}}))}))}))},t.prototype.cleanup=function(){var t;this.views.forEach((function(t){t.graphManager.cleanup()})),null===(t=this.animator)||void 0===t||t.kill()},t.prototype.dispose=function(){var t;this.views.forEach((function(t){t.graphManager.dispose()})),null===(t=this.animator)||void 0===t||t.kill()},t.prototype.initializeNewGraph=function(t){var e=this.dataPointMaps[this.selectedLevel],n=this.currentGraph;this.selectedLevel=t;var i=Number(this.sliderManager.getSliderValue(this.sliderConfig.connectivity.label)),r=ne(this.graphData[t],i),o=function(t,e){var n=new Array(e.nodes().length);return e.forEachNode((function(e,i){var r=Number(e),o=i.points,a=new Set;o.forEach((function(e){a.add(t[e])})),n[r]=Array.from(a)})),n}(e,r);return function(t,e,n){var i=ee(t),r=i.minX,o=i.minY,a=i.maxX,s=i.maxY,h=e.order/t.order,u=Math.max(10,a-r)/100,c=Math.max(10,s-o)/100,d=Math.max(u,c);e.updateEachNodeAttributes((function(e,i){var r=Number(e),o=n[r],a=o.map((function(e){try{return t.getNodeAttribute(e,"x")}catch(t){return 0}})),s=o.map((function(e){try{return t.getNodeAttribute(e,"y")}catch(t){return 0}})),u=0,c=a.reduce((function(t,e){return isFinite(e)?(u+=1,t+e):t}),0),l=c/Math.max(u,1),p=0,f=s.reduce((function(t,e){return isFinite(e)?(p+=1,t+e):t}),0),g=f/Math.max(p,1);return Jt(Jt({},i),{x:h*(l+d*Math.random()),y:h*(g+d*Math.random())})}))}(n,r,o),r},t.prototype.updateGraphAndViewsWithNewGraph=function(t,e,n){var i,r=this;this.normalizeNewGraphScaleBeforeTransition(t),this.selectedNodes=e,this.onSelectedNodesChange(e);var s=re(re(re({},Ct(t)),this.layoutConfig),null===(i=this.animator)||void 0===i?void 0:i.params.settings),h=ee(t);(function(t,e){return void 0===e&&(e={}),i=function(){var n,i,r,s,h,u,c,d,l,p,f;return function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(g){switch(g.label){case 0:return n=Jt(Jt(Jt({},Ct(t)),e),{warmupLayout:!0}),i=(0,o.kS)(t).map((function(t){return t.map(Number)})),r=st(t),s=$t.createWorker(a),h={iterations:100,nAnnealingSteps:4,settings:n,nodes:r.nodes.buffer,edges:r.edges.buffer,components:i,__messageId:"initialGraphLayout"},console.log("getStableLayout settings",n),s.postMessage(h,[r.nodes.buffer,r.edges.buffer]),[4,new Promise((function(t){s.onmessage=function(e){t({nodes:new Float32Array(e.data.nodes),settings:e.data.settings}),s.terminate()}}))];case 1:for(u=g.sent(),c=t.nodes().length,d=[],l=0;l<c;l++)p=u.nodes[10*l],f=u.nodes[10*l+1],d.push({x:p,y:f});return[2,{endPositions:d,settings:u.settings}]}}))},new((n=void 0)||(n=Promise))((function(t,e){function r(t){try{a(i.next(t))}catch(t){e(t)}}function o(t){try{a(i.throw(t))}catch(t){e(t)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(t){t(i)}))).then(r,o)}a((i=i.apply(void 0,[])).next())}));var n,i})(t,s).then((function(i){var o,a,s,u,c,d=i.endPositions,l=i.settings,p=d,f=(a=1/0,s=1/0,u=-1/0,c=-1/0,d.forEach((function(t){var e=t.x,n=t.y;e<a&&(a=e),n<s&&(s=n),e>u&&(u=e),n>c&&(c=n)})),{minX:a,minY:s,maxX:u,maxY:c});r.layoutConfig=l,r.currentGraph.updateEachNodeAttributes((function(t,e){return re(re({},e),{highlighted:!1})})),r.updateAllGraphViews(t,e),r.updateNodeAttributes(),r.views.forEach((function(t){t.graphManager.unzoomAndShiftForLayoutBounds(h,f,500)}));var g=new Tt(r.currentGraph,p,"linear",500);null===(o=r.animator)||void 0===o||o.kill(),g.run((function(){var t=r.getNewAnimator(l);r.animator=t,r.views.forEach((function(e){n&&e.graphManager.resetView(),e.graphManager.updateAnimator(t)})),r.animator.start()}))}))},t.prototype.updateNodeColors=function(){if(this.nodeColors){var t=this.nodeColors[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return re(re({},n),{color:r||n.color})}))}},t.prototype.updateNodeLabels=function(){if(this.nodeLabels){var t=this.nodeLabels[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return re(re({},n),{label:r||n.label})}))}},t.prototype.updateNodeHoverLabels=function(){if(this.nodeHoverLabels){var t=this.nodeHoverLabels[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return re(re({},n),{labelToDisplay:r||n.labelToDisplay})}))}},t.prototype.updateViewsSelectedNodes=function(){var t=this;this.views.forEach((function(e){e.graphManager.setSelectedNodes(t.selectedNodes,!1)}))},t.prototype.updateNodeAttributes=function(){if(this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.nodeAttrs){var t=this.nodeAttrs[this.selectedLevel];t&&this.currentGraph.updateEachNodeAttributes((function(e,n){var i=Number(e),r=t[i];return re(re({},n),r||{})}))}},t.prototype.runInitialLayout=function(t){return oe(this,void 0,void 0,(function(){var e;return ae(this,(function(n){switch(n.label){case 0:return[4,pt(this.currentGraph,t)];case 1:return e=n.sent(),console.log("runInitialLayout returned settings",e),this.animator&&this.animator.kill(),this.animator=this.getNewAnimator(),this.animator.params.settings=e,this.layoutConfig=e,this.animator.forceNodePositionUpdate(),this.startAnimator(),[2]}}))}))},t.prototype.resetAnimator=function(){var t;null===(t=this.animator)||void 0===t||t.kill(),this.animator=this.getNewAnimator(),this.startAnimator()},t.prototype.startAnimator=function(){if(this.animator){this.animator.start();var t=this.animator;this.views.forEach((function(e){e.graphManager.updateAnimator(t)}))}},t.prototype.getNewAnimator=function(t){var e;return new ut(this.currentGraph,{settings:re(re(re(re({},Ct(this.currentGraph)),this.layoutConfig),null===(e=this.animator)||void 0===e?void 0:e.params.settings),t||{})},{maxiters:1500,miniters:200,convergenceThreshold:.1})},t.prototype.addSliderListeners=function(){var t=this;this.sliderManager.addListener(this.sliderConfig.coarseness.label,(function(e){return oe(t,void 0,void 0,(function(){return ae(this,(function(t){switch(t.label){case 0:return[4,this.handleCoarsenessChange(e)];case 1:return t.sent(),this.onCoarsenessChange(e),[2]}}))}))})),this.sliderManager.addListener(this.sliderConfig.connectivity.label,(function(e){t.handleConnectivityChange(e),t.onConnectivityChange(e)}))},t.prototype.handleCoarsenessChange=function(t){return oe(this,void 0,void 0,(function(){return ae(this,(function(e){switch(e.label){case 0:return[4,this.setCoarsenessLevel(t.toString())];case 1:return e.sent(),[2]}}))}))},t.prototype.handleConnectivityChange=function(t){this.setConnectivityLevel(t)},t.prototype.updateAllGraphViews=function(t,e){this.currentGraph=t,this.views.forEach((function(e){e.graphManager.updateGraph(t,!0)})),this.selectedNodes=e,this.updateViewsSelectedNodes()},t.prototype.updateAllGraphRenderSettings=function(){var t=this;this.views.forEach((function(e){e.graphManager.updateRenderSettings(t.renderSettings)}))},t.prototype.normalizeNewGraphScaleBeforeTransition=function(t){var e=Math.max(1,this.currentGraph.order),n=Math.max(1,t.order)/e;if(Number.isFinite(n)&&!(n<=0)&&!(Math.abs(n-1)<1e-9)){var i=1/n;t.updateEachNodeAttributes((function(t,e){var n=Number(e.x),r=Number(e.y);return re(re({},e),{x:Number.isFinite(n)?n*i:n,y:Number.isFinite(r)?r*i:r})}))}},t.prototype.resetAllGraphViews=function(){this.views.forEach((function(t){t.graphManager.resetView()}))},t}();const he={GraphManager:Rt,MultiResolutionGraph:se,GraphView:jt,initialGraphLayout:pt,relativeComponentLayout:rt,getLayoutSettings:Ct,ForceAtlasAnimator:ut,LinearAnimator:Tt,exportGraphToSVG:wt,downloadSVG:xt}})(),i})(),t.exports=e()},364:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n,i,r,o=t[1]||"",a=t[3];if(!a)return o;if(e&&"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(t){return"/*# sourceURL=".concat(a.sourceRoot||"").concat(t," */")}));return[o].concat(h).concat([s]).join("\n")}return[o].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);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<t.length;s++){var h=[].concat(t[s]);i&&r[h[0]]||(n&&(h[2]?h[2]="".concat(n," and ").concat(h[2]):h[2]=n),e.push(h))}},e}},463:(t,e,n)=>{var i=n(72),r=n(930);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.id,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},356:(t,e,n)=>{var i=n(72),r=n(969);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.id,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},72:(t,e,n)=>{"use strict";var i,r=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),o=[];function a(t){for(var e=-1,n=0;n<o.length;n++)if(o[n].identifier===t){e=n;break}return e}function s(t,e){for(var n={},i=[],r=0;r<t.length;r++){var s=t[r],h=e.base?s[0]+e.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,e),references:1}),i.push(c)}return i}function h(t){var e=document.createElement("style"),i=t.attributes||{};if(void 0===i.nonce){var o=n.nc;o&&(i.nonce=o)}if(Object.keys(i).forEach((function(t){e.setAttribute(t,i[t])})),"function"==typeof t.insert)t.insert(e);else{var a=r(t.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(e)}return e}var u,c=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function d(t,e,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(t.styleSheet)t.styleSheet.cssText=c(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function l(t,e,n){var i=n.css,r=n.media,o=n.sourceMap;if(r?t.setAttribute("media",r):t.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}var p=null,f=0;function g(t,e){var n,i,r;if(e.singleton){var o=f++;n=p||(p=h(e)),i=d.bind(null,n,o,!1),r=d.bind(null,n,o,!0)}else n=h(e),i=l.bind(null,n,e),r=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=s(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var i=0;i<n.length;i++){var r=a(n[i]);o[r].references--}for(var h=s(t,e),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:e=>{"use strict";e.exports=t},330:t=>{"use strict";t.exports=JSON.parse('{"name":"landscape-widget","version":"0.5.0","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(t){var r=n[t];if(void 0!==r)return r.exports;var o=n[t]={id:t,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__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:()=>e});const t=i(330),e=t.version,n=t.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(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)});function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var c,d=function(){function t(){}return t._xfnv1a=function(t){for(var e=2166136261,n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return function(){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,(e+=e<<5)>>>0}},t}(),l=function(t){function e(n){var i=t.call(this)||this;return i.a=e._xfnv1a(n)(),i}return u(e,t),e.prototype.next=function(){var t=this.a+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},e}(d),p=function(t){function e(n){var i=t.call(this)||this,r=e._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(e,t),e.prototype.next=function(){this.a>>>=0,this.b>>>=0,this.c>>>=0,this.d>>>=0;var t=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,t=t+this.d|0,this.c=this.c+t|0,(t>>>0)/4294967296},e}(d),f=function(t){function e(n){var i=t.call(this)||this,r=e._xfnv1a(n);return i.a=r(),i.b=r(),i.c=r(),i.d=r(),i}return u(e,t),e.prototype.next=function(){var t=this.b<<9,e=5*this.a;return e=e<<7|9*(e>>>25),this.c^=this.a,this.d^=this.b,this.b^=this.c,this.a^=this.d,this.c^=t,this.d=this.d<<11|this.d>>>21,(e>>>0)/4294967296},e}(d);!function(t){t.sfc32="sfc32",t.mulberry32="mulberry32",t.xoshiro128ss="xoshiro128ss"}(c||(c={}));var g=function(){function t(t,e){void 0===e&&(e=c.sfc32),this.str=t,this.prng=e,this.generator=this._initializeGenerator()}return t.prototype.next=function(){return this.generator.next()},t.prototype._initializeGenerator=function(){if(function(t){return null===t}(t=this.str)||function(t){return void 0===t}(t))return this.wrap();var t;switch(this.prng){case"sfc32":return new p(this.str);case"mulberry32":return new l(this.str);case"xoshiro128ss":return new f(this.str);default:return this.wrap()}},t.prototype.wrap=function(){return{next:function(){return Math.random()}}},t}(),v=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const y={allowInvalidContainer:!0,zoomToSizeRatioFunction:t=>t<=1?Math.max(Math.sqrt(t),.05):Math.min(Math.sqrt(t),3),edgeZoomToSizeRatioFunction:t=>t<=1?Math.max(Math.sqrt(t),.5):Math.min(Math.sqrt(t),3),showHtmlHoverDefault:!0,edgeSize:1,edgeMaxSize:4,edgeWeightToSize:!1,highlightHaloColor:"rgba(0, 0, 0, 0.8)",highlightHaloExpansion:.8,highlightHaloGap:4,highlightHaloFadeExponent:1.8,highlightHoverNeighbors:!1},m={adjustSizes:!0};class b extends o.DOMWidgetModel{initialize(t,e){super.initialize(t,e),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("change:is_expanded_layout",this.updateExpandedLayoutButton,this),this.on("msg:custom",this.handleCustomMessage,this),this.loadGraph()}loadGraph(){return v(this,void 0,void 0,(function*(){const t=this.get("graph"),e=this.get("node_labels"),n=this.get("node_hover_labels"),i=Object.keys(t).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 t=String(u.width),e=String(u.height);if(t.endsWith("px")&&e.endsWith("px")){const n=Number(t.slice(0,t.length-2)),i=Number(e.slice(0,e.length-2));c.expectedDims=[n,i]}}const d=Object.assign(Object.assign({},y),this.get("sigma_settings")||{});this.multiResolutionGraph=new s.MultiResolutionGraph({graphData:t,sliderConfig:h,renderSettings:d,onSelectedNodesChange:()=>{},onSelectedPointsChange:this.setSelectedPoints.bind(this),onFullScreenChange:this.toggleExpandedLayout.bind(this),onCoarsenessChange:this.setCoarsenessLevel.bind(this),onConnectivityChange:this.setConnectivityLevel.bind(this),nodeLabels:e,nodeHoverLabels:n,layoutConfig:Object.assign(Object.assign({adjustSizes:!0},c),this.get("layout_config")),showButtons:this.get("show_buttons"),isFullScreen:this.get("is_expanded_layout"),highlightHoverNeighbors:d.highlightHoverNeighbors}),this.updateNodeProperties(),this.updateHoverTemplate()}))}updateNodeProperties(){this.updateNodeColors(),this.updateNodeLabels(),this.updateNodeHoverLabels(),this.updateNodeAttrs()}setSelectedPoints(t){this.set("selected_points",t),this.save_changes()}toggleExpandedLayout(t){this.set("is_expanded_layout",t),this.save_changes()}setCoarsenessLevel(t){this.set("selected_level",t),this.save_changes()}setConnectivityLevel(t){this.set("avg_degree",t),this.save_changes()}updateNodeColors(){if(!this.multiResolutionGraph)return;const t=this.get("colors");t&&this.multiResolutionGraph.setNodeColors(t)}updateNodeLabels(){if(!this.multiResolutionGraph)return;const t=this.get("node_labels");t&&this.multiResolutionGraph.setNodeLabels(t)}updateNodeHoverLabels(){if(!this.multiResolutionGraph)return;const t=this.get("node_hover_labels");t&&this.multiResolutionGraph.setNodeHoverLabels(t)}updateNodeAttrs(){if(!this.multiResolutionGraph)return;const t=this.get("node_attrs");t&&this.multiResolutionGraph.setNodeAttrs(t)}updateExpandedLayoutButton(){const t=this.get("is_expanded_layout");this.multiResolutionGraph.setIsFullScreen(t)}updateHoverTemplate(){if(!this.multiResolutionGraph)return;const t=this.get("rich_node_hover_template");t&&this.multiResolutionGraph.setNodeHoverTemplate(t)}updateSelectedLevel(){return v(this,void 0,void 0,(function*(){if(!this.multiResolutionGraph)return;const t=this.get("selected_level");t&&String(t)!==String(this.multiResolutionGraph.selectedLevel)&&(yield this.multiResolutionGraph.setCoarsenessLevel(t),this.multiResolutionGraph.sliderManager.setSliderValue("Coarseness",t))}))}updateAvgDegree(){if(!this.multiResolutionGraph)return;const t=this.get("avg_degree");(t||0===t)&&(this.multiResolutionGraph.setConnectivityLevel(t),this.multiResolutionGraph.sliderManager.setSliderValue("Connectivity",t))}updateSelectedPoints(){if(!this.multiResolutionGraph)return;const t=this.get("selected_points");t&&this.multiResolutionGraph.setSelectedPoints(t)}disposeGraph(){this.multiResolutionGraph.cleanup(),this.multiResolutionGraph.dispose()}resetView(){this.multiResolutionGraph.resetView()}handleCustomMessage(t){"dispose_graph"===t.event_type?this.disposeGraph():"reset_view"===t.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:y,background_color:null,is_expanded_layout:!1,layout_settings:m})}}b.serializers=Object.assign(Object.assign({},o.DOMWidgetModel.serializers),{colors:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},graph:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_labels:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_hover_labels:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)},node_attrs:{deserialize:t=>"string"==typeof t?JSON.parse(t):t,serialize:t=>"string"==typeof t?t:JSON.stringify(t)}}),b.model_name="LandscapeModel",b.model_module=n,b.model_module_version=e,b.view_name="LandscapeView",b.view_module=n,b.view_module_version=e;class w extends o.DOMWidgetView{constructor(t){super(t),this.setupRequestId=0,this.setupRetryTimer=null,this.removed=!1,this.view=null;const e=new g;this.containerId=`landscape-container-${e.next().toString(36).substring(2)}`}render(){this.removed=!1,this.createLandscapeContainer(),this.setupRequestId+=1,this.setupGraphManager(this.setupRequestId),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(t){return v(this,void 0,void 0,(function*(){if(this.removed||t!==this.setupRequestId)return;const e=document.getElementById(this.containerId);if(e&&this.model.multiResolutionGraph){const n=yield this.model.multiResolutionGraph.getView(e);if(this.removed||t!==this.setupRequestId)return void this.disposeTrackedView(n);this.view=n,yield this.view.graphManager.resetView()}else this.setupRetryTimer=window.setTimeout((()=>{this.setupGraphManager(t)}),100)}))}disposeTrackedView(t){t.graphManager.cleanup(),t.graphManager.dispose(),this.model.multiResolutionGraph&&(this.model.multiResolutionGraph.deleteView(t),this.model.multiResolutionGraph.sliderManager.deleteView(t.sliderView))}setBackgroundColor(){const t=this.model.get("background_color");t&&(this.el.style.backgroundColor=t,this._landscapeContainer.style.backgroundColor=t,this._landscapeContainer.style.setProperty("--sigma-background-color",t))}remove(){var t,e;this.removed=!0,this.setupRequestId+=1,null!==this.setupRetryTimer&&(window.clearTimeout(this.setupRetryTimer),this.setupRetryTimer=null),this.model.off("change:background_color",this.setBackgroundColor,this);const n=null!==(t=this.view)&&void 0!==t?t:null===(e=this.model.multiResolutionGraph)||void 0===e?void 0:e.views.find((t=>t.container.id===this.containerId));return n&&(this.disposeTrackedView(n),this.view=null),this.el.querySelectorAll("canvas").forEach((t=>{t.width=1,t.height=1})),super.remove()}}})(),r})()));
2
2
  //# sourceMappingURL=index.js.map