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