markdown-flow-ui 0.2.35 → 0.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +12 -0
  2. package/dist/_virtual/index.es10.js +2 -2
  3. package/dist/_virtual/index.es3.js +5 -4
  4. package/dist/_virtual/index.es3.js.map +1 -1
  5. package/dist/_virtual/index.es4.js +4 -5
  6. package/dist/_virtual/index.es4.js.map +1 -1
  7. package/dist/_virtual/index.es5.js +5 -5
  8. package/dist/_virtual/index.es6.js +5 -3
  9. package/dist/_virtual/index.es6.js.map +1 -1
  10. package/dist/_virtual/index.es7.js +3 -5
  11. package/dist/_virtual/index.es7.js.map +1 -1
  12. package/dist/_virtual/index.es8.js +2 -2
  13. package/dist/_virtual/index10.cjs +1 -1
  14. package/dist/_virtual/index3.cjs +1 -1
  15. package/dist/_virtual/index4.cjs +1 -1
  16. package/dist/_virtual/index5.cjs +1 -1
  17. package/dist/_virtual/index6.cjs +1 -1
  18. package/dist/_virtual/index7.cjs +1 -1
  19. package/dist/_virtual/index8.cjs +1 -1
  20. package/dist/_virtual/variable-marker.cjs +2 -0
  21. package/dist/_virtual/variable-marker.cjs.map +1 -0
  22. package/dist/_virtual/variable-marker.es.js +5 -0
  23. package/dist/_virtual/variable-marker.es.js.map +1 -0
  24. package/dist/_virtual/variable-name.cjs +2 -0
  25. package/dist/_virtual/variable-name.cjs.map +1 -0
  26. package/dist/_virtual/variable-name.es.js +5 -0
  27. package/dist/_virtual/variable-name.es.js.map +1 -0
  28. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  29. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  30. package/dist/components/ContentRender/ContentRender.es.js +206 -205
  31. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  32. package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
  33. package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
  34. package/dist/components/ContentRender/plugins/CustomVariable.es.js +52 -51
  35. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  36. package/dist/components/ContentRender/utils/inline-code-ranges.cjs +9 -9
  37. package/dist/components/ContentRender/utils/inline-code-ranges.cjs.map +1 -1
  38. package/dist/components/ContentRender/utils/inline-code-ranges.d.ts +3 -0
  39. package/dist/components/ContentRender/utils/inline-code-ranges.es.js +185 -161
  40. package/dist/components/ContentRender/utils/inline-code-ranges.es.js.map +1 -1
  41. package/dist/components/ContentRender/utils/mermaid-parse.cjs +4 -4
  42. package/dist/components/ContentRender/utils/mermaid-parse.cjs.map +1 -1
  43. package/dist/components/ContentRender/utils/mermaid-parse.es.js +53 -48
  44. package/dist/components/ContentRender/utils/mermaid-parse.es.js.map +1 -1
  45. package/dist/components/ContentRender/utils/split-content.cjs +6 -6
  46. package/dist/components/ContentRender/utils/split-content.cjs.map +1 -1
  47. package/dist/components/ContentRender/utils/split-content.d.ts +1 -0
  48. package/dist/components/ContentRender/utils/split-content.es.js +361 -313
  49. package/dist/components/ContentRender/utils/split-content.es.js.map +1 -1
  50. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  51. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  52. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +286 -290
  53. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  54. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
  55. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
  56. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +62 -63
  57. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
  58. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  59. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +1 -1
  61. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  62. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -1
  63. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +13 -13
  64. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  65. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -1
  66. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +19 -19
  67. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  68. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -1
  69. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +13 -13
  70. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  71. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -1
  72. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +16 -16
  73. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  74. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -1
  75. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +13 -13
  76. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  77. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -1
  78. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +1 -1
  79. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  80. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -1
  81. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +1 -1
  82. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  83. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -1
  84. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +1 -1
  85. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  86. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -1
  87. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +13 -13
  88. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  89. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -1
  90. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +1 -1
  91. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  92. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  93. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +176 -174
  94. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  95. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +2 -1
  96. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +1 -1
  97. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +3 -1
  98. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +38 -55
  99. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +1 -1
  100. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.test.d.ts +1 -0
  101. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  102. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  103. package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -3
  104. package/dist/components/MarkdownFlowEditor/utils.es.js +47 -51
  105. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  106. package/dist/components/MarkdownFlowEditor/utils.variables.test.d.ts +1 -0
  107. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  108. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  109. package/dist/lib/interaction-defaults.cjs +1 -1
  110. package/dist/lib/interaction-defaults.cjs.map +1 -1
  111. package/dist/lib/interaction-defaults.es.js +123 -132
  112. package/dist/lib/interaction-defaults.es.js.map +1 -1
  113. package/dist/lib/interaction-defaults.failure.test.d.ts +1 -0
  114. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  115. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  116. package/dist/node_modules/classnames/index.cjs +1 -1
  117. package/dist/node_modules/classnames/index.es.js +1 -1
  118. package/dist/node_modules/cose-base/cose-base.cjs +1 -1
  119. package/dist/node_modules/cose-base/cose-base.cjs.map +1 -1
  120. package/dist/node_modules/cose-base/cose-base.es.js +1 -1
  121. package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs +1 -1
  122. package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.map +1 -1
  123. package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.es.js +1 -1
  124. package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs +1 -1
  125. package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.map +1 -1
  126. package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.es.js +1 -1
  127. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  128. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  129. package/dist/node_modules/layout-base/layout-base.cjs +1 -1
  130. package/dist/node_modules/layout-base/layout-base.cjs.map +1 -1
  131. package/dist/node_modules/layout-base/layout-base.es.js +1 -1
  132. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.cjs +1 -1
  133. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.es.js +1 -1
  134. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.cjs +1 -1
  135. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.es.js +1 -1
  136. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.cjs +1 -1
  137. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.es.js +1 -1
  138. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.cjs +1 -1
  139. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.es.js +1 -1
  140. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.cjs +1 -1
  141. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.es.js +1 -1
  142. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  143. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  144. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  145. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  146. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  147. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  148. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  149. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  150. package/dist/node_modules/remark-flow/dist/escaping.cjs +2 -2
  151. package/dist/node_modules/remark-flow/dist/escaping.cjs.map +1 -1
  152. package/dist/node_modules/remark-flow/dist/escaping.es.js +128 -63
  153. package/dist/node_modules/remark-flow/dist/escaping.es.js.map +1 -1
  154. package/dist/node_modules/remark-flow/dist/index.cjs +1 -1
  155. package/dist/node_modules/remark-flow/dist/index.cjs.map +1 -1
  156. package/dist/node_modules/remark-flow/dist/index.es.js +62 -33
  157. package/dist/node_modules/remark-flow/dist/index.es.js.map +1 -1
  158. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
  159. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
  160. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +260 -256
  161. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
  162. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  163. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs.map +1 -1
  164. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +71 -42
  165. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js.map +1 -1
  166. package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs +1 -1
  167. package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs.map +1 -1
  168. package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js +500 -46
  169. package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js.map +1 -1
  170. package/dist/node_modules/remark-flow/dist/variable-marker.cjs +2 -0
  171. package/dist/node_modules/remark-flow/dist/variable-marker.cjs.map +1 -0
  172. package/dist/node_modules/remark-flow/dist/variable-marker.es.js +77 -0
  173. package/dist/node_modules/remark-flow/dist/variable-marker.es.js.map +1 -0
  174. package/dist/node_modules/remark-flow/dist/variable-name.cjs +15 -0
  175. package/dist/node_modules/remark-flow/dist/variable-name.cjs.map +1 -0
  176. package/dist/node_modules/remark-flow/dist/variable-name.es.js +748 -0
  177. package/dist/node_modules/remark-flow/dist/variable-name.es.js.map +1 -0
  178. package/dist/node_modules/style-to-object/cjs/index.cjs +1 -1
  179. package/dist/node_modules/style-to-object/cjs/index.cjs.map +1 -1
  180. package/dist/node_modules/style-to-object/cjs/index.es.js +1 -1
  181. package/dist/node_modules/unified/lib/index.cjs +1 -1
  182. package/dist/node_modules/unified/lib/index.es.js +1 -1
  183. package/package.json +2 -2
