markdown-flow-ui 0.3.2 → 0.3.3

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 (243) hide show
  1. package/dist/_virtual/index.es6.js +5 -3
  2. package/dist/_virtual/index.es6.js.map +1 -1
  3. package/dist/_virtual/index.es7.js +3 -5
  4. package/dist/_virtual/index.es7.js.map +1 -1
  5. package/dist/_virtual/index.es8.js +2 -2
  6. package/dist/_virtual/index.es9.js +2 -2
  7. package/dist/_virtual/index6.cjs +1 -1
  8. package/dist/_virtual/index7.cjs +1 -1
  9. package/dist/_virtual/index8.cjs +1 -1
  10. package/dist/_virtual/index9.cjs +1 -1
  11. package/dist/assets/markdown-flow-ui.css +1 -10
  12. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
  13. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
  14. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +23 -24
  15. package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
  16. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  17. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  18. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +54 -53
  19. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  20. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
  21. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
  22. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +21 -22
  23. package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
  24. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  25. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  26. package/dist/components/MarkdownFlowEditor/utils.d.ts +5 -1
  27. package/dist/components/MarkdownFlowEditor/utils.es.js +40 -41
  28. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  29. package/dist/markdown-flow-ui-lib.css +1 -1
  30. package/dist/markdown-flow-ui.css +1 -10
  31. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  32. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  33. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-FOHPRMQF.cjs +2 -14
  34. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-FOHPRMQF.cjs.map +1 -1
  35. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-FOHPRMQF.es.js +6 -26
  36. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-FOHPRMQF.es.js.map +1 -1
  37. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ICYGCRZG.cjs +1 -1
  38. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ICYGCRZG.cjs.map +1 -1
  39. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ICYGCRZG.es.js +2 -6
  40. package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ICYGCRZG.es.js.map +1 -1
  41. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
  42. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
  43. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +1 -1
  44. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +1 -1
  45. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
  46. package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
  47. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
  48. package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -1
  49. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js +1 -1
  50. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  51. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +2 -2
  52. package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  53. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +1 -1
  54. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
  55. package/dist/node_modules/classnames/index.cjs +1 -5
  56. package/dist/node_modules/classnames/index.cjs.map +1 -1
  57. package/dist/node_modules/classnames/index.es.js +1 -6
  58. package/dist/node_modules/classnames/index.es.js.map +1 -1
  59. package/dist/node_modules/cytoscape/dist/cytoscape.esm.cjs +3 -13
  60. package/dist/node_modules/cytoscape/dist/cytoscape.esm.cjs.map +1 -1
  61. package/dist/node_modules/cytoscape/dist/cytoscape.esm.es.js +15 -46
  62. package/dist/node_modules/cytoscape/dist/cytoscape.esm.es.js.map +1 -1
  63. package/dist/node_modules/d3-scale/src/ordinal.es.js +1 -1
  64. package/dist/node_modules/d3-scale/src/ordinal.es.js.map +1 -1
  65. package/dist/node_modules/dompurify/dist/purify.es.cjs +2 -2
  66. package/dist/node_modules/dompurify/dist/purify.es.cjs.map +1 -1
  67. package/dist/node_modules/dompurify/dist/purify.es.es.js +0 -2
  68. package/dist/node_modules/dompurify/dist/purify.es.es.js.map +1 -1
  69. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  70. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  71. package/dist/node_modules/highlight.js/lib/core.es.js +1 -1
  72. package/dist/node_modules/highlight.js/lib/core.es.js.map +1 -1
  73. package/dist/node_modules/katex/dist/katex.cjs +18 -18
  74. package/dist/node_modules/katex/dist/katex.cjs.map +1 -1
  75. package/dist/node_modules/katex/dist/katex.es.js +2716 -3120
  76. package/dist/node_modules/katex/dist/katex.es.js.map +1 -1
  77. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs +1 -6
  78. package/dist/node_modules/lucide-react/dist/esm/Icon.cjs.map +1 -1
  79. package/dist/node_modules/lucide-react/dist/esm/Icon.es.js +0 -6
  80. package/dist/node_modules/lucide-react/dist/esm/Icon.es.js.map +1 -1
  81. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +1 -6
  82. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.cjs.map +1 -1
  83. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js +0 -6
  84. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.es.js.map +1 -1
  85. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +1 -6
  86. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.cjs.map +1 -1
  87. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.es.js +0 -6
  88. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.es.js.map +1 -1
  89. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs +1 -6
  90. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.cjs.map +1 -1
  91. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js +0 -6
  92. package/dist/node_modules/lucide-react/dist/esm/icons/captions-off.es.js.map +1 -1
  93. package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs +1 -6
  94. package/dist/node_modules/lucide-react/dist/esm/icons/captions.cjs.map +1 -1
  95. package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js +0 -6
  96. package/dist/node_modules/lucide-react/dist/esm/icons/captions.es.js.map +1 -1
  97. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs +1 -6
  98. package/dist/node_modules/lucide-react/dist/esm/icons/check.cjs.map +1 -1
  99. package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js +0 -6
  100. package/dist/node_modules/lucide-react/dist/esm/icons/check.es.js.map +1 -1
  101. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs +1 -6
  102. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs.map +1 -1
  103. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js +0 -6
  104. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.es.js.map +1 -1
  105. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs +1 -6
  106. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.cjs.map +1 -1
  107. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js +0 -6
  108. package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-down.es.js.map +1 -1
  109. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs +1 -6
  110. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.cjs.map +1 -1
  111. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js +0 -6
  112. package/dist/node_modules/lucide-react/dist/esm/icons/circle-check.es.js.map +1 -1
  113. package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs +1 -6
  114. package/dist/node_modules/lucide-react/dist/esm/icons/copy.cjs.map +1 -1
  115. package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js +0 -6
  116. package/dist/node_modules/lucide-react/dist/esm/icons/copy.es.js.map +1 -1
  117. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs +1 -6
  118. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.map +1 -1
  119. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js +0 -6
  120. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.es.js.map +1 -1
  121. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs +1 -6
  122. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.cjs.map +1 -1
  123. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js +0 -6
  124. package/dist/node_modules/lucide-react/dist/esm/icons/fast-forward.es.js.map +1 -1
  125. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs +1 -6
  126. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.cjs.map +1 -1
  127. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js +0 -6
  128. package/dist/node_modules/lucide-react/dist/esm/icons/file-type.es.js.map +1 -1
  129. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs +1 -6
  130. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.map +1 -1
  131. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js +0 -6
  132. package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js.map +1 -1
  133. package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs +1 -6
  134. package/dist/node_modules/lucide-react/dist/esm/icons/image.cjs.map +1 -1
  135. package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js +0 -6
  136. package/dist/node_modules/lucide-react/dist/esm/icons/image.es.js.map +1 -1
  137. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs +1 -6
  138. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.cjs.map +1 -1
  139. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js +0 -6
  140. package/dist/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js.map +1 -1
  141. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs +1 -6
  142. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.cjs.map +1 -1
  143. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js +0 -6
  144. package/dist/node_modules/lucide-react/dist/esm/icons/maximize.es.js.map +1 -1
  145. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs +1 -6
  146. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.cjs.map +1 -1
  147. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js +0 -6
  148. package/dist/node_modules/lucide-react/dist/esm/icons/rewind.es.js.map +1 -1
  149. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs +1 -6
  150. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.cjs.map +1 -1
  151. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js +0 -6
  152. package/dist/node_modules/lucide-react/dist/esm/icons/scan-line.es.js.map +1 -1
  153. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs +1 -6
  154. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.cjs.map +1 -1
  155. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js +0 -6
  156. package/dist/node_modules/lucide-react/dist/esm/icons/skip-back.es.js.map +1 -1
  157. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs +1 -6
  158. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.cjs.map +1 -1
  159. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js +0 -6
  160. package/dist/node_modules/lucide-react/dist/esm/icons/skip-forward.es.js.map +1 -1
  161. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs +1 -6
  162. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.cjs.map +1 -1
  163. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js +0 -6
  164. package/dist/node_modules/lucide-react/dist/esm/icons/square-check.es.js.map +1 -1
  165. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs +1 -6
  166. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.cjs.map +1 -1
  167. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js +0 -6
  168. package/dist/node_modules/lucide-react/dist/esm/icons/square-play.es.js.map +1 -1
  169. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs +1 -6
  170. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.cjs.map +1 -1
  171. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js +0 -6
  172. package/dist/node_modules/lucide-react/dist/esm/icons/text-cursor-input.es.js.map +1 -1
  173. package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs +1 -6
  174. package/dist/node_modules/lucide-react/dist/esm/icons/upload.cjs.map +1 -1
  175. package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js +0 -6
  176. package/dist/node_modules/lucide-react/dist/esm/icons/upload.es.js.map +1 -1
  177. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs +1 -6
  178. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.cjs.map +1 -1
  179. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js +0 -6
  180. package/dist/node_modules/lucide-react/dist/esm/icons/volume-2.es.js.map +1 -1
  181. package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs +1 -6
  182. package/dist/node_modules/lucide-react/dist/esm/icons/x.cjs.map +1 -1
  183. package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js +0 -6
  184. package/dist/node_modules/lucide-react/dist/esm/icons/x.es.js.map +1 -1
  185. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +1 -6
  186. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.cjs.map +1 -1
  187. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js +0 -6
  188. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.es.js.map +1 -1
  189. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-VBNYF7ZC.cjs +1 -1
  190. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-VBNYF7ZC.cjs.map +1 -1
  191. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-VBNYF7ZC.es.js +1 -6
  192. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-VBNYF7ZC.es.js.map +1 -1
  193. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.cjs +1 -1
  194. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.es.js +1 -1
  195. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.cjs +1 -1
  196. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.es.js +1 -1
  197. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.cjs +1 -1
  198. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.es.js +1 -1
  199. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.cjs +1 -1
  200. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.es.js +1 -1
  201. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.cjs +1 -1
  202. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.es.js +1 -1
  203. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/dagre-VZM6K2ZE.cjs +1 -1
  204. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/dagre-VZM6K2ZE.cjs.map +1 -1
  205. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/dagre-VZM6K2ZE.es.js +0 -3
  206. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/dagre-VZM6K2ZE.es.js.map +1 -1
  207. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-B4RE2ZJO.cjs +1 -1
  208. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-B4RE2ZJO.cjs.map +1 -1
  209. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-B4RE2ZJO.es.js +0 -2
  210. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-B4RE2ZJO.es.js.map +1 -1
  211. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.cjs +1 -1
  212. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.es.js +1 -1
  213. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.cjs +1 -1
  214. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.es.js +1 -1
  215. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-7S7Q4E2Y.cjs +1 -1
  216. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-7S7Q4E2Y.cjs.map +1 -1
  217. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-7S7Q4E2Y.es.js +0 -1
  218. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-7S7Q4E2Y.es.js.map +1 -1
  219. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.cjs +1 -1
  220. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.es.js +1 -1
  221. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.cjs +1 -1
  222. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.es.js +1 -1
  223. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.cjs +1 -1
  224. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.es.js +1 -1
  225. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.cjs +1 -1
  226. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.es.js +1 -1
  227. package/dist/node_modules/mermaid/dist/mermaid.core.cjs +1 -3
  228. package/dist/node_modules/mermaid/dist/mermaid.core.cjs.map +1 -1
  229. package/dist/node_modules/mermaid/dist/mermaid.core.es.js +0 -4
  230. package/dist/node_modules/mermaid/dist/mermaid.core.es.js.map +1 -1
  231. package/dist/node_modules/rc-util/es/React/isFragment.es.js +1 -1
  232. package/dist/node_modules/rc-util/es/React/isFragment.es.js.map +1 -1
  233. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.cjs +1 -9
  234. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.cjs.map +1 -1
  235. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.es.js +2 -11
  236. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.development.es.js.map +1 -1
  237. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.cjs +1 -9
  238. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.cjs.map +1 -1
  239. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.es.js +2 -11
  240. package/dist/node_modules/rc-util/node_modules/react-is/cjs/react-is.production.min.es.js.map +1 -1
  241. package/dist/node_modules/style-mod/src/style-mod.es.js +1 -1
  242. package/dist/node_modules/style-mod/src/style-mod.es.js.map +1 -1
  243. package/package.json +21 -20
