"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_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([["vendors-node_modules_mermaid_dist_chunks_mermaid_core_stateDiagram-FKZM4ZOC_mjs"],{

/***/ "../node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-FKZM4ZOC.mjs":
/*!**********************************************************************************!*\
  !*** ../node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-FKZM4ZOC.mjs ***!
  \**********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   diagram: () => (/* binding */ diagram)\n/* harmony export */ });\n/* harmony import */ var _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-DI55MBZ5.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-DI55MBZ5.mjs\");\n/* harmony import */ var _chunk_55IACEB6_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-55IACEB6.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-55IACEB6.mjs\");\n/* harmony import */ var _chunk_QN33PNHL_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-QN33PNHL.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-QN33PNHL.mjs\");\n/* harmony import */ var _chunk_N4CR4FBY_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunk-N4CR4FBY.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.mjs\");\n/* harmony import */ var _chunk_QXUST7PY_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunk-QXUST7PY.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.mjs\");\n/* harmony import */ var _chunk_HN2XXSSU_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chunk-HN2XXSSU.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-HN2XXSSU.mjs\");\n/* harmony import */ var _chunk_JZLCHNYA_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./chunk-JZLCHNYA.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.mjs\");\n/* harmony import */ var _chunk_CVBHYZKI_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./chunk-CVBHYZKI.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.mjs\");\n/* harmony import */ var _chunk_ATLVNIR6_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./chunk-ATLVNIR6.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-ATLVNIR6.mjs\");\n/* harmony import */ var _chunk_JA3XYJ7Z_mjs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./chunk-JA3XYJ7Z.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.mjs\");\n/* harmony import */ var _chunk_S3R3BYOJ_mjs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./chunk-S3R3BYOJ.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.mjs\");\n/* harmony import */ var _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./chunk-ABZYJK2D.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.mjs\");\n/* harmony import */ var _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./chunk-AGHRB4JF.mjs */ \"../node_modules/mermaid/dist/chunks/mermaid.core/chunk-AGHRB4JF.mjs\");\n/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! d3 */ \"../node_modules/d3/src/index.js\");\n/* harmony import */ var dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! dagre-d3-es/src/dagre/index.js */ \"../node_modules/dagre-d3-es/src/dagre/index.js\");\n/* harmony import */ var dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! dagre-d3-es/src/graphlib/index.js */ \"../node_modules/dagre-d3-es/src/graphlib/index.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// src/diagrams/state/stateRenderer.js\n\n\n\n\n// src/diagrams/state/shapes.js\n\nvar drawStartState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g) => g.append(\"circle\").attr(\"class\", \"start-state\").attr(\"r\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit).attr(\"cx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit).attr(\"cy\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit), \"drawStartState\");\nvar drawDivider = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g) => g.append(\"line\").style(\"stroke\", \"grey\").style(\"stroke-dasharray\", \"3\").attr(\"x1\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight).attr(\"class\", \"divider\").attr(\"x2\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight * 2).attr(\"y1\", 0).attr(\"y2\", 0), \"drawDivider\");\nvar drawSimpleState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g, stateDef) => {\n  const state = g.append(\"text\").attr(\"x\", 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"font-size\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.fontSize).attr(\"class\", \"state-title\").text(stateDef.id);\n  const classBox = state.node().getBBox();\n  g.insert(\"rect\", \":first-child\").attr(\"x\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"width\", classBox.width + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"height\", classBox.height + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"rx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.radius);\n  return state;\n}, \"drawSimpleState\");\nvar drawDescrState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g, stateDef) => {\n  const addTspan = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(textEl, txt, isFirst2) {\n    const tSpan = textEl.append(\"tspan\").attr(\"x\", 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).text(txt);\n    if (!isFirst2) {\n      tSpan.attr(\"dy\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight);\n    }\n  }, \"addTspan\");\n  const title = g.append(\"text\").attr(\"x\", 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight + 1.3 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"font-size\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.fontSize).attr(\"class\", \"state-title\").text(stateDef.descriptions[0]);\n  const titleBox = title.node().getBBox();\n  const titleHeight = titleBox.height;\n  const description = g.append(\"text\").attr(\"x\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\n    \"y\",\n    titleHeight + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding * 0.4 + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.dividerMargin + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight\n  ).attr(\"class\", \"state-description\");\n  let isFirst = true;\n  let isSecond = true;\n  stateDef.descriptions.forEach(function(descr) {\n    if (!isFirst) {\n      addTspan(description, descr, isSecond);\n      isSecond = false;\n    }\n    isFirst = false;\n  });\n  const descrLine = g.append(\"line\").attr(\"x1\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y1\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + titleHeight + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.dividerMargin / 2).attr(\"y2\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + titleHeight + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.dividerMargin / 2).attr(\"class\", \"descr-divider\");\n  const descrBox = description.node().getBBox();\n  const width = Math.max(descrBox.width, titleBox.width);\n  descrLine.attr(\"x2\", width + 3 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding);\n  g.insert(\"rect\", \":first-child\").attr(\"x\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"width\", width + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"height\", descrBox.height + titleHeight + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"rx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.radius);\n  return g;\n}, \"drawDescrState\");\nvar addTitleAndBox = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g, stateDef, altBkg) => {\n  const pad = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding;\n  const dblPad = 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding;\n  const orgBox = g.node().getBBox();\n  const orgWidth = orgBox.width;\n  const orgX = orgBox.x;\n  const title = g.append(\"text\").attr(\"x\", 0).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.titleShift).attr(\"font-size\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.fontSize).attr(\"class\", \"state-title\").text(stateDef.id);\n  const titleBox = title.node().getBBox();\n  const titleWidth = titleBox.width + dblPad;\n  let width = Math.max(titleWidth, orgWidth);\n  if (width === orgWidth) {\n    width = width + dblPad;\n  }\n  let startX;\n  const graphBox = g.node().getBBox();\n  if (stateDef.doc) {\n  }\n  startX = orgX - pad;\n  if (titleWidth > orgWidth) {\n    startX = (orgWidth - width) / 2 + pad;\n  }\n  if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {\n    startX = orgX - (titleWidth - orgWidth) / 2;\n  }\n  const lineY = 1 - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight;\n  g.insert(\"rect\", \":first-child\").attr(\"x\", startX).attr(\"y\", lineY).attr(\"class\", altBkg ? \"alt-composit\" : \"composit\").attr(\"width\", width).attr(\n    \"height\",\n    graphBox.height + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.titleShift + 1\n  ).attr(\"rx\", \"0\");\n  title.attr(\"x\", startX + pad);\n  if (titleWidth <= orgWidth) {\n    title.attr(\"x\", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);\n  }\n  g.insert(\"rect\", \":first-child\").attr(\"x\", startX).attr(\n    \"y\",\n    (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.titleShift - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding\n  ).attr(\"width\", width).attr(\"height\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight * 3).attr(\"rx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.radius);\n  g.insert(\"rect\", \":first-child\").attr(\"x\", startX).attr(\n    \"y\",\n    (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.titleShift - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding\n  ).attr(\"width\", width).attr(\"height\", graphBox.height + 3 + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.textHeight).attr(\"rx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.radius);\n  return g;\n}, \"addTitleAndBox\");\nvar drawEndState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g) => {\n  g.append(\"circle\").attr(\"class\", \"end-state-outer\").attr(\"r\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.miniPadding).attr(\n    \"cx\",\n    (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.miniPadding\n  ).attr(\n    \"cy\",\n    (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.miniPadding\n  );\n  return g.append(\"circle\").attr(\"class\", \"end-state-inner\").attr(\"r\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit).attr(\"cx\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit + 2).attr(\"cy\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.sizeUnit + 2);\n}, \"drawEndState\");\nvar drawForkJoinState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((g, stateDef) => {\n  let width = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.forkWidth;\n  let height = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.forkHeight;\n  if (stateDef.parentId) {\n    let tmp = width;\n    width = height;\n    height = tmp;\n  }\n  return g.append(\"rect\").style(\"stroke\", \"black\").style(\"fill\", \"black\").attr(\"width\", width).attr(\"height\", height).attr(\"x\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding);\n}, \"drawForkJoinState\");\nvar _drawLongText = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((_text, x, y, g) => {\n  let textHeight = 0;\n  const textElem = g.append(\"text\");\n  textElem.style(\"text-anchor\", \"start\");\n  textElem.attr(\"class\", \"noteText\");\n  let text = _text.replace(/\\r\\n/g, \"<br/>\");\n  text = text.replace(/\\n/g, \"<br/>\");\n  const lines = text.split(_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.common_default.lineBreakRegex);\n  let tHeight = 1.25 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.noteMargin;\n  for (const line2 of lines) {\n    const txt = line2.trim();\n    if (txt.length > 0) {\n      const span = textElem.append(\"tspan\");\n      span.text(txt);\n      if (tHeight === 0) {\n        const textBounds = span.node().getBBox();\n        tHeight += textBounds.height;\n      }\n      textHeight += tHeight;\n      span.attr(\"x\", x + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.noteMargin);\n      span.attr(\"y\", y + textHeight + 1.25 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.noteMargin);\n    }\n  }\n  return { textWidth: textElem.node().getBBox().width, textHeight };\n}, \"_drawLongText\");\nvar drawNote = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((text, g) => {\n  g.attr(\"class\", \"state-note\");\n  const note = g.append(\"rect\").attr(\"x\", 0).attr(\"y\", (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding);\n  const rectElem = g.append(\"g\");\n  const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);\n  note.attr(\"height\", textHeight + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.noteMargin);\n  note.attr(\"width\", textWidth + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.noteMargin * 2);\n  return note;\n}, \"drawNote\");\nvar drawState = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(elem, stateDef) {\n  const id = stateDef.id;\n  const stateInfo = {\n    id,\n    label: stateDef.id,\n    width: 0,\n    height: 0\n  };\n  const g = elem.append(\"g\").attr(\"id\", id).attr(\"class\", \"stateGroup\");\n  if (stateDef.type === \"start\") {\n    drawStartState(g);\n  }\n  if (stateDef.type === \"end\") {\n    drawEndState(g);\n  }\n  if (stateDef.type === \"fork\" || stateDef.type === \"join\") {\n    drawForkJoinState(g, stateDef);\n  }\n  if (stateDef.type === \"note\") {\n    drawNote(stateDef.note.text, g);\n  }\n  if (stateDef.type === \"divider\") {\n    drawDivider(g);\n  }\n  if (stateDef.type === \"default\" && stateDef.descriptions.length === 0) {\n    drawSimpleState(g, stateDef);\n  }\n  if (stateDef.type === \"default\" && stateDef.descriptions.length > 0) {\n    drawDescrState(g, stateDef);\n  }\n  const stateBox = g.node().getBBox();\n  stateInfo.width = stateBox.width + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding;\n  stateInfo.height = stateBox.height + 2 * (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding;\n  return stateInfo;\n}, \"drawState\");\nvar edgeCount = 0;\nvar drawEdge = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(elem, path, relation) {\n  const getRelationType = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(type) {\n    switch (type) {\n      case _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB.relationType.AGGREGATION:\n        return \"aggregation\";\n      case _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB.relationType.EXTENSION:\n        return \"extension\";\n      case _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB.relationType.COMPOSITION:\n        return \"composition\";\n      case _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB.relationType.DEPENDENCY:\n        return \"dependency\";\n    }\n  }, \"getRelationType\");\n  path.points = path.points.filter((p) => !Number.isNaN(p.y));\n  const lineData = path.points;\n  const lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_13__.line)().x(function(d) {\n    return d.x;\n  }).y(function(d) {\n    return d.y;\n  }).curve(d3__WEBPACK_IMPORTED_MODULE_13__.curveBasis);\n  const svgPath = elem.append(\"path\").attr(\"d\", lineFunction(lineData)).attr(\"id\", \"edge\" + edgeCount).attr(\"class\", \"transition\");\n  let url = \"\";\n  if ((0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.arrowMarkerAbsolute) {\n    url = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getUrl)(true);\n  }\n  svgPath.attr(\n    \"marker-end\",\n    \"url(\" + url + \"#\" + getRelationType(_chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB.relationType.DEPENDENCY) + \"End)\"\n  );\n  if (relation.title !== void 0) {\n    const label = elem.append(\"g\").attr(\"class\", \"stateLabel\");\n    const { x, y } = _chunk_S3R3BYOJ_mjs__WEBPACK_IMPORTED_MODULE_10__.utils_default.calcLabelPosition(path.points);\n    const rows = _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.common_default.getRows(relation.title);\n    let titleHeight = 0;\n    const titleRows = [];\n    let maxWidth = 0;\n    let minX = 0;\n    for (let i = 0; i <= rows.length; i++) {\n      const title = label.append(\"text\").attr(\"text-anchor\", \"middle\").text(rows[i]).attr(\"x\", x).attr(\"y\", y + titleHeight);\n      const boundsTmp = title.node().getBBox();\n      maxWidth = Math.max(maxWidth, boundsTmp.width);\n      minX = Math.min(minX, boundsTmp.x);\n      _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.info(boundsTmp.x, x, y + titleHeight);\n      if (titleHeight === 0) {\n        const titleBox = title.node().getBBox();\n        titleHeight = titleBox.height;\n        _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.info(\"Title height\", titleHeight, y);\n      }\n      titleRows.push(title);\n    }\n    let boxHeight = titleHeight * rows.length;\n    if (rows.length > 1) {\n      const heightAdj = (rows.length - 1) * titleHeight * 0.5;\n      titleRows.forEach((title, i) => title.attr(\"y\", y + i * titleHeight - heightAdj));\n      boxHeight = titleHeight * rows.length;\n    }\n    const bounds = label.node().getBBox();\n    label.insert(\"rect\", \":first-child\").attr(\"class\", \"box\").attr(\"x\", x - maxWidth / 2 - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding / 2).attr(\"y\", y - boxHeight / 2 - (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding / 2 - 3.5).attr(\"width\", maxWidth + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding).attr(\"height\", boxHeight + (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state.padding);\n    _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.info(bounds);\n  }\n  edgeCount++;\n}, \"drawEdge\");\n\n// src/diagrams/state/stateRenderer.js\nvar conf;\nvar transformationLog = {};\nvar setConf = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function() {\n}, \"setConf\");\nvar insertMarkers = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(elem) {\n  elem.append(\"defs\").append(\"marker\").attr(\"id\", \"dependencyEnd\").attr(\"refX\", 19).attr(\"refY\", 7).attr(\"markerWidth\", 20).attr(\"markerHeight\", 28).attr(\"orient\", \"auto\").append(\"path\").attr(\"d\", \"M 19,7 L9,13 L14,7 L9,1 Z\");\n}, \"insertMarkers\");\nvar draw = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)(function(text, id, _version, diagObj) {\n  conf = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().state;\n  const securityLevel = (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.getConfig2)().securityLevel;\n  let sandboxElement;\n  if (securityLevel === \"sandbox\") {\n    sandboxElement = (0,d3__WEBPACK_IMPORTED_MODULE_13__.select)(\"#i\" + id);\n  }\n  const root = securityLevel === \"sandbox\" ? (0,d3__WEBPACK_IMPORTED_MODULE_13__.select)(sandboxElement.nodes()[0].contentDocument.body) : (0,d3__WEBPACK_IMPORTED_MODULE_13__.select)(\"body\");\n  const doc = securityLevel === \"sandbox\" ? sandboxElement.nodes()[0].contentDocument : document;\n  _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Rendering diagram \" + text);\n  const diagram2 = root.select(`[id='${id}']`);\n  insertMarkers(diagram2);\n  const rootDoc = diagObj.db.getRootDoc();\n  renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);\n  const padding = conf.padding;\n  const bounds = diagram2.node().getBBox();\n  const width = bounds.width + padding * 2;\n  const height = bounds.height + padding * 2;\n  const svgWidth = width * 1.75;\n  (0,_chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.configureSvgSize)(diagram2, height, svgWidth, conf.useMaxWidth);\n  diagram2.attr(\n    \"viewBox\",\n    `${bounds.x - conf.padding}  ${bounds.y - conf.padding} ` + width + \" \" + height\n  );\n}, \"draw\");\nvar getLabelWidth = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((text) => {\n  return text ? text.length * conf.fontSizeFactor : 1;\n}, \"getLabelWidth\");\nvar renderDoc = /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {\n  const graph = new dagre_d3_es_src_graphlib_index_js__WEBPACK_IMPORTED_MODULE_15__.Graph({\n    compound: true,\n    multigraph: true\n  });\n  let i;\n  let edgeFreeDoc = true;\n  for (i = 0; i < doc.length; i++) {\n    if (doc[i].stmt === \"relation\") {\n      edgeFreeDoc = false;\n      break;\n    }\n  }\n  if (parentId) {\n    graph.setGraph({\n      rankdir: \"LR\",\n      multigraph: true,\n      compound: true,\n      // acyclicer: 'greedy',\n      ranker: \"tight-tree\",\n      ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,\n      nodeSep: edgeFreeDoc ? 1 : 50,\n      isMultiGraph: true\n      // ranksep: 5,\n      // nodesep: 1\n    });\n  } else {\n    graph.setGraph({\n      rankdir: \"TB\",\n      multigraph: true,\n      compound: true,\n      // isCompound: true,\n      // acyclicer: 'greedy',\n      // ranker: 'longest-path'\n      ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,\n      nodeSep: edgeFreeDoc ? 1 : 50,\n      ranker: \"tight-tree\",\n      // ranker: 'network-simplex'\n      isMultiGraph: true\n    });\n  }\n  graph.setDefaultEdgeLabel(function() {\n    return {};\n  });\n  const states = diagObj.db.getStates();\n  const relations = diagObj.db.getRelations();\n  const keys = Object.keys(states);\n  let first = true;\n  for (const key of keys) {\n    const stateDef = states[key];\n    if (parentId) {\n      stateDef.parentId = parentId;\n    }\n    let node;\n    if (stateDef.doc) {\n      let sub = diagram2.append(\"g\").attr(\"id\", stateDef.id).attr(\"class\", \"stateGroup\");\n      node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);\n      if (first) {\n        sub = addTitleAndBox(sub, stateDef, altBkg);\n        let boxBounds = sub.node().getBBox();\n        node.width = boxBounds.width;\n        node.height = boxBounds.height + conf.padding / 2;\n        transformationLog[stateDef.id] = { y: conf.compositTitleSize };\n      } else {\n        let boxBounds = sub.node().getBBox();\n        node.width = boxBounds.width;\n        node.height = boxBounds.height;\n      }\n    } else {\n      node = drawState(diagram2, stateDef, graph);\n    }\n    if (stateDef.note) {\n      const noteDef = {\n        descriptions: [],\n        id: stateDef.id + \"-note\",\n        note: stateDef.note,\n        type: \"note\"\n      };\n      const note = drawState(diagram2, noteDef, graph);\n      if (stateDef.note.position === \"left of\") {\n        graph.setNode(node.id + \"-note\", note);\n        graph.setNode(node.id, node);\n      } else {\n        graph.setNode(node.id, node);\n        graph.setNode(node.id + \"-note\", note);\n      }\n      graph.setParent(node.id, node.id + \"-group\");\n      graph.setParent(node.id + \"-note\", node.id + \"-group\");\n    } else {\n      graph.setNode(node.id, node);\n    }\n  }\n  _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Count=\", graph.nodeCount(), graph);\n  let cnt = 0;\n  relations.forEach(function(relation) {\n    cnt++;\n    _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Setting edge\", relation);\n    graph.setEdge(\n      relation.id1,\n      relation.id2,\n      {\n        relation,\n        width: getLabelWidth(relation.title),\n        height: conf.labelHeight * _chunk_ABZYJK2D_mjs__WEBPACK_IMPORTED_MODULE_11__.common_default.getRows(relation.title).length,\n        labelpos: \"c\"\n      },\n      \"id\" + cnt\n    );\n  });\n  (0,dagre_d3_es_src_dagre_index_js__WEBPACK_IMPORTED_MODULE_14__.layout)(graph);\n  _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Graph after layout\", graph.nodes());\n  const svgElem = diagram2.node();\n  graph.nodes().forEach(function(v) {\n    if (v !== void 0 && graph.node(v) !== void 0) {\n      _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.warn(\"Node \" + v + \": \" + JSON.stringify(graph.node(v)));\n      root.select(\"#\" + svgElem.id + \" #\" + v).attr(\n        \"transform\",\n        \"translate(\" + (graph.node(v).x - graph.node(v).width / 2) + \",\" + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + \" )\"\n      );\n      root.select(\"#\" + svgElem.id + \" #\" + v).attr(\"data-x-shift\", graph.node(v).x - graph.node(v).width / 2);\n      const dividers = domDocument.querySelectorAll(\"#\" + svgElem.id + \" #\" + v + \" .divider\");\n      dividers.forEach((divider) => {\n        const parent = divider.parentElement;\n        let pWidth = 0;\n        let pShift = 0;\n        if (parent) {\n          if (parent.parentElement) {\n            pWidth = parent.parentElement.getBBox().width;\n          }\n          pShift = parseInt(parent.getAttribute(\"data-x-shift\"), 10);\n          if (Number.isNaN(pShift)) {\n            pShift = 0;\n          }\n        }\n        divider.setAttribute(\"x1\", 0 - pShift + 8);\n        divider.setAttribute(\"x2\", pWidth - pShift - 8);\n      });\n    } else {\n      _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"No Node \" + v + \": \" + JSON.stringify(graph.node(v)));\n    }\n  });\n  let stateBox = svgElem.getBBox();\n  graph.edges().forEach(function(e) {\n    if (e !== void 0 && graph.edge(e) !== void 0) {\n      _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Edge \" + e.v + \" -> \" + e.w + \": \" + JSON.stringify(graph.edge(e)));\n      drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);\n    }\n  });\n  stateBox = svgElem.getBBox();\n  const stateInfo = {\n    id: parentId ? parentId : \"root\",\n    label: parentId ? parentId : \"root\",\n    width: 0,\n    height: 0\n  };\n  stateInfo.width = stateBox.width + 2 * conf.padding;\n  stateInfo.height = stateBox.height + 2 * conf.padding;\n  _chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.log.debug(\"Doc rendered\", stateInfo, graph);\n  return stateInfo;\n}, \"renderDoc\");\nvar stateRenderer_default = {\n  setConf,\n  draw\n};\n\n// src/diagrams/state/stateDiagram.ts\nvar diagram = {\n  parser: _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.stateDiagram_default,\n  get db() {\n    return new _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.StateDB(1);\n  },\n  renderer: stateRenderer_default,\n  styles: _chunk_DI55MBZ5_mjs__WEBPACK_IMPORTED_MODULE_0__.styles_default,\n  init: /* @__PURE__ */ (0,_chunk_AGHRB4JF_mjs__WEBPACK_IMPORTED_MODULE_12__.__name)((cnf) => {\n    if (!cnf.state) {\n      cnf.state = {};\n    }\n    cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;\n  }, \"init\")\n};\n\n\n\n//# sourceURL=webpack://_JUPYTERLAB.CORE_OUTPUT/../node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-FKZM4ZOC.mjs?");

/***/ })

}]);