@bytechain.cn/colamd 1.5.0 → 1.5.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/.trae/specs/optimize-theme-loading/checklist.md +20 -0
  2. package/.trae/specs/optimize-theme-loading/spec.md +103 -0
  3. package/.trae/specs/optimize-theme-loading/tasks.md +40 -0
  4. package/CHANGELOG.md +323 -0
  5. package/CLAUDE.md +56 -0
  6. package/README.md +422 -26
  7. package/README_CN.md +480 -28
  8. package/android/app/build/.npmkeep +0 -0
  9. package/android/app/build.gradle +76 -0
  10. package/android/app/capacitor.build.gradle +24 -0
  11. package/android/app/proguard-rules.pro +21 -0
  12. package/android/app/release.keystore +0 -0
  13. package/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
  14. package/android/app/src/main/AndroidManifest.xml +64 -0
  15. package/android/app/src/main/java/cn/bytechain/colamd/MainActivity.java +180 -0
  16. package/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
  17. package/android/app/src/main/res/drawable/splash.png +0 -0
  18. package/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  19. package/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  20. package/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  21. package/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  22. package/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  23. package/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  24. package/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  25. package/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  26. package/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  27. package/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  28. package/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  29. package/android/app/src/main/res/layout/activity_main.xml +12 -0
  30. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  31. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  32. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  33. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  34. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  35. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  36. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  37. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  38. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  39. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  40. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  41. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  42. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  43. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  44. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  45. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  46. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  47. package/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
  48. package/android/app/src/main/res/values/strings.xml +7 -0
  49. package/android/app/src/main/res/values/styles.xml +22 -0
  50. package/android/app/src/main/res/xml/file_paths.xml +5 -0
  51. package/android/app/src/main/res/xml/network_security_config.xml +8 -0
  52. package/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
  53. package/android/build.gradle +29 -0
  54. package/android/capacitor.settings.gradle +21 -0
  55. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  56. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  57. package/android/gradle.properties +22 -0
  58. package/android/gradlew +248 -0
  59. package/android/gradlew.bat +92 -0
  60. package/android/settings.gradle +5 -0
  61. package/android/variables.gradle +16 -0
  62. package/bytechain.cn-colamd-1.5.1-beta.2.tgz +0 -0
  63. package/capacitor.config.js +29 -0
  64. package/capacitor.config.ts +30 -0
  65. package/demo.md +191 -484
  66. package/dist/main/index.js +77 -46
  67. package/dist/renderer/assets/{arc-tTbbM8LO.js → arc-CPdeInCG.js} +1 -1
  68. package/dist/renderer/assets/{architectureDiagram-3BPJPVTR-CEgYow6c.js → architectureDiagram-3BPJPVTR-BAbnaR9G.js} +4 -3
  69. package/dist/renderer/assets/{blockDiagram-GPEHLZMM-LHyVtPwW.js → blockDiagram-GPEHLZMM-CYSWjnJg.js} +5 -4
  70. package/dist/renderer/assets/{c4Diagram-AAUBKEIU-C1P1eJrf.js → c4Diagram-AAUBKEIU-Rb1tstnr.js} +3 -2
  71. package/dist/renderer/assets/{channel-upve91Tq.js → channel-DpG2A6fE.js} +1 -1
  72. package/dist/renderer/assets/{chunk-2J33WTMH-lag2vhq9.js → chunk-2J33WTMH-DFc0Jxy_.js} +1 -1
  73. package/dist/renderer/assets/{chunk-4BX2VUAB-BXJ8Ggh-.js → chunk-4BX2VUAB-BhRxDTNn.js} +1 -1
  74. package/dist/renderer/assets/{chunk-55IACEB6-CiBpxRa1.js → chunk-55IACEB6-DEgMVBk8.js} +1 -1
  75. package/dist/renderer/assets/{chunk-727SXJPM-ODeKQFXC.js → chunk-727SXJPM-bjBIfiz8.js} +5 -5
  76. package/dist/renderer/assets/{chunk-AQP2D5EJ-BK7xJolB.js → chunk-AQP2D5EJ-DwQMzTzD.js} +3 -3
  77. package/dist/renderer/assets/{chunk-FMBD7UC4-BxpCZPtz.js → chunk-FMBD7UC4-CkphwJzs.js} +1 -1
  78. package/dist/renderer/assets/{chunk-ND2GUHAM-CqqaU9Ue.js → chunk-ND2GUHAM-oU09z4y4.js} +1 -1
  79. package/dist/renderer/assets/{chunk-QZHKN3VN-Biq_K124.js → chunk-QZHKN3VN-rCbVuPBn.js} +1 -1
  80. package/dist/renderer/assets/{classDiagram-v2-Q7XG4LA2-Cq95X99o.js → classDiagram-4FO5ZUOK-DGS2faoM.js} +7 -6
  81. package/dist/renderer/assets/{classDiagram-4FO5ZUOK-Cq95X99o.js → classDiagram-v2-Q7XG4LA2-DGS2faoM.js} +7 -6
  82. package/dist/renderer/assets/{cose-bilkent-S5V4N54A-XasiD0bu.js → cose-bilkent-S5V4N54A-iqY6-EwA.js} +2 -1
  83. package/dist/renderer/assets/{dagre-BM42HDAG-Nq84Gfx4.js → dagre-BM42HDAG-5t3X5sDa.js} +4 -3
  84. package/dist/renderer/assets/{diagram-2AECGRRQ-DwuB1GWt.js → diagram-2AECGRRQ-DzHiYDPh.js} +4 -3
  85. package/dist/renderer/assets/{diagram-5GNKFQAL-C2tgeI1h.js → diagram-5GNKFQAL-BiNv6Keq.js} +5 -4
  86. package/dist/renderer/assets/{diagram-KO2AKTUF-D5KzjNBc.js → diagram-KO2AKTUF-ClzeDG6f.js} +4 -3
  87. package/dist/renderer/assets/{diagram-LMA3HP47-C12xHS1c.js → diagram-LMA3HP47-CGkw7wII.js} +4 -3
  88. package/dist/renderer/assets/{diagram-OG6HWLK6-CnxI9oEa.js → diagram-OG6HWLK6-Dl-Hyk1_.js} +5 -4
  89. package/dist/renderer/assets/{erDiagram-TEJ5UH35-D_uPaKwn.js → erDiagram-TEJ5UH35-BxUN79Qb.js} +5 -4
  90. package/dist/renderer/assets/{flowDiagram-I6XJVG4X-B6q_1-tE.js → flowDiagram-I6XJVG4X-CzFk-KNI.js} +7 -6
  91. package/dist/renderer/assets/{ganttDiagram-6RSMTGT7-CFo7ifF9.js → ganttDiagram-6RSMTGT7-C2xl6Igx.js} +3 -2
  92. package/dist/renderer/assets/{gitGraphDiagram-PVQCEYII-WSexHTnq.js → gitGraphDiagram-PVQCEYII-_fn7XCa7.js} +5 -4
  93. package/dist/renderer/assets/{graph-DyX_9f6d.js → graph-CDoHYrHm.js} +1 -1
  94. package/dist/renderer/assets/index-B4uDgADr.js +530 -0
  95. package/dist/renderer/assets/index-CBcVpA3d.js +30 -0
  96. package/dist/renderer/assets/index-CGj1spkU.js +27 -0
  97. package/dist/renderer/assets/{index-dyHEFYvY.css → index-CeFpoCKV.css} +443 -400
  98. package/dist/renderer/assets/index-D4CPFkph.js +9 -0
  99. package/dist/renderer/assets/{index-DW7LS8C1.js → index-DAlXyxzt.js} +1183 -346
  100. package/dist/renderer/assets/index-DxOzbfR-.js +110 -0
  101. package/dist/renderer/assets/index-Y89U1ptl.js +9 -0
  102. package/dist/renderer/assets/{infoDiagram-5YYISTIA-DaeJdLRq.js → infoDiagram-5YYISTIA-DL6XIxLz.js} +3 -2
  103. package/dist/renderer/assets/{ishikawaDiagram-YF4QCWOH-DDCZc35f.js → ishikawaDiagram-YF4QCWOH-BUZLjRo-.js} +2 -1
  104. package/dist/renderer/assets/{journeyDiagram-JHISSGLW-BEdmpAgl.js → journeyDiagram-JHISSGLW-C4rH_mQM.js} +5 -4
  105. package/dist/renderer/assets/{kanban-definition-UN3LZRKU-BEFtQcFb.js → kanban-definition-UN3LZRKU-DRbrBcWV.js} +3 -2
  106. package/dist/renderer/assets/{layout-CAJgQHdw.js → layout-DZl4n4qu.js} +2 -2
  107. package/dist/renderer/assets/{linear-B2ggJ8Am.js → linear-B0Krxg21.js} +1 -1
  108. package/dist/renderer/assets/{mindmap-definition-RKZ34NQL-DSxVgHB5.js → mindmap-definition-RKZ34NQL-DdmPsWrn.js} +4 -3
  109. package/dist/renderer/assets/{pieDiagram-4H26LBE5-CwYoJBuL.js → pieDiagram-4H26LBE5-BPZLqwG0.js} +5 -4
  110. package/dist/renderer/assets/preload-helper-tXtZnHb0.js +88 -0
  111. package/dist/renderer/assets/{quadrantDiagram-W4KKPZXB-CST9Fvg9.js → quadrantDiagram-W4KKPZXB-Dr-oWRk9.js} +3 -2
  112. package/dist/renderer/assets/{requirementDiagram-4Y6WPE33-DtrH52jS.js → requirementDiagram-4Y6WPE33-B6QZd0lo.js} +4 -3
  113. package/dist/renderer/assets/{sankeyDiagram-5OEKKPKP-ca1tPzJ_.js → sankeyDiagram-5OEKKPKP-Cyl9ojEt.js} +2 -1
  114. package/dist/renderer/assets/{sequenceDiagram-3UESZ5HK-Dfp1EJZ7.js → sequenceDiagram-3UESZ5HK-D48Yr9T6.js} +4 -3
  115. package/dist/renderer/assets/{stateDiagram-AJRCARHV-Bha2QoNB.js → stateDiagram-AJRCARHV-qyb8ETsa.js} +7 -6
  116. package/dist/renderer/assets/{stateDiagram-v2-BHNVJYJU-DWgFUYu1.js → stateDiagram-v2-BHNVJYJU-DmDOyyrJ.js} +5 -4
  117. package/dist/renderer/assets/{timeline-definition-PNZ67QCA-C3h_-OTj.js → timeline-definition-PNZ67QCA-C-KQxTi1.js} +3 -2
  118. package/dist/renderer/assets/{vennDiagram-CIIHVFJN-DFzjSrZi.js → vennDiagram-CIIHVFJN-BdaZlnH-.js} +2 -1
  119. package/dist/renderer/assets/{wardley-L42UT6IY-Cx-VbqoS.js → wardley-L42UT6IY-b-_GPpqL.js} +1 -1
  120. package/dist/renderer/assets/{wardleyDiagram-YWT4CUSO-S2D9XqX6.js → wardleyDiagram-YWT4CUSO-B2hBE-EE.js} +4 -3
  121. package/dist/renderer/assets/web-BKE0SH0E.js +36 -0
  122. package/dist/renderer/assets/web-CBsFp24u.js +564 -0
  123. package/dist/renderer/assets/web-Dc8YgoHP.js +24 -0
  124. package/dist/renderer/assets/web-TfDzToU7.js +58 -0
  125. package/dist/renderer/assets/{xychartDiagram-2RQKCTM6-Cfxigbts.js → xychartDiagram-2RQKCTM6-CSvswDTY.js} +3 -2
  126. package/dist/renderer/index.html +62 -3
  127. package/docs/academic-demo.md +566 -0
  128. package/docs/demo.html +748 -0
  129. package/docs/demo.md +546 -0
  130. package/docs/demo.pdf +0 -0
  131. package/docs/theme-paradigm.md +658 -0
  132. package/electron-builder.yml +7 -0
  133. package/electron.vite.config.js +31 -0
  134. package/electron.vite.config.ts +1 -1
  135. package/ios/App/App/AppDelegate.swift +49 -0
  136. package/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  137. package/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  138. package/ios/App/App/Assets.xcassets/Contents.json +6 -0
  139. package/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  140. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  141. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  142. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  143. package/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  144. package/ios/App/App/Base.lproj/Main.storyboard +19 -0
  145. package/ios/App/App/Info.plist +49 -0
  146. package/ios/App/App.xcodeproj/project.pbxproj +408 -0
  147. package/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  148. package/ios/App/Podfile +28 -0
  149. package/package.json +23 -3
  150. package/resources/templates/slides/template-forest-ink.html +540 -0
  151. package/scripts/generate-icons.js +102 -0
  152. package/src/main/index.ts +87 -63
  153. package/src/preload/index.d.ts +51 -0
  154. package/src/preload/index.js +70 -0
  155. package/src/renderer/capacitor-api.ts +713 -0
  156. package/src/renderer/editor/editor.ts +87 -4
  157. package/src/renderer/editor/plugins/index.ts +24 -32
  158. package/src/renderer/editor/plugins/math-plugin.ts +1 -1
  159. package/src/renderer/editor/plugins/mermaid-plugin-custom.css +13 -398
  160. package/src/renderer/editor/plugins/mermaid-plugin.ts +62 -71
  161. package/src/renderer/editor/plugins/themes/base/dark.css +23 -0
  162. package/src/renderer/editor/plugins/themes/base/elegant.css +32 -0
  163. package/src/renderer/editor/plugins/themes/base/light.css +20 -0
  164. package/src/renderer/editor/plugins/themes/base/newsprint.css +27 -0
  165. package/src/renderer/editor/plugins/themes/components/mermaid/academic.css +43 -0
  166. package/src/renderer/editor/plugins/themes/components/mermaid/dark.css +20 -0
  167. package/src/renderer/editor/plugins/themes/components/mermaid/elegant.css +24 -0
  168. package/src/renderer/editor/plugins/themes/components/mermaid/light.css +21 -0
  169. package/src/renderer/editor/plugins/themes/components/mermaid/newsprint.css +26 -0
  170. package/src/renderer/editor/plugins/themes/components/mermaid/variables.css +592 -0
  171. package/src/renderer/editor/plugins/themes/foundation.css +143 -0
  172. package/src/renderer/editor/plugins/themes/theme-manager.ts +92 -0
  173. package/src/renderer/env.d.ts +4 -1
  174. package/src/renderer/index.html +59 -1
  175. package/src/renderer/main.ts +432 -57
  176. package/src/renderer/mobile.css +429 -0
  177. package/themes/README.md +3 -0
  178. package/themes/academic-paper.css +1321 -0
  179. package/themes/elegant.css +14 -7
  180. package/themes/forest-ink.css +664 -0
  181. package/themes/pixso-design.css +1261 -0
  182. package/themes/swiss-design.css +596 -0
  183. package/themes/template.css +498 -0
  184. package/tsconfig.main.json +1 -0
  185. package/tsconfig.main.tsbuildinfo +1 -0
  186. package/tsconfig.preload.json +1 -0
  187. package/tsconfig.preload.tsbuildinfo +1 -0
  188. package/tsconfig.renderer.json +1 -0
  189. package/tsconfig.renderer.tsbuildinfo +1 -0
  190. package/tsconfig.tsbuildinfo +1 -0
  191. package/.trae/documents/fix-mermaid-colors-and-sankey.md +0 -50
  192. package/src/renderer/themes/theme-manager.ts +0 -40
  193. /package/src/renderer/{themes → editor/plugins/themes}/base.css +0 -0
