import { u as h } from "./chunk-5PVQY5BW.js";
import { n as o, r as s } from "./chunk-AGHRB4JF.js";
import { s as u, y } from "./chunk-ICPOFSXX.js";
import { a as w, i as F, s as $ } from "./chunk-5FUZZQ4R.js";
import { a as D, i as v, n as x, r as A } from "./chunk-ENJZ2VHE.js";
var I = {
  common: u,
  getConfig: y,
  insertCluster: F,
  insertEdge: x,
  insertEdgeLabel: A,
  insertMarkers: v,
  insertNode: w,
  interpolateToCurve: h,
  labelHelper: $,
  log: s,
  positionEdgeLabel: D
}, a = {}, E = /* @__PURE__ */ o((t) => {
  for (const r of t) a[r.name] = r;
}, "registerLayoutLoaders");
(/* @__PURE__ */ o(() => {
  E([{
    name: "dagre",
    loader: /* @__PURE__ */ o(async () => await import("./dagre-KV5264BT.js"), "loader")
  }, {
    name: "cose-bilkent",
    loader: /* @__PURE__ */ o(async () => await import("./cose-bilkent-S5V4N54A.js"), "loader")
  }]);
}, "registerDefaultLayoutLoaders"))();
var B = /* @__PURE__ */ o(async (t, r) => {
  if (!(t.layoutAlgorithm in a)) throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);
  if (t.diagramId) for (const e of t.nodes) {
    const c = e.domId || e.id;
    e.domId = `${t.diagramId}-${c}`;
  }
  const i = a[t.layoutAlgorithm], l = await i.loader(), { theme: n, themeVariables: p } = t.config, { useGradient: m, gradientStart: g, gradientStop: f } = p, d = r.attr("id");
  if (r.append("defs").append("filter").attr("id", `${d}-drop-shadow`).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${n?.includes("dark") ? "#FFFFFF" : "#000000"}`), r.append("defs").append("filter").attr("id", `${d}-drop-shadow-small`).attr("height", "150%").attr("width", "150%").append("feDropShadow").attr("dx", "2").attr("dy", "2").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${n?.includes("dark") ? "#FFFFFF" : "#000000"}`), m) {
    const e = r.append("linearGradient").attr("id", r.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
    e.append("svg:stop").attr("offset", "0%").attr("stop-color", g).attr("stop-opacity", 1), e.append("svg:stop").attr("offset", "100%").attr("stop-color", f).attr("stop-opacity", 1);
  }
  return l.render(t, r, I, { algorithm: i.algorithm });
}, "render"), C = /* @__PURE__ */ o((t = "", { fallback: r = "dagre" } = {}) => {
  if (t in a) return t;
  if (r in a)
    return s.warn(`Layout algorithm ${t} is not registered. Using ${r} as fallback.`), r;
  throw new Error(`Both layout algorithms ${t} and ${r} are not registered.`);
}, "getRegisteredLayoutAlgorithm");
export {
  E as n,
  B as r,
  C as t
};

//# sourceMappingURL=chunk-336JU56O.js.map