markdown-flow-ui 0.2.14 → 0.2.16-dev.1

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 (465) hide show
  1. package/README.md +7 -0
  2. package/dist/assets/markdown-flow-ui.css +10 -1
  3. package/dist/components/ContentRender/CodeBlock.cjs +1 -1
  4. package/dist/components/ContentRender/CodeBlock.cjs.map +1 -1
  5. package/dist/components/ContentRender/CodeBlock.d.ts +5 -0
  6. package/dist/components/ContentRender/CodeBlock.es.js +41 -38
  7. package/dist/components/ContentRender/CodeBlock.es.js.map +1 -1
  8. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  9. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  10. package/dist/components/ContentRender/ContentRender.d.ts +12 -4
  11. package/dist/components/ContentRender/ContentRender.es.js +436 -306
  12. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  13. package/dist/components/ContentRender/IframeSandbox.cjs +7 -7
  14. package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
  15. package/dist/components/ContentRender/IframeSandbox.d.ts +5 -1
  16. package/dist/components/ContentRender/IframeSandbox.es.js +311 -266
  17. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  18. package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
  19. package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
  20. package/dist/components/ContentRender/MarkdownFlowInput.d.ts +5 -1
  21. package/dist/components/ContentRender/MarkdownFlowInput.es.js +37 -32
  22. package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
  23. package/dist/components/ContentRender/SandboxApp.cjs +2 -2
  24. package/dist/components/ContentRender/SandboxApp.cjs.map +1 -1
  25. package/dist/components/ContentRender/SandboxApp.d.ts +5 -1
  26. package/dist/components/ContentRender/SandboxApp.es.js +108 -103
  27. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  28. package/dist/components/ContentRender/blackboard-vendor.d.ts +1 -1
  29. package/dist/components/ContentRender/contentRenderI18n.cjs +1 -1
  30. package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
  31. package/dist/components/ContentRender/contentRenderI18n.d.ts +6 -1
  32. package/dist/components/ContentRender/contentRenderI18n.es.js +5 -56
  33. package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
  34. package/dist/components/ContentRender/contentRenderI18n.test.d.ts +1 -0
  35. package/dist/components/ContentRender/index.cjs +1 -1
  36. package/dist/components/ContentRender/index.d.ts +11 -11
  37. package/dist/components/ContentRender/index.es.js +1 -2
  38. package/dist/components/ContentRender/index.es.js.map +1 -1
  39. package/dist/components/ContentRender/locales/contentRender.json.cjs +2 -0
  40. package/dist/components/ContentRender/locales/contentRender.json.cjs.map +1 -0
  41. package/dist/components/ContentRender/locales/contentRender.json.d.ts +90 -0
  42. package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -0
  43. package/dist/components/ContentRender/locales/contentRender.json.es.js.map +1 -0
  44. package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
  45. package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
  46. package/dist/components/ContentRender/plugins/CustomVariable.d.ts +7 -3
  47. package/dist/components/ContentRender/plugins/CustomVariable.es.js +165 -151
  48. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  49. package/dist/components/ContentRender/plugins/MermaidChart.cjs +1 -1
  50. package/dist/components/ContentRender/plugins/MermaidChart.cjs.map +1 -1
  51. package/dist/components/ContentRender/plugins/MermaidChart.d.ts +1 -0
  52. package/dist/components/ContentRender/plugins/MermaidChart.es.js +68 -44
  53. package/dist/components/ContentRender/plugins/MermaidChart.es.js.map +1 -1
  54. package/dist/components/ContentRender/typewriterPacing.fixtures.d.ts +14 -0
  55. package/dist/components/ContentRender/utils/typewriter-pacing.cjs +3 -0
  56. package/dist/components/ContentRender/utils/typewriter-pacing.cjs.map +1 -0
  57. package/dist/components/ContentRender/utils/typewriter-pacing.d.ts +27 -0
  58. package/dist/components/ContentRender/utils/typewriter-pacing.es.js +98 -0
  59. package/dist/components/ContentRender/utils/typewriter-pacing.es.js.map +1 -0
  60. package/dist/components/ContentRender/utils/typewriter-pacing.test.d.ts +1 -0
  61. package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
  62. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
  63. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +12 -4
  64. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +51 -39
  65. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  66. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs +1 -1
  67. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
  68. package/dist/components/MarkdownFlow/ScrollToBottomButton.d.ts +31 -1
  69. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js +46 -17
  70. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
  71. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs +2 -0
  72. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -0
  73. package/dist/components/MarkdownFlow/ScrollToBottomControl.d.ts +18 -0
  74. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js +47 -0
  75. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -0
  76. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs +1 -1
  77. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs.map +1 -1
  78. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.d.ts +1 -1
  79. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js +33 -52
  80. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js.map +1 -1
  81. package/dist/components/MarkdownFlow/index.cjs +1 -1
  82. package/dist/components/MarkdownFlow/index.d.ts +9 -6
  83. package/dist/components/MarkdownFlow/index.es.js +6 -6
  84. package/dist/components/MarkdownFlow/index.es.js.map +1 -1
  85. package/dist/components/MarkdownFlow/useScrollToBottom.cjs +1 -1
  86. package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
  87. package/dist/components/MarkdownFlow/useScrollToBottom.d.ts +40 -8
  88. package/dist/components/MarkdownFlow/useScrollToBottom.es.js +352 -83
  89. package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
  90. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  91. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  92. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +5 -3
  93. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +371 -324
  94. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  95. package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs +1 -1
  96. package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs.map +1 -1
  97. package/dist/components/MarkdownFlowEditor/components/CustomDialog.d.ts +10 -0
  98. package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js +22 -19
  99. package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js.map +1 -1
  100. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +1 -1
  101. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +1 -1
  102. package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +8 -0
  103. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +19 -15
  104. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +1 -1
  105. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  106. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  107. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +4 -1
  108. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +99 -93
  109. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  110. package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs +1 -1
  111. package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs.map +1 -1
  112. package/dist/components/MarkdownFlowEditor/components/ImageInject.d.ts +1 -1
  113. package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js +183 -182
  114. package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js.map +1 -1
  115. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +1 -1
  116. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +1 -1
  117. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +1 -1
  118. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +107 -103
  119. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +1 -1
  120. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
  121. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
  122. package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +1 -1
  123. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +106 -106
  124. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
  125. package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs +1 -1
  126. package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs.map +1 -1
  127. package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js +64 -63
  128. package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js.map +1 -1
  129. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs +1 -1
  130. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs.map +1 -1
  131. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js +13 -13
  132. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js.map +1 -1
  133. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +1 -1
  134. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +1 -1
  135. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +12 -12
  136. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +1 -1
  137. package/dist/components/MarkdownFlowEditor/editor-context.d.ts +1 -1
  138. package/dist/components/MarkdownFlowEditor/editorI18n.cjs +1 -1
  139. package/dist/components/MarkdownFlowEditor/editorI18n.cjs.map +1 -1
  140. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +290 -0
  141. package/dist/components/MarkdownFlowEditor/editorI18n.es.js +12 -8
  142. package/dist/components/MarkdownFlowEditor/editorI18n.es.js.map +1 -1
  143. package/dist/components/MarkdownFlowEditor/editorI18n.test.d.ts +1 -0
  144. package/dist/components/MarkdownFlowEditor/index.d.ts +6 -6
  145. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +2 -0
  146. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs.map +1 -0
  147. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +72 -0
  148. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +140 -0
  149. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -0
  150. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  151. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +2 -0
  152. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +118 -114
  153. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  154. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  155. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +2 -0
  156. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +118 -114
  157. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  158. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +2 -0
  159. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs.map +1 -0
  160. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +72 -0
  161. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +140 -0
  162. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -0
  163. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  164. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +2 -0
  165. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +70 -66
  166. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  167. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
  168. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
  169. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +40 -35
  170. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
  171. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
  172. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
  173. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
  174. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +27 -23
  175. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
  176. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs +2 -0
  177. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs.map +1 -0
  178. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.d.ts +7 -0
  179. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js +12 -0
  180. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js.map +1 -0
  181. package/dist/components/MarkdownFlowEditor/utils.d.ts +1 -1
  182. package/dist/components/Slide/MarkdownSlideScaling.cjs +1 -1
  183. package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
  184. package/dist/components/Slide/MarkdownSlideScaling.d.ts +1 -1
  185. package/dist/components/Slide/MarkdownSlideScaling.es.js +20 -20
  186. package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
  187. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs +1 -1
  188. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.map +1 -1
  189. package/dist/components/Slide/MobilePlayerSettingsSheet.d.ts +7 -2
  190. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +61 -57
  191. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js.map +1 -1
  192. package/dist/components/Slide/Player.cjs +1 -1
  193. package/dist/components/Slide/Player.cjs.map +1 -1
  194. package/dist/components/Slide/Player.d.ts +6 -6
  195. package/dist/components/Slide/Player.es.js +547 -541
  196. package/dist/components/Slide/Player.es.js.map +1 -1
  197. package/dist/components/Slide/Slide.cjs +1 -1
  198. package/dist/components/Slide/Slide.cjs.map +1 -1
  199. package/dist/components/Slide/Slide.d.ts +14 -12
  200. package/dist/components/Slide/Slide.es.js +745 -726
  201. package/dist/components/Slide/Slide.es.js.map +1 -1
  202. package/dist/components/Slide/SubtitleOverlay.cjs +1 -1
  203. package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
  204. package/dist/components/Slide/SubtitleOverlay.d.ts +2 -2
  205. package/dist/components/Slide/SubtitleOverlay.es.js +17 -17
  206. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  207. package/dist/components/Slide/diff-utils.d.ts +1 -1
  208. package/dist/components/Slide/index.d.ts +12 -12
  209. package/dist/components/Slide/locales/slide.json.cjs +2 -0
  210. package/dist/components/Slide/locales/slide.json.cjs.map +1 -0
  211. package/dist/components/Slide/locales/slide.json.d.ts +205 -0
  212. package/dist/components/Slide/locales/slide.json.es.js +11 -0
  213. package/dist/components/Slide/locales/slide.json.es.js.map +1 -0
  214. package/dist/components/Slide/slideI18n.cjs +1 -1
  215. package/dist/components/Slide/slideI18n.cjs.map +1 -1
  216. package/dist/components/Slide/slideI18n.d.ts +6 -3
  217. package/dist/components/Slide/slideI18n.es.js +10 -155
  218. package/dist/components/Slide/slideI18n.es.js.map +1 -1
  219. package/dist/components/Slide/useSlide.d.ts +1 -1
  220. package/dist/components/Slide/utils/appendedMarkerAdvance.d.ts +1 -1
  221. package/dist/components/Slide/utils/audioSegments.d.ts +1 -1
  222. package/dist/components/Slide/utils/interactionResolution.d.ts +2 -2
  223. package/dist/components/Slide/utils/listenModeElementList.d.ts +2 -2
  224. package/dist/components/Slide/utils/markdownScaling.d.ts +1 -1
  225. package/dist/components/Slide/utils/playerCustomActions.d.ts +2 -2
  226. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
  227. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
  228. package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
  229. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +20 -20
  230. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
  231. package/dist/components/Slide/utils/runStreamFixture.d.ts +1 -1
  232. package/dist/components/Slide/utils/segmentSeek.d.ts +1 -1
  233. package/dist/components/Slide/utils/silentStepAutoAdvance.d.ts +1 -1
  234. package/dist/components/Slide/utils/streamingNavigation.d.ts +1 -1
  235. package/dist/components/Slide/utils/subtitleCue.d.ts +1 -1
  236. package/dist/components/Slide/utils/subtitleJumpNavigation.d.ts +1 -1
  237. package/dist/components/index.d.ts +22 -18
  238. package/dist/components/ui/button.cjs +1 -1
  239. package/dist/components/ui/button.cjs.map +1 -1
  240. package/dist/components/ui/button.es.js +12 -13
  241. package/dist/components/ui/button.es.js.map +1 -1
  242. package/dist/components/ui/checkbox.cjs +1 -1
  243. package/dist/components/ui/checkbox.cjs.map +1 -1
  244. package/dist/components/ui/checkbox.es.js +35 -35
  245. package/dist/components/ui/checkbox.es.js.map +1 -1
  246. package/dist/components/ui/dialog.cjs +1 -1
  247. package/dist/components/ui/dialog.cjs.map +1 -1
  248. package/dist/components/ui/dialog.d.ts +5 -1
  249. package/dist/components/ui/dialog.es.js +37 -37
  250. package/dist/components/ui/dialog.es.js.map +1 -1
  251. package/dist/components/ui/input.cjs +1 -1
  252. package/dist/components/ui/input.cjs.map +1 -1
  253. package/dist/components/ui/input.es.js +4 -4
  254. package/dist/components/ui/input.es.js.map +1 -1
  255. package/dist/components/ui/inputGroup/button.cjs +1 -1
  256. package/dist/components/ui/inputGroup/button.cjs.map +1 -1
  257. package/dist/components/ui/inputGroup/button.es.js +9 -10
  258. package/dist/components/ui/inputGroup/button.es.js.map +1 -1
  259. package/dist/components/ui/inputGroup/input-group.cjs +1 -1
  260. package/dist/components/ui/inputGroup/input-group.cjs.map +1 -1
  261. package/dist/components/ui/inputGroup/input-group.d.ts +1 -1
  262. package/dist/components/ui/inputGroup/input-group.es.js +10 -10
  263. package/dist/components/ui/inputGroup/input-group.es.js.map +1 -1
  264. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  265. package/dist/components/ui/inputGroup/textarea.cjs.map +1 -1
  266. package/dist/components/ui/inputGroup/textarea.es.js +2 -2
  267. package/dist/components/ui/inputGroup/textarea.es.js.map +1 -1
  268. package/dist/components/ui/loading-overlay-card.cjs +2 -2
  269. package/dist/components/ui/loading-overlay-card.cjs.map +1 -1
  270. package/dist/components/ui/loading-overlay-card.es.js +11 -11
  271. package/dist/components/ui/loading-overlay-card.es.js.map +1 -1
  272. package/dist/components/ui/popover.cjs +1 -1
  273. package/dist/components/ui/popover.cjs.map +1 -1
  274. package/dist/components/ui/popover.es.js +6 -6
  275. package/dist/components/ui/popover.es.js.map +1 -1
  276. package/dist/components/ui/tooltip.cjs +1 -1
  277. package/dist/components/ui/tooltip.cjs.map +1 -1
  278. package/dist/components/ui/tooltip.es.js +16 -16
  279. package/dist/components/ui/tooltip.es.js.map +1 -1
  280. package/dist/editor.d.ts +2 -2
  281. package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  282. package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  283. package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  284. package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  285. package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  286. package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  287. package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  288. package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  289. package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  290. package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  291. package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  292. package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  293. package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  294. package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  295. package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  296. package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  297. package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  298. package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  299. package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  300. package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  301. package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  302. package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  303. package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  304. package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  305. package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  306. package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  307. package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  308. package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  309. package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  310. package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  311. package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  312. package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  313. package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  314. package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  315. package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  316. package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  317. package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  318. package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  319. package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  320. package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  321. package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  322. package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  323. package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  324. package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  325. package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  326. package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  327. package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  328. package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  329. package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  330. package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  331. package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  332. package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  333. package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  334. package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  335. package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  336. package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  337. package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  338. package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  339. package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  340. package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  341. package/dist/index.cjs +1 -1
  342. package/dist/index.d.ts +2 -2
  343. package/dist/index.es.js +22 -19
  344. package/dist/index.es.js.map +1 -1
  345. package/dist/lib/locale.cjs +1 -1
  346. package/dist/lib/locale.cjs.map +1 -1
  347. package/dist/lib/locale.d.ts +5 -1
  348. package/dist/lib/locale.es.js +26 -13
  349. package/dist/lib/locale.es.js.map +1 -1
  350. package/dist/lib/locale.test.d.ts +1 -0
  351. package/dist/lib/useDetachedLanguage.cjs +2 -0
  352. package/dist/lib/useDetachedLanguage.cjs.map +1 -0
  353. package/dist/lib/useDetachedLanguage.d.ts +3 -0
  354. package/dist/lib/useDetachedLanguage.es.js +25 -0
  355. package/dist/lib/useDetachedLanguage.es.js.map +1 -0
  356. package/dist/lib/useResolvedDirection.cjs +2 -0
  357. package/dist/lib/useResolvedDirection.cjs.map +1 -0
  358. package/dist/lib/useResolvedDirection.d.ts +6 -0
  359. package/dist/lib/useResolvedDirection.es.js +37 -0
  360. package/dist/lib/useResolvedDirection.es.js.map +1 -0
  361. package/dist/markdown-flow-ui-lib.css +1 -1
  362. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
  363. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -1
  364. package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js +6 -6
  365. package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +1 -1
  366. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
  367. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  368. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +21 -21
  369. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
  370. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +2 -2
  371. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
  372. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +100 -100
  373. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
  374. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +1 -1
  375. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -1
  376. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +38 -38
  377. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -1
  378. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
  379. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  380. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +9 -9
  381. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
  382. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +1 -1
  383. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +1 -1
  384. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +95 -95
  385. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +1 -1
  386. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +1 -1
  387. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -1
  388. package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js +48 -48
  389. package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js.map +1 -1
  390. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs +1 -1
  391. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -1
  392. package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js +6 -6
  393. package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -1
  394. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
  395. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  396. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +9 -9
  397. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
  398. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
  399. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  400. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +17 -17
  401. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  402. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
  403. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
  404. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +100 -100
  405. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js.map +1 -1
  406. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
  407. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs.map +1 -1
  408. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js +6 -6
  409. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js.map +1 -1
  410. package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs +1 -1
  411. package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs.map +1 -1
  412. package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js +27 -27
  413. package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js.map +1 -1
  414. package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.cjs → chevrons-down.cjs} +2 -2
  415. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -0
  416. package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.es.js → chevrons-down.es.js} +6 -3
  417. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -0
  418. package/dist/node_modules/react-markdown/lib/index.cjs +1 -1
  419. package/dist/node_modules/react-markdown/lib/index.cjs.map +1 -1
  420. package/dist/node_modules/react-markdown/lib/index.es.js +39 -39
  421. package/dist/node_modules/react-markdown/lib/index.es.js.map +1 -1
  422. package/dist/renderer.cjs +1 -1
  423. package/dist/renderer.d.ts +18 -17
  424. package/dist/renderer.es.js +20 -17
  425. package/dist/renderer.es.js.map +1 -1
  426. package/dist/scroll.cjs +1 -1
  427. package/dist/scroll.d.ts +6 -3
  428. package/dist/scroll.es.js +4 -2
  429. package/dist/scroll.es.js.map +1 -1
  430. package/dist/slide.d.ts +3 -3
  431. package/package.json +5 -2
  432. package/dist/_virtual/jsx-runtime.cjs +0 -2
  433. package/dist/_virtual/jsx-runtime.cjs.map +0 -1
  434. package/dist/_virtual/jsx-runtime.es.js +0 -6
  435. package/dist/_virtual/jsx-runtime.es.js.map +0 -1
  436. package/dist/_virtual/jsx-runtime.es2.js +0 -5
  437. package/dist/_virtual/jsx-runtime.es2.js.map +0 -1
  438. package/dist/_virtual/jsx-runtime2.cjs +0 -2
  439. package/dist/_virtual/jsx-runtime2.cjs.map +0 -1
  440. package/dist/_virtual/react-jsx-runtime.development.cjs +0 -2
  441. package/dist/_virtual/react-jsx-runtime.development.cjs.map +0 -1
  442. package/dist/_virtual/react-jsx-runtime.development.es.js +0 -5
  443. package/dist/_virtual/react-jsx-runtime.development.es.js.map +0 -1
  444. package/dist/_virtual/react-jsx-runtime.production.cjs +0 -2
  445. package/dist/_virtual/react-jsx-runtime.production.cjs.map +0 -1
  446. package/dist/_virtual/react-jsx-runtime.production.es.js +0 -5
  447. package/dist/_virtual/react-jsx-runtime.production.es.js.map +0 -1
  448. package/dist/lib/localeTextMap.cjs +0 -2
  449. package/dist/lib/localeTextMap.cjs.map +0 -1
  450. package/dist/lib/localeTextMap.es.js +0 -5
  451. package/dist/lib/localeTextMap.es.js.map +0 -1
  452. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.map +0 -1
  453. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.es.js.map +0 -1
  454. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -24
  455. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.map +0 -1
  456. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js +0 -409
  457. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js.map +0 -1
  458. package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs +0 -10
  459. package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs.map +0 -1
  460. package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js +0 -36
  461. package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js.map +0 -1
  462. package/dist/node_modules/react/jsx-runtime.cjs +0 -2
  463. package/dist/node_modules/react/jsx-runtime.cjs.map +0 -1
  464. package/dist/node_modules/react/jsx-runtime.es.js +0 -11
  465. package/dist/node_modules/react/jsx-runtime.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxApp.cjs","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\nimport type { MarkdownFlowLocale } from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport type { ScalingWindow } from \"./utils/iframe-scaling\";\nimport {\n isAnchorElement,\n mergeAnchorRelValue,\n resolveClosestAnchor,\n shouldForceAnchorHrefToNewTab,\n} from \"./utils/link-targets\";\n\nexport interface SandboxAppProps {\n html: string;\n locale?: MarkdownFlowLocale;\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n enableScaling?: boolean;\n disableLoadingOverlay?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n syncImageAttributes(nextImage, preservedImage);\n nextImage.replaceWith(preservedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n locale,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n enableScaling = false,\n disableLoadingOverlay = false,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const [hasRenderedContent, setHasRenderedContent] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n /* Hide scroll UI without removing scroll semantics. Content roots with\n inline style=\"height:100vh; overflow-y:auto\" are the signal that\n IframeSandbox.getInnerScrollableHeight relies on to grow the iframe\n when content exceeds the viewport. We must not change overflow-y,\n but sub-pixel rounding (1px below the +1 detection threshold) can\n still surface a phantom scrollbar on content that visually fits.\n Hide the scrollbar UI globally; when content truly overflows the\n iframe is resized and no scrollbar would render anyway. */\n .sandbox-container *::-webkit-scrollbar { display: none; }\n .sandbox-container * { scrollbar-width: none; -ms-overflow-style: none; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n .overflow-y-auto { overflow-y: visible !important; }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n setHasRenderedContent(false);\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n wrapper.querySelectorAll(\"a[href]\").forEach((node) => {\n if (!isAnchorElement(node)) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(node.getAttribute(\"href\"))) {\n return;\n }\n\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", mergeAnchorRelValue(node.getAttribute(\"rel\")));\n });\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n const hasInitialContent = contentNodes.length > 0;\n setHasRenderedContent(hasInitialContent);\n container.replaceChildren(...contentNodes);\n\n const handleLinkClick = (event: MouseEvent) => {\n const anchor = resolveClosestAnchor(event.target);\n if (!anchor) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(anchor.getAttribute(\"href\"))) {\n return;\n }\n\n anchor.setAttribute(\"target\", \"_blank\");\n anchor.setAttribute(\n \"rel\",\n mergeAnchorRelValue(anchor.getAttribute(\"rel\"))\n );\n };\n container.addEventListener(\"click\", handleLinkClick, true);\n\n let scriptContentObserver: MutationObserver | null = null;\n const markRenderedContentFromContainer = () => {\n if (container.childNodes.length === 0) {\n return false;\n }\n\n setHasRenderedContent(true);\n scriptContentObserver?.disconnect();\n scriptContentObserver = null;\n return true;\n };\n if (!hasInitialContent && hasScripts && shouldExecuteScripts) {\n scriptContentObserver = new MutationObserver(() => {\n markRenderedContentFromContainer();\n });\n scriptContentObserver.observe(container, {\n childList: true,\n subtree: true,\n });\n }\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n markRenderedContentFromContainer();\n if (enableScaling) {\n const win = container.ownerDocument?.defaultView as ScalingWindow | null;\n win?.__mdf_triggerFitContent?.();\n }\n\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n\n return () => {\n scriptContentObserver?.disconnect();\n container.removeEventListener(\"click\", handleLinkClick, true);\n };\n }, [html, resetToken, enableScaling]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n }, [disableLoadingOverlay]);\n\n const overlayMessage = (() => {\n if (disableLoadingOverlay) {\n return null;\n }\n\n if (isGeneratingScripts || hasScriptsRef.current)\n return (\n scriptLoadingText || loadingText || localeTexts.sandboxScriptLoadingText\n );\n if (isGeneratingStyles || hasStylesRef.current)\n return (\n styleLoadingText || loadingText || localeTexts.sandboxStyleLoadingText\n );\n if (!hasRenderedContent)\n return loadingText || localeTexts.sandboxLoadingText;\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n zIndex: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n }}\n >\n <LoadingOverlayCard message={overlayMessage} />\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","reuseRenderedImages","nextImage","preservedImage","SandboxApp","html","locale","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","enableScaling","disableLoadingOverlay","localeTexts","getContentRenderLocaleTexts","containerRef","useRef","isGeneratingStyles","setIsGeneratingStyles","useState","isGeneratingScripts","setIsGeneratingScripts","hasRenderedContent","setHasRenderedContent","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","wrapper","isAnchorElement","shouldForceAnchorHrefToNewTab","mergeAnchorRelValue","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","contentNodes","hasInitialContent","handleLinkClick","event","anchor","resolveClosestAnchor","scriptContentObserver","markRenderedContentFromContainer","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","jsx","LoadingOverlayCard"],"mappings":"0SA0BMA,GAAyB,CAC7B,MACA,SACA,QACA,MACA,QACA,QACA,SACA,QACA,UACA,WACA,cACA,iBACA,eACF,EAEMC,EAAoBC,GACxBF,GAAuB,IACpBG,GAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,GAAK,EAAE,EACpE,EAAE,KAAK,GAAG,EAENC,GAAyBC,GAAqB,CAClD,MAAMC,MAAe,IACrB,OAAAD,EAAK,iBAAiB,KAAK,EAAE,QAASE,GAAS,CAC7C,MAAML,EAAQK,EACRC,EAAMP,EAAiBC,CAAK,EAC5BO,EAASH,EAAS,IAAIE,CAAG,GAAK,CAAA,EACpCC,EAAO,KAAKP,CAAK,EACjBI,EAAS,IAAIE,EAAKC,CAAM,CAC1B,CAAC,EACMH,CACT,EAEMI,GAAsB,CAC1BC,EACAC,IACG,CACH,MAAMC,EAAmB,MAAM,KAAKF,EAAY,UAAU,EACpDG,EAAuB,IAAI,IAC/BD,EAAiB,IAAKV,GAAcA,EAAU,IAAI,CAAA,EAGpD,MAAM,KAAKS,EAAY,UAAU,EAAE,QAAST,GAAc,CACnDW,EAA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O,OACP,OAAQ,OACR,QAAS,OACT,cAAe,SAEf,eAAgBD,EACZ,aACAD,EACE,eACA,YAAA,EAEFG,GAA6C,CACjD,cAAeJ,EAAiB,OAAS,OACzC,OAAQC,EAAe,OAAY,SACnC,MAAO,OACP,OAAQC,EAA0B,OAAS,OAC3C,UAAWA,EAA0B,EAAI,OACzC,KAAMA,EAA0B,WAAa,MAAA,EAG/C,OACEG,EAAAA,kBAAAA,KAAC,MAAA,CACC,eAAcpE,EAAkB,OAAS,QACzC,UAAU,kBACV,MAAOkE,GACP,YAAW,CAAC,CAACH,EAEb,SAAA,CAAAM,EAAAA,kBAAAA,IAAC,MAAA,CACC,IAAK/D,EACL,UAAU,oBACV,MAAO6D,EAAA,CAAA,EAERJ,GACCM,EAAAA,kBAAAA,IAAC,MAAA,CACC,MAAO,CACL,SAAU,WACV,MAAO,EACP,OAAQ,GACR,QAAS,OACT,WAAY,SACZ,eAAgB,SAChB,cAAe,MAAA,EAGjB,SAAAA,EAAAA,kBAAAA,IAACC,GAAAA,QAAA,CAAmB,QAASP,CAAA,CAAgB,CAAA,CAAA,CAC/C,CAAA,CAAA,CAIR"}
