"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_mdts_frontend"] = self["webpackChunk_mdts_frontend"] || []).push([["vendors-node_modules_mermaid_dist_chunks_mermaid_core_chunk-RYQCIY6F_mjs"],{

/***/ "./node_modules/dagre-d3-es/src/graphlib/json.js"
/*!*******************************************************!*\
  !*** ./node_modules/dagre-d3-es/src/graphlib/json.js ***!
  \*******************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   read: () => (/* binding */ read),\n/* harmony export */   write: () => (/* binding */ write)\n/* harmony export */ });\n/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash-es */ \"./node_modules/lodash-es/forEach.js\");\n/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash-es */ \"./node_modules/lodash-es/clone.js\");\n/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash-es */ \"./node_modules/lodash-es/isUndefined.js\");\n/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash-es */ \"./node_modules/lodash-es/map.js\");\n/* harmony import */ var _graph_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./graph.js */ \"./node_modules/dagre-d3-es/src/graphlib/graph.js\");\n\n\n\n/**\n * @import { NodeID, EdgeObj, GraphOptions } from './graph.js';\n */\n\n\n\n/**\n * @template [GraphLabel=any] - Label of the graph.\n * @template [NodeLabel=any] - Label of a node.\n * @template [EdgeLabel=any] - Label of an edge.\n *\n * @typedef {object} GraphJSON\n * @property {Required<GraphOptions>} options - The options used to create the graph.\n * @property {Array<{ v: NodeID; value?: NodeLabel; parent?: NodeID }>} nodes - The nodes in the graph.\n * @property {Array<EdgeObj & { value?: EdgeLabel }>} edges - The edges in the graph.\n * @property {GraphLabel} [value] - The graph's value, if any.\n */\n\n/**\n * Creates a JSON representation of the graph that can be serialized to a\n * string with\n * [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).\n * The graph can later be restored using {@link read}.\n *\n * @example\n *\n * ```js\n * var g = new graphlib.Graph();\n * g.setNode(\"a\", { label: \"node a\" });\n * g.setNode(\"b\", { label: \"node b\" });\n * g.setEdge(\"a\", \"b\", { label: \"edge a->b\" });\n * graphlib.json.write(g);\n * // Returns the object:\n * //\n * // {\n * //   \"options\": {\n * //     \"directed\": true,\n * //     \"multigraph\": false,\n * //     \"compound\": false\n * //   },\n * //   \"nodes\": [\n * //     { \"v\": \"a\", \"value\": { \"label\": \"node a\" } },\n * //     { \"v\": \"b\", \"value\": { \"label\": \"node b\" } }\n * //   ],\n * //   \"edges\": [\n * //     { \"v\": \"a\", \"w\": \"b\", \"value\": { \"label\": \"edge a->b\" } }\n * //   ]\n * // }\n * ```\n *\n * @template [GraphLabel=any] - Label of the graph.\n * @template [NodeLabel=any] - Label of a node.\n * @template [EdgeLabel=any] - Label of an edge.\n * @param {Graph<GraphLabel, NodeLabel, EdgeLabel>} g - The graph to serialize.\n * @returns {GraphJSON<GraphLabel, NodeLabel, EdgeLabel>} The JSON representation of the graph.\n */\nfunction write(g) {\n  /** @type {GraphJSON<GraphLabel, NodeLabel, EdgeLabel>} */\n  var json = {\n    options: {\n      directed: g.isDirected(),\n      multigraph: g.isMultigraph(),\n      compound: g.isCompound(),\n    },\n    nodes: writeNodes(g),\n    edges: writeEdges(g),\n  };\n  if (!lodash_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"](g.graph())) {\n    json.value = lodash_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"](g.graph());\n  }\n  return json;\n}\n\n/**\n * @template NodeLabel - Label of a node.\n *\n * @param {Graph<unknown, NodeLabel, unknown>} g - The graph to serialize.\n * @returns {Array<{ v: NodeID; value?: NodeLabel; parent?: NodeID }>} The nodes in the graph.\n */\nfunction writeNodes(g) {\n  return lodash_es__WEBPACK_IMPORTED_MODULE_3__[\"default\"](g.nodes(), function (v) {\n    var nodeValue = g.node(v);\n    var parent = g.parent(v);\n    /** @type {{ v: NodeID; value?: NodeLabel; parent?: NodeID }} */\n    var node = { v: v };\n    if (!lodash_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"](nodeValue)) {\n      node.value = nodeValue;\n    }\n    if (!lodash_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"](parent)) {\n      node.parent = parent;\n    }\n    return node;\n  });\n}\n\n/**\n * @template EdgeLabel - Label of a node.\n *\n * @param {Graph<unknown, unknown, EdgeLabel>} g - The graph to serialize.\n * @returns {Array<EdgeObj & { value?: EdgeLabel }>} The edges in the graph.\n */\nfunction writeEdges(g) {\n  return lodash_es__WEBPACK_IMPORTED_MODULE_3__[\"default\"](g.edges(), function (e) {\n    var edgeValue = g.edge(e);\n    /** @type {EdgeObj & { value?: EdgeLabel }} */\n    var edge = { v: e.v, w: e.w };\n    if (!lodash_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"](e.name)) {\n      edge.name = e.name;\n    }\n    if (!lodash_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"](edgeValue)) {\n      edge.value = edgeValue;\n    }\n    return edge;\n  });\n}\n\n/**\n * Takes JSON as input and returns the graph representation.\n *\n * @example\n *\n * For example, if we have serialized the graph in {@link write}\n * to a string named `str`, we can restore it to a graph as follows:\n *\n * ```js\n * var g2 = graphlib.json.read(JSON.parse(str));\n * // or, in order to copy the graph\n * var g3 = graphlib.json.read(graphlib.json.write(g))\n *\n * g2.nodes();\n * // ['a', 'b']\n * g2.edges()\n * // [ { v: 'a', w: 'b' } ]\n * ```\n *\n * @template [GraphLabel=any] - Label of the graph.\n * @template [NodeLabel=any] - Label of a node.\n * @template [EdgeLabel=any] - Label of an edge.\n * @param {GraphJSON<GraphLabel, NodeLabel, EdgeLabel>} json - The JSON representation of the graph.\n * @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} The restored graph.\n */\nfunction read(json) {\n  var g = new _graph_js__WEBPACK_IMPORTED_MODULE_4__.Graph(json.options).setGraph(json.value);\n  lodash_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"](json.nodes, function (entry) {\n    g.setNode(entry.v, entry.value);\n    if (entry.parent) {\n      g.setParent(entry.v, entry.parent);\n    }\n  });\n  lodash_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"](json.edges, function (entry) {\n    g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);\n  });\n  return g;\n}\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/dagre-d3-es/src/graphlib/json.js?\n}");

