markdown-flow-ui 0.2.15 → 0.2.16-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.
- 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/ContentRender/ContentRender.cjs +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +3 -0
- package/dist/components/ContentRender/ContentRender.es.js +301 -262
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/index.d.ts +1 -1
- package/dist/components/ContentRender/typewriterPacing.fixtures.d.ts +14 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.cjs +3 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.cjs.map +1 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.d.ts +27 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.es.js +98 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.es.js.map +1 -0
- package/dist/components/ContentRender/utils/typewriter-pacing.test.d.ts +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/markdown-flow-ui-lib.css +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/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
- package/dist/renderer.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { sanitizeInvalidTagName as
|
|
5
|
-
import { stripSvgTextLineBreaks as
|
|
1
|
+
import { jsx as r, jsxs as ze } from "react/jsx-runtime";
|
|
2
|
+
import Q, { useMemo as y, useState as Ce, useRef as g, useEffect as H } from "react";
|
|
3
|
+
import We from "../../_virtual/index.es.js";
|
|
4
|
+
import { sanitizeInvalidTagName as Pe } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
5
|
+
import { stripSvgTextLineBreaks as He } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { preserveCustomVariableProperties as
|
|
14
|
-
import { subsetLanguages as
|
|
15
|
-
import { parseMarkdownSegments as
|
|
16
|
-
import { normalizeInlineHtml as
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
import Qe, { CodeBlockContext as qe } from "./CodeBlock.es.js";
|
|
11
|
+
import je from "./plugins/CustomVariable.es.js";
|
|
12
|
+
import se from "./plugins/MermaidChart.es.js";
|
|
13
|
+
import { preserveCustomVariableProperties as Ue, restoreCustomVariableProperties as Ge } from "./utils/custom-variable-props.es.js";
|
|
14
|
+
import { subsetLanguages as Ke, highlightLanguages as Oe } from "./utils/highlight-languages.es.js";
|
|
15
|
+
import { parseMarkdownSegments as be, mermaidBlockIsComplete as Xe } from "./utils/mermaid-parse.es.js";
|
|
16
|
+
import { normalizeInlineHtml as ke } from "./utils/normalize-inline-html.es.js";
|
|
17
|
+
import Ye from "./IframeSandbox.es.js";
|
|
18
|
+
import { appendContentAwareTypewriterQueue as Ze, createContentAwareTypewriterQueue as Je, consumeContentAwareTypewriterQueue as et, CONTENT_AWARE_TYPEWRITER_TICK_BUDGET as tt, isContentAwareTypewriterQueueEmpty as rt } from "./utils/typewriter-pacing.es.js";
|
|
19
|
+
import { splitContentSegments as nt } from "./utils/split-content.es.js";
|
|
20
|
+
import { getInteractionDefaultValues as ot } from "../../lib/interaction-defaults.es.js";
|
|
21
|
+
import { getMarkdownFlowDirection as st, getMarkdownFlowLanguage as at } from "../../lib/locale.es.js";
|
|
22
|
+
import { getContentRenderLocaleTexts as Re } from "./contentRenderI18n.es.js";
|
|
23
|
+
import { Markdown as it } from "../../node_modules/react-markdown/lib/index.es.js";
|
|
24
|
+
import ct from "../../node_modules/rehype-raw/lib/index.es.js";
|
|
25
|
+
import lt from "../../node_modules/rehype-highlight/lib/index.es.js";
|
|
26
|
+
import ut from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
27
|
+
import dt from "../../node_modules/remark-gfm/lib/index.es.js";
|
|
28
|
+
import mt from "../../node_modules/remark-math/lib/index.es.js";
|
|
29
|
+
import pt from "../../node_modules/remark-breaks/lib/index.es.js";
|
|
30
|
+
const ft = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, ht = 2, Be = ({ svg: t }) => {
|
|
31
|
+
const n = g(null);
|
|
32
|
+
return H(() => {
|
|
32
33
|
const o = n.current;
|
|
33
34
|
if (!o) return;
|
|
34
|
-
const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }),
|
|
35
|
-
let
|
|
36
|
-
|
|
35
|
+
const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }), T = "content-render-svg-style";
|
|
36
|
+
let u = s.getElementById(T);
|
|
37
|
+
u || (u = document.createElement("style"), u.id = T, u.textContent = `
|
|
37
38
|
svg { height: auto; display: inline-block; }
|
|
38
39
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
39
40
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
40
|
-
`, s.appendChild(
|
|
41
|
-
(a) => a !==
|
|
41
|
+
`, s.appendChild(u)), Array.from(s.childNodes).filter(
|
|
42
|
+
(a) => a !== u
|
|
42
43
|
).forEach((a) => s.removeChild(a));
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
let
|
|
44
|
+
const V = document.createElement("template"), L = He(t);
|
|
45
|
+
V.innerHTML = L, s.append(V.content.cloneNode(!0));
|
|
46
|
+
let f = !1, I = !1;
|
|
46
47
|
s.querySelectorAll("svg").forEach((a) => {
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const [, ,
|
|
52
|
-
if (!
|
|
53
|
-
const
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
if (!
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
48
|
+
const F = a.getAttribute("viewBox");
|
|
49
|
+
if (!F) return;
|
|
50
|
+
const _ = F.trim().split(/[\s,]+/).map((x) => Number(x));
|
|
51
|
+
if (_.length !== 4 || _.some(Number.isNaN)) return;
|
|
52
|
+
const [, , M, b] = _, S = a.getAttribute("width"), D = a.getAttribute("height"), q = (x) => {
|
|
53
|
+
if (!x) return !1;
|
|
54
|
+
const c = x.trim().toLowerCase();
|
|
55
|
+
return c === "auto" || c.endsWith("%");
|
|
56
|
+
}, j = (x) => {
|
|
57
|
+
if (!x) return null;
|
|
58
|
+
const c = x.trim().toLowerCase();
|
|
59
|
+
if (c === "auto" || c.endsWith("%"))
|
|
59
60
|
return null;
|
|
60
|
-
const
|
|
61
|
-
return Number.isNaN(
|
|
62
|
-
},
|
|
63
|
-
if (
|
|
64
|
-
|
|
61
|
+
const R = Number.parseFloat(c);
|
|
62
|
+
return Number.isNaN(R) ? null : R;
|
|
63
|
+
}, O = q(S), X = q(D), U = !S || S === "0", G = !D || D === "0", Y = j(S), Z = j(D);
|
|
64
|
+
if (O || X || U && G || Y === M && Z === b) {
|
|
65
|
+
f = !0, a.classList.add("content-render-svg-el--responsive"), a.classList.remove("content-render-svg-el--fixed"), a.style.width = "100%", a.style.height = "auto", !a.style.aspectRatio && b > 0 && (a.style.aspectRatio = `${M} / ${b}`);
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
I = !0, a.classList.add("content-render-svg-el--fixed"), a.classList.remove("content-render-svg-el--responsive"), U && M > 0 && a.setAttribute("width", `${M}`), G && b > 0 && a.setAttribute("height", `${b}`);
|
|
68
69
|
});
|
|
69
|
-
const
|
|
70
|
-
o.classList.toggle("content-render-svg--responsive",
|
|
70
|
+
const $ = f && !I;
|
|
71
|
+
o.classList.toggle("content-render-svg--responsive", $), o.classList.toggle("content-render-svg--fixed", !$);
|
|
71
72
|
}, [t]), /* @__PURE__ */ r("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ r("div", { className: "content-render-svg", ref: n }) });
|
|
72
|
-
},
|
|
73
|
+
}, ae = Q.createContext(
|
|
73
74
|
null
|
|
74
|
-
),
|
|
75
|
-
const n =
|
|
75
|
+
), gt = (t) => {
|
|
76
|
+
const n = Q.useContext(ae), o = Q.useContext(qe);
|
|
76
77
|
if (!n)
|
|
77
78
|
throw new Error("Markdown code renderer requires ContentRender context.");
|
|
78
|
-
const { className: s, children:
|
|
79
|
+
const { className: s, children: T, ...u } = t;
|
|
79
80
|
if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
|
|
80
|
-
const
|
|
81
|
+
const L = T?.toString().replace(/\n$/, "") || "", f = Xe(
|
|
81
82
|
n.current.renderContent,
|
|
82
|
-
|
|
83
|
+
L
|
|
83
84
|
);
|
|
84
85
|
return /* @__PURE__ */ r(
|
|
85
|
-
|
|
86
|
+
se,
|
|
86
87
|
{
|
|
87
|
-
chart:
|
|
88
|
-
frozen:
|
|
88
|
+
chart: L,
|
|
89
|
+
frozen: f,
|
|
89
90
|
messages: n.current.mermaidMessages
|
|
90
91
|
}
|
|
91
92
|
);
|
|
@@ -94,42 +95,42 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
94
95
|
"code",
|
|
95
96
|
{
|
|
96
97
|
className: s,
|
|
97
|
-
...
|
|
98
|
-
dir:
|
|
99
|
-
children:
|
|
98
|
+
...u,
|
|
99
|
+
dir: u.dir ?? (o ? void 0 : "ltr"),
|
|
100
|
+
children: T
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
],
|
|
108
|
-
Fe,
|
|
103
|
+
}, xt = [
|
|
104
|
+
dt,
|
|
105
|
+
mt,
|
|
106
|
+
We,
|
|
107
|
+
pt
|
|
108
|
+
], vt = [
|
|
109
109
|
Ue,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
ct,
|
|
111
|
+
Pe,
|
|
112
|
+
Ge,
|
|
113
|
+
[lt, { languages: Oe, subset: Ke }],
|
|
114
|
+
ut
|
|
115
|
+
], Se = ({ content: t, components: n, locale: o }) => {
|
|
116
|
+
const s = Re(o);
|
|
116
117
|
return /* @__PURE__ */ r("div", { className: "markdown-renderer", children: /* @__PURE__ */ r(
|
|
117
|
-
|
|
118
|
+
it,
|
|
118
119
|
{
|
|
119
|
-
remarkPlugins:
|
|
120
|
-
rehypePlugins:
|
|
120
|
+
remarkPlugins: xt,
|
|
121
|
+
rehypePlugins: vt,
|
|
121
122
|
remarkRehypeOptions: {
|
|
122
123
|
footnoteLabel: s.footnoteLabel,
|
|
123
|
-
footnoteBackLabel: (
|
|
124
|
-
const
|
|
125
|
-
return s.footnoteBackLabel.replace("{reference}",
|
|
124
|
+
footnoteBackLabel: (T, u) => {
|
|
125
|
+
const B = String(T + 1) + (u > 1 ? `-${u}` : "");
|
|
126
|
+
return s.footnoteBackLabel.replace("{reference}", B);
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
129
|
components: n,
|
|
129
130
|
children: t
|
|
130
131
|
}
|
|
131
132
|
) });
|
|
132
|
-
},
|
|
133
|
+
}, yt = (t) => {
|
|
133
134
|
if (t.length <= 1) return t;
|
|
134
135
|
const n = [];
|
|
135
136
|
return t.forEach((o) => {
|
|
@@ -147,155 +148,193 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
147
148
|
}
|
|
148
149
|
n.push({ type: "markdown", value: o.value });
|
|
149
150
|
}), n;
|
|
150
|
-
},
|
|
151
|
+
}, Tt = (t, n) => {
|
|
151
152
|
const o = Math.max(1, n), s = Array.from(t);
|
|
152
153
|
return {
|
|
153
154
|
chunk: s.slice(0, o).join(""),
|
|
154
155
|
rest: s.slice(o).join("")
|
|
155
156
|
};
|
|
156
|
-
},
|
|
157
|
-
const n =
|
|
158
|
-
return
|
|
159
|
-
},
|
|
157
|
+
}, wt = (t, n) => t === n ? !0 : !t || !n || t.length !== n.length ? !1 : t.every((o, s) => o === n[s]), Ct = (t) => {
|
|
158
|
+
const n = g(t);
|
|
159
|
+
return wt(n.current, t) || (n.current = t), n.current;
|
|
160
|
+
}, er = ({
|
|
160
161
|
content: t,
|
|
161
162
|
contentType: n,
|
|
162
163
|
locale: o,
|
|
163
164
|
lang: s,
|
|
164
|
-
dir:
|
|
165
|
-
customRenderBar:
|
|
166
|
-
onSend:
|
|
167
|
-
typingSpeed:
|
|
168
|
-
enableTypewriter:
|
|
169
|
-
|
|
165
|
+
dir: T,
|
|
166
|
+
customRenderBar: u,
|
|
167
|
+
onSend: B,
|
|
168
|
+
typingSpeed: V = 40,
|
|
169
|
+
enableTypewriter: L = !1,
|
|
170
|
+
typewriterPacing: f = "fixed",
|
|
171
|
+
onTypeFinished: I,
|
|
170
172
|
onTypewriterStateChange: $,
|
|
171
|
-
userInput:
|
|
172
|
-
interactionDefaultValueOptions:
|
|
173
|
-
defaultButtonText:
|
|
174
|
-
defaultInputText:
|
|
175
|
-
defaultSelectedValues:
|
|
176
|
-
readonly:
|
|
177
|
-
confirmButtonText:
|
|
178
|
-
copyButtonText:
|
|
179
|
-
copiedButtonText:
|
|
180
|
-
sandboxLoadingText:
|
|
181
|
-
sandboxStyleLoadingText:
|
|
182
|
-
sandboxScriptLoadingText:
|
|
183
|
-
disableSandboxLoadingOverlay:
|
|
184
|
-
sandboxFullscreenButtonText:
|
|
185
|
-
sandboxExitFullscreenButtonText:
|
|
186
|
-
sandboxMode:
|
|
187
|
-
onClickCustomButtonAfterContent:
|
|
188
|
-
beforeSend:
|
|
173
|
+
userInput: a,
|
|
174
|
+
interactionDefaultValueOptions: F,
|
|
175
|
+
defaultButtonText: _,
|
|
176
|
+
defaultInputText: M,
|
|
177
|
+
defaultSelectedValues: b,
|
|
178
|
+
readonly: S = !1,
|
|
179
|
+
confirmButtonText: D,
|
|
180
|
+
copyButtonText: q,
|
|
181
|
+
copiedButtonText: j,
|
|
182
|
+
sandboxLoadingText: O,
|
|
183
|
+
sandboxStyleLoadingText: X,
|
|
184
|
+
sandboxScriptLoadingText: U,
|
|
185
|
+
disableSandboxLoadingOverlay: G = !1,
|
|
186
|
+
sandboxFullscreenButtonText: Y,
|
|
187
|
+
sandboxExitFullscreenButtonText: Z,
|
|
188
|
+
sandboxMode: ie = "content",
|
|
189
|
+
onClickCustomButtonAfterContent: J,
|
|
190
|
+
beforeSend: x
|
|
189
191
|
// tooltipMinLength,
|
|
190
192
|
}) => {
|
|
191
|
-
const c =
|
|
193
|
+
const c = Re(o), R = y(
|
|
192
194
|
() => ({
|
|
193
195
|
loading: c.mermaidLoadingText,
|
|
194
196
|
emptyChart: c.mermaidEmptyChartText,
|
|
195
197
|
error: c.mermaidErrorText
|
|
196
198
|
}),
|
|
197
199
|
[c]
|
|
198
|
-
),
|
|
199
|
-
() =>
|
|
200
|
-
),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
), z = T ?? st(o), W = s ?? at(o), ce = D || c.confirmButtonText, le = q || c.copyButtonText, ue = j || c.copiedButtonText, Ne = Y || c.sandboxFullscreenButtonText, Ae = Z || c.sandboxExitFullscreenButtonText, d = !!L && (!n || n === "text"), de = Math.max(0, V), Le = f === "fixed" ? t : void 0, [w, me] = Ce(
|
|
201
|
+
() => d ? "" : t
|
|
202
|
+
), K = g(w), h = g(""), k = g({
|
|
203
|
+
tokens: [],
|
|
204
|
+
head: 0
|
|
205
|
+
}), N = g(0), pe = g(d), fe = g(f), he = g(t), ee = g(!1), [Me, De] = Ce(0);
|
|
206
|
+
H(() => {
|
|
207
|
+
const e = pe.current, i = fe.current, m = he.current, C = !!h.current;
|
|
208
|
+
pe.current = d, fe.current = f, he.current = t, (t !== m || d !== e) && (ee.current = !1);
|
|
209
|
+
const p = () => {
|
|
210
|
+
h.current = "", k.current = { tokens: [], head: 0 }, N.current = 0;
|
|
211
|
+
}, P = (E) => {
|
|
212
|
+
K.current = E, me(E);
|
|
213
|
+
};
|
|
214
|
+
if (!d) {
|
|
215
|
+
p(), P(t);
|
|
205
216
|
return;
|
|
206
217
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
e || (p(), P(""));
|
|
219
|
+
const A = e ? K.current : "";
|
|
220
|
+
if (!t.startsWith(A)) {
|
|
221
|
+
p(), P(t);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const oe = t.slice(A.length);
|
|
225
|
+
if (!oe) {
|
|
226
|
+
p();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (f === "content-aware") {
|
|
230
|
+
const E = m.slice(
|
|
231
|
+
A.length
|
|
232
|
+
);
|
|
233
|
+
e && i === "content-aware" && t.startsWith(m) && h.current === E ? k.current = Ze(
|
|
234
|
+
k.current,
|
|
235
|
+
t.slice(m.length)
|
|
236
|
+
) : (k.current = Je(oe), N.current = 0);
|
|
237
|
+
} else
|
|
238
|
+
k.current = { tokens: [], head: 0 }, N.current = 0;
|
|
239
|
+
h.current = oe, C || De((E) => E + 1);
|
|
240
|
+
}, [t, d, f]), H(() => {
|
|
241
|
+
d && (ee.current || h.current || w !== t || (ee.current = !0, I?.()));
|
|
242
|
+
}, [t, w, d, I]), H(() => {
|
|
243
|
+
if (!d || !h.current)
|
|
218
244
|
return;
|
|
219
245
|
const e = window.setTimeout(() => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
246
|
+
if (!h.current)
|
|
247
|
+
return;
|
|
248
|
+
let i = "";
|
|
249
|
+
if (f === "content-aware") {
|
|
250
|
+
const C = et(
|
|
251
|
+
k.current,
|
|
252
|
+
N.current + tt
|
|
224
253
|
);
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
|
|
254
|
+
i = C.chunk, k.current = C.queue, rt(C.queue) ? N.current = 0 : N.current = C.remainingBudget;
|
|
255
|
+
} else
|
|
256
|
+
i = Tt(
|
|
257
|
+
h.current,
|
|
258
|
+
ht
|
|
259
|
+
).chunk;
|
|
260
|
+
if (!i)
|
|
261
|
+
return;
|
|
262
|
+
h.current = h.current.slice(i.length), h.current || (k.current = { tokens: [], head: 0 }, N.current = 0);
|
|
263
|
+
const m = `${K.current}${i}`;
|
|
264
|
+
K.current = m, me(m);
|
|
265
|
+
}, de);
|
|
228
266
|
return () => window.clearTimeout(e);
|
|
229
267
|
}, [
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
268
|
+
w,
|
|
269
|
+
Le,
|
|
270
|
+
d,
|
|
271
|
+
f,
|
|
272
|
+
de,
|
|
273
|
+
Me
|
|
235
274
|
]);
|
|
236
|
-
const
|
|
275
|
+
const ge = y(
|
|
237
276
|
() => ({
|
|
238
|
-
isTypewriterEnabled:
|
|
239
|
-
isTyping:
|
|
240
|
-
isComplete:
|
|
241
|
-
renderedLength:
|
|
277
|
+
isTypewriterEnabled: d,
|
|
278
|
+
isTyping: d && w !== t,
|
|
279
|
+
isComplete: w === t,
|
|
280
|
+
renderedLength: w.length,
|
|
242
281
|
totalLength: t.length
|
|
243
282
|
}),
|
|
244
|
-
[t,
|
|
283
|
+
[t, w, d]
|
|
245
284
|
);
|
|
246
|
-
|
|
247
|
-
$?.(
|
|
248
|
-
}, [$,
|
|
249
|
-
const
|
|
250
|
-
() =>
|
|
251
|
-
[
|
|
252
|
-
),
|
|
253
|
-
() =>
|
|
254
|
-
h,
|
|
285
|
+
H(() => {
|
|
286
|
+
$?.(ge);
|
|
287
|
+
}, [$, ge]);
|
|
288
|
+
const v = d ? w : t, te = y(
|
|
289
|
+
() => ke(v),
|
|
290
|
+
[v]
|
|
291
|
+
), re = y(
|
|
292
|
+
() => ot(
|
|
255
293
|
v,
|
|
256
|
-
a
|
|
294
|
+
a,
|
|
295
|
+
F
|
|
257
296
|
),
|
|
258
|
-
[
|
|
259
|
-
),
|
|
260
|
-
() =>
|
|
261
|
-
[
|
|
262
|
-
),
|
|
263
|
-
|
|
264
|
-
), l =
|
|
265
|
-
direction:
|
|
266
|
-
language:
|
|
267
|
-
mermaidMessages:
|
|
268
|
-
beforeSend:
|
|
297
|
+
[F, v, a]
|
|
298
|
+
), xe = _?.trim() || re.buttonText, ve = M?.trim() || re.inputText, Ee = y(
|
|
299
|
+
() => a ? a.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
300
|
+
[a]
|
|
301
|
+
), Ve = b?.length ? b : re.selectedValues || Ee, ye = Ct(
|
|
302
|
+
Ve
|
|
303
|
+
), l = g({
|
|
304
|
+
direction: z,
|
|
305
|
+
language: W,
|
|
306
|
+
mermaidMessages: R,
|
|
307
|
+
beforeSend: x,
|
|
269
308
|
locale: o,
|
|
270
|
-
onClickCustomButtonAfterContent:
|
|
271
|
-
onSend:
|
|
272
|
-
readonly:
|
|
273
|
-
renderContent:
|
|
274
|
-
resolvedConfirmButtonText:
|
|
275
|
-
resolvedCopiedButtonText:
|
|
276
|
-
resolvedCopyButtonText:
|
|
277
|
-
resolvedDefaultButtonText:
|
|
278
|
-
resolvedDefaultInputText:
|
|
279
|
-
resolvedDefaultSelectedValues:
|
|
309
|
+
onClickCustomButtonAfterContent: J,
|
|
310
|
+
onSend: B,
|
|
311
|
+
readonly: S,
|
|
312
|
+
renderContent: v,
|
|
313
|
+
resolvedConfirmButtonText: ce,
|
|
314
|
+
resolvedCopiedButtonText: ue,
|
|
315
|
+
resolvedCopyButtonText: le,
|
|
316
|
+
resolvedDefaultButtonText: xe,
|
|
317
|
+
resolvedDefaultInputText: ve,
|
|
318
|
+
resolvedDefaultSelectedValues: ye
|
|
280
319
|
});
|
|
281
320
|
l.current = {
|
|
282
|
-
direction:
|
|
283
|
-
language:
|
|
284
|
-
mermaidMessages:
|
|
285
|
-
beforeSend:
|
|
321
|
+
direction: z,
|
|
322
|
+
language: W,
|
|
323
|
+
mermaidMessages: R,
|
|
324
|
+
beforeSend: x,
|
|
286
325
|
locale: o,
|
|
287
|
-
onClickCustomButtonAfterContent:
|
|
288
|
-
onSend:
|
|
289
|
-
readonly:
|
|
290
|
-
renderContent:
|
|
291
|
-
resolvedConfirmButtonText:
|
|
292
|
-
resolvedCopiedButtonText:
|
|
293
|
-
resolvedCopyButtonText:
|
|
294
|
-
resolvedDefaultButtonText:
|
|
295
|
-
resolvedDefaultInputText:
|
|
296
|
-
resolvedDefaultSelectedValues:
|
|
326
|
+
onClickCustomButtonAfterContent: J,
|
|
327
|
+
onSend: B,
|
|
328
|
+
readonly: S,
|
|
329
|
+
renderContent: v,
|
|
330
|
+
resolvedConfirmButtonText: ce,
|
|
331
|
+
resolvedCopiedButtonText: ue,
|
|
332
|
+
resolvedCopyButtonText: le,
|
|
333
|
+
resolvedDefaultButtonText: xe,
|
|
334
|
+
resolvedDefaultInputText: ve,
|
|
335
|
+
resolvedDefaultSelectedValues: ye
|
|
297
336
|
};
|
|
298
|
-
const
|
|
337
|
+
const Te = y(
|
|
299
338
|
() => ({
|
|
300
339
|
"custom-button-after-content": ({
|
|
301
340
|
children: e
|
|
@@ -308,7 +347,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
308
347
|
}
|
|
309
348
|
),
|
|
310
349
|
"custom-variable": (e) => /* @__PURE__ */ r(
|
|
311
|
-
|
|
350
|
+
je,
|
|
312
351
|
{
|
|
313
352
|
...e,
|
|
314
353
|
readonly: l.current.readonly,
|
|
@@ -323,7 +362,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
323
362
|
confirmButtonText: l.current.resolvedConfirmButtonText
|
|
324
363
|
}
|
|
325
364
|
),
|
|
326
|
-
code:
|
|
365
|
+
code: gt,
|
|
327
366
|
table: ({ ...e }) => /* @__PURE__ */ r("div", { className: "content-render-table-container", children: /* @__PURE__ */ r("table", { className: "content-render-table", ...e }) }),
|
|
328
367
|
th: ({ ...e }) => /* @__PURE__ */ r("th", { className: "content-render-th", ...e }),
|
|
329
368
|
td: ({ ...e }) => /* @__PURE__ */ r("td", { className: "content-render-td", ...e }),
|
|
@@ -345,7 +384,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
345
384
|
) : /* @__PURE__ */ r("input", { ...e }),
|
|
346
385
|
a: ({ children: e, ...i }) => /* @__PURE__ */ r("a", { target: "_blank", rel: "noopener noreferrer", ...i, children: e }),
|
|
347
386
|
pre: (e) => /* @__PURE__ */ r(
|
|
348
|
-
|
|
387
|
+
Qe,
|
|
349
388
|
{
|
|
350
389
|
...e,
|
|
351
390
|
copyButtonText: l.current.resolvedCopyButtonText,
|
|
@@ -354,96 +393,96 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
354
393
|
)
|
|
355
394
|
}),
|
|
356
395
|
[]
|
|
357
|
-
),
|
|
358
|
-
() =>
|
|
359
|
-
[
|
|
360
|
-
),
|
|
361
|
-
() =>
|
|
362
|
-
[
|
|
363
|
-
),
|
|
396
|
+
), we = y(
|
|
397
|
+
() => ft.test(v),
|
|
398
|
+
[v]
|
|
399
|
+
), ne = y(
|
|
400
|
+
() => we ? nt(v, !0) : [],
|
|
401
|
+
[v, we]
|
|
402
|
+
), Ie = ne.some(
|
|
364
403
|
(e) => e.type === "sandbox"
|
|
365
|
-
),
|
|
366
|
-
() =>
|
|
367
|
-
[
|
|
368
|
-
),
|
|
369
|
-
() =>
|
|
370
|
-
[
|
|
371
|
-
),
|
|
372
|
-
const m =
|
|
373
|
-
return
|
|
374
|
-
const
|
|
375
|
-
return
|
|
376
|
-
|
|
404
|
+
), $e = y(
|
|
405
|
+
() => yt(ne),
|
|
406
|
+
[ne]
|
|
407
|
+
), Fe = y(
|
|
408
|
+
() => be(te),
|
|
409
|
+
[te]
|
|
410
|
+
), _e = (e, i) => {
|
|
411
|
+
const m = ke(e);
|
|
412
|
+
return be(m).map((p, P) => {
|
|
413
|
+
const A = `${i}-${p.type}-${P}`;
|
|
414
|
+
return p.type === "text" ? /* @__PURE__ */ r(
|
|
415
|
+
ae.Provider,
|
|
377
416
|
{
|
|
378
417
|
value: l,
|
|
379
418
|
children: /* @__PURE__ */ r(
|
|
380
|
-
|
|
419
|
+
Se,
|
|
381
420
|
{
|
|
382
421
|
locale: o,
|
|
383
|
-
components:
|
|
384
|
-
content:
|
|
422
|
+
components: Te,
|
|
423
|
+
content: p.value
|
|
385
424
|
}
|
|
386
425
|
)
|
|
387
426
|
},
|
|
388
|
-
|
|
389
|
-
) :
|
|
390
|
-
|
|
427
|
+
A
|
|
428
|
+
) : p.type === "mermaid" ? /* @__PURE__ */ r(
|
|
429
|
+
se,
|
|
391
430
|
{
|
|
392
|
-
chart:
|
|
393
|
-
frozen: !
|
|
394
|
-
messages:
|
|
431
|
+
chart: p.value,
|
|
432
|
+
frozen: !p.complete,
|
|
433
|
+
messages: R
|
|
395
434
|
},
|
|
396
|
-
|
|
397
|
-
) :
|
|
435
|
+
A
|
|
436
|
+
) : p.type === "svg" ? /* @__PURE__ */ r(Be, { svg: p.value }, A) : null;
|
|
398
437
|
});
|
|
399
438
|
};
|
|
400
|
-
return
|
|
439
|
+
return Ie ? /* @__PURE__ */ r(
|
|
401
440
|
"div",
|
|
402
441
|
{
|
|
403
442
|
className: "content-render markdown-body",
|
|
404
|
-
dir:
|
|
405
|
-
lang:
|
|
406
|
-
children:
|
|
443
|
+
dir: z,
|
|
444
|
+
lang: W,
|
|
445
|
+
children: $e.map(
|
|
407
446
|
(e, i) => e.type === "sandbox" ? /* @__PURE__ */ r(
|
|
408
|
-
|
|
447
|
+
Ye,
|
|
409
448
|
{
|
|
410
449
|
hideFullScreen: !0,
|
|
411
450
|
type: "sandbox",
|
|
412
451
|
content: e.value,
|
|
413
452
|
className: "content-render-iframe",
|
|
414
453
|
locale: o,
|
|
415
|
-
dir:
|
|
416
|
-
lang:
|
|
417
|
-
loadingText:
|
|
418
|
-
styleLoadingText:
|
|
419
|
-
scriptLoadingText:
|
|
420
|
-
disableLoadingOverlay:
|
|
421
|
-
fullScreenButtonText:
|
|
422
|
-
exitFullScreenButtonText:
|
|
423
|
-
mode:
|
|
454
|
+
dir: z,
|
|
455
|
+
lang: W,
|
|
456
|
+
loadingText: O,
|
|
457
|
+
styleLoadingText: X,
|
|
458
|
+
scriptLoadingText: U,
|
|
459
|
+
disableLoadingOverlay: G,
|
|
460
|
+
fullScreenButtonText: Ne,
|
|
461
|
+
exitFullScreenButtonText: Ae,
|
|
462
|
+
mode: ie
|
|
424
463
|
},
|
|
425
464
|
`sandbox-${i}`
|
|
426
|
-
) : /* @__PURE__ */ r(
|
|
465
|
+
) : /* @__PURE__ */ r(Q.Fragment, { children: _e(e.value, `md-${i}`) }, `md-${i}`)
|
|
427
466
|
)
|
|
428
467
|
}
|
|
429
|
-
) : /* @__PURE__ */
|
|
468
|
+
) : /* @__PURE__ */ ze(
|
|
430
469
|
"div",
|
|
431
470
|
{
|
|
432
471
|
className: "content-render markdown-body",
|
|
433
|
-
dir:
|
|
434
|
-
lang:
|
|
472
|
+
dir: z,
|
|
473
|
+
lang: W,
|
|
435
474
|
children: [
|
|
436
|
-
|
|
475
|
+
Fe.map((e, i) => {
|
|
437
476
|
if (e.type === "text")
|
|
438
477
|
return /* @__PURE__ */ r(
|
|
439
|
-
|
|
478
|
+
ae.Provider,
|
|
440
479
|
{
|
|
441
480
|
value: l,
|
|
442
481
|
children: /* @__PURE__ */ r(
|
|
443
|
-
|
|
482
|
+
Se,
|
|
444
483
|
{
|
|
445
484
|
locale: o,
|
|
446
|
-
components:
|
|
485
|
+
components: Te,
|
|
447
486
|
content: e.value
|
|
448
487
|
}
|
|
449
488
|
)
|
|
@@ -452,28 +491,28 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
452
491
|
);
|
|
453
492
|
if (e.type === "mermaid")
|
|
454
493
|
return /* @__PURE__ */ r(
|
|
455
|
-
|
|
494
|
+
se,
|
|
456
495
|
{
|
|
457
496
|
chart: e.value,
|
|
458
497
|
frozen: !e.complete,
|
|
459
|
-
messages:
|
|
498
|
+
messages: R
|
|
460
499
|
},
|
|
461
500
|
i
|
|
462
501
|
);
|
|
463
502
|
if (e.type === "svg")
|
|
464
|
-
return /* @__PURE__ */ r(
|
|
503
|
+
return /* @__PURE__ */ r(Be, { svg: e.value }, i);
|
|
465
504
|
}),
|
|
466
|
-
|
|
505
|
+
u && /* @__PURE__ */ r("div", { className: "content-render-custom-bar", children: Q.createElement(u, {
|
|
467
506
|
content: t,
|
|
468
|
-
displayContent:
|
|
469
|
-
onSend:
|
|
507
|
+
displayContent: te,
|
|
508
|
+
onSend: B
|
|
470
509
|
}) })
|
|
471
510
|
]
|
|
472
511
|
}
|
|
473
512
|
);
|
|
474
513
|
};
|
|
475
514
|
export {
|
|
476
|
-
|
|
477
|
-
|
|
515
|
+
Se as MarkdownRenderer,
|
|
516
|
+
er as default
|
|
478
517
|
};
|
|
479
518
|
//# sourceMappingURL=ContentRender.es.js.map
|