markdown-flow-ui 0.2.13 → 0.2.15

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 (475) hide show
  1. package/README.md +7 -0
  2. package/dist/_virtual/index.es3.js +5 -4
  3. package/dist/_virtual/index.es3.js.map +1 -1
  4. package/dist/_virtual/index.es4.js +4 -5
  5. package/dist/_virtual/index.es4.js.map +1 -1
  6. package/dist/_virtual/index3.cjs +1 -1
  7. package/dist/_virtual/index4.cjs +1 -1
  8. package/dist/assets/markdown-flow-ui.css +10 -1
  9. package/dist/components/ContentRender/CodeBlock.cjs +1 -1
  10. package/dist/components/ContentRender/CodeBlock.cjs.map +1 -1
  11. package/dist/components/ContentRender/CodeBlock.d.ts +5 -0
  12. package/dist/components/ContentRender/CodeBlock.es.js +41 -38
  13. package/dist/components/ContentRender/CodeBlock.es.js.map +1 -1
  14. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  15. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  16. package/dist/components/ContentRender/ContentRender.d.ts +9 -4
  17. package/dist/components/ContentRender/ContentRender.es.js +389 -298
  18. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  19. package/dist/components/ContentRender/IframeSandbox.cjs +7 -7
  20. package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
  21. package/dist/components/ContentRender/IframeSandbox.d.ts +5 -1
  22. package/dist/components/ContentRender/IframeSandbox.es.js +311 -266
  23. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  24. package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
  25. package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
  26. package/dist/components/ContentRender/MarkdownFlowInput.d.ts +5 -1
  27. package/dist/components/ContentRender/MarkdownFlowInput.es.js +37 -32
  28. package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
  29. package/dist/components/ContentRender/SandboxApp.cjs +2 -2
  30. package/dist/components/ContentRender/SandboxApp.cjs.map +1 -1
  31. package/dist/components/ContentRender/SandboxApp.d.ts +5 -1
  32. package/dist/components/ContentRender/SandboxApp.es.js +108 -103
  33. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  34. package/dist/components/ContentRender/blackboard-vendor.d.ts +1 -1
  35. package/dist/components/ContentRender/contentRenderI18n.cjs +1 -1
  36. package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
  37. package/dist/components/ContentRender/contentRenderI18n.d.ts +6 -1
  38. package/dist/components/ContentRender/contentRenderI18n.es.js +5 -56
  39. package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
  40. package/dist/components/ContentRender/contentRenderI18n.test.d.ts +1 -0
  41. package/dist/components/ContentRender/index.cjs +1 -1
  42. package/dist/components/ContentRender/index.d.ts +11 -11
  43. package/dist/components/ContentRender/index.es.js +1 -2
  44. package/dist/components/ContentRender/index.es.js.map +1 -1
  45. package/dist/components/ContentRender/locales/contentRender.json.cjs +2 -0
  46. package/dist/components/ContentRender/locales/contentRender.json.cjs.map +1 -0
  47. package/dist/components/ContentRender/locales/contentRender.json.d.ts +90 -0
  48. package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -0
  49. package/dist/components/ContentRender/locales/contentRender.json.es.js.map +1 -0
  50. package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
  51. package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
  52. package/dist/components/ContentRender/plugins/CustomVariable.d.ts +7 -3
  53. package/dist/components/ContentRender/plugins/CustomVariable.es.js +165 -151
  54. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  55. package/dist/components/ContentRender/plugins/MermaidChart.cjs +1 -1
  56. package/dist/components/ContentRender/plugins/MermaidChart.cjs.map +1 -1
  57. package/dist/components/ContentRender/plugins/MermaidChart.d.ts +1 -0
  58. package/dist/components/ContentRender/plugins/MermaidChart.es.js +68 -44
  59. package/dist/components/ContentRender/plugins/MermaidChart.es.js.map +1 -1
  60. package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
  61. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
  62. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +12 -4
  63. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +51 -39
  64. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  65. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs +1 -1
  66. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
  67. package/dist/components/MarkdownFlow/ScrollToBottomButton.d.ts +31 -1
  68. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js +46 -17
  69. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
  70. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs +2 -0
  71. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -0
  72. package/dist/components/MarkdownFlow/ScrollToBottomControl.d.ts +18 -0
  73. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js +47 -0
  74. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -0
  75. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs +1 -1
  76. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.cjs.map +1 -1
  77. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.d.ts +1 -1
  78. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js +33 -52
  79. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.es.js.map +1 -1
  80. package/dist/components/MarkdownFlow/index.cjs +1 -1
  81. package/dist/components/MarkdownFlow/index.d.ts +9 -6
  82. package/dist/components/MarkdownFlow/index.es.js +6 -6
  83. package/dist/components/MarkdownFlow/index.es.js.map +1 -1
  84. package/dist/components/MarkdownFlow/useScrollToBottom.cjs +1 -1
  85. package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
  86. package/dist/components/MarkdownFlow/useScrollToBottom.d.ts +40 -8
  87. package/dist/components/MarkdownFlow/useScrollToBottom.es.js +352 -83
  88. package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
  89. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  90. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  91. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +5 -3
  92. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +371 -324
  93. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  94. package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs +1 -1
  95. package/dist/components/MarkdownFlowEditor/components/CustomDialog.cjs.map +1 -1
  96. package/dist/components/MarkdownFlowEditor/components/CustomDialog.d.ts +10 -0
  97. package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js +22 -19
  98. package/dist/components/MarkdownFlowEditor/components/CustomDialog.es.js.map +1 -1
  99. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +1 -1
  100. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +1 -1
  101. package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +8 -0
  102. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +19 -15
  103. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +1 -1
  104. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  105. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  106. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +4 -1
  107. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +99 -93
  108. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  109. package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs +1 -1
  110. package/dist/components/MarkdownFlowEditor/components/ImageInject.cjs.map +1 -1
  111. package/dist/components/MarkdownFlowEditor/components/ImageInject.d.ts +1 -1
  112. package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js +183 -182
  113. package/dist/components/MarkdownFlowEditor/components/ImageInject.es.js.map +1 -1
  114. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +1 -1
  115. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +1 -1
  116. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +1 -1
  117. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +107 -103
  118. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +1 -1
  119. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
  120. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
  121. package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +1 -1
  122. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +106 -106
  123. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
  124. package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs +1 -1
  125. package/dist/components/MarkdownFlowEditor/components/VideoInject.cjs.map +1 -1
  126. package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js +64 -63
  127. package/dist/components/MarkdownFlowEditor/components/VideoInject.es.js.map +1 -1
  128. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs +1 -1
  129. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.cjs.map +1 -1
  130. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js +13 -13
  131. package/dist/components/MarkdownFlowEditor/components/icons/ButtonIcon.es.js.map +1 -1
  132. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +1 -1
  133. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +1 -1
  134. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +12 -12
  135. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +1 -1
  136. package/dist/components/MarkdownFlowEditor/editor-context.d.ts +1 -1
  137. package/dist/components/MarkdownFlowEditor/editorI18n.cjs +1 -1
  138. package/dist/components/MarkdownFlowEditor/editorI18n.cjs.map +1 -1
  139. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +290 -0
  140. package/dist/components/MarkdownFlowEditor/editorI18n.es.js +12 -8
  141. package/dist/components/MarkdownFlowEditor/editorI18n.es.js.map +1 -1
  142. package/dist/components/MarkdownFlowEditor/editorI18n.test.d.ts +1 -0
  143. package/dist/components/MarkdownFlowEditor/index.d.ts +6 -6
  144. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +2 -0
  145. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs.map +1 -0
  146. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +72 -0
  147. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +140 -0
  148. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -0
  149. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  150. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +2 -0
  151. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +118 -114
  152. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  153. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  154. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +2 -0
  155. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +118 -114
  156. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  157. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +2 -0
  158. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs.map +1 -0
  159. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +72 -0
  160. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +140 -0
  161. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -0
  162. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  163. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +2 -0
  164. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +70 -66
  165. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  166. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
  167. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
  168. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +40 -35
  169. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
  170. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
  171. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
  172. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
  173. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +27 -23
  174. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
  175. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs +2 -0
  176. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.cjs.map +1 -0
  177. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.d.ts +7 -0
  178. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js +12 -0
  179. package/dist/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.es.js.map +1 -0
  180. package/dist/components/MarkdownFlowEditor/utils.d.ts +1 -1
  181. package/dist/components/Slide/MarkdownSlideScaling.cjs +1 -1
  182. package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
  183. package/dist/components/Slide/MarkdownSlideScaling.d.ts +1 -1
  184. package/dist/components/Slide/MarkdownSlideScaling.es.js +20 -20
  185. package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
  186. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs +1 -1
  187. package/dist/components/Slide/MobilePlayerSettingsSheet.cjs.map +1 -1
  188. package/dist/components/Slide/MobilePlayerSettingsSheet.d.ts +7 -2
  189. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +61 -57
  190. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js.map +1 -1
  191. package/dist/components/Slide/Player.cjs +1 -1
  192. package/dist/components/Slide/Player.cjs.map +1 -1
  193. package/dist/components/Slide/Player.d.ts +6 -6
  194. package/dist/components/Slide/Player.es.js +547 -541
  195. package/dist/components/Slide/Player.es.js.map +1 -1
  196. package/dist/components/Slide/Slide.cjs +1 -1
  197. package/dist/components/Slide/Slide.cjs.map +1 -1
  198. package/dist/components/Slide/Slide.d.ts +14 -12
  199. package/dist/components/Slide/Slide.es.js +745 -726
  200. package/dist/components/Slide/Slide.es.js.map +1 -1
  201. package/dist/components/Slide/SubtitleOverlay.cjs +1 -1
  202. package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
  203. package/dist/components/Slide/SubtitleOverlay.d.ts +2 -2
  204. package/dist/components/Slide/SubtitleOverlay.es.js +17 -17
  205. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  206. package/dist/components/Slide/diff-utils.d.ts +1 -1
  207. package/dist/components/Slide/index.d.ts +12 -12
  208. package/dist/components/Slide/locales/slide.json.cjs +2 -0
  209. package/dist/components/Slide/locales/slide.json.cjs.map +1 -0
  210. package/dist/components/Slide/locales/slide.json.d.ts +205 -0
  211. package/dist/components/Slide/locales/slide.json.es.js +11 -0
  212. package/dist/components/Slide/locales/slide.json.es.js.map +1 -0
  213. package/dist/components/Slide/slideI18n.cjs +1 -1
  214. package/dist/components/Slide/slideI18n.cjs.map +1 -1
  215. package/dist/components/Slide/slideI18n.d.ts +6 -3
  216. package/dist/components/Slide/slideI18n.es.js +10 -155
  217. package/dist/components/Slide/slideI18n.es.js.map +1 -1
  218. package/dist/components/Slide/useSlide.d.ts +1 -1
  219. package/dist/components/Slide/utils/appendedMarkerAdvance.d.ts +1 -1
  220. package/dist/components/Slide/utils/audioSegments.d.ts +1 -1
  221. package/dist/components/Slide/utils/interactionResolution.d.ts +2 -2
  222. package/dist/components/Slide/utils/listenModeElementList.d.ts +2 -2
  223. package/dist/components/Slide/utils/markdownScaling.d.ts +1 -1
  224. package/dist/components/Slide/utils/playerCustomActions.d.ts +2 -2
  225. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
  226. package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
  227. package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
  228. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +20 -20
  229. package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
  230. package/dist/components/Slide/utils/runStreamFixture.d.ts +1 -1
  231. package/dist/components/Slide/utils/segmentSeek.d.ts +1 -1
  232. package/dist/components/Slide/utils/silentStepAutoAdvance.d.ts +1 -1
  233. package/dist/components/Slide/utils/streamingNavigation.d.ts +1 -1
  234. package/dist/components/Slide/utils/subtitleCue.d.ts +1 -1
  235. package/dist/components/Slide/utils/subtitleJumpNavigation.d.ts +1 -1
  236. package/dist/components/index.d.ts +22 -18
  237. package/dist/components/ui/button.cjs +1 -1
  238. package/dist/components/ui/button.cjs.map +1 -1
  239. package/dist/components/ui/button.es.js +12 -13
  240. package/dist/components/ui/button.es.js.map +1 -1
  241. package/dist/components/ui/checkbox.cjs +1 -1
  242. package/dist/components/ui/checkbox.cjs.map +1 -1
  243. package/dist/components/ui/checkbox.es.js +35 -35
  244. package/dist/components/ui/checkbox.es.js.map +1 -1
  245. package/dist/components/ui/dialog.cjs +1 -1
  246. package/dist/components/ui/dialog.cjs.map +1 -1
  247. package/dist/components/ui/dialog.d.ts +5 -1
  248. package/dist/components/ui/dialog.es.js +37 -37
  249. package/dist/components/ui/dialog.es.js.map +1 -1
  250. package/dist/components/ui/input.cjs +1 -1
  251. package/dist/components/ui/input.cjs.map +1 -1
  252. package/dist/components/ui/input.es.js +4 -4
  253. package/dist/components/ui/input.es.js.map +1 -1
  254. package/dist/components/ui/inputGroup/button.cjs +1 -1
  255. package/dist/components/ui/inputGroup/button.cjs.map +1 -1
  256. package/dist/components/ui/inputGroup/button.es.js +9 -10
  257. package/dist/components/ui/inputGroup/button.es.js.map +1 -1
  258. package/dist/components/ui/inputGroup/input-group.cjs +1 -1
  259. package/dist/components/ui/inputGroup/input-group.cjs.map +1 -1
  260. package/dist/components/ui/inputGroup/input-group.d.ts +1 -1
  261. package/dist/components/ui/inputGroup/input-group.es.js +10 -10
  262. package/dist/components/ui/inputGroup/input-group.es.js.map +1 -1
  263. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  264. package/dist/components/ui/inputGroup/textarea.cjs.map +1 -1
  265. package/dist/components/ui/inputGroup/textarea.es.js +3 -3
  266. package/dist/components/ui/inputGroup/textarea.es.js.map +1 -1
  267. package/dist/components/ui/loading-overlay-card.cjs +2 -2
  268. package/dist/components/ui/loading-overlay-card.cjs.map +1 -1
  269. package/dist/components/ui/loading-overlay-card.es.js +11 -11
  270. package/dist/components/ui/loading-overlay-card.es.js.map +1 -1
  271. package/dist/components/ui/popover.cjs +1 -1
  272. package/dist/components/ui/popover.cjs.map +1 -1
  273. package/dist/components/ui/popover.es.js +6 -6
  274. package/dist/components/ui/popover.es.js.map +1 -1
  275. package/dist/components/ui/tooltip.cjs +1 -1
  276. package/dist/components/ui/tooltip.cjs.map +1 -1
  277. package/dist/components/ui/tooltip.es.js +16 -16
  278. package/dist/components/ui/tooltip.es.js.map +1 -1
  279. package/dist/editor.d.ts +2 -2
  280. package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
  281. package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
  282. package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  283. package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  284. package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  285. package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  286. package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  287. package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  288. package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  289. package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  290. package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  291. package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  292. package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  293. package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  294. package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  295. package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
  296. package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
  297. package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
  298. package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  299. package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  300. package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  301. package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
  302. package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
  303. package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
  304. package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
  305. package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
  306. package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
  307. package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  308. package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  309. package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  310. package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
  311. package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
  312. package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
  313. package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  314. package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  315. package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  316. package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  317. package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  318. package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  319. package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  320. package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  321. package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  322. package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
  323. package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
  324. package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
  325. package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
  326. package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
  327. package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  328. package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
  329. package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
  330. package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  331. package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
  332. package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
  333. package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  334. package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
  335. package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
  336. package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  337. package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  338. package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  339. package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  340. package/dist/index.cjs +1 -1
  341. package/dist/index.d.ts +2 -2
  342. package/dist/index.es.js +22 -19
  343. package/dist/index.es.js.map +1 -1
  344. package/dist/lib/locale.cjs +1 -1
  345. package/dist/lib/locale.cjs.map +1 -1
  346. package/dist/lib/locale.d.ts +5 -1
  347. package/dist/lib/locale.es.js +26 -13
  348. package/dist/lib/locale.es.js.map +1 -1
  349. package/dist/lib/locale.test.d.ts +1 -0
  350. package/dist/lib/useDetachedLanguage.cjs +2 -0
  351. package/dist/lib/useDetachedLanguage.cjs.map +1 -0
  352. package/dist/lib/useDetachedLanguage.d.ts +3 -0
  353. package/dist/lib/useDetachedLanguage.es.js +25 -0
  354. package/dist/lib/useDetachedLanguage.es.js.map +1 -0
  355. package/dist/lib/useResolvedDirection.cjs +2 -0
  356. package/dist/lib/useResolvedDirection.cjs.map +1 -0
  357. package/dist/lib/useResolvedDirection.d.ts +6 -0
  358. package/dist/lib/useResolvedDirection.es.js +37 -0
  359. package/dist/lib/useResolvedDirection.es.js.map +1 -0
  360. package/dist/markdown-flow-ui-lib.css +1 -1
  361. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
  362. package/dist/node_modules/@radix-ui/react-arrow/dist/index.cjs.map +1 -1
  363. package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js +6 -6
  364. package/dist/node_modules/@radix-ui/react-arrow/dist/index.es.js.map +1 -1
  365. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
  366. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  367. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +21 -21
  368. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
  369. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +2 -2
  370. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
  371. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +100 -100
  372. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
  373. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +1 -1
  374. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -1
  375. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +38 -38
  376. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -1
  377. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
  378. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  379. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +9 -9
  380. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
  381. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +1 -1
  382. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +1 -1
  383. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +95 -95
  384. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +1 -1
  385. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs +1 -1
  386. package/dist/node_modules/@radix-ui/react-popper/dist/index.cjs.map +1 -1
  387. package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js +48 -48
  388. package/dist/node_modules/@radix-ui/react-popper/dist/index.es.js.map +1 -1
  389. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs +1 -1
  390. package/dist/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -1
  391. package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js +6 -6
  392. package/dist/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -1
  393. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
  394. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  395. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +9 -9
  396. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
  397. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
  398. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  399. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +17 -17
  400. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  401. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
  402. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
  403. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +100 -100
  404. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js.map +1 -1
  405. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
  406. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs.map +1 -1
  407. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js +6 -6
  408. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.es.js.map +1 -1
  409. package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs +1 -1
  410. package/dist/node_modules/@uiw/react-codemirror/esm/index.cjs.map +1 -1
  411. package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js +27 -27
  412. package/dist/node_modules/@uiw/react-codemirror/esm/index.es.js.map +1 -1
  413. package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.cjs → chevrons-down.cjs} +2 -2
  414. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -0
  415. package/dist/node_modules/lucide-react/dist/esm/icons/{chevron-down.es.js → chevrons-down.es.js} +6 -3
  416. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -0
  417. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  418. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  419. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  420. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  421. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  422. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  423. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  424. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  425. package/dist/node_modules/react-markdown/lib/index.cjs +1 -1
  426. package/dist/node_modules/react-markdown/lib/index.cjs.map +1 -1
  427. package/dist/node_modules/react-markdown/lib/index.es.js +39 -39
  428. package/dist/node_modules/react-markdown/lib/index.es.js.map +1 -1
  429. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  430. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
  431. package/dist/renderer.cjs +1 -1
  432. package/dist/renderer.d.ts +18 -17
  433. package/dist/renderer.es.js +20 -17
  434. package/dist/renderer.es.js.map +1 -1
  435. package/dist/scroll.cjs +2 -0
  436. package/dist/scroll.cjs.map +1 -0
  437. package/dist/scroll.d.ts +6 -0
  438. package/dist/scroll.es.js +9 -0
  439. package/dist/scroll.es.js.map +1 -0
  440. package/dist/slide.d.ts +3 -3
  441. package/package.json +13 -2
  442. package/dist/_virtual/jsx-runtime.cjs +0 -2
  443. package/dist/_virtual/jsx-runtime.cjs.map +0 -1
  444. package/dist/_virtual/jsx-runtime.es.js +0 -6
  445. package/dist/_virtual/jsx-runtime.es.js.map +0 -1
  446. package/dist/_virtual/jsx-runtime.es2.js +0 -5
  447. package/dist/_virtual/jsx-runtime.es2.js.map +0 -1
  448. package/dist/_virtual/jsx-runtime2.cjs +0 -2
  449. package/dist/_virtual/jsx-runtime2.cjs.map +0 -1
  450. package/dist/_virtual/react-jsx-runtime.development.cjs +0 -2
  451. package/dist/_virtual/react-jsx-runtime.development.cjs.map +0 -1
  452. package/dist/_virtual/react-jsx-runtime.development.es.js +0 -5
  453. package/dist/_virtual/react-jsx-runtime.development.es.js.map +0 -1
  454. package/dist/_virtual/react-jsx-runtime.production.cjs +0 -2
  455. package/dist/_virtual/react-jsx-runtime.production.cjs.map +0 -1
  456. package/dist/_virtual/react-jsx-runtime.production.es.js +0 -5
  457. package/dist/_virtual/react-jsx-runtime.production.es.js.map +0 -1
  458. package/dist/lib/localeTextMap.cjs +0 -2
  459. package/dist/lib/localeTextMap.cjs.map +0 -1
  460. package/dist/lib/localeTextMap.es.js +0 -5
  461. package/dist/lib/localeTextMap.es.js.map +0 -1
  462. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs.map +0 -1
  463. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.es.js.map +0 -1
  464. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs +0 -24
  465. package/dist/node_modules/react/cjs/react-jsx-runtime.development.cjs.map +0 -1
  466. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js +0 -409
  467. package/dist/node_modules/react/cjs/react-jsx-runtime.development.es.js.map +0 -1
  468. package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs +0 -10
  469. package/dist/node_modules/react/cjs/react-jsx-runtime.production.cjs.map +0 -1
  470. package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js +0 -36
  471. package/dist/node_modules/react/cjs/react-jsx-runtime.production.es.js.map +0 -1
  472. package/dist/node_modules/react/jsx-runtime.cjs +0 -2
  473. package/dist/node_modules/react/jsx-runtime.cjs.map +0 -1
  474. package/dist/node_modules/react/jsx-runtime.es.js +0 -11
  475. package/dist/node_modules/react/jsx-runtime.es.js.map +0 -1
