"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_diagram-NH7WQ7WH_mjs"],{

/***/ "./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/diagram-NH7WQ7WH.mjs"
/*!****************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/diagram-NH7WQ7WH.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_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_0__ = __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_1__ = __webpack_require__(/*! ./chunk-VAUOI2AC.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-VAUOI2AC.mjs\");\n/* harmony import */ var _chunk_ICXQ74PX_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-ICXQ74PX.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICXQ74PX.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/packet/db.ts\nvar DEFAULT_PACKET_CONFIG = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.defaultConfig_default.packet;\nvar PacketDB = class {\n  constructor() {\n    this.packet = [];\n    this.setAccTitle = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccTitle;\n    this.getAccTitle = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccTitle;\n    this.setDiagramTitle = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.setDiagramTitle;\n    this.getDiagramTitle = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.getDiagramTitle;\n    this.getAccDescription = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.getAccDescription;\n    this.setAccDescription = _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.setAccDescription;\n  }\n  static {\n    ;(0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)(this, \"PacketDB\");\n  }\n  getConfig() {\n    const config = (0,_chunk_ICXQ74PX_mjs__WEBPACK_IMPORTED_MODULE_2__.cleanAndMerge)({\n      ...DEFAULT_PACKET_CONFIG,\n      ...(0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.getConfig)().packet\n    });\n    if (config.showBits) {\n      config.paddingY += 10;\n    }\n    return config;\n  }\n  getPacket() {\n    return this.packet;\n  }\n  pushWord(word) {\n    if (word.length > 0) {\n      this.packet.push(word);\n    }\n  }\n  clear() {\n    ;(0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.clear)();\n    this.packet = [];\n  }\n};\n\n// src/diagrams/packet/parser.ts\n\nvar maxPacketSize = 1e4;\nvar populate = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((ast, db) => {\n  (0,_chunk_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_0__.populateCommonDb)(ast, db);\n  let lastBit = -1;\n  let word = [];\n  let row = 1;\n  const { bitsPerRow } = db.getConfig();\n  for (let { start, end, bits, label } of ast.blocks) {\n    if (start !== void 0 && end !== void 0 && end < start) {\n      throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);\n    }\n    start ??= lastBit + 1;\n    if (start !== lastBit + 1) {\n      throw new Error(\n        `Packet block ${start} - ${end ?? start} is not contiguous. It should start from ${lastBit + 1}.`\n      );\n    }\n    if (bits === 0) {\n      throw new Error(`Packet block ${start} is invalid. Cannot have a zero bit field.`);\n    }\n    end ??= start + (bits ?? 1) - 1;\n    bits ??= end - start + 1;\n    lastBit = end;\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(`Packet block ${start} - ${lastBit} with label ${label}`);\n    while (word.length <= bitsPerRow + 1 && db.getPacket().length < maxPacketSize) {\n      const [block, nextBlock] = getNextFittingBlock({ start, end, bits, label }, row, bitsPerRow);\n      word.push(block);\n      if (block.end + 1 === row * bitsPerRow) {\n        db.pushWord(word);\n        word = [];\n        row++;\n      }\n      if (!nextBlock) {\n        break;\n      }\n      ({ start, end, bits, label } = nextBlock);\n    }\n  }\n  db.pushWord(word);\n}, \"populate\");\nvar getNextFittingBlock = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((block, row, bitsPerRow) => {\n  if (block.start === void 0) {\n    throw new Error(\"start should have been set during first phase\");\n  }\n  if (block.end === void 0) {\n    throw new Error(\"end should have been set during first phase\");\n  }\n  if (block.start > block.end) {\n    throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);\n  }\n  if (block.end + 1 <= row * bitsPerRow) {\n    return [block, void 0];\n  }\n  const rowEnd = row * bitsPerRow - 1;\n  const rowStart = row * bitsPerRow;\n  return [\n    {\n      start: block.start,\n      end: rowEnd,\n      label: block.label,\n      bits: rowEnd - block.start\n    },\n    {\n      start: rowStart,\n      end: block.end,\n      label: block.label,\n      bits: block.end - rowStart\n    }\n  ];\n}, \"getNextFittingBlock\");\nvar parser = {\n  // @ts-expect-error - PacketDB is not assignable to DiagramDB\n  parser: { yy: void 0 },\n  parse: /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)(async (input) => {\n    const ast = await (0,_mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__.parse)(\"packet\", input);\n    const db = parser.parser?.yy;\n    if (!(db instanceof PacketDB)) {\n      throw new Error(\n        \"parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.\"\n      );\n    }\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(ast);\n    populate(ast, db);\n  }, \"parse\")\n};\n\n// src/diagrams/packet/renderer.ts\nvar draw = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((_text, id, _version, diagram2) => {\n  const db = diagram2.db;\n  const config = db.getConfig();\n  const { rowHeight, paddingY, bitWidth, bitsPerRow } = config;\n  const words = db.getPacket();\n  const title = db.getDiagramTitle();\n  const totalRowHeight = rowHeight + paddingY;\n  const svgHeight = totalRowHeight * (words.length + 1) - (title ? 0 : rowHeight);\n  const svgWidth = bitWidth * bitsPerRow + 2;\n  const svg = (0,_chunk_VAUOI2AC_mjs__WEBPACK_IMPORTED_MODULE_1__.selectSvgElement)(id);\n  svg.attr(\"viewBox\", `0 0 ${svgWidth} ${svgHeight}`);\n  (0,_chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(svg, svgHeight, svgWidth, config.useMaxWidth);\n  for (const [word, packet] of words.entries()) {\n    drawWord(svg, packet, word, config);\n  }\n  svg.append(\"text\").text(title).attr(\"x\", svgWidth / 2).attr(\"y\", svgHeight - totalRowHeight / 2).attr(\"dominant-baseline\", \"middle\").attr(\"text-anchor\", \"middle\").attr(\"class\", \"packetTitle\");\n}, \"draw\");\nvar drawWord = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((svg, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => {\n  const group = svg.append(\"g\");\n  const wordY = rowNumber * (rowHeight + paddingY) + paddingY;\n  for (const block of word) {\n    const blockX = block.start % bitsPerRow * bitWidth + 1;\n    const width = (block.end - block.start + 1) * bitWidth - paddingX;\n    group.append(\"rect\").attr(\"x\", blockX).attr(\"y\", wordY).attr(\"width\", width).attr(\"height\", rowHeight).attr(\"class\", \"packetBlock\");\n    group.append(\"text\").attr(\"x\", blockX + width / 2).attr(\"y\", wordY + rowHeight / 2).attr(\"class\", \"packetLabel\").attr(\"dominant-baseline\", \"middle\").attr(\"text-anchor\", \"middle\").text(block.label);\n    if (!showBits) {\n      continue;\n    }\n    const isSingleBlock = block.end === block.start;\n    const bitNumberY = wordY - 2;\n    group.append(\"text\").attr(\"x\", blockX + (isSingleBlock ? width / 2 : 0)).attr(\"y\", bitNumberY).attr(\"class\", \"packetByte start\").attr(\"dominant-baseline\", \"auto\").attr(\"text-anchor\", isSingleBlock ? \"middle\" : \"start\").text(block.start);\n    if (!isSingleBlock) {\n      group.append(\"text\").attr(\"x\", blockX + width).attr(\"y\", bitNumberY).attr(\"class\", \"packetByte end\").attr(\"dominant-baseline\", \"auto\").attr(\"text-anchor\", \"end\").text(block.end);\n    }\n  }\n}, \"drawWord\");\nvar renderer = { draw };\n\n// src/diagrams/packet/styles.ts\nvar defaultPacketStyleOptions = {\n  byteFontSize: \"10px\",\n  startByteColor: \"black\",\n  endByteColor: \"black\",\n  labelColor: \"black\",\n  labelFontSize: \"12px\",\n  titleColor: \"black\",\n  titleFontSize: \"14px\",\n  blockStrokeColor: \"black\",\n  blockStrokeWidth: \"1\",\n  blockFillColor: \"#efefef\"\n};\nvar styles = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)(({ packet } = {}) => {\n  const options = (0,_chunk_ICXQ74PX_mjs__WEBPACK_IMPORTED_MODULE_2__.cleanAndMerge)(defaultPacketStyleOptions, packet);\n  return `\n\t.packetByte {\n\t\tfont-size: ${options.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${options.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${options.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${options.labelColor};\n\t\tfont-size: ${options.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${options.titleColor};\n\t\tfont-size: ${options.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${options.blockStrokeColor};\n\t\tstroke-width: ${options.blockStrokeWidth};\n\t\tfill: ${options.blockFillColor};\n\t}\n\t`;\n}, \"styles\");\n\n// src/diagrams/packet/diagram.ts\nvar diagram = {\n  parser,\n  get db() {\n    return new PacketDB();\n  },\n  renderer,\n  styles\n};\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/diagram-NH7WQ7WH.mjs?\n}");

/***/ }

}]);