markdown-flow-ui 0.3.2-dev.2 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +0 -13
  2. package/dist/_virtual/index.es8.js +2 -2
  3. package/dist/_virtual/index.es9.js +2 -2
  4. package/dist/_virtual/index8.cjs +1 -1
  5. package/dist/_virtual/index9.cjs +1 -1
  6. package/dist/assets/markdown-flow-ui.css +1 -1
  7. package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
  8. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  9. package/dist/components/ContentRender/utils/video-markdown-run.cjs.map +1 -1
  10. package/dist/components/ContentRender/utils/video-markdown-run.es.js.map +1 -1
  11. package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
  12. package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
  13. package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -1
  14. package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -1
  15. package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
  16. package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
  17. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  18. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  19. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -2
  20. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +323 -562
  21. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  22. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  23. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  24. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +0 -8
  25. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +64 -107
  26. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  27. package/dist/components/MarkdownFlowEditor/editor-context.cjs +1 -1
  28. package/dist/components/MarkdownFlowEditor/editor-context.cjs.map +1 -1
  29. package/dist/components/MarkdownFlowEditor/editor-context.es.js +4 -10
  30. package/dist/components/MarkdownFlowEditor/editor-context.es.js.map +1 -1
  31. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -308
  32. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  33. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -15
  34. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +87 -115
  35. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
  36. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  37. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -15
  38. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +88 -116
  39. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
  40. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  41. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -15
  42. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +88 -116
  43. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  44. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  45. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -15
  46. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +80 -108
  47. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
  48. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  49. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -15
  50. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +82 -110
  51. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
  52. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  53. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -15
  54. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +86 -114
  55. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  56. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  57. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -15
  58. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +88 -116
  59. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  61. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -15
  62. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +85 -113
  63. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
  64. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  65. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -15
  66. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +94 -122
  67. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
  68. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  69. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -15
  70. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +74 -102
  71. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
  72. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  73. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -15
  74. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +72 -100
  75. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  76. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
  77. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
  78. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.d.ts +2 -1
  79. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +62 -53
  80. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
  81. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
  82. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
  83. package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
  84. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  85. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  86. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +1 -5
  87. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +149 -154
  88. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  89. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
  90. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
  91. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.d.ts +2 -1
  92. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +53 -42
  93. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
  94. package/dist/components/MarkdownFlowEditor/types.cjs +1 -1
  95. package/dist/components/MarkdownFlowEditor/types.cjs.map +1 -1
  96. package/dist/components/MarkdownFlowEditor/types.d.ts +1 -11
  97. package/dist/components/MarkdownFlowEditor/types.es.js +2 -2
  98. package/dist/components/MarkdownFlowEditor/types.es.js.map +1 -1
  99. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  100. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  101. package/dist/components/MarkdownFlowEditor/utils.d.ts +0 -10
  102. package/dist/components/MarkdownFlowEditor/utils.es.js +59 -73
  103. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  104. package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
  105. package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
  106. package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +16 -16
  107. package/dist/components/Slide/Player.cjs.map +1 -1
  108. package/dist/components/Slide/Player.es.js.map +1 -1
  109. package/dist/components/Slide/Slide.cjs.map +1 -1
  110. package/dist/components/Slide/Slide.es.js.map +1 -1
  111. package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
  112. package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
  113. package/dist/components/Slide/slideI18n.cjs.map +1 -1
  114. package/dist/components/Slide/slideI18n.es.js.map +1 -1
  115. package/dist/components/Slide/useSlide.cjs.map +1 -1
  116. package/dist/components/Slide/useSlide.es.js.map +1 -1
  117. package/dist/components/Slide/utils/streamingNavigation.cjs.map +1 -1
  118. package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
  119. package/dist/components/ui/dialog.cjs +1 -1
  120. package/dist/components/ui/dialog.cjs.map +1 -1
  121. package/dist/components/ui/dialog.es.js +27 -27
  122. package/dist/components/ui/dialog.es.js.map +1 -1
  123. package/dist/lib/interaction-defaults.cjs.map +1 -1
  124. package/dist/lib/interaction-defaults.es.js.map +1 -1
  125. package/dist/markdown-flow-ui-lib.css +1 -1
  126. package/dist/markdown-flow-ui.css +1 -1
  127. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  128. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  129. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
  130. package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
  131. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +34 -49
  132. package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
  133. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +1 -5
  134. package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
  135. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +206 -220
  136. package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
  137. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs +2 -0
  138. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -0
  139. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js +50 -0
  140. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js.map +1 -0
  141. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  142. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  143. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  144. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  145. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs +2 -0
  146. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -0
  147. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js +82 -0
  148. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -0
  149. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +2 -0
  150. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -0
  151. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +216 -0
  152. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -0
  153. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs +2 -0
  154. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -0
  155. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js +15 -0
  156. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -0
  157. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -0
  158. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -0
  159. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js +18 -0
  160. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -0
  161. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs +2 -0
  162. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -0
  163. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js +104 -0
  164. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js.map +1 -0
  165. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
  166. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
  167. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
  168. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
  169. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
  170. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
  171. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
  172. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
  173. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +2 -0
  174. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -0
  175. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +70 -0
  176. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +1 -0
  177. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs +2 -0
  178. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs.map +1 -0
  179. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js +20 -0
  180. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js.map +1 -0
  181. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +2 -0
  182. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -0
  183. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js +7 -0
  184. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js.map +1 -0
  185. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +1 -1
  186. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
  187. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js +18 -9
  188. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js.map +1 -1
  189. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
  190. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
  191. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +148 -100
  192. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
  193. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  194. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  195. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  196. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  197. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
  198. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
  199. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
  200. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
  201. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
  202. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
  203. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
  204. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
  205. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
  206. package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
  207. package/dist/node_modules/@radix-ui/react-id/dist/index.es.js +8 -8
  208. package/dist/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -1
  209. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
  210. package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
  211. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
  212. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
  213. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
  214. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js +50 -0
  215. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
  216. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
  217. package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
  218. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +80 -41
  219. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  220. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
  221. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
  222. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
  223. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
  224. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
  225. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
  226. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +1 -1
  227. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
  228. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
  229. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +12 -0
  230. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
  231. package/dist/node_modules/classnames/index.cjs +1 -1
  232. package/dist/node_modules/classnames/index.es.js +1 -1
  233. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
  234. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
  235. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js +75 -72
  236. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js.map +1 -1
  237. package/package.json +10 -10
  238. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +0 -2
  239. package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +0 -1
  240. package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +0 -17
  241. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +0 -46
  242. package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +0 -1
  243. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +0 -2
  244. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +0 -1
  245. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +0 -18
  246. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +0 -184
  247. package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +0 -1
  248. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +0 -2
  249. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +0 -1
  250. package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +0 -11
  251. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +0 -172
  252. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +0 -1
  253. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +0 -2
  254. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +0 -1
  255. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.d.ts +0 -3
  256. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +0 -32
  257. package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +0 -1
  258. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +0 -3
  259. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +0 -1
  260. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +0 -9
  261. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +0 -53
  262. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +0 -1
  263. package/dist/components/ui/popover.cjs +0 -2
  264. package/dist/components/ui/popover.cjs.map +0 -1
  265. package/dist/components/ui/popover.es.js +0 -24
  266. package/dist/components/ui/popover.es.js.map +0 -1
  267. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +0 -2
  268. package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +0 -1
  269. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +0 -241
  270. package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +0 -1
  271. package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs +0 -7
  272. package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs.map +0 -1
  273. package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js +0 -25
  274. package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js.map +0 -1
  275. package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs +0 -7
  276. package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs.map +0 -1
  277. package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js +0 -16
  278. package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js.map +0 -1
  279. package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs +0 -7
  280. package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs.map +0 -1
  281. package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js +0 -16
  282. package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js.map +0 -1
  283. /package/dist/components/MarkdownFlowEditor/plugins/{VariablePlaceholder.test.d.ts → MediaPlaceholder.variables.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const B=require("../../../node_modules/@codemirror/view/dist/index.cjs"),$=require("../../../node_modules/@codemirror/state/dist/index.cjs"),L=require("../../ContentRender/utils/inline-code-ranges.cjs"),k=require("../../../_virtual/index.cjs"),F=/<!--[\s\S]*?-->/g,W=n=>{const s=k.distExports.findVariableMarkers(n),f=n.indexOf("{{",s.at(-1)?.end??0);return f===-1?s:[...s,{start:f,end:n.length,name:null}]},C=new RegExp(`\\?\\[(${k.distExports.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,"g"),Q=n=>L.getMarkdownSourceAnalysis(n).interactions;function j(n,s){const f=[];let i=null,d=0;for(;d<=n.length;){const a=n.indexOf(`
2
- `,d),r=a===-1?n.length:a;if(n.slice(d,r).trim()==="!==="&&!s(d)&&(i===null?i=d:(f.push({from:i,to:r,className:"syntax-fixed"}),i=null)),a===-1)break;d=a+1}return f}function T(n,s,f){const i=[];let d=0;const a=t=>{for(;d<s.length&&s[d].to<=t;)d++;const o=s[d];return!!o&&t>=o.from&&t<o.to};let r=0;for(;r<=n.length;){const t=n.indexOf(`
3
- `,r),o=t===-1?n.length:t,l=n.slice(r,o),g=[];let p=0;for(;p<l.length;){const m=l.indexOf("===",p);if(m===-1)break;const h=r+m;!(h>0&&n[h-1]==="!")&&!a(h)&&!f(h)&&g.push(h),p=m+3}for(let m=0;m+1<g.length;m+=2)i.push({from:g[m],to:g[m+1]+3,className:"syntax-fixed"});if(t===-1)break;r=t+1}return i}function U(n,s){const f=[];let i;for(F.lastIndex=0;(i=F.exec(n))!==null;)s(i.index)||f.push({from:i.index,to:i.index+i[0].length,className:"syntax-comment"});return f}function D(n){const s=k.distExports.findDocumentVariableMarkers(n),f=r=>s.some(t=>r>=t.start&&r<t.end),i=U(n,f),d=[...j(n,f),...T(n,i,f),...i].sort((r,t)=>r.from!==t.from?r.from-t.from:t.to-r.to),a=[];for(const r of d){const t=a[a.length-1];(!t||r.from>=t.to)&&a.push(r)}return a}function P(n,s=()=>!1,f=!1){const i=[],d=k.distExports.findDocumentVariableMarkers(n),a=[];C.lastIndex=0;const r=(o,l)=>a.some(g=>!(l<=g.from||o>=g.to)),t=(o,l,g)=>o>=l||r(o,l)?!1:(a.push({from:o,to:l}),i.push({from:o,to:l,className:g}),!0);for(const o of D(n))t(o.from,o.to,o.className);for(const o of Q(n)){C.lastIndex=o.start;const l=C.exec(n);if(!l||l.index!==o.start||l.index+l[0].length!==o.end)continue;const g=l.index,p=l.index+l[0].length,m=l[1],h=g+2;if(r(g,p)||d.some(y=>y.start<=g&&g<y.end))continue;t(g,g+1,"syntax-keyword"),t(g+1,g+2,"syntax-bracket"),t(p-1,p,"syntax-bracket");const V=W(m),b=V[0],E=b?b.start-1:-1,I=E>=0&&m[E]==="%"&&k.distExports.trimVariablePadding(m.slice(0,E))==="";if(m.startsWith("%")||I){let y="syntax-percent-invalid";if(b&&I){const e=h+b.start,x=h+b.end,M=s(e,x);y=b.name!==null&&!M?"syntax-percent-valid":"syntax-percent-invalid"}const v=h+(I?E:0);t(v,v+1,y);const O=[],R=[],N=[];for(const e of V)R.push({from:h+e.start,to:h+e.end,className:e.name===null?"syntax-variable-invalid":"syntax-variable"});let u=0;for(;u<m.length;){const e=R.find(M=>h+u===M.from);if(e){u=e.to-h;continue}if(k.distExports.isEscape(m,u)){u+=2;continue}const x=m.startsWith("||",u)?"||":m[u]==="|"?"|":m.startsWith("...",u)?"...":null;if(!x){u+=1;continue}O.push({from:h+u,to:h+u+x.length}),u+=x.length}const c=[...O.map(e=>({...e,className:"syntax-keyword"})),...R.map(e=>({...e,className:e.className}))].sort((e,x)=>e.from!==x.from?e.from-x.from:e.to-x.to);for(const e of c)e.className.startsWith("syntax-variable")&&s(e.from,e.to)||t(e.from,e.to,e.className)&&N.push({from:e.from,to:e.to});const w=v+1,H=p-1;let S=w;const q=N.sort((e,x)=>e.from!==x.from?e.from-x.from:e.to-x.to);for(const e of q)S<e.from&&t(S,e.from,"syntax-string"),S=Math.max(S,e.to);S<H&&t(S,H,"syntax-string")}else{const y=[],v=[];for(const c of W(m))y.push({from:h+c.start,to:h+c.end,className:c.name===null?"syntax-variable-invalid":"syntax-variable"});const O=y.sort((c,w)=>c.from!==w.from?c.from-w.from:c.to-w.to);for(const c of O)c.className.startsWith("syntax-variable")&&s(c.from,c.to)||t(c.from,c.to,c.className)&&v.push({from:c.from,to:c.to});const R=h,N=p-1;let u=R;for(const c of v)u<c.from&&t(u,c.from,"syntax-button-text"),u=Math.max(u,c.to);u<N&&t(u,N,"syntax-button-text")}}for(const o of f?[]:d)o.name!==null&&!s(o.start,o.end)&&t(o.start,o.end,"syntax-variable");return i.sort((o,l)=>o.from!==l.from?o.from-l.from:l.to-o.to),i}function A(n,s=!1){const f=new $.RangeSetBuilder,i=n.state.doc.toString(),d=P(i,(a,r)=>n.state.selection.ranges.some(t=>t.from>=a&&t.to<=r),s);for(const a of d)if(a.from<a.to)try{f.add(a.from,a.to,B.Decoration.mark({class:a.className}))}catch(r){console.warn("SyntaxHighlighter: Failed to add decoration",a,r)}return f.finish()}const _=(n=!1)=>B.ViewPlugin.fromClass(class{constructor(s){this.decorations=A(s,n)}update(s){(s.docChanged||s.viewportChanged||s.selectionSet)&&(this.decorations=A(s.view,n))}},{decorations:s=>s.decorations}),z=_(),G=_(!0);exports.QuestionSyntaxHighlighter=G;exports.collectOuterBlockRanges=D;exports.collectSyntaxHighlightRanges=P;exports.default=z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("../../../node_modules/@codemirror/view/dist/index.cjs"),P=require("../../../node_modules/@codemirror/state/dist/index.cjs"),_=require("../../ContentRender/utils/inline-code-ranges.cjs"),R=require("../../../_virtual/index.cjs"),F=/<!--[\s\S]*?-->/g,W=n=>{const i=R.distExports.findVariableMarkers(n),f=n.indexOf("{{",i.at(-1)?.end??0);return f===-1?i:[...i,{start:f,end:n.length,name:null}]},M=new RegExp(`\\?\\[(${R.distExports.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,"g"),$=n=>_.getMarkdownSourceAnalysis(n).interactions;function L(n,i){const f=[];let l=null,s=0;for(;s<=n.length;){const u=n.indexOf(`
2
+ `,s),e=u===-1?n.length:u;if(n.slice(s,e).trim()==="!==="&&!i(s)&&(l===null?l=s:(f.push({from:l,to:e,className:"syntax-fixed"}),l=null)),u===-1)break;s=u+1}return f}function j(n,i,f){const l=[];let s=0;const u=t=>{for(;s<i.length&&i[s].to<=t;)s++;const r=i[s];return!!r&&t>=r.from&&t<r.to};let e=0;for(;e<=n.length;){const t=n.indexOf(`
3
+ `,e),r=t===-1?n.length:t,d=n.slice(e,r),x=[];let g=0;for(;g<d.length;){const c=d.indexOf("===",g);if(c===-1)break;const p=e+c;!(p>0&&n[p-1]==="!")&&!u(p)&&!f(p)&&x.push(p),g=c+3}for(let c=0;c+1<x.length;c+=2)l.push({from:x[c],to:x[c+1]+3,className:"syntax-fixed"});if(t===-1)break;e=t+1}return l}function T(n,i){const f=[];let l;for(F.lastIndex=0;(l=F.exec(n))!==null;)i(l.index)||f.push({from:l.index,to:l.index+l[0].length,className:"syntax-comment"});return f}function B(n){const i=R.distExports.findDocumentVariableMarkers(n),f=e=>i.some(t=>e>=t.start&&e<t.end),l=T(n,f),s=[...L(n,f),...j(n,l,f),...l].sort((e,t)=>e.from!==t.from?e.from-t.from:t.to-e.to),u=[];for(const e of s){const t=u[u.length-1];(!t||e.from>=t.to)&&u.push(e)}return u}function D(n,i=()=>!1){const f=[],l=R.distExports.findDocumentVariableMarkers(n),s=[];M.lastIndex=0;const u=(t,r)=>s.some(d=>!(r<=d.from||t>=d.to)),e=(t,r,d)=>t>=r||u(t,r)?!1:(s.push({from:t,to:r}),f.push({from:t,to:r,className:d}),!0);for(const t of B(n))e(t.from,t.to,t.className);for(const t of $(n)){M.lastIndex=t.start;const r=M.exec(n);if(!r||r.index!==t.start||r.index+r[0].length!==t.end)continue;const d=r.index,x=r.index+r[0].length,g=r[1],c=d+2;if(u(d,x)||l.some(b=>b.start<=d&&d<b.end))continue;e(d,d+1,"syntax-keyword"),e(d+1,d+2,"syntax-bracket"),e(x-1,x,"syntax-bracket");const p=W(g),y=p[0],E=y?y.start-1:-1,V=E>=0&&g[E]==="%"&&R.distExports.trimVariablePadding(g.slice(0,E))==="";if(g.startsWith("%")||V){let b="syntax-percent-invalid";if(y&&V){const o=c+y.start,h=c+y.end,I=i(o,h);b=y.name!==null&&!I?"syntax-percent-valid":"syntax-percent-invalid"}const v=c+(V?E:0);e(v,v+1,b);const O=[],S=[],N=[];for(const o of p)S.push({from:c+o.start,to:c+o.end,className:o.name===null?"syntax-variable-invalid":"syntax-variable"});let m=0;for(;m<g.length;){const o=S.find(I=>c+m===I.from);if(o){m=o.to-c;continue}if(R.distExports.isEscape(g,m)){m+=2;continue}const h=g.startsWith("||",m)?"||":g[m]==="|"?"|":g.startsWith("...",m)?"...":null;if(!h){m+=1;continue}O.push({from:c+m,to:c+m+h.length}),m+=h.length}const a=[...O.map(o=>({...o,className:"syntax-keyword"})),...S.map(o=>({...o,className:o.className}))].sort((o,h)=>o.from!==h.from?o.from-h.from:o.to-h.to);for(const o of a)o.className.startsWith("syntax-variable")&&i(o.from,o.to)||e(o.from,o.to,o.className)&&N.push({from:o.from,to:o.to});const w=v+1,C=x-1;let k=w;const H=N.sort((o,h)=>o.from!==h.from?o.from-h.from:o.to-h.to);for(const o of H)k<o.from&&e(k,o.from,"syntax-string"),k=Math.max(k,o.to);k<C&&e(k,C,"syntax-string")}else{const b=[],v=[];for(const a of W(g))b.push({from:c+a.start,to:c+a.end,className:a.name===null?"syntax-variable-invalid":"syntax-variable"});const O=b.sort((a,w)=>a.from!==w.from?a.from-w.from:a.to-w.to);for(const a of O)a.className.startsWith("syntax-variable")&&i(a.from,a.to)||e(a.from,a.to,a.className)&&v.push({from:a.from,to:a.to});const S=c,N=x-1;let m=S;for(const a of v)m<a.from&&e(m,a.from,"syntax-button-text"),m=Math.max(m,a.to);m<N&&e(m,N,"syntax-button-text")}}for(const t of l)t.name!==null&&!i(t.start,t.end)&&e(t.start,t.end,"syntax-variable");return f.sort((t,r)=>t.from!==r.from?t.from-r.from:r.to-t.to),f}function q(n){const i=new P.RangeSetBuilder,f=n.state.doc.toString(),l=D(f,(s,u)=>n.state.selection.ranges.some(e=>e.from>=s&&e.to<=u));for(const s of l)if(s.from<s.to)try{i.add(s.from,s.to,A.Decoration.mark({class:s.className}))}catch(u){console.warn("SyntaxHighlighter: Failed to add decoration",s,u)}return i.finish()}const U=A.ViewPlugin.fromClass(class{constructor(n){this.decorations=q(n)}update(n){(n.docChanged||n.viewportChanged||n.selectionSet)&&(this.decorations=q(n.view))}},{decorations:n=>n.decorations});exports.collectOuterBlockRanges=B;exports.collectSyntaxHighlightRanges=D;exports.default=U;
4
4
  //# sourceMappingURL=SyntaxHighlighter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"SyntaxHighlighter.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.ts"],"sourcesContent":["import {\n Decoration,\n DecorationSet,\n EditorView,\n ViewPlugin,\n ViewUpdate,\n} from \"@codemirror/view\";\nimport { RangeSetBuilder } from \"@codemirror/state\";\nimport { getMarkdownSourceAnalysis } from \"../../ContentRender/utils/inline-code-ranges\";\nimport { INTERACTION_CONTENT_SOURCE, isEscape } from \"remark-flow\";\n\nimport {\n findVariableMarkers,\n findDocumentVariableMarkers,\n trimVariablePadding,\n} from \"../utils\";\n\nconst commentRegex = /<!--[\\s\\S]*?-->/g;\n\n// An unfinished marker still owns its tail, so nested syntax stays literal while typing.\nconst interactionVariableRanges = (text: string) => {\n const markers = findVariableMarkers(text);\n const pending = text.indexOf(\"{{\", markers.at(-1)?.end ?? 0);\n return pending === -1\n ? markers\n : [...markers, { start: pending, end: text.length, name: null }];\n};\n// The grammar's own definition of where an interaction ends, so a `\\]` an option escaped does\n// not cut the highlight short, and the same `(?!\\()` the parser uses, so `?[text](url)` stays a\n// markdown link. Taken from remark-flow rather than written again here: the editor and the\n// parser have to agree about what they are looking at.\nconst controlBlockRegex = new RegExp(\n `\\\\?\\\\[(${INTERACTION_CONTENT_SOURCE})\\\\](?!\\\\()`,\n \"g\"\n);\n\nconst documentControlRanges = (text: string) =>\n getMarkdownSourceAnalysis(text).interactions;\n\nexport interface SyntaxHighlightRange {\n from: number;\n to: number;\n className: string;\n}\n\nfunction collectMultilineFixedOutputRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let pendingStart: number | null = null;\n let lineStart = 0;\n\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n\n if (lineText.trim() === \"!===\" && !isInsideVariable(lineStart)) {\n if (pendingStart === null) {\n pendingStart = lineStart;\n } else {\n ranges.push({\n from: pendingStart,\n to: lineEnd,\n className: \"syntax-fixed\",\n });\n pendingStart = null;\n }\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectSingleLineFixedOutputRanges(\n docText: string,\n commentRanges: SyntaxHighlightRange[],\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let commentIndex = 0;\n\n const isInsideComment = (index: number) => {\n while (\n commentIndex < commentRanges.length &&\n commentRanges[commentIndex].to <= index\n ) {\n commentIndex++;\n }\n\n const range = commentRanges[commentIndex];\n return !!range && index >= range.from && index < range.to;\n };\n\n let lineStart = 0;\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n const markerPositions: number[] = [];\n let searchFrom = 0;\n\n while (searchFrom < lineText.length) {\n const markerOffset = lineText.indexOf(\"===\", searchFrom);\n if (markerOffset === -1) {\n break;\n }\n\n const markerIndex = lineStart + markerOffset;\n const isNegated = markerIndex > 0 && docText[markerIndex - 1] === \"!\";\n if (\n !isNegated &&\n !isInsideComment(markerIndex) &&\n !isInsideVariable(markerIndex)\n ) {\n markerPositions.push(markerIndex);\n }\n\n searchFrom = markerOffset + 3;\n }\n\n for (let i = 0; i + 1 < markerPositions.length; i += 2) {\n ranges.push({\n from: markerPositions[i],\n to: markerPositions[i + 1] + 3,\n className: \"syntax-fixed\",\n });\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectCommentRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let match;\n\n commentRegex.lastIndex = 0;\n while ((match = commentRegex.exec(docText)) !== null) {\n if (isInsideVariable(match.index)) continue;\n ranges.push({\n from: match.index,\n to: match.index + match[0].length,\n className: \"syntax-comment\",\n });\n }\n\n return ranges;\n}\n\n/**\n * Collects non-overlapping fixed-output and comment wrapper ranges.\n *\n * @param docText - Document text to scan.\n * @returns Outer syntax highlight ranges sorted by document position.\n */\nexport function collectOuterBlockRanges(\n docText: string\n): SyntaxHighlightRange[] {\n const variables = findDocumentVariableMarkers(docText);\n const isInsideVariable = (position: number) =>\n variables.some(\n (marker) => position >= marker.start && position < marker.end\n );\n const commentRanges = collectCommentRanges(docText, isInsideVariable);\n const blockRanges = [\n ...collectMultilineFixedOutputRanges(docText, isInsideVariable),\n ...collectSingleLineFixedOutputRanges(\n docText,\n commentRanges,\n isInsideVariable\n ),\n ...commentRanges,\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n const outerRanges: SyntaxHighlightRange[] = [];\n\n for (const range of blockRanges) {\n const lastOuter = outerRanges[outerRanges.length - 1];\n if (!lastOuter || range.from >= lastOuter.to) {\n outerRanges.push(range);\n }\n }\n\n return outerRanges;\n}\n\n/**\n * Collects all custom syntax highlight ranges for editor decorations.\n *\n * @param docText - Document text to scan.\n * @param isCursorInside - Returns true when the current cursor is inside a range.\n * @returns Non-overlapping syntax highlight ranges sorted by document position.\n */\nexport function collectSyntaxHighlightRanges(\n docText: string,\n isCursorInside: (from: number, to: number) => boolean = () => false,\n questionMode = false\n): SyntaxHighlightRange[] {\n const matches: SyntaxHighlightRange[] = [];\n const documentVariables = findDocumentVariableMarkers(docText);\n const occupied: { from: number; to: number }[] = [];\n\n controlBlockRegex.lastIndex = 0;\n\n // Prevent overlapping decorations so styling stays deterministic\n const isOverlapping = (from: number, to: number) =>\n occupied.some((range) => !(to <= range.from || from >= range.to));\n\n const addMatch = (from: number, to: number, className: string) => {\n if (from >= to) return false;\n if (isOverlapping(from, to)) return false;\n occupied.push({ from, to });\n matches.push({ from, to, className });\n return true;\n };\n\n // 1. Outer block ranges win over any syntax inside them.\n for (const range of collectOuterBlockRanges(docText)) {\n addMatch(range.from, range.to, range.className);\n }\n\n // 2. Control Blocks\n for (const control of documentControlRanges(docText)) {\n // Native Markdown owns document boundaries. The shared token grammar still\n // supplies the exact source offsets used for individual editor decorations.\n controlBlockRegex.lastIndex = control.start;\n const match = controlBlockRegex.exec(docText);\n if (\n !match ||\n match.index !== control.start ||\n match.index + match[0].length !== control.end\n )\n continue;\n const fullStart = match.index;\n const fullEnd = match.index + match[0].length;\n const content = match[1];\n const contentStart = fullStart + 2; // after ?[\n if (\n isOverlapping(fullStart, fullEnd) ||\n documentVariables.some(\n (marker) => marker.start <= fullStart && fullStart < marker.end\n )\n ) {\n continue;\n }\n\n // Outer brackets and question mark\n addMatch(fullStart, fullStart + 1, \"syntax-keyword\"); // ?\n addMatch(fullStart + 1, fullStart + 2, \"syntax-bracket\"); // [\n addMatch(fullEnd - 1, fullEnd, \"syntax-bracket\"); // ]\n\n const variables = interactionVariableRanges(content);\n const firstVariable = variables[0];\n const percentIndex = firstVariable ? firstVariable.start - 1 : -1;\n const hasLeadingAssignment =\n percentIndex >= 0 &&\n content[percentIndex] === \"%\" &&\n trimVariablePadding(content.slice(0, percentIndex)) === \"\";\n if (content.startsWith(\"%\") || hasLeadingAssignment) {\n // Input / Select\n let percentClass = \"syntax-percent-invalid\";\n if (firstVariable && hasLeadingAssignment) {\n const varFrom = contentStart + firstVariable.start;\n const varTo = contentStart + firstVariable.end;\n const cursorInsideVar = isCursorInside(varFrom, varTo);\n percentClass =\n firstVariable.name !== null && !cursorInsideVar\n ? \"syntax-percent-valid\"\n : \"syntax-percent-invalid\";\n }\n const percentStart =\n contentStart + (hasLeadingAssignment ? percentIndex : 0);\n addMatch(percentStart, percentStart + 1, percentClass); // %\n\n const operatorRanges: { from: number; to: number }[] = [];\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedTokenRanges: { from: number; to: number }[] = [];\n\n // Keep a variable name atomic even when it contains option punctuation.\n for (const variable of variables) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n // Inner operators | || ... -- skipping any an option escaped, the way the parser does.\n // Painted as separators, they told the author the grammar had split an option that it\n // had in fact left whole.\n let scanIndex = 0;\n while (scanIndex < content.length) {\n const variable = variableRanges.find(\n (range) => contentStart + scanIndex === range.from\n );\n if (variable) {\n scanIndex = variable.to - contentStart;\n continue;\n }\n if (isEscape(content, scanIndex)) {\n scanIndex += 2;\n continue;\n }\n const operator = content.startsWith(\"||\", scanIndex)\n ? \"||\"\n : content[scanIndex] === \"|\"\n ? \"|\"\n : content.startsWith(\"...\", scanIndex)\n ? \"...\"\n : null;\n if (!operator) {\n scanIndex += 1;\n continue;\n }\n operatorRanges.push({\n from: contentStart + scanIndex,\n to: contentStart + scanIndex + operator.length,\n });\n scanIndex += operator.length;\n }\n\n const allTokens = [\n ...operatorRanges.map((range) => ({\n ...range,\n className: \"syntax-keyword\",\n })),\n ...variableRanges.map((range) => ({\n ...range,\n className: range.className,\n })),\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of allTokens) {\n if (\n token.className.startsWith(\"syntax-variable\") &&\n isCursorInside(token.from, token.to)\n ) {\n continue;\n }\n if (addMatch(token.from, token.to, token.className)) {\n appliedTokenRanges.push({ from: token.from, to: token.to });\n }\n }\n\n // Content (Dark Blue) for remaining text segments\n const stringStart = percentStart + 1;\n const stringEnd = fullEnd - 1;\n let cursor = stringStart;\n const sortedApplied = appliedTokenRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of sortedApplied) {\n if (cursor < token.from) {\n addMatch(cursor, token.from, \"syntax-string\");\n }\n cursor = Math.max(cursor, token.to);\n }\n if (cursor < stringEnd) {\n addMatch(cursor, stringEnd, \"syntax-string\");\n }\n } else {\n // Button ?[text]\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedVariableRanges: { from: number; to: number }[] = [];\n\n for (const variable of interactionVariableRanges(content)) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n const sortedVariables = variableRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const variable of sortedVariables) {\n if (\n variable.className.startsWith(\"syntax-variable\") &&\n isCursorInside(variable.from, variable.to)\n ) {\n continue;\n }\n if (addMatch(variable.from, variable.to, variable.className)) {\n appliedVariableRanges.push({ from: variable.from, to: variable.to });\n }\n }\n\n const buttonTextStart = contentStart;\n const buttonTextEnd = fullEnd - 1;\n let cursor = buttonTextStart;\n\n for (const variable of appliedVariableRanges) {\n if (cursor < variable.from) {\n addMatch(cursor, variable.from, \"syntax-button-text\");\n }\n cursor = Math.max(cursor, variable.to);\n }\n if (cursor < buttonTextEnd) {\n addMatch(cursor, buttonTextEnd, \"syntax-button-text\");\n }\n }\n }\n\n // 3. Variables (only if not already decorated; invalid ones stay default outside control blocks)\n for (const variable of questionMode ? [] : documentVariables) {\n if (\n variable.name !== null &&\n !isCursorInside(variable.start, variable.end)\n ) {\n addMatch(variable.start, variable.end, \"syntax-variable\");\n }\n }\n\n // Sort matches by 'from' asc, then 'to' desc (longest first)\n matches.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n return matches;\n}\n\nfunction buildDecorations(\n view: EditorView,\n questionMode = false\n): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>();\n const docText = view.state.doc.toString();\n const matches = collectSyntaxHighlightRanges(\n docText,\n (from, to) => {\n return view.state.selection.ranges.some((range) => {\n return range.from >= from && range.to <= to;\n });\n },\n questionMode\n );\n\n for (const m of matches) {\n if (m.from < m.to) {\n try {\n builder.add(m.from, m.to, Decoration.mark({ class: m.className }));\n } catch (e) {\n console.warn(\"SyntaxHighlighter: Failed to add decoration\", m, e);\n }\n }\n }\n\n return builder.finish();\n}\n\nconst createSyntaxHighlighter = (questionMode = false) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = buildDecorations(view, questionMode);\n }\n\n update(update: ViewUpdate) {\n if (\n update.docChanged ||\n update.viewportChanged ||\n update.selectionSet\n ) {\n this.decorations = buildDecorations(update.view, questionMode);\n }\n }\n },\n {\n decorations: (instance) => instance.decorations,\n }\n );\n\nconst SyntaxHighlighter = createSyntaxHighlighter();\nexport const QuestionSyntaxHighlighter = createSyntaxHighlighter(true);\n\nexport default SyntaxHighlighter;\n"],"names":["commentRegex","interactionVariableRanges","text","markers","findVariableMarkers","pending","controlBlockRegex","INTERACTION_CONTENT_SOURCE","documentControlRanges","getMarkdownSourceAnalysis","collectMultilineFixedOutputRanges","docText","isInsideVariable","ranges","pendingStart","lineStart","newlineIndex","lineEnd","collectSingleLineFixedOutputRanges","commentRanges","commentIndex","isInsideComment","index","range","lineText","markerPositions","searchFrom","markerOffset","markerIndex","i","collectCommentRanges","match","collectOuterBlockRanges","variables","findDocumentVariableMarkers","position","marker","blockRanges","a","b","outerRanges","lastOuter","collectSyntaxHighlightRanges","isCursorInside","questionMode","matches","documentVariables","occupied","isOverlapping","from","to","addMatch","className","control","fullStart","fullEnd","content","contentStart","firstVariable","percentIndex","hasLeadingAssignment","trimVariablePadding","percentClass","varFrom","varTo","cursorInsideVar","percentStart","operatorRanges","variableRanges","appliedTokenRanges","variable","scanIndex","isEscape","operator","allTokens","token","stringStart","stringEnd","cursor","sortedApplied","appliedVariableRanges","sortedVariables","buttonTextStart","buttonTextEnd","buildDecorations","view","builder","RangeSetBuilder","m","Decoration","e","createSyntaxHighlighter","ViewPlugin","update","instance","SyntaxHighlighter","QuestionSyntaxHighlighter"],"mappings":"gWAiBMA,EAAe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ACAzC,EAAe,GACA,CACf,MAAM0C,EAAU,IAAIC,kBACd5E,EAAU0E,EAAK,MAAM,IAAI,SAAA,EACzBxC,EAAUH,EACd/B,EACA,CAACsC,EAAMC,IACEmC,EAAK,MAAM,UAAU,OAAO,KAAM9D,GAChCA,EAAM,MAAQ0B,GAAQ1B,EAAM,IAAM2B,CAC1C,EAEHN,CAAA,EAGF,UAAW4C,KAAK3C,EACd,GAAI2C,EAAE,KAAOA,EAAE,GACb,GAAI,CACFF,EAAQ,IAAIE,EAAE,KAAMA,EAAE,GAAIC,aAAW,KAAK,CAAE,MAAOD,EAAE,SAAA,CAAW,CAAC,CACnE,OAASE,EAAG,CACV,QAAQ,KAAK,8CAA+CF,EAAGE,CAAC,CAClE,CAIJ,OAAOJ,EAAQ,OAAA,CACjB,CAEA,MAAMK,EAA0B,CAAC/C,EAAe,KAC9CgD,EAAAA,WAAW,UACT,KAAM,CAGJ,YAAYP,EAAkB,CAC5B,KAAK,YAAcD,EAAiBC,EAAMzC,CAAY,CACxD,CAEA,OAAOiD,EAAoB,EAEvBA,EAAO,YACPA,EAAO,iBACPA,EAAO,gBAEP,KAAK,YAAcT,EAAiBS,EAAO,KAAMjD,CAAY,EAEjE,CAAA,EAEF,CACE,YAAckD,GAAaA,EAAS,WAAA,CAExC,EAEIC,EAAoBJ,EAAA,EACbK,EAA4BL,EAAwB,EAAI"}
1
+ {"version":3,"file":"SyntaxHighlighter.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.ts"],"sourcesContent":["import {\n Decoration,\n DecorationSet,\n EditorView,\n ViewPlugin,\n ViewUpdate,\n} from \"@codemirror/view\";\nimport { RangeSetBuilder } from \"@codemirror/state\";\nimport { getMarkdownSourceAnalysis } from \"../../ContentRender/utils/inline-code-ranges\";\nimport { INTERACTION_CONTENT_SOURCE, isEscape } from \"remark-flow\";\n\nimport {\n findVariableMarkers,\n findDocumentVariableMarkers,\n trimVariablePadding,\n} from \"../utils\";\n\nconst commentRegex = /<!--[\\s\\S]*?-->/g;\n\n// An unfinished marker still owns its tail, so nested syntax stays literal while typing.\nconst interactionVariableRanges = (text: string) => {\n const markers = findVariableMarkers(text);\n const pending = text.indexOf(\"{{\", markers.at(-1)?.end ?? 0);\n return pending === -1\n ? markers\n : [...markers, { start: pending, end: text.length, name: null }];\n};\n// The grammar's own definition of where an interaction ends, so a `\\]` an option escaped does\n// not cut the highlight short, and the same `(?!\\()` the parser uses, so `?[text](url)` stays a\n// markdown link. Taken from remark-flow rather than written again here: the editor and the\n// parser have to agree about what they are looking at.\nconst controlBlockRegex = new RegExp(\n `\\\\?\\\\[(${INTERACTION_CONTENT_SOURCE})\\\\](?!\\\\()`,\n \"g\"\n);\n\nconst documentControlRanges = (text: string) =>\n getMarkdownSourceAnalysis(text).interactions;\n\nexport interface SyntaxHighlightRange {\n from: number;\n to: number;\n className: string;\n}\n\nfunction collectMultilineFixedOutputRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let pendingStart: number | null = null;\n let lineStart = 0;\n\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n\n if (lineText.trim() === \"!===\" && !isInsideVariable(lineStart)) {\n if (pendingStart === null) {\n pendingStart = lineStart;\n } else {\n ranges.push({\n from: pendingStart,\n to: lineEnd,\n className: \"syntax-fixed\",\n });\n pendingStart = null;\n }\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectSingleLineFixedOutputRanges(\n docText: string,\n commentRanges: SyntaxHighlightRange[],\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let commentIndex = 0;\n\n const isInsideComment = (index: number) => {\n while (\n commentIndex < commentRanges.length &&\n commentRanges[commentIndex].to <= index\n ) {\n commentIndex++;\n }\n\n const range = commentRanges[commentIndex];\n return !!range && index >= range.from && index < range.to;\n };\n\n let lineStart = 0;\n while (lineStart <= docText.length) {\n const newlineIndex = docText.indexOf(\"\\n\", lineStart);\n const lineEnd = newlineIndex === -1 ? docText.length : newlineIndex;\n const lineText = docText.slice(lineStart, lineEnd);\n const markerPositions: number[] = [];\n let searchFrom = 0;\n\n while (searchFrom < lineText.length) {\n const markerOffset = lineText.indexOf(\"===\", searchFrom);\n if (markerOffset === -1) {\n break;\n }\n\n const markerIndex = lineStart + markerOffset;\n const isNegated = markerIndex > 0 && docText[markerIndex - 1] === \"!\";\n if (\n !isNegated &&\n !isInsideComment(markerIndex) &&\n !isInsideVariable(markerIndex)\n ) {\n markerPositions.push(markerIndex);\n }\n\n searchFrom = markerOffset + 3;\n }\n\n for (let i = 0; i + 1 < markerPositions.length; i += 2) {\n ranges.push({\n from: markerPositions[i],\n to: markerPositions[i + 1] + 3,\n className: \"syntax-fixed\",\n });\n }\n\n if (newlineIndex === -1) {\n break;\n }\n\n lineStart = newlineIndex + 1;\n }\n\n return ranges;\n}\n\nfunction collectCommentRanges(\n docText: string,\n isInsideVariable: (position: number) => boolean\n): SyntaxHighlightRange[] {\n const ranges: SyntaxHighlightRange[] = [];\n let match;\n\n commentRegex.lastIndex = 0;\n while ((match = commentRegex.exec(docText)) !== null) {\n if (isInsideVariable(match.index)) continue;\n ranges.push({\n from: match.index,\n to: match.index + match[0].length,\n className: \"syntax-comment\",\n });\n }\n\n return ranges;\n}\n\n/**\n * Collects non-overlapping fixed-output and comment wrapper ranges.\n *\n * @param docText - Document text to scan.\n * @returns Outer syntax highlight ranges sorted by document position.\n */\nexport function collectOuterBlockRanges(\n docText: string\n): SyntaxHighlightRange[] {\n const variables = findDocumentVariableMarkers(docText);\n const isInsideVariable = (position: number) =>\n variables.some(\n (marker) => position >= marker.start && position < marker.end\n );\n const commentRanges = collectCommentRanges(docText, isInsideVariable);\n const blockRanges = [\n ...collectMultilineFixedOutputRanges(docText, isInsideVariable),\n ...collectSingleLineFixedOutputRanges(\n docText,\n commentRanges,\n isInsideVariable\n ),\n ...commentRanges,\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n const outerRanges: SyntaxHighlightRange[] = [];\n\n for (const range of blockRanges) {\n const lastOuter = outerRanges[outerRanges.length - 1];\n if (!lastOuter || range.from >= lastOuter.to) {\n outerRanges.push(range);\n }\n }\n\n return outerRanges;\n}\n\n/**\n * Collects all custom syntax highlight ranges for editor decorations.\n *\n * @param docText - Document text to scan.\n * @param isCursorInside - Returns true when the current cursor is inside a range.\n * @returns Non-overlapping syntax highlight ranges sorted by document position.\n */\nexport function collectSyntaxHighlightRanges(\n docText: string,\n isCursorInside: (from: number, to: number) => boolean = () => false\n): SyntaxHighlightRange[] {\n const matches: SyntaxHighlightRange[] = [];\n const documentVariables = findDocumentVariableMarkers(docText);\n const occupied: { from: number; to: number }[] = [];\n\n controlBlockRegex.lastIndex = 0;\n\n // Prevent overlapping decorations so styling stays deterministic\n const isOverlapping = (from: number, to: number) =>\n occupied.some((range) => !(to <= range.from || from >= range.to));\n\n const addMatch = (from: number, to: number, className: string) => {\n if (from >= to) return false;\n if (isOverlapping(from, to)) return false;\n occupied.push({ from, to });\n matches.push({ from, to, className });\n return true;\n };\n\n // 1. Outer block ranges win over any syntax inside them.\n for (const range of collectOuterBlockRanges(docText)) {\n addMatch(range.from, range.to, range.className);\n }\n\n // 2. Control Blocks\n for (const control of documentControlRanges(docText)) {\n // Native Markdown owns document boundaries. The shared token grammar still\n // supplies the exact source offsets used for individual editor decorations.\n controlBlockRegex.lastIndex = control.start;\n const match = controlBlockRegex.exec(docText);\n if (\n !match ||\n match.index !== control.start ||\n match.index + match[0].length !== control.end\n )\n continue;\n const fullStart = match.index;\n const fullEnd = match.index + match[0].length;\n const content = match[1];\n const contentStart = fullStart + 2; // after ?[\n if (\n isOverlapping(fullStart, fullEnd) ||\n documentVariables.some(\n (marker) => marker.start <= fullStart && fullStart < marker.end\n )\n ) {\n continue;\n }\n\n // Outer brackets and question mark\n addMatch(fullStart, fullStart + 1, \"syntax-keyword\"); // ?\n addMatch(fullStart + 1, fullStart + 2, \"syntax-bracket\"); // [\n addMatch(fullEnd - 1, fullEnd, \"syntax-bracket\"); // ]\n\n const variables = interactionVariableRanges(content);\n const firstVariable = variables[0];\n const percentIndex = firstVariable ? firstVariable.start - 1 : -1;\n const hasLeadingAssignment =\n percentIndex >= 0 &&\n content[percentIndex] === \"%\" &&\n trimVariablePadding(content.slice(0, percentIndex)) === \"\";\n if (content.startsWith(\"%\") || hasLeadingAssignment) {\n // Input / Select\n let percentClass = \"syntax-percent-invalid\";\n if (firstVariable && hasLeadingAssignment) {\n const varFrom = contentStart + firstVariable.start;\n const varTo = contentStart + firstVariable.end;\n const cursorInsideVar = isCursorInside(varFrom, varTo);\n percentClass =\n firstVariable.name !== null && !cursorInsideVar\n ? \"syntax-percent-valid\"\n : \"syntax-percent-invalid\";\n }\n const percentStart =\n contentStart + (hasLeadingAssignment ? percentIndex : 0);\n addMatch(percentStart, percentStart + 1, percentClass); // %\n\n const operatorRanges: { from: number; to: number }[] = [];\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedTokenRanges: { from: number; to: number }[] = [];\n\n // Keep a variable name atomic even when it contains option punctuation.\n for (const variable of variables) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n // Inner operators | || ... -- skipping any an option escaped, the way the parser does.\n // Painted as separators, they told the author the grammar had split an option that it\n // had in fact left whole.\n let scanIndex = 0;\n while (scanIndex < content.length) {\n const variable = variableRanges.find(\n (range) => contentStart + scanIndex === range.from\n );\n if (variable) {\n scanIndex = variable.to - contentStart;\n continue;\n }\n if (isEscape(content, scanIndex)) {\n scanIndex += 2;\n continue;\n }\n const operator = content.startsWith(\"||\", scanIndex)\n ? \"||\"\n : content[scanIndex] === \"|\"\n ? \"|\"\n : content.startsWith(\"...\", scanIndex)\n ? \"...\"\n : null;\n if (!operator) {\n scanIndex += 1;\n continue;\n }\n operatorRanges.push({\n from: contentStart + scanIndex,\n to: contentStart + scanIndex + operator.length,\n });\n scanIndex += operator.length;\n }\n\n const allTokens = [\n ...operatorRanges.map((range) => ({\n ...range,\n className: \"syntax-keyword\",\n })),\n ...variableRanges.map((range) => ({\n ...range,\n className: range.className,\n })),\n ].sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of allTokens) {\n if (\n token.className.startsWith(\"syntax-variable\") &&\n isCursorInside(token.from, token.to)\n ) {\n continue;\n }\n if (addMatch(token.from, token.to, token.className)) {\n appliedTokenRanges.push({ from: token.from, to: token.to });\n }\n }\n\n // Content (Dark Blue) for remaining text segments\n const stringStart = percentStart + 1;\n const stringEnd = fullEnd - 1;\n let cursor = stringStart;\n const sortedApplied = appliedTokenRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const token of sortedApplied) {\n if (cursor < token.from) {\n addMatch(cursor, token.from, \"syntax-string\");\n }\n cursor = Math.max(cursor, token.to);\n }\n if (cursor < stringEnd) {\n addMatch(cursor, stringEnd, \"syntax-string\");\n }\n } else {\n // Button ?[text]\n const variableRanges: { from: number; to: number; className: string }[] =\n [];\n const appliedVariableRanges: { from: number; to: number }[] = [];\n\n for (const variable of interactionVariableRanges(content)) {\n variableRanges.push({\n from: contentStart + variable.start,\n to: contentStart + variable.end,\n className:\n variable.name === null\n ? \"syntax-variable-invalid\"\n : \"syntax-variable\",\n });\n }\n\n const sortedVariables = variableRanges.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return a.to - b.to;\n });\n\n for (const variable of sortedVariables) {\n if (\n variable.className.startsWith(\"syntax-variable\") &&\n isCursorInside(variable.from, variable.to)\n ) {\n continue;\n }\n if (addMatch(variable.from, variable.to, variable.className)) {\n appliedVariableRanges.push({ from: variable.from, to: variable.to });\n }\n }\n\n const buttonTextStart = contentStart;\n const buttonTextEnd = fullEnd - 1;\n let cursor = buttonTextStart;\n\n for (const variable of appliedVariableRanges) {\n if (cursor < variable.from) {\n addMatch(cursor, variable.from, \"syntax-button-text\");\n }\n cursor = Math.max(cursor, variable.to);\n }\n if (cursor < buttonTextEnd) {\n addMatch(cursor, buttonTextEnd, \"syntax-button-text\");\n }\n }\n }\n\n // 3. Variables (only if not already decorated; invalid ones stay default outside control blocks)\n for (const variable of documentVariables) {\n if (\n variable.name !== null &&\n !isCursorInside(variable.start, variable.end)\n ) {\n addMatch(variable.start, variable.end, \"syntax-variable\");\n }\n }\n\n // Sort matches by 'from' asc, then 'to' desc (longest first)\n matches.sort((a, b) => {\n if (a.from !== b.from) return a.from - b.from;\n return b.to - a.to;\n });\n\n return matches;\n}\n\nfunction buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>();\n const docText = view.state.doc.toString();\n const matches = collectSyntaxHighlightRanges(docText, (from, to) => {\n return view.state.selection.ranges.some((range) => {\n return range.from >= from && range.to <= to;\n });\n });\n\n for (const m of matches) {\n if (m.from < m.to) {\n try {\n builder.add(m.from, m.to, Decoration.mark({ class: m.className }));\n } catch (e) {\n console.warn(\"SyntaxHighlighter: Failed to add decoration\", m, e);\n }\n }\n }\n\n return builder.finish();\n}\n\nconst SyntaxHighlighter = ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = buildDecorations(view);\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged || update.selectionSet) {\n this.decorations = buildDecorations(update.view);\n }\n }\n },\n {\n decorations: (instance) => instance.decorations,\n }\n);\n\nexport default SyntaxHighlighter;\n"],"names":["commentRegex","interactionVariableRanges","text","markers","findVariableMarkers","pending","controlBlockRegex","INTERACTION_CONTENT_SOURCE","documentControlRanges","getMarkdownSourceAnalysis","collectMultilineFixedOutputRanges","docText","isInsideVariable","ranges","pendingStart","lineStart","newlineIndex","lineEnd","collectSingleLineFixedOutputRanges","commentRanges","commentIndex","isInsideComment","index","range","lineText","markerPositions","searchFrom","markerOffset","markerIndex","i","collectCommentRanges","match","collectOuterBlockRanges","variables","findDocumentVariableMarkers","position","marker","blockRanges","a","b","outerRanges","lastOuter","collectSyntaxHighlightRanges","isCursorInside","matches","documentVariables","occupied","isOverlapping","from","to","addMatch","className","control","fullStart","fullEnd","content","contentStart","firstVariable","percentIndex","hasLeadingAssignment","trimVariablePadding","percentClass","varFrom","varTo","cursorInsideVar","percentStart","operatorRanges","variableRanges","appliedTokenRanges","variable","scanIndex","isEscape","operator","allTokens","token","stringStart","stringEnd","cursor","sortedApplied","appliedVariableRanges","sortedVariables","buttonTextStart","buttonTextEnd","buildDecorations","view","builder","RangeSetBuilder","m","Decoration","e","SyntaxHighlighter","ViewPlugin","update","instance"],"mappings":"gWAiBMA,EAAe,mBAGfC,EAA6BC,GAAiB,CAClD,MAAMC,EAAUC,EAAAA,YAAAA,oBAAoBF,CAAI,EAClCG,EAAUH,EAAK,QAAQ,KAAMC,EAAQ,GAAG,EAAE,GAAG,KAAO,CAAC,EAC3D,OAAOE,IAAY,GACfF,EACA,CAAC,GAAGA,EAAS,CAAE,MAAOE,EAAS,IAAKH,EAAK,OAAQ,KAAM,KAAM,CACnE,EAKMI,EAAoB,IAAI,OAC5B,UAAUC,EAAAA,YAAAA,0BAA0B,cACpC,GACF,EAEMC,EAAyBN,GAC7BO,4BAA0BP,CAAI,EAAE,aAQlC,SAASQ,EACPC,EACAC,EACwB,CACxB,MAAMC,EAAiC,CAAA,EACvC,IAAIC,EAA8B,KAC9BC,EAAY,EAEhB,KAAOA,GAAaJ,EAAQ,QAAQ,CAClC,MAAMK,EAAeL,EAAQ,QAAQ;AAAA,EAAMI,CAAS,EAC9CE,EAAUD,IAAiB,GAAKL,EAAQ,OAASK,EAgBvD,G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AAO,gBACxD,KAAK,YAAcT,EAAiBS,EAAO,IAAI,EAEnD,CAAA,EAEF,CACE,YAAcC,GAAaA,EAAS,WAAA,CAExC"}
@@ -18,13 +18,9 @@ export declare function collectOuterBlockRanges(docText: string): SyntaxHighligh
18
18
  * @param isCursorInside - Returns true when the current cursor is inside a range.
19
19
  * @returns Non-overlapping syntax highlight ranges sorted by document position.
20
20
  */
21
- export declare function collectSyntaxHighlightRanges(docText: string, isCursorInside?: (from: number, to: number) => boolean, questionMode?: boolean): SyntaxHighlightRange[];
21
+ export declare function collectSyntaxHighlightRanges(docText: string, isCursorInside?: (from: number, to: number) => boolean): SyntaxHighlightRange[];
22
22
  declare const SyntaxHighlighter: ViewPlugin<{
23
23
  decorations: DecorationSet;
24
24
  update(update: ViewUpdate): void;
25
25
  }, undefined>;
26
- export declare const QuestionSyntaxHighlighter: ViewPlugin<{
27
- decorations: DecorationSet;
28
- update(update: ViewUpdate): void;
29
- }, undefined>;
30
26
  export default SyntaxHighlighter;
@@ -1,220 +1,215 @@
1
- import { ViewPlugin as P, Decoration as L } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
- import { RangeSetBuilder as _ } from "../../../node_modules/@codemirror/state/dist/index.es.js";
3
- import { getMarkdownSourceAnalysis as Q } from "../../ContentRender/utils/inline-code-ranges.es.js";
1
+ import { ViewPlugin as B, Decoration as H } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
+ import { RangeSetBuilder as P } from "../../../node_modules/@codemirror/state/dist/index.es.js";
3
+ import { getMarkdownSourceAnalysis as L } from "../../ContentRender/utils/inline-code-ranges.es.js";
4
4
  import { d as N } from "../../../_virtual/index.es.js";
5
- const H = /<!--[\s\S]*?-->/g, W = (n) => {
6
- const s = N.findVariableMarkers(n), f = n.indexOf("{{", s.at(-1)?.end ?? 0);
7
- return f === -1 ? s : [...s, { start: f, end: n.length, name: null }];
5
+ const F = /<!--[\s\S]*?-->/g, W = (n) => {
6
+ const i = N.findVariableMarkers(n), f = n.indexOf("{{", i.at(-1)?.end ?? 0);
7
+ return f === -1 ? i : [...i, { start: f, end: n.length, name: null }];
8
8
  }, M = new RegExp(
9
9
  `\\?\\[(${N.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,
10
10
  "g"
11
- ), U = (n) => Q(n).interactions;
12
- function $(n, s) {
11
+ ), _ = (n) => L(n).interactions;
12
+ function U(n, i) {
13
13
  const f = [];
14
- let i = null, d = 0;
15
- for (; d <= n.length; ) {
16
- const a = n.indexOf(`
17
- `, d), r = a === -1 ? n.length : a;
18
- if (n.slice(d, r).trim() === "!===" && !s(d) && (i === null ? i = d : (f.push({
19
- from: i,
20
- to: r,
14
+ let l = null, s = 0;
15
+ for (; s <= n.length; ) {
16
+ const u = n.indexOf(`
17
+ `, s), e = u === -1 ? n.length : u;
18
+ if (n.slice(s, e).trim() === "!===" && !i(s) && (l === null ? l = s : (f.push({
19
+ from: l,
20
+ to: e,
21
21
  className: "syntax-fixed"
22
- }), i = null)), a === -1)
22
+ }), l = null)), u === -1)
23
23
  break;
24
- d = a + 1;
24
+ s = u + 1;
25
25
  }
26
26
  return f;
27
27
  }
28
- function j(n, s, f) {
29
- const i = [];
30
- let d = 0;
31
- const a = (t) => {
32
- for (; d < s.length && s[d].to <= t; )
33
- d++;
34
- const o = s[d];
35
- return !!o && t >= o.from && t < o.to;
28
+ function $(n, i, f) {
29
+ const l = [];
30
+ let s = 0;
31
+ const u = (t) => {
32
+ for (; s < i.length && i[s].to <= t; )
33
+ s++;
34
+ const r = i[s];
35
+ return !!r && t >= r.from && t < r.to;
36
36
  };
37
- let r = 0;
38
- for (; r <= n.length; ) {
37
+ let e = 0;
38
+ for (; e <= n.length; ) {
39
39
  const t = n.indexOf(`
40
- `, r), o = t === -1 ? n.length : t, l = n.slice(r, o), g = [];
41
- let p = 0;
42
- for (; p < l.length; ) {
43
- const m = l.indexOf("===", p);
44
- if (m === -1)
40
+ `, e), r = t === -1 ? n.length : t, d = n.slice(e, r), x = [];
41
+ let g = 0;
42
+ for (; g < d.length; ) {
43
+ const c = d.indexOf("===", g);
44
+ if (c === -1)
45
45
  break;
46
- const h = r + m;
47
- !(h > 0 && n[h - 1] === "!") && !a(h) && !f(h) && g.push(h), p = m + 3;
46
+ const p = e + c;
47
+ !(p > 0 && n[p - 1] === "!") && !u(p) && !f(p) && x.push(p), g = c + 3;
48
48
  }
49
- for (let m = 0; m + 1 < g.length; m += 2)
50
- i.push({
51
- from: g[m],
52
- to: g[m + 1] + 3,
49
+ for (let c = 0; c + 1 < x.length; c += 2)
50
+ l.push({
51
+ from: x[c],
52
+ to: x[c + 1] + 3,
53
53
  className: "syntax-fixed"
54
54
  });
55
55
  if (t === -1)
56
56
  break;
57
- r = t + 1;
57
+ e = t + 1;
58
58
  }
59
- return i;
59
+ return l;
60
60
  }
61
- function z(n, s) {
61
+ function j(n, i) {
62
62
  const f = [];
63
- let i;
64
- for (H.lastIndex = 0; (i = H.exec(n)) !== null; )
65
- s(i.index) || f.push({
66
- from: i.index,
67
- to: i.index + i[0].length,
63
+ let l;
64
+ for (F.lastIndex = 0; (l = F.exec(n)) !== null; )
65
+ i(l.index) || f.push({
66
+ from: l.index,
67
+ to: l.index + l[0].length,
68
68
  className: "syntax-comment"
69
69
  });
70
70
  return f;
71
71
  }
72
- function G(n) {
73
- const s = N.findDocumentVariableMarkers(n), f = (r) => s.some(
74
- (t) => r >= t.start && r < t.end
75
- ), i = z(n, f), d = [
76
- ...$(n, f),
77
- ...j(
72
+ function q(n) {
73
+ const i = N.findDocumentVariableMarkers(n), f = (e) => i.some(
74
+ (t) => e >= t.start && e < t.end
75
+ ), l = j(n, f), s = [
76
+ ...U(n, f),
77
+ ...$(
78
78
  n,
79
- i,
79
+ l,
80
80
  f
81
81
  ),
82
- ...i
83
- ].sort((r, t) => r.from !== t.from ? r.from - t.from : t.to - r.to), a = [];
84
- for (const r of d) {
85
- const t = a[a.length - 1];
86
- (!t || r.from >= t.to) && a.push(r);
82
+ ...l
83
+ ].sort((e, t) => e.from !== t.from ? e.from - t.from : t.to - e.to), u = [];
84
+ for (const e of s) {
85
+ const t = u[u.length - 1];
86
+ (!t || e.from >= t.to) && u.push(e);
87
87
  }
88
- return a;
88
+ return u;
89
89
  }
90
- function J(n, s = () => !1, f = !1) {
91
- const i = [], d = N.findDocumentVariableMarkers(n), a = [];
90
+ function z(n, i = () => !1) {
91
+ const f = [], l = N.findDocumentVariableMarkers(n), s = [];
92
92
  M.lastIndex = 0;
93
- const r = (o, l) => a.some((g) => !(l <= g.from || o >= g.to)), t = (o, l, g) => o >= l || r(o, l) ? !1 : (a.push({ from: o, to: l }), i.push({ from: o, to: l, className: g }), !0);
94
- for (const o of G(n))
95
- t(o.from, o.to, o.className);
96
- for (const o of U(n)) {
97
- M.lastIndex = o.start;
98
- const l = M.exec(n);
99
- if (!l || l.index !== o.start || l.index + l[0].length !== o.end)
93
+ const u = (t, r) => s.some((d) => !(r <= d.from || t >= d.to)), e = (t, r, d) => t >= r || u(t, r) ? !1 : (s.push({ from: t, to: r }), f.push({ from: t, to: r, className: d }), !0);
94
+ for (const t of q(n))
95
+ e(t.from, t.to, t.className);
96
+ for (const t of _(n)) {
97
+ M.lastIndex = t.start;
98
+ const r = M.exec(n);
99
+ if (!r || r.index !== t.start || r.index + r[0].length !== t.end)
100
100
  continue;
101
- const g = l.index, p = l.index + l[0].length, m = l[1], h = g + 2;
102
- if (r(g, p) || d.some(
103
- (y) => y.start <= g && g < y.end
101
+ const d = r.index, x = r.index + r[0].length, g = r[1], c = d + 2;
102
+ if (u(d, x) || l.some(
103
+ (b) => b.start <= d && d < b.end
104
104
  ))
105
105
  continue;
106
- t(g, g + 1, "syntax-keyword"), t(g + 1, g + 2, "syntax-bracket"), t(p - 1, p, "syntax-bracket");
107
- const E = W(m), b = E[0], O = b ? b.start - 1 : -1, I = O >= 0 && m[O] === "%" && N.trimVariablePadding(m.slice(0, O)) === "";
108
- if (m.startsWith("%") || I) {
109
- let y = "syntax-percent-invalid";
110
- if (b && I) {
111
- const e = h + b.start, x = h + b.end, C = s(e, x);
112
- y = b.name !== null && !C ? "syntax-percent-valid" : "syntax-percent-invalid";
106
+ e(d, d + 1, "syntax-keyword"), e(d + 1, d + 2, "syntax-bracket"), e(x - 1, x, "syntax-bracket");
107
+ const p = W(g), y = p[0], O = y ? y.start - 1 : -1, E = O >= 0 && g[O] === "%" && N.trimVariablePadding(g.slice(0, O)) === "";
108
+ if (g.startsWith("%") || E) {
109
+ let b = "syntax-percent-invalid";
110
+ if (y && E) {
111
+ const o = c + y.start, h = c + y.end, I = i(o, h);
112
+ b = y.name !== null && !I ? "syntax-percent-valid" : "syntax-percent-invalid";
113
113
  }
114
- const v = h + (I ? O : 0);
115
- t(v, v + 1, y);
116
- const V = [], S = [], R = [];
117
- for (const e of E)
118
- S.push({
119
- from: h + e.start,
120
- to: h + e.end,
121
- className: e.name === null ? "syntax-variable-invalid" : "syntax-variable"
114
+ const v = c + (E ? O : 0);
115
+ e(v, v + 1, b);
116
+ const V = [], R = [], S = [];
117
+ for (const o of p)
118
+ R.push({
119
+ from: c + o.start,
120
+ to: c + o.end,
121
+ className: o.name === null ? "syntax-variable-invalid" : "syntax-variable"
122
122
  });
123
- let u = 0;
124
- for (; u < m.length; ) {
125
- const e = S.find(
126
- (C) => h + u === C.from
123
+ let m = 0;
124
+ for (; m < g.length; ) {
125
+ const o = R.find(
126
+ (I) => c + m === I.from
127
127
  );
128
- if (e) {
129
- u = e.to - h;
128
+ if (o) {
129
+ m = o.to - c;
130
130
  continue;
131
131
  }
132
- if (N.isEscape(m, u)) {
133
- u += 2;
132
+ if (N.isEscape(g, m)) {
133
+ m += 2;
134
134
  continue;
135
135
  }
136
- const x = m.startsWith("||", u) ? "||" : m[u] === "|" ? "|" : m.startsWith("...", u) ? "..." : null;
137
- if (!x) {
138
- u += 1;
136
+ const h = g.startsWith("||", m) ? "||" : g[m] === "|" ? "|" : g.startsWith("...", m) ? "..." : null;
137
+ if (!h) {
138
+ m += 1;
139
139
  continue;
140
140
  }
141
141
  V.push({
142
- from: h + u,
143
- to: h + u + x.length
144
- }), u += x.length;
142
+ from: c + m,
143
+ to: c + m + h.length
144
+ }), m += h.length;
145
145
  }
146
- const c = [
147
- ...V.map((e) => ({
148
- ...e,
146
+ const a = [
147
+ ...V.map((o) => ({
148
+ ...o,
149
149
  className: "syntax-keyword"
150
150
  })),
151
- ...S.map((e) => ({
152
- ...e,
153
- className: e.className
151
+ ...R.map((o) => ({
152
+ ...o,
153
+ className: o.className
154
154
  }))
155
- ].sort((e, x) => e.from !== x.from ? e.from - x.from : e.to - x.to);
156
- for (const e of c)
157
- e.className.startsWith("syntax-variable") && s(e.from, e.to) || t(e.from, e.to, e.className) && R.push({ from: e.from, to: e.to });
158
- const w = v + 1, F = p - 1;
155
+ ].sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
156
+ for (const o of a)
157
+ o.className.startsWith("syntax-variable") && i(o.from, o.to) || e(o.from, o.to, o.className) && S.push({ from: o.from, to: o.to });
158
+ const w = v + 1, C = x - 1;
159
159
  let k = w;
160
- const B = R.sort((e, x) => e.from !== x.from ? e.from - x.from : e.to - x.to);
161
- for (const e of B)
162
- k < e.from && t(k, e.from, "syntax-string"), k = Math.max(k, e.to);
163
- k < F && t(k, F, "syntax-string");
160
+ const D = S.sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
161
+ for (const o of D)
162
+ k < o.from && e(k, o.from, "syntax-string"), k = Math.max(k, o.to);
163
+ k < C && e(k, C, "syntax-string");
164
164
  } else {
165
- const y = [], v = [];
166
- for (const c of W(m))
167
- y.push({
168
- from: h + c.start,
169
- to: h + c.end,
170
- className: c.name === null ? "syntax-variable-invalid" : "syntax-variable"
165
+ const b = [], v = [];
166
+ for (const a of W(g))
167
+ b.push({
168
+ from: c + a.start,
169
+ to: c + a.end,
170
+ className: a.name === null ? "syntax-variable-invalid" : "syntax-variable"
171
171
  });
172
- const V = y.sort((c, w) => c.from !== w.from ? c.from - w.from : c.to - w.to);
173
- for (const c of V)
174
- c.className.startsWith("syntax-variable") && s(c.from, c.to) || t(c.from, c.to, c.className) && v.push({ from: c.from, to: c.to });
175
- const S = h, R = p - 1;
176
- let u = S;
177
- for (const c of v)
178
- u < c.from && t(u, c.from, "syntax-button-text"), u = Math.max(u, c.to);
179
- u < R && t(u, R, "syntax-button-text");
172
+ const V = b.sort((a, w) => a.from !== w.from ? a.from - w.from : a.to - w.to);
173
+ for (const a of V)
174
+ a.className.startsWith("syntax-variable") && i(a.from, a.to) || e(a.from, a.to, a.className) && v.push({ from: a.from, to: a.to });
175
+ const R = c, S = x - 1;
176
+ let m = R;
177
+ for (const a of v)
178
+ m < a.from && e(m, a.from, "syntax-button-text"), m = Math.max(m, a.to);
179
+ m < S && e(m, S, "syntax-button-text");
180
180
  }
181
181
  }
182
- for (const o of f ? [] : d)
183
- o.name !== null && !s(o.start, o.end) && t(o.start, o.end, "syntax-variable");
184
- return i.sort((o, l) => o.from !== l.from ? o.from - l.from : l.to - o.to), i;
182
+ for (const t of l)
183
+ t.name !== null && !i(t.start, t.end) && e(t.start, t.end, "syntax-variable");
184
+ return f.sort((t, r) => t.from !== r.from ? t.from - r.from : r.to - t.to), f;
185
185
  }
186
- function A(n, s = !1) {
187
- const f = new _(), i = n.state.doc.toString(), d = J(
188
- i,
189
- (a, r) => n.state.selection.ranges.some((t) => t.from >= a && t.to <= r),
190
- s
191
- );
192
- for (const a of d)
193
- if (a.from < a.to)
186
+ function A(n) {
187
+ const i = new P(), f = n.state.doc.toString(), l = z(f, (s, u) => n.state.selection.ranges.some((e) => e.from >= s && e.to <= u));
188
+ for (const s of l)
189
+ if (s.from < s.to)
194
190
  try {
195
- f.add(a.from, a.to, L.mark({ class: a.className }));
196
- } catch (r) {
197
- console.warn("SyntaxHighlighter: Failed to add decoration", a, r);
191
+ i.add(s.from, s.to, H.mark({ class: s.className }));
192
+ } catch (u) {
193
+ console.warn("SyntaxHighlighter: Failed to add decoration", s, u);
198
194
  }
199
- return f.finish();
195
+ return i.finish();
200
196
  }
201
- const D = (n = !1) => P.fromClass(
197
+ const T = B.fromClass(
202
198
  class {
203
- constructor(s) {
204
- this.decorations = A(s, n);
199
+ constructor(n) {
200
+ this.decorations = A(n);
205
201
  }
206
- update(s) {
207
- (s.docChanged || s.viewportChanged || s.selectionSet) && (this.decorations = A(s.view, n));
202
+ update(n) {
203
+ (n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations = A(n.view));
208
204
  }
209
205
  },
210
206
  {
211
- decorations: (s) => s.decorations
207
+ decorations: (n) => n.decorations
212
208
  }
213
- ), Z = D(), q = D(!0);
209
+ );
214
210
  export {
215
- q as QuestionSyntaxHighlighter,
216
- G as collectOuterBlockRanges,
217
- J as collectSyntaxHighlightRanges,
218
- Z as default
211
+ q as collectOuterBlockRanges,
212
+ z as collectSyntaxHighlightRanges,
213
+ T as default
219
214
  };
220
215
  //# sourceMappingURL=SyntaxHighlighter.es.js.map