/***/ },

/***/ "./node_modules/lodash-es/clone.js"
/*!*****************************************!*\
  !*** ./node_modules/lodash-es/clone.js ***!
  \*****************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _baseClone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_baseClone.js */ \"./node_modules/lodash-es/_baseClone.js\");\n\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\nfunction clone(value) {\n  return (0,_baseClone_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(value, CLONE_SYMBOLS_FLAG);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/lodash-es/clone.js?\n}");

/***/ },

/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/chunk-RYQCIY6F.mjs"
/*!**************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-RYQCIY6F.mjs ***!
  \**************************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   adjustClustersAndEdges: () => (/* binding */ adjustClustersAndEdges),\n/* harmony export */   clear: () => (/* binding */ clear),\n/* harmony export */   clusterDb: () => (/* binding */ clusterDb),\n/* harmony export */   findNonClusterChild: () => (/* binding */ findNonClusterChild),\n/* harmony export */   sortNodesByHierarchy: () => (/* binding */ sortNodesByHierarchy)\n/* harmony export */ });\n/* harmony import */ var _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-X3CZISLH.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-X3CZISLH.mjs\");\n/* harmony import */ var _chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-Y2CYZVJY.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-Y2CYZVJY.mjs\");\n/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3-es/src/graphlib/index.js */ \"./node_modules/dagre-d3-es/src/graphlib/index.js\");\n/* harmony import */ var dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dagre-d3-es/src/graphlib/json.js */ \"./node_modules/dagre-d3-es/src/graphlib/json.js\");\n\n\n\n// src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js\n\n\nvar clusterDb = /* @__PURE__ */ new Map();\nvar descendants = /* @__PURE__ */ new Map();\nvar parents = /* @__PURE__ */ new Map();\nvar clear = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)(() => {\n  descendants.clear();\n  parents.clear();\n  clusterDb.clear();\n}, \"clear\");\nvar isDescendant = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((id, ancestorId) => {\n  const ancestorDescendants = descendants.get(ancestorId) || [];\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.trace(\"In isDescendant\", ancestorId, \" \", id, \" = \", ancestorDescendants.includes(id));\n  return ancestorDescendants.includes(id);\n}, \"isDescendant\");\nvar edgeInCluster = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((edge, clusterId) => {\n  const clusterDescendants = descendants.get(clusterId) || [];\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Descendants of \", clusterId, \" is \", clusterDescendants);\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Edge is \", edge);\n  if (edge.v === clusterId || edge.w === clusterId) {\n    return false;\n  }\n  if (!clusterDescendants) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Tilt, \", clusterId, \",not in descendants\");\n    return false;\n  }\n  return clusterDescendants.includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || clusterDescendants.includes(edge.w);\n}, \"edgeInCluster\");\nvar copy = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((clusterId, graph, newGraph, rootId) => {\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n    \"Copying children of \",\n    clusterId,\n    \"root\",\n    rootId,\n    \"data\",\n    graph.node(clusterId),\n    rootId\n  );\n  const nodes = graph.children(clusterId) || [];\n  if (clusterId !== rootId) {\n    nodes.push(clusterId);\n  }\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Copying (nodes) clusterId\", clusterId, \"nodes\", nodes);\n  nodes.forEach((node) => {\n    if (graph.children(node).length > 0) {\n      copy(node, graph, newGraph, rootId);\n    } else {\n      const data = graph.node(node);\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"cp \", node, \" to \", rootId, \" with parent \", clusterId);\n      newGraph.setNode(node, data);\n      if (rootId !== graph.parent(node)) {\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Setting parent\", node, graph.parent(node));\n        newGraph.setParent(node, graph.parent(node));\n      }\n      if (clusterId !== rootId && node !== clusterId) {\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Setting parent\", node, clusterId);\n        newGraph.setParent(node, clusterId);\n      } else {\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"In copy \", clusterId, \"root\", rootId, \"data\", graph.node(clusterId), rootId);\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\n          \"Not Setting parent for node=\",\n          node,\n          \"cluster!==rootId\",\n          clusterId !== rootId,\n          \"node!==clusterId\",\n          node !== clusterId\n        );\n      }\n      const edges = graph.edges(node);\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Copying Edges\", edges);\n      edges.forEach((edge) => {\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Edge\", edge);\n        const data2 = graph.edge(edge.v, edge.w, edge.name);\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Edge data\", data2, rootId);\n        try {\n          if (edgeInCluster(edge, rootId)) {\n            const rootDescendants = descendants.get(rootId) || [];\n            const vIn = rootDescendants.includes(edge.v) || isDescendant(edge.v, rootId) || edge.v === rootId;\n            const wIn = rootDescendants.includes(edge.w) || isDescendant(edge.w, rootId) || edge.w === rootId;\n            if (vIn && wIn) {\n              _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Copying as \", edge.v, edge.w, data2, edge.name);\n              newGraph.setEdge(edge.v, edge.w, data2, edge.name);\n              _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"newGraph edges \", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));\n            } else {\n              const newV = vIn ? rootId : edge.v;\n              const newW = wIn ? rootId : edge.w;\n              _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\"Rebinding cross-boundary edge as \", newV, newW, data2, edge.name);\n              graph.setEdge(newV, newW, data2, edge.name);\n            }\n          } else {\n            _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.info(\n              \"Skipping copy of edge \",\n              edge.v,\n              \"-->\",\n              edge.w,\n              \" rootId: \",\n              rootId,\n              \" clusterId:\",\n              clusterId\n            );\n          }\n        } catch (e) {\n          _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.error(e);\n        }\n      });\n    }\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Removing node\", node);\n    graph.removeNode(node);\n  });\n}, \"copy\");\nvar extractDescendants = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((id, graph) => {\n  const children = graph.children(id);\n  let res = [...children];\n  for (const child of children) {\n    parents.set(child, id);\n    res = [...res, ...extractDescendants(child, graph)];\n  }\n  return res;\n}, \"extractDescendants\");\nvar findCommonEdges = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, id1, id2) => {\n  const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);\n  const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);\n  const edges1Prim = edges1.map((edge) => {\n    return { v: edge.v === id1 ? id2 : edge.v, w: edge.w === id1 ? id1 : edge.w };\n  });\n  const edges2Prim = edges2.map((edge) => {\n    return { v: edge.v, w: edge.w };\n  });\n  const result = edges1Prim.filter((edgeIn1) => {\n    return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);\n  });\n  return result;\n}, \"findCommonEdges\");\nvar findNonClusterChild = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((id, graph, clusterId) => {\n  const children = graph.children(id);\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.trace(\"Searching children of id \", id, children);\n  if (children.length < 1) {\n    return id;\n  }\n  let reserve;\n  for (const child of children) {\n    const _id = findNonClusterChild(child, graph, clusterId);\n    const commonEdges = findCommonEdges(graph, clusterId, _id);\n    if (_id) {\n      if (commonEdges.length > 0) {\n        reserve = _id;\n      } else {\n        return _id;\n      }\n    }\n  }\n  return reserve;\n}, \"findNonClusterChild\");\nvar getAnchorId = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((id) => {\n  if (!clusterDb.has(id)) {\n    return id;\n  }\n  if (!clusterDb.get(id).externalConnections) {\n    return id;\n  }\n  if (clusterDb.has(id)) {\n    return clusterDb.get(id).id;\n  }\n  return id;\n}, \"getAnchorId\");\nvar adjustClustersAndEdges = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, depth) => {\n  if (!graph || depth > 10) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Opting out, no graph \");\n    return;\n  } else {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Opting in, graph \");\n  }\n  graph.nodes().forEach(function(id) {\n    const children = graph.children(id);\n    if (children.length > 0) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n        \"Cluster identified\",\n        id,\n        \" Replacement id in edges: \",\n        findNonClusterChild(id, graph, id)\n      );\n      descendants.set(id, extractDescendants(id, graph));\n      clusterDb.set(id, { id: findNonClusterChild(id, graph, id), clusterData: graph.node(id) });\n    }\n  });\n  graph.nodes().forEach(function(id) {\n    const children = graph.children(id);\n    const edges = graph.edges();\n    if (children.length > 0) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Cluster identified\", id, descendants);\n      edges.forEach((edge) => {\n        const d1 = isDescendant(edge.v, id);\n        const d2 = isDescendant(edge.w, id);\n        if (d1 ^ d2) {\n          _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Edge: \", edge, \" leaves cluster \", id);\n          _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Descendants of XXX \", id, \": \", descendants.get(id));\n          clusterDb.get(id).externalConnections = true;\n        }\n      });\n    } else {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Not a cluster \", id, descendants);\n    }\n  });\n  for (let id of clusterDb.keys()) {\n    const nonClusterChild = clusterDb.get(id).id;\n    const parent = graph.parent(nonClusterChild);\n    if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) {\n      clusterDb.get(id).id = parent;\n    }\n    const hasDirectOutgoingEdge = graph.edges().some((edge) => edge.v === id);\n    if (nonClusterChild && clusterDb.get(id)?.externalConnections && hasDirectOutgoingEdge && isNodeInExtractableCluster(graph, nonClusterChild, id)) {\n      const safeAnchor = findSafeAnchorNode(graph, id, graph.parent(nonClusterChild));\n      if (safeAnchor) {\n        clusterDb.get(id).id = safeAnchor;\n      }\n    }\n  }\n  graph.edges().forEach(function(e) {\n    const edge = graph.edge(e);\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Edge \" + e.v + \" -> \" + e.w + \": \" + JSON.stringify(e));\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Edge \" + e.v + \" -> \" + e.w + \": \" + JSON.stringify(graph.edge(e)));\n    let v = e.v;\n    let w = e.w;\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n      \"Fix XXX\",\n      clusterDb,\n      \"ids:\",\n      e.v,\n      e.w,\n      \"Translating: \",\n      clusterDb.get(e.v),\n      \" --- \",\n      clusterDb.get(e.w)\n    );\n    if (clusterDb.get(e.v) || clusterDb.get(e.w)) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Fixing and trying - removing XXX\", e.v, e.w, e.name);\n      v = getAnchorId(e.v);\n      w = getAnchorId(e.w);\n      graph.removeEdge(e.v, e.w, e.name);\n      if (v !== e.v) {\n        const parent = graph.parent(v);\n        clusterDb.get(parent).externalConnections = true;\n        edge.fromCluster = e.v;\n      }\n      if (w !== e.w) {\n        const parent = graph.parent(w);\n        clusterDb.get(parent).externalConnections = true;\n        edge.toCluster = e.w;\n      }\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Fix Replacing with XXX\", v, w, e.name);\n      graph.setEdge(v, w, edge, e.name);\n    }\n  });\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Adjusted Graph\", dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_3__.write(graph));\n  extractor(graph, 0);\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.trace(clusterDb);\n}, \"adjustClustersAndEdges\");\nvar extractor = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, depth) => {\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"extractor - \", depth, dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_3__.write(graph), graph.children(\"D\"));\n  if (depth > 10) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.error(\"Bailing out\");\n    return;\n  }\n  let nodes = graph.nodes();\n  let hasChildren = false;\n  for (const node of nodes) {\n    const children = graph.children(node);\n    hasChildren = hasChildren || children.length > 0;\n  }\n  if (!hasChildren) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Done, no node has children\", graph.nodes());\n    return;\n  }\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Nodes = \", nodes, depth);\n  for (const node of nodes) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\n      \"Extracting node\",\n      node,\n      clusterDb,\n      clusterDb.has(node) && !clusterDb.get(node).externalConnections,\n      !graph.parent(node),\n      graph.node(node),\n      graph.children(\"D\"),\n      \" Depth \",\n      depth\n    );\n    if (!clusterDb.has(node)) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Not a cluster\", node, depth);\n    } else if (clusterDb.get(node)?.clusterData?.explicitDir && graph.children(node) && graph.children(node).length > 0) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Cluster with explicit dir, creating subgraph for children\", node, depth);\n      const dir = clusterDb.get(node).clusterData.dir;\n      const clusterGraph = new dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_2__.Graph({\n        multigraph: true,\n        compound: true\n      }).setGraph({\n        rankdir: dir,\n        nodesep: 50,\n        ranksep: 50,\n        marginx: 8,\n        marginy: 8\n      }).setDefaultEdgeLabel(function() {\n        return {};\n      });\n      copy(node, graph, clusterGraph, node);\n      const clusterNodeData = graph.node(node) || {};\n      graph.setNode(node, {\n        ...clusterNodeData,\n        clusterNode: true,\n        id: node,\n        clusterData: clusterDb.get(node).clusterData,\n        label: clusterDb.get(node).label,\n        graph: clusterGraph\n      });\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n        \"Subgraph for cluster with explicit dir created:\",\n        node,\n        dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_3__.write(clusterGraph)\n      );\n    } else if (!clusterDb.get(node).externalConnections && graph.children(node) && graph.children(node).length > 0) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n        \"Cluster without external connections, without a parent and with children\",\n        node,\n        depth\n      );\n      const graphSettings = graph.graph();\n      let dir = graphSettings.rankdir === \"TB\" ? \"LR\" : \"TB\";\n      if (clusterDb.get(node)?.clusterData?.dir) {\n        dir = clusterDb.get(node).clusterData.dir;\n        _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"Fixing dir\", clusterDb.get(node).clusterData.dir, dir);\n      }\n      const clusterGraph = new dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_2__.Graph({\n        multigraph: true,\n        compound: true\n      }).setGraph({\n        rankdir: dir,\n        nodesep: 50,\n        ranksep: 50,\n        marginx: 8,\n        marginy: 8\n      }).setDefaultEdgeLabel(function() {\n        return {};\n      });\n      copy(node, graph, clusterGraph, node);\n      const clusterNodeData = graph.node(node) || {};\n      graph.setNode(node, {\n        ...clusterNodeData,\n        clusterNode: true,\n        id: node,\n        clusterData: clusterDb.get(node).clusterData,\n        label: clusterDb.get(node).label,\n        graph: clusterGraph\n      });\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(\"Old graph after copy\", dagre_d3_es_src_graphlib_json_js__WEBPACK_IMPORTED_MODULE_3__.write(graph));\n    } else {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\n        \"Cluster ** \",\n        node,\n        \" **not meeting the criteria !externalConnections:\",\n        !clusterDb.get(node).externalConnections,\n        \" no parent: \",\n        !graph.parent(node),\n        \" children \",\n        graph.children(node) && graph.children(node).length > 0,\n        graph.children(\"D\"),\n        depth\n      );\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.debug(clusterDb);\n    }\n  }\n  nodes = graph.nodes();\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\"New list of nodes\", nodes);\n  for (const node of nodes) {\n    const data = graph.node(node);\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_0__.log.warn(\" Now next level\", node, data);\n    if (data?.clusterNode) {\n      extractor(data.graph, depth + 1);\n    }\n  }\n}, \"extractor\");\nvar sorter = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, nodes) => {\n  if (nodes.length === 0) {\n    return [];\n  }\n  let result = Object.assign([], nodes);\n  nodes.forEach((node) => {\n    const children = graph.children(node);\n    const sorted = sorter(graph, children);\n    result = [...result, ...sorted];\n  });\n  return result;\n}, \"sorter\");\nvar sortNodesByHierarchy = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph) => sorter(graph, graph.children()), \"sortNodesByHierarchy\");\nvar isNodeInExtractableCluster = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, node, rootId) => {\n  let parent = graph.parent(node);\n  while (parent && parent !== rootId) {\n    const cluster = clusterDb.get(parent);\n    if (cluster && !cluster.externalConnections) {\n      return true;\n    }\n    parent = graph.parent(parent);\n  }\n  return false;\n}, \"isNodeInExtractableCluster\");\nvar findSafeAnchorNode = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_1__.__name)((graph, clusterId, excludedCluster) => {\n  const children = graph.children(clusterId) ?? [];\n  for (const child of children) {\n    if (child === excludedCluster || isDescendant(child, excludedCluster)) {\n      continue;\n    }\n    const candidate = findNonClusterChild(child, graph, clusterId);\n    if (!candidate) {\n      continue;\n    }\n    if (!isNodeInExtractableCluster(graph, candidate, clusterId)) {\n      return candidate;\n    }\n  }\n  return null;\n}, \"findSafeAnchorNode\");\n\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/chunk-RYQCIY6F.mjs?\n}");

/***/ }

}]);