import { d as interpolateToCurve } from "./chunk-S3R3BYOJ-mQeCz5CE.js";
import { i as log, r as __name } from "./src-Bf2iLOlr.js";
import { s as common_default, y as getConfig, __tla as __tla_0 } from "./chunk-ABZYJK2D-D0cLy8Bb.js";
import { a as insertNode, i as insertCluster, s as labelHelper } from "./chunk-JZLCHNYA-BvsPHJmL.js";
import { a as positionEdgeLabel, i as markers_default, n as insertEdge, r as insertEdgeLabel } from "./chunk-QXUST7PY-DV8yRwBd.js";
let registerLayoutLoaders, render, getRegisteredLayoutAlgorithm;
let __tla = Promise.all([
  (() => {
    try {
      return __tla_0;
    } catch {
    }
  })()
]).then(async () => {
  let internalHelpers, layoutAlgorithms;
  internalHelpers = {
    common: common_default,
    getConfig,
    insertCluster,
    insertEdge,
    insertEdgeLabel,
    insertMarkers: markers_default,
    insertNode,
    interpolateToCurve,
    labelHelper,
    log,
    positionEdgeLabel
  };
  layoutAlgorithms = {};
  registerLayoutLoaders = __name((e) => {
    for (let h of e) layoutAlgorithms[h.name] = h;
  }, "registerLayoutLoaders");
  __name(() => {
    registerLayoutLoaders([
      {
        name: "dagre",
        loader: __name(async () => await import("./dagre-6UL2VRFP-DRBWoQUw.js"), "loader")
      },
      ...[
        {
          name: "cose-bilkent",
          loader: __name(async () => await import("./cose-bilkent-S5V4N54A-kjoZoid4.js"), "loader")
        }
      ]
    ]);
  }, "registerDefaultLayoutLoaders")();
  render = __name(async (e, h) => {
    if (!(e.layoutAlgorithm in layoutAlgorithms)) throw Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);
    let g = layoutAlgorithms[e.layoutAlgorithm];
    return (await g.loader()).render(e, h, internalHelpers, {
      algorithm: g.algorithm
    });
  }, "render");
  getRegisteredLayoutAlgorithm = __name((e = "", { fallback: g = "dagre" } = {}) => {
    if (e in layoutAlgorithms) return e;
    if (g in layoutAlgorithms) return log.warn(`Layout algorithm ${e} is not registered. Using ${g} as fallback.`), g;
    throw Error(`Both layout algorithms ${e} and ${g} are not registered.`);
  }, "getRegisteredLayoutAlgorithm");
});
export {
  __tla,
  registerLayoutLoaders as n,
  render as r,
  getRegisteredLayoutAlgorithm as t
};
