"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-JWPE2WC7_mjs-node_modules_mermaid-866e44"],{

/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.mjs"
/*!**************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.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 */   populateCommonDb: () => (/* binding */ populateCommonDb)\n/* harmony export */ });\n/* harmony import */ var _chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-Y2CYZVJY.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-Y2CYZVJY.mjs\");\n\n\n// src/diagrams/common/populateCommonDb.ts\nfunction populateCommonDb(ast, db) {\n  if (ast.accDescr) {\n    db.setAccDescription?.(ast.accDescr);\n  }\n  if (ast.accTitle) {\n    db.setAccTitle?.(ast.accTitle);\n  }\n  if (ast.title) {\n    db.setDiagramTitle?.(ast.title);\n  }\n}\n;(0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_0__.__name)(populateCommonDb, \"populateCommonDb\");\n\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.mjs?\n}");

/***/ },

/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/chunk-MOJQB5TN.mjs"
/*!**************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-MOJQB5TN.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 */   db: () => (/* binding */ db),\n/* harmony export */   getStyles: () => (/* binding */ getStyles),\n/* harmony export */   renderer: () => (/* binding */ renderer)\n/* harmony export */ });\n/* harmony import */ var _chunk_VAUOI2AC_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-VAUOI2AC.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-VAUOI2AC.mjs\");\n/* harmony import */ var _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-WYO6CB5R.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-WYO6CB5R.mjs\");\n/* harmony import */ var _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__ = __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_3__ = __webpack_require__(/*! ./chunk-Y2CYZVJY.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-Y2CYZVJY.mjs\");\n\n\n\n\n\n// src/diagrams/railroad/railroadDb.ts\nvar diagramTitle = \"\";\nvar accTitle = \"\";\nvar accDescription = \"\";\nvar rules = [];\nvar ruleMap = /* @__PURE__ */ new Map();\nvar sanitizeText2 = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text) => {\n  return (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.sanitizeText)(text, (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.getConfig2)());\n}, \"sanitizeText\");\nvar sanitizeAstNode = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((node) => {\n  switch (node.type) {\n    case \"terminal\":\n      return { ...node, value: sanitizeText2(node.value) };\n    case \"nonterminal\":\n      return { ...node, name: sanitizeText2(node.name) };\n    case \"sequence\":\n      return { ...node, elements: node.elements.map(sanitizeAstNode) };\n    case \"choice\":\n      return { ...node, alternatives: node.alternatives.map(sanitizeAstNode) };\n    case \"optional\":\n      return { ...node, element: sanitizeAstNode(node.element) };\n    case \"repetition\":\n      return {\n        ...node,\n        element: sanitizeAstNode(node.element),\n        separator: node.separator ? sanitizeAstNode(node.separator) : void 0\n      };\n    case \"special\":\n      return { ...node, text: sanitizeText2(node.text) };\n  }\n}, \"sanitizeAstNode\");\nvar clear2 = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(() => {\n  diagramTitle = \"\";\n  accTitle = \"\";\n  accDescription = \"\";\n  rules.length = 0;\n  ruleMap.clear();\n  (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.clear)();\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Database cleared\");\n}, \"clear\");\nvar setTitle = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text) => {\n  diagramTitle = sanitizeText2(text);\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Title set:\", text);\n}, \"setTitle\");\nvar getTitle = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(() => {\n  return diagramTitle;\n}, \"getTitle\");\nvar addRule = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((rule) => {\n  const sanitizedRule = {\n    ...rule,\n    name: sanitizeText2(rule.name),\n    definition: sanitizeAstNode(rule.definition),\n    comment: rule.comment ? sanitizeText2(rule.comment) : void 0\n  };\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Adding rule:\", sanitizedRule.name);\n  if (ruleMap.has(sanitizedRule.name)) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.warn(`[Railroad] Rule '${sanitizedRule.name}' is already defined. Overwriting.`);\n  }\n  rules.push(sanitizedRule);\n  ruleMap.set(sanitizedRule.name, sanitizedRule);\n}, \"addRule\");\nvar getRules = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(() => {\n  return rules;\n}, \"getRules\");\nvar getRule = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((name) => {\n  return ruleMap.get(name);\n}, \"getRule\");\nvar setAccTitle = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text) => {\n  accTitle = sanitizeText2(text).replace(/^\\s+/g, \"\");\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Accessibility title set:\", text);\n}, \"setAccTitle\");\nvar getAccTitle = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(() => {\n  return accTitle;\n}, \"getAccTitle\");\nvar setAccDescription = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text) => {\n  accDescription = sanitizeText2(text).replace(/\\n\\s+/g, \"\\n\");\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Accessibility description set:\", text);\n}, \"setAccDescription\");\nvar getAccDescription = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(() => {\n  return accDescription;\n}, \"getAccDescription\");\nvar setDiagramTitle = setTitle;\nvar getDiagramTitle = getTitle;\nvar db = {\n  clear: clear2,\n  setTitle,\n  getTitle,\n  addRule,\n  getRules,\n  getRule,\n  setAccTitle,\n  getAccTitle,\n  setAccDescription,\n  getAccDescription,\n  setDiagramTitle,\n  getDiagramTitle\n};\n\n// src/diagrams/railroad/railroadTypes.ts\nvar DEFAULT_RAILROAD_CONFIG = {\n  // Layout\n  compactMode: false,\n  // Spacing\n  padding: 10,\n  verticalSeparation: 8,\n  horizontalSeparation: 10,\n  arcRadius: 10,\n  // Typography\n  fontSize: 14,\n  fontFamily: \"monospace\",\n  // Colors - Terminal\n  terminalFill: \"#FFFFC0\",\n  terminalStroke: \"#000000\",\n  terminalTextColor: \"#000000\",\n  // Colors - Non-terminal\n  nonTerminalFill: \"#FFFFFF\",\n  nonTerminalStroke: \"#000000\",\n  nonTerminalTextColor: \"#000000\",\n  // Colors - Lines\n  lineColor: \"#000000\",\n  strokeWidth: 2,\n  // Colors - Markers\n  markerFill: \"#000000\",\n  // Colors - Comment\n  commentFill: \"#E8E8E8\",\n  commentStroke: \"#888888\",\n  commentTextColor: \"#666666\",\n  // Colors - Special\n  specialFill: \"#F0E0FF\",\n  specialStroke: \"#8800CC\",\n  // Other\n  ruleNameColor: \"#000066\",\n  showMarkers: true,\n  markerRadius: 5\n};\n\n// src/diagrams/railroad/styles.ts\nvar COLOR_VALUE_PATTERN = /^#(?:[\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\\([\\d\\s%+,./-]+\\)$|^[a-z]+$/i;\nvar FONT_FAMILY_PATTERN = /^[\\w \"',.-]+$/;\nvar RAILROAD_STYLE_OPTION_KEYS = /* @__PURE__ */ new Set([\n  \"compactMode\",\n  \"padding\",\n  \"verticalSeparation\",\n  \"horizontalSeparation\",\n  \"arcRadius\",\n  \"fontSize\",\n  \"fontFamily\",\n  \"terminalFill\",\n  \"terminalStroke\",\n  \"terminalTextColor\",\n  \"nonTerminalFill\",\n  \"nonTerminalStroke\",\n  \"nonTerminalTextColor\",\n  \"lineColor\",\n  \"strokeWidth\",\n  \"markerFill\",\n  \"commentFill\",\n  \"commentStroke\",\n  \"commentTextColor\",\n  \"specialFill\",\n  \"specialStroke\",\n  \"ruleNameColor\",\n  \"showMarkers\",\n  \"markerRadius\"\n]);\nvar isRailroadStyleOptions = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => {\n  if (!options) {\n    return false;\n  }\n  return Object.keys(options).every(\n    (key) => key === \"railroad\" || RAILROAD_STYLE_OPTION_KEYS.has(key)\n  );\n}, \"isRailroadStyleOptions\");\nvar extractRailroadOverrides = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => {\n  if (!options) {\n    return {};\n  }\n  if (\"railroad\" in options && options.railroad) {\n    return options.railroad;\n  }\n  return isRailroadStyleOptions(options) ? options : {};\n}, \"extractRailroadOverrides\");\nvar extractThemeOverrides = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => {\n  if (!options || isRailroadStyleOptions(options)) {\n    return {};\n  }\n  const {\n    railroad: _railroad,\n    svgId: _svgId,\n    theme: _theme,\n    look: _look,\n    ...themeOverrides\n  } = options;\n  return themeOverrides;\n}, \"extractThemeOverrides\");\nvar sanitizeColorValue = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((value, fallback) => {\n  if (typeof value !== \"string\") {\n    return fallback;\n  }\n  const normalized = value.trim();\n  return COLOR_VALUE_PATTERN.test(normalized) ? normalized : fallback;\n}, \"sanitizeColorValue\");\nvar sanitizeFontFamilyValue = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((value, fallback) => {\n  if (typeof value !== \"string\") {\n    return fallback;\n  }\n  const normalized = value.trim();\n  return FONT_FAMILY_PATTERN.test(normalized) ? normalized : fallback;\n}, \"sanitizeFontFamilyValue\");\nvar sanitizeNumberValue = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((value, fallback) => {\n  const parsed = typeof value === \"number\" ? value : typeof value === \"string\" ? Number.parseFloat(value) : Number.NaN;\n  return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;\n}, \"sanitizeNumberValue\");\nvar parseThemeFontSize = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((value) => {\n  const parsed = typeof value === \"number\" ? value : typeof value === \"string\" ? Number.parseFloat(value) : Number.NaN;\n  return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;\n}, \"parseThemeFontSize\");\nvar buildThemeDefaults = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((themeVariables) => {\n  const fontFamily = sanitizeFontFamilyValue(\n    themeVariables.fontFamily,\n    DEFAULT_RAILROAD_CONFIG.fontFamily\n  );\n  const fontSize = parseThemeFontSize(themeVariables.fontSize) ?? DEFAULT_RAILROAD_CONFIG.fontSize;\n  return {\n    ...DEFAULT_RAILROAD_CONFIG,\n    fontFamily,\n    fontSize,\n    terminalFill: sanitizeColorValue(\n      themeVariables.secondBkg ?? themeVariables.secondaryColor,\n      DEFAULT_RAILROAD_CONFIG.terminalFill\n    ),\n    terminalStroke: sanitizeColorValue(\n      themeVariables.secondaryBorderColor ?? themeVariables.lineColor,\n      DEFAULT_RAILROAD_CONFIG.terminalStroke\n    ),\n    terminalTextColor: sanitizeColorValue(\n      themeVariables.secondaryTextColor ?? themeVariables.textColor,\n      DEFAULT_RAILROAD_CONFIG.terminalTextColor\n    ),\n    nonTerminalFill: sanitizeColorValue(\n      themeVariables.mainBkg ?? themeVariables.background,\n      DEFAULT_RAILROAD_CONFIG.nonTerminalFill\n    ),\n    nonTerminalStroke: sanitizeColorValue(\n      themeVariables.primaryBorderColor ?? themeVariables.lineColor,\n      DEFAULT_RAILROAD_CONFIG.nonTerminalStroke\n    ),\n    nonTerminalTextColor: sanitizeColorValue(\n      themeVariables.primaryTextColor ?? themeVariables.textColor,\n      DEFAULT_RAILROAD_CONFIG.nonTerminalTextColor\n    ),\n    lineColor: sanitizeColorValue(themeVariables.lineColor, DEFAULT_RAILROAD_CONFIG.lineColor),\n    markerFill: sanitizeColorValue(themeVariables.lineColor, DEFAULT_RAILROAD_CONFIG.markerFill),\n    commentFill: sanitizeColorValue(\n      themeVariables.labelBackground ?? themeVariables.tertiaryColor,\n      DEFAULT_RAILROAD_CONFIG.commentFill\n    ),\n    commentStroke: sanitizeColorValue(\n      themeVariables.tertiaryBorderColor ?? themeVariables.lineColor,\n      DEFAULT_RAILROAD_CONFIG.commentStroke\n    ),\n    commentTextColor: sanitizeColorValue(\n      themeVariables.tertiaryTextColor ?? themeVariables.textColor,\n      DEFAULT_RAILROAD_CONFIG.commentTextColor\n    ),\n    specialFill: sanitizeColorValue(\n      themeVariables.tertiaryColor ?? themeVariables.secondaryColor,\n      DEFAULT_RAILROAD_CONFIG.specialFill\n    ),\n    specialStroke: sanitizeColorValue(\n      themeVariables.tertiaryBorderColor ?? themeVariables.secondaryBorderColor,\n      DEFAULT_RAILROAD_CONFIG.specialStroke\n    ),\n    ruleNameColor: sanitizeColorValue(\n      themeVariables.titleColor ?? themeVariables.textColor,\n      DEFAULT_RAILROAD_CONFIG.ruleNameColor\n    )\n  };\n}, \"buildThemeDefaults\");\nvar buildRailroadStyleOptions = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => {\n  const currentConfig = (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.getConfig)();\n  const themeVariables = {\n    ...(0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.getThemeVariables)(),\n    ...currentConfig.themeVariables ?? {},\n    ...extractThemeOverrides(options)\n  };\n  const themeDefaults = buildThemeDefaults(themeVariables);\n  const railroadOptions = {\n    ...currentConfig.railroad ?? {},\n    ...extractRailroadOverrides(options)\n  };\n  return {\n    compactMode: railroadOptions.compactMode ?? themeDefaults.compactMode,\n    padding: sanitizeNumberValue(railroadOptions.padding, themeDefaults.padding),\n    verticalSeparation: sanitizeNumberValue(\n      railroadOptions.verticalSeparation,\n      themeDefaults.verticalSeparation\n    ),\n    horizontalSeparation: sanitizeNumberValue(\n      railroadOptions.horizontalSeparation,\n      themeDefaults.horizontalSeparation\n    ),\n    arcRadius: sanitizeNumberValue(railroadOptions.arcRadius, themeDefaults.arcRadius),\n    fontSize: sanitizeNumberValue(railroadOptions.fontSize, themeDefaults.fontSize),\n    fontFamily: sanitizeFontFamilyValue(railroadOptions.fontFamily, themeDefaults.fontFamily),\n    terminalFill: sanitizeColorValue(railroadOptions.terminalFill, themeDefaults.terminalFill),\n    terminalStroke: sanitizeColorValue(\n      railroadOptions.terminalStroke,\n      themeDefaults.terminalStroke\n    ),\n    terminalTextColor: sanitizeColorValue(\n      railroadOptions.terminalTextColor,\n      themeDefaults.terminalTextColor\n    ),\n    nonTerminalFill: sanitizeColorValue(\n      railroadOptions.nonTerminalFill,\n      themeDefaults.nonTerminalFill\n    ),\n    nonTerminalStroke: sanitizeColorValue(\n      railroadOptions.nonTerminalStroke,\n      themeDefaults.nonTerminalStroke\n    ),\n    nonTerminalTextColor: sanitizeColorValue(\n      railroadOptions.nonTerminalTextColor,\n      themeDefaults.nonTerminalTextColor\n    ),\n    lineColor: sanitizeColorValue(railroadOptions.lineColor, themeDefaults.lineColor),\n    strokeWidth: sanitizeNumberValue(railroadOptions.strokeWidth, themeDefaults.strokeWidth),\n    markerFill: sanitizeColorValue(railroadOptions.markerFill, themeDefaults.markerFill),\n    commentFill: sanitizeColorValue(railroadOptions.commentFill, themeDefaults.commentFill),\n    commentStroke: sanitizeColorValue(railroadOptions.commentStroke, themeDefaults.commentStroke),\n    commentTextColor: sanitizeColorValue(\n      railroadOptions.commentTextColor,\n      themeDefaults.commentTextColor\n    ),\n    specialFill: sanitizeColorValue(railroadOptions.specialFill, themeDefaults.specialFill),\n    specialStroke: sanitizeColorValue(railroadOptions.specialStroke, themeDefaults.specialStroke),\n    ruleNameColor: sanitizeColorValue(railroadOptions.ruleNameColor, themeDefaults.ruleNameColor),\n    showMarkers: railroadOptions.showMarkers ?? themeDefaults.showMarkers,\n    markerRadius: sanitizeNumberValue(railroadOptions.markerRadius, themeDefaults.markerRadius)\n  };\n}, \"buildRailroadStyleOptions\");\nvar getStyles = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((options) => {\n  const {\n    fontFamily,\n    fontSize,\n    terminalFill,\n    terminalStroke,\n    terminalTextColor,\n    nonTerminalFill,\n    nonTerminalStroke,\n    nonTerminalTextColor,\n    lineColor,\n    strokeWidth,\n    markerFill,\n    commentFill,\n    commentStroke,\n    commentTextColor,\n    specialFill,\n    specialStroke,\n    ruleNameColor\n  } = buildRailroadStyleOptions(options);\n  return `\n  .railroad-diagram {\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n  }\n\n  .railroad-terminal rect {\n    fill: ${terminalFill};\n    stroke: ${terminalStroke};\n    stroke-width: ${strokeWidth}px;\n  }\n\n  .railroad-terminal text {\n    fill: ${terminalTextColor};\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n    text-anchor: middle;\n    dominant-baseline: middle;\n  }\n\n  .railroad-nonterminal rect {\n    fill: ${nonTerminalFill};\n    stroke: ${nonTerminalStroke};\n    stroke-width: ${strokeWidth}px;\n  }\n\n  .railroad-nonterminal text {\n    fill: ${nonTerminalTextColor};\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n    text-anchor: middle;\n    dominant-baseline: middle;\n  }\n\n  .railroad-line {\n    stroke: ${lineColor};\n    stroke-width: ${strokeWidth}px;\n    fill: none;\n  }\n\n  .railroad-start circle,\n  .railroad-end circle {\n    fill: ${markerFill};\n  }\n\n  .railroad-comment ellipse {\n    fill: ${commentFill};\n    stroke: ${commentStroke};\n    stroke-width: ${strokeWidth}px;\n  }\n\n  .railroad-comment text {\n    fill: ${commentTextColor};\n    font-style: italic;\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n    text-anchor: middle;\n    dominant-baseline: middle;\n  }\n\n  .railroad-special rect {\n    fill: ${specialFill};\n    stroke: ${specialStroke};\n    stroke-width: ${strokeWidth}px;\n    stroke-dasharray: 5,3;\n  }\n\n  .railroad-special text {\n    fill: ${nonTerminalTextColor};\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n    text-anchor: middle;\n    dominant-baseline: middle;\n  }\n\n  .railroad-rule-name {\n    font-weight: bold;\n    fill: ${ruleNameColor};\n    font-family: ${fontFamily};\n    font-size: ${fontSize}px;\n  }\n\n  .railroad-group {\n    /* Grouping container, no specific styles */\n  }\n`;\n}, \"getStyles\");\n\n// src/diagrams/railroad/railroadRenderer.ts\nvar PathBuilder = class {\n  constructor() {\n    this.d = \"\";\n  }\n  static {\n    ;(0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(this, \"PathBuilder\");\n  }\n  moveTo(x, y) {\n    this.d += `M ${x} ${y} `;\n    return this;\n  }\n  lineTo(x, y) {\n    this.d += `L ${x} ${y} `;\n    return this;\n  }\n  horizontalTo(x) {\n    this.d += `H ${x} `;\n    return this;\n  }\n  verticalTo(y) {\n    this.d += `V ${y} `;\n    return this;\n  }\n  arcTo(rx, ry, rotation, largeArc, sweep, x, y) {\n    this.d += `A ${rx} ${ry} ${rotation} ${largeArc ? 1 : 0} ${sweep ? 1 : 0} ${x} ${y} `;\n    return this;\n  }\n  build() {\n    return this.d.trim();\n  }\n};\nvar RailroadRenderer = class {\n  constructor(svg, config = buildRailroadStyleOptions()) {\n    this.textCache = /* @__PURE__ */ new Map();\n    this.svg = svg;\n    this.config = config;\n  }\n  static {\n    ;(0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)(this, \"RailroadRenderer\");\n  }\n  /**\n   * Measure text dimensions\n   */\n  measureText(text) {\n    if (this.textCache.has(text)) {\n      return this.textCache.get(text);\n    }\n    const tempText = this.svg.append(\"text\").attr(\"font-family\", this.config.fontFamily).attr(\"font-size\", this.config.fontSize).text(text);\n    const bbox = tempText.node().getBBox();\n    const dimensions = { width: bbox.width, height: bbox.height };\n    tempText.remove();\n    this.textCache.set(text, dimensions);\n    return dimensions;\n  }\n  /**\n   * Render terminal symbol (rounded rectangle)\n   */\n  renderTerminal(parent, value) {\n    const textDim = this.measureText(value);\n    const width = textDim.width + this.config.padding * 2;\n    const height = textDim.height + this.config.padding * 2;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-terminal\");\n    group.append(\"rect\").attr(\"x\", 0).attr(\"y\", 0).attr(\"width\", width).attr(\"height\", height).attr(\"rx\", 10).attr(\"ry\", 10);\n    group.append(\"text\").attr(\"x\", width / 2).attr(\"y\", height / 2).text(value);\n    return {\n      element: group.node(),\n      dimensions: {\n        width,\n        height,\n        up: height / 2,\n        down: height / 2\n      }\n    };\n  }\n  /**\n   * Render non-terminal symbol (rectangle)\n   */\n  renderNonTerminal(parent, name) {\n    const textDim = this.measureText(name);\n    const width = textDim.width + this.config.padding * 2;\n    const height = textDim.height + this.config.padding * 2;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-nonterminal\");\n    group.append(\"rect\").attr(\"x\", 0).attr(\"y\", 0).attr(\"width\", width).attr(\"height\", height);\n    group.append(\"text\").attr(\"x\", width / 2).attr(\"y\", height / 2).text(name);\n    return {\n      element: group.node(),\n      dimensions: {\n        width,\n        height,\n        up: height / 2,\n        down: height / 2\n      }\n    };\n  }\n  /**\n   * Render sequence (horizontal concatenation)\n   */\n  renderSequence(parent, elements) {\n    const rendered = elements.map((e) => this.renderExpression(parent, e));\n    let totalWidth = 0;\n    let maxUp = 0;\n    let maxDown = 0;\n    for (const r of rendered) {\n      totalWidth += r.dimensions.width;\n      maxUp = Math.max(maxUp, r.dimensions.up);\n      maxDown = Math.max(maxDown, r.dimensions.down);\n    }\n    totalWidth += (rendered.length - 1) * this.config.horizontalSeparation;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-sequence\");\n    let x = 0;\n    for (let i = 0; i < rendered.length; i++) {\n      const r = rendered[i];\n      const y = maxUp - r.dimensions.up;\n      const elem = group.node().appendChild(r.element);\n      elem.setAttribute(\"transform\", `translate(${x}, ${y})`);\n      if (i < rendered.length - 1) {\n        const lineX1 = x + r.dimensions.width;\n        const lineX2 = lineX1 + this.config.horizontalSeparation;\n        const lineY = maxUp;\n        group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", new PathBuilder().moveTo(lineX1, lineY).lineTo(lineX2, lineY).build());\n      }\n      x += r.dimensions.width + this.config.horizontalSeparation;\n    }\n    return {\n      element: group.node(),\n      dimensions: {\n        width: totalWidth,\n        height: maxUp + maxDown,\n        up: maxUp,\n        down: maxDown\n      }\n    };\n  }\n  /**\n   * Render choice (vertical alternatives)\n   */\n  renderChoice(parent, alternatives) {\n    const rendered = alternatives.map((a) => this.renderExpression(parent, a));\n    let maxWidth = 0;\n    let totalHeight = 0;\n    for (const r of rendered) {\n      maxWidth = Math.max(maxWidth, r.dimensions.width);\n      totalHeight += r.dimensions.height;\n    }\n    totalHeight += (rendered.length - 1) * this.config.verticalSeparation;\n    const arcRadius = this.config.arcRadius;\n    const arcWidth = arcRadius * 4;\n    const totalWidth = maxWidth + arcWidth;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-choice\");\n    let y = 0;\n    const centerY = totalHeight / 2;\n    for (const r of rendered) {\n      const elemY = y;\n      const elemCenterY = elemY + r.dimensions.up;\n      const elemX = arcRadius * 2 + (maxWidth - r.dimensions.width) / 2;\n      const elem = group.node().appendChild(r.element);\n      elem.setAttribute(\"transform\", `translate(${elemX}, ${elemY})`);\n      const leftPath = new PathBuilder();\n      const isBelowCenter = elemCenterY > centerY;\n      if (elemCenterY === centerY) {\n        leftPath.moveTo(0, centerY).lineTo(elemX, elemCenterY);\n      } else {\n        leftPath.moveTo(0, centerY).arcTo(\n          arcRadius,\n          arcRadius,\n          0,\n          false,\n          isBelowCenter,\n          arcRadius,\n          centerY + (isBelowCenter ? arcRadius : -arcRadius)\n        ).lineTo(arcRadius, elemCenterY - (isBelowCenter ? arcRadius : -arcRadius)).arcTo(arcRadius, arcRadius, 0, false, !isBelowCenter, arcRadius * 2, elemCenterY).lineTo(elemX, elemCenterY);\n      }\n      group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", leftPath.build());\n      const rightPath = new PathBuilder();\n      const rightStart = elemX + r.dimensions.width;\n      const rightLaneX = totalWidth - arcRadius * 2;\n      if (elemCenterY === centerY) {\n        rightPath.moveTo(rightStart, elemCenterY).lineTo(totalWidth, centerY);\n      } else {\n        rightPath.moveTo(rightStart, elemCenterY).lineTo(rightLaneX, elemCenterY).arcTo(\n          arcRadius,\n          arcRadius,\n          0,\n          false,\n          !isBelowCenter,\n          totalWidth - arcRadius,\n          elemCenterY + (isBelowCenter ? -arcRadius : arcRadius)\n        ).lineTo(totalWidth - arcRadius, centerY + (isBelowCenter ? arcRadius : -arcRadius)).arcTo(arcRadius, arcRadius, 0, false, isBelowCenter, totalWidth, centerY);\n      }\n      group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", rightPath.build());\n      y += r.dimensions.height + this.config.verticalSeparation;\n    }\n    return {\n      element: group.node(),\n      dimensions: {\n        width: totalWidth,\n        height: totalHeight,\n        up: centerY,\n        down: totalHeight - centerY\n      }\n    };\n  }\n  /**\n   * Render optional (bypass path above)\n   */\n  renderOptional(parent, element) {\n    const inner = this.renderExpression(parent, element);\n    const arcRadius = this.config.arcRadius;\n    const arcHeight = arcRadius * 2;\n    const totalWidth = inner.dimensions.width + arcRadius * 4;\n    const totalHeight = inner.dimensions.height + arcHeight;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-optional\");\n    const elemX = arcRadius * 2;\n    const elemY = arcHeight;\n    const elem = group.node().appendChild(inner.element);\n    elem.setAttribute(\"transform\", `translate(${elemX}, ${elemY})`);\n    const centerY = elemY + inner.dimensions.up;\n    const lowerPath = new PathBuilder().moveTo(0, centerY).lineTo(arcRadius * 2, centerY);\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", lowerPath.build());\n    const lowerPath2 = new PathBuilder().moveTo(elemX + inner.dimensions.width, centerY).lineTo(totalWidth, centerY);\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", lowerPath2.build());\n    const bypassPath = new PathBuilder().moveTo(0, centerY).arcTo(arcRadius, arcRadius, 0, false, false, arcRadius, centerY - arcRadius).lineTo(arcRadius, arcRadius).arcTo(arcRadius, arcRadius, 0, false, true, arcRadius * 2, 0).lineTo(totalWidth - arcRadius * 2, 0).arcTo(arcRadius, arcRadius, 0, false, true, totalWidth - arcRadius, arcRadius).lineTo(totalWidth - arcRadius, centerY - arcRadius).arcTo(arcRadius, arcRadius, 0, false, false, totalWidth, centerY);\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", bypassPath.build());\n    return {\n      element: group.node(),\n      dimensions: {\n        width: totalWidth,\n        height: totalHeight,\n        up: centerY,\n        down: totalHeight - centerY\n      }\n    };\n  }\n  /**\n   * Render repetition (loop back path)\n   */\n  renderRepetition(parent, element, min) {\n    const inner = this.renderExpression(parent, element);\n    const arcRadius = this.config.arcRadius;\n    const arcHeight = arcRadius * 2;\n    const totalWidth = inner.dimensions.width + arcRadius * 4;\n    const hasBypass = min === 0;\n    const totalHeight = inner.dimensions.height + arcHeight + (hasBypass ? arcHeight : 0);\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-repetition\");\n    const elemX = arcRadius * 2;\n    const elemY = hasBypass ? arcHeight : 0;\n    const elem = group.node().appendChild(inner.element);\n    elem.setAttribute(\"transform\", `translate(${elemX}, ${elemY})`);\n    const centerY = elemY + inner.dimensions.up;\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\n      \"d\",\n      new PathBuilder().moveTo(0, centerY).lineTo(arcRadius * 2, centerY).build()\n    );\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\n      \"d\",\n      new PathBuilder().moveTo(elemX + inner.dimensions.width, centerY).lineTo(totalWidth, centerY).build()\n    );\n    const loopY = elemY + inner.dimensions.height + arcRadius;\n    const loopPath = new PathBuilder().moveTo(elemX + inner.dimensions.width, centerY).arcTo(\n      arcRadius,\n      arcRadius,\n      0,\n      false,\n      true,\n      elemX + inner.dimensions.width + arcRadius,\n      centerY + arcRadius\n    ).lineTo(elemX + inner.dimensions.width + arcRadius, loopY).arcTo(\n      arcRadius,\n      arcRadius,\n      0,\n      false,\n      true,\n      elemX + inner.dimensions.width,\n      loopY + arcRadius\n    ).lineTo(arcRadius * 2, loopY + arcRadius).arcTo(arcRadius, arcRadius, 0, false, true, arcRadius, loopY).lineTo(arcRadius, centerY + arcRadius).arcTo(arcRadius, arcRadius, 0, false, true, arcRadius * 2, centerY);\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", loopPath.build());\n    if (hasBypass) {\n      const bypassPath = new PathBuilder().moveTo(0, centerY).arcTo(arcRadius, arcRadius, 0, false, false, arcRadius, centerY - arcRadius).lineTo(arcRadius, arcRadius).arcTo(arcRadius, arcRadius, 0, false, true, arcRadius * 2, 0).lineTo(totalWidth - arcRadius * 2, 0).arcTo(arcRadius, arcRadius, 0, false, true, totalWidth - arcRadius, arcRadius).lineTo(totalWidth - arcRadius, centerY - arcRadius).arcTo(arcRadius, arcRadius, 0, false, false, totalWidth, centerY);\n      group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\"d\", bypassPath.build());\n    }\n    return {\n      element: group.node(),\n      dimensions: {\n        width: totalWidth,\n        height: totalHeight,\n        up: centerY,\n        down: totalHeight - centerY\n      }\n    };\n  }\n  /**\n   * Render special sequence\n   */\n  renderSpecial(parent, text) {\n    const textDim = this.measureText(\"? \" + text + \" ?\");\n    const width = textDim.width + this.config.padding * 2;\n    const height = textDim.height + this.config.padding * 2;\n    const group = parent.append(\"g\").attr(\"class\", \"railroad-special\");\n    group.append(\"rect\").attr(\"x\", 0).attr(\"y\", 0).attr(\"width\", width).attr(\"height\", height);\n    group.append(\"text\").attr(\"x\", width / 2).attr(\"y\", height / 2).text(\"? \" + text + \" ?\");\n    return {\n      element: group.node(),\n      dimensions: {\n        width,\n        height,\n        up: height / 2,\n        down: height / 2\n      }\n    };\n  }\n  /**\n   * Render an expression (recursive)\n   */\n  renderExpression(parent, node) {\n    switch (node.type) {\n      case \"terminal\":\n        return this.renderTerminal(parent, node.value);\n      case \"nonterminal\":\n        return this.renderNonTerminal(parent, node.name);\n      case \"sequence\":\n        return this.renderSequence(parent, node.elements);\n      case \"choice\":\n        return this.renderChoice(parent, node.alternatives);\n      case \"optional\":\n        return this.renderOptional(parent, node.element);\n      case \"repetition\":\n        return this.renderRepetition(parent, node.element, node.min);\n      case \"special\":\n        return this.renderSpecial(parent, node.text);\n      default:\n        throw new Error(`Unknown node type: ${node.type}`);\n    }\n  }\n  /**\n   * Render a single rule\n   */\n  renderRule(rule, y) {\n    const group = this.svg.append(\"g\").attr(\"class\", \"railroad-rule\").attr(\"transform\", `translate(0, ${y})`);\n    const ruleName = rule.name + \" =\";\n    const nameWidth = this.measureText(ruleName).width + 20;\n    const definitionX = nameWidth + 20;\n    const defGroup = group.append(\"g\");\n    const result = this.renderExpression(defGroup, rule.definition);\n    const baselineY = Math.max(20, result.dimensions.up);\n    const definitionY = baselineY - result.dimensions.up;\n    defGroup.attr(\"transform\", `translate(${definitionX}, ${definitionY})`);\n    const nameGroup = group.append(\"g\").attr(\"class\", \"railroad-rule-name-group\");\n    nameGroup.append(\"text\").attr(\"class\", \"railroad-rule-name\").attr(\"x\", 0).attr(\"y\", baselineY).text(ruleName);\n    const startMarker = group.append(\"g\").attr(\"class\", \"railroad-start\");\n    startMarker.append(\"circle\").attr(\"cx\", nameWidth).attr(\"cy\", baselineY).attr(\"r\", this.config.markerRadius);\n    const endMarker = group.append(\"g\").attr(\"class\", \"railroad-end\");\n    endMarker.append(\"circle\").attr(\"cx\", definitionX + result.dimensions.width + 10).attr(\"cy\", baselineY).attr(\"r\", this.config.markerRadius);\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\n      \"d\",\n      new PathBuilder().moveTo(nameWidth + this.config.markerRadius, baselineY).lineTo(definitionX, baselineY).build()\n    );\n    group.append(\"path\").attr(\"class\", \"railroad-line\").attr(\n      \"d\",\n      new PathBuilder().moveTo(definitionX + result.dimensions.width, baselineY).lineTo(definitionX + result.dimensions.width + 10 - this.config.markerRadius, baselineY).build()\n    );\n    return {\n      height: Math.max(40, definitionY + result.dimensions.height + this.config.padding * 2),\n      width: definitionX + result.dimensions.width + 10 + this.config.markerRadius\n    };\n  }\n  /**\n   * Render all rules\n   */\n  renderDiagram(rules2) {\n    let y = this.config.padding;\n    let maxWidth = 0;\n    for (const rule of rules2) {\n      const result = this.renderRule(rule, y);\n      y += result.height + this.config.verticalSeparation;\n      maxWidth = Math.max(maxWidth, result.width);\n    }\n    return {\n      width: maxWidth + this.config.padding * 2,\n      height: y + this.config.padding\n    };\n  }\n};\nvar configureRailroadSvgSize = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((svg, dimensions, useMaxWidth) => {\n  (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.configureSvgSize)(svg, dimensions.height, dimensions.width, useMaxWidth);\n  svg.attr(\"viewBox\", `0 0 ${dimensions.width} ${dimensions.height}`);\n}, \"configureRailroadSvgSize\");\nvar draw = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_3__.__name)((text, id, _version) => {\n  _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Rendering diagram\\n\" + text);\n  try {\n    const svg = (0,_chunk_VAUOI2AC_mjs__WEBPACK_IMPORTED_MODULE_0__.selectSvgElement)(id);\n    svg.attr(\"class\", \"railroad-diagram\");\n    const railroadConfig = (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_1__.getConfig)().railroad;\n    const useMaxWidth = railroadConfig?.useMaxWidth ?? true;\n    const rules2 = db.getRules();\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(`[Railroad] Rendering ${rules2.length} rules`);\n    if (rules2.length === 0) {\n      _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.warn(\"[Railroad] No rules to render\");\n      configureRailroadSvgSize(svg, { height: 100, width: 200 }, useMaxWidth);\n      return;\n    }\n    const renderer2 = new RailroadRenderer(svg, buildRailroadStyleOptions());\n    const dimensions = renderer2.renderDiagram(rules2);\n    configureRailroadSvgSize(svg, dimensions, useMaxWidth);\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.debug(\"[Railroad] Render complete\");\n  } catch (error) {\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_2__.log.error(\"[Railroad] Render error:\", error);\n    throw error;\n  }\n}, \"draw\");\nvar renderer = { draw };\n\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/chunk-MOJQB5TN.mjs?\n}");

/***/ }

}]);