markdown-flow-ui 0.2.26-dev.9 → 0.2.27
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.
- package/dist/_virtual/escaping.cjs +2 -0
- package/dist/_virtual/escaping.cjs.map +1 -0
- package/dist/_virtual/escaping.es.js +5 -0
- package/dist/_virtual/escaping.es.js.map +1 -0
- package/dist/_virtual/index.es3.js +4 -5
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +5 -4
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +27 -26
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +131 -117
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/lib/interaction-defaults.cjs +1 -1
- package/dist/lib/interaction-defaults.cjs.map +1 -1
- package/dist/lib/interaction-defaults.es.js +25 -23
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/escaping.cjs +3 -0
- package/dist/node_modules/remark-flow/dist/escaping.cjs.map +1 -0
- package/dist/node_modules/remark-flow/dist/escaping.es.js +96 -0
- package/dist/node_modules/remark-flow/dist/escaping.es.js.map +1 -0
- package/dist/node_modules/remark-flow/dist/index.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/index.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/index.es.js +46 -25
- package/dist/node_modules/remark-flow/dist/index.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +123 -106
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +19 -18
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
const x =
|
|
1
|
+
import { d as p } from "../_virtual/index.es.js";
|
|
2
|
+
const x = p.createInteractionParser(), b = /<custom-variable\b/i, T = new RegExp(
|
|
3
|
+
`\\?\\[%\\{\\{([^}]+)\\}\\}(${p.INTERACTION_CONTENT_SOURCE})\\]`
|
|
4
|
+
), I = /^[\[{]/, g = /^[\s,,\n]+/, v = (t) => {
|
|
3
5
|
if (!t)
|
|
4
6
|
return null;
|
|
5
|
-
const n = t.match(
|
|
7
|
+
const n = t.match(T), s = n?.[1]?.trim(), e = n?.[2]?.trim();
|
|
6
8
|
if (!e)
|
|
7
9
|
return null;
|
|
8
10
|
const r = e.includes("||"), l = r ? "||" : "|", u = e.split(l).map((a) => a.trim()).filter(Boolean);
|
|
@@ -24,7 +26,7 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
24
26
|
placeholder: c,
|
|
25
27
|
isMultiSelect: r
|
|
26
28
|
};
|
|
27
|
-
},
|
|
29
|
+
}, E = (t) => {
|
|
28
30
|
if (!t)
|
|
29
31
|
return null;
|
|
30
32
|
try {
|
|
@@ -34,7 +36,7 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
34
36
|
} catch (n) {
|
|
35
37
|
console.warn("Failed to parse interaction block", n);
|
|
36
38
|
}
|
|
37
|
-
return
|
|
39
|
+
return v(t);
|
|
38
40
|
}, h = (t, n) => {
|
|
39
41
|
if (!t)
|
|
40
42
|
return null;
|
|
@@ -49,7 +51,7 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
49
51
|
value: e[u] || r[u],
|
|
50
52
|
display: r[u]
|
|
51
53
|
} : null;
|
|
52
|
-
},
|
|
54
|
+
}, V = (t) => t.split(/[,,\n]/).map((n) => n.trim()).filter(Boolean), d = (t) => t.replace(g, ""), R = (t) => {
|
|
53
55
|
const n = t.buttonValues || [], s = t.buttonTexts || [], e = [], r = /* @__PURE__ */ new Set();
|
|
54
56
|
return n.forEach((l, u) => {
|
|
55
57
|
const o = `${l ?? ""}`.trim(), i = `${s[u] ?? ""}`.trim();
|
|
@@ -65,8 +67,8 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
65
67
|
}), e.sort(
|
|
66
68
|
(l, u) => u.token.length - l.token.length
|
|
67
69
|
);
|
|
68
|
-
},
|
|
69
|
-
const s = d(t), e =
|
|
70
|
+
}, A = (t, n) => {
|
|
71
|
+
const s = d(t), e = R(n);
|
|
70
72
|
for (const r of e) {
|
|
71
73
|
if (!s.startsWith(r.token))
|
|
72
74
|
continue;
|
|
@@ -75,8 +77,8 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
75
77
|
return r;
|
|
76
78
|
}
|
|
77
79
|
return null;
|
|
78
|
-
},
|
|
79
|
-
const s =
|
|
80
|
+
}, N = (t, n) => {
|
|
81
|
+
const s = V(t);
|
|
80
82
|
if (!s.length)
|
|
81
83
|
return {};
|
|
82
84
|
const e = [], r = [];
|
|
@@ -95,11 +97,11 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
95
97
|
selectedValues: e.length ? e : void 0,
|
|
96
98
|
inputText: r.length ? r.join(", ") : void 0
|
|
97
99
|
};
|
|
98
|
-
},
|
|
100
|
+
}, O = (t, n) => {
|
|
99
101
|
const s = [];
|
|
100
102
|
let e = t.trim();
|
|
101
103
|
for (; e; ) {
|
|
102
|
-
const l =
|
|
104
|
+
const l = A(e, n);
|
|
103
105
|
if (!l)
|
|
104
106
|
break;
|
|
105
107
|
s.push(l.value);
|
|
@@ -113,11 +115,11 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
113
115
|
selectedValues: s,
|
|
114
116
|
inputText: n.placeholder && e.trim() ? e.trim() : void 0
|
|
115
117
|
};
|
|
116
|
-
const r =
|
|
118
|
+
const r = N(t, n);
|
|
117
119
|
return r.selectedValues?.length ? r : n.placeholder ? {
|
|
118
120
|
inputText: t.trim()
|
|
119
121
|
} : r;
|
|
120
|
-
},
|
|
122
|
+
}, S = (t) => {
|
|
121
123
|
if (!t || Array.isArray(t))
|
|
122
124
|
return null;
|
|
123
125
|
const n = Array.isArray(t.selectedValues) ? t.selectedValues.map((r) => `${r ?? ""}`.trim()).filter(Boolean) : void 0, s = `${t.buttonText ?? ""}`.trim(), e = typeof t.inputText == "string" ? t.inputText : void 0;
|
|
@@ -126,16 +128,16 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
126
128
|
inputText: e,
|
|
127
129
|
selectedValues: n?.length ? n : void 0
|
|
128
130
|
};
|
|
129
|
-
},
|
|
131
|
+
}, D = (t) => {
|
|
130
132
|
if (!t || !I.test(t.trim()))
|
|
131
133
|
return null;
|
|
132
134
|
try {
|
|
133
135
|
const n = JSON.parse(t);
|
|
134
|
-
return
|
|
136
|
+
return S(n);
|
|
135
137
|
} catch {
|
|
136
138
|
return null;
|
|
137
139
|
}
|
|
138
|
-
},
|
|
140
|
+
}, C = (t) => !!(t && (b.test(t) || T.test(t))), m = (t, n, s, e) => e?.resolveDefaultValues?.({
|
|
139
141
|
content: t,
|
|
140
142
|
rawValue: n,
|
|
141
143
|
interactionInfo: s
|
|
@@ -143,7 +145,7 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
143
145
|
const e = n?.toString().trim();
|
|
144
146
|
if (!e)
|
|
145
147
|
return {};
|
|
146
|
-
const r =
|
|
148
|
+
const r = D(e);
|
|
147
149
|
if (r)
|
|
148
150
|
return r;
|
|
149
151
|
const l = m(
|
|
@@ -154,12 +156,12 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
154
156
|
);
|
|
155
157
|
if (l)
|
|
156
158
|
return l;
|
|
157
|
-
if (!
|
|
159
|
+
if (!C(t))
|
|
158
160
|
return {
|
|
159
161
|
buttonText: e,
|
|
160
162
|
inputText: e
|
|
161
163
|
};
|
|
162
|
-
const u =
|
|
164
|
+
const u = E(t), o = m(
|
|
163
165
|
t,
|
|
164
166
|
e,
|
|
165
167
|
u,
|
|
@@ -173,7 +175,7 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
173
175
|
inputText: e
|
|
174
176
|
};
|
|
175
177
|
if (u.isMultiSelect)
|
|
176
|
-
return
|
|
178
|
+
return O(e, u);
|
|
177
179
|
const i = h(e, u);
|
|
178
180
|
return i ? {
|
|
179
181
|
buttonText: i.value || i.display || e
|
|
@@ -183,12 +185,12 @@ const x = T.createInteractionParser(), b = /<custom-variable\b/i, p = /\?\[%\{\{
|
|
|
183
185
|
buttonText: e,
|
|
184
186
|
inputText: e
|
|
185
187
|
};
|
|
186
|
-
},
|
|
188
|
+
}, B = (t, n, s) => {
|
|
187
189
|
const e = _(t, n, s);
|
|
188
190
|
return e.selectedValues ? e.selectedValues : n ? n.split(",").map((r) => r.trim()).filter(Boolean) : void 0;
|
|
189
191
|
};
|
|
190
192
|
export {
|
|
191
|
-
|
|
193
|
+
B as getInteractionDefaultSelectedValues,
|
|
192
194
|
_ as getInteractionDefaultValues
|
|
193
195
|
};
|
|
194
196
|
//# sourceMappingURL=interaction-defaults.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction-defaults.es.js","sources":["../../src/lib/interaction-defaults.ts"],"sourcesContent":["import { createInteractionParser } from \"remark-flow\";\n\nexport interface InteractionParseResult {\n buttonTexts?: string[];\n buttonValues?: string[];\n placeholder?: string;\n variableName?: string;\n isMultiSelect?: boolean;\n}\n\nexport interface InteractionDefaultValues {\n buttonText?: string;\n inputText?: string;\n selectedValues?: string[];\n}\n\nexport interface InteractionDefaultResolverParams {\n content?: string | null;\n rawValue?: string | null;\n interactionInfo?: InteractionParseResult | null;\n}\n\nexport type InteractionDefaultResolver = (\n params: InteractionDefaultResolverParams\n) => InteractionDefaultValues | null | undefined;\n\nexport interface InteractionDefaultValueOptions {\n resolveDefaultValues?: InteractionDefaultResolver;\n}\n\ninterface StructuredInteractionPayload {\n buttonText?: unknown;\n inputText?: unknown;\n selectedValues?: unknown;\n}\n\nconst interactionParser = createInteractionParser();\nconst INTERACTION_TAG_PATTERN = /<custom-variable\\b/i;\nconst INTERACTION_SHORTCODE_PATTERN = /\\?\\[%\\{\\{([^}]+)\\}\\}([\\s\\S]*?)\\]/;\nconst JSON_LIKE_VALUE_PATTERN = /^[\\[{]/;\nconst INTERACTION_VALUE_SEPARATOR_PATTERN = /^[\\s,,\\n]+/;\n\ninterface InteractionOptionCandidate {\n token: string;\n value: string;\n}\n\nconst parseInteractionShortcode = (\n content?: string | null\n): InteractionParseResult | null => {\n if (!content) {\n return null;\n }\n\n const matched = content.match(INTERACTION_SHORTCODE_PATTERN);\n const variableName = matched?.[1]?.trim();\n const interactionBody = matched?.[2]?.trim();\n\n if (!interactionBody) {\n return null;\n }\n\n const isMultiSelect = interactionBody.includes(\"||\");\n const separator = isMultiSelect ? \"||\" : \"|\";\n const rawOptions = interactionBody\n .split(separator)\n .map((item) => item.trim())\n .filter(Boolean);\n\n if (!rawOptions.length) {\n return null;\n }\n\n const buttonTexts: string[] = [];\n const buttonValues: string[] = [];\n let placeholder: string | undefined;\n\n rawOptions.forEach((option) => {\n if (option.startsWith(\"...\")) {\n const normalizedPlaceholder = option.replace(/^\\.\\.\\./, \"\").trim();\n if (normalizedPlaceholder) {\n placeholder = normalizedPlaceholder;\n }\n return;\n }\n\n buttonTexts.push(option);\n buttonValues.push(option);\n });\n\n return {\n variableName,\n buttonTexts: buttonTexts.length ? buttonTexts : undefined,\n buttonValues: buttonValues.length ? buttonValues : undefined,\n placeholder,\n isMultiSelect,\n };\n};\n\nconst parseInteractionBlock = (\n content?: string | null\n): InteractionParseResult | null => {\n if (!content) {\n return null;\n }\n\n try {\n return interactionParser.parseToRemarkFormat(\n content\n ) as InteractionParseResult;\n } catch (error) {\n console.warn(\"Failed to parse interaction block\", error);\n }\n\n return parseInteractionShortcode(content);\n};\n\nconst normalizeButtonValue = (\n token: string,\n info: InteractionParseResult\n): { value: string; display?: string } | null => {\n if (!token) {\n return null;\n }\n\n const cleaned = token.trim();\n const buttonValues = info.buttonValues || [];\n const buttonTexts = info.buttonTexts || [];\n const valueIndex = buttonValues.indexOf(cleaned);\n\n if (valueIndex > -1) {\n return {\n value: buttonValues[valueIndex],\n display: buttonTexts[valueIndex],\n };\n }\n\n const textIndex = buttonTexts.indexOf(cleaned);\n\n if (textIndex > -1) {\n return {\n value: buttonValues[textIndex] || buttonTexts[textIndex],\n display: buttonTexts[textIndex],\n };\n }\n\n return null;\n};\n\nconst splitPresetValues = (raw: string) => {\n return raw\n .split(/[,,\\n]/)\n .map((item) => item.trim())\n .filter(Boolean);\n};\n\nconst trimLeadingInteractionSeparators = (raw: string) =>\n raw.replace(INTERACTION_VALUE_SEPARATOR_PATTERN, \"\");\n\nconst buildInteractionOptionCandidates = (\n info: InteractionParseResult\n): InteractionOptionCandidate[] => {\n const buttonValues = info.buttonValues || [];\n const buttonTexts = info.buttonTexts || [];\n const candidates: InteractionOptionCandidate[] = [];\n const seenCandidates = new Set<string>();\n\n buttonValues.forEach((buttonValue, index) => {\n const normalizedValue = `${buttonValue ?? \"\"}`.trim();\n const normalizedText = `${buttonTexts[index] ?? \"\"}`.trim();\n\n [normalizedValue, normalizedText].forEach((token) => {\n if (!token) {\n return;\n }\n\n const candidateKey = `${token}::${normalizedValue || token}`;\n if (seenCandidates.has(candidateKey)) {\n return;\n }\n\n seenCandidates.add(candidateKey);\n candidates.push({\n token,\n value: normalizedValue || token,\n });\n });\n });\n\n return candidates.sort(\n (left, right) => right.token.length - left.token.length\n );\n};\n\nconst matchInteractionOptionPrefix = (\n raw: string,\n info: InteractionParseResult\n): InteractionOptionCandidate | null => {\n const normalizedRaw = trimLeadingInteractionSeparators(raw);\n const candidates = buildInteractionOptionCandidates(info);\n\n for (const candidate of candidates) {\n if (!normalizedRaw.startsWith(candidate.token)) {\n continue;\n }\n\n const trailingChar = normalizedRaw[candidate.token.length];\n if (trailingChar && !/[\\s,,\\n]/.test(trailingChar)) {\n continue;\n }\n\n return candidate;\n }\n\n return null;\n};\n\nconst resolveMultiSelectFallbackDefaults = (\n raw: string,\n info: InteractionParseResult\n): InteractionDefaultValues => {\n const tokens = splitPresetValues(raw);\n\n if (!tokens.length) {\n return {};\n }\n\n const selectedValues: string[] = [];\n const customInputs: string[] = [];\n\n tokens.forEach((token) => {\n const mapped = normalizeButtonValue(token, info);\n\n if (mapped) {\n selectedValues.push(mapped.value);\n return;\n }\n\n if (info.placeholder) {\n customInputs.push(token);\n return;\n }\n\n selectedValues.push(token);\n });\n\n return {\n selectedValues: selectedValues.length ? selectedValues : undefined,\n inputText: customInputs.length ? customInputs.join(\", \") : undefined,\n };\n};\n\nconst resolveMultiSelectInteractionDefaults = (\n raw: string,\n info: InteractionParseResult\n): InteractionDefaultValues => {\n const selectedValues: string[] = [];\n let remainingRaw = raw.trim();\n\n // Prefer option-aware prefix matching before delimiter splitting so\n // option labels that contain commas can still round-trip correctly.\n while (remainingRaw) {\n const matchedCandidate = matchInteractionOptionPrefix(remainingRaw, info);\n\n if (!matchedCandidate) {\n break;\n }\n\n selectedValues.push(matchedCandidate.value);\n const normalizedRemainingRaw =\n trimLeadingInteractionSeparators(remainingRaw);\n remainingRaw = trimLeadingInteractionSeparators(\n normalizedRemainingRaw.slice(matchedCandidate.token.length)\n );\n }\n\n if (selectedValues.length > 0) {\n return {\n selectedValues,\n inputText:\n info.placeholder && remainingRaw.trim()\n ? remainingRaw.trim()\n : undefined,\n };\n }\n\n const fallbackDefaults = resolveMultiSelectFallbackDefaults(raw, info);\n\n if (fallbackDefaults.selectedValues?.length) {\n return fallbackDefaults;\n }\n\n if (info.placeholder) {\n return {\n inputText: raw.trim(),\n };\n }\n\n return fallbackDefaults;\n};\n\nconst normalizeStructuredInteractionDefaults = (\n payload?: StructuredInteractionPayload | null\n): InteractionDefaultValues | null => {\n if (!payload || Array.isArray(payload)) {\n return null;\n }\n\n const selectedValues = Array.isArray(payload.selectedValues)\n ? payload.selectedValues\n .map((item) => `${item ?? \"\"}`.trim())\n .filter(Boolean)\n : undefined;\n const buttonText = `${payload.buttonText ?? \"\"}`.trim();\n const inputText =\n typeof payload.inputText === \"string\" ? payload.inputText : undefined;\n\n if (!selectedValues?.length && !buttonText && !inputText) {\n return null;\n }\n\n return {\n buttonText: buttonText || undefined,\n inputText,\n selectedValues: selectedValues?.length ? selectedValues : undefined,\n };\n};\n\nconst parseStructuredInteractionDefaults = (rawValue?: string | null) => {\n if (!rawValue) {\n return null;\n }\n\n if (!JSON_LIKE_VALUE_PATTERN.test(rawValue.trim())) {\n return null;\n }\n\n try {\n const parsed = JSON.parse(rawValue) as StructuredInteractionPayload;\n return normalizeStructuredInteractionDefaults(parsed);\n } catch {\n return null;\n }\n};\n\nconst hasPotentialInteractionBlock = (content?: string | null) =>\n Boolean(\n content &&\n (INTERACTION_TAG_PATTERN.test(content) ||\n INTERACTION_SHORTCODE_PATTERN.test(content))\n );\n\nconst resolveCustomInteractionDefaults = (\n content?: string | null,\n rawValue?: string | null,\n interactionInfo?: InteractionParseResult | null,\n options?: InteractionDefaultValueOptions\n) => {\n return (\n options?.resolveDefaultValues?.({\n content,\n rawValue,\n interactionInfo,\n }) ?? null\n );\n};\n\nexport const getInteractionDefaultValues = (\n content?: string | null,\n rawValue?: string | null,\n options?: InteractionDefaultValueOptions\n): InteractionDefaultValues => {\n const normalized = rawValue?.toString().trim();\n\n if (!normalized) {\n return {};\n }\n\n const structuredDefaults = parseStructuredInteractionDefaults(normalized);\n\n if (structuredDefaults) {\n return structuredDefaults;\n }\n\n const customDefaults = resolveCustomInteractionDefaults(\n content,\n normalized,\n null,\n options\n );\n\n if (customDefaults) {\n return customDefaults;\n }\n\n if (!hasPotentialInteractionBlock(content)) {\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n }\n\n const interactionInfo = parseInteractionBlock(content);\n const customDefaultsWithInteraction = resolveCustomInteractionDefaults(\n content,\n normalized,\n interactionInfo,\n options\n );\n\n if (customDefaultsWithInteraction) {\n return customDefaultsWithInteraction;\n }\n\n if (!interactionInfo) {\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n }\n\n if (interactionInfo.isMultiSelect) {\n return resolveMultiSelectInteractionDefaults(normalized, interactionInfo);\n }\n\n const mapped = normalizeButtonValue(normalized, interactionInfo);\n\n if (mapped) {\n return {\n buttonText: mapped.value || mapped.display || normalized,\n };\n }\n\n if (interactionInfo.placeholder) {\n return {\n inputText: normalized,\n };\n }\n\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n};\n\nexport const getInteractionDefaultSelectedValues = (\n content?: string | null,\n rawValue?: string | null,\n options?: InteractionDefaultValueOptions\n) => {\n const defaults = getInteractionDefaultValues(content, rawValue, options);\n\n if (defaults.selectedValues) {\n return defaults.selectedValues;\n }\n\n return rawValue\n ? rawValue\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined;\n};\n"],"names":["interactionParser","createInteractionParser","INTERACTION_TAG_PATTERN","INTERACTION_SHORTCODE_PATTERN","JSON_LIKE_VALUE_PATTERN","INTERACTION_VALUE_SEPARATOR_PATTERN","parseInteractionShortcode","content","matched","variableName","interactionBody","isMultiSelect","separator","rawOptions","item","buttonTexts","buttonValues","placeholder","option","normalizedPlaceholder","parseInteractionBlock","error","normalizeButtonValue","token","info","cleaned","valueIndex","textIndex","splitPresetValues","raw","trimLeadingInteractionSeparators","buildInteractionOptionCandidates","candidates","seenCandidates","buttonValue","index","normalizedValue","normalizedText","candidateKey","left","right","matchInteractionOptionPrefix","normalizedRaw","candidate","trailingChar","resolveMultiSelectFallbackDefaults","tokens","selectedValues","customInputs","mapped","resolveMultiSelectInteractionDefaults","remainingRaw","matchedCandidate","normalizedRemainingRaw","fallbackDefaults","normalizeStructuredInteractionDefaults","payload","buttonText","inputText","parseStructuredInteractionDefaults","rawValue","parsed","hasPotentialInteractionBlock","resolveCustomInteractionDefaults","interactionInfo","options","getInteractionDefaultValues","normalized","structuredDefaults","customDefaults","customDefaultsWithInteraction","getInteractionDefaultSelectedValues","defaults","value"],"mappings":";AAoCA,MAAMA,IAAoBC,EAAAA,wBAAA,GACpBC,IAA0B,uBAC1BC,IAAgC,oCAChCC,IAA0B,UAC1BC,IAAsC,cAOtCC,IAA4B,CAChCC,MACkC;AAClC,MAAI,CAACA;AACH,WAAO;AAGT,QAAMC,IAAUD,EAAQ,MAAMJ,CAA6B,GACrDM,IAAeD,IAAU,CAAC,GAAG,KAAA,GAC7BE,IAAkBF,IAAU,CAAC,GAAG,KAAA;AAEtC,MAAI,CAACE;AACH,WAAO;AAGT,QAAMC,IAAgBD,EAAgB,SAAS,IAAI,GAC7CE,IAAYD,IAAgB,OAAO,KACnCE,IAAaH,EAChB,MAAME,CAAS,EACf,IAAI,CAACE,MAASA,EAAK,KAAA,CAAM,EACzB,OAAO,OAAO;AAEjB,MAAI,CAACD,EAAW;AACd,WAAO;AAGT,QAAME,IAAwB,CAAA,GACxBC,IAAyB,CAAA;AAC/B,MAAIC;AAEJ,SAAAJ,EAAW,QAAQ,CAACK,MAAW;AAC7B,QAAIA,EAAO,WAAW,KAAK,GAAG;AAC5B,YAAMC,IAAwBD,EAAO,QAAQ,WAAW,EAAE,EAAE,KAAA;AAC5D,MAAIC,MACFF,IAAcE;AAEhB;AAAA,IACF;AAEA,IAAAJ,EAAY,KAAKG,CAAM,GACvBF,EAAa,KAAKE,CAAM;AAAA,EAC1B,CAAC,GAEM;AAAA,IACL,cAAAT;AAAA,IACA,aAAaM,EAAY,SAASA,IAAc;AAAA,IAChD,cAAcC,EAAa,SAASA,IAAe;AAAA,IACnD,aAAAC;AAAA,IACA,eAAAN;AAAA,EAAA;AAEJ,GAEMS,IAAwB,CAC5Bb,MACkC;AAClC,MAAI,CAACA;AACH,WAAO;AAGT,MAAI;AACF,WAAOP,EAAkB;AAAA,MACvBO;AAAA,IAAA;AAAA,EAEJ,SAASc,GAAO;AACd,YAAQ,KAAK,qCAAqC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O,EAAS,iBACJA,EAAS,iBAGXZ,IACHA,EACG,MAAM,GAAG,EACT,IAAI,CAACa,MAAUA,EAAM,KAAA,CAAM,EAC3B,OAAO,OAAO,IACjB;AACN;"}
|
|
1
|
+
{"version":3,"file":"interaction-defaults.es.js","sources":["../../src/lib/interaction-defaults.ts"],"sourcesContent":["import {\n createInteractionParser,\n INTERACTION_CONTENT_SOURCE,\n} from \"remark-flow\";\n\nexport interface InteractionParseResult {\n buttonTexts?: string[];\n buttonValues?: string[];\n placeholder?: string;\n variableName?: string;\n isMultiSelect?: boolean;\n}\n\nexport interface InteractionDefaultValues {\n buttonText?: string;\n inputText?: string;\n selectedValues?: string[];\n}\n\nexport interface InteractionDefaultResolverParams {\n content?: string | null;\n rawValue?: string | null;\n interactionInfo?: InteractionParseResult | null;\n}\n\nexport type InteractionDefaultResolver = (\n params: InteractionDefaultResolverParams\n) => InteractionDefaultValues | null | undefined;\n\nexport interface InteractionDefaultValueOptions {\n resolveDefaultValues?: InteractionDefaultResolver;\n}\n\ninterface StructuredInteractionPayload {\n buttonText?: unknown;\n inputText?: unknown;\n selectedValues?: unknown;\n}\n\nconst interactionParser = createInteractionParser();\nconst INTERACTION_TAG_PATTERN = /<custom-variable\\b/i;\n// Same definition of where an interaction ends as the parser uses, so an option carrying a\n// `\\]` is read whole instead of being cut at its first bracket.\nconst INTERACTION_SHORTCODE_PATTERN = new RegExp(\n `\\\\?\\\\[%\\\\{\\\\{([^}]+)\\\\}\\\\}(${INTERACTION_CONTENT_SOURCE})\\\\]`\n);\nconst JSON_LIKE_VALUE_PATTERN = /^[\\[{]/;\nconst INTERACTION_VALUE_SEPARATOR_PATTERN = /^[\\s,,\\n]+/;\n\ninterface InteractionOptionCandidate {\n token: string;\n value: string;\n}\n\nconst parseInteractionShortcode = (\n content?: string | null\n): InteractionParseResult | null => {\n if (!content) {\n return null;\n }\n\n const matched = content.match(INTERACTION_SHORTCODE_PATTERN);\n const variableName = matched?.[1]?.trim();\n const interactionBody = matched?.[2]?.trim();\n\n if (!interactionBody) {\n return null;\n }\n\n const isMultiSelect = interactionBody.includes(\"||\");\n const separator = isMultiSelect ? \"||\" : \"|\";\n const rawOptions = interactionBody\n .split(separator)\n .map((item) => item.trim())\n .filter(Boolean);\n\n if (!rawOptions.length) {\n return null;\n }\n\n const buttonTexts: string[] = [];\n const buttonValues: string[] = [];\n let placeholder: string | undefined;\n\n rawOptions.forEach((option) => {\n if (option.startsWith(\"...\")) {\n const normalizedPlaceholder = option.replace(/^\\.\\.\\./, \"\").trim();\n if (normalizedPlaceholder) {\n placeholder = normalizedPlaceholder;\n }\n return;\n }\n\n buttonTexts.push(option);\n buttonValues.push(option);\n });\n\n return {\n variableName,\n buttonTexts: buttonTexts.length ? buttonTexts : undefined,\n buttonValues: buttonValues.length ? buttonValues : undefined,\n placeholder,\n isMultiSelect,\n };\n};\n\nconst parseInteractionBlock = (\n content?: string | null\n): InteractionParseResult | null => {\n if (!content) {\n return null;\n }\n\n try {\n return interactionParser.parseToRemarkFormat(\n content\n ) as InteractionParseResult;\n } catch (error) {\n console.warn(\"Failed to parse interaction block\", error);\n }\n\n return parseInteractionShortcode(content);\n};\n\nconst normalizeButtonValue = (\n token: string,\n info: InteractionParseResult\n): { value: string; display?: string } | null => {\n if (!token) {\n return null;\n }\n\n const cleaned = token.trim();\n const buttonValues = info.buttonValues || [];\n const buttonTexts = info.buttonTexts || [];\n const valueIndex = buttonValues.indexOf(cleaned);\n\n if (valueIndex > -1) {\n return {\n value: buttonValues[valueIndex],\n display: buttonTexts[valueIndex],\n };\n }\n\n const textIndex = buttonTexts.indexOf(cleaned);\n\n if (textIndex > -1) {\n return {\n value: buttonValues[textIndex] || buttonTexts[textIndex],\n display: buttonTexts[textIndex],\n };\n }\n\n return null;\n};\n\nconst splitPresetValues = (raw: string) => {\n return raw\n .split(/[,,\\n]/)\n .map((item) => item.trim())\n .filter(Boolean);\n};\n\nconst trimLeadingInteractionSeparators = (raw: string) =>\n raw.replace(INTERACTION_VALUE_SEPARATOR_PATTERN, \"\");\n\nconst buildInteractionOptionCandidates = (\n info: InteractionParseResult\n): InteractionOptionCandidate[] => {\n const buttonValues = info.buttonValues || [];\n const buttonTexts = info.buttonTexts || [];\n const candidates: InteractionOptionCandidate[] = [];\n const seenCandidates = new Set<string>();\n\n buttonValues.forEach((buttonValue, index) => {\n const normalizedValue = `${buttonValue ?? \"\"}`.trim();\n const normalizedText = `${buttonTexts[index] ?? \"\"}`.trim();\n\n [normalizedValue, normalizedText].forEach((token) => {\n if (!token) {\n return;\n }\n\n const candidateKey = `${token}::${normalizedValue || token}`;\n if (seenCandidates.has(candidateKey)) {\n return;\n }\n\n seenCandidates.add(candidateKey);\n candidates.push({\n token,\n value: normalizedValue || token,\n });\n });\n });\n\n return candidates.sort(\n (left, right) => right.token.length - left.token.length\n );\n};\n\nconst matchInteractionOptionPrefix = (\n raw: string,\n info: InteractionParseResult\n): InteractionOptionCandidate | null => {\n const normalizedRaw = trimLeadingInteractionSeparators(raw);\n const candidates = buildInteractionOptionCandidates(info);\n\n for (const candidate of candidates) {\n if (!normalizedRaw.startsWith(candidate.token)) {\n continue;\n }\n\n const trailingChar = normalizedRaw[candidate.token.length];\n if (trailingChar && !/[\\s,,\\n]/.test(trailingChar)) {\n continue;\n }\n\n return candidate;\n }\n\n return null;\n};\n\nconst resolveMultiSelectFallbackDefaults = (\n raw: string,\n info: InteractionParseResult\n): InteractionDefaultValues => {\n const tokens = splitPresetValues(raw);\n\n if (!tokens.length) {\n return {};\n }\n\n const selectedValues: string[] = [];\n const customInputs: string[] = [];\n\n tokens.forEach((token) => {\n const mapped = normalizeButtonValue(token, info);\n\n if (mapped) {\n selectedValues.push(mapped.value);\n return;\n }\n\n if (info.placeholder) {\n customInputs.push(token);\n return;\n }\n\n selectedValues.push(token);\n });\n\n return {\n selectedValues: selectedValues.length ? selectedValues : undefined,\n inputText: customInputs.length ? customInputs.join(\", \") : undefined,\n };\n};\n\nconst resolveMultiSelectInteractionDefaults = (\n raw: string,\n info: InteractionParseResult\n): InteractionDefaultValues => {\n const selectedValues: string[] = [];\n let remainingRaw = raw.trim();\n\n // Prefer option-aware prefix matching before delimiter splitting so\n // option labels that contain commas can still round-trip correctly.\n while (remainingRaw) {\n const matchedCandidate = matchInteractionOptionPrefix(remainingRaw, info);\n\n if (!matchedCandidate) {\n break;\n }\n\n selectedValues.push(matchedCandidate.value);\n const normalizedRemainingRaw =\n trimLeadingInteractionSeparators(remainingRaw);\n remainingRaw = trimLeadingInteractionSeparators(\n normalizedRemainingRaw.slice(matchedCandidate.token.length)\n );\n }\n\n if (selectedValues.length > 0) {\n return {\n selectedValues,\n inputText:\n info.placeholder && remainingRaw.trim()\n ? remainingRaw.trim()\n : undefined,\n };\n }\n\n const fallbackDefaults = resolveMultiSelectFallbackDefaults(raw, info);\n\n if (fallbackDefaults.selectedValues?.length) {\n return fallbackDefaults;\n }\n\n if (info.placeholder) {\n return {\n inputText: raw.trim(),\n };\n }\n\n return fallbackDefaults;\n};\n\nconst normalizeStructuredInteractionDefaults = (\n payload?: StructuredInteractionPayload | null\n): InteractionDefaultValues | null => {\n if (!payload || Array.isArray(payload)) {\n return null;\n }\n\n const selectedValues = Array.isArray(payload.selectedValues)\n ? payload.selectedValues\n .map((item) => `${item ?? \"\"}`.trim())\n .filter(Boolean)\n : undefined;\n const buttonText = `${payload.buttonText ?? \"\"}`.trim();\n const inputText =\n typeof payload.inputText === \"string\" ? payload.inputText : undefined;\n\n if (!selectedValues?.length && !buttonText && !inputText) {\n return null;\n }\n\n return {\n buttonText: buttonText || undefined,\n inputText,\n selectedValues: selectedValues?.length ? selectedValues : undefined,\n };\n};\n\nconst parseStructuredInteractionDefaults = (rawValue?: string | null) => {\n if (!rawValue) {\n return null;\n }\n\n if (!JSON_LIKE_VALUE_PATTERN.test(rawValue.trim())) {\n return null;\n }\n\n try {\n const parsed = JSON.parse(rawValue) as StructuredInteractionPayload;\n return normalizeStructuredInteractionDefaults(parsed);\n } catch {\n return null;\n }\n};\n\nconst hasPotentialInteractionBlock = (content?: string | null) =>\n Boolean(\n content &&\n (INTERACTION_TAG_PATTERN.test(content) ||\n INTERACTION_SHORTCODE_PATTERN.test(content))\n );\n\nconst resolveCustomInteractionDefaults = (\n content?: string | null,\n rawValue?: string | null,\n interactionInfo?: InteractionParseResult | null,\n options?: InteractionDefaultValueOptions\n) => {\n return (\n options?.resolveDefaultValues?.({\n content,\n rawValue,\n interactionInfo,\n }) ?? null\n );\n};\n\nexport const getInteractionDefaultValues = (\n content?: string | null,\n rawValue?: string | null,\n options?: InteractionDefaultValueOptions\n): InteractionDefaultValues => {\n const normalized = rawValue?.toString().trim();\n\n if (!normalized) {\n return {};\n }\n\n const structuredDefaults = parseStructuredInteractionDefaults(normalized);\n\n if (structuredDefaults) {\n return structuredDefaults;\n }\n\n const customDefaults = resolveCustomInteractionDefaults(\n content,\n normalized,\n null,\n options\n );\n\n if (customDefaults) {\n return customDefaults;\n }\n\n if (!hasPotentialInteractionBlock(content)) {\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n }\n\n const interactionInfo = parseInteractionBlock(content);\n const customDefaultsWithInteraction = resolveCustomInteractionDefaults(\n content,\n normalized,\n interactionInfo,\n options\n );\n\n if (customDefaultsWithInteraction) {\n return customDefaultsWithInteraction;\n }\n\n if (!interactionInfo) {\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n }\n\n if (interactionInfo.isMultiSelect) {\n return resolveMultiSelectInteractionDefaults(normalized, interactionInfo);\n }\n\n const mapped = normalizeButtonValue(normalized, interactionInfo);\n\n if (mapped) {\n return {\n buttonText: mapped.value || mapped.display || normalized,\n };\n }\n\n if (interactionInfo.placeholder) {\n return {\n inputText: normalized,\n };\n }\n\n return {\n buttonText: normalized,\n inputText: normalized,\n };\n};\n\nexport const getInteractionDefaultSelectedValues = (\n content?: string | null,\n rawValue?: string | null,\n options?: InteractionDefaultValueOptions\n) => {\n const defaults = getInteractionDefaultValues(content, rawValue, options);\n\n if (defaults.selectedValues) {\n return defaults.selectedValues;\n }\n\n return rawValue\n ? rawValue\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n : undefined;\n};\n"],"names":["interactionParser","createInteractionParser","INTERACTION_TAG_PATTERN","INTERACTION_SHORTCODE_PATTERN","INTERACTION_CONTENT_SOURCE","JSON_LIKE_VALUE_PATTERN","INTERACTION_VALUE_SEPARATOR_PATTERN","parseInteractionShortcode","content","matched","variableName","interactionBody","isMultiSelect","separator","rawOptions","item","buttonTexts","buttonValues","placeholder","option","normalizedPlaceholder","parseInteractionBlock","error","normalizeButtonValue","token","info","cleaned","valueIndex","textIndex","splitPresetValues","raw","trimLeadingInteractionSeparators","buildInteractionOptionCandidates","candidates","seenCandidates","buttonValue","index","normalizedValue","normalizedText","candidateKey","left","right","matchInteractionOptionPrefix","normalizedRaw","candidate","trailingChar","resolveMultiSelectFallbackDefaults","tokens","selectedValues","customInputs","mapped","resolveMultiSelectInteractionDefaults","remainingRaw","matchedCandidate","normalizedRemainingRaw","fallbackDefaults","normalizeStructuredInteractionDefaults","payload","buttonText","inputText","parseStructuredInteractionDefaults","rawValue","parsed","hasPotentialInteractionBlock","resolveCustomInteractionDefaults","interactionInfo","options","getInteractionDefaultValues","normalized","structuredDefaults","customDefaults","customDefaultsWithInteraction","getInteractionDefaultSelectedValues","defaults","value"],"mappings":";AAuCA,MAAMA,IAAoBC,EAAAA,wBAAA,GACpBC,IAA0B,uBAG1BC,IAAgC,IAAI;AAAA,EACxC,8BAA8BC,EAAAA,0BAA0B;AAC1D,GACMC,IAA0B,UAC1BC,IAAsC,cAOtCC,IAA4B,CAChCC,MACkC;AAClC,MAAI,CAACA;AACH,WAAO;AAGT,QAAMC,IAAUD,EAAQ,MAAML,CAA6B,GACrDO,IAAeD,IAAU,CAAC,GAAG,KAAA,GAC7BE,IAAkBF,IAAU,CAAC,GAAG,KAAA;AAEtC,MAAI,CAACE;AACH,WAAO;AAGT,QAAMC,IAAgBD,EAAgB,SAAS,IAAI,GAC7CE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A,IACrBxD;AAAA,IACA4D;AAAA,IACA;AAAA,IACAF;AAAA,EAAA;AAGF,MAAII;AACF,WAAOA;AAGT,MAAI,CAACP,EAA6BvD,CAAO;AACvC,WAAO;AAAA,MACL,YAAY4D;AAAA,MACZ,WAAWA;AAAA,IAAA;AAIf,QAAMH,IAAkB5C,EAAsBb,CAAO,GAC/C+D,IAAgCP;AAAA,IACpCxD;AAAA,IACA4D;AAAA,IACAH;AAAA,IACAC;AAAA,EAAA;AAGF,MAAIK;AACF,WAAOA;AAGT,MAAI,CAACN;AACH,WAAO;AAAA,MACL,YAAYG;AAAA,MACZ,WAAWA;AAAA,IAAA;AAIf,MAAIH,EAAgB;AAClB,WAAOd,EAAsCiB,GAAYH,CAAe;AAG1E,QAAMf,IAAS3B,EAAqB6C,GAAYH,CAAe;AAE/D,SAAIf,IACK;AAAA,IACL,YAAYA,EAAO,SAASA,EAAO,WAAWkB;AAAA,EAAA,IAI9CH,EAAgB,cACX;AAAA,IACL,WAAWG;AAAA,EAAA,IAIR;AAAA,IACL,YAAYA;AAAA,IACZ,WAAWA;AAAA,EAAA;AAEf,GAEaI,IAAsC,CACjDhE,GACAqD,GACAK,MACG;AACH,QAAMO,IAAWN,EAA4B3D,GAASqD,GAAUK,CAAO;AAEvE,SAAIO,EAAS,iBACJA,EAAS,iBAGXZ,IACHA,EACG,MAAM,GAAG,EACT,IAAI,CAACa,MAAUA,EAAM,KAAA,CAAM,EAC3B,OAAO,OAAO,IACjB;AACN;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/index9.cjs"),v=require("./constants.cjs");var d;function x(){if(d)return c.__exports;d=1,Object.defineProperty(c.__exports,"__esModule",{value:!0}),c.__exports.sanitizeUrl=void 0;var e=v.__require();function m(r){return e.relativeFirstCharacters.indexOf(r[0])>-1}function p(r){var i=r.replace(e.ctrlCharactersRegex,"");return i.replace(e.htmlEntitiesRegex,function(t,a){return String.fromCharCode(a)})}function R(r){return URL.canParse(r)}function l(r){try{return decodeURIComponent(r)}catch{return r}}function f(r){if(!r)return e.BLANK_URL;var i,t=l(r.trim());do t=p(t).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),t=l(t),i=t.match(e.ctrlCharactersRegex)||t.match(e.htmlEntitiesRegex)||t.match(e.htmlCtrlEntityRegex)||t.match(e.whitespaceEscapeCharsRegex);while(i&&i.length>0);var a=t;if(!a)return e.BLANK_URL;if(m(a))return a;var u=a.trimStart(),h=u.match(e.urlSchemeRegex);if(!h)return a;var n=h[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(n))return e.BLANK_URL;var s=u.replace(/\\/g,"/");if(n==="mailto:"||n.includes("://"))return s;if(n==="http:"||n==="https:"){if(!R(s))return e.BLANK_URL;var o=new URL(s);return o.protocol=o.protocol.toLowerCase(),o.hostname=o.hostname.toLowerCase(),o.toString()}return s}return c.__exports.sanitizeUrl=f,c.__exports}exports.__require=x;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../_virtual/index8.cjs");/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const H=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),te=require("../../@babel/runtime/helpers/esm/extends.cjs"),i=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),oe=require("../../@babel/runtime/helpers/esm/typeof.cjs"),u=require("../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const H=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),te=require("../../@babel/runtime/helpers/esm/extends.cjs"),i=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),oe=require("../../@babel/runtime/helpers/esm/typeof.cjs"),u=require("../../../_virtual/index4.cjs"),n=require("react"),T=require("./utils/commonUtils.cjs");var de=n.forwardRef(function(e,U){var p,x,y,$=e.inputElement,N=e.children,r=e.prefixCls,k=e.prefix,f=e.suffix,C=e.addonBefore,W=e.addonAfter,z=e.className,J=e.style,m=e.disabled,I=e.readOnly,K=e.focused,E=e.triggerFocus,d=e.allowClear,b=e.value,h=e.handleReset,L=e.hidden,t=e.classes,a=e.classNames,g=e.dataAttrs,o=e.styles,l=e.components,w=e.onClear,M=N??$,Q=l?.affixWrapper||"span",V=l?.groupWrapper||"span",X=l?.wrapper||"span",S=l?.groupAddon||"span",A=n.useRef(null),Y=function(s){var q;(q=A.current)!==null&&q!==void 0&&q.contains(s.target)&&E?.()},j=T.hasPrefixSuffix(e),c=n.cloneElement(M,{value:b,className:u.default((p=M.props)===null||p===void 0?void 0:p.className,!j&&a?.variant)||null}),B=n.useRef(null);if(n.useImperativeHandle(U,function(){return{nativeElement:B.current||A.current}}),j){var D=null;if(d){var Z=!m&&!I&&b,R="".concat(r,"-clear-icon"),P=oe.default(d)==="object"&&d!==null&&d!==void 0&&d.clearIcon?d.clearIcon:"✖";D=n.createElement("button",{type:"button",tabIndex:-1,onClick:function(s){h?.(s),w?.()},onMouseDown:function(s){return s.preventDefault()},className:u.default(R,i.default(i.default({},"".concat(R,"-hidden"),!Z),"".concat(R,"-has-suffix"),!!f))},P)}var v="".concat(r,"-affix-wrapper"),ee=u.default(v,i.default(i.default(i.default(i.default(i.default({},"".concat(r,"-disabled"),m),"".concat(v,"-disabled"),m),"".concat(v,"-focused"),K),"".concat(v,"-readonly"),I),"".concat(v,"-input-with-clear-btn"),f&&d&&b),t?.affixWrapper,a?.affixWrapper,a?.variant),ae=(f||d)&&n.createElement("span",{className:u.default("".concat(r,"-suffix"),a?.suffix),style:o?.suffix},D,f);c=n.createElement(Q,te.default({className:ee,style:o?.affixWrapper,onClick:Y},g?.affixWrapper,{ref:A}),k&&n.createElement("span",{className:u.default("".concat(r,"-prefix"),a?.prefix),style:o?.prefix},k),c,ae)}if(T.hasAddon(e)){var _="".concat(r,"-group"),O="".concat(_,"-addon"),F="".concat(_,"-wrapper"),ne=u.default("".concat(r,"-wrapper"),_,t?.wrapper,a?.wrapper),le=u.default(F,i.default({},"".concat(F,"-disabled"),m),t?.group,a?.groupWrapper);c=n.createElement(V,{className:le,ref:B},n.createElement(X,{className:ne},C&&n.createElement(S,{className:O},C),c,W&&n.createElement(S,{className:O},W)))}return n.cloneElement(c,{className:u.default((x=c.props)===null||x===void 0?void 0:x.className,z)||null,style:H.default(H.default({},(y=c.props)===null||y===void 0?void 0:y.style),J),hidden:L})});exports.default=de;
|
|
2
2
|
//# sourceMappingURL=BaseInput.cjs.map
|
|
@@ -2,7 +2,7 @@ import $ from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
|
|
|
2
2
|
import oe from "../../@babel/runtime/helpers/esm/extends.es.js";
|
|
3
3
|
import r from "../../@babel/runtime/helpers/esm/defineProperty.es.js";
|
|
4
4
|
import te from "../../@babel/runtime/helpers/esm/typeof.es.js";
|
|
5
|
-
import d from "../../../_virtual/index.
|
|
5
|
+
import d from "../../../_virtual/index.es4.js";
|
|
6
6
|
import l, { useRef as q, cloneElement as ie } from "react";
|
|
7
7
|
import { hasPrefixSuffix as re, hasAddon as de } from "./utils/commonUtils.es.js";
|
|
8
8
|
var xe = /* @__PURE__ */ l.forwardRef(function(e, z) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("../../@babel/runtime/helpers/esm/extends.cjs"),F=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),N=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),J=require("../../@babel/runtime/helpers/esm/typeof.cjs"),f=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),K=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),Q=require("../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("../../@babel/runtime/helpers/esm/extends.cjs"),F=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),N=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),J=require("../../@babel/runtime/helpers/esm/typeof.cjs"),f=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),K=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),Q=require("../../../_virtual/index4.cjs"),ee=require("../../rc-resize-observer/es/index.cjs"),j=require("../../rc-util/es/hooks/useLayoutEffect.cjs"),te=require("../../rc-util/es/hooks/useMergedState.cjs"),w=require("../../rc-util/es/raf.cjs"),ae=require("react"),re=require("./calculateNodeHeight.cjs");function ne(n){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(o,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return o.default=n,Object.freeze(o)}const t=ne(ae);var ue=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],g=0,m=1,_=2,le=t.forwardRef(function(n,o){var e=n,s=e.prefixCls,O=e.defaultValue,p=e.value,a=e.autoSize,i=e.onResize,T=e.className,$=e.style,b=e.disabled,c=e.onChange,d=e.onInternalAutoSize,P=K.default(e,ue),V=te.default(O,{value:p,postState:function(r){return r??""}}),y=f.default(V,2),D=y[0],Z=y[1],H=function(r){Z(r.target.value),c?.(r)},S=t.useRef();t.useImperativeHandle(o,function(){return{textArea:S.current}});var L=t.useMemo(function(){return a&&J.default(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),E=f.default(L,2),q=E[0],x=E[1],R=!!a,k=t.useState(_),A=f.default(k,2),u=A[0],v=A[1],B=t.useState(),I=f.default(B,2),G=I[0],U=I[1],M=function(){v(g),process.env.NODE_ENV==="test"&&d?.()};j.default(function(){R&&M()},[p,q,x,R]),j.default(function(){if(u===g)v(m);else if(u===m){var l=re.default(S.current,!1,q,x);v(_),U(l)}},[u]);var h=t.useRef(),C=function(){w.default.cancel(h.current)},W=function(r){u===_&&(i?.(r),a&&(C(),h.current=w.default(function(){M()})))};t.useEffect(function(){return C},[]);var X=R?G:null,z=N.default(N.default({},$),X);return(u===g||u===m)&&(z.overflowY="hidden",z.overflowX="hidden"),t.createElement(ee.default,{onResize:W,disabled:!(a||i)},t.createElement("textarea",Y.default({},P,{ref:S,style:z,className:Q.default(s,T,F.default({},"".concat(s,"-disabled"),b)),disabled:b,value:D,onChange:H})))});exports.default=le;
|
|
2
2
|
//# sourceMappingURL=ResizableTextArea.cjs.map
|
|
@@ -4,7 +4,7 @@ import w from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
|
|
|
4
4
|
import J from "../../@babel/runtime/helpers/esm/typeof.es.js";
|
|
5
5
|
import s from "../../@babel/runtime/helpers/esm/slicedToArray.es.js";
|
|
6
6
|
import K from "../../@babel/runtime/helpers/esm/objectWithoutProperties.es.js";
|
|
7
|
-
import Q from "../../../_virtual/index.
|
|
7
|
+
import Q from "../../../_virtual/index.es4.js";
|
|
8
8
|
import ee from "../../rc-resize-observer/es/index.es.js";
|
|
9
9
|
import M from "../../rc-util/es/hooks/useLayoutEffect.es.js";
|
|
10
10
|
import te from "../../rc-util/es/hooks/useMergedState.es.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const be=require("../../@babel/runtime/helpers/esm/extends.cjs"),X=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),d=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),ze=require("../../@babel/runtime/helpers/esm/toConsumableArray.cjs"),x=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),qe=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),g=require("../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const be=require("../../@babel/runtime/helpers/esm/extends.cjs"),X=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),d=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),ze=require("../../@babel/runtime/helpers/esm/toConsumableArray.cjs"),x=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),qe=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),g=require("../../../_virtual/index4.cjs"),Te=require("../../rc-input/es/BaseInput.cjs"),Ae=require("../../rc-util/es/hooks/useMergedState.cjs"),n=require("react"),Fe=require("../../rc-input/es/hooks/useCount.cjs"),Y=require("../../rc-input/es/utils/commonUtils.cjs"),Ne=require("./ResizableTextArea.cjs");var Oe=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],$e=n.forwardRef(function(t,Z){var C,B=t.defaultValue,_=t.value,p=t.onFocus,y=t.onBlur,L=t.onChange,R=t.allowClear,M=t.maxLength,S=t.onCompositionStart,w=t.onCompositionEnd,ee=t.suffix,P=t.prefixCls,s=P===void 0?"rc-textarea":P,E=t.showCount,te=t.count,ae=t.className,v=t.style,m=t.disabled,ne=t.hidden,l=t.classNames,i=t.styles,b=t.onResize,oe=t.onClear,D=t.onPressEnter,K=t.readOnly,V=t.autoSize,z=t.onKeyDown,le=qe.default(t,Oe),re=Ae.default(B,{value:_,defaultValue:B}),W=x.default(re,2),q=W[0],j=W[1],T=q==null?"":String(q),ue=n.useState(!1),k=x.default(ue,2),se=k[0],A=k[1],F=n.useRef(!1),ie=n.useState(null),H=x.default(ie,2),de=H[0],ce=H[1],U=n.useRef(null),N=n.useRef(null),r=function(){var e;return(e=N.current)===null||e===void 0?void 0:e.textArea},G=function(){r().focus()};n.useImperativeHandle(Z,function(){var a;return{resizableTextArea:N.current,focus:G,blur:function(){r().blur()},nativeElement:((a=U.current)===null||a===void 0?void 0:a.nativeElement)||r()}}),n.useEffect(function(){A(function(a){return!m&&a})},[m]);var fe=n.useState(null),J=x.default(fe,2),O=J[0],ve=J[1];n.useEffect(function(){if(O){var a;(a=r()).setSelectionRange.apply(a,ze.default(O))}},[O]);var o=Fe.default(te,E),c=(C=o.max)!==null&&C!==void 0?C:M,me=Number(c)>0,$=o.strategy(T),he=!!c&&$>c,Q=function(e,u){var h=u;!F.current&&o.exceedFormatter&&o.max&&o.strategy(u)>o.max&&(h=o.exceedFormatter(u,{max:o.max}),u!==h&&ve([r().selectionStart||0,r().selectionEnd||0])),j(h),Y.resolveOnChange(e.currentTarget,e,L,h)},xe=function(e){F.current=!0,S?.(e)},ge=function(e){F.current=!1,Q(e,e.currentTarget.value),w?.(e)},Ce=function(e){Q(e,e.target.value)},pe=function(e){e.key==="Enter"&&D&&D(e),z?.(e)},ye=function(e){A(!0),p?.(e)},Re=function(e){A(!1),y?.(e)},Se=function(e){j(""),G(),Y.resolveOnChange(r(),e,L)},I=ee,f;o.show&&(o.showFormatter?f=o.showFormatter({value:T,count:$,maxLength:c}):f="".concat($).concat(me?" / ".concat(c):""),I=n.createElement(n.Fragment,null,I,n.createElement("span",{className:g.default("".concat(s,"-data-count"),l?.count),style:i?.count},f)));var we=function(e){var u;b?.(e),(u=r())!==null&&u!==void 0&&u.style.height&&ce(!0)},Ee=!V&&!E&&!R;return n.createElement(Te.default,{ref:U,value:T,allowClear:R,handleReset:Se,suffix:I,prefixCls:s,classNames:d.default(d.default({},l),{},{affixWrapper:g.default(l?.affixWrapper,X.default(X.default({},"".concat(s,"-show-count"),E),"".concat(s,"-textarea-allow-clear"),R))}),disabled:m,focused:se,className:g.default(ae,he&&"".concat(s,"-out-of-range")),style:d.default(d.default({},v),de&&!Ee?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof f=="string"?f:void 0}},hidden:ne,readOnly:K,onClear:oe},n.createElement(Ne.default,be.default({},le,{autoSize:V,maxLength:M,onKeyDown:pe,onChange:Ce,onFocus:ye,onBlur:Re,onCompositionStart:xe,onCompositionEnd:ge,className:g.default(l?.textarea),style:d.default(d.default({},i?.textarea),{},{resize:v?.resize}),disabled:m,prefixCls:s,onResize:we,ref:N,readOnly:K})))});exports.default=$e;
|
|
2
2
|
//# sourceMappingURL=TextArea.cjs.map
|
|
@@ -4,7 +4,7 @@ import d from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
|
|
|
4
4
|
import Ae from "../../@babel/runtime/helpers/esm/toConsumableArray.es.js";
|
|
5
5
|
import x from "../../@babel/runtime/helpers/esm/slicedToArray.es.js";
|
|
6
6
|
import Fe from "../../@babel/runtime/helpers/esm/objectWithoutProperties.es.js";
|
|
7
|
-
import h from "../../../_virtual/index.
|
|
7
|
+
import h from "../../../_virtual/index.es4.js";
|
|
8
8
|
import Ne from "../../rc-input/es/BaseInput.es.js";
|
|
9
9
|
import Te from "../../rc-util/es/hooks/useMergedState.es.js";
|
|
10
10
|
import o, { useRef as Y, useImperativeHandle as $e, useEffect as Ie } from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./TextArea.cjs");require("../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./TextArea.cjs");require("../../../_virtual/index4.cjs");require("../../rc-resize-observer/es/index.cjs");require("../../rc-util/es/hooks/useLayoutEffect.cjs");require("react");require("../../rc-util/es/raf.cjs");exports.default=e.default;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../_virtual/escaping.cjs");var u;function o(){return u||(u=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.INTERACTION_CONTENT_SOURCE=i.splitOnEllipsis=i.splitOnSingleUnescapedPipe=i.splitUnescaped=i.findUnescaped=i.unescapeInteractionText=i.escapeInteractionText=i.isEscape=i.ESCAPABLE=void 0,i.ESCAPABLE="|/.]";const t=(n,s)=>s+1<n.length&&n[s]==="\\"&&i.ESCAPABLE.includes(n[s+1]);i.isEscape=t;const p=n=>{let s="",c=0;for(;c<n.length;){const e=n[c];if(e==="."){let l=0;for(;n[c+l]===".";)l+=1;s+=l>=3?"\\.".repeat(l):".".repeat(l),c+=l;continue}i.ESCAPABLE.includes(e)&&(s+="\\"),s+=e,c+=1}return s};i.escapeInteractionText=p;const d=n=>{let s="",c=0;for(;c<n.length;){if((0,i.isEscape)(n,c)){s+=n[c+1],c+=2;continue}s+=n[c],c+=1}return s};i.unescapeInteractionText=d;const r=(n,s,c=0)=>{let e=c;for(;e<n.length;){if((0,i.isEscape)(n,e)){e+=2;continue}if(n.startsWith(s,e))return e;e+=1}return-1};i.findUnescaped=r;const E=(n,s)=>{const c=[];let e=0;for(;;){const l=(0,i.findUnescaped)(n,s,e);if(l<0)return c.push(n.slice(e)),c;c.push(n.slice(e,l)),e=l+s.length}};i.splitUnescaped=E;const f=n=>{const s=[];let c=0,e=0;for(;e<n.length;){if((0,i.isEscape)(n,e)){e+=2;continue}if(n[e]==="|"){if(n.startsWith("||",e)){e+=2;continue}if(e>0&&n[e-1]==="|"&&!(0,i.isEscape)(n,e-1)){e+=1;continue}s.push(n.slice(c,e)),c=e+1}e+=1}return s.push(n.slice(c)),s};i.splitOnSingleUnescapedPipe=f;const h=n=>{const s=n.split(`
|
|
2
|
+
`,1)[0],c=(0,i.findUnescaped)(s,"...");return c<0?null:[s.slice(0,c),s.slice(c+3)]};i.splitOnEllipsis=h,i.INTERACTION_CONTENT_SOURCE="(?:\\\\[|/.\\]]|\\\\(?![|/.\\]])|[^\\]\\\\])*"})(a.__exports)),a.__exports}exports.__require=o;
|
|
3
|
+
//# sourceMappingURL=escaping.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escaping.cjs","sources":["../../../../node_modules/remark-flow/dist/escaping.js"],"sourcesContent":["\"use strict\";\n/**\n * Backslash escapes for the delimiters inside an interaction's brackets.\n *\n * `?[A|B]` gives `|`, `//`, `...` and `]` structural meaning, so option text that contains one of\n * them is reshaped: a bar splits one choice into two, a double slash gives half the display away\n * to the stored value, an ellipsis turns the rest into a text box, and a bracket ends the\n * interaction early. An option carrying a URL or a regular expression could not be written at all.\n *\n * A backslash before one of those characters now makes it ordinary text.\n *\n * The escape is deliberately *selective*: a backslash is an escape only when the character after\n * it is a delimiter, and is literal text everywhere else. `\\\\` is not an escape either. That\n * matters for content that already exists: of 110,685 interactions in published courses, 97\n * contain a backslash and every one of them is LaTeX -- `$\\pi_\\theta$`, `\\beta`, `\\nabla`, and\n * `\\\\` as a line break. A general \"backslash escapes the next character\" rule would render those\n * as `$pi_theta$`. Under this rule, none of them change.\n *\n * The cost is that a literal backslash cannot sit immediately before a literal delimiter: `\\|` is\n * an escaped bar, not a backslash and a separator.\n *\n * This mirrors `markdown_flow/escaping.py` in markdown-flow-agent-py character for character.\n * The two must agree: the backend renders an interaction, parses its own output with the Python\n * parser to prove the meaning survived, and then this parser is what the browser reads it with.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.INTERACTION_CONTENT_SOURCE = exports.splitOnEllipsis = exports.splitOnSingleUnescapedPipe = exports.splitUnescaped = exports.findUnescaped = exports.unescapeInteractionText = exports.escapeInteractionText = exports.isEscape = exports.ESCAPABLE = void 0;\n/** The characters a backslash may make ordinary. `/` covers `//`, `.` covers `...`. */\nexports.ESCAPABLE = '|/.]';\n/** Whether the backslash at `index` escapes the character after it. */\nconst isEscape = (text, index) => index + 1 < text.length &&\n text[index] === '\\\\' &&\n exports.ESCAPABLE.includes(text[index + 1]);\nexports.isEscape = isEscape;\n/**\n * Make `text` safe to write inside `?[...]`, keeping every character it has.\n *\n * A dot is escaped only inside a run of three or more, because only `...` is a delimiter and a\n * single period ends most sentences: escaping every one turns `Yes, I agree.` into\n * `Yes, I agree\\.` in everything that stores or shows the raw interaction. Two dots cannot become\n * three on their own, and the run is escaped whole so it cannot be read as one.\n *\n * Bars, brackets and slashes are escaped wherever they appear. They are rare in option text, and\n * escaping them unconditionally removes the need to reason about what a neighbouring character\n * might combine with once the option is written next to a separator.\n *\n * Escaping the delimiters rather than the backslashes as well is what keeps existing content\n * readable: a script that writes `$\\pi$` in an option still writes `$\\pi$` afterwards.\n */\nconst escapeInteractionText = (text) => {\n let out = '';\n let index = 0;\n while (index < text.length) {\n const char = text[index];\n if (char === '.') {\n let run = 0;\n while (text[index + run] === '.') {\n run += 1;\n }\n out += run >= 3 ? '\\\\.'.repeat(run) : '.'.repeat(run);\n index += run;\n continue;\n }\n if (exports.ESCAPABLE.includes(char)) {\n out += '\\\\';\n }\n out += char;\n index += 1;\n }\n return out;\n};\nexports.escapeInteractionText = escapeInteractionText;\n/** Resolve the escapes in one option's text, leaving every other backslash alone. */\nconst unescapeInteractionText = (text) => {\n let out = '';\n let index = 0;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n out += text[index + 1];\n index += 2;\n continue;\n }\n out += text[index];\n index += 1;\n }\n return out;\n};\nexports.unescapeInteractionText = unescapeInteractionText;\n/**\n * Index of the first `needle` that is not escaped and does not begin inside an escape, or -1.\n *\n * `needle` is matched whole: a `//` whose first slash is escaped is not a separator even though\n * its second slash is bare, because that second slash is the escaped character of the pair.\n */\nconst findUnescaped = (text, needle, start = 0) => {\n let index = start;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n index += 2;\n continue;\n }\n if (text.startsWith(needle, index)) {\n return index;\n }\n index += 1;\n }\n return -1;\n};\nexports.findUnescaped = findUnescaped;\n/** Split on every unescaped `separator`, leaving the escapes themselves in place. */\nconst splitUnescaped = (text, separator) => {\n const parts = [];\n let start = 0;\n for (;;) {\n const found = (0, exports.findUnescaped)(text, separator, start);\n if (found < 0) {\n parts.push(text.slice(start));\n return parts;\n }\n parts.push(text.slice(start, found));\n start = found + separator.length;\n }\n};\nexports.splitUnescaped = splitUnescaped;\n/** Split on unescaped single bars, leaving `||` joined as the multi-select separator. */\nconst splitOnSingleUnescapedPipe = (text) => {\n const parts = [];\n let start = 0;\n let index = 0;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n index += 2;\n continue;\n }\n if (text[index] === '|') {\n if (text.startsWith('||', index)) {\n index += 2;\n continue;\n }\n if (index > 0 && text[index - 1] === '|' && !(0, exports.isEscape)(text, index - 1)) {\n index += 1;\n continue;\n }\n parts.push(text.slice(start, index));\n start = index + 1;\n }\n index += 1;\n }\n parts.push(text.slice(start));\n return parts;\n};\nexports.splitOnSingleUnescapedPipe = splitOnSingleUnescapedPipe;\n/**\n * Split an interaction's content at the `...` that opens its text box, or null.\n *\n * Two details are inherited rather than chosen, because changing either would rewrite questions\n * in courses that are already published:\n *\n * - the ellipsis counts only on the first line. The regex this replaces was anchored and its `.`\n * did not cross a newline, so `A\\n| ...hint` has always been read as two buttons, one of them\n * named `...hint`.\n * - the *first* ellipsis on that line wins, which is what the lazy group matched. (The Python\n * parser takes the last one instead -- a difference that predates escapes and is left alone\n * here; with options escaping their own dots, only the real marker is ever unescaped, so the\n * two agree on everything a producer writes.)\n *\n * What is new is only that an escaped ellipsis no longer counts.\n */\nconst splitOnEllipsis = (content) => {\n const head = content.split('\\n', 1)[0];\n const at = (0, exports.findUnescaped)(head, '...');\n if (at < 0) {\n return null;\n }\n return [head.slice(0, at), head.slice(at + 3)];\n};\nexports.splitOnEllipsis = splitOnEllipsis;\n/**\n * The bracket content of an interaction, as a regex source fragment.\n *\n * The three alternatives are mutually exclusive on purpose: a backslash before a delimiter can\n * only be read as an escape, so the pattern cannot backtrack into reading it as plain text and\n * then closing on the very bracket it escapes. Without that, this regex and a left-to-right\n * scanner disagree about `?[a\\\\]`, and two parsers of one grammar must not.\n */\nexports.INTERACTION_CONTENT_SOURCE = '(?:\\\\\\\\[|/.\\\\]]|\\\\\\\\(?![|/.\\\\]])|[^\\\\]\\\\\\\\])*';\n//# sourceMappingURL=escaping.js.map"],"names":["exports","isEscape","text","index","escapeInteractionText","out","char","run","unescapeInteractionText","findUnescaped","needle","start","splitUnescaped","separator","parts","found","splitOnSingleUnescapedPipe","splitOnEllipsis","content","head","at"],"mappings":"iLAyBA,OAAO,eAAcA,EAAU,aAAc,CAAE,MAAO,GAAM,EAC5DA,EAAA,2BAAqCA,EAAA,gBAA0BA,6BAAqCA,EAAA,eAAyBA,EAAA,cAAwBA,0BAAkCA,EAAA,sBAAgCA,EAAA,SAAmBA,EAAA,UAAoB,OAE9PA,EAAA,UAAoB,OAEpB,MAAMC,EAAW,CAACC,EAAMC,IAAUA,EAAQ,EAAID,EAAK,QAC/CA,EAAKC,CAAK,IAAM,MAChBH,EAAQ,UAAU,SAASE,EAAKC,EAAQ,CAAC,CAAC,EAC9CH,EAAA,SAAmBC,EAgBnB,MAAMG,EAAyBF,GAAS,CACpC,IAAIG,EAAM,GACNF,EAAQ,EACZ,KAAOA,EAAQD,EAAK,QAAQ,CACxB,MAAMI,EAAOJ,EAAKC,CAAK,EACvB,GAAIG,IAAS,IAAK,CACd,IAAIC,EAAM,EACV,KAAOL,EAAKC,EAAQI,CAAG,IAAM,KACzBA,GAAO,EAEXF,GAAOE,GAAO,EAAI,MAAM,OAAOA,CAAG,EAAI,IAAI,OAAOA,CA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K,EAAG,CACpCA,GAAS,EACT,QACZ,CACQ,GAAID,EAAKC,CAAK,IAAM,IAAK,CACrB,GAAID,EAAK,WAAW,KAAMC,CAAK,EAAG,CAC9BA,GAAS,EACT,QAChB,CACY,GAAIA,EAAQ,GAAKD,EAAKC,EAAQ,CAAC,IAAM,KAAO,IAAKH,EAAQ,UAAUE,EAAMC,EAAQ,CAAC,EAAG,CACjFA,GAAS,EACT,QAChB,CACYW,EAAM,KAAKZ,EAAK,MAAMS,EAAOR,CAAK,CAAC,EACnCQ,EAAQR,EAAQ,CAC5B,CACQA,GAAS,CACjB,CACI,OAAAW,EAAM,KAAKZ,EAAK,MAAMS,CAAK,CAAC,EACrBG,CACX,EACAd,EAAA,2BAAqCgB,EAiBrC,MAAMC,EAAmBC,GAAY,CACjC,MAAMC,EAAOD,EAAQ,MAAM;AAAA,EAAM,CAAC,EAAE,CAAC,EAC/BE,KAASpB,EAAQ,eAAemB,EAAM,KAAK,EACjD,OAAIC,EAAK,EACE,KAEJ,CAACD,EAAK,MAAM,EAAGC,CAAE,EAAGD,EAAK,MAAMC,EAAK,CAAC,CAAC,CACjD,EACApB,EAAA,gBAA0BiB,EAS1BjB,EAAA,2BAAqC","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __exports as a } from "../../../_virtual/escaping.es.js";
|
|
2
|
+
var u;
|
|
3
|
+
function O() {
|
|
4
|
+
return u ? a : (u = 1, (function(e) {
|
|
5
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.INTERACTION_CONTENT_SOURCE = e.splitOnEllipsis = e.splitOnSingleUnescapedPipe = e.splitUnescaped = e.findUnescaped = e.unescapeInteractionText = e.escapeInteractionText = e.isEscape = e.ESCAPABLE = void 0, e.ESCAPABLE = "|/.]";
|
|
6
|
+
const t = (n, s) => s + 1 < n.length && n[s] === "\\" && e.ESCAPABLE.includes(n[s + 1]);
|
|
7
|
+
e.isEscape = t;
|
|
8
|
+
const p = (n) => {
|
|
9
|
+
let s = "", c = 0;
|
|
10
|
+
for (; c < n.length; ) {
|
|
11
|
+
const i = n[c];
|
|
12
|
+
if (i === ".") {
|
|
13
|
+
let l = 0;
|
|
14
|
+
for (; n[c + l] === "."; )
|
|
15
|
+
l += 1;
|
|
16
|
+
s += l >= 3 ? "\\.".repeat(l) : ".".repeat(l), c += l;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
e.ESCAPABLE.includes(i) && (s += "\\"), s += i, c += 1;
|
|
20
|
+
}
|
|
21
|
+
return s;
|
|
22
|
+
};
|
|
23
|
+
e.escapeInteractionText = p;
|
|
24
|
+
const d = (n) => {
|
|
25
|
+
let s = "", c = 0;
|
|
26
|
+
for (; c < n.length; ) {
|
|
27
|
+
if ((0, e.isEscape)(n, c)) {
|
|
28
|
+
s += n[c + 1], c += 2;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
s += n[c], c += 1;
|
|
32
|
+
}
|
|
33
|
+
return s;
|
|
34
|
+
};
|
|
35
|
+
e.unescapeInteractionText = d;
|
|
36
|
+
const E = (n, s, c = 0) => {
|
|
37
|
+
let i = c;
|
|
38
|
+
for (; i < n.length; ) {
|
|
39
|
+
if ((0, e.isEscape)(n, i)) {
|
|
40
|
+
i += 2;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (n.startsWith(s, i))
|
|
44
|
+
return i;
|
|
45
|
+
i += 1;
|
|
46
|
+
}
|
|
47
|
+
return -1;
|
|
48
|
+
};
|
|
49
|
+
e.findUnescaped = E;
|
|
50
|
+
const f = (n, s) => {
|
|
51
|
+
const c = [];
|
|
52
|
+
let i = 0;
|
|
53
|
+
for (; ; ) {
|
|
54
|
+
const l = (0, e.findUnescaped)(n, s, i);
|
|
55
|
+
if (l < 0)
|
|
56
|
+
return c.push(n.slice(i)), c;
|
|
57
|
+
c.push(n.slice(i, l)), i = l + s.length;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
e.splitUnescaped = f;
|
|
61
|
+
const r = (n) => {
|
|
62
|
+
const s = [];
|
|
63
|
+
let c = 0, i = 0;
|
|
64
|
+
for (; i < n.length; ) {
|
|
65
|
+
if ((0, e.isEscape)(n, i)) {
|
|
66
|
+
i += 2;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (n[i] === "|") {
|
|
70
|
+
if (n.startsWith("||", i)) {
|
|
71
|
+
i += 2;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (i > 0 && n[i - 1] === "|" && !(0, e.isEscape)(n, i - 1)) {
|
|
75
|
+
i += 1;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
s.push(n.slice(c, i)), c = i + 1;
|
|
79
|
+
}
|
|
80
|
+
i += 1;
|
|
81
|
+
}
|
|
82
|
+
return s.push(n.slice(c)), s;
|
|
83
|
+
};
|
|
84
|
+
e.splitOnSingleUnescapedPipe = r;
|
|
85
|
+
const h = (n) => {
|
|
86
|
+
const s = n.split(`
|
|
87
|
+
`, 1)[0], c = (0, e.findUnescaped)(s, "...");
|
|
88
|
+
return c < 0 ? null : [s.slice(0, c), s.slice(c + 3)];
|
|
89
|
+
};
|
|
90
|
+
e.splitOnEllipsis = h, e.INTERACTION_CONTENT_SOURCE = "(?:\\\\[|/.\\]]|\\\\(?![|/.\\]])|[^\\]\\\\])*";
|
|
91
|
+
})(a), a);
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
O as __require
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=escaping.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escaping.es.js","sources":["../../../../node_modules/remark-flow/dist/escaping.js"],"sourcesContent":["\"use strict\";\n/**\n * Backslash escapes for the delimiters inside an interaction's brackets.\n *\n * `?[A|B]` gives `|`, `//`, `...` and `]` structural meaning, so option text that contains one of\n * them is reshaped: a bar splits one choice into two, a double slash gives half the display away\n * to the stored value, an ellipsis turns the rest into a text box, and a bracket ends the\n * interaction early. An option carrying a URL or a regular expression could not be written at all.\n *\n * A backslash before one of those characters now makes it ordinary text.\n *\n * The escape is deliberately *selective*: a backslash is an escape only when the character after\n * it is a delimiter, and is literal text everywhere else. `\\\\` is not an escape either. That\n * matters for content that already exists: of 110,685 interactions in published courses, 97\n * contain a backslash and every one of them is LaTeX -- `$\\pi_\\theta$`, `\\beta`, `\\nabla`, and\n * `\\\\` as a line break. A general \"backslash escapes the next character\" rule would render those\n * as `$pi_theta$`. Under this rule, none of them change.\n *\n * The cost is that a literal backslash cannot sit immediately before a literal delimiter: `\\|` is\n * an escaped bar, not a backslash and a separator.\n *\n * This mirrors `markdown_flow/escaping.py` in markdown-flow-agent-py character for character.\n * The two must agree: the backend renders an interaction, parses its own output with the Python\n * parser to prove the meaning survived, and then this parser is what the browser reads it with.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.INTERACTION_CONTENT_SOURCE = exports.splitOnEllipsis = exports.splitOnSingleUnescapedPipe = exports.splitUnescaped = exports.findUnescaped = exports.unescapeInteractionText = exports.escapeInteractionText = exports.isEscape = exports.ESCAPABLE = void 0;\n/** The characters a backslash may make ordinary. `/` covers `//`, `.` covers `...`. */\nexports.ESCAPABLE = '|/.]';\n/** Whether the backslash at `index` escapes the character after it. */\nconst isEscape = (text, index) => index + 1 < text.length &&\n text[index] === '\\\\' &&\n exports.ESCAPABLE.includes(text[index + 1]);\nexports.isEscape = isEscape;\n/**\n * Make `text` safe to write inside `?[...]`, keeping every character it has.\n *\n * A dot is escaped only inside a run of three or more, because only `...` is a delimiter and a\n * single period ends most sentences: escaping every one turns `Yes, I agree.` into\n * `Yes, I agree\\.` in everything that stores or shows the raw interaction. Two dots cannot become\n * three on their own, and the run is escaped whole so it cannot be read as one.\n *\n * Bars, brackets and slashes are escaped wherever they appear. They are rare in option text, and\n * escaping them unconditionally removes the need to reason about what a neighbouring character\n * might combine with once the option is written next to a separator.\n *\n * Escaping the delimiters rather than the backslashes as well is what keeps existing content\n * readable: a script that writes `$\\pi$` in an option still writes `$\\pi$` afterwards.\n */\nconst escapeInteractionText = (text) => {\n let out = '';\n let index = 0;\n while (index < text.length) {\n const char = text[index];\n if (char === '.') {\n let run = 0;\n while (text[index + run] === '.') {\n run += 1;\n }\n out += run >= 3 ? '\\\\.'.repeat(run) : '.'.repeat(run);\n index += run;\n continue;\n }\n if (exports.ESCAPABLE.includes(char)) {\n out += '\\\\';\n }\n out += char;\n index += 1;\n }\n return out;\n};\nexports.escapeInteractionText = escapeInteractionText;\n/** Resolve the escapes in one option's text, leaving every other backslash alone. */\nconst unescapeInteractionText = (text) => {\n let out = '';\n let index = 0;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n out += text[index + 1];\n index += 2;\n continue;\n }\n out += text[index];\n index += 1;\n }\n return out;\n};\nexports.unescapeInteractionText = unescapeInteractionText;\n/**\n * Index of the first `needle` that is not escaped and does not begin inside an escape, or -1.\n *\n * `needle` is matched whole: a `//` whose first slash is escaped is not a separator even though\n * its second slash is bare, because that second slash is the escaped character of the pair.\n */\nconst findUnescaped = (text, needle, start = 0) => {\n let index = start;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n index += 2;\n continue;\n }\n if (text.startsWith(needle, index)) {\n return index;\n }\n index += 1;\n }\n return -1;\n};\nexports.findUnescaped = findUnescaped;\n/** Split on every unescaped `separator`, leaving the escapes themselves in place. */\nconst splitUnescaped = (text, separator) => {\n const parts = [];\n let start = 0;\n for (;;) {\n const found = (0, exports.findUnescaped)(text, separator, start);\n if (found < 0) {\n parts.push(text.slice(start));\n return parts;\n }\n parts.push(text.slice(start, found));\n start = found + separator.length;\n }\n};\nexports.splitUnescaped = splitUnescaped;\n/** Split on unescaped single bars, leaving `||` joined as the multi-select separator. */\nconst splitOnSingleUnescapedPipe = (text) => {\n const parts = [];\n let start = 0;\n let index = 0;\n while (index < text.length) {\n if ((0, exports.isEscape)(text, index)) {\n index += 2;\n continue;\n }\n if (text[index] === '|') {\n if (text.startsWith('||', index)) {\n index += 2;\n continue;\n }\n if (index > 0 && text[index - 1] === '|' && !(0, exports.isEscape)(text, index - 1)) {\n index += 1;\n continue;\n }\n parts.push(text.slice(start, index));\n start = index + 1;\n }\n index += 1;\n }\n parts.push(text.slice(start));\n return parts;\n};\nexports.splitOnSingleUnescapedPipe = splitOnSingleUnescapedPipe;\n/**\n * Split an interaction's content at the `...` that opens its text box, or null.\n *\n * Two details are inherited rather than chosen, because changing either would rewrite questions\n * in courses that are already published:\n *\n * - the ellipsis counts only on the first line. The regex this replaces was anchored and its `.`\n * did not cross a newline, so `A\\n| ...hint` has always been read as two buttons, one of them\n * named `...hint`.\n * - the *first* ellipsis on that line wins, which is what the lazy group matched. (The Python\n * parser takes the last one instead -- a difference that predates escapes and is left alone\n * here; with options escaping their own dots, only the real marker is ever unescaped, so the\n * two agree on everything a producer writes.)\n *\n * What is new is only that an escaped ellipsis no longer counts.\n */\nconst splitOnEllipsis = (content) => {\n const head = content.split('\\n', 1)[0];\n const at = (0, exports.findUnescaped)(head, '...');\n if (at < 0) {\n return null;\n }\n return [head.slice(0, at), head.slice(at + 3)];\n};\nexports.splitOnEllipsis = splitOnEllipsis;\n/**\n * The bracket content of an interaction, as a regex source fragment.\n *\n * The three alternatives are mutually exclusive on purpose: a backslash before a delimiter can\n * only be read as an escape, so the pattern cannot backtrack into reading it as plain text and\n * then closing on the very bracket it escapes. Without that, this regex and a left-to-right\n * scanner disagree about `?[a\\\\]`, and two parsers of one grammar must not.\n */\nexports.INTERACTION_CONTENT_SOURCE = '(?:\\\\\\\\[|/.\\\\]]|\\\\\\\\(?![|/.\\\\]])|[^\\\\]\\\\\\\\])*';\n//# sourceMappingURL=escaping.js.map"],"names":["exports","isEscape","text","index","escapeInteractionText","out","char","run","unescapeInteractionText","findUnescaped","needle","start","splitUnescaped","separator","parts","found","splitOnSingleUnescapedPipe","splitOnEllipsis","content","head","at"],"mappings":";;;;AAyBA,WAAO,eAAcA,GAAU,cA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ACjB;AACI,aAAAW,EAAM,KAAKZ,EAAK,MAAMS,CAAK,CAAC,GACrBG;AAAA,IACX;AACA,IAAAd,EAAA,6BAAqCgB;AAiBrC,UAAMC,IAAkB,CAACC,MAAY;AACjC,YAAMC,IAAOD,EAAQ,MAAM;AAAA,GAAM,CAAC,EAAE,CAAC,GAC/BE,QAASpB,EAAQ,eAAemB,GAAM,KAAK;AACjD,aAAIC,IAAK,IACE,OAEJ,CAACD,EAAK,MAAM,GAAGC,CAAE,GAAGD,EAAK,MAAMC,IAAK,CAAC,CAAC;AAAA,IACjD;AACA,IAAApB,EAAA,kBAA0BiB,GAS1BjB,EAAA,6BAAqC;AAAA;;","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../_virtual/index2.cjs"),_=require("./remark-custom-variable.cjs"),f=require("./remark-flow.cjs"),s=require("./remark-interaction.cjs"),d=require("./interaction-parser.cjs"),b=require("./escaping.cjs");var c;function p(){return c||(c=1,(function(e){var i=n.__exports&&n.__exports.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.remarkInteraction=e.remarkFlow=e.remarkCustomVariable=e.unescapeInteractionText=e.splitUnescaped=e.splitOnSingleUnescapedPipe=e.splitOnEllipsis=e.isEscape=e.INTERACTION_CONTENT_SOURCE=e.findUnescaped=e.escapeInteractionText=e.ESCAPABLE=e.InteractionType=e.InteractionParser=e.createInteractionParser=void 0;const l=i(_.__require());e.remarkCustomVariable=l.default;const o=i(f.__require());e.remarkFlow=o.default;const u=i(s.__require());e.remarkInteraction=u.default;var a=d.__require();Object.defineProperty(e,"createInteractionParser",{enumerable:!0,get:function(){return a.createInteractionParser}}),Object.defineProperty(e,"InteractionParser",{enumerable:!0,get:function(){return a.InteractionParser}}),Object.defineProperty(e,"InteractionType",{enumerable:!0,get:function(){return a.InteractionType}});var r=b.__require();Object.defineProperty(e,"ESCAPABLE",{enumerable:!0,get:function(){return r.ESCAPABLE}}),Object.defineProperty(e,"escapeInteractionText",{enumerable:!0,get:function(){return r.escapeInteractionText}}),Object.defineProperty(e,"findUnescaped",{enumerable:!0,get:function(){return r.findUnescaped}}),Object.defineProperty(e,"INTERACTION_CONTENT_SOURCE",{enumerable:!0,get:function(){return r.INTERACTION_CONTENT_SOURCE}}),Object.defineProperty(e,"isEscape",{enumerable:!0,get:function(){return r.isEscape}}),Object.defineProperty(e,"splitOnEllipsis",{enumerable:!0,get:function(){return r.splitOnEllipsis}}),Object.defineProperty(e,"splitOnSingleUnescapedPipe",{enumerable:!0,get:function(){return r.splitOnSingleUnescapedPipe}}),Object.defineProperty(e,"splitUnescaped",{enumerable:!0,get:function(){return r.splitUnescaped}}),Object.defineProperty(e,"unescapeInteractionText",{enumerable:!0,get:function(){return r.unescapeInteractionText}}),e.default=u.default})(n.__exports)),n.__exports}exports.__require=p;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../node_modules/remark-flow/dist/index.js"],"sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.remarkInteraction = exports.remarkFlow = exports.remarkCustomVariable = exports.InteractionType = exports.InteractionParser = exports.createInteractionParser = void 0;\nconst remark_custom_variable_1 = __importDefault(require(\"./remark-custom-variable\"));\nexports.remarkCustomVariable = remark_custom_variable_1.default;\nconst remark_flow_1 = __importDefault(require(\"./remark-flow\"));\nexports.remarkFlow = remark_flow_1.default;\nconst remark_interaction_1 = __importDefault(require(\"./remark-interaction\"));\nexports.remarkInteraction = remark_interaction_1.default;\nvar interaction_parser_1 = require(\"./interaction-parser\");\nObject.defineProperty(exports, \"createInteractionParser\", { enumerable: true, get: function () { return interaction_parser_1.createInteractionParser; } });\nObject.defineProperty(exports, \"InteractionParser\", { enumerable: true, get: function () { return interaction_parser_1.InteractionParser; } });\nObject.defineProperty(exports, \"InteractionType\", { enumerable: true, get: function () { return interaction_parser_1.InteractionType; } });\nexports.default = remark_interaction_1.default;\n//# sourceMappingURL=index.js.map"],"names":["__importDefault","this","mod","exports","remark_custom_variable_1","require$$0","remark_flow_1","require$$1","remark_interaction_1","require$$2","interaction_parser_1","require$$3"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../node_modules/remark-flow/dist/index.js"],"sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.remarkInteraction = exports.remarkFlow = exports.remarkCustomVariable = exports.unescapeInteractionText = exports.splitUnescaped = exports.splitOnSingleUnescapedPipe = exports.splitOnEllipsis = exports.isEscape = exports.INTERACTION_CONTENT_SOURCE = exports.findUnescaped = exports.escapeInteractionText = exports.ESCAPABLE = exports.InteractionType = exports.InteractionParser = exports.createInteractionParser = void 0;\nconst remark_custom_variable_1 = __importDefault(require(\"./remark-custom-variable\"));\nexports.remarkCustomVariable = remark_custom_variable_1.default;\nconst remark_flow_1 = __importDefault(require(\"./remark-flow\"));\nexports.remarkFlow = remark_flow_1.default;\nconst remark_interaction_1 = __importDefault(require(\"./remark-interaction\"));\nexports.remarkInteraction = remark_interaction_1.default;\nvar interaction_parser_1 = require(\"./interaction-parser\");\nObject.defineProperty(exports, \"createInteractionParser\", { enumerable: true, get: function () { return interaction_parser_1.createInteractionParser; } });\nObject.defineProperty(exports, \"InteractionParser\", { enumerable: true, get: function () { return interaction_parser_1.InteractionParser; } });\nObject.defineProperty(exports, \"InteractionType\", { enumerable: true, get: function () { return interaction_parser_1.InteractionType; } });\n// The grammar's escape rule, so that anything else scanning for `?[...]` -- an editor's syntax\n// highlighting, a shortcode reader -- uses the same definition of where an interaction ends\n// rather than a second copy of it that an escaped bracket would fool.\nvar escaping_1 = require(\"./escaping\");\nObject.defineProperty(exports, \"ESCAPABLE\", { enumerable: true, get: function () { return escaping_1.ESCAPABLE; } });\nObject.defineProperty(exports, \"escapeInteractionText\", { enumerable: true, get: function () { return escaping_1.escapeInteractionText; } });\nObject.defineProperty(exports, \"findUnescaped\", { enumerable: true, get: function () { return escaping_1.findUnescaped; } });\nObject.defineProperty(exports, \"INTERACTION_CONTENT_SOURCE\", { enumerable: true, get: function () { return escaping_1.INTERACTION_CONTENT_SOURCE; } });\nObject.defineProperty(exports, \"isEscape\", { enumerable: true, get: function () { return escaping_1.isEscape; } });\nObject.defineProperty(exports, \"splitOnEllipsis\", { enumerable: true, get: function () { return escaping_1.splitOnEllipsis; } });\nObject.defineProperty(exports, \"splitOnSingleUnescapedPipe\", { enumerable: true, get: function () { return escaping_1.splitOnSingleUnescapedPipe; } });\nObject.defineProperty(exports, \"splitUnescaped\", { enumerable: true, get: function () { return escaping_1.splitUnescaped; } });\nObject.defineProperty(exports, \"unescapeInteractionText\", { enumerable: true, get: function () { return escaping_1.unescapeInteractionText; } });\nexports.default = remark_interaction_1.default;\n//# sourceMappingURL=index.js.map"],"names":["__importDefault","this","mod","exports","remark_custom_variable_1","require$$0","remark_flow_1","require$$1","remark_interaction_1","require$$2","interaction_parser_1","require$$3","escaping_1","require$$4"],"mappings":"gWACA,IAAIA,EAAmBC,EAAAA,WAAQA,EAAAA,UAAK,iBAAoB,SAAUC,EAAK,CACnE,OAAQA,GAAOA,EAAI,WAAcA,EAAM,CAAE,QAAWA,CAAG,CAC3D,EACA,OAAO,eAAcC,EAAU,aAAc,CAAE,MAAO,GAAM,EAC5DA,EAAA,kBAA4BA,EAAA,WAAqBA,EAAA,qBAA+BA,EAAA,wBAAkCA,EAAA,eAAyBA,6BAAqCA,EAAA,gBAA0BA,EAAA,SAAmBA,EAAA,2BAA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