@datagrok/eda 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/980.js CHANGED
@@ -1,2 +1,2 @@
1
- var eda;(()=>{var t,e,n={6807:(t,e,n)=>{"use strict";var r;!function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(r||(r={}));const i={[r.EUCLIDEAN]:function(t){return`\n var sum = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[r.MANHATTAN]:function(t){return`\n var sum = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var o;!function(t){t.HAMMING="Hamming",t.EUCLIDEAN="Euclidean",t.MANHATTAN="Manhattan",t.TANIMOTO="Tanimoto",t.LEVENSTEIN="Levenshtein",t.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",t.SOKAL="Sokal",t.COSINE="Cosine",t.ASYMMETRIC="Asymmetric",t.Difference="Difference",t.OneHot="One-Hot"}(o||(o={}));const a={[o.HAMMING]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${t};\n `},[o.EUCLIDEAN]:function(t,e){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[o.MANHATTAN]:function(t,e){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[o.TANIMOTO]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[o.LEVENSTEIN]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${t+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[o.NEEDLEMAN_WUNSCH]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${t+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${t+1}u>;\n var horizontalGaps: array<u32, ${t+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${e};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${e};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${e}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(minLength);\n\n `},[o.MONOMER_CHEMICAL_DISTANCE]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${e}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${t};\n `},[o.SOKAL]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[o.COSINE]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[o.ASYMMETRIC]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[o.Difference]:function(t,e){return`\n let range = suppInfo.range${e};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[o.OneHot]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},s={[o.HAMMING]:t=>Math.ceil(t/30),[o.EUCLIDEAN]:t=>Math.ceil(t/30),[o.MANHATTAN]:t=>Math.ceil(t/30),[o.TANIMOTO]:t=>Math.ceil(t/30),[o.SOKAL]:t=>Math.ceil(t/30),[o.COSINE]:t=>Math.ceil(t/30),[o.ASYMMETRIC]:t=>Math.ceil(t/30),[o.LEVENSTEIN]:t=>Math.ceil(t*t/60),[o.NEEDLEMAN_WUNSCH]:t=>Math.ceil(t*t/60),[o.MONOMER_CHEMICAL_DISTANCE]:t=>Math.ceil(t/25),[o.Difference]:t=>1,[o.OneHot]:t=>Math.ceil(t/40)},u={STRING:new Set([o.HAMMING,o.LEVENSTEIN,o.NEEDLEMAN_WUNSCH,o.MONOMER_CHEMICAL_DISTANCE,o.OneHot]),UINT32ARRAY:new Set([o.HAMMING,o.EUCLIDEAN,o.MANHATTAN,o.MONOMER_CHEMICAL_DISTANCE,o.LEVENSTEIN,o.NEEDLEMAN_WUNSCH,o.TANIMOTO,o.COSINE,o.SOKAL,o.ASYMMETRIC,o.OneHot,o.Difference]),INT32ARRAY:new Set([o.EUCLIDEAN,o.MANHATTAN,o.OneHot,o.Difference]),FLOAT32ARRAY:new Set([o.EUCLIDEAN,o.MANHATTAN,o.Difference]),NUMBER:new Set([o.EUCLIDEAN,o.MANHATTAN,o.Difference]),BITARRAY:new Set([o.TANIMOTO,o.COSINE,o.SOKAL,o.ASYMMETRIC])};let c=null,d=null;function h(t,e=.8,n,i,a,h){return p=this,l=void 0,y=function*(){const p=yield function(){return t=this,e=void 0,r=function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!c&&(c=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==c))return null;let t=!1;if(d&&(d.lost.then((()=>{t=!0})),yield new Promise((t=>setTimeout(t,10)))),!d||t){const t=1e9,e=c.limits,n=e.maxBufferSize,r=e.maxStorageBufferBindingSize;try{return d=yield c.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,t),maxStorageBufferBindingSize:Math.min(r,t)}}),d}catch(t){return console.error("Failed to create device with required limits",t),d=yield c.requestDevice(),d}}return d},new((n=void 0)||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r}();if(!p)return null;const l=Object.values(o);if(n.some((t=>!l.includes(t))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(r).includes(i))throw new Error("Invalid aggregation function provided: "+i);const g=1-e;if(h.length!==t.length||h.length!==n.length||h.length!==a.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(t.some((e=>e.length!==t[0].length)))throw new Error("All entry lists must be the same length");const y=t.length,m=t[0].length,w=t.map(((t,e)=>function(t,e=o.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,a;let c=null;const d=t.some((t=>"string"==typeof t))?(c="STRING",t.map((t=>new Uint32Array(t.split("").map((t=>t.charCodeAt(0))))))):t.some((t=>"number"==typeof t))?(c="NUMBER",t.map((t=>new Float32Array([t])))):"object"==typeof t[0]&&t.some((t=>"_data"in t&&"_length"in t))?(c="BITARRAY",t.map((t=>t._data))):t.some((t=>t instanceof Float32Array))?(c="FLOAT32ARRAY",t):t.some((t=>t instanceof Uint32Array))?(c="UINT32ARRAY",t):t.some((t=>t instanceof Int32Array))?(c="INT32ARRAY",t):void 0;if(!d||!c)throw new Error("Invalid entry type, could not determine entry type from input list");const h=d[0]instanceof Int32Array?"INT32ARRAY":d[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",f=new Uint32Array(d.map((t=>t.length)));if(!u[c]||!u[c].has(e))throw new Error(`Distance metric '${e}' not supported for entry type '${c}'`);const p=f.reduce(((t,e)=>Math.max(t,e)),0),l=s[e](p),g="INT32ARRAY"===h?Int32Array:"FLOAT32ARRAY"===h?Float32Array:Uint32Array,y=new g(d.length*p);d.forEach(((t,e)=>{y.set(t,e*p)}));let m="",w=0,b="FLOAT32ARRAY",v=null;if(e===o.NEEDLEMAN_WUNSCH||e===o.MONOMER_CHEMICAL_DISTANCE){let t=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((t,e)=>Math.max(t,e.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let e=0;e<y.length;e++)y[e]>t&&(t=y[e]);r.scoringMatrix=new Array(t+1).fill(null).map((()=>new Array(t+1).fill(0))),r.alphabetIndexes={};for(let t=0;t<r.scoringMatrix.length;t++)r.scoringMatrix[t][t]=1,r.alphabetIndexes[String.fromCharCode(t)]=t}const e=(t+1)*(t+1),o=new Array(t+1).fill(null).map((()=>new Float32Array(t+1)));for(let e=0;e<t+1;e++)o[e][e]=1;const s=r.alphabetIndexes;for(const t of Object.keys(s))for(const e of Object.keys(s))t!==e&&(o[t.charCodeAt(0)][e.charCodeAt(0)]=r.scoringMatrix[s[t]][s[e]]);w=2+e,b="FLOAT32ARRAY",v=new Float32Array(w),v[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,v[1]=null!==(a=r.gapExtensionPenalty)&&void 0!==a?a:.6;let u=2;for(let t=0;t<o.length;t++)v.set(o[t],u),u+=o[t].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${t+1}>, ${t+1}>`}else if(e===o.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const t=y.reduce(((t,e)=>Math.min(t,e)),y[0]),e=y.reduce(((t,e)=>Math.max(t,e)),y[0]);r.range=e-t}r.range<=0&&(r.range=1),w=1,b="FLOAT32ARRAY",v=new Float32Array([r.range]),m=`\n range${n}: f32`}const A=y instanceof Int32Array?"i32":y instanceof Float32Array?"f32":"u32",E=`data${n}: array<array<${A}, ${p}>, ${d.length}>`;return{flatSourceArray:y,sourceArraySize:y.length,maxEntryLen:p,arraySizes:f,complexity:l,suppInfoBuffer:v,suppInfoSize:w,suppInfoType:b,suppInfoStructWgsl:m,entryType:c,dataTypeWGSL:A,dataStructWgsl:E,EncodedArrayConstructor:g}}(t,n[e],e,h[e])));if(0===y)throw new Error("No columns provided. Please provide at least one column of data.");1===y&&(i=r.MANHATTAN);let b=w.map((t=>t.suppInfoStructWgsl)).filter((t=>!!t&&""!=t)).join(",\n"),v=!1;b&&""!=b.trim()||(v=!0,b="\ndummy: f32\n");const A=w.map((t=>t.dataStructWgsl)).filter((t=>!!t&&""!=t)).join(",\n"),E=new Uint32Array(y*m);w.forEach(((t,e)=>{E.set(t.arraySizes,e*m)}));const x=1e4,_=100,k=w.reduce(((t,e)=>t+e.complexity),0),G=Math.ceil(6e3/k),M=Math.ceil(Math.sqrt(Math.ceil(100))),L=10*M,S=m*(m-1)/2,I=Math.ceil(S/x),N=p.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${I} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${m}>, ${y}>,\n // the weights for each entry\n weights: array<f32, ${y}>,\n // the data for each entry\n ${A} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${b}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${v?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${L} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${m}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${m}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${G}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${g}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${m}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${f(n,w.map((t=>t.maxEntryLen)),g,i)}\n\n\n `}),U=p.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:N,entryPoint:"calcSparseMatrix"}}),D=new Uint32Array(x),C=new Uint32Array(x),O=new Uint32Array(x),R=new Uint32Array(x),j=Math.floor(S/x);let T=0,B=1;console.time("GPUthreadStarts");for(let t=0;t<x;t++){const e=9999===t?S-1:(t+1)*j,n=m-2-Math.floor(Math.sqrt(-8*e+4*m*(m-1)-7)/2-.5),r=e-m*n+Math.floor((n+1)*(n+2)/2);D[t]=B,C[t]=T,O[t]=r,R[t]=n,T=n,B=r}console.timeEnd("GPUthreadStarts");const P=4e4+m*y+y+w.reduce(((t,e)=>t+e.sourceArraySize),0),z=w.reduce(((t,e)=>t+e.suppInfoSize),0),$=1e6,W=P*Uint32Array.BYTES_PER_ELEMENT;let Y=W;const F=15&W;0!==F&&(Y+=16-F);const H=p.createBuffer({label:"compute info buffer",size:Y,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),q=H.getMappedRange();let K=0;new Uint32Array(q,K,x).set(D),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(C),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(O),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(R),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,E.length).set(E),K+=E.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(q,K,y).set(a),K+=y*Float32Array.BYTES_PER_ELEMENT;for(const t of w){const e=t.EncodedArrayConstructor,n=t.sourceArraySize;new e(q,K,n).set(t.flatSourceArray),K+=n*e.BYTES_PER_ELEMENT}H.unmap();const V=z*Uint32Array.BYTES_PER_ELEMENT;let X=V;const J=15&V;0!==J&&(X+=16-J),X=Math.max(X,16);const Q=p.createBuffer({label:"supp info buffer",size:X,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),Z=Q.getMappedRange();let tt=0;for(const t of w)t.suppInfoBuffer&&t.suppInfoBuffer.byteLength>0&&t.suppInfoSize>0&&(new("UINT32ARRAY"===t.suppInfoType?Uint32Array:Float32Array)(Z,tt,t.suppInfoBuffer.length).set(t.suppInfoBuffer),tt+=t.suppInfoBuffer.byteLength);0===tt&&new Uint32Array(Z,0,4).set([1,1,1,1]),Q.unmap();const et=302e4*Uint32Array.BYTES_PER_ELEMENT;let nt=et;const rt=15&et;0!==rt&&(nt+=16-rt);const it=p.createBuffer({label:"results buffer",size:nt,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),ot=p.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:U.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:H}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:it}}]}),at=p.createBuffer({label:"results out buffer",size:it.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),st=[],ut=[],ct=[];let dt=!1;for(;!dt;){const t=p.createCommandEncoder({label:"distance encoder"}),e=t.beginComputePass({label:"distance compute pass"});e.setPipeline(U),e.setBindGroup(0,ot),e.dispatchWorkgroups(M,M),e.end(),t.copyBufferToBuffer(it,0,at,0,at.size);const n=t.finish();p.queue.submit([n]),yield p.queue.onSubmittedWorkDone(),yield at.mapAsync(GPUMapMode.READ);const r=at.getMappedRange();let i=0;const o=new Uint32Array(r,i,$);i+=$*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,$);i+=$*Uint32Array.BYTES_PER_ELEMENT;const s=new Float32Array(r,i,$);i+=$*Float32Array.BYTES_PER_ELEMENT;const u=new Uint32Array(r,i,x);i+=x*Uint32Array.BYTES_PER_ELEMENT,dt=new Uint32Array(r,i,x).every((t=>1===t));const c=u.reduce(((t,e)=>t+e),0),d=new Uint32Array(c),h=new Uint32Array(c),f=new Float32Array(c);let l=0;for(let t=0;t<u.length;t++){const e=u[t];0!==e&&(d.set(o.subarray(t*_,t*_+e),l),h.set(a.subarray(t*_,t*_+e),l),f.set(s.subarray(t*_,t*_+e),l),l+=e)}st.push(d),ut.push(h),ct.push(f),at.unmap()}const ht=st.reduce(((t,e)=>t+e.length),0),ft=new Uint32Array(ht),pt=new Uint32Array(ht),lt=new Float32Array(ht);let gt=0;for(let t=0;t<st.length;t++)ft.set(st[t],gt),pt.set(ut[t],gt),lt.set(ct[t],gt),gt+=st[t].length;return H.destroy(),Q.destroy(),it.destroy(),at.destroy(),{i:ft,j:pt,distance:lt}},new((g=void 0)||(g=Promise))((function(t,e){function n(t){try{i(y.next(t))}catch(t){e(t)}}function r(t){try{i(y.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):(i=e.value,i instanceof g?i:new g((function(t){t(i)}))).then(n,r)}i((y=y.apply(p,l||[])).next())}));var p,l,g,y}function f(t,e,n,r){return t.map(((t,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${a[t](e[r],r)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${t.length}>;\n ${t.map(((t,e)=>`distances[${e}] = distanceScript${e}(aIndex, bIndex);`)).join("\n")}\n ${i[r](t.length)}\n }\n \n `}var p=n(5731);let l=Promise.resolve();const g=async()=>{await l;let t=()=>{};const e=new Promise((e=>{t=e}));return l=e,t};async function y(t,e,r){const i=Math.min(Math.min(Math.max(navigator.hardwareConcurrency-2,1),e),10),o=5*i,a=new Uint32Array(o),s=new Uint32Array(o),u=e/o;for(let t=0;t<o;t++)a[t]=Math.floor(t*u),s[t]=t===o-1?e:Math.floor((t+1)*u);const c=new Array(i).fill(0).map((()=>new Worker(new URL(n.p+n.u(801),n.b)))),d=new Set;for(let t=0;t<o;t++)d.add(t);const h=c.map((n=>new Promise((i=>{n.postMessage({is:t.i,js:t.j,ds:t.distance,nRows:e,pruneValue:r}),n.onmessage=()=>{i()}}))));await Promise.all(h);const f=[],p=async t=>{const e=await g(),n=d.values().next().value;null!=n?(d.delete(n),e(),await new Promise((e=>{c[t].postMessage({blockStart:a[n],blockEnd:s[n],workerIdx:t}),c[t].onmessage=t=>{f.push(t.data),e()}})),await p(t)):e()},l=c.map(((t,e)=>p(e)));await Promise.all(l),c.forEach((t=>t.terminate()));let y=0;for(const t of f)y+=t.i.length;const m=new Uint32Array(y),w=new Uint32Array(y),b=new Float32Array(y);let v=0;for(const t of f)m.set(t.i,v),w.set(t.j,v),b.set(t.distance,v),v+=t.i.length;return{i:m,j:w,distance:b}}function m(t,e){const n=t.distance;for(let r=0;r<t.i.length;r++)n[r]=Math.pow(n[r],e);return t}function w(t,e,n,r){r&&(t=function(t,e){const n=[],r=[],i=[];for(let o=0;o<t.i.length;o++)t.distance[o]>e&&(n.push(t.i[o]),r.push(t.j[o]),i.push(t.distance[o]));return{i:new Uint32Array(n),j:new Uint32Array(r),distance:new Float32Array(i)}}(t,n));const i=new Float32Array(e),o=t.distance,a=t.j;for(let e=0;e<t.i.length;e++)i[a[e]]+=o[e];for(let e=0;e<t.i.length;e++){const t=i[a[e]];0!==t&&(o[e]/=t)}return t}var b=n(934),v=n.n(b),A=n(8903),E=n.n(A);function x(t,e,n){const r=new(v());for(let e=0;e<t.length;e++)r.addNode(t[e],{x:2e4*Math.random(),y:2e4*Math.random()});for(let t=0;t<e.i.length;t++){const i=e.i[t],o=e.j[t],a=e.v[t];if(i===o||a<=0)continue;const s=n[i]===n[o]?2:1;r.addEdge(i,o,{weight:a*s})}const i={iterations:100,getEdgeWeight:"weight",settings:{...E().inferSettings(r),weighted:!0,edgeWeightInfluence:1}};E().assign(r,i);const o=new Float32Array(t.length),a=new Float32Array(t.length);for(let e=0;e<t.length;e++){const n=r.getNodeAttributes(t[e]);o[e]=n.x,a[e]=n.y}let s=o[0],u=a[0],c=o[0],d=a[0];for(let e=1;e<t.length;e++)s=Math.min(s,o[e]),u=Math.min(u,a[e]),c=Math.max(c,o[e]),d=Math.max(d,a[e]);let h=c-s,f=d-u;0===h&&(h=1),0===f&&(f=1);for(let e=0;e<t.length;e++)o[e]=(o[e]-s)/h,a[e]=(a[e]-u)/f;return{embedX:o,embedY:a}}const _={expandFactor:2,maxIterations:5,inflateFactor:2,multFactor:1,pruneValue:1e-17};class k{constructor(t={}){this._options={..._,...t}}async transform(t,e){const n=this.assignClusters(t,e);this.correctClusters(n.clusters);const r=this.splitConnectionsIntoClusters(t,n.clusters),i=await async function(t,e,n,r,i){let o=function(t,e,n){const r=new Uint32Array(2*t.i.length+e),i=new Uint32Array(2*t.j.length+e),o=new Float32Array(2*t.distance.length+e);for(let t=0;t<e;t++)r[t]=t,i[t]=t,o[t]=1;for(let n=0;n<t.i.length;n++){const a=2*n+e;r[a]=t.i[n],i[a]=t.j[n],o[a]=1-t.distance[n],r[a+1]=t.j[n],i[a+1]=t.i[n],o[a+1]=1-t.distance[n]}return w({i:r,j:i,distance:o},e,n,!1),{i:r,j:i,distance:o}}(t,e,i);for(let t=0;t<r;t++)o=await y(o,e,i),o=w(o,e,i,!1),o=m(o,n),o=w(o,e,i,!0),console.log("MCL iteration",t);return o}(t,e,this._options.inflateFactor,this._options.maxIterations,this._options.pruneValue),{clusters:o}=this.assignClusters(i,e);this.correctClusters(o);const a=this.layout(n.clusters,r,e,o);return{clusters:o,embedX:a.embedX,embedY:a.embedY,is:t.i,js:t.j}}async transformWebGPU(t,e){return this.transform(t,e)}splitConnectionsIntoClusters(t,e){const n=new Map;for(let t=0;t<e.length;t++)n.has(e[t])||n.set(e[t],{i:[],j:[],v:[]});for(let r=0;r<t.i.length;r++){const i=e[t.i[r]],o=n.get(i);o.i.push(t.i[r]),o.j.push(t.j[r]),o.v.push(1-t.distance[r])}return n}assignClusters(t,e){let n=0;const r=[],i=[],o=new Array(e).fill(-1);for(let e=0;e<t.i.length;e++){const a=t.i[e],s=t.j[e];a!==s&&(r.push(a),i.push(s),-1!==o[a]&&-1!==o[s]?o[a]!==o[s]&&this.mergeClusters(o,a,s):-1!==o[a]?o[s]=o[a]:-1!==o[s]?o[a]=o[s]:(n++,o[a]=n,o[s]=n))}for(let t=0;t<o.length;t++)-1===o[t]&&(n++,o[t]=n);return{clusters:o,is:new Uint32Array(r),js:new Uint32Array(i)}}mergeClusters(t,e,n){const r=t[e],i=t[n];for(let e=0;e<t.length;e++)t[e]===i&&(t[e]=r)}correctClusters(t){const e={};for(const n of t)e[n]||(e[n]=0),e[n]++;const n=Object.keys(e).map(Number).sort(((t,n)=>e[n]-e[t])),r={};n.forEach(((t,e)=>r[t]=e+1));for(let e=0;e<t.length;e++)t[e]=r[t[e]]}layout(t,e,n,r){const i=new Float32Array(n).fill(0),o=new Float32Array(n).fill(0),a={};t.forEach(((t,e)=>{a[t]||(a[t]=[]),a[t].push(e)}));let s=0;const u=Object.keys(a);u.sort(((t,e)=>a[e].length-a[t].length));let c=1,d=0;const h=[1];if(u.length>1){const t=a[u[0]].length,e=a[u[1]].length;t/e<2&&(h[0]=2);let n=h[0],r=3*n,i=1==n?t:t+e,o=0,s=0;for(let t=2;t<u.length;t++)o+=a[u[t]].length,s++,(s>r||o>=.7*i||t===u.length-1)&&(h.push(t===u.length-1?r:s),n=s,r=3*n,i=Math.max(o,i),o=0,s=0)}c=h[0];let f=0;for(const t of u){const n=a[t],u=x(n,e.get(Number(t)),r);s===c&&(s=0,d+=5/c,f++,c=Math.min(Math.ceil(h[f]),45));const p=5*s/c+5/c*(1/1.2/4);for(let t=0;t<u.embedX.length;t++)i[n[t]]=5*u.embedX[t]/c/1.2+p,o[n[t]]=5*u.embedY[t]/c/1.2+d;s++}return{embedX:i,embedY:o}}}onmessage=async t=>{const{data:e,threshold:n,weights:r,aggregationMethod:i,distanceFnArgs:o,distanceFns:a,maxIterations:s,useWebGPU:u,inflate:c}=t.data;console.time("sparse matrix");let d=null;if(u)try{d=await h(e,n/100,a,i,r,o)}catch(t){console.error(t)}d||(u&&console.error("WEBGPU sparse matrix calculation failed, falling back to CPU implementation"),d=await(new p.p).calcMultiColumn(e,a,n/100,o,r,i));const f=1e6;d.i.length>f&&(d=p.p.pruneSparseMatrix(d,f)),console.timeEnd("sparse matrix");const l=new k({maxIterations:s??5,inflateFactor:c??2});console.time("MCL");let g=null;if(u)try{g=await l.transformWebGPU(d,e[0].length)}catch(t){console.error("webGPU MCL failed, falling back to CPU implementation"),console.error(t)}g||(g=await l.transform(d,e[0].length)),console.timeEnd("MCL"),postMessage({res:g})}},606:(t,e,n)=>{"use strict";n.d(e,{Qt:()=>i,gD:()=>r}),n(6066);const r=t=>null==t;function i(t,e,n,r){if(n>t[t.length-1])return;const i=t.findIndex((t=>n<t));t.pop(),t.splice(i,0,n),e.pop(),e.splice(i,0,r)}},9937:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(t,e)=>{e.assign=function(t){t=t||{};var e,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(e=0,r=i.length;e<r;e++)if(i[e])for(n in i[e])t[n]=i[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},e.graphToByteArrays=function(t,e){var n,r=t.order,i=t.size,o={},a=new Float32Array(10*r),s=new Float32Array(3*i);return n=0,t.forEachNode((function(t,e){o[t]=n,a[n]=e.x,a[n+1]=e.y,a[n+2]=0,a[n+3]=0,a[n+4]=0,a[n+5]=0,a[n+6]=1,a[n+7]=1,a[n+8]=e.size||1,a[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,r,i,u,c,d,h){var f=o[i],p=o[u],l=e(t,r,i,u,c,d,h);a[f+6]+=l,a[p+6]+=l,s[n]=f,s[n+1]=p,s[n+2]=l,n+=3})),{nodes:a,edges:s}},e.assignLayoutChanges=function(t,e,n){var r=0;t.updateEachNodeAttributes((function(t,i){return i.x=e[r],i.y=e[r+1],r+=10,n?n(t,i):i}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,r){e[n]=r.x,e[n+1]=r.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var r=t.nodes(),i={},o=0,a=0,s=e.length;o<s;o+=10){if(n){var u=Object.assign({},t.getNodeAttributes(r[a]));u.x=e[o],u.y=e[o+1],u=n(r[a],u),i[r[a]]={x:u.x,y:u.y}}else i[r[a]]={x:e[o],y:e[o+1]};a++}return i},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),r=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return e.revokeObjectURL(r),i}},8903:(t,e,n)=>{var r=n(1736),i=n(8153).Fd,o=n(2561),a=n(1782),s=n(9937);function u(t,e,n){if(!r(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var u=n.iterations;if("number"!=typeof u)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(u<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var c=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,d="function"==typeof n.outputReducer?n.outputReducer:null,h=a.assign({},s,n.settings),f=a.validateSettings(h);if(f)throw new Error("graphology-layout-forceatlas2: "+f.message);var p,l=a.graphToByteArrays(e,c);for(p=0;p<u;p++)o(h,l.nodes,l.edges);if(!t)return a.collectLayoutChanges(e,l.nodes);a.assignLayoutChanges(e,l.nodes,d)}var c=u.bind(null,!1);c.assign=u.bind(null,!0),c.inferSettings=function(t){var e="number"==typeof t?t:t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}},t.exports=c},2561:t=>{var e=10;t.exports=function(t,n,r){var i,o,a,s,u,c,d,h,f,p,l,g,y,m,w,b,v,A,E,x,_,k,G,M=n.length,L=r.length,S=t.adjustSizes,I=t.barnesHutTheta*t.barnesHutTheta,N=[];for(a=0;a<M;a+=e)n[a+4]=n[a+2],n[a+5]=n[a+3],n[a+2]=0,n[a+3]=0;if(t.outboundAttractionDistribution){for(l=0,a=0;a<M;a+=e)l+=n[a+6];l/=M/e}if(t.barnesHutOptimize){var U,D,C,O=1/0,R=-1/0,j=1/0,T=-1/0;for(a=0;a<M;a+=e)O=Math.min(O,n[a+0]),R=Math.max(R,n[a+0]),j=Math.min(j,n[a+1]),T=Math.max(T,n[a+1]);var B=R-O,P=T-j;for(B>P?T=(j-=(B-P)/2)+B:R=(O-=(P-B)/2)+P,N[0]=-1,N[1]=(O+R)/2,N[2]=(j+T)/2,N[3]=Math.max(R-O,T-j),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,a=0;a<M;a+=e)for(o=0,C=3;;){if(!(N[o+5]>=0)){if(N[o+0]<0){N[o+0]=a;break}if(N[o+5]=9*i,h=N[o+3]/2,N[(f=N[o+5])+0]=-1,N[f+1]=N[o+1]-h,N[f+2]=N[o+2]-h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]-h,N[f+2]=N[o+2]+h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]+h,N[f+2]=N[o+2]-h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]+h,N[f+2]=N[o+2]+h,N[f+3]=h,N[f+4]=N[o+4],N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,i+=4,U=n[N[o+0]+0]<N[o+1]?n[N[o+0]+1]<N[o+2]?N[o+5]:N[o+5]+9:n[N[o+0]+1]<N[o+2]?N[o+5]+18:N[o+5]+27,N[o+6]=n[N[o+0]+6],N[o+7]=n[N[o+0]+0],N[o+8]=n[N[o+0]+1],N[U+0]=N[o+0],N[o+0]=-1,U===(D=n[a+0]<N[o+1]?n[a+1]<N[o+2]?N[o+5]:N[o+5]+9:n[a+1]<N[o+2]?N[o+5]+18:N[o+5]+27)){if(C--){o=U;continue}C=3;break}N[D+0]=a;break}U=n[a+0]<N[o+1]?n[a+1]<N[o+2]?N[o+5]:N[o+5]+9:n[a+1]<N[o+2]?N[o+5]+18:N[o+5]+27,N[o+7]=(N[o+7]*N[o+6]+n[a+0]*n[a+6])/(N[o+6]+n[a+6]),N[o+8]=(N[o+8]*N[o+6]+n[a+1]*n[a+6])/(N[o+6]+n[a+6]),N[o+6]+=n[a+6],o=U}}if(t.barnesHutOptimize){for(g=t.scalingRatio,a=0;a<M;a+=e)for(o=0;;)if(N[o+5]>=0){if(b=Math.pow(n[a+0]-N[o+7],2)+Math.pow(n[a+1]-N[o+8],2),4*(p=N[o+3])*p/b<I){if(y=n[a+0]-N[o+7],m=n[a+1]-N[o+8],!0===S?b>0?(v=g*n[a+6]*N[o+6]/b,n[a+2]+=y*v,n[a+3]+=m*v):b<0&&(v=-g*n[a+6]*N[o+6]/Math.sqrt(b),n[a+2]+=y*v,n[a+3]+=m*v):b>0&&(v=g*n[a+6]*N[o+6]/b,n[a+2]+=y*v,n[a+3]+=m*v),(o=N[o+4])<0)break;continue}o=N[o+5]}else if((c=N[o+0])>=0&&c!==a&&(b=(y=n[a+0]-n[c+0])*y+(m=n[a+1]-n[c+1])*m,!0===S?b>0?(v=g*n[a+6]*n[c+6]/b,n[a+2]+=y*v,n[a+3]+=m*v):b<0&&(v=-g*n[a+6]*n[c+6]/Math.sqrt(b),n[a+2]+=y*v,n[a+3]+=m*v):b>0&&(v=g*n[a+6]*n[c+6]/b,n[a+2]+=y*v,n[a+3]+=m*v)),(o=N[o+4])<0)break}else for(g=t.scalingRatio,s=0;s<M;s+=e)for(u=0;u<s;u+=e)y=n[s+0]-n[u+0],m=n[s+1]-n[u+1],!0===S?(b=Math.sqrt(y*y+m*m)-n[s+8]-n[u+8])>0?(v=g*n[s+6]*n[u+6]/b/b,n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v):b<0&&(v=100*g*n[s+6]*n[u+6],n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v):(b=Math.sqrt(y*y+m*m))>0&&(v=g*n[s+6]*n[u+6]/b/b,n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v);for(f=t.gravity/t.scalingRatio,g=t.scalingRatio,a=0;a<M;a+=e)v=0,y=n[a+0],m=n[a+1],b=Math.sqrt(Math.pow(y,2)+Math.pow(m,2)),t.strongGravityMode?b>0&&(v=g*n[a+6]*f):b>0&&(v=g*n[a+6]*f/b),n[a+2]-=y*v,n[a+3]-=m*v;for(g=1*(t.outboundAttractionDistribution?l:1),d=0;d<L;d+=3)s=r[d+0],u=r[d+1],h=r[d+2],w=Math.pow(h,t.edgeWeightInfluence),y=n[s+0]-n[u+0],m=n[s+1]-n[u+1],!0===S?(b=Math.sqrt(y*y+m*m)-n[s+8]-n[u+8],t.linLogMode?t.outboundAttractionDistribution?b>0&&(v=-g*w*Math.log(1+b)/b/n[s+6]):b>0&&(v=-g*w*Math.log(1+b)/b):t.outboundAttractionDistribution?b>0&&(v=-g*w/n[s+6]):b>0&&(v=-g*w)):(b=Math.sqrt(Math.pow(y,2)+Math.pow(m,2)),t.linLogMode?t.outboundAttractionDistribution?b>0&&(v=-g*w*Math.log(1+b)/b/n[s+6]):b>0&&(v=-g*w*Math.log(1+b)/b):t.outboundAttractionDistribution?(b=1,v=-g*w/n[s+6]):(b=1,v=-g*w)),b>0&&(n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v);if(!0===S)for(a=0;a<M;a+=e)1!==n[a+9]&&((A=Math.sqrt(Math.pow(n[a+2],2)+Math.pow(n[a+3],2)))>10&&(n[a+2]=10*n[a+2]/A,n[a+3]=10*n[a+3]/A),E=n[a+6]*Math.sqrt((n[a+4]-n[a+2])*(n[a+4]-n[a+2])+(n[a+5]-n[a+3])*(n[a+5]-n[a+3])),x=Math.sqrt((n[a+4]+n[a+2])*(n[a+4]+n[a+2])+(n[a+5]+n[a+3])*(n[a+5]+n[a+3]))/2,_=.1*Math.log(1+x)/(1+Math.sqrt(E)),k=n[a+0]+n[a+2]*(_/t.slowDown),n[a+0]=k,G=n[a+1]+n[a+3]*(_/t.slowDown),n[a+1]=G);else for(a=0;a<M;a+=e)1!==n[a+9]&&(E=n[a+6]*Math.sqrt((n[a+4]-n[a+2])*(n[a+4]-n[a+2])+(n[a+5]-n[a+3])*(n[a+5]-n[a+3])),x=Math.sqrt((n[a+4]+n[a+2])*(n[a+4]+n[a+2])+(n[a+5]+n[a+3])*(n[a+5]+n[a+3]))/2,_=n[a+7]*Math.log(1+x)/(1+Math.sqrt(E)),n[a+7]=Math.min(1,Math.sqrt(_*(Math.pow(n[a+2],2)+Math.pow(n[a+3],2))/(1+Math.sqrt(E)))),k=n[a+0]+n[a+2]*(_/t.slowDown),n[a+0]=k,G=n[a+1]+n[a+3]*(_/t.slowDown),n[a+1]=G);return{}}},8153:(t,e)=>{function n(t){return"number"!=typeof t||isNaN(t)?1:t}e.Fd=function(t){return function(t,e){var n={},r=function(t){return void 0===t?e:t};"function"==typeof e&&(r=e);var i=function(e){return r(e[t])},o=function(){return r(void 0)};return"string"==typeof t?(n.fromAttributes=i,n.fromGraph=function(t,e){return i(t.getEdgeAttributes(e))},n.fromEntry=function(t,e){return i(e)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof t?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(e,n){var i=e.extremities(n);return r(t(n,e.getEdgeAttributes(n),i[0],i[1],e.getNodeAttributes(i[0]),e.getNodeAttributes(i[1]),e.isUndirected(n)))},n.fromEntry=function(e,n,i,o,a,s,u){return r(t(e,n,i,o,a,s,u))},n.fromPartialEntry=function(e,n,i,o){return r(t(e,n,i,o))},n.fromMinimalEntry=function(e,n){return r(t(e,n))}):(n.fromAttributes=o,n.fromGraph=o,n.fromEntry=o,n.fromMinimalEntry=o),n}(t,n)}},1736:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},934:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function i(t,e,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o},i.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return i(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,t)},o(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var s=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var r in arguments[e])t[r]=arguments[e][r];return t};function u(t,e,n,r){var i=t._nodes.get(e),o=null;return i?o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:o}function c(e){return"object"===t(e)&&null!==e}function d(t){var e;for(e in t)return!1;return!0}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function f(t,e,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function p(t){return!(!c(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var l,g={exports:{}},y="object"==typeof Reflect?Reflect:null,m=y&&"function"==typeof y.apply?y.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};l=y&&"function"==typeof y.ownKeys?y.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var w=Number.isNaN||function(t){return t!=t};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}S(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&S(t,"error",e,{once:!0})}(t,i)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var v=10;function A(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function E(t){return void 0===t._maxListeners?b.defaultMaxListeners:t._maxListeners}function x(t,e,n,r){var i,o,a,s;if(A(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=E(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function k(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=_.bind(r);return i.listener=n,r.wrapFn=i,i}function G(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):L(i,i.length)}function M(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function L(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function S(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}function I(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(t){if("number"!=typeof t||t<0||w(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");v=t}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||w(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},b.prototype.getMaxListeners=function(){return E(this)},b.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[t];if(void 0===s)return!1;if("function"==typeof s)m(s,this,e);else{var u=s.length,c=L(s,u);for(n=0;n<u;++n)m(c[n],this,e)}return!0},b.prototype.addListener=function(t,e){return x(this,t,e,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(t,e){return x(this,t,e,!0)},b.prototype.once=function(t,e){return A(e),this.on(t,k(this,t,e)),this},b.prototype.prependOnceListener=function(t,e){return A(e),this.prependListener(t,k(this,t,e)),this},b.prototype.removeListener=function(t,e){var n,r,i,o,a;if(A(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},b.prototype.listeners=function(t){return G(this,t,!0)},b.prototype.rawListeners=function(t){return G(this,t,!1)},b.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):M.call(t,e)},b.prototype.listenerCount=M,b.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]},"undefined"!=typeof Symbol&&(I.prototype[Symbol.iterator]=function(){return this}),I.of=function(){var t=arguments,e=t.length,n=0;return new I((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},I.empty=function(){return new I((function(){return{done:!0}}))},I.fromSequence=function(t){var e=0,n=t.length;return new I((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},I.is=function(t){return t instanceof I||"object"==typeof t&&null!==t&&"function"==typeof t.next};var N=I,U={};U.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,U.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var D=N,C=U,O=C.ARRAY_BUFFER_SUPPORT,R=C.SYMBOL_SUPPORT,j=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||O&&ArrayBuffer.isView(t)?D.fromSequence(t):"object"!=typeof t||null===t?null:R&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},T=j,B=function(t,e){for(var n,r=arguments.length>1?e:1/0,i=r!==1/0?new Array(r):[],o=0,a=T(t);;){if(o===r)return i;if((n=a.next()).done)return o!==e&&(i.length=o),i;i[o++]=n.value}},P=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),z=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P),$=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P),W=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P);function Y(t,e){this.key=t,this.attributes=e,this.clear()}function F(t,e){this.key=t,this.attributes=e,this.clear()}function H(t,e){this.key=t,this.attributes=e,this.clear()}function q(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}function K(t,e,n,r,i,o,a){var s,u,c,d;if(r=""+r,0===n){if(!(s=t._nodes.get(r)))throw new $("Graph.".concat(e,': could not find the "').concat(r,'" node in the graph.'));c=i,d=o}else if(3===n){if(i=""+i,!(u=t._edges.get(i)))throw new $("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));var h=u.source.key,f=u.target.key;if(r===h)s=u.target;else{if(r!==f)throw new $("Graph.".concat(e,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(h,", ").concat(f,")."));s=u.source}c=o,d=a}else{if(!(u=t._edges.get(r)))throw new $("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));s=1===n?u.source:u.target,c=i,d=o}return[s,c,d]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},F.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},H.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},q.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},q.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");var i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},q.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},q.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var V=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){return K(this,e,n,t,r)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=K(this,e,n,t,r,i,o),s=a[0],u=a[1],c=a[2];return s.attributes[u]=c,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=K(this,e,n,t,r,i,o),s=a[0],u=a[1],c=a[2];if("function"!=typeof c)throw new z("Graph.".concat(e,": updater should be a function."));var d=s.attributes,h=c(d[u]);return d[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];if(!c(s))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],u=o[1];if(!c(u))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return s(a.attributes,u),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:u}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];if("function"!=typeof s)throw new z("Graph.".concat(e,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],X=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+t,o=""+arguments[1];if(!(r=u(this,i,o,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(i,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,s=""+r;if(r=arguments[2],i=arguments[3],!(o=u(this,a,s,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,s=""+r;if(r=arguments[2],i=arguments[3],!(o=u(this,a,s,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new z("Graph.".concat(e,": updater should be a function."));return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(r))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(r))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return s(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new z("Graph.".concat(e,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],J=N,Q=j,Z=function(){var t=arguments,e=null,n=-1;return new J((function(){for(var r=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=Q(t[n])}if(!0!==(r=e.next()).done)break;e=null}return r}))},tt=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function et(t,e,n,r){var i=!1;for(var o in e)if(o!==r){var a=e[o];if(i=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&i)return a.key}}function nt(t,e,n,r){var i,o,a,s=!1;for(var u in e)if(u!==r){i=e[u];do{if(o=i.source,a=i.target,s=n(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected),t&&s)return i.key;i=i.next}while(void 0!==i)}}function rt(t,e){var n,r=Object.keys(t),i=r.length,o=0;return new N((function(){do{if(n)n=n.next;else{if(o>=i)return{done:!0};var a=r[o++];if(a===e){n=void 0;continue}n=t[a]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function it(t,e,n,r){var i=e[n];if(i){var o=i.source,a=i.target;return r(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected)&&t?i.key:void 0}}function ot(t,e,n,r){var i=e[n];if(i){var o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}}function at(t,e){var n=t[e];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function st(t,e,n,r){if(0!==e.size)for(var i,o,a="mixed"!==n&&n!==e.type,s="undirected"===n,u=!1,c=e._edges.values();!0!==(i=c.next()).done;)if(o=i.value,!a||o.undirected===s){var d=o,h=d.key,f=d.attributes,p=d.source,l=d.target;if(u=r(h,f,p.key,l.key,p.attributes,l.attributes,o.undirected),t&&u)return h}}function ut(t,e,n,r,i,o){var a,s=e?nt:et;if("undirected"!==n){if("out"!==r&&(a=s(t,i.in,o),t&&a))return a;if("in"!==r&&(a=s(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=s(t,i.undirected,o),t&&a))return a}function ct(t,e,n,r,i,o,a){var s,u=n?ot:it;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(s=u(t,i.in,o,a),t&&s))return s;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(s=u(t,i.out,o,a),t&&s))return s}if("directed"!==e&&void 0!==i.undirected&&(s=u(t,i.undirected,o,a),t&&s))return s}var dt=[{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 ht(){this.A=null,this.B=null}function ft(t,e,n,r,i){for(var o in r){var a=r[o],s=a.source,u=a.target,c=s===n?u:s;if(!e||!e.has(c.key)){var d=i(c.key,c.attributes);if(t&&d)return c.key}}}function pt(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return ft(t,null,r,r.undirected,i);if("string"==typeof n)return ft(t,null,r,r[n],i)}var o,a=new ht;if("undirected"!==e){if("out"!==n){if(o=ft(t,null,r,r.in,i),t&&o)return o;a.wrap(r.in)}if("in"!==n){if(o=ft(t,a,r,r.out,i),t&&o)return o;a.wrap(r.out)}}if("directed"!==e&&(o=ft(t,a,r,r.undirected,i),t&&o))return o}function lt(t,e,n){var r=Object.keys(n),i=r.length,o=0;return new N((function(){var a=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};var s=n[r[o++]],u=s.source,c=s.target;a=u===e?c:u,t&&t.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function gt(t,e,n,r,i){for(var o,a,s,u,c,d,h,f=r._nodes.values(),p=r.type;!0!==(o=f.next()).done;){var l=!1;if(a=o.value,"undirected"!==p)for(s in u=a.out){c=u[s];do{if(d=c.target,l=!0,h=i(a.key,d.key,a.attributes,d.attributes,c.key,c.attributes,c.undirected),t&&h)return c;c=c.next}while(c)}if("directed"!==p)for(s in u=a.undirected)if(!(e&&a.key>s)){c=u[s];do{if((d=c.target).key!==s&&(d=c.source),l=!0,h=i(a.key,d.key,a.attributes,d.attributes,c.key,c.attributes,c.undirected),t&&h)return c;c=c.next}while(c)}if(n&&!l&&(h=i(a.key,null,a.attributes,null,null,null,null),t&&h))return null}}function yt(t){if(!c(t))throw new z('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new z("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!c(t.attributes)||null===t.attributes))throw new z("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function mt(t){if(!c(t))throw new z('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new z("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new z("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!c(t.attributes)||null===t.attributes))throw new z("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new z("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}ht.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},ht.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var wt,bt=(wt=255&Math.floor(256*Math.random()),function(){return wt++}),vt=new Set(["directed","undirected","mixed"]),At=new Set(["domain","_events","_eventsCount","_maxListeners"]),Et={allowSelfLoops:!0,multi:!1,type:"mixed"};function xt(t,e,n){var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function _t(t,e,n,r,i,o,a,s){if(!r&&"undirected"===t.type)throw new W("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new W("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!c(s))throw new z("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!t.allowSelfLoops&&o===a)throw new W("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var u=t._nodes.get(o),d=t._nodes.get(a);if(!u)throw new $("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!d)throw new $("Graph.".concat(e,': target node "').concat(a,'" not found.'));var h={key:null,undirected:r,source:o,target:a,attributes:s};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new W("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));if(!t.multi&&(r?void 0!==u.undirected[a]:void 0!==u.out[a]))throw new W("Graph.".concat(e,': an edge linking "').concat(o,'" to "').concat(a,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var f=new q(r,i,u,d,s);t._edges.set(i,f);var p=o===a;return r?(u.undirectedDegree++,d.undirectedDegree++,p&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,p&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,h.key=i,t.emit("edgeAdded",h),i}function kt(t,e,n,r,i,o,a,u,d){if(!r&&"undirected"===t.type)throw new W("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new W("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(u)if(d){if("function"!=typeof u)throw new z("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(u,'"'))}else if(!c(u))throw new z("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(u,'"'));var h;if(o=""+o,a=""+a,d&&(h=u,u=void 0),!t.allowSelfLoops&&o===a)throw new W("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var f,p,l=t._nodes.get(o),g=t._nodes.get(a);if(!n&&(f=t._edges.get(i))){if(!(f.source.key===o&&f.target.key===a||r&&f.source.key===a&&f.target.key===o))throw new W("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(o,'" source & "').concat(a,'" target vs. ("').concat(f.source.key,'", "').concat(f.target.key,'").'));p=f}if(p||t.multi||!l||(p=r?l.undirected[a]:l.out[a]),p){var y=[p.key,!1,!1,!1];if(d?!h:!u)return y;if(d){var m=p.attributes;p.attributes=h(m),t.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else s(p.attributes,u),t.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:u});return y}u=u||{},d&&h&&(u=h(u));var w={key:null,undirected:r,source:o,target:a,attributes:u};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new W("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));var b=!1,v=!1;l||(l=xt(t,o,{}),b=!0,o===a&&(g=l,v=!0)),g||(g=xt(t,a,{}),v=!0),f=new q(r,i,l,g,u),t._edges.set(i,f);var A=o===a;return r?(l.undirectedDegree++,g.undirectedDegree++,A&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,g.inDegree++,A&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,w.key=i,t.emit("edgeAdded",w),[i,!0,b,v]}function Gt(t,e){t._edges.delete(e.key);var n=e.source,r=e.target,i=e.attributes,o=e.undirected,a=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}var Mt=function(n){function r(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=s({},Et,t)).multi)throw new z("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!vt.has(t.type))throw new z('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new z("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var r="mixed"===t.type?Y:"directed"===t.type?F:H;h(a(e),"NodeDataClass",r);var i="geid_"+bt()+"_",o=0;return h(a(e),"_attributes",{}),h(a(e),"_nodes",new Map),h(a(e),"_edges",new Map),h(a(e),"_directedSize",0),h(a(e),"_undirectedSize",0),h(a(e),"_directedSelfLoopCount",0),h(a(e),"_undirectedSelfLoopCount",0),h(a(e),"_edgeKeyGenerator",(function(){var t;do{t=i+o++}while(e._edges.has(t));return t})),h(a(e),"_options",t),At.forEach((function(t){return h(a(e),t,e[t])})),f(a(e),"order",(function(){return e._nodes.size})),f(a(e),"size",(function(){return e._edges.size})),f(a(e),"directedSize",(function(){return e._directedSize})),f(a(e),"undirectedSize",(function(){return e._undirectedSize})),f(a(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),f(a(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),f(a(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),f(a(e),"multi",e._options.multi),f(a(e),"type",e._options.type),f(a(e),"allowSelfLoops",e._options.allowSelfLoops),f(a(e),"implementation",(function(){return"graphology"})),e}e(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(t){return this._nodes.has(""+t)},i.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.out.hasOwnProperty(e)}throw new z("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.undirected.hasOwnProperty(e)}throw new z("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(e)||void 0!==r.undirected&&r.undirected.hasOwnProperty(e))}throw new z("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new W("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(t);if(!n)throw new $('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new W("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(t);if(!n)throw new $('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}},i.edge=function(t,e){if(this.multi)throw new W("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},i.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},i.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},i.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},i.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},i.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},i.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},i.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},i.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},i.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},i.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},i.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},i.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},i.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},i.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},i.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},i.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r},i.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r},i.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},i.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},i.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},i.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new $('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new $('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new $('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},i.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},i.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},i.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},i.addNode=function(t,e){var n=function(t,e,n){if(n&&!c(n))throw new z('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new W('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key},i.mergeNode=function(t,e){if(e&&!c(e))throw new z('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(s(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},i.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new z('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var i=e?e({}):{};return n=new this.NodeDataClass(t,i),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:i}),[t,!0]},i.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new $('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){e=n.out[r];do{Gt(this,e),e=e.next}while(e)}for(var i in n.in){e=n.in[i];do{Gt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{Gt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},i.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(e=u(this,n,r,this.type)))throw new $('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new $('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Gt(this,e),this},i.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new W("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 W("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=u(this,t=""+t,e=""+e,"directed");if(!n)throw new $('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Gt(this,n),this},i.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new W("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 W("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=u(this,t,e,"undirected");if(!n)throw new $('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Gt(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(t){return this._attributes[t]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},i.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.updateAttribute=function(t,e){if("function"!=typeof e)throw new z("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},i.replaceAttributes=function(t){if(!c(t))throw new z("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(t){if(!c(t))throw new z("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},i.updateAttributes=function(t){if("function"!=typeof t)throw new z("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new z("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!p(e))throw new z("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=t(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},i.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new z("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!p(e))throw new z("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,o,a=this._edges.values();!0!==(n=a.next()).done;)i=(r=n.value).source,o=r.target,r.attributes=t(r.key,r.attributes,i.key,o.key,i.attributes,o.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},i.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new z("Graph.forEachAdjacencyEntry: expecting a callback.");gt(!1,!1,!1,this,t)},i.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new z("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!1,!0,this,t)},i.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new z("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");gt(!1,!0,!1,this,t)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new z("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!0,!0,this,t)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):B(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(t){if("function"!=typeof t)throw new z("Graph.forEachNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)},i.findNode=function(t){if("function"!=typeof t)throw new z("Graph.findNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},i.mapNodes=function(t){if("function"!=typeof t)throw new z("Graph.mapNode: expecting a callback.");for(var e,n,r=this._nodes.values(),i=new Array(this.order),o=0;!0!==(e=r.next()).done;)n=e.value,i[o++]=t(n.key,n.attributes);return i},i.someNode=function(t){if("function"!=typeof t)throw new z("Graph.someNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},i.everyNode=function(t){if("function"!=typeof t)throw new z("Graph.everyNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},i.filterNodes=function(t){if("function"!=typeof t)throw new z("Graph.filterNodes: expecting a callback.");for(var e,n,r=this._nodes.values(),i=[];!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(t,e){if("function"!=typeof t)throw new z("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new z("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=e,o=this._nodes.values();!0!==(n=o.next()).done;)i=t(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var t=this._nodes.values();return new N((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,r){e[n++]=function(t,e){var n={key:t};return d(e.attributes)||(n.attributes=s({},e.attributes)),n}(r,t)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,i){r[n++]=function(t,e,n){var r={key:e,source:n.source.key,target:n.target.key};return d(n.attributes)||(r.attributes=s({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(t.type,i,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}},i.import=function(t){var e,n,i,o,a,s=this,u=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof r)return t.forEachNode((function(t,e){u?s.mergeNode(t,e):s.addNode(t,e)})),t.forEachEdge((function(t,e,n,r,i,o,a){u?a?s.mergeUndirectedEdgeWithKey(t,n,r,e):s.mergeDirectedEdgeWithKey(t,n,r,e):a?s.addUndirectedEdgeWithKey(t,n,r,e):s.addDirectedEdgeWithKey(t,n,r,e)})),this;if(!c(t))throw new z("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!c(t.attributes))throw new z("Graph.import: invalid attributes. Expecting a plain object.");u?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new z("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=i.length;e<n;e++){yt(o=i[e]);var d=o,h=d.key,f=d.attributes;u?this.mergeNode(h,f):this.addNode(h,f)}}if(t.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=t.edges,!Array.isArray(i))throw new z("Graph.import: invalid edges. Expecting an array.");for(e=0,n=i.length;e<n;e++){mt(a=i[e]);var l=a,g=l.source,y=l.target,m=l.attributes,w=l.undirected,b=void 0===w?p:w;"key"in a?(u?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,y,m):(u?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,y,m)}}return this},i.nullCopy=function(t){var e=new r(s({},this._options,t));return e.replaceAttributes(s({},this.getAttributes())),e},i.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var r=s({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)})),e},i.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new W('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new W("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new W("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var e,n,r=this.emptyCopy(t),i=this._edges.values();!0!==(e=i.next()).done;)_t(r,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,s({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var r={},i={};this._edges.forEach((function(t,n){var o,a=t.undirected?"--":"->",s="",u=t.source.key,c=t.target.key;t.undirected&&u>c&&(o=u,u=c,c=o);var d="(".concat(u,")").concat(a,"(").concat(c,")");n.startsWith("geid_")?e.multi&&(void 0===i[d]?i[d]=0:i[d]++,s+="".concat(i[d],". ")):s+="[".concat(n,"]: "),r[s+=d]=t.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!At.has(a)&&"function"!=typeof this[a]&&"symbol"!==t(a)&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=n,o.edges=r,h(o,"constructor",this.constructor),o},r}(g.exports.EventEmitter);"undefined"!=typeof Symbol&&(Mt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Mt.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),r="add"===e?_t:kt;t.generateKey?Mt.prototype[n]=function(i,o,a){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,a,"update"===e)}:Mt.prototype[n]=function(i,o,a,s){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,a,s,"update"===e)}}))})),function(t){V.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Node"),0),r(t,n("Source"),1),r(t,n("Target"),2),r(t,n("Opposite"),3)}))}(Mt),function(t){X.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Edge"),"mixed"),r(t,n("DirectedEdge"),"directed"),r(t,n("UndirectedEdge"),"undirected")}))}(Mt),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):B(t._edges.keys(),t._edges.size);for(var n,r,i="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(i),a="undirected"===e,s=t._edges.values(),u=0;!0!==(n=s.next()).done;)(r=n.value).undirected===a&&(o[u++]=r.key);return o}(this,r);if(1===arguments.length){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,r){var i=[];return ut(!1,t,e,n,r,(function(t){i.push(t)})),i}(this.multi,"mixed"===r?this.type:r,i,o)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,r,i){var o=[];return ct(!1,t,e,n,r,i,(function(t){o.push(t)})),o}(r,this.multi,i,a,e)}throw new z("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return st(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ut(!1,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!1,r,this.multi,i,s,e,n)}throw new z("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),t=new Array(i);var a=0;e.push((function(e,r,i,o,s,u,c){t[a++]=n(e,r,i,o,s,u,c)}))}else t=[],e.push((function(e,r,i,o,a,s,u){t.push(n(e,r,i,o,a,s,u))}));return this[o].apply(this,e),t};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,r,i,o,a,s,u){e(t,r,i,o,a,s,u)&&n.push(t)})),this[o].apply(this,t),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new z("Graph.".concat(u,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new z("Graph.".concat(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."));2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var r=e;return n.push((function(e,n,i,o,a,s,u){r=t(r,e,n,i,o,a,s,u)})),this[o].apply(this,n),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return st(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ut(!0,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!0,r,this.multi,i,s,e,n)}throw new z("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,s){return e(t,n,r,i,o,a,s)})),!!this[o].apply(this,t)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,s){return!e(t,n,r,i,o,a,s)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(t,e){if(0===t.size)return N.empty();var n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return new N((function(){for(var t,e;;){if((t=i.next()).done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,r);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var r=N.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=Z(r,rt(n.in))),"in"!==e&&void 0!==n.out&&(r=Z(r,rt(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=Z(r,rt(n.undirected))),r}(r,i,n)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,r){var i=N.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=Z(i,at(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=Z(i,at(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=Z(i,at(n.undirected,r))),i}(r,i,a,e)}throw new z("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(Mt),function(t){dt.forEach((function(e){(function(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var r=[];return pt(!1,t,e,n,(function(t){r.push(t)})),r}("mixed"===r?this.type:r,i,e)}})(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));pt(!1,"mixed"===r?this.type:r,i,n,e)}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,r){n.push(e(t,r))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,r){e(t,r)&&n.push(t)})),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new z("Graph.".concat(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."));var r=n;return this[o](t,(function(t,n){r=e(r,t,n)})),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;t.prototype[a]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new $("Graph.".concat(a,': could not find the "').concat(t,'" node in the graph.'));return pt(!0,"mixed"===r?this.type:r,i,n,e)}};var s="some"+o;t.prototype[s]=function(t,e){return!!this[a](t,e)};var u="every"+o;t.prototype[u]=function(t,e){return!this[a](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return lt(null,n,n.undirected);if("string"==typeof e)return lt(null,n,n[e])}var r=N.empty(),i=new ht;return"undirected"!==t&&("out"!==e&&(r=Z(r,lt(i,n,n.in))),"in"!==e&&(r=Z(r,lt(i,n,n.out)))),"directed"!==t&&(r=Z(r,lt(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}(t,e)}))}(Mt);var Lt=function(t){function n(e){var n=s({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new z("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new z('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),St=function(t){function n(e){var n=s({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new z("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new z('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),It=function(t){function n(e){var n=s({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(Mt),Nt=function(t){function n(e){var n=s({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new z('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Ut=function(t){function n(e){var n=s({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new z('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt);function Dt(t){t.from=function(e,n){var r=s({},e.options,n),i=new t(r);return i.import(e),i}}return Dt(Mt),Dt(Lt),Dt(St),Dt(It),Dt(Nt),Dt(Ut),Mt.Graph=Mt,Mt.DirectedGraph=Lt,Mt.UndirectedGraph=St,Mt.MultiGraph=It,Mt.MultiDirectedGraph=Nt,Mt.MultiUndirectedGraph=Ut,Mt.InvalidArgumentsGraphError=z,Mt.NotFoundGraphError=$,Mt.UsageGraphError=W,Mt}()}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={exports:{}};return n[t].call(o.exports,o,o.exports,i),o.exports}i.m=n,i.x=()=>{var t=i.O(void 0,[731],(()=>i(6807)));return i.O(t)},t=[],i.O=(e,n,r,o)=>{if(!n){var a=1/0;for(d=0;d<t.length;d++){for(var[n,r,o]=t[d],s=!0,u=0;u<n.length;u++)(!1&o||a>=o)&&Object.keys(i.O).every((t=>i.O[t](n[u])))?n.splice(u--,1):(s=!1,o<a&&(a=o));if(s){t.splice(d--,1);var c=r();void 0!==c&&(e=c)}}return e}o=o||0;for(var d=t.length;d>0&&t[d-1][2]>o;d--)t[d]=t[d-1];t[d]=[n,r,o]},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,n)=>(i.f[n](t,e),e)),[])),i.u=t=>t+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{i.b=self.location+"";var t={980:1};i.f.i=(e,n)=>{t[e]||importScripts(i.p+i.u(e))};var e=self.webpackChunkeda=self.webpackChunkeda||[],n=e.push.bind(e);e.push=e=>{var[r,o,a]=e;for(var s in o)i.o(o,s)&&(i.m[s]=o[s]);for(a&&a(i);r.length;)t[r.pop()]=1;n(e)}})(),e=i.x,i.x=()=>i.e(731).then(e);var o=i.x();eda=o})();
1
+ var eda;(()=>{var t,e,n={6807:(t,e,n)=>{"use strict";var r;!function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(r||(r={}));const i={[r.EUCLIDEAN]:function(t){return`\n var sum = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[r.MANHATTAN]:function(t){return`\n var sum = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var o;!function(t){t.HAMMING="Hamming",t.EUCLIDEAN="Euclidean",t.VECTOR_COSINE="Vector Cosine",t.MANHATTAN="Manhattan",t.TANIMOTO="Tanimoto",t.LEVENSTEIN="Levenshtein",t.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",t.SOKAL="Sokal",t.COSINE="Cosine",t.ASYMMETRIC="Asymmetric",t.Difference="Difference",t.OneHot="One-Hot"}(o||(o={}));const a={[o.HAMMING]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${t};\n `},[o.EUCLIDEAN]:function(t,e){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[o.MANHATTAN]:function(t,e){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[o.VECTOR_COSINE]:function(t,e){return`\n var dist: f32 = 0.0;\n var productSum: f32 = 0.0;\n var aSquareSum: f32 = 0.0;\n var bSquareSum: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n productSum = productSum + f32(a[i] * b[i]);\n aSquareSum = aSquareSum + f32(a[i] * a[i]);\n bSquareSum = bSquareSum + f32(b[i] * b[i]);\n }\n var sim = productSum / (sqrt(aSquareSum) * sqrt(bSquareSum));\n return (1.0 - sim) / 2.0;\n `},[o.TANIMOTO]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[o.LEVENSTEIN]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${t+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[o.NEEDLEMAN_WUNSCH]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${t+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${t+1}u>;\n var horizontalGaps: array<u32, ${t+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${e};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${e};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${e}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(minLength);\n\n `},[o.MONOMER_CHEMICAL_DISTANCE]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${e}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${t}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${t};\n `},[o.SOKAL]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[o.COSINE]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[o.ASYMMETRIC]:function(t,e){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${t}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[o.Difference]:function(t,e){return`\n let range = suppInfo.range${e};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[o.OneHot]:function(t,e){return`\n let aLength: u32 = computeInfo.entrySizes[${e}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${e}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},s={[o.HAMMING]:t=>Math.ceil(t/30),[o.EUCLIDEAN]:t=>Math.ceil(t/30),[o.MANHATTAN]:t=>Math.ceil(t/30),[o.TANIMOTO]:t=>Math.ceil(t/30),[o.SOKAL]:t=>Math.ceil(t/30),[o.COSINE]:t=>Math.ceil(t/30),[o.ASYMMETRIC]:t=>Math.ceil(t/30),[o.LEVENSTEIN]:t=>Math.ceil(t*t/60),[o.NEEDLEMAN_WUNSCH]:t=>Math.ceil(t*t/60),[o.MONOMER_CHEMICAL_DISTANCE]:t=>Math.ceil(t/25),[o.Difference]:t=>1,[o.OneHot]:t=>Math.ceil(t/40),[o.VECTOR_COSINE]:t=>Math.ceil(t/30)},u={STRING:new Set([o.HAMMING,o.LEVENSTEIN,o.NEEDLEMAN_WUNSCH,o.MONOMER_CHEMICAL_DISTANCE,o.OneHot]),UINT32ARRAY:new Set([o.HAMMING,o.EUCLIDEAN,o.MANHATTAN,o.MONOMER_CHEMICAL_DISTANCE,o.LEVENSTEIN,o.NEEDLEMAN_WUNSCH,o.TANIMOTO,o.COSINE,o.VECTOR_COSINE,o.SOKAL,o.ASYMMETRIC,o.OneHot,o.Difference]),INT32ARRAY:new Set([o.EUCLIDEAN,o.MANHATTAN,o.OneHot,o.Difference,o.VECTOR_COSINE]),FLOAT32ARRAY:new Set([o.EUCLIDEAN,o.MANHATTAN,o.Difference,o.VECTOR_COSINE]),NUMBER:new Set([o.EUCLIDEAN,o.MANHATTAN,o.Difference]),BITARRAY:new Set([o.TANIMOTO,o.COSINE,o.SOKAL,o.ASYMMETRIC])};let c=null,d=null;function h(t,e=.8,n,i,a,h){return p=this,l=void 0,y=function*(){const p=yield function(){return t=this,e=void 0,r=function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!c&&(c=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==c))return null;let t=!1;if(d&&(d.lost.then((()=>{t=!0})),yield new Promise((t=>setTimeout(t,10)))),!d||t){const t=1e9,e=c.limits,n=e.maxBufferSize,r=e.maxStorageBufferBindingSize;try{return d=yield c.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,t),maxStorageBufferBindingSize:Math.min(r,t)}}),d}catch(t){return console.error("Failed to create device with required limits",t),d=yield c.requestDevice(),d}}return d},new((n=void 0)||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r}();if(!p)return null;const l=Object.values(o);if(n.some((t=>!l.includes(t))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(r).includes(i))throw new Error("Invalid aggregation function provided: "+i);const g=1-e;if(h.length!==t.length||h.length!==n.length||h.length!==a.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(t.some((e=>e.length!==t[0].length)))throw new Error("All entry lists must be the same length");const y=t.length,m=t[0].length,w=t.map(((t,e)=>function(t,e=o.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,a;let c=null;const d=t.some((t=>"string"==typeof t))?(c="STRING",t.map((t=>new Uint32Array(t.split("").map((t=>t.charCodeAt(0))))))):t.some((t=>"number"==typeof t))?(c="NUMBER",t.map((t=>new Float32Array([t])))):"object"==typeof t[0]&&t.some((t=>"_data"in t&&"_length"in t))?(c="BITARRAY",t.map((t=>t._data))):t.some((t=>t instanceof Float32Array))?(c="FLOAT32ARRAY",t):t.some((t=>t instanceof Uint32Array))?(c="UINT32ARRAY",t):t.some((t=>t instanceof Int32Array))?(c="INT32ARRAY",t):void 0;if(!d||!c)throw new Error("Invalid entry type, could not determine entry type from input list");const h=d[0]instanceof Int32Array?"INT32ARRAY":d[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",f=new Uint32Array(d.map((t=>t.length)));if(!u[c]||!u[c].has(e))throw new Error(`Distance metric '${e}' not supported for entry type '${c}'`);const p=f.reduce(((t,e)=>Math.max(t,e)),0),l=s[e](p),g="INT32ARRAY"===h?Int32Array:"FLOAT32ARRAY"===h?Float32Array:Uint32Array,y=new g(d.length*p);d.forEach(((t,e)=>{y.set(t,e*p)}));let m="",w=0,b="FLOAT32ARRAY",v=null;if(e===o.NEEDLEMAN_WUNSCH||e===o.MONOMER_CHEMICAL_DISTANCE){let t=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((t,e)=>Math.max(t,e.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let e=0;e<y.length;e++)y[e]>t&&(t=y[e]);r.scoringMatrix=new Array(t+1).fill(null).map((()=>new Array(t+1).fill(0))),r.alphabetIndexes={};for(let t=0;t<r.scoringMatrix.length;t++)r.scoringMatrix[t][t]=1,r.alphabetIndexes[String.fromCharCode(t)]=t}const e=(t+1)*(t+1),o=new Array(t+1).fill(null).map((()=>new Float32Array(t+1)));for(let e=0;e<t+1;e++)o[e][e]=1;const s=r.alphabetIndexes;for(const t of Object.keys(s))for(const e of Object.keys(s))t!==e&&(o[t.charCodeAt(0)][e.charCodeAt(0)]=r.scoringMatrix[s[t]][s[e]]);w=2+e,b="FLOAT32ARRAY",v=new Float32Array(w),v[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,v[1]=null!==(a=r.gapExtensionPenalty)&&void 0!==a?a:.6;let u=2;for(let t=0;t<o.length;t++)v.set(o[t],u),u+=o[t].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${t+1}>, ${t+1}>`}else if(e===o.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const t=y.reduce(((t,e)=>Math.min(t,e)),y[0]),e=y.reduce(((t,e)=>Math.max(t,e)),y[0]);r.range=e-t}r.range<=0&&(r.range=1),w=1,b="FLOAT32ARRAY",v=new Float32Array([r.range]),m=`\n range${n}: f32`}const A=y instanceof Int32Array?"i32":y instanceof Float32Array?"f32":"u32",E=`data${n}: array<array<${A}, ${p}>, ${d.length}>`;return{flatSourceArray:y,sourceArraySize:y.length,maxEntryLen:p,arraySizes:f,complexity:l,suppInfoBuffer:v,suppInfoSize:w,suppInfoType:b,suppInfoStructWgsl:m,entryType:c,dataTypeWGSL:A,dataStructWgsl:E,EncodedArrayConstructor:g}}(t,n[e],e,h[e])));if(0===y)throw new Error("No columns provided. Please provide at least one column of data.");1===y&&(i=r.MANHATTAN);let b=w.map((t=>t.suppInfoStructWgsl)).filter((t=>!!t&&""!=t)).join(",\n"),v=!1;b&&""!=b.trim()||(v=!0,b="\ndummy: f32\n");const A=w.map((t=>t.dataStructWgsl)).filter((t=>!!t&&""!=t)).join(",\n"),E=new Uint32Array(y*m);w.forEach(((t,e)=>{E.set(t.arraySizes,e*m)}));const x=1e4,_=100,k=w.reduce(((t,e)=>t+e.complexity),0),G=Math.ceil(6e3/k),M=Math.ceil(Math.sqrt(Math.ceil(100))),S=10*M,L=m*(m-1)/2,I=Math.ceil(L/x),N=p.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${I} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${m}>, ${y}>,\n // the weights for each entry\n weights: array<f32, ${y}>,\n // the data for each entry\n ${A} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${b}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${v?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${S} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${m}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${m}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${G}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${g}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${m}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${f(n,w.map((t=>t.maxEntryLen)),g,i)}\n\n\n `}),C=p.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:N,entryPoint:"calcSparseMatrix"}}),U=new Uint32Array(x),D=new Uint32Array(x),O=new Uint32Array(x),R=new Uint32Array(x),j=Math.floor(L/x);let T=0,B=1;console.time("GPUthreadStarts");for(let t=0;t<x;t++){const e=9999===t?L-1:(t+1)*j,n=m-2-Math.floor(Math.sqrt(-8*e+4*m*(m-1)-7)/2-.5),r=e-m*n+Math.floor((n+1)*(n+2)/2);U[t]=B,D[t]=T,O[t]=r,R[t]=n,T=n,B=r}console.timeEnd("GPUthreadStarts");const P=4e4+m*y+y+w.reduce(((t,e)=>t+e.sourceArraySize),0),z=w.reduce(((t,e)=>t+e.suppInfoSize),0),$=1e6,W=P*Uint32Array.BYTES_PER_ELEMENT;let Y=W;const F=15&W;0!==F&&(Y+=16-F);const H=p.createBuffer({label:"compute info buffer",size:Y,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),q=H.getMappedRange();let K=0;new Uint32Array(q,K,x).set(U),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(D),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(O),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,x).set(R),K+=x*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,K,E.length).set(E),K+=E.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(q,K,y).set(a),K+=y*Float32Array.BYTES_PER_ELEMENT;for(const t of w){const e=t.EncodedArrayConstructor,n=t.sourceArraySize;new e(q,K,n).set(t.flatSourceArray),K+=n*e.BYTES_PER_ELEMENT}H.unmap();const V=z*Uint32Array.BYTES_PER_ELEMENT;let X=V;const J=15&V;0!==J&&(X+=16-J),X=Math.max(X,16);const Q=p.createBuffer({label:"supp info buffer",size:X,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),Z=Q.getMappedRange();let tt=0;for(const t of w)t.suppInfoBuffer&&t.suppInfoBuffer.byteLength>0&&t.suppInfoSize>0&&(new("UINT32ARRAY"===t.suppInfoType?Uint32Array:Float32Array)(Z,tt,t.suppInfoBuffer.length).set(t.suppInfoBuffer),tt+=t.suppInfoBuffer.byteLength);0===tt&&new Uint32Array(Z,0,4).set([1,1,1,1]),Q.unmap();const et=302e4*Uint32Array.BYTES_PER_ELEMENT;let nt=et;const rt=15&et;0!==rt&&(nt+=16-rt);const it=p.createBuffer({label:"results buffer",size:nt,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),ot=p.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:C.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:H}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:it}}]}),at=p.createBuffer({label:"results out buffer",size:it.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),st=[],ut=[],ct=[];let dt=!1;for(;!dt;){const t=p.createCommandEncoder({label:"distance encoder"}),e=t.beginComputePass({label:"distance compute pass"});e.setPipeline(C),e.setBindGroup(0,ot),e.dispatchWorkgroups(M,M),e.end(),t.copyBufferToBuffer(it,0,at,0,at.size);const n=t.finish();p.queue.submit([n]),yield p.queue.onSubmittedWorkDone(),yield at.mapAsync(GPUMapMode.READ);const r=at.getMappedRange();let i=0;const o=new Uint32Array(r,i,$);i+=$*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,$);i+=$*Uint32Array.BYTES_PER_ELEMENT;const s=new Float32Array(r,i,$);i+=$*Float32Array.BYTES_PER_ELEMENT;const u=new Uint32Array(r,i,x);i+=x*Uint32Array.BYTES_PER_ELEMENT,dt=new Uint32Array(r,i,x).every((t=>1===t));const c=u.reduce(((t,e)=>t+e),0),d=new Uint32Array(c),h=new Uint32Array(c),f=new Float32Array(c);let l=0;for(let t=0;t<u.length;t++){const e=u[t];0!==e&&(d.set(o.subarray(t*_,t*_+e),l),h.set(a.subarray(t*_,t*_+e),l),f.set(s.subarray(t*_,t*_+e),l),l+=e)}st.push(d),ut.push(h),ct.push(f),at.unmap()}const ht=st.reduce(((t,e)=>t+e.length),0),ft=new Uint32Array(ht),pt=new Uint32Array(ht),lt=new Float32Array(ht);let gt=0;for(let t=0;t<st.length;t++)ft.set(st[t],gt),pt.set(ut[t],gt),lt.set(ct[t],gt),gt+=st[t].length;return H.destroy(),Q.destroy(),it.destroy(),at.destroy(),{i:ft,j:pt,distance:lt}},new((g=void 0)||(g=Promise))((function(t,e){function n(t){try{i(y.next(t))}catch(t){e(t)}}function r(t){try{i(y.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):(i=e.value,i instanceof g?i:new g((function(t){t(i)}))).then(n,r)}i((y=y.apply(p,l||[])).next())}));var p,l,g,y}function f(t,e,n,r){return t.map(((t,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${a[t](e[r],r)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${t.length}>;\n ${t.map(((t,e)=>`distances[${e}] = distanceScript${e}(aIndex, bIndex);`)).join("\n")}\n ${i[r](t.length)}\n }\n \n `}var p=n(5731);let l=Promise.resolve();const g=async()=>{await l;let t=()=>{};const e=new Promise((e=>{t=e}));return l=e,t};async function y(t,e,r){const i=Math.min(Math.min(Math.max(navigator.hardwareConcurrency-2,1),e),10),o=5*i,a=new Uint32Array(o),s=new Uint32Array(o),u=e/o;for(let t=0;t<o;t++)a[t]=Math.floor(t*u),s[t]=t===o-1?e:Math.floor((t+1)*u);const c=new Array(i).fill(0).map((()=>new Worker(new URL(n.p+n.u(801),n.b)))),d=new Set;for(let t=0;t<o;t++)d.add(t);const h=c.map((n=>new Promise((i=>{n.postMessage({is:t.i,js:t.j,ds:t.distance,nRows:e,pruneValue:r}),n.onmessage=()=>{i()}}))));await Promise.all(h);const f=[],p=async t=>{const e=await g(),n=d.values().next().value;null!=n?(d.delete(n),e(),await new Promise((e=>{c[t].postMessage({blockStart:a[n],blockEnd:s[n],workerIdx:t}),c[t].onmessage=t=>{f.push(t.data),e()}})),await p(t)):e()},l=c.map(((t,e)=>p(e)));await Promise.all(l),c.forEach((t=>t.terminate()));let y=0;for(const t of f)y+=t.i.length;const m=new Uint32Array(y),w=new Uint32Array(y),b=new Float32Array(y);let v=0;for(const t of f)m.set(t.i,v),w.set(t.j,v),b.set(t.distance,v),v+=t.i.length;return{i:m,j:w,distance:b}}function m(t,e){const n=t.distance;for(let r=0;r<t.i.length;r++)n[r]=Math.pow(n[r],e);return t}function w(t,e,n,r){r&&(t=function(t,e){const n=[],r=[],i=[];for(let o=0;o<t.i.length;o++)t.distance[o]>e&&(n.push(t.i[o]),r.push(t.j[o]),i.push(t.distance[o]));return{i:new Uint32Array(n),j:new Uint32Array(r),distance:new Float32Array(i)}}(t,n));const i=new Float32Array(e),o=t.distance,a=t.j;for(let e=0;e<t.i.length;e++)i[a[e]]+=o[e];for(let e=0;e<t.i.length;e++){const t=i[a[e]];0!==t&&(o[e]/=t)}return t}var b=n(934),v=n.n(b),A=n(8903),E=n.n(A);function x(t,e,n){const r=new(v());for(let e=0;e<t.length;e++)r.addNode(t[e],{x:2e4*Math.random(),y:2e4*Math.random()});for(let t=0;t<e.i.length;t++){const i=e.i[t],o=e.j[t],a=e.v[t];if(i===o||a<=0)continue;const s=n[i]===n[o]?2:1;r.addEdge(i,o,{weight:a*s})}const i={iterations:100,getEdgeWeight:"weight",settings:{...E().inferSettings(r),weighted:!0,edgeWeightInfluence:1}};E().assign(r,i);const o=new Float32Array(t.length),a=new Float32Array(t.length);for(let e=0;e<t.length;e++){const n=r.getNodeAttributes(t[e]);o[e]=n.x,a[e]=n.y}let s=o[0],u=a[0],c=o[0],d=a[0];for(let e=1;e<t.length;e++)s=Math.min(s,o[e]),u=Math.min(u,a[e]),c=Math.max(c,o[e]),d=Math.max(d,a[e]);let h=c-s,f=d-u;0===h&&(h=1),0===f&&(f=1);for(let e=0;e<t.length;e++)o[e]=(o[e]-s)/h,a[e]=(a[e]-u)/f;return{embedX:o,embedY:a}}const _={expandFactor:2,maxIterations:5,inflateFactor:2,multFactor:1,pruneValue:1e-17};class k{constructor(t={}){this._options={..._,...t}}async transform(t,e){const n=this.assignClusters(t,e);this.correctClusters(n.clusters);const r=this.splitConnectionsIntoClusters(t,n.clusters),i=await async function(t,e,n,r,i){let o=function(t,e,n){const r=new Uint32Array(2*t.i.length+e),i=new Uint32Array(2*t.j.length+e),o=new Float32Array(2*t.distance.length+e);for(let t=0;t<e;t++)r[t]=t,i[t]=t,o[t]=1;for(let n=0;n<t.i.length;n++){const a=2*n+e;r[a]=t.i[n],i[a]=t.j[n],o[a]=1-t.distance[n],r[a+1]=t.j[n],i[a+1]=t.i[n],o[a+1]=1-t.distance[n]}return w({i:r,j:i,distance:o},e,n,!1),{i:r,j:i,distance:o}}(t,e,i);for(let t=0;t<r;t++)o=await y(o,e,i),o=w(o,e,i,!1),o=m(o,n),o=w(o,e,i,!0),console.log("MCL iteration",t);return o}(t,e,this._options.inflateFactor,this._options.maxIterations,this._options.pruneValue),{clusters:o}=this.assignClusters(i,e);this.correctClusters(o);const a=this.layout(n.clusters,r,e,o);return{clusters:o,embedX:a.embedX,embedY:a.embedY,is:t.i,js:t.j}}async transformWebGPU(t,e){return this.transform(t,e)}splitConnectionsIntoClusters(t,e){const n=new Map;for(let t=0;t<e.length;t++)n.has(e[t])||n.set(e[t],{i:[],j:[],v:[]});for(let r=0;r<t.i.length;r++){const i=e[t.i[r]],o=n.get(i);o.i.push(t.i[r]),o.j.push(t.j[r]),o.v.push(1-t.distance[r])}return n}assignClusters(t,e){let n=0;const r=[],i=[],o=new Array(e).fill(-1);for(let e=0;e<t.i.length;e++){const a=t.i[e],s=t.j[e];a!==s&&(r.push(a),i.push(s),-1!==o[a]&&-1!==o[s]?o[a]!==o[s]&&this.mergeClusters(o,a,s):-1!==o[a]?o[s]=o[a]:-1!==o[s]?o[a]=o[s]:(n++,o[a]=n,o[s]=n))}for(let t=0;t<o.length;t++)-1===o[t]&&(n++,o[t]=n);return{clusters:o,is:new Uint32Array(r),js:new Uint32Array(i)}}mergeClusters(t,e,n){const r=t[e],i=t[n];for(let e=0;e<t.length;e++)t[e]===i&&(t[e]=r)}correctClusters(t){const e={};for(const n of t)e[n]||(e[n]=0),e[n]++;const n=Object.keys(e).map(Number).sort(((t,n)=>e[n]-e[t])),r={};n.forEach(((t,e)=>r[t]=e+1));for(let e=0;e<t.length;e++)t[e]=r[t[e]]}layout(t,e,n,r){const i=new Float32Array(n).fill(0),o=new Float32Array(n).fill(0),a={};t.forEach(((t,e)=>{a[t]||(a[t]=[]),a[t].push(e)}));let s=0;const u=Object.keys(a);u.sort(((t,e)=>a[e].length-a[t].length));let c=1,d=0;const h=[1];if(u.length>1){const t=a[u[0]].length,e=a[u[1]].length;t/e<2&&(h[0]=2);let n=h[0],r=3*n,i=1==n?t:t+e,o=0,s=0;for(let t=2;t<u.length;t++)o+=a[u[t]].length,s++,(s>r||o>=.7*i||t===u.length-1)&&(h.push(t===u.length-1?r:s),n=s,r=3*n,i=Math.max(o,i),o=0,s=0)}c=h[0];let f=0;for(const t of u){const n=a[t],u=x(n,e.get(Number(t)),r);s===c&&(s=0,d+=5/c,f++,c=Math.min(Math.ceil(h[f]),45));const p=5*s/c+5/c*(1/1.2/4);for(let t=0;t<u.embedX.length;t++)i[n[t]]=5*u.embedX[t]/c/1.2+p,o[n[t]]=5*u.embedY[t]/c/1.2+d;s++}return{embedX:i,embedY:o}}}onmessage=async t=>{const{data:e,threshold:n,weights:r,aggregationMethod:i,distanceFnArgs:o,distanceFns:a,maxIterations:s,useWebGPU:u,inflate:c}=t.data;console.time("sparse matrix");let d=null;if(u)try{d=await h(e,n/100,a,i,r,o)}catch(t){console.error(t)}d||(u&&console.error("WEBGPU sparse matrix calculation failed, falling back to CPU implementation"),d=await(new p.p).calcMultiColumn(e,a,n/100,o,r,i));const f=1e6;d.i.length>f&&(d=p.p.pruneSparseMatrix(d,f)),console.timeEnd("sparse matrix");const l=new k({maxIterations:s??5,inflateFactor:c??2});console.time("MCL");let g=null;if(u)try{g=await l.transformWebGPU(d,e[0].length)}catch(t){console.error("webGPU MCL failed, falling back to CPU implementation"),console.error(t)}g||(g=await l.transform(d,e[0].length)),console.timeEnd("MCL"),postMessage({res:g})}},606:(t,e,n)=>{"use strict";n.d(e,{Qt:()=>i,gD:()=>r}),n(6066);const r=t=>null==t;function i(t,e,n,r){if(n>t[t.length-1])return;const i=t.findIndex((t=>n<t));t.pop(),t.splice(i,0,n),e.pop(),e.splice(i,0,r)}},9937:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(t,e)=>{e.assign=function(t){t=t||{};var e,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(e=0,r=i.length;e<r;e++)if(i[e])for(n in i[e])t[n]=i[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},e.graphToByteArrays=function(t,e){var n,r=t.order,i=t.size,o={},a=new Float32Array(10*r),s=new Float32Array(3*i);return n=0,t.forEachNode((function(t,e){o[t]=n,a[n]=e.x,a[n+1]=e.y,a[n+2]=0,a[n+3]=0,a[n+4]=0,a[n+5]=0,a[n+6]=1,a[n+7]=1,a[n+8]=e.size||1,a[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,r,i,u,c,d,h){var f=o[i],p=o[u],l=e(t,r,i,u,c,d,h);a[f+6]+=l,a[p+6]+=l,s[n]=f,s[n+1]=p,s[n+2]=l,n+=3})),{nodes:a,edges:s}},e.assignLayoutChanges=function(t,e,n){var r=0;t.updateEachNodeAttributes((function(t,i){return i.x=e[r],i.y=e[r+1],r+=10,n?n(t,i):i}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,r){e[n]=r.x,e[n+1]=r.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var r=t.nodes(),i={},o=0,a=0,s=e.length;o<s;o+=10){if(n){var u=Object.assign({},t.getNodeAttributes(r[a]));u.x=e[o],u.y=e[o+1],u=n(r[a],u),i[r[a]]={x:u.x,y:u.y}}else i[r[a]]={x:e[o],y:e[o+1]};a++}return i},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),r=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return e.revokeObjectURL(r),i}},8903:(t,e,n)=>{var r=n(1736),i=n(8153).Fd,o=n(2561),a=n(1782),s=n(9937);function u(t,e,n){if(!r(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var u=n.iterations;if("number"!=typeof u)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(u<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var c=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,d="function"==typeof n.outputReducer?n.outputReducer:null,h=a.assign({},s,n.settings),f=a.validateSettings(h);if(f)throw new Error("graphology-layout-forceatlas2: "+f.message);var p,l=a.graphToByteArrays(e,c);for(p=0;p<u;p++)o(h,l.nodes,l.edges);if(!t)return a.collectLayoutChanges(e,l.nodes);a.assignLayoutChanges(e,l.nodes,d)}var c=u.bind(null,!1);c.assign=u.bind(null,!0),c.inferSettings=function(t){var e="number"==typeof t?t:t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}},t.exports=c},2561:t=>{var e=10;t.exports=function(t,n,r){var i,o,a,s,u,c,d,h,f,p,l,g,y,m,w,b,v,A,E,x,_,k,G,M=n.length,S=r.length,L=t.adjustSizes,I=t.barnesHutTheta*t.barnesHutTheta,N=[];for(a=0;a<M;a+=e)n[a+4]=n[a+2],n[a+5]=n[a+3],n[a+2]=0,n[a+3]=0;if(t.outboundAttractionDistribution){for(l=0,a=0;a<M;a+=e)l+=n[a+6];l/=M/e}if(t.barnesHutOptimize){var C,U,D,O=1/0,R=-1/0,j=1/0,T=-1/0;for(a=0;a<M;a+=e)O=Math.min(O,n[a+0]),R=Math.max(R,n[a+0]),j=Math.min(j,n[a+1]),T=Math.max(T,n[a+1]);var B=R-O,P=T-j;for(B>P?T=(j-=(B-P)/2)+B:R=(O-=(P-B)/2)+P,N[0]=-1,N[1]=(O+R)/2,N[2]=(j+T)/2,N[3]=Math.max(R-O,T-j),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,a=0;a<M;a+=e)for(o=0,D=3;;){if(!(N[o+5]>=0)){if(N[o+0]<0){N[o+0]=a;break}if(N[o+5]=9*i,h=N[o+3]/2,N[(f=N[o+5])+0]=-1,N[f+1]=N[o+1]-h,N[f+2]=N[o+2]-h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]-h,N[f+2]=N[o+2]+h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]+h,N[f+2]=N[o+2]-h,N[f+3]=h,N[f+4]=f+9,N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,N[(f+=9)+0]=-1,N[f+1]=N[o+1]+h,N[f+2]=N[o+2]+h,N[f+3]=h,N[f+4]=N[o+4],N[f+5]=-1,N[f+6]=0,N[f+7]=0,N[f+8]=0,i+=4,C=n[N[o+0]+0]<N[o+1]?n[N[o+0]+1]<N[o+2]?N[o+5]:N[o+5]+9:n[N[o+0]+1]<N[o+2]?N[o+5]+18:N[o+5]+27,N[o+6]=n[N[o+0]+6],N[o+7]=n[N[o+0]+0],N[o+8]=n[N[o+0]+1],N[C+0]=N[o+0],N[o+0]=-1,C===(U=n[a+0]<N[o+1]?n[a+1]<N[o+2]?N[o+5]:N[o+5]+9:n[a+1]<N[o+2]?N[o+5]+18:N[o+5]+27)){if(D--){o=C;continue}D=3;break}N[U+0]=a;break}C=n[a+0]<N[o+1]?n[a+1]<N[o+2]?N[o+5]:N[o+5]+9:n[a+1]<N[o+2]?N[o+5]+18:N[o+5]+27,N[o+7]=(N[o+7]*N[o+6]+n[a+0]*n[a+6])/(N[o+6]+n[a+6]),N[o+8]=(N[o+8]*N[o+6]+n[a+1]*n[a+6])/(N[o+6]+n[a+6]),N[o+6]+=n[a+6],o=C}}if(t.barnesHutOptimize){for(g=t.scalingRatio,a=0;a<M;a+=e)for(o=0;;)if(N[o+5]>=0){if(b=Math.pow(n[a+0]-N[o+7],2)+Math.pow(n[a+1]-N[o+8],2),4*(p=N[o+3])*p/b<I){if(y=n[a+0]-N[o+7],m=n[a+1]-N[o+8],!0===L?b>0?(v=g*n[a+6]*N[o+6]/b,n[a+2]+=y*v,n[a+3]+=m*v):b<0&&(v=-g*n[a+6]*N[o+6]/Math.sqrt(b),n[a+2]+=y*v,n[a+3]+=m*v):b>0&&(v=g*n[a+6]*N[o+6]/b,n[a+2]+=y*v,n[a+3]+=m*v),(o=N[o+4])<0)break;continue}o=N[o+5]}else if((c=N[o+0])>=0&&c!==a&&(b=(y=n[a+0]-n[c+0])*y+(m=n[a+1]-n[c+1])*m,!0===L?b>0?(v=g*n[a+6]*n[c+6]/b,n[a+2]+=y*v,n[a+3]+=m*v):b<0&&(v=-g*n[a+6]*n[c+6]/Math.sqrt(b),n[a+2]+=y*v,n[a+3]+=m*v):b>0&&(v=g*n[a+6]*n[c+6]/b,n[a+2]+=y*v,n[a+3]+=m*v)),(o=N[o+4])<0)break}else for(g=t.scalingRatio,s=0;s<M;s+=e)for(u=0;u<s;u+=e)y=n[s+0]-n[u+0],m=n[s+1]-n[u+1],!0===L?(b=Math.sqrt(y*y+m*m)-n[s+8]-n[u+8])>0?(v=g*n[s+6]*n[u+6]/b/b,n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v):b<0&&(v=100*g*n[s+6]*n[u+6],n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v):(b=Math.sqrt(y*y+m*m))>0&&(v=g*n[s+6]*n[u+6]/b/b,n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v);for(f=t.gravity/t.scalingRatio,g=t.scalingRatio,a=0;a<M;a+=e)v=0,y=n[a+0],m=n[a+1],b=Math.sqrt(Math.pow(y,2)+Math.pow(m,2)),t.strongGravityMode?b>0&&(v=g*n[a+6]*f):b>0&&(v=g*n[a+6]*f/b),n[a+2]-=y*v,n[a+3]-=m*v;for(g=1*(t.outboundAttractionDistribution?l:1),d=0;d<S;d+=3)s=r[d+0],u=r[d+1],h=r[d+2],w=Math.pow(h,t.edgeWeightInfluence),y=n[s+0]-n[u+0],m=n[s+1]-n[u+1],!0===L?(b=Math.sqrt(y*y+m*m)-n[s+8]-n[u+8],t.linLogMode?t.outboundAttractionDistribution?b>0&&(v=-g*w*Math.log(1+b)/b/n[s+6]):b>0&&(v=-g*w*Math.log(1+b)/b):t.outboundAttractionDistribution?b>0&&(v=-g*w/n[s+6]):b>0&&(v=-g*w)):(b=Math.sqrt(Math.pow(y,2)+Math.pow(m,2)),t.linLogMode?t.outboundAttractionDistribution?b>0&&(v=-g*w*Math.log(1+b)/b/n[s+6]):b>0&&(v=-g*w*Math.log(1+b)/b):t.outboundAttractionDistribution?(b=1,v=-g*w/n[s+6]):(b=1,v=-g*w)),b>0&&(n[s+2]+=y*v,n[s+3]+=m*v,n[u+2]-=y*v,n[u+3]-=m*v);if(!0===L)for(a=0;a<M;a+=e)1!==n[a+9]&&((A=Math.sqrt(Math.pow(n[a+2],2)+Math.pow(n[a+3],2)))>10&&(n[a+2]=10*n[a+2]/A,n[a+3]=10*n[a+3]/A),E=n[a+6]*Math.sqrt((n[a+4]-n[a+2])*(n[a+4]-n[a+2])+(n[a+5]-n[a+3])*(n[a+5]-n[a+3])),x=Math.sqrt((n[a+4]+n[a+2])*(n[a+4]+n[a+2])+(n[a+5]+n[a+3])*(n[a+5]+n[a+3]))/2,_=.1*Math.log(1+x)/(1+Math.sqrt(E)),k=n[a+0]+n[a+2]*(_/t.slowDown),n[a+0]=k,G=n[a+1]+n[a+3]*(_/t.slowDown),n[a+1]=G);else for(a=0;a<M;a+=e)1!==n[a+9]&&(E=n[a+6]*Math.sqrt((n[a+4]-n[a+2])*(n[a+4]-n[a+2])+(n[a+5]-n[a+3])*(n[a+5]-n[a+3])),x=Math.sqrt((n[a+4]+n[a+2])*(n[a+4]+n[a+2])+(n[a+5]+n[a+3])*(n[a+5]+n[a+3]))/2,_=n[a+7]*Math.log(1+x)/(1+Math.sqrt(E)),n[a+7]=Math.min(1,Math.sqrt(_*(Math.pow(n[a+2],2)+Math.pow(n[a+3],2))/(1+Math.sqrt(E)))),k=n[a+0]+n[a+2]*(_/t.slowDown),n[a+0]=k,G=n[a+1]+n[a+3]*(_/t.slowDown),n[a+1]=G);return{}}},8153:(t,e)=>{function n(t){return"number"!=typeof t||isNaN(t)?1:t}e.Fd=function(t){return function(t,e){var n={},r=function(t){return void 0===t?e:t};"function"==typeof e&&(r=e);var i=function(e){return r(e[t])},o=function(){return r(void 0)};return"string"==typeof t?(n.fromAttributes=i,n.fromGraph=function(t,e){return i(t.getEdgeAttributes(e))},n.fromEntry=function(t,e){return i(e)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof t?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(e,n){var i=e.extremities(n);return r(t(n,e.getEdgeAttributes(n),i[0],i[1],e.getNodeAttributes(i[0]),e.getNodeAttributes(i[1]),e.isUndirected(n)))},n.fromEntry=function(e,n,i,o,a,s,u){return r(t(e,n,i,o,a,s,u))},n.fromPartialEntry=function(e,n,i,o){return r(t(e,n,i,o))},n.fromMinimalEntry=function(e,n){return r(t(e,n))}):(n.fromAttributes=o,n.fromGraph=o,n.fromEntry=o,n.fromMinimalEntry=o),n}(t,n)}},1736:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},934:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function i(t,e,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o},i.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return i(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,t)},o(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var s=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var r in arguments[e])t[r]=arguments[e][r];return t};function u(t,e,n,r){var i=t._nodes.get(e),o=null;return i?o="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:o}function c(e){return"object"===t(e)&&null!==e}function d(t){var e;for(e in t)return!1;return!0}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function f(t,e,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(t,e,r)}function p(t){return!(!c(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(s=Object.assign);var l,g={exports:{}},y="object"==typeof Reflect?Reflect:null,m=y&&"function"==typeof y.apply?y.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};l=y&&"function"==typeof y.ownKeys?y.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var w=Number.isNaN||function(t){return t!=t};function b(){b.init.call(this)}g.exports=b,g.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}L(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&L(t,"error",e,{once:!0})}(t,i)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var v=10;function A(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function E(t){return void 0===t._maxListeners?b.defaultMaxListeners:t._maxListeners}function x(t,e,n,r){var i,o,a,s;if(A(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=E(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function k(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=_.bind(r);return i.listener=n,r.wrapFn=i,i}function G(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):S(i,i.length)}function M(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function S(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function L(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}function I(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(t){if("number"!=typeof t||t<0||w(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");v=t}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||w(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},b.prototype.getMaxListeners=function(){return E(this)},b.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[t];if(void 0===s)return!1;if("function"==typeof s)m(s,this,e);else{var u=s.length,c=S(s,u);for(n=0;n<u;++n)m(c[n],this,e)}return!0},b.prototype.addListener=function(t,e){return x(this,t,e,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(t,e){return x(this,t,e,!0)},b.prototype.once=function(t,e){return A(e),this.on(t,k(this,t,e)),this},b.prototype.prependOnceListener=function(t,e){return A(e),this.prependListener(t,k(this,t,e)),this},b.prototype.removeListener=function(t,e){var n,r,i,o,a;if(A(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},b.prototype.listeners=function(t){return G(this,t,!0)},b.prototype.rawListeners=function(t){return G(this,t,!1)},b.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):M.call(t,e)},b.prototype.listenerCount=M,b.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]},"undefined"!=typeof Symbol&&(I.prototype[Symbol.iterator]=function(){return this}),I.of=function(){var t=arguments,e=t.length,n=0;return new I((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},I.empty=function(){return new I((function(){return{done:!0}}))},I.fromSequence=function(t){var e=0,n=t.length;return new I((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},I.is=function(t){return t instanceof I||"object"==typeof t&&null!==t&&"function"==typeof t.next};var N=I,C={};C.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,C.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var U=N,D=C,O=D.ARRAY_BUFFER_SUPPORT,R=D.SYMBOL_SUPPORT,j=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||O&&ArrayBuffer.isView(t)?U.fromSequence(t):"object"!=typeof t||null===t?null:R&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},T=j,B=function(t,e){for(var n,r=arguments.length>1?e:1/0,i=r!==1/0?new Array(r):[],o=0,a=T(t);;){if(o===r)return i;if((n=a.next()).done)return o!==e&&(i.length=o),i;i[o++]=n.value}},P=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),z=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P),$=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P),W=function(t){function n(e){var r;return(r=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(r),n.prototype.constructor),r}return e(n,t),n}(P);function Y(t,e){this.key=t,this.attributes=e,this.clear()}function F(t,e){this.key=t,this.attributes=e,this.clear()}function H(t,e){this.key=t,this.attributes=e,this.clear()}function q(t,e,n,r,i){this.key=e,this.attributes=i,this.undirected=t,this.source=n,this.target=r}function K(t,e,n,r,i,o,a){var s,u,c,d;if(r=""+r,0===n){if(!(s=t._nodes.get(r)))throw new $("Graph.".concat(e,': could not find the "').concat(r,'" node in the graph.'));c=i,d=o}else if(3===n){if(i=""+i,!(u=t._edges.get(i)))throw new $("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));var h=u.source.key,f=u.target.key;if(r===h)s=u.target;else{if(r!==f)throw new $("Graph.".concat(e,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(h,", ").concat(f,")."));s=u.source}c=o,d=a}else{if(!(u=t._edges.get(r)))throw new $("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));s=1===n?u.source:u.target,c=i,d=o}return[s,c,d]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},F.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},H.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},q.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,r=this.target.key;this.source[t][r]=this,this.undirected&&n===r||(this.target[e][n]=this)},q.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,r=this.target.key;this.undirected&&(t=e="undirected");var i=this.source[t],o=i[r];if(void 0===o)return i[r]=this,void(this.undirected&&n===r||(this.target[e][n]=this));o.previous=this,this.next=o,i[r]=this,this.target[e][n]=this},q.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][e],delete this.target[r][t]},q.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[r][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[r][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var V=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return a.attributes[s]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){return K(this,e,n,t,r)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return a.attributes.hasOwnProperty(s)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=K(this,e,n,t,r,i,o),s=a[0],u=a[1],c=a[2];return s.attributes[u]=c,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i,o){var a=K(this,e,n,t,r,i,o),s=a[0],u=a[1],c=a[2];if("function"!=typeof c)throw new z("Graph.".concat(e,": updater should be a function."));var d=s.attributes,h=c(d[u]);return d[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];if(!c(s))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],u=o[1];if(!c(u))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return s(a.attributes,u),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:u}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o=K(this,e,n,t,r,i),a=o[0],s=o[1];if("function"!=typeof s)throw new z("Graph.".concat(e,": provided updater is not a function."));return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}}],X=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+t,o=""+arguments[1];if(!(r=u(this,i,o,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(i,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,s=""+r;if(r=arguments[2],i=arguments[3],!(o=u(this,a,s,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var a=""+t,s=""+r;if(r=arguments[2],i=arguments[3],!(o=u(this,a,s,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(a,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new z("Graph.".concat(e,": updater should be a function."));return o.attributes[r]=i(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(r))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(r))throw new z("Graph.".concat(e,": provided attributes are not a plain object."));return s(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new W("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new W("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,a=""+r;if(r=arguments[2],!(i=u(this,o,a,n)))throw new $("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new W("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new $("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new z("Graph.".concat(e,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],J=N,Q=j,Z=function(){var t=arguments,e=null,n=-1;return new J((function(){for(var r=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=Q(t[n])}if(!0!==(r=e.next()).done)break;e=null}return r}))},tt=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function et(t,e,n,r){var i=!1;for(var o in e)if(o!==r){var a=e[o];if(i=n(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),t&&i)return a.key}}function nt(t,e,n,r){var i,o,a,s=!1;for(var u in e)if(u!==r){i=e[u];do{if(o=i.source,a=i.target,s=n(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected),t&&s)return i.key;i=i.next}while(void 0!==i)}}function rt(t,e){var n,r=Object.keys(t),i=r.length,o=0;return new N((function(){do{if(n)n=n.next;else{if(o>=i)return{done:!0};var a=r[o++];if(a===e){n=void 0;continue}n=t[a]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function it(t,e,n,r){var i=e[n];if(i){var o=i.source,a=i.target;return r(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected)&&t?i.key:void 0}}function ot(t,e,n,r){var i=e[n];if(i){var o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),t&&o)return i.key;i=i.next}while(void 0!==i)}}function at(t,e){var n=t[e];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function st(t,e,n,r){if(0!==e.size)for(var i,o,a="mixed"!==n&&n!==e.type,s="undirected"===n,u=!1,c=e._edges.values();!0!==(i=c.next()).done;)if(o=i.value,!a||o.undirected===s){var d=o,h=d.key,f=d.attributes,p=d.source,l=d.target;if(u=r(h,f,p.key,l.key,p.attributes,l.attributes,o.undirected),t&&u)return h}}function ut(t,e,n,r,i,o){var a,s=e?nt:et;if("undirected"!==n){if("out"!==r&&(a=s(t,i.in,o),t&&a))return a;if("in"!==r&&(a=s(t,i.out,o,r?void 0:i.key),t&&a))return a}if("directed"!==n&&(a=s(t,i.undirected,o),t&&a))return a}function ct(t,e,n,r,i,o,a){var s,u=n?ot:it;if("undirected"!==e){if(void 0!==i.in&&"out"!==r&&(s=u(t,i.in,o,a),t&&s))return s;if(void 0!==i.out&&"in"!==r&&(r||i.key!==o)&&(s=u(t,i.out,o,a),t&&s))return s}if("directed"!==e&&void 0!==i.undirected&&(s=u(t,i.undirected,o,a),t&&s))return s}var dt=[{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 ht(){this.A=null,this.B=null}function ft(t,e,n,r,i){for(var o in r){var a=r[o],s=a.source,u=a.target,c=s===n?u:s;if(!e||!e.has(c.key)){var d=i(c.key,c.attributes);if(t&&d)return c.key}}}function pt(t,e,n,r,i){if("mixed"!==e){if("undirected"===e)return ft(t,null,r,r.undirected,i);if("string"==typeof n)return ft(t,null,r,r[n],i)}var o,a=new ht;if("undirected"!==e){if("out"!==n){if(o=ft(t,null,r,r.in,i),t&&o)return o;a.wrap(r.in)}if("in"!==n){if(o=ft(t,a,r,r.out,i),t&&o)return o;a.wrap(r.out)}}if("directed"!==e&&(o=ft(t,a,r,r.undirected,i),t&&o))return o}function lt(t,e,n){var r=Object.keys(n),i=r.length,o=0;return new N((function(){var a=null;do{if(o>=i)return t&&t.wrap(n),{done:!0};var s=n[r[o++]],u=s.source,c=s.target;a=u===e?c:u,t&&t.has(a.key)&&(a=null)}while(null===a);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}))}function gt(t,e,n,r,i){for(var o,a,s,u,c,d,h,f=r._nodes.values(),p=r.type;!0!==(o=f.next()).done;){var l=!1;if(a=o.value,"undirected"!==p)for(s in u=a.out){c=u[s];do{if(d=c.target,l=!0,h=i(a.key,d.key,a.attributes,d.attributes,c.key,c.attributes,c.undirected),t&&h)return c;c=c.next}while(c)}if("directed"!==p)for(s in u=a.undirected)if(!(e&&a.key>s)){c=u[s];do{if((d=c.target).key!==s&&(d=c.source),l=!0,h=i(a.key,d.key,a.attributes,d.attributes,c.key,c.attributes,c.undirected),t&&h)return c;c=c.next}while(c)}if(n&&!l&&(h=i(a.key,null,a.attributes,null,null,null,null),t&&h))return null}}function yt(t){if(!c(t))throw new z('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new z("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!c(t.attributes)||null===t.attributes))throw new z("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function mt(t){if(!c(t))throw new z('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new z("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new z("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!c(t.attributes)||null===t.attributes))throw new z("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new z("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}ht.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},ht.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var wt,bt=(wt=255&Math.floor(256*Math.random()),function(){return wt++}),vt=new Set(["directed","undirected","mixed"]),At=new Set(["domain","_events","_eventsCount","_maxListeners"]),Et={allowSelfLoops:!0,multi:!1,type:"mixed"};function xt(t,e,n){var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}function _t(t,e,n,r,i,o,a,s){if(!r&&"undirected"===t.type)throw new W("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new W("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(s&&!c(s))throw new z("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(s,'"'));if(o=""+o,a=""+a,s=s||{},!t.allowSelfLoops&&o===a)throw new W("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var u=t._nodes.get(o),d=t._nodes.get(a);if(!u)throw new $("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!d)throw new $("Graph.".concat(e,': target node "').concat(a,'" not found.'));var h={key:null,undirected:r,source:o,target:a,attributes:s};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new W("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));if(!t.multi&&(r?void 0!==u.undirected[a]:void 0!==u.out[a]))throw new W("Graph.".concat(e,': an edge linking "').concat(o,'" to "').concat(a,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var f=new q(r,i,u,d,s);t._edges.set(i,f);var p=o===a;return r?(u.undirectedDegree++,d.undirectedDegree++,p&&(u.undirectedLoops++,t._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,p&&(u.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,h.key=i,t.emit("edgeAdded",h),i}function kt(t,e,n,r,i,o,a,u,d){if(!r&&"undirected"===t.type)throw new W("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===t.type)throw new W("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(u)if(d){if("function"!=typeof u)throw new z("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(u,'"'))}else if(!c(u))throw new z("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(u,'"'));var h;if(o=""+o,a=""+a,d&&(h=u,u=void 0),!t.allowSelfLoops&&o===a)throw new W("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var f,p,l=t._nodes.get(o),g=t._nodes.get(a);if(!n&&(f=t._edges.get(i))){if(!(f.source.key===o&&f.target.key===a||r&&f.source.key===a&&f.target.key===o))throw new W("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(o,'" source & "').concat(a,'" target vs. ("').concat(f.source.key,'", "').concat(f.target.key,'").'));p=f}if(p||t.multi||!l||(p=r?l.undirected[a]:l.out[a]),p){var y=[p.key,!1,!1,!1];if(d?!h:!u)return y;if(d){var m=p.attributes;p.attributes=h(m),t.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else s(p.attributes,u),t.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:u});return y}u=u||{},d&&h&&(u=h(u));var w={key:null,undirected:r,source:o,target:a,attributes:u};if(n)i=t._edgeKeyGenerator();else if(i=""+i,t._edges.has(i))throw new W("Graph.".concat(e,': the "').concat(i,'" edge already exists in the graph.'));var b=!1,v=!1;l||(l=xt(t,o,{}),b=!0,o===a&&(g=l,v=!0)),g||(g=xt(t,a,{}),v=!0),f=new q(r,i,l,g,u),t._edges.set(i,f);var A=o===a;return r?(l.undirectedDegree++,g.undirectedDegree++,A&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,g.inDegree++,A&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?f.attachMulti():f.attach(),r?t._undirectedSize++:t._directedSize++,w.key=i,t.emit("edgeAdded",w),[i,!0,b,v]}function Gt(t,e){t._edges.delete(e.key);var n=e.source,r=e.target,i=e.attributes,o=e.undirected,a=n===r;o?(n.undirectedDegree--,r.undirectedDegree--,a&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,a&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:i,source:n.key,target:r.key,undirected:o})}var Mt=function(n){function r(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=s({},Et,t)).multi)throw new z("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!vt.has(t.type))throw new z('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new z("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var r="mixed"===t.type?Y:"directed"===t.type?F:H;h(a(e),"NodeDataClass",r);var i="geid_"+bt()+"_",o=0;return h(a(e),"_attributes",{}),h(a(e),"_nodes",new Map),h(a(e),"_edges",new Map),h(a(e),"_directedSize",0),h(a(e),"_undirectedSize",0),h(a(e),"_directedSelfLoopCount",0),h(a(e),"_undirectedSelfLoopCount",0),h(a(e),"_edgeKeyGenerator",(function(){var t;do{t=i+o++}while(e._edges.has(t));return t})),h(a(e),"_options",t),At.forEach((function(t){return h(a(e),t,e[t])})),f(a(e),"order",(function(){return e._nodes.size})),f(a(e),"size",(function(){return e._edges.size})),f(a(e),"directedSize",(function(){return e._directedSize})),f(a(e),"undirectedSize",(function(){return e._undirectedSize})),f(a(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),f(a(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),f(a(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),f(a(e),"multi",e._options.multi),f(a(e),"type",e._options.type),f(a(e),"allowSelfLoops",e._options.allowSelfLoops),f(a(e),"implementation",(function(){return"graphology"})),e}e(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(t){return this._nodes.has(""+t)},i.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.out.hasOwnProperty(e)}throw new z("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&i.undirected.hasOwnProperty(e)}throw new z("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(e)||void 0!==r.undirected&&r.undirected.hasOwnProperty(e))}throw new z("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new W("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(t);if(!n)throw new $('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new W("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(t);if(!n)throw new $('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.undirected&&n.undirected[e]||void 0;return r?r.key:void 0}},i.edge=function(t,e){if(this.multi)throw new W("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var r=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},i.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},i.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},i.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},i.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},i.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},i.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new $('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},i.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},i.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},i.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},i.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},i.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},i.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},i.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},i.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},i.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},i.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,r+=e.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,r+=e.directedLoops),n-r},i.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new $('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=e.undirectedDegree,r+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,r+=2*e.directedLoops),n-r},i.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},i.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},i.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},i.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new $('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(t===r)return i;if(t===i)return r;throw new $('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new $('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},i.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},i.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},i.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new $('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},i.addNode=function(t,e){var n=function(t,e,n){if(n&&!c(n))throw new z('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new W('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var r=new t.NodeDataClass(e,n);return t._nodes.set(e,r),t.emit("nodeAdded",{key:e,attributes:n}),r}(this,t,e);return n.key},i.mergeNode=function(t,e){if(e&&!c(e))throw new z('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(s(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},i.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new z('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var r=n.attributes;n.attributes=e(r),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var i=e?e({}):{};return n=new this.NodeDataClass(t,i),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:i}),[t,!0]},i.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new $('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){e=n.out[r];do{Gt(this,e),e=e.next}while(e)}for(var i in n.in){e=n.in[i];do{Gt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{Gt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},i.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(e=u(this,n,r,this.type)))throw new $('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new $('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Gt(this,e),this},i.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new W("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 W("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=u(this,t=""+t,e=""+e,"directed");if(!n)throw new $('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Gt(this,n),this},i.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new W("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 W("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=u(this,t,e,"undirected");if(!n)throw new $('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Gt(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(t){return this._attributes[t]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},i.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.updateAttribute=function(t,e){if("function"!=typeof e)throw new z("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},i.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},i.replaceAttributes=function(t){if(!c(t))throw new z("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(t){if(!c(t))throw new z("Graph.mergeAttributes: provided attributes are not a plain object.");return s(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},i.updateAttributes=function(t){if("function"!=typeof t)throw new z("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new z("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!p(e))throw new z("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=t(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},i.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new z("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!p(e))throw new z("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,o,a=this._edges.values();!0!==(n=a.next()).done;)i=(r=n.value).source,o=r.target,r.attributes=t(r.key,r.attributes,i.key,o.key,i.attributes,o.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},i.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new z("Graph.forEachAdjacencyEntry: expecting a callback.");gt(!1,!1,!1,this,t)},i.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new z("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!1,!0,this,t)},i.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new z("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");gt(!1,!0,!1,this,t)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new z("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");gt(!1,!0,!0,this,t)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):B(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(t){if("function"!=typeof t)throw new z("Graph.forEachNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)},i.findNode=function(t){if("function"!=typeof t)throw new z("Graph.findNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},i.mapNodes=function(t){if("function"!=typeof t)throw new z("Graph.mapNode: expecting a callback.");for(var e,n,r=this._nodes.values(),i=new Array(this.order),o=0;!0!==(e=r.next()).done;)n=e.value,i[o++]=t(n.key,n.attributes);return i},i.someNode=function(t){if("function"!=typeof t)throw new z("Graph.someNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},i.everyNode=function(t){if("function"!=typeof t)throw new z("Graph.everyNode: expecting a callback.");for(var e,n,r=this._nodes.values();!0!==(e=r.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},i.filterNodes=function(t){if("function"!=typeof t)throw new z("Graph.filterNodes: expecting a callback.");for(var e,n,r=this._nodes.values(),i=[];!0!==(e=r.next()).done;)t((n=e.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(t,e){if("function"!=typeof t)throw new z("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new z("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=e,o=this._nodes.values();!0!==(n=o.next()).done;)i=t(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var t=this._nodes.values();return new N((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,r){e[n++]=function(t,e){var n={key:t};return d(e.attributes)||(n.attributes=s({},e.attributes)),n}(r,t)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,i){r[n++]=function(t,e,n){var r={key:e,source:n.source.key,target:n.target.key};return d(n.attributes)||(r.attributes=s({},n.attributes)),"mixed"===t&&n.undirected&&(r.undirected=!0),r}(t.type,i,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}},i.import=function(t){var e,n,i,o,a,s=this,u=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof r)return t.forEachNode((function(t,e){u?s.mergeNode(t,e):s.addNode(t,e)})),t.forEachEdge((function(t,e,n,r,i,o,a){u?a?s.mergeUndirectedEdgeWithKey(t,n,r,e):s.mergeDirectedEdgeWithKey(t,n,r,e):a?s.addUndirectedEdgeWithKey(t,n,r,e):s.addDirectedEdgeWithKey(t,n,r,e)})),this;if(!c(t))throw new z("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!c(t.attributes))throw new z("Graph.import: invalid attributes. Expecting a plain object.");u?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new z("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=i.length;e<n;e++){yt(o=i[e]);var d=o,h=d.key,f=d.attributes;u?this.mergeNode(h,f):this.addNode(h,f)}}if(t.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=t.edges,!Array.isArray(i))throw new z("Graph.import: invalid edges. Expecting an array.");for(e=0,n=i.length;e<n;e++){mt(a=i[e]);var l=a,g=l.source,y=l.target,m=l.attributes,w=l.undirected,b=void 0===w?p:w;"key"in a?(u?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,a.key,g,y,m):(u?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,g,y,m)}}return this},i.nullCopy=function(t){var e=new r(s({},this._options,t));return e.replaceAttributes(s({},this.getAttributes())),e},i.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var r=s({},t.attributes);t=new e.NodeDataClass(n,r),e._nodes.set(n,t)})),e},i.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new W('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new W("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new W("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var e,n,r=this.emptyCopy(t),i=this._edges.values();!0!==(e=i.next()).done;)_t(r,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,s({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var r={},i={};this._edges.forEach((function(t,n){var o,a=t.undirected?"--":"->",s="",u=t.source.key,c=t.target.key;t.undirected&&u>c&&(o=u,u=c,c=o);var d="(".concat(u,")").concat(a,"(").concat(c,")");n.startsWith("geid_")?e.multi&&(void 0===i[d]?i[d]=0:i[d]++,s+="".concat(i[d],". ")):s+="[".concat(n,"]: "),r[s+=d]=t.attributes}));var o={};for(var a in this)this.hasOwnProperty(a)&&!At.has(a)&&"function"!=typeof this[a]&&"symbol"!==t(a)&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=n,o.edges=r,h(o,"constructor",this.constructor),o},r}(g.exports.EventEmitter);"undefined"!=typeof Symbol&&(Mt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Mt.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),r="add"===e?_t:kt;t.generateKey?Mt.prototype[n]=function(i,o,a){return r(this,n,!0,"undirected"===(t.type||this.type),null,i,o,a,"update"===e)}:Mt.prototype[n]=function(i,o,a,s){return r(this,n,!1,"undirected"===(t.type||this.type),i,o,a,s,"update"===e)}}))})),function(t){V.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Node"),0),r(t,n("Source"),1),r(t,n("Target"),2),r(t,n("Opposite"),3)}))}(Mt),function(t){X.forEach((function(e){var n=e.name,r=e.attacher;r(t,n("Edge"),"mixed"),r(t,n("DirectedEdge"),"directed"),r(t,n("UndirectedEdge"),"undirected")}))}(Mt),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):B(t._edges.keys(),t._edges.size);for(var n,r,i="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(i),a="undirected"===e,s=t._edges.values(),u=0;!0!==(n=s.next()).done;)(r=n.value).undirected===a&&(o[u++]=r.key);return o}(this,r);if(1===arguments.length){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,r){var i=[];return ut(!1,t,e,n,r,(function(t){i.push(t)})),i}(this.multi,"mixed"===r?this.type:r,i,o)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,r,i){var o=[];return ct(!1,t,e,n,r,i,(function(t){o.push(t)})),o}(r,this.multi,i,a,e)}throw new z("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return st(!1,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ut(!1,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!1,r,this.multi,i,s,e,n)}throw new z("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),t=new Array(i);var a=0;e.push((function(e,r,i,o,s,u,c){t[a++]=n(e,r,i,o,s,u,c)}))}else t=[],e.push((function(e,r,i,o,a,s,u){t.push(n(e,r,i,o,a,s,u))}));return this[o].apply(this,e),t};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,r,i,o,a,s,u){e(t,r,i,o,a,s,u)&&n.push(t)})),this[o].apply(this,t),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new z("Graph.".concat(u,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new z("Graph.".concat(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."));2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var r=e;return n.push((function(e,n,i,o,a,s,u){r=t(r,e,n,i,o,a,s,u)})),this[o].apply(this,n),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return st(!0,this,r,n=t);if(2===arguments.length){t=""+t,n=e;var a=this._nodes.get(t);if(void 0===a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return ut(!0,this.multi,"mixed"===r?this.type:r,i,a,n)}if(3===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!0,r,this.multi,i,s,e,n)}throw new z("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var a="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,s){return e(t,n,r,i,o,a,s)})),!!this[o].apply(this,t)};var s="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,r,i,o,a,s){return!e(t,n,r,i,o,a,s)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(t,e){if(0===t.size)return N.empty();var n="mixed"!==e&&e!==t.type,r="undirected"===e,i=t._edges.values();return new N((function(){for(var t,e;;){if((t=i.next()).done)return t;if(e=t.value,!n||e.undirected===r)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,r);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var r=N.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(r=Z(r,rt(n.in))),"in"!==e&&void 0!==n.out&&(r=Z(r,rt(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(r=Z(r,rt(n.undirected))),r}(r,i,n)}if(2===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new $("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,r){var i=N.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&r in n.in&&(i=Z(i,at(n.in,r))),void 0!==n.out&&"in"!==e&&r in n.out&&(e||n.key!==r)&&(i=Z(i,at(n.out,r)))),"directed"!==t&&void 0!==n.undirected&&r in n.undirected&&(i=Z(i,at(n.undirected,r))),i}(r,i,a,e)}throw new z("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(Mt),function(t){dt.forEach((function(e){(function(t,e){var n=e.name,r=e.type,i=e.direction;t.prototype[n]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new $("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var r=[];return pt(!1,t,e,n,(function(t){r.push(t)})),r}("mixed"===r?this.type:r,i,e)}})(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));pt(!1,"mixed"===r?this.type:r,i,n,e)}};var a="map"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,r){n.push(e(t,r))})),n};var s="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,r){e(t,r)&&n.push(t)})),n};var u="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[u]=function(t,e,n){if(arguments.length<3)throw new z("Graph.".concat(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."));var r=n;return this[o](t,(function(t,n){r=e(r,t,n)})),r}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),a="find"+o;t.prototype[a]=function(t,e){if("mixed"===r||"mixed"===this.type||r===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new $("Graph.".concat(a,': could not find the "').concat(t,'" node in the graph.'));return pt(!0,"mixed"===r?this.type:r,i,n,e)}};var s="some"+o;t.prototype[s]=function(t,e){return!!this[a](t,e)};var u="every"+o;t.prototype[u]=function(t,e){return!this[a](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,r=e.type,i=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new $("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return lt(null,n,n.undirected);if("string"==typeof e)return lt(null,n,n[e])}var r=N.empty(),i=new ht;return"undirected"!==t&&("out"!==e&&(r=Z(r,lt(i,n,n.in))),"in"!==e&&(r=Z(r,lt(i,n,n.out)))),"directed"!==t&&(r=Z(r,lt(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,e)}}(t,e)}))}(Mt);var St=function(t){function n(e){var n=s({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new z("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new z('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Lt=function(t){function n(e){var n=s({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new z("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new z('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),It=function(t){function n(e){var n=s({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(Mt),Nt=function(t){function n(e){var n=s({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new z('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt),Ct=function(t){function n(e){var n=s({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new z("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new z('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(Mt);function Ut(t){t.from=function(e,n){var r=s({},e.options,n),i=new t(r);return i.import(e),i}}return Ut(Mt),Ut(St),Ut(Lt),Ut(It),Ut(Nt),Ut(Ct),Mt.Graph=Mt,Mt.DirectedGraph=St,Mt.UndirectedGraph=Lt,Mt.MultiGraph=It,Mt.MultiDirectedGraph=Nt,Mt.MultiUndirectedGraph=Ct,Mt.InvalidArgumentsGraphError=z,Mt.NotFoundGraphError=$,Mt.UsageGraphError=W,Mt}()}},r={};function i(t){var e=r[t];if(void 0!==e)return e.exports;var o=r[t]={exports:{}};return n[t].call(o.exports,o,o.exports,i),o.exports}i.m=n,i.x=()=>{var t=i.O(void 0,[731],(()=>i(6807)));return i.O(t)},t=[],i.O=(e,n,r,o)=>{if(!n){var a=1/0;for(d=0;d<t.length;d++){for(var[n,r,o]=t[d],s=!0,u=0;u<n.length;u++)(!1&o||a>=o)&&Object.keys(i.O).every((t=>i.O[t](n[u])))?n.splice(u--,1):(s=!1,o<a&&(a=o));if(s){t.splice(d--,1);var c=r();void 0!==c&&(e=c)}}return e}o=o||0;for(var d=t.length;d>0&&t[d-1][2]>o;d--)t[d]=t[d-1];t[d]=[n,r,o]},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,n)=>(i.f[n](t,e),e)),[])),i.u=t=>t+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{i.b=self.location+"";var t={980:1};i.f.i=(e,n)=>{t[e]||importScripts(i.p+i.u(e))};var e=self.webpackChunkeda=self.webpackChunkeda||[],n=e.push.bind(e);e.push=e=>{var[r,o,a]=e;for(var s in o)i.o(o,s)&&(i.m[s]=o[s]);for(a&&a(i);r.length;)t[r.pop()]=1;n(e)}})(),e=i.x,i.x=()=>i.e(731).then(e);var o=i.x();eda=o})();
2
2
  //# sourceMappingURL=980.js.map