@@ -1,9 +1,8 @@
1
1
  import { ViewPlugin as f, EditorView as x, Decoration as p, MatchDecorator as w } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
2
  import { SelectedOption as b } from "../types.es.js";
3
- import { unwrapFixedOutput as M } from "../utils.es.js";
4
- import P from "./PlaceholderWidget.es.js";
3
+ import { findDocumentVariableMarkers as M, unwrapFixedOutput as P } from "../utils.es.js";
4
+ import D from "./PlaceholderWidget.es.js";
5
5
  import { mediaPlaceholderLabels as l } from "./mediaPlaceholderLabels.es.js";
6
- import { d as D } from "../../../_virtual/index.es.js";
7
6
  const I = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, O = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, n = (t, c) => {
8
7
  const e = new RegExp(
9
8
  `${c}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,
@@ -12,50 +11,50 @@ const I = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, O = /===\s*(?:!\[[^\]]*\]\([
12
11
  if (r)
13
12
  return r[2] ?? r[3] ?? r[4];
14
13
  }, v = (t) => Math.max(1, Math.min(1e3, Math.round(t))), C = (t) => {
15
- const c = t?.[0] ?? "", e = M(c), r = /^\s*===/.test(c);
14
+ const c = t?.[0] ?? "", e = P(c), r = /^\s*===/.test(c);
16
15
  if (/^<img\b/i.test(e)) {
17
16
  const s = n(e, "src") ?? "", m = n(e, "alt") ?? n(e, "title") ?? "", h = n(e, "width");
18
- let d;
17
+ let u;
19
18
  if (h) {
20
- const u = Number.parseFloat(h);
21
- Number.isFinite(u) && (d = v(u));
19
+ const g = Number.parseFloat(h);
20
+ Number.isFinite(g) && (u = v(g));
22
21
  }
23
22
  return {
24
23
  text: m,
25
24
  url: s,
26
25
  title: m,
27
- scalePercent: d,
26
+ scalePercent: u,
28
27
  fixedOutput: r
29
28
  };
30
29
  }
31
- const a = e.match(I), i = a?.[1] ?? "", o = a?.[2] ?? "";
30
+ const o = e.match(I), i = o?.[1] ?? "", a = o?.[2] ?? "";
32
31
  return {
33
32
  text: i,
34
- url: o,
33
+ url: a,
35
34
  title: i,
36
35
  scalePercent: void 0,
37
36
  fixedOutput: r
38
37
  };
39
- }, g = (t) => {
40
- const c = D.findDocumentVariableMarkers(
38
+ }, d = (t) => {
39
+ const c = M(
41
40
  t.state.doc.toString()
42
41
  ).filter((e) => e.name !== null);
43
42
  return new w({
44
43
  regexp: O,
45
- decoration: (e, r, a) => {
46
- const i = a + e[0].length;
47
- if (c.some((s) => a < s.end && i > s.start))
44
+ decoration: (e, r, o) => {
45
+ const i = o + e[0].length;
46
+ if (c.some((s) => o < s.end && i > s.start))
48
47
  return null;
49
- const o = C(e);
48
+ const a = C(e);
50
49
  return p.replace({
51
- widget: new P(
52
- o.text || r.state.facet(l).image,
50
+ widget: new D(
51
+ a.text || r.state.facet(l).image,
53
52
  {
54
53
  tag: "image",
55
- url: o.url,
56
- title: o.title,
57
- scalePercent: o.scalePercent,
58
- fixedOutput: o.fixedOutput
54
+ url: a.url,
55
+ title: a.title,
56
+ scalePercent: a.scalePercent,
57
+ fixedOutput: a.fixedOutput
59
58
  },
60
59
  "tag-image",
61
60
  b.Image,
@@ -67,10 +66,10 @@ const I = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, O = /===\s*(?:!\[[^\]]*\]\([
67
66
  }, A = f.fromClass(
68
67
  class {
69
68
  constructor(t) {
70
- this.matcher = g(t), this.placeholders = this.matcher.createDeco(t);
69
+ this.matcher = d(t), this.placeholders = this.matcher.createDeco(t);
71
70
  }
72
71
  update(t) {
73
- if (t.docChanged && (this.matcher = g(t.view)), t.docChanged || t.startState.facet(l) !== t.state.facet(l)) {
72
+ if (t.docChanged && (this.matcher = d(t.view)), t.docChanged || t.startState.facet(l) !== t.state.facet(l)) {
74
73
  this.placeholders = this.matcher.createDeco(t.view);
75
74
  return;
76
75
  }
@@ -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 { findDocumentVariableMarkers, 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 createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\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};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.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","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","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,C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cesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { findDocumentVariableMarkers, 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 createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\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};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.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","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","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a,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACjB,MACnBA,EAAK,OAAOgB,CAAM,GAAG,gBAAgBR,EAAW,IACxD;AAAA,EAAA;AAEP;"}
@@ -1,4 +1,4 @@
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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("../../../node_modules/@codemirror/view/dist/index.cjs"),_=require("../../../node_modules/@codemirror/state/dist/index.cjs"),$=require("../../ContentRender/utils/inline-code-ranges.cjs"),B=require("../../../_virtual/index.cjs"),E=require("../utils.cjs"),q=/<!--[\s\S]*?-->/g,F=n=>{const i=E.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(`\\?\\[(${B.distExports.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,"g"),L=n=>$.getMarkdownSourceAnalysis(n).interactions;function j(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 T(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 U(n,i){const f=[];let l;for(q.lastIndex=0;(l=q.exec(n))!==null;)i(l.index)||f.push({from:l.index,to:l.index+l[0].length,className:"syntax-comment"});return f}function D(n){const i=E.findDocumentVariableMarkers(n),f=e=>i.some(t=>e>=t.start&&e<t.end),l=U(n,f),s=[...j(n,f),...T(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 H(n,i=()=>!1){const f=[],l=E.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 D(n))e(t.from,t.to,t.className);for(const t of L(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=F(g),y=p[0],w=y?y.start-1:-1,V=w>=0&&g[w]==="%"&&E.trimVariablePadding(g.slice(0,w))==="";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?w:0);e(v,v+1,b);const O=[],R=[],S=[];for(const o of p)R.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=R.find(I=>c+m===I.from);if(o){m=o.to-c;continue}if(B.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"})),...R.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)&&S.push({from:o.from,to:o.to});const N=v+1,C=x-1;let k=N;const P=S.sort((o,h)=>o.from!==h.from?o.from-h.from:o.to-h.to);for(const o of P)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 F(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,N)=>a.from!==N.from?a.from-N.from:a.to-N.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 R=c,S=x-1;let m=R;for(const a of v)m<a.from&&e(m,a.from,"syntax-button-text"),m=Math.max(m,a.to);m<S&&e(m,S,"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 W(n){const i=new _.RangeSetBuilder,f=n.state.doc.toString(),l=H(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 z=A.ViewPlugin.fromClass(class{constructor(n){this.decorations=W(n)}update(n){(n.docChanged||n.viewportChanged||n.selectionSet)&&(this.decorations=W(n.view))}},{decorations:n=>n.decorations});exports.collectOuterBlockRanges=D;exports.collectSyntaxHighlightRanges=H;exports.default=z;
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): 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,GAfiBL,EAAQ,MAAMI,EAAWE,CAAO,EAEpC,KAAA,IAAW,QAAU,CAACL,EAAiBG,CAAS,IACvDD,IAAiB,KACnBA,EAAeC,GAEfF,EAAO,KAAK,CACV,KAAMC,EACN,GAAIG,EACJ,UAAW,cAAA,CACZ,EACDH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lighter.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":"0XAiBMA,EAAe,mBAGfC,EAA6BC,GAAiB,CAClD,MAAMC,EAAUC,EAAAA,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,cAC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,CACnE,OAASE,EAAG,CACV,QAAQ,KAAK,8CAA+CF,EAAGE,CAAC,CAClE,CAIJ,OAAOJ,EAAQ,OAAA,CACjB,CAEA,MAAMK,EAAoBC,EAAAA,WAAW,UACnC,KAAM,CAGJ,YAAYP,EAAkB,CAC5B,KAAK,YAAcD,EAAiBC,CAAI,CAC1C,CAEA,OAAOQ,EAAoB,EACrBA,EAAO,YAAcA,EAAO,iBAAmBA,EAAO,gBACxD,KAAK,YAAcT,EAAiBS,EAAO,IAAI,EAEnD,CAAA,EAEF,CACE,YAAcC,GAAaA,EAAS,WAAA,CAExC"}
@@ -1,15 +1,16 @@
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
- import { d as N } from "../../../_virtual/index.es.js";
5
- const F = /<!--[\s\S]*?-->/g, W = (n) => {
6
- const i = N.findVariableMarkers(n), f = n.indexOf("{{", i.at(-1)?.end ?? 0);
1
+ import { ViewPlugin as H, Decoration as P } from "../../../node_modules/@codemirror/view/dist/index.es.js";
2
+ import { RangeSetBuilder as L } from "../../../node_modules/@codemirror/state/dist/index.es.js";
3
+ import { getMarkdownSourceAnalysis as _ } from "../../ContentRender/utils/inline-code-ranges.es.js";
4
+ import { d as A } from "../../../_virtual/index.es.js";
5
+ import { findDocumentVariableMarkers as B, trimVariablePadding as U, findVariableMarkers as $ } from "../utils.es.js";
6
+ const M = /<!--[\s\S]*?-->/g, F = (n) => {
7
+ const i = $(n), f = n.indexOf("{{", i.at(-1)?.end ?? 0);
7
8
  return f === -1 ? i : [...i, { start: f, end: n.length, name: null }];
8
- }, M = new RegExp(
9
- `\\?\\[(${N.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,
9
+ }, V = new RegExp(
10
+ `\\?\\[(${A.INTERACTION_CONTENT_SOURCE})\\](?!\\()`,
10
11
  "g"
11
- ), _ = (n) => L(n).interactions;
12
- function U(n, i) {
12
+ ), j = (n) => _(n).interactions;
13
+ function q(n, i) {
13
14
  const f = [];
14
15
  let l = null, s = 0;
15
16
  for (; s <= n.length; ) {
@@ -25,7 +26,7 @@ function U(n, i) {
25
26
  }
26
27
  return f;
27
28
  }
28
- function $(n, i, f) {
29
+ function z(n, i, f) {
29
30
  const l = [];
30
31
  let s = 0;
31
32
  const u = (t) => {
@@ -58,10 +59,10 @@ function $(n, i, f) {
58
59
  }
59
60
  return l;
60
61
  }
61
- function j(n, i) {
62
+ function G(n, i) {
62
63
  const f = [];
63
64
  let l;
64
- for (F.lastIndex = 0; (l = F.exec(n)) !== null; )
65
+ for (M.lastIndex = 0; (l = M.exec(n)) !== null; )
65
66
  i(l.index) || f.push({
66
67
  from: l.index,
67
68
  to: l.index + l[0].length,
@@ -69,12 +70,12 @@ function j(n, i) {
69
70
  });
70
71
  return f;
71
72
  }
72
- function q(n) {
73
- const i = N.findDocumentVariableMarkers(n), f = (e) => i.some(
73
+ function J(n) {
74
+ const i = B(n), f = (e) => i.some(
74
75
  (t) => e >= t.start && e < t.end
75
- ), l = j(n, f), s = [
76
- ...U(n, f),
77
- ...$(
76
+ ), l = G(n, f), s = [
77
+ ...q(n, f),
78
+ ...z(
78
79
  n,
79
80
  l,
80
81
  f
@@ -87,15 +88,15 @@ function q(n) {
87
88
  }
88
89
  return u;
89
90
  }
90
- function z(n, i = () => !1) {
91
- const f = [], l = N.findDocumentVariableMarkers(n), s = [];
92
- M.lastIndex = 0;
91
+ function K(n, i = () => !1) {
92
+ const f = [], l = B(n), s = [];
93
+ V.lastIndex = 0;
93
94
  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
+ for (const t of J(n))
95
96
  e(t.from, t.to, t.className);
96
- for (const t of _(n)) {
97
- M.lastIndex = t.start;
98
- const r = M.exec(n);
97
+ for (const t of j(n)) {
98
+ V.lastIndex = t.start;
99
+ const r = V.exec(n);
99
100
  if (!r || r.index !== t.start || r.index + r[0].length !== t.end)
100
101
  continue;
101
102
  const d = r.index, x = r.index + r[0].length, g = r[1], c = d + 2;
@@ -104,32 +105,32 @@ function z(n, i = () => !1) {
104
105
  ))
105
106
  continue;
106
107
  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
+ const p = F(g), y = p[0], w = y ? y.start - 1 : -1, E = w >= 0 && g[w] === "%" && U(g.slice(0, w)) === "";
108
109
  if (g.startsWith("%") || E) {
109
110
  let b = "syntax-percent-invalid";
110
111
  if (y && E) {
111
112
  const o = c + y.start, h = c + y.end, I = i(o, h);
112
113
  b = y.name !== null && !I ? "syntax-percent-valid" : "syntax-percent-invalid";
113
114
  }
114
- const v = c + (E ? O : 0);
115
+ const v = c + (E ? w : 0);
115
116
  e(v, v + 1, b);
116
- const V = [], R = [], S = [];
117
+ const O = [], N = [], R = [];
117
118
  for (const o of p)
118
- R.push({
119
+ N.push({
119
120
  from: c + o.start,
120
121
  to: c + o.end,
121
122
  className: o.name === null ? "syntax-variable-invalid" : "syntax-variable"
122
123
  });
123
124
  let m = 0;
124
125
  for (; m < g.length; ) {
125
- const o = R.find(
126
+ const o = N.find(
126
127
  (I) => c + m === I.from
127
128
  );
128
129
  if (o) {
129
130
  m = o.to - c;
130
131
  continue;
131
132
  }
132
- if (N.isEscape(g, m)) {
133
+ if (A.isEscape(g, m)) {
133
134
  m += 2;
134
135
  continue;
135
136
  }
@@ -138,69 +139,69 @@ function z(n, i = () => !1) {
138
139
  m += 1;
139
140
  continue;
140
141
  }
141
- V.push({
142
+ O.push({
142
143
  from: c + m,
143
144
  to: c + m + h.length
144
145
  }), m += h.length;
145
146
  }
146
147
  const a = [
147
- ...V.map((o) => ({
148
+ ...O.map((o) => ({
148
149
  ...o,
149
150
  className: "syntax-keyword"
150
151
  })),
151
- ...R.map((o) => ({
152
+ ...N.map((o) => ({
152
153
  ...o,
153
154
  className: o.className
154
155
  }))
155
156
  ].sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
156
157
  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
- let k = w;
160
- const D = S.sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
158
+ o.className.startsWith("syntax-variable") && i(o.from, o.to) || e(o.from, o.to, o.className) && R.push({ from: o.from, to: o.to });
159
+ const S = v + 1, C = x - 1;
160
+ let k = S;
161
+ const D = R.sort((o, h) => o.from !== h.from ? o.from - h.from : o.to - h.to);
161
162
  for (const o of D)
162
163
  k < o.from && e(k, o.from, "syntax-string"), k = Math.max(k, o.to);
163
164
  k < C && e(k, C, "syntax-string");
164
165
  } else {
165
166
  const b = [], v = [];
166
- for (const a of W(g))
167
+ for (const a of F(g))
167
168
  b.push({
168
169
  from: c + a.start,
169
170
  to: c + a.end,
170
171
  className: a.name === null ? "syntax-variable-invalid" : "syntax-variable"
171
172
  });
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)
173
+ const O = b.sort((a, S) => a.from !== S.from ? a.from - S.from : a.to - S.to);
174
+ for (const a of O)
174
175
  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;
176
+ const N = c, R = x - 1;
177
+ let m = N;
177
178
  for (const a of v)
178
179
  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
+ m < R && e(m, R, "syntax-button-text");
180
181
  }
181
182
  }
182
183
  for (const t of l)
183
184
  t.name !== null && !i(t.start, t.end) && e(t.start, t.end, "syntax-variable");
184
185
  return f.sort((t, r) => t.from !== r.from ? t.from - r.from : r.to - t.to), f;
185
186
  }
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));
187
+ function W(n) {
188
+ const i = new L(), f = n.state.doc.toString(), l = K(f, (s, u) => n.state.selection.ranges.some((e) => e.from >= s && e.to <= u));
188
189
  for (const s of l)
189
190
  if (s.from < s.to)
190
191
  try {
191
- i.add(s.from, s.to, H.mark({ class: s.className }));
192
+ i.add(s.from, s.to, P.mark({ class: s.className }));
192
193
  } catch (u) {
193
194
  console.warn("SyntaxHighlighter: Failed to add decoration", s, u);
194
195
  }
195
196
  return i.finish();
196
197
  }
197
- const T = B.fromClass(
198
+ const tt = H.fromClass(
198
199
  class {
199
200
  constructor(n) {
200
- this.decorations = A(n);
201
+ this.decorations = W(n);
201
202
  }
202
203
  update(n) {
203
- (n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations = A(n.view));
204
+ (n.docChanged || n.viewportChanged || n.selectionSet) && (this.decorations = W(n.view));
204
205
  }
205
206
  },
206
207
  {
@@ -208,8 +209,8 @@ const T = B.fromClass(
208
209
  }
209
210
  );
210
211
  export {
211
- q as collectOuterBlockRanges,
212
- z as collectSyntaxHighlightRanges,
213
- T as default
212
+ J as collectOuterBlockRanges,
213
+ K as collectSyntaxHighlightRanges,
214
+ tt as default
214
215
  };
215
216
  //# sourceMappingURL=SyntaxHighlighter.es.js.map