"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([["node_modules_mermaid_dist_chunks_mermaid_core_abnfDiagram-VRR7QNED_mjs"],{

/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/abnfDiagram-VRR7QNED.mjs"
/*!********************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/abnfDiagram-VRR7QNED.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 */   diagram: () => (/* binding */ diagram)\n/* harmony export */ });\n/* harmony import */ var _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-MOJQB5TN.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-MOJQB5TN.mjs\");\n/* harmony import */ var _chunk_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-JWPE2WC7.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.mjs\");\n/* harmony import */ var _chunk_VAUOI2AC_mjs__WEBPACK_IMPORTED_MODULE_2__ = __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_3__ = __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_4__ = __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_5__ = __webpack_require__(/*! ./chunk-Y2CYZVJY.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-Y2CYZVJY.mjs\");\n/* harmony import */ var _mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @mermaid-js/parser */ \"./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs\");\n\n\n\n\n\n\n\n// src/diagrams/railroad/parser/abnfParser.ts\n\nvar langiumParser = (0,_mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__.createRailroadAbnfServices)().RailroadAbnf.parser.LangiumParser;\nvar transformAlternation = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((alt) => {\n  const alternatives = alt.alternatives.map(transformConcatenation);\n  if (alternatives.length === 1) {\n    return alternatives[0];\n  }\n  return {\n    type: \"choice\",\n    alternatives\n  };\n}, \"transformAlternation\");\nvar transformConcatenation = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((concat) => {\n  const elements = concat.elements.map(transformElement);\n  if (elements.length === 1) {\n    return elements[0];\n  }\n  return {\n    type: \"sequence\",\n    elements\n  };\n}, \"transformConcatenation\");\nvar parseRepeat = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((repeat) => {\n  if (repeat.includes(\"*\")) {\n    const [minStr, maxStr] = repeat.split(\"*\");\n    const min = minStr ? parseInt(minStr, 10) : 0;\n    const max = maxStr ? parseInt(maxStr, 10) : Infinity;\n    return { min, max };\n  }\n  const exact = parseInt(repeat, 10);\n  return { min: exact, max: exact };\n}, \"parseRepeat\");\nvar transformElement = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((element) => {\n  const inner = transformPrimary(element.primary);\n  if (!element.repeat) {\n    return inner;\n  }\n  const { min, max } = parseRepeat(element.repeat);\n  if (min === 0 && max === 1) {\n    return { type: \"optional\", element: inner };\n  }\n  return {\n    type: \"repetition\",\n    element: inner,\n    min,\n    max\n  };\n}, \"transformElement\");\nvar transformPrimary = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((primary) => {\n  switch (primary.$type) {\n    case \"AbnfStringLiteral\":\n      return {\n        type: \"terminal\",\n        value: primary.value\n      };\n    case \"AbnfNumVal\":\n      return {\n        type: \"terminal\",\n        value: primary.value\n      };\n    case \"AbnfRuleName\":\n      return {\n        type: \"nonterminal\",\n        name: primary.name\n      };\n    case \"AbnfGroup\":\n      return transformAlternation(primary.element);\n    case \"AbnfOptionalGroup\":\n      return {\n        type: \"optional\",\n        element: transformAlternation(primary.element)\n      };\n    default:\n      throw new Error(`Unsupported ABNF primary node: ${primary.$type}`);\n  }\n}, \"transformPrimary\");\nvar transformRule = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((rule) => {\n  return {\n    name: rule.name,\n    definition: transformAlternation(rule.definition)\n  };\n}, \"transformRule\");\nvar populateDb = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((ast) => {\n  (0,_chunk_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_1__.populateCommonDb)(ast, _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db);\n  if (ast.title) {\n    _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.setTitle(ast.title);\n  }\n  ast.rules.map((rule) => _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.addRule(transformRule(rule)));\n}, \"populateDb\");\nvar parser = {\n  parse: /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((input) => {\n    _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.clear();\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[ABNF Parser] Starting Langium parse\");\n    const result = langiumParser.parse(input);\n    if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {\n      throw new _mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__.MermaidParseError(result);\n    }\n    const ast = result.value;\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[ABNF Parser] Parsed rules:\", ast.rules.length);\n    populateDb(ast);\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[ABNF Parser] Parse complete\");\n  }, \"parse\"),\n  parser: {\n    yy: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db\n  }\n};\n\n// src/diagrams/railroad/abnfDiagram.ts\nvar diagram = {\n  parser,\n  db: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db,\n  renderer: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.renderer,\n  styles: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.getStyles\n};\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/abnfDiagram-VRR7QNED.mjs?\n}");

/***/ }

}]);