@reqvire-org/reqvire 1.3.2 → 1.4.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.
- package/artifacts/reqvire-darwin-arm64.tar.gz +0 -0
- package/artifacts/reqvire-darwin-x86_64.tar.gz +0 -0
- package/artifacts/reqvire-linux-x86_64.tar.gz +0 -0
- package/explorer-dist/assets/brand/README.md +28 -0
- package/explorer-dist/assets/explorer-KnowledgeGraphCanvasImpl.js +1 -0
- package/explorer-dist/assets/{explorer-abnfDiagram-VCTEODGH.js → explorer-abnfDiagram-WEYOIA3C.js} +1 -1
- package/explorer-dist/assets/explorer-actionscript-3.js +1 -1
- package/explorer-dist/assets/explorer-ada.js +1 -1
- package/explorer-dist/assets/explorer-ahk.js +1 -0
- package/explorer-dist/assets/explorer-ahk2.js +1 -0
- package/explorer-dist/assets/explorer-apex.js +1 -1
- package/explorer-dist/assets/explorer-architectureDiagram-ZHVYKT53.js +36 -0
- package/explorer-dist/assets/explorer-asciidoc.js +1 -1
- package/explorer-dist/assets/explorer-bat.js +1 -1
- package/explorer-dist/assets/explorer-beancount.js +1 -1
- package/explorer-dist/assets/explorer-bird2.js +1 -1
- package/explorer-dist/assets/explorer-blockDiagram-RJAE7QA3.js +140 -0
- package/explorer-dist/assets/explorer-bsl.js +1 -1
- package/explorer-dist/assets/explorer-c3.js +1 -1
- package/explorer-dist/assets/explorer-c4Diagram-XDPPPE54.js +38 -0
- package/explorer-dist/assets/explorer-catppuccin-frappe.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-latte.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-macchiato.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-mocha.js +1 -1
- package/explorer-dist/assets/explorer-chapel.js +1 -0
- package/explorer-dist/assets/{explorer-chunk-SVP7TREG.js → explorer-chunk-2E7WHVMD.js} +4 -4
- package/explorer-dist/assets/explorer-chunk-4EMNKR2T.js +1 -0
- package/explorer-dist/assets/explorer-chunk-55XCU76K.js +1 -0
- package/explorer-dist/assets/explorer-chunk-ZCHMQSOR.js +2 -0
- package/explorer-dist/assets/explorer-clarity.js +1 -1
- package/explorer-dist/assets/explorer-classDiagram-v2-4MYWR3UA.js +217 -0
- package/explorer-dist/assets/explorer-coq.js +1 -1
- package/explorer-dist/assets/explorer-cose-bilkent-JH36ORCC.js +1 -1
- package/explorer-dist/assets/explorer-cpp.js +1 -1
- package/explorer-dist/assets/explorer-csharp.js +1 -1
- package/explorer-dist/assets/explorer-css.js +1 -1
- package/explorer-dist/assets/explorer-cynefin-EF2NZ3EQ.js +141 -0
- package/explorer-dist/assets/{explorer-cynefinDiagram-5FMLGOSQ.js → explorer-cynefinDiagram-WF24UDRP.js} +2 -2
- package/explorer-dist/assets/explorer-cytoscape.esm.js +23 -23
- package/explorer-dist/assets/explorer-dagre-NK4GIZVX.js +4 -0
- package/explorer-dist/assets/explorer-dart.js +1 -1
- package/explorer-dist/assets/{explorer-diagram-VX7I27RA.js → explorer-diagram-CBK3MWTC.js} +2 -2
- package/explorer-dist/assets/explorer-diagram-I5XIIV2D.js +24 -0
- package/explorer-dist/assets/{explorer-diagram-S7CK7UJ4.js → explorer-diagram-ODIL2UCW.js} +5 -5
- package/explorer-dist/assets/explorer-diagram-PFBEJUXE.js +3 -0
- package/explorer-dist/assets/explorer-diagram-RJA3I4VV.js +41 -0
- package/explorer-dist/assets/explorer-diagram-TYUNFSNR.js +200 -0
- package/explorer-dist/assets/explorer-dotenv.js +1 -1
- package/explorer-dist/assets/{explorer-ebnfDiagram-PWID7BFC.js → explorer-ebnfDiagram-V4P3TTPT.js} +1 -1
- package/explorer-dist/assets/explorer-elk-QONTBCTQ.js +27 -0
- package/explorer-dist/assets/explorer-emacs-lisp.js +1 -1
- package/explorer-dist/assets/explorer-erDiagram-KYQIGQAA.js +99 -0
- package/explorer-dist/assets/explorer-flowDiagram-IUGLLWBU.js +213 -0
- package/explorer-dist/assets/explorer-ganttDiagram-R7GPNTJY.js +292 -0
- package/explorer-dist/assets/explorer-gdscript.js +1 -1
- package/explorer-dist/assets/{explorer-gitGraphDiagram-WWUBYQGX.js → explorer-gitGraphDiagram-PDYL7XHY.js} +5 -5
- package/explorer-dist/assets/explorer-gn.js +1 -1
- package/explorer-dist/assets/explorer-graph.js +1 -0
- package/explorer-dist/assets/explorer-hack.js +1 -1
- package/explorer-dist/assets/explorer-handlebars.js +1 -1
- package/explorer-dist/assets/explorer-haxe.js +1 -1
- package/explorer-dist/assets/explorer-hxml.js +1 -1
- package/explorer-dist/assets/explorer-index.js +312 -0
- package/explorer-dist/assets/explorer-infoDiagram-MVDRKAX5.js +2 -0
- package/explorer-dist/assets/{explorer-ishikawaDiagram-5VMMS53U.js → explorer-ishikawaDiagram-HPEHV2GE.js} +4 -4
- package/explorer-dist/assets/{explorer-journeyDiagram-3NMN7TZE.js → explorer-journeyDiagram-BOSHW7O7.js} +1 -1
- package/explorer-dist/assets/explorer-julia.js +1 -1
- package/explorer-dist/assets/explorer-just.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-dragon.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-lotus.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-wave.js +1 -1
- package/explorer-dist/assets/{explorer-kanban-definition-UXKFOSKX.js → explorer-kanban-definition-FNSA4HC5.js} +7 -7
- package/explorer-dist/assets/explorer-katex.js +18 -18
- package/explorer-dist/assets/explorer-latex.js +1 -1
- package/explorer-dist/assets/explorer-linear.js +1 -1
- package/explorer-dist/assets/explorer-llvm.js +1 -1
- package/explorer-dist/assets/explorer-luau.js +1 -1
- package/explorer-dist/assets/explorer-marko.js +1 -1
- package/explorer-dist/assets/explorer-mdc.js +1 -1
- package/explorer-dist/assets/explorer-mermaid.core.js +150 -148
- package/explorer-dist/assets/explorer-mermaid.js +1 -1
- package/explorer-dist/assets/explorer-mindmap-definition-6OY57UG3.js +98 -0
- package/explorer-dist/assets/explorer-mojo.js +1 -1
- package/explorer-dist/assets/explorer-monokai.js +1 -1
- package/explorer-dist/assets/explorer-moonbit.js +1 -1
- package/explorer-dist/assets/explorer-move.js +1 -1
- package/explorer-dist/assets/explorer-nextflow-groovy.js +1 -1
- package/explorer-dist/assets/explorer-nextflow.js +1 -1
- package/explorer-dist/assets/explorer-nsis.js +1 -0
- package/explorer-dist/assets/explorer-nushell.js +1 -1
- package/explorer-dist/assets/explorer-one-dark-pro.js +1 -1
- package/explorer-dist/assets/explorer-ontologyGraphRendererImpl.js +616 -0
- package/explorer-dist/assets/explorer-org.js +1 -0
- package/explorer-dist/assets/{explorer-pegDiagram-XKGWAZYB.js → explorer-pegDiagram-ECIUJNBX.js} +1 -1
- package/explorer-dist/assets/explorer-php.js +1 -1
- package/explorer-dist/assets/explorer-pieDiagram-GNMPY74T.js +39 -0
- package/explorer-dist/assets/explorer-powershell.js +1 -1
- package/explorer-dist/assets/explorer-prisma.js +1 -1
- package/explorer-dist/assets/{explorer-quadrantDiagram-AXDQQJYC.js → explorer-quadrantDiagram-D57K4MC3.js} +1 -1
- package/explorer-dist/assets/explorer-r.js +1 -1
- package/explorer-dist/assets/{explorer-railroadDiagram-O6MQD6OU.js → explorer-railroadDiagram-Y72NRBL7.js} +1 -1
- package/explorer-dist/assets/explorer-rbs.js +1 -0
- package/explorer-dist/assets/explorer-red.js +1 -1
- package/explorer-dist/assets/explorer-requirementDiagram-EQYSW5RA.js +84 -0
- package/explorer-dist/assets/explorer-rose-pine-dawn.js +1 -1
- package/explorer-dist/assets/explorer-rose-pine-moon.js +1 -1
- package/explorer-dist/assets/explorer-rose-pine.js +1 -1
- package/explorer-dist/assets/explorer-rst.js +1 -1
- package/explorer-dist/assets/explorer-ruby.js +1 -1
- package/explorer-dist/assets/explorer-rust.js +1 -1
- package/explorer-dist/assets/{explorer-sankeyDiagram-P5KCCOFB.js → explorer-sankeyDiagram-SY24JHO5.js} +4 -4
- package/explorer-dist/assets/explorer-scala.js +1 -1
- package/explorer-dist/assets/explorer-sequenceDiagram-BLEHNHQU.js +169 -0
- package/explorer-dist/assets/explorer-smalltalk.js +1 -1
- package/explorer-dist/assets/explorer-smithy.js +1 -0
- package/explorer-dist/assets/explorer-solarized-dark.js +1 -1
- package/explorer-dist/assets/explorer-solarized-light.js +1 -1
- package/explorer-dist/assets/explorer-solidity.js +1 -1
- package/explorer-dist/assets/explorer-sql.js +1 -1
- package/explorer-dist/assets/explorer-stateDiagram-v2-A6IESKWZ.js +291 -0
- package/explorer-dist/assets/explorer-surrealql.js +1 -1
- package/explorer-dist/assets/explorer-svelte.js +1 -1
- package/explorer-dist/assets/explorer-swift.js +1 -1
- package/explorer-dist/assets/explorer-swimlanes-B3ENRKFQ.js +1 -0
- package/explorer-dist/assets/explorer-swimlanesDiagram-AYQRV4AK.js +8 -0
- package/explorer-dist/assets/explorer-system-verilog.js +1 -1
- package/explorer-dist/assets/explorer-timeline-definition-JXYKGLGB.js +120 -0
- package/explorer-dist/assets/explorer-twig.js +1 -1
- package/explorer-dist/assets/explorer-typespec.js +1 -1
- package/explorer-dist/assets/explorer-typst.js +1 -1
- package/explorer-dist/assets/explorer-usecaseDiagram-WPOLBNNX.js +370 -0
- package/explorer-dist/assets/explorer-v.js +1 -1
- package/explorer-dist/assets/explorer-vb.js +1 -1
- package/explorer-dist/assets/explorer-vennDiagram-Q3Y3IDCW.js +34 -0
- package/explorer-dist/assets/explorer-verilog.js +1 -1
- package/explorer-dist/assets/explorer-vue.js +1 -1
- package/explorer-dist/assets/{explorer-wardleyDiagram-VM6X3IG4.js → explorer-wardleyDiagram-IVAIDKWA.js} +3 -3
- package/explorer-dist/assets/explorer-xychartDiagram-4URNHDU4.js +7 -0
- package/explorer-dist/assets/explorer.css +1 -1
- package/explorer-dist/assets/explorer.js +40 -1152
- package/explorer-dist/assets/fonts/.gitkeep +0 -0
- package/package.json +1 -1
- package/explorer-dist/assets/explorer-architectureDiagram-5GKGNRK7.js +0 -36
- package/explorer-dist/assets/explorer-blockDiagram-I7D4REHJ.js +0 -129
- package/explorer-dist/assets/explorer-c4Diagram-7LVT6UL2.js +0 -38
- package/explorer-dist/assets/explorer-chunk-F27PBJKO.js +0 -1
- package/explorer-dist/assets/explorer-chunk-IMKFNOWR.js +0 -231
- package/explorer-dist/assets/explorer-chunk-TICWLB2K.js +0 -206
- package/explorer-dist/assets/explorer-classDiagram-ZZMXUADV.js +0 -1
- package/explorer-dist/assets/explorer-classDiagram-v2-VYDZK3BY.js +0 -1
- package/explorer-dist/assets/explorer-cynefin-OW5HDTMX.js +0 -178
- package/explorer-dist/assets/explorer-dagre-GXQ25YYZ.js +0 -4
- package/explorer-dist/assets/explorer-diagram-UQ7AKVKN.js +0 -41
- package/explorer-dist/assets/explorer-diagram-VSXAHHWV.js +0 -3
- package/explorer-dist/assets/explorer-diagram-Z3DM3KII.js +0 -24
- package/explorer-dist/assets/explorer-erDiagram-RLTQ6QDP.js +0 -99
- package/explorer-dist/assets/explorer-flowDiagram-HODETNUW.js +0 -168
- package/explorer-dist/assets/explorer-ganttDiagram-EL5Y4UJY.js +0 -292
- package/explorer-dist/assets/explorer-infoDiagram-27XIBGKW.js +0 -2
- package/explorer-dist/assets/explorer-layout.js +0 -1
- package/explorer-dist/assets/explorer-mindmap-definition-YA3MSWOX.js +0 -96
- package/explorer-dist/assets/explorer-pieDiagram-E7YTZNPT.js +0 -39
- package/explorer-dist/assets/explorer-requirementDiagram-BXWQKSXE.js +0 -84
- package/explorer-dist/assets/explorer-sequenceDiagram-WJ2MYXX4.js +0 -162
- package/explorer-dist/assets/explorer-stateDiagram-D77RDMKH.js +0 -1
- package/explorer-dist/assets/explorer-stateDiagram-v2-MP3YSRHH.js +0 -1
- package/explorer-dist/assets/explorer-swimlanes-42K2YHIH.js +0 -1
- package/explorer-dist/assets/explorer-swimlanesDiagram-VR7AAH4N.js +0 -8
- package/explorer-dist/assets/explorer-timeline-definition-24CTP7MA.js +0 -120
- package/explorer-dist/assets/explorer-vennDiagram-4TSXK5OY.js +0 -34
- package/explorer-dist/assets/explorer-xychartDiagram-S5SC5T6Z.js +0 -7
- /package/explorer-dist/assets/{explorer-chunk-POPQ4Y6H.js → explorer-chunk-VQ5W62QI.js} +0 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import{n as Ce}from"./explorer.js";var Me={exports:{}},Ft;function tr(){if(Ft)return Me.exports;Ft=1;var n=typeof Reflect=="object"?Reflect:null,t=n&&typeof n.apply=="function"?n.apply:function(v,b,w){return Function.prototype.apply.call(v,b,w)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:i=function(v){return Object.getOwnPropertyNames(v)};function e(g){console&&console.warn&&console.warn(g)}var r=Number.isNaN||function(v){return v!==v};function a(){a.init.call(this)}Me.exports=a,Me.exports.once=R,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");o=g}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function u(g){return g._maxListeners===void 0?a.defaultMaxListeners:g._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(v){for(var b=[],w=1;w<arguments.length;w++)b.push(arguments[w]);var k=v==="error",D=this._events;if(D!==void 0)k=k&&D.error===void 0;else if(!k)return!1;if(k){var C;if(b.length>0&&(C=b[0]),C instanceof Error)throw C;var G=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw G.context=C,G}var N=D[v];if(N===void 0)return!1;if(typeof N=="function")t(N,this,b);else for(var z=N.length,P=p(N,z),w=0;w<z;++w)t(P[w],this,b);return!0};function h(g,v,b,w){var k,D,C;if(s(b),D=g._events,D===void 0?(D=g._events=Object.create(null),g._eventsCount=0):(D.newListener!==void 0&&(g.emit("newListener",v,b.listener?b.listener:b),D=g._events),C=D[v]),C===void 0)C=D[v]=b,++g._eventsCount;else if(typeof C=="function"?C=D[v]=w?[b,C]:[C,b]:w?C.unshift(b):C.push(b),k=u(g),k>0&&C.length>k&&!C.warned){C.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+C.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");G.name="MaxListenersExceededWarning",G.emitter=g,G.type=v,G.count=C.length,e(G)}return g}a.prototype.addListener=function(v,b){return h(this,v,b,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,b){return h(this,v,b,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(g,v,b){var w={fired:!1,wrapFn:void 0,target:g,type:v,listener:b},k=d.bind(w);return k.listener=b,w.wrapFn=k,k}a.prototype.once=function(v,b){return s(b),this.on(v,l(this,v,b)),this},a.prototype.prependOnceListener=function(v,b){return s(b),this.prependListener(v,l(this,v,b)),this},a.prototype.removeListener=function(v,b){var w,k,D,C,G;if(s(b),k=this._events,k===void 0)return this;if(w=k[v],w===void 0)return this;if(w===b||w.listener===b)--this._eventsCount===0?this._events=Object.create(null):(delete k[v],k.removeListener&&this.emit("removeListener",v,w.listener||b));else if(typeof w!="function"){for(D=-1,C=w.length-1;C>=0;C--)if(w[C]===b||w[C].listener===b){G=w[C].listener,D=C;break}if(D<0)return this;D===0?w.shift():y(w,D),w.length===1&&(k[v]=w[0]),k.removeListener!==void 0&&this.emit("removeListener",v,G||b)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var b,w,k;if(w=this._events,w===void 0)return this;if(w.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):w[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete w[v]),this;if(arguments.length===0){var D=Object.keys(w),C;for(k=0;k<D.length;++k)C=D[k],C!=="removeListener"&&this.removeAllListeners(C);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(b=w[v],typeof b=="function")this.removeListener(v,b);else if(b!==void 0)for(k=b.length-1;k>=0;k--)this.removeListener(v,b[k]);return this};function c(g,v,b){var w=g._events;if(w===void 0)return[];var k=w[v];return k===void 0?[]:typeof k=="function"?b?[k.listener||k]:[k]:b?_(k):p(k,k.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(g,v){return typeof g.listenerCount=="function"?g.listenerCount(v):f.call(g,v)},a.prototype.listenerCount=f;function f(g){var v=this._events;if(v!==void 0){var b=v[g];if(typeof b=="function")return 1;if(b!==void 0)return b.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function p(g,v){for(var b=new Array(v),w=0;w<v;++w)b[w]=g[w];return b}function y(g,v){for(;v+1<g.length;v++)g[v]=g[v+1];g.pop()}function _(g){for(var v=new Array(g.length),b=0;b<v.length;++b)v[b]=g[b].listener||g[b];return v}function R(g,v){return new Promise(function(b,w){function k(C){g.removeListener(v,D),w(C)}function D(){typeof g.removeListener=="function"&&g.removeListener("error",k),b([].slice.call(arguments))}x(g,v,D,{once:!0}),v!=="error"&&T(g,k,{once:!0})})}function T(g,v,b){typeof g.on=="function"&&x(g,"error",v,b)}function x(g,v,b,w){if(typeof g.on=="function")w.once?g.once(v,b):g.on(v,b);else if(typeof g.addEventListener=="function")g.addEventListener(v,function k(D){w.once&&g.removeEventListener(v,k),b(D)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g)}return Me.exports}var vi=tr(),Ye,Pt;function mt(){if(Pt)return Ye;Pt=1;function n(t){if(typeof t!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=t}return typeof Symbol<"u"&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var t=arguments,i=t.length,e=0;return new n(function(){return e>=i?{done:!0}:{done:!1,value:t[e++]}})},n.empty=function(){var t=new n(function(){return{done:!0}});return t},n.fromSequence=function(t){var i=0,e=t.length;return new n(function(){return i>=e?{done:!0}:{done:!1,value:t[i++]}})},n.is=function(t){return t instanceof n?!0:typeof t=="object"&&t!==null&&typeof t.next=="function"},Ye=n,Ye}var ir=mt();const V=Ce(ir);var Ue={},It;function rr(){return It||(It=1,Ue.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Ue.SYMBOL_SUPPORT=typeof Symbol<"u"),Ue}var Ke,Mt;function mi(){if(Mt)return Ke;Mt=1;var n=mt(),t=rr(),i=t.ARRAY_BUFFER_SUPPORT,e=t.SYMBOL_SUPPORT;function r(a){return typeof a=="string"||Array.isArray(a)||i&&ArrayBuffer.isView(a)?n.fromSequence(a):typeof a!="object"||a===null?null:e&&typeof a[Symbol.iterator]=="function"?a[Symbol.iterator]():typeof a.next=="function"?a:null}return Ke=function(o){var s=r(o);if(!s)throw new Error("obliterator: target is not iterable nor a valid iterator.");return s},Ke}var Ze,Ut;function nr(){if(Ut)return Ze;Ut=1;var n=mi();return Ze=function(i,e){for(var r=arguments.length>1?e:1/0,a=r!==1/0?new Array(r):[],o,s=0,u=n(i);;){if(s===r)return a;if(o=u.next(),o.done)return s!==e&&(a.length=s),a;a[s++]=o.value}},Ze}var ar=nr();const yi=Ce(ar);var Xe,Ot;function or(){if(Ot)return Xe;Ot=1;var n=mt(),t=mi();return Xe=function(){var e=arguments,r=null,a=-1;return new n(function(){var s=null;do{if(r===null){if(a++,a>=e.length)return{done:!0};r=t(e[a])}if(s=r.next(),s.done===!0){r=null;continue}break}while(!0);return s})},Xe}var sr=or();const oe=Ce(sr);function ur(){const n=arguments[0];for(let t=1,i=arguments.length;t<i;t++)if(arguments[t])for(const e in arguments[t])n[e]=arguments[t][e];return n}let I=ur;typeof Object.assign=="function"&&(I=Object.assign);function j(n,t,i,e){const r=n._nodes.get(t);let a=null;return r&&(e==="mixed"?a=r.out&&r.out[i]||r.undirected&&r.undirected[i]:e==="directed"?a=r.out&&r.out[i]:a=r.undirected&&r.undirected[i]),a}function M(n){return typeof n=="object"&&n!==null}function bi(n){let t;for(t in n)return!1;return!0}function W(n,t,i){Object.defineProperty(n,t,{enumerable:!1,configurable:!1,writable:!0,value:i})}function ee(n,t,i){const e={enumerable:!0,configurable:!0};typeof i=="function"?e.get=i:(e.value=i,e.writable=!1),Object.defineProperty(n,t,e)}function $t(n){return!(!M(n)||n.attributes&&!Array.isArray(n.attributes))}function hr(){let n=Math.floor(Math.random()*256)&255;return()=>n++}class yt extends Error{constructor(t){super(),this.name="GraphError",this.message=t}}class S extends yt{constructor(t){super(t),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,S.prototype.constructor)}}class E extends yt{constructor(t){super(t),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,E.prototype.constructor)}}class L extends yt{constructor(t){super(t),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,L.prototype.constructor)}}function wi(n,t){this.key=n,this.attributes=t,this.clear()}wi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Ei(n,t){this.key=n,this.attributes=t,this.clear()}Ei.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function _i(n,t){this.key=n,this.attributes=t,this.clear()}_i.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function me(n,t,i,e,r){this.key=t,this.attributes=r,this.undirected=n,this.source=i,this.target=e}me.prototype.attach=function(){let n="out",t="in";this.undirected&&(n=t="undirected");const i=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&i===e)&&(this.target[t][i]=this)};me.prototype.attachMulti=function(){let n="out",t="in";const i=this.source.key,e=this.target.key;this.undirected&&(n=t="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&i===e||(this.target[t][i]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[t][i]=this};me.prototype.detach=function(){const n=this.source.key,t=this.target.key;let i="out",e="in";this.undirected&&(i=e="undirected"),delete this.source[i][t],delete this.target[e][n]};me.prototype.detachMulti=function(){const n=this.source.key,t=this.target.key;let i="out",e="in";this.undirected&&(i=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[i][t],delete this.target[e][n]):(this.next.previous=void 0,this.source[i][t]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const xi=0,Ti=1,dr=2,Si=3;function se(n,t,i,e,r,a,o){let s,u,h,d;if(e=""+e,i===xi){if(s=n._nodes.get(e),!s)throw new E(`Graph.${t}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(i===Si){if(r=""+r,u=n._edges.get(r),!u)throw new E(`Graph.${t}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new E(`Graph.${t}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`);i===Ti?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function lr(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);return o.attributes[s]}}function cr(n,t,i){n.prototype[t]=function(e,r){const[a]=se(this,t,i,e,r);return a.attributes}}function fr(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);return o.attributes.hasOwnProperty(s)}}function gr(n,t,i){n.prototype[t]=function(e,r,a,o){const[s,u,h]=se(this,t,i,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,t,i){n.prototype[t]=function(e,r,a,o){const[s,u,h]=se(this,t,i,e,r,a,o);if(typeof h!="function")throw new S(`Graph.${t}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function vr(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function mr(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);if(!M(s))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function yr(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);if(!M(s))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return I(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function br(n,t,i){n.prototype[t]=function(e,r,a){const[o,s]=se(this,t,i,e,r,a);if(typeof s!="function")throw new S(`Graph.${t}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const wr=[{name:n=>`get${n}Attribute`,attacher:lr},{name:n=>`get${n}Attributes`,attacher:cr},{name:n=>`has${n}Attribute`,attacher:fr},{name:n=>`set${n}Attribute`,attacher:gr},{name:n=>`update${n}Attribute`,attacher:pr},{name:n=>`remove${n}Attribute`,attacher:vr},{name:n=>`replace${n}Attributes`,attacher:mr},{name:n=>`merge${n}Attributes`,attacher:yr},{name:n=>`update${n}Attributes`,attacher:br}];function Er(n){wr.forEach(function({name:t,attacher:i}){i(n,t("Node"),xi),i(n,t("Source"),Ti),i(n,t("Target"),dr),i(n,t("Opposite"),Si)})}function _r(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function xr(n,t,i){n.prototype[t]=function(e){let r;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=j(this,a,o,i),!r)throw new E(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Tr(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Sr(n,t,i){n.prototype[t]=function(e,r,a){let o;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=j(this,s,u,i),!o)throw new E(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,t,i){n.prototype[t]=function(e,r,a){let o;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=j(this,s,u,i),!o)throw new E(`Graph.${t}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new S(`Graph.${t}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function Cr(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!M(r))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function kr(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!M(r))throw new S(`Graph.${t}: provided attributes are not a plain object.`);return I(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function Lr(n,t,i){n.prototype[t]=function(e,r){let a;if(this.type!=="mixed"&&i!=="mixed"&&i!==this.type)throw new L(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new L(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=j(this,o,s,i),!a)throw new E(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(i!=="mixed")throw new L(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new E(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new S(`Graph.${t}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Dr=[{name:n=>`get${n}Attribute`,attacher:_r},{name:n=>`get${n}Attributes`,attacher:xr},{name:n=>`has${n}Attribute`,attacher:Tr},{name:n=>`set${n}Attribute`,attacher:Sr},{name:n=>`update${n}Attribute`,attacher:Ar},{name:n=>`remove${n}Attribute`,attacher:Rr},{name:n=>`replace${n}Attributes`,attacher:Cr},{name:n=>`merge${n}Attributes`,attacher:kr},{name:n=>`update${n}Attributes`,attacher:Lr}];function Gr(n){Dr.forEach(function({name:t,attacher:i}){i(n,t("Edge"),"mixed"),i(n,t("DirectedEdge"),"directed"),i(n,t("UndirectedEdge"),"undirected")})}const Nr=[{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 Fr(n,t,i,e){let r=!1;for(const a in t){if(a===e)continue;const o=t[a];if(r=i(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Pr(n,t,i,e){let r,a,o,s=!1;for(const u in t)if(u!==e){r=t[u];do{if(a=r.source,o=r.target,s=i(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function Je(n,t){const i=Object.keys(n),e=i.length;let r,a=0;return new V(function(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const s=i[a++];if(s===t){r=void 0;continue}r=n[s]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}})}function Ir(n,t,i,e){const r=t[i];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Mr(n,t,i,e){let r=t[i];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function Qe(n,t){let i=n[t];return i.next!==void 0?new V(function(){if(!i)return{done:!0};const e={edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected};return i=i.next,{done:!1,value:e}}):V.of({edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected})}function Ur(n,t){if(n.size===0)return[];if(t==="mixed"||t===n.type)return typeof Array.from=="function"?Array.from(n._edges.keys()):yi(n._edges.keys(),n._edges.size);const i=t==="undirected"?n.undirectedSize:n.directedSize,e=new Array(i),r=t==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ai(n,t,i,e){if(t.size===0)return;const r=i!=="mixed"&&i!==t.type,a=i==="undirected";let o,s,u=!1;const h=t._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:f}=s;if(u=e(d,l,c.key,f.key,c.attributes,f.attributes,s.undirected),n&&u)return d}}function Or(n,t){if(n.size===0)return V.empty();const i=t!=="mixed"&&t!==n.type,e=t==="undirected",r=n._edges.values();return new V(function(){let o,s;for(;;){if(o=r.next(),o.done)return o;if(s=o.value,!(i&&s.undirected!==e))break}return{value:{edge:s.key,attributes:s.attributes,source:s.source.key,target:s.target.key,sourceAttributes:s.source.attributes,targetAttributes:s.target.attributes,undirected:s.undirected},done:!1}})}function bt(n,t,i,e,r,a){const o=t?Pr:Fr;let s;if(i!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||i!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function $r(n,t,i,e){const r=[];return bt(!1,n,t,i,e,function(a){r.push(a)}),r}function zr(n,t,i){let e=V.empty();return n!=="undirected"&&(t!=="out"&&typeof i.in<"u"&&(e=oe(e,Je(i.in))),t!=="in"&&typeof i.out<"u"&&(e=oe(e,Je(i.out,t?void 0:i.key)))),n!=="directed"&&typeof i.undirected<"u"&&(e=oe(e,Je(i.undirected))),e}function wt(n,t,i,e,r,a,o){const s=i?Mr:Ir;let u;if(t!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||t!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Br(n,t,i,e,r){const a=[];return wt(!1,n,t,i,e,r,function(o){a.push(o)}),a}function Hr(n,t,i,e){let r=V.empty();return n!=="undirected"&&(typeof i.in<"u"&&t!=="out"&&e in i.in&&(r=oe(r,Qe(i.in,e))),typeof i.out<"u"&&t!=="in"&&e in i.out&&(t||i.key!==e)&&(r=oe(r,Qe(i.out,e)))),n!=="directed"&&typeof i.undirected<"u"&&e in i.undirected&&(r=oe(r,Qe(i.undirected,e))),r}function Wr(n,t){const{name:i,type:e,direction:r}=t;n.prototype[i]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Ur(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new E(`Graph.${i}: could not find the "${a}" node in the graph.`);return $r(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new E(`Graph.${i}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new E(`Graph.${i}: could not find the "${o}" target node in the graph.`);return Br(e,this.multi,r,s,o)}throw new S(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function jr(n,t){const{name:i,type:e,direction:r}=t,a="forEach"+i[0].toUpperCase()+i.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ai(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new E(`Graph.${a}: could not find the "${h}" node in the graph.`);return bt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new E(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new E(`Graph.${a}: could not find the "${d}" target node in the graph.`);return wt(!1,e,this.multi,r,c,d,l)}throw new S(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+i[0].toUpperCase()+i.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let f=0;h.push((p,y,_,R,T,x,g)=>{l[f++]=d(p,y,_,R,T,x,g)})}else l=[],h.push((c,f,p,y,_,R,T)=>{l.push(d(c,f,p,y,_,R,T))});return this[a].apply(this,h),l};const s="filter"+i[0].toUpperCase()+i.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,f,p,y,_,R,T)=>{d(c,f,p,y,_,R,T)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+i[0].toUpperCase()+i.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new S(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new S(`Graph.${u}: 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.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((f,p,y,_,R,T,x)=>{c=d(c,f,p,y,_,R,T,x)}),this[a].apply(this,h),c}}function Vr(n,t){const{name:i,type:e,direction:r}=t,a="find"+i[0].toUpperCase()+i.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ai(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new E(`Graph.${a}: could not find the "${u}" node in the graph.`);return bt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new E(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new E(`Graph.${a}: could not find the "${h}" target node in the graph.`);return wt(!0,e,this.multi,r,l,h,d)}throw new S(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+i[0].toUpperCase()+i.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,f,p,y,_,R)=>h(l,c,f,p,y,_,R)),!!this[a].apply(this,u)};const s="every"+i[0].toUpperCase()+i.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,f,p,y,_,R)=>!h(l,c,f,p,y,_,R)),!this[a].apply(this,u)}}function qr(n,t){const{name:i,type:e,direction:r}=t,a=i.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return V.empty();if(!arguments.length)return Or(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new E(`Graph.${a}: could not find the "${o}" node in the graph.`);return zr(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new E(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new E(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Hr(e,r,u,s)}throw new S(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Yr(n){Nr.forEach(t=>{Wr(n,t),jr(n,t),Vr(n,t),qr(n,t)})}const Kr=[{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 je(){this.A=null,this.B=null}je.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};je.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Ee(n,t,i,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===i?u:s;if(t&&t.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Et(n,t,i,e,r){if(t!=="mixed"){if(t==="undirected")return Ee(n,null,e,e.undirected,r);if(typeof i=="string")return Ee(n,null,e,e[i],r)}const a=new je;let o;if(t!=="undirected"){if(i!=="out"){if(o=Ee(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(i!=="in"){if(o=Ee(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(t!=="directed"&&(o=Ee(n,a,e,e.undirected,r),n&&o))return o}function Zr(n,t,i){if(n!=="mixed"){if(n==="undirected")return Object.keys(i.undirected);if(typeof t=="string")return Object.keys(i[t])}const e=[];return Et(!1,n,t,i,function(r){e.push(r)}),e}function _e(n,t,i){const e=Object.keys(i),r=e.length;let a=0;return new V(function(){let s=null;do{if(a>=r)return n&&n.wrap(i),{done:!0};const u=i[e[a++]],h=u.source,d=u.target;if(s=h===t?d:h,n&&n.has(s.key)){s=null;continue}}while(s===null);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}})}function Xr(n,t,i){if(n!=="mixed"){if(n==="undirected")return _e(null,i,i.undirected);if(typeof t=="string")return _e(null,i,i[t])}let e=V.empty();const r=new je;return n!=="undirected"&&(t!=="out"&&(e=oe(e,_e(r,i,i.in))),t!=="in"&&(e=oe(e,_e(r,i,i.out)))),n!=="directed"&&(e=oe(e,_e(r,i,i.undirected))),e}function Jr(n,t){const{name:i,type:e,direction:r}=t;n.prototype[i]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new E(`Graph.${i}: could not find the "${a}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,o)}}function Qr(n,t){const{name:i,type:e,direction:r}=t,a="forEach"+i[0].toUpperCase()+i.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new E(`Graph.${a}: could not find the "${h}" node in the graph.`);Et(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+i[0].toUpperCase()+i.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,f)=>{l.push(d(c,f))}),l};const s="filter"+i[0].toUpperCase()+i.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,f)=>{d(c,f)&&l.push(c)}),l};const u="reduce"+i[0].toUpperCase()+i.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new S(`Graph.${u}: 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.`);let c=l;return this[a](h,(f,p)=>{c=d(c,f,p)}),c}}function en(n,t){const{name:i,type:e,direction:r}=t,a=i[0].toUpperCase()+i.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new E(`Graph.${o}: could not find the "${h}" node in the graph.`);return Et(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,f)=>!d(c,f))}}function tn(n,t){const{name:i,type:e,direction:r}=t,a=i.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return V.empty();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new E(`Graph.${a}: could not find the "${o}" node in the graph.`);return Xr(e==="mixed"?this.type:e,r,s)}}function rn(n){Kr.forEach(t=>{Jr(n,t),Qr(n,t),en(n,t),tn(n,t)})}function Oe(n,t,i,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let f=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,f=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(t&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),f=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}i&&!f&&r(u.key,null,u.attributes,null,null,null,null)}}function nn(n,t){const i={key:n};return bi(t.attributes)||(i.attributes=I({},t.attributes)),i}function an(n,t,i){const e={key:t,source:i.source.key,target:i.target.key};return bi(i.attributes)||(e.attributes=I({},i.attributes)),n==="mixed"&&i.undirected&&(e.undirected=!0),e}function on(n){if(!M(n))throw new S('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new S("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!M(n.attributes)||n.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sn(n){if(!M(n))throw new S('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new S("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new S("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!M(n.attributes)||n.attributes===null))throw new S("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new S("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const un=hr(),hn=new Set(["directed","undirected","mixed"]),zt=new Set(["domain","_events","_eventsCount","_maxListeners"]),dn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],ln={allowSelfLoops:!0,multi:!1,type:"mixed"};function cn(n,t,i){if(i&&!M(i))throw new S(`Graph.addNode: invalid attributes. Expecting an object but got "${i}"`);if(t=""+t,i=i||{},n._nodes.has(t))throw new L(`Graph.addNode: the "${t}" node already exist in the graph.`);const e=new n.NodeDataClass(t,i);return n._nodes.set(t,e),n.emit("nodeAdded",{key:t,attributes:i}),e}function Bt(n,t,i){const e=new n.NodeDataClass(t,i);return n._nodes.set(t,e),n.emit("nodeAdded",{key:t,attributes:i}),e}function Ri(n,t,i,e,r,a,o,s){if(!e&&n.type==="undirected")throw new L(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new L(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!M(s))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new L(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new E(`Graph.${t}: source node "${a}" not found.`);if(!h)throw new E(`Graph.${t}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(i)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new L(`Graph.${t}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new L(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new me(e,r,u,h,s);n._edges.set(r,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function fn(n,t,i,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new L(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new L(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new S(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!M(s))throw new S(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new L(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,f;if(!i&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new L(`Graph.${t}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);f=c}if(!f&&!n.multi&&d&&(f=e?d.undirected[o]:d.out[o]),f){const T=[f.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const x=f.attributes;f.attributes=h(x),n.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else I(f.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const p={key:null,undirected:e,source:a,target:o,attributes:s};if(i)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new L(`Graph.${t}: the "${r}" edge already exists in the graph.`);let y=!1,_=!1;d||(d=Bt(n,a,{}),y=!0,a===o&&(l=d,_=!0)),l||(l=Bt(n,o,{}),_=!0),c=new me(e,r,d,l,s),n._edges.set(r,c);const R=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,R&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,R&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,p.key=r,n.emit("edgeAdded",p),[r,!0,y,_]}function fe(n,t){n._edges.delete(t.key);const{source:i,target:e,attributes:r}=t,a=t.undirected,o=i===e;a?(i.undirectedDegree--,e.undirectedDegree--,o&&(i.undirectedLoops--,n._undirectedSelfLoopCount--)):(i.outDegree--,e.inDegree--,o&&(i.directedLoops--,n._directedSelfLoopCount--)),n.multi?t.detachMulti():t.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:t.key,attributes:r,source:i.key,target:e.key,undirected:a})}class F extends vi.EventEmitter{constructor(t){if(super(),t=I({},ln,t),typeof t.multi!="boolean")throw new S(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${t.multi}".`);if(!hn.has(t.type))throw new S(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${t.type}".`);if(typeof t.allowSelfLoops!="boolean")throw new S(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${t.allowSelfLoops}".`);const i=t.type==="mixed"?wi:t.type==="directed"?Ei:_i;W(this,"NodeDataClass",i);const e="geid_"+un()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};W(this,"_attributes",{}),W(this,"_nodes",new Map),W(this,"_edges",new Map),W(this,"_directedSize",0),W(this,"_undirectedSize",0),W(this,"_directedSelfLoopCount",0),W(this,"_undirectedSelfLoopCount",0),W(this,"_edgeKeyGenerator",a),W(this,"_options",t),zt.forEach(o=>W(this,o,this[o])),ee(this,"order",()=>this._nodes.size),ee(this,"size",()=>this._edges.size),ee(this,"directedSize",()=>this._directedSize),ee(this,"undirectedSize",()=>this._undirectedSize),ee(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),ee(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),ee(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),ee(this,"multi",this._options.multi),ee(this,"type",this._options.type),ee(this,"allowSelfLoops",this._options.allowSelfLoops),ee(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(t){return this._nodes.has(""+t)}hasDirectedEdge(t,i){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+t,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){t=""+t,i=""+i;const e=this._nodes.get(t);return e?e.out.hasOwnProperty(i):!1}throw new S(`Graph.hasDirectedEdge: invalid arity (${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.`)}hasUndirectedEdge(t,i){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+t,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){t=""+t,i=""+i;const e=this._nodes.get(t);return e?e.undirected.hasOwnProperty(i):!1}throw new S(`Graph.hasDirectedEdge: invalid arity (${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.`)}hasEdge(t,i){if(arguments.length===1){const e=""+t;return this._edges.has(e)}else if(arguments.length===2){t=""+t,i=""+i;const e=this._nodes.get(t);return e?typeof e.out<"u"&&e.out.hasOwnProperty(i)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(i):!1}throw new S(`Graph.hasEdge: invalid arity (${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.`)}directedEdge(t,i){if(this.type==="undirected")return;if(t=""+t,i=""+i,this.multi)throw new L("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(t);if(!e)throw new E(`Graph.directedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(i))throw new E(`Graph.directedEdge: could not find the "${i}" target node in the graph.`);const r=e.out&&e.out[i]||void 0;if(r)return r.key}undirectedEdge(t,i){if(this.type==="directed")return;if(t=""+t,i=""+i,this.multi)throw new L("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(t);if(!e)throw new E(`Graph.undirectedEdge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(i))throw new E(`Graph.undirectedEdge: could not find the "${i}" target node in the graph.`);const r=e.undirected&&e.undirected[i]||void 0;if(r)return r.key}edge(t,i){if(this.multi)throw new L("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.edge: could not find the "${t}" source node in the graph.`);if(!this._nodes.has(i))throw new E(`Graph.edge: could not find the "${i}" target node in the graph.`);const r=e.out&&e.out[i]||e.undirected&&e.undirected[i]||void 0;if(r)return r.key}areDirectedNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areDirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:i in e.in||i in e.out}areOutNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areOutNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:i in e.out}areInNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areInNeighbors: could not find the "${t}" node in the graph.`);return this.type==="undirected"?!1:i in e.in}areUndirectedNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areUndirectedNeighbors: could not find the "${t}" node in the graph.`);return this.type==="directed"?!1:i in e.undirected}areNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&(i in e.in||i in e.out)||this.type!=="directed"&&i in e.undirected}areInboundNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areInboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&i in e.in||this.type!=="directed"&&i in e.undirected}areOutboundNeighbors(t,i){t=""+t,i=""+i;const e=this._nodes.get(t);if(!e)throw new E(`Graph.areOutboundNeighbors: could not find the "${t}" node in the graph.`);return this.type!=="undirected"&&i in e.out||this.type!=="directed"&&i in e.undirected}inDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.inDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.inDegree}outDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.outDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.outDegree}directedDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.directedDegree: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.inDegree+i.outDegree}undirectedDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.undirectedDegree: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:i.undirectedDegree}inboundDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.inboundDegree: could not find the "${t}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=i.undirectedDegree),this.type!=="undirected"&&(e+=i.inDegree),e}outboundDegree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.outboundDegree: could not find the "${t}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=i.undirectedDegree),this.type!=="undirected"&&(e+=i.outDegree),e}degree(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.degree: could not find the "${t}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=i.undirectedDegree),this.type!=="undirected"&&(e+=i.inDegree+i.outDegree),e}inDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.inDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.inDegree-i.directedLoops}outDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.outDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.outDegree-i.directedLoops}directedDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.directedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="undirected"?0:i.inDegree+i.outDegree-i.directedLoops*2}undirectedDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);return this.type==="directed"?0:i.undirectedDegree-i.undirectedLoops*2}inboundDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=i.undirectedDegree,r+=i.undirectedLoops*2),this.type!=="undirected"&&(e+=i.inDegree,r+=i.directedLoops),e-r}outboundDegreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=i.undirectedDegree,r+=i.undirectedLoops*2),this.type!=="undirected"&&(e+=i.outDegree,r+=i.directedLoops),e-r}degreeWithoutSelfLoops(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.degreeWithoutSelfLoops: could not find the "${t}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=i.undirectedDegree,r+=i.undirectedLoops*2),this.type!=="undirected"&&(e+=i.inDegree+i.outDegree,r+=i.directedLoops*2),e-r}source(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.source: could not find the "${t}" edge in the graph.`);return i.source.key}target(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.target: could not find the "${t}" edge in the graph.`);return i.target.key}extremities(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.extremities: could not find the "${t}" edge in the graph.`);return[i.source.key,i.target.key]}opposite(t,i){t=""+t,i=""+i;const e=this._edges.get(i);if(!e)throw new E(`Graph.opposite: could not find the "${i}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(t===r)return a;if(t===a)return r;throw new E(`Graph.opposite: the "${t}" node is not attached to the "${i}" edge (${r}, ${a}).`)}hasExtremity(t,i){t=""+t,i=""+i;const e=this._edges.get(t);if(!e)throw new E(`Graph.hasExtremity: could not find the "${t}" edge in the graph.`);return e.source.key===i||e.target.key===i}isUndirected(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.isUndirected: could not find the "${t}" edge in the graph.`);return i.undirected}isDirected(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.isDirected: could not find the "${t}" edge in the graph.`);return!i.undirected}isSelfLoop(t){t=""+t;const i=this._edges.get(t);if(!i)throw new E(`Graph.isSelfLoop: could not find the "${t}" edge in the graph.`);return i.source===i.target}addNode(t,i){return cn(this,t,i).key}mergeNode(t,i){if(i&&!M(i))throw new S(`Graph.mergeNode: invalid attributes. Expecting an object but got "${i}"`);t=""+t,i=i||{};let e=this._nodes.get(t);return e?(i&&(I(e.attributes,i),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:e.attributes,data:i})),[t,!1]):(e=new this.NodeDataClass(t,i),this._nodes.set(t,e),this.emit("nodeAdded",{key:t,attributes:i}),[t,!0])}updateNode(t,i){if(i&&typeof i!="function")throw new S(`Graph.updateNode: invalid updater function. Expecting a function but got "${i}"`);t=""+t;let e=this._nodes.get(t);if(e){if(i){const a=e.attributes;e.attributes=i(a),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:e.attributes})}return[t,!1]}const r=i?i({}):{};return e=new this.NodeDataClass(t,r),this._nodes.set(t,e),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]}dropNode(t){t=""+t;const i=this._nodes.get(t);if(!i)throw new E(`Graph.dropNode: could not find the "${t}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in i.out){e=i.out[r];do fe(this,e),e=e.next;while(e)}for(const r in i.in){e=i.in[r];do fe(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in i.undirected){e=i.undirected[r];do fe(this,e),e=e.next;while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:i.attributes})}dropEdge(t){let i;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(i=j(this,e,r,this.type),!i)throw new E(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(t=""+t,i=this._edges.get(t),!i)throw new E(`Graph.dropEdge: could not find the "${t}" edge in the graph.`);return fe(this,i),this}dropDirectedEdge(t,i){if(arguments.length<2)throw new L("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 L("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.");t=""+t,i=""+i;const e=j(this,t,i,"directed");if(!e)throw new E(`Graph.dropDirectedEdge: could not find a "${t}" -> "${i}" edge in the graph.`);return fe(this,e),this}dropUndirectedEdge(t,i){if(arguments.length<2)throw new L("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 L("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.");const e=j(this,t,i,"undirected");if(!e)throw new E(`Graph.dropUndirectedEdge: could not find a "${t}" -> "${i}" edge in the graph.`);return fe(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const t=this._nodes.values();let i;for(;i=t.next(),i.done!==!0;)i.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(t){return this._attributes[t]}getAttributes(){return this._attributes}hasAttribute(t){return this._attributes.hasOwnProperty(t)}setAttribute(t,i){return this._attributes[t]=i,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}updateAttribute(t,i){if(typeof i!="function")throw new S("Graph.updateAttribute: updater should be a function.");const e=this._attributes[t];return this._attributes[t]=i(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this}removeAttribute(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this}replaceAttributes(t){if(!M(t))throw new S("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(t){if(!M(t))throw new S("Graph.mergeAttributes: provided attributes are not a plain object.");return I(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this}updateAttributes(t){if(typeof t!="function")throw new S("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(t,i){if(typeof t!="function")throw new S("Graph.updateEachNodeAttributes: expecting an updater function.");if(i&&!$t(i))throw new S("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=t(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:i||null})}updateEachEdgeAttributes(t,i){if(typeof t!="function")throw new S("Graph.updateEachEdgeAttributes: expecting an updater function.");if(i&&!$t(i))throw new S("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=t(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:i||null})}forEachAdjacencyEntry(t){if(typeof t!="function")throw new S("Graph.forEachAdjacencyEntry: expecting a callback.");Oe(!1,!1,!1,this,t)}forEachAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new S("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Oe(!1,!1,!0,this,t)}forEachAssymetricAdjacencyEntry(t){if(typeof t!="function")throw new S("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Oe(!1,!0,!1,this,t)}forEachAssymetricAdjacencyEntryWithOrphans(t){if(typeof t!="function")throw new S("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Oe(!1,!0,!0,this,t)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):yi(this._nodes.keys(),this._nodes.size)}forEachNode(t){if(typeof t!="function")throw new S("Graph.forEachNode: expecting a callback.");const i=this._nodes.values();let e,r;for(;e=i.next(),e.done!==!0;)r=e.value,t(r.key,r.attributes)}findNode(t){if(typeof t!="function")throw new S("Graph.findNode: expecting a callback.");const i=this._nodes.values();let e,r;for(;e=i.next(),e.done!==!0;)if(r=e.value,t(r.key,r.attributes))return r.key}mapNodes(t){if(typeof t!="function")throw new S("Graph.mapNode: expecting a callback.");const i=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=i.next(),e.done!==!0;)r=e.value,a[o++]=t(r.key,r.attributes);return a}someNode(t){if(typeof t!="function")throw new S("Graph.someNode: expecting a callback.");const i=this._nodes.values();let e,r;for(;e=i.next(),e.done!==!0;)if(r=e.value,t(r.key,r.attributes))return!0;return!1}everyNode(t){if(typeof t!="function")throw new S("Graph.everyNode: expecting a callback.");const i=this._nodes.values();let e,r;for(;e=i.next(),e.done!==!0;)if(r=e.value,!t(r.key,r.attributes))return!1;return!0}filterNodes(t){if(typeof t!="function")throw new S("Graph.filterNodes: expecting a callback.");const i=this._nodes.values();let e,r;const a=[];for(;e=i.next(),e.done!==!0;)r=e.value,t(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(t,i){if(typeof t!="function")throw new S("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new S("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.");let e=i;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=t(e,o.key,o.attributes);return e}nodeEntries(){const t=this._nodes.values();return new V(()=>{const i=t.next();if(i.done)return i;const e=i.value;return{value:{node:e.key,attributes:e.attributes},done:!1}})}export(){const t=new Array(this._nodes.size);let i=0;this._nodes.forEach((r,a)=>{t[i++]=nn(a,r)});const e=new Array(this._edges.size);return i=0,this._edges.forEach((r,a)=>{e[i++]=an(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:e}}import(t,i=!1){if(t instanceof F)return t.forEachNode((u,h)=>{i?this.mergeNode(u,h):this.addNode(u,h)}),t.forEachEdge((u,h,d,l,c,f,p)=>{i?p?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):p?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!M(t))throw new S("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!M(t.attributes))throw new S("Graph.import: invalid attributes. Expecting a plain object.");i?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let e,r,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new S("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e<r;e++){o=a[e],on(o);const{key:u,attributes:h}=o;i?this.mergeNode(u,h):this.addNode(u,h)}}if(t.edges){let u=!1;if(this.type==="undirected"&&(u=!0),a=t.edges,!Array.isArray(a))throw new S("Graph.import: invalid edges. Expecting an array.");for(e=0,r=a.length;e<r;e++){s=a[e],sn(s);const{source:h,target:d,attributes:l,undirected:c=u}=s;let f;"key"in s?(f=i?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,f.call(this,s.key,h,d,l)):(f=i?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,f.call(this,h,d,l))}}return this}nullCopy(t){const i=new F(I({},this._options,t));return i.replaceAttributes(I({},this.getAttributes())),i}emptyCopy(t){const i=this.nullCopy(t);return this._nodes.forEach((e,r)=>{const a=I({},e.attributes);e=new i.NodeDataClass(r,a),i._nodes.set(r,e)}),i}copy(t){if(t=t||{},typeof t.type=="string"&&t.type!==this.type&&t.type!=="mixed")throw new L(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${t.type}" because this would mean losing information about the current graph.`);if(typeof t.multi=="boolean"&&t.multi!==this.multi&&t.multi!==!0)throw new L("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(typeof t.allowSelfLoops=="boolean"&&t.allowSelfLoops!==this.allowSelfLoops&&t.allowSelfLoops!==!0)throw new L("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.");const i=this.emptyCopy(t),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,Ri(i,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,I({},a.attributes));return i}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const t={};this._nodes.forEach((a,o)=>{t[o]=a.attributes});const i={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,i[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!zt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=t,r.edges=i,W(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(F.prototype[Symbol.for("nodejs.util.inspect.custom")]=F.prototype.inspect);dn.forEach(n=>{["add","merge","update"].forEach(t=>{const i=n.name(t),e=t==="add"?Ri:fn;n.generateKey?F.prototype[i]=function(r,a,o){return e(this,i,!0,(n.type||this.type)==="undirected",null,r,a,o,t==="update")}:F.prototype[i]=function(r,a,o,s){return e(this,i,!1,(n.type||this.type)==="undirected",r,a,o,s,t==="update")}})});Er(F);Gr(F);Yr(F);rn(F);class Ci extends F{constructor(t){const i=I({type:"directed"},t);if("multi"in i&&i.multi!==!1)throw new S("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(i.type!=="directed")throw new S('DirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class ki extends F{constructor(t){const i=I({type:"undirected"},t);if("multi"in i&&i.multi!==!1)throw new S("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(i.type!=="undirected")throw new S('UndirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class Li extends F{constructor(t){const i=I({multi:!0},t);if("multi"in i&&i.multi!==!0)throw new S("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(i)}}class Di extends F{constructor(t){const i=I({type:"directed",multi:!0},t);if("multi"in i&&i.multi!==!0)throw new S("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(i.type!=="directed")throw new S('MultiDirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}class Gi extends F{constructor(t){const i=I({type:"undirected",multi:!0},t);if("multi"in i&&i.multi!==!0)throw new S("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(i.type!=="undirected")throw new S('MultiUndirectedGraph.from: inconsistent "'+i.type+'" type in given options!');super(i)}}function ye(n){n.from=function(t,i){const e=I({},t.options,i),r=new n(e);return r.import(t),r}}ye(F);ye(Ci);ye(ki);ye(Li);ye(Di);ye(Gi);F.Graph=F;F.DirectedGraph=Ci;F.UndirectedGraph=ki;F.MultiGraph=Li;F.MultiDirectedGraph=Di;F.MultiUndirectedGraph=Gi;F.InvalidArgumentsGraphError=S;F.NotFoundGraphError=E;F.UsageGraphError=L;var et,Ht;function Ni(){return Ht||(Ht=1,et=function(t){return t!==null&&typeof t=="object"&&typeof t.addUndirectedEdgeWithKey=="function"&&typeof t.dropNode=="function"&&typeof t.multi=="boolean"}),et}function gn(n,t){if(typeof n!="object"||!n)return n;var i=n[Symbol.toPrimitive];if(i!==void 0){var e=i.call(n,t);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function Re(n){var t=gn(n,"string");return typeof t=="symbol"?t:t+""}function O(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function Wt(n,t){for(var i=0;i<t.length;i++){var e=t[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,Re(e.key),e)}}function $(n,t,i){return t&&Wt(n.prototype,t),i&&Wt(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n}function pe(n){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(n)}function Fi(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Fi=function(){return!!n})()}function pn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function vn(n,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pn(n)}function q(n,t,i){return t=pe(t),vn(n,Fi()?Reflect.construct(t,i||[],pe(n).constructor):t.apply(n,i))}function ct(n,t){return ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,e){return i.__proto__=e,i},ct(n,t)}function Y(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&ct(n,t)}function mn(n){if(Array.isArray(n))return n}function yn(n,t){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var e,r,a,o,s=[],u=!0,h=!1;try{if(a=(i=i.call(n)).next,t===0){if(Object(i)!==i)return;u=!1}else for(;!(u=(e=a.call(i)).done)&&(s.push(e.value),s.length!==t);u=!0);}catch(d){h=!0,r=d}finally{try{if(!u&&i.return!=null&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return s}}function ft(n,t){(t==null||t>n.length)&&(t=n.length);for(var i=0,e=Array(t);i<t;i++)e[i]=n[i];return e}function Pi(n,t){if(n){if(typeof n=="string")return ft(n,t);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ft(n,t):void 0}}function bn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ve(n,t){return mn(n)||yn(n,t)||Pi(n,t)||bn()}var tt={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},Ii=new Int8Array(4),it=new Int32Array(Ii.buffer,0,1),wn=new Float32Array(Ii.buffer,0,1),En=/^\s*rgba?\s*\(/,_n=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function xn(n){var t=0,i=0,e=0,r=1;if(n[0]==="#")n.length===4?(t=parseInt(n.charAt(1)+n.charAt(1),16),i=parseInt(n.charAt(2)+n.charAt(2),16),e=parseInt(n.charAt(3)+n.charAt(3),16)):(t=parseInt(n.charAt(1)+n.charAt(2),16),i=parseInt(n.charAt(3)+n.charAt(4),16),e=parseInt(n.charAt(5)+n.charAt(6),16)),n.length===9&&(r=parseInt(n.charAt(7)+n.charAt(8),16)/255);else if(En.test(n)){var a=n.match(_n);a&&(t=+a[1],i=+a[2],e=+a[3],a[4]&&(r=+a[4]))}return{r:t,g:i,b:e,a:r}}var ge={};for(var $e in tt)ge[$e]=ke(tt[$e]),ge[tt[$e]]=ge[$e];function Mi(n,t,i,e,r){return it[0]=e<<24|i<<16|t<<8|n,it[0]=it[0]&4278190079,wn[0]}function ke(n){if(n=n.toLowerCase(),typeof ge[n]<"u")return ge[n];var t=xn(n),i=t.r,e=t.g,r=t.b,a=t.a;a=a*255|0;var o=Mi(i,e,r,a);return ge[n]=o,o}var rt={};function Ui(n){if(typeof rt[n]<"u")return rt[n];var t=(n&16711680)>>>16,i=(n&65280)>>>8,e=n&255,r=255,a=Mi(t,i,e,r);return rt[n]=a,a}function jt(n,t,i,e){return i+(t<<8)+(n<<16)}function Vt(n,t,i,e,r,a){var o=Math.floor(i/a*r),s=Math.floor(n.drawingBufferHeight/a-e/a*r),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,t),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var h=ve(u,4),d=h[0],l=h[1],c=h[2],f=h[3];return[d,l,c,f]}function m(n,t,i){return(t=Re(t))in n?Object.defineProperty(n,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[t]=i,n}function qt(n,t){var i=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);t&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),i.push.apply(i,e)}return i}function A(n){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?qt(Object(i),!0).forEach(function(e){m(n,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):qt(Object(i)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))})}return n}function Tn(n,t){for(;!{}.hasOwnProperty.call(n,t)&&(n=pe(n))!==null;);return n}function gt(){return gt=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,t,i){var e=Tn(n,t);if(e){var r=Object.getOwnPropertyDescriptor(e,t);return r.get?r.get.call(arguments.length<3?n:i):r.value}},gt.apply(null,arguments)}function Oi(n,t,i,e){var r=gt(pe(n.prototype),t,i);return typeof r=="function"?function(a){return r.apply(i,a)}:r}function Sn(n){return n.normalized?1:n.size}function nt(n){var t=0;return n.forEach(function(i){return t+=Sn(i)}),t}function $i(n,t,i){var e=n==="VERTEX"?t.VERTEX_SHADER:t.FRAGMENT_SHADER,r=t.createShader(e);if(r===null)throw new Error("loadShader: error while creating the shader");t.shaderSource(r,i),t.compileShader(r);var a=t.getShaderParameter(r,t.COMPILE_STATUS);if(!a){var o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`loadShader: error while compiling the shader:
|
|
3
|
+
`.concat(o,`
|
|
4
|
+
`).concat(i))}return r}function An(n,t){return $i("VERTEX",n,t)}function Rn(n,t){return $i("FRAGMENT",n,t)}function Cn(n,t){var i=n.createProgram();if(i===null)throw new Error("loadProgram: error while creating the program.");var e,r;for(e=0,r=t.length;e<r;e++)n.attachShader(i,t[e]);n.linkProgram(i);var a=n.getProgramParameter(i,n.LINK_STATUS);if(!a){var o=n.getProgramInfoLog(i);throw n.deleteProgram(i),new Error("loadProgram: error while linking the program: ".concat(o))}return i}function Yt(n){var t=n.gl,i=n.buffer,e=n.program,r=n.vertexShader,a=n.fragmentShader;t.deleteShader(r),t.deleteShader(a),t.deleteProgram(e),t.deleteBuffer(i)}var Kt=`#define PICKING_MODE
|
|
5
|
+
`,kn=m(m(m(m(m(m(m(m({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),zi=(function(){function n(t,i,e){O(this,n),m(this,"array",new Float32Array),m(this,"constantArray",new Float32Array),m(this,"capacity",0),m(this,"verticesCount",0);var r=this.getDefinition();if(this.VERTICES=r.VERTICES,this.VERTEX_SHADER_SOURCE=r.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=r.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=r.UNIFORMS,this.ATTRIBUTES=r.ATTRIBUTES,this.METHOD=r.METHOD,this.CONSTANT_ATTRIBUTES="CONSTANT_ATTRIBUTES"in r?r.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA="CONSTANT_DATA"in r?r.CONSTANT_DATA:[],this.isInstanced="CONSTANT_ATTRIBUTES"in r,this.ATTRIBUTES_ITEMS_COUNT=nt(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=e,this.normalProgram=this.getProgramInfo("normal",t,r.VERTEX_SHADER_SOURCE,r.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=i?this.getProgramInfo("pick",t,Kt+r.VERTEX_SHADER_SOURCE,Kt+r.FRAGMENT_SHADER_SOURCE,i):null,this.isInstanced){var a=nt(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw new Error("Program: error while getting constant data (expected ".concat(this.VERTICES," items, received ").concat(this.CONSTANT_DATA.length," instead)"));this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var o=0;o<this.CONSTANT_DATA.length;o++){var s=this.CONSTANT_DATA[o];if(s.length!==a)throw new Error("Program: error while getting constant data (one vector has ".concat(s.length," items instead of ").concat(a,")"));for(var u=0;u<s.length;u++)this.constantArray[o*a+u]=s[u]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}return $(n,[{key:"kill",value:function(){Yt(this.normalProgram),this.pickProgram&&(Yt(this.pickProgram),this.pickProgram=null)}},{key:"getProgramInfo",value:function(i,e,r,a,o){var s=this.getDefinition(),u=e.createBuffer();if(u===null)throw new Error("Program: error while creating the WebGL buffer.");var h=An(e,r),d=Rn(e,a),l=Cn(e,[h,d]),c={};s.UNIFORMS.forEach(function(y){var _=e.getUniformLocation(l,y);_&&(c[y]=_)});var f={};s.ATTRIBUTES.forEach(function(y){f[y.name]=e.getAttribLocation(l,y.name)});var p;if("CONSTANT_ATTRIBUTES"in s&&(s.CONSTANT_ATTRIBUTES.forEach(function(y){f[y.name]=e.getAttribLocation(l,y.name)}),p=e.createBuffer(),p===null))throw new Error("Program: error while creating the WebGL constant buffer.");return{name:i,program:l,gl:e,frameBuffer:o,buffer:u,constantBuffer:p||{},uniformLocations:c,attributeLocations:f,isPicking:i==="pick",vertexShader:h,fragmentShader:d}}},{key:"bindProgram",value:function(i){var e=this,r=0,a=i.gl,o=i.buffer;this.isInstanced?(a.bindBuffer(a.ARRAY_BUFFER,i.constantBuffer),r=0,this.CONSTANT_ATTRIBUTES.forEach(function(s){return r+=e.bindAttribute(s,i,r,!1)}),a.bufferData(a.ARRAY_BUFFER,this.constantArray,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,i.buffer),r=0,this.ATTRIBUTES.forEach(function(s){return r+=e.bindAttribute(s,i,r,!0)}),a.bufferData(a.ARRAY_BUFFER,this.array,a.DYNAMIC_DRAW)):(a.bindBuffer(a.ARRAY_BUFFER,o),r=0,this.ATTRIBUTES.forEach(function(s){return r+=e.bindAttribute(s,i,r)}),a.bufferData(a.ARRAY_BUFFER,this.array,a.DYNAMIC_DRAW)),a.bindBuffer(a.ARRAY_BUFFER,null)}},{key:"unbindProgram",value:function(i){var e=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach(function(r){return e.unbindAttribute(r,i,!1)}),this.ATTRIBUTES.forEach(function(r){return e.unbindAttribute(r,i,!0)})):this.ATTRIBUTES.forEach(function(r){return e.unbindAttribute(r,i)})}},{key:"bindAttribute",value:function(i,e,r,a){var o=kn[i.type];if(typeof o!="number")throw new Error('Program.bind: yet unsupported attribute type "'.concat(i.type,'"'));var s=e.attributeLocations[i.name],u=e.gl;if(s!==-1){u.enableVertexAttribArray(s);var h=this.isInstanced?(a?this.ATTRIBUTES_ITEMS_COUNT:nt(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(u.vertexAttribPointer(s,i.size,i.type,i.normalized||!1,h,r),this.isInstanced&&a)if(u instanceof WebGL2RenderingContext)u.vertexAttribDivisor(s,1);else{var d=u.getExtension("ANGLE_instanced_arrays");d&&d.vertexAttribDivisorANGLE(s,1)}}return i.size*o}},{key:"unbindAttribute",value:function(i,e,r){var a=e.attributeLocations[i.name],o=e.gl;if(a!==-1&&(o.disableVertexAttribArray(a),this.isInstanced&&r))if(o instanceof WebGL2RenderingContext)o.vertexAttribDivisor(a,0);else{var s=o.getExtension("ANGLE_instanced_arrays");s&&s.vertexAttribDivisorANGLE(a,0)}}},{key:"reallocate",value:function(i){i!==this.capacity&&(this.capacity=i,this.verticesCount=this.VERTICES*i,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:"hasNothingToRender",value:function(){return this.verticesCount===0}},{key:"renderProgram",value:function(i,e){var r=e.gl,a=e.program;r.enable(r.BLEND),r.useProgram(a),this.setUniforms(i,e),this.drawWebGL(this.METHOD,e)}},{key:"render",value:function(i){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,i.width*i.pixelRatio/i.downSizingRatio,i.height*i.pixelRatio/i.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(A(A({},i),{},{pixelRatio:i.pixelRatio/i.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,i.width*i.pixelRatio,i.height*i.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(i,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:"drawWebGL",value:function(i,e){var r=e.gl,a=e.frameBuffer;if(r.bindFramebuffer(r.FRAMEBUFFER,a),!this.isInstanced)r.drawArrays(i,0,this.verticesCount);else if(r instanceof WebGL2RenderingContext)r.drawArraysInstanced(i,0,this.VERTICES,this.capacity);else{var o=r.getExtension("ANGLE_instanced_arrays");o&&o.drawArraysInstancedANGLE(i,0,this.VERTICES,this.capacity)}}}])})(),Ln=(function(n){function t(){return O(this,t),q(this,t,arguments)}return Y(t,n),$(t,[{key:"kill",value:function(){Oi(t,"kill",this)([])}},{key:"process",value:function(e,r,a){var o=r*this.STRIDE;if(a.hidden){for(var s=o+this.STRIDE;o<s;o++)this.array[o]=0;return}return this.processVisibleItem(Ui(e),o,a)}}])})(zi),_t=(function(n){function t(){var i;O(this,t);for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return i=q(this,t,[].concat(r)),m(i,"drawLabel",void 0),i}return Y(t,n),$(t,[{key:"kill",value:function(){Oi(t,"kill",this)([])}},{key:"process",value:function(e,r,a,o,s){var u=r*this.STRIDE;if(s.hidden||a.hidden||o.hidden){for(var h=u+this.STRIDE;u<h;u++)this.array[u]=0;return}return this.processVisibleItem(Ui(e),u,a,o,s)}}])})(zi);function Dn(n,t){return(function(){function i(e,r,a){O(this,i),m(this,"drawLabel",t),this.programs=n.map(function(o){return new o(e,r,a)})}return $(i,[{key:"reallocate",value:function(r){this.programs.forEach(function(a){return a.reallocate(r)})}},{key:"process",value:function(r,a,o,s,u){this.programs.forEach(function(h){return h.process(r,a,o,s,u)})}},{key:"render",value:function(r){this.programs.forEach(function(a){return a.render(r)})}},{key:"kill",value:function(){this.programs.forEach(function(r){return r.kill()})}}])})()}function Gn(n,t,i,e,r){var a=r.edgeLabelSize,o=r.edgeLabelFont,s=r.edgeLabelWeight,u=r.edgeLabelColor.attribute?t[r.edgeLabelColor.attribute]||r.edgeLabelColor.color||"#000":r.edgeLabelColor.color,h=t.label;if(h){n.fillStyle=u,n.font="".concat(s," ").concat(a,"px ").concat(o);var d=i.size,l=e.size,c=i.x,f=i.y,p=e.x,y=e.y,_=(c+p)/2,R=(f+y)/2,T=p-c,x=y-f,g=Math.sqrt(T*T+x*x);if(!(g<d+l)){c+=T*d/g,f+=x*d/g,p-=T*l/g,y-=x*l/g,_=(c+p)/2,R=(f+y)/2,T=p-c,x=y-f,g=Math.sqrt(T*T+x*x);var v=n.measureText(h).width;if(v>g){var b="…";for(h=h+b,v=n.measureText(h).width;v>g&&h.length>1;)h=h.slice(0,-2)+b,v=n.measureText(h).width;if(h.length<4)return}var w;T>0?x>0?w=Math.acos(T/g):w=Math.asin(x/g):x>0?w=Math.acos(T/g)+Math.PI:w=Math.asin(T/g)+Math.PI/2,n.save(),n.translate(_,R),n.rotate(w),n.fillText(h,-v/2,t.size/2+a),n.restore()}}}function Bi(n,t,i){if(t.label){var e=i.labelSize,r=i.labelFont,a=i.labelWeight,o=i.labelColor.attribute?t[i.labelColor.attribute]||i.labelColor.color||"#000":i.labelColor.color;n.fillStyle=o,n.font="".concat(a," ").concat(e,"px ").concat(r),n.fillText(t.label,t.x+t.size+3,t.y+e/3)}}function Nn(n,t,i){var e=i.labelSize,r=i.labelFont,a=i.labelWeight;n.font="".concat(a," ").concat(e,"px ").concat(r),n.fillStyle="#FFF",n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=8,n.shadowColor="#000";var o=2;if(typeof t.label=="string"){var s=n.measureText(t.label).width,u=Math.round(s+5),h=Math.round(e+2*o),d=Math.max(t.size,e/2)+o,l=Math.asin(h/2/d),c=Math.sqrt(Math.abs(Math.pow(d,2)-Math.pow(h/2,2)));n.beginPath(),n.moveTo(t.x+c,t.y+h/2),n.lineTo(t.x+d+u,t.y+h/2),n.lineTo(t.x+d+u,t.y-h/2),n.lineTo(t.x+c,t.y-h/2),n.arc(t.x,t.y,d,l,-l),n.closePath(),n.fill()}else n.beginPath(),n.arc(t.x,t.y,t.size+o,0,Math.PI*2),n.closePath(),n.fill();n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=0,Bi(n,t,i)}var Fn=`
|
|
6
|
+
precision highp float;
|
|
7
|
+
|
|
8
|
+
varying vec4 v_color;
|
|
9
|
+
varying vec2 v_diffVector;
|
|
10
|
+
varying float v_radius;
|
|
11
|
+
|
|
12
|
+
uniform float u_correctionRatio;
|
|
13
|
+
|
|
14
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
15
|
+
|
|
16
|
+
void main(void) {
|
|
17
|
+
float border = u_correctionRatio * 2.0;
|
|
18
|
+
float dist = length(v_diffVector) - v_radius + border;
|
|
19
|
+
|
|
20
|
+
// No antialiasing for picking mode:
|
|
21
|
+
#ifdef PICKING_MODE
|
|
22
|
+
if (dist > border)
|
|
23
|
+
gl_FragColor = transparent;
|
|
24
|
+
else
|
|
25
|
+
gl_FragColor = v_color;
|
|
26
|
+
|
|
27
|
+
#else
|
|
28
|
+
float t = 0.0;
|
|
29
|
+
if (dist > border)
|
|
30
|
+
t = 1.0;
|
|
31
|
+
else if (dist > 0.0)
|
|
32
|
+
t = dist / border;
|
|
33
|
+
|
|
34
|
+
gl_FragColor = mix(v_color, transparent, t);
|
|
35
|
+
#endif
|
|
36
|
+
}
|
|
37
|
+
`,Pn=Fn,In=`
|
|
38
|
+
attribute vec4 a_id;
|
|
39
|
+
attribute vec4 a_color;
|
|
40
|
+
attribute vec2 a_position;
|
|
41
|
+
attribute float a_size;
|
|
42
|
+
attribute float a_angle;
|
|
43
|
+
|
|
44
|
+
uniform mat3 u_matrix;
|
|
45
|
+
uniform float u_sizeRatio;
|
|
46
|
+
uniform float u_correctionRatio;
|
|
47
|
+
|
|
48
|
+
varying vec4 v_color;
|
|
49
|
+
varying vec2 v_diffVector;
|
|
50
|
+
varying float v_radius;
|
|
51
|
+
varying float v_border;
|
|
52
|
+
|
|
53
|
+
const float bias = 255.0 / 254.0;
|
|
54
|
+
|
|
55
|
+
void main() {
|
|
56
|
+
float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
|
|
57
|
+
vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
|
|
58
|
+
vec2 position = a_position + diffVector;
|
|
59
|
+
gl_Position = vec4(
|
|
60
|
+
(u_matrix * vec3(position, 1)).xy,
|
|
61
|
+
0,
|
|
62
|
+
1
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
v_diffVector = diffVector;
|
|
66
|
+
v_radius = size / 2.0;
|
|
67
|
+
|
|
68
|
+
#ifdef PICKING_MODE
|
|
69
|
+
// For picking mode, we use the ID as the color:
|
|
70
|
+
v_color = a_id;
|
|
71
|
+
#else
|
|
72
|
+
// For normal mode, we use the color:
|
|
73
|
+
v_color = a_color;
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
v_color.a *= bias;
|
|
77
|
+
}
|
|
78
|
+
`,Mn=In,Hi=WebGLRenderingContext,Zt=Hi.UNSIGNED_BYTE,at=Hi.FLOAT,Un=["u_sizeRatio","u_correctionRatio","u_matrix"],Ve=(function(n){function t(){return O(this,t),q(this,t,arguments)}return Y(t,n),$(t,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Mn,FRAGMENT_SHADER_SOURCE:Pn,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Un,ATTRIBUTES:[{name:"a_position",size:2,type:at},{name:"a_size",size:1,type:at},{name:"a_color",size:4,type:Zt,normalized:!0},{name:"a_id",size:4,type:Zt,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:at}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:"processVisibleItem",value:function(e,r,a){var o=this.array,s=ke(a.color);o[r++]=a.x,o[r++]=a.y,o[r++]=a.size,o[r++]=s,o[r++]=e}},{key:"setUniforms",value:function(e,r){var a=r.gl,o=r.uniformLocations,s=o.u_sizeRatio,u=o.u_correctionRatio,h=o.u_matrix;a.uniform1f(u,e.correctionRatio),a.uniform1f(s,e.sizeRatio),a.uniformMatrix3fv(h,!1,e.matrix)}}])})(Ln);m(Ve,"ANGLE_1",0);m(Ve,"ANGLE_2",2*Math.PI/3);m(Ve,"ANGLE_3",4*Math.PI/3);var On=`
|
|
79
|
+
precision mediump float;
|
|
80
|
+
|
|
81
|
+
varying vec4 v_color;
|
|
82
|
+
|
|
83
|
+
void main(void) {
|
|
84
|
+
gl_FragColor = v_color;
|
|
85
|
+
}
|
|
86
|
+
`,$n=On,zn=`
|
|
87
|
+
attribute vec2 a_position;
|
|
88
|
+
attribute vec2 a_normal;
|
|
89
|
+
attribute float a_radius;
|
|
90
|
+
attribute vec3 a_barycentric;
|
|
91
|
+
|
|
92
|
+
#ifdef PICKING_MODE
|
|
93
|
+
attribute vec4 a_id;
|
|
94
|
+
#else
|
|
95
|
+
attribute vec4 a_color;
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
uniform mat3 u_matrix;
|
|
99
|
+
uniform float u_sizeRatio;
|
|
100
|
+
uniform float u_correctionRatio;
|
|
101
|
+
uniform float u_minEdgeThickness;
|
|
102
|
+
uniform float u_lengthToThicknessRatio;
|
|
103
|
+
uniform float u_widenessToThicknessRatio;
|
|
104
|
+
|
|
105
|
+
varying vec4 v_color;
|
|
106
|
+
|
|
107
|
+
const float bias = 255.0 / 254.0;
|
|
108
|
+
|
|
109
|
+
void main() {
|
|
110
|
+
float minThickness = u_minEdgeThickness;
|
|
111
|
+
|
|
112
|
+
float normalLength = length(a_normal);
|
|
113
|
+
vec2 unitNormal = a_normal / normalLength;
|
|
114
|
+
|
|
115
|
+
// These first computations are taken from edge.vert.glsl and
|
|
116
|
+
// edge.clamped.vert.glsl. Please read it to get better comments on what's
|
|
117
|
+
// happening:
|
|
118
|
+
float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);
|
|
119
|
+
float webGLThickness = pixelsThickness * u_correctionRatio;
|
|
120
|
+
float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
121
|
+
float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
122
|
+
float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;
|
|
123
|
+
|
|
124
|
+
float da = a_barycentric.x;
|
|
125
|
+
float db = a_barycentric.y;
|
|
126
|
+
float dc = a_barycentric.z;
|
|
127
|
+
|
|
128
|
+
vec2 delta = vec2(
|
|
129
|
+
da * (webGLNodeRadius * unitNormal.y)
|
|
130
|
+
+ db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)
|
|
131
|
+
+ dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),
|
|
132
|
+
|
|
133
|
+
da * (-webGLNodeRadius * unitNormal.x)
|
|
134
|
+
+ db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)
|
|
135
|
+
+ dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;
|
|
139
|
+
|
|
140
|
+
gl_Position = vec4(position, 0, 1);
|
|
141
|
+
|
|
142
|
+
#ifdef PICKING_MODE
|
|
143
|
+
// For picking mode, we use the ID as the color:
|
|
144
|
+
v_color = a_id;
|
|
145
|
+
#else
|
|
146
|
+
// For normal mode, we use the color:
|
|
147
|
+
v_color = a_color;
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
v_color.a *= bias;
|
|
151
|
+
}
|
|
152
|
+
`,Bn=zn,Wi=WebGLRenderingContext,Xt=Wi.UNSIGNED_BYTE,ze=Wi.FLOAT,Hn=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],ji={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function Vi(n){var t=A(A({},ji),{});return(function(i){function e(){return O(this,e),q(this,e,arguments)}return Y(e,i),$(e,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Bn,FRAGMENT_SHADER_SOURCE:$n,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Hn,ATTRIBUTES:[{name:"a_position",size:2,type:ze},{name:"a_normal",size:2,type:ze},{name:"a_radius",size:1,type:ze},{name:"a_color",size:4,type:Xt,normalized:!0},{name:"a_id",size:4,type:Xt,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:ze}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(a,o,s,u,h){if(t.extremity==="source"){var d=[u,s];s=d[0],u=d[1]}var l=h.size||1,c=u.size||1,f=s.x,p=s.y,y=u.x,_=u.y,R=ke(h.color),T=y-f,x=_-p,g=T*T+x*x,v=0,b=0;g&&(g=1/Math.sqrt(g),v=-x*g*l,b=T*g*l);var w=this.array;w[o++]=y,w[o++]=_,w[o++]=-v,w[o++]=-b,w[o++]=c,w[o++]=R,w[o++]=a}},{key:"setUniforms",value:function(a,o){var s=o.gl,u=o.uniformLocations,h=u.u_matrix,d=u.u_sizeRatio,l=u.u_correctionRatio,c=u.u_minEdgeThickness,f=u.u_lengthToThicknessRatio,p=u.u_widenessToThicknessRatio;s.uniformMatrix3fv(h,!1,a.matrix),s.uniform1f(d,a.sizeRatio),s.uniform1f(l,a.correctionRatio),s.uniform1f(c,a.minEdgeThickness),s.uniform1f(f,t.lengthToThicknessRatio),s.uniform1f(p,t.widenessToThicknessRatio)}}])})(_t)}Vi();var Wn=`
|
|
153
|
+
precision mediump float;
|
|
154
|
+
|
|
155
|
+
varying vec4 v_color;
|
|
156
|
+
varying vec2 v_normal;
|
|
157
|
+
varying float v_thickness;
|
|
158
|
+
varying float v_feather;
|
|
159
|
+
|
|
160
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
161
|
+
|
|
162
|
+
void main(void) {
|
|
163
|
+
// We only handle antialiasing for normal mode:
|
|
164
|
+
#ifdef PICKING_MODE
|
|
165
|
+
gl_FragColor = v_color;
|
|
166
|
+
#else
|
|
167
|
+
float dist = length(v_normal) * v_thickness;
|
|
168
|
+
|
|
169
|
+
float t = smoothstep(
|
|
170
|
+
v_thickness - v_feather,
|
|
171
|
+
v_thickness,
|
|
172
|
+
dist
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
gl_FragColor = mix(v_color, transparent, t);
|
|
176
|
+
#endif
|
|
177
|
+
}
|
|
178
|
+
`,qi=Wn,jn=`
|
|
179
|
+
attribute vec4 a_id;
|
|
180
|
+
attribute vec4 a_color;
|
|
181
|
+
attribute vec2 a_normal;
|
|
182
|
+
attribute float a_normalCoef;
|
|
183
|
+
attribute vec2 a_positionStart;
|
|
184
|
+
attribute vec2 a_positionEnd;
|
|
185
|
+
attribute float a_positionCoef;
|
|
186
|
+
attribute float a_radius;
|
|
187
|
+
attribute float a_radiusCoef;
|
|
188
|
+
|
|
189
|
+
uniform mat3 u_matrix;
|
|
190
|
+
uniform float u_zoomRatio;
|
|
191
|
+
uniform float u_sizeRatio;
|
|
192
|
+
uniform float u_pixelRatio;
|
|
193
|
+
uniform float u_correctionRatio;
|
|
194
|
+
uniform float u_minEdgeThickness;
|
|
195
|
+
uniform float u_lengthToThicknessRatio;
|
|
196
|
+
uniform float u_feather;
|
|
197
|
+
|
|
198
|
+
varying vec4 v_color;
|
|
199
|
+
varying vec2 v_normal;
|
|
200
|
+
varying float v_thickness;
|
|
201
|
+
varying float v_feather;
|
|
202
|
+
|
|
203
|
+
const float bias = 255.0 / 254.0;
|
|
204
|
+
|
|
205
|
+
void main() {
|
|
206
|
+
float minThickness = u_minEdgeThickness;
|
|
207
|
+
|
|
208
|
+
float radius = a_radius * a_radiusCoef;
|
|
209
|
+
vec2 normal = a_normal * a_normalCoef;
|
|
210
|
+
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
211
|
+
|
|
212
|
+
float normalLength = length(normal);
|
|
213
|
+
vec2 unitNormal = normal / normalLength;
|
|
214
|
+
|
|
215
|
+
// These first computations are taken from edge.vert.glsl. Please read it to
|
|
216
|
+
// get better comments on what's happening:
|
|
217
|
+
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
218
|
+
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
219
|
+
|
|
220
|
+
// Here, we move the point to leave space for the arrow head:
|
|
221
|
+
float direction = sign(radius);
|
|
222
|
+
float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
223
|
+
float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
224
|
+
|
|
225
|
+
vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);
|
|
226
|
+
|
|
227
|
+
// Here is the proper position of the vertex
|
|
228
|
+
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);
|
|
229
|
+
|
|
230
|
+
v_thickness = webGLThickness / u_zoomRatio;
|
|
231
|
+
|
|
232
|
+
v_normal = unitNormal;
|
|
233
|
+
|
|
234
|
+
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
235
|
+
|
|
236
|
+
#ifdef PICKING_MODE
|
|
237
|
+
// For picking mode, we use the ID as the color:
|
|
238
|
+
v_color = a_id;
|
|
239
|
+
#else
|
|
240
|
+
// For normal mode, we use the color:
|
|
241
|
+
v_color = a_color;
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
v_color.a *= bias;
|
|
245
|
+
}
|
|
246
|
+
`,Vn=jn,Yi=WebGLRenderingContext,Jt=Yi.UNSIGNED_BYTE,he=Yi.FLOAT,qn=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],Yn={lengthToThicknessRatio:ji.lengthToThicknessRatio};function Ki(n){var t=A(A({},Yn),{});return(function(i){function e(){return O(this,e),q(this,e,arguments)}return Y(e,i),$(e,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Vn,FRAGMENT_SHADER_SOURCE:qi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:qn,ATTRIBUTES:[{name:"a_positionStart",size:2,type:he},{name:"a_positionEnd",size:2,type:he},{name:"a_normal",size:2,type:he},{name:"a_color",size:4,type:Jt,normalized:!0},{name:"a_id",size:4,type:Jt,normalized:!0},{name:"a_radius",size:1,type:he}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:he},{name:"a_normalCoef",size:1,type:he},{name:"a_radiusCoef",size:1,type:he}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(a,o,s,u,h){var d=h.size||1,l=s.x,c=s.y,f=u.x,p=u.y,y=ke(h.color),_=f-l,R=p-c,T=u.size||1,x=_*_+R*R,g=0,v=0;x&&(x=1/Math.sqrt(x),g=-R*x*d,v=_*x*d);var b=this.array;b[o++]=l,b[o++]=c,b[o++]=f,b[o++]=p,b[o++]=g,b[o++]=v,b[o++]=y,b[o++]=a,b[o++]=T}},{key:"setUniforms",value:function(a,o){var s=o.gl,u=o.uniformLocations,h=u.u_matrix,d=u.u_zoomRatio,l=u.u_feather,c=u.u_pixelRatio,f=u.u_correctionRatio,p=u.u_sizeRatio,y=u.u_minEdgeThickness,_=u.u_lengthToThicknessRatio;s.uniformMatrix3fv(h,!1,a.matrix),s.uniform1f(d,a.zoomRatio),s.uniform1f(p,a.sizeRatio),s.uniform1f(f,a.correctionRatio),s.uniform1f(c,a.pixelRatio),s.uniform1f(l,a.antiAliasingFeather),s.uniform1f(y,a.minEdgeThickness),s.uniform1f(_,t.lengthToThicknessRatio)}}])})(_t)}Ki();function Kn(n){return Dn([Ki(),Vi()])}var Zn=Kn(),Xn=Zn,Jn=`
|
|
247
|
+
attribute vec4 a_id;
|
|
248
|
+
attribute vec4 a_color;
|
|
249
|
+
attribute vec2 a_normal;
|
|
250
|
+
attribute float a_normalCoef;
|
|
251
|
+
attribute vec2 a_positionStart;
|
|
252
|
+
attribute vec2 a_positionEnd;
|
|
253
|
+
attribute float a_positionCoef;
|
|
254
|
+
|
|
255
|
+
uniform mat3 u_matrix;
|
|
256
|
+
uniform float u_sizeRatio;
|
|
257
|
+
uniform float u_zoomRatio;
|
|
258
|
+
uniform float u_pixelRatio;
|
|
259
|
+
uniform float u_correctionRatio;
|
|
260
|
+
uniform float u_minEdgeThickness;
|
|
261
|
+
uniform float u_feather;
|
|
262
|
+
|
|
263
|
+
varying vec4 v_color;
|
|
264
|
+
varying vec2 v_normal;
|
|
265
|
+
varying float v_thickness;
|
|
266
|
+
varying float v_feather;
|
|
267
|
+
|
|
268
|
+
const float bias = 255.0 / 254.0;
|
|
269
|
+
|
|
270
|
+
void main() {
|
|
271
|
+
float minThickness = u_minEdgeThickness;
|
|
272
|
+
|
|
273
|
+
vec2 normal = a_normal * a_normalCoef;
|
|
274
|
+
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
275
|
+
|
|
276
|
+
float normalLength = length(normal);
|
|
277
|
+
vec2 unitNormal = normal / normalLength;
|
|
278
|
+
|
|
279
|
+
// We require edges to be at least "minThickness" pixels thick *on screen*
|
|
280
|
+
// (so we need to compensate the size ratio):
|
|
281
|
+
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
282
|
+
|
|
283
|
+
// Then, we need to retrieve the normalized thickness of the edge in the WebGL
|
|
284
|
+
// referential (in a ([0, 1], [0, 1]) space), using our "magic" correction
|
|
285
|
+
// ratio:
|
|
286
|
+
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
287
|
+
|
|
288
|
+
// Here is the proper position of the vertex
|
|
289
|
+
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);
|
|
290
|
+
|
|
291
|
+
// For the fragment shader though, we need a thickness that takes the "magic"
|
|
292
|
+
// correction ratio into account (as in webGLThickness), but so that the
|
|
293
|
+
// antialiasing effect does not depend on the zoom level. So here's yet
|
|
294
|
+
// another thickness version:
|
|
295
|
+
v_thickness = webGLThickness / u_zoomRatio;
|
|
296
|
+
|
|
297
|
+
v_normal = unitNormal;
|
|
298
|
+
|
|
299
|
+
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
300
|
+
|
|
301
|
+
#ifdef PICKING_MODE
|
|
302
|
+
// For picking mode, we use the ID as the color:
|
|
303
|
+
v_color = a_id;
|
|
304
|
+
#else
|
|
305
|
+
// For normal mode, we use the color:
|
|
306
|
+
v_color = a_color;
|
|
307
|
+
#endif
|
|
308
|
+
|
|
309
|
+
v_color.a *= bias;
|
|
310
|
+
}
|
|
311
|
+
`,Qn=Jn,Zi=WebGLRenderingContext,Qt=Zi.UNSIGNED_BYTE,xe=Zi.FLOAT,ea=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],ta=(function(n){function t(){return O(this,t),q(this,t,arguments)}return Y(t,n),$(t,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Qn,FRAGMENT_SHADER_SOURCE:qi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:ea,ATTRIBUTES:[{name:"a_positionStart",size:2,type:xe},{name:"a_positionEnd",size:2,type:xe},{name:"a_normal",size:2,type:xe},{name:"a_color",size:4,type:Qt,normalized:!0},{name:"a_id",size:4,type:Qt,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:xe},{name:"a_normalCoef",size:1,type:xe}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(e,r,a,o,s){var u=s.size||1,h=a.x,d=a.y,l=o.x,c=o.y,f=ke(s.color),p=l-h,y=c-d,_=p*p+y*y,R=0,T=0;_&&(_=1/Math.sqrt(_),R=-y*_*u,T=p*_*u);var x=this.array;x[r++]=h,x[r++]=d,x[r++]=l,x[r++]=c,x[r++]=R,x[r++]=T,x[r++]=f,x[r++]=e}},{key:"setUniforms",value:function(e,r){var a=r.gl,o=r.uniformLocations,s=o.u_matrix,u=o.u_zoomRatio,h=o.u_feather,d=o.u_pixelRatio,l=o.u_correctionRatio,c=o.u_sizeRatio,f=o.u_minEdgeThickness;a.uniformMatrix3fv(s,!1,e.matrix),a.uniform1f(u,e.zoomRatio),a.uniform1f(c,e.sizeRatio),a.uniform1f(l,e.correctionRatio),a.uniform1f(d,e.pixelRatio),a.uniform1f(h,e.antiAliasingFeather),a.uniform1f(f,e.minEdgeThickness)}}])})(_t),xt=(function(n){function t(){var i;return O(this,t),i=q(this,t),i.rawEmitter=i,i}return Y(t,n),$(t)})(vi.EventEmitter),ia=Ni();const ra=Ce(ia);var na=function(t){return t},aa=function(t){return t*t},oa=function(t){return t*(2-t)},sa=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},ua=function(t){return t*t*t},ha=function(t){return--t*t*t+1},da=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},Xi={linear:na,quadraticIn:aa,quadraticOut:oa,quadraticInOut:sa,cubicIn:ua,cubicOut:ha,cubicInOut:da},Ji={easing:"quadraticInOut",duration:150};function za(n,t,i,e){var r=Object.assign({},Ji,i),a=typeof r.easing=="function"?r.easing:Xi[r.easing],o=Date.now(),s={};for(var u in t){var h=t[u];s[u]={};for(var d in h)s[u][d]=n.getNodeAttribute(u,d)}var l=null,c=function(){l=null;var p=(Date.now()-o)/r.duration;if(p>=1){for(var y in t){var _=t[y];for(var R in _)n.setNodeAttribute(y,R,_[R])}typeof e=="function"&&e();return}p=a(p);for(var T in t){var x=t[T],g=s[T];for(var v in x)n.setNodeAttribute(T,v,x[v]*p+g[v]*(1-p))}l=requestAnimationFrame(c)};return c(),function(){l&&cancelAnimationFrame(l)}}function te(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function Be(n,t,i){return n[0]=t,n[4]=typeof i=="number"?i:t,n}function ei(n,t){var i=Math.sin(t),e=Math.cos(t);return n[0]=e,n[1]=i,n[3]=-i,n[4]=e,n}function ti(n,t,i){return n[6]=t,n[7]=i,n}function ue(n,t){var i=n[0],e=n[1],r=n[2],a=n[3],o=n[4],s=n[5],u=n[6],h=n[7],d=n[8],l=t[0],c=t[1],f=t[2],p=t[3],y=t[4],_=t[5],R=t[6],T=t[7],x=t[8];return n[0]=l*i+c*a+f*u,n[1]=l*e+c*o+f*h,n[2]=l*r+c*s+f*d,n[3]=p*i+y*a+_*u,n[4]=p*e+y*o+_*h,n[5]=p*r+y*s+_*d,n[6]=R*i+T*a+x*u,n[7]=R*e+T*o+x*h,n[8]=R*r+T*s+x*d,n}function pt(n,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=n[0],r=n[1],a=n[3],o=n[4],s=n[6],u=n[7],h=t.x,d=t.y;return{x:h*e+d*a+s*i,y:h*r+d*o+u*i}}function la(n,t){var i=n.height/n.width,e=t.height/t.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function Te(n,t,i,e,r){var a=n.angle,o=n.ratio,s=n.x,u=n.y,h=t.width,d=t.height,l=te(),c=Math.min(h,d)-2*e,f=la(t,i);return r?(ue(l,ti(te(),s,u)),ue(l,Be(te(),o)),ue(l,ei(te(),a)),ue(l,Be(te(),h/c/2/f,d/c/2/f))):(ue(l,Be(te(),2*(c/h)*f,2*(c/d)*f)),ue(l,ei(te(),-a)),ue(l,Be(te(),1/o)),ue(l,ti(te(),-s,-u))),l}function ca(n,t,i){var e=pt(n,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),r=e.x,a=e.y;return 1/Math.sqrt(Math.pow(r,2)+Math.pow(a,2))/i.width}function fa(n){if(!n.order)return{x:[0,1],y:[0,1]};var t=1/0,i=-1/0,e=1/0,r=-1/0;return n.forEachNode(function(a,o){var s=o.x,u=o.y;s<t&&(t=s),s>i&&(i=s),u<e&&(e=u),u>r&&(r=u)}),{x:[t,i],y:[e,r]}}function ga(n){if(!ra(n))throw new Error("Sigma: invalid graph instance.");n.forEachNode(function(t,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(t," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function pa(n,t,i){var e=document.createElement(n);if(t)for(var r in t)e.style[r]=t[r];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function ii(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ri(n,t,i){return i.sort(function(e,r){var a=t(e)||0,o=t(r)||0;return a<o?-1:a>o?1:0})}function ni(n){var t=ve(n.x,2),i=t[0],e=t[1],r=ve(n.y,2),a=r[0],o=r[1],s=Math.max(e-i,o-a),u=(e+i)/2,h=(o+a)/2;(s===0||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(u)&&(u=0),isNaN(h)&&(h=0);var d=function(c){return{x:.5+(c.x-u)/s,y:.5+(c.y-h)/s}};return d.applyTo=function(l){l.x=.5+(l.x-u)/s,l.y=.5+(l.y-h)/s},d.inverse=function(l){return{x:u+s*(l.x-.5),y:h+s*(l.y-.5)}},d.ratio=s,d}function vt(n){"@babel/helpers - typeof";return vt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vt(n)}function ai(n,t){var i=t.size;if(i!==0){var e=n.length;n.length+=i;var r=0;t.forEach(function(a){n[e+r]=a,r++})}}function ot(n){n=n||{};for(var t=0,i=arguments.length<=1?0:arguments.length-1;t<i;t++){var e=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];e&&Object.assign(n,e)}return n}var Tt={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Gn,defaultDrawNodeLabel:Bi,defaultDrawNodeHover:Nn,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},va={circle:Ve},ma={arrow:Xn,line:ta};function st(n){if(typeof n.labelDensity!="number"||n.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=n.minCameraRatio,i=n.maxCameraRatio;if(typeof t=="number"&&typeof i=="number"&&i<t)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function ya(n){var t=ot({},Tt,n);return t.nodeProgramClasses=ot({},va,t.nodeProgramClasses),t.edgeProgramClasses=ot({},ma,t.edgeProgramClasses),t}var He=1.5,oi=(function(n){function t(){var i;return O(this,t),i=q(this,t),m(i,"x",.5),m(i,"y",.5),m(i,"angle",0),m(i,"ratio",1),m(i,"minRatio",null),m(i,"maxRatio",null),m(i,"enabledZooming",!0),m(i,"enabledPanning",!0),m(i,"enabledRotation",!0),m(i,"clean",null),m(i,"nextFrame",null),m(i,"previousState",null),m(i,"enabled",!0),i.previousState=i.getState(),i}return Y(t,n),$(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var r=e;return typeof this.minRatio=="number"&&(r=Math.max(r,this.minRatio)),typeof this.maxRatio=="number"&&(r=Math.min(r,this.maxRatio)),r}},{key:"validateState",value:function(e){var r={};return this.enabledPanning&&typeof e.x=="number"&&(r.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(r.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(r.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(r.angle=e.angle),this.clean?this.clean(A(A({},this.getState()),r)):r}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var r=this.validateState(e);return typeof r.x=="number"&&(this.x=r.x),typeof r.y=="number"&&(this.y=r.y),typeof r.ratio=="number"&&(this.ratio=r.ratio),typeof r.angle=="number"&&(this.angle=r.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(!o)return new Promise(function(f){return r.animate(e,a,f)});if(this.enabled){var s=A(A({},Ji),a),u=this.validateState(e),h=typeof s.easing=="function"?s.easing:Xi[s.easing],d=Date.now(),l=this.getState(),c=function(){var p=(Date.now()-d)/s.duration;if(p>=1){r.nextFrame=null,r.setState(u),r.animationCallback&&(r.animationCallback.call(null),r.animationCallback=void 0);return}var y=h(p),_={};typeof u.x=="number"&&(_.x=l.x+(u.x-l.x)*y),typeof u.y=="number"&&(_.y=l.y+(u.y-l.y)*y),r.enabledRotation&&typeof u.angle=="number"&&(_.angle=l.angle+(u.angle-l.angle)*y),typeof u.ratio=="number"&&(_.ratio=l.ratio+(u.ratio-l.ratio)*y),r.setState(_),r.nextFrame=requestAnimationFrame(c)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(c)):c(),this.animationCallback=o}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||He)},e):this.animate({ratio:this.ratio/He})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||He)},e):this.animate({ratio:this.ratio*He})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return t.from(this.getState())}}],[{key:"from",value:function(e){var r=new t;return r.setState(e)}}])})(xt);function ie(n,t){var i=t.getBoundingClientRect();return{x:n.clientX-i.left,y:n.clientY-i.top}}function ne(n,t){var i=A(A({},ie(n,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:n});return i}function Se(n){var t="x"in n?n:A(A({},n.touches[0]||n.previousTouches[0]),{},{original:n.original,sigmaDefaultPrevented:n.sigmaDefaultPrevented,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function ba(n,t){return A(A({},ne(n,t)),{},{delta:Qi(n)})}var wa=2;function We(n){for(var t=[],i=0,e=Math.min(n.length,wa);i<e;i++)t.push(n[i]);return t}function Ae(n,t,i){var e={touches:We(n.touches).map(function(r){return ie(r,i)}),previousTouches:t.map(function(r){return ie(r,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:n};return e}function Qi(n){if(typeof n.deltaY<"u")return n.deltaY*-3/360;if(typeof n.detail<"u")return n.detail/-9;throw new Error("Captor: could not extract delta from event.")}var er=(function(n){function t(i,e){var r;return O(this,t),r=q(this,t),r.container=i,r.renderer=e,r}return Y(t,n),$(t)})(xt),Ea=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],_a=Ea.reduce(function(n,t){return A(A({},n),{},m({},t,Tt[t]))},{}),xa=(function(n){function t(i,e){var r;return O(this,t),r=q(this,t,[i,e]),m(r,"enabled",!0),m(r,"draggedEvents",0),m(r,"downStartTime",null),m(r,"lastMouseX",null),m(r,"lastMouseY",null),m(r,"isMouseDown",!1),m(r,"isMoving",!1),m(r,"movingTimeout",null),m(r,"startCameraState",null),m(r,"clicks",0),m(r,"doubleClickTimeout",null),m(r,"currentWheelDirection",0),m(r,"settings",_a),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),i.addEventListener("click",r.handleClick,{capture:!1}),i.addEventListener("contextmenu",r.handleRightClick,{capture:!1}),i.addEventListener("mousedown",r.handleDown,{capture:!1}),i.addEventListener("wheel",r.handleWheel,{capture:!1}),i.addEventListener("mouseleave",r.handleLeave,{capture:!1}),i.addEventListener("mouseenter",r.handleEnter,{capture:!1}),document.addEventListener("mousemove",r.handleMove,{capture:!1}),document.addEventListener("mouseup",r.handleUp,{capture:!1}),r}return Y(t,n),$(t,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var r=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){r.clicks=0,r.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",ne(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",ne(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var r=ne(e,this.container);if(this.emit("doubleClick",r),!r.sigmaDefaultPrevented){var a=this.renderer.getCamera(),o=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(ie(e,this.container),o),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var r=ie(e,this.container),a=r.x,o=r.y;this.lastMouseX=a,this.lastMouseY=o,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",ne(e,this.container))}}},{key:"handleUp",value:function(e){var r=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var o=ie(e,this.container),s=o.x,u=o.y,h=a.getState(),d=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:h.x+this.settings.inertiaRatio*(h.x-d.x),y:h.y+this.settings.inertiaRatio*(h.y-d.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==s||this.lastMouseY!==u)&&a.setState({x:h.x,y:h.y}),this.isMoving=!1,setTimeout(function(){var l=r.draggedEvents>0;r.draggedEvents=0,l&&r.renderer.getSetting("hideEdgesOnMove")&&r.renderer.refresh()},0),this.emit("mouseup",ne(e,this.container))}}},{key:"handleMove",value:function(e){var r=this;if(this.enabled){var a=ne(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){r.movingTimeout=null,r.isMoving=!1},this.settings.dragTimeout);var o=this.renderer.getCamera(),s=ie(e,this.container),u=s.x,h=s.y,d=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),l=this.renderer.viewportToFramedGraph({x:u,y:h}),c=d.x-l.x,f=d.y-l.y,p=o.getState(),y=p.x+c,_=p.y+f;o.setState({x:y,y:_}),this.lastMouseX=u,this.lastMouseY=h,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",ne(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",ne(e,this.container))}},{key:"handleWheel",value:function(e){var r=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var o=Qi(e);if(o){var s=ba(e,this.container);if(this.emit("wheel",s),s.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var u=a.getState().ratio,h=o>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,d=a.getBoundedRatio(u*h),l=o>0?1:-1,c=Date.now();u!==d&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===l&&this.lastWheelTriggerTime&&c-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(ie(e,this.container),d),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){r.currentWheelDirection=0}),this.currentWheelDirection=l,this.lastWheelTriggerTime=c))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(er),Ta=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],Sa=Ta.reduce(function(n,t){return A(A({},n),{},m({},t,Tt[t]))},{}),Aa=(function(n){function t(i,e){var r;return O(this,t),r=q(this,t,[i,e]),m(r,"enabled",!0),m(r,"isMoving",!1),m(r,"hasMoved",!1),m(r,"touchMode",0),m(r,"startTouchesPositions",[]),m(r,"lastTouches",[]),m(r,"lastTap",null),m(r,"settings",Sa),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),i.addEventListener("touchstart",r.handleStart,{capture:!1}),i.addEventListener("touchcancel",r.handleLeave,{capture:!1}),document.addEventListener("touchend",r.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",r.handleMove,{capture:!1,passive:!1}),r}return Y(t,n),$(t,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var r=this;if(this.enabled){e.preventDefault();var a=We(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return ie(f,r.container)}),this.touchMode===2){var o=ve(this.startTouchesPositions,2),s=o[0],u=s.x,h=s.y,d=o[1],l=d.x,c=d.y;this.startTouchesAngle=Math.atan2(c-h,l-u),this.startTouchesDistance=Math.sqrt(Math.pow(l-u,2)+Math.pow(c-h,2))}this.emit("touchdown",Ae(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var r=this.renderer.getCamera(),a=r.getState(),o=r.getPreviousState()||{x:0,y:0};r.animate({x:a.x+this.settings.inertiaRatio*(a.x-o.x),y:a.y+this.settings.inertiaRatio*(a.y-o.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",Ae(e,this.lastTouches,this.container)),!e.touches.length){var s=ie(this.lastTouches[0],this.container),u=this.startTouchesPositions[0],h=Math.pow(s.x-u.x,2)+Math.pow(s.y-u.y,2);if(!e.touches.length&&h<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var d=Ae(e,this.lastTouches,this.container);if(this.emit("doubletap",d),this.lastTap=null,!d.sigmaDefaultPrevented){var l=this.renderer.getCamera(),c=l.getBoundedRatio(l.getState().ratio/this.settings.doubleClickZoomingRatio);l.animate(this.renderer.getViewportZoomedState(s,c),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=Ae(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=We(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var r=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=We(e.touches),o=a.map(function(J){return ie(J,r.container)}),s=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=o;var u=Ae(e,s,this.container);if(this.emit("touchmove",u),!u.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=o.some(function(J,le){var H=r.startTouchesPositions[le];return H&&(J.x!==H.x||J.y!==H.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){r.isMoving=!1},this.settings.dragTimeout);var h=this.renderer.getCamera(),d=this.startCameraState,l=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var c=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=c.x,p=c.y,y=this.renderer.viewportToFramedGraph(o[0]),_=y.x,R=y.y;h.setState({x:d.x+f-_,y:d.y+p-R});break}case 2:{var T={x:.5,y:.5,angle:0,ratio:1},x=o[0],g=x.x,v=x.y,b=o[1],w=b.x,k=b.y,D=Math.atan2(k-v,w-g)-this.startTouchesAngle,C=Math.hypot(k-v,w-g)/this.startTouchesDistance,G=h.getBoundedRatio(d.ratio/C);T.ratio=G,T.angle=d.angle+D;var N=this.getDimensions(),z=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:d}),P=Math.min(N.width,N.height)-2*l,B=P/N.width,K=P/N.height,re=G/P,Z=g-P/2/B,U=v-P/2/K,X=[Z*Math.cos(-T.angle)-U*Math.sin(-T.angle),U*Math.cos(-T.angle)+Z*Math.sin(-T.angle)];Z=X[0],U=X[1],T.x=z.x-Z*re,T.y=z.y+U*re,h.setState(T);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(er);function Ra(n){if(Array.isArray(n))return ft(n)}function Ca(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function ka(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
312
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function si(n){return Ra(n)||Ca(n)||Pi(n)||ka()}function La(n,t){if(n==null)return{};var i={};for(var e in n)if({}.hasOwnProperty.call(n,e)){if(t.indexOf(e)!==-1)continue;i[e]=n[e]}return i}function ut(n,t){if(n==null)return{};var i,e,r=La(n,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(e=0;e<a.length;e++)i=a[e],t.indexOf(i)===-1&&{}.propertyIsEnumerable.call(n,i)&&(r[i]=n[i])}return r}var ui=(function(){function n(t,i){O(this,n),this.key=t,this.size=i}return $(n,null,[{key:"compare",value:function(i,e){return i.size>e.size?-1:i.size<e.size||i.key>e.key?1:-1}}])})(),hi=(function(){function n(){O(this,n),m(this,"width",0),m(this,"height",0),m(this,"cellSize",0),m(this,"columns",0),m(this,"rows",0),m(this,"cells",{})}return $(n,[{key:"resizeAndClear",value:function(i,e){this.width=i.width,this.height=i.height,this.cellSize=e,this.columns=Math.ceil(i.width/e),this.rows=Math.ceil(i.height/e),this.cells={}}},{key:"getIndex",value:function(i){var e=Math.floor(i.x/this.cellSize),r=Math.floor(i.y/this.cellSize);return r*this.columns+e}},{key:"add",value:function(i,e,r){var a=new ui(i,e),o=this.getIndex(r),s=this.cells[o];s||(s=[],this.cells[o]=s),s.push(a)}},{key:"organize",value:function(){for(var i in this.cells){var e=this.cells[i];e.sort(ui.compare)}}},{key:"getLabelsToDisplay",value:function(i,e){var r=this.cellSize*this.cellSize,a=r/i/i,o=a*e/r,s=Math.ceil(o),u=[];for(var h in this.cells)for(var d=this.cells[h],l=0;l<Math.min(s,d.length);l++)u.push(d[l].key);return u}}])})();function Da(n){var t=n.graph,i=n.hoveredNode,e=n.highlightedNodes,r=n.displayedNodeLabels,a=[];return t.forEachEdge(function(o,s,u,h){(u===i||h===i||e.has(u)||e.has(h)||r.has(u)&&r.has(h))&&a.push(o)}),a}var di=150,li=50,ae=Object.prototype.hasOwnProperty;function Ga(n,t,i){if(!ae.call(i,"x")||!ae.call(i,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(t,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return i.color||(i.color=n.defaultNodeColor),!i.label&&i.label!==""&&(i.label=null),i.label!==void 0&&i.label!==null?i.label=""+i.label:i.label=null,i.size||(i.size=2),ae.call(i,"hidden")||(i.hidden=!1),ae.call(i,"highlighted")||(i.highlighted=!1),ae.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=n.defaultNodeType),i.zIndex||(i.zIndex=0),i}function Na(n,t,i){return i.color||(i.color=n.defaultEdgeColor),i.label||(i.label=""),i.size||(i.size=.5),ae.call(i,"hidden")||(i.hidden=!1),ae.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=n.defaultEdgeType),i.zIndex||(i.zIndex=0),i}var Fa=(function(n){function t(i,e){var r,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(O(this,t),r=q(this,t),m(r,"elements",{}),m(r,"canvasContexts",{}),m(r,"webGLContexts",{}),m(r,"pickingLayers",new Set),m(r,"textures",{}),m(r,"frameBuffers",{}),m(r,"activeListeners",{}),m(r,"labelGrid",new hi),m(r,"nodeDataCache",{}),m(r,"edgeDataCache",{}),m(r,"nodeProgramIndex",{}),m(r,"edgeProgramIndex",{}),m(r,"nodesWithForcedLabels",new Set),m(r,"edgesWithForcedLabels",new Set),m(r,"nodeExtent",{x:[0,1],y:[0,1]}),m(r,"nodeZExtent",[1/0,-1/0]),m(r,"edgeZExtent",[1/0,-1/0]),m(r,"matrix",te()),m(r,"invMatrix",te()),m(r,"correctionRatio",1),m(r,"customBBox",null),m(r,"normalizationFunction",ni({x:[0,1],y:[0,1]})),m(r,"graphToViewportRatio",1),m(r,"itemIDsIndex",{}),m(r,"nodeIndices",{}),m(r,"edgeIndices",{}),m(r,"width",0),m(r,"height",0),m(r,"pixelRatio",ii()),m(r,"pickingDownSizingRatio",2*r.pixelRatio),m(r,"displayedNodeLabels",new Set),m(r,"displayedEdgeLabels",new Set),m(r,"highlightedNodes",new Set),m(r,"hoveredNode",null),m(r,"hoveredEdge",null),m(r,"renderFrame",null),m(r,"renderHighlightedNodesFrame",null),m(r,"needToProcess",!1),m(r,"checkEdgesEventsFrame",null),m(r,"nodePrograms",{}),m(r,"nodeHoverPrograms",{}),m(r,"edgePrograms",{}),r.settings=ya(a),st(r.settings),ga(i),!(e instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");r.graph=i,r.container=e,r.createWebGLContext("edges",{picking:a.enableEdgeEvents}),r.createCanvasContext("edgeLabels"),r.createWebGLContext("nodes",{picking:!0}),r.createCanvasContext("labels"),r.createCanvasContext("hovers"),r.createWebGLContext("hoverNodes"),r.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),r.resize();for(var o in r.settings.nodeProgramClasses)r.registerNodeProgram(o,r.settings.nodeProgramClasses[o],r.settings.nodeHoverProgramClasses[o]);for(var s in r.settings.edgeProgramClasses)r.registerEdgeProgram(s,r.settings.edgeProgramClasses[s]);return r.camera=new oi,r.bindCameraHandlers(),r.mouseCaptor=new xa(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Aa(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return Y(t,n),$(t,[{key:"registerNodeProgram",value:function(e,r,a){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new r(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(a||r)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,r){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new r(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(e){if(this.nodePrograms[e]){var r=this.nodePrograms,a=r[e],o=ut(r,[e].map(Re));a.kill(),this.nodePrograms=o}if(this.nodeHoverPrograms[e]){var s=this.nodeHoverPrograms,u=s[e],h=ut(s,[e].map(Re));u.kill(),this.nodePrograms=h}return this}},{key:"unregisterEdgeProgram",value:function(e){if(this.edgePrograms[e]){var r=this.edgePrograms,a=r[e],o=ut(r,[e].map(Re));a.kill(),this.edgePrograms=o}return this}},{key:"resetWebGLTexture",value:function(e){var r=this.webGLContexts[e],a=this.frameBuffers[e],o=this.textures[e];o&&r.deleteTexture(o);var s=r.createTexture();return r.bindFramebuffer(r.FRAMEBUFFER,a),r.bindTexture(r.TEXTURE_2D,s),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.width,this.height,0,r.RGBA,r.UNSIGNED_BYTE,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,s,0),this.textures[e]=s,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var r=e.x,a=e.y,o=Vt(this.webGLContexts.nodes,this.frameBuffers.nodes,r,a,this.pixelRatio,this.pickingDownSizingRatio),s=jt.apply(void 0,si(o)),u=this.itemIDsIndex[s];return u&&u.type==="node"?u.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(a){var o=Se(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}},u=e.getNodeAtPosition(o);if(u&&e.hoveredNode!==u&&!e.nodeDataCache[u].hidden){e.hoveredNode&&e.emit("leaveNode",A(A({},s),{},{node:e.hoveredNode})),e.hoveredNode=u,e.emit("enterNode",A(A({},s),{},{node:u})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(o)!==e.hoveredNode){var h=e.hoveredNode;e.hoveredNode=null,e.emit("leaveNode",A(A({},s),{},{node:h})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var d=e.hoveredNode?null:e.getEdgeAtPoint(s.event.x,s.event.y);d!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",A(A({},s),{},{edge:e.hoveredEdge})),d&&e.emit("enterEdge",A(A({},s),{},{edge:d})),e.hoveredEdge=d)}},this.activeListeners.handleMoveBody=function(a){var o=Se(a);e.emit("moveBody",{event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(a){var o=Se(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",A(A({},s),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",A(A({},s),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",A({},s))},this.activeListeners.handleEnter=function(a){var o=Se(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}};e.emit("enterStage",A({},s))};var r=function(o){return function(s){var u=Se(s),h={event:u,preventSigmaDefault:function(){u.preventSigmaDefault()}},d=e.getNodeAtPosition(u);if(d)return e.emit("".concat(o,"Node"),A(A({},h),{},{node:d}));if(e.settings.enableEdgeEvents){var l=e.getEdgeAtPoint(u.x,u.y);if(l)return e.emit("".concat(o,"Edge"),A(A({},h),{},{edge:l}))}return e.emit("".concat(o,"Stage"),h)}};return this.activeListeners.handleClick=r("click"),this.activeListeners.handleRightClick=r("rightClick"),this.activeListeners.handleDoubleClick=r("doubleClick"),this.activeListeners.handleWheel=r("wheel"),this.activeListeners.handleDown=r("down"),this.activeListeners.handleUp=r("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,r=this.graph,a=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(o){var s,u=(s=o.hints)===null||s===void 0?void 0:s.attributes;e.graph.forEachNode(function(d){return e.updateNode(d)});var h=!u||u.some(function(d){return a.has(d)});e.refresh({partialGraph:{nodes:r.nodes()},skipIndexation:!h,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(o){var s,u=(s=o.hints)===null||s===void 0?void 0:s.attributes;e.graph.forEachEdge(function(d){return e.updateEdge(d)});var h=u&&["zIndex","type"].some(function(d){return u==null?void 0:u.includes(d)});e.refresh({partialGraph:{edges:r.edges()},skipIndexation:!h,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(o){var s=o.key;e.addNode(s),e.refresh({partialGraph:{nodes:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(o){var s=o.key;e.refresh({partialGraph:{nodes:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(o){var s=o.key;e.removeNode(s),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(o){var s=o.key;e.addEdge(s),e.refresh({partialGraph:{edges:[s]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(o){var s=o.key;e.refresh({partialGraph:{edges:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(o){var s=o.key;e.removeEdge(s),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},r.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),r.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),r.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),r.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),r.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),r.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),r.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),r.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),r.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),r.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,r){var a=Vt(this.webGLContexts.edges,this.frameBuffers.edges,e,r,this.pixelRatio,this.pickingDownSizingRatio),o=jt.apply(void 0,si(a)),s=this.itemIDsIndex[o];return s&&s.type==="edge"?s.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var r=this.graph,a=this.settings,o=this.getDimensions();if(this.nodeExtent=fa(this.graph),!this.settings.autoRescale){var s=o.width,u=o.height,h=this.nodeExtent,d=h.x,l=h.y;this.nodeExtent={x:[(d[0]+d[1])/2-s/2,(d[0]+d[1])/2+s/2],y:[(l[0]+l[1])/2-u/2,(l[0]+l[1])/2+u/2]}}this.normalizationFunction=ni(this.customBBox||this.nodeExtent);var c=new oi,f=Te(c.getState(),o,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(o,a.labelGridCellSize);for(var p={},y={},_={},R={},T=1,x=r.nodes(),g=0,v=x.length;g<v;g++){var b=x[g],w=this.nodeDataCache[b],k=r.getNodeAttributes(b);w.x=k.x,w.y=k.y,this.normalizationFunction.applyTo(w),typeof w.label=="string"&&!w.hidden&&this.labelGrid.add(b,w.size,this.framedGraphToViewport(w,{matrix:f})),p[w.type]=(p[w.type]||0)+1}this.labelGrid.organize();for(var D in this.nodePrograms){if(!ae.call(this.nodePrograms,D))throw new Error('Sigma: could not find a suitable program for node type "'.concat(D,'"!'));this.nodePrograms[D].reallocate(p[D]||0),p[D]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(x=ri(this.nodeZExtent,function(ce){return e.nodeDataCache[ce].zIndex},x));for(var C=0,G=x.length;C<G;C++){var N=x[C];y[N]=T,R[y[N]]={type:"node",id:N},T++;var z=this.nodeDataCache[N];this.addNodeToProgram(N,y[N],p[z.type]++)}for(var P={},B=r.edges(),K=0,re=B.length;K<re;K++){var Z=B[K],U=this.edgeDataCache[Z];P[U.type]=(P[U.type]||0)+1}this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(B=ri(this.edgeZExtent,function(ce){return e.edgeDataCache[ce].zIndex},B));for(var X in this.edgePrograms){if(!ae.call(this.edgePrograms,X))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(X,'"!'));this.edgePrograms[X].reallocate(P[X]||0),P[X]=0}for(var J=0,le=B.length;J<le;J++){var H=B[J];_[H]=T,R[_[H]]={type:"edge",id:H},T++;var Le=this.edgeDataCache[H];this.addEdgeToProgram(H,_[H],P[Le.type]++)}return this.itemIDsIndex=R,this.nodeIndices=y,this.edgeIndices=_,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var r=this,a=this.settings;if(this.camera.minRatio=a.minCameraRatio,this.camera.maxRatio=a.maxCameraRatio,this.camera.enabledZooming=a.enableCameraZooming,this.camera.enabledPanning=a.enableCameraPanning,this.camera.enabledRotation=a.enableCameraRotation,a.cameraPanBoundaries?this.camera.clean=function(d){return r.cleanCameraState(d,a.cameraPanBoundaries&&vt(a.cameraPanBoundaries)==="object"?a.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==a.edgeProgramClasses){for(var o in a.edgeProgramClasses)a.edgeProgramClasses[o]!==e.edgeProgramClasses[o]&&this.registerEdgeProgram(o,a.edgeProgramClasses[o]);for(var s in e.edgeProgramClasses)a.edgeProgramClasses[s]||this.unregisterEdgeProgram(s)}if(e.nodeProgramClasses!==a.nodeProgramClasses||e.nodeHoverProgramClasses!==a.nodeHoverProgramClasses){for(var u in a.nodeProgramClasses)(a.nodeProgramClasses[u]!==e.nodeProgramClasses[u]||a.nodeHoverProgramClasses[u]!==e.nodeHoverProgramClasses[u])&&this.registerNodeProgram(u,a.nodeProgramClasses[u],a.nodeHoverProgramClasses[u]);for(var h in e.nodeProgramClasses)a.nodeProgramClasses[h]||this.unregisterNodeProgram(h)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=r.tolerance,o=a===void 0?0:a,s=r.boundaries,u=A({},e),h=s||this.nodeExtent,d=ve(h.x,2),l=d[0],c=d[1],f=ve(h.y,2),p=f[0],y=f[1],_=[this.graphToViewport({x:l,y:p},{cameraState:e}),this.graphToViewport({x:c,y:p},{cameraState:e}),this.graphToViewport({x:l,y},{cameraState:e}),this.graphToViewport({x:c,y},{cameraState:e})],R=1/0,T=-1/0,x=1/0,g=-1/0;_.forEach(function(P){var B=P.x,K=P.y;R=Math.min(R,B),T=Math.max(T,B),x=Math.min(x,K),g=Math.max(g,K)});var v=T-R,b=g-x,w=this.getDimensions(),k=w.width,D=w.height,C=0,G=0;if(v>=k?T<k-o?C=T-(k-o):R>o&&(C=R-o):T>k+o?C=T-(k+o):R<-o&&(C=R+o),b>=D?g<D-o?G=g-(D-o):x>o&&(G=x-o):g>D+o?G=g-(D+o):x<-o&&(G=x+o),C||G){var N=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),z=this.viewportToFramedGraph({x:C,y:G},{cameraState:e});C=z.x-N.x,G=z.y-N.y,u.x+=C,u.y+=G}return u}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),r=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);ai(r,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var a=this.canvasContexts.labels,o=0,s=r.length;o<s;o++){var u=r[o],h=this.nodeDataCache[u];if(!this.displayedNodeLabels.has(u)&&!h.hidden){var d=this.framedGraphToViewport(h),l=d.x,c=d.y,f=this.scaleSize(h.size);if(!(!h.forceLabel&&f<this.settings.labelRenderedSizeThreshold)&&!(l<-di||l>this.width+di||c<-li||c>this.height+li)){this.displayedNodeLabels.add(u);var p=this.settings.defaultDrawNodeLabel,y=this.nodePrograms[h.type],_=(y==null?void 0:y.drawLabel)||p;_(a,A(A({key:u},h),{},{size:f,x:l,y:c}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var r=Da({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});ai(r,this.edgesWithForcedLabels);for(var a=new Set,o=0,s=r.length;o<s;o++){var u=r[o],h=this.graph.extremities(u),d=this.nodeDataCache[h[0]],l=this.nodeDataCache[h[1]],c=this.edgeDataCache[u];if(!a.has(u)&&!(c.hidden||d.hidden||l.hidden)){var f=this.settings.defaultDrawEdgeLabel,p=this.edgePrograms[c.type],y=(p==null?void 0:p.drawLabel)||f;y(e,A(A({key:u},c),{},{size:this.scaleSize(c.size)}),A(A(A({key:h[0]},d),this.framedGraphToViewport(d)),{},{size:this.scaleSize(d.size)}),A(A(A({key:h[1]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),this.settings),a.add(u)}}return this.displayedEdgeLabels=a,this}},{key:"renderHighlightedNodes",value:function(){var e=this,r=this.canvasContexts.hovers;r.clearRect(0,0,this.width,this.height);var a=function(f){var p=e.nodeDataCache[f],y=e.framedGraphToViewport(p),_=y.x,R=y.y,T=e.scaleSize(p.size),x=e.settings.defaultDrawNodeHover,g=e.nodePrograms[p.type],v=(g==null?void 0:g.drawHover)||x;v(r,A(A({key:f},p),{},{size:T,x:_,y:R}),e.settings)},o=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&o.push(this.hoveredNode),this.highlightedNodes.forEach(function(c){c!==e.hoveredNode&&o.push(c)}),o.forEach(function(c){return a(c)});var s={};o.forEach(function(c){var f=e.nodeDataCache[c].type;s[f]=(s[f]||0)+1});for(var u in this.nodeHoverPrograms)this.nodeHoverPrograms[u].reallocate(s[u]||0),s[u]=0;o.forEach(function(c){var f=e.nodeDataCache[c];e.nodeHoverPrograms[f.type].process(0,s[f.type]++,f)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var h=this.getRenderParams();for(var d in this.nodeHoverPrograms){var l=this.nodeHoverPrograms[d];l.render(h)}}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var r=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(_){return e.resetWebGLTexture(_)}),!this.graph.order)return r();var a=this.mouseCaptor,o=this.camera.isAnimated()||a.isMoving||a.draggedEvents||a.currentWheelDirection,s=this.camera.getState(),u=this.getDimensions(),h=this.getGraphDimensions(),d=this.getStagePadding();this.matrix=Te(s,u,h,d),this.invMatrix=Te(s,u,h,d,!0),this.correctionRatio=ca(this.matrix,s,u),this.graphToViewportRatio=this.getGraphToViewportRatio();var l=this.getRenderParams();for(var c in this.nodePrograms){var f=this.nodePrograms[c];f.render(l)}if(!this.settings.hideEdgesOnMove||!o)for(var p in this.edgePrograms){var y=this.edgePrograms[p];y.render(l)}return this.settings.hideLabelsOnMove&&o||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),r()}},{key:"addNode",value:function(e){var r=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(r=this.settings.nodeReducer(e,r));var a=Ga(this.settings,e,r);this.nodeDataCache[e]=a,this.nodesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),a.highlighted&&!a.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(a.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=a.zIndex),a.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=a.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var r=this.nodeDataCache[e];this.normalizationFunction.applyTo(r)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var r=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(r=this.settings.edgeReducer(e,r));var a=Na(this.settings,e,r);this.edgeDataCache[e]=a,this.edgesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(a.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=a.zIndex),a.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=a.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new hi,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,r,a){var o=this.nodeDataCache[e],s=this.nodePrograms[o.type];if(!s)throw new Error('Sigma: could not find a suitable program for node type "'.concat(o.type,'"!'));s.process(r,a,o),this.nodeProgramIndex[e]=a}},{key:"addEdgeToProgram",value:function(e,r,a){var o=this.edgeDataCache[e],s=this.edgePrograms[o.type];if(!s)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(o.type,'"!'));var u=this.graph.extremities(e),h=this.nodeDataCache[u[0]],d=this.nodeDataCache[u[1]];s.process(r,a,h,d,o),this.edgeProgramIndex[e]=a}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,r=e.stagePadding,a=e.autoRescale;return a&&r||0}},{key:"createLayer",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var o=pa(r,{position:"absolute"},{class:"sigma-".concat(e)});return a.style&&Object.assign(o.style,a.style),this.elements[e]=o,"beforeLayer"in a&&a.beforeLayer?this.elements[a.beforeLayer].before(o):"afterLayer"in a&&a.afterLayer?this.elements[a.afterLayer].after(o):this.container.appendChild(o),o}},{key:"createCanvas",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,"canvas",r)}},{key:"createCanvasContext",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.createCanvas(e,r),o={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=a.getContext("2d",o),this}},{key:"createWebGLContext",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(r==null?void 0:r.canvas)||this.createCanvas(e,r);r.hidden&&a.remove();var o=A({preserveDrawingBuffer:!1,antialias:!1},r),s;s=a.getContext("webgl2",o),s||(s=a.getContext("webgl",o)),s||(s=a.getContext("experimental-webgl",o));var u=s;if(this.webGLContexts[e]=u,u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA),r.picking){this.pickingLayers.add(e);var h=u.createFramebuffer();if(!h)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=h}return u}},{key:"killLayer",value:function(e){var r=this.elements[e];if(!r)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));if(this.webGLContexts[e]){var a,o=this.webGLContexts[e];(a=o.getExtension("WEBGL_lose_context"))===null||a===void 0||a.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return r.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var r=this.nodeDataCache[e];return r?Object.assign({},r):void 0}},{key:"getEdgeDisplayData",value:function(e){var r=this.edgeDataCache[e];return r?Object.assign({},r):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return A({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,r){var a=A({},this.settings);return this.settings[e]=r,st(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,r){return this.setSetting(e,r(this.settings[e])),this}},{key:"setSettings",value:function(e){var r=A({},this.settings);return this.settings=A(A({},this.settings),e),st(this.settings),this.handleSettingsUpdate(r),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var r=this.width,a=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=ii(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!e&&r===this.width&&a===this.height)return this;for(var o in this.elements){var s=this.elements[o];s.style.width=this.width+"px",s.style.height=this.height+"px"}for(var u in this.canvasContexts)this.elements[u].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[u].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[u].scale(this.pixelRatio,this.pixelRatio);for(var h in this.webGLContexts){this.elements[h].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[h].setAttribute("height",this.height*this.pixelRatio+"px");var d=this.webGLContexts[h];if(d.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(h)){var l=this.textures[h];l&&d.deleteTexture(l)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var r=this,a=(e==null?void 0:e.skipIndexation)!==void 0?e==null?void 0:e.skipIndexation:!1,o=(e==null?void 0:e.schedule)!==void 0?e.schedule:!1,s=!e||!e.partialGraph;if(s)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(g){return r.addNode(g)}),this.graph.forEachEdge(function(g){return r.addEdge(g)});else{for(var u,h,d=((u=e.partialGraph)===null||u===void 0?void 0:u.nodes)||[],l=0,c=(d==null?void 0:d.length)||0;l<c;l++){var f=d[l];if(this.updateNode(f),a){var p=this.nodeProgramIndex[f];if(p===void 0)throw new Error('Sigma: node "'.concat(f,`" can't be repaint`));this.addNodeToProgram(f,this.nodeIndices[f],p)}}for(var y=(e==null||(h=e.partialGraph)===null||h===void 0?void 0:h.edges)||[],_=0,R=y.length;_<R;_++){var T=y[_];if(this.updateEdge(T),a){var x=this.edgeProgramIndex[T];if(x===void 0)throw new Error('Sigma: edge "'.concat(T,`" can't be repaint`));this.addEdgeToProgram(T,this.edgeIndices[T],x)}}}return(s||!a)&&(this.needToProcess=!0),o?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame(function(){e.render()})),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(A(A({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,r){var a=this.camera.getState(),o=a.ratio,s=a.angle,u=a.x,h=a.y,d=this.settings,l=d.minCameraRatio,c=d.maxCameraRatio;typeof c=="number"&&(r=Math.min(r,c)),typeof l=="number"&&(r=Math.max(r,l));var f=r/o,p={x:this.width/2,y:this.height/2},y=this.viewportToFramedGraph(e),_=this.viewportToFramedGraph(p);return{angle:s,x:(y.x-_.x)*(1-f)+u,y:(y.y-_.y)*(1-f)+h,ratio:r}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),r=this.viewportToFramedGraph({x:this.width,y:0}),a=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:r.x,y2:r.y,height:r.y-a.y}}},{key:"framedGraphToViewport",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!r.cameraState||!!r.viewportDimensions||!!r.graphDimensions,o=r.matrix?r.matrix:a?Te(r.cameraState||this.camera.getState(),r.viewportDimensions||this.getDimensions(),r.graphDimensions||this.getGraphDimensions(),r.padding||this.getStagePadding()):this.matrix,s=pt(o,e);return{x:(1+s.x)*this.width/2,y:(1-s.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!r.cameraState||!!r.viewportDimensions||!r.graphDimensions,o=r.matrix?r.matrix:a?Te(r.cameraState||this.camera.getState(),r.viewportDimensions||this.getDimensions(),r.graphDimensions||this.getGraphDimensions(),r.padding||this.getStagePadding(),!0):this.invMatrix,s=pt(o,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(s.x)&&(s.x=0),isNaN(s.y)&&(s.y=0),s}},{key:"viewportToGraph",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,r))}},{key:"graphToViewport",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),r)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},r={x:1,y:1},a=Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)),o=this.graphToViewport(e),s=this.graphToViewport(r),u=Math.sqrt(Math.pow(o.x-s.x,2)+Math.pow(o.y-s.y,2));return u/a}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var r in this.nodePrograms)this.nodePrograms[r].kill();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].kill();for(var o in this.edgePrograms)this.edgePrograms[o].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var s in this.elements)this.killLayer(s);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:"scaleSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(r)*(this.getSetting("itemSizesReference")==="positions"?r*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var r in this.elements)this.elements[r]instanceof HTMLCanvasElement&&(e[r]=this.elements[r]);return e}}])})(xt),Ba=Fa,ht,ci;function Pa(){if(ci)return ht;ci=1;var n=0,t=1,i=2,e=3;function r(o,s){return o+"§"+s}function a(){return .01*(.5-Math.random())}return ht=function(s,u){var h=s.margin,d=s.ratio,l=s.expansion,c=s.gridSize,f=s.speed,p,y,_,R,T,x,g=!0,v=u.length,b=v/e|0,w=new Float32Array(b),k=new Float32Array(b),D=1/0,C=1/0,G=-1/0,N=-1/0;for(p=0;p<v;p+=e)_=u[p+n],R=u[p+t],x=u[p+i]*d+h,D=Math.min(D,_-x),G=Math.max(G,_+x),C=Math.min(C,R-x),N=Math.max(N,R+x);var z=G-D,P=N-C,B=(D+G)/2,K=(C+N)/2;D=B-l*z/2,G=B+l*z/2,C=K-l*P/2,N=K+l*P/2;var re=new Array(c*c),Z=re.length,U;for(U=0;U<Z;U++)re[U]=[];var X,J,le,H,Le,ce,St,At,De,Ge;for(p=0;p<v;p+=e)for(_=u[p+n],R=u[p+t],x=u[p+i]*d+h,X=_-x,J=_+x,le=R-x,H=R+x,Le=Math.floor(c*(X-D)/(G-D)),ce=Math.floor(c*(J-D)/(G-D)),St=Math.floor(c*(le-C)/(N-C)),At=Math.floor(c*(H-C)/(N-C)),De=Le;De<=ce;De++)for(Ge=St;Ge<=At;Ge++)re[De*c+Ge].push(p);var Ne,Rt=new Set,be,Q,Ct,kt,Lt,Dt,Fe,Gt,qe,Pe,Ie,we,Nt;for(U=0;U<Z;U++)for(Ne=re[U],p=0,T=Ne.length;p<T;p++)for(be=Ne[p],Ct=u[be+n],Lt=u[be+t],Fe=u[be+i],y=p+1;y<T;y++)Q=Ne[y],qe=r(be,Q),!(Z>1&&Rt.has(qe))&&(Z>1&&Rt.add(qe),kt=u[Q+n],Dt=u[Q+t],Gt=u[Q+i],Pe=kt-Ct,Ie=Dt-Lt,we=Math.sqrt(Pe*Pe+Ie*Ie),Nt=we<Fe*d+h+(Gt*d+h),Nt&&(g=!1,Q=Q/e|0,we>0?(w[Q]+=Pe/we*(1+Fe),k[Q]+=Ie/we*(1+Fe)):(w[Q]+=z*a(),k[Q]+=P*a())));for(p=0,y=0;p<v;p+=e,y++)u[p+n]+=w[y]*.1*f,u[p+t]+=k[y]*.1*f;return{converged:g}},ht}var de={},fi;function Ia(){if(fi)return de;fi=1;var n=3;return de.validateSettings=function(t){return"gridSize"in t&&typeof t.gridSize!="number"||t.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in t&&typeof t.margin!="number"||t.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in t&&typeof t.expansion!="number"||t.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in t&&typeof t.ratio!="number"||t.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in t&&typeof t.speed!="number"||t.speed<=0?{message:"the `speed` setting should be a positive number."}:null},de.graphToByteArray=function(t,i){var e=t.order,r=new Float32Array(e*n),a=0;return t.forEachNode(function(o,s){typeof i=="function"&&(s=i(o,s)),r[a]=s.x,r[a+1]=s.y,r[a+2]=s.size||1,a+=n}),r},de.assignLayoutChanges=function(t,i,e){var r=0;t.forEachNode(function(a){var o={x:i[r],y:i[r+1]};typeof e=="function"&&(o=e(a,o)),t.mergeNodeAttributes(a,o),r+=n})},de.collectLayoutChanges=function(t,i,e){var r={},a=0;return t.forEachNode(function(o){var s={x:i[a],y:i[a+1]};typeof e=="function"&&(s=e(o,s)),r[o]=s,a+=n}),r},de.createWorker=function(i){var e=window.URL||window.webkitURL,r=i.toString(),a=e.createObjectURL(new Blob(["("+r+").call(this);"],{type:"text/javascript"})),o=new Worker(a);return e.revokeObjectURL(a),o},de}var dt,gi;function Ma(){return gi||(gi=1,dt={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),dt}var lt,pi;function Ua(){if(pi)return lt;pi=1;var n=Ni(),t=Pa(),i=Ia(),e=Ma(),r=500;function a(s,u,h){if(!n(u))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof h=="number"?h={maxIterations:h}:h=h||{};var d=h.maxIterations||r;if(typeof d!="number"||d<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var l=Object.assign({},e,h.settings),c=i.validateSettings(l);if(c)throw new Error("graphology-layout-noverlap: "+c.message);var f=i.graphToByteArray(u,h.inputReducer),p=!1,y;for(y=0;y<d&&!p;y++)p=t(l,f).converged;if(s){i.assignLayoutChanges(u,f,h.outputReducer);return}return i.collectLayoutChanges(u,f,h.outputReducer)}var o=a.bind(null,!1);return o.assign=a.bind(null,!0),lt=o,lt}var Oa=Ua();const Ha=Ce(Oa);export{ji as D,_t as E,F as G,Ln as N,Ba as S,za as a,vi as e,ke as f,Ha as n};
|