@@ -1,46 +1,47 @@
1
- import { MatchDecorator as h, Decoration as p, ViewPlugin as f, EditorView as x } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
- import { SelectedOption as w } from "../types.es.js";
3
- import { unwrapFixedOutput as M } from "../utils.es.js";
4
- import P from "./PlaceholderWidget.es.js";
5
- const b = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, I = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, c = (t, r) => {
1
+ import { MatchDecorator as f, Decoration as p, ViewPlugin as x, EditorView as w } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
+ import { SelectedOption as P } from "../types.es.js";
3
+ import { unwrapFixedOutput as b } from "../utils.es.js";
4
+ import M from "./PlaceholderWidget.es.js";
5
+ import { mediaPlaceholderLabels as i } from "./mediaPlaceholderLabels.es.js";
6
+ const D = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, I = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, o = (t, r) => {
6
7
  const e = new RegExp(
7
8
  `${r}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,
8
9
  "i"
9
- ), o = t.match(e);
10
- if (o)
11
- return o[2] ?? o[3] ?? o[4];
12
- }, O = (t) => Math.max(1, Math.min(1e3, Math.round(t))), D = (t) => {
13
- const r = t?.[0] ?? "", e = M(r), o = /^\s*===/.test(r);
10
+ ), c = t.match(e);
11
+ if (c)
12
+ return c[2] ?? c[3] ?? c[4];
13
+ }, O = (t) => Math.max(1, Math.min(1e3, Math.round(t))), R = (t) => {
14
+ const r = t?.[0] ?? "", e = b(r), c = /^\s*===/.test(r);
14
15
  if (/^<img\b/i.test(e)) {
15
- const d = c(e, "src") ?? "", n = c(e, "alt") ?? c(e, "title") ?? "", s = c(e, "width");
16
- let l;
17
- if (s) {
18
- const m = Number.parseFloat(s);
19
- Number.isFinite(m) && (l = O(m));
16
+ const h = o(e, "src") ?? "", l = o(e, "alt") ?? o(e, "title") ?? "", m = o(e, "width");
17
+ let u;
18
+ if (m) {
19
+ const g = Number.parseFloat(m);
20
+ Number.isFinite(g) && (u = O(g));
20
21
  }
21
22
  return {
22
- text: n || "Image",
23
- url: d,
24
- title: n,
25
- scalePercent: l,
26
- fixedOutput: o
23
+ text: l,
24
+ url: h,
25
+ title: l,
26
+ scalePercent: u,
27
+ fixedOutput: c
27
28
  };
28
29
  }
29
- const a = e.match(b), i = a?.[1] ?? "", g = a?.[2] ?? "";
30
+ const s = e.match(D), n = s?.[1] ?? "", d = s?.[2] ?? "";
30
31
  return {
31
- text: i,
32
- url: g,
33
- title: i,
32
+ text: n,
33
+ url: d,
34
+ title: n,
34
35
  scalePercent: void 0,
35
- fixedOutput: o
36
+ fixedOutput: c
36
37
  };
37
- }, u = new h({
38
+ }, a = new f({
38
39
  regexp: I,
39
40
  decoration: (t, r) => {
40
- const e = D(t);
41
+ const e = R(t);
41
42
  return p.replace({
42
- widget: new P(
43
- e.text,
43
+ widget: new M(
44
+ e.text || r.state.facet(i).image,
44
45
  {
45
46
  tag: "image",
46
47
  url: e.url,
@@ -49,26 +50,30 @@ const b = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, I = /===\s*(?:!\[[^\]]*\]\([
49
50
  fixedOutput: e.fixedOutput
50
51
  },
51
52
  "tag-image",
52
- w.Image,
53
+ P.Image,
53
54
  r
54
55
  )
55
56
  });
56
57
  }
57
- }), k = f.fromClass(
58
+ }), A = x.fromClass(
58
59
  class {
59
60
  constructor(t) {
60
- this.placeholders = u.createDeco(t);
61
+ this.placeholders = a.createDeco(t);
61
62
  }
62
63
  update(t) {
63
- this.placeholders = u.updateDeco(t, this.placeholders);
64
+ if (t.startState.facet(i) !== t.state.facet(i)) {
65
+ this.placeholders = a.createDeco(t.view);
66
+ return;
67
+ }
68
+ this.placeholders = a.updateDeco(t, this.placeholders);
64
69
  }
65
70
  },
66
71
  {
67
72
  decorations: (t) => t.placeholders,
68
- provide: (t) => x.atomicRanges.of((r) => r.plugin(t)?.placeholders || p.none)
73
+ provide: (t) => w.atomicRanges.of((r) => r.plugin(t)?.placeholders || p.none)
69
74
  }
70
75
  );
71
76
  export {
72
- k as default
77
+ A as default
73
78
  };
74
79
  //# sourceMappingURL=ImgPlaceholder.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt || \"Image\",\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst imageUrlMatcher = new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view) => {\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n});\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = imageUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n this.placeholders = imageUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","imageUrlMatcher","MatchDecorator","view","info","Decoration","PlaceholderWidget","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;AAYA,MAAMA,IAAoB,0CACpBC,IACJ,yFAEIC,IAAwB,CAACC,GAAaC,MAAsB;AAChE,QAAMC,IAAS,IAAI;AAAA,IACjB,GAAGD,CAAS;AAAA,IACZ;AAAA,EAAA,GAEIE,IAAQH,EAAI,MAAME,CAAM;AAC9B,MAAKC;AACL,WAAOA,EAAM,CAAC,KAAKA,EAAM,CAAC,KAAKA,EAAM,CAAC;AACxC,GAEMC,IAAoB,CAACC,MACzB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,KAAK,M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,MAAA;AAAA,IACF,CACD;AAAA,EACH;AACF,CAAC,GAEKK,IAAiBC,EAAW;AAAA,EAChC,MAAM;AAAA,IAEJ,YAAYN,GAAkB;AAC5B,WAAK,eAAeF,EAAgB,WAAWE,CAAI;AAAA,IACrD;AAAA,IACA,OAAOO,GAAoB;AACzB,WAAK,eAAeT,EAAgB,WAAWS,GAAQ,KAAK,YAAY;AAAA,IAC1E;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACV,MACnBA,EAAK,OAAOS,CAAM,GAAG,gBAAgBP,EAAW,IACxD;AAAA,EAAA;AAEP;"}
1
+ {"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst imageUrlMatcher = new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view) => {\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n});\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = imageUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = imageUrlMatcher.createDeco(update.view);\n return;\n }\n this.placeholders = imageUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","imageUrlMatcher","MatchDecorator","view","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;;AAaA,MAAMA,IAAoB,0CACpBC,IACJ,yFAEIC,IAAwB,CAACC,GAAaC,MAAsB;AAChE,QAAMC,IAAS,IAAI;AAAA,IACjB,GAAGD,CAAS;AAAA,IACZ;AAAA,EAAA,GAEIE,IAAQH,EAAI,MAAME,CAAM;AAC9B,MAAKC;AACL,WAAOA,EAAM,CAAC,KAAKA,EAAM,CAAC,KAAKA,EAAM,CAAC;AACxC,GAEMC,IAAoB,CAACC,MACzB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,GAEzCC,IAAoB,CAACH,MAA4B;AACrD,QAAMI,IAASJ,IAAQ,CAAC,KAAK,IACvBK,IAAMC,EAAkBF,CAAM,GAC9BG,IAAc,UAAU,KAAKH,CAAM;AACzC,MAAI,WAAW,KAAKC,CAAG,GAAG;AACxB,UAAMG,IAAMZ,EAAsBS,GAAK,KAAK,KAAK,IAC3CI,IACJb,EAAsBS,GAAK,KAAK,KAChCT,EAAsBS,GAAK,OAAO,KAClC,IACIK,IAAYd,EAAsBS,GAAK,OAAO;AACpD,QAAIM;AACJ,QAAID,GAAW;AACb,YAAME,IAAU,OAAO,WAAWF,CAAS;AAC3C,MAAI,OAAO,SAASE,CAAO,MACzBD,IAAeV,EAAkBW,CAAO;AAAA,IAE5C;AACA,WAAO;AAAA,MACL,MAAMH;AAAA,MACN,KAAKD;AAAA,MACL,OAAOC;AAAA,MACP,cAAAE;AAAA,MACA,aAAAJ;AAAA,IAAA;AAAA,EAEJ;AACA,QAAM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"}
@@ -1,5 +1,5 @@
1
1
  import { EditorView, WidgetType } from '@codemirror/view';
2
- import { SelectedOption } from '../types';
2
+ import { SelectedOption } from '../types.js';
3
3
  declare class PlaceholderWidget extends WidgetType {
4
4
  private text;
5
5
  private dataset;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../../../node_modules/@codemirror/view/dist/index.cjs"),R=require("../types.cjs"),x=require("../utils.cjs"),U=require("./PlaceholderWidget.cjs"),V=/===\s*<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>\s*===|<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>/gi,i=(e,t)=>{const a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`${a}="([^"]*)"`,"i"),c=e.match(r);return c?c[1]:""},l=e=>e.replace(/&quot;/g,'"').replace(/&amp;/g,"&"),w=new o.MatchDecorator({regexp:V,decoration:(e,t)=>{const a=e?.[0]||"",r=x.unwrapFixedOutput(a),c=/^\s*===/.test(a),n=i(r,"src"),d=i(r,"data-title"),u=i(r,"data-url"),p=d?l(d):"",s=n?l(n):"",g=u?l(u):"";let h=g||s;try{if(!g&&s){const f=new URLSearchParams(new URL(s).search).get("url");f&&(h=decodeURIComponent(f))}}catch(m){console.warn("Failed to decode video URL:",m)}return o.Decoration.replace({widget:new U.default(p||"Video",{tag:"video",url:h,title:p,fixedOutput:c},"tag-video",R.SelectedOption.Video,t)})}}),v=o.ViewPlugin.fromClass(class{constructor(e){this.placeholders=w.createDeco(e)}update(e){this.placeholders=w.updateDeco(e,this.placeholders)}},{decorations:e=>e.placeholders,provide:e=>o.EditorView.atomicRanges.of(t=>t.plugin(e)?.placeholders||o.Decoration.none)});exports.default=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../../node_modules/@codemirror/view/dist/index.cjs"),R=require("../types.cjs"),v=require("../utils.cjs"),x=require("./PlaceholderWidget.cjs"),n=require("./mediaPlaceholderLabels.cjs"),U=/===\s*<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>\s*===|<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>/gi,l=(e,t)=>{const o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`${o}="([^"]*)"`,"i"),c=e.match(r);return c?c[1]:""},i=e=>e.replace(/&quot;/g,'"').replace(/&amp;/g,"&"),d=new a.MatchDecorator({regexp:U,decoration:(e,t)=>{const o=e?.[0]||"",r=v.unwrapFixedOutput(o),c=/^\s*===/.test(o),u=l(r,"src"),p=l(r,"data-title"),h=l(r,"data-url"),g=p?i(p):"",s=u?i(u):"",m=h?i(h):"";let f=m||s;try{if(!m&&s){const P=new URLSearchParams(new URL(s).search).get("url");P&&(f=decodeURIComponent(P))}}catch(w){console.warn("Failed to decode video URL:",w)}return a.Decoration.replace({widget:new x.default(g||t.state.facet(n.mediaPlaceholderLabels).video,{tag:"video",url:f,title:g,fixedOutput:c},"tag-video",R.SelectedOption.Video,t)})}}),b=a.ViewPlugin.fromClass(class{constructor(e){this.placeholders=d.createDeco(e)}update(e){if(e.startState.facet(n.mediaPlaceholderLabels)!==e.state.facet(n.mediaPlaceholderLabels)){this.placeholders=d.createDeco(e.view);return}this.placeholders=d.updateDeco(e,this.placeholders)}},{decorations:e=>e.placeholders,provide:e=>a.EditorView.atomicRanges.of(t=>t.plugin(e)?.placeholders||a.Decoration.none)});exports.default=b;
2
2
  //# sourceMappingURL=VideoPlaceholder.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/VideoPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\n\nconst biliVideoContextRegexp =\n /===\\s*<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>\\s*===|<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>/gi;\n\nconst extractAttrValue = (markup: string, attr: string) => {\n const escapedAttr = attr.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexp = new RegExp(`${escapedAttr}=\"([^\"]*)\"`, \"i\");\n const match = markup.match(regexp);\n return match ? match[1] : \"\";\n};\n\nconst decodeHtmlEntities = (value: string) =>\n value.replace(/&quot;/g, '\"').replace(/&amp;/g, \"&\");\n\nconst biliUrlMatcher = new MatchDecorator({\n regexp: biliVideoContextRegexp,\n decoration: (match, view) => {\n const source = match?.[0] || \"\";\n const iframeMarkup = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n const srcValueRaw = extractAttrValue(iframeMarkup, \"src\");\n const titleAttrRaw = extractAttrValue(iframeMarkup, \"data-title\");\n const dataUrlAttrRaw = extractAttrValue(iframeMarkup, \"data-url\");\n const titleAttr = titleAttrRaw ? decodeHtmlEntities(titleAttrRaw) : \"\";\n const decodedSrcValue = srcValueRaw ? decodeHtmlEntities(srcValueRaw) : \"\";\n const storedDataUrl = dataUrlAttrRaw\n ? decodeHtmlEntities(dataUrlAttrRaw)\n : \"\";\n // Extract and decode the original URL from stored attributes or API endpoint\n let originalUrl = storedDataUrl || decodedSrcValue;\n try {\n if (!storedDataUrl && decodedSrcValue) {\n const urlParams = new URLSearchParams(new URL(decodedSrcValue).search);\n const encodedUrl = urlParams.get(\"url\");\n if (encodedUrl) {\n originalUrl = decodeURIComponent(encodedUrl);\n }\n }\n } catch (error) {\n console.warn(\"Failed to decode video URL:\", error);\n }\n\n return Decoration.replace({\n widget: new PlaceholderWidget(\n titleAttr || \"Video\", // Display title from data-title\n {\n tag: \"video\",\n url: originalUrl, // Decoded original Bilibili URL\n title: titleAttr, // title from data-title attribute\n fixedOutput,\n },\n \"tag-video\",\n SelectedOption.Video,\n view\n ),\n });\n },\n});\n\nconst VideoPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = biliUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n this.placeholders = biliUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default VideoPlaceholder;\n"],"names":["biliVideoContextRegexp","extractAttrValue","markup","attr","escapedAttr","regexp","match","decodeHtmlEntities","value","biliUrlMatcher","MatchDecorator","view","source","iframeMarkup","unwrapFixedOutput","fixedOutput","srcValueRaw","titleAttrRaw","dataUrlAttrRaw","titleAttr","decodedSrcValue","storedDataUrl","originalUrl","encodedUrl","error","Decoration","PlaceholderWidget","SelectedOption","VideoPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":"8QAYMA,EACJ,8GAEIC,EAAmB,CAACC,EAAgBC,IAAiB,CACzD,MAAMC,EAAcD,EAAK,QAAQ,sBAAuB,MAAM,EACxDE,EAAS,IAAI,OAAO,GAAGD,CAAW,aAAc,GAAG,EACnDE,EAAQJ,EAAO,MAAMG,CAAM,EACjC,OAAOC,EAAQA,EAAM,CAAC,EAAI,EAC5B,EAEMC,EAAsBC,GAC1BA,EAAM,QAAQ,UAAW,GAAG,EAAE,QAAQ,SAAU,GAAG,EAE/CC,EAAiB,IAAIC,EAAAA,eAAe,CACxC,OAAQV,EACR,WAAY,CAACM,EAAOK,IAAS,CAC3B,MAAMC,EAASN,IAAQ,CAAC,GAAK,GACvBO,EAAeC,EAAAA,kBAAkBF,CAAM,EACvCG,EAAc,UAAU,KAAKH,CAAM,EACnCI,EAAcf,EAAiBY,EAAc,KAAK,EAClDI,EAAehB,EAAiBY,EAAc,YAAY,EAC1DK,EAAiBjB,EAAiBY,EAAc,UAAU,EAC1DM,EAAYF,EAAeV,EAAmBU,CAAY,EAAI,GAC9DG,EAAkBJ,EAAcT,EAAmBS,CAAW,EAAI,GAClEK,EAAgBH,EAClBX,EAAmBW,CAAc,EACjC,GAEJ,IAAII,EAAcD,GAAiBD,EACnC,GAAI,CACF,GAAI,CAACC,GAAiBD,EAAiB,CAErC,MAAMG,EADY,IAAI,gBAAgB,IAAI,IAAIH,CAAe,EAAE,MAAM,EACxC,IAAI,KAAK,EAClCG,IACFD,EAAc,mBAAmBC,CAAU,EAE/C,CACF,OAASC,EAAO,CACd,QAAQ,KAAK,8BAA+BA,CAAK,CACnD,CAEA,OAAOC,EAAAA,WAAW,QAAQ,CACxB,OAAQ,IAAIC,EAAAA,QACVP,GAAa,QACb,CACE,IAAK,QACL,IAAKG,EACL,MAAOH,EACP,YAAAJ,CAAA,EAEF,YACAY,EAAAA,eAAe,MACfhB,CAAA,CACF,CACD,CACH,CACF,CAAC,EAEKiB,EAAmBC,EAAAA,WAAW,UAClC,KAAM,CAEJ,YAAYlB,EAAkB,CAC5B,KAAK,aAAeF,EAAe,WAAWE,CAAI,CACpD,CACA,OAAOmB,EAAoB,CACzB,KAAK,aAAerB,EAAe,WAAWqB,EAAQ,KAAK,YAAY,CACzE,CAAA,EAEF,CACE,YAAcC,GAAaA,EAAS,aACpC,QAAUC,GACRC,EAAAA,WAAW,aAAa,GAAItB,GACnBA,EAAK,OAAOqB,CAAM,GAAG,cAAgBP,EAAAA,WAAW,IACxD,CAAA,CAEP"}
1
+ {"version":3,"file":"VideoPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/VideoPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst biliVideoContextRegexp =\n /===\\s*<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>\\s*===|<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>/gi;\n\nconst extractAttrValue = (markup: string, attr: string) => {\n const escapedAttr = attr.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexp = new RegExp(`${escapedAttr}=\"([^\"]*)\"`, \"i\");\n const match = markup.match(regexp);\n return match ? match[1] : \"\";\n};\n\nconst decodeHtmlEntities = (value: string) =>\n value.replace(/&quot;/g, '\"').replace(/&amp;/g, \"&\");\n\nconst biliUrlMatcher = new MatchDecorator({\n regexp: biliVideoContextRegexp,\n decoration: (match, view) => {\n const source = match?.[0] || \"\";\n const iframeMarkup = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n const srcValueRaw = extractAttrValue(iframeMarkup, \"src\");\n const titleAttrRaw = extractAttrValue(iframeMarkup, \"data-title\");\n const dataUrlAttrRaw = extractAttrValue(iframeMarkup, \"data-url\");\n const titleAttr = titleAttrRaw ? decodeHtmlEntities(titleAttrRaw) : \"\";\n const decodedSrcValue = srcValueRaw ? decodeHtmlEntities(srcValueRaw) : \"\";\n const storedDataUrl = dataUrlAttrRaw\n ? decodeHtmlEntities(dataUrlAttrRaw)\n : \"\";\n // Extract and decode the original URL from stored attributes or API endpoint\n let originalUrl = storedDataUrl || decodedSrcValue;\n try {\n if (!storedDataUrl && decodedSrcValue) {\n const urlParams = new URLSearchParams(new URL(decodedSrcValue).search);\n const encodedUrl = urlParams.get(\"url\");\n if (encodedUrl) {\n originalUrl = decodeURIComponent(encodedUrl);\n }\n }\n } catch (error) {\n console.warn(\"Failed to decode video URL:\", error);\n }\n\n return Decoration.replace({\n widget: new PlaceholderWidget(\n titleAttr || view.state.facet(mediaPlaceholderLabels).video,\n {\n tag: \"video\",\n url: originalUrl, // Decoded original Bilibili URL\n title: titleAttr, // title from data-title attribute\n fixedOutput,\n },\n \"tag-video\",\n SelectedOption.Video,\n view\n ),\n });\n },\n});\n\nconst VideoPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = biliUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = biliUrlMatcher.createDeco(update.view);\n return;\n }\n this.placeholders = biliUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default VideoPlaceholder;\n"],"names":["biliVideoContextRegexp","extractAttrValue","markup","attr","escapedAttr","regexp","match","decodeHtmlEntities","value","biliUrlMatcher","MatchDecorator","view","source","iframeMarkup","unwrapFixedOutput","fixedOutput","srcValueRaw","titleAttrRaw","dataUrlAttrRaw","titleAttr","decodedSrcValue","storedDataUrl","originalUrl","encodedUrl","error","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","VideoPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":"wTAaMA,EACJ,8GAEIC,EAAmB,CAACC,EAAgBC,IAAiB,CACzD,MAAMC,EAAcD,EAAK,QAAQ,sBAAuB,MAAM,EACxDE,EAAS,IAAI,OAAO,GAAGD,CAAW,aAAc,GAAG,EACnDE,EAAQJ,EAAO,MAAMG,CAAM,EACjC,OAAOC,EAAQA,EAAM,CAAC,EAAI,EAC5B,EAEMC,EAAsBC,GAC1BA,EAAM,QAAQ,UAAW,GAAG,EAAE,QAAQ,SAAU,GAAG,EAE/CC,EAAiB,IAAIC,EAAAA,eAAe,CACxC,OAAQV,EACR,WAAY,CAACM,EAAOK,IAAS,CAC3B,MAAMC,EAASN,IAAQ,CAAC,GAAK,GACvBO,EAAeC,EAAAA,kBAAkBF,CAAM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AgBR,EAAAA,WAAW,IACxD,CAAA,CAEP"}
@@ -1,53 +1,57 @@
1
- import { MatchDecorator as R, Decoration as w, ViewPlugin as x, EditorView as U } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
- import { SelectedOption as V } from "../types.es.js";
3
- import { unwrapFixedOutput as v } from "../utils.es.js";
4
- import P from "./PlaceholderWidget.es.js";
5
- const A = /===\s*<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>\s*===|<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>/gi, i = (e, t) => {
6
- const r = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(`${r}="([^"]*)"`, "i"), a = e.match(o);
1
+ import { MatchDecorator as x, Decoration as R, ViewPlugin as U, EditorView as V } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
+ import { SelectedOption as v } from "../types.es.js";
3
+ import { unwrapFixedOutput as P } from "../utils.es.js";
4
+ import D from "./PlaceholderWidget.es.js";
5
+ import { mediaPlaceholderLabels as d } from "./mediaPlaceholderLabels.es.js";
6
+ const A = /===\s*<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>\s*===|<iframe\s[^>]*data-tag="video"[^>]*><\/iframe>/gi, s = (e, t) => {
7
+ const o = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = new RegExp(`${o}="([^"]*)"`, "i"), a = e.match(r);
7
8
  return a ? a[1] : "";
8
- }, s = (e) => e.replace(/&quot;/g, '"').replace(/&amp;/g, "&"), f = new R({
9
+ }, i = (e) => e.replace(/&quot;/g, '"').replace(/&amp;/g, "&"), l = new x({
9
10
  regexp: A,
10
11
  decoration: (e, t) => {
11
- const r = e?.[0] || "", o = v(r), a = /^\s*===/.test(r), l = i(o, "src"), d = i(o, "data-title"), n = i(o, "data-url"), p = d ? s(d) : "", c = l ? s(l) : "", u = n ? s(n) : "";
12
- let m = u || c;
12
+ const o = e?.[0] || "", r = P(o), a = /^\s*===/.test(o), n = s(r, "src"), p = s(r, "data-title"), m = s(r, "data-url"), u = p ? i(p) : "", c = n ? i(n) : "", f = m ? i(m) : "";
13
+ let h = f || c;
13
14
  try {
14
- if (!u && c) {
15
- const h = new URLSearchParams(new URL(c).search).get("url");
16
- h && (m = decodeURIComponent(h));
15
+ if (!f && c) {
16
+ const w = new URLSearchParams(new URL(c).search).get("url");
17
+ w && (h = decodeURIComponent(w));
17
18
  }
18
19
  } catch (g) {
19
20
  console.warn("Failed to decode video URL:", g);
20
21
  }
21
- return w.replace({
22
- widget: new P(
23
- p || "Video",
24
- // Display title from data-title
22
+ return R.replace({
23
+ widget: new D(
24
+ u || t.state.facet(d).video,
25
25
  {
26
26
  tag: "video",
27
- url: m,
27
+ url: h,
28
28
  // Decoded original Bilibili URL
29
- title: p,
29
+ title: u,
30
30
  // title from data-title attribute
31
31
  fixedOutput: a
32
32
  },
33
33
  "tag-video",
34
- V.Video,
34
+ v.Video,
35
35
  t
36
36
  )
37
37
  });
38
38
  }
39
- }), M = x.fromClass(
39
+ }), M = U.fromClass(
40
40
  class {
41
41
  constructor(e) {
42
- this.placeholders = f.createDeco(e);
42
+ this.placeholders = l.createDeco(e);
43
43
  }
44
44
  update(e) {
45
- this.placeholders = f.updateDeco(e, this.placeholders);
45
+ if (e.startState.facet(d) !== e.state.facet(d)) {
46
+ this.placeholders = l.createDeco(e.view);
47
+ return;
48
+ }
49
+ this.placeholders = l.updateDeco(e, this.placeholders);
46
50
  }
47
51
  },
48
52
  {
49
53
  decorations: (e) => e.placeholders,
50
- provide: (e) => U.atomicRanges.of((t) => t.plugin(e)?.placeholders || w.none)
54
+ provide: (e) => V.atomicRanges.of((t) => t.plugin(e)?.placeholders || R.none)
51
55
  }
52
56
  );
53
57
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/VideoPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\n\nconst biliVideoContextRegexp =\n /===\\s*<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>\\s*===|<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>/gi;\n\nconst extractAttrValue = (markup: string, attr: string) => {\n const escapedAttr = attr.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexp = new RegExp(`${escapedAttr}=\"([^\"]*)\"`, \"i\");\n const match = markup.match(regexp);\n return match ? match[1] : \"\";\n};\n\nconst decodeHtmlEntities = (value: string) =>\n value.replace(/&quot;/g, '\"').replace(/&amp;/g, \"&\");\n\nconst biliUrlMatcher = new MatchDecorator({\n regexp: biliVideoContextRegexp,\n decoration: (match, view) => {\n const source = match?.[0] || \"\";\n const iframeMarkup = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n const srcValueRaw = extractAttrValue(iframeMarkup, \"src\");\n const titleAttrRaw = extractAttrValue(iframeMarkup, \"data-title\");\n const dataUrlAttrRaw = extractAttrValue(iframeMarkup, \"data-url\");\n const titleAttr = titleAttrRaw ? decodeHtmlEntities(titleAttrRaw) : \"\";\n const decodedSrcValue = srcValueRaw ? decodeHtmlEntities(srcValueRaw) : \"\";\n const storedDataUrl = dataUrlAttrRaw\n ? decodeHtmlEntities(dataUrlAttrRaw)\n : \"\";\n // Extract and decode the original URL from stored attributes or API endpoint\n let originalUrl = storedDataUrl || decodedSrcValue;\n try {\n if (!storedDataUrl && decodedSrcValue) {\n const urlParams = new URLSearchParams(new URL(decodedSrcValue).search);\n const encodedUrl = urlParams.get(\"url\");\n if (encodedUrl) {\n originalUrl = decodeURIComponent(encodedUrl);\n }\n }\n } catch (error) {\n console.warn(\"Failed to decode video URL:\", error);\n }\n\n return Decoration.replace({\n widget: new PlaceholderWidget(\n titleAttr || \"Video\", // Display title from data-title\n {\n tag: \"video\",\n url: originalUrl, // Decoded original Bilibili URL\n title: titleAttr, // title from data-title attribute\n fixedOutput,\n },\n \"tag-video\",\n SelectedOption.Video,\n view\n ),\n });\n },\n});\n\nconst VideoPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = biliUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n this.placeholders = biliUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default VideoPlaceholder;\n"],"names":["biliVideoContextRegexp","extractAttrValue","markup","attr","escapedAttr","regexp","match","decodeHtmlEntities","value","biliUrlMatcher","MatchDecorator","view","source","iframeMarkup","unwrapFixedOutput","fixedOutput","srcValueRaw","titleAttrRaw","dataUrlAttrRaw","titleAttr","decodedSrcValue","storedDataUrl","originalUrl","encodedUrl","error","Decoration","PlaceholderWidget","SelectedOption","VideoPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;AAYA,MAAMA,IACJ,+GAEIC,IAAmB,CAACC,GAAgBC,MAAiB;AACzD,QAAMC,IAAcD,EAAK,QAAQ,uBAAuB,MAAM,GACxDE,IAAS,IAAI,OAAO,GAAGD,CAAW,cAAc,GAAG,GACnDE,IAAQJ,EAAO,MAAMG,CAAM;AACjC,SAAOC,IAAQA,EAAM,CAAC,IAAI;AAC5B,GAEMC,IAAqB,CAACC,MAC1BA,EAAM,QAAQ,WAAW,GAAG,EAAE,QAAQ,UAAU,GAAG,GAE/CC,IAAiB,IAAIC,EAAe;AAAA,EACxC,QAAQV;AAAA,EACR,YAAY,CAACM,GAAOK,MAAS;AAC3B,UAAMC,IAASN,IAAQ,CAAC,KAAK,IACvBO,IAAeC,EAAkBF,CAAM,GACvCG,IAAc,UAAU,KAAKH,CAAM,GACn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ources":["../../../../src/components/MarkdownFlowEditor/plugins/VideoPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst biliVideoContextRegexp =\n /===\\s*<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>\\s*===|<iframe\\s[^>]*data-tag=\"video\"[^>]*><\\/iframe>/gi;\n\nconst extractAttrValue = (markup: string, attr: string) => {\n const escapedAttr = attr.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexp = new RegExp(`${escapedAttr}=\"([^\"]*)\"`, \"i\");\n const match = markup.match(regexp);\n return match ? match[1] : \"\";\n};\n\nconst decodeHtmlEntities = (value: string) =>\n value.replace(/&quot;/g, '\"').replace(/&amp;/g, \"&\");\n\nconst biliUrlMatcher = new MatchDecorator({\n regexp: biliVideoContextRegexp,\n decoration: (match, view) => {\n const source = match?.[0] || \"\";\n const iframeMarkup = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n const srcValueRaw = extractAttrValue(iframeMarkup, \"src\");\n const titleAttrRaw = extractAttrValue(iframeMarkup, \"data-title\");\n const dataUrlAttrRaw = extractAttrValue(iframeMarkup, \"data-url\");\n const titleAttr = titleAttrRaw ? decodeHtmlEntities(titleAttrRaw) : \"\";\n const decodedSrcValue = srcValueRaw ? decodeHtmlEntities(srcValueRaw) : \"\";\n const storedDataUrl = dataUrlAttrRaw\n ? decodeHtmlEntities(dataUrlAttrRaw)\n : \"\";\n // Extract and decode the original URL from stored attributes or API endpoint\n let originalUrl = storedDataUrl || decodedSrcValue;\n try {\n if (!storedDataUrl && decodedSrcValue) {\n const urlParams = new URLSearchParams(new URL(decodedSrcValue).search);\n const encodedUrl = urlParams.get(\"url\");\n if (encodedUrl) {\n originalUrl = decodeURIComponent(encodedUrl);\n }\n }\n } catch (error) {\n console.warn(\"Failed to decode video URL:\", error);\n }\n\n return Decoration.replace({\n widget: new PlaceholderWidget(\n titleAttr || view.state.facet(mediaPlaceholderLabels).video,\n {\n tag: \"video\",\n url: originalUrl, // Decoded original Bilibili URL\n title: titleAttr, // title from data-title attribute\n fixedOutput,\n },\n \"tag-video\",\n SelectedOption.Video,\n view\n ),\n });\n },\n});\n\nconst VideoPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n constructor(view: EditorView) {\n this.placeholders = biliUrlMatcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = biliUrlMatcher.createDeco(update.view);\n return;\n }\n this.placeholders = biliUrlMatcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default VideoPlaceholder;\n"],"names":["biliVideoContextRegexp","extractAttrValue","markup","attr","escapedAttr","regexp","match","decodeHtmlEntities","value","biliUrlMatcher","MatchDecorator","view","source","iframeMarkup","unwrapFixedOutput","fixedOutput","srcValueRaw","titleAttrRaw","dataUrlAttrRaw","titleAttr","decodedSrcValue","storedDataUrl","originalUrl","encodedUrl","error","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","VideoPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;;AAaA,MAAMA,IACJ,+GAEIC,IAAmB,CAACC,GAAgBC,MAAiB;AACzD,QAAMC,IAAcD,EAAK,QAAQ,uBAAuB,MAAM,GACxDE,IAAS,IAAI,OAAO,GAAGD,CAAW,cAAc,GAAG,GACnDE,IAAQJ,EAAO,MAAMG,CAAM;AACjC,SAAOC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;AAAA,IACpD;AAAA,IACA,OAAOoB,GAAoB;AACzB,UACEA,EAAO,WAAW,MAAMJ,CAAsB,MAC9CI,EAAO,MAAM,MAAMJ,CAAsB,GACzC;AACA,aAAK,eAAelB,EAAe,WAAWsB,EAAO,IAAI;AACzD;AAAA,MACF;AACA,WAAK,eAAetB,EAAe,WAAWsB,GAAQ,KAAK,YAAY;AAAA,IACzE;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACvB,MACnBA,EAAK,OAAOsB,CAAM,GAAG,gBAAgBR,EAAW,IACxD;AAAA,EAAA;AAEP;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../node_modules/@codemirror/state/dist/index.cjs"),i=require("../editorI18n.cjs"),e=i.getEditorLocaleMessages(),l={image:e.imageDefaultTitle,video:e.videoDefaultTitle},o=a.Facet.define({combine:t=>t[0]??l});exports.mediaPlaceholderLabels=o;
2
+ //# sourceMappingURL=mediaPlaceholderLabels.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaPlaceholderLabels.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.ts"],"sourcesContent":["import { Facet } from \"@codemirror/state\";\nimport { getEditorLocaleMessages } from \"../editorI18n\";\n\ninterface MediaPlaceholderLabels {\n image: string;\n video: string;\n}\n\nconst defaultMessages = getEditorLocaleMessages();\nconst defaultLabels: MediaPlaceholderLabels = {\n image: defaultMessages.imageDefaultTitle,\n video: defaultMessages.videoDefaultTitle,\n};\n\nexport const mediaPlaceholderLabels: Facet<\n MediaPlaceholderLabels,\n MediaPlaceholderLabels\n> = Facet.define({\n combine: (values) => values[0] ?? defaultLabels,\n});\n"],"names":["defaultMessages","getEditorLocaleMessages","defaultLabels","mediaPlaceholderLabels","Facet","values"],"mappings":"yLAQMA,EAAkBC,EAAAA,wBAAA,EAClBC,EAAwC,CAC5C,MAAOF,EAAgB,kBACvB,MAAOA,EAAgB,iBACzB,EAEaG,EAGTC,EAAAA,MAAM,OAAO,CACf,QAAUC,GAAWA,EAAO,CAAC,GAAKH,CACpC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Facet } from '@codemirror/state';
2
+ interface MediaPlaceholderLabels {
3
+ image: string;
4
+ video: string;
5
+ }
6
+ export declare const mediaPlaceholderLabels: Facet<MediaPlaceholderLabels, MediaPlaceholderLabels>;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Facet as a } from "../../../node_modules/@codemirror/state/dist/index.es.js";
2
+ import { getEditorLocaleMessages as o } from "../editorI18n.es.js";
3
+ const e = o(), i = {
4
+ image: e.imageDefaultTitle,
5
+ video: e.videoDefaultTitle
6
+ }, d = a.define({
7
+ combine: (t) => t[0] ?? i
8
+ });
9
+ export {
10
+ d as mediaPlaceholderLabels
11
+ };
12
+ //# sourceMappingURL=mediaPlaceholderLabels.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaPlaceholderLabels.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/mediaPlaceholderLabels.ts"],"sourcesContent":["import { Facet } from \"@codemirror/state\";\nimport { getEditorLocaleMessages } from \"../editorI18n\";\n\ninterface MediaPlaceholderLabels {\n image: string;\n video: string;\n}\n\nconst defaultMessages = getEditorLocaleMessages();\nconst defaultLabels: MediaPlaceholderLabels = {\n image: defaultMessages.imageDefaultTitle,\n video: defaultMessages.videoDefaultTitle,\n};\n\nexport const mediaPlaceholderLabels: Facet<\n MediaPlaceholderLabels,\n MediaPlaceholderLabels\n> = Facet.define({\n combine: (values) => values[0] ?? defaultLabels,\n});\n"],"names":["defaultMessages","getEditorLocaleMessages","defaultLabels","mediaPlaceholderLabels","Facet","values"],"mappings":";;AAQA,MAAMA,IAAkBC,EAAA,GAClBC,IAAwC;AAAA,EAC5C,OAAOF,EAAgB;AAAA,EACvB,OAAOA,EAAgB;AACzB,GAEaG,IAGTC,EAAM,OAAO;AAAA,EACf,SAAS,CAACC,MAAWA,EAAO,CAAC,KAAKH;AACpC,CAAC;"}
@@ -1,5 +1,5 @@
1
1
  import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
2
- import { SelectedOption } from './types';
2
+ import { SelectedOption } from './types.js';
3
3
  declare const createVariableExpressionRegexp: () => RegExp;
4
4
  declare const isValidVariableName: (name: string) => boolean;
5
5
  declare const extractVariableNames: (content: string) => string[];
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../../_virtual/jsx-runtime.cjs"),i=require("react"),R=require("../../lib/utils.cjs"),y=require("../ContentRender/utils/presentation-scaling.cjs"),p="--mdf-slide-font-size",m=typeof window>"u"?i.useEffect:i.useLayoutEffect,z=(o,c)=>o.contentHeight===c.contentHeight&&o.contentWidth===c.contentWidth&&o.mode===c.mode&&o.viewportHeight===c.viewportHeight&&o.viewportWidth===c.viewportWidth,H=({children:o,className:c,mode:e,...E})=>{const w=i.useRef(null),d=i.useRef(null),s=i.useRef(null),v=i.useRef(!1),f=i.useRef(null),h=i.useCallback(()=>{const r=w.current,t=d.current;if(e==="disabled"||!r||!t||v.current)return;const n={height:r.clientHeight,width:r.clientWidth};if(n.height<=0||n.width<=0)return;const u={contentHeight:t.scrollHeight,contentWidth:t.scrollWidth,mode:e,viewportHeight:n.height,viewportWidth:n.width},a=f.current;if(!(a&&z(a,u))){v.current=!0;try{const S=e==="fit"?y.fitPresentationFontSize({viewport:n,measure:F=>(t.style.setProperty(p,`${F}px`),{height:t.scrollHeight,width:t.scrollWidth})}):y.resolvePresentationBaseFontSize(n);t.style.setProperty(p,`${S}px`),t.dataset.markdownSlideFontSize=String(S),f.current={contentHeight:t.scrollHeight,contentWidth:t.scrollWidth,mode:e,viewportHeight:n.height,viewportWidth:n.width}}finally{v.current=!1}}},[e]),l=i.useCallback(()=>{e==="disabled"||s.current!==null||(s.current=window.requestAnimationFrame(()=>{s.current=null,h()}))},[h,e]);m(()=>{s.current!==null&&(window.cancelAnimationFrame(s.current),s.current=null);const r=d.current;if(r){if(e==="disabled"){r.style.removeProperty(p),delete r.dataset.markdownSlideFontSize,f.current=null;return}h()}},[h,e]),i.useEffect(()=>{const r=w.current,t=d.current;if(e==="disabled"||!r||!t)return;const n=typeof ResizeObserver>"u"?null:new ResizeObserver(l);n?.observe(r);const u=()=>{f.current=null,l()},a=e==="fit"&&typeof MutationObserver<"u"?new MutationObserver(u):null;return e==="fit"&&(n?.observe(t),a?.observe(t,{childList:!0,characterData:!0,subtree:!0}),t.addEventListener("load",u,!0)),window.addEventListener("resize",l),l(),()=>{n?.disconnect(),a?.disconnect(),e==="fit"&&t.removeEventListener("load",u,!0),window.removeEventListener("resize",l),s.current!==null&&(window.cancelAnimationFrame(s.current),s.current=null)}},[e,l]);const g=e!=="disabled";return b.jsxRuntimeExports.jsx("div",{ref:w,className:R.cn(c,g&&"slide-markdown-scaling"),"data-markdown-slide-scaling":g?e:void 0,...E,children:b.jsxRuntimeExports.jsx("div",{ref:d,className:R.cn("slide-markdown-scaling__content flex w-full flex-col gap-4",e!=="fit"&&"slide-markdown-scaling__content--contents"),children:o})})};exports.default=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("react/jsx-runtime"),i=require("react"),R=require("../../lib/utils.cjs"),y=require("../ContentRender/utils/presentation-scaling.cjs"),p="--mdf-slide-font-size",E=typeof window>"u"?i.useEffect:i.useLayoutEffect,H=(o,c)=>o.contentHeight===c.contentHeight&&o.contentWidth===c.contentWidth&&o.mode===c.mode&&o.viewportHeight===c.viewportHeight&&o.viewportWidth===c.viewportWidth,W=({children:o,className:c,mode:e,...F})=>{const w=i.useRef(null),d=i.useRef(null),s=i.useRef(null),v=i.useRef(!1),f=i.useRef(null),h=i.useCallback(()=>{const r=w.current,t=d.current;if(e==="disabled"||!r||!t||v.current)return;const n={height:r.clientHeight,width:r.clientWidth};if(n.height<=0||n.width<=0)return;const u={contentHeight:t.scrollHeight,contentWidth:t.scrollWidth,mode:e,viewportHeight:n.height,viewportWidth:n.width},a=f.current;if(!(a&&H(a,u))){v.current=!0;try{const S=e==="fit"?y.fitPresentationFontSize({viewport:n,measure:z=>(t.style.setProperty(p,`${z}px`),{height:t.scrollHeight,width:t.scrollWidth})}):y.resolvePresentationBaseFontSize(n);t.style.setProperty(p,`${S}px`),t.dataset.markdownSlideFontSize=String(S),f.current={contentHeight:t.scrollHeight,contentWidth:t.scrollWidth,mode:e,viewportHeight:n.height,viewportWidth:n.width}}finally{v.current=!1}}},[e]),l=i.useCallback(()=>{e==="disabled"||s.current!==null||(s.current=window.requestAnimationFrame(()=>{s.current=null,h()}))},[h,e]);E(()=>{s.current!==null&&(window.cancelAnimationFrame(s.current),s.current=null);const r=d.current;if(r){if(e==="disabled"){r.style.removeProperty(p),delete r.dataset.markdownSlideFontSize,f.current=null;return}h()}},[h,e]),i.useEffect(()=>{const r=w.current,t=d.current;if(e==="disabled"||!r||!t)return;const n=typeof ResizeObserver>"u"?null:new ResizeObserver(l);n?.observe(r);const u=()=>{f.current=null,l()},a=e==="fit"&&typeof MutationObserver<"u"?new MutationObserver(u):null;return e==="fit"&&(n?.observe(t),a?.observe(t,{childList:!0,characterData:!0,subtree:!0}),t.addEventListener("load",u,!0)),window.addEventListener("resize",l),l(),()=>{n?.disconnect(),a?.disconnect(),e==="fit"&&t.removeEventListener("load",u,!0),window.removeEventListener("resize",l),s.current!==null&&(window.cancelAnimationFrame(s.current),s.current=null)}},[e,l]);const g=e!=="disabled";return b.jsx("div",{ref:w,className:R.cn(c,g&&"slide-markdown-scaling"),"data-markdown-slide-scaling":g?e:void 0,...F,children:b.jsx("div",{ref:d,className:R.cn("slide-markdown-scaling__content flex w-full flex-col gap-4",e!=="fit"&&"slide-markdown-scaling__content--contents"),children:o})})};exports.default=W;
2
2
  //# sourceMappingURL=MarkdownSlideScaling.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownSlideScaling.cjs","sources":["../../../src/components/Slide/MarkdownSlideScaling.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport {\n fitPresentationFontSize,\n resolvePresentationBaseFontSize,\n} from \"../ContentRender/utils/presentation-scaling\";\nimport type { MarkdownScalingMode } from \"./utils/markdownScaling\";\n\nconst SLIDE_FONT_SIZE_PROPERTY = \"--mdf-slide-font-size\";\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\ninterface MarkdownFitSnapshot {\n contentHeight: number;\n contentWidth: number;\n mode: MarkdownScalingMode;\n viewportHeight: number;\n viewportWidth: number;\n}\n\nconst areFitSnapshotsEqual = (\n left: MarkdownFitSnapshot,\n right: MarkdownFitSnapshot\n) =>\n left.contentHeight === right.contentHeight &&\n left.contentWidth === right.contentWidth &&\n left.mode === right.mode &&\n left.viewportHeight === right.viewportHeight &&\n left.viewportWidth === right.viewportWidth;\n\nexport interface MarkdownSlideScalingProps\n extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Controls whether Markdown content is fitted, base-scaled, or unscaled. */\n mode: MarkdownScalingMode;\n}\n\n/**\n * Fits all Markdown elements in one logical slide with a shared font-size.\n * Keeping this boundary outside ContentRender lets accumulated title, text,\n * table, and code elements participate in the same presentation layout.\n */\nconst MarkdownSlideScaling: React.FC<MarkdownSlideScalingProps> = ({\n children,\n className,\n mode,\n ...props\n}) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const fitFrameRef = useRef<number | null>(null);\n const isFittingRef = useRef(false);\n const lastFitSnapshotRef = useRef<MarkdownFitSnapshot | null>(null);\n\n const fitContent = useCallback(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content || isFittingRef.current) {\n return;\n }\n\n const viewportSize = {\n height: viewport.clientHeight,\n width: viewport.clientWidth,\n };\n\n if (viewportSize.height <= 0 || viewportSize.width <= 0) {\n return;\n }\n\n const currentSnapshot: MarkdownFitSnapshot = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n const lastSnapshot = lastFitSnapshotRef.current;\n\n if (lastSnapshot && areFitSnapshotsEqual(lastSnapshot, currentSnapshot)) {\n return;\n }\n\n isFittingRef.current = true;\n\n try {\n const fontSize =\n mode === \"fit\"\n ? fitPresentationFontSize({\n viewport: viewportSize,\n measure: (candidateFontSize) => {\n content.style.setProperty(\n SLIDE_FONT_SIZE_PROPERTY,\n `${candidateFontSize}px`\n );\n\n // Read after the CSS variable update so wrapping and em-based\n // styles are included in the next compression step.\n return {\n height: content.scrollHeight,\n width: content.scrollWidth,\n };\n },\n })\n : resolvePresentationBaseFontSize(viewportSize);\n\n content.style.setProperty(SLIDE_FONT_SIZE_PROPERTY, `${fontSize}px`);\n content.dataset.markdownSlideFontSize = String(fontSize);\n lastFitSnapshotRef.current = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n } finally {\n isFittingRef.current = false;\n }\n }, [mode]);\n\n const scheduleFit = useCallback(() => {\n if (mode === \"disabled\" || fitFrameRef.current !== null) {\n return;\n }\n\n fitFrameRef.current = window.requestAnimationFrame(() => {\n fitFrameRef.current = null;\n fitContent();\n });\n }, [fitContent, mode]);\n\n useIsomorphicLayoutEffect(() => {\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n\n const content = contentRef.current;\n\n if (!content) {\n return;\n }\n\n if (mode === \"disabled\") {\n content.style.removeProperty(SLIDE_FONT_SIZE_PROPERTY);\n delete content.dataset.markdownSlideFontSize;\n lastFitSnapshotRef.current = null;\n return;\n }\n\n fitContent();\n }, [fitContent, mode]);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content) {\n return;\n }\n\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(scheduleFit);\n resizeObserver?.observe(viewport);\n\n const handleContentChange = () => {\n lastFitSnapshotRef.current = null;\n scheduleFit();\n };\n const mutationObserver =\n mode === \"fit\" && typeof MutationObserver !== \"undefined\"\n ? new MutationObserver(handleContentChange)\n : null;\n\n if (mode === \"fit\") {\n resizeObserver?.observe(content);\n mutationObserver?.observe(content, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n content.addEventListener(\"load\", handleContentChange, true);\n }\n\n window.addEventListener(\"resize\", scheduleFit);\n scheduleFit();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n\n if (mode === \"fit\") {\n content.removeEventListener(\"load\", handleContentChange, true);\n }\n\n window.removeEventListener(\"resize\", scheduleFit);\n\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n };\n }, [mode, scheduleFit]);\n\n const isScaling = mode !== \"disabled\";\n\n return (\n <div\n ref={viewportRef}\n className={cn(className, isScaling && \"slide-markdown-scaling\")}\n data-markdown-slide-scaling={isScaling ? mode : undefined}\n {...props}\n >\n <div\n ref={contentRef}\n className={cn(\n \"slide-markdown-scaling__content flex w-full flex-col gap-4\",\n mode !== \"fit\" && \"slide-markdown-scaling__content--contents\"\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default MarkdownSlideScaling;\n"],"names":["SLIDE_FONT_SIZE_PROPERTY","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","areFitSnapshotsEqual","left","right","MarkdownSlideScaling","children","className","mode","props","viewportRef","useRef","contentRef","fitFrameRef","isFittingRef","lastFitSnapshotRef","fitContent","useCallback","viewport","content","viewportSize","currentSnapshot","lastSnapshot","fontSize","fitPresentationFontSize","candidateFontSize","resolvePresentationBaseFontSize","scheduleFit","resizeObserver","handleContentChange","mutationObserver","isScaling","jsx","cn"],"mappings":"+QASMA,EAA2B,wBAC3BC,EACJ,OAAO,OAAW,IAAcC,EAAAA,UAAYC,EAAAA,gBAUxCC,EAAuB,CAC3BC,EACAC,IAEAD,EAAK,gBAAkBC,EAAM,eAC7BD,EAAK,eAAiBC,EAAM,cAC5BD,EAAK,OAASC,EAAM,MACpBD,EAAK,iBAAmBC,EAAM,gBAC9BD,EAAK,gBAAkBC,EAAM,cAazBC,EAA4D,CAAC,CACjE,SAAAC,EACA,UAAAC,EACA,KAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAcC,EAAAA,OAAuB,IAAI,EACzCC,EAAaD,EAAAA,OAAuB,IAAI,EACxCE,EAAcF,EAAAA,OAAsB,IAAI,EACxCG,EAAeH,EAAAA,OAAO,EAAK,EAC3BI,EAAqBJ,EAAAA,OAAmC,IAAI,EAE5DK,EAAaC,EAAAA,YAAY,IAAM,CACnC,MAAMC,EAAWR,EAAY,QACvBS,EAAUP,EAAW,QAE3B,GAAIJ,IAAS,YAAc,CAACU,GAAY,CAACC,GAAWL,EAAa,QAC/D,OAGF,MAAMM,EAAe,CACnB,OAAQF,EAAS,aACjB,MAAOA,EAAS,WAAA,EAGlB,GAAIE,EAAa,QAAU,GAAKA,EAAa,OAAS,EACpD,OAGF,MAAMC,EAAuC,CAC3C,cAAeF,EAAQ,aACvB,aAAcA,EAAQ,YACtB,KAAAX,EACA,eAAgBY,EAAa,OAC7B,cAAeA,EAAa,KAAA,EAExBE,EAAeP,EAAmB,QAExC,GAAI,EAAAO,GAAgBpB,EAAqBoB,EAAcD,CAAe,GAItE,CAAAP,EAAa,QAAU,GAEvB,GAAI,CACF,MAAMS,EACJf,IAAS,MACLgB,0BAAwB,CACtB,SAAUJ,EACV,QAAUK,IACRN,EAAQ,MAAM,YACZrB,EACA,GAAG2B,CAAiB,IAAA,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AAmB,EACxC,KAEN,OAAIrB,IAAS,QACXoB,GAAgB,QAAQT,CAAO,EAC/BW,GAAkB,QAAQX,EAAS,CACjC,UAAW,GACX,cAAe,GACf,QAAS,EAAA,CACV,EACDA,EAAQ,iBAAiB,OAAQU,EAAqB,EAAI,GAG5D,OAAO,iBAAiB,SAAUF,CAAW,EAC7CA,EAAA,EAEO,IAAM,CACXC,GAAgB,WAAA,EAChBE,GAAkB,WAAA,EAEdtB,IAAS,OACXW,EAAQ,oBAAoB,OAAQU,EAAqB,EAAI,EAG/D,OAAO,oBAAoB,SAAUF,CAAW,EAE5Cd,EAAY,UAAY,OAC1B,OAAO,qBAAqBA,EAAY,OAAO,EAC/CA,EAAY,QAAU,KAE1B,CACF,EAAG,CAACL,EAAMmB,CAAW,CAAC,EAEtB,MAAMI,EAAYvB,IAAS,WAE3B,OACEwB,EAAAA,kBAAAA,IAAC,MAAA,CACC,IAAKtB,EACL,UAAWuB,EAAAA,GAAG1B,EAAWwB,GAAa,wBAAwB,EAC9D,8BAA6BA,EAAYvB,EAAO,OAC/C,GAAGC,EAEJ,SAAAuB,EAAAA,kBAAAA,IAAC,MAAA,CACC,IAAKpB,EACL,UAAWqB,EAAAA,GACT,6DACAzB,IAAS,OAAS,2CAAA,EAGnB,SAAAF,CAAA,CAAA,CACH,CAAA,CAGN"}
1
+ {"version":3,"file":"MarkdownSlideScaling.cjs","sources":["../../../src/components/Slide/MarkdownSlideScaling.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport {\n fitPresentationFontSize,\n resolvePresentationBaseFontSize,\n} from \"../ContentRender/utils/presentation-scaling\";\nimport type { MarkdownScalingMode } from \"./utils/markdownScaling\";\n\nconst SLIDE_FONT_SIZE_PROPERTY = \"--mdf-slide-font-size\";\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\ninterface MarkdownFitSnapshot {\n contentHeight: number;\n contentWidth: number;\n mode: MarkdownScalingMode;\n viewportHeight: number;\n viewportWidth: number;\n}\n\nconst areFitSnapshotsEqual = (\n left: MarkdownFitSnapshot,\n right: MarkdownFitSnapshot\n) =>\n left.contentHeight === right.contentHeight &&\n left.contentWidth === right.contentWidth &&\n left.mode === right.mode &&\n left.viewportHeight === right.viewportHeight &&\n left.viewportWidth === right.viewportWidth;\n\nexport interface MarkdownSlideScalingProps\n extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Controls whether Markdown content is fitted, base-scaled, or unscaled. */\n mode: MarkdownScalingMode;\n}\n\n/**\n * Fits all Markdown elements in one logical slide with a shared font-size.\n * Keeping this boundary outside ContentRender lets accumulated title, text,\n * table, and code elements participate in the same presentation layout.\n */\nconst MarkdownSlideScaling: React.FC<MarkdownSlideScalingProps> = ({\n children,\n className,\n mode,\n ...props\n}) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const fitFrameRef = useRef<number | null>(null);\n const isFittingRef = useRef(false);\n const lastFitSnapshotRef = useRef<MarkdownFitSnapshot | null>(null);\n\n const fitContent = useCallback(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content || isFittingRef.current) {\n return;\n }\n\n const viewportSize = {\n height: viewport.clientHeight,\n width: viewport.clientWidth,\n };\n\n if (viewportSize.height <= 0 || viewportSize.width <= 0) {\n return;\n }\n\n const currentSnapshot: MarkdownFitSnapshot = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n const lastSnapshot = lastFitSnapshotRef.current;\n\n if (lastSnapshot && areFitSnapshotsEqual(lastSnapshot, currentSnapshot)) {\n return;\n }\n\n isFittingRef.current = true;\n\n try {\n const fontSize =\n mode === \"fit\"\n ? fitPresentationFontSize({\n viewport: viewportSize,\n measure: (candidateFontSize) => {\n content.style.setProperty(\n SLIDE_FONT_SIZE_PROPERTY,\n `${candidateFontSize}px`\n );\n\n // Read after the CSS variable update so wrapping and em-based\n // styles are included in the next compression step.\n return {\n height: content.scrollHeight,\n width: content.scrollWidth,\n };\n },\n })\n : resolvePresentationBaseFontSize(viewportSize);\n\n content.style.setProperty(SLIDE_FONT_SIZE_PROPERTY, `${fontSize}px`);\n content.dataset.markdownSlideFontSize = String(fontSize);\n lastFitSnapshotRef.current = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n } finally {\n isFittingRef.current = false;\n }\n }, [mode]);\n\n const scheduleFit = useCallback(() => {\n if (mode === \"disabled\" || fitFrameRef.current !== null) {\n return;\n }\n\n fitFrameRef.current = window.requestAnimationFrame(() => {\n fitFrameRef.current = null;\n fitContent();\n });\n }, [fitContent, mode]);\n\n useIsomorphicLayoutEffect(() => {\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n\n const content = contentRef.current;\n\n if (!content) {\n return;\n }\n\n if (mode === \"disabled\") {\n content.style.removeProperty(SLIDE_FONT_SIZE_PROPERTY);\n delete content.dataset.markdownSlideFontSize;\n lastFitSnapshotRef.current = null;\n return;\n }\n\n fitContent();\n }, [fitContent, mode]);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content) {\n return;\n }\n\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(scheduleFit);\n resizeObserver?.observe(viewport);\n\n const handleContentChange = () => {\n lastFitSnapshotRef.current = null;\n scheduleFit();\n };\n const mutationObserver =\n mode === \"fit\" && typeof MutationObserver !== \"undefined\"\n ? new MutationObserver(handleContentChange)\n : null;\n\n if (mode === \"fit\") {\n resizeObserver?.observe(content);\n mutationObserver?.observe(content, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n content.addEventListener(\"load\", handleContentChange, true);\n }\n\n window.addEventListener(\"resize\", scheduleFit);\n scheduleFit();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n\n if (mode === \"fit\") {\n content.removeEventListener(\"load\", handleContentChange, true);\n }\n\n window.removeEventListener(\"resize\", scheduleFit);\n\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n };\n }, [mode, scheduleFit]);\n\n const isScaling = mode !== \"disabled\";\n\n return (\n <div\n ref={viewportRef}\n className={cn(className, isScaling && \"slide-markdown-scaling\")}\n data-markdown-slide-scaling={isScaling ? mode : undefined}\n {...props}\n >\n <div\n ref={contentRef}\n className={cn(\n \"slide-markdown-scaling__content flex w-full flex-col gap-4\",\n mode !== \"fit\" && \"slide-markdown-scaling__content--contents\"\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default MarkdownSlideScaling;\n"],"names":["SLIDE_FONT_SIZE_PROPERTY","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","areFitSnapshotsEqual","left","right","MarkdownSlideScaling","children","className","mode","props","viewportRef","useRef","contentRef","fitFrameRef","isFittingRef","lastFitSnapshotRef","fitContent","useCallback","viewport","content","viewportSize","currentSnapshot","lastSnapshot","fontSize","fitPresentationFontSize","candidateFontSize","resolvePresentationBaseFontSize","scheduleFit","resizeObserver","handleContentChange","mutationObserver","isScaling","jsx","cn"],"mappings":"kQASMA,EAA2B,wBAC3BC,EACJ,OAAO,OAAW,IAAcC,EAAAA,UAAYC,EAAAA,gBAUxCC,EAAuB,CAC3BC,EACAC,IAEAD,EAAK,gBAAkBC,EAAM,eAC7BD,EAAK,eAAiBC,EAAM,cAC5BD,EAAK,OAASC,EAAM,MACpBD,EAAK,iBAAmBC,EAAM,gBAC9BD,EAAK,gBAAkBC,EAAM,cAazBC,EAA4D,CAAC,CACjE,SAAAC,EACA,UAAAC,EACA,KAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,E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E1B,CACF,EAAG,CAACL,EAAMmB,CAAW,CAAC,EAEtB,MAAMI,EAAYvB,IAAS,WAE3B,OACEwB,EAAAA,IAAC,MAAA,CACC,IAAKtB,EACL,UAAWuB,EAAAA,GAAG1B,EAAWwB,GAAa,wBAAwB,EAC9D,8BAA6BA,EAAYvB,EAAO,OAC/C,GAAGC,EAEJ,SAAAuB,EAAAA,IAAC,MAAA,CACC,IAAKpB,EACL,UAAWqB,EAAAA,GACT,6DACAzB,IAAS,OAAS,2CAAA,EAGnB,SAAAF,CAAA,CAAA,CACH,CAAA,CAGN"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { MarkdownScalingMode } from './utils/markdownScaling';
2
+ import { MarkdownScalingMode } from './utils/markdownScaling.js';
3
3
  export interface MarkdownSlideScalingProps extends React.ComponentPropsWithoutRef<"div"> {
4
4
  /** Controls whether Markdown content is fitted, base-scaled, or unscaled. */
5
5
  mode: MarkdownScalingMode;
@@ -1,16 +1,16 @@
1
- import { j as m } from "../../_virtual/jsx-runtime.es.js";
2
- import { useRef as u, useCallback as b, useEffect as F, useLayoutEffect as H } from "react";
1
+ import { jsx as b } from "react/jsx-runtime";
2
+ import { useRef as u, useCallback as m, useEffect as F, useLayoutEffect as W } from "react";
3
3
  import { cn as y } from "../../lib/utils.es.js";
4
- import { fitPresentationFontSize as W, resolvePresentationBaseFontSize as R } from "../ContentRender/utils/presentation-scaling.es.js";
5
- const v = "--mdf-slide-font-size", x = typeof window > "u" ? F : H, k = (o, s) => o.contentHeight === s.contentHeight && o.contentWidth === s.contentWidth && o.mode === s.mode && o.viewportHeight === s.viewportHeight && o.viewportWidth === s.viewportWidth, j = ({
4
+ import { fitPresentationFontSize as E, resolvePresentationBaseFontSize as R } from "../ContentRender/utils/presentation-scaling.es.js";
5
+ const p = "--mdf-slide-font-size", k = typeof window > "u" ? F : W, L = (o, s) => o.contentHeight === s.contentHeight && o.contentWidth === s.contentWidth && o.mode === s.mode && o.viewportHeight === s.viewportHeight && o.viewportWidth === s.viewportWidth, C = ({
6
6
  children: o,
7
7
  className: s,
8
8
  mode: t,
9
9
  ...z
10
10
  }) => {
11
- const w = u(null), d = u(null), i = u(null), p = u(!1), f = u(null), h = b(() => {
11
+ const w = u(null), d = u(null), i = u(null), v = u(!1), f = u(null), h = m(() => {
12
12
  const r = w.current, e = d.current;
13
- if (t === "disabled" || !r || !e || p.current)
13
+ if (t === "disabled" || !r || !e || v.current)
14
14
  return;
15
15
  const n = {
16
16
  height: r.clientHeight,
@@ -25,20 +25,20 @@ const v = "--mdf-slide-font-size", x = typeof window > "u" ? F : H, k = (o, s) =
25
25
  viewportHeight: n.height,
26
26
  viewportWidth: n.width
27
27
  }, a = f.current;
28
- if (!(a && k(a, l))) {
29
- p.current = !0;
28
+ if (!(a && L(a, l))) {
29
+ v.current = !0;
30
30
  try {
31
- const S = t === "fit" ? W({
31
+ const S = t === "fit" ? E({
32
32
  viewport: n,
33
- measure: (E) => (e.style.setProperty(
34
- v,
35
- `${E}px`
33
+ measure: (H) => (e.style.setProperty(
34
+ p,
35
+ `${H}px`
36
36
  ), {
37
37
  height: e.scrollHeight,
38
38
  width: e.scrollWidth
39
39
  })
40
40
  }) : R(n);
41
- e.style.setProperty(v, `${S}px`), e.dataset.markdownSlideFontSize = String(S), f.current = {
41
+ e.style.setProperty(p, `${S}px`), e.dataset.markdownSlideFontSize = String(S), f.current = {
42
42
  contentHeight: e.scrollHeight,
43
43
  contentWidth: e.scrollWidth,
44
44
  mode: t,
@@ -46,20 +46,20 @@ const v = "--mdf-slide-font-size", x = typeof window > "u" ? F : H, k = (o, s) =
46
46
  viewportWidth: n.width
47
47
  };
48
48
  } finally {
49
- p.current = !1;
49
+ v.current = !1;
50
50
  }
51
51
  }
52
- }, [t]), c = b(() => {
52
+ }, [t]), c = m(() => {
53
53
  t === "disabled" || i.current !== null || (i.current = window.requestAnimationFrame(() => {
54
54
  i.current = null, h();
55
55
  }));
56
56
  }, [h, t]);
57
- x(() => {
57
+ k(() => {
58
58
  i.current !== null && (window.cancelAnimationFrame(i.current), i.current = null);
59
59
  const r = d.current;
60
60
  if (r) {
61
61
  if (t === "disabled") {
62
- r.style.removeProperty(v), delete r.dataset.markdownSlideFontSize, f.current = null;
62
+ r.style.removeProperty(p), delete r.dataset.markdownSlideFontSize, f.current = null;
63
63
  return;
64
64
  }
65
65
  h();
@@ -82,14 +82,14 @@ const v = "--mdf-slide-font-size", x = typeof window > "u" ? F : H, k = (o, s) =
82
82
  };
83
83
  }, [t, c]);
84
84
  const g = t !== "disabled";
85
- return /* @__PURE__ */ m.jsx(
85
+ return /* @__PURE__ */ b(
86
86
  "div",
87
87
  {
88
88
  ref: w,
89
89
  className: y(s, g && "slide-markdown-scaling"),
90
90
  "data-markdown-slide-scaling": g ? t : void 0,
91
91
  ...z,
92
- children: /* @__PURE__ */ m.jsx(
92
+ children: /* @__PURE__ */ b(
93
93
  "div",
94
94
  {
95
95
  ref: d,
@@ -104,6 +104,6 @@ const v = "--mdf-slide-font-size", x = typeof window > "u" ? F : H, k = (o, s) =
104
104
  );
105
105
  };
106
106
  export {
107
- j as default
107
+ C as default
108
108
  };
109
109
  //# sourceMappingURL=MarkdownSlideScaling.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownSlideScaling.es.js","sources":["../../../src/components/Slide/MarkdownSlideScaling.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport {\n fitPresentationFontSize,\n resolvePresentationBaseFontSize,\n} from \"../ContentRender/utils/presentation-scaling\";\nimport type { MarkdownScalingMode } from \"./utils/markdownScaling\";\n\nconst SLIDE_FONT_SIZE_PROPERTY = \"--mdf-slide-font-size\";\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\ninterface MarkdownFitSnapshot {\n contentHeight: number;\n contentWidth: number;\n mode: MarkdownScalingMode;\n viewportHeight: number;\n viewportWidth: number;\n}\n\nconst areFitSnapshotsEqual = (\n left: MarkdownFitSnapshot,\n right: MarkdownFitSnapshot\n) =>\n left.contentHeight === right.contentHeight &&\n left.contentWidth === right.contentWidth &&\n left.mode === right.mode &&\n left.viewportHeight === right.viewportHeight &&\n left.viewportWidth === right.viewportWidth;\n\nexport interface MarkdownSlideScalingProps\n extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Controls whether Markdown content is fitted, base-scaled, or unscaled. */\n mode: MarkdownScalingMode;\n}\n\n/**\n * Fits all Markdown elements in one logical slide with a shared font-size.\n * Keeping this boundary outside ContentRender lets accumulated title, text,\n * table, and code elements participate in the same presentation layout.\n */\nconst MarkdownSlideScaling: React.FC<MarkdownSlideScalingProps> = ({\n children,\n className,\n mode,\n ...props\n}) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const fitFrameRef = useRef<number | null>(null);\n const isFittingRef = useRef(false);\n const lastFitSnapshotRef = useRef<MarkdownFitSnapshot | null>(null);\n\n const fitContent = useCallback(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content || isFittingRef.current) {\n return;\n }\n\n const viewportSize = {\n height: viewport.clientHeight,\n width: viewport.clientWidth,\n };\n\n if (viewportSize.height <= 0 || viewportSize.width <= 0) {\n return;\n }\n\n const currentSnapshot: MarkdownFitSnapshot = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n const lastSnapshot = lastFitSnapshotRef.current;\n\n if (lastSnapshot && areFitSnapshotsEqual(lastSnapshot, currentSnapshot)) {\n return;\n }\n\n isFittingRef.current = true;\n\n try {\n const fontSize =\n mode === \"fit\"\n ? fitPresentationFontSize({\n viewport: viewportSize,\n measure: (candidateFontSize) => {\n content.style.setProperty(\n SLIDE_FONT_SIZE_PROPERTY,\n `${candidateFontSize}px`\n );\n\n // Read after the CSS variable update so wrapping and em-based\n // styles are included in the next compression step.\n return {\n height: content.scrollHeight,\n width: content.scrollWidth,\n };\n },\n })\n : resolvePresentationBaseFontSize(viewportSize);\n\n content.style.setProperty(SLIDE_FONT_SIZE_PROPERTY, `${fontSize}px`);\n content.dataset.markdownSlideFontSize = String(fontSize);\n lastFitSnapshotRef.current = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n } finally {\n isFittingRef.current = false;\n }\n }, [mode]);\n\n const scheduleFit = useCallback(() => {\n if (mode === \"disabled\" || fitFrameRef.current !== null) {\n return;\n }\n\n fitFrameRef.current = window.requestAnimationFrame(() => {\n fitFrameRef.current = null;\n fitContent();\n });\n }, [fitContent, mode]);\n\n useIsomorphicLayoutEffect(() => {\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n\n const content = contentRef.current;\n\n if (!content) {\n return;\n }\n\n if (mode === \"disabled\") {\n content.style.removeProperty(SLIDE_FONT_SIZE_PROPERTY);\n delete content.dataset.markdownSlideFontSize;\n lastFitSnapshotRef.current = null;\n return;\n }\n\n fitContent();\n }, [fitContent, mode]);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content) {\n return;\n }\n\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(scheduleFit);\n resizeObserver?.observe(viewport);\n\n const handleContentChange = () => {\n lastFitSnapshotRef.current = null;\n scheduleFit();\n };\n const mutationObserver =\n mode === \"fit\" && typeof MutationObserver !== \"undefined\"\n ? new MutationObserver(handleContentChange)\n : null;\n\n if (mode === \"fit\") {\n resizeObserver?.observe(content);\n mutationObserver?.observe(content, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n content.addEventListener(\"load\", handleContentChange, true);\n }\n\n window.addEventListener(\"resize\", scheduleFit);\n scheduleFit();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n\n if (mode === \"fit\") {\n content.removeEventListener(\"load\", handleContentChange, true);\n }\n\n window.removeEventListener(\"resize\", scheduleFit);\n\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n };\n }, [mode, scheduleFit]);\n\n const isScaling = mode !== \"disabled\";\n\n return (\n <div\n ref={viewportRef}\n className={cn(className, isScaling && \"slide-markdown-scaling\")}\n data-markdown-slide-scaling={isScaling ? mode : undefined}\n {...props}\n >\n <div\n ref={contentRef}\n className={cn(\n \"slide-markdown-scaling__content flex w-full flex-col gap-4\",\n mode !== \"fit\" && \"slide-markdown-scaling__content--contents\"\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default MarkdownSlideScaling;\n"],"names":["SLIDE_FONT_SIZE_PROPERTY","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","areFitSnapshotsEqual","left","right","MarkdownSlideScaling","children","className","mode","props","viewportRef","useRef","contentRef","fitFrameRef","isFittingRef","lastFitSnapshotRef","fitContent","useCallback","viewport","content","viewportSize","currentSnapshot","lastSnapshot","fontSize","fitPresentationFontSize","candidateFontSize","resolvePresentationBaseFontSize","scheduleFit","resizeObserver","handleContentChange","mutationObserver","isScaling","jsx","cn"],"mappings":";;;;AASA,MAAMA,IAA2B,yBAC3BC,IACJ,OAAO,SAAW,MAAcC,IAAYC,GAUxCC,IAAuB,CAC3BC,GACAC,MAEAD,EAAK,kBAAkBC,EAAM,iBAC7BD,EAAK,iBAAiBC,EAAM,gBAC5BD,EAAK,SAASC,EAAM,QACpBD,EAAK,mBAAmBC,EAAM,kBAC9BD,EAAK,kBAAkBC,EAAM,eAazBC,IAA4D,CAAC;AAAA,EACjE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAcC,EAAuB,IAAI,GACzCC,IAAaD,EAAuB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C,GAAgB,WAAA,GAChBE,GAAkB,WAAA,GAEdtB,MAAS,SACXW,EAAQ,oBAAoB,QAAQU,GAAqB,EAAI,GAG/D,OAAO,oBAAoB,UAAUF,CAAW,GAE5Cd,EAAY,YAAY,SAC1B,OAAO,qBAAqBA,EAAY,OAAO,GAC/CA,EAAY,UAAU;AAAA,IAE1B;AAAA,EACF,GAAG,CAACL,GAAMmB,CAAW,CAAC;AAEtB,QAAMI,IAAYvB,MAAS;AAE3B,SACEwB,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKtB;AAAA,MACL,WAAWuB,EAAG1B,GAAWwB,KAAa,wBAAwB;AAAA,MAC9D,+BAA6BA,IAAYvB,IAAO;AAAA,MAC/C,GAAGC;AAAA,MAEJ,UAAAuB,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAKpB;AAAA,UACL,WAAWqB;AAAA,YACT;AAAA,YACAzB,MAAS,SAAS;AAAA,UAAA;AAAA,UAGnB,UAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"MarkdownSlideScaling.es.js","sources":["../../../src/components/Slide/MarkdownSlideScaling.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport {\n fitPresentationFontSize,\n resolvePresentationBaseFontSize,\n} from \"../ContentRender/utils/presentation-scaling\";\nimport type { MarkdownScalingMode } from \"./utils/markdownScaling\";\n\nconst SLIDE_FONT_SIZE_PROPERTY = \"--mdf-slide-font-size\";\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\ninterface MarkdownFitSnapshot {\n contentHeight: number;\n contentWidth: number;\n mode: MarkdownScalingMode;\n viewportHeight: number;\n viewportWidth: number;\n}\n\nconst areFitSnapshotsEqual = (\n left: MarkdownFitSnapshot,\n right: MarkdownFitSnapshot\n) =>\n left.contentHeight === right.contentHeight &&\n left.contentWidth === right.contentWidth &&\n left.mode === right.mode &&\n left.viewportHeight === right.viewportHeight &&\n left.viewportWidth === right.viewportWidth;\n\nexport interface MarkdownSlideScalingProps\n extends React.ComponentPropsWithoutRef<\"div\"> {\n /** Controls whether Markdown content is fitted, base-scaled, or unscaled. */\n mode: MarkdownScalingMode;\n}\n\n/**\n * Fits all Markdown elements in one logical slide with a shared font-size.\n * Keeping this boundary outside ContentRender lets accumulated title, text,\n * table, and code elements participate in the same presentation layout.\n */\nconst MarkdownSlideScaling: React.FC<MarkdownSlideScalingProps> = ({\n children,\n className,\n mode,\n ...props\n}) => {\n const viewportRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const fitFrameRef = useRef<number | null>(null);\n const isFittingRef = useRef(false);\n const lastFitSnapshotRef = useRef<MarkdownFitSnapshot | null>(null);\n\n const fitContent = useCallback(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content || isFittingRef.current) {\n return;\n }\n\n const viewportSize = {\n height: viewport.clientHeight,\n width: viewport.clientWidth,\n };\n\n if (viewportSize.height <= 0 || viewportSize.width <= 0) {\n return;\n }\n\n const currentSnapshot: MarkdownFitSnapshot = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n const lastSnapshot = lastFitSnapshotRef.current;\n\n if (lastSnapshot && areFitSnapshotsEqual(lastSnapshot, currentSnapshot)) {\n return;\n }\n\n isFittingRef.current = true;\n\n try {\n const fontSize =\n mode === \"fit\"\n ? fitPresentationFontSize({\n viewport: viewportSize,\n measure: (candidateFontSize) => {\n content.style.setProperty(\n SLIDE_FONT_SIZE_PROPERTY,\n `${candidateFontSize}px`\n );\n\n // Read after the CSS variable update so wrapping and em-based\n // styles are included in the next compression step.\n return {\n height: content.scrollHeight,\n width: content.scrollWidth,\n };\n },\n })\n : resolvePresentationBaseFontSize(viewportSize);\n\n content.style.setProperty(SLIDE_FONT_SIZE_PROPERTY, `${fontSize}px`);\n content.dataset.markdownSlideFontSize = String(fontSize);\n lastFitSnapshotRef.current = {\n contentHeight: content.scrollHeight,\n contentWidth: content.scrollWidth,\n mode,\n viewportHeight: viewportSize.height,\n viewportWidth: viewportSize.width,\n };\n } finally {\n isFittingRef.current = false;\n }\n }, [mode]);\n\n const scheduleFit = useCallback(() => {\n if (mode === \"disabled\" || fitFrameRef.current !== null) {\n return;\n }\n\n fitFrameRef.current = window.requestAnimationFrame(() => {\n fitFrameRef.current = null;\n fitContent();\n });\n }, [fitContent, mode]);\n\n useIsomorphicLayoutEffect(() => {\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n\n const content = contentRef.current;\n\n if (!content) {\n return;\n }\n\n if (mode === \"disabled\") {\n content.style.removeProperty(SLIDE_FONT_SIZE_PROPERTY);\n delete content.dataset.markdownSlideFontSize;\n lastFitSnapshotRef.current = null;\n return;\n }\n\n fitContent();\n }, [fitContent, mode]);\n\n useEffect(() => {\n const viewport = viewportRef.current;\n const content = contentRef.current;\n\n if (mode === \"disabled\" || !viewport || !content) {\n return;\n }\n\n const resizeObserver =\n typeof ResizeObserver === \"undefined\"\n ? null\n : new ResizeObserver(scheduleFit);\n resizeObserver?.observe(viewport);\n\n const handleContentChange = () => {\n lastFitSnapshotRef.current = null;\n scheduleFit();\n };\n const mutationObserver =\n mode === \"fit\" && typeof MutationObserver !== \"undefined\"\n ? new MutationObserver(handleContentChange)\n : null;\n\n if (mode === \"fit\") {\n resizeObserver?.observe(content);\n mutationObserver?.observe(content, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n content.addEventListener(\"load\", handleContentChange, true);\n }\n\n window.addEventListener(\"resize\", scheduleFit);\n scheduleFit();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n\n if (mode === \"fit\") {\n content.removeEventListener(\"load\", handleContentChange, true);\n }\n\n window.removeEventListener(\"resize\", scheduleFit);\n\n if (fitFrameRef.current !== null) {\n window.cancelAnimationFrame(fitFrameRef.current);\n fitFrameRef.current = null;\n }\n };\n }, [mode, scheduleFit]);\n\n const isScaling = mode !== \"disabled\";\n\n return (\n <div\n ref={viewportRef}\n className={cn(className, isScaling && \"slide-markdown-scaling\")}\n data-markdown-slide-scaling={isScaling ? mode : undefined}\n {...props}\n >\n <div\n ref={contentRef}\n className={cn(\n \"slide-markdown-scaling__content flex w-full flex-col gap-4\",\n mode !== \"fit\" && \"slide-markdown-scaling__content--contents\"\n )}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default MarkdownSlideScaling;\n"],"names":["SLIDE_FONT_SIZE_PROPERTY","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","areFitSnapshotsEqual","left","right","MarkdownSlideScaling","children","className","mode","props","viewportRef","useRef","contentRef","fitFrameRef","isFittingRef","lastFitSnapshotRef","fitContent","useCallback","viewport","content","viewportSize","currentSnapshot","lastSnapshot","fontSize","fitPresentationFontSize","candidateFontSize","resolvePresentationBaseFontSize","scheduleFit","resizeObserver","handleContentChange","mutationObserver","isScaling","jsx","cn"],"mappings":";;;;AASA,MAAMA,IAA2B,yBAC3BC,IACJ,OAAO,SAAW,MAAcC,IAAYC,GAUxCC,IAAuB,CAC3BC,GACAC,MAEAD,EAAK,kBAAkBC,EAAM,iBAC7BD,EAAK,iBAAiBC,EAAM,gBAC5BD,EAAK,SAASC,EAAM,QACpBD,EAAK,mBAAmBC,EAAM,kBAC9BD,EAAK,kBAAkBC,EAAM,eAazBC,IAA4D,CAAC;AAAA,EACjE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAcC,EAAuB,IAAI,GACzCC,IAAaD,EAAuB,IAAI,GACxCE,IAAcF,EAAsB,IAAI,GACxCG,IAAeH,EAAO,EAAK,GAC3B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