1
+ {"version":3,"file":"SandboxApp.cjs","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport type { ScalingWindow } from \"./utils/iframe-scaling\";\nimport {\n isAnchorElement,\n mergeAnchorRelValue,\n resolveClosestAnchor,\n shouldForceAnchorHrefToNewTab,\n} from \"./utils/link-targets\";\n\nexport interface SandboxAppProps {\n html: string;\n locale?: MarkdownFlowLocale;\n /** Overrides the wrapper language without changing authored HTML language. */\n lang?: string;\n /** Overrides the wrapper direction while preserving explicit direction in authored HTML. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n enableScaling?: boolean;\n disableLoadingOverlay?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n syncImageAttributes(nextImage, preservedImage);\n nextImage.replaceWith(preservedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n locale,\n dir,\n lang,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n enableScaling = false,\n disableLoadingOverlay = false,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const [hasRenderedContent, setHasRenderedContent] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n /* Hide scroll UI without removing scroll semantics. Content roots with\n inline style=\"height:100vh; overflow-y:auto\" are the signal that\n IframeSandbox.getInnerScrollableHeight relies on to grow the iframe\n when content exceeds the viewport. We must not change overflow-y,\n but sub-pixel rounding (1px below the +1 detection threshold) can\n still surface a phantom scrollbar on content that visually fits.\n Hide the scrollbar UI globally; when content truly overflows the\n iframe is resized and no scrollbar would render anyway. */\n .sandbox-container *::-webkit-scrollbar { display: none; }\n .sandbox-container * { scrollbar-width: none; -ms-overflow-style: none; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n .overflow-y-auto { overflow-y: visible !important; }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n setHasRenderedContent(false);\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n wrapper.querySelectorAll(\"a[href]\").forEach((node) => {\n if (!isAnchorElement(node)) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(node.getAttribute(\"href\"))) {\n return;\n }\n\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", mergeAnchorRelValue(node.getAttribute(\"rel\")));\n });\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n const hasInitialContent = contentNodes.length > 0;\n setHasRenderedContent(hasInitialContent);\n container.replaceChildren(...contentNodes);\n\n const handleLinkClick = (event: MouseEvent) => {\n const anchor = resolveClosestAnchor(event.target);\n if (!anchor) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(anchor.getAttribute(\"href\"))) {\n return;\n }\n\n anchor.setAttribute(\"target\", \"_blank\");\n anchor.setAttribute(\n \"rel\",\n mergeAnchorRelValue(anchor.getAttribute(\"rel\"))\n );\n };\n container.addEventListener(\"click\", handleLinkClick, true);\n\n let scriptContentObserver: MutationObserver | null = null;\n const markRenderedContentFromContainer = () => {\n if (container.childNodes.length === 0) {\n return false;\n }\n\n setHasRenderedContent(true);\n scriptContentObserver?.disconnect();\n scriptContentObserver = null;\n return true;\n };\n if (!hasInitialContent && hasScripts && shouldExecuteScripts) {\n scriptContentObserver = new MutationObserver(() => {\n markRenderedContentFromContainer();\n });\n scriptContentObserver.observe(container, {\n childList: true,\n subtree: true,\n });\n }\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n markRenderedContentFromContainer();\n if (enableScaling) {\n const win = container.ownerDocument?.defaultView as ScalingWindow | null;\n win?.__mdf_triggerFitContent?.();\n }\n\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n\n return () => {\n scriptContentObserver?.disconnect();\n container.removeEventListener(\"click\", handleLinkClick, true);\n };\n }, [html, resetToken, enableScaling]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n }, [disableLoadingOverlay]);\n\n const overlayMessage = (() => {\n if (disableLoadingOverlay) {\n return null;\n }\n\n if (isGeneratingScripts || hasScriptsRef.current)\n return (\n scriptLoadingText || loadingText || localeTexts.sandboxScriptLoadingText\n );\n if (isGeneratingStyles || hasStylesRef.current)\n return (\n styleLoadingText || loadingText || localeTexts.sandboxStyleLoadingText\n );\n if (!hasRenderedContent)\n return loadingText || localeTexts.sandboxLoadingText;\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n zIndex: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n }}\n >\n <LoadingOverlayCard message={overlayMessage} />\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","reuseRenderedImages","nextImage","preservedImage","SandboxApp","html","locale","dir","lang","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","enableScaling","disableLoadingOverlay","localeTexts","getContentRenderLocaleTexts","containerRef","useRef","isGeneratingStyles","setIsGeneratingStyles","useState","isGeneratingScripts","setIsGeneratingScripts","hasRenderedContent","setHasRenderedContent","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","wrapper","isAnchorElement","shouldForceAnchorHrefToNewTab","mergeAnchorRelValue","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","contentNodes","hasInitialContent","handleLinkClick","event","anchor","resolveClosestAnchor","scriptContentObserver","markRenderedContentFromContainer","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","getMarkdownFlowDirection","getMarkdownFlowLanguage","jsx","LoadingOverlayCard"],"mappings":"+TAkCMA,GAAyB,CAC7B,MACA,SACA,QACA,MACA,QACA,QACA,SACA,QACA,UACA,WACA,cACA,iBACA,eACF,EAEMC,EAAoBC,GACxBF,GAAuB,IACpBG,GAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,GAAK,EAAE,EACpE,EAAE,KAAK,GAAG,EAENC,GAAyBC,GAAqB,CAClD,MAAMC,MAAe,IACrB,OAAAD,EAAK,iBAAiB,KAAK,EAAE,QAASE,GAAS,CAC7C,MAAML,EAAQK,EACRC,EAAMP,EA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EACzBC,EAAa,QAAU,GACvBC,EAAc,QAAU,GACxBb,EAAsB,EAAK,EAC3BG,EAAuB,EAAK,EAC9B,EAAG,CAACT,CAAqB,CAAC,EAE1B,MAAM4D,EACA5D,EACK,KAGLQ,IAAuBW,EAAc,QAErCzB,GAAqBF,GAAeS,EAAY,yBAEhDI,IAAsBa,EAAa,QAEnCzB,GAAoBD,GAAeS,EAAY,wBAE9CS,GAEE,KADElB,GAAeS,EAAY,mBAIhC4D,EAAejE,IAAS,aACxBkE,EAA0BD,GAAgB/D,GAC1CiE,GAA2C,CAC/C,SAAU,WACV,MAAO,OACP,OAAQ,OACR,QAAS,OACT,cAAe,SAEf,eAAgBD,EACZ,aACAD,EACE,eACA,YAAA,EAEFG,GAA6C,CACjD,cAAeJ,EAAiB,OAAS,OACzC,OAAQC,EAAe,OAAY,SACnC,MAAO,OACP,OAAQC,EAA0B,OAAS,OAC3C,UAAWA,EAA0B,EAAI,OACzC,KAAMA,EAA0B,WAAa,MAAA,EAG/C,OACEG,EAAAA,KAAC,MAAA,CACC,eAAcpE,EAAkB,OAAS,QACzC,UAAU,kBACV,IAAKP,GAAO4E,EAAAA,yBAAyB7E,CAAM,EAC3C,KAAME,GAAQ4E,EAAAA,wBAAwB9E,CAAM,EAC5C,MAAO0E,GACP,YAAW,CAAC,CAACH,EAEb,SAAA,CAAAQ,EAAAA,IAAC,MAAA,CACC,IAAKjE,EACL,UAAU,oBACV,MAAO6D,EAAA,CAAA,EAERJ,GACCQ,EAAAA,IAAC,MAAA,CACC,MAAO,CACL,SAAU,WACV,MAAO,EACP,OAAQ,GACR,QAAS,OACT,WAAY,SACZ,eAAgB,SAChB,cAAe,MAAA,EAGjB,SAAAA,EAAAA,IAACC,GAAAA,QAAA,CAAmB,QAAST,CAAA,CAAgB,CAAA,CAAA,CAC/C,CAAA,CAAA,CAIR"}
@@ -1,8 +1,12 @@
1
1
  import { default as React } from 'react';
2
- import { MarkdownFlowLocale } from '../../lib/locale';
2
+ import { MarkdownFlowLocale } from '../../lib/locale.js';
3
3
  export interface SandboxAppProps {
4
4
  html: string;
5
5
  locale?: MarkdownFlowLocale;
6
+ /** Overrides the wrapper language without changing authored HTML language. */
7
+ lang?: string;
8
+ /** Overrides the wrapper direction while preserving explicit direction in authored HTML. */
9
+ dir?: React.HTMLAttributes<HTMLDivElement>["dir"];
6
10
  loadingText?: string;
7
11
  styleLoadingText?: string;
8
12
  scriptLoadingText?: string;
@@ -1,9 +1,10 @@
1
- import { j as R } from "../../_virtual/jsx-runtime.es.js";
2
- import { useRef as f, useState as q, useEffect as N } from "react";
3
- import ie from "../ui/loading-overlay-card.es.js";
4
- import { getContentRenderLocaleTexts as le } from "./contentRenderI18n.es.js";
5
- import { isAnchorElement as ue, shouldForceAnchorHrefToNewTab as P, mergeAnchorRelValue as X, resolveClosestAnchor as fe } from "./utils/link-targets.es.js";
6
- const de = [
1
+ import { jsxs as ue, jsx as G } from "react/jsx-runtime";
2
+ import { useRef as l, useState as q, useEffect as k } from "react";
3
+ import fe from "../ui/loading-overlay-card.es.js";
4
+ import { getMarkdownFlowLanguage as de, getMarkdownFlowDirection as he } from "../../lib/locale.es.js";
5
+ import { getContentRenderLocaleTexts as me } from "./contentRenderI18n.es.js";
6
+ import { isAnchorElement as pe, shouldForceAnchorHrefToNewTab as X, mergeAnchorRelValue as Y, resolveClosestAnchor as ge } from "./utils/link-targets.es.js";
7
+ const ye = [
7
8
  "src",
8
9
  "srcset",
9
10
  "sizes",
@@ -17,55 +18,57 @@ const de = [
17
18
  "crossorigin",
18
19
  "referrerpolicy",
19
20
  "fetchpriority"
20
- ], Y = (o) => de.map(
21
+ ], Z = (o) => ye.map(
21
22
  (n) => `${n}:${o.getAttribute(n) || ""}`
22
- ).join("|"), he = (o) => {
23
+ ).join("|"), be = (o) => {
23
24
  const n = /* @__PURE__ */ new Map();
24
- return o.querySelectorAll("img").forEach((i) => {
25
- const l = i, s = Y(l), a = n.get(s) || [];
26
- a.push(l), n.set(s, a);
25
+ return o.querySelectorAll("img").forEach((f) => {
26
+ const c = f, s = Z(c), d = n.get(s) || [];
27
+ d.push(c), n.set(s, d);
27
28
  }), n;
28
- }, me = (o, n) => {
29
- const i = Array.from(o.attributes), l = new Set(
30
- i.map((s) => s.name)
29
+ }, we = (o, n) => {
30
+ const f = Array.from(o.attributes), c = new Set(
31
+ f.map((s) => s.name)
31
32
  );
32
33
  Array.from(n.attributes).forEach((s) => {
33
- l.has(s.name) || n.removeAttribute(s.name);
34
- }), i.forEach((s) => {
34
+ c.has(s.name) || n.removeAttribute(s.name);
35
+ }), f.forEach((s) => {
35
36
  n.setAttribute(s.name, s.value);
36
37
  });
37
- }, pe = (o, n) => {
38
- n.size && o.querySelectorAll("img").forEach((i) => {
39
- const l = i, s = Y(l), a = n.get(s), p = a?.shift();
40
- p && (me(l, p), l.replaceWith(p), a && a.length === 0 && n.delete(s));
38
+ }, ve = (o, n) => {
39
+ n.size && o.querySelectorAll("img").forEach((f) => {
40
+ const c = f, s = Z(c), d = n.get(s), p = d?.shift();
41
+ p && (we(c, p), c.replaceWith(p), d && d.length === 0 && n.delete(s));
41
42
  });
42
- }, Ae = ({
43
+ }, ke = ({
43
44
  html: o,
44
45
  locale: n,
45
- loadingText: i,
46
- styleLoadingText: l,
47
- scriptLoadingText: s,
48
- resetToken: a = 0,
49
- mode: p = "content",
50
- hasRootVhHeight: Z = !1,
51
- stretchRootHeight: ee = !1,
52
- enableScaling: F = !1,
53
- disableLoadingOverlay: k = !1
46
+ dir: f,
47
+ lang: c,
48
+ loadingText: s,
49
+ styleLoadingText: d,
50
+ scriptLoadingText: p,
51
+ resetToken: A = 0,
52
+ mode: ee = "content",
53
+ hasRootVhHeight: te = !1,
54
+ stretchRootHeight: re = !1,
55
+ enableScaling: z = !1,
56
+ disableLoadingOverlay: L = !1
54
57
  }) => {
55
- const L = le(n), T = f(null), [te, A] = q(!1), [re, S] = q(!1), [ne, j] = q(!1), _ = f([]), H = f([]), z = f(0), U = f(0), y = f(null), g = f(null), b = f(!1), x = f(!1), V = f(a), se = 200, d = (t) => {
58
+ const N = me(n), T = l(null), [ne, S] = q(!1), [se, C] = q(!1), [oe, M] = q(!1), _ = l([]), H = l([]), U = l(0), V = l(0), g = l(null), y = l(null), b = l(!1), w = l(!1), W = l(A), ae = 200, u = (t) => {
56
59
  t.current && (clearTimeout(t.current), t.current = null);
57
- }, W = (t, c, u, D) => {
58
- const h = performance.now() - u.current, I = Math.max(0, se - h);
59
- d(c), c.current = window.setTimeout(() => {
60
- t(!1), D?.(), c.current = null;
61
- }, I);
60
+ }, B = (t, a, i, D) => {
61
+ const h = performance.now() - i.current, R = Math.max(0, ae - h);
62
+ u(a), a.current = window.setTimeout(() => {
63
+ t(!1), D?.(), a.current = null;
64
+ }, R);
62
65
  };
63
- N(() => {
66
+ k(() => {
64
67
  const t = T.current?.ownerDocument;
65
68
  if (!t) return;
66
- const c = "sandbox-spinner-style";
67
- let u = t.getElementById(c);
68
- u || (u = t.createElement("style"), u.id = c, t.head?.appendChild(u)), u.textContent = `
69
+ const a = "sandbox-spinner-style";
70
+ let i = t.getElementById(a);
71
+ i || (i = t.createElement("style"), i.id = a, t.head?.appendChild(i)), i.textContent = `
69
72
  .sandbox-wrapper { align-items: center; }
70
73
  .sandbox-container { position: relative; width: 100%; }
71
74
  .sandbox-container svg,
@@ -85,62 +88,62 @@ const de = [
85
88
  }
86
89
  .overflow-y-auto { overflow-y: visible !important; }
87
90
  `;
88
- }, []), N(() => {
89
- a !== V.current && (j(!1), V.current = a), d(y), d(g), b.current = !1, x.current = !1;
91
+ }, []), k(() => {
92
+ A !== W.current && (M(!1), W.current = A), u(g), u(y), b.current = !1, w.current = !1;
90
93
  const t = T.current;
91
94
  if (!t) return;
92
- const c = t.ownerDocument, u = c?.body;
93
- if (!u) return;
94
- const D = he(t);
95
- _.current.forEach((e) => e.remove()), _.current = [], H.current.forEach((e) => e.remove()), H.current = [], A(!1), S(!1);
96
- const h = c.createElement("div");
95
+ const a = t.ownerDocument, i = a?.body;
96
+ if (!i) return;
97
+ const D = be(t);
98
+ _.current.forEach((e) => e.remove()), _.current = [], H.current.forEach((e) => e.remove()), H.current = [], S(!1), C(!1);
99
+ const h = a.createElement("div");
97
100
  h.innerHTML = o, h.querySelectorAll("a[href]").forEach((e) => {
98
- ue(e) && P(e.getAttribute("href")) && (e.setAttribute("target", "_blank"), e.setAttribute("rel", X(e.getAttribute("rel"))));
101
+ pe(e) && X(e.getAttribute("href")) && (e.setAttribute("target", "_blank"), e.setAttribute("rel", Y(e.getAttribute("rel"))));
99
102
  });
100
- const I = (o.match(/<script[\s>]/gi) || []).length, ae = (o.match(/<\/script>/gi) || []).length, B = I > 0 && I === ae, v = [];
103
+ const R = (o.match(/<script[\s>]/gi) || []).length, le = (o.match(/<\/script>/gi) || []).length, O = R > 0 && R === le, v = [];
101
104
  Array.from(h.querySelectorAll("style, script")).forEach((e) => {
102
105
  if (e.tagName.toLowerCase() === "style") {
103
- const r = c.createElement("style");
106
+ const r = a.createElement("style");
104
107
  r.textContent = e.textContent || "", Array.from(e.attributes).forEach((m) => {
105
108
  r.setAttribute(m.name, m.value);
106
109
  }), v.push(r);
107
110
  } else {
108
- const r = c.createElement("script");
111
+ const r = a.createElement("script");
109
112
  Array.from(e.attributes).forEach((m) => {
110
113
  r.setAttribute(m.name, m.value);
111
114
  }), r.textContent = e.textContent || "", v.push(r);
112
115
  }
113
116
  e.remove();
114
- }), pe(h, D);
115
- const O = v.some(
117
+ }), ve(h, D);
118
+ const $ = v.some(
116
119
  (e) => e.tagName.toLowerCase() === "style"
117
- ), G = v.some(
120
+ ), F = v.some(
118
121
  (e) => e.tagName.toLowerCase() === "script"
119
122
  );
120
- O && (b.current = !0, z.current = performance.now(), d(y), A(!0)), G && (x.current = !0, U.current = performance.now(), d(g), S(!0));
121
- const $ = Array.from(h.childNodes), K = $.length > 0;
122
- j(K), t.replaceChildren(...$);
123
- const Q = (e) => {
124
- const r = fe(e.target);
125
- r && P(r.getAttribute("href")) && (r.setAttribute("target", "_blank"), r.setAttribute(
123
+ $ && (b.current = !0, U.current = performance.now(), u(g), S(!0)), F && (w.current = !0, V.current = performance.now(), u(y), C(!0));
124
+ const K = Array.from(h.childNodes), Q = K.length > 0;
125
+ M(Q), t.replaceChildren(...K);
126
+ const J = (e) => {
127
+ const r = ge(e.target);
128
+ r && X(r.getAttribute("href")) && (r.setAttribute("target", "_blank"), r.setAttribute(
126
129
  "rel",
127
- X(r.getAttribute("rel"))
130
+ Y(r.getAttribute("rel"))
128
131
  ));
129
132
  };
130
- t.addEventListener("click", Q, !0);
131
- let w = null;
132
- const J = () => t.childNodes.length === 0 ? !1 : (j(!0), w?.disconnect(), w = null, !0);
133
- return !K && G && B && (w = new MutationObserver(() => {
134
- J();
135
- }), w.observe(t, {
133
+ t.addEventListener("click", J, !0);
134
+ let x = null;
135
+ const P = () => t.childNodes.length === 0 ? !1 : (M(!0), x?.disconnect(), x = null, !0);
136
+ return !Q && F && O && (x = new MutationObserver(() => {
137
+ P();
138
+ }), x.observe(t, {
136
139
  childList: !0,
137
140
  subtree: !0
138
141
  })), v.forEach((e) => {
139
142
  if (e.tagName.toLowerCase() === "style") {
140
- c.head?.appendChild(e), _.current.push(e);
143
+ a.head?.appendChild(e), _.current.push(e);
141
144
  return;
142
145
  }
143
- if (B) {
146
+ if (O) {
144
147
  const r = e, m = r.textContent || "";
145
148
  if (!r.src)
146
149
  try {
@@ -150,72 +153,74 @@ const de = [
150
153
  return;
151
154
  }
152
155
  try {
153
- u.appendChild(r), H.current.push(r);
156
+ i.appendChild(r), H.current.push(r);
154
157
  } catch {
155
158
  r.remove();
156
159
  }
157
160
  } else
158
161
  e.remove();
159
- }), J(), F && t.ownerDocument?.defaultView?.__mdf_triggerFitContent?.(), requestAnimationFrame(() => {
160
- O && W(
161
- A,
162
- y,
163
- z,
164
- () => {
165
- b.current = !1;
166
- }
167
- ), G && W(
162
+ }), P(), z && t.ownerDocument?.defaultView?.__mdf_triggerFitContent?.(), requestAnimationFrame(() => {
163
+ $ && B(
168
164
  S,
169
165
  g,
170
166
  U,
171
167
  () => {
172
- x.current = !1;
168
+ b.current = !1;
169
+ }
170
+ ), F && B(
171
+ C,
172
+ y,
173
+ V,
174
+ () => {
175
+ w.current = !1;
173
176
  }
174
177
  );
175
178
  }), () => {
176
- w?.disconnect(), t.removeEventListener("click", Q, !0);
179
+ x?.disconnect(), t.removeEventListener("click", J, !0);
177
180
  };
178
- }, [o, a, F]), N(
181
+ }, [o, A, z]), k(
179
182
  () => () => {
180
- d(y), d(g);
183
+ u(g), u(y);
181
184
  },
182
185
  []
183
- ), N(() => {
184
- k && (d(y), d(g), b.current = !1, x.current = !1, A(!1), S(!1));
185
- }, [k]);
186
- const C = k ? null : re || x.current ? s || i || L.sandboxScriptLoadingText : te || b.current ? l || i || L.sandboxStyleLoadingText : ne ? null : i || L.sandboxLoadingText, M = p === "blackboard", E = M && ee, oe = {
186
+ ), k(() => {
187
+ L && (u(g), u(y), b.current = !1, w.current = !1, S(!1), C(!1));
188
+ }, [L]);
189
+ const E = L ? null : se || w.current ? p || s || N.sandboxScriptLoadingText : ne || b.current ? d || s || N.sandboxStyleLoadingText : oe ? null : s || N.sandboxLoadingText, j = ee === "blackboard", I = j && re, ce = {
187
190
  position: "relative",
188
191
  width: "100%",
189
192
  height: "100%",
190
193
  display: "flex",
191
194
  flexDirection: "column",
192
195
  // Keep blackboard scroll behavior while centering content in non-blackboard mode
193
- justifyContent: E ? "flex-start" : M ? "space-around" : "flex-start"
194
- }, ce = {
195
- pointerEvents: C ? "none" : void 0,
196
- margin: M ? void 0 : "auto 0",
196
+ justifyContent: I ? "flex-start" : j ? "space-around" : "flex-start"
197
+ }, ie = {
198
+ pointerEvents: E ? "none" : void 0,
199
+ margin: j ? void 0 : "auto 0",
197
200
  width: "100%",
198
- height: E ? "100%" : void 0,
199
- minHeight: E ? 0 : void 0,
200
- flex: E ? "1 1 auto" : void 0
201
+ height: I ? "100%" : void 0,
202
+ minHeight: I ? 0 : void 0,
203
+ flex: I ? "1 1 auto" : void 0
201
204
  };
202
- return /* @__PURE__ */ R.jsxs(
205
+ return /* @__PURE__ */ ue(
203
206
  "div",
204
207
  {
205
- "data-root-vh": Z ? "true" : "false",
208
+ "data-root-vh": te ? "true" : "false",
206
209
  className: "sandbox-wrapper",
207
- style: oe,
208
- "aria-busy": !!C,
210
+ dir: f ?? he(n),
211
+ lang: c ?? de(n),
212
+ style: ce,
213
+ "aria-busy": !!E,
209
214
  children: [
210
- /* @__PURE__ */ R.jsx(
215
+ /* @__PURE__ */ G(
211
216
  "div",
212
217
  {
213
218
  ref: T,
214
219
  className: "sandbox-container",
215
- style: ce
220
+ style: ie
216
221
  }
217
222
  ),
218
- C && /* @__PURE__ */ R.jsx(
223
+ E && /* @__PURE__ */ G(
219
224
  "div",
220
225
  {
221
226
  style: {
@@ -227,7 +232,7 @@ const de = [
227
232
  justifyContent: "center",
228
233
  pointerEvents: "none"
229
234
  },
230
- children: /* @__PURE__ */ R.jsx(ie, { message: C })
235
+ children: /* @__PURE__ */ G(fe, { message: E })
231
236
  }
232
237
  )
233
238
  ]
@@ -235,6 +240,6 @@ const de = [
235
240
  );
236
241
  };
237
242
  export {
238
- Ae as default
243
+ ke as default
239
244
  };
240
245
  //# sourceMappingURL=SandboxApp.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxApp.es.js","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\nimport type { MarkdownFlowLocale } from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport type { ScalingWindow } from \"./utils/iframe-scaling\";\nimport {\n isAnchorElement,\n mergeAnchorRelValue,\n resolveClosestAnchor,\n shouldForceAnchorHrefToNewTab,\n} from \"./utils/link-targets\";\n\nexport interface SandboxAppProps {\n html: string;\n locale?: MarkdownFlowLocale;\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n enableScaling?: boolean;\n disableLoadingOverlay?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n syncImageAttributes(nextImage, preservedImage);\n nextImage.replaceWith(preservedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n locale,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n enableScaling = false,\n disableLoadingOverlay = false,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const [hasRenderedContent, setHasRenderedContent] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n /* Hide scroll UI without removing scroll semantics. Content roots with\n inline style=\"height:100vh; overflow-y:auto\" are the signal that\n IframeSandbox.getInnerScrollableHeight relies on to grow the iframe\n when content exceeds the viewport. We must not change overflow-y,\n but sub-pixel rounding (1px below the +1 detection threshold) can\n still surface a phantom scrollbar on content that visually fits.\n Hide the scrollbar UI globally; when content truly overflows the\n iframe is resized and no scrollbar would render anyway. */\n .sandbox-container *::-webkit-scrollbar { display: none; }\n .sandbox-container * { scrollbar-width: none; -ms-overflow-style: none; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n .overflow-y-auto { overflow-y: visible !important; }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n setHasRenderedContent(false);\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n wrapper.querySelectorAll(\"a[href]\").forEach((node) => {\n if (!isAnchorElement(node)) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(node.getAttribute(\"href\"))) {\n return;\n }\n\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", mergeAnchorRelValue(node.getAttribute(\"rel\")));\n });\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n const hasInitialContent = contentNodes.length > 0;\n setHasRenderedContent(hasInitialContent);\n container.replaceChildren(...contentNodes);\n\n const handleLinkClick = (event: MouseEvent) => {\n const anchor = resolveClosestAnchor(event.target);\n if (!anchor) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(anchor.getAttribute(\"href\"))) {\n return;\n }\n\n anchor.setAttribute(\"target\", \"_blank\");\n anchor.setAttribute(\n \"rel\",\n mergeAnchorRelValue(anchor.getAttribute(\"rel\"))\n );\n };\n container.addEventListener(\"click\", handleLinkClick, true);\n\n let scriptContentObserver: MutationObserver | null = null;\n const markRenderedContentFromContainer = () => {\n if (container.childNodes.length === 0) {\n return false;\n }\n\n setHasRenderedContent(true);\n scriptContentObserver?.disconnect();\n scriptContentObserver = null;\n return true;\n };\n if (!hasInitialContent && hasScripts && shouldExecuteScripts) {\n scriptContentObserver = new MutationObserver(() => {\n markRenderedContentFromContainer();\n });\n scriptContentObserver.observe(container, {\n childList: true,\n subtree: true,\n });\n }\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n markRenderedContentFromContainer();\n if (enableScaling) {\n const win = container.ownerDocument?.defaultView as ScalingWindow | null;\n win?.__mdf_triggerFitContent?.();\n }\n\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n\n return () => {\n scriptContentObserver?.disconnect();\n container.removeEventListener(\"click\", handleLinkClick, true);\n };\n }, [html, resetToken, enableScaling]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n }, [disableLoadingOverlay]);\n\n const overlayMessage = (() => {\n if (disableLoadingOverlay) {\n return null;\n }\n\n if (isGeneratingScripts || hasScriptsRef.current)\n return (\n scriptLoadingText || loadingText || localeTexts.sandboxScriptLoadingText\n );\n if (isGeneratingStyles || hasStylesRef.current)\n return (\n styleLoadingText || loadingText || localeTexts.sandboxStyleLoadingText\n );\n if (!hasRenderedContent)\n return loadingText || localeTexts.sandboxLoadingText;\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n zIndex: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n }}\n >\n <LoadingOverlayCard message={overlayMessage} />\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","reuseRenderedImages","nextImage","preservedImage","SandboxApp","html","locale","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","enableScaling","disableLoadingOverlay","localeTexts","getContentRenderLocaleTexts","containerRef","useRef","isGeneratingStyles","setIsGeneratingStyles","useState","isGeneratingScripts","setIsGeneratingScripts","hasRenderedContent","setHasRenderedContent","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","wrapper","isAnchorElement","shouldForceAnchorHrefToNewTab","mergeAnchorRelValue","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","contentNodes","hasInitialContent","handleLinkClick","event","anchor","resolveClosestAnchor","scriptContentObserver","markRenderedContentFromContainer","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","jsx","LoadingOverlayCard"],"mappings":";;;;;AA0BA,MAAMA,KAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,GAAuB;AAAA,EACrB,CAACG,MAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,KAAK,EAAE;AACpE,EAAE,KAAK,GAAG,GAENC,KAAwB,CAACC,MAAqB;AAClD,QAAMC,wBAAe,IAAA;AACrB,SAAAD,EAAK,iBAAiB,KAAK,EAAE,QAAQ,CAACE,MAAS;AAC7C,UAAML,IAAQK,GACRC,IAAMP,EAAiBC,CAAK,GAC5BO,IAASH,EAAS,IAAIE,CAAG,KAAK,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,IAAkB,SAAS;AAAA,MACzC,WAAU;AAAA,MACV,OAAOkE;AAAA,MACP,aAAW,CAAC,CAACH;AAAA,MAEb,UAAA;AAAA,QAAAM,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAK/D;AAAA,YACL,WAAU;AAAA,YACV,OAAO6D;AAAA,UAAA;AAAA,QAAA;AAAA,QAERJ,KACCM,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,UAAU;AAAA,cACV,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,gBAAgB;AAAA,cAChB,eAAe;AAAA,YAAA;AAAA,YAGjB,UAAAA,gBAAAA,EAAAA,IAACC,IAAA,EAAmB,SAASP,EAAA,CAAgB;AAAA,UAAA;AAAA,QAAA;AAAA,MAC/C;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"SandboxApp.es.js","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport LoadingOverlayCard from \"../ui/loading-overlay-card\";\nimport {\n getMarkdownFlowDirection,\n getMarkdownFlowLanguage,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport { getContentRenderLocaleTexts } from \"./contentRenderI18n\";\nimport type { ScalingWindow } from \"./utils/iframe-scaling\";\nimport {\n isAnchorElement,\n mergeAnchorRelValue,\n resolveClosestAnchor,\n shouldForceAnchorHrefToNewTab,\n} from \"./utils/link-targets\";\n\nexport interface SandboxAppProps {\n html: string;\n locale?: MarkdownFlowLocale;\n /** Overrides the wrapper language without changing authored HTML language. */\n lang?: string;\n /** Overrides the wrapper direction while preserving explicit direction in authored HTML. */\n dir?: React.HTMLAttributes<HTMLDivElement>[\"dir\"];\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n enableScaling?: boolean;\n disableLoadingOverlay?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n syncImageAttributes(nextImage, preservedImage);\n nextImage.replaceWith(preservedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n locale,\n dir,\n lang,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n enableScaling = false,\n disableLoadingOverlay = false,\n}) => {\n const localeTexts = getContentRenderLocaleTexts(locale);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const [hasRenderedContent, setHasRenderedContent] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n /* Hide scroll UI without removing scroll semantics. Content roots with\n inline style=\"height:100vh; overflow-y:auto\" are the signal that\n IframeSandbox.getInnerScrollableHeight relies on to grow the iframe\n when content exceeds the viewport. We must not change overflow-y,\n but sub-pixel rounding (1px below the +1 detection threshold) can\n still surface a phantom scrollbar on content that visually fits.\n Hide the scrollbar UI globally; when content truly overflows the\n iframe is resized and no scrollbar would render anyway. */\n .sandbox-container *::-webkit-scrollbar { display: none; }\n .sandbox-container * { scrollbar-width: none; -ms-overflow-style: none; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n .overflow-y-auto { overflow-y: visible !important; }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n setHasRenderedContent(false);\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n wrapper.querySelectorAll(\"a[href]\").forEach((node) => {\n if (!isAnchorElement(node)) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(node.getAttribute(\"href\"))) {\n return;\n }\n\n node.setAttribute(\"target\", \"_blank\");\n node.setAttribute(\"rel\", mergeAnchorRelValue(node.getAttribute(\"rel\")));\n });\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n const hasInitialContent = contentNodes.length > 0;\n setHasRenderedContent(hasInitialContent);\n container.replaceChildren(...contentNodes);\n\n const handleLinkClick = (event: MouseEvent) => {\n const anchor = resolveClosestAnchor(event.target);\n if (!anchor) {\n return;\n }\n\n if (!shouldForceAnchorHrefToNewTab(anchor.getAttribute(\"href\"))) {\n return;\n }\n\n anchor.setAttribute(\"target\", \"_blank\");\n anchor.setAttribute(\n \"rel\",\n mergeAnchorRelValue(anchor.getAttribute(\"rel\"))\n );\n };\n container.addEventListener(\"click\", handleLinkClick, true);\n\n let scriptContentObserver: MutationObserver | null = null;\n const markRenderedContentFromContainer = () => {\n if (container.childNodes.length === 0) {\n return false;\n }\n\n setHasRenderedContent(true);\n scriptContentObserver?.disconnect();\n scriptContentObserver = null;\n return true;\n };\n if (!hasInitialContent && hasScripts && shouldExecuteScripts) {\n scriptContentObserver = new MutationObserver(() => {\n markRenderedContentFromContainer();\n });\n scriptContentObserver.observe(container, {\n childList: true,\n subtree: true,\n });\n }\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n markRenderedContentFromContainer();\n if (enableScaling) {\n const win = container.ownerDocument?.defaultView as ScalingWindow | null;\n win?.__mdf_triggerFitContent?.();\n }\n\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n\n return () => {\n scriptContentObserver?.disconnect();\n container.removeEventListener(\"click\", handleLinkClick, true);\n };\n }, [html, resetToken, enableScaling]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n useEffect(() => {\n if (!disableLoadingOverlay) {\n return;\n }\n\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n }, [disableLoadingOverlay]);\n\n const overlayMessage = (() => {\n if (disableLoadingOverlay) {\n return null;\n }\n\n if (isGeneratingScripts || hasScriptsRef.current)\n return (\n scriptLoadingText || loadingText || localeTexts.sandboxScriptLoadingText\n );\n if (isGeneratingStyles || hasStylesRef.current)\n return (\n styleLoadingText || loadingText || localeTexts.sandboxStyleLoadingText\n );\n if (!hasRenderedContent)\n return loadingText || localeTexts.sandboxLoadingText;\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n dir={dir ?? getMarkdownFlowDirection(locale)}\n lang={lang ?? getMarkdownFlowLanguage(locale)}\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n zIndex: 20,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pointerEvents: \"none\",\n }}\n >\n <LoadingOverlayCard message={overlayMessage} />\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","reuseRenderedImages","nextImage","preservedImage","SandboxApp","html","locale","dir","lang","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","enableScaling","disableLoadingOverlay","localeTexts","getContentRenderLocaleTexts","containerRef","useRef","isGeneratingStyles","setIsGeneratingStyles","useState","isGeneratingScripts","setIsGeneratingScripts","hasRenderedContent","setHasRenderedContent","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","wrapper","isAnchorElement","shouldForceAnchorHrefToNewTab","mergeAnchorRelValue","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","contentNodes","hasInitialContent","handleLinkClick","event","anchor","resolveClosestAnchor","scriptContentObserver","markRenderedContentFromContainer","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","getMarkdownFlowDirection","getMarkdownFlowLanguage","jsx","LoadingOverlayCard"],"mappings":";;;;;;AAkCA,MAAMA,KAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,GAAuB;AAAA,EACrB,CAACG,MAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,KAAK,EAAE;AACpE,EAAE,KAAK,GAAG,GAENC,KAAwB,CAACC,MAAqB;AAClD,QAAMC,wBAAe,IAAA;AACrB,SAAAD,EAAK,iBAAiB,KAAK,EAAE,QAAQ,CAACE,MAAS;AAC7C,UAAML,IAAQK,GACRC,IAAMP,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AAa;AAAA,EAAA;AAG/C,SACE,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,gBAAcpE,KAAkB,SAAS;AAAA,MACzC,WAAU;AAAA,MACV,KAAKP,KAAO4E,GAAyB7E,CAAM;AAAA,MAC3C,MAAME,KAAQ4E,GAAwB9E,CAAM;AAAA,MAC5C,OAAO0E;AAAA,MACP,aAAW,CAAC,CAACH;AAAA,MAEb,UAAA;AAAA,QAAA,gBAAAQ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKjE;AAAA,YACL,WAAU;AAAA,YACV,OAAO6D;AAAA,UAAA;AAAA,QAAA;AAAA,QAERJ,KACC,gBAAAQ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,UAAU;AAAA,cACV,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,gBAAgB;AAAA,cAChB,eAAe;AAAA,YAAA;AAAA,YAGjB,UAAA,gBAAAA,EAACC,IAAA,EAAmB,SAAST,EAAA,CAAgB;AAAA,UAAA;AAAA,QAAA;AAAA,MAC/C;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,4 +1,4 @@
1
- import { refreshTailwindRuntime } from './utils/tailwind-runtime';
1
+ import { refreshTailwindRuntime } from './utils/tailwind-runtime.js';
2
2
  export { refreshTailwindRuntime };
3
3
  /**
4
4
  * Inject blackboard-mode libraries (Tailwind CSS, DaisyUI, GSAP)
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../lib/locale.cjs"),l=require("../../lib/localeTextMap.cjs"),c=["confirmButtonText","copyButtonText","copiedButtonText","sandboxLoadingText","sandboxStyleLoadingText","sandboxScriptLoadingText","sandboxFullscreenButtonText","sandboxExitFullscreenButtonText","sendButtonLabel","scrollToBottomLabel"],t=e=>l.buildLocaleTexts(c,e),n={"en-US":t(["Submit","Copy","Copied","Loading content...","Building styles...","Building scripts cache...","Fullscreen","Exit fullscreen","Send","Scroll to bottom"]),"fr-FR":t(["Soumettre","Copier","Copié","Chargement du contenu...","Génération des styles...","Génération du cache des scripts...","Plein écran","Quitter le plein écran","Envoyer","Faire défiler jusqu'en bas"]),"zh-CN":t(["提交","复制","已复制","正在加载内容...","正在生成样式...","正在生成脚本缓存...","全屏浏览","退出全屏","发送","滚动到底部"])},r=e=>n[o.normalizeMarkdownFlowLocale(e)];exports.CONTENT_RENDER_LOCALE_TEXTS=n;exports.getContentRenderLocaleTexts=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../lib/locale.cjs"),n=require("./locales/contentRender.json.cjs"),e=n.default,r=t=>e[o.normalizeMarkdownFlowLocale(t)];exports.CONTENT_RENDER_LOCALE_TEXTS=e;exports.getContentRenderLocaleTexts=r;
2
2
  //# sourceMappingURL=contentRenderI18n.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contentRenderI18n.cjs","sources":["../../../src/components/ContentRender/contentRenderI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport {\n buildLocaleTexts,\n type LocaleTextValues,\n} from \"../../lib/localeTextMap\";\n\nexport interface ContentRenderLocaleTexts {\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n sandboxLoadingText: string;\n sandboxStyleLoadingText: string;\n sandboxScriptLoadingText: string;\n sandboxFullscreenButtonText: string;\n sandboxExitFullscreenButtonText: string;\n sendButtonLabel: string;\n scrollToBottomLabel: string;\n}\n\nconst CONTENT_RENDER_TEXT_KEYS = [\n \"confirmButtonText\",\n \"copyButtonText\",\n \"copiedButtonText\",\n \"sandboxLoadingText\",\n \"sandboxStyleLoadingText\",\n \"sandboxScriptLoadingText\",\n \"sandboxFullscreenButtonText\",\n \"sandboxExitFullscreenButtonText\",\n \"sendButtonLabel\",\n \"scrollToBottomLabel\",\n] as const satisfies readonly (keyof ContentRenderLocaleTexts)[];\n\nconst createContentRenderLocaleTexts = (\n values: LocaleTextValues<typeof CONTENT_RENDER_TEXT_KEYS>\n): ContentRenderLocaleTexts =>\n buildLocaleTexts(\n CONTENT_RENDER_TEXT_KEYS,\n values\n ) as ContentRenderLocaleTexts;\n\nexport const CONTENT_RENDER_LOCALE_TEXTS: Record<\n MarkdownFlowLocale,\n ContentRenderLocaleTexts\n> = {\n \"en-US\": createContentRenderLocaleTexts([\n \"Submit\",\n \"Copy\",\n \"Copied\",\n \"Loading content...\",\n \"Building styles...\",\n \"Building scripts cache...\",\n \"Fullscreen\",\n \"Exit fullscreen\",\n \"Send\",\n \"Scroll to bottom\",\n ]),\n \"fr-FR\": createContentRenderLocaleTexts([\n \"Soumettre\",\n \"Copier\",\n \"Copié\",\n \"Chargement du contenu...\",\n \"Génération des styles...\",\n \"Génération du cache des scripts...\",\n \"Plein écran\",\n \"Quitter le plein écran\",\n \"Envoyer\",\n \"Faire défiler jusqu'en bas\",\n ]),\n \"zh-CN\": createContentRenderLocaleTexts([\n \"提交\",\n \"复制\",\n \"已复制\",\n \"正在加载内容...\",\n \"正在生成样式...\",\n \"正在生成脚本缓存...\",\n \"全屏浏览\",\n \"退出全屏\",\n \"发送\",\n \"滚动到底部\",\n ]),\n};\n\nexport const getContentRenderLocaleTexts = (\n locale?: string | null\n): ContentRenderLocaleTexts =>\n CONTENT_RENDER_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n"],"names":["CONTENT_RENDER_TEXT_KEYS","createContentRenderLocaleTexts","values","buildLocaleTexts","CONTENT_RENDER_LOCALE_TEXTS","getContentRenderLocaleTexts","locale","normalizeMarkdownFlowLocale"],"mappings":"iKAsBMA,EAA2B,CAC/B,oBACA,iBACA,mBACA,qBACA,0BACA,2BACA,8BACA,kCACA,kBACA,qBACF,EAEMC,EACJC,GAEAC,EAAAA,iBACEH,EACAE,CACF,EAEWE,EAGT,CACF,QAASH,EAA+B,CACtC,SACA,OACA,SACA,qBACA,qBACA,4BACA,aACA,kBACA,OACA,kBAAA,CACD,EACD,QAASA,EAA+B,CACtC,YACA,SACA,QACA,2BACA,2BACA,qCACA,cACA,yBACA,UACA,4BAAA,CACD,EACD,QAASA,EAA+B,CACtC,KACA,KACA,MACA,YACA,YACA,cACA,OACA,OACA,KACA,OAAA,CACD,CACH,EAEaI,EACXC,GAEAF,EAA4BG,EAAAA,4BAA4BD,CAAM,CAAC"}
1
+ {"version":3,"file":"contentRenderI18n.cjs","sources":["../../../src/components/ContentRender/contentRenderI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport localeTexts from \"./locales/contentRender.json\";\n\nexport interface ContentRenderLocaleTexts {\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n sandboxLoadingText: string;\n sandboxStyleLoadingText: string;\n sandboxScriptLoadingText: string;\n sandboxFullscreenButtonText: string;\n sandboxExitFullscreenButtonText: string;\n sendButtonLabel: string;\n scrollToBottomLabel: string;\n mermaidLoadingText: string;\n mermaidEmptyChartText: string;\n mermaidErrorText: string;\n footnoteLabel: string;\n footnoteBackLabel: string;\n}\n\nexport const CONTENT_RENDER_LOCALE_TEXTS: Record<\n MarkdownFlowLocale,\n ContentRenderLocaleTexts\n> = localeTexts;\n\nexport const getContentRenderLocaleTexts = (\n locale?: string | null\n): ContentRenderLocaleTexts =>\n CONTENT_RENDER_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n"],"names":["CONTENT_RENDER_LOCALE_TEXTS","localeTexts","getContentRenderLocaleTexts","locale","normalizeMarkdownFlowLocale"],"mappings":"sKAwBaA,EAGTC,EAAAA,QAESC,EACXC,GAEAH,EAA4BI,EAAAA,4BAA4BD,CAAM,CAAC"}