{
  "version": 3,
  "sources": ["../../../src/utils/subGraphTitleMargins.ts", "../../../src/rendering-util/rendering-elements/shapes/labelImageUtils.ts"],
  "sourcesContent": ["import type { FlowchartDiagramConfig } from '../config.type.js';\n\nexport const getSubGraphTitleMargins = ({\n  flowchart,\n}: {\n  flowchart: FlowchartDiagramConfig;\n}): {\n  subGraphTitleTopMargin: number;\n  subGraphTitleBottomMargin: number;\n  subGraphTitleTotalMargin: number;\n} => {\n  const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;\n  const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;\n  const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;\n\n  return {\n    subGraphTitleTopMargin,\n    subGraphTitleBottomMargin,\n    subGraphTitleTotalMargin,\n  };\n};\n", "import { getConfig } from '../../../diagram-api/diagramAPI.js';\nimport defaultConfig from '../../../defaultConfig.js';\nimport { parseFontSize } from '../../../utils.js';\n\n/**\n * Waits for all images in a container to load and applies appropriate styling.\n * This ensures accurate bounding box measurements after images are loaded.\n *\n * @param container - The HTML element containing img tags\n * @param labelText - The original label text to check if there's text besides images\n * @returns Promise that resolves when all images are loaded and styled\n */\nexport async function configureLabelImages(\n  container: HTMLElement,\n  labelText: string\n): Promise<void> {\n  const images = container.getElementsByTagName('img');\n  if (!images || images.length === 0) {\n    return;\n  }\n\n  const noImgText = labelText.replace(/<img[^>]*>/g, '').trim() === '';\n\n  await Promise.all(\n    [...images].map(\n      (img) =>\n        new Promise((res) => {\n          function setupImage() {\n            img.style.display = 'flex';\n            img.style.flexDirection = 'column';\n\n            if (noImgText) {\n              // default size if no text\n              const bodyFontSize = getConfig().fontSize\n                ? getConfig().fontSize\n                : window.getComputedStyle(document.body).fontSize;\n              const enlargingFactor = 5;\n              const [parsedBodyFontSize = defaultConfig.fontSize] = parseFontSize(bodyFontSize);\n              const width = parsedBodyFontSize * enlargingFactor + 'px';\n              img.style.minWidth = width;\n              img.style.maxWidth = width;\n            } else {\n              img.style.width = '100%';\n            }\n            res(img);\n          }\n          setTimeout(() => {\n            if (img.complete) {\n              setupImage();\n            }\n          });\n          img.addEventListener('error', setupImage);\n          img.addEventListener('load', setupImage);\n        })\n    )\n  );\n}\n"],
  "mappings": ";;;;;;;;;;;;AAEO,IAAM,0BAA0B,wBAAC;AAAA,EACtC;AACF,MAMK;AACH,QAAM,yBAAyB,WAAW,qBAAqB,OAAO;AACtE,QAAM,4BAA4B,WAAW,qBAAqB,UAAU;AAC5E,QAAM,2BAA2B,yBAAyB;AAE1D,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GAlBuC;;;ACUvC,eAAsB,qBACpB,WACA,WACe;AACf,QAAM,SAAS,UAAU,qBAAqB,KAAK;AACnD,MAAI,CAAC,UAAU,OAAO,WAAW,GAAG;AAClC;AAAA,EACF;AAEA,QAAM,YAAY,UAAU,QAAQ,eAAe,EAAE,EAAE,KAAK,MAAM;AAElE,QAAM,QAAQ;AAAA,IACZ,CAAC,GAAG,MAAM,EAAE;AAAA,MACV,CAAC,QACC,IAAI,QAAQ,CAAC,QAAQ;AACnB,iBAAS,aAAa;AACpB,cAAI,MAAM,UAAU;AACpB,cAAI,MAAM,gBAAgB;AAE1B,cAAI,WAAW;AAEb,kBAAM,eAAe,UAAU,EAAE,WAC7B,UAAU,EAAE,WACZ,OAAO,iBAAiB,SAAS,IAAI,EAAE;AAC3C,kBAAM,kBAAkB;AACxB,kBAAM,CAAC,qBAAqB,sBAAc,QAAQ,IAAI,cAAc,YAAY;AAChF,kBAAM,QAAQ,qBAAqB,kBAAkB;AACrD,gBAAI,MAAM,WAAW;AACrB,gBAAI,MAAM,WAAW;AAAA,UACvB,OAAO;AACL,gBAAI,MAAM,QAAQ;AAAA,UACpB;AACA,cAAI,GAAG;AAAA,QACT;AAlBS;AAmBT,mBAAW,MAAM;AACf,cAAI,IAAI,UAAU;AAChB,uBAAW;AAAA,UACb;AAAA,QACF,CAAC;AACD,YAAI,iBAAiB,SAAS,UAAU;AACxC,YAAI,iBAAiB,QAAQ,UAAU;AAAA,MACzC,CAAC;AAAA,IACL;AAAA,EACF;AACF;AA5CsB;",
  "names": []
}