@@ -1,280 +1,284 @@
1
- import { __exports as _ } from "../../../_virtual/interaction-parser.es.js";
2
- import { __require as I } from "./escaping.es.js";
3
- var p;
4
- function N() {
5
- return p ? _ : (p = 1, (function(l) {
6
- Object.defineProperty(l, "__esModule", { value: !0 }), l.InteractionParser = l.COMPILED_REGEXES = l.InteractionType = void 0, l.parseInteractionFormat = T, l.createInteractionParser = S;
7
- const a = I();
8
- var u;
9
- (function(o) {
10
- o.TEXT_ONLY = "text_only", o.BUTTONS_ONLY = "buttons_only", o.BUTTONS_WITH_TEXT = "buttons_with_text", o.BUTTONS_MULTI_SELECT = "buttons_multi_select", o.BUTTONS_MULTI_WITH_TEXT = "buttons_multi_with_text", o.NON_ASSIGNMENT_BUTTON = "non_assignment_button";
11
- })(u || (l.InteractionType = u = {})), l.COMPILED_REGEXES = {
12
- // Layer 1: Basic format validation - matches ?[content] but excludes ?[text](url) format.
13
- // The content accepts an escaped delimiter as one unit, so a `\]` inside an option does not
14
- // end the interaction. See ./escaping.
15
- LAYER1_INTERACTION: new RegExp(`\\?\\[(${a.INTERACTION_CONTENT_SOURCE})\\](?!\\()`),
16
- // Layer 2: Variable detection - matches %{{variable}}content format
17
- // (supports letters, numbers, underscores, Chinese characters, Japanese
18
- // kana, with optional spaces inside the braces). Superset of both the
19
- // repo history and the published 0.1.6 behavior.
20
- LAYER2_VARIABLE: /^%\{\{\s*([a-zA-Z0-9_\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff]+)\s*\}\}(.*)$/,
21
- // Layer 3: Split content before and after ...
22
- LAYER3_ELLIPSIS: /^(.*?)\.\.\.(.*)/,
23
- // Kept for consumers that inspect the exported regex collection. Exact
24
- // single-pipe splitting requires context that Safari-safe regexes cannot
25
- // express without consuming adjacent text, and now also has to skip a bar
26
- // an option escaped, so the parser uses the scanner in ./escaping instead.
27
- LAYER3_SINGLE_PIPE_SPLIT: /\|(?!\|)/g
28
- };
29
- class c {
30
- constructor() {
31
- }
32
- /**
33
- * Main parsing method
34
- *
35
- * @param content - Raw content of interaction block
36
- * @returns Standardized parse result
37
- */
38
- parse(e) {
39
- try {
40
- const t = this._layer1ValidateFormat(e);
41
- if (t === null)
42
- return this._createErrorResult(`Invalid interaction format: ${e}`);
43
- const [r, s, i] = this._layer2DetectVariable(t);
44
- return r && s ? this._layer3ParseVariableInteraction(s, i) : this._layer3ParseDisplayButtons(t);
45
- } catch (t) {
46
- return this._createErrorResult(`Parsing error: ${t instanceof Error ? t.message : "Unknown error"}`);
47
- }
48
- }
49
- /**
50
- * Parse and convert to remark-compatible format
51
- *
52
- * @param content - Raw content of interaction block
53
- * @returns remark-compatible result object
54
- */
55
- parseToRemarkFormat(e) {
56
- const t = this.parse(e);
57
- if (t.error)
58
- return { placeholder: e.trim() };
59
- const r = {};
60
- if (t.type === u.NON_ASSIGNMENT_BUTTON) {
61
- const s = t;
62
- s.buttons.length > 0 && (r.buttonTexts = s.buttons.map((i) => i.display), r.buttonValues = s.buttons.map((i) => i.value)), s.question !== void 0 && (r.placeholder = s.question), s.isMultiSelect !== void 0 && (r.isMultiSelect = s.isMultiSelect);
63
- } else if (t.type !== null) {
64
- const s = t;
65
- r.variableName = s.variable, s.buttons && (r.buttonTexts = s.buttons.map((i) => i.display), r.buttonValues = s.buttons.map((i) => i.value)), s.question !== void 0 && (r.placeholder = s.question), s.isMultiSelect !== void 0 && (r.isMultiSelect = s.isMultiSelect);
66
- }
67
- return r;
68
- }
69
- /**
70
- * Layer 1: Validate ?[] format and extract content
71
- *
72
- * @param content - Raw content
73
- * @returns Extracted bracket content, returns null if validation fails
74
- */
75
- _layer1ValidateFormat(e) {
76
- e = e.trim();
77
- const t = l.COMPILED_REGEXES.LAYER1_INTERACTION.exec(e);
78
- return !t || t[0].trim() !== e ? null : t[1];
1
+ import { __exports as o } from "../../../_virtual/interaction-parser.es.js";
2
+ import { __require as S } from "./escaping.es.js";
3
+ import { __require as I } from "./variable-name.es.js";
4
+ var d;
5
+ function h() {
6
+ if (d) return o;
7
+ d = 1, Object.defineProperty(o, "__esModule", { value: !0 }), o.InteractionParser = o.COMPILED_REGEXES = o.InteractionType = void 0, o.parseInteractionFormat = f, o.createInteractionParser = T;
8
+ const n = S(), s = I();
9
+ var u;
10
+ (function(c) {
11
+ c.TEXT_ONLY = "text_only", c.BUTTONS_ONLY = "buttons_only", c.BUTTONS_WITH_TEXT = "buttons_with_text", c.BUTTONS_MULTI_SELECT = "buttons_multi_select", c.BUTTONS_MULTI_WITH_TEXT = "buttons_multi_with_text", c.NON_ASSIGNMENT_BUTTON = "non_assignment_button";
12
+ })(u || (o.InteractionType = u = {})), o.COMPILED_REGEXES = {
13
+ // Layer 1: Basic format validation - matches ?[content] but excludes ?[text](url) format.
14
+ // The content accepts an escaped delimiter as one unit, so a `\]` inside an option does not
15
+ // end the interaction. See ./escaping.
16
+ LAYER1_INTERACTION: new RegExp(`\\?\\[(${n.INTERACTION_CONTENT_SOURCE})\\](?!\\()`),
17
+ // Names use the teaching engine's grammar; only the content after the marker is split into
18
+ // choices, display/value pairs or a text input. Punctuation inside the name is ordinary text.
19
+ LAYER2_VARIABLE: new RegExp(`^${s.VARIABLE_PADDING_SOURCE}${s.VARIABLE_ASSIGNMENT_SOURCE}([\\s\\S]*)$`),
20
+ // Layer 3: Split content before and after ...
21
+ LAYER3_ELLIPSIS: /^(.*?)\.\.\.(.*)/,
22
+ // Kept for consumers that inspect the exported regex collection. Exact
23
+ // single-pipe splitting requires context that Safari-safe regexes cannot
24
+ // express without consuming adjacent text, and now also has to skip a bar
25
+ // an option escaped, so the parser uses the scanner in ./escaping instead.
26
+ LAYER3_SINGLE_PIPE_SPLIT: /\|(?!\|)/g
27
+ };
28
+ class p {
29
+ constructor() {
30
+ }
31
+ /**
32
+ * Main parsing method
33
+ *
34
+ * @param content - Raw content of interaction block
35
+ * @returns Standardized parse result
36
+ */
37
+ parse(e) {
38
+ try {
39
+ const t = this._layer1ValidateFormat(e);
40
+ if (t === null)
41
+ return this._createErrorResult(`Invalid interaction format: ${e}`);
42
+ const [r, i, a] = this._layer2DetectVariable(t);
43
+ return r && i === null ? this._createErrorResult("Invalid variable name") : r && i ? this._layer3ParseVariableInteraction(i, a) : this._layer3ParseDisplayButtons(t);
44
+ } catch (t) {
45
+ return this._createErrorResult(`Parsing error: ${t instanceof Error ? t.message : "Unknown error"}`);
79
46
  }
80
- /**
81
- * Layer 2: Detect variables and perform pattern classification
82
- *
83
- * @param innerContent - Content extracted from layer 1
84
- * @returns [hasVariable, variableName, remainingContent]
85
- */
86
- _layer2DetectVariable(e) {
87
- const t = l.COMPILED_REGEXES.LAYER2_VARIABLE.exec(e);
88
- if (!t)
89
- return [!1, null, e];
90
- const r = t[1].trim(), s = t[2].trim();
91
- return [!0, r, s];
47
+ }
48
+ /**
49
+ * Parse and convert to remark-compatible format
50
+ *
51
+ * @param content - Raw content of interaction block
52
+ * @returns remark-compatible result object
53
+ */
54
+ parseToRemarkFormat(e) {
55
+ const t = this.parse(e);
56
+ if (t.error)
57
+ return { placeholder: (0, s.trimVariablePadding)(e) };
58
+ const r = {};
59
+ if (t.type === u.NON_ASSIGNMENT_BUTTON) {
60
+ const i = t;
61
+ i.buttons.length > 0 && (r.buttonTexts = i.buttons.map((a) => a.display), r.buttonValues = i.buttons.map((a) => a.value)), i.question !== void 0 && (r.placeholder = i.question), i.isMultiSelect !== void 0 && (r.isMultiSelect = i.isMultiSelect);
62
+ } else if (t.type !== null) {
63
+ const i = t;
64
+ r.variableName = i.variable, i.buttons && (r.buttonTexts = i.buttons.map((a) => a.display), r.buttonValues = i.buttons.map((a) => a.value)), i.question !== void 0 && (r.placeholder = i.question), i.isMultiSelect !== void 0 && (r.isMultiSelect = i.isMultiSelect);
92
65
  }
93
- /**
94
- * Parse the structural shape of interaction content: buttons, optional
95
- * `...question` text input, multi-select flag. Shared by the variable and
96
- * non-assignment branches, which only differ in how they map the shape
97
- * into their result types.
98
- *
99
- * @param content - Content after the (optional) variable
100
- * @returns The parsed content shape
101
- */
102
- _parseContentShape(e) {
103
- const t = (0, a.splitOnEllipsis)(e);
104
- if (t) {
105
- const r = t[0].trim(), s = (0, a.unescapeInteractionText)(t[1]).trim();
106
- if (r) {
107
- const [i, n] = this._parseButtons(r);
108
- return { buttons: i, question: s, isMultiSelect: n, hasTextInput: !0 };
109
- }
110
- return {
111
- buttons: [],
112
- question: s,
113
- isMultiSelect: !1,
114
- hasTextInput: !0
115
- };
116
- }
117
- if ((0, a.findUnescaped)(e, "|") >= 0) {
118
- const [r, s] = this._parseButtons(e);
119
- return { buttons: r, isMultiSelect: s, hasTextInput: !1 };
66
+ return r;
67
+ }
68
+ /**
69
+ * Layer 1: Validate ?[] format and extract content
70
+ *
71
+ * @param content - Raw content
72
+ * @returns Extracted bracket content, returns null if validation fails
73
+ */
74
+ _layer1ValidateFormat(e) {
75
+ e = (0, s.trimVariablePadding)(e);
76
+ const t = (0, n.readInteraction)(e);
77
+ return t?.complete && t.end === e.length ? t.content : null;
78
+ }
79
+ /**
80
+ * Layer 2: Detect variables and perform pattern classification
81
+ *
82
+ * @param innerContent - Content extracted from layer 1
83
+ * @returns [hasVariable, variableName, remainingContent]
84
+ */
85
+ _layer2DetectVariable(e) {
86
+ if (e = (0, s.trimVariablePadding)(e), !e.startsWith("%{{"))
87
+ return [!1, null, e];
88
+ const t = (0, s.readVariableMarker)(e, 1);
89
+ if (!t)
90
+ return [!0, null, e];
91
+ const r = (0, s.normalizeVariableName)(t.rawName), i = (0, s.trimVariablePadding)(e.slice(t.end));
92
+ return [!0, r, i];
93
+ }
94
+ /**
95
+ * Parse the structural shape of interaction content: buttons, optional
96
+ * `...question` text input, multi-select flag. Shared by the variable and
97
+ * non-assignment branches, which only differ in how they map the shape
98
+ * into their result types.
99
+ *
100
+ * @param content - Content after the (optional) variable
101
+ * @returns The parsed content shape
102
+ */
103
+ _parseContentShape(e) {
104
+ const t = (0, n.splitOnEllipsis)(e);
105
+ if (t) {
106
+ const r = (0, s.trimVariablePadding)(t[0]), i = (0, s.trimVariablePadding)((0, n.unescapeInteractionText)(t[1]));
107
+ if (r) {
108
+ const [a, l] = this._parseButtons(r);
109
+ return { buttons: a, question: i, isMultiSelect: l, hasTextInput: !0 };
120
110
  }
121
- return e ? {
122
- buttons: [this._parseSingleButton(e)],
123
- isMultiSelect: !1,
124
- hasTextInput: !1
125
- } : {
111
+ return {
126
112
  buttons: [],
127
- question: "",
113
+ question: i,
128
114
  isMultiSelect: !1,
129
115
  hasTextInput: !0
130
116
  };
131
117
  }
132
- /**
133
- * Layer 3: Parse variable interaction (variable assignment type)
134
- *
135
- * @param variableName - Variable name
136
- * @param content - Content after variable
137
- * @returns Parse result
138
- */
139
- _layer3ParseVariableInteraction(e, t) {
140
- const r = this._parseContentShape(t);
141
- return r.hasTextInput ? r.buttons.length > 0 ? {
142
- type: r.isMultiSelect ? u.BUTTONS_MULTI_WITH_TEXT : u.BUTTONS_WITH_TEXT,
143
- variable: e,
144
- buttons: r.buttons,
145
- question: r.question,
146
- isMultiSelect: r.isMultiSelect
147
- } : {
148
- type: u.TEXT_ONLY,
149
- variable: e,
150
- question: r.question ?? "",
151
- isMultiSelect: !1
152
- } : {
153
- type: r.isMultiSelect ? u.BUTTONS_MULTI_SELECT : u.BUTTONS_ONLY,
154
- variable: e,
155
- buttons: r.buttons,
156
- isMultiSelect: r.isMultiSelect
157
- };
118
+ if ((0, n.findUnescaped)(e, "|") >= 0) {
119
+ const [r, i] = this._parseButtons(e);
120
+ return { buttons: r, isMultiSelect: i, hasTextInput: !1 };
158
121
  }
159
- /**
160
- * Layer 3: Parse non-assignment interactions (no variable). Same shapes as
161
- * the variable branch; the answer is not assigned to a variable.
162
- *
163
- * @param content - Content
164
- * @returns Parse result
165
- */
166
- _layer3ParseDisplayButtons(e) {
167
- if (!e)
168
- return {
169
- type: u.NON_ASSIGNMENT_BUTTON,
170
- buttons: [{ display: "", value: "" }]
171
- };
172
- const t = this._parseContentShape(e), r = {
122
+ return e ? {
123
+ buttons: [this._parseSingleButton(e)],
124
+ isMultiSelect: !1,
125
+ hasTextInput: !1
126
+ } : {
127
+ buttons: [],
128
+ question: "",
129
+ isMultiSelect: !1,
130
+ hasTextInput: !0
131
+ };
132
+ }
133
+ /**
134
+ * Layer 3: Parse variable interaction (variable assignment type)
135
+ *
136
+ * @param variableName - Variable name
137
+ * @param content - Content after variable
138
+ * @returns Parse result
139
+ */
140
+ _layer3ParseVariableInteraction(e, t) {
141
+ const r = this._parseContentShape(t);
142
+ return r.hasTextInput ? r.buttons.length > 0 ? {
143
+ type: r.isMultiSelect ? u.BUTTONS_MULTI_WITH_TEXT : u.BUTTONS_WITH_TEXT,
144
+ variable: e,
145
+ buttons: r.buttons,
146
+ question: r.question,
147
+ isMultiSelect: r.isMultiSelect
148
+ } : {
149
+ type: u.TEXT_ONLY,
150
+ variable: e,
151
+ question: r.question ?? "",
152
+ isMultiSelect: !1
153
+ } : {
154
+ type: r.isMultiSelect ? u.BUTTONS_MULTI_SELECT : u.BUTTONS_ONLY,
155
+ variable: e,
156
+ buttons: r.buttons,
157
+ isMultiSelect: r.isMultiSelect
158
+ };
159
+ }
160
+ /**
161
+ * Layer 3: Parse non-assignment interactions (no variable). Same shapes as
162
+ * the variable branch; the answer is not assigned to a variable.
163
+ *
164
+ * @param content - Content
165
+ * @returns Parse result
166
+ */
167
+ _layer3ParseDisplayButtons(e) {
168
+ if (!e)
169
+ return {
173
170
  type: u.NON_ASSIGNMENT_BUTTON,
174
- buttons: t.buttons,
175
- isMultiSelect: t.isMultiSelect
171
+ buttons: [{ display: "", value: "" }]
176
172
  };
177
- return t.hasTextInput && (r.question = t.question), r;
178
- }
179
- /**
180
- * Parse button group with fault tolerance
181
- *
182
- * @param content - Button content, separated by | or ||
183
- * @returns [button list, isMultiSelect]
184
- */
185
- _parseButtons(e) {
186
- if (!e || typeof e != "string")
187
- return [[], !1];
188
- const [t, r] = this._detectSeparatorType(e), s = [];
189
- try {
190
- let i;
191
- r ? i = (0, a.splitUnescaped)(e, "||") : i = (0, a.splitOnSingleUnescapedPipe)(e);
192
- for (const n of i) {
193
- const f = n.trim();
194
- if (f) {
195
- const E = this._parseSingleButton(f);
196
- s.push(E);
197
- }
173
+ const t = this._parseContentShape(e), r = {
174
+ type: u.NON_ASSIGNMENT_BUTTON,
175
+ buttons: t.buttons,
176
+ isMultiSelect: t.isMultiSelect
177
+ };
178
+ return t.hasTextInput && (r.question = t.question), r;
179
+ }
180
+ /**
181
+ * Parse button group with fault tolerance
182
+ *
183
+ * @param content - Button content, separated by | or ||
184
+ * @returns [button list, isMultiSelect]
185
+ */
186
+ _parseButtons(e) {
187
+ if (!e || typeof e != "string")
188
+ return [[], !1];
189
+ const [t, r] = this._detectSeparatorType(e), i = [];
190
+ try {
191
+ let a;
192
+ r ? a = (0, n.splitUnescaped)(e, "||") : a = (0, n.splitOnSingleUnescapedPipe)(e);
193
+ for (const l of a) {
194
+ const _ = (0, s.trimVariablePadding)(l);
195
+ if (_) {
196
+ const b = this._parseSingleButton(_);
197
+ i.push(b);
198
198
  }
199
- } catch {
200
- const i = (0, a.unescapeInteractionText)(e).trim();
201
- return [[{ display: i, value: i }], !1];
202
199
  }
203
- if (!s.length && (e.trim() === "||" || e.trim() === "|"))
204
- return [[], r];
205
- if (!s.length && e.trim()) {
206
- const i = (0, a.unescapeInteractionText)(e).trim();
207
- s.push({ display: i, value: i });
208
- }
209
- return [s, r];
210
- }
211
- /**
212
- * Parse single button, supports Button//value format
213
- *
214
- * @param buttonText - Button text
215
- * @returns {display: display text, value: actual value}
216
- */
217
- _parseSingleButton(e) {
218
- e = e.trim();
219
- const t = (0, a.findUnescaped)(e, "//");
220
- if (t > 0 && t + 2 < e.length)
221
- return {
222
- display: (0, a.unescapeInteractionText)(e.slice(0, t)).trim(),
223
- value: (0, a.unescapeInteractionText)(e.slice(t + 2)).trim()
224
- };
225
- const r = (0, a.unescapeInteractionText)(e);
226
- return { display: r, value: r };
200
+ } catch {
201
+ const a = (0, s.trimVariablePadding)((0, n.unescapeInteractionText)(e));
202
+ return [[{ display: a, value: a }], !1];
227
203
  }
228
- /**
229
- * Detect separator type and whether it's multi-select
230
- *
231
- * Logic: The first separator type encountered determines the parsing mode:
232
- * - If first separator is |, then || is treated as part of the value
233
- * - If first separator is ||, then single | is treated as part of the value
234
- *
235
- * @param content - Button content to analyze
236
- * @returns [separator, isMultiSelect] where separator is '|' or '||'
237
- */
238
- _detectSeparatorType(e) {
239
- if (!e || typeof e != "string")
240
- return ["|", !1];
241
- const t = (0, a.findUnescaped)(e, "|"), r = (0, a.findUnescaped)(e, "||");
242
- return t === -1 ? ["|", !1] : r === -1 ? ["|", !1] : r <= t ? ["||", !0] : ["|", !1];
204
+ if (!i.length && ((0, s.trimVariablePadding)(e) === "||" || (0, s.trimVariablePadding)(e) === "|"))
205
+ return [[], r];
206
+ if (!i.length && (0, s.trimVariablePadding)(e)) {
207
+ const a = (0, s.trimVariablePadding)((0, n.unescapeInteractionText)(e));
208
+ i.push({ display: a, value: a });
243
209
  }
244
- /**
245
- * Create error result
246
- *
247
- * @param errorMessage - Error message
248
- * @returns Error result
249
- */
250
- _createErrorResult(e) {
210
+ return [i, r];
211
+ }
212
+ /**
213
+ * Parse single button, supports Button//value format
214
+ *
215
+ * @param buttonText - Button text
216
+ * @returns {display: display text, value: actual value}
217
+ */
218
+ _parseSingleButton(e) {
219
+ e = (0, s.trimVariablePadding)(e);
220
+ const t = (0, n.findUnescaped)(e, "//");
221
+ if (t > 0 && t + 2 < e.length)
251
222
  return {
252
- type: null,
253
- error: e
223
+ display: (0, s.trimVariablePadding)((0, n.unescapeInteractionText)(e.slice(0, t))),
224
+ value: (0, s.trimVariablePadding)((0, n.unescapeInteractionText)(e.slice(t + 2)))
254
225
  };
255
- }
226
+ const r = (0, n.unescapeInteractionText)(e);
227
+ return { display: r, value: r };
256
228
  }
257
- l.InteractionParser = c;
258
- function T(o) {
259
- const t = new c().parse(o);
260
- if (t.error)
261
- return [u.TEXT_ONLY, { question: o.trim() }];
262
- const r = t.type, s = {};
263
- if (t.type !== u.NON_ASSIGNMENT_BUTTON) {
264
- const n = t;
265
- n.variable !== void 0 && (s.variable = n.variable), n.buttons !== void 0 && (s.buttons = n.buttons), n.question !== void 0 && (s.question = n.question), n.isMultiSelect !== void 0 && (s.isMultiSelect = n.isMultiSelect);
266
- } else {
267
- const n = t;
268
- n.buttons !== void 0 && (s.buttons = n.buttons);
269
- }
270
- return [r || u.TEXT_ONLY, s];
229
+ /**
230
+ * Detect separator type and whether it's multi-select
231
+ *
232
+ * Logic: The first separator type encountered determines the parsing mode:
233
+ * - If first separator is |, then || is treated as part of the value
234
+ * - If first separator is ||, then single | is treated as part of the value
235
+ *
236
+ * @param content - Button content to analyze
237
+ * @returns [separator, isMultiSelect] where separator is '|' or '||'
238
+ */
239
+ _detectSeparatorType(e) {
240
+ if (!e || typeof e != "string")
241
+ return ["|", !1];
242
+ const t = (0, n.findUnescaped)(e, "|"), r = (0, n.findUnescaped)(e, "||");
243
+ return t === -1 ? ["|", !1] : r === -1 ? ["|", !1] : r <= t ? ["||", !0] : ["|", !1];
244
+ }
245
+ /**
246
+ * Create error result
247
+ *
248
+ * @param errorMessage - Error message
249
+ * @returns Error result
250
+ */
251
+ _createErrorResult(e) {
252
+ return {
253
+ type: null,
254
+ error: e
255
+ };
271
256
  }
272
- function S() {
273
- return new c();
257
+ }
258
+ o.InteractionParser = p;
259
+ function f(c) {
260
+ const t = new p().parse(c);
261
+ if (t.error)
262
+ return [
263
+ u.TEXT_ONLY,
264
+ { question: (0, s.trimVariablePadding)(c) }
265
+ ];
266
+ const r = t.type, i = {};
267
+ if (t.type !== u.NON_ASSIGNMENT_BUTTON) {
268
+ const l = t;
269
+ l.variable !== void 0 && (i.variable = l.variable), l.buttons !== void 0 && (i.buttons = l.buttons), l.question !== void 0 && (i.question = l.question), l.isMultiSelect !== void 0 && (i.isMultiSelect = l.isMultiSelect);
270
+ } else {
271
+ const l = t;
272
+ l.buttons !== void 0 && (i.buttons = l.buttons);
274
273
  }
275
- })(_), _);
274
+ return [r || u.TEXT_ONLY, i];
275
+ }
276
+ function T() {
277
+ return new p();
278
+ }
279
+ return o;
276
280
  }
277
281
  export {
278
- N as __require
282
+ h as __require
279
283
  };
280
284
  //# sourceMappingURL=interaction-parser.es.js.map