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C,uDA9DA,QAAA","file":"/npm/path-scc@1.0.2/scc.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/path-scc@1.0.2/scc.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// see: https://en.wikipedia.org/wiki/Path-based_strong_component_algorithm\nexport interface ISCCNode { id: string }\nexport interface ISCCLink { source: string, target: string }\n\nexport function scc<Node extends ISCCNode, Link extends ISCCLink>(nodes: Node[], links: Link[]): Node[][] {\n  const index = makeIndex(nodes)\n  const done: boolean[] = []\n  const preOrder: number[] = []\n  const S: number[] = []\n  const P: number[] = []\n  let C = 0\n  const components: number[][] = []\n\n  function edges(v: number) {\n    const node = nodes[v]\n    return links.filter(l => l.source === node.id).map(l => index[l.target])\n  }\n\n  function process(v: number) {\n    // 1. Set the preorder number of v to C, and increment C.\n    preOrder[v] = C++\n    // 2. Push v onto S and also onto P.\n    S.push(v)\n    P.push(v)\n    // 3. For each edge from v to a neighboring vertex w:\n    for (const w of edges(v)) {\n      // If the preorder number of w has not yet been assigned, recursively search w;\n      if (preOrder[w] === undefined) process(w)\n      // Otherwise, if w has not yet been assigned to a strongly connected component:\n      // Repeatedly pop vertices from P until the top element of P has a preorder number\n      // less than or equal to the preorder number of w.\n      if (!done[w]) {\n        while (preOrder[P[P.length - 1]] > preOrder[w]) {\n          P.pop()\n        }\n      }\n    }\n    // 4. If v is the top element of P:\n    if (v === P[P.length - 1]) {\n      // Pop vertices from S until v has been popped, and assign the popped vertices to a new component.\n      const component: number[] = []\n      do {\n        const x = S.pop()!\n        done[x] = true\n        component.push(x)\n      } while (component[component.length - 1] !== v)\n      components.push(component)\n      // Pop v from P.\n      P.pop()\n    }\n  }\n\n  for (let i = 0; i < nodes.length; i++) {\n    if (preOrder[i] === undefined) process(i)\n    index[nodes[i].id] = i\n  }\n\n  return components.map(c => c.map(x => nodes[x]))\n}\n\nfunction makeIndex(nodes: ISCCNode[]): Record<string, number> {\n  const index: Record<string, number> = {}\n  for (let i = 0; i < nodes.length; i++) {\n    index[nodes[i].id] = i\n  }\n  return index\n}\n"]}