@@ -1,4 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dagre-BM42HDAG-Nq84Gfx4.js","./graph-DyX_9f6d.js","./layout-CAJgQHdw.js","./cose-bilkent-S5V4N54A-XasiD0bu.js","./cytoscape.esm-CpHeHM5e.js","./c4Diagram-AAUBKEIU-C1P1eJrf.js","./chunk-ND2GUHAM-CqqaU9Ue.js","./flowDiagram-I6XJVG4X-B6q_1-tE.js","./chunk-FMBD7UC4-BxpCZPtz.js","./chunk-55IACEB6-CiBpxRa1.js","./chunk-2J33WTMH-lag2vhq9.js","./channel-upve91Tq.js","./erDiagram-TEJ5UH35-D_uPaKwn.js","./gitGraphDiagram-PVQCEYII-WSexHTnq.js","./chunk-4BX2VUAB-BXJ8Ggh-.js","./chunk-QZHKN3VN-Biq_K124.js","./wardley-L42UT6IY-Cx-VbqoS.js","./ganttDiagram-6RSMTGT7-CFo7ifF9.js","./linear-B2ggJ8Am.js","./init-ZxktEp_H.js","./defaultLocale-B2RvLBDe.js","./infoDiagram-5YYISTIA-DaeJdLRq.js","./pieDiagram-4H26LBE5-CwYoJBuL.js","./arc-tTbbM8LO.js","./ordinal-DSZU4PqD.js","./quadrantDiagram-W4KKPZXB-CST9Fvg9.js","./xychartDiagram-2RQKCTM6-Cfxigbts.js","./requirementDiagram-4Y6WPE33-DtrH52jS.js","./sequenceDiagram-3UESZ5HK-Dfp1EJZ7.js","./classDiagram-4FO5ZUOK-Cq95X99o.js","./chunk-727SXJPM-ODeKQFXC.js","./classDiagram-v2-Q7XG4LA2-Cq95X99o.js","./stateDiagram-AJRCARHV-Bha2QoNB.js","./chunk-AQP2D5EJ-BK7xJolB.js","./stateDiagram-v2-BHNVJYJU-DWgFUYu1.js","./journeyDiagram-JHISSGLW-BEdmpAgl.js","./timeline-definition-PNZ67QCA-C3h_-OTj.js","./mindmap-definition-RKZ34NQL-DSxVgHB5.js","./kanban-definition-UN3LZRKU-BEFtQcFb.js","./sankeyDiagram-5OEKKPKP-ca1tPzJ_.js","./diagram-LMA3HP47-C12xHS1c.js","./diagram-2AECGRRQ-DwuB1GWt.js","./blockDiagram-GPEHLZMM-LHyVtPwW.js","./diagram-5GNKFQAL-C2tgeI1h.js","./architectureDiagram-3BPJPVTR-CEgYow6c.js","./diagram-KO2AKTUF-D5KzjNBc.js","./diagram-OG6HWLK6-CnxI9oEa.js","./wardleyDiagram-YWT4CUSO-S2D9XqX6.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dagre-BM42HDAG-5t3X5sDa.js","./graph-CDoHYrHm.js","./layout-DZl4n4qu.js","./preload-helper-tXtZnHb0.js","./cose-bilkent-S5V4N54A-iqY6-EwA.js","./cytoscape.esm-CpHeHM5e.js","./c4Diagram-AAUBKEIU-Rb1tstnr.js","./chunk-ND2GUHAM-oU09z4y4.js","./flowDiagram-I6XJVG4X-CzFk-KNI.js","./chunk-FMBD7UC4-CkphwJzs.js","./chunk-55IACEB6-DEgMVBk8.js","./chunk-2J33WTMH-DFc0Jxy_.js","./channel-DpG2A6fE.js","./erDiagram-TEJ5UH35-BxUN79Qb.js","./gitGraphDiagram-PVQCEYII-_fn7XCa7.js","./chunk-4BX2VUAB-BhRxDTNn.js","./chunk-QZHKN3VN-rCbVuPBn.js","./wardley-L42UT6IY-b-_GPpqL.js","./ganttDiagram-6RSMTGT7-C2xl6Igx.js","./linear-B0Krxg21.js","./init-ZxktEp_H.js","./defaultLocale-B2RvLBDe.js","./infoDiagram-5YYISTIA-DL6XIxLz.js","./pieDiagram-4H26LBE5-BPZLqwG0.js","./arc-CPdeInCG.js","./ordinal-DSZU4PqD.js","./quadrantDiagram-W4KKPZXB-Dr-oWRk9.js","./xychartDiagram-2RQKCTM6-CSvswDTY.js","./requirementDiagram-4Y6WPE33-B6QZd0lo.js","./sequenceDiagram-3UESZ5HK-D48Yr9T6.js","./classDiagram-4FO5ZUOK-DGS2faoM.js","./chunk-727SXJPM-bjBIfiz8.js","./classDiagram-v2-Q7XG4LA2-DGS2faoM.js","./stateDiagram-AJRCARHV-qyb8ETsa.js","./chunk-AQP2D5EJ-DwQMzTzD.js","./stateDiagram-v2-BHNVJYJU-DmDOyyrJ.js","./journeyDiagram-JHISSGLW-C4rH_mQM.js","./timeline-definition-PNZ67QCA-C-KQxTi1.js","./mindmap-definition-RKZ34NQL-DdmPsWrn.js","./kanban-definition-UN3LZRKU-DRbrBcWV.js","./sankeyDiagram-5OEKKPKP-Cyl9ojEt.js","./diagram-LMA3HP47-CGkw7wII.js","./diagram-2AECGRRQ-DzHiYDPh.js","./blockDiagram-GPEHLZMM-CYSWjnJg.js","./diagram-5GNKFQAL-BiNv6Keq.js","./architectureDiagram-3BPJPVTR-BAbnaR9G.js","./diagram-KO2AKTUF-ClzeDG6f.js","./ishikawaDiagram-YF4QCWOH-BUZLjRo-.js","./vennDiagram-CIIHVFJN-BdaZlnH-.js","./diagram-OG6HWLK6-Dl-Hyk1_.js","./wardleyDiagram-YWT4CUSO-B2hBE-EE.js","./index-CBcVpA3d.js","./index-B4uDgADr.js","./index-Y89U1ptl.js","./index-D4CPFkph.js","./index-DxOzbfR-.js","./index-CGj1spkU.js"])))=>i.map(i=>d[i]);
2
+ import { _ as __vitePreload } from "./preload-helper-tXtZnHb0.js";
2
3
  var ErrorCode = /* @__PURE__ */ (function(ErrorCode2) {
3
4
  ErrorCode2["docTypeError"] = "docTypeError";
4
5
  ErrorCode2["contextNotFound"] = "contextNotFound";
@@ -748,15 +749,15 @@ function initializeDocument(effects) {
748
749
  }
749
750
  const indexBeforeExits = self2.events.length;
750
751
  let indexBeforeFlow = indexBeforeExits;
751
- let seen2;
752
+ let seen;
752
753
  let point2;
753
754
  while (indexBeforeFlow--) {
754
755
  if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
755
- if (seen2) {
756
+ if (seen) {
756
757
  point2 = self2.events[indexBeforeFlow][1].end;
757
758
  break;
758
759
  }
759
- seen2 = true;
760
+ seen = true;
760
761
  }
761
762
  }
762
763
  exitContainers(continued);
@@ -2053,7 +2054,7 @@ function factoryDestination(effects, ok2, nok, type2, literalType, literalMarker
2053
2054
  function factoryLabel(effects, ok2, nok, type2, markerType, stringType) {
2054
2055
  const self2 = this;
2055
2056
  let size = 0;
2056
- let seen2;
2057
+ let seen;
2057
2058
  return start2;
2058
2059
  function start2(code2) {
2059
2060
  effects.enter(type2);
@@ -2064,7 +2065,7 @@ function factoryLabel(effects, ok2, nok, type2, markerType, stringType) {
2064
2065
  return atBreak;
2065
2066
  }
2066
2067
  function atBreak(code2) {
2067
- if (size > 999 || code2 === null || code2 === 91 || code2 === 93 && !seen2 || // To do: remove in the future once we’ve switched from
2068
+ if (size > 999 || code2 === null || code2 === 91 || code2 === 93 && !seen || // To do: remove in the future once we’ve switched from
2068
2069
  // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
2069
2070
  // which doesn’t need this.
2070
2071
  // Hidden footnotes hook.
@@ -2097,7 +2098,7 @@ function factoryLabel(effects, ok2, nok, type2, markerType, stringType) {
2097
2098
  return atBreak(code2);
2098
2099
  }
2099
2100
  effects.consume(code2);
2100
- if (!seen2) seen2 = !markdownSpace(code2);
2101
+ if (!seen) seen = !markdownSpace(code2);
2101
2102
  return code2 === 92 ? labelEscape : labelInside;
2102
2103
  }
2103
2104
  function labelEscape(code2) {
@@ -2170,18 +2171,18 @@ function factoryTitle(effects, ok2, nok, type2, markerType, stringType) {
2170
2171
  }
2171
2172
  }
2172
2173
  function factoryWhitespace(effects, ok2) {
2173
- let seen2;
2174
+ let seen;
2174
2175
  return start2;
2175
2176
  function start2(code2) {
2176
2177
  if (markdownLineEnding(code2)) {
2177
2178
  effects.enter("lineEnding");
2178
2179
  effects.consume(code2);
2179
2180
  effects.exit("lineEnding");
2180
- seen2 = true;
2181
+ seen = true;
2181
2182
  return start2;
2182
2183
  }
2183
2184
  if (markdownSpace(code2)) {
2184
- return factorySpace(effects, start2, seen2 ? "linePrefix" : "lineSuffix")(code2);
2185
+ return factorySpace(effects, start2, seen ? "linePrefix" : "lineSuffix")(code2);
2185
2186
  }
2186
2187
  return ok2(code2);
2187
2188
  }
@@ -10037,15 +10038,15 @@ class ContentMatch {
10037
10038
  content expression.
10038
10039
  */
10039
10040
  fillBefore(after, toEnd = false, startIndex = 0) {
10040
- let seen2 = [this];
10041
+ let seen = [this];
10041
10042
  function search2(match, types) {
10042
10043
  let finished = match.matchFragment(after, startIndex);
10043
10044
  if (finished && (!toEnd || finished.validEnd))
10044
10045
  return Fragment.from(types.map((tp) => tp.createAndFill()));
10045
10046
  for (let i2 = 0; i2 < match.next.length; i2++) {
10046
10047
  let { type: type2, next: next2 } = match.next[i2];
10047
- if (!(type2.isText || type2.hasRequiredAttrs()) && seen2.indexOf(next2) == -1) {
10048
- seen2.push(next2);
10048
+ if (!(type2.isText || type2.hasRequiredAttrs()) && seen.indexOf(next2) == -1) {
10049
+ seen.push(next2);
10049
10050
  let found2 = search2(next2, types.concat(type2));
10050
10051
  if (found2)
10051
10052
  return found2;
@@ -10073,7 +10074,7 @@ class ContentMatch {
10073
10074
  @internal
10074
10075
  */
10075
10076
  computeWrapping(target) {
10076
- let seen2 = /* @__PURE__ */ Object.create(null), active = [{ match: this, type: null, via: null }];
10077
+ let seen = /* @__PURE__ */ Object.create(null), active = [{ match: this, type: null, via: null }];
10077
10078
  while (active.length) {
10078
10079
  let current = active.shift(), match = current.match;
10079
10080
  if (match.matchType(target)) {
@@ -10084,9 +10085,9 @@ class ContentMatch {
10084
10085
  }
10085
10086
  for (let i2 = 0; i2 < match.next.length; i2++) {
10086
10087
  let { type: type2, next: next2 } = match.next[i2];
10087
- if (!type2.isLeaf && !type2.hasRequiredAttrs() && !(type2.name in seen2) && (!current.type || next2.validEnd)) {
10088
+ if (!type2.isLeaf && !type2.hasRequiredAttrs() && !(type2.name in seen) && (!current.type || next2.validEnd)) {
10088
10089
  active.push({ match: type2.contentMatch, type: type2, via: current });
10089
- seen2[type2.name] = true;
10090
+ seen[type2.name] = true;
10090
10091
  }
10091
10092
  }
10092
10093
  }
@@ -10112,18 +10113,18 @@ class ContentMatch {
10112
10113
  @internal
10113
10114
  */
10114
10115
  toString() {
10115
- let seen2 = [];
10116
+ let seen = [];
10116
10117
  function scan(m2) {
10117
- seen2.push(m2);
10118
+ seen.push(m2);
10118
10119
  for (let i2 = 0; i2 < m2.next.length; i2++)
10119
- if (seen2.indexOf(m2.next[i2].next) == -1)
10120
+ if (seen.indexOf(m2.next[i2].next) == -1)
10120
10121
  scan(m2.next[i2].next);
10121
10122
  }
10122
10123
  scan(this);
10123
- return seen2.map((m2, i2) => {
10124
+ return seen.map((m2, i2) => {
10124
10125
  let out = i2 + (m2.validEnd ? "*" : " ") + " ";
10125
10126
  for (let i3 = 0; i3 < m2.next.length; i3++)
10126
- out += (i3 ? ", " : "") + m2.next[i3].type.name + "->" + seen2.indexOf(m2.next[i3].next);
10127
+ out += (i3 ? ", " : "") + m2.next[i3].type.name + "->" + seen.indexOf(m2.next[i3].next);
10127
10128
  return out;
10128
10129
  }).join("\n");
10129
10130
  }
@@ -11442,13 +11443,13 @@ function markMayApply(markType, nodeType) {
11442
11443
  let parent = nodes[name];
11443
11444
  if (!parent.allowsMarkType(markType))
11444
11445
  continue;
11445
- let seen2 = [], scan = (match) => {
11446
- seen2.push(match);
11446
+ let seen = [], scan = (match) => {
11447
+ seen.push(match);
11447
11448
  for (let i2 = 0; i2 < match.edgeCount; i2++) {
11448
11449
  let { type: type2, next: next2 } = match.edge(i2);
11449
11450
  if (type2 == nodeType)
11450
11451
  return true;
11451
- if (seen2.indexOf(next2) < 0 && scan(next2))
11452
+ if (seen.indexOf(next2) < 0 && scan(next2))
11452
11453
  return true;
11453
11454
  }
11454
11455
  };
@@ -14213,27 +14214,27 @@ class EditorState {
14213
14214
  applyTransaction(rootTr) {
14214
14215
  if (!this.filterTransaction(rootTr))
14215
14216
  return { state: this, transactions: [] };
14216
- let trs = [rootTr], newState = this.applyInner(rootTr), seen2 = null;
14217
+ let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
14217
14218
  for (; ; ) {
14218
14219
  let haveNew = false;
14219
14220
  for (let i2 = 0; i2 < this.config.plugins.length; i2++) {
14220
14221
  let plugin26 = this.config.plugins[i2];
14221
14222
  if (plugin26.spec.appendTransaction) {
14222
- let n2 = seen2 ? seen2[i2].n : 0, oldState = seen2 ? seen2[i2].state : this;
14223
+ let n2 = seen ? seen[i2].n : 0, oldState = seen ? seen[i2].state : this;
14223
14224
  let tr = n2 < trs.length && plugin26.spec.appendTransaction.call(plugin26, n2 ? trs.slice(n2) : trs, oldState, newState);
14224
14225
  if (tr && newState.filterTransaction(tr, i2)) {
14225
14226
  tr.setMeta("appendedTransaction", rootTr);
14226
- if (!seen2) {
14227
- seen2 = [];
14227
+ if (!seen) {
14228
+ seen = [];
14228
14229
  for (let j2 = 0; j2 < this.config.plugins.length; j2++)
14229
- seen2.push(j2 < i2 ? { state: newState, n: trs.length } : { state: this, n: 0 });
14230
+ seen.push(j2 < i2 ? { state: newState, n: trs.length } : { state: this, n: 0 });
14230
14231
  }
14231
14232
  trs.push(tr);
14232
14233
  newState = newState.applyInner(tr);
14233
14234
  haveNew = true;
14234
14235
  }
14235
- if (seen2)
14236
- seen2[i2] = { state: newState, n: trs.length };
14236
+ if (seen)
14237
+ seen[i2] = { state: newState, n: trs.length };
14237
14238
  }
14238
14239
  }
14239
14240
  if (!haveNew)
@@ -21862,21 +21863,18 @@ function getAllPluginModules() {
21862
21863
  function getAllPlugins() {
21863
21864
  return modules.map((m2) => m2.info);
21864
21865
  }
21865
- function togglePlugin(id33) {
21866
- const m2 = modules.find((m22) => m22.info.id === id33);
21867
- if (m2) m2.info.enabled = !m2.info.enabled;
21868
- }
21869
- function findExportCapabilities(selector2) {
21866
+ function findExportCapabilities(className) {
21870
21867
  for (const m2 of modules) {
21871
- if (!m2.info.enabled || !m2.info.exportCapabilities?.length) continue;
21872
- for (const nodeType of m2.info.nodeTypes) {
21873
- if (selector2.includes(nodeType.replace(/_/g, "-"))) {
21874
- return m2.info.exportCapabilities;
21875
- }
21868
+ if (m2.info.enabled && m2.info.exportCapabilities && m2.info.nodeTypes?.some((nt2) => className.includes(nt2.replace(/_/g, "-")))) {
21869
+ return m2.info.exportCapabilities;
21876
21870
  }
21877
21871
  }
21878
21872
  return [];
21879
21873
  }
21874
+ function togglePlugin(id33, enabled) {
21875
+ const mod = modules.find((m2) => m2.info.id === id33);
21876
+ if (mod) mod.info.enabled = enabled;
21877
+ }
21880
21878
  class ParseError extends Error {
21881
21879
  // The underlying error message without any context added.
21882
21880
  constructor(message, token2) {
@@ -37022,7 +37020,7 @@ const mathBlockView = $view(mathBlockSchema, (_ctx) => {
37022
37020
  div.addEventListener("focusout", (e2) => {
37023
37021
  const target = e2.target;
37024
37022
  if (!target.classList.contains("math-block-raw")) return;
37025
- const rawValue = target.value;
37023
+ const rawValue = e2.target.value;
37026
37024
  const newText = rawValue.replace(/^\$\$\s*\n?/, "").replace(/\n?\s*\$\$$/, "").trim();
37027
37025
  const pos = getPos();
37028
37026
  if (pos != null && node2.attrs.text !== newText) {
@@ -37074,91 +37072,6 @@ registerPluginModule({
37074
37072
  info: mathPlugin,
37075
37073
  milkdownPlugins: [mathInlineSchema, mathBlockSchema, mathInlineView, mathBlockView]
37076
37074
  });
37077
- const scriptRel = /* @__PURE__ */ (function detectScriptRel() {
37078
- const relList = typeof document !== "undefined" && document.createElement("link").relList;
37079
- return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
37080
- })();
37081
- const assetsURL = function(dep, importerUrl) {
37082
- return new URL(dep, importerUrl).href;
37083
- };
37084
- const seen = {};
37085
- const __vitePreload = function preload(baseModule, deps, importerUrl) {
37086
- let promise = Promise.resolve();
37087
- if (deps && deps.length > 0) {
37088
- let allSettled2 = function(promises) {
37089
- return Promise.all(
37090
- promises.map(
37091
- (p2) => Promise.resolve(p2).then(
37092
- (value) => ({ status: "fulfilled", value }),
37093
- (reason) => ({ status: "rejected", reason })
37094
- )
37095
- )
37096
- );
37097
- };
37098
- const links = document.getElementsByTagName("link");
37099
- const cspNonceMeta = document.querySelector(
37100
- "meta[property=csp-nonce]"
37101
- );
37102
- const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
37103
- promise = allSettled2(
37104
- deps.map((dep) => {
37105
- dep = assetsURL(dep, importerUrl);
37106
- if (dep in seen) return;
37107
- seen[dep] = true;
37108
- const isCss = dep.endsWith(".css");
37109
- const cssSelector = isCss ? '[rel="stylesheet"]' : "";
37110
- const isBaseRelative = !!importerUrl;
37111
- if (isBaseRelative) {
37112
- for (let i2 = links.length - 1; i2 >= 0; i2--) {
37113
- const link22 = links[i2];
37114
- if (link22.href === dep && (!isCss || link22.rel === "stylesheet")) {
37115
- return;
37116
- }
37117
- }
37118
- } else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
37119
- return;
37120
- }
37121
- const link2 = document.createElement("link");
37122
- link2.rel = isCss ? "stylesheet" : scriptRel;
37123
- if (!isCss) {
37124
- link2.as = "script";
37125
- }
37126
- link2.crossOrigin = "";
37127
- link2.href = dep;
37128
- if (cspNonce) {
37129
- link2.setAttribute("nonce", cspNonce);
37130
- }
37131
- document.head.appendChild(link2);
37132
- if (isCss) {
37133
- return new Promise((res, rej) => {
37134
- link2.addEventListener("load", res);
37135
- link2.addEventListener(
37136
- "error",
37137
- () => rej(new Error(`Unable to preload CSS for ${dep}`))
37138
- );
37139
- });
37140
- }
37141
- })
37142
- );
37143
- }
37144
- function handlePreloadError(err) {
37145
- const e2 = new Event("vite:preloadError", {
37146
- cancelable: true
37147
- });
37148
- e2.payload = err;
37149
- window.dispatchEvent(e2);
37150
- if (!e2.defaultPrevented) {
37151
- throw err;
37152
- }
37153
- }
37154
- return promise.then((res) => {
37155
- for (const item of res || []) {
37156
- if (item.status !== "rejected") continue;
37157
- handlePreloadError(item.reason);
37158
- }
37159
- return baseModule().catch(handlePreloadError);
37160
- });
37161
- };
37162
37075
  var dayjs_min$1 = { exports: {} };
37163
37076
  var dayjs_min = dayjs_min$1.exports;
37164
37077
  var hasRequiredDayjs_min;
@@ -61025,12 +60938,12 @@ var registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => {
61025
60938
  registerLayoutLoaders([
61026
60939
  {
61027
60940
  name: "dagre",
61028
- loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./dagre-BM42HDAG-Nq84Gfx4.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url), "loader")
60941
+ loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./dagre-BM42HDAG-5t3X5sDa.js"), true ? __vite__mapDeps([0,1,2,3]) : void 0, import.meta.url), "loader")
61029
60942
  },
61030
60943
  ...[
61031
60944
  {
61032
60945
  name: "cose-bilkent",
61033
- loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./cose-bilkent-S5V4N54A-XasiD0bu.js"), true ? __vite__mapDeps([3,4]) : void 0, import.meta.url), "loader")
60946
+ loader: /* @__PURE__ */ __name(async () => await __vitePreload(() => import("./cose-bilkent-S5V4N54A-iqY6-EwA.js"), true ? __vite__mapDeps([4,5,3]) : void 0, import.meta.url), "loader")
61034
60947
  }
61035
60948
  ]
61036
60949
  ]);
@@ -61440,9 +61353,9 @@ var detector = /* @__PURE__ */ __name((txt) => {
61440
61353
  }, "detector");
61441
61354
  var loader = /* @__PURE__ */ __name(async () => {
61442
61355
  const { diagram: diagram2 } = await __vitePreload(async () => {
61443
- const { diagram: diagram22 } = await import("./c4Diagram-AAUBKEIU-C1P1eJrf.js");
61356
+ const { diagram: diagram22 } = await import("./c4Diagram-AAUBKEIU-Rb1tstnr.js");
61444
61357
  return { diagram: diagram22 };
61445
- }, true ? __vite__mapDeps([5,6]) : void 0, import.meta.url);
61358
+ }, true ? __vite__mapDeps([6,7,3]) : void 0, import.meta.url);
61446
61359
  return { id: id$2, diagram: diagram2 };
61447
61360
  }, "loader");
61448
61361
  var plugin = {
@@ -61460,9 +61373,9 @@ var detector2 = /* @__PURE__ */ __name((txt, config2) => {
61460
61373
  }, "detector");
61461
61374
  var loader2 = /* @__PURE__ */ __name(async () => {
61462
61375
  const { diagram: diagram2 } = await __vitePreload(async () => {
61463
- const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-B6q_1-tE.js");
61376
+ const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-CzFk-KNI.js");
61464
61377
  return { diagram: diagram22 };
61465
- }, true ? __vite__mapDeps([7,8,6,9,10,11]) : void 0, import.meta.url);
61378
+ }, true ? __vite__mapDeps([8,9,7,10,11,12,3]) : void 0, import.meta.url);
61466
61379
  return { id: id2, diagram: diagram2 };
61467
61380
  }, "loader");
61468
61381
  var plugin2 = {
@@ -61486,9 +61399,9 @@ var detector3 = /* @__PURE__ */ __name((txt, config2) => {
61486
61399
  }, "detector");
61487
61400
  var loader3 = /* @__PURE__ */ __name(async () => {
61488
61401
  const { diagram: diagram2 } = await __vitePreload(async () => {
61489
- const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-B6q_1-tE.js");
61402
+ const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-CzFk-KNI.js");
61490
61403
  return { diagram: diagram22 };
61491
- }, true ? __vite__mapDeps([7,8,6,9,10,11]) : void 0, import.meta.url);
61404
+ }, true ? __vite__mapDeps([8,9,7,10,11,12,3]) : void 0, import.meta.url);
61492
61405
  return { id: id3, diagram: diagram2 };
61493
61406
  }, "loader");
61494
61407
  var plugin3 = {
@@ -61503,9 +61416,9 @@ var detector4 = /* @__PURE__ */ __name((txt) => {
61503
61416
  }, "detector");
61504
61417
  var loader4 = /* @__PURE__ */ __name(async () => {
61505
61418
  const { diagram: diagram2 } = await __vitePreload(async () => {
61506
- const { diagram: diagram22 } = await import("./erDiagram-TEJ5UH35-D_uPaKwn.js");
61419
+ const { diagram: diagram22 } = await import("./erDiagram-TEJ5UH35-BxUN79Qb.js");
61507
61420
  return { diagram: diagram22 };
61508
- }, true ? __vite__mapDeps([12,9,10,11]) : void 0, import.meta.url);
61421
+ }, true ? __vite__mapDeps([13,10,11,12,3]) : void 0, import.meta.url);
61509
61422
  return { id: id4, diagram: diagram2 };
61510
61423
  }, "loader");
61511
61424
  var plugin4 = {
@@ -61520,9 +61433,9 @@ var detector5 = /* @__PURE__ */ __name((txt) => {
61520
61433
  }, "detector");
61521
61434
  var loader5 = /* @__PURE__ */ __name(async () => {
61522
61435
  const { diagram: diagram2 } = await __vitePreload(async () => {
61523
- const { diagram: diagram22 } = await import("./gitGraphDiagram-PVQCEYII-WSexHTnq.js");
61436
+ const { diagram: diagram22 } = await import("./gitGraphDiagram-PVQCEYII-_fn7XCa7.js");
61524
61437
  return { diagram: diagram22 };
61525
- }, true ? __vite__mapDeps([13,14,15,16]) : void 0, import.meta.url);
61438
+ }, true ? __vite__mapDeps([14,15,16,17,3]) : void 0, import.meta.url);
61526
61439
  return { id: id5, diagram: diagram2 };
61527
61440
  }, "loader");
61528
61441
  var plugin5 = {
@@ -61537,9 +61450,9 @@ var detector6 = /* @__PURE__ */ __name((txt) => {
61537
61450
  }, "detector");
61538
61451
  var loader6 = /* @__PURE__ */ __name(async () => {
61539
61452
  const { diagram: diagram2 } = await __vitePreload(async () => {
61540
- const { diagram: diagram22 } = await import("./ganttDiagram-6RSMTGT7-CFo7ifF9.js");
61453
+ const { diagram: diagram22 } = await import("./ganttDiagram-6RSMTGT7-C2xl6Igx.js");
61541
61454
  return { diagram: diagram22 };
61542
- }, true ? __vite__mapDeps([17,18,19,20]) : void 0, import.meta.url);
61455
+ }, true ? __vite__mapDeps([18,19,20,21,3]) : void 0, import.meta.url);
61543
61456
  return { id: id6, diagram: diagram2 };
61544
61457
  }, "loader");
61545
61458
  var plugin6 = {
@@ -61554,9 +61467,9 @@ var detector7 = /* @__PURE__ */ __name((txt) => {
61554
61467
  }, "detector");
61555
61468
  var loader7 = /* @__PURE__ */ __name(async () => {
61556
61469
  const { diagram: diagram2 } = await __vitePreload(async () => {
61557
- const { diagram: diagram22 } = await import("./infoDiagram-5YYISTIA-DaeJdLRq.js");
61470
+ const { diagram: diagram22 } = await import("./infoDiagram-5YYISTIA-DL6XIxLz.js");
61558
61471
  return { diagram: diagram22 };
61559
- }, true ? __vite__mapDeps([21,16]) : void 0, import.meta.url);
61472
+ }, true ? __vite__mapDeps([22,17,3]) : void 0, import.meta.url);
61560
61473
  return { id: id7, diagram: diagram2 };
61561
61474
  }, "loader");
61562
61475
  var info = {
@@ -61570,9 +61483,9 @@ var detector8 = /* @__PURE__ */ __name((txt) => {
61570
61483
  }, "detector");
61571
61484
  var loader8 = /* @__PURE__ */ __name(async () => {
61572
61485
  const { diagram: diagram2 } = await __vitePreload(async () => {
61573
- const { diagram: diagram22 } = await import("./pieDiagram-4H26LBE5-CwYoJBuL.js");
61486
+ const { diagram: diagram22 } = await import("./pieDiagram-4H26LBE5-BPZLqwG0.js");
61574
61487
  return { diagram: diagram22 };
61575
- }, true ? __vite__mapDeps([22,14,16,23,24,19]) : void 0, import.meta.url);
61488
+ }, true ? __vite__mapDeps([23,15,17,3,24,25,20]) : void 0, import.meta.url);
61576
61489
  return { id: id8, diagram: diagram2 };
61577
61490
  }, "loader");
61578
61491
  var pie = {
@@ -61586,9 +61499,9 @@ var detector9 = /* @__PURE__ */ __name((txt) => {
61586
61499
  }, "detector");
61587
61500
  var loader9 = /* @__PURE__ */ __name(async () => {
61588
61501
  const { diagram: diagram2 } = await __vitePreload(async () => {
61589
- const { diagram: diagram22 } = await import("./quadrantDiagram-W4KKPZXB-CST9Fvg9.js");
61502
+ const { diagram: diagram22 } = await import("./quadrantDiagram-W4KKPZXB-Dr-oWRk9.js");
61590
61503
  return { diagram: diagram22 };
61591
- }, true ? __vite__mapDeps([25,18,19,20]) : void 0, import.meta.url);
61504
+ }, true ? __vite__mapDeps([26,19,20,21,3]) : void 0, import.meta.url);
61592
61505
  return { id: id9, diagram: diagram2 };
61593
61506
  }, "loader");
61594
61507
  var plugin7 = {
@@ -61603,9 +61516,9 @@ var detector10 = /* @__PURE__ */ __name((txt) => {
61603
61516
  }, "detector");
61604
61517
  var loader10 = /* @__PURE__ */ __name(async () => {
61605
61518
  const { diagram: diagram2 } = await __vitePreload(async () => {
61606
- const { diagram: diagram22 } = await import("./xychartDiagram-2RQKCTM6-Cfxigbts.js");
61519
+ const { diagram: diagram22 } = await import("./xychartDiagram-2RQKCTM6-CSvswDTY.js");
61607
61520
  return { diagram: diagram22 };
61608
- }, true ? __vite__mapDeps([26,19,24,18,20]) : void 0, import.meta.url);
61521
+ }, true ? __vite__mapDeps([27,20,25,19,21,3]) : void 0, import.meta.url);
61609
61522
  return { id: id10, diagram: diagram2 };
61610
61523
  }, "loader");
61611
61524
  var plugin8 = {
@@ -61620,9 +61533,9 @@ var detector11 = /* @__PURE__ */ __name((txt) => {
61620
61533
  }, "detector");
61621
61534
  var loader11 = /* @__PURE__ */ __name(async () => {
61622
61535
  const { diagram: diagram2 } = await __vitePreload(async () => {
61623
- const { diagram: diagram22 } = await import("./requirementDiagram-4Y6WPE33-DtrH52jS.js");
61536
+ const { diagram: diagram22 } = await import("./requirementDiagram-4Y6WPE33-B6QZd0lo.js");
61624
61537
  return { diagram: diagram22 };
61625
- }, true ? __vite__mapDeps([27,9,10]) : void 0, import.meta.url);
61538
+ }, true ? __vite__mapDeps([28,10,11,3]) : void 0, import.meta.url);
61626
61539
  return { id: id11, diagram: diagram2 };
61627
61540
  }, "loader");
61628
61541
  var plugin9 = {
@@ -61637,9 +61550,9 @@ var detector12 = /* @__PURE__ */ __name((txt) => {
61637
61550
  }, "detector");
61638
61551
  var loader12 = /* @__PURE__ */ __name(async () => {
61639
61552
  const { diagram: diagram2 } = await __vitePreload(async () => {
61640
- const { diagram: diagram22 } = await import("./sequenceDiagram-3UESZ5HK-Dfp1EJZ7.js");
61553
+ const { diagram: diagram22 } = await import("./sequenceDiagram-3UESZ5HK-D48Yr9T6.js");
61641
61554
  return { diagram: diagram22 };
61642
- }, true ? __vite__mapDeps([28,6,15]) : void 0, import.meta.url);
61555
+ }, true ? __vite__mapDeps([29,7,16,3]) : void 0, import.meta.url);
61643
61556
  return { id: id12, diagram: diagram2 };
61644
61557
  }, "loader");
61645
61558
  var plugin10 = {
@@ -61657,9 +61570,9 @@ var detector13 = /* @__PURE__ */ __name((txt, config2) => {
61657
61570
  }, "detector");
61658
61571
  var loader13 = /* @__PURE__ */ __name(async () => {
61659
61572
  const { diagram: diagram2 } = await __vitePreload(async () => {
61660
- const { diagram: diagram22 } = await import("./classDiagram-4FO5ZUOK-Cq95X99o.js");
61573
+ const { diagram: diagram22 } = await import("./classDiagram-4FO5ZUOK-DGS2faoM.js");
61661
61574
  return { diagram: diagram22 };
61662
- }, true ? __vite__mapDeps([29,30,8,6,9,10]) : void 0, import.meta.url);
61575
+ }, true ? __vite__mapDeps([30,31,9,7,10,11,3]) : void 0, import.meta.url);
61663
61576
  return { id: id13, diagram: diagram2 };
61664
61577
  }, "loader");
61665
61578
  var plugin11 = {
@@ -61677,9 +61590,9 @@ var detector14 = /* @__PURE__ */ __name((txt, config2) => {
61677
61590
  }, "detector");
61678
61591
  var loader14 = /* @__PURE__ */ __name(async () => {
61679
61592
  const { diagram: diagram2 } = await __vitePreload(async () => {
61680
- const { diagram: diagram22 } = await import("./classDiagram-v2-Q7XG4LA2-Cq95X99o.js");
61593
+ const { diagram: diagram22 } = await import("./classDiagram-v2-Q7XG4LA2-DGS2faoM.js");
61681
61594
  return { diagram: diagram22 };
61682
- }, true ? __vite__mapDeps([31,30,8,6,9,10]) : void 0, import.meta.url);
61595
+ }, true ? __vite__mapDeps([32,31,9,7,10,11,3]) : void 0, import.meta.url);
61683
61596
  return { id: id14, diagram: diagram2 };
61684
61597
  }, "loader");
61685
61598
  var plugin12 = {
@@ -61697,9 +61610,9 @@ var detector15 = /* @__PURE__ */ __name((txt, config2) => {
61697
61610
  }, "detector");
61698
61611
  var loader15 = /* @__PURE__ */ __name(async () => {
61699
61612
  const { diagram: diagram2 } = await __vitePreload(async () => {
61700
- const { diagram: diagram22 } = await import("./stateDiagram-AJRCARHV-Bha2QoNB.js");
61613
+ const { diagram: diagram22 } = await import("./stateDiagram-AJRCARHV-qyb8ETsa.js");
61701
61614
  return { diagram: diagram22 };
61702
- }, true ? __vite__mapDeps([32,33,9,10,1,2]) : void 0, import.meta.url);
61615
+ }, true ? __vite__mapDeps([33,34,10,11,1,2,3]) : void 0, import.meta.url);
61703
61616
  return { id: id15, diagram: diagram2 };
61704
61617
  }, "loader");
61705
61618
  var plugin13 = {
@@ -61720,9 +61633,9 @@ var detector16 = /* @__PURE__ */ __name((txt, config2) => {
61720
61633
  }, "detector");
61721
61634
  var loader16 = /* @__PURE__ */ __name(async () => {
61722
61635
  const { diagram: diagram2 } = await __vitePreload(async () => {
61723
- const { diagram: diagram22 } = await import("./stateDiagram-v2-BHNVJYJU-DWgFUYu1.js");
61636
+ const { diagram: diagram22 } = await import("./stateDiagram-v2-BHNVJYJU-DmDOyyrJ.js");
61724
61637
  return { diagram: diagram22 };
61725
- }, true ? __vite__mapDeps([34,33,9,10]) : void 0, import.meta.url);
61638
+ }, true ? __vite__mapDeps([35,34,10,11,3]) : void 0, import.meta.url);
61726
61639
  return { id: id16, diagram: diagram2 };
61727
61640
  }, "loader");
61728
61641
  var plugin14 = {
@@ -61737,9 +61650,9 @@ var detector17 = /* @__PURE__ */ __name((txt) => {
61737
61650
  }, "detector");
61738
61651
  var loader17 = /* @__PURE__ */ __name(async () => {
61739
61652
  const { diagram: diagram2 } = await __vitePreload(async () => {
61740
- const { diagram: diagram22 } = await import("./journeyDiagram-JHISSGLW-BEdmpAgl.js");
61653
+ const { diagram: diagram22 } = await import("./journeyDiagram-JHISSGLW-C4rH_mQM.js");
61741
61654
  return { diagram: diagram22 };
61742
- }, true ? __vite__mapDeps([35,8,6,23]) : void 0, import.meta.url);
61655
+ }, true ? __vite__mapDeps([36,9,7,24,3]) : void 0, import.meta.url);
61743
61656
  return { id: id17, diagram: diagram2 };
61744
61657
  }, "loader");
61745
61658
  var plugin15 = {
@@ -61807,9 +61720,9 @@ var detector18 = /* @__PURE__ */ __name((txt, config2 = {}) => {
61807
61720
  }, "detector");
61808
61721
  var loader18 = /* @__PURE__ */ __name(async () => {
61809
61722
  const { diagram: diagram2 } = await __vitePreload(async () => {
61810
- const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-B6q_1-tE.js");
61723
+ const { diagram: diagram22 } = await import("./flowDiagram-I6XJVG4X-CzFk-KNI.js");
61811
61724
  return { diagram: diagram22 };
61812
- }, true ? __vite__mapDeps([7,8,6,9,10,11]) : void 0, import.meta.url);
61725
+ }, true ? __vite__mapDeps([8,9,7,10,11,12,3]) : void 0, import.meta.url);
61813
61726
  return { id: id18, diagram: diagram2 };
61814
61727
  }, "loader");
61815
61728
  var plugin16 = {
@@ -61824,9 +61737,9 @@ var detector19 = /* @__PURE__ */ __name((txt) => {
61824
61737
  }, "detector");
61825
61738
  var loader19 = /* @__PURE__ */ __name(async () => {
61826
61739
  const { diagram: diagram2 } = await __vitePreload(async () => {
61827
- const { diagram: diagram22 } = await import("./timeline-definition-PNZ67QCA-C3h_-OTj.js");
61740
+ const { diagram: diagram22 } = await import("./timeline-definition-PNZ67QCA-C-KQxTi1.js");
61828
61741
  return { diagram: diagram22 };
61829
- }, true ? __vite__mapDeps([36,23]) : void 0, import.meta.url);
61742
+ }, true ? __vite__mapDeps([37,24,3]) : void 0, import.meta.url);
61830
61743
  return { id: id19, diagram: diagram2 };
61831
61744
  }, "loader");
61832
61745
  var plugin17 = {
@@ -61841,9 +61754,9 @@ var detector20 = /* @__PURE__ */ __name((txt) => {
61841
61754
  }, "detector");
61842
61755
  var loader20 = /* @__PURE__ */ __name(async () => {
61843
61756
  const { diagram: diagram2 } = await __vitePreload(async () => {
61844
- const { diagram: diagram22 } = await import("./mindmap-definition-RKZ34NQL-DSxVgHB5.js");
61757
+ const { diagram: diagram22 } = await import("./mindmap-definition-RKZ34NQL-DdmPsWrn.js");
61845
61758
  return { diagram: diagram22 };
61846
- }, true ? __vite__mapDeps([37,9,10]) : void 0, import.meta.url);
61759
+ }, true ? __vite__mapDeps([38,10,11,3]) : void 0, import.meta.url);
61847
61760
  return { id: id20, diagram: diagram2 };
61848
61761
  }, "loader");
61849
61762
  var plugin18 = {
@@ -61858,9 +61771,9 @@ var detector21 = /* @__PURE__ */ __name((txt) => {
61858
61771
  }, "detector");
61859
61772
  var loader21 = /* @__PURE__ */ __name(async () => {
61860
61773
  const { diagram: diagram2 } = await __vitePreload(async () => {
61861
- const { diagram: diagram22 } = await import("./kanban-definition-UN3LZRKU-BEFtQcFb.js");
61774
+ const { diagram: diagram22 } = await import("./kanban-definition-UN3LZRKU-DRbrBcWV.js");
61862
61775
  return { diagram: diagram22 };
61863
- }, true ? __vite__mapDeps([38,8]) : void 0, import.meta.url);
61776
+ }, true ? __vite__mapDeps([39,9,3]) : void 0, import.meta.url);
61864
61777
  return { id: id21, diagram: diagram2 };
61865
61778
  }, "loader");
61866
61779
  var plugin19 = {
@@ -61875,9 +61788,9 @@ var detector22 = /* @__PURE__ */ __name((txt) => {
61875
61788
  }, "detector");
61876
61789
  var loader22 = /* @__PURE__ */ __name(async () => {
61877
61790
  const { diagram: diagram2 } = await __vitePreload(async () => {
61878
- const { diagram: diagram22 } = await import("./sankeyDiagram-5OEKKPKP-ca1tPzJ_.js");
61791
+ const { diagram: diagram22 } = await import("./sankeyDiagram-5OEKKPKP-Cyl9ojEt.js");
61879
61792
  return { diagram: diagram22 };
61880
- }, true ? __vite__mapDeps([39,24,19]) : void 0, import.meta.url);
61793
+ }, true ? __vite__mapDeps([40,25,20,3]) : void 0, import.meta.url);
61881
61794
  return { id: id22, diagram: diagram2 };
61882
61795
  }, "loader");
61883
61796
  var plugin20 = {
@@ -61892,9 +61805,9 @@ var detector23 = /* @__PURE__ */ __name((txt) => {
61892
61805
  }, "detector");
61893
61806
  var loader23 = /* @__PURE__ */ __name(async () => {
61894
61807
  const { diagram: diagram2 } = await __vitePreload(async () => {
61895
- const { diagram: diagram22 } = await import("./diagram-LMA3HP47-C12xHS1c.js");
61808
+ const { diagram: diagram22 } = await import("./diagram-LMA3HP47-CGkw7wII.js");
61896
61809
  return { diagram: diagram22 };
61897
- }, true ? __vite__mapDeps([40,14,16]) : void 0, import.meta.url);
61810
+ }, true ? __vite__mapDeps([41,15,17,3]) : void 0, import.meta.url);
61898
61811
  return { id: id23, diagram: diagram2 };
61899
61812
  }, "loader");
61900
61813
  var packet = {
@@ -61908,9 +61821,9 @@ var detector24 = /* @__PURE__ */ __name((txt) => {
61908
61821
  }, "detector");
61909
61822
  var loader24 = /* @__PURE__ */ __name(async () => {
61910
61823
  const { diagram: diagram2 } = await __vitePreload(async () => {
61911
- const { diagram: diagram22 } = await import("./diagram-2AECGRRQ-DwuB1GWt.js");
61824
+ const { diagram: diagram22 } = await import("./diagram-2AECGRRQ-DzHiYDPh.js");
61912
61825
  return { diagram: diagram22 };
61913
- }, true ? __vite__mapDeps([41,14,16]) : void 0, import.meta.url);
61826
+ }, true ? __vite__mapDeps([42,15,17,3]) : void 0, import.meta.url);
61914
61827
  return { id: id24, diagram: diagram2 };
61915
61828
  }, "loader");
61916
61829
  var radar = {
@@ -61924,9 +61837,9 @@ var detector25 = /* @__PURE__ */ __name((txt) => {
61924
61837
  }, "detector");
61925
61838
  var loader25 = /* @__PURE__ */ __name(async () => {
61926
61839
  const { diagram: diagram2 } = await __vitePreload(async () => {
61927
- const { diagram: diagram22 } = await import("./blockDiagram-GPEHLZMM-LHyVtPwW.js");
61840
+ const { diagram: diagram22 } = await import("./blockDiagram-GPEHLZMM-CYSWjnJg.js");
61928
61841
  return { diagram: diagram22 };
61929
- }, true ? __vite__mapDeps([42,8,1,11]) : void 0, import.meta.url);
61842
+ }, true ? __vite__mapDeps([43,9,1,12,3]) : void 0, import.meta.url);
61930
61843
  return { id: id25, diagram: diagram2 };
61931
61844
  }, "loader");
61932
61845
  var plugin21 = {
@@ -61941,9 +61854,9 @@ var detector26 = /* @__PURE__ */ __name((txt) => {
61941
61854
  }, "detector");
61942
61855
  var loader26 = /* @__PURE__ */ __name(async () => {
61943
61856
  const { diagram: diagram2 } = await __vitePreload(async () => {
61944
- const { diagram: diagram22 } = await import("./diagram-5GNKFQAL-C2tgeI1h.js");
61857
+ const { diagram: diagram22 } = await import("./diagram-5GNKFQAL-BiNv6Keq.js");
61945
61858
  return { diagram: diagram22 };
61946
- }, true ? __vite__mapDeps([43,14,15,16]) : void 0, import.meta.url);
61859
+ }, true ? __vite__mapDeps([44,15,16,17,3]) : void 0, import.meta.url);
61947
61860
  return { id: id26, diagram: diagram2 };
61948
61861
  }, "loader");
61949
61862
  var plugin22 = {
@@ -61958,9 +61871,9 @@ var detector27 = /* @__PURE__ */ __name((txt) => {
61958
61871
  }, "detector");
61959
61872
  var loader27 = /* @__PURE__ */ __name(async () => {
61960
61873
  const { diagram: diagram2 } = await __vitePreload(async () => {
61961
- const { diagram: diagram22 } = await import("./architectureDiagram-3BPJPVTR-CEgYow6c.js");
61874
+ const { diagram: diagram22 } = await import("./architectureDiagram-3BPJPVTR-BAbnaR9G.js");
61962
61875
  return { diagram: diagram22 };
61963
- }, true ? __vite__mapDeps([44,14,16,4]) : void 0, import.meta.url);
61876
+ }, true ? __vite__mapDeps([45,15,17,3,5]) : void 0, import.meta.url);
61964
61877
  return { id: id27, diagram: diagram2 };
61965
61878
  }, "loader");
61966
61879
  var architecture = {
@@ -61975,9 +61888,9 @@ var detector28 = /* @__PURE__ */ __name((txt) => {
61975
61888
  }, "detector");
61976
61889
  var loader28 = /* @__PURE__ */ __name(async () => {
61977
61890
  const { diagram: diagram2 } = await __vitePreload(async () => {
61978
- const { diagram: diagram22 } = await import("./diagram-KO2AKTUF-D5KzjNBc.js");
61891
+ const { diagram: diagram22 } = await import("./diagram-KO2AKTUF-ClzeDG6f.js");
61979
61892
  return { diagram: diagram22 };
61980
- }, true ? __vite__mapDeps([45,14,16]) : void 0, import.meta.url);
61893
+ }, true ? __vite__mapDeps([46,15,17,3]) : void 0, import.meta.url);
61981
61894
  return { id: id28, diagram: diagram2 };
61982
61895
  }, "loader");
61983
61896
  var plugin23 = {
@@ -61992,9 +61905,9 @@ var detector29 = /* @__PURE__ */ __name((txt) => {
61992
61905
  }, "detector");
61993
61906
  var loader29 = /* @__PURE__ */ __name(async () => {
61994
61907
  const { diagram: diagram2 } = await __vitePreload(async () => {
61995
- const { diagram: diagram22 } = await import("./ishikawaDiagram-YF4QCWOH-DDCZc35f.js");
61908
+ const { diagram: diagram22 } = await import("./ishikawaDiagram-YF4QCWOH-BUZLjRo-.js");
61996
61909
  return { diagram: diagram22 };
61997
- }, true ? [] : void 0, import.meta.url);
61910
+ }, true ? __vite__mapDeps([47,3]) : void 0, import.meta.url);
61998
61911
  return { id: id29, diagram: diagram2 };
61999
61912
  }, "loader");
62000
61913
  var ishikawa = {
@@ -62008,9 +61921,9 @@ var detector30 = /* @__PURE__ */ __name((txt) => {
62008
61921
  }, "detector");
62009
61922
  var loader30 = /* @__PURE__ */ __name(async () => {
62010
61923
  const { diagram: diagram2 } = await __vitePreload(async () => {
62011
- const { diagram: diagram22 } = await import("./vennDiagram-CIIHVFJN-DFzjSrZi.js");
61924
+ const { diagram: diagram22 } = await import("./vennDiagram-CIIHVFJN-BdaZlnH-.js");
62012
61925
  return { diagram: diagram22 };
62013
- }, true ? [] : void 0, import.meta.url);
61926
+ }, true ? __vite__mapDeps([48,3]) : void 0, import.meta.url);
62014
61927
  return { id: id30, diagram: diagram2 };
62015
61928
  }, "loader");
62016
61929
  var plugin24 = {
@@ -62025,9 +61938,9 @@ var detector31 = /* @__PURE__ */ __name((txt) => {
62025
61938
  }, "detector");
62026
61939
  var loader31 = /* @__PURE__ */ __name(async () => {
62027
61940
  const { diagram: diagram2 } = await __vitePreload(async () => {
62028
- const { diagram: diagram22 } = await import("./diagram-OG6HWLK6-CnxI9oEa.js");
61941
+ const { diagram: diagram22 } = await import("./diagram-OG6HWLK6-Dl-Hyk1_.js");
62029
61942
  return { diagram: diagram22 };
62030
- }, true ? __vite__mapDeps([46,10,14,16,20,24,19]) : void 0, import.meta.url);
61943
+ }, true ? __vite__mapDeps([49,11,15,17,3,21,25,20]) : void 0, import.meta.url);
62031
61944
  return { id: id31, diagram: diagram2 };
62032
61945
  }, "loader");
62033
61946
  var treemap = {
@@ -62041,9 +61954,9 @@ var detector32 = /* @__PURE__ */ __name((text2) => {
62041
61954
  }, "detector");
62042
61955
  var loader32 = /* @__PURE__ */ __name(async () => {
62043
61956
  const { diagram: diagram2 } = await __vitePreload(async () => {
62044
- const { diagram: diagram22 } = await import("./wardleyDiagram-YWT4CUSO-S2D9XqX6.js");
61957
+ const { diagram: diagram22 } = await import("./wardleyDiagram-YWT4CUSO-B2hBE-EE.js");
62045
61958
  return { diagram: diagram22 };
62046
- }, true ? __vite__mapDeps([47,14,16]) : void 0, import.meta.url);
61959
+ }, true ? __vite__mapDeps([50,15,17,3]) : void 0, import.meta.url);
62047
61960
  return { id: id32, diagram: diagram2 };
62048
61961
  }, "loader");
62049
61962
  var plugin25 = {
@@ -62874,6 +62787,12 @@ var mermaid_default = mermaid;
62874
62787
  * Wait for document loaded before starting the execution
62875
62788
  */
62876
62789
  window.mermaid = mermaid_default;
62790
+ const pendingRenders = /* @__PURE__ */ new Set();
62791
+ function awaitAllMermaidRenders() {
62792
+ const promises = Array.from(pendingRenders);
62793
+ return Promise.allSettled(promises).then(() => {
62794
+ });
62795
+ }
62877
62796
  function getMermaidTheme() {
62878
62797
  const cls = document.body.className;
62879
62798
  if (cls.includes("theme-dark")) return "dark";
@@ -62885,17 +62804,20 @@ function getMermaidTheme() {
62885
62804
  }
62886
62805
  return "default";
62887
62806
  }
62888
- function readCustomVar(name, fallback) {
62889
- const style = getComputedStyle(document.body);
62807
+ function getCustomMermaidCSS() {
62808
+ return getComputedStyle(document.body);
62809
+ }
62810
+ function readCustomVar(style, name, fallback) {
62890
62811
  return style.getPropertyValue(name).trim() || fallback;
62891
62812
  }
62892
62813
  function getCustomMermaidFontSize() {
62893
- const raw = readCustomVar("--mermaid-font-size", "");
62814
+ const raw = getCustomMermaidCSS().getPropertyValue("--mermaid-font-size").trim();
62894
62815
  const n2 = parseInt(raw, 10);
62895
62816
  return Number.isFinite(n2) && n2 > 0 ? n2 : 12;
62896
62817
  }
62897
62818
  function getCustomMermaidThemeVariables() {
62898
- const v2 = (name, fallback) => readCustomVar(name, fallback);
62819
+ const style = getCustomMermaidCSS();
62820
+ const v2 = (name, fallback) => readCustomVar(style, name, fallback);
62899
62821
  const baseFont = '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif';
62900
62822
  const font = v2("--mermaid-font-family", baseFont);
62901
62823
  const darkMode = v2("--mermaid-dark-mode", "false");
@@ -62903,7 +62825,7 @@ function getCustomMermaidThemeVariables() {
62903
62825
  darkMode,
62904
62826
  background: v2("--mermaid-background", v2("--bg-color", "#ffffff")),
62905
62827
  primaryColor: v2("--mermaid-primary-color", v2("--code-block-bg", "#f6f8fa")),
62906
- primaryBorderColor: v2("--mermaid-primary-border-color", v2("--border-color", "#d0d7de")),
62828
+ primaryBorderColor: v2("--mermaid-node-stroke", v2("--border-color", "#d0d7de")),
62907
62829
  primaryTextColor: v2("--mermaid-primary-text-color", v2("--text-color", "#24292f")),
62908
62830
  secondaryColor: v2("--mermaid-secondary-color", v2("--code-bg", "#f6f8fa")),
62909
62831
  secondaryBorderColor: v2("--mermaid-secondary-border-color", v2("--border-color", "#d0d7de")),
@@ -62911,21 +62833,21 @@ function getCustomMermaidThemeVariables() {
62911
62833
  tertiaryColor: v2("--mermaid-tertiary-color", v2("--bg-color", "#ffffff")),
62912
62834
  tertiaryBorderColor: v2("--mermaid-tertiary-border-color", v2("--border-color", "#d0d7de")),
62913
62835
  tertiaryTextColor: v2("--mermaid-tertiary-text-color", v2("--text-color", "#24292f")),
62914
- lineColor: v2("--mermaid-line-color", v2("--border-color", "#d0d7de")),
62915
- textColor: v2("--mermaid-text-color", v2("--text-color", "#24292f")),
62836
+ lineColor: v2("--mermaid-edge-stroke", v2("--border-color", "#d0d7de")),
62837
+ textColor: v2("--mermaid-label-text", v2("--text-color", "#24292f")),
62916
62838
  mainBkg: v2("--mermaid-main-bkg", v2("--code-block-bg", "#f6f8fa")),
62917
62839
  secondBkg: v2("--mermaid-second-bkg", v2("--code-bg", "#f6f8fa")),
62918
62840
  mainContrastColor: v2("--mermaid-primary-text-color", v2("--text-color", "#24292f")),
62919
62841
  labelBackground: v2("--mermaid-label-background", v2("--code-block-bg", "#f6f8fa")),
62920
62842
  labelTextColor: v2("--mermaid-label-text-color", v2("--text-color", "#24292f")),
62921
- nodeBorder: v2("--mermaid-node-border", v2("--border-color", "#d0d7de")),
62843
+ nodeBorder: v2("--mermaid-node-stroke", v2("--border-color", "#d0d7de")),
62922
62844
  nodeBkg: v2("--mermaid-node-bkg", v2("--code-block-bg", "#f6f8fa")),
62923
62845
  clusterBkg: v2("--mermaid-cluster-bkg", v2("--code-bg", "#f6f8fa")),
62924
- clusterBorder: v2("--mermaid-cluster-border", v2("--border-color", "#d0d7de")),
62925
- defaultLinkColor: v2("--mermaid-line-color", v2("--border-color", "#d0d7de")),
62846
+ clusterBorder: v2("--mermaid-cluster-stroke", v2("--border-color", "#d0d7de")),
62847
+ defaultLinkColor: v2("--mermaid-edge-stroke", v2("--border-color", "#d0d7de")),
62926
62848
  edgeLabelBackground: v2("--mermaid-edge-label-background", v2("--code-block-bg", "#f6f8fa")),
62927
- arrowheadColor: v2("--mermaid-arrowhead-color", v2("--mermaid-line-color", v2("--border-color", "#d0d7de"))),
62928
- personBorder: v2("--mermaid-person-border", v2("--border-color", "#d0d7de")),
62849
+ arrowheadColor: v2("--mermaid-edge-stroke", v2("--border-color", "#d0d7de")),
62850
+ personBorder: v2("--mermaid-person-stroke", v2("--border-color", "#d0d7de")),
62929
62851
  personBkg: v2("--mermaid-person-bkg", v2("--code-block-bg", "#f6f8fa")),
62930
62852
  fontFamily: font,
62931
62853
  cScale0: v2("--mermaid-cscale0", "#2d5f8a"),
@@ -62944,7 +62866,8 @@ function getCustomMermaidThemeVariables() {
62944
62866
  return result;
62945
62867
  }
62946
62868
  function getCustomMermaidC4Config() {
62947
- const v2 = (name, fallback) => readCustomVar(name, fallback);
62869
+ const style = getCustomMermaidCSS();
62870
+ const v2 = (name, fallback) => readCustomVar(style, name, fallback);
62948
62871
  const baseFont = '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif';
62949
62872
  const font = v2("--mermaid-font-family", baseFont);
62950
62873
  return {
@@ -62955,45 +62878,45 @@ function getCustomMermaidC4Config() {
62955
62878
  boundaryFontFamily: font,
62956
62879
  messageFontFamily: font,
62957
62880
  person_bg_color: v2("--mermaid-c4-person-bg", "#2d5f8a"),
62958
- person_border_color: v2("--mermaid-c4-person-border", "#4a7aaa"),
62881
+ person_border_color: v2("--mermaid-c4-person-stroke", "#4a7aaa"),
62959
62882
  external_person_bg_color: v2("--mermaid-c4-ext-person-bg", "#4a5568"),
62960
- external_person_border_color: v2("--mermaid-c4-ext-person-border", "#6b7a8a"),
62883
+ external_person_border_color: v2("--mermaid-c4-ext-person-stroke", "#6b7a8a"),
62961
62884
  system_bg_color: v2("--mermaid-c4-system-bg", "#3d7a5a"),
62962
- system_border_color: v2("--mermaid-c4-system-border", "#5a9a7a"),
62885
+ system_border_color: v2("--mermaid-c4-system-stroke", "#5a9a7a"),
62963
62886
  system_db_bg_color: v2("--mermaid-c4-system-bg", "#3d7a5a"),
62964
- system_db_border_color: v2("--mermaid-c4-system-border", "#5a9a7a"),
62887
+ system_db_border_color: v2("--mermaid-c4-system-stroke", "#5a9a7a"),
62965
62888
  system_queue_bg_color: v2("--mermaid-c4-system-bg", "#3d7a5a"),
62966
- system_queue_border_color: v2("--mermaid-c4-system-border", "#5a9a7a"),
62889
+ system_queue_border_color: v2("--mermaid-c4-system-stroke", "#5a9a7a"),
62967
62890
  external_system_bg_color: v2("--mermaid-c4-ext-system-bg", "#6b4a7a"),
62968
- external_system_border_color: v2("--mermaid-c4-ext-system-border", "#8a6a9a"),
62891
+ external_system_border_color: v2("--mermaid-c4-ext-system-stroke", "#8a6a9a"),
62969
62892
  external_system_db_bg_color: v2("--mermaid-c4-ext-system-bg", "#6b4a7a"),
62970
- external_system_db_border_color: v2("--mermaid-c4-ext-system-border", "#8a6a9a"),
62893
+ external_system_db_border_color: v2("--mermaid-c4-ext-system-stroke", "#8a6a9a"),
62971
62894
  external_system_queue_bg_color: v2("--mermaid-c4-ext-system-bg", "#6b4a7a"),
62972
- external_system_queue_border_color: v2("--mermaid-c4-ext-system-border", "#8a6a9a"),
62895
+ external_system_queue_border_color: v2("--mermaid-c4-ext-system-stroke", "#8a6a9a"),
62973
62896
  container_bg_color: v2("--mermaid-c4-container-bg", "#8a6b3c"),
62974
- container_border_color: v2("--mermaid-c4-container-border", "#aa8a5c"),
62897
+ container_border_color: v2("--mermaid-c4-container-stroke", "#aa8a5c"),
62975
62898
  container_db_bg_color: v2("--mermaid-c4-container-bg", "#8a6b3c"),
62976
- container_db_border_color: v2("--mermaid-c4-container-border", "#aa8a5c"),
62899
+ container_db_border_color: v2("--mermaid-c4-container-stroke", "#aa8a5c"),
62977
62900
  container_queue_bg_color: v2("--mermaid-c4-container-bg", "#8a6b3c"),
62978
- container_queue_border_color: v2("--mermaid-c4-container-border", "#aa8a5c"),
62901
+ container_queue_border_color: v2("--mermaid-c4-container-stroke", "#aa8a5c"),
62979
62902
  external_container_bg_color: v2("--mermaid-c4-ext-container-bg", "#5a5a6a"),
62980
- external_container_border_color: v2("--mermaid-c4-ext-container-border", "#7a7a8a"),
62903
+ external_container_border_color: v2("--mermaid-c4-ext-container-stroke", "#7a7a8a"),
62981
62904
  external_container_db_bg_color: v2("--mermaid-c4-ext-container-bg", "#5a5a6a"),
62982
- external_container_db_border_color: v2("--mermaid-c4-ext-container-border", "#7a7a8a"),
62905
+ external_container_db_border_color: v2("--mermaid-c4-ext-container-stroke", "#7a7a8a"),
62983
62906
  external_container_queue_bg_color: v2("--mermaid-c4-ext-container-bg", "#5a5a6a"),
62984
- external_container_queue_border_color: v2("--mermaid-c4-ext-container-border", "#7a7a8a"),
62907
+ external_container_queue_border_color: v2("--mermaid-c4-ext-container-stroke", "#7a7a8a"),
62985
62908
  component_bg_color: v2("--mermaid-c4-component-bg", "#3c7a6b"),
62986
- component_border_color: v2("--mermaid-c4-component-border", "#5c9a8b"),
62909
+ component_border_color: v2("--mermaid-c4-component-stroke", "#5c9a8b"),
62987
62910
  component_db_bg_color: v2("--mermaid-c4-component-bg", "#3c7a6b"),
62988
- component_db_border_color: v2("--mermaid-c4-component-border", "#5c9a8b"),
62911
+ component_db_border_color: v2("--mermaid-c4-component-stroke", "#5c9a8b"),
62989
62912
  component_queue_bg_color: v2("--mermaid-c4-component-bg", "#3c7a6b"),
62990
- component_queue_border_color: v2("--mermaid-c4-component-border", "#5c9a8b"),
62913
+ component_queue_border_color: v2("--mermaid-c4-component-stroke", "#5c9a8b"),
62991
62914
  external_component_bg_color: v2("--mermaid-c4-ext-component-bg", "#6a6a6a"),
62992
- external_component_border_color: v2("--mermaid-c4-ext-component-border", "#8a8a8a"),
62915
+ external_component_border_color: v2("--mermaid-c4-ext-component-stroke", "#8a8a8a"),
62993
62916
  external_component_db_bg_color: v2("--mermaid-c4-ext-component-bg", "#6a6a6a"),
62994
- external_component_db_border_color: v2("--mermaid-c4-ext-component-border", "#8a8a8a"),
62917
+ external_component_db_border_color: v2("--mermaid-c4-ext-component-stroke", "#8a8a8a"),
62995
62918
  external_component_queue_bg_color: v2("--mermaid-c4-ext-component-bg", "#6a6a6a"),
62996
- external_component_queue_border_color: v2("--mermaid-c4-ext-component-border", "#8a8a8a")
62919
+ external_component_queue_border_color: v2("--mermaid-c4-ext-component-stroke", "#8a8a8a")
62997
62920
  };
62998
62921
  }
62999
62922
  function getMermaidThemeVariables() {
@@ -63279,8 +63202,8 @@ const mermaidBlockSchema = $nodeSchema("mermaid_block", () => ({
63279
63202
  toDOM: (node2) => {
63280
63203
  const container = document.createElement("div");
63281
63204
  container.className = "mermaid-block";
63282
- container.dataset.mermaid = node2.attrs.text;
63283
63205
  const text2 = (node2.attrs.text || "").trim();
63206
+ container.dataset.mermaid = text2;
63284
63207
  if (node2.attrs.mode === "raw") {
63285
63208
  const el = document.createElement("pre");
63286
63209
  el.className = "mermaid-raw";
@@ -63288,36 +63211,7 @@ const mermaidBlockSchema = $nodeSchema("mermaid_block", () => ({
63288
63211
  el.textContent = "```mermaid\n" + text2 + "\n```";
63289
63212
  return { dom: el };
63290
63213
  }
63291
- if (!text2) {
63292
- container.innerHTML = '<div class="mermaid-preview"><div class="mermaid-loading">Empty diagram</div></div>';
63293
- return { dom: container };
63294
- }
63295
- const mermaidLib = window.mermaid;
63296
- if (!mermaidLib || typeof mermaidLib.render !== "function") {
63297
- container.innerHTML = '<div class="mermaid-preview"><div class="mermaid-error">Mermaid not loaded</div></div>';
63298
- return { dom: container };
63299
- }
63300
63214
  container.innerHTML = '<div class="mermaid-preview"><div class="mermaid-loading">Rendering...</div></div>';
63301
- const id33 = "mermaid-" + ++renderCounter;
63302
- try {
63303
- mermaidLib.render(id33, text2).then((result) => {
63304
- const preview = container.querySelector(".mermaid-preview");
63305
- if (preview) {
63306
- preview.innerHTML = result.svg;
63307
- const svg2 = preview.querySelector("svg");
63308
- if (svg2) adjustNodeHeights(svg2);
63309
- if (result.bindFunctions) result.bindFunctions(container);
63310
- }
63311
- }).catch((e2) => {
63312
- const preview = container.querySelector(".mermaid-preview");
63313
- if (preview) {
63314
- const msg = e2.message.replace(/&/g, "&amp;").replace(/</g, "&lt;");
63315
- preview.innerHTML = '<div class="mermaid-error">Error: ' + msg + "</div>";
63316
- }
63317
- });
63318
- } catch (e2) {
63319
- container.innerHTML = '<div class="mermaid-preview"><div class="mermaid-error">' + String(e2.message || e2) + "</div></div>";
63320
- }
63321
63215
  return { dom: container };
63322
63216
  },
63323
63217
  parseMarkdown: {
@@ -63365,7 +63259,7 @@ function renderMermaidBlock(dom, node2, renderIdRef) {
63365
63259
  }
63366
63260
  dom.innerHTML = '<div class="mermaid-preview"><div class="mermaid-loading">Rendering...</div></div>';
63367
63261
  const id33 = "mermaid-" + ++renderCounter;
63368
- mermaidLib.render(id33, text2).then((result) => {
63262
+ const renderPromise = mermaidLib.render(id33, text2).then((result) => {
63369
63263
  if (currentRenderId !== renderIdRef.current) return;
63370
63264
  const preview = dom.querySelector(".mermaid-preview");
63371
63265
  if (preview) {
@@ -63381,7 +63275,10 @@ function renderMermaidBlock(dom, node2, renderIdRef) {
63381
63275
  const msg = e2.message.replace(/&/g, "&amp;").replace(/</g, "&lt;");
63382
63276
  preview.innerHTML = '<div class="mermaid-error">Error: ' + msg + "</div>";
63383
63277
  }
63278
+ }).finally(() => {
63279
+ pendingRenders.delete(renderPromise);
63384
63280
  });
63281
+ pendingRenders.add(renderPromise);
63385
63282
  }
63386
63283
  const mermaidBlockView = $view(mermaidBlockSchema, (_ctx) => {
63387
63284
  return (node2, view, getPos) => {
@@ -63488,6 +63385,8 @@ const mermaidPlugin = {
63488
63385
  themeVariables: getMermaidThemeVariables(),
63489
63386
  c4: getMermaidC4Config(),
63490
63387
  securityLevel: "loose",
63388
+ logLevel: "error",
63389
+ suppressErrorRendering: true,
63491
63390
  fontSize
63492
63391
  });
63493
63392
  },
@@ -63501,9 +63400,12 @@ const mermaidPlugin = {
63501
63400
  themeVariables: getMermaidThemeVariables(),
63502
63401
  c4: getMermaidC4Config(),
63503
63402
  securityLevel: "loose",
63403
+ logLevel: "error",
63404
+ suppressErrorRendering: true,
63504
63405
  fontSize
63505
63406
  });
63506
- }
63407
+ },
63408
+ ensureRendered: awaitAllMermaidRenders
63507
63409
  };
63508
63410
  registerPluginModule({
63509
63411
  info: mermaidPlugin,
@@ -65879,12 +65781,12 @@ var TableMap = class {
65879
65781
  }
65880
65782
  cellsInRect(rect2) {
65881
65783
  const result = [];
65882
- const seen2 = {};
65784
+ const seen = {};
65883
65785
  for (let row = rect2.top; row < rect2.bottom; row++) for (let col = rect2.left; col < rect2.right; col++) {
65884
65786
  const index2 = row * this.width + col;
65885
65787
  const pos = this.map[index2];
65886
- if (seen2[pos]) continue;
65887
- seen2[pos] = true;
65788
+ if (seen[pos]) continue;
65789
+ seen[pos] = true;
65888
65790
  if (col == rect2.left && col && this.map[index2 - 1] == pos || row == rect2.top && row && this.map[index2 - this.width] == pos) continue;
65889
65791
  result.push(pos);
65890
65792
  }
@@ -65995,11 +65897,11 @@ function findWidth(table) {
65995
65897
  }
65996
65898
  function findBadColWidths(map3, colWidths, table) {
65997
65899
  if (!map3.problems) map3.problems = [];
65998
- const seen2 = {};
65900
+ const seen = {};
65999
65901
  for (let i2 = 0; i2 < map3.map.length; i2++) {
66000
65902
  const pos = map3.map[i2];
66001
- if (seen2[pos]) continue;
66002
- seen2[pos] = true;
65903
+ if (seen[pos]) continue;
65904
+ seen[pos] = true;
66003
65905
  const node2 = table.nodeAt(pos);
66004
65906
  if (!node2) throw new RangeError(`No cell with offset ${pos} found`);
66005
65907
  let updated = null;
@@ -66247,14 +66149,14 @@ var CellSelection = class CellSelection2 extends Selection$2 {
66247
66149
  const map3 = TableMap.get(table);
66248
66150
  const tableStart = this.$anchorCell.start(-1);
66249
66151
  const rect2 = map3.rectBetween(this.$anchorCell.pos - tableStart, this.$headCell.pos - tableStart);
66250
- const seen2 = {};
66152
+ const seen = {};
66251
66153
  const rows = [];
66252
66154
  for (let row = rect2.top; row < rect2.bottom; row++) {
66253
66155
  const rowContent = [];
66254
66156
  for (let index2 = row * map3.width + rect2.left, col = rect2.left; col < rect2.right; col++, index2++) {
66255
66157
  const pos = map3.map[index2];
66256
- if (seen2[pos]) continue;
66257
- seen2[pos] = true;
66158
+ if (seen[pos]) continue;
66159
+ seen[pos] = true;
66258
66160
  const cellRect = map3.findCell(pos);
66259
66161
  let cell = table.nodeAt(pos);
66260
66162
  if (!cell) throw new RangeError(`No cell with offset ${pos} found`);
@@ -66888,11 +66790,11 @@ function removeRow(tr, { map: map3, table, tableStart }, row) {
66888
66790
  const nextRow = rowPos + table.child(row).nodeSize;
66889
66791
  const mapFrom = tr.mapping.maps.length;
66890
66792
  tr.delete(rowPos + tableStart, nextRow + tableStart);
66891
- const seen2 = /* @__PURE__ */ new Set();
66793
+ const seen = /* @__PURE__ */ new Set();
66892
66794
  for (let col = 0, index2 = row * map3.width; col < map3.width; col++, index2++) {
66893
66795
  const pos = map3.map[index2];
66894
- if (seen2.has(pos)) continue;
66895
- seen2.add(pos);
66796
+ if (seen.has(pos)) continue;
66797
+ seen.add(pos);
66896
66798
  if (row > 0 && pos == map3.map[index2 - map3.width]) {
66897
66799
  const attrs = table.nodeAt(pos).attrs;
66898
66800
  tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + tableStart), null, {
@@ -68632,7 +68534,7 @@ function tokenizeWwwAutolink(effects, ok2, nok) {
68632
68534
  function tokenizeProtocolAutolink(effects, ok2, nok) {
68633
68535
  const self2 = this;
68634
68536
  let buffer = "";
68635
- let seen2 = false;
68537
+ let seen = false;
68636
68538
  return protocolStart;
68637
68539
  function protocolStart(code2) {
68638
68540
  if ((code2 === 72 || code2 === 104) && previousProtocol.call(self2, self2.previous) && !previousUnbalanced(self2.events)) {
@@ -68662,10 +68564,10 @@ function tokenizeProtocolAutolink(effects, ok2, nok) {
68662
68564
  function protocolSlashesInside(code2) {
68663
68565
  if (code2 === 47) {
68664
68566
  effects.consume(code2);
68665
- if (seen2) {
68567
+ if (seen) {
68666
68568
  return afterProtocol;
68667
68569
  }
68668
- seen2 = true;
68570
+ seen = true;
68669
68571
  return protocolSlashesInside;
68670
68572
  }
68671
68573
  return nok(code2);
@@ -68701,7 +68603,7 @@ function tokenizeWwwPrefix(effects, ok2, nok) {
68701
68603
  function tokenizeDomain(effects, ok2, nok) {
68702
68604
  let underscoreInLastSegment;
68703
68605
  let underscoreInLastLastSegment;
68704
- let seen2;
68606
+ let seen;
68705
68607
  return domainInside;
68706
68608
  function domainInside(code2) {
68707
68609
  if (code2 === 46 || code2 === 95) {
@@ -68710,7 +68612,7 @@ function tokenizeDomain(effects, ok2, nok) {
68710
68612
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {
68711
68613
  return domainAfter(code2);
68712
68614
  }
68713
- seen2 = true;
68615
+ seen = true;
68714
68616
  effects.consume(code2);
68715
68617
  return domainInside;
68716
68618
  }
@@ -68725,7 +68627,7 @@ function tokenizeDomain(effects, ok2, nok) {
68725
68627
  return domainInside;
68726
68628
  }
68727
68629
  function domainAfter(code2) {
68728
- if (underscoreInLastLastSegment || underscoreInLastSegment || !seen2) {
68630
+ if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
68729
68631
  return nok(code2);
68730
68632
  }
68731
68633
  return ok2(code2);
@@ -69328,7 +69230,7 @@ function tokenizeTable(effects, ok2, nok) {
69328
69230
  const self2 = this;
69329
69231
  let size = 0;
69330
69232
  let sizeB = 0;
69331
- let seen2;
69233
+ let seen;
69332
69234
  return start2;
69333
69235
  function start2(code2) {
69334
69236
  let index2 = self2.events.length - 1;
@@ -69354,7 +69256,7 @@ function tokenizeTable(effects, ok2, nok) {
69354
69256
  if (code2 === 124) {
69355
69257
  return headRowBreak(code2);
69356
69258
  }
69357
- seen2 = true;
69259
+ seen = true;
69358
69260
  sizeB += 1;
69359
69261
  return headRowBreak(code2);
69360
69262
  }
@@ -69378,15 +69280,15 @@ function tokenizeTable(effects, ok2, nok) {
69378
69280
  return factorySpace(effects, headRowBreak, "whitespace")(code2);
69379
69281
  }
69380
69282
  sizeB += 1;
69381
- if (seen2) {
69382
- seen2 = false;
69283
+ if (seen) {
69284
+ seen = false;
69383
69285
  size += 1;
69384
69286
  }
69385
69287
  if (code2 === 124) {
69386
69288
  effects.enter("tableCellDivider");
69387
69289
  effects.consume(code2);
69388
69290
  effects.exit("tableCellDivider");
69389
- seen2 = true;
69291
+ seen = true;
69390
69292
  return headRowBreak;
69391
69293
  }
69392
69294
  effects.enter("data");
@@ -69413,7 +69315,7 @@ function tokenizeTable(effects, ok2, nok) {
69413
69315
  return nok(code2);
69414
69316
  }
69415
69317
  effects.enter("tableDelimiterRow");
69416
- seen2 = false;
69318
+ seen = false;
69417
69319
  if (markdownSpace(code2)) {
69418
69320
  return factorySpace(effects, headDelimiterBefore, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2);
69419
69321
  }
@@ -69424,7 +69326,7 @@ function tokenizeTable(effects, ok2, nok) {
69424
69326
  return headDelimiterValueBefore(code2);
69425
69327
  }
69426
69328
  if (code2 === 124) {
69427
- seen2 = true;
69329
+ seen = true;
69428
69330
  effects.enter("tableCellDivider");
69429
69331
  effects.consume(code2);
69430
69332
  effects.exit("tableCellDivider");
@@ -69441,7 +69343,7 @@ function tokenizeTable(effects, ok2, nok) {
69441
69343
  function headDelimiterValueBefore(code2) {
69442
69344
  if (code2 === 58) {
69443
69345
  sizeB += 1;
69444
- seen2 = true;
69346
+ seen = true;
69445
69347
  effects.enter("tableDelimiterMarker");
69446
69348
  effects.consume(code2);
69447
69349
  effects.exit("tableDelimiterMarker");
@@ -69469,7 +69371,7 @@ function tokenizeTable(effects, ok2, nok) {
69469
69371
  return headDelimiterFiller;
69470
69372
  }
69471
69373
  if (code2 === 58) {
69472
- seen2 = true;
69374
+ seen = true;
69473
69375
  effects.exit("tableDelimiterFiller");
69474
69376
  effects.enter("tableDelimiterMarker");
69475
69377
  effects.consume(code2);
@@ -69490,7 +69392,7 @@ function tokenizeTable(effects, ok2, nok) {
69490
69392
  return headDelimiterBefore(code2);
69491
69393
  }
69492
69394
  if (code2 === null || markdownLineEnding(code2)) {
69493
- if (!seen2 || size !== sizeB) {
69395
+ if (!seen || size !== sizeB) {
69494
69396
  return headDelimiterNok(code2);
69495
69397
  }
69496
69398
  effects.exit("tableDelimiterRow");
@@ -71772,7 +71674,30 @@ async function createEditor(rootId, onChange) {
71772
71674
  builder = builder.use(p2);
71773
71675
  }
71774
71676
  }
71775
- editorInstance = await builder.create();
71677
+ try {
71678
+ editorInstance = await builder.create();
71679
+ } catch (e2) {
71680
+ if (e2?.message?.includes("math_inline") || e2?.message?.includes("math_block")) {
71681
+ console.warn("[editor] Milkdown context error, retrying without math plugins:", e2.message);
71682
+ const filteredModules = pluginModules.filter((m2) => m2.info.id !== "math");
71683
+ builder = Editor.make().config((ctx) => {
71684
+ ctx.set(rootCtx, root2);
71685
+ ctx.set(defaultValueCtx, defaultContent);
71686
+ ctx.set(remarkPluginsCtx, [
71687
+ ...filteredModules.map((m2) => m2.info.remarkPlugin),
71688
+ { plugin: remarkBreaks, options: void 0 }
71689
+ ]);
71690
+ }).use(commonmark).use(gfm).use(history).use(listener).use(clipboard).use(htmlView);
71691
+ for (const mod of filteredModules) {
71692
+ for (const p2 of mod.milkdownPlugins) {
71693
+ builder = builder.use(p2);
71694
+ }
71695
+ }
71696
+ editorInstance = await builder.create();
71697
+ } else {
71698
+ throw e2;
71699
+ }
71700
+ }
71776
71701
  editorInstance.action((ctx) => {
71777
71702
  const nvs = ctx.get(nodeViewCtx);
71778
71703
  const schema2 = ctx.get(schemaCtx);
@@ -71808,7 +71733,8 @@ async function createEditor(rootId, onChange) {
71808
71733
  const href = link2.getAttribute("href");
71809
71734
  if (href) {
71810
71735
  e2.preventDefault();
71811
- window.electronAPI.openExternal(href);
71736
+ window.electronAPI?.openExternal(href);
71737
+ window.capacitorAPI?.openExternal(href);
71812
71738
  }
71813
71739
  });
71814
71740
  return editorInstance;
@@ -71823,17 +71749,27 @@ function getMarkdown() {
71823
71749
  });
71824
71750
  return markdown;
71825
71751
  }
71826
- function getHTML() {
71827
- if (!editorInstance) return "";
71828
- let html2 = "";
71829
- editorInstance.action((ctx) => {
71830
- const view = ctx.get(editorViewCtx);
71831
- const div = document.createElement("div");
71832
- const fragment = DOMSerializer.fromSchema(view.state.schema).serializeFragment(view.state.doc.content);
71833
- div.appendChild(fragment);
71834
- html2 = div.innerHTML;
71835
- });
71836
- return html2;
71752
+ function getLiveHTML() {
71753
+ const editorDom = document.querySelector("#editor .ProseMirror");
71754
+ if (!editorDom) return "";
71755
+ const clone2 = editorDom.cloneNode(true);
71756
+ const styleTargets = [
71757
+ { selector: ".math-inline", prop: "backgroundColor" },
71758
+ { selector: ".math-block", prop: "backgroundColor" },
71759
+ { selector: ".mermaid-block", prop: "backgroundColor" }
71760
+ ];
71761
+ for (const { selector: selector2, prop } of styleTargets) {
71762
+ const originals = editorDom.querySelectorAll(selector2);
71763
+ const clones = clone2.querySelectorAll(selector2);
71764
+ originals.forEach((orig, i2) => {
71765
+ const computed = getComputedStyle(orig);
71766
+ const val = computed.getPropertyValue(prop === "backgroundColor" ? "background-color" : prop);
71767
+ if (val && clones[i2]) clones[i2].style.setProperty(prop, val);
71768
+ });
71769
+ }
71770
+ clone2.querySelectorAll("textarea.mermaid-source, .math-inline-raw, .math-block-raw").forEach((el) => el.remove());
71771
+ clone2.querySelectorAll(".mermaid-loading, .mermaid-error").forEach((el) => el.style.display = "none");
71772
+ return clone2.innerHTML;
71837
71773
  }
71838
71774
  function setMarkdown(content2) {
71839
71775
  if (!editorInstance) return;
@@ -71861,6 +71797,15 @@ const themes = {
71861
71797
  newsprint: "theme-newsprint"
71862
71798
  };
71863
71799
  let customStyleEl = null;
71800
+ const customThemeCache = /* @__PURE__ */ new Map();
71801
+ function parseTemplateDirective(css) {
71802
+ const match = css.match(/\/\*\s*@template:\s*(\w+)\s*\*\//);
71803
+ return match && themes[match[1]] ? match[1] : null;
71804
+ }
71805
+ function setCachedCustomTheme(name, css) {
71806
+ const template = parseTemplateDirective(css);
71807
+ customThemeCache.set(name, { css, template });
71808
+ }
71864
71809
  function applyTheme(name, customCSS) {
71865
71810
  const body = document.body;
71866
71811
  Object.values(themes).forEach((cls) => body.classList.remove(cls));
@@ -71870,10 +71815,18 @@ function applyTheme(name, customCSS) {
71870
71815
  customStyleEl = null;
71871
71816
  }
71872
71817
  if (customCSS || name.startsWith("custom:")) {
71818
+ const key2 = name.startsWith("custom:") ? name.slice(7) : name;
71873
71819
  if (customCSS) {
71820
+ setCachedCustomTheme(key2, customCSS);
71821
+ }
71822
+ const cached = customThemeCache.get(key2);
71823
+ if (cached) {
71874
71824
  customStyleEl = document.createElement("style");
71875
- customStyleEl.textContent = customCSS;
71825
+ customStyleEl.textContent = cached.css;
71876
71826
  document.head.appendChild(customStyleEl);
71827
+ if (cached.template && themes[cached.template]) {
71828
+ body.classList.add(themes[cached.template]);
71829
+ }
71877
71830
  }
71878
71831
  body.classList.add("theme-custom");
71879
71832
  } else if (themes[name]) {
@@ -71884,6 +71837,623 @@ function applyTheme(name, customCSS) {
71884
71837
  function loadSavedTheme() {
71885
71838
  return localStorage.getItem("colamd-theme") || "elegant";
71886
71839
  }
71840
+ const { Capacitor } = await __vitePreload(async () => {
71841
+ const { Capacitor: Capacitor2 } = await import("./index-B4uDgADr.js");
71842
+ return { Capacitor: Capacitor2 };
71843
+ }, true ? [] : void 0, import.meta.url).catch(() => ({ Capacitor: { isNativePlatform: () => false } }));
71844
+ const _capModules = {};
71845
+ async function capModule(name) {
71846
+ if (!(name in _capModules)) {
71847
+ try {
71848
+ switch (name) {
71849
+ case "@capacitor/filesystem":
71850
+ _capModules[name] = await __vitePreload(() => import("./index-CBcVpA3d.js"), true ? __vite__mapDeps([51,3,52]) : void 0, import.meta.url);
71851
+ break;
71852
+ case "@capacitor/share":
71853
+ _capModules[name] = await __vitePreload(() => import("./index-Y89U1ptl.js"), true ? __vite__mapDeps([53,3,52]) : void 0, import.meta.url);
71854
+ break;
71855
+ case "@capacitor/app":
71856
+ _capModules[name] = await __vitePreload(() => import("./index-D4CPFkph.js"), true ? __vite__mapDeps([54,3,52]) : void 0, import.meta.url);
71857
+ break;
71858
+ case "@capawesome/capacitor-file-picker":
71859
+ _capModules[name] = await __vitePreload(() => import("./index-DxOzbfR-.js"), true ? __vite__mapDeps([55,52]) : void 0, import.meta.url);
71860
+ break;
71861
+ case "@capacitor/haptics":
71862
+ _capModules[name] = await __vitePreload(() => import("./index-CGj1spkU.js"), true ? __vite__mapDeps([56,3,52]) : void 0, import.meta.url);
71863
+ break;
71864
+ default:
71865
+ _capModules[name] = null;
71866
+ }
71867
+ } catch {
71868
+ _capModules[name] = null;
71869
+ }
71870
+ }
71871
+ return _capModules[name];
71872
+ }
71873
+ async function capFS() {
71874
+ return capModule("@capacitor/filesystem");
71875
+ }
71876
+ async function capShare() {
71877
+ return capModule("@capacitor/share");
71878
+ }
71879
+ async function capPicker() {
71880
+ return capModule("@capawesome/capacitor-file-picker");
71881
+ }
71882
+ let currentFilePath = null;
71883
+ const eventListeners = {};
71884
+ function decodeBase64UTF8(base64) {
71885
+ const binary2 = atob(base64);
71886
+ const bytes = new Uint8Array(binary2.length);
71887
+ for (let i2 = 0; i2 < binary2.length; i2++) {
71888
+ bytes[i2] = binary2.charCodeAt(i2);
71889
+ }
71890
+ return new TextDecoder("utf-8").decode(bytes);
71891
+ }
71892
+ async function writeAndShareFile(fileName, content2) {
71893
+ try {
71894
+ const fs = await capFS();
71895
+ await fs.Filesystem.writeFile({
71896
+ path: fileName,
71897
+ data: content2,
71898
+ directory: fs.Directory.Documents,
71899
+ encoding: fs.Encoding.UTF8,
71900
+ recursive: true
71901
+ });
71902
+ const fileUri = await fs.Filesystem.getUri({
71903
+ path: fileName,
71904
+ directory: fs.Directory.Documents
71905
+ });
71906
+ const sh = await capShare();
71907
+ try {
71908
+ await sh.Share.share({
71909
+ title: fileName,
71910
+ text: "ColaMD Export",
71911
+ files: [fileUri.uri],
71912
+ dialogTitle: "Share Export"
71913
+ });
71914
+ } catch {
71915
+ }
71916
+ return true;
71917
+ } catch (err) {
71918
+ console.error("writeAndShareFile failed:", err);
71919
+ return false;
71920
+ }
71921
+ }
71922
+ function emit(event, ...args) {
71923
+ const listeners = eventListeners[event] || [];
71924
+ listeners.forEach((fn) => fn(...args));
71925
+ }
71926
+ function isNativePlatform() {
71927
+ return Capacitor.isNativePlatform();
71928
+ }
71929
+ function getBaseName(path2) {
71930
+ const parts = path2.split(/[/\\]/);
71931
+ return parts[parts.length - 1] || "Untitled";
71932
+ }
71933
+ function generateFilename(content2, ext) {
71934
+ const match = content2.match(/^#\s+(.+)$/m);
71935
+ if (match) {
71936
+ const title = match[1].replace(/[\\/:*?"<>|]/g, "").trim().slice(0, 50);
71937
+ if (title) return `${title}.${ext}`;
71938
+ }
71939
+ const ts = Date.now();
71940
+ return `untitled_${ts}.${ext}`;
71941
+ }
71942
+ async function readFileContent(filePath) {
71943
+ try {
71944
+ const fs = await capFS();
71945
+ const result = await fs.Filesystem.readFile({
71946
+ path: filePath,
71947
+ directory: fs.Directory.Documents,
71948
+ encoding: fs.Encoding.UTF8
71949
+ });
71950
+ return result.data;
71951
+ } catch {
71952
+ return "";
71953
+ }
71954
+ }
71955
+ async function writeFileContent(filePath, content2) {
71956
+ try {
71957
+ const fs = await capFS();
71958
+ await fs.Filesystem.writeFile({
71959
+ path: filePath,
71960
+ data: content2,
71961
+ directory: fs.Directory.Documents,
71962
+ encoding: fs.Encoding.UTF8,
71963
+ recursive: true
71964
+ });
71965
+ return true;
71966
+ } catch (err) {
71967
+ console.error("writeFileContent failed:", err);
71968
+ return false;
71969
+ }
71970
+ }
71971
+ async function triggerHaptic(style = "light") {
71972
+ if (!isNativePlatform()) return;
71973
+ try {
71974
+ const { Haptics } = await __vitePreload(async () => {
71975
+ const { Haptics: Haptics2 } = await import("./index-CGj1spkU.js");
71976
+ return { Haptics: Haptics2 };
71977
+ }, true ? __vite__mapDeps([56,3,52]) : void 0, import.meta.url);
71978
+ if (style === "heavy") await Haptics.impact({ style: "HEAVY" });
71979
+ else if (style === "medium") await Haptics.impact({ style: "MEDIUM" });
71980
+ else await Haptics.impact({ style: "LIGHT" });
71981
+ } catch {
71982
+ }
71983
+ }
71984
+ async function pickAndReadFile() {
71985
+ try {
71986
+ const picker = await capPicker();
71987
+ const result = await picker.FilePicker.pickFiles({
71988
+ types: [
71989
+ "text/markdown",
71990
+ "text/plain",
71991
+ "application/octet-stream",
71992
+ "text/x-markdown"
71993
+ ],
71994
+ multiple: false,
71995
+ readData: true
71996
+ });
71997
+ const file = result.files[0];
71998
+ if (!file) return null;
71999
+ let content2 = "";
72000
+ if (file.data) {
72001
+ content2 = decodeBase64UTF8(file.data);
72002
+ } else if (file.path) {
72003
+ const fs = await capFS();
72004
+ const readResult = await fs.Filesystem.readFile({
72005
+ path: file.path,
72006
+ encoding: fs.Encoding.UTF8
72007
+ });
72008
+ content2 = readResult.data;
72009
+ }
72010
+ const filePath = file.path || file.name;
72011
+ currentFilePath = filePath;
72012
+ return { path: filePath, content: content2 };
72013
+ } catch (error) {
72014
+ console.warn("File picker cancelled or failed:", error);
72015
+ return null;
72016
+ }
72017
+ }
72018
+ async function pickCSSFile() {
72019
+ try {
72020
+ const picker = await capPicker();
72021
+ const result = await picker.FilePicker.pickFiles({
72022
+ types: ["text/css"],
72023
+ multiple: false,
72024
+ readData: true
72025
+ });
72026
+ const file = result.files[0];
72027
+ if (!file) return null;
72028
+ let css = "";
72029
+ if (file.data) {
72030
+ css = decodeBase64UTF8(file.data);
72031
+ } else if (file.path) {
72032
+ const fs = await capFS();
72033
+ const readResult = await fs.Filesystem.readFile({
72034
+ path: file.path,
72035
+ encoding: fs.Encoding.UTF8
72036
+ });
72037
+ css = readResult.data;
72038
+ }
72039
+ return { name: file.name, css };
72040
+ } catch (error) {
72041
+ console.warn("CSS file picker cancelled or failed:", error);
72042
+ return null;
72043
+ }
72044
+ }
72045
+ function createCapacitorAPI() {
72046
+ const api = {
72047
+ async openFile() {
72048
+ if (!isNativePlatform()) {
72049
+ const input = document.createElement("input");
72050
+ input.type = "file";
72051
+ input.accept = ".md,.markdown,.mdown,.mkd,.txt";
72052
+ return new Promise((resolve) => {
72053
+ input.onchange = async () => {
72054
+ const file = input.files?.[0];
72055
+ if (!file) {
72056
+ resolve(null);
72057
+ return;
72058
+ }
72059
+ const content2 = await file.text();
72060
+ currentFilePath = file.name;
72061
+ resolve({ path: file.name, content: content2 });
72062
+ input.remove();
72063
+ };
72064
+ input.click();
72065
+ });
72066
+ }
72067
+ return pickAndReadFile();
72068
+ },
72069
+ async openFilePath(path2) {
72070
+ const content2 = await readFileContent(path2);
72071
+ if (!content2 && content2 !== "") return null;
72072
+ currentFilePath = path2;
72073
+ return { path: path2, content: content2 };
72074
+ },
72075
+ setCurrentFile(path2) {
72076
+ currentFilePath = path2;
72077
+ },
72078
+ async saveFile(content2) {
72079
+ if (!currentFilePath) {
72080
+ const fileName = generateFilename(content2, "md");
72081
+ const ok22 = await writeFileContent(fileName, content2);
72082
+ if (ok22) {
72083
+ currentFilePath = fileName;
72084
+ triggerHaptic("medium");
72085
+ }
72086
+ return ok22;
72087
+ }
72088
+ const ok2 = await writeFileContent(currentFilePath, content2);
72089
+ if (ok2) triggerHaptic("light");
72090
+ return ok2;
72091
+ },
72092
+ async saveFileAs(content2) {
72093
+ const baseName = currentFilePath ? getBaseName(currentFilePath).replace(/\.md$/, "") : "untitled";
72094
+ const fileName = `${baseName}_${Date.now()}.md`;
72095
+ if (!isNativePlatform()) {
72096
+ const blob = new Blob([content2], { type: "text/markdown" });
72097
+ const url = URL.createObjectURL(blob);
72098
+ const a2 = document.createElement("a");
72099
+ a2.href = url;
72100
+ a2.download = fileName;
72101
+ a2.click();
72102
+ URL.revokeObjectURL(url);
72103
+ currentFilePath = fileName;
72104
+ return true;
72105
+ }
72106
+ const ok2 = await writeFileContent(fileName, content2);
72107
+ if (!ok2) {
72108
+ triggerHaptic("heavy");
72109
+ return false;
72110
+ }
72111
+ currentFilePath = fileName;
72112
+ triggerHaptic("medium");
72113
+ try {
72114
+ const fs = await capFS();
72115
+ const fileUri = await fs.Filesystem.getUri({
72116
+ path: fileName,
72117
+ directory: fs.Directory.Documents
72118
+ });
72119
+ const sh = await capShare();
72120
+ await sh.Share.share({
72121
+ title: fileName,
72122
+ text: "ColaMD Document",
72123
+ files: [fileUri.uri],
72124
+ dialogTitle: "Save As"
72125
+ });
72126
+ } catch {
72127
+ }
72128
+ return true;
72129
+ },
72130
+ async exportPDF(htmlContent) {
72131
+ if (!isNativePlatform()) {
72132
+ window.print();
72133
+ return true;
72134
+ }
72135
+ const bridge = window.ColaMDNative;
72136
+ if (bridge && typeof bridge.printDocument === "function") {
72137
+ let saveAndOverride = function(selector2, overrides) {
72138
+ const el = document.querySelector(selector2);
72139
+ if (!el) return;
72140
+ orig.push({ el, cssText: el.style.cssText });
72141
+ for (const [prop, value] of Object.entries(overrides)) {
72142
+ el.style[prop] = value;
72143
+ }
72144
+ };
72145
+ const orig = [];
72146
+ saveAndOverride("#titlebar", { display: "none" });
72147
+ saveAndOverride("#mobile-menu", { display: "none" });
72148
+ saveAndOverride("#menu-btn", { display: "none" });
72149
+ saveAndOverride(".cola-toast", { display: "none" });
72150
+ saveAndOverride("html", { height: "auto", overflow: "visible" });
72151
+ saveAndOverride("body", { height: "auto", overflow: "visible" });
72152
+ saveAndOverride("#editor", {
72153
+ position: "static",
72154
+ height: "auto",
72155
+ overflow: "visible",
72156
+ top: "auto",
72157
+ bottom: "auto"
72158
+ });
72159
+ saveAndOverride("#editor .ProseMirror", { minHeight: "auto" });
72160
+ await new Promise((r2) => requestAnimationFrame(r2));
72161
+ const jobName = currentFilePath ? getBaseName(currentFilePath).replace(/\.(md|markdown)$/, "") : "ColaMD Document";
72162
+ bridge.printDocument(jobName);
72163
+ setTimeout(() => {
72164
+ for (const { el, cssText } of orig) {
72165
+ el.style.cssText = cssText;
72166
+ }
72167
+ }, 3e3);
72168
+ return true;
72169
+ }
72170
+ const content2 = htmlContent || "";
72171
+ if (!content2) return false;
72172
+ const defaultName = currentFilePath ? getBaseName(currentFilePath).replace(/\.(md|markdown)$/, "-print.html") : "colamd-print.html";
72173
+ return writeAndShareFile(defaultName, content2);
72174
+ },
72175
+ async exportHTML(htmlContent) {
72176
+ const defaultName = currentFilePath ? getBaseName(currentFilePath).replace(/\.(md|markdown)$/, ".html") : "colamd-export.html";
72177
+ if (!isNativePlatform()) {
72178
+ const blob = new Blob([htmlContent], { type: "text/html" });
72179
+ const url = URL.createObjectURL(blob);
72180
+ const a2 = document.createElement("a");
72181
+ a2.href = url;
72182
+ a2.download = defaultName;
72183
+ a2.click();
72184
+ URL.revokeObjectURL(url);
72185
+ return true;
72186
+ }
72187
+ return writeAndShareFile(defaultName, htmlContent);
72188
+ },
72189
+ async newSlides() {
72190
+ const template = `---
72191
+ kicker: ColaMD
72192
+ chip: Markdown Editor · 2026
72193
+ page: Your Name
72194
+ ---
72195
+
72196
+ <!-- type: cover -->
72197
+ # Welcome to ColaMD
72198
+ Agent Native Markdown Editor
72199
+
72200
+ ---
72201
+
72202
+ <!-- type: statement -->
72203
+ ## Start Writing
72204
+ Edit this file in ColaMD and see your changes in real time.
72205
+ `;
72206
+ return template;
72207
+ },
72208
+ async openAsSlides(content2) {
72209
+ if (!isNativePlatform()) {
72210
+ const newWindow = window.open("", "_blank");
72211
+ if (newWindow) {
72212
+ newWindow.document.write(`<pre>${content2}</pre>`);
72213
+ }
72214
+ return !!newWindow;
72215
+ }
72216
+ return writeAndShareFile("colamd-slides-preview.html", content2);
72217
+ },
72218
+ async loadCustomTheme() {
72219
+ if (!isNativePlatform()) {
72220
+ const input = document.createElement("input");
72221
+ input.type = "file";
72222
+ input.accept = ".css";
72223
+ return new Promise((resolve) => {
72224
+ input.onchange = async () => {
72225
+ const file = input.files?.[0];
72226
+ if (!file) {
72227
+ resolve(null);
72228
+ return;
72229
+ }
72230
+ const css = await file.text();
72231
+ resolve({ name: file.name, css });
72232
+ input.remove();
72233
+ };
72234
+ input.click();
72235
+ });
72236
+ }
72237
+ return pickCSSFile();
72238
+ },
72239
+ async loadThemeCSS(_fileName) {
72240
+ try {
72241
+ const fs = await capFS();
72242
+ const result = await fs.Filesystem.readFile({
72243
+ path: `.colamd/themes/${_fileName}`,
72244
+ directory: fs.Directory.Documents,
72245
+ encoding: fs.Encoding.UTF8
72246
+ });
72247
+ return result.data;
72248
+ } catch {
72249
+ return null;
72250
+ }
72251
+ },
72252
+ getPathForFile(_file) {
72253
+ return _file.name || "";
72254
+ },
72255
+ openExternal(url) {
72256
+ if (isNativePlatform()) {
72257
+ window.open(url, "_system", "location=yes");
72258
+ } else {
72259
+ window.open(url, "_blank");
72260
+ }
72261
+ },
72262
+ onFileChanged(callback) {
72263
+ eventListeners["file-changed"] = eventListeners["file-changed"] || [];
72264
+ eventListeners["file-changed"].push(callback);
72265
+ if (!isNativePlatform()) return;
72266
+ let lastContent = "";
72267
+ let watcherTimer = null;
72268
+ const pollChanges = async () => {
72269
+ if (!currentFilePath) return;
72270
+ try {
72271
+ const content2 = await readFileContent(currentFilePath);
72272
+ if (content2 !== lastContent && content2) {
72273
+ lastContent = content2;
72274
+ emit("file-changed", content2);
72275
+ }
72276
+ } catch {
72277
+ }
72278
+ };
72279
+ if (!watcherTimer) {
72280
+ watcherTimer = setInterval(pollChanges, 2e3);
72281
+ }
72282
+ },
72283
+ onNewFile(callback) {
72284
+ eventListeners["new-file"] = eventListeners["new-file"] || [];
72285
+ eventListeners["new-file"].push(callback);
72286
+ },
72287
+ onFileOpened(callback) {
72288
+ eventListeners["file-opened"] = eventListeners["file-opened"] || [];
72289
+ eventListeners["file-opened"].push(callback);
72290
+ },
72291
+ onMenuOpen(callback) {
72292
+ eventListeners["menu-open"] = eventListeners["menu-open"] || [];
72293
+ eventListeners["menu-open"].push(callback);
72294
+ },
72295
+ onMenuSave(callback) {
72296
+ eventListeners["menu-save"] = eventListeners["menu-save"] || [];
72297
+ eventListeners["menu-save"].push(callback);
72298
+ },
72299
+ onMenuSaveAs(callback) {
72300
+ eventListeners["menu-save-as"] = eventListeners["menu-save-as"] || [];
72301
+ eventListeners["menu-save-as"].push(callback);
72302
+ },
72303
+ onMenuExportPDF(callback) {
72304
+ eventListeners["menu-export-pdf"] = eventListeners["menu-export-pdf"] || [];
72305
+ eventListeners["menu-export-pdf"].push(callback);
72306
+ },
72307
+ onMenuExportHTML(callback) {
72308
+ eventListeners["menu-export-html"] = eventListeners["menu-export-html"] || [];
72309
+ eventListeners["menu-export-html"].push(callback);
72310
+ },
72311
+ onMenuNewSlides(callback) {
72312
+ eventListeners["menu-new-slides"] = eventListeners["menu-new-slides"] || [];
72313
+ eventListeners["menu-new-slides"].push(callback);
72314
+ },
72315
+ onMenuOpenAsSlides(callback) {
72316
+ eventListeners["menu-open-as-slides"] = eventListeners["menu-open-as-slides"] || [];
72317
+ eventListeners["menu-open-as-slides"].push(callback);
72318
+ },
72319
+ onNewSlidesContent(callback) {
72320
+ eventListeners["new-slides-content"] = eventListeners["new-slides-content"] || [];
72321
+ eventListeners["new-slides-content"].push(callback);
72322
+ },
72323
+ onSetTheme(callback) {
72324
+ eventListeners["set-theme"] = eventListeners["set-theme"] || [];
72325
+ eventListeners["set-theme"].push(callback);
72326
+ },
72327
+ onSetCustomCSS(callback) {
72328
+ eventListeners["set-custom-css"] = eventListeners["set-custom-css"] || [];
72329
+ eventListeners["set-custom-css"].push(callback);
72330
+ },
72331
+ async exportSlides(content2) {
72332
+ const defaultName = "colamd-slides.html";
72333
+ if (!isNativePlatform()) {
72334
+ const blob = new Blob([content2], { type: "text/html" });
72335
+ const url = URL.createObjectURL(blob);
72336
+ const a2 = document.createElement("a");
72337
+ a2.href = url;
72338
+ a2.download = defaultName;
72339
+ a2.click();
72340
+ URL.revokeObjectURL(url);
72341
+ return true;
72342
+ }
72343
+ return writeAndShareFile(defaultName, content2);
72344
+ },
72345
+ onMenuExportSlides(callback) {
72346
+ eventListeners["menu-export-slides"] = eventListeners["menu-export-slides"] || [];
72347
+ eventListeners["menu-export-slides"].push(callback);
72348
+ },
72349
+ onAgentActivity(callback) {
72350
+ eventListeners["agent-activity"] = eventListeners["agent-activity"] || [];
72351
+ eventListeners["agent-activity"].push(callback);
72352
+ },
72353
+ async registerPlugins(_plugins) {
72354
+ localStorage.setItem("colamd-plugins", JSON.stringify(_plugins));
72355
+ return true;
72356
+ },
72357
+ async syncPluginState(_id, _enabled) {
72358
+ const raw = localStorage.getItem("colamd-plugins") || "[]";
72359
+ const plugins2 = JSON.parse(raw);
72360
+ const p2 = plugins2.find((x2) => x2.id === _id);
72361
+ if (p2) p2.enabled = _enabled;
72362
+ localStorage.setItem("colamd-plugins", JSON.stringify(plugins2));
72363
+ },
72364
+ onMenuTogglePlugin(callback) {
72365
+ eventListeners["menu-toggle-plugin"] = eventListeners["menu-toggle-plugin"] || [];
72366
+ eventListeners["menu-toggle-plugin"].push(callback);
72367
+ },
72368
+ onMenuImportTheme(callback) {
72369
+ eventListeners["menu-import-theme"] = eventListeners["menu-import-theme"] || [];
72370
+ eventListeners["menu-import-theme"].push(callback);
72371
+ },
72372
+ async exportFile(dataUrl, defaultName) {
72373
+ if (!isNativePlatform()) {
72374
+ const a2 = document.createElement("a");
72375
+ a2.href = dataUrl;
72376
+ a2.download = defaultName;
72377
+ a2.click();
72378
+ return true;
72379
+ }
72380
+ const base64Data = dataUrl.replace(/^data:[^;]+;base64,/, "");
72381
+ try {
72382
+ const fs = await capFS();
72383
+ await fs.Filesystem.writeFile({
72384
+ path: defaultName,
72385
+ data: base64Data,
72386
+ directory: fs.Directory.Documents,
72387
+ recursive: true
72388
+ });
72389
+ const fileUri = await fs.Filesystem.getUri({
72390
+ path: defaultName,
72391
+ directory: fs.Directory.Documents
72392
+ });
72393
+ const sh = await capShare();
72394
+ try {
72395
+ await sh.Share.share({
72396
+ title: defaultName,
72397
+ files: [fileUri.uri],
72398
+ dialogTitle: "Share Export"
72399
+ });
72400
+ } catch {
72401
+ }
72402
+ return true;
72403
+ } catch {
72404
+ return false;
72405
+ }
72406
+ }
72407
+ };
72408
+ return api;
72409
+ }
72410
+ function showToast(message, duration = 2e3) {
72411
+ const existing = document.querySelector(".cola-toast");
72412
+ if (existing) existing.remove();
72413
+ const toast = document.createElement("div");
72414
+ toast.className = "cola-toast";
72415
+ toast.textContent = message;
72416
+ toast.style.cssText = "position:fixed;top:56px;left:50%;transform:translateX(-50%);background:rgba(0,0,0,0.8);color:#fff;padding:10px 20px;border-radius:8px;font-size:14px;z-index:9999;pointer-events:none;";
72417
+ document.body.appendChild(toast);
72418
+ setTimeout(() => {
72419
+ toast.style.opacity = "0";
72420
+ toast.style.transition = "opacity 0.3s";
72421
+ setTimeout(() => toast.remove(), 300);
72422
+ }, duration);
72423
+ }
72424
+ function checkAndOpenPendingFile(api) {
72425
+ const bridge = window.ColaMDNative;
72426
+ if (!bridge || typeof bridge.checkPendingFile !== "function") return;
72427
+ try {
72428
+ const result = bridge.checkPendingFile();
72429
+ if (result && result !== "null") {
72430
+ const data = JSON.parse(result);
72431
+ if (data && data.content) {
72432
+ setContent(data.content);
72433
+ if (data.name && api?.setCurrentFile) {
72434
+ api.setCurrentFile(data.name);
72435
+ }
72436
+ }
72437
+ }
72438
+ } catch (e2) {
72439
+ }
72440
+ }
72441
+ function processPendingIntentFile(api) {
72442
+ checkAndOpenPendingFile(api);
72443
+ }
72444
+ async function ensureAllPluginsRendered() {
72445
+ for (const p2 of getAllPlugins()) {
72446
+ if (p2.enabled && p2.ensureRendered) await p2.ensureRendered();
72447
+ }
72448
+ }
72449
+ function refreshThemeSensitivePlugins() {
72450
+ for (const p2 of getAllPlugins()) {
72451
+ if (p2.enabled && p2.nodeTypes && p2.onThemeChange) {
72452
+ togglePluginMode(p2.nodeTypes, "raw");
72453
+ requestAnimationFrame(() => togglePluginMode(p2.nodeTypes, "rendered"));
72454
+ }
72455
+ }
72456
+ }
71887
72457
  function isSlidesContent(content2) {
71888
72458
  return /^---\s*\n[\s\S]*?(kicker|chip):/m.test(content2);
71889
72459
  }
@@ -71917,63 +72487,115 @@ function getContent() {
71917
72487
  if (sourceModeActive) return sourceEl().value;
71918
72488
  return getMarkdown();
71919
72489
  }
72490
+ function syncRawEdits() {
72491
+ document.querySelectorAll(".math-block-raw, .math-inline-raw, .mermaid-source").forEach((el) => {
72492
+ if (el.matches(":focus")) el.blur();
72493
+ });
72494
+ }
72495
+ function restoreRenderedMode(api) {
72496
+ for (const p2 of getAllPlugins()) {
72497
+ if (!p2.enabled) {
72498
+ p2.enabled = true;
72499
+ togglePluginMode(p2.nodeTypes || [], "rendered");
72500
+ api.syncPluginState(p2.id, true);
72501
+ }
72502
+ }
72503
+ }
71920
72504
  async function init() {
71921
- const api = window.electronAPI;
71922
- const savedTheme = loadSavedTheme();
71923
- applyTheme(savedTheme);
71924
- if (savedTheme.startsWith("custom:")) {
71925
- const fileName = savedTheme.slice(7);
71926
- const css = await api.loadThemeCSS(fileName);
71927
- if (css) applyTheme(savedTheme, css);
71928
- }
71929
- await createEditor("editor");
72505
+ const api = window.electronAPI || await createCapacitorAPI();
72506
+ let editorReady = false;
72507
+ let pendingFileContent = null;
72508
+ api.onFileOpened((data) => {
72509
+ if (editorReady) {
72510
+ setContent(data.content);
72511
+ } else {
72512
+ pendingFileContent = data.content;
72513
+ }
72514
+ });
72515
+ let savedTheme = loadSavedTheme();
72516
+ try {
72517
+ if (savedTheme.startsWith("custom:")) {
72518
+ const fileName = savedTheme.slice(7);
72519
+ const css = await api.loadThemeCSS(fileName);
72520
+ if (css) {
72521
+ setCachedCustomTheme(fileName, css);
72522
+ applyTheme(savedTheme);
72523
+ } else {
72524
+ applyTheme("elegant");
72525
+ }
72526
+ } else {
72527
+ applyTheme(savedTheme);
72528
+ }
72529
+ } catch (e2) {
72530
+ console.error("Theme initialization failed, falling back to elegant:", e2);
72531
+ applyTheme("elegant");
72532
+ }
72533
+ try {
72534
+ await createEditor("editor");
72535
+ } catch (e2) {
72536
+ console.error("Editor initialization failed:", e2);
72537
+ }
72538
+ editorReady = true;
72539
+ if (pendingFileContent !== null) {
72540
+ setContent(pendingFileContent);
72541
+ pendingFileContent = null;
72542
+ }
71930
72543
  for (const p2 of getAllPlugins()) p2.onInit?.();
72544
+ checkAndOpenPendingFile(api);
71931
72545
  api.registerPlugins(getAllPlugins().map((p2) => ({ id: p2.id, name: p2.name, enabled: p2.enabled })));
71932
72546
  api.onMenuTogglePlugin((id33) => {
71933
- togglePlugin(id33);
71934
72547
  const p2 = getAllPlugins().find((x2) => x2.id === id33);
71935
72548
  if (p2) {
72549
+ togglePlugin(id33, !p2.enabled);
71936
72550
  const mode = p2.enabled ? "rendered" : "raw";
71937
- togglePluginMode(p2.nodeTypes, mode);
72551
+ togglePluginMode(p2.nodeTypes || [], mode);
71938
72552
  api.syncPluginState(p2.id, p2.enabled);
71939
72553
  }
71940
72554
  });
72555
+ setupMobileMenu(api, savedTheme);
72556
+ if (!window.electronAPI) {
72557
+ setInterval(() => processPendingIntentFile(api), 3e3);
72558
+ }
71941
72559
  slidesBtnEl().addEventListener("click", () => api.openAsSlides(getContent()));
71942
72560
  api.onMenuOpen(async () => {
71943
72561
  const result = await api.openFile();
71944
72562
  if (result) setContent(result.content);
71945
72563
  });
71946
- function syncRawEdits() {
71947
- document.querySelectorAll(".math-block-raw, .math-inline-raw, .mermaid-source").forEach((el) => {
71948
- if (el.matches(":focus")) el.blur();
71949
- });
71950
- }
71951
- function restoreRenderedMode() {
71952
- for (const p2 of getAllPlugins()) {
71953
- if (!p2.enabled) {
71954
- p2.enabled = true;
71955
- togglePluginMode(p2.nodeTypes, "rendered");
71956
- api.syncPluginState(p2.id, true);
71957
- }
71958
- }
71959
- }
71960
72564
  api.onMenuSave(async () => {
71961
72565
  syncRawEdits();
71962
72566
  const ok2 = await api.saveFile(getContent());
71963
- if (ok2) restoreRenderedMode();
72567
+ if (ok2) {
72568
+ showToast("Saved");
72569
+ restoreRenderedMode(api);
72570
+ } else {
72571
+ showToast("Save failed");
72572
+ }
71964
72573
  });
71965
72574
  api.onMenuSaveAs(async () => {
71966
72575
  syncRawEdits();
71967
72576
  const ok2 = await api.saveFileAs(getContent());
71968
- if (ok2) restoreRenderedMode();
72577
+ if (ok2) {
72578
+ showToast("Saved");
72579
+ restoreRenderedMode(api);
72580
+ } else {
72581
+ showToast("Save cancelled or failed");
72582
+ }
71969
72583
  });
71970
72584
  api.onMenuExportPDF(async () => {
71971
72585
  syncRawEdits();
71972
- restoreRenderedMode();
71973
- await new Promise((r2) => requestAnimationFrame(() => requestAnimationFrame(r2)));
71974
- await api.exportPDF();
72586
+ restoreRenderedMode(api);
72587
+ await ensureAllPluginsRendered();
72588
+ await new Promise((r2) => setTimeout(r2, 300));
72589
+ await api.exportPDF(buildExportHTML());
72590
+ setTimeout(() => {
72591
+ document.querySelectorAll(".mermaid-loading, .mermaid-error").forEach((el) => el.style.display = "none");
72592
+ }, 1e3);
71975
72593
  });
71976
- api.onMenuExportHTML(() => {
72594
+ api.onMenuExportHTML(async () => {
72595
+ syncRawEdits();
72596
+ restoreRenderedMode(api);
72597
+ await ensureAllPluginsRendered();
72598
+ await new Promise((r2) => setTimeout(r2, 200));
71977
72599
  const s2 = getComputedStyle(document.body);
71978
72600
  const v2 = (name) => s2.getPropertyValue(name).trim();
71979
72601
  const bgColor = v2("--bg-color");
@@ -71984,6 +72606,7 @@ async function init() {
71984
72606
  const codeBg = v2("--code-bg");
71985
72607
  const codeBlockBg = v2("--code-block-bg");
71986
72608
  const codeBlockText = v2("--code-block-text") || textColor;
72609
+ const mermaidBg = v2("--mermaid-background") || bgColor;
71987
72610
  const blockquoteBorder = v2("--blockquote-border");
71988
72611
  const blockquoteBg = v2("--blockquote-bg") || "transparent";
71989
72612
  const tableHeaderBg = v2("--table-header-bg");
@@ -72016,21 +72639,20 @@ th{background:${tableHeaderBg};font-weight:600}
72016
72639
  hr{border:none;border-top:2px solid ${borderColor};margin:2em 0}
72017
72640
  img{max-width:100%}
72018
72641
  ::selection{background:${selectionBg}}
72019
- .math-inline{display:inline;padding:2px 4px;border-radius:3px;background:${codeBg}}
72020
- .math-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${codeBlockBg};text-align:center;overflow-x:auto}
72021
- .mermaid-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${codeBlockBg};border:1px solid ${borderColor}}
72642
+ .math-inline{display:inline;padding:2px 4px;border-radius:3px;background:${mermaidBg}}
72643
+ .math-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${mermaidBg};text-align:center;overflow-x:auto}
72644
+ .mermaid-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${mermaidBg};border:1px solid ${borderColor}}
72022
72645
  .mermaid-preview{display:flex;justify-content:center;align-items:center}
72023
72646
  .mermaid-preview svg{max-width:100%;height:auto}
72024
72647
  .mermaid-preview svg .label text,.mermaid-preview svg .nodeLabel text,.mermaid-preview svg .state-title,.mermaid-preview svg .state-description,.mermaid-preview svg .pieTitleText,.mermaid-preview svg .titleText{transform:translateY(-2px)}.mermaid-preview svg .nodeLabel,.mermaid-preview svg .edgeLabel{display:inline-block;position:relative;top:-2px}
72025
72648
  </style>
72026
- </head><body>${getHTML()}</body></html>`;
72649
+ </head><body>${getLiveHTML()}</body></html>`;
72027
72650
  api.exportHTML(html2);
72028
72651
  });
72029
72652
  api.onNewFile(() => {
72030
72653
  exitSourceMode();
72031
72654
  setMarkdown("");
72032
72655
  });
72033
- api.onFileOpened((data) => setContent(data.content));
72034
72656
  api.onFileChanged((content2) => {
72035
72657
  if (sourceModeActive) {
72036
72658
  sourceEl().value = content2;
@@ -72038,18 +72660,23 @@ img{max-width:100%}
72038
72660
  setMarkdown(content2);
72039
72661
  }
72040
72662
  });
72041
- api.onSetTheme((theme) => {
72663
+ let pendingThemeChange = null;
72664
+ let themeChangeTimer = null;
72665
+ function applyThemeChange(theme) {
72666
+ pendingThemeChange = null;
72042
72667
  applyTheme(theme);
72043
72668
  for (const p2 of getAllPlugins()) p2.onThemeChange?.(theme);
72044
- for (const p2 of getAllPlugins()) {
72045
- if (p2.enabled) {
72046
- togglePluginMode(p2.nodeTypes, "raw");
72047
- requestAnimationFrame(() => togglePluginMode(p2.nodeTypes, "rendered"));
72048
- }
72049
- }
72669
+ refreshThemeSensitivePlugins();
72670
+ }
72671
+ api.onSetTheme((theme) => {
72672
+ if (themeChangeTimer) clearTimeout(themeChangeTimer);
72673
+ pendingThemeChange = theme;
72674
+ themeChangeTimer = setTimeout(() => {
72675
+ if (pendingThemeChange) applyThemeChange(pendingThemeChange);
72676
+ }, 50);
72050
72677
  });
72051
72678
  api.onSetCustomCSS((css) => {
72052
- const theme = loadSavedTheme();
72679
+ const theme = pendingThemeChange || loadSavedTheme();
72053
72680
  applyTheme(theme, css);
72054
72681
  });
72055
72682
  api.onMenuNewSlides(async () => {
@@ -72066,7 +72693,10 @@ img{max-width:100%}
72066
72693
  });
72067
72694
  api.onMenuImportTheme(async () => {
72068
72695
  const result = await api.loadCustomTheme();
72069
- if (result) applyTheme(`custom:${result.name}`, result.css);
72696
+ if (result) {
72697
+ setCachedCustomTheme(result.name, result.css);
72698
+ applyTheme(`custom:${result.name}`);
72699
+ }
72070
72700
  });
72071
72701
  const agentDot = document.getElementById("agent-dot");
72072
72702
  api.onAgentActivity((state2) => {
@@ -72137,6 +72767,214 @@ img{max-width:100%}
72137
72767
  if (result) setContent(result.content);
72138
72768
  });
72139
72769
  }
72770
+ function setupMobileMenu(api, currentTheme) {
72771
+ const menuEl = document.getElementById("mobile-menu");
72772
+ const menuBtn = document.getElementById("menu-btn");
72773
+ const closeBtn = document.getElementById("menu-close-btn");
72774
+ const overlay = document.getElementById("menu-overlay");
72775
+ if (!menuEl || !menuBtn) return;
72776
+ function openMenu() {
72777
+ menuEl.classList.add("open");
72778
+ }
72779
+ function closeMenu() {
72780
+ menuEl.classList.remove("open");
72781
+ }
72782
+ menuBtn.addEventListener("click", openMenu);
72783
+ closeBtn?.addEventListener("click", closeMenu);
72784
+ overlay?.addEventListener("click", closeMenu);
72785
+ const themes2 = [
72786
+ { key: "light", label: "Light" },
72787
+ { key: "dark", label: "Dark" },
72788
+ { key: "elegant", label: "Elegant" },
72789
+ { key: "newsprint", label: "Newsprint" }
72790
+ ];
72791
+ const themeListEl = document.getElementById("menu-theme-list");
72792
+ if (themeListEl) {
72793
+ themeListEl.innerHTML = themes2.map(
72794
+ (t2) => `<div class="menu-theme-item${t2.key === currentTheme ? " active" : ""}" data-theme="${t2.key}">${t2.label}</div>`
72795
+ ).join("");
72796
+ themeListEl.querySelectorAll(".menu-theme-item").forEach((el) => {
72797
+ el.addEventListener("click", () => {
72798
+ const theme = el.dataset.theme;
72799
+ applyTheme(theme);
72800
+ for (const p2 of getAllPlugins()) p2.onThemeChange?.(theme);
72801
+ refreshThemeSensitivePlugins();
72802
+ themeListEl.querySelectorAll(".menu-theme-item").forEach((e2) => e2.classList.remove("active"));
72803
+ el.classList.add("active");
72804
+ closeMenu();
72805
+ });
72806
+ });
72807
+ }
72808
+ const pluginsSection = document.getElementById("menu-plugins-section");
72809
+ const pluginListEl = document.getElementById("menu-plugin-list");
72810
+ const plugins2 = getAllPlugins();
72811
+ if (pluginsSection && pluginListEl && plugins2.length > 0) {
72812
+ pluginsSection.style.display = "";
72813
+ pluginListEl.innerHTML = plugins2.map(
72814
+ (p2) => `<div class="menu-plugin-item" data-plugin-id="${p2.id}"><span>${p2.name}</span><div class="menu-plugin-toggle${p2.enabled ? " on" : ""}"></div></div>`
72815
+ ).join("");
72816
+ pluginListEl.querySelectorAll(".menu-plugin-item").forEach((el) => {
72817
+ el.addEventListener("click", () => {
72818
+ const id33 = el.dataset.pluginId;
72819
+ const p2 = getAllPlugins().find((x2) => x2.id === id33);
72820
+ if (p2) {
72821
+ togglePlugin(id33, !p2.enabled);
72822
+ const mode = p2.enabled ? "rendered" : "raw";
72823
+ togglePluginMode(p2.nodeTypes || [], mode);
72824
+ api.syncPluginState(p2.id, p2.enabled);
72825
+ const toggle = el.querySelector(".menu-plugin-toggle");
72826
+ toggle?.classList.toggle("on", p2.enabled);
72827
+ }
72828
+ });
72829
+ });
72830
+ }
72831
+ menuEl.querySelectorAll(".menu-item").forEach((el) => {
72832
+ el.addEventListener("click", async () => {
72833
+ const action = el.dataset.action;
72834
+ if (!action) return;
72835
+ closeMenu();
72836
+ switch (action) {
72837
+ case "new":
72838
+ exitSourceMode();
72839
+ setMarkdown("");
72840
+ break;
72841
+ case "open": {
72842
+ const result = await api.openFile();
72843
+ if (result) setContent(result.content);
72844
+ break;
72845
+ }
72846
+ case "save":
72847
+ syncRawEdits();
72848
+ {
72849
+ const ok2 = await api.saveFile(getContent());
72850
+ if (ok2) {
72851
+ showToast("Saved");
72852
+ restoreRenderedMode(api);
72853
+ } else {
72854
+ showToast("Save failed");
72855
+ }
72856
+ }
72857
+ break;
72858
+ case "save-as":
72859
+ syncRawEdits();
72860
+ {
72861
+ const ok2 = await api.saveFileAs(getContent());
72862
+ if (ok2) {
72863
+ showToast("Saved");
72864
+ restoreRenderedMode(api);
72865
+ } else {
72866
+ showToast("Save cancelled or failed");
72867
+ }
72868
+ }
72869
+ break;
72870
+ case "export-pdf":
72871
+ syncRawEdits();
72872
+ restoreRenderedMode(api);
72873
+ await ensureAllPluginsRendered();
72874
+ await new Promise((r2) => setTimeout(r2, 300));
72875
+ await api.exportPDF(buildExportHTML());
72876
+ setTimeout(() => {
72877
+ document.querySelectorAll(".mermaid-loading, .mermaid-error").forEach((el2) => el2.style.display = "none");
72878
+ }, 1e3);
72879
+ break;
72880
+ case "export-html":
72881
+ syncRawEdits();
72882
+ restoreRenderedMode(api);
72883
+ await ensureAllPluginsRendered();
72884
+ await new Promise((r2) => setTimeout(r2, 200));
72885
+ api.exportHTML(buildExportHTML());
72886
+ break;
72887
+ case "export-slides":
72888
+ await api.exportSlides(getContent());
72889
+ break;
72890
+ case "new-slides": {
72891
+ const template = await api.newSlides();
72892
+ if (template) enterSourceMode(template);
72893
+ break;
72894
+ }
72895
+ case "open-as-slides":
72896
+ await api.openAsSlides(getContent());
72897
+ break;
72898
+ case "import-theme": {
72899
+ const result = await api.loadCustomTheme();
72900
+ if (result) {
72901
+ setCachedCustomTheme(result.name, result.css);
72902
+ applyTheme(`custom:${result.name}`);
72903
+ }
72904
+ break;
72905
+ }
72906
+ case "about":
72907
+ api.openExternal("https://github.com/byteuser1977/ColaMD-extend");
72908
+ break;
72909
+ case "exit":
72910
+ try {
72911
+ const { App } = await __vitePreload(async () => {
72912
+ const { App: App2 } = await import("./index-D4CPFkph.js");
72913
+ return { App: App2 };
72914
+ }, true ? __vite__mapDeps([54,3,52]) : void 0, import.meta.url);
72915
+ await App.exitApp();
72916
+ } catch {
72917
+ window.close();
72918
+ }
72919
+ break;
72920
+ }
72921
+ });
72922
+ });
72923
+ }
72924
+ function buildExportHTML() {
72925
+ const s2 = getComputedStyle(document.body);
72926
+ const v2 = (name) => s2.getPropertyValue(name).trim();
72927
+ const bgColor = v2("--bg-color");
72928
+ const textColor = v2("--text-color");
72929
+ const textMuted = v2("--text-muted");
72930
+ const borderColor = v2("--border-color");
72931
+ const linkColor = v2("--link-color");
72932
+ const codeBg = v2("--code-bg");
72933
+ const codeBlockBg = v2("--code-block-bg");
72934
+ const codeBlockText = v2("--code-block-text") || textColor;
72935
+ const mermaidBg = v2("--mermaid-background") || bgColor;
72936
+ const blockquoteBorder = v2("--blockquote-border");
72937
+ const blockquoteBg = v2("--blockquote-bg") || "transparent";
72938
+ const tableHeaderBg = v2("--table-header-bg");
72939
+ const selectionBg = v2("--selection-bg");
72940
+ const editor = document.querySelector("#editor .ProseMirror");
72941
+ const fontFamily = editor ? getComputedStyle(editor).fontFamily : "-apple-system,BlinkMacSystemFont,sans-serif";
72942
+ const getElColor = (selector2, fallback) => {
72943
+ const el = document.querySelector(`#editor .ProseMirror ${selector2}`);
72944
+ return el ? getComputedStyle(el).color : fallback;
72945
+ };
72946
+ const strongColor = getElColor("strong", textColor);
72947
+ const codeColor = getElColor("code", textColor);
72948
+ return `<!DOCTYPE html>
72949
+ <html><head><meta charset="utf-8"><title>ColaMD Export</title>
72950
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.46/dist/katex.min.css">
72951
+ <style>
72952
+ body{max-width:780px;margin:40px auto;padding:20px;font-family:${fontFamily};line-height:1.75;background:${bgColor};color:${textColor}}
72953
+ h1{font-size:2em;font-weight:700;border-bottom:1px solid ${borderColor};padding-bottom:.3em}
72954
+ h2{font-size:1.5em;font-weight:600;border-bottom:1px solid ${borderColor};padding-bottom:.25em}
72955
+ h3{font-size:1.25em;font-weight:600}
72956
+ strong{color:${strongColor}}
72957
+ a{color:${linkColor};text-decoration:none}
72958
+ code{background:${codeBg};color:${codeColor};padding:2px 6px;border-radius:3px;font-size:.875em;font-family:'SF Mono','Fira Code',Menlo,monospace}
72959
+ pre{background:${codeBlockBg};color:${codeBlockText};padding:16px;border-radius:6px;overflow-x:auto;margin:1em 0}
72960
+ pre code{background:none;padding:0;color:inherit}
72961
+ blockquote{border-left:4px solid ${blockquoteBorder};background:${blockquoteBg};padding-left:16px;margin:1em 0;color:${textMuted}}
72962
+ table{border-collapse:collapse;width:100%;margin:1em 0}
72963
+ th,td{border:1px solid ${borderColor};padding:8px 12px}
72964
+ th{background:${tableHeaderBg};font-weight:600}
72965
+ hr{border:none;border-top:2px solid ${borderColor};margin:2em 0}
72966
+ img{max-width:100%}
72967
+ ::selection{background:${selectionBg}}
72968
+ .math-inline{display:inline;padding:2px 4px;border-radius:3px;background:${codeBg}}
72969
+ .math-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${codeBlockBg};text-align:center;overflow-x:auto}
72970
+ .mermaid-block{display:block;padding:16px;margin:1em 0;border-radius:6px;background:${mermaidBg};border:1px solid ${borderColor}}
72971
+ .mermaid-preview{display:flex;justify-content:center;align-items:center}
72972
+ .mermaid-preview svg{max-width:100%;height:auto}
72973
+ @page{margin:15mm;size:A4}
72974
+ @media print{body{max-width:none;margin:0;padding:20px}#editor{position:static!important;overflow:visible!important}}
72975
+ </style>
72976
+ </head><body>${getLiveHTML()}</body></html>`;
72977
+ }
72140
72978
  init().catch((e2) => console.error("ColaMD init failed:", e2));
72141
72979
  export {
72142
72980
  commonDb_exports as $,
@@ -72264,7 +73102,6 @@ export {
72264
73102
  Symbol$1 as bs,
72265
73103
  isSymbol as bt,
72266
73104
  freeGlobal as bu,
72267
- __vitePreload as bv,
72268
73105
  getConfig2 as c,
72269
73106
  select as d,
72270
73107
  configureSvgSize as e,