{"version":3,"file":"index.umd.cjs","sources":["../src/layout/depthUtils.ts","../src/layout/forceUtils.ts","../src/layout/layoutUtils.ts","../src/layout/forceInABox.ts","../src/layout/forceDirected.ts","../src/layout/circular2d.ts","../src/layout/hierarchical.ts","../src/layout/nooverlap.ts","../src/layout/forceatlas2.ts","../src/layout/custom.ts","../src/layout/layoutProvider.ts","../src/layout/recommender.ts","../src/utils/visibility.ts","../src/sizing/pageRank.ts","../src/sizing/centrality.ts","../src/sizing/attribute.ts","../src/sizing/nodeSizeProvider.ts","../src/utils/graph.ts","../src/utils/animation.ts","../src/utils/arrow.ts","../src/utils/position.ts","../src/utils/layout.ts","../src/utils/cluster.ts","../src/utils/paths.ts","../src/utils/dom.ts","../src/store.ts","../src/collapse/utils.ts","../src/collapse/useCollapse.ts","../src/useGraph.ts","../src/symbols/Label.tsx","../src/utils/useDrag.ts","../src/utils/useHoverIntent.ts","../src/CameraControls/useCameraControls.ts","../src/symbols/clusters/Ring.tsx","../src/symbols/Cluster.tsx","../src/symbols/Arrow.tsx","../src/symbols/Line.tsx","../src/symbols/Edge.tsx","../src/symbols/edges/useEdgeGeometry.ts","../src/symbols/edges/useEdgeEvents.ts","../src/symbols/edges/useEdgeAnimations.ts","../src/symbols/edges/Edge.tsx","../src/symbols/edges/Edges.tsx","../src/symbols/Ring.tsx","../src/symbols/nodes/Sphere.tsx","../src/symbols/nodes/Icon.tsx","../src/symbols/nodes/SphereWithIcon.tsx","../src/symbols/nodes/Svg.tsx","../src/symbols/nodes/SphereWithSvg.tsx","../src/symbols/Node.tsx","../src/CameraControls/utils.ts","../src/CameraControls/useCenterGraph.ts","../src/GraphScene.tsx","../src/CameraControls/CameraControls.tsx","../src/themes/darkTheme.ts","../src/themes/lightTheme.ts","../src/selection/utils.ts","../src/selection/Lasso.tsx","../src/GraphCanvas/GraphCanvas.tsx","../src/selection/useSelection.ts","../src/RadialMenu/RadialSlice.tsx","../src/RadialMenu/utils.ts","../src/RadialMenu/RadialMenu.tsx"],"sourcesContent":["import { InternalGraphEdge, InternalGraphNode } from '../types';\n\nexport interface DepthNode {\n  data: InternalGraphNode;\n  ins: DepthNode[];\n  out: DepthNode[];\n  depth: number;\n}\n\n/**\n * Traverse the graph and get the depth of each node.\n */\nfunction traverseGraph(nodes: DepthNode[], nodeStack: DepthNode[] = []) {\n  const currentDepth = nodeStack.length;\n\n  for (const node of nodes) {\n    const idx = nodeStack.indexOf(node);\n    if (idx > -1) {\n      const loop = [...nodeStack.slice(idx), node].map(d => d.data.id);\n      throw new Error(\n        `Invalid Graph: Circular node path detected: ${loop.join(' -> ')}.`\n      );\n    }\n\n    if (currentDepth > node.depth) {\n      node.depth = currentDepth;\n      traverseGraph(node.out, [...nodeStack, node]);\n    }\n  }\n}\n\n/**\n * Gets the depth of the graph's nodes. Used in the radial layout.\n */\nexport function getNodeDepth(\n  nodes: InternalGraphNode[],\n  links: InternalGraphEdge[]\n) {\n  let invalid = false;\n\n  const graph: { [key: string]: DepthNode } = nodes.reduce(\n    (acc, cur) => ({\n      ...acc,\n      [cur.id]: {\n        data: cur,\n        out: [],\n        depth: -1,\n        ins: []\n      }\n    }),\n    {}\n  );\n\n  try {\n    for (const link of links) {\n      const from = link.source;\n      const to = link.target;\n\n      if (!graph.hasOwnProperty(from)) {\n        throw new Error(`Missing source Node ${from}`);\n      }\n\n      if (!graph.hasOwnProperty(to)) {\n        throw new Error(`Missing target Node ${to}`);\n      }\n\n      const sourceNode = graph[from];\n      const targetNode = graph[to];\n      targetNode.ins.push(sourceNode);\n      sourceNode.out.push(targetNode);\n    }\n\n    traverseGraph(Object.values(graph));\n  } catch (e) {\n    invalid = true;\n  }\n\n  const allDepths = Object.keys(graph).map(id => graph[id].depth);\n  const maxDepth = Math.max(...allDepths);\n\n  return {\n    invalid,\n    depths: graph,\n    maxDepth: maxDepth || 1\n  };\n}\n","import { forceRadial as d3ForceRadial } from 'd3-force-3d';\nimport { InternalGraphEdge, InternalGraphNode } from '../types';\nimport { getNodeDepth } from './depthUtils';\n\nconst RADIALS: DagMode[] = ['radialin', 'radialout'];\n\nexport type DagMode =\n  | 'lr'\n  | 'rl'\n  | 'td'\n  | 'but'\n  | 'zout'\n  | 'zin'\n  | 'radialin'\n  | 'radialout';\n\nexport interface ForceRadialInputs {\n  nodes: InternalGraphNode[];\n  edges: InternalGraphEdge[];\n  mode: DagMode;\n  nodeLevelRatio: number;\n}\n\n/**\n * Radial graph layout using D3 Force 3d.\n * Inspired by: https://github.com/vasturiano/three-forcegraph/blob/master/src/forcegraph-kapsule.js#L970-L1018\n */\nexport function forceRadial({\n  nodes,\n  edges,\n  mode = 'lr',\n  nodeLevelRatio = 2\n}: ForceRadialInputs) {\n  const { depths, maxDepth, invalid } = getNodeDepth(nodes, edges);\n\n  if (invalid) {\n    return null;\n  }\n\n  const modeDistance = RADIALS.includes(mode) ? 1 : 5;\n  const dagLevelDistance =\n    (nodes.length / maxDepth) * nodeLevelRatio * modeDistance;\n\n  if (mode) {\n    const getFFn =\n      (fix: boolean, invert: boolean) => (node: InternalGraphNode) =>\n        !fix\n          ? undefined\n          : (depths[node.id].depth - maxDepth / 2) *\n            dagLevelDistance *\n            (invert ? -1 : 1);\n\n    const fxFn = getFFn(['lr', 'rl'].includes(mode), mode === 'rl');\n    const fyFn = getFFn(['td', 'bu'].includes(mode), mode === 'td');\n    const fzFn = getFFn(['zin', 'zout'].includes(mode), mode === 'zout');\n\n    nodes.forEach(node => {\n      node.fx = fxFn(node);\n      node.fy = fyFn(node);\n      node.fz = fzFn(node);\n    });\n  }\n\n  return RADIALS.includes(mode)\n    ? d3ForceRadial(node => {\n      const nodeDepth = depths[node.id];\n      const depth =\n          mode === 'radialin' ? maxDepth - nodeDepth.depth : nodeDepth.depth;\n      return depth * dagLevelDistance;\n    }).strength(1)\n    : null;\n}\n","import Graph from 'graphology';\nimport { LayoutStrategy } from './types';\nimport { InternalGraphEdge, InternalGraphNode } from '../types';\n\n/**\n * Promise based tick helper.\n */\nexport function tick(layout: LayoutStrategy) {\n  return new Promise((resolve, _reject) => {\n    let stable: boolean | undefined;\n\n    function run() {\n      if (!stable) {\n        stable = layout.step();\n        run();\n      } else {\n        resolve(stable);\n      }\n    }\n\n    run();\n  });\n}\n\n/**\n * Helper function to turn the graph nodes/edges into an array for\n * easier manipulation.\n */\nexport function buildNodeEdges(graph: Graph) {\n  const nodes: InternalGraphNode[] = [];\n  const edges: InternalGraphEdge[] = [];\n\n  graph.forEachNode((id, n: any) => {\n    nodes.push({\n      ...n,\n      id,\n      // This is for the clustering\n      radius: n.size || 1\n    });\n  });\n\n  graph.forEachEdge((id, l: any) => {\n    edges.push({ ...l, id });\n  });\n\n  return { nodes, edges };\n}\n","import {\n  forceSimulation,\n  forceX,\n  forceY,\n  forceLink,\n  forceManyBody,\n  forceCollide\n} from 'd3-force-3d';\nimport { treemap, hierarchy } from 'd3-hierarchy';\nimport { ClusterGroup } from '../utils/cluster';\n\n/**\n * Used for calculating clusterings of nodes.\n *\n * Modified version of: https://github.com/john-guerra/forceInABox\n *\n * Changes:\n *  - Improved d3 import for tree shaking\n *  - Fixed node lookup for edges using array\n *  - Updated d3-force to use d3-force-3d\n *  - Removed template logic\n */\nexport function forceInABox() {\n  // d3 style\n  const constant = (_: any) => () => _;\n  const index = (d: any) => d.index;\n\n  // Default values\n  let id = index;\n  let nodes = [];\n  let links = []; // needed for the force version\n  let clusters: Map<string, ClusterGroup>;\n  let tree;\n  let size = [100, 100];\n  let forceNodeSize = constant(1); // The expected node size used for computing the cluster node\n  let forceCharge = constant(-1);\n  let forceLinkDistance = constant(100);\n  let forceLinkStrength = constant(0.1);\n  let foci = {};\n  let linkStrengthIntraCluster = 0.1;\n  let linkStrengthInterCluster = 0.001;\n  let templateNodes = [];\n  let offset = [0, 0];\n  let templateForce;\n  let groupBy = d => d.cluster;\n  let template = 'treemap';\n  let enableGrouping = true;\n  let strength = 0.1;\n\n  function force(alpha) {\n    if (!enableGrouping) {\n      return force;\n    }\n\n    if (template === 'force') {\n      // Do the tick of the template force and get the new focis\n      templateForce.tick();\n      getFocisFromTemplate();\n    }\n\n    for (let i = 0, n = nodes.length, node, k = alpha * strength; i < n; ++i) {\n      node = nodes[i];\n      node.vx += (foci[groupBy(node)].x - node.x) * k;\n      node.vy += (foci[groupBy(node)].y - node.y) * k;\n    }\n  }\n\n  function initialize() {\n    if (!nodes) {\n      return;\n    }\n\n    if (template === 'treemap') {\n      initializeWithTreemap();\n    } else {\n      initializeWithForce();\n    }\n  }\n\n  force.initialize = function (_) {\n    nodes = _;\n    initialize();\n  };\n\n  function getLinkKey(l) {\n    let sourceID = groupBy(l.source),\n      targetID = groupBy(l.target);\n\n    return sourceID <= targetID\n      ? sourceID + '~' + targetID\n      : targetID + '~' + sourceID;\n  }\n\n  function computeClustersNodeCounts(nodes) {\n    let clustersCounts = new Map(),\n      tmpCount: any = {};\n\n    nodes.forEach(function (d) {\n      if (!clustersCounts.has(groupBy(d))) {\n        clustersCounts.set(groupBy(d), { count: 0, sumforceNodeSize: 0 });\n      }\n    });\n\n    nodes.forEach(function (d) {\n      tmpCount = clustersCounts.get(groupBy(d));\n      tmpCount.count = tmpCount.count + 1;\n      tmpCount.sumforceNodeSize =\n        tmpCount.sumforceNodeSize +\n        // @ts-ignore\n        Math.PI * (forceNodeSize(d) * forceNodeSize(d)) * 1.3;\n      clustersCounts.set(groupBy(d), tmpCount);\n    });\n\n    return clustersCounts;\n  }\n\n  //Returns\n  function computeClustersLinkCounts(links) {\n    let dClusterLinks = new Map(),\n      clusterLinks = [];\n\n    links.forEach(function (l) {\n      let key = getLinkKey(l),\n        count;\n      if (dClusterLinks.has(key)) {\n        count = dClusterLinks.get(key);\n      } else {\n        count = 0;\n      }\n      count += 1;\n      dClusterLinks.set(key, count);\n    });\n\n    dClusterLinks.forEach(function (value, key) {\n      let source, target;\n      source = key.split('~')[0];\n      target = key.split('~')[1];\n      if (source !== undefined && target !== undefined) {\n        clusterLinks.push({\n          source: source,\n          target: target,\n          count: value\n        });\n      }\n    });\n\n    return clusterLinks;\n  }\n\n  //Returns the metagraph of the clusters\n  function getGroupsGraph() {\n    let gnodes = [];\n    let glinks = [];\n    let dNodes = new Map();\n    let c;\n    let i;\n    let cc;\n    let clustersCounts;\n    let clustersLinks;\n\n    clustersCounts = computeClustersNodeCounts(nodes);\n    clustersLinks = computeClustersLinkCounts(links);\n\n    for (c of clustersCounts.keys()) {\n      cc = clustersCounts.get(c);\n      gnodes.push({\n        id: c,\n        size: cc.count,\n        r: Math.sqrt(cc.sumforceNodeSize / Math.PI)\n      }); // Uses approx meta-node size\n      dNodes.set(c, i);\n    }\n\n    clustersLinks.forEach(function (l) {\n      let source = dNodes.get(l.source),\n        target = dNodes.get(l.target);\n      if (source !== undefined && target !== undefined) {\n        glinks.push({\n          source: source,\n          target: target,\n          count: l.count\n        });\n      }\n    });\n\n    return { nodes: gnodes, links: glinks };\n  }\n\n  function getGroupsTree() {\n    let children = [];\n    let c;\n    let cc;\n    let clustersCounts;\n\n    // @ts-ignore\n    clustersCounts = computeClustersNodeCounts(force.nodes());\n\n    for (c of clustersCounts.keys()) {\n      cc = clustersCounts.get(c);\n      children.push({ id: c, size: cc.count });\n    }\n    return { id: 'clustersTree', children: children };\n  }\n\n  function getFocisFromTemplate() {\n    //compute foci\n    // @ts-ignore\n    foci.none = { x: 0, y: 0 };\n    templateNodes.forEach(function (d) {\n      if (template === 'treemap') {\n        foci[d.data.id] = {\n          x: d.x0 + (d.x1 - d.x0) / 2 - offset[0],\n          y: d.y0 + (d.y1 - d.y0) / 2 - offset[1]\n        };\n      } else {\n        foci[d.id] = {\n          x: d.x - offset[0],\n          y: d.y - offset[1]\n        };\n      }\n    });\n    return foci;\n  }\n\n  function initializeWithTreemap() {\n    // @ts-ignore\n    let sim = treemap().size(force.size());\n\n    tree = hierarchy(getGroupsTree())\n      .sum((d: any) => d.radius)\n      .sort(function (a, b) {\n        return b.height - a.height || b.value - a.value;\n      });\n\n    templateNodes = sim(tree).leaves();\n    getFocisFromTemplate();\n  }\n\n  function checkLinksAsObjects() {\n    // Check if links come in the format of indexes instead of objects\n    let linkCount = 0;\n    if (nodes.length === 0) return;\n\n    links.forEach(function (link) {\n      let source, target;\n      if (!nodes) {\n        return;\n      }\n\n      source = link.source;\n      target = link.target;\n\n      if (typeof link.source !== 'object') {\n        source = nodes.find(n => n.id === link.source);\n      }\n\n      if (typeof link.target !== 'object') {\n        target = nodes.find(n => n.id === link.target);\n      }\n\n      if (source === undefined || target === undefined) {\n        throw Error(\n          'Error setting links, couldnt find nodes for a link (see it on the console)'\n        );\n      }\n      link.source = source;\n      link.target = target;\n      link.index = linkCount++;\n    });\n  }\n\n  function initializeWithForce() {\n    let net;\n\n    if (!nodes || !nodes.length) {\n      return;\n    }\n\n    checkLinksAsObjects();\n\n    net = getGroupsGraph();\n\n    // Use dragged clusters position if available\n    if (clusters.size > 0) {\n      net.nodes.forEach(n => {\n        // Set fixed X position for cluster\n        n.fx = clusters.get(n.id)?.position?.x;\n        // Set fixed Y position for cluster\n        n.fy = clusters.get(n.id)?.position?.y;\n      });\n    }\n\n    templateForce = forceSimulation(net.nodes)\n      .force('x', forceX(size[0] / 2).strength(0.1))\n      .force('y', forceY(size[1] / 2).strength(0.1))\n      .force('collide', forceCollide(d => d.r).iterations(4))\n      .force('charge', forceManyBody().strength(forceCharge))\n      .force(\n        'links',\n        forceLink(net.nodes.length ? net.links : [])\n          .distance(forceLinkDistance)\n          .strength(forceLinkStrength)\n      );\n\n    templateNodes = templateForce.nodes();\n\n    getFocisFromTemplate();\n  }\n\n  force.template = function (x) {\n    if (!arguments.length) {\n      return template;\n    }\n\n    template = x;\n    initialize();\n    return force;\n  };\n\n  force.groupBy = function (x) {\n    if (!arguments.length) {\n      return groupBy;\n    }\n\n    if (typeof x === 'string') {\n      groupBy = function (d) {\n        return d[x];\n      };\n\n      return force;\n    }\n\n    groupBy = x;\n\n    return force;\n  };\n\n  force.enableGrouping = function (x) {\n    if (!arguments.length) {\n      return enableGrouping;\n    }\n\n    enableGrouping = x;\n\n    return force;\n  };\n\n  force.strength = function (x) {\n    if (!arguments.length) {\n      return strength;\n    }\n\n    strength = x;\n\n    return force as any;\n  };\n\n  force.getLinkStrength = function (e) {\n    if (enableGrouping) {\n      if (groupBy(e.source) === groupBy(e.target)) {\n        if (typeof linkStrengthIntraCluster === 'function') {\n          // @ts-ignore\n          return linkStrengthIntraCluster(e);\n        } else {\n          return linkStrengthIntraCluster;\n        }\n      } else {\n        if (typeof linkStrengthInterCluster === 'function') {\n          // @ts-ignore\n          return linkStrengthInterCluster(e);\n        } else {\n          return linkStrengthInterCluster;\n        }\n      }\n    } else {\n      // Not grouping return the intracluster\n      if (typeof linkStrengthIntraCluster === 'function') {\n        // @ts-ignore\n        return linkStrengthIntraCluster(e);\n      } else {\n        return linkStrengthIntraCluster;\n      }\n    }\n  };\n\n  force.id = function (_) {\n    return arguments.length ? ((id = _), force) : id;\n  };\n\n  force.size = function (_) {\n    return arguments.length ? ((size = _), force) : size;\n  };\n\n  force.linkStrengthInterCluster = function (_) {\n    return arguments.length\n      ? ((linkStrengthInterCluster = _), force)\n      : linkStrengthInterCluster;\n  };\n\n  force.linkStrengthIntraCluster = function (_) {\n    return arguments.length\n      ? ((linkStrengthIntraCluster = _), force)\n      : linkStrengthIntraCluster;\n  };\n\n  force.nodes = function (_) {\n    return arguments.length ? ((nodes = _), force) : nodes;\n  };\n\n  force.links = function (_) {\n    if (!arguments.length) {\n      return links;\n    }\n\n    if (_ === null) {\n      links = [];\n    } else {\n      links = _;\n    }\n\n    initialize();\n\n    return force;\n  };\n\n  force.template = function (x) {\n    if (!arguments.length) {\n      return template;\n    }\n\n    template = x;\n    initialize();\n    return force;\n  };\n\n  force.forceNodeSize = function (_) {\n    return arguments.length\n      ? ((forceNodeSize = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceNodeSize;\n  };\n\n  // Legacy support\n  force.nodeSize = force.forceNodeSize;\n\n  force.forceCharge = function (_) {\n    return arguments.length\n      ? ((forceCharge = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceCharge;\n  };\n\n  force.forceLinkDistance = function (_) {\n    return arguments.length\n      ? ((forceLinkDistance = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceLinkDistance;\n  };\n\n  force.forceLinkStrength = function (_) {\n    return arguments.length\n      ? ((forceLinkStrength = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceLinkStrength;\n  };\n\n  force.offset = function (_) {\n    return arguments.length\n      ? ((offset = typeof _ === 'function' ? _ : constant(+_)), force)\n      : offset;\n  };\n\n  force.getFocis = getFocisFromTemplate;\n\n  // Define the clusters to reuse positions from\n  force.setClusters = function (value: any) {\n    clusters = value;\n\n    return force;\n  };\n\n  return force;\n}\n","import {\n  forceSimulation as d3ForceSimulation,\n  forceLink as d3ForceLink,\n  forceCollide,\n  forceManyBody as d3ForceManyBody,\n  forceX as d3ForceX,\n  forceY as d3ForceY,\n  forceZ as d3ForceZ,\n  forceCenter as d3ForceCenter\n} from 'd3-force-3d';\nimport { forceRadial, DagMode } from './forceUtils';\nimport { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { buildNodeEdges } from './layoutUtils';\nimport { forceInABox } from './forceInABox';\nimport { FORCE_LAYOUTS } from './layoutProvider';\nimport { ClusterGroup } from '../utils/cluster';\n\nexport interface ForceDirectedLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Center inertia for the layout. Default: 1.\n   */\n  centerInertia?: number;\n\n  /**\n   * Number of dimensions for the layout. 2d or 3d.\n   */\n  dimensions?: number;\n\n  /**\n   * Mode for the dag layout. Only applicable for dag layouts.\n   */\n  mode?: DagMode;\n\n  /**\n   * Distance between links.\n   */\n  linkDistance?: number;\n\n  /**\n   * Strength of the node repulsion.\n   */\n  nodeStrength?: number;\n\n  /**\n   * Strength of the cluster repulsion.\n   */\n  clusterStrength?: number;\n\n  /**\n   * The clusters dragged position to reuse for the layout.\n   */\n  clusters: Map<string, ClusterGroup>;\n\n  /**\n   * The type of clustering.\n   */\n  clusterType?: 'force' | 'treemap';\n\n  /**\n   * Ratio of the distance between nodes on the same level.\n   */\n  nodeLevelRatio?: number;\n\n  /**\n   * LinkStrength between nodes of different clusters\n   */\n  linkStrengthInterCluster?: number | ((d: any) => number);\n\n  /**\n   * LinkStrength between nodes of the same cluster\n   */\n  linkStrengthIntraCluster?: number | ((d: any) => number);\n\n  /**\n   * Charge between the meta-nodes (Force template only)\n   */\n  forceLinkDistance?: number;\n\n  /**\n   * Used to compute the template force nodes size (Force template only)\n   */\n  forceLinkStrength?: number;\n\n  /**\n   * Used to compute the template force nodes size (Force template only)\n   */\n  forceCharge?: number;\n\n  /**\n   * Used to determine the simulation forceX and forceY values\n   */\n  forceLayout: (typeof FORCE_LAYOUTS)[number];\n}\n\nexport function forceDirected({\n  graph,\n  nodeLevelRatio = 2,\n  mode = null,\n  dimensions = 2,\n  nodeStrength = -250,\n  linkDistance = 50,\n  clusterStrength = 0.5,\n  linkStrengthInterCluster = 0.01,\n  linkStrengthIntraCluster = 0.5,\n  forceLinkDistance = 100,\n  forceLinkStrength = 0.1,\n  clusterType = 'force',\n  forceCharge = -700,\n  getNodePosition,\n  drags,\n  clusters,\n  clusterAttribute,\n  forceLayout\n}: ForceDirectedLayoutInputs): LayoutStrategy {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  // Dynamically adjust node strength based on the number of edges\n  const is2d = dimensions === 2;\n  const nodeStrengthAdjustment =\n    is2d && edges.length > 25 ? nodeStrength * 2 : nodeStrength;\n\n  let forceX;\n  let forceY;\n  if (forceLayout === 'forceDirected2d') {\n    forceX = d3ForceX();\n    forceY = d3ForceY();\n  } else {\n    forceX = d3ForceX(600).strength(0.05);\n    forceY = d3ForceY(600).strength(0.05);\n  }\n\n  // Create the simulation\n  const sim = d3ForceSimulation()\n    .force('center', d3ForceCenter(0, 0))\n    .force('link', d3ForceLink())\n    .force('charge', d3ForceManyBody().strength(nodeStrengthAdjustment))\n    .force('x', forceX)\n    .force('y', forceY)\n    .force('z', d3ForceZ())\n    // Handles nodes not overlapping each other ( most relevant in clustering )\n    .force(\n      'collide',\n      forceCollide(d => d.radius + 10)\n    )\n    .force(\n      'dagRadial',\n      forceRadial({\n        nodes,\n        edges,\n        mode,\n        nodeLevelRatio\n      })\n    )\n    .stop();\n\n  let groupingForce;\n  if (clusterAttribute) {\n    // Dynamically adjust cluster force charge based on the number of nodes\n    let forceChargeAdjustment = forceCharge;\n    if (nodes?.length) {\n      const adjustmentFactor = Math.ceil(nodes.length / 200);\n      forceChargeAdjustment = forceCharge * adjustmentFactor;\n    }\n\n    groupingForce = forceInABox()\n      // The clusters dragged position to reuse for the layout\n      .setClusters(clusters)\n      // Strength to foci\n      .strength(clusterStrength)\n      // Either treemap or force\n      .template(clusterType)\n      // Node attribute to group\n      .groupBy(d => d.data[clusterAttribute])\n      // The graph links. Must be called after setting the grouping attribute\n      .links(edges)\n      // Size of the chart\n      .size([100, 100])\n      // linkStrength between nodes of different clusters\n      .linkStrengthInterCluster(linkStrengthInterCluster)\n      // linkStrength between nodes of the same cluster\n      .linkStrengthIntraCluster(linkStrengthIntraCluster)\n      // linkDistance between meta-nodes on the template (Force template only)\n      .forceLinkDistance(forceLinkDistance)\n      // linkStrength between meta-nodes of the template (Force template only)\n      .forceLinkStrength(forceLinkStrength)\n      // Charge between the meta-nodes (Force template only)\n      .forceCharge(forceChargeAdjustment)\n      // Used to compute the template force nodes size (Force template only)\n      .forceNodeSize(d => d.radius);\n  }\n\n  // Initialize the simulation\n  let layout = sim.numDimensions(dimensions).nodes(nodes);\n\n  if (groupingForce) {\n    layout = layout.force('group', groupingForce);\n  }\n\n  // Run the force on the links\n  if (linkDistance) {\n    let linkForce = layout.force('link');\n    if (linkForce) {\n      linkForce\n        .id(d => d.id)\n        .links(edges)\n        // When no mode passed, its a tree layout\n        // so let's use a larger distance\n        .distance(linkDistance);\n\n      if (groupingForce) {\n        linkForce = linkForce.strength(groupingForce?.getLinkStrength ?? 0.1);\n      }\n    }\n  }\n\n  const nodeMap = new Map(nodes.map(n => [n.id, n]));\n\n  return {\n    step() {\n      // Run the simulation til we get a stable result\n      while (sim.alpha() > 0.01) {\n        sim.tick();\n      }\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return nodeMap.get(id);\n    }\n  };\n}\n","import circular from 'graphology-layout/circular.js';\nimport { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface CircularLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Radius of the circle.\n   */\n  radius: number;\n}\n\nexport function circular2d({\n  graph,\n  radius,\n  drags,\n  getNodePosition\n}: CircularLayoutInputs) {\n  const layout = circular(graph, {\n    scale: radius\n  });\n\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return layout?.[id];\n    }\n  };\n}\n","import { InternalGraphNode } from '../types';\nimport { DepthNode, getNodeDepth } from './depthUtils';\nimport { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { hierarchy, stratify, tree } from 'd3-hierarchy';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface HierarchicalLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Direction of the layout. Default 'td'.\n   */\n  mode?: 'td' | 'lr';\n  /**\n   * Factor of distance between nodes. Default 1.\n   */\n  nodeSeparation?: number;\n  /**\n   * Size of each node. Default [50,50]\n   */\n  nodeSize?: [number, number];\n}\n\nconst DIRECTION_MAP = {\n  td: {\n    x: 'x',\n    y: 'y',\n    factor: -1\n  },\n  lr: {\n    x: 'y',\n    y: 'x',\n    factor: 1\n  }\n};\n\nexport function hierarchical({\n  graph,\n  drags,\n  mode = 'td',\n  nodeSeparation = 1,\n  nodeSize = [50, 50],\n  getNodePosition\n}: HierarchicalLayoutInputs): LayoutStrategy {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  const { depths } = getNodeDepth(nodes, edges);\n  const rootNodes = Object.keys(depths).map(d => depths[d]);\n\n  const root = stratify<DepthNode>()\n    .id(d => d.data.id)\n    .parentId(d => d.ins?.[0]?.data?.id)(rootNodes);\n\n  const treeRoot = tree()\n    .separation(() => nodeSeparation)\n    .nodeSize(nodeSize)(hierarchy(root));\n\n  const treeNodes = treeRoot.descendants();\n  const path = DIRECTION_MAP[mode];\n\n  const mappedNodes = new Map<string, InternalGraphNode>(\n    nodes.map(n => {\n      const { x, y } = treeNodes.find((t: any) => t.data.id === n.id);\n      return [\n        n.id,\n        {\n          ...n,\n          [path.x]: x * path.factor,\n          [path.y]: y * path.factor,\n          z: 0\n        }\n      ];\n    })\n  );\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return mappedNodes.get(id);\n    }\n  };\n}\n","import noverlapLayout from 'graphology-layout-noverlap';\nimport { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface NoOverlapLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Grid size. Default 20.\n   */\n  gridSize?: number;\n\n  /**\n   * Ratio of the layout. Default 10.\n   */\n  ratio?: number;\n\n  /**\n   * Maximum number of iterations. Default 50.\n   */\n  maxIterations?: number;\n\n  /**\n   * Margin between nodes. Default 10.\n   */\n  margin?: number;\n}\n\nexport function nooverlap({\n  graph,\n  margin,\n  drags,\n  getNodePosition,\n  ratio,\n  gridSize,\n  maxIterations\n}: NoOverlapLayoutInputs) {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  const layout = noverlapLayout(graph, {\n    maxIterations,\n    inputReducer: (_key, attr) => ({\n      ...attr,\n      // Have to specify defaults for the engine\n      x: attr.x || 0,\n      y: attr.y || 0\n    }),\n    settings: {\n      ratio,\n      margin,\n      gridSize\n    }\n  });\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return layout?.[id];\n    }\n  };\n}\n","import forceAtlas2Layout from 'graphology-layout-forceatlas2';\nimport { LayoutFactoryProps } from './types';\nimport random from 'graphology-layout/random.js';\n\nexport interface ForceAtlas2LayoutInputs extends LayoutFactoryProps {\n  /**\n   * Should the node’s sizes be taken into account. Default: false.\n   */\n  adjustSizes?: boolean;\n\n  /**\n   * whether to use the Barnes-Hut approximation to compute\n   * repulsion in O(n*log(n)) rather than default O(n^2),\n   * n being the number of nodes. Default: false.\n   */\n  barnesHutOptimize?: boolean;\n\n  /**\n   * Barnes-Hut approximation theta parameter. Default: 0.5.\n   */\n  barnesHutTheta?: number;\n\n  /**\n   * Influence of the edge’s weights on the layout. To consider edge weight, don’t\n   *  forget to pass weighted as true. Default: 1.\n   */\n  edgeWeightInfluence?: number;\n\n  /**\n   * Strength of the layout’s gravity. Default: 10.\n   */\n  gravity?: number;\n\n  /**\n   * Whether to use Noack’s LinLog model. Default: false.\n   */\n  linLogMode?: boolean;\n\n  /**\n   * Whether to consider edge weights when calculating repulsion. Default: false.\n   */\n  outboundAttractionDistribution?: boolean;\n\n  /**\n   * Scaling ratio for repulsion. Default: 100.\n   */\n  scalingRatio?: number;\n\n  /**\n   * Speed of the slowdown. Default: 1.\n   */\n  slowDown?: number;\n\n  /**\n   * Whether to use the strong gravity mode. Default: false.\n   */\n  strongGravityMode?: boolean;\n\n  /**\n   * Number of iterations to perform. Default: 50.\n   */\n  iterations?: number;\n}\n\nexport function forceAtlas2({\n  graph,\n  drags,\n  iterations,\n  ...rest\n}: ForceAtlas2LayoutInputs) {\n  // Note: We need to assign a random position to each node\n  // in order for the force atlas to work.\n  // Reference: https://graphology.github.io/standard-library/layout-forceatlas2.html#pre-requisites\n  random.assign(graph);\n\n  const layout = forceAtlas2Layout(graph, {\n    iterations,\n    settings: rest\n  });\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      // If we dragged, we need to use that position\n      return (drags?.[id]?.position as any) || layout?.[id];\n    }\n  };\n}\n","import { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport function custom({ graph, drags, getNodePosition }: LayoutFactoryProps) {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      return getNodePosition(id, { graph, drags, nodes, edges });\n    }\n  };\n}\n","import { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { forceDirected, ForceDirectedLayoutInputs } from './forceDirected';\nimport { circular2d, CircularLayoutInputs } from './circular2d';\nimport { hierarchical, HierarchicalLayoutInputs } from './hierarchical';\nimport { NoOverlapLayoutInputs, nooverlap } from './nooverlap';\nimport { ForceAtlas2LayoutInputs, forceAtlas2 } from './forceatlas2';\nimport { custom } from './custom';\n\nexport type LayoutOverrides = Partial<\n  | Omit<ForceDirectedLayoutInputs, 'dimensions' | 'mode'>\n  | CircularLayoutInputs\n  | HierarchicalLayoutInputs\n>;\n\nexport const FORCE_LAYOUTS = [\n  'forceDirected2d',\n  'treeTd2d',\n  'treeLr2d',\n  'radialOut2d',\n  'treeTd3d',\n  'treeLr3d',\n  'radialOut3d',\n  'forceDirected3d'\n];\n\nexport function layoutProvider({\n  type,\n  ...rest\n}: LayoutFactoryProps | LayoutOverrides): LayoutStrategy {\n  if (FORCE_LAYOUTS.includes(type)) {\n    const { nodeStrength, linkDistance, nodeLevelRatio } =\n      rest as ForceDirectedLayoutInputs;\n\n    if (type === 'forceDirected2d') {\n      return forceDirected({\n        ...rest,\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -250,\n        linkDistance,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeTd2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'td',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -250,\n        linkDistance: linkDistance || 50,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeLr2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'lr',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -250,\n        linkDistance: linkDistance || 50,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'radialOut2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'radialout',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 100,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeTd3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'td',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 50\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeLr3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'lr',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 50,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'radialOut3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'radialout',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 100,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'forceDirected3d') {\n      return forceDirected({\n        ...rest,\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -250,\n        linkDistance,\n        forceLayout: type\n      } as ForceDirectedLayoutInputs);\n    }\n  } else if (type === 'circular2d') {\n    const { radius } = rest as CircularLayoutInputs;\n    return circular2d({\n      ...rest,\n      radius: radius || 300\n    } as CircularLayoutInputs);\n  } else if (type === 'hierarchicalTd') {\n    return hierarchical({ ...rest, mode: 'td' } as HierarchicalLayoutInputs);\n  } else if (type === 'hierarchicalLr') {\n    return hierarchical({ ...rest, mode: 'lr' } as HierarchicalLayoutInputs);\n  } else if (type === 'nooverlap') {\n    const { graph, maxIterations, ratio, margin, gridSize, ...settings } =\n      rest as NoOverlapLayoutInputs;\n\n    return nooverlap({\n      type: 'nooverlap',\n      graph,\n      margin: margin || 10,\n      maxIterations: maxIterations || 50,\n      ratio: ratio || 10,\n      gridSize: gridSize || 20,\n      ...settings\n    });\n  } else if (type === 'forceatlas2') {\n    const { graph, iterations, gravity, scalingRatio, ...settings } =\n      rest as ForceAtlas2LayoutInputs;\n\n    return forceAtlas2({\n      type: 'forceatlas2',\n      graph,\n      ...settings,\n      scalingRatio: scalingRatio || 100,\n      gravity: gravity || 10,\n      iterations: iterations || 50\n    });\n  } else if (type === 'custom') {\n    return custom({\n      type: 'custom',\n      ...rest\n    } as LayoutFactoryProps);\n  }\n\n  throw new Error(`Layout ${type} not found.`);\n}\n","import { GraphEdge, GraphNode } from '../types';\nimport { getNodeDepth } from './depthUtils';\nimport { LayoutTypes } from './types';\n\n/**\n * Given a set of nodes and edges, determine the type of layout that\n * is most ideal. This is very beta.\n */\nexport function recommendLayout(\n  nodes: GraphNode[],\n  edges: GraphEdge[]\n): LayoutTypes {\n  const { invalid } = getNodeDepth(nodes as any[], edges as any[]);\n  const nodeCount = nodes.length;\n\n  if (!invalid) {\n    // Large tree layouts\n    if (nodeCount > 100) {\n      return 'radialOut2d';\n    } else {\n      // Smaller tree layouts\n      return 'treeTd2d';\n    }\n  }\n\n  // Circular layouts\n  return 'forceDirected2d';\n}\n","import { PerspectiveCamera } from 'three';\nimport { EdgeLabelPosition } from '../symbols';\n\nexport type LabelVisibilityType = 'all' | 'auto' | 'none' | 'nodes' | 'edges';\n\ninterface CalcLabelVisibilityArgs {\n  nodeCount: number;\n  nodePosition?: { x: number; y: number; z: number };\n  labelType: LabelVisibilityType;\n  camera?: PerspectiveCamera;\n}\n\nexport function calcLabelVisibility({\n  nodeCount,\n  nodePosition,\n  labelType,\n  camera\n}: CalcLabelVisibilityArgs) {\n  return (shape: 'node' | 'edge', size: number) => {\n    if (\n      camera &&\n      nodePosition &&\n      camera?.position?.z / camera?.zoom - nodePosition?.z > 6000\n    ) {\n      return false;\n    }\n\n    if (labelType === 'all') {\n      return true;\n    } else if (labelType === 'nodes' && shape === 'node') {\n      return true;\n    } else if (labelType === 'edges' && shape === 'edge') {\n      return true;\n    } else if (labelType === 'auto' && shape === 'node') {\n      if (size > 7) {\n        return true;\n      } else if (\n        camera &&\n        nodePosition &&\n        camera.position.z / camera.zoom - nodePosition.z < 3000\n      ) {\n        return true;\n      }\n    }\n\n    return false;\n  };\n}\n\nexport function getLabelOffsetByType(\n  offset: number,\n  position: EdgeLabelPosition\n): number {\n  switch (position) {\n  case 'above':\n    return offset;\n  case 'below':\n    return -offset;\n  case 'inline':\n  case 'natural':\n  default:\n    return 0;\n  }\n}\n\nexport const isServerRender = typeof window === 'undefined';\n","import pagerank from 'graphology-metrics/centrality/pagerank.js';\nimport { SizingStrategy, SizingStrategyInputs } from './types';\n\nexport function pageRankSizing({\n  graph\n}: SizingStrategyInputs): SizingStrategy {\n  const ranks = pagerank(graph);\n\n  return {\n    ranks,\n    getSizeForNode: (nodeID: string) => ranks[nodeID] * 80\n  };\n}\n","import { SizingStrategy, SizingStrategyInputs } from './types';\nimport { degreeCentrality } from 'graphology-metrics/centrality/degree.js';\n\nexport function centralitySizing({\n  graph\n}: SizingStrategyInputs): SizingStrategy {\n  const ranks = degreeCentrality(graph);\n\n  return {\n    ranks,\n    getSizeForNode: (nodeID: string) => ranks[nodeID] * 20\n  };\n}\n","import { SizingStrategy, SizingStrategyInputs } from './types';\n\nexport function attributeSizing({\n  graph,\n  attribute,\n  defaultSize\n}: SizingStrategyInputs): SizingStrategy {\n  const map = new Map();\n\n  if (attribute) {\n    graph.forEachNode((id, node) => {\n      const size = node.data?.[attribute];\n      if (isNaN(size)) {\n        console.warn(`Attribute ${size} is not a number for node ${node.id}`);\n      }\n\n      map.set(id, size || 0);\n    });\n  } else {\n    console.warn('Attribute sizing configured but no attribute provided');\n  }\n\n  return {\n    getSizeForNode: (nodeId: string) => {\n      if (!attribute || !map) {\n        return defaultSize;\n      }\n\n      return map.get(nodeId);\n    }\n  };\n}\n","import { pageRankSizing } from './pageRank';\nimport { centralitySizing } from './centrality';\nimport { attributeSizing } from './attribute';\nimport { SizingStrategyInputs } from './types';\nimport { scaleLinear } from 'd3-scale';\n\nexport type SizingType =\n  | 'none'\n  | 'pagerank'\n  | 'centrality'\n  | 'attribute'\n  | 'default';\n\nexport interface NodeSizeProviderInputs extends SizingStrategyInputs {\n  /**\n   * The sizing strategy to use.\n   */\n  type: SizingType;\n}\n\nconst providers = {\n  pagerank: pageRankSizing,\n  centrality: centralitySizing,\n  attribute: attributeSizing,\n  none: ({ defaultSize }: SizingStrategyInputs) => ({\n    getSizeForNode: (_id: string) => defaultSize\n  })\n};\n\nexport function nodeSizeProvider({ type, ...rest }: NodeSizeProviderInputs) {\n  const provider = providers[type]?.(rest);\n  if (!provider && type !== 'default') {\n    throw new Error(`Unknown sizing strategy: ${type}`);\n  }\n\n  const { graph, minSize, maxSize } = rest;\n  const sizes = new Map();\n  let min;\n  let max;\n\n  graph.forEachNode((id, node) => {\n    let size;\n    if (type === 'default') {\n      size = node.size || rest.defaultSize;\n    } else {\n      size = provider.getSizeForNode(id);\n    }\n\n    if (min === undefined || size < min) {\n      min = size;\n    }\n\n    if (max === undefined || size > max) {\n      max = size;\n    }\n\n    sizes.set(id, size);\n  });\n\n  // Relatively scale the sizes\n  if (type !== 'none') {\n    const scale = scaleLinear()\n      .domain([min, max])\n      .rangeRound([minSize, maxSize]);\n\n    for (const [nodeId, size] of sizes) {\n      sizes.set(nodeId, scale(size));\n    }\n  }\n\n  return sizes;\n}\n","import Graph from 'graphology';\nimport { nodeSizeProvider, SizingType } from '../sizing';\nimport {\n  GraphEdge,\n  GraphNode,\n  InternalGraphEdge,\n  InternalGraphNode\n} from '../types';\nimport { calcLabelVisibility, LabelVisibilityType } from './visibility';\nimport { LayoutStrategy } from '../layout';\n\n/**\n * Initialize the graph with the nodes/edges.\n */\nexport function buildGraph(\n  graph: Graph,\n  nodes: GraphNode[],\n  edges: GraphEdge[]\n) {\n  // TODO: We probably want to make this\n  // smarter and only add/remove nodes\n  graph.clear();\n\n  const addedNodes = new Set<string>();\n\n  for (const node of nodes) {\n    try {\n      if (!addedNodes.has(node.id)) {\n        graph.addNode(node.id, node);\n        addedNodes.add(node.id);\n      }\n    } catch (e) {\n      console.error(`[Graph] Error adding node '${node.id}`, e);\n    }\n  }\n\n  for (const edge of edges) {\n    if (!addedNodes.has(edge.source) || !addedNodes.has(edge.target)) {\n      continue;\n    }\n\n    try {\n      graph.addEdge(edge.source, edge.target, edge);\n    } catch (e) {\n      console.error(`[Graph] Error adding edge '${edge.source} -> ${edge.target}`, e);\n    }\n  }\n\n  return graph;\n}\n\ninterface TransformGraphInput {\n  graph: Graph;\n  layout: LayoutStrategy;\n  sizingType?: SizingType;\n  labelType?: LabelVisibilityType;\n  sizingAttribute?: string;\n  minNodeSize?: number;\n  maxNodeSize?: number;\n  defaultNodeSize?: number;\n  clusterAttribute?: string;\n}\n\n/**\n * Transform the graph into a format that is easier to work with.\n */\nexport function transformGraph({\n  graph,\n  layout,\n  sizingType,\n  labelType,\n  sizingAttribute,\n  defaultNodeSize,\n  minNodeSize,\n  maxNodeSize,\n  clusterAttribute\n}: TransformGraphInput) {\n  const nodes: InternalGraphNode[] = [];\n  const edges: InternalGraphEdge[] = [];\n  const map = new Map<string, InternalGraphNode>();\n\n  const sizes = nodeSizeProvider({\n    graph,\n    type: sizingType,\n    attribute: sizingAttribute,\n    minSize: minNodeSize,\n    maxSize: maxNodeSize,\n    defaultSize: defaultNodeSize\n  });\n\n  const nodeCount = graph.nodes().length;\n  const checkVisibility = calcLabelVisibility({ nodeCount, labelType });\n\n  graph.forEachNode((id, node) => {\n    const position = layout.getNodePosition(id);\n    const { data, fill, icon, label, size, ...rest } = node;\n    const nodeSize = sizes.get(node.id);\n    const labelVisible = checkVisibility('node', nodeSize);\n\n    const nodeLinks = graph.inboundNeighbors(node.id) || [];\n    const parents = nodeLinks.map(n => graph.getNodeAttributes(n));\n\n    const n: InternalGraphNode = {\n      ...(node as any),\n      size: nodeSize,\n      labelVisible,\n      label,\n      icon,\n      fill,\n      cluster: clusterAttribute ? data[clusterAttribute] : undefined,\n      parents,\n      data: {\n        ...rest,\n        ...(data ?? {})\n      },\n      position: {\n        ...position,\n        x: position.x || 0,\n        y: position.y || 0,\n        z: position.z || 1\n      }\n    };\n\n    map.set(node.id, n);\n    nodes.push(n);\n  });\n\n  graph.forEachEdge((_id, link) => {\n    const from = map.get(link.source);\n    const to = map.get(link.target);\n\n    if (from && to) {\n      const { data, id, label, size, ...rest } = link;\n      const labelVisible = checkVisibility('edge', size);\n\n      // TODO: Fix type\n      edges.push({\n        ...link,\n        id,\n        label,\n        labelVisible,\n        size,\n        data: {\n          ...rest,\n          id,\n          ...(data || {})\n        }\n      } as any);\n    }\n  });\n\n  return {\n    nodes,\n    edges\n  };\n}\n","export const animationConfig = {\n  mass: 10,\n  tension: 1000,\n  friction: 300,\n  // Decreasing precision to improve performance from 0.00001\n  precision: 0.1\n};\n","import { Curve, Vector3 } from 'three';\n\nimport { EdgeArrowPosition } from '../symbols/Arrow';\n\n// Calculate the correct position for an arrow along a curve,\n// as well as the tangent to the curve at that point.\nexport function getArrowVectors(\n  placement: EdgeArrowPosition,\n  curve: Curve<Vector3>,\n  arrowLength: number\n): [Vector3, Vector3] {\n  const curveLength = curve.getLength();\n  const absSize = placement === 'end' ? curveLength : curveLength / 2;\n  const offset = placement === 'end' ? arrowLength / 2 : 0;\n  const u = (absSize - offset) / curveLength;\n\n  const position = curve.getPointAt(u);\n  const rotation = curve.getTangentAt(u);\n\n  return [position, rotation];\n}\n\nexport function getArrowSize(size: number): [number, number] {\n  return [size + 6, 2 + size / 1.5];\n}\n","import { Curve, LineCurve3, QuadraticBezierCurve3, Vector3 } from 'three';\nimport { InternalGraphNode, InternalVector3 } from '../types';\nimport { EdgeSubLabelPosition } from 'symbols/Edge';\n\nconst MULTI_EDGE_OFFSET_FACTOR = 0.7;\n\n/**\n * Get the midpoint given two points.\n */\nexport function getMidPoint(\n  from: InternalVector3,\n  to: InternalVector3,\n  offset = 0\n) {\n  const fromVector = new Vector3(from.x, from.y || 0, from.z || 0);\n  const toVector = new Vector3(to.x, to.y || 0, to.z || 0);\n  const midVector = new Vector3()\n    .addVectors(fromVector, toVector)\n    .divideScalar(2);\n\n  return midVector.setLength(midVector.length() + offset);\n}\n\n/**\n * Calculate the center for a quadratic bezier curve.\n *\n * 1) Find the point halfway between the start and end points of the desired curve\n * 2) Find the vector pependicular to that point\n * 3) Find the point 1/4 the distance between start and end along that vector.\n */\nexport function getCurvePoints(\n  from: Vector3,\n  to: Vector3,\n  offset = -1\n): [Vector3, Vector3, Vector3] {\n  const fromVector = from.clone();\n  const toVector = to.clone();\n  const v = new Vector3().subVectors(toVector, fromVector);\n  const vlen = v.length();\n  const vn = v.clone().normalize();\n  const vv = new Vector3().subVectors(toVector, fromVector).divideScalar(2);\n  const k = Math.abs(vn.x) % 1;\n  const b = new Vector3(-vn.y, vn.x - k * vn.z, k * vn.y).normalize();\n  const vm = new Vector3()\n    .add(fromVector)\n    .add(vv)\n    .add(b.multiplyScalar(vlen / 4).multiplyScalar(offset));\n\n  return [from, vm, to];\n}\n\n/**\n * Get the curve given two points.\n */\nexport function getCurve(\n  from: Vector3,\n  fromOffset: number,\n  to: Vector3,\n  toOffset: number,\n  curved: boolean,\n  curveOffset?: number\n): Curve<Vector3> {\n  const offsetFrom = getPointBetween(from, to, fromOffset);\n  const offsetTo = getPointBetween(to, from, toOffset);\n  return curved\n    ? new QuadraticBezierCurve3(\n      ...getCurvePoints(offsetFrom, offsetTo, curveOffset)\n    )\n    : new LineCurve3(offsetFrom, offsetTo);\n}\n\n/**\n * Create a threejs vector for a node.\n */\nexport function getVector(node: InternalGraphNode): Vector3 {\n  return new Vector3(node.position.x, node.position.y, node.position.z || 0);\n}\n\n/**\n * Get the point between two vectors.\n */\nfunction getPointBetween(from: Vector3, to: Vector3, offset: number): Vector3 {\n  const distance = from.distanceTo(to);\n  return from.clone().add(\n    to\n      .clone()\n      .sub(from)\n      .multiplyScalar(offset / distance)\n  );\n}\n\n/**\n * Given a node and a new vector set, update the node model.\n */\nexport function updateNodePosition(node: InternalGraphNode, offset: Vector3) {\n  return {\n    ...node,\n    position: {\n      ...node.position,\n      x: node.position.x + offset.x,\n      y: node.position.y + offset.y,\n      z: node.position.z + offset.z\n    }\n  };\n}\n\n/**\n * Calculate the curve offset for an edge.\n * This is used to offset edges that are parallel to each other (same source and same target).\n * This will return a curveOffset of null if the edge is not parallel to any other edges.\n */\nexport function calculateEdgeCurveOffset({ edge, edges, curved }) {\n  let updatedCurved = curved;\n  let curveOffset: number;\n\n  const parallelEdges = edges\n    .filter(e => e.target === edge.target && e.source === edge.source)\n    .map(e => e.id);\n\n  if (parallelEdges.length > 1) {\n    updatedCurved = true;\n    const edgeIndex = parallelEdges.indexOf(edge.id);\n\n    if (parallelEdges.length === 2) {\n      curveOffset =\n        edgeIndex === 0 ? MULTI_EDGE_OFFSET_FACTOR : -MULTI_EDGE_OFFSET_FACTOR;\n    } else {\n      curveOffset =\n        (edgeIndex - Math.floor(parallelEdges.length / 2)) *\n        MULTI_EDGE_OFFSET_FACTOR;\n    }\n  }\n\n  return { curved: updatedCurved, curveOffset };\n}\n\n/**\n * Calculate the offset position for a subLabel based on edge orientation and placement preference\n *\n * @param fromPosition - Position of the source node\n * @param toPosition - Position of the target node\n * @param subLabelPlacement - Whether to place the subLabel 'above' or 'below' the edge\n * @returns Object with x, y offset values for positioning the subLabel perpendicular to the edge\n *\n * The function calculates a perpendicular offset from the edge line, with the direction\n * determined by both the subLabelPlacement ('above' or 'below') and the edge direction.\n * The perpendicular angle is calculated differently based on whether the edge is going\n * left-to-right or right-to-left to maintain consistent 'above'/'below' positioning.\n */\nexport function calculateSubLabelOffset(\n  fromPosition: { x: number; y: number },\n  toPosition: { x: number; y: number },\n  subLabelPlacement?: EdgeSubLabelPosition\n): { x: number; y: number; z: number } {\n  // Calculate direction vector between nodes\n  const dx = toPosition.x - fromPosition.x;\n  const dy = toPosition.y - fromPosition.y;\n\n  // Get angle of the edge\n  const angle = Math.atan2(dy, dx);\n\n  // Calculate perpendicular angle based on edge direction and subLabelPlacement\n  const perpAngle =\n    subLabelPlacement === 'above'\n      ? dx >= 0\n        ? angle + Math.PI / 2\n        : angle - Math.PI / 2\n      : dx >= 0\n        ? angle - Math.PI / 2\n        : angle + Math.PI / 2;\n\n  // Offset distance for subLabel\n  const offsetDistance = 7;\n\n  // Calculate offset using perpendicular angle\n  const offsetX = Math.cos(perpAngle) * offsetDistance;\n  const offsetY = Math.sin(perpAngle) * offsetDistance;\n\n  return { x: offsetX, y: offsetY, z: 0 };\n}\n","import { InternalGraphNode } from '../types';\n\nexport interface CenterPositionVector {\n  x: number;\n  y: number;\n  z: number;\n  minX: number;\n  maxX: number;\n  minY: number;\n  maxY: number;\n  minZ: number;\n  maxZ: number;\n  height: number;\n  width: number;\n}\n\n/**\n * Given a collection of nodes, get the center point.\n */\nexport function getLayoutCenter(\n  nodes: InternalGraphNode[]\n): CenterPositionVector {\n  let minX = Number.POSITIVE_INFINITY;\n  let maxX = Number.NEGATIVE_INFINITY;\n  let minY = Number.POSITIVE_INFINITY;\n  let maxY = Number.NEGATIVE_INFINITY;\n  let minZ = Number.POSITIVE_INFINITY;\n  let maxZ = Number.NEGATIVE_INFINITY;\n\n  for (let node of nodes) {\n    minX = Math.min(minX, node.position.x);\n    maxX = Math.max(maxX, node.position.x);\n    minY = Math.min(minY, node.position.y);\n    maxY = Math.max(maxY, node.position.y);\n    minZ = Math.min(minZ, node.position.z);\n    maxZ = Math.max(maxZ, node.position.z);\n  }\n\n  return {\n    height: maxY - minY,\n    width: maxX - minX,\n    minX,\n    maxX,\n    minY,\n    maxY,\n    minZ,\n    maxZ,\n    x: (maxX + minX) / 2,\n    y: (maxY + minY) / 2,\n    z: (maxZ + minZ) / 2\n  };\n}\n","import { InternalGraphNode } from '../types';\nimport { CenterPositionVector, getLayoutCenter } from './layout';\n\n/**\n * Given nodes and a attribute, find all the cluster groups.\n */\nexport function buildClusterGroups(\n  nodes: InternalGraphNode[],\n  clusterAttribute?: string\n) {\n  if (!clusterAttribute) {\n    return new Map();\n  }\n\n  return nodes.reduce((entryMap, e) => {\n    const val = e.data[clusterAttribute];\n    if (val) {\n      entryMap.set(val, [...(entryMap.get(val) || []), e]);\n    }\n    return entryMap;\n  }, new Map());\n}\n\nexport interface CalculateClustersInput {\n  /**\n   * The nodes to calculate clusters for.\n   */\n  nodes: InternalGraphNode[];\n  /**\n   * The attribute to use for clustering.\n   */\n  clusterAttribute?: string;\n}\n\nexport interface ClusterGroup {\n  /**\n   * Nodes in the cluster.\n   */\n  nodes: InternalGraphNode[];\n\n  /**\n   * Center position of the cluster.\n   */\n  position: CenterPositionVector;\n\n  /**\n   * Label of the cluster.\n   */\n  label: string;\n}\n\n/**\n * Builds the cluster map.\n *\n * This function:\n *  - Builds the cluster groups\n *  - Calculates the center position of each cluster group\n *  - Creates a cluster object for each group\n */\nexport function calculateClusters({\n  nodes,\n  clusterAttribute\n}: CalculateClustersInput) {\n  const result = new Map<string, ClusterGroup>();\n\n  if (clusterAttribute) {\n    const groups = buildClusterGroups(nodes, clusterAttribute);\n    for (const [key, nodes] of groups) {\n      const position = getLayoutCenter(nodes);\n      result.set(key, {\n        label: key,\n        nodes,\n        position\n      });\n    }\n  }\n\n  return result;\n}\n","import Graph from 'graphology';\nimport { bidirectional } from 'graphology-shortest-path';\n\nexport function findPath(graph: Graph, source: string, target: string) {\n  return bidirectional(graph, source, target);\n}\n","/**\n * Check if an element is not editable (input, select, textarea, contentEditable).\n * @param element - The element to check\n * @returns True if the element is not editable, false otherwise\n */\nexport const isNotEditableElement = (element: HTMLElement) => {\n  return (\n    element.tagName !== 'INPUT' &&\n    element.tagName !== 'SELECT' &&\n    element.tagName !== 'TEXTAREA' &&\n    !element.isContentEditable\n  );\n};\n","import { createContext, useContext, FC, ReactNode } from 'react';\nimport React from 'react';\nimport { StoreApi, create, useStore as useZustandStore } from 'zustand';\nimport { useShallow } from 'zustand/shallow';\nimport {\n  InternalGraphEdge,\n  InternalGraphNode,\n  InternalGraphPosition\n} from './types';\nimport { BufferGeometry, Mesh, Vector3 } from 'three';\nimport {\n  CenterPositionVector,\n  ClusterGroup,\n  getLayoutCenter,\n  getVector,\n  updateNodePosition\n} from './utils';\nimport { isServerRender } from './utils/visibility';\nimport Graph from 'graphology';\nimport { Theme } from './themes';\n\nexport type DragReferences = {\n  [key: string]: InternalGraphNode;\n};\n\nexport interface GraphState {\n  nodes: InternalGraphNode[];\n  edges: InternalGraphEdge[];\n  graph: Graph;\n  clusters: Map<string, ClusterGroup>;\n  collapsedNodeIds?: string[];\n  centerPosition?: CenterPositionVector;\n  actives?: string[];\n  selections?: string[];\n  // The node that is currently hovered, used to disable cluster dragging\n  hoveredNodeId?: string;\n  edgeContextMenus?: Set<string>;\n  setEdgeContextMenus: (edges: Set<string>) => void;\n  edgeMeshes: Array<Mesh<BufferGeometry>>;\n  setEdgeMeshes: (edgeMeshes: Array<Mesh<BufferGeometry>>) => void;\n  draggingIds?: string[];\n  drags?: DragReferences;\n  panning?: boolean;\n  theme: Theme;\n  setTheme: (theme: Theme) => void;\n  setClusters: (clusters: Map<string, ClusterGroup>) => void;\n  setPanning: (panning: boolean) => void;\n  setDrags: (drags: DragReferences) => void;\n  addDraggingId: (id: string) => void;\n  removeDraggingId: (id: string) => void;\n  setActives: (actives: string[]) => void;\n  setSelections: (selections: string[]) => void;\n  setHoveredNodeId: (hoveredNodeId: string | null) => void;\n  setNodes: (nodes: InternalGraphNode[]) => void;\n  setEdges: (edges: InternalGraphEdge[]) => void;\n  setNodePosition: (id: string, position: InternalGraphPosition) => void;\n  setCollapsedNodeIds: (nodeIds: string[]) => void;\n  setClusterPosition: (id: string, position: CenterPositionVector) => void;\n}\n\n// Create a store factory function\nexport const createStore = ({\n  actives = [],\n  selections = [],\n  collapsedNodeIds = [],\n  theme\n}: Partial<GraphState>) =>\n  create<GraphState>(set => ({\n    theme: {\n      ...theme,\n      edge: {\n        ...theme?.edge,\n        label: {\n          ...theme?.edge?.label,\n          fontSize: theme?.edge?.label?.fontSize ?? 6\n        }\n      }\n    },\n    edges: [],\n    nodes: [],\n    collapsedNodeIds,\n    clusters: new Map(),\n    panning: false,\n    draggingIds: [],\n    actives,\n    edgeContextMenus: new Set(),\n    edgeMeshes: [],\n    selections,\n    hoveredNodeId: null,\n    drags: {},\n    graph: new Graph({ multi: true }),\n    setTheme: theme => set(state => ({ ...state, theme })),\n    setClusters: clusters => set(state => ({ ...state, clusters })),\n    setEdgeContextMenus: edgeContextMenus =>\n      set(state => ({\n        ...state,\n        edgeContextMenus\n      })),\n    setEdgeMeshes: edgeMeshes => set(state => ({ ...state, edgeMeshes })),\n    setPanning: panning => set(state => ({ ...state, panning })),\n    setDrags: drags => set(state => ({ ...state, drags })),\n    addDraggingId: id =>\n      set(state => ({ ...state, draggingIds: [...state.draggingIds, id] })),\n    removeDraggingId: id =>\n      set(state => ({\n        ...state,\n        draggingIds: state.draggingIds.filter(drag => drag !== id)\n      })),\n    setActives: actives => set(state => ({ ...state, actives })),\n    setSelections: selections => set(state => ({ ...state, selections })),\n    setHoveredNodeId: hoveredNodeId =>\n      set(state => ({ ...state, hoveredNodeId })),\n    setNodes: nodes =>\n      set(state => ({\n        ...state,\n        nodes,\n        centerPosition: getLayoutCenter(nodes)\n      })),\n    setEdges: edges => set(state => ({ ...state, edges })),\n    setNodePosition: (id, position) =>\n      set(state => {\n        const node = state.nodes.find(n => n.id === id);\n        const originalVector = getVector(node);\n        const newVector = new Vector3(position.x, position.y, position.z);\n        const offset = newVector.sub(originalVector);\n        const nodes = [...state.nodes];\n\n        if (state.selections?.includes(id)) {\n          state.selections?.forEach(id => {\n            const node = state.nodes.find(n => n.id === id);\n            // Selections can contain edges:\n            if (node) {\n              const nodeIndex = state.nodes.indexOf(node);\n              nodes[nodeIndex] = updateNodePosition(node, offset);\n            }\n          });\n        } else {\n          const nodeIndex = state.nodes.indexOf(node);\n          nodes[nodeIndex] = updateNodePosition(node, offset);\n        }\n\n        return {\n          ...state,\n          drags: {\n            ...state.drags,\n            [id]: node\n          },\n          nodes\n        };\n      }),\n    setCollapsedNodeIds: (nodeIds = []) =>\n      set(state => ({ ...state, collapsedNodeIds: nodeIds })),\n    // Update the position of a cluster with nodes inside it\n    setClusterPosition: (id, position) =>\n      set(state => {\n        const clusters = new Map<string, any>(state.clusters);\n        const cluster = clusters.get(id);\n\n        if (cluster) {\n          // Calculate the offset between old and new position\n          const oldPos = cluster.position;\n          const offset = new Vector3(\n            position.x - oldPos.x,\n            position.y - oldPos.y,\n            position.z - (oldPos.z ?? 0)\n          );\n\n          // Update all nodes in the cluster\n          const nodes: InternalGraphNode[] = [...state.nodes];\n          const drags: DragReferences = { ...state.drags };\n          nodes.forEach((node, index) => {\n            if (node.cluster === id) {\n              nodes[index] = {\n                ...node,\n                position: {\n                  ...node.position,\n                  x: node.position.x + offset.x,\n                  y: node.position.y + offset.y,\n                  z: node.position.z + (offset.z ?? 0)\n                } as InternalGraphPosition\n              };\n              // Update node in drag reference\n              drags[node.id] = node;\n            }\n          });\n\n          const clusterNodes: InternalGraphNode[] = nodes.filter(\n            node => node.cluster === id\n          );\n          const newClusterPosition = getLayoutCenter(clusterNodes);\n          // Update cluster position\n          clusters.set(id, {\n            ...cluster,\n            position: newClusterPosition\n          });\n\n          return {\n            ...state,\n            drags: {\n              ...drags,\n              [id]: cluster\n            },\n            clusters,\n            nodes\n          };\n        }\n\n        return state;\n      })\n  }));\n\nconst defaultStore = createStore({});\nconst StoreContext = isServerRender\n  ? null\n  : createContext<StoreApi<GraphState>>(defaultStore);\n\nexport const Provider: FC<{\n  children: ReactNode;\n  store?: StoreApi<GraphState>;\n}> = ({ children, store = defaultStore }) => {\n  if (isServerRender) {\n    return children;\n  }\n\n  return React.createElement(StoreContext.Provider, { value: store }, children);\n};\n\nexport const useStore = <T>(selector: (state: GraphState) => T): T => {\n  const store = useContext(StoreContext);\n  // use the useShallow hook, which will return a stable reference (https://zustand.docs.pmnd.rs/migrations/migrating-to-v5)\n  return useZustandStore(store, useShallow(selector));\n};\n","import { GraphEdge, GraphNode } from '../types';\n\ninterface GetHiddenChildrenInput {\n  nodeId: string;\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n  currentHiddenNodes: GraphNode[];\n  currentHiddenEdges: GraphEdge[];\n}\n\ninterface GetVisibleIdsInput {\n  collapsedIds: string[];\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n}\n\ninterface GetExpandPathInput {\n  nodeId: string;\n  edges: GraphEdge[];\n  visibleEdgeIds: string[];\n}\n\n/**\n * Get the children of a node id that is hidden.\n */\nfunction getHiddenChildren({\n  nodeId,\n  nodes,\n  edges,\n  currentHiddenNodes,\n  currentHiddenEdges\n}: GetHiddenChildrenInput) {\n  const hiddenNodes: GraphNode[] = [];\n  const hiddenEdges: GraphEdge[] = [];\n  const curHiddenNodeIds = currentHiddenNodes.map(n => n.id);\n  const curHiddenEdgeIds = currentHiddenEdges.map(e => e.id);\n\n  const outboundEdges = edges.filter(l => l.source === nodeId);\n  const outboundEdgeNodeIds = outboundEdges.map(l => l.target);\n\n  hiddenEdges.push(...outboundEdges);\n  for (const outboundEdgeNodeId of outboundEdgeNodeIds) {\n    const incomingEdges = edges.filter(\n      l => l.target === outboundEdgeNodeId && l.source !== nodeId\n    );\n    let hideNode = false;\n\n    // Check to see if any other edge is coming into this node\n    if (incomingEdges.length === 0) {\n      hideNode = true;\n    } else if (\n      incomingEdges.length > 0 &&\n      !curHiddenNodeIds.includes(outboundEdgeNodeId)\n    ) {\n      // If all inbound links are hidden, hide this node as well\n      const inboundNodeLinkIds = incomingEdges.map(l => l.id);\n      if (inboundNodeLinkIds.every(i => curHiddenEdgeIds.includes(i))) {\n        hideNode = true;\n      }\n    }\n    if (hideNode) {\n      // Need to hide this node and any children of this node\n      const node = nodes.find(n => n.id === outboundEdgeNodeId);\n      if (node) {\n        hiddenNodes.push(node);\n      }\n      const nested = getHiddenChildren({\n        nodeId: outboundEdgeNodeId,\n        nodes,\n        edges,\n        currentHiddenEdges: hiddenEdges,\n        currentHiddenNodes: hiddenNodes\n      });\n      hiddenEdges.push(...nested.hiddenEdges);\n      hiddenNodes.push(...nested.hiddenNodes);\n    }\n  }\n\n  const uniqueEdges: GraphEdge[] = Object.values(\n    hiddenEdges.reduce(\n      (acc, next) => ({\n        ...acc,\n        [next.id]: next\n      }),\n      {}\n    )\n  );\n\n  const uniqueNodes: GraphNode[] = Object.values(\n    hiddenNodes.reduce(\n      (acc, next) => ({\n        ...acc,\n        [next.id]: next\n      }),\n      {}\n    )\n  );\n\n  return {\n    hiddenEdges: uniqueEdges,\n    hiddenNodes: uniqueNodes\n  };\n}\n\n/**\n * Get the visible nodes and edges given a collapsed set of ids.\n */\nexport const getVisibleEntities = ({\n  collapsedIds,\n  nodes,\n  edges\n}: GetVisibleIdsInput) => {\n  const curHiddenNodes = [];\n  const curHiddenEdges = [];\n\n  for (const collapsedId of collapsedIds) {\n    const { hiddenEdges, hiddenNodes } = getHiddenChildren({\n      nodeId: collapsedId,\n      nodes,\n      edges,\n      currentHiddenEdges: curHiddenEdges,\n      currentHiddenNodes: curHiddenNodes\n    });\n\n    curHiddenNodes.push(...hiddenNodes);\n    curHiddenEdges.push(...hiddenEdges);\n  }\n\n  const hiddenNodeIds = curHiddenNodes.map(n => n.id);\n  const hiddenEdgeIds = curHiddenEdges.map(e => e.id);\n  const visibleNodes = nodes.filter(n => !hiddenNodeIds.includes(n.id));\n  const visibleEdges = edges.filter(e => !hiddenEdgeIds.includes(e.id));\n\n  return {\n    visibleNodes,\n    visibleEdges\n  };\n};\n\n/**\n * Get the path to expand a node.\n */\nexport const getExpandPath = ({\n  nodeId,\n  edges,\n  visibleEdgeIds\n}: GetExpandPathInput) => {\n  const parentIds = [];\n  const inboundEdges = edges.filter(l => l.target === nodeId);\n  const inboundEdgeIds = inboundEdges.map(e => e.id);\n  const hasVisibleInboundEdge = inboundEdgeIds.some(id =>\n    visibleEdgeIds.includes(id)\n  );\n\n  if (hasVisibleInboundEdge) {\n    // If there is a visible edge to this node, that means the node is\n    // visible so no parents need to be expanded\n    return parentIds;\n  }\n\n  const inboundEdgeNodeIds = inboundEdges.map(l => l.source);\n  let addedParent = false;\n\n  for (const inboundNodeId of inboundEdgeNodeIds) {\n    if (!addedParent) {\n      // Only want to expand a single path to the node, so if there\n      // are multiple hidden incoming edges, only expand the first\n      // to reduce how many nodes are expanded to get to the node\n      parentIds.push(\n        ...[\n          inboundNodeId,\n          ...getExpandPath({ nodeId: inboundNodeId, edges, visibleEdgeIds })\n        ]\n      );\n      addedParent = true;\n    }\n  }\n\n  return parentIds;\n};\n","import React, { useCallback } from 'react';\nimport { GraphEdge, GraphNode } from '../types';\nimport { getExpandPath, getVisibleEntities } from './utils';\n\nexport interface UseCollapseProps {\n  /**\n   * Current collapsed node ids.\n   */\n  collapsedNodeIds?: string[];\n\n  /**\n   * Node data.\n   */\n  nodes?: GraphNode[];\n\n  /**\n   * Edge data.\n   */\n  edges?: GraphEdge[];\n}\n\nexport interface CollpaseResult {\n  /**\n   * Determine if a node is currently collapsed\n   */\n  getIsCollapsed: (nodeId: string) => boolean;\n\n  /**\n   * Return a list of ids required to expand in order to view the provided node\n   */\n  getExpandPathIds: (nodeId: string) => string[];\n}\n\nexport const useCollapse = ({\n  collapsedNodeIds = [],\n  nodes = [],\n  edges = []\n}: UseCollapseProps): CollpaseResult => {\n  const getIsCollapsed = useCallback(\n    (nodeId: string) => {\n      const { visibleNodes } = getVisibleEntities({\n        nodes,\n        edges,\n        collapsedIds: collapsedNodeIds\n      });\n      const visibleNodeIds = visibleNodes.map(n => n.id);\n\n      return !visibleNodeIds.includes(nodeId);\n    },\n    [collapsedNodeIds, edges, nodes]\n  );\n\n  const getExpandPathIds = useCallback(\n    (nodeId: string) => {\n      const { visibleEdges } = getVisibleEntities({\n        nodes,\n        edges,\n        collapsedIds: collapsedNodeIds\n      });\n      const visibleEdgeIds = visibleEdges.map(e => e.id);\n\n      return getExpandPath({ nodeId, edges, visibleEdgeIds });\n    },\n    [collapsedNodeIds, edges, nodes]\n  );\n\n  return {\n    getIsCollapsed,\n    getExpandPathIds\n  };\n};\n","import { useRef, useCallback, useEffect, useMemo } from 'react';\nimport { useThree } from '@react-three/fiber';\nimport { PerspectiveCamera } from 'three';\nimport { SizingType } from './sizing';\nimport {\n  LayoutTypes,\n  layoutProvider,\n  LayoutStrategy,\n  LayoutOverrides\n} from './layout';\nimport { LabelVisibilityType, calcLabelVisibility } from './utils/visibility';\nimport { tick } from './layout/layoutUtils';\nimport { GraphEdge, GraphNode, InternalGraphNode } from './types';\nimport { buildGraph, transformGraph } from './utils/graph';\nimport { DragReferences, useStore } from './store';\nimport { getVisibleEntities } from './collapse';\nimport { calculateClusters } from './utils/cluster';\n\nexport interface GraphInputs {\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n  collapsedNodeIds?: string[];\n  layoutType?: LayoutTypes;\n  sizingType?: SizingType;\n  labelType?: LabelVisibilityType;\n  sizingAttribute?: string;\n  selections?: string[];\n  actives?: string[];\n  clusterAttribute?: string;\n  defaultNodeSize?: number;\n  minNodeSize?: number;\n  maxNodeSize?: number;\n  constrainDragging?: boolean;\n  layoutOverrides?: LayoutOverrides;\n}\n\nexport const useGraph = ({\n  layoutType,\n  sizingType,\n  labelType,\n  sizingAttribute,\n  clusterAttribute,\n  selections,\n  nodes,\n  edges,\n  actives,\n  collapsedNodeIds,\n  defaultNodeSize,\n  maxNodeSize,\n  minNodeSize,\n  layoutOverrides,\n  constrainDragging\n}: GraphInputs) => {\n  const graph = useStore(state => state.graph);\n  const clusters = useStore(state => state.clusters);\n  const storedNodes = useStore(state => state.nodes);\n  const setClusters = useStore(state => state.setClusters);\n  const stateCollapsedNodeIds = useStore(state => state.collapsedNodeIds);\n  const setEdges = useStore(state => state.setEdges);\n  const stateNodes = useStore(state => state.nodes);\n  const setNodes = useStore(state => state.setNodes);\n  const setSelections = useStore(state => state.setSelections);\n  const setActives = useStore(state => state.setActives);\n  const drags = useStore(state => state.drags);\n  const setDrags = useStore(state => state.setDrags);\n  const setCollapsedNodeIds = useStore(state => state.setCollapsedNodeIds);\n  const layoutMounted = useRef<boolean>(false);\n  const layout = useRef<LayoutStrategy | null>(null);\n  const camera = useThree(state => state.camera) as PerspectiveCamera;\n  const dragRef = useRef<DragReferences>(drags);\n  const clustersRef = useRef<any>([]);\n\n  // When a new node is added, remove the dragged position of the cluster nodes to put new node in the right place\n  useEffect(() => {\n    if (!clusterAttribute) {\n      return;\n    }\n\n    const existedNodesIds = storedNodes.map(n => n.id);\n    const newNode = nodes.find(n => !existedNodesIds.includes(n.id));\n    if (newNode) {\n      const clusterName = newNode.data[clusterAttribute];\n      const cluster = clusters.get(clusterName);\n      const drags = { ...dragRef.current };\n\n      cluster?.nodes?.forEach(node => (drags[node.id] = undefined));\n\n      dragRef.current = drags;\n      setDrags(drags);\n    }\n  }, [storedNodes, nodes, clusterAttribute, clusters, setDrags]);\n\n  // Calculate the visible entities\n  const { visibleEdges, visibleNodes } = useMemo(\n    () =>\n      getVisibleEntities({\n        collapsedIds: stateCollapsedNodeIds,\n        nodes,\n        edges\n      }),\n    [stateCollapsedNodeIds, nodes, edges]\n  );\n\n  // Store node positions inside drags state\n  const updateDrags = useCallback(\n    (nodes: InternalGraphNode[]) => {\n      const drags = { ...dragRef.current };\n      nodes.forEach(node => (drags[node.id] = node));\n      dragRef.current = drags;\n      setDrags(drags);\n    },\n    [setDrags]\n  );\n\n  const updateLayout = useCallback(\n    async (curLayout?: any) => {\n      // Cache the layout provider\n      layout.current =\n        curLayout ||\n        layoutProvider({\n          ...layoutOverrides,\n          type: layoutType,\n          graph,\n          drags: dragRef.current,\n          clusters: clustersRef?.current,\n          clusterAttribute\n        });\n\n      // Run the layout\n      await tick(layout.current);\n\n      // Transform the graph\n      const result = transformGraph({\n        graph,\n        layout: layout.current,\n        sizingType,\n        labelType,\n        sizingAttribute,\n        maxNodeSize,\n        minNodeSize,\n        defaultNodeSize,\n        clusterAttribute\n      });\n\n      // Calculate clusters\n      const newClusters = calculateClusters({\n        nodes: result.nodes,\n        clusterAttribute\n      });\n\n      // Do not decrease the cluster size is the number of nodes is the same\n      if (constrainDragging) {\n        newClusters.forEach(cluster => {\n          const prevCluster = clustersRef.current.get(cluster.label);\n          if (prevCluster?.nodes.length === cluster.nodes.length) {\n            cluster.position =\n              clustersRef.current?.get(cluster.label)?.position ??\n              cluster.position;\n          }\n        });\n      }\n\n      // Set our store outputs\n      setEdges(result.edges);\n      setNodes(result.nodes);\n      setClusters(newClusters);\n      if (clusterAttribute) {\n        // Set drag positions for nodes to prevent them from being moved by the layout update\n        updateDrags(result.nodes);\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [\n      layoutOverrides,\n      layoutType,\n      clusterAttribute,\n      sizingType,\n      labelType,\n      sizingAttribute,\n      maxNodeSize,\n      minNodeSize,\n      defaultNodeSize,\n      setEdges,\n      setNodes,\n      setClusters\n    ]\n  );\n\n  // Transient updates\n  useEffect(() => {\n    dragRef.current = drags;\n  }, [drags, clusterAttribute, updateLayout]);\n\n  // Transient cluster state\n  useEffect(() => {\n    clustersRef.current = clusters;\n  }, [clusters]);\n\n  useEffect(() => {\n    // When the camera position/zoom changes, update the label visibility\n    const nodes = stateNodes.map(node => ({\n      ...node,\n      labelVisible: calcLabelVisibility({\n        nodeCount: stateNodes?.length,\n        labelType,\n        camera,\n        nodePosition: node?.position\n      })('node', node?.size)\n    }));\n\n    // Determine if the label visibility has changed\n    const isVisibilityUpdated = nodes.some(\n      (node, i) => node.labelVisible !== stateNodes[i].labelVisible\n    );\n\n    // Update the nodes if the label visibility has changed\n    if (isVisibilityUpdated) {\n      setNodes(nodes);\n    }\n  }, [camera, camera.zoom, camera.position.z, setNodes, stateNodes, labelType]);\n\n  useEffect(() => {\n    // Let's set the store selections so its easier to access\n    if (layoutMounted.current) {\n      setSelections(selections);\n    }\n  }, [selections, setSelections]);\n\n  useEffect(() => {\n    // Let's set the store actives so its easier to access\n    if (layoutMounted.current) {\n      setActives(actives);\n    }\n  }, [actives, setActives]);\n\n  // Create the nggraph graph object\n  useEffect(() => {\n    async function update() {\n      layoutMounted.current = false;\n      buildGraph(graph, visibleNodes, visibleEdges);\n      await updateLayout();\n      // rqf to prevent race condition\n      requestAnimationFrame(() => (layoutMounted.current = true));\n    }\n\n    update();\n    // eslint-disable-next-line\n  }, [visibleNodes, visibleEdges]);\n\n  useEffect(() => {\n    // Let's set the store collapsedNodeIds so its easier to access\n    if (layoutMounted.current) {\n      setCollapsedNodeIds(collapsedNodeIds);\n    }\n  }, [collapsedNodeIds, setCollapsedNodeIds]);\n\n  // Update layout on type changes\n  useEffect(() => {\n    if (layoutMounted.current) {\n      // When a update is changed, discard all the previous drag positions\n      // NOTE: This sets the transient and the state\n      dragRef.current = {};\n      setDrags({});\n\n      // Recalculate the layout\n      updateLayout();\n    }\n  }, [layoutType, updateLayout, setDrags]);\n\n  // Update layout on size, label changes\n  useEffect(() => {\n    if (layoutMounted.current) {\n      updateLayout(layout.current);\n    }\n  }, [sizingType, sizingAttribute, labelType, updateLayout]);\n\n  return {\n    updateLayout\n  };\n};\n","import React, { FC, useMemo } from 'react';\nimport { Billboard, Text } from '@react-three/drei';\nimport { Color, ColorRepresentation, Euler } from 'three';\nimport ellipsize from 'ellipsize';\n\nexport interface LabelProps {\n  /**\n   * Text to render.\n   */\n  text: string;\n\n  /**\n   * Font URL.\n   * Reference: https://github.com/reaviz/reagraph/issues/23\n   */\n  fontUrl?: string;\n\n  /**\n   * Size of the font.\n   */\n  fontSize?: number;\n\n  /**\n   * Color of the text.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * Stroke of the text.\n   */\n  stroke?: ColorRepresentation;\n\n  /**\n   * Opacity for the label.\n   */\n  opacity?: number;\n\n  /**\n   * The lenth of which to start the ellipsis.\n   */\n  ellipsis?: number;\n\n  /**\n   * Whether the label is active ( dragging, hover, focus ).\n   */\n  active?: boolean;\n\n  /**\n   * Rotation of the label.\n   */\n  rotation?: Euler | [number, number, number];\n}\n\nexport const Label: FC<LabelProps> = ({\n  text,\n  fontSize = 7,\n  fontUrl,\n  color = '#2A6475',\n  opacity = 1,\n  stroke,\n  active,\n  ellipsis = 75,\n  rotation\n}) => {\n  const shortText = ellipsis && !active ? ellipsize(text, ellipsis) : text;\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const normalizedStroke = useMemo(\n    () => (stroke ? new Color(stroke) : undefined),\n    [stroke]\n  );\n\n  return (\n    <Billboard position={[0, 0, 1]}>\n      <Text\n        font={fontUrl}\n        fontSize={fontSize}\n        color={normalizedColor}\n        fillOpacity={opacity}\n        textAlign=\"center\"\n        outlineWidth={stroke ? 1 : 0}\n        outlineColor={normalizedStroke}\n        depthOffset={0}\n        maxWidth={100}\n        overflowWrap=\"break-word\"\n        rotation={rotation}\n      >\n        {shortText}\n      </Text>\n    </Billboard>\n  );\n};\n","import { useThree } from '@react-three/fiber';\nimport { useMemo } from 'react';\nimport { useGesture } from '@use-gesture/react';\nimport { Vector2, Vector3, Plane } from 'three';\nimport { InternalGraphPosition } from '../types';\nimport { CenterPositionVector } from '../utils/layout';\n\ninterface DragParams {\n  draggable: boolean;\n  position: InternalGraphPosition;\n  bounds?: CenterPositionVector;\n  set: (position: Vector3) => void;\n  onDragStart: () => void;\n  onDragEnd: () => void;\n}\n\nexport const useDrag = ({\n  draggable,\n  set,\n  position,\n  bounds,\n  onDragStart,\n  onDragEnd\n}: DragParams) => {\n  const camera = useThree(state => state.camera);\n  const raycaster = useThree(state => state.raycaster);\n  const size = useThree(state => state.size);\n  const gl = useThree(state => state.gl);\n\n  // Reference: https://codesandbox.io/s/react-three-draggable-cxu37\n  const { mouse2D, mouse3D, offset, normal, plane } = useMemo(\n    () => ({\n      // Normalized 2D screen space mouse coords\n      mouse2D: new Vector2(),\n      // 3D world space mouse coords\n      mouse3D: new Vector3(),\n      // Drag point offset from object origin\n      offset: new Vector3(),\n      // Normal of the drag plane\n      normal: new Vector3(),\n      // Drag plane\n      plane: new Plane()\n    }),\n    []\n  );\n\n  const clientRect = useMemo(\n    () => gl.domElement.getBoundingClientRect(),\n    [gl.domElement]\n  );\n\n  return useGesture(\n    {\n      onDragStart: ({ event }) => {\n        // @ts-ignore\n        const { eventObject, point } = event;\n\n        // Save the offset of click point from object origin\n        eventObject.getWorldPosition(offset).sub(point);\n\n        // Set initial 3D cursor position (needed for onDrag plane calculation)\n        mouse3D.copy(point);\n\n        // Run user callback\n        onDragStart();\n      },\n      onDrag: ({ xy, buttons, cancel }) => {\n        // If the left mouse button is not pressed, cancel the drag\n        if (buttons !== 1) {\n          cancel();\n          return;\n        }\n        // Compute normalized mouse coordinates (screen space)\n        const nx = ((xy[0] - (clientRect?.left ?? 0)) / size.width) * 2 - 1;\n        const ny = -((xy[1] - (clientRect?.top ?? 0)) / size.height) * 2 + 1;\n\n        // Unlike the mouse from useThree, this works offscreen\n        mouse2D.set(nx, ny);\n\n        // Update raycaster (otherwise it doesn't track offscreen)\n        raycaster.setFromCamera(mouse2D, camera);\n\n        // The drag plane is normal to the camera view\n        camera.getWorldDirection(normal).negate();\n\n        // Find the plane that's normal to the camera and contains our drag point\n        plane.setFromNormalAndCoplanarPoint(normal, mouse3D);\n\n        // Find the point of intersection\n        raycaster.ray.intersectPlane(plane, mouse3D);\n\n        // Update the object position with the original offset\n        const updated = new Vector3(position.x, position.y, position.z)\n          .copy(mouse3D)\n          .add(offset);\n\n        // If there's a cluster, clamp the position within its circular bounds\n        if (bounds) {\n          const center = new Vector3(\n            (bounds.minX + bounds.maxX) / 2,\n            (bounds.minY + bounds.maxY) / 2,\n            (bounds.minZ + bounds.maxZ) / 2\n          );\n          const radius = (bounds.maxX - bounds.minX) / 2;\n\n          // Calculate direction from center to updated position\n          const direction = updated.clone().sub(center);\n          const distance = direction.length();\n\n          // If outside the circle, clamp to the circle's edge\n          if (distance > radius) {\n            direction.normalize().multiplyScalar(radius);\n            updated.copy(center).add(direction);\n          }\n        }\n\n        return set(updated);\n      },\n      onDragEnd\n    },\n    { drag: { enabled: draggable, threshold: 10 } }\n  );\n};\n","import { useCallback, useRef } from 'react';\nimport type { ThreeEvent } from '@react-three/fiber';\n\nexport interface HoverIntentOptions {\n  interval?: number;\n  sensitivity?: number;\n  timeout?: number;\n  disabled?: boolean;\n  onPointerOver: (event: ThreeEvent<PointerEvent>) => void;\n  onPointerOut: (event: ThreeEvent<PointerEvent>) => void;\n}\n\nexport interface HoverIntentResult {\n  pointerOut: (event: ThreeEvent<PointerEvent>) => void;\n  pointerOver: (event: ThreeEvent<PointerEvent>) => void;\n}\n\n/**\n * Hover intent identifies if the user actually is\n * intending to over by measuring the position of the mouse\n * once a pointer enters and determining if in a duration if\n * the mouse moved inside a certain threshold and fires the events.\n */\nexport const useHoverIntent = ({\n  sensitivity = 7,\n  interval = 50,\n  timeout = 0,\n  disabled,\n  onPointerOver,\n  onPointerOut\n}: HoverIntentOptions | undefined): HoverIntentResult => {\n  const mouseOver = useRef<boolean>(false);\n  const timer = useRef<any | null>(null);\n  const state = useRef<number>(0);\n  const coords = useRef({\n    x: null,\n    y: null,\n    px: null,\n    py: null\n  });\n\n  const onMouseMove = useCallback((event: MouseEvent) => {\n    coords.current.x = event.clientX;\n    coords.current.y = event.clientY;\n  }, []);\n\n  const comparePosition = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      timer.current = clearTimeout(timer.current);\n      const { px, x, py, y } = coords.current;\n\n      if (Math.abs(px - x) + Math.abs(py - y) < sensitivity) {\n        state.current = 1;\n        onPointerOver(event);\n      } else {\n        coords.current.px = x;\n        coords.current.py = y;\n        timer.current = setTimeout(() => comparePosition(event), interval);\n      }\n    },\n    [interval, onPointerOver, sensitivity]\n  );\n\n  const cleanup = useCallback(() => {\n    clearTimeout(timer.current);\n    if (typeof window !== 'undefined') {\n      document.removeEventListener('mousemove', onMouseMove, false);\n    }\n  }, [onMouseMove]);\n\n  const pointerOver = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      if (!disabled) {\n        mouseOver.current = true;\n        cleanup();\n\n        if (state.current !== 1) {\n          coords.current.px = event.pointer.x;\n          coords.current.py = event.pointer.y;\n\n          if (typeof window !== 'undefined') {\n            document.addEventListener('mousemove', onMouseMove, false);\n          }\n\n          timer.current = setTimeout(() => comparePosition(event), timeout);\n        }\n      }\n    },\n    [cleanup, comparePosition, disabled, onMouseMove, timeout]\n  );\n\n  const delay = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      timer.current = clearTimeout(timer.current);\n      state.current = 0;\n      onPointerOut(event);\n    },\n    [onPointerOut]\n  );\n\n  const pointerOut = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      mouseOver.current = false;\n      cleanup();\n\n      if (state.current === 1) {\n        timer.current = setTimeout(() => delay(event), timeout);\n      }\n    },\n    [cleanup, delay, timeout]\n  );\n\n  return {\n    pointerOver,\n    pointerOut\n  };\n};\n","import CameraControls from 'camera-controls';\nimport { createContext, useContext } from 'react';\n\nexport interface CameraControlsContextProps {\n  /**\n   * The camera controls object.\n   */\n  controls: CameraControls | null;\n\n  /**\n   * A function that resets the camera controls.\n   * If the optional `animated` argument is true, the reset is animated.\n   */\n  resetControls: (animated?: boolean) => void;\n\n  /**\n   * A function that zooms in the camera.\n   */\n  zoomIn: () => void;\n\n  /**\n   * A function that zooms out the camera.\n   */\n  zoomOut: () => void;\n\n  /**\n   * A function that dollies in the camera.\n   */\n  dollyIn: (distance?: number) => void;\n\n  /**\n   * A function that dollies out the camera.\n   */\n  dollyOut: (distance?: number) => void;\n\n  /**\n   * A function that pans the camera to the left.\n   */\n  panLeft: () => void;\n\n  /**\n   * A function that pans the camera to the right.\n   */\n  panRight: () => void;\n\n  /**\n   * A function that pans the camera upwards.\n   */\n  panUp: () => void;\n\n  /**\n   * A function that pans the camera downwards.\n   */\n  panDown: () => void;\n\n  /**\n   * A function that freezes the camera.\n   */\n  freeze: () => void;\n\n  /**\n   * A function that unfreezes the camera.\n   */\n  unFreeze: () => void;\n}\n\nexport const CameraControlsContext = createContext<CameraControlsContextProps>({\n  controls: null,\n  resetControls: () => undefined,\n  zoomIn: () => undefined,\n  zoomOut: () => undefined,\n  dollyIn: () => undefined,\n  dollyOut: () => undefined,\n  panLeft: () => undefined,\n  panRight: () => undefined,\n  panUp: () => undefined,\n  panDown: () => undefined,\n  freeze: () => undefined,\n  unFreeze: () => undefined\n});\n\nexport const useCameraControls = () => {\n  const context = useContext(CameraControlsContext);\n\n  if (context === undefined) {\n    throw new Error(\n      '`useCameraControls` hook must be used within a `ControlsProvider` component'\n    );\n  }\n\n  return context;\n};\n","import React, { FC } from 'react';\nimport { a, useSpring } from '@react-spring/three';\nimport { Color, DoubleSide } from 'three';\n\nimport { Theme } from '../../themes';\nimport { animationConfig } from '../../utils';\n\nexport interface RingProps {\n  outerRadius: number;\n  innerRadius: number;\n  padding: number;\n  normalizedFill: Color;\n  normalizedStroke: Color;\n  opacity: number;\n  animated: boolean;\n  theme: Theme;\n}\n\nexport const Ring: FC<RingProps> = ({\n  outerRadius,\n  innerRadius,\n  padding,\n  normalizedFill,\n  normalizedStroke,\n  opacity,\n  animated,\n  theme\n}) => {\n  const { opacity: springOpacity } = useSpring({\n    from: { opacity: 0 },\n    to: { opacity },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  return (\n    <>\n      <mesh>\n        <ringGeometry attach=\"geometry\" args={[outerRadius, 0, 128]} />\n        <a.meshBasicMaterial\n          attach=\"material\"\n          color={normalizedFill}\n          transparent={true}\n          depthTest={false}\n          opacity={theme.cluster?.fill ? springOpacity : 0}\n          side={DoubleSide}\n          fog={true}\n        />\n      </mesh>\n      <mesh>\n        <ringGeometry\n          attach=\"geometry\"\n          args={[outerRadius, innerRadius + padding, 128]}\n        />\n        <a.meshBasicMaterial\n          attach=\"material\"\n          color={normalizedStroke}\n          transparent={true}\n          depthTest={false}\n          opacity={springOpacity}\n          side={DoubleSide}\n          fog={true}\n        />\n      </mesh>\n    </>\n  );\n};\n","import React, { FC, useMemo, useState } from 'react';\nimport { ClusterGroup, animationConfig } from '../utils';\nimport { useSpring, a } from '@react-spring/three';\nimport { Color } from 'three';\nimport { useStore } from '../store';\nimport { Label } from './Label';\nimport { useCursor } from '@react-three/drei';\nimport type { ThreeEvent } from '@react-three/fiber';\nimport { useDrag } from '../utils/useDrag';\nimport { useHoverIntent } from '../utils/useHoverIntent';\nimport { useCameraControls } from '../CameraControls/useCameraControls';\nimport { Vector3 } from 'three';\nimport { ClusterRenderer } from '../types';\nimport { Ring } from './clusters/Ring';\n\nexport type ClusterEventArgs = Omit<ClusterGroup, 'position'>;\n\nexport interface ClusterProps extends ClusterGroup {\n  /**\n   * Whether the circle should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The radius of the circle. Default 1.\n   */\n  radius?: number;\n\n  /**\n   * The padding of the circle. Default 20.\n   */\n  padding?: number;\n\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * Whether the node is disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * When the cluster was clicked.\n   */\n  onClick?: (cluster: ClusterEventArgs, event: ThreeEvent<MouseEvent>) => void;\n\n  /**\n   * When a cluster receives a pointer over event.\n   */\n  onPointerOver?: (\n    cluster: ClusterEventArgs,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * When cluster receives a pointer leave event.\n   */\n  onPointerOut?: (\n    cluster: ClusterEventArgs,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * Whether the cluster is draggable\n   */\n  draggable?: boolean;\n\n  /**\n   * Triggered after a cluster was dragged\n   */\n  onDragged?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * Render a custom cluster label\n   */\n  onRender?: ClusterRenderer;\n}\n\nexport const Cluster: FC<ClusterProps> = ({\n  animated,\n  position,\n  padding = 40,\n  labelFontUrl,\n  disabled,\n  radius = 2,\n  nodes,\n  label,\n  onClick,\n  onPointerOver,\n  onPointerOut,\n  draggable = false,\n  onDragged,\n  onRender\n}) => {\n  const theme = useStore(state => state.theme);\n  const rad = Math.max(position.width, position.height) / 2;\n  const offset = rad - radius + padding;\n  const [active, setActive] = useState<boolean>(false);\n  const center = useStore(state => state.centerPosition);\n  const nodesState = useStore(state => state.nodes);\n  const cameraControls = useCameraControls();\n  const draggingIds = useStore(state => state.draggingIds);\n  const isDraggingCurrent = draggingIds.includes(label);\n  const isDragging = draggingIds.length > 0;\n\n  const isActive = useStore(state =>\n    state.actives?.some(id => nodes.some(n => n.id === id))\n  );\n  const hoveredNodeId = useStore(state => state.hoveredNodeId);\n\n  const isSelected = useStore(state =>\n    state.selections?.some(id => nodes.some(n => n.id === id))\n  );\n\n  const hasSelections = useStore(state => state.selections?.length > 0);\n\n  const opacity = hasSelections\n    ? isSelected || active || isActive\n      ? theme.cluster?.selectedOpacity\n      : theme.cluster?.inactiveOpacity\n    : theme.cluster?.opacity;\n\n  const labelPosition: [number, number, number] = useMemo(() => {\n    const defaultPosition: [number, number, number] = [0, -offset, 2];\n    const themeOffset = theme.cluster?.label?.offset;\n    if (themeOffset) {\n      return [\n        defaultPosition[0] - themeOffset[0],\n        defaultPosition[1] - themeOffset[1],\n        defaultPosition[2] - themeOffset[2]\n      ];\n    }\n\n    return defaultPosition;\n  }, [offset, theme.cluster?.label?.offset]);\n\n  const { circlePosition } = useSpring({\n    from: {\n      circlePosition: [center.x, center.y, -1] as [number, number, number]\n    },\n    to: {\n      circlePosition: position\n        ? ([position.x, position.y, -1] as [number, number, number])\n        : ([0, 0, -1] as [number, number, number])\n    },\n    config: {\n      ...animationConfig,\n      duration: animated && !isDragging ? undefined : 0\n    }\n  });\n\n  const normalizedStroke = useMemo(\n    () => new Color(theme.cluster?.stroke),\n    [theme.cluster?.stroke]\n  );\n\n  const normalizedFill = useMemo(\n    () => new Color(theme.cluster?.fill),\n    [theme.cluster?.fill]\n  );\n\n  const addDraggingId = useStore(state => state.addDraggingId);\n  const removeDraggingId = useStore(state => state.removeDraggingId);\n  const setClusterPosition = useStore(state => state.setClusterPosition);\n\n  // Define the drag event handlers for the cluster\n  const bind = useDrag({\n    draggable: draggable && !hoveredNodeId,\n    position: {\n      x: position.x,\n      y: position.y,\n      z: -1\n    } as any,\n    set: (pos: Vector3) => setClusterPosition(label, pos as any),\n    onDragStart: () => {\n      addDraggingId(label);\n      setActive(true);\n    },\n    onDragEnd: () => {\n      removeDraggingId(label);\n      setActive(false);\n      // Get nodes from store with updated position after dragging\n      const updatedClusterNodes = nodesState.filter(n => n.cluster === label);\n      onDragged?.({ nodes: updatedClusterNodes, label });\n    }\n  });\n\n  // Set the cursor to pointer when the cluster is active and not dragging\n  useCursor(active && !isDragging && onClick !== undefined, 'pointer');\n  // Set the cursor to grab when the cluster is active and draggable\n  useCursor(\n    active && draggable && !isDraggingCurrent && onClick === undefined,\n    'grab'\n  );\n  // Set the cursor to grabbing when the cluster is dragging\n  useCursor(isDraggingCurrent, 'grabbing');\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled,\n    onPointerOver: (event: ThreeEvent<PointerEvent>) => {\n      setActive(true);\n      cameraControls.freeze();\n      onPointerOver?.(\n        {\n          nodes,\n          label\n        },\n        event\n      );\n    },\n    onPointerOut: (event: ThreeEvent<PointerEvent>) => {\n      setActive(false);\n      cameraControls.unFreeze();\n      onPointerOut?.(\n        {\n          nodes,\n          label\n        },\n        event\n      );\n    }\n  });\n\n  const cluster = useMemo(\n    () =>\n      theme.cluster && (\n        <a.group\n          userData={{ id: label, type: 'cluster' }}\n          position={circlePosition as any}\n          onPointerOver={pointerOver}\n          onPointerOut={pointerOut}\n          onClick={(event: ThreeEvent<MouseEvent>) => {\n            if (!disabled && !isDraggingCurrent) {\n              onClick?.({ nodes, label }, event);\n            }\n          }}\n          {...(bind() as any)}\n        >\n          {onRender ? (\n            onRender({\n              label: {\n                position: labelPosition,\n                text: label,\n                opacity: opacity,\n                fontUrl: labelFontUrl\n              },\n              opacity,\n              outerRadius: offset,\n              innerRadius: rad,\n              padding,\n              theme\n            })\n          ) : (\n            <>\n              <Ring\n                outerRadius={offset}\n                innerRadius={rad}\n                padding={padding}\n                normalizedFill={normalizedFill}\n                normalizedStroke={normalizedStroke}\n                opacity={opacity}\n                animated={animated}\n                theme={theme}\n              />\n              {theme.cluster?.label && (\n                <a.group position={labelPosition}>\n                  <Label\n                    text={label}\n                    opacity={opacity}\n                    fontUrl={labelFontUrl}\n                    stroke={theme.cluster.label.stroke}\n                    active={false}\n                    color={theme.cluster?.label.color}\n                    fontSize={theme.cluster?.label.fontSize ?? 12}\n                  />\n                </a.group>\n              )}\n            </>\n          )}\n        </a.group>\n      ),\n    [\n      theme,\n      circlePosition,\n      pointerOver,\n      pointerOut,\n      offset,\n      normalizedFill,\n      rad,\n      padding,\n      normalizedStroke,\n      labelPosition,\n      label,\n      opacity,\n      labelFontUrl,\n      disabled,\n      onClick,\n      nodes,\n      bind,\n      isDraggingCurrent,\n      onRender,\n      animated\n    ]\n  );\n\n  return cluster;\n};\n","import React, { FC, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Color, ColorRepresentation, Mesh, DoubleSide, Vector3 } from 'three';\nimport { animationConfig } from '../utils';\nimport { useStore } from '../store';\n\nexport type EdgeArrowPosition = 'none' | 'mid' | 'end';\n\nexport interface ArrowProps {\n  /**\n   * Whether the arrow should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The color of the arrow.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * The length of the arrow.\n   */\n  length: number;\n\n  /**\n   * The opacity of the arrow.\n   */\n  opacity?: number;\n\n  /**\n   * The position of the arrow in 3D space.\n   */\n  position: Vector3;\n\n  /**\n   * The rotation of the arrow in 3D space.\n   */\n  rotation: Vector3;\n\n  /**\n   * The size of the arrow.\n   */\n  size: number;\n\n  /**\n   * A function that is called when the arrow is right-clicked.\n   */\n  onContextMenu?: () => void;\n\n  /**\n   * A function that is called when the arrow is selected or deselected.\n   */\n  onActive?: (state: boolean) => void;\n}\n\nexport const Arrow: FC<ArrowProps> = ({\n  animated,\n  color = '#D8E6EA',\n  length,\n  opacity = 0.5,\n  position,\n  rotation,\n  size = 1,\n  onActive,\n  onContextMenu\n}) => {\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const meshRef = useRef<Mesh | null>(null);\n  const isDragging = useStore(state => state.draggingIds.length > 0);\n  const center = useStore(state => state.centerPosition);\n\n  const [{ pos, arrowOpacity }] = useSpring(\n    () => ({\n      from: {\n        pos: center ? [center.x, center.y, center.z] : [0, 0, 0],\n        arrowOpacity: 0\n      },\n      to: {\n        pos: [position.x, position.y, position.z],\n        arrowOpacity: opacity\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !isDragging ? undefined : 0\n      }\n    }),\n    [animated, isDragging, opacity, position]\n  );\n\n  const setQuaternion = useCallback(() => {\n    const axis = new Vector3(0, 1, 0);\n    meshRef.current?.quaternion.setFromUnitVectors(axis, rotation);\n  }, [rotation, meshRef]);\n\n  useEffect(() => setQuaternion(), [setQuaternion]);\n\n  return (\n    <a.mesh\n      position={pos as any}\n      ref={meshRef}\n      scale={[1, 1, 1]}\n      onPointerOver={() => onActive(true)}\n      onPointerOut={() => onActive(false)}\n      onPointerDown={event => {\n        // context menu controls\n        if (event.nativeEvent.buttons === 2) {\n          event.stopPropagation();\n          onContextMenu();\n        }\n      }}\n    >\n      <cylinderGeometry\n        args={[0, size, length, 20, 1, true]}\n        attach=\"geometry\"\n      />\n      <a.meshBasicMaterial\n        attach=\"material\"\n        color={normalizedColor}\n        depthTest={false}\n        opacity={arrowOpacity}\n        transparent={true}\n        side={DoubleSide}\n        fog={true}\n      />\n    </a.mesh>\n  );\n};\n","import React, { FC, useEffect, useMemo, useRef } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { animationConfig, getCurve } from '../utils';\nimport {\n  Vector3,\n  TubeGeometry,\n  ColorRepresentation,\n  Color,\n  Curve\n} from 'three';\nimport { useStore } from '../store';\nimport type { ThreeEvent } from '@react-three/fiber';\n\nexport interface LineProps {\n  /**\n   * Whether the line should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The color of the line.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * Whether the line should be curved.\n   */\n  curved: boolean;\n\n  /**\n   * The curve of the line in 3D space.\n   */\n  curve: Curve<Vector3>;\n\n  /**\n   * The unique identifier of the line.\n   */\n  id: string;\n\n  /**\n   * The opacity of the line.\n   */\n  opacity?: number;\n\n  /**\n   * The size of the line.\n   */\n  size?: number;\n\n  /**\n   * A function that is called when the line is clicked.\n   */\n  onClick?: (event: ThreeEvent<MouseEvent>) => void;\n\n  /**\n   * A function that is called when the line is right-clicked.\n   */\n  onContextMenu?: () => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved over the line.\n   */\n  onPointerOver?: (event: ThreeEvent<PointerEvent>) => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved out of the line.\n   */\n  onPointerOut?: (event: ThreeEvent<PointerEvent>) => void;\n\n  /**\n   * The offset of the curve.\n   */\n  curveOffset?: number;\n}\n\nexport const Line: FC<LineProps> = ({\n  curveOffset,\n  animated,\n  color = '#000',\n  curve,\n  curved = false,\n  id,\n  opacity = 1,\n  size = 1,\n  onContextMenu,\n  onClick,\n  onPointerOver,\n  onPointerOut\n}) => {\n  const tubeRef = useRef<TubeGeometry | null>(null);\n  const isDragging = useStore(state => state.draggingIds.length > 0);\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const center = useStore(state => state.centerPosition);\n  const mounted = useRef<boolean>(false);\n\n  // Do opacity seperate from vertices for perf\n  const { lineOpacity } = useSpring({\n    from: {\n      lineOpacity: 0\n    },\n    to: {\n      lineOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  useSpring(() => {\n    const from = curve.getPoint(0);\n    const to = curve.getPoint(1);\n    return {\n      from: {\n        // Animate from center first time, then from the actual from point\n        fromVertices: !mounted.current\n          ? [center?.x, center?.y, center?.z || 0]\n          : [to?.x, to?.y, to?.z || 0],\n        toVertices: [from?.x, from?.y, from?.z || 0]\n      },\n      to: {\n        fromVertices: [from?.x, from?.y, from?.z || 0],\n        toVertices: [to?.x, to?.y, to?.z || 0]\n      },\n      onChange: event => {\n        const { fromVertices, toVertices } = event.value;\n        const fromVector = new Vector3(...fromVertices);\n        const toVector = new Vector3(...toVertices);\n\n        const curve = getCurve(fromVector, 0, toVector, 0, curved, curveOffset);\n        tubeRef.current.copy(new TubeGeometry(curve, 20, size / 2, 5, false));\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !isDragging ? undefined : 0\n      }\n    };\n  }, [animated, isDragging, curve, size]);\n\n  useEffect(() => {\n    // Handle mount operation for initial render\n    mounted.current = true;\n  }, []);\n\n  return (\n    <mesh\n      userData={{ id, type: 'edge' }}\n      onPointerOver={onPointerOver}\n      onPointerOut={onPointerOut}\n      onClick={onClick}\n      onPointerDown={event => {\n        // context menu controls\n        if (event.nativeEvent.buttons === 2) {\n          event.stopPropagation();\n          onContextMenu();\n        }\n      }}\n    >\n      <tubeGeometry attach=\"geometry\" ref={tubeRef} />\n      <a.meshBasicMaterial\n        attach=\"material\"\n        opacity={lineOpacity}\n        fog={true}\n        transparent={true}\n        depthTest={false}\n        color={normalizedColor}\n      />\n    </mesh>\n  );\n};\n","import React, { FC, useMemo, useState } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Arrow, EdgeArrowPosition } from './Arrow';\nimport { Label } from './Label';\nimport {\n  animationConfig,\n  calculateEdgeCurveOffset,\n  getArrowSize,\n  getArrowVectors,\n  getCurve,\n  getLabelOffsetByType,\n  getMidPoint,\n  getVector\n} from '../utils';\nimport { Line } from './Line';\nimport { useStore } from '../store';\nimport type { ContextMenuEvent, InternalGraphEdge } from '../types';\nimport { Html, useCursor } from '@react-three/drei';\nimport { useHoverIntent } from '../utils/useHoverIntent';\nimport { Euler, Vector3 } from 'three';\nimport type { ThreeEvent } from '@react-three/fiber';\nimport { calculateSubLabelOffset } from '../utils/position';\n\n/**\n * Label positions relatively edge.\n *\n * - below: show label under the edge line\n * - above: show label above the edge line\n * - inline: show label along the edge line\n * - natural: normal text positions\n */\nexport type EdgeLabelPosition = 'below' | 'above' | 'inline' | 'natural';\n\n/**\n * SubLabel positions relatively to the main label.\n *\n * - below: show subLabel below the main label\n * - above: show subLabel above the main label\n */\nexport type EdgeSubLabelPosition = 'below' | 'above';\n\n/**\n * Type of edge interpolation.\n *\n * - Linear is straight\n * - Curved is curved\n */\nexport type EdgeInterpolation = 'linear' | 'curved';\n\nexport interface EdgeProps {\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The unique identifier of the edge.\n   */\n  id: string;\n\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The placement of the edge subLabel relative to the main label.\n   */\n  subLabelPlacement?: EdgeSubLabelPosition;\n\n  /**\n   * The placement of the edge arrow.\n   */\n  arrowPlacement?: EdgeArrowPosition;\n\n  /**\n   * The type of interpolation used to draw the edge.\n   */\n  interpolation: EdgeInterpolation;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * A function that is called when the edge is clicked.\n   */\n  onClick?: (edge: InternalGraphEdge, event: ThreeEvent<MouseEvent>) => void;\n\n  /**\n   * A function that is called when the edge is right-clicked.\n   */\n  onContextMenu?: (edge?: InternalGraphEdge) => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved over the edge.\n   */\n  onPointerOver?: (\n    edge: InternalGraphEdge,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved out of the edge.\n   */\n  onPointerOut?: (\n    edge: InternalGraphEdge,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n}\n\nconst LABEL_PLACEMENT_OFFSET = 3;\n\nexport const Edge: FC<EdgeProps> = ({\n  animated,\n  arrowPlacement = 'end',\n  contextMenu,\n  disabled,\n  labelPlacement = 'inline',\n  id,\n  interpolation,\n  labelFontUrl,\n  onContextMenu,\n  onClick,\n  onPointerOver,\n  onPointerOut,\n  subLabelPlacement = 'below'\n}) => {\n  const theme = useStore(state => state.theme);\n  const isDragging = useStore(state => state.draggingIds.length > 0);\n\n  // UI states\n  const [active, setActive] = useState<boolean>(false);\n  const [menuVisible, setMenuVisible] = useState<boolean>(false);\n\n  // Edge data\n  const edges = useStore(state => state.edges);\n  const edge = edges.find(e => e.id === id);\n  const {\n    target,\n    source,\n    label,\n    subLabel,\n    labelVisible = false,\n    size = 1,\n    fill\n  } = edge;\n\n  // Use subLabelPlacement from edge data if available, otherwise use the prop value\n  const effectiveSubLabelPlacement =\n    edge.subLabelPlacement || subLabelPlacement;\n\n  const from = useStore(store => store.nodes.find(node => node.id === source));\n  const to = useStore(store => store.nodes.find(node => node.id === target));\n\n  // Edge properties\n  const labelOffset = (size + theme.edge.label.fontSize) / 2;\n  const [arrowLength, arrowSize] = useMemo(() => getArrowSize(size), [size]);\n  const { curveOffset, curved } = useMemo(\n    () =>\n      calculateEdgeCurveOffset({\n        edge,\n        edges,\n        curved: interpolation === 'curved'\n      }),\n    [edge, edges, interpolation]\n  );\n\n  const [curve, arrowPosition, arrowRotation] = useMemo(() => {\n    const fromVector = getVector(from);\n    const fromOffset = from.size;\n    const toVector = getVector(to);\n    const toOffset = to.size;\n\n    let curve = getCurve(\n      fromVector,\n      fromOffset,\n      toVector,\n      toOffset,\n      curved,\n      curveOffset\n    );\n\n    const [arrowPosition, arrowRotation] = getArrowVectors(\n      arrowPlacement,\n      curve,\n      arrowLength\n    );\n\n    if (arrowPlacement === 'end') {\n      curve = getCurve(\n        fromVector,\n        fromOffset,\n        arrowPosition,\n        0,\n        curved,\n        curveOffset\n      );\n    }\n\n    return [curve, arrowPosition, arrowRotation];\n  }, [from, to, curved, curveOffset, arrowPlacement, arrowLength]);\n\n  const midPoint = useMemo(() => {\n    let newMidPoint = getMidPoint(\n      from.position,\n      to.position,\n      getLabelOffsetByType(labelOffset, labelPlacement)\n    );\n\n    if (curved) {\n      // Offset the label to the mid point of the curve\n      const offset = new Vector3().subVectors(newMidPoint, curve.getPoint(0.5));\n      switch (labelPlacement) {\n      case 'above':\n        offset.y = offset.y - LABEL_PLACEMENT_OFFSET;\n        break;\n      case 'below':\n        offset.y = offset.y + LABEL_PLACEMENT_OFFSET;\n        break;\n      }\n      newMidPoint = newMidPoint.sub(offset);\n    }\n\n    return newMidPoint;\n  }, [from.position, to.position, labelOffset, labelPlacement, curved, curve]);\n\n  const isSelected = useStore(state => state.selections?.includes(id));\n  const hasSelections = useStore(state => state.selections?.length);\n  const isActive = useStore(state => state.actives?.includes(id));\n  const center = useStore(state => state.centerPosition);\n\n  const selectionOpacity = hasSelections\n    ? isSelected || isActive\n      ? theme.edge.selectedOpacity\n      : theme.edge.inactiveOpacity\n    : theme.edge.opacity;\n\n  // Calculate subLabel position based on edge orientation and subLabelPlacement\n  const subLabelOffset = useMemo(() => {\n    return calculateSubLabelOffset(\n      from.position,\n      to.position,\n      effectiveSubLabelPlacement\n    );\n  }, [from.position, to.position, effectiveSubLabelPlacement]);\n\n  const [{ labelPosition }] = useSpring(\n    () => ({\n      from: {\n        labelPosition: center ? [center.x, center.y, center.z] : [0, 0, 0]\n      },\n      to: {\n        labelPosition: [midPoint.x, midPoint.y, midPoint.z]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !isDragging ? undefined : 0\n      }\n    }),\n    [midPoint, animated, isDragging]\n  );\n\n  const labelRotation = useMemo(\n    () =>\n      new Euler(\n        0,\n        0,\n        labelPlacement === 'natural'\n          ? 0\n          : Math.atan(\n            (to.position.y - from.position.y) /\n                (to.position.x - from.position.x)\n          )\n      ),\n    [\n      to.position.x,\n      to.position.y,\n      from.position.x,\n      from.position.y,\n      labelPlacement\n    ]\n  );\n\n  useCursor(active && !isDragging && onClick !== undefined, 'pointer');\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled,\n    onPointerOver: (event: ThreeEvent<PointerEvent>) => {\n      setActive(true);\n      onPointerOver?.(edge, event);\n    },\n    onPointerOut: (event: ThreeEvent<PointerEvent>) => {\n      setActive(false);\n      onPointerOut?.(edge, event);\n    }\n  });\n\n  const arrowComponent = useMemo(\n    () =>\n      arrowPlacement !== 'none' && (\n        <Arrow\n          animated={animated}\n          color={\n            isSelected || active || isActive\n              ? theme.arrow.activeFill\n              : fill || theme.arrow.fill\n          }\n          length={arrowLength}\n          opacity={selectionOpacity}\n          position={arrowPosition}\n          rotation={arrowRotation}\n          size={arrowSize}\n          onActive={setActive}\n          onContextMenu={() => {\n            if (!disabled) {\n              setMenuVisible(true);\n              onContextMenu?.(edge);\n            }\n          }}\n        />\n      ),\n    [\n      fill,\n      active,\n      animated,\n      arrowLength,\n      arrowPlacement,\n      arrowPosition,\n      arrowRotation,\n      arrowSize,\n      disabled,\n      edge,\n      isActive,\n      isSelected,\n      onContextMenu,\n      selectionOpacity,\n      theme.arrow.activeFill,\n      theme.arrow.fill\n    ]\n  );\n\n  const labelComponent = useMemo(\n    () =>\n      labelVisible &&\n      label && (\n        <a.group\n          position={labelPosition as any}\n          onContextMenu={() => {\n            if (!disabled) {\n              setMenuVisible(true);\n              onContextMenu?.(edge);\n            }\n          }}\n          onPointerOver={pointerOver}\n          onPointerOut={pointerOut}\n        >\n          <Label\n            text={label}\n            ellipsis={15}\n            fontUrl={labelFontUrl}\n            stroke={theme.edge.label.stroke}\n            color={\n              isSelected || active || isActive\n                ? theme.edge.label.activeColor\n                : theme.edge.label.color\n            }\n            opacity={selectionOpacity}\n            fontSize={theme.edge.label.fontSize}\n            rotation={labelRotation}\n          />\n\n          {subLabel && (\n            <group position={[subLabelOffset.x, subLabelOffset.y, 0]}>\n              <Label\n                text={subLabel}\n                ellipsis={15}\n                fontUrl={labelFontUrl}\n                stroke={theme.edge.subLabel?.stroke || theme.edge.label.stroke}\n                color={\n                  isSelected || active || isActive\n                    ? theme.edge.subLabel?.activeColor ||\n                      theme.edge.label.activeColor\n                    : theme.edge.subLabel?.color || theme.edge.label.color\n                }\n                opacity={selectionOpacity}\n                fontSize={\n                  theme.edge.subLabel?.fontSize ||\n                  theme.edge.label.fontSize * 0.8\n                }\n                rotation={labelRotation}\n              />\n            </group>\n          )}\n        </a.group>\n      ),\n    [\n      active,\n      disabled,\n      edge,\n      isActive,\n      isSelected,\n      label,\n      subLabel,\n      labelFontUrl,\n      labelPosition,\n      subLabelOffset,\n      labelRotation,\n      labelVisible,\n      onContextMenu,\n      pointerOut,\n      pointerOver,\n      selectionOpacity,\n      theme.edge.label.activeColor,\n      theme.edge.label.color,\n      theme.edge.label.fontSize,\n      theme.edge.label.stroke,\n      theme.edge.subLabel?.stroke,\n      theme.edge.subLabel?.activeColor,\n      theme.edge.subLabel?.color,\n      theme.edge.subLabel?.fontSize\n    ]\n  );\n\n  const menuComponent = useMemo(\n    () =>\n      menuVisible &&\n      contextMenu && (\n        <Html prepend={true} center={true} position={midPoint}>\n          {contextMenu({ data: edge, onClose: () => setMenuVisible(false) })}\n        </Html>\n      ),\n    [menuVisible, contextMenu, midPoint, edge]\n  );\n\n  return (\n    <group>\n      <Line\n        curveOffset={curveOffset}\n        animated={animated}\n        color={\n          isSelected || active || isActive\n            ? theme.edge.activeFill\n            : fill || theme.edge.fill\n        }\n        curve={curve}\n        curved={curved}\n        id={id}\n        opacity={selectionOpacity}\n        size={size}\n        onClick={event => {\n          if (!disabled) {\n            onClick?.(edge, event);\n          }\n        }}\n        onPointerOver={pointerOver}\n        onPointerOut={pointerOut}\n        onContextMenu={() => {\n          if (!disabled) {\n            setMenuVisible(true);\n            onContextMenu?.(edge);\n          }\n        }}\n      />\n      {arrowComponent}\n      {labelComponent}\n      {menuComponent}\n    </group>\n  );\n};\n","import { useCallback, useRef } from 'react';\nimport {\n  BoxGeometry,\n  BufferGeometry,\n  CylinderGeometry,\n  Quaternion,\n  TubeGeometry,\n  Vector3\n} from 'three';\nimport { mergeBufferGeometries } from 'three-stdlib';\n\nimport { GraphState, useStore } from '../../store';\nimport { InternalGraphEdge } from '../../types';\nimport {\n  getArrowSize,\n  getArrowVectors,\n  getVector,\n  getCurve\n} from '../../utils';\nimport { EdgeArrowPosition } from '../Arrow';\nimport { EdgeInterpolation } from '../Edge';\n\nexport type UseEdgeGeometry = {\n  getGeometries(edges: Array<InternalGraphEdge>): Array<BufferGeometry>;\n  getGeometry(\n    active: Array<InternalGraphEdge>,\n    inactive: Array<InternalGraphEdge>\n  ): BufferGeometry;\n};\n\nconst NULL_GEOMETRY = new BoxGeometry(0, 0, 0);\n\nexport function useEdgeGeometry(\n  arrowPlacement: EdgeArrowPosition,\n  interpolation: EdgeInterpolation\n): UseEdgeGeometry {\n  // We don't want to rerun everything when the state changes,\n  // but we do want to use the most recent nodes whenever `getGeometries`\n  // or `getGeometry` is run, so we store it in a ref:\n  const stateRef = useRef<GraphState | null>(null);\n  const theme = useStore(state => state.theme);\n  useStore(state => {\n    stateRef.current = state;\n  });\n\n  const geometryCacheRef = useRef(new Map<string, BufferGeometry>());\n\n  // Add memoized geometries for arrows and null geometry\n  const nullGeometryRef = useRef(new BoxGeometry(0, 0, 0));\n  const baseArrowGeometryRef = useRef<CylinderGeometry | null>(null);\n\n  const curved = interpolation === 'curved';\n  const getGeometries = useCallback(\n    (edges: Array<InternalGraphEdge>): Array<BufferGeometry> => {\n      const geometries: Array<BufferGeometry> = [];\n      const cache = geometryCacheRef.current;\n\n      // Pre-compute values outside the loop\n      const { nodes } = stateRef.current;\n      const nodesMap = new Map(nodes.map(node => [node.id, node]));\n      const labelFontSize = theme.edge.label.fontSize;\n\n      // Initialize base arrow geometry if needed\n      if (arrowPlacement !== 'none' && !baseArrowGeometryRef.current) {\n        baseArrowGeometryRef.current = new CylinderGeometry(\n          0,\n          1,\n          1,\n          20,\n          1,\n          true\n        );\n      }\n\n      edges.forEach(edge => {\n        const { target, source, size = 1 } = edge;\n        const from = nodesMap.get(source);\n        const to = nodesMap.get(target);\n\n        if (!from || !to) {\n          return;\n        }\n\n        // Improved hash function to include size\n        const hash = `${from.position.x},${from.position.y},${to.position.x},${to.position.y},${size}`;\n        if (cache.has(hash)) {\n          geometries.push(cache.get(hash));\n          return;\n        }\n\n        const fromVector = getVector(from);\n        const fromOffset = from.size + labelFontSize;\n        const toVector = getVector(to);\n        const toOffset = to.size + labelFontSize;\n        let curve = getCurve(\n          fromVector,\n          fromOffset,\n          toVector,\n          toOffset,\n          curved\n        );\n\n        let edgeGeometry = new TubeGeometry(curve, 20, size / 2, 5, false);\n\n        if (arrowPlacement === 'none') {\n          geometries.push(edgeGeometry);\n          cache.set(hash, edgeGeometry);\n          return;\n        }\n\n        // Reuse base arrow geometry and scale/rotate as needed\n        const [arrowLength, arrowSize] = getArrowSize(size);\n        const arrowGeometry = baseArrowGeometryRef.current.clone();\n        arrowGeometry.scale(arrowSize, arrowLength, arrowSize);\n        const [arrowPosition, arrowRotation] = getArrowVectors(\n          arrowPlacement,\n          curve,\n          arrowLength\n        );\n        const quaternion = new Quaternion();\n        quaternion.setFromUnitVectors(new Vector3(0, 1, 0), arrowRotation);\n        arrowGeometry.applyQuaternion(quaternion);\n        arrowGeometry.translate(\n          arrowPosition.x,\n          arrowPosition.y,\n          arrowPosition.z\n        );\n\n        // Move edge so it doesn't stick through the arrow:\n        if (arrowPlacement && arrowPlacement === 'end') {\n          const curve = getCurve(\n            fromVector,\n            fromOffset,\n            arrowPosition,\n            0,\n            curved\n          );\n          edgeGeometry = new TubeGeometry(curve, 20, size / 2, 5, false);\n        }\n\n        const merged = mergeBufferGeometries([edgeGeometry, arrowGeometry]);\n        geometries.push(merged);\n        cache.set(hash, merged);\n      });\n      return geometries;\n    },\n    [arrowPlacement, curved, theme.edge.label.fontSize]\n  );\n\n  const getGeometry = useCallback(\n    (\n      active: Array<InternalGraphEdge>,\n      inactive: Array<InternalGraphEdge>\n    ): BufferGeometry => {\n      const activeGeometries = getGeometries(active);\n      const inactiveGeometries = getGeometries(inactive);\n\n      return mergeBufferGeometries(\n        [\n          inactiveGeometries.length\n            ? mergeBufferGeometries(inactiveGeometries)\n            : NULL_GEOMETRY,\n          activeGeometries.length\n            ? mergeBufferGeometries(activeGeometries)\n            : NULL_GEOMETRY\n        ],\n        true\n      );\n    },\n    [getGeometries]\n  );\n\n  return {\n    getGeometries,\n    getGeometry\n  };\n}\n","import { useCallback, useRef, useEffect } from 'react';\n\nimport { useStore } from '../../store';\nimport { InternalGraphEdge } from '../../types';\n\nexport type EdgeEvents = {\n  onClick?: (edge: InternalGraphEdge) => void;\n  onContextMenu?: (edge?: InternalGraphEdge) => void;\n  onPointerOver?: (edge: InternalGraphEdge) => void;\n  onPointerOut?: (edge: InternalGraphEdge) => void;\n};\n\nexport function useEdgeEvents(\n  events: EdgeEvents,\n  contextMenu,\n  disabled: boolean\n) {\n  const memoizedEvents = useRef(events);\n  useEffect(() => {\n    memoizedEvents.current = events;\n  }, [events]);\n\n  const edgeContextMenus = useStore(state => state.edgeContextMenus);\n  const setEdgeContextMenus = useStore(\n    useCallback(state => state.setEdgeContextMenus, [])\n  );\n\n  const clickRef = useRef(false);\n  const handleClick = useCallback(() => {\n    clickRef.current = true;\n  }, []);\n\n  const contextMenuEventRef = useRef(false);\n  const handleContextMenu = useCallback(() => {\n    contextMenuEventRef.current = true;\n  }, []);\n\n  const handleIntersections = useCallback(\n    (\n      previous: Array<InternalGraphEdge>,\n      intersected: Array<InternalGraphEdge>\n    ) => {\n      const { onClick, onContextMenu, onPointerOver, onPointerOut } =\n        memoizedEvents.current;\n\n      if (onClick && clickRef.current && !disabled) {\n        clickRef.current = false;\n        for (const edge of intersected) {\n          onClick(edge);\n        }\n      }\n\n      if (\n        (contextMenu || onContextMenu) &&\n        contextMenuEventRef.current &&\n        !disabled\n      ) {\n        contextMenuEventRef.current = false;\n        const newEdges = new Set(edgeContextMenus);\n        let hasChanges = false;\n\n        for (const edge of intersected) {\n          if (!edgeContextMenus.has(edge.id)) {\n            newEdges.add(edge.id);\n            hasChanges = true;\n            onContextMenu?.(edge);\n          }\n        }\n\n        if (hasChanges) {\n          setEdgeContextMenus(newEdges);\n        }\n      }\n\n      if (onPointerOver) {\n        const over = intersected.filter(index => !previous.includes(index));\n        over.forEach(edge => {\n          onPointerOver(edge);\n        });\n      }\n\n      if (onPointerOut) {\n        const out = previous.filter(index => !intersected.includes(index));\n        out.forEach(edge => {\n          onPointerOut(edge);\n        });\n      }\n    },\n    [contextMenu, disabled, edgeContextMenus, setEdgeContextMenus]\n  );\n\n  return {\n    handleClick,\n    handleContextMenu,\n    handleIntersections\n  };\n}\n","import { SpringValue, useSpring } from '@react-spring/three';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { BufferAttribute, BufferGeometry } from 'three';\n\nimport { Theme } from '../../themes';\nimport { animationConfig } from '../../utils';\n\nexport function useEdgePositionAnimation(\n  geometry: BufferGeometry,\n  animated: boolean\n): void {\n  const geometryRef = useRef<BufferGeometry>(geometry);\n  const bufferPool = useRef<Float32Array | null>(null);\n\n  useEffect(() => {\n    geometryRef.current = geometry;\n    const positions = geometry.getAttribute('position');\n    bufferPool.current = new Float32Array(positions.array.length);\n  }, [geometry]);\n\n  const getAnimationPositions = useCallback(() => {\n    const positions = geometryRef.current.getAttribute('position');\n    const from = new Float32Array(positions.array.length);\n    return {\n      from,\n      to: positions.array\n    };\n  }, []);\n\n  const updateGeometryPosition = useCallback((positions: Array<number>) => {\n    const buffer = bufferPool.current!;\n    buffer.set(positions);\n    const newPosition = new BufferAttribute(buffer, 3, false);\n    geometryRef.current.setAttribute('position', newPosition);\n    newPosition.needsUpdate = true;\n  }, []);\n\n  useSpring(() => {\n    if (!animated) {\n      return null;\n    }\n\n    const animationPositions = getAnimationPositions();\n\n    return {\n      from: {\n        positions: animationPositions.from\n      },\n      to: {\n        positions: animationPositions.to\n      },\n      onChange: event => {\n        updateGeometryPosition(event.value.positions);\n      },\n      config: {\n        ...animationConfig,\n        duration: animated ? undefined : 0\n      }\n    };\n  }, [animated, getAnimationPositions, updateGeometryPosition]);\n}\n\nexport type UseEdgeOpacityAnimations = {\n  activeOpacity: SpringValue<number>;\n  inactiveOpacity: SpringValue<number>;\n};\n\nexport function useEdgeOpacityAnimation(\n  animated: boolean,\n  hasSelections: boolean,\n  theme: Theme\n): UseEdgeOpacityAnimations {\n  const [{ activeOpacity, inactiveOpacity }] = useSpring(() => {\n    return {\n      from: {\n        activeOpacity: 0,\n        inactiveOpacity: 0\n      },\n      to: {\n        activeOpacity: hasSelections\n          ? theme.edge.selectedOpacity\n          : theme.edge.opacity,\n        inactiveOpacity: hasSelections\n          ? theme.edge.inactiveOpacity\n          : theme.edge.opacity\n      },\n      config: {\n        ...animationConfig,\n        duration: animated ? undefined : 0\n      }\n    };\n  }, [animated, hasSelections, theme]);\n\n  return { activeOpacity, inactiveOpacity };\n}\n","import React, { FC, useCallback, useMemo } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Html } from '@react-three/drei';\nimport { ColorRepresentation, Euler } from 'three';\n\nimport { useStore } from '../../store';\nimport { ContextMenuEvent, InternalGraphEdge } from '../../types';\nimport {\n  animationConfig,\n  getLabelOffsetByType,\n  getMidPoint\n} from '../../utils';\nimport { Label } from '../Label';\n\n/**\n * Label positions relatively edge\n *\n * below: show label under the edge line\n * above: show label above the edge line\n * inline: show label along the edge line\n * natural: normal text positions\n */\nexport type EdgeLabelPosition = 'below' | 'above' | 'inline' | 'natural';\n\nexport type EdgeArrowPosition = 'none' | 'mid' | 'end';\n\nexport interface EdgeProps {\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The color of the edge.\n   */\n  color: ColorRepresentation;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * The edge object.\n   */\n  edge: InternalGraphEdge;\n\n  /**\n   * The URL of the font for the edge label.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The opacity of the edge.\n   */\n  opacity?: number;\n}\n\nexport const Edge: FC<EdgeProps> = ({\n  animated,\n  color,\n  contextMenu,\n  edge,\n  labelFontUrl,\n  labelPlacement = 'inline',\n  opacity\n}) => {\n  const theme = useStore(state => state.theme);\n  const { target, source, label, labelVisible = false, size = 1 } = edge;\n\n  const nodes = useStore(store => store.nodes);\n  const [from, to] = useMemo(\n    () => [\n      nodes.find(node => node.id === source),\n      nodes.find(node => node.id === target)\n    ],\n    [nodes, source, target]\n  );\n  const isDragging = useStore(state => state.draggingIds.length > 0);\n\n  const labelOffset = useMemo(\n    () => (size + theme.edge.label.fontSize) / 2,\n    [size, theme.edge.label.fontSize]\n  );\n\n  const midPoint = useMemo(\n    () =>\n      getMidPoint(\n        from.position,\n        to.position,\n        getLabelOffsetByType(labelOffset, labelPlacement)\n      ),\n    [from.position, to.position, labelOffset, labelPlacement]\n  );\n\n  const edgeContextMenus = useStore(state => state.edgeContextMenus);\n  const setEdgeContextMenus = useStore(state => state.setEdgeContextMenus);\n\n  const [{ labelPosition }] = useSpring(\n    () => ({\n      from: {\n        labelPosition: [0, 0, 0]\n      },\n      to: {\n        labelPosition: [midPoint.x, midPoint.y, midPoint.z]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !isDragging ? undefined : 0\n      }\n    }),\n    [midPoint, animated, isDragging]\n  );\n\n  const removeContextMenu = useCallback(\n    (edgeId: string) => {\n      edgeContextMenus.delete(edgeId);\n      setEdgeContextMenus(new Set(edgeContextMenus));\n    },\n    [edgeContextMenus, setEdgeContextMenus]\n  );\n\n  const labelRotation = useMemo(() => {\n    if (labelPlacement === 'natural') {\n      return new Euler(0, 0, 0);\n    }\n    return new Euler(\n      0,\n      0,\n      Math.atan2(\n        to.position.y - from.position.y,\n        to.position.x - from.position.x\n      )\n    );\n  }, [\n    labelPlacement,\n    to.position.y,\n    to.position.x,\n    from.position.y,\n    from.position.x\n  ]);\n\n  const htmlProps = useMemo(\n    () => ({\n      prepend: true,\n      center: true,\n      position: midPoint\n    }),\n    [midPoint]\n  );\n\n  const labelProps = useMemo(\n    () => ({\n      text: label,\n      ellipsis: 15,\n      fontUrl: labelFontUrl,\n      stroke: theme.edge.label.stroke,\n      color,\n      opacity,\n      fontSize: theme.edge.label.fontSize,\n      rotation: labelRotation\n    }),\n    [\n      label,\n      labelFontUrl,\n      theme.edge.label.stroke,\n      color,\n      opacity,\n      theme.edge.label.fontSize,\n      labelRotation\n    ]\n  );\n\n  return (\n    <group>\n      {labelVisible && label && (\n        <a.group position={labelPosition as any}>\n          <Label {...labelProps} />\n        </a.group>\n      )}\n      {contextMenu && edgeContextMenus.has(edge.id) && (\n        <Html {...htmlProps}>\n          {contextMenu({\n            data: edge,\n            onClose: () => removeContextMenu(edge.id)\n          })}\n        </Html>\n      )}\n    </group>\n  );\n};\n","import React, { FC, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { a } from '@react-spring/three';\nimport { useFrame } from '@react-three/fiber';\nimport { DoubleSide, Mesh, Raycaster, TubeGeometry } from 'three';\n\nimport { useStore } from '../../store';\nimport { ContextMenuEvent, InternalGraphEdge } from '../../types';\nimport { EdgeArrowPosition } from '../Arrow';\nimport { EdgeLabelPosition, EdgeInterpolation } from '../Edge';\nimport { useEdgeGeometry } from './useEdgeGeometry';\nimport { EdgeEvents, useEdgeEvents } from './useEdgeEvents';\nimport {\n  useEdgePositionAnimation,\n  useEdgeOpacityAnimation\n} from './useEdgeAnimations';\nimport { Edge } from './Edge';\n\nexport type EdgesProps = {\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The placement of the edge arrow.\n   */\n  arrowPlacement?: EdgeArrowPosition;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The array of edge objects.\n   */\n  edges: Array<InternalGraphEdge>;\n\n  /**\n   * The URL of the font for the edge label.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The type of interpolation used to draw the edge.\n   */\n  interpolation?: EdgeInterpolation;\n} & EdgeEvents;\n\n/**\n * Three.js rendering starts to get slower if you have an individual mesh for each edge\n * and a high number of edges.\n *\n * Instead, we take the edges and split them into their different render states:\n *\n *  * - Active (any edges that are marked as \"selected\" or \"active\" in the state)\n *  * - Dragging (any edges that are connected to a node that is being dragged)\n *  * - Intersecting (any edges that are currently intersected by the ray from the mouse position)\n *  * - Inactive (any edges that aren't active, dragging, or intersected)\n *\n * We generate the geometry for each edge in each of these groups, and then merge them\n * into a single geometry for each group. This merged mesh is rendered as one object\n * which gives much better performance. This means that we only need to update geometry\n * and positions when edges move between the different states, rather than updating all\n * edges whenever any other edge changes.\n *\n * To get this all working, we have to do a few things outside the @react-three/fiber world,\n * specifically:\n *\n *  * manually create edge/arrow geometries (see `useEdgeGeometry`)\n *  * manually track mouse/edge interactions and fire events (see `useEdgeEvents`)\n *  * manually update edge/arrow positions during aniamations (see `useEdgeAnimations`)\n */\nexport const Edges: FC<EdgesProps> = ({\n  interpolation = 'linear',\n  arrowPlacement = 'end',\n  labelPlacement = 'inline',\n  animated,\n  contextMenu,\n  disabled,\n  edges,\n  labelFontUrl,\n  onClick,\n  onContextMenu,\n  onPointerOut,\n  onPointerOver\n}) => {\n  const theme = useStore(state => state.theme);\n  const { getGeometries, getGeometry } = useEdgeGeometry(\n    arrowPlacement,\n    interpolation\n  );\n\n  const draggingIds = useStore(state => state.draggingIds);\n  const edgeMeshes = useStore(state => state.edgeMeshes);\n  const setEdgeMeshes = useStore(state => state.setEdgeMeshes);\n  const actives = useStore(state => state.actives || []);\n  const selections = useStore(state => state.selections || []);\n\n  const [active, inactive, draggingActive, draggingInactive] = useMemo(() => {\n    const active: Array<InternalGraphEdge> = [];\n    const inactive: Array<InternalGraphEdge> = [];\n    const draggingActive: Array<InternalGraphEdge> = [];\n    const draggingInactive: Array<InternalGraphEdge> = [];\n    edges.forEach(edge => {\n      if (\n        draggingIds.includes(edge.source) ||\n        draggingIds.includes(edge.target)\n      ) {\n        if (selections.includes(edge.id) || actives.includes(edge.id)) {\n          draggingActive.push(edge);\n        } else {\n          draggingInactive.push(edge);\n        }\n        return;\n      }\n\n      if (selections.includes(edge.id) || actives.includes(edge.id)) {\n        active.push(edge);\n      } else {\n        inactive.push(edge);\n      }\n    });\n    return [active, inactive, draggingActive, draggingInactive];\n  }, [edges, actives, selections, draggingIds]);\n\n  const hasSelections = !!selections.length;\n\n  const staticEdgesGeometry = useMemo(\n    () => getGeometry(active, inactive),\n    [getGeometry, active, inactive]\n  );\n\n  const { activeOpacity, inactiveOpacity } = useEdgeOpacityAnimation(\n    animated,\n    hasSelections,\n    theme\n  );\n\n  useEdgePositionAnimation(staticEdgesGeometry, animated);\n\n  useEffect(() => {\n    if (draggingIds.length === 0) {\n      const edgeGeometries = getGeometries(edges);\n      const edgeMeshes = edgeGeometries.map(edge => new Mesh(edge));\n      setEdgeMeshes(edgeMeshes);\n    }\n  }, [getGeometries, setEdgeMeshes, edges, draggingIds.length]);\n\n  const staticEdgesRef = useRef(new Mesh());\n  const dynamicEdgesRef = useRef(new Mesh());\n\n  const intersect = useCallback(\n    (raycaster: Raycaster): Array<InternalGraphEdge> => {\n      // Handle initial raycaster state:\n      if (!raycaster.camera) {\n        return [];\n      }\n      const intersections =\n        raycaster.intersectObjects<Mesh<TubeGeometry>>(edgeMeshes);\n      if (!intersections.length) {\n        return [];\n      }\n      return intersections.map(\n        intersection => edges[edgeMeshes.indexOf(intersection.object)]\n      );\n    },\n    [edgeMeshes, edges]\n  );\n\n  const { handleClick, handleContextMenu, handleIntersections } = useEdgeEvents(\n    {\n      onClick,\n      onContextMenu,\n      onPointerOut,\n      onPointerOver\n    },\n    contextMenu,\n    disabled\n  );\n\n  const draggingIdRef = useRef<string[]>([]);\n  const intersectingRef = useRef<Array<InternalGraphEdge>>([]);\n\n  useFrame(state => {\n    staticEdgesRef.current.geometry = staticEdgesGeometry;\n\n    if (disabled) {\n      return;\n    }\n\n    const previousDraggingId = draggingIdRef.current;\n    if (\n      draggingIds.length ||\n      (draggingIds.length === 0 && previousDraggingId !== null)\n    ) {\n      dynamicEdgesRef.current.geometry = getGeometry(\n        draggingActive,\n        draggingInactive\n      );\n    }\n\n    draggingIdRef.current = draggingIds;\n    if (draggingIds.length) {\n      return;\n    }\n\n    const previousIntersecting = intersectingRef.current;\n    const intersecting = intersect(state.raycaster);\n    handleIntersections(previousIntersecting, intersecting);\n\n    if (intersecting.join() !== previousIntersecting.join()) {\n      dynamicEdgesRef.current.geometry = getGeometry(intersecting, []);\n    }\n\n    intersectingRef.current = intersecting;\n  });\n\n  return (\n    <group onClick={handleClick} onContextMenu={handleContextMenu}>\n      {/* Static edges */}\n      <mesh ref={staticEdgesRef}>\n        <a.meshBasicMaterial\n          attach=\"material-0\"\n          color={theme.edge.fill}\n          depthTest={false}\n          fog={true}\n          opacity={inactiveOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n        <a.meshBasicMaterial\n          attach=\"material-1\"\n          color={theme.edge.activeFill}\n          depthTest={false}\n          fog={true}\n          opacity={activeOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n      </mesh>\n      {/* Dynamic edges */}\n      <mesh ref={dynamicEdgesRef}>\n        <a.meshBasicMaterial\n          attach=\"material-0\"\n          color={theme.edge.fill}\n          depthTest={false}\n          fog={true}\n          opacity={inactiveOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n        <a.meshBasicMaterial\n          attach=\"material-1\"\n          color={theme.edge.activeFill}\n          depthTest={false}\n          fog={true}\n          opacity={activeOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n      </mesh>\n      {edges.map(edge => (\n        <Edge\n          animated={animated}\n          contextMenu={contextMenu}\n          color={theme.edge.label.color}\n          disabled={disabled}\n          edge={edge}\n          key={edge.id}\n          labelFontUrl={labelFontUrl}\n          labelPlacement={labelPlacement}\n        />\n      ))}\n    </group>\n  );\n};\n","import React, { FC, useMemo } from 'react';\nimport { Color, ColorRepresentation, DoubleSide } from 'three';\nimport { animationConfig } from '../utils/animation';\nimport { useSpring, a } from '@react-spring/three';\nimport { Billboard } from '@react-three/drei';\n\nexport interface RingProps {\n  /**\n   * The color of the ring.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * Whether the ring should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The size of the ring.\n   */\n  size?: number;\n\n  /**\n   * The opacity of the ring.\n   */\n  opacity?: number;\n\n  /**\n   * The stroke width of the ring.\n   */\n  strokeWidth?: number;\n\n  /**\n   * The inner radius of the ring.\n   * Default value: 4\n   */\n  innerRadius?: number;\n\n  /**\n   * The number of segments in the ring geometry.\n   * Default value: 25\n   */\n  segments?: number;\n}\n\nexport const Ring: FC<RingProps> = ({\n  color = '#D8E6EA',\n  size = 1,\n  opacity = 0.5,\n  animated,\n  strokeWidth = 5,\n  innerRadius = 4,\n  segments = 25\n}) => {\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  const { ringSize, ringOpacity } = useSpring({\n    from: {\n      ringOpacity: 0,\n      ringSize: [0.00001, 0.00001, 0.00001]\n    },\n    to: {\n      ringOpacity: opacity,\n      ringSize: [size / 2, size / 2, 1]\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  const strokeWidthFraction = strokeWidth / 10;\n  const outerRadius = innerRadius + strokeWidthFraction;\n\n  return (\n    <Billboard position={[0, 0, 1]}>\n      <a.mesh scale={ringSize as any}>\n        <ringGeometry\n          attach=\"geometry\"\n          args={[innerRadius, outerRadius, segments]}\n        />\n        <a.meshBasicMaterial\n          attach=\"material\"\n          color={normalizedColor}\n          transparent={true}\n          depthTest={false}\n          opacity={ringOpacity}\n          side={DoubleSide}\n          fog={true}\n        />\n      </a.mesh>\n    </Billboard>\n  );\n};\n","import React, { FC, useMemo } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { animationConfig } from '../../utils/animation';\nimport { Color, DoubleSide } from 'three';\nimport { NodeRendererProps } from '../../types';\nimport { Ring } from '../Ring';\nimport { useStore } from '../../store';\n\nexport const Sphere: FC<NodeRendererProps> = ({\n  color,\n  id,\n  size,\n  selected,\n  opacity = 1,\n  animated\n}) => {\n  const { scale, nodeOpacity } = useSpring({\n    from: {\n      // Note: This prevents incorrect scaling w/ 0\n      scale: [0.00001, 0.00001, 0.00001],\n      nodeOpacity: 0\n    },\n    to: {\n      scale: [size, size, size],\n      nodeOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const theme = useStore(state => state.theme);\n\n  return (\n    <>\n      <a.mesh userData={{ id, type: 'node' }} scale={scale as any}>\n        <sphereGeometry attach=\"geometry\" args={[1, 25, 25]} />\n        <a.meshPhongMaterial\n          attach=\"material\"\n          side={DoubleSide}\n          transparent={true}\n          fog={true}\n          opacity={nodeOpacity}\n          color={normalizedColor}\n          emissive={normalizedColor}\n          emissiveIntensity={0.7}\n        />\n      </a.mesh>\n      <Ring\n        opacity={selected ? 0.5 : 0}\n        size={size}\n        animated={animated}\n        color={selected ? theme.ring.activeFill : theme.ring.fill}\n      />\n    </>\n  );\n};\n","import React, { FC, useMemo } from 'react';\nimport { a, useSpring } from '@react-spring/three';\nimport { TextureLoader, LinearFilter, DoubleSide } from 'three';\nimport { animationConfig } from '../../utils';\nimport { NodeRendererProps } from '../../types';\n\nexport interface IconProps extends NodeRendererProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n}\n\nexport const Icon: FC<IconProps> = ({\n  image,\n  id,\n  size,\n  opacity = 1,\n  animated\n}) => {\n  const texture = useMemo(() => new TextureLoader().load(image), [image]);\n\n  const { scale, spriteOpacity } = useSpring({\n    from: {\n      scale: [0.00001, 0.00001, 0.00001],\n      spriteOpacity: 0\n    },\n    to: {\n      scale: [size, size, size],\n      spriteOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  return (\n    <a.sprite userData={{ id, type: 'node' }} scale={scale as any}>\n      <a.spriteMaterial\n        attach=\"material\"\n        opacity={spriteOpacity}\n        fog={true}\n        depthTest={false}\n        transparent={true}\n        side={DoubleSide}\n      >\n        <primitive attach=\"map\" object={texture} minFilter={LinearFilter} />\n      </a.spriteMaterial>\n    </a.sprite>\n  );\n};\n","import React, { FC } from 'react';\nimport { NodeRendererProps } from '../../types';\nimport { Sphere } from './Sphere';\nimport { Icon } from './Icon';\n\nexport interface SphereWithIconProps extends NodeRendererProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n}\n\nexport const SphereWithIcon: FC<SphereWithIconProps> = ({\n  color,\n  id,\n  size,\n  opacity = 1,\n  node,\n  active = false,\n  animated,\n  image,\n  selected\n}) => (\n  <>\n    <Sphere\n      id={id}\n      selected={selected}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n    <Icon\n      id={id}\n      image={image}\n      selected={selected}\n      size={size + 8}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n  </>\n);\n","import React, { FC, useMemo } from 'react';\nimport { a, useSpring } from '@react-spring/three';\nimport { animationConfig } from '../../utils';\nimport { NodeRendererProps } from '../../types';\nimport {\n  Billboard,\n  Svg as DreiSvg,\n  SvgProps as DreiSvgProps\n} from '@react-three/drei';\nimport { Color, DoubleSide } from 'three';\n\nexport type SvgProps = NodeRendererProps &\n  Omit<DreiSvgProps, 'src' | 'id'> & {\n    /**\n     * The image to display on the icon.\n     */\n    image: string;\n  };\n\nexport const Svg: FC<SvgProps> = ({\n  id,\n  image,\n  color,\n  size,\n  opacity = 1,\n  animated,\n  ...rest\n}) => {\n  const normalizedSize = size / 25;\n\n  const { scale } = useSpring({\n    from: {\n      scale: [0.00001, 0.00001, 0.00001]\n    },\n    to: {\n      scale: [normalizedSize, normalizedSize, normalizedSize]\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  return (\n    <a.group userData={{ id, type: 'node' }} scale={scale as any}>\n      <Billboard position={[0, 0, 1]}>\n        <DreiSvg\n          {...rest}\n          src={image}\n          fillMaterial={{\n            fog: true,\n            depthTest: false,\n            transparent: true,\n            color: normalizedColor,\n            opacity,\n            side: DoubleSide,\n            ...(rest.fillMaterial || {})\n          }}\n          fillMeshProps={{\n            // Note: This is a hack to get the svg to\n            // render in the correct position.\n            position: [-25, -25, 1],\n            ...(rest.fillMeshProps || {})\n          }}\n        />\n      </Billboard>\n    </a.group>\n  );\n};\n","import React, { FC } from 'react';\nimport { Sphere } from './Sphere';\nimport { Svg, SvgProps } from './Svg';\nimport { ColorRepresentation } from 'three';\n\nexport interface SphereWithSvgProps extends SvgProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n\n  /**\n   * The color of the svg fill.\n   */\n  svgFill?: ColorRepresentation;\n}\n\nexport const SphereWithSvg: FC<SphereWithSvgProps> = ({\n  color,\n  id,\n  size,\n  opacity = 1,\n  node,\n  svgFill,\n  active = false,\n  animated,\n  image,\n  selected,\n  ...rest\n}) => (\n  <>\n    <Sphere\n      id={id}\n      selected={selected}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n    <Svg\n      {...rest}\n      id={id}\n      selected={selected}\n      image={image}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={svgFill}\n      node={node}\n      active={active}\n    />\n  </>\n);\n","import React, {\n  FC,\n  ReactNode,\n  useCallback,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport { Group } from 'three';\nimport { animationConfig } from '../utils';\nimport { useSpring, a } from '@react-spring/three';\nimport { Sphere } from './nodes/Sphere';\nimport { Label } from './Label';\nimport {\n  NodeContextMenuProps,\n  ContextMenuEvent,\n  InternalGraphNode,\n  NodeRenderer,\n  CollapseProps\n} from '../types';\nimport { Html, useCursor } from '@react-three/drei';\nimport { useCameraControls } from '../CameraControls/useCameraControls';\nimport { useStore } from '../store';\nimport { useDrag } from '../utils/useDrag';\nimport { useHoverIntent } from '../utils/useHoverIntent';\nimport { Icon } from './nodes';\nimport type { ThreeEvent } from '@react-three/fiber';\n\nexport interface NodeProps {\n  /**\n   * The unique identifier for the node.\n   */\n  id: string;\n\n  /**\n   * The parent nodes of the node.\n   */\n  parents?: string[];\n\n  /**\n   * Whether the node is disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * Whether the node is animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the node is draggable.\n   */\n  draggable?: boolean;\n\n  /**\n   * Constrain dragging to the cluster bounds.\n   */\n  constrainDragging?: boolean;\n\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The function to use to render the node.\n   */\n  renderNode?: NodeRenderer;\n\n  /**\n   * The context menu for the node.\n   */\n  contextMenu?: (event: ContextMenuEvent) => ReactNode;\n\n  /**\n   * The function to call when the pointer is over the node.\n   */\n  onPointerOver?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * The function to call when the pointer is out of the node.\n   */\n  onPointerOut?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * The function to call when the node is clicked.\n   */\n  onClick?: (\n    node: InternalGraphNode,\n    props?: CollapseProps,\n    event?: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * The function to call when the node is double clicked.\n   */\n  onDoubleClick?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * The function to call when the node is right clicked.\n   */\n  onContextMenu?: (\n    node?: InternalGraphNode,\n    props?: NodeContextMenuProps\n  ) => void;\n\n  /**\n   * Triggered after a node was dragged.\n   */\n  onDragged?: (node: InternalGraphNode) => void;\n}\n\nexport const Node: FC<NodeProps> = ({\n  animated,\n  disabled,\n  id,\n  draggable = false,\n  labelFontUrl,\n  contextMenu,\n  onClick,\n  onDoubleClick,\n  onPointerOver,\n  onDragged,\n  onPointerOut,\n  onContextMenu,\n  renderNode,\n  constrainDragging\n}) => {\n  const cameraControls = useCameraControls();\n  const theme = useStore(state => state.theme);\n  const node = useStore(state => state.nodes.find(n => n.id === id));\n  const edges = useStore(state => state.edges);\n  const draggingIds = useStore(state => state.draggingIds);\n  const collapsedNodeIds = useStore(state => state.collapsedNodeIds);\n  const addDraggingId = useStore(state => state.addDraggingId);\n  const removeDraggingId = useStore(state => state.removeDraggingId);\n  const setHoveredNodeId = useStore(state => state.setHoveredNodeId);\n  const setNodePosition = useStore(state => state.setNodePosition);\n  const setCollapsedNodeIds = useStore(state => state.setCollapsedNodeIds);\n  const isCollapsed = useStore(state => state.collapsedNodeIds.includes(id));\n  const isActive = useStore(state => state.actives?.includes(id));\n  const isSelected = useStore(state => state.selections?.includes(id));\n  const hasSelections = useStore(state => state.selections?.length > 0);\n  const center = useStore(state => state.centerPosition);\n  const cluster = useStore(state => state.clusters.get(node.cluster));\n\n  const isDraggingCurrent = draggingIds.includes(id);\n  const isDragging = draggingIds.length > 0;\n\n  const {\n    position,\n    label,\n    subLabel,\n    size: nodeSize = 7,\n    labelVisible = true\n  } = node;\n\n  const group = useRef<Group | null>(null);\n  const [active, setActive] = useState<boolean>(false);\n  const [menuVisible, setMenuVisible] = useState<boolean>(false);\n\n  const shouldHighlight = active || isSelected || isActive;\n\n  const selectionOpacity = hasSelections\n    ? shouldHighlight\n      ? theme.node.selectedOpacity\n      : theme.node.inactiveOpacity\n    : theme.node.opacity;\n\n  const canCollapse = useMemo(() => {\n    // If the node has outgoing edges, it can collapse via context menu\n    const outboundLinks = edges.filter(l => l.source === id);\n\n    return outboundLinks.length > 0 || isCollapsed;\n  }, [edges, id, isCollapsed]);\n\n  const onCollapse = useCallback(() => {\n    if (canCollapse) {\n      if (isCollapsed) {\n        setCollapsedNodeIds(collapsedNodeIds.filter(p => p !== id));\n      } else {\n        setCollapsedNodeIds([...collapsedNodeIds, id]);\n      }\n    }\n  }, [canCollapse, collapsedNodeIds, id, isCollapsed, setCollapsedNodeIds]);\n\n  const [{ nodePosition, labelPosition }] = useSpring(\n    () => ({\n      from: {\n        nodePosition: center ? [center.x, center.y, 0] : [0, 0, 0],\n        labelPosition: [0, -(nodeSize + 7), 2]\n      },\n      to: {\n        nodePosition: position\n          ? [\n            position.x,\n            position.y,\n            shouldHighlight ? position.z + 1 : position.z\n          ]\n          : [0, 0, 0],\n        labelPosition: [0, -(nodeSize + 7), 2]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !isDragging ? undefined : 0\n      }\n    }),\n    [isDraggingCurrent, position, animated, nodeSize, shouldHighlight]\n  );\n\n  const bind = useDrag({\n    draggable,\n    position,\n    // If dragging is constrained to the cluster, use the cluster's position as the bounds\n    bounds: constrainDragging ? cluster?.position : undefined,\n    // @ts-ignore\n    set: pos => setNodePosition(id, pos),\n    onDragStart: () => {\n      addDraggingId(id);\n      setActive(true);\n    },\n    onDragEnd: () => {\n      removeDraggingId(id);\n      onDragged?.(node);\n    }\n  });\n\n  useCursor(active && !isDragging && onClick !== undefined, 'pointer');\n  useCursor(\n    active && draggable && !isDraggingCurrent && onClick === undefined,\n    'grab'\n  );\n  useCursor(isDraggingCurrent, 'grabbing');\n\n  const combinedActiveState = shouldHighlight || isDraggingCurrent;\n  const color = combinedActiveState\n    ? theme.node.activeFill\n    : node.fill || theme.node.fill;\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled: disabled || isDraggingCurrent,\n    onPointerOver: (event: ThreeEvent<PointerEvent>) => {\n      cameraControls.freeze();\n      setActive(true);\n      onPointerOver?.(node, event);\n      setHoveredNodeId(id);\n    },\n    onPointerOut: (event: ThreeEvent<PointerEvent>) => {\n      cameraControls.unFreeze();\n      setActive(false);\n      onPointerOut?.(node, event);\n      setHoveredNodeId(null);\n    }\n  });\n\n  const nodeComponent = useMemo(\n    () =>\n      renderNode ? (\n        renderNode({\n          id,\n          color,\n          size: nodeSize,\n          active: combinedActiveState,\n          opacity: selectionOpacity,\n          animated,\n          selected: isSelected,\n          node\n        })\n      ) : (\n        <>\n          {node.icon ? (\n            <Icon\n              id={id}\n              image={node.icon || ''}\n              size={nodeSize + 8}\n              opacity={selectionOpacity}\n              animated={animated}\n              color={color}\n              node={node}\n              active={combinedActiveState}\n              selected={isSelected}\n            />\n          ) : (\n            <Sphere\n              id={id}\n              size={nodeSize}\n              opacity={selectionOpacity}\n              animated={animated}\n              color={color}\n              node={node}\n              active={combinedActiveState}\n              selected={isSelected}\n            />\n          )}\n        </>\n      ),\n    [\n      renderNode,\n      id,\n      color,\n      nodeSize,\n      combinedActiveState,\n      selectionOpacity,\n      animated,\n      isSelected,\n      node\n    ]\n  );\n\n  const labelComponent = useMemo(\n    () =>\n      labelVisible &&\n      (labelVisible || isSelected || active) &&\n      label && (\n        <a.group position={labelPosition as any}>\n          <Label\n            text={label}\n            fontUrl={labelFontUrl}\n            opacity={selectionOpacity}\n            stroke={theme.node.label.stroke}\n            active={isSelected || active || isDraggingCurrent || isActive}\n            color={\n              isSelected || active || isDraggingCurrent || isActive\n                ? theme.node.label.activeColor\n                : theme.node.label.color\n            }\n          />\n          {subLabel && (\n            <group position={[0, -(nodeSize - 3), 0]}>\n              <Label\n                text={subLabel}\n                fontUrl={labelFontUrl}\n                fontSize={5}\n                opacity={selectionOpacity}\n                stroke={theme.node.subLabel?.stroke}\n                active={isSelected || active || isDraggingCurrent || isActive}\n                color={\n                  isSelected || active || isDraggingCurrent || isActive\n                    ? theme.node.subLabel?.activeColor\n                    : theme.node.subLabel?.color\n                }\n              />\n            </group>\n          )}\n        </a.group>\n      ),\n    [\n      active,\n      isActive,\n      isDraggingCurrent,\n      isSelected,\n      label,\n      labelFontUrl,\n      labelPosition,\n      labelVisible,\n      nodeSize,\n      selectionOpacity,\n      subLabel,\n      theme.node.label.activeColor,\n      theme.node.label.color,\n      theme.node.label.stroke,\n      theme.node.subLabel?.activeColor,\n      theme.node.subLabel?.color,\n      theme.node.subLabel?.stroke\n    ]\n  );\n\n  const menuComponent = useMemo(\n    () =>\n      menuVisible &&\n      contextMenu && (\n        <Html prepend={true} center={true}>\n          {contextMenu({\n            data: node,\n            canCollapse,\n            isCollapsed,\n            onCollapse,\n            onClose: () => setMenuVisible(false)\n          })}\n        </Html>\n      ),\n    [menuVisible, contextMenu, node, canCollapse, isCollapsed, onCollapse]\n  );\n\n  return (\n    <a.group\n      renderOrder={1}\n      userData={{ id, type: 'node' }}\n      ref={group}\n      position={nodePosition as any}\n      onPointerOver={pointerOver}\n      onPointerOut={pointerOut}\n      onClick={(event: ThreeEvent<MouseEvent>) => {\n        if (!disabled && !isDraggingCurrent) {\n          onClick?.(\n            node,\n            {\n              canCollapse,\n              isCollapsed\n            },\n            event\n          );\n        }\n      }}\n      onDoubleClick={(event: ThreeEvent<MouseEvent>) => {\n        if (!disabled && !isDraggingCurrent) {\n          onDoubleClick?.(node, event);\n        }\n      }}\n      onContextMenu={() => {\n        if (!disabled) {\n          setMenuVisible(true);\n          onContextMenu?.(node, {\n            canCollapse,\n            isCollapsed,\n            onCollapse\n          });\n        }\n      }}\n      {...(bind() as any)}\n    >\n      {nodeComponent}\n      {menuComponent}\n      {labelComponent}\n    </a.group>\n  );\n};\n","import { PerspectiveCamera } from 'three';\nimport { InternalGraphPosition } from '../types';\n\n/**\n * Get the visible height at the z depth.\n * Ref: https://discourse.threejs.org/t/functions-to-calculate-the-visible-width-height-at-a-given-z-depth-from-a-perspective-camera/269\n */\nfunction visibleHeightAtZDepth(depth: number, camera: PerspectiveCamera) {\n  // compensate for cameras not positioned at z=0\n  const cameraOffset = camera.position.z;\n  if (depth < cameraOffset) depth -= cameraOffset;\n  else depth += cameraOffset;\n\n  // vertical fov in radians\n  const vFOV = ((camera.fov / camera.zoom) * Math.PI) / 180;\n\n  // Math.abs to ensure the result is always positive\n  return 2 * Math.tan(vFOV / 2) * Math.abs(depth);\n}\n\n/**\n * Get the visible width at the z depth.\n */\nfunction visibleWidthAtZDepth(depth: number, camera: PerspectiveCamera) {\n  const height = visibleHeightAtZDepth(depth, camera);\n  return height * camera.aspect;\n}\n\n/**\n * Returns whether the node is in view of the camera.\n */\nexport function isNodeInView(\n  camera: PerspectiveCamera,\n  nodePosition: InternalGraphPosition\n): boolean {\n  const visibleWidth = visibleWidthAtZDepth(1, camera);\n  const visibleHeight = visibleHeightAtZDepth(1, camera);\n\n  // The boundary coordinates of the area visible to the camera relative to the scene\n  const visibleArea = {\n    x0: camera?.position?.x - visibleWidth / 2,\n    x1: camera?.position?.x + visibleWidth / 2,\n    y0: camera?.position?.y - visibleHeight / 2,\n    y1: camera?.position?.y + visibleHeight / 2\n  };\n\n  return (\n    nodePosition?.x > visibleArea.x0 &&\n    nodePosition?.x < visibleArea.x1 &&\n    nodePosition?.y > visibleArea.y0 &&\n    nodePosition?.y < visibleArea.y1\n  );\n}\n\n/**\n * Get the closest axis to a given angle.\n */\nexport function getClosestAxis(angle: number, axes: number[]) {\n  return axes.reduce((prev, curr) =>\n    Math.abs(curr - (angle % Math.PI)) < Math.abs(prev - (angle % Math.PI))\n      ? curr\n      : prev\n  );\n}\n\n/**\n * Get how far an angle is from the closest 2D axis in radians.\n */\nexport function getDegreesToClosest2dAxis(\n  horizontalAngle: number,\n  verticalAngle: number\n) {\n  const closestHorizontalAxis = getClosestAxis(horizontalAngle, [0, Math.PI]);\n  const closestVerticalAxis = getClosestAxis(verticalAngle, [\n    Math.PI / 2,\n    (3 * Math.PI) / 2\n  ]);\n\n  return {\n    horizontalRotation: closestHorizontalAxis - (horizontalAngle % Math.PI),\n    verticalRotation: closestVerticalAxis - (verticalAngle % Math.PI)\n  };\n}\n","import { useThree } from '@react-three/fiber';\nimport { useCameraControls } from '../CameraControls/useCameraControls';\nimport { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { Vector3, Box3, PerspectiveCamera } from 'three';\nimport { getLayoutCenter } from '../utils/layout';\nimport { InternalGraphNode } from '../types';\nimport { useStore } from '../store';\nimport {\n  isNodeInView,\n  getDegreesToClosest2dAxis\n} from '../CameraControls/utils';\nimport { LayoutTypes } from '../layout/types';\n\nconst PADDING = 50;\n\nexport interface CenterNodesParams {\n  animated?: boolean;\n  centerOnlyIfNodesNotInView?: boolean;\n}\n\nexport interface FitNodesParams {\n  animated?: boolean;\n  fitOnlyIfNodesNotInView?: boolean;\n}\n\nexport interface CenterGraphInput {\n  /**\n   * Whether the animate the transition or not.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the center graph function is disabled or not.\n   */\n  disabled?: boolean;\n\n  /**\n   * The layout type of the graph used to determine rotation logic.\n   */\n  layoutType: LayoutTypes;\n}\n\nexport interface CenterGraphOutput {\n  /**\n   * Centers the graph on a specific node or list of nodes.\n   *\n   * @param nodes - An array of `InternalGraphNode` objects to center the graph on. If this parameter is omitted,\n   * the graph will be centered on all nodes.\n   *\n   * @param animated - A boolean flag that determines whether the centering action should be animated.\n   *\n   * @param centerOnlyIfNodesNotInView - A boolean flag that determines whether the graph should\n   * only be centered if the nodes specified by `nodes` are not currently in view. If this\n   * parameter is `true`, the graph will only be re-centered if one or more of the nodes\n   * specified by `nodes` are not currently visible in the viewport. If this parameter is\n   * `false` or omitted, the graph will be re-centered regardless of whether the nodes\n   * are currently in view.\n   */\n  centerNodes: (nodes: InternalGraphNode[], opts: CenterNodesParams) => void;\n\n  /**\n   * Centers the graph on a specific node or list of nodes.\n   *\n   * @param nodeIds - An array of node IDs to center the graph on. If this parameter is omitted,\n   * the graph will be centered on all nodes.\n   *\n   * @param opts.centerOnlyIfNodesNotInView - A boolean flag that determines whether the graph should\n   * only be centered if the nodes specified by `ids` are not currently in view. If this\n   * parameter is `true`, the graph will only be re-centered if one or more of the nodes\n   * specified by `ids` are not currently in view. If this parameter is\n   * `false` or omitted, the graph will be re-centered regardless of whether the nodes\n   * are currently in view.\n   */\n  centerNodesById: (nodeIds: string[], opts?: CenterNodesParams) => void;\n\n  /**\n   * Fit all the given nodes into view of the camera.\n   *\n   * @param nodeIds - An array of node IDs to fit the view on. If this parameter is omitted,\n   * the view will fit to all nodes.\n   *\n   * @param opts.fitOnlyIfNodesNotInView - A boolean flag that determines whether the view should\n   * only be fit if the nodes specified by `ids` are not currently in view. If this\n   * parameter is `true`, the view will only be fit if one or more of the nodes\n   * specified by `ids` are not currently visible in the viewport. If this parameter is\n   * `false` or omitted, the view will be fit regardless of whether the nodes\n   * are currently in view.\n   */\n  fitNodesInViewById: (nodeIds: string[], opts?: FitNodesParams) => void;\n\n  /**\n   * Whether the graph is centered or not.\n   */\n  isCentered?: boolean;\n}\n\nexport const useCenterGraph = ({\n  animated,\n  disabled,\n  layoutType\n}: CenterGraphInput): CenterGraphOutput => {\n  const nodes = useStore(state => state.nodes);\n  const [isCentered, setIsCentered] = useState<boolean>(false);\n  const invalidate = useThree(state => state.invalidate);\n  const { controls } = useCameraControls();\n  const camera = useThree(state => state.camera) as PerspectiveCamera;\n  const mounted = useRef<boolean>(false);\n\n  const centerNodes = useCallback(\n    async (nodes, opts?: CenterNodesParams) => {\n      const animated = opts?.animated !== undefined ? opts?.animated : true;\n      const centerOnlyIfNodesNotInView =\n        opts?.centerOnlyIfNodesNotInView !== undefined\n          ? opts?.centerOnlyIfNodesNotInView\n          : false;\n\n      if (\n        !mounted.current ||\n        !centerOnlyIfNodesNotInView ||\n        (centerOnlyIfNodesNotInView &&\n          nodes?.some(node => !isNodeInView(camera, node.position)))\n      ) {\n        // Centers the graph based on the central most node\n        const { x, y, z } = getLayoutCenter(nodes);\n\n        await controls.setTarget(x, y, z, animated);\n\n        if (!isCentered) {\n          setIsCentered(true);\n        }\n\n        invalidate();\n      }\n    },\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [invalidate, controls, nodes]\n  );\n\n  const fitNodesInView = useCallback(\n    async (\n      nodes,\n      opts: FitNodesParams = { animated: true, fitOnlyIfNodesNotInView: false }\n    ) => {\n      const { fitOnlyIfNodesNotInView } = opts;\n\n      if (\n        !fitOnlyIfNodesNotInView ||\n        (fitOnlyIfNodesNotInView &&\n          nodes?.some(node => !isNodeInView(camera, node.position)))\n      ) {\n        const { minX, maxX, minY, maxY, minZ, maxZ } = getLayoutCenter(nodes);\n\n        if (!layoutType.includes('3d')) {\n          // fitToBox will auto rotate to the closest axis including the z axis,\n          // which is not desired for 2D graphs\n          // So get the rotation to the closest flat axis for 2D graphs\n          const { horizontalRotation, verticalRotation } =\n            getDegreesToClosest2dAxis(\n              controls?.azimuthAngle,\n              controls?.polarAngle\n            );\n\n          void controls?.rotate(horizontalRotation, verticalRotation, true);\n        }\n\n        await controls?.zoomTo(1, opts?.animated);\n\n        await controls?.fitToBox(\n          new Box3(\n            new Vector3(minX, minY, minZ),\n            new Vector3(maxX, maxY, maxZ)\n          ),\n          opts?.animated,\n          {\n            cover: false,\n            paddingLeft: PADDING,\n            paddingRight: PADDING,\n            paddingBottom: PADDING,\n            paddingTop: PADDING\n          }\n        );\n      }\n    },\n    [camera, controls, layoutType]\n  );\n\n  const getNodesById = useCallback(\n    (nodeIds: string[]) => {\n      let mappedNodes: InternalGraphNode[] | null = null;\n\n      if (nodeIds?.length) {\n        // Map the node ids to the actual nodes\n        mappedNodes = nodeIds.reduce((acc, id) => {\n          const node = nodes.find(n => n.id === id);\n          if (node) {\n            acc.push(node);\n          } else {\n            throw new Error(\n              `Attempted to center ${id} but it was not found in the nodes`\n            );\n          }\n\n          return acc;\n        }, []);\n      }\n\n      return mappedNodes;\n    },\n    [nodes]\n  );\n\n  const centerNodesById = useCallback(\n    (nodeIds: string[], opts: CenterNodesParams) => {\n      const mappedNodes = getNodesById(nodeIds);\n\n      centerNodes(mappedNodes || nodes, {\n        animated,\n        centerOnlyIfNodesNotInView: opts?.centerOnlyIfNodesNotInView\n      });\n    },\n    [animated, centerNodes, getNodesById, nodes]\n  );\n\n  const fitNodesInViewById = useCallback(\n    async (nodeIds: string[], opts: FitNodesParams) => {\n      const mappedNodes = getNodesById(nodeIds);\n\n      await fitNodesInView(mappedNodes || nodes, { animated, ...opts });\n    },\n    [animated, fitNodesInView, getNodesById, nodes]\n  );\n\n  useLayoutEffect(() => {\n    async function load() {\n      // Once we've loaded controls and we have nodes, let's recenter\n      if (controls && nodes?.length) {\n        if (!mounted.current) {\n          // Center the graph once nodes are loaded on mount\n          await centerNodes(nodes, { animated: false });\n          await fitNodesInView(nodes, { animated: false });\n          mounted.current = true;\n        }\n      }\n    }\n\n    load();\n  }, [controls, centerNodes, nodes, animated, camera, fitNodesInView]);\n\n  return { centerNodes, centerNodesById, fitNodesInViewById, isCentered };\n};\n","import React, {\n  FC,\n  forwardRef,\n  Fragment,\n  ReactNode,\n  Ref,\n  useCallback,\n  useImperativeHandle,\n  useMemo\n} from 'react';\nimport { useGraph } from './useGraph';\nimport { LayoutOverrides, LayoutTypes } from './layout';\nimport {\n  NodeContextMenuProps,\n  ContextMenuEvent,\n  GraphEdge,\n  GraphNode,\n  InternalGraphEdge,\n  InternalGraphNode,\n  NodeRenderer,\n  CollapseProps,\n  ClusterRenderer\n} from './types';\nimport type { SizingType } from './sizing';\nimport type { ClusterEventArgs } from './symbols/Cluster';\nimport type { EdgeArrowPosition } from './symbols/edges/Edge';\nimport type { EdgeInterpolation, EdgeLabelPosition } from './symbols/Edge';\nimport type {\n  CenterNodesParams,\n  FitNodesParams\n} from './CameraControls/useCenterGraph';\nimport { Cluster } from './symbols/Cluster';\nimport { Edge } from './symbols/Edge';\nimport { Edges } from './symbols/edges';\nimport { Node } from './symbols';\nimport { useCenterGraph } from './CameraControls/useCenterGraph';\nimport { LabelVisibilityType } from './utils/visibility';\nimport { useStore } from './store';\nimport Graph from 'graphology';\nimport type { ThreeEvent } from '@react-three/fiber';\nimport { useThree } from '@react-three/fiber';\n\nexport interface GraphSceneProps {\n  /**\n   * Type of layout.\n   */\n  layoutType?: LayoutTypes;\n\n  /**\n   * List of ids that are selected.\n   */\n  selections?: string[];\n\n  /**\n   * List of ids that are active.\n   */\n  actives?: string[];\n\n  /**\n   * List of node ids that are collapsed.\n   */\n  collapsedNodeIds?: string[];\n\n  /**\n   * Animate or not the graph positions.\n   */\n  animated?: boolean;\n\n  /**\n   * Nodes to pass to the graph.\n   */\n  nodes: GraphNode[];\n\n  /**\n   * Edges to pass to the graph.\n   */\n  edges: GraphEdge[];\n\n  /**\n   * Context menu element.\n   */\n  contextMenu?: (event: ContextMenuEvent) => ReactNode;\n\n  /**\n   * Type of sizing for nodes.\n   */\n  sizingType?: SizingType;\n\n  /**\n   * Type of visibility for labels.\n   */\n  labelType?: LabelVisibilityType;\n\n  /**\n   * Place of visibility for edge labels.\n   */\n  edgeLabelPosition?: EdgeLabelPosition;\n\n  /**\n   * Placement of edge arrows.\n   */\n  edgeArrowPosition?: EdgeArrowPosition;\n\n  /**\n   * Shape of edge.\n   */\n  edgeInterpolation?: EdgeInterpolation;\n\n  /**\n   * Font of label, same as troika-three-text\n   * The URL of a custom font file to be used. Supported font formats are: * .ttf * .otf * .woff (.woff2 is not supported)\n   * Default: The Roboto font loaded from Google Fonts CDN\n   */\n  labelFontUrl?: string;\n\n  /**\n   * Attribute based sizing property.\n   */\n  sizingAttribute?: string;\n\n  /**\n   * The default size to size nodes to. Default is 7.\n   */\n  defaultNodeSize?: number;\n\n  /**\n   * When using sizing attributes, the min size a node can be.\n   */\n  minNodeSize?: number;\n\n  /**\n   * When using sizing attributes, the max size a node can be.\n   */\n  maxNodeSize?: number;\n\n  /**\n   * Attribute used for clustering.\n   */\n  clusterAttribute?: string;\n\n  /**\n   * Disable interactions or not.\n   */\n  disabled?: boolean;\n\n  /**\n   * Allow dragging of nodes.\n   */\n  draggable?: boolean;\n\n  /**\n   * Constrain dragging to the cluster bounds. Default is `false`.\n   */\n  constrainDragging?: boolean;\n\n  /**\n   * Render a custom node\n   */\n  renderNode?: NodeRenderer;\n\n  /**\n   * Render a custom cluster\n   */\n  onRenderCluster?: ClusterRenderer;\n\n  /**\n   * Advanced overrides for the layout.\n   */\n  layoutOverrides?: LayoutOverrides;\n\n  /**\n   * When a node was clicked.\n   */\n  onNodeClick?: (\n    node: InternalGraphNode,\n    props?: CollapseProps,\n    event?: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * When a node was double clicked.\n   */\n  onNodeDoubleClick?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * When a node context menu happened.\n   */\n  onNodeContextMenu?: (\n    node: InternalGraphNode,\n    props?: NodeContextMenuProps\n  ) => void;\n\n  /**\n   * When node got a pointer over.\n   */\n  onNodePointerOver?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * When node lost pointer over.\n   */\n  onNodePointerOut?: (\n    node: InternalGraphNode,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * Triggered after a node was dragged.\n   */\n  onNodeDragged?: (node: InternalGraphNode) => void;\n\n  /**\n   * Triggered after a cluster was dragged.\n   */\n  onClusterDragged?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * When a edge context menu happened.\n   */\n  onEdgeContextMenu?: (edge?: InternalGraphEdge) => void;\n\n  /**\n   * When an edge was clicked.\n   */\n  onEdgeClick?: (\n    edge: InternalGraphEdge,\n    event?: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * When edge got a pointer over.\n   */\n  onEdgePointerOver?: (\n    edge: InternalGraphEdge,\n    event?: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * When edge lost pointer over.\n   */\n  onEdgePointerOut?: (\n    edge: InternalGraphEdge,\n    event?: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * When a cluster was clicked.\n   */\n  onClusterClick?: (\n    cluster: ClusterEventArgs,\n    event: ThreeEvent<MouseEvent>\n  ) => void;\n\n  /**\n   * When a cluster receives a pointer over event.\n   */\n  onClusterPointerOver?: (\n    cluster: ClusterEventArgs,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n\n  /**\n   * When cluster receives a pointer leave event.\n   */\n  onClusterPointerOut?: (\n    cluster: ClusterEventArgs,\n    event: ThreeEvent<PointerEvent>\n  ) => void;\n}\n\nexport interface GraphSceneRef {\n  /**\n   * Reference to the graph object.\n   */\n  graph: Graph;\n\n  /**\n   * Centers the graph on a specific node or list of nodes.\n   *\n   * @param nodeIds - An array of node IDs to center the graph on. If this parameter is omitted,\n   * the graph will be centered on all nodes.\n   *\n   * @param opts.centerOnlyIfNodesNotInView - A boolean flag that determines whether the graph should\n   * only be centered if the nodes specified by `ids` are not currently in view. If this\n   * parameter is `true`, the graph will only be re-centered if one or more of the nodes\n   * specified by `ids` are not currently in view. If this parameter is\n   * `false` or omitted, the graph will be re-centered regardless of whether the nodes\n   * are currently in view.\n   */\n  centerGraph: (nodeIds?: string[], opts?: CenterNodesParams) => void;\n\n  /**\n   * Fit all the given nodes into view of the camera.\n   *\n   * @param nodeIds - An array of node IDs to fit the view on. If this parameter is omitted,\n   * the view will fit to all nodes.\n   *\n   * @param opts.fitOnlyIfNodesNotInView - A boolean flag that determines whether the view should\n   * only be fit if the nodes specified by `ids` are not currently in view. If this\n   * parameter is `true`, the view will only be fit if one or more of the nodes\n   * specified by `ids` are not currently visible in the viewport. If this parameter is\n   * `false` or omitted, the view will be fit regardless of whether the nodes\n   * are currently in view.\n   */\n  fitNodesInView: (nodeIds?: string[], opts?: FitNodesParams) => void;\n\n  /**\n   * Calls render scene on the graph. this is useful when you want to manually render the graph\n   * for things like screenshots.\n   */\n  renderScene: () => void;\n}\n\nexport const GraphScene: FC<GraphSceneProps & { ref?: Ref<GraphSceneRef> }> =\n  forwardRef(\n    (\n      {\n        onNodeClick,\n        onNodeDoubleClick,\n        onNodeContextMenu,\n        onEdgeContextMenu,\n        onEdgeClick,\n        onEdgePointerOver,\n        onEdgePointerOut,\n        onNodePointerOver,\n        onNodePointerOut,\n        onClusterClick,\n        onNodeDragged,\n        onClusterDragged,\n        onClusterPointerOver,\n        onClusterPointerOut,\n        contextMenu,\n        animated,\n        disabled,\n        draggable,\n        constrainDragging = false,\n        edgeLabelPosition,\n        edgeArrowPosition,\n        edgeInterpolation = 'linear',\n        labelFontUrl,\n        renderNode,\n        onRenderCluster,\n        ...rest\n      },\n      ref\n    ) => {\n      const { layoutType, clusterAttribute } = rest;\n\n      // Get the gl/scene/camera for render shortcuts\n      const gl = useThree(state => state.gl);\n      const scene = useThree(state => state.scene);\n      const camera = useThree(state => state.camera);\n\n      // Mount and build the graph\n      const { updateLayout } = useGraph({ ...rest, constrainDragging });\n\n      if (\n        clusterAttribute &&\n        !(layoutType === 'forceDirected2d' || layoutType === 'forceDirected3d')\n      ) {\n        throw new Error(\n          'Clustering is only supported for the force directed layouts.'\n        );\n      }\n\n      // Get the graph and nodes via the store for memo\n      const graph = useStore(state => state.graph);\n      const nodes = useStore(state => state.nodes);\n      const edges = useStore(state => state.edges);\n      const clusters = useStore(state => [...state.clusters.values()]);\n\n      // Center the graph on the nodes\n      const { centerNodesById, fitNodesInViewById, isCentered } =\n        useCenterGraph({\n          animated,\n          disabled,\n          layoutType\n        });\n\n      // Let's expose some helper methods\n      useImperativeHandle(\n        ref,\n        () => ({\n          centerGraph: centerNodesById,\n          fitNodesInView: fitNodesInViewById,\n          graph,\n          renderScene: () => gl.render(scene, camera)\n        }),\n        [centerNodesById, fitNodesInViewById, graph, gl, scene, camera]\n      );\n\n      const onNodeDraggedHandler = useCallback(\n        (node: InternalGraphNode) => {\n          onNodeDragged?.(node);\n\n          // Update layout to recalculate the cluster positions when a node is dragged\n          if (clusterAttribute) {\n            updateLayout();\n          }\n        },\n        [clusterAttribute, onNodeDragged, updateLayout]\n      );\n\n      const nodeComponents = useMemo(\n        () =>\n          nodes.map(n => (\n            <Node\n              key={n?.id}\n              id={n?.id}\n              labelFontUrl={labelFontUrl}\n              draggable={draggable}\n              constrainDragging={constrainDragging}\n              disabled={disabled}\n              animated={animated}\n              contextMenu={contextMenu}\n              renderNode={renderNode}\n              onClick={onNodeClick}\n              onDoubleClick={onNodeDoubleClick}\n              onContextMenu={onNodeContextMenu}\n              onPointerOver={onNodePointerOver}\n              onPointerOut={onNodePointerOut}\n              onDragged={onNodeDraggedHandler}\n            />\n          )),\n        [\n          constrainDragging,\n          animated,\n          contextMenu,\n          disabled,\n          draggable,\n          labelFontUrl,\n          nodes,\n          onNodeClick,\n          onNodeContextMenu,\n          onNodeDoubleClick,\n          onNodeDraggedHandler,\n          onNodePointerOut,\n          onNodePointerOver,\n          renderNode\n        ]\n      );\n\n      const edgeComponents = useMemo(\n        () =>\n          animated ? (\n            edges.map(e => (\n              <Edge\n                key={e.id}\n                id={e.id}\n                disabled={disabled}\n                animated={animated}\n                labelFontUrl={labelFontUrl}\n                labelPlacement={edgeLabelPosition}\n                arrowPlacement={edgeArrowPosition}\n                interpolation={edgeInterpolation}\n                contextMenu={contextMenu}\n                onClick={onEdgeClick}\n                onContextMenu={onEdgeContextMenu}\n                onPointerOver={onEdgePointerOver}\n                onPointerOut={onEdgePointerOut}\n              />\n            ))\n          ) : (\n            <Edges\n              edges={edges}\n              disabled={disabled}\n              animated={animated}\n              labelFontUrl={labelFontUrl}\n              labelPlacement={edgeLabelPosition}\n              arrowPlacement={edgeArrowPosition}\n              interpolation={edgeInterpolation}\n              contextMenu={contextMenu}\n              onClick={onEdgeClick}\n              onContextMenu={onEdgeContextMenu}\n              onPointerOver={onEdgePointerOver}\n              onPointerOut={onEdgePointerOut}\n            />\n          ),\n        [\n          animated,\n          contextMenu,\n          disabled,\n          edgeArrowPosition,\n          edgeInterpolation,\n          edgeLabelPosition,\n          edges,\n          labelFontUrl,\n          onEdgeClick,\n          onEdgeContextMenu,\n          onEdgePointerOut,\n          onEdgePointerOver\n        ]\n      );\n\n      const clusterComponents = useMemo(\n        () =>\n          clusters.map(c => (\n            <Cluster\n              key={c.label}\n              animated={animated}\n              disabled={disabled}\n              draggable={draggable}\n              labelFontUrl={labelFontUrl}\n              onClick={onClusterClick}\n              onPointerOver={onClusterPointerOver}\n              onPointerOut={onClusterPointerOut}\n              onDragged={onClusterDragged}\n              onRender={onRenderCluster}\n              {...c}\n            />\n          )),\n        [\n          animated,\n          clusters,\n          disabled,\n          draggable,\n          labelFontUrl,\n          onClusterClick,\n          onClusterPointerOut,\n          onClusterPointerOver,\n          onClusterDragged,\n          onRenderCluster\n        ]\n      );\n\n      return (\n        isCentered && (\n          <Fragment>\n            {edgeComponents}\n            {nodeComponents}\n            {clusterComponents}\n          </Fragment>\n        )\n      );\n    }\n  );\n","import React, {\n  FC,\n  useRef,\n  useEffect,\n  useCallback,\n  forwardRef,\n  Ref,\n  useImperativeHandle,\n  useMemo,\n  ReactNode,\n  useState\n} from 'react';\nimport { useThree, useFrame, extend } from '@react-three/fiber';\nimport {\n  MOUSE,\n  Vector2,\n  Vector3,\n  Vector4,\n  Quaternion,\n  Matrix4,\n  Spherical,\n  Box3,\n  Sphere,\n  Raycaster,\n  MathUtils\n} from 'three';\nimport ThreeCameraControls from 'camera-controls';\nimport {\n  CameraControlsContext,\n  CameraControlsContextProps\n} from './useCameraControls';\nimport * as holdEvent from 'hold-event';\nimport { useStore } from '../store';\nimport { isServerRender } from '../utils/visibility';\n\n// Install the camera controls\n// Use a subset for better three shaking\nThreeCameraControls.install({\n  THREE: {\n    MOUSE: MOUSE,\n    Vector2: Vector2,\n    Vector3: Vector3,\n    Vector4: Vector4,\n    Quaternion: Quaternion,\n    Matrix4: Matrix4,\n    Spherical: Spherical,\n    Box3: Box3,\n    Sphere: Sphere,\n    Raycaster: Raycaster,\n    MathUtils: {\n      DEG2RAD: MathUtils?.DEG2RAD,\n      clamp: MathUtils?.clamp\n    }\n  }\n});\n\n// Extend r3f with the new controls\nextend({ ThreeCameraControls });\n\nconst KEY_CODES = {\n  ARROW_LEFT: 37,\n  ARROW_UP: 38,\n  ARROW_RIGHT: 39,\n  ARROW_DOWN: 40\n};\n\nexport type CameraMode = 'pan' | 'rotate' | 'orbit';\n\nexport interface CameraControlsProps {\n  /**\n   * Mode of the camera.\n   */\n  mode?: CameraMode;\n\n  /**\n   * Children symbols.\n   */\n  children?: ReactNode;\n\n  /**\n   * Animate transitions to centering.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the controls are enabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The maximum distance for the camera.\n   */\n  maxDistance?: number;\n\n  /**\n   * The minimum distance for the camera.\n   */\n  minDistance?: number;\n}\n\nexport type CameraControlsRef = CameraControlsContextProps;\n\nexport const CameraControls: FC<\n  CameraControlsProps & { ref?: Ref<CameraControlsRef> }\n> = forwardRef(\n  (\n    {\n      mode = 'rotate',\n      children,\n      animated,\n      disabled,\n      minDistance = 1000,\n      maxDistance = 50000\n    },\n    ref: Ref<CameraControlsRef>\n  ) => {\n    const cameraRef = useRef<ThreeCameraControls | null>(null);\n    const camera = useThree(state => state.camera);\n    const gl = useThree(state => state.gl);\n    const isOrbiting = mode === 'orbit';\n    const setPanning = useStore(state => state.setPanning);\n    const isDragging = useStore(state => state.draggingIds.length > 0);\n    const cameraSpeedRef = useRef(0);\n    const [controlMounted, setControlMounted] = useState<boolean>(false);\n\n    useFrame((_state, delta) => {\n      if (cameraRef.current?.enabled) {\n        cameraRef.current?.update(delta);\n      }\n\n      if (isOrbiting) {\n        cameraRef.current.azimuthAngle += 20 * delta * MathUtils.DEG2RAD;\n      }\n    }, -1);\n\n    useEffect(() => () => cameraRef.current?.dispose(), []);\n\n    const zoomIn = useCallback(() => {\n      cameraRef.current?.zoom(camera.zoom / 2, animated);\n    }, [animated, camera.zoom]);\n\n    const zoomOut = useCallback(() => {\n      cameraRef.current?.zoom(-camera.zoom / 2, animated);\n    }, [animated, camera.zoom]);\n\n    const dollyIn = useCallback(\n      distance => {\n        cameraRef.current?.dolly(distance, animated);\n      },\n      [animated]\n    );\n\n    const dollyOut = useCallback(\n      distance => {\n        cameraRef.current?.dolly(distance, animated);\n      },\n      [animated]\n    );\n\n    const panRight = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(-0.03 * event.deltaTime, 0, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panLeft = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0.03 * event.deltaTime, 0, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panUp = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0, 0.03 * event.deltaTime, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panDown = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0, -0.03 * event.deltaTime, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const onKeyDown = useCallback(\n      event => {\n        if (event.code === 'Space') {\n          if (mode === 'rotate') {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.TRUCK;\n          } else {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.ROTATE;\n          }\n        }\n      },\n      [mode]\n    );\n\n    const onKeyUp = useCallback(\n      event => {\n        if (event.code === 'Space') {\n          if (mode === 'rotate') {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.ROTATE;\n          } else {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.TRUCK;\n          }\n        }\n      },\n      [mode]\n    );\n\n    const [keyControls, setKeyControls] = useState<{\n      leftKey: holdEvent.KeyboardKeyHold;\n      rightKey: holdEvent.KeyboardKeyHold;\n      upKey: holdEvent.KeyboardKeyHold;\n      downKey: holdEvent.KeyboardKeyHold;\n    } | null>(null);\n\n    useEffect(() => {\n      // Only initialize on client side\n      if (!isServerRender) {\n        setKeyControls({\n          leftKey: new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_LEFT, 100),\n          rightKey: new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_RIGHT, 100),\n          upKey: new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_UP, 100),\n          downKey: new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_DOWN, 100)\n        });\n      }\n    }, []);\n\n    useEffect(() => {\n      if (!disabled && keyControls) {\n        keyControls.leftKey.addEventListener('holding', panLeft);\n        keyControls.rightKey.addEventListener('holding', panRight);\n        keyControls.upKey.addEventListener('holding', panUp);\n        keyControls.downKey.addEventListener('holding', panDown);\n\n        window.addEventListener('keydown', onKeyDown);\n        window.addEventListener('keyup', onKeyUp);\n      }\n\n      return () => {\n        if (keyControls) {\n          keyControls.leftKey.removeEventListener('holding', panLeft);\n          keyControls.rightKey.removeEventListener('holding', panRight);\n          keyControls.upKey.removeEventListener('holding', panUp);\n          keyControls.downKey.removeEventListener('holding', panDown);\n\n          window.removeEventListener('keydown', onKeyDown);\n          window.removeEventListener('keyup', onKeyUp);\n        }\n      };\n    }, [\n      disabled,\n      onKeyDown,\n      onKeyUp,\n      panDown,\n      panLeft,\n      panRight,\n      panUp,\n      keyControls\n    ]);\n\n    useEffect(() => {\n      if (disabled) {\n        cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.NONE;\n        cameraRef.current.mouseButtons.middle = ThreeCameraControls.ACTION.NONE;\n        cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.NONE;\n      } else {\n        cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.TRUCK;\n        cameraRef.current.mouseButtons.middle =\n          ThreeCameraControls.ACTION.TRUCK;\n        cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.DOLLY;\n      }\n    }, [disabled]);\n\n    useEffect(() => {\n      const onControl = () => setPanning(true);\n      const onControlEnd = () => setPanning(false);\n\n      const ref = cameraRef.current;\n      if (ref) {\n        ref.addEventListener('control', onControl);\n        ref.addEventListener('controlend', onControlEnd);\n      }\n\n      return () => {\n        if (ref) {\n          ref.removeEventListener('control', onControl);\n          ref.removeEventListener('controlend', onControlEnd);\n        }\n      };\n    }, [cameraRef, setPanning]);\n\n    useEffect(() => {\n      // If a node is being dragged, disable the camera controls\n      if (isDragging) {\n        cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.NONE;\n        cameraRef.current.touches.one = ThreeCameraControls.ACTION.NONE;\n      } else {\n        if (mode === 'rotate') {\n          cameraRef.current.mouseButtons.left =\n            ThreeCameraControls.ACTION.ROTATE;\n          cameraRef.current.touches.one =\n            ThreeCameraControls.ACTION.TOUCH_ROTATE;\n        } else {\n          cameraRef.current.touches.one =\n            ThreeCameraControls.ACTION.TOUCH_TRUCK;\n          cameraRef.current.mouseButtons.left =\n            ThreeCameraControls.ACTION.TRUCK;\n        }\n      }\n    }, [isDragging, mode]);\n\n    const values = useMemo(\n      () => ({\n        controls: cameraRef.current,\n        zoomIn: () => zoomIn(),\n        zoomOut: () => zoomOut(),\n        dollyIn: (distance = 1000) => dollyIn(distance),\n        dollyOut: (distance = -1000) => dollyOut(distance),\n        panLeft: (deltaTime = 100) => panLeft({ deltaTime }),\n        panRight: (deltaTime = 100) => panRight({ deltaTime }),\n        panDown: (deltaTime = 100) => panDown({ deltaTime }),\n        panUp: (deltaTime = 100) => panUp({ deltaTime }),\n        resetControls: (animated?: boolean) =>\n          cameraRef.current?.reset(animated),\n        freeze: () => {\n          // Save the current speed\n          if (cameraRef.current.truckSpeed) {\n            cameraSpeedRef.current = cameraRef.current.truckSpeed;\n          }\n          cameraRef.current.truckSpeed = 0;\n        },\n        unFreeze: () => (cameraRef.current.truckSpeed = cameraSpeedRef.current)\n      }),\n      // eslint-disable-next-line\n      [zoomIn, zoomOut, panLeft, panRight, panDown, panUp, cameraRef.current]\n    );\n\n    useImperativeHandle(ref, () => values);\n\n    return (\n      <CameraControlsContext.Provider value={values}>\n        <threeCameraControls\n          ref={controls => {\n            cameraRef.current = controls;\n            if (!controlMounted) {\n              // Update the state when the controls are mounted to notify about it component that using that controls\n              setControlMounted(true);\n            }\n          }}\n          args={[camera, gl.domElement]}\n          smoothTime={0.1}\n          minDistance={minDistance}\n          dollyToCursor\n          maxDistance={maxDistance}\n        />\n        {children}\n      </CameraControlsContext.Provider>\n    );\n  }\n);\n","import { Theme } from './theme';\n\nexport const darkTheme: Theme = {\n  canvas: { background: '#1E2026' },\n  node: {\n    fill: '#7A8C9E',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.2,\n    label: { stroke: '#1E2026', color: '#ACBAC7', activeColor: '#1DE9AC' },\n    subLabel: { stroke: '#1E2026', color: '#ACBAC7', activeColor: '#1DE9AC' }\n  },\n  lasso: { border: '1px solid #55aaff', background: 'rgba(75, 160, 255, 0.1)' },\n  ring: { fill: '#54616D', activeFill: '#1DE9AC' },\n  edge: {\n    fill: '#474B56',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#1E2026',\n      color: '#ACBAC7',\n      activeColor: '#1DE9AC',\n      fontSize: 6\n    },\n    subLabel: {\n      stroke: '#1E2026',\n      color: '#ACBAC7',\n      activeColor: '#1DE9AC'\n    }\n  },\n  arrow: { fill: '#474B56', activeFill: '#1DE9AC' },\n  cluster: {\n    stroke: '#474B56',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: { stroke: '#1E2026', color: '#ACBAC7' }\n  }\n};\n","import { Theme } from './theme';\n\nexport const lightTheme: Theme = {\n  canvas: { background: '#fff' },\n  node: {\n    fill: '#7CA0AB',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.2,\n    label: { color: '#2A6475', stroke: '#fff', activeColor: '#1DE9AC' },\n    subLabel: { color: '#ddd', stroke: 'transparent', activeColor: '#1DE9AC' }\n  },\n  lasso: { border: '1px solid #55aaff', background: 'rgba(75, 160, 255, 0.1)' },\n  ring: { fill: '#D8E6EA', activeFill: '#1DE9AC' },\n  edge: {\n    fill: '#D8E6EA',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#fff',\n      color: '#2A6475',\n      activeColor: '#1DE9AC',\n      fontSize: 6\n    },\n    subLabel: {\n      color: '#ddd',\n      stroke: 'transparent',\n      activeColor: '#1DE9AC'\n    }\n  },\n  arrow: { fill: '#D8E6EA', activeFill: '#1DE9AC' },\n  cluster: {\n    stroke: '#D8E6EA',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: { stroke: '#fff', color: '#2A6475' }\n  }\n};\n","import { Theme } from '../themes';\nimport Graph from 'graphology';\n\nexport type PathSelectionTypes = 'direct' | 'out' | 'in' | 'all';\n\n/**\n * Given a graph and a list of node ids, return the adjacent nodes and edges.\n *\n * TODO: This method could be improved with the introduction of graphology\n */\nexport function getAdjacents(\n  graph: Graph,\n  nodeIds: string | string[],\n  type: PathSelectionTypes\n) {\n  nodeIds = Array.isArray(nodeIds) ? nodeIds : [nodeIds];\n\n  const nodes: string[] = [];\n  const edges: string[] = [];\n\n  for (const nodeId of nodeIds) {\n    const graphLinks = [\n      ...(graph.inEdgeEntries(nodeId) ?? []),\n      ...(graph.outEdgeEntries(nodeId) ?? [])\n    ];\n\n    if (!graphLinks) {\n      continue;\n    }\n\n    for (const link of graphLinks) {\n      const linkId = link.attributes.id;\n\n      if (type === 'in') {\n        if (link.target === nodeId && !edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      } else if (type === 'out') {\n        if (link.source === nodeId && !edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      } else {\n        if (!edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      }\n\n      if (type === 'out' || type === 'all') {\n        const toId = link.target;\n        if (!nodes.includes(toId as string)) {\n          nodes.push(toId as string);\n        }\n      }\n\n      if (type === 'in' || type === 'all') {\n        if (!nodes.includes(link.source)) {\n          nodes.push(link.source as string);\n        }\n      }\n    }\n  }\n\n  return {\n    nodes,\n    edges\n  };\n}\n\n/**\n * Set the vectors.\n */\nexport function prepareRay(event, vec, size) {\n  const { offsetX, offsetY } = event;\n  const { width, height } = size;\n  vec.set((offsetX / width) * 2 - 1, -(offsetY / height) * 2 + 1);\n}\n\n/**\n * Create a lasso element.\n */\nexport function createElement(theme: Theme) {\n  const element = document.createElement('div');\n  element.style.pointerEvents = 'none';\n  element.style.border = theme.lasso.border;\n  element.style.backgroundColor = theme.lasso.background;\n  element.style.position = 'fixed';\n  return element;\n}\n","import React, {\n  FC,\n  PropsWithChildren,\n  useCallback,\n  useEffect,\n  useRef\n} from 'react';\nimport { useThree } from '@react-three/fiber';\nimport { SelectionBox } from 'three-stdlib';\nimport { Mesh, Scene, TubeGeometry, Vector2 } from 'three';\nimport { useCameraControls } from '../CameraControls/useCameraControls';\nimport { useStore } from '../store';\nimport { createElement, prepareRay } from './utils';\n\nexport type LassoType = 'none' | 'all' | 'node' | 'edge';\n\nexport type LassoProps = PropsWithChildren<{\n  /**\n   * Whether the lasso tool is disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The type of the lasso tool.\n   */\n  type?: LassoType;\n\n  /**\n   * A function that is called when the lasso tool is used to select nodes.\n   * The function receives an array of the ids of the selected nodes.\n   */\n  onLasso?: (selections: string[]) => void;\n\n  /**\n   * A function that is called when the lasso tool is released, ending the selection.\n   * The function receives an array of the ids of the selected nodes.\n   */\n  onLassoEnd?: (selections: string[]) => void;\n}>;\n\nexport const Lasso: FC<LassoProps> = ({\n  children,\n  type = 'none',\n  onLasso,\n  onLassoEnd,\n  disabled\n}) => {\n  const theme = useStore(state => state.theme);\n  const camera = useThree(state => state.camera);\n  const gl = useThree(state => state.gl);\n  const setEvents = useThree(state => state.setEvents);\n  const size = useThree(state => state.size);\n  const get = useThree(state => state.get);\n  const scene = useThree(state => state.scene);\n\n  const cameraControls = useCameraControls();\n\n  const actives = useStore(state => state.actives);\n  const setActives = useStore(state => state.setActives);\n  const edges = useStore(state => state.edges);\n  const edgeMeshes = useStore(state => state.edgeMeshes);\n\n  const selectionBoxRef = useRef<SelectionBox | null>(null);\n  const edgeMeshSelectionBoxRef = useRef<SelectionBox | null>(null);\n  const elementRef = useRef<HTMLDivElement>(createElement(theme));\n  const vectorsRef = useRef<[Vector2, Vector2, Vector2] | null>(null);\n  const isDownRef = useRef(false);\n  const oldRaycasterEnabledRef = useRef<boolean>(get().events.enabled);\n  const oldControlsEnabledRef = useRef<boolean>(\n    cameraControls.controls?.enabled\n  );\n\n  const onPointerMove = useCallback(\n    event => {\n      if (isDownRef.current) {\n        const [startPoint, pointTopLeft, pointBottomRight] = vectorsRef.current;\n\n        pointBottomRight.x = Math.max(startPoint.x, event.clientX);\n        pointBottomRight.y = Math.max(startPoint.y, event.clientY);\n        pointTopLeft.x = Math.min(startPoint.x, event.clientX);\n        pointTopLeft.y = Math.min(startPoint.y, event.clientY);\n        elementRef.current.style.left = `${pointTopLeft.x}px`;\n        elementRef.current.style.top = `${pointTopLeft.y}px`;\n        elementRef.current.style.width = `${\n          pointBottomRight.x - pointTopLeft.x\n        }px`;\n        elementRef.current.style.height = `${\n          pointBottomRight.y - pointTopLeft.y\n        }px`;\n\n        prepareRay(event, selectionBoxRef.current.endPoint, size);\n        prepareRay(event, edgeMeshSelectionBoxRef.current.endPoint, size);\n\n        const allSelected = [];\n        const edgesSelected = edgeMeshSelectionBoxRef.current\n          .select()\n          .sort(o => (o as any).uuid)\n          .map(\n            edge => edges[edgeMeshes.indexOf(edge as Mesh<TubeGeometry>)].id\n          );\n        allSelected.push(...edgesSelected);\n\n        const selected = selectionBoxRef.current\n          .select()\n          .sort(o => (o as any).uuid)\n          .filter(\n            o =>\n              o.isMesh &&\n              o.userData?.id &&\n              (o.userData?.type === type || type === 'all')\n          )\n          .map(o => o.userData.id);\n        allSelected.push(...selected);\n\n        // Note: This probably isn't the best solution but\n        // it prevents the render thrashing and causing flickering\n        requestAnimationFrame(() => {\n          setActives(allSelected);\n          onLasso?.(allSelected);\n        });\n\n        document.addEventListener('pointermove', onPointerMove, {\n          passive: true,\n          capture: true,\n          once: true\n        });\n      }\n    },\n    [size, edges, edgeMeshes, type, setActives, onLasso]\n  );\n\n  const onPointerUp = useCallback(() => {\n    if (isDownRef.current) {\n      setEvents({ enabled: oldRaycasterEnabledRef.current });\n      isDownRef.current = false;\n      elementRef.current.parentElement?.removeChild(elementRef.current);\n      cameraControls.controls.enabled = oldControlsEnabledRef.current;\n      onLassoEnd?.(actives);\n\n      document.removeEventListener('pointermove', onPointerMove);\n      document.removeEventListener('pointerup', onPointerUp);\n    }\n  }, [setEvents, cameraControls.controls, onLassoEnd, actives, onPointerMove]);\n\n  const onPointerDown = useCallback(\n    event => {\n      if (event.shiftKey) {\n        // Let's capture the old props to restore them later\n        oldRaycasterEnabledRef.current = get().events.enabled;\n        oldControlsEnabledRef.current = cameraControls.controls?.enabled;\n\n        // SelectionBox for all meshes\n        selectionBoxRef.current = new SelectionBox(camera, scene);\n\n        // SelectionBox for all Edge meshes (since they are combined into one geometry for rendering)\n        const edgeScene = new Scene();\n        if (edgeMeshes.length) {\n          edgeScene.add(...edgeMeshes);\n        }\n        edgeMeshSelectionBoxRef.current = new SelectionBox(camera, edgeScene);\n\n        vectorsRef.current = [\n          // start point\n          new Vector2(),\n          // point top left\n          new Vector2(),\n          // point bottom right\n          new Vector2()\n        ];\n\n        const [startPoint] = vectorsRef.current;\n\n        cameraControls.controls.enabled = false;\n        setEvents({ enabled: false });\n        isDownRef.current = true;\n        gl.domElement.parentElement?.appendChild(elementRef.current);\n        elementRef.current.style.left = `${event.clientX}px`;\n        elementRef.current.style.top = `${event.clientY}px`;\n        elementRef.current.style.width = '0px';\n        elementRef.current.style.height = '0px';\n        startPoint.x = event.clientX;\n        startPoint.y = event.clientY;\n\n        prepareRay(event, selectionBoxRef.current.startPoint, size);\n        prepareRay(event, edgeMeshSelectionBoxRef.current.startPoint, size);\n\n        document.addEventListener('pointermove', onPointerMove, {\n          passive: true,\n          capture: true,\n          once: true\n        });\n        document.addEventListener('pointerup', onPointerUp, { passive: true });\n      }\n    },\n    [\n      camera,\n      cameraControls.controls,\n      edgeMeshes,\n      get,\n      gl.domElement.parentElement,\n      onPointerMove,\n      onPointerUp,\n      scene,\n      setEvents,\n      size\n    ]\n  );\n\n  useEffect(() => {\n    if (disabled || type === 'none') {\n      return;\n    }\n\n    if (typeof window !== 'undefined') {\n      document.addEventListener('pointerdown', onPointerDown, {\n        passive: true\n      });\n      document.addEventListener('pointermove', onPointerMove, {\n        passive: true\n      });\n      document.addEventListener('pointerup', onPointerUp, { passive: true });\n    }\n\n    return () => {\n      if (typeof window !== 'undefined') {\n        document.removeEventListener('pointerdown', onPointerDown);\n        document.removeEventListener('pointermove', onPointerMove);\n        document.removeEventListener('pointerup', onPointerUp);\n      }\n    };\n  }, [type, disabled, onPointerDown, onPointerMove, onPointerUp]);\n\n  return <group>{children}</group>;\n};\n","import React, {\n  FC,\n  forwardRef,\n  ReactNode,\n  Ref,\n  Suspense,\n  useImperativeHandle,\n  useRef,\n  useMemo\n} from 'react';\nimport { Canvas } from '@react-three/fiber';\nimport { GraphScene } from '../GraphScene';\nimport type { GraphSceneProps, GraphSceneRef } from '../GraphScene';\nimport { CameraControls } from '../CameraControls';\nimport type { CameraMode, CameraControlsRef } from '../CameraControls';\nimport { Theme, lightTheme } from '../themes';\nimport { createStore, Provider } from '../store';\nimport Graph from 'graphology';\nimport { Lasso } from '../selection/Lasso';\nimport type { LassoType } from '../selection/Lasso';\nimport ThreeCameraControls from 'camera-controls';\nimport css from './GraphCanvas.module.css';\n\nexport interface GraphCanvasProps extends Omit<GraphSceneProps, 'theme'> {\n  /**\n   * Theme to use for the graph.\n   */\n  theme?: Theme;\n\n  /**\n   * Type of camera interaction.\n   */\n  cameraMode?: CameraMode;\n\n  /**\n   * The maximum distance for the camera. Default is 50000.\n   */\n  maxDistance?: number;\n\n  /**\n   * The minimum distance for the camera. Default is 1000.\n   */\n  minDistance?: number;\n\n  /**\n   * The type of lasso selection.\n   */\n  lassoType?: LassoType;\n\n  /**\n   * Children to render in the canvas. Useful for things like lights.\n   */\n  children?: ReactNode;\n\n  /**\n   * Ability to extend Cavas gl options. For example { preserveDrawingBuffer: true }\n   */\n  glOptions?: Object;\n\n  /**\n   * When the canvas had a lasso selection.\n   */\n  onLasso?: (selections: string[]) => void;\n\n  /**\n   * When the canvas had a lasso selection end.\n   */\n  onLassoEnd?: (selections: string[]) => void;\n\n  /**\n   * When the canvas was clicked but didn't hit a node/edge.\n   */\n  onCanvasClick?: (event: MouseEvent) => void;\n}\n\nexport type GraphCanvasRef = Omit<GraphSceneRef, 'graph' | 'renderScene'> &\n  Omit<CameraControlsRef, 'controls'> & {\n    /**\n     * Get the graph object.\n     */\n    getGraph: () => Graph;\n\n    /**\n     * Get the camera controls.\n     */\n    getControls: () => ThreeCameraControls;\n\n    /**\n     * Export the canvas as a data URL.\n     */\n    exportCanvas: () => string;\n  };\n\nconst GL_DEFAULTS = {\n  alpha: true,\n  antialias: true\n};\n\n// TODO: Fix type\nconst CAMERA_DEFAULTS: any = {\n  position: [0, 0, 1000],\n  near: 5,\n  far: 50000,\n  fov: 10\n};\n\nexport const GraphCanvas: FC<GraphCanvasProps & { ref?: Ref<GraphCanvasRef> }> =\n  forwardRef(\n    (\n      {\n        cameraMode = 'pan',\n        layoutType = 'forceDirected2d',\n        sizingType = 'default',\n        labelType = 'auto',\n        theme = lightTheme,\n        animated = true,\n        defaultNodeSize = 7,\n        minNodeSize = 5,\n        maxNodeSize = 15,\n        lassoType = 'none',\n        glOptions = {},\n        edges,\n        children,\n        nodes,\n        minDistance,\n        maxDistance,\n        onCanvasClick,\n        disabled,\n        onLasso,\n        onLassoEnd,\n        ...rest\n      },\n      ref: Ref<GraphCanvasRef>\n    ) => {\n      const rendererRef = useRef<GraphSceneRef | null>(null);\n      const controlsRef = useRef<CameraControlsRef | null>(null);\n      const canvasRef = useRef<HTMLCanvasElement | null>(null);\n\n      useImperativeHandle(ref, () => ({\n        centerGraph: (nodeIds, opts) =>\n          rendererRef.current?.centerGraph(nodeIds, opts),\n        fitNodesInView: (nodeIds, opts) =>\n          rendererRef.current?.fitNodesInView(nodeIds, opts),\n        zoomIn: () => controlsRef.current?.zoomIn(),\n        zoomOut: () => controlsRef.current?.zoomOut(),\n        dollyIn: distance => controlsRef.current?.dollyIn(distance),\n        dollyOut: distance => controlsRef.current?.dollyOut(distance),\n        panLeft: () => controlsRef.current?.panLeft(),\n        panRight: () => controlsRef.current?.panRight(),\n        panDown: () => controlsRef.current?.panDown(),\n        panUp: () => controlsRef.current?.panUp(),\n        resetControls: (animated?: boolean) =>\n          controlsRef.current?.resetControls(animated),\n        getControls: () => controlsRef.current?.controls,\n        getGraph: () => rendererRef.current?.graph,\n        exportCanvas: () => {\n          rendererRef.current.renderScene();\n          return canvasRef.current.toDataURL();\n        },\n        freeze: () => controlsRef.current?.freeze(),\n        unFreeze: () => controlsRef.current?.unFreeze()\n      }));\n\n      // Defaults to pass to the store\n      const { selections, actives, collapsedNodeIds } = rest;\n\n      // It's pretty hard to get good animation performance with large n of edges/nodes\n      const finalAnimated =\n        edges.length + nodes.length > 400 ? false : animated;\n\n      const gl = useMemo(() => ({ ...glOptions, ...GL_DEFAULTS }), [glOptions]);\n      // zustand/context migration (https://github.com/pmndrs/zustand/discussions/1180)\n      const store = useRef(\n        createStore({\n          selections,\n          actives,\n          theme,\n          collapsedNodeIds\n        })\n      ).current;\n\n      // NOTE: The legacy/linear/flat flags are for color issues\n      // Reference: https://github.com/protectwise/troika/discussions/213#discussioncomment-3086666\n      return (\n        <div className={css.canvas}>\n          <Canvas\n            legacy\n            linear\n            ref={canvasRef}\n            flat\n            gl={gl}\n            camera={CAMERA_DEFAULTS}\n            onPointerMissed={onCanvasClick}\n          >\n            <Provider store={store}>\n              {theme.canvas?.background && (\n                <color attach=\"background\" args={[theme.canvas.background]} />\n              )}\n              <ambientLight intensity={1} />\n              {children}\n              {theme.canvas?.fog && (\n                <fog attach=\"fog\" args={[theme.canvas.fog, 4000, 9000]} />\n              )}\n              <CameraControls\n                mode={cameraMode}\n                ref={controlsRef}\n                disabled={disabled}\n                minDistance={minDistance}\n                maxDistance={maxDistance}\n                animated={animated}\n              >\n                <Lasso\n                  disabled={disabled}\n                  type={lassoType}\n                  onLasso={onLasso}\n                  onLassoEnd={onLassoEnd}\n                >\n                  <Suspense>\n                    <GraphScene\n                      ref={rendererRef as any}\n                      disabled={disabled}\n                      animated={finalAnimated}\n                      edges={edges}\n                      nodes={nodes}\n                      layoutType={layoutType}\n                      sizingType={sizingType}\n                      labelType={labelType}\n                      defaultNodeSize={defaultNodeSize}\n                      minNodeSize={minNodeSize}\n                      maxNodeSize={maxNodeSize}\n                      {...rest}\n                    />\n                  </Suspense>\n                </Lasso>\n              </CameraControls>\n            </Provider>\n          </Canvas>\n        </div>\n      );\n    }\n  );\n","import React, {\n  RefObject,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState\n} from 'react';\nimport { isNotEditableElement } from '../utils/dom';\nimport { GraphCanvasRef } from '../GraphCanvas';\nimport { GraphEdge, GraphNode } from '../types';\nimport { findPath } from '../utils/paths';\nimport { getAdjacents, PathSelectionTypes } from './utils';\n\nexport type HotkeyTypes = 'selectAll' | 'deselect' | 'delete';\n\nexport type SelectionTypes = 'single' | 'multi' | 'multiModifier';\n\nexport interface SelectionProps {\n  /**\n   * Required ref for the graph.\n   */\n  ref: RefObject<GraphCanvasRef | null>;\n\n  /**\n   * Current selections.\n   *\n   * Contains both nodes and edges ids.\n   */\n  selections?: string[];\n\n  /**\n   * Default active selections.\n   */\n  actives?: string[];\n\n  /**\n   * Node datas.\n   */\n  nodes?: GraphNode[];\n\n  /**\n   * Edge datas.\n   */\n  edges?: GraphEdge[];\n\n  /**\n   * Disabled or not.\n   */\n  disabled?: boolean;\n\n  /**\n   * Whether to focus on select or not.\n   */\n  focusOnSelect?: boolean | 'singleOnly';\n\n  /**\n   * Type of selection.\n   */\n  type?: SelectionTypes;\n\n  /**\n   * Type of selection.\n   */\n  pathSelectionType?: PathSelectionTypes;\n\n  /**\n   * Whether it should active on hover or not.\n   */\n  pathHoverType?: PathSelectionTypes;\n\n  /**\n   * On selection change.\n   */\n  onSelection?: (selectionIds: string[]) => void;\n}\n\nexport interface SelectionResult {\n  /**\n   * Selections id array (of nodes and edges).\n   */\n  selections: string[];\n\n  /**\n   * The nodes/edges around the selections to highlight.\n   */\n  actives: string[];\n\n  /**\n   * Clear selections method.\n   */\n  clearSelections: (value?: string[]) => void;\n\n  /**\n   * A selection method.\n   */\n  addSelection: (value: string) => void;\n\n  /**\n   * Get the paths between two nodes.\n   */\n  selectNodePaths: (source: string, target: string) => void;\n\n  /**\n   * Remove selection method.\n   */\n  removeSelection: (value: string) => void;\n\n  /**\n   * Toggle existing selection on/off method.\n   */\n  toggleSelection: (value: string) => void;\n\n  /**\n   * Set internal selections.\n   */\n  setSelections: (value: string[]) => void;\n\n  /**\n   * On click event pass through.\n   */\n  onNodeClick?: (data: GraphNode) => void;\n\n  /**\n   * On canvas click event pass through.\n   */\n  onCanvasClick?: (event: MouseEvent) => void;\n\n  /**\n   * When the lasso happened.\n   */\n  onLasso?: (selections: string[]) => void;\n\n  /**\n   * When the lasso ended.\n   */\n  onLassoEnd?: (selections: string[]) => void;\n\n  /**\n   * When node got a pointer over.\n   */\n  onNodePointerOver?: (node: GraphNode) => void;\n\n  /**\n   * When node lost pointer over.\n   */\n  onNodePointerOut?: (node: GraphNode) => void;\n}\n\nexport const useSelection = ({\n  selections = [],\n  nodes = [],\n  actives = [],\n  focusOnSelect = true,\n  type = 'single',\n  pathHoverType = 'out',\n  pathSelectionType = 'direct',\n  ref,\n  disabled,\n  onSelection\n}: SelectionProps): SelectionResult => {\n  const [internalHovers, setInternalHovers] = useState<string[]>([]);\n  const [internalActives, setInternalActives] = useState<string[]>(actives);\n  const [internalSelections, setInternalSelections] =\n    useState<string[]>(selections);\n  const [metaKeyDown, setMetaKeyDown] = useState<boolean>(false);\n  const isMulti = type === 'multi' || type === 'multiModifier';\n\n  const addSelection = useCallback(\n    (items: string | string[]) => {\n      if (!disabled && items) {\n        items = Array.isArray(items) ? items : [items];\n\n        const filtered = items.filter(\n          item => !internalSelections.includes(item)\n        );\n        if (filtered.length) {\n          const next = [...internalSelections, ...filtered];\n          onSelection?.(next);\n          setInternalSelections(next);\n        }\n      }\n    },\n    [disabled, internalSelections, onSelection]\n  );\n\n  const removeSelection = useCallback(\n    (items: string | string[]) => {\n      if (!disabled && items) {\n        items = Array.isArray(items) ? items : [items];\n\n        const next = internalSelections.filter(i => !items.includes(i));\n        onSelection?.(next);\n        setInternalSelections(next);\n      }\n    },\n    [disabled, internalSelections, onSelection]\n  );\n\n  const clearSelections = useCallback(\n    (next: string | string[] = []) => {\n      if (!disabled) {\n        next = Array.isArray(next) ? next : [next];\n        setInternalActives([]);\n        setInternalSelections(next);\n        onSelection?.(next);\n      }\n    },\n    [disabled, onSelection]\n  );\n\n  const toggleSelection = useCallback(\n    (item: string) => {\n      const has = internalSelections.includes(item);\n      if (has) {\n        removeSelection(item);\n      } else {\n        if (!isMulti) {\n          clearSelections(item);\n        } else {\n          addSelection(item);\n        }\n      }\n    },\n    [\n      addSelection,\n      clearSelections,\n      internalSelections,\n      isMulti,\n      removeSelection\n    ]\n  );\n\n  const onNodeClick = useCallback(\n    (data: GraphNode) => {\n      if (isMulti) {\n        if (type === 'multiModifier') {\n          if (metaKeyDown) {\n            addSelection(data.id);\n          } else {\n            clearSelections(data.id);\n          }\n        } else {\n          addSelection(data.id);\n        }\n      } else {\n        clearSelections(data.id);\n      }\n\n      if (\n        focusOnSelect === true ||\n        (focusOnSelect === 'singleOnly' && !metaKeyDown)\n      ) {\n        if (!ref.current) {\n          throw new Error('No ref found for the graph canvas.');\n        }\n\n        const graph = ref.current.getGraph();\n        const { nodes: adjacents } = getAdjacents(\n          graph,\n          [data.id],\n          pathSelectionType\n        );\n\n        ref.current.fitNodesInView([data.id, ...adjacents], {\n          fitOnlyIfNodesNotInView: true\n        });\n      }\n    },\n    [\n      addSelection,\n      clearSelections,\n      focusOnSelect,\n      isMulti,\n      metaKeyDown,\n      pathSelectionType,\n      ref,\n      type\n    ]\n  );\n\n  const selectNodePaths = useCallback(\n    (source: string, target: string) => {\n      const graph = ref.current.getGraph();\n      if (!graph) {\n        throw new Error('Graph is not initialized');\n      }\n\n      const path = findPath(graph, source, target);\n      clearSelections([source, target]);\n\n      const result = [];\n      for (let i = 0; i < path.length - 1; i++) {\n        const from = path[i];\n        const to = path[i + 1];\n        const edge = graph.getEdgeAttributes(from, to);\n        if (edge) {\n          result.push(edge.id);\n        }\n      }\n\n      setInternalActives([...path.map(p => p as string), ...result]);\n    },\n    [clearSelections, ref]\n  );\n\n  const onKeyDown = useCallback((event: KeyboardEvent) => {\n    const element = event.target as HTMLElement;\n    const isSafe = isNotEditableElement(element);\n    const isMeta = event.metaKey || event.ctrlKey;\n\n    if (isSafe && isMeta) {\n      setMetaKeyDown(true);\n    }\n  }, []);\n\n  const onKeyUp = useCallback((event: KeyboardEvent) => {\n    const element = event.target as HTMLElement;\n    const isSafe = isNotEditableElement(element);\n    const isMeta = ['Meta', 'Control'].includes(event.key);\n\n    if (isSafe && isMeta) {\n      setMetaKeyDown(false);\n    }\n  }, []);\n\n  useEffect(() => {\n    if (typeof window !== 'undefined') {\n      window.addEventListener('keydown', onKeyDown);\n      window.addEventListener('keyup', onKeyUp);\n    }\n\n    return () => {\n      if (typeof window !== 'undefined') {\n        window.removeEventListener('keydown', onKeyDown);\n        window.removeEventListener('keyup', onKeyUp);\n      }\n    };\n  }, [onKeyDown, onKeyUp]);\n\n  const onCanvasClick = useCallback(\n    (event: MouseEvent) => {\n      if (\n        event.button !== 2 &&\n        (internalSelections.length || internalActives.length)\n      ) {\n        clearSelections();\n        setMetaKeyDown(false);\n\n        // Only re-center if we have a single selection\n        if (focusOnSelect && internalSelections.length === 1) {\n          if (!ref.current) {\n            throw new Error('No ref found for the graph canvas.');\n          }\n\n          ref.current.fitNodesInView([], { fitOnlyIfNodesNotInView: true });\n        }\n      }\n    },\n    [\n      clearSelections,\n      focusOnSelect,\n      internalActives.length,\n      internalSelections.length,\n      ref\n    ]\n  );\n\n  const onLasso = useCallback((selections: string[]) => {\n    setInternalActives(selections);\n  }, []);\n\n  const onLassoEnd = useCallback(\n    (selections: string[]) => {\n      clearSelections(selections);\n    },\n    [clearSelections]\n  );\n\n  const onNodePointerOver = useCallback(\n    (data: GraphNode) => {\n      if (pathHoverType) {\n        const graph = ref.current.getGraph();\n        if (!graph) {\n          throw new Error('No ref found for the graph canvas.');\n        }\n\n        const { nodes, edges } = getAdjacents(graph, [data.id], pathHoverType);\n        setInternalHovers([...nodes, ...edges]);\n      }\n    },\n    [pathHoverType, ref]\n  );\n\n  const onNodePointerOut = useCallback(() => {\n    if (pathHoverType) {\n      setInternalHovers([]);\n    }\n  }, [pathHoverType]);\n\n  useEffect(() => {\n    if (pathSelectionType !== 'direct' && internalSelections.length > 0) {\n      const graph = ref.current?.getGraph();\n      if (graph) {\n        const { nodes, edges } = getAdjacents(\n          graph,\n          internalSelections,\n          pathSelectionType\n        );\n        setInternalActives([...nodes, ...edges]);\n      }\n    }\n  }, [internalSelections, pathSelectionType, ref]);\n\n  const joinedActives = useMemo(\n    () => [...internalActives, ...internalHovers],\n    [internalActives, internalHovers]\n  );\n\n  return {\n    actives: joinedActives,\n    onNodeClick,\n    onNodePointerOver,\n    onNodePointerOut,\n    onLasso,\n    onLassoEnd,\n    selectNodePaths,\n    onCanvasClick,\n    selections: internalSelections,\n    clearSelections,\n    addSelection,\n    removeSelection,\n    toggleSelection,\n    setSelections: setInternalSelections\n  };\n};\n","import classNames from 'classnames';\nimport React, { FC, ReactNode } from 'react';\nimport css from './RadialSlice.module.css';\n\nexport interface MenuItem {\n  /**\n   * Label to display on the menu item.\n   */\n  label: string;\n\n  /**\n   * CSS Classname to apply to the slice.\n   */\n  className?: string;\n\n  /**\n   * Optional icon to display on the menu item.\n   */\n  icon?: ReactNode;\n\n  /**\n   * Optional callback to detemine if the menu item is active.\n   */\n  disabled?: boolean;\n\n  /**\n   * Optional callback to handle when the menu item is clicked.\n   */\n  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\ninterface RadialSliceProps extends MenuItem {\n  /**\n   * The starting angle of the radial slice, in degrees.\n   */\n  startAngle: number;\n\n  /**\n   * The ending angle of the radial slice, in degrees.\n   */\n  endAngle: number;\n\n  /**\n   * The skew of the radial slice.\n   */\n  skew: number;\n\n  /**\n   * Whether the radial slice is polar (true) or not (false).\n   */\n  polar: boolean;\n\n  /**\n   * The central angle of the radial slice, in degrees.\n   */\n  centralAngle: number;\n\n  /**\n   * The radius of the radial slice.\n   */\n  radius: number;\n\n  /**\n   * The inner radius of the radial slice.\n   */\n  innerRadius: number;\n}\n\nexport const RadialSlice: FC<RadialSliceProps> = ({\n  label,\n  centralAngle,\n  startAngle,\n  endAngle,\n  polar,\n  radius,\n  className,\n  icon,\n  innerRadius,\n  skew,\n  disabled,\n  onClick\n}) => (\n  <div\n    role=\"menuitem\"\n    className={classNames(css.container, className, {\n      [css.disabled]: disabled\n    })}\n    style={{\n      width: centralAngle > 90 ? '100%' : '50%',\n      height: centralAngle > 90 ? '100%' : '50%',\n      bottom: centralAngle > 90 ? '50%' : 'initial',\n      right: centralAngle > 90 ? '50%' : 'initial',\n      transform: `rotate(${startAngle + endAngle}deg) skew(${skew}deg)`\n    }}\n    onClick={event => {\n      if (!disabled) {\n        onClick(event);\n      }\n    }}\n  >\n    <div\n      className={css.contentContainer}\n      style={{\n        transform: `skew(${-skew}deg) rotate(${\n          (polar ? 90 : centralAngle) / 2 - 90\n        }deg)`\n      }}\n    >\n      <div\n        className={css.contentInner}\n        style={{\n          top: `calc((((${\n            centralAngle > 90 ? '50% + ' : ''\n          }${radius}px) - ${innerRadius}px) / 2) - 4em)`\n        }}\n      >\n        <div\n          className={css.content}\n          style={{\n            transform: `rotate(${-endAngle}deg)`\n          }}\n          title={label}\n        >\n          {icon}\n          {label}\n        </div>\n      </div>\n    </div>\n  </div>\n);\n","import { MenuItem } from './RadialSlice';\n\nexport function calculateRadius(items: MenuItem[], startOffsetAngle: number) {\n  const centralAngle = 360 / items.length || 360;\n  const polar = centralAngle % 180 === 0;\n  const deltaAngle = 90 - centralAngle;\n  const startAngle = polar\n    ? 45\n    : startOffsetAngle + deltaAngle + centralAngle / 2;\n\n  return { centralAngle, polar, startAngle, deltaAngle };\n}\n","import React, { FC, useLayoutEffect, useMemo, useRef } from 'react';\nimport { RadialSlice, MenuItem } from './RadialSlice';\nimport { calculateRadius } from './utils';\nimport css from './RadialMenu.module.css';\nimport classNames from 'classnames';\n\ninterface RadialMenuProps {\n  /**\n   * An array of menu items to be displayed in the radial menu.\n   */\n  items: MenuItem[];\n\n  /**\n   * The radius of the radial menu.\n   */\n  radius?: number;\n\n  /**\n   * The inner radius of the radial menu.\n   */\n  innerRadius?: number;\n\n  /**\n   * The starting offset angle for the first menu item.\n   */\n  startOffsetAngle?: number;\n\n  /**\n   * The CSS class name for the radial menu.\n   */\n  className?: string;\n\n  /**\n   * A function that is called when the radial menu is closed.\n   * The function receives the mouse event that triggered the closure.\n   */\n  onClose?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\nexport const RadialMenu: FC<RadialMenuProps> = ({\n  items,\n  radius = 175,\n  className,\n  innerRadius = 25,\n  startOffsetAngle = 0,\n  onClose\n}) => {\n  const { centralAngle, polar, startAngle, deltaAngle } = useMemo(\n    () => calculateRadius(items, startOffsetAngle),\n    [items, startOffsetAngle]\n  );\n  const timeout = useRef<any | null>(null);\n\n  useLayoutEffect(() => {\n    const timer = timeout.current;\n    return () => clearTimeout(timer);\n  }, []);\n\n  if (items.length === 0) {\n    return null;\n  }\n\n  return (\n    <div\n      role=\"menu\"\n      className={classNames(css.container, className)}\n      onPointerEnter={() => clearTimeout(timeout.current)}\n      onPointerLeave={event => {\n        clearTimeout(timeout.current);\n        timeout.current = setTimeout(() => onClose?.(event), 500);\n      }}\n    >\n      {items.map((slice, index) => (\n        <RadialSlice\n          key={index}\n          {...slice}\n          radius={radius}\n          innerRadius={innerRadius}\n          startAngle={startAngle}\n          endAngle={centralAngle * index}\n          skew={polar ? 0 : deltaAngle}\n          polar={polar}\n          centralAngle={centralAngle}\n          onClick={event => {\n            slice?.onClick(event);\n            onClose?.(event);\n          }}\n        />\n      ))}\n    </div>\n  );\n};\n"],"names":["d3ForceRadial","nodes","links","treemap","hierarchy","_b","_a","forceSimulation","forceX","forceY","forceCollide","forceManyBody","forceLink","d3ForceX","d3ForceY","d3ForceSimulation","d3ForceCenter","d3ForceLink","d3ForceManyBody","d3ForceZ","stratify","tree","degreeCentrality","scaleLinear","n","Vector3","QuadraticBezierCurve3","LineCurve3","bidirectional","create","theme","actives","selections","id","node","createContext","useContext","useZustandStore","useShallow","useCallback","useRef","useThree","useEffect","drags","useMemo","Color","Billboard","jsx","Text","Vector2","Plane","useGesture","disabled","Ring","useSpring","jsxs","Fragment","a","DoubleSide","useState","useCursor","_c","curve","TubeGeometry","Edge","arrowPosition","arrowRotation","Euler","_d","Html","BoxGeometry","CylinderGeometry","Quaternion","mergeBufferGeometries","BufferAttribute","active","inactive","draggingActive","draggingInactive","edgeMeshes","Mesh","useFrame","TextureLoader","LinearFilter","DreiSvg","animated","Box3","useLayoutEffect","forwardRef","useImperativeHandle","MOUSE","Vector4","Matrix4","Spherical","Sphere","Raycaster","MathUtils","extend","holdEvent","ref","SelectionBox","Scene","css","Canvas","Suspense"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,WAAS,cAAc,OAAoB,YAAyB,IAAI;AACtE,UAAM,eAAe,UAAU;AAE/B,eAAW,QAAQ,OAAO;AAClB,YAAA,MAAM,UAAU,QAAQ,IAAI;AAClC,UAAI,MAAM,IAAI;AACZ,cAAM,OAAO,CAAC,GAAG,UAAU,MAAM,GAAG,GAAG,IAAI,EAAE,IAAI,CAAK,MAAA,EAAE,KAAK,EAAE;AAC/D,cAAM,IAAI;AAAA,UACR,+CAA+C,KAAK,KAAK,MAAM,CAAC;AAAA,QAClE;AAAA,MAAA;AAGE,UAAA,eAAe,KAAK,OAAO;AAC7B,aAAK,QAAQ;AACb,sBAAc,KAAK,KAAK,CAAC,GAAG,WAAW,IAAI,CAAC;AAAA,MAAA;AAAA,IAC9C;AAAA,EAEJ;AAKgB,WAAA,aACd,OACA,OACA;AACA,QAAI,UAAU;AAEd,UAAM,QAAsC,MAAM;AAAA,MAChD,CAAC,KAAK,SAAS;AAAA,QACb,GAAG;AAAA,QACH,CAAC,IAAI,EAAE,GAAG;AAAA,UACR,MAAM;AAAA,UACN,KAAK,CAAC;AAAA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