markdown-flow-ui 0.1.120 → 0.1.121
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.cjs11.js +1 -1
- package/dist/_virtual/index.cjs12.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -2
- package/dist/_virtual/index.es11.js +3 -3
- package/dist/_virtual/index.es12.js +2 -2
- package/dist/_virtual/index.es4.js +4 -4
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +5 -5
- package/dist/_virtual/index.es8.js +3 -2
- package/dist/_virtual/index.es8.js.map +1 -1
- package/dist/_virtual/index.es9.js +2 -3
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +10 -1
- package/dist/components/ContentRender/ContentRender.es.js +221 -175
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -3
- package/dist/components/ContentRender/index.d.ts +1 -2
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +0 -3
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -29
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.es.js +50 -51
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/utils/runStreamFixture.d.ts +2 -0
- package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js.map +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.es.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/package.json +2 -3
- package/dist/components/ContentRender/useTypewriter.d.ts +0 -19
- package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js +0 -2
- package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js.map +0 -1
- package/dist/components/ContentRender/useTypewriterStateMachine.d.ts +0 -19
- package/dist/components/ContentRender/useTypewriterStateMachine.es.js +0 -180
- package/dist/components/ContentRender/useTypewriterStateMachine.es.js.map +0 -1
|
@@ -1,89 +1,88 @@
|
|
|
1
1
|
import { j as t } 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 Z, { useState as pe, useRef as V, useEffect as S, useMemo as g } from "react";
|
|
5
|
+
import he from "../../_virtual/index.es.js";
|
|
6
|
+
import { sanitizeInvalidTagName as fe } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
7
|
+
import { stripSvgTextLineBreaks as xe } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return F(() => {
|
|
10
|
+
import ge from "./CodeBlock.es.js";
|
|
11
|
+
import ye from "./plugins/CustomVariable.es.js";
|
|
12
|
+
import q from "./plugins/MermaidChart.es.js";
|
|
13
|
+
import { preserveCustomVariableProperties as ve, restoreCustomVariableProperties as be } from "./utils/custom-variable-props.es.js";
|
|
14
|
+
import { subsetLanguages as we, highlightLanguages as ke } from "./utils/highlight-languages.es.js";
|
|
15
|
+
import { parseMarkdownSegments as ee, mermaidBlockIsComplete as je } from "./utils/mermaid-parse.es.js";
|
|
16
|
+
import { normalizeInlineHtml as te } from "./utils/normalize-inline-html.es.js";
|
|
17
|
+
import Ne from "./IframeSandbox.es.js";
|
|
18
|
+
import { splitContentSegments as Te } from "./utils/split-content.es.js";
|
|
19
|
+
import { getInteractionDefaultValues as Ce } from "../../lib/interaction-defaults.es.js";
|
|
20
|
+
import { Markdown as Se } from "../../markdown-flow-ui/node_modules/.pnpm/react-markdown@10.1.0_@types_react@19.2.2_react@19.0.1/node_modules/react-markdown/lib/index.es.js";
|
|
21
|
+
import Re from "../../markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.es.js";
|
|
22
|
+
import Be from "../../markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.es.js";
|
|
23
|
+
import Le from "../../markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.es.js";
|
|
24
|
+
import Ae from "../../markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.es.js";
|
|
25
|
+
import $e from "../../markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.es.js";
|
|
26
|
+
import ze from "../../markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.es.js";
|
|
27
|
+
const Me = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, re = ({ svg: r }) => {
|
|
28
|
+
const o = V(null);
|
|
29
|
+
return S(() => {
|
|
31
30
|
const a = o.current;
|
|
32
31
|
if (!a) return;
|
|
33
|
-
const i = a.shadowRoot ?? a.attachShadow({ mode: "open" }),
|
|
34
|
-
let
|
|
35
|
-
|
|
32
|
+
const i = a.shadowRoot ?? a.attachShadow({ mode: "open" }), R = "content-render-svg-style";
|
|
33
|
+
let f = i.getElementById(R);
|
|
34
|
+
f || (f = document.createElement("style"), f.id = R, f.textContent = `
|
|
36
35
|
svg { height: auto; display: inline-block; }
|
|
37
36
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
38
37
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
39
|
-
`, i.appendChild(
|
|
40
|
-
(
|
|
41
|
-
).forEach((
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
i.querySelectorAll("svg").forEach((
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const [, ,
|
|
38
|
+
`, i.appendChild(f)), Array.from(i.childNodes).filter(
|
|
39
|
+
(s) => s !== f
|
|
40
|
+
).forEach((s) => i.removeChild(s));
|
|
41
|
+
const N = document.createElement("template"), y = xe(r);
|
|
42
|
+
N.innerHTML = y, i.append(N.content.cloneNode(!0));
|
|
43
|
+
let T = !1, B = !1;
|
|
44
|
+
i.querySelectorAll("svg").forEach((s) => {
|
|
45
|
+
const A = s.getAttribute("viewBox");
|
|
46
|
+
if (!A) return;
|
|
47
|
+
const C = A.trim().split(/[\s,]+/).map((c) => Number(c));
|
|
48
|
+
if (C.length !== 4 || C.some(Number.isNaN)) return;
|
|
49
|
+
const [, , b, v] = C, w = s.getAttribute("width"), k = s.getAttribute("height"), $ = (c) => {
|
|
51
50
|
if (!c) return !1;
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
},
|
|
51
|
+
const u = c.trim().toLowerCase();
|
|
52
|
+
return u === "auto" || u.endsWith("%");
|
|
53
|
+
}, z = (c) => {
|
|
55
54
|
if (!c) return null;
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
55
|
+
const u = c.trim().toLowerCase();
|
|
56
|
+
if (u === "auto" || u.endsWith("%"))
|
|
58
57
|
return null;
|
|
59
|
-
const
|
|
60
|
-
return Number.isNaN(
|
|
61
|
-
},
|
|
62
|
-
if (
|
|
63
|
-
|
|
58
|
+
const p = Number.parseFloat(u);
|
|
59
|
+
return Number.isNaN(p) ? null : p;
|
|
60
|
+
}, D = $(w), P = $(k), M = !w || w === "0", I = !k || k === "0", K = z(w), l = z(k);
|
|
61
|
+
if (D || P || M && I || K === b && l === v) {
|
|
62
|
+
T = !0, s.classList.add("content-render-svg-el--responsive"), s.classList.remove("content-render-svg-el--fixed"), s.style.width = "100%", s.style.height = "auto", !s.style.aspectRatio && v > 0 && (s.style.aspectRatio = `${b} / ${v}`);
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
66
|
-
|
|
65
|
+
B = !0, s.classList.add("content-render-svg-el--fixed"), s.classList.remove("content-render-svg-el--responsive"), M && b > 0 && s.setAttribute("width", `${b}`), I && v > 0 && s.setAttribute("height", `${v}`);
|
|
67
66
|
});
|
|
68
|
-
const
|
|
69
|
-
a.classList.toggle("content-render-svg--responsive",
|
|
67
|
+
const L = T && !B;
|
|
68
|
+
a.classList.toggle("content-render-svg--responsive", L), a.classList.toggle("content-render-svg--fixed", !L);
|
|
70
69
|
}, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: o }) });
|
|
71
|
-
},
|
|
72
|
-
|
|
70
|
+
}, Ie = [Ae, $e, he, ze], Ve = [
|
|
71
|
+
ve,
|
|
72
|
+
Re,
|
|
73
|
+
fe,
|
|
73
74
|
be,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
], Z = ({ content: r, components: o }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
|
|
79
|
-
ge,
|
|
75
|
+
[Be, { languages: ke, subset: we }],
|
|
76
|
+
Le
|
|
77
|
+
], ne = ({ content: r, components: o }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
|
|
78
|
+
Se,
|
|
80
79
|
{
|
|
81
|
-
remarkPlugins:
|
|
82
|
-
rehypePlugins:
|
|
80
|
+
remarkPlugins: Ie,
|
|
81
|
+
rehypePlugins: Ve,
|
|
83
82
|
components: o,
|
|
84
83
|
children: r
|
|
85
84
|
}
|
|
86
|
-
) }),
|
|
85
|
+
) }), He = (r) => {
|
|
87
86
|
if (r.length <= 1) return r;
|
|
88
87
|
const o = [];
|
|
89
88
|
return r.forEach((a) => {
|
|
@@ -101,46 +100,105 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
101
100
|
}
|
|
102
101
|
o.push({ type: "markdown", value: a.value });
|
|
103
102
|
}), o;
|
|
104
|
-
},
|
|
103
|
+
}, De = (r, o) => {
|
|
104
|
+
const a = Math.max(1, o), i = Array.from(r);
|
|
105
|
+
return {
|
|
106
|
+
chunk: i.slice(0, a).join(""),
|
|
107
|
+
rest: i.slice(a).join("")
|
|
108
|
+
};
|
|
109
|
+
}, dt = ({
|
|
105
110
|
content: r,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
contentType: o,
|
|
112
|
+
customRenderBar: a,
|
|
113
|
+
onSend: i,
|
|
114
|
+
typingSpeed: R = 40,
|
|
115
|
+
enableTypewriter: f = !1,
|
|
116
|
+
onTypeFinished: H,
|
|
117
|
+
onTypewriterStateChange: N,
|
|
118
|
+
userInput: y,
|
|
119
|
+
interactionDefaultValueOptions: T,
|
|
120
|
+
defaultButtonText: B,
|
|
121
|
+
defaultInputText: L,
|
|
122
|
+
defaultSelectedValues: s,
|
|
123
|
+
readonly: A = !1,
|
|
124
|
+
confirmButtonText: C,
|
|
125
|
+
copyButtonText: b,
|
|
126
|
+
copiedButtonText: v,
|
|
127
|
+
sandboxLoadingText: w,
|
|
128
|
+
sandboxStyleLoadingText: k,
|
|
129
|
+
sandboxScriptLoadingText: $,
|
|
130
|
+
disableSandboxLoadingOverlay: z = !1,
|
|
131
|
+
sandboxFullscreenButtonText: D,
|
|
132
|
+
sandboxMode: P = "content",
|
|
126
133
|
onClickCustomButtonAfterContent: M,
|
|
127
134
|
beforeSend: I
|
|
128
135
|
// tooltipMinLength,
|
|
129
136
|
}) => {
|
|
130
|
-
const
|
|
131
|
-
() =>
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
const l = !!f && (!o || o === "text"), W = 2, _ = Math.max(0, R), [c, u] = pe(
|
|
138
|
+
() => l ? "" : r
|
|
139
|
+
), p = V(""), O = V(l), F = V(!1);
|
|
140
|
+
S(() => {
|
|
141
|
+
const e = O.current;
|
|
142
|
+
if (O.current = l, F.current = !1, !l) {
|
|
143
|
+
p.current = "", u(r);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
u((n) => {
|
|
147
|
+
const m = !e, x = r.startsWith(n);
|
|
148
|
+
if (!m && !x)
|
|
149
|
+
return p.current = "", r;
|
|
150
|
+
const d = m || !x ? "" : n;
|
|
151
|
+
return p.current = r.slice(d.length), d;
|
|
152
|
+
});
|
|
153
|
+
}, [r, l]), S(() => {
|
|
154
|
+
l && (F.current || p.current || c !== r || (F.current = !0, H?.()));
|
|
155
|
+
}, [r, c, l, H]), S(() => {
|
|
156
|
+
if (!l || !p.current)
|
|
157
|
+
return;
|
|
158
|
+
const e = window.setTimeout(() => {
|
|
159
|
+
u((n) => {
|
|
160
|
+
const { chunk: m, rest: x } = De(
|
|
161
|
+
p.current,
|
|
162
|
+
W
|
|
163
|
+
);
|
|
164
|
+
return m ? (p.current = x, `${n}${m}`) : n;
|
|
165
|
+
});
|
|
166
|
+
}, _);
|
|
167
|
+
return () => window.clearTimeout(e);
|
|
168
|
+
}, [
|
|
169
|
+
r,
|
|
170
|
+
c,
|
|
171
|
+
l,
|
|
172
|
+
W,
|
|
173
|
+
_
|
|
174
|
+
]);
|
|
175
|
+
const X = g(
|
|
176
|
+
() => ({
|
|
177
|
+
isTypewriterEnabled: l,
|
|
178
|
+
isTyping: l && c !== r,
|
|
179
|
+
isComplete: c === r,
|
|
180
|
+
renderedLength: c.length,
|
|
181
|
+
totalLength: r.length
|
|
182
|
+
}),
|
|
183
|
+
[r, c, l]
|
|
184
|
+
);
|
|
185
|
+
S(() => {
|
|
186
|
+
N?.(X);
|
|
187
|
+
}, [N, X]);
|
|
188
|
+
const h = l ? c : r, E = g(
|
|
189
|
+
() => te(h),
|
|
190
|
+
[h]
|
|
191
|
+
), G = g(
|
|
192
|
+
() => Ce(
|
|
193
|
+
h,
|
|
194
|
+
y,
|
|
195
|
+
T
|
|
138
196
|
),
|
|
139
|
-
[
|
|
140
|
-
),
|
|
141
|
-
() =>
|
|
142
|
-
[
|
|
143
|
-
),
|
|
197
|
+
[T, h, y]
|
|
198
|
+
), se = B?.trim() || G.buttonText, oe = L?.trim() || G.inputText, ae = g(
|
|
199
|
+
() => y ? y.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
200
|
+
[y]
|
|
201
|
+
), ie = s?.length ? s : G.selectedValues || ae, J = {
|
|
144
202
|
"custom-button-after-content": ({
|
|
145
203
|
children: e
|
|
146
204
|
}) => /* @__PURE__ */ t.jsx(
|
|
@@ -152,33 +210,33 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
152
210
|
}
|
|
153
211
|
),
|
|
154
212
|
"custom-variable": (e) => /* @__PURE__ */ t.jsx(
|
|
155
|
-
|
|
213
|
+
ye,
|
|
156
214
|
{
|
|
157
215
|
...e,
|
|
158
|
-
readonly:
|
|
159
|
-
defaultButtonText:
|
|
160
|
-
defaultInputText:
|
|
161
|
-
defaultSelectedValues:
|
|
162
|
-
onSend:
|
|
216
|
+
readonly: A,
|
|
217
|
+
defaultButtonText: se,
|
|
218
|
+
defaultInputText: oe,
|
|
219
|
+
defaultSelectedValues: ie,
|
|
220
|
+
onSend: i,
|
|
163
221
|
beforeSend: I,
|
|
164
|
-
confirmButtonText:
|
|
222
|
+
confirmButtonText: C
|
|
165
223
|
}
|
|
166
224
|
),
|
|
167
225
|
code: (e) => {
|
|
168
|
-
const { className:
|
|
169
|
-
if (/language-(\w+)/.exec(
|
|
170
|
-
const
|
|
171
|
-
return /* @__PURE__ */ t.jsx(
|
|
226
|
+
const { className: n, children: m, ...x } = e;
|
|
227
|
+
if (/language-(\w+)/.exec(n || "")?.[1] === "mermaid") {
|
|
228
|
+
const j = m?.toString().replace(/\n$/, "") || "", ue = je(h, j);
|
|
229
|
+
return /* @__PURE__ */ t.jsx(q, { chart: j, frozen: ue });
|
|
172
230
|
}
|
|
173
|
-
return /* @__PURE__ */ t.jsx("code", { className:
|
|
231
|
+
return /* @__PURE__ */ t.jsx("code", { className: n, ...x, children: m });
|
|
174
232
|
},
|
|
175
233
|
table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
|
|
176
234
|
th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
|
|
177
235
|
td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
|
|
178
236
|
tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
|
|
179
|
-
li: ({ node: e, ...
|
|
180
|
-
const
|
|
181
|
-
return typeof
|
|
237
|
+
li: ({ node: e, ...n }) => {
|
|
238
|
+
const m = e?.properties?.className;
|
|
239
|
+
return typeof m == "string" && m.includes("task-list-item") || Array.isArray(m) && m.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...n }) : /* @__PURE__ */ t.jsx("li", { ...n });
|
|
182
240
|
},
|
|
183
241
|
ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
|
|
184
242
|
ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
|
|
@@ -191,104 +249,92 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
191
249
|
...e
|
|
192
250
|
}
|
|
193
251
|
) : /* @__PURE__ */ t.jsx("input", { ...e }),
|
|
194
|
-
a: ({ children: e, ...
|
|
252
|
+
a: ({ children: e, ...n }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
|
|
195
253
|
pre: (e) => /* @__PURE__ */ t.jsx(
|
|
196
|
-
|
|
254
|
+
ge,
|
|
197
255
|
{
|
|
198
256
|
...e,
|
|
199
|
-
copyButtonText:
|
|
200
|
-
copiedButtonText:
|
|
257
|
+
copyButtonText: b,
|
|
258
|
+
copiedButtonText: v
|
|
201
259
|
}
|
|
202
260
|
)
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
() => Se.test(r),
|
|
211
|
-
[r]
|
|
212
|
-
), D = h(
|
|
213
|
-
() => K ? xe(r, !0) : [],
|
|
214
|
-
[r, K]
|
|
215
|
-
), R = D.some(
|
|
261
|
+
}, Q = g(
|
|
262
|
+
() => Me.test(h),
|
|
263
|
+
[h]
|
|
264
|
+
), U = g(
|
|
265
|
+
() => Q ? Te(h, !0) : [],
|
|
266
|
+
[h, Q]
|
|
267
|
+
), ce = U.some(
|
|
216
268
|
(e) => e.type === "sandbox"
|
|
217
|
-
),
|
|
218
|
-
() =>
|
|
219
|
-
[
|
|
220
|
-
),
|
|
221
|
-
() =>
|
|
222
|
-
[
|
|
223
|
-
),
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const re = (e, s) => {
|
|
230
|
-
const d = Q(e);
|
|
231
|
-
return J(d).map((u, O) => {
|
|
232
|
-
const b = `${s}-${u.type}-${O}`;
|
|
233
|
-
return u.type === "text" ? /* @__PURE__ */ t.jsx(
|
|
234
|
-
Z,
|
|
269
|
+
), le = g(
|
|
270
|
+
() => He(U),
|
|
271
|
+
[U]
|
|
272
|
+
), me = g(
|
|
273
|
+
() => ee(E),
|
|
274
|
+
[E]
|
|
275
|
+
), de = (e, n) => {
|
|
276
|
+
const m = te(e);
|
|
277
|
+
return ee(m).map((d, Y) => {
|
|
278
|
+
const j = `${n}-${d.type}-${Y}`;
|
|
279
|
+
return d.type === "text" ? /* @__PURE__ */ t.jsx(
|
|
280
|
+
ne,
|
|
235
281
|
{
|
|
236
|
-
components:
|
|
237
|
-
content:
|
|
282
|
+
components: J,
|
|
283
|
+
content: d.value
|
|
238
284
|
},
|
|
239
|
-
|
|
240
|
-
) :
|
|
285
|
+
j
|
|
286
|
+
) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(q, { chart: d.value, frozen: !d.complete }, j) : d.type === "svg" ? /* @__PURE__ */ t.jsx(re, { svg: d.value }, j) : null;
|
|
241
287
|
});
|
|
242
288
|
};
|
|
243
|
-
return
|
|
244
|
-
(e,
|
|
245
|
-
|
|
289
|
+
return ce ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: le.map(
|
|
290
|
+
(e, n) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
|
|
291
|
+
Ne,
|
|
246
292
|
{
|
|
247
293
|
hideFullScreen: !0,
|
|
248
294
|
type: "sandbox",
|
|
249
295
|
content: e.value,
|
|
250
296
|
className: "content-render-iframe",
|
|
251
|
-
loadingText:
|
|
252
|
-
styleLoadingText:
|
|
253
|
-
scriptLoadingText:
|
|
254
|
-
disableLoadingOverlay:
|
|
255
|
-
fullScreenButtonText:
|
|
256
|
-
mode:
|
|
297
|
+
loadingText: w,
|
|
298
|
+
styleLoadingText: k,
|
|
299
|
+
scriptLoadingText: $,
|
|
300
|
+
disableLoadingOverlay: z,
|
|
301
|
+
fullScreenButtonText: D,
|
|
302
|
+
mode: P
|
|
257
303
|
},
|
|
258
|
-
`sandbox-${
|
|
259
|
-
) : /* @__PURE__ */ t.jsx(
|
|
304
|
+
`sandbox-${n}`
|
|
305
|
+
) : /* @__PURE__ */ t.jsx(Z.Fragment, { children: de(e.value, `md-${n}`) }, `md-${n}`)
|
|
260
306
|
) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
|
|
261
|
-
|
|
307
|
+
me.map((e, n) => {
|
|
262
308
|
if (e.type === "text")
|
|
263
309
|
return /* @__PURE__ */ t.jsx(
|
|
264
|
-
|
|
310
|
+
ne,
|
|
265
311
|
{
|
|
266
|
-
components:
|
|
312
|
+
components: J,
|
|
267
313
|
content: e.value
|
|
268
314
|
},
|
|
269
|
-
|
|
315
|
+
n
|
|
270
316
|
);
|
|
271
317
|
if (e.type === "mermaid")
|
|
272
318
|
return /* @__PURE__ */ t.jsx(
|
|
273
|
-
|
|
319
|
+
q,
|
|
274
320
|
{
|
|
275
321
|
chart: e.value,
|
|
276
322
|
frozen: !e.complete
|
|
277
323
|
},
|
|
278
|
-
|
|
324
|
+
n
|
|
279
325
|
);
|
|
280
326
|
if (e.type === "svg")
|
|
281
|
-
return /* @__PURE__ */ t.jsx(
|
|
327
|
+
return /* @__PURE__ */ t.jsx(re, { svg: e.value }, n);
|
|
282
328
|
}),
|
|
283
|
-
|
|
329
|
+
a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: Z.createElement(a, {
|
|
284
330
|
content: r,
|
|
285
|
-
displayContent:
|
|
286
|
-
onSend:
|
|
331
|
+
displayContent: E,
|
|
332
|
+
onSend: i
|
|
287
333
|
}) })
|
|
288
334
|
] });
|
|
289
335
|
};
|
|
290
336
|
export {
|
|
291
|
-
|
|
292
|
-
|
|
337
|
+
ne as MarkdownRenderer,
|
|
338
|
+
dt as default
|
|
293
339
|
};
|
|
294
340
|
//# sourceMappingURL=ContentRender.es.js.map
|