markdown-flow-ui 0.2.6 → 0.2.7-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +206 -190
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +49 -43
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/lib/mobileDevice.cjs.js +1 -1
- package/dist/lib/mobileDevice.cjs.js.map +1 -1
- package/dist/lib/mobileDevice.d.ts +3 -3
- package/dist/lib/mobileDevice.es.js +27 -32
- package/dist/lib/mobileDevice.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as t } from "../../_virtual/jsx-runtime.es.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
import
|
|
4
|
+
import ce, { useState as be, useRef as W, useEffect as A, useMemo as h } from "react";
|
|
5
5
|
import Te from "../../_virtual/index.es.js";
|
|
6
6
|
import { sanitizeInvalidTagName as we } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
7
7
|
import { stripSvgTextLineBreaks as ke } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
@@ -9,11 +9,11 @@ import { stripSvgTextLineBreaks as ke } from "./utils/strip-svg-text-line-breaks
|
|
|
9
9
|
/* empty css */
|
|
10
10
|
import je from "./CodeBlock.es.js";
|
|
11
11
|
import Ne from "./plugins/CustomVariable.es.js";
|
|
12
|
-
import
|
|
12
|
+
import J from "./plugins/MermaidChart.es.js";
|
|
13
13
|
import { preserveCustomVariableProperties as Be, restoreCustomVariableProperties as Ce } from "./utils/custom-variable-props.es.js";
|
|
14
14
|
import { subsetLanguages as Se, highlightLanguages as Re } from "./utils/highlight-languages.es.js";
|
|
15
|
-
import {
|
|
16
|
-
import { normalizeInlineHtml as
|
|
15
|
+
import { mermaidBlockIsComplete as Le, parseMarkdownSegments as le } from "./utils/mermaid-parse.es.js";
|
|
16
|
+
import { normalizeInlineHtml as de } from "./utils/normalize-inline-html.es.js";
|
|
17
17
|
import Ae from "./IframeSandbox.es.js";
|
|
18
18
|
import { splitContentSegments as $e } from "./utils/split-content.es.js";
|
|
19
19
|
import { getInteractionDefaultValues as ze } from "../../lib/interaction-defaults.es.js";
|
|
@@ -25,49 +25,49 @@ import He from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
|
25
25
|
import De from "../../node_modules/remark-gfm/lib/index.es.js";
|
|
26
26
|
import Pe from "../../node_modules/remark-math/lib/index.es.js";
|
|
27
27
|
import We from "../../node_modules/remark-breaks/lib/index.es.js";
|
|
28
|
-
const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i,
|
|
29
|
-
const
|
|
28
|
+
const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, me = ({ svg: r }) => {
|
|
29
|
+
const i = W(null);
|
|
30
30
|
return A(() => {
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const a =
|
|
34
|
-
let
|
|
35
|
-
|
|
31
|
+
const s = i.current;
|
|
32
|
+
if (!s) return;
|
|
33
|
+
const a = s.shadowRoot ?? s.attachShadow({ mode: "open" }), T = "content-render-svg-style";
|
|
34
|
+
let f = a.getElementById(T);
|
|
35
|
+
f || (f = document.createElement("style"), f.id = T, f.textContent = `
|
|
36
36
|
svg { height: auto; display: inline-block; }
|
|
37
37
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
38
38
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
39
|
-
`, a.appendChild(
|
|
40
|
-
(o) => o !==
|
|
39
|
+
`, a.appendChild(f)), Array.from(a.childNodes).filter(
|
|
40
|
+
(o) => o !== f
|
|
41
41
|
).forEach((o) => a.removeChild(o));
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
let
|
|
42
|
+
const S = document.createElement("template"), $ = ke(r);
|
|
43
|
+
S.innerHTML = $, a.append(S.content.cloneNode(!0));
|
|
44
|
+
let x = !1, R = !1;
|
|
45
45
|
a.querySelectorAll("svg").forEach((o) => {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const [, ,
|
|
46
|
+
const L = o.getAttribute("viewBox");
|
|
47
|
+
if (!L) return;
|
|
48
|
+
const w = L.trim().split(/[\s,]+/).map((m) => Number(m));
|
|
49
|
+
if (w.length !== 4 || w.some(Number.isNaN)) return;
|
|
50
|
+
const [, , k, y] = w, j = o.getAttribute("width"), N = o.getAttribute("height"), M = (m) => {
|
|
51
51
|
if (!m) return !1;
|
|
52
|
-
const
|
|
53
|
-
return
|
|
52
|
+
const p = m.trim().toLowerCase();
|
|
53
|
+
return p === "auto" || p.endsWith("%");
|
|
54
54
|
}, F = (m) => {
|
|
55
55
|
if (!m) return null;
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
56
|
+
const p = m.trim().toLowerCase();
|
|
57
|
+
if (p === "auto" || p.endsWith("%"))
|
|
58
58
|
return null;
|
|
59
|
-
const
|
|
60
|
-
return Number.isNaN(
|
|
61
|
-
},
|
|
62
|
-
if (
|
|
63
|
-
|
|
59
|
+
const P = Number.parseFloat(p);
|
|
60
|
+
return Number.isNaN(P) ? null : P;
|
|
61
|
+
}, _ = M(j), E = M(N), I = !j || j === "0", V = !N || N === "0", H = F(j), D = F(N);
|
|
62
|
+
if (_ || E || I && V || H === k && D === y) {
|
|
63
|
+
x = !0, o.classList.add("content-render-svg-el--responsive"), o.classList.remove("content-render-svg-el--fixed"), o.style.width = "100%", o.style.height = "auto", !o.style.aspectRatio && y > 0 && (o.style.aspectRatio = `${k} / ${y}`);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
R = !0, o.classList.add("content-render-svg-el--fixed"), o.classList.remove("content-render-svg-el--responsive"), I && k > 0 && o.setAttribute("width", `${k}`), V && y > 0 && o.setAttribute("height", `${y}`);
|
|
67
67
|
});
|
|
68
|
-
const z =
|
|
69
|
-
|
|
70
|
-
}, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref:
|
|
68
|
+
const z = x && !R;
|
|
69
|
+
s.classList.toggle("content-render-svg--responsive", z), s.classList.toggle("content-render-svg--fixed", !z);
|
|
70
|
+
}, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: i }) });
|
|
71
71
|
}, Ee = [
|
|
72
72
|
De,
|
|
73
73
|
Pe,
|
|
@@ -80,219 +80,235 @@ const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
80
80
|
Ce,
|
|
81
81
|
[Ve, { languages: Re, subset: Se }],
|
|
82
82
|
He
|
|
83
|
-
],
|
|
83
|
+
], ue = ({ content: r, components: i }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
|
|
84
84
|
Fe,
|
|
85
85
|
{
|
|
86
86
|
remarkPlugins: Ee,
|
|
87
87
|
rehypePlugins: Ge,
|
|
88
|
-
components:
|
|
88
|
+
components: i,
|
|
89
89
|
children: r
|
|
90
90
|
}
|
|
91
91
|
) }), Ue = (r) => {
|
|
92
92
|
if (r.length <= 1) return r;
|
|
93
|
-
const
|
|
94
|
-
return r.forEach((
|
|
95
|
-
if (
|
|
96
|
-
|
|
93
|
+
const i = [];
|
|
94
|
+
return r.forEach((s) => {
|
|
95
|
+
if (s.type === "sandbox") {
|
|
96
|
+
i.push(s);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
const a =
|
|
99
|
+
const a = i[i.length - 1];
|
|
100
100
|
if (a && a.type !== "sandbox") {
|
|
101
|
-
|
|
101
|
+
i[i.length - 1] = {
|
|
102
102
|
type: "markdown",
|
|
103
|
-
value: `${a.value}${
|
|
103
|
+
value: `${a.value}${s.value}`
|
|
104
104
|
};
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
}, qe = (r,
|
|
110
|
-
const
|
|
107
|
+
i.push({ type: "markdown", value: s.value });
|
|
108
|
+
}), i;
|
|
109
|
+
}, qe = (r, i) => {
|
|
110
|
+
const s = Math.max(1, i), a = Array.from(r);
|
|
111
111
|
return {
|
|
112
|
-
chunk: a.slice(0,
|
|
113
|
-
rest: a.slice(
|
|
112
|
+
chunk: a.slice(0, s).join(""),
|
|
113
|
+
rest: a.slice(s).join("")
|
|
114
114
|
};
|
|
115
115
|
}, Tt = ({
|
|
116
116
|
content: r,
|
|
117
|
-
contentType:
|
|
118
|
-
locale:
|
|
117
|
+
contentType: i,
|
|
118
|
+
locale: s,
|
|
119
119
|
customRenderBar: a,
|
|
120
|
-
onSend:
|
|
121
|
-
typingSpeed:
|
|
122
|
-
enableTypewriter:
|
|
123
|
-
onTypeFinished:
|
|
120
|
+
onSend: T,
|
|
121
|
+
typingSpeed: f = 40,
|
|
122
|
+
enableTypewriter: Q = !1,
|
|
123
|
+
onTypeFinished: S,
|
|
124
124
|
onTypewriterStateChange: $,
|
|
125
|
-
userInput:
|
|
126
|
-
interactionDefaultValueOptions:
|
|
125
|
+
userInput: x,
|
|
126
|
+
interactionDefaultValueOptions: R,
|
|
127
127
|
defaultButtonText: z,
|
|
128
128
|
defaultInputText: o,
|
|
129
|
-
defaultSelectedValues:
|
|
130
|
-
readonly:
|
|
131
|
-
confirmButtonText:
|
|
132
|
-
copyButtonText:
|
|
133
|
-
copiedButtonText:
|
|
134
|
-
sandboxLoadingText:
|
|
129
|
+
defaultSelectedValues: L,
|
|
130
|
+
readonly: w = !1,
|
|
131
|
+
confirmButtonText: k,
|
|
132
|
+
copyButtonText: y,
|
|
133
|
+
copiedButtonText: j,
|
|
134
|
+
sandboxLoadingText: N,
|
|
135
135
|
sandboxStyleLoadingText: M,
|
|
136
136
|
sandboxScriptLoadingText: F,
|
|
137
|
-
disableSandboxLoadingOverlay:
|
|
138
|
-
sandboxFullscreenButtonText:
|
|
137
|
+
disableSandboxLoadingOverlay: _ = !1,
|
|
138
|
+
sandboxFullscreenButtonText: E,
|
|
139
139
|
sandboxExitFullscreenButtonText: I,
|
|
140
140
|
sandboxMode: V = "content",
|
|
141
|
-
onClickCustomButtonAfterContent:
|
|
142
|
-
beforeSend:
|
|
141
|
+
onClickCustomButtonAfterContent: H,
|
|
142
|
+
beforeSend: D
|
|
143
143
|
// tooltipMinLength,
|
|
144
144
|
}) => {
|
|
145
|
-
const
|
|
145
|
+
const B = Me(s), G = k || B.confirmButtonText, m = y || B.copyButtonText, p = j || B.copiedButtonText, P = E || B.sandboxFullscreenButtonText, pe = I || B.sandboxExitFullscreenButtonText, l = !!Q && (!i || i === "text"), Y = 2, Z = Math.max(0, f), [g, U] = be(
|
|
146
146
|
() => l ? "" : r
|
|
147
|
-
), b =
|
|
147
|
+
), b = W(""), ee = W(l), q = W(!1);
|
|
148
148
|
A(() => {
|
|
149
149
|
const e = ee.current;
|
|
150
|
-
if (ee.current = l,
|
|
151
|
-
b.current = "",
|
|
150
|
+
if (ee.current = l, q.current = !1, !l) {
|
|
151
|
+
b.current = "", U(r);
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
const c = !e,
|
|
156
|
-
if (!c && !
|
|
154
|
+
U((n) => {
|
|
155
|
+
const c = !e, v = r.startsWith(n);
|
|
156
|
+
if (!c && !v)
|
|
157
157
|
return b.current = "", r;
|
|
158
|
-
const d = c || !
|
|
158
|
+
const d = c || !v ? "" : n;
|
|
159
159
|
return b.current = r.slice(d.length), d;
|
|
160
160
|
});
|
|
161
161
|
}, [r, l]), A(() => {
|
|
162
|
-
l && (
|
|
163
|
-
}, [r,
|
|
162
|
+
l && (q.current || b.current || g !== r || (q.current = !0, S?.()));
|
|
163
|
+
}, [r, g, l, S]), A(() => {
|
|
164
164
|
if (!l || !b.current)
|
|
165
165
|
return;
|
|
166
166
|
const e = window.setTimeout(() => {
|
|
167
|
-
|
|
168
|
-
const { chunk: c, rest:
|
|
167
|
+
U((n) => {
|
|
168
|
+
const { chunk: c, rest: v } = qe(
|
|
169
169
|
b.current,
|
|
170
170
|
Y
|
|
171
171
|
);
|
|
172
|
-
return c ? (b.current =
|
|
172
|
+
return c ? (b.current = v, `${n}${c}`) : n;
|
|
173
173
|
});
|
|
174
174
|
}, Z);
|
|
175
175
|
return () => window.clearTimeout(e);
|
|
176
176
|
}, [
|
|
177
177
|
r,
|
|
178
|
-
|
|
178
|
+
g,
|
|
179
179
|
l,
|
|
180
180
|
Y,
|
|
181
181
|
Z
|
|
182
182
|
]);
|
|
183
|
-
const te =
|
|
183
|
+
const te = h(
|
|
184
184
|
() => ({
|
|
185
185
|
isTypewriterEnabled: l,
|
|
186
|
-
isTyping: l &&
|
|
187
|
-
isComplete:
|
|
188
|
-
renderedLength:
|
|
186
|
+
isTyping: l && g !== r,
|
|
187
|
+
isComplete: g === r,
|
|
188
|
+
renderedLength: g.length,
|
|
189
189
|
totalLength: r.length
|
|
190
190
|
}),
|
|
191
|
-
[r,
|
|
191
|
+
[r, g, l]
|
|
192
192
|
);
|
|
193
193
|
A(() => {
|
|
194
194
|
$?.(te);
|
|
195
195
|
}, [$, te]);
|
|
196
|
-
const u = l ?
|
|
197
|
-
() =>
|
|
196
|
+
const u = l ? g : r, K = h(
|
|
197
|
+
() => de(u),
|
|
198
198
|
[u]
|
|
199
|
-
),
|
|
199
|
+
), O = h(
|
|
200
200
|
() => ze(
|
|
201
201
|
u,
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
x,
|
|
203
|
+
R
|
|
204
204
|
),
|
|
205
|
-
[
|
|
206
|
-
),
|
|
207
|
-
() =>
|
|
208
|
-
[
|
|
209
|
-
),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
205
|
+
[R, u, x]
|
|
206
|
+
), re = z?.trim() || O.buttonText, ne = o?.trim() || O.inputText, he = h(
|
|
207
|
+
() => x ? x.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
208
|
+
[x]
|
|
209
|
+
), oe = L?.length ? L : O.selectedValues || he, se = h(
|
|
210
|
+
() => ({
|
|
211
|
+
"custom-button-after-content": ({
|
|
212
|
+
children: e
|
|
213
|
+
}) => /* @__PURE__ */ t.jsx(
|
|
214
|
+
"button",
|
|
215
|
+
{
|
|
216
|
+
className: "content-render-custom-button-after-content",
|
|
217
|
+
onClick: H,
|
|
218
|
+
children: /* @__PURE__ */ t.jsx("span", { className: "content-render-custom-button-after-content-inner", children: e })
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
"custom-variable": (e) => /* @__PURE__ */ t.jsx(
|
|
222
|
+
Ne,
|
|
223
|
+
{
|
|
224
|
+
...e,
|
|
225
|
+
readonly: w,
|
|
226
|
+
defaultButtonText: re,
|
|
227
|
+
defaultInputText: ne,
|
|
228
|
+
defaultSelectedValues: oe,
|
|
229
|
+
onSend: T,
|
|
230
|
+
beforeSend: D,
|
|
231
|
+
locale: s,
|
|
232
|
+
confirmButtonText: G
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
code: (e) => {
|
|
236
|
+
const { className: n, children: c, ...v } = e;
|
|
237
|
+
if (/language-(\w+)/.exec(n || "")?.[1] === "mermaid") {
|
|
238
|
+
const C = c?.toString().replace(/\n$/, "") || "", ye = Le(u, C);
|
|
239
|
+
return /* @__PURE__ */ t.jsx(J, { chart: C, frozen: ye });
|
|
240
|
+
}
|
|
241
|
+
return /* @__PURE__ */ t.jsx("code", { className: n, ...v, children: c });
|
|
242
|
+
},
|
|
243
|
+
table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
|
|
244
|
+
th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
|
|
245
|
+
td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
|
|
246
|
+
tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
|
|
247
|
+
li: ({ node: e, ...n }) => {
|
|
248
|
+
const c = e?.properties?.className;
|
|
249
|
+
return typeof c == "string" && c.includes("task-list-item") || Array.isArray(c) && c.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...n }) : /* @__PURE__ */ t.jsx("li", { ...n });
|
|
250
|
+
},
|
|
251
|
+
ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
|
|
252
|
+
ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
|
|
253
|
+
input: ({ ...e }) => e.type === "checkbox" ? /* @__PURE__ */ t.jsx(
|
|
254
|
+
"input",
|
|
255
|
+
{
|
|
256
|
+
type: "checkbox",
|
|
257
|
+
className: "content-render-checkbox",
|
|
258
|
+
disabled: !0,
|
|
259
|
+
...e
|
|
260
|
+
}
|
|
261
|
+
) : /* @__PURE__ */ t.jsx("input", { ...e }),
|
|
262
|
+
a: ({ children: e, ...n }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
|
|
263
|
+
pre: (e) => /* @__PURE__ */ t.jsx(
|
|
264
|
+
je,
|
|
265
|
+
{
|
|
266
|
+
...e,
|
|
267
|
+
copyButtonText: m,
|
|
268
|
+
copiedButtonText: p
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
}),
|
|
272
|
+
[
|
|
273
|
+
D,
|
|
274
|
+
s,
|
|
275
|
+
H,
|
|
276
|
+
T,
|
|
277
|
+
w,
|
|
278
|
+
u,
|
|
279
|
+
G,
|
|
280
|
+
p,
|
|
281
|
+
m,
|
|
282
|
+
re,
|
|
283
|
+
ne,
|
|
284
|
+
oe
|
|
285
|
+
]
|
|
286
|
+
), ie = h(
|
|
271
287
|
() => _e.test(u),
|
|
272
288
|
[u]
|
|
273
|
-
),
|
|
274
|
-
() =>
|
|
275
|
-
[u,
|
|
276
|
-
), fe =
|
|
289
|
+
), X = h(
|
|
290
|
+
() => ie ? $e(u, !0) : [],
|
|
291
|
+
[u, ie]
|
|
292
|
+
), fe = X.some(
|
|
277
293
|
(e) => e.type === "sandbox"
|
|
278
|
-
), xe =
|
|
279
|
-
() => Ue(
|
|
280
|
-
[
|
|
281
|
-
),
|
|
282
|
-
() =>
|
|
283
|
-
[
|
|
284
|
-
),
|
|
285
|
-
const c =
|
|
286
|
-
return
|
|
287
|
-
const
|
|
294
|
+
), xe = h(
|
|
295
|
+
() => Ue(X),
|
|
296
|
+
[X]
|
|
297
|
+
), ge = h(
|
|
298
|
+
() => le(K),
|
|
299
|
+
[K]
|
|
300
|
+
), ve = (e, n) => {
|
|
301
|
+
const c = de(e);
|
|
302
|
+
return le(c).map((d, ae) => {
|
|
303
|
+
const C = `${n}-${d.type}-${ae}`;
|
|
288
304
|
return d.type === "text" ? /* @__PURE__ */ t.jsx(
|
|
289
|
-
|
|
305
|
+
ue,
|
|
290
306
|
{
|
|
291
|
-
components:
|
|
307
|
+
components: se,
|
|
292
308
|
content: d.value
|
|
293
309
|
},
|
|
294
|
-
|
|
295
|
-
) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(
|
|
310
|
+
C
|
|
311
|
+
) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(J, { chart: d.value, frozen: !d.complete }, C) : d.type === "svg" ? /* @__PURE__ */ t.jsx(me, { svg: d.value }, C) : null;
|
|
296
312
|
});
|
|
297
313
|
};
|
|
298
314
|
return fe ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: xe.map(
|
|
@@ -303,31 +319,31 @@ const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
303
319
|
type: "sandbox",
|
|
304
320
|
content: e.value,
|
|
305
321
|
className: "content-render-iframe",
|
|
306
|
-
locale:
|
|
307
|
-
loadingText:
|
|
322
|
+
locale: s,
|
|
323
|
+
loadingText: N,
|
|
308
324
|
styleLoadingText: M,
|
|
309
325
|
scriptLoadingText: F,
|
|
310
|
-
disableLoadingOverlay:
|
|
311
|
-
fullScreenButtonText:
|
|
312
|
-
exitFullScreenButtonText:
|
|
326
|
+
disableLoadingOverlay: _,
|
|
327
|
+
fullScreenButtonText: P,
|
|
328
|
+
exitFullScreenButtonText: pe,
|
|
313
329
|
mode: V
|
|
314
330
|
},
|
|
315
331
|
`sandbox-${n}`
|
|
316
|
-
) : /* @__PURE__ */ t.jsx(
|
|
332
|
+
) : /* @__PURE__ */ t.jsx(ce.Fragment, { children: ve(e.value, `md-${n}`) }, `md-${n}`)
|
|
317
333
|
) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
|
|
318
|
-
|
|
334
|
+
ge.map((e, n) => {
|
|
319
335
|
if (e.type === "text")
|
|
320
336
|
return /* @__PURE__ */ t.jsx(
|
|
321
|
-
|
|
337
|
+
ue,
|
|
322
338
|
{
|
|
323
|
-
components:
|
|
339
|
+
components: se,
|
|
324
340
|
content: e.value
|
|
325
341
|
},
|
|
326
342
|
n
|
|
327
343
|
);
|
|
328
344
|
if (e.type === "mermaid")
|
|
329
345
|
return /* @__PURE__ */ t.jsx(
|
|
330
|
-
|
|
346
|
+
J,
|
|
331
347
|
{
|
|
332
348
|
chart: e.value,
|
|
333
349
|
frozen: !e.complete
|
|
@@ -335,17 +351,17 @@ const _e = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
335
351
|
n
|
|
336
352
|
);
|
|
337
353
|
if (e.type === "svg")
|
|
338
|
-
return /* @__PURE__ */ t.jsx(
|
|
354
|
+
return /* @__PURE__ */ t.jsx(me, { svg: e.value }, n);
|
|
339
355
|
}),
|
|
340
|
-
a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children:
|
|
356
|
+
a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: ce.createElement(a, {
|
|
341
357
|
content: r,
|
|
342
|
-
displayContent:
|
|
343
|
-
onSend:
|
|
358
|
+
displayContent: K,
|
|
359
|
+
onSend: T
|
|
344
360
|
}) })
|
|
345
361
|
] });
|
|
346
362
|
};
|
|
347
363
|
export {
|
|
348
|
-
|
|
364
|
+
ue as MarkdownRenderer,
|
|
349
365
|
Tt as default
|
|
350
366
|
};
|
|
351
367
|
//# sourceMappingURL=ContentRender.es.js.map
|