markdown-flow-ui 0.3.11 → 0.3.13
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/README.md +50 -0
- package/dist/_virtual/index10.cjs +1 -1
- package/dist/_virtual/index10.es.js +3 -2
- package/dist/_virtual/index10.es.js.map +1 -1
- package/dist/_virtual/index11.cjs +1 -1
- package/dist/_virtual/index11.es.js +2 -3
- package/dist/_virtual/index11.es.js.map +1 -1
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index3.es.js +5 -4
- package/dist/_virtual/index3.es.js.map +1 -1
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index4.es.js +4 -5
- package/dist/_virtual/index4.es.js.map +1 -1
- package/dist/_virtual/index6.cjs +1 -1
- package/dist/_virtual/index6.es.js +2 -3
- package/dist/_virtual/index6.es.js.map +1 -1
- package/dist/_virtual/index7.cjs +1 -1
- package/dist/_virtual/index7.es.js +3 -5
- package/dist/_virtual/index7.es.js.map +1 -1
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index8.es.js +5 -2
- package/dist/_virtual/index8.es.js.map +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/_virtual/index9.es.js +2 -2
- package/dist/assets/markdown-flow-ui.css +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 +5 -0
- package/dist/components/ContentRender/ContentRender.es.js +405 -394
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/ImageInputGroup.cjs +2 -0
- package/dist/components/ContentRender/ImageInputGroup.cjs.map +1 -0
- package/dist/components/ContentRender/ImageInputGroup.d.ts +31 -0
- package/dist/components/ContentRender/ImageInputGroup.es.js +101 -0
- package/dist/components/ContentRender/ImageInputGroup.es.js.map +1 -0
- package/dist/components/ContentRender/MarkdownFlowInput.cjs +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.cjs.map +1 -1
- package/dist/components/ContentRender/MarkdownFlowInput.d.ts +5 -0
- package/dist/components/ContentRender/MarkdownFlowInput.es.js +54 -50
- package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
- package/dist/components/ContentRender/contentRenderI18n.cjs.map +1 -1
- package/dist/components/ContentRender/contentRenderI18n.d.ts +4 -0
- package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -1
- package/dist/components/ContentRender/locales/contentRender.json.cjs +1 -1
- package/dist/components/ContentRender/locales/contentRender.json.d.ts +55 -11
- package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -11
- package/dist/components/ContentRender/plugins/CustomVariable.cjs +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.cjs.map +1 -1
- package/dist/components/ContentRender/plugins/CustomVariable.d.ts +4 -1
- package/dist/components/ContentRender/plugins/CustomVariable.es.js +212 -173
- package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +7 -0
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +63 -53
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.d.ts +5 -0
- package/dist/components/Slide/Slide.es.js +638 -621
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/utils/interactionResolution.cjs +1 -1
- package/dist/components/Slide/utils/interactionResolution.cjs.map +1 -1
- package/dist/components/Slide/utils/interactionResolution.es.js +15 -15
- package/dist/components/Slide/utils/interactionResolution.es.js.map +1 -1
- package/dist/components/types.d.ts +2 -0
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/lib/interaction-defaults.cjs +1 -1
- package/dist/lib/interaction-defaults.cjs.map +1 -1
- package/dist/lib/interaction-defaults.d.ts +4 -0
- package/dist/lib/interaction-defaults.es.js +47 -41
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/markdown-flow-ui.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/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.cjs +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.cjs.map +1 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.es.js +19 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/image-plus.es.js.map +1 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-6MUBBAK2.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-6MUBBAK2.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-HFQBQIA3.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-HFQBQIA3.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-MALGAFMO.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-MALGAFMO.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-23REXITY.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-23REXITY.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-5NDRBG5M.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-5NDRBG5M.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-OMPLPG4O.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-OMPLPG4O.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/rc-util/es/ref.cjs +1 -1
- package/dist/node_modules/rc-util/es/ref.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/node_modules/style-to-object/cjs/index.cjs +1 -1
- package/dist/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/dist/renderer.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { d as
|
|
3
|
-
import X, { useMemo as h, useState as
|
|
4
|
-
import { sanitizeInvalidTagName as
|
|
5
|
-
import { stripSvgTextLineBreaks as
|
|
1
|
+
import { jsx as s, jsxs as qe, Fragment as gt } from "react/jsx-runtime";
|
|
2
|
+
import { d as Qe } from "../../_virtual/index.es.js";
|
|
3
|
+
import X, { useMemo as h, useState as Oe, useRef as T, useEffect as re } from "react";
|
|
4
|
+
import { sanitizeInvalidTagName as vt } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
5
|
+
import { stripSvgTextLineBreaks as xt } 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
|
|
10
|
+
import yt, { CodeBlockContext as wt } from "./CodeBlock.es.js";
|
|
11
|
+
import Ct from "./plugins/CustomVariable.es.js";
|
|
12
12
|
import ke from "./plugins/MermaidChart.es.js";
|
|
13
|
-
import { preserveCustomVariableProperties as
|
|
14
|
-
import { subsetLanguages as
|
|
15
|
-
import { parseMarkdownSegments as
|
|
16
|
-
import { getMarkdownSourceAnalysis as
|
|
17
|
-
import { remarkPlugins as
|
|
13
|
+
import { preserveCustomVariableProperties as kt, restoreCustomVariableProperties as Tt } from "./utils/custom-variable-props.es.js";
|
|
14
|
+
import { subsetLanguages as bt, highlightLanguages as St } from "./utils/highlight-languages.es.js";
|
|
15
|
+
import { parseMarkdownSegments as Ue, mermaidBlockIsComplete as Rt } from "./utils/mermaid-parse.es.js";
|
|
16
|
+
import { getMarkdownSourceAnalysis as Bt, getInlineCodeRanges as Nt } from "./utils/inline-code-ranges.es.js";
|
|
17
|
+
import { remarkPlugins as Je } from "./utils/markdown-plugins.es.js";
|
|
18
18
|
import { normalizeInlineHtml as we } from "./utils/normalize-inline-html.es.js";
|
|
19
19
|
import { escapeTypedMarkdownMetadata as Te } from "./utils/escape-typed-metadata.es.js";
|
|
20
|
-
import
|
|
21
|
-
import { getTrailingTypewriterGrapheme as Ce, appendContentAwareTypewriterQueue as
|
|
22
|
-
import { normalizeWrappedSandboxContent as
|
|
23
|
-
import { getInteractionDefaultValues as
|
|
24
|
-
import { getMarkdownFlowDirection as
|
|
20
|
+
import Lt from "./IframeSandbox.es.js";
|
|
21
|
+
import { getTrailingTypewriterGrapheme as Ce, appendContentAwareTypewriterQueue as Ke, consumeContentAwareTypewriterQueue as Mt, CONTENT_AWARE_TYPEWRITER_TICK_BUDGET as At, isContentAwareTypewriterQueueEmpty as It } from "./utils/typewriter-pacing.es.js";
|
|
22
|
+
import { normalizeWrappedSandboxContent as Vt, splitContentSegments as $t } from "./utils/split-content.es.js";
|
|
23
|
+
import { getInteractionDefaultValues as Et } from "../../lib/interaction-defaults.es.js";
|
|
24
|
+
import { getMarkdownFlowDirection as Pt, getMarkdownFlowLanguage as Dt } from "../../lib/locale.es.js";
|
|
25
25
|
import { getContentRenderLocaleTexts as Se } from "./contentRenderI18n.es.js";
|
|
26
|
-
import { createVideoMarkdownRunPlan as
|
|
27
|
-
import { unified as
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import { Markdown as
|
|
33
|
-
const
|
|
26
|
+
import { createVideoMarkdownRunPlan as Wt, cloneVideoMarkdownSourceTree as zt, prepareVideoMarkdownRun as Ft, projectVideoMarkdownRun as Gt, getVideoMarkdownNodeState as _t } from "./utils/video-markdown-run.es.js";
|
|
27
|
+
import { unified as Ye } from "../../node_modules/unified/lib/index.es.js";
|
|
28
|
+
import jt from "../../node_modules/remark-rehype/lib/index.es.js";
|
|
29
|
+
import Ht from "../../node_modules/rehype-raw/lib/index.es.js";
|
|
30
|
+
import qt from "../../node_modules/rehype-highlight/lib/index.es.js";
|
|
31
|
+
import Qt from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
32
|
+
import { Markdown as et } from "../../node_modules/react-markdown/lib/index.es.js";
|
|
33
|
+
const Ot = 2, be = ({
|
|
34
34
|
svg: t,
|
|
35
35
|
inline: r = !1
|
|
36
36
|
}) => {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
const u =
|
|
37
|
+
const i = T(null), o = r ? "span" : "div";
|
|
38
|
+
return re(() => {
|
|
39
|
+
const u = i.current;
|
|
40
40
|
if (!u) return;
|
|
41
41
|
const m = u.shadowRoot ?? u.attachShadow({ mode: "open" }), y = "content-render-svg-style";
|
|
42
|
-
let
|
|
43
|
-
|
|
42
|
+
let v = m.getElementById(y);
|
|
43
|
+
v || (v = document.createElement("style"), v.id = y, v.textContent = `
|
|
44
44
|
svg { height: auto; display: inline-block; }
|
|
45
45
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
46
46
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
47
|
-
`, m.appendChild(
|
|
48
|
-
(
|
|
49
|
-
).forEach((
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
m.querySelectorAll("svg").forEach((
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
const W =
|
|
47
|
+
`, m.appendChild(v)), Array.from(m.childNodes).filter(
|
|
48
|
+
(c) => c !== v
|
|
49
|
+
).forEach((c) => m.removeChild(c));
|
|
50
|
+
const O = document.createElement("template"), f = xt(t);
|
|
51
|
+
O.innerHTML = f, m.append(O.content.cloneNode(!0));
|
|
52
|
+
let b = !1, A = !1;
|
|
53
|
+
m.querySelectorAll("svg").forEach((c) => {
|
|
54
|
+
const I = c.getAttribute("viewBox");
|
|
55
|
+
if (!I) return;
|
|
56
|
+
const W = I.trim().split(/[\s,]+/).map((D) => Number(D));
|
|
57
57
|
if (W.length !== 4 || W.some(Number.isNaN)) return;
|
|
58
|
-
const [, ,
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
return
|
|
62
|
-
},
|
|
63
|
-
if (!
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
58
|
+
const [, , P, w] = W, z = c.getAttribute("width"), V = c.getAttribute("height"), U = (D) => {
|
|
59
|
+
if (!D) return !1;
|
|
60
|
+
const F = D.trim().toLowerCase();
|
|
61
|
+
return F === "auto" || F.endsWith("%");
|
|
62
|
+
}, oe = (D) => {
|
|
63
|
+
if (!D) return null;
|
|
64
|
+
const F = D.trim().toLowerCase();
|
|
65
|
+
if (F === "auto" || F.endsWith("%"))
|
|
66
66
|
return null;
|
|
67
|
-
const
|
|
68
|
-
return Number.isNaN(
|
|
69
|
-
},
|
|
70
|
-
if (
|
|
71
|
-
|
|
67
|
+
const B = Number.parseFloat(F);
|
|
68
|
+
return Number.isNaN(B) ? null : B;
|
|
69
|
+
}, de = U(z), me = U(V), se = !z || z === "0", ae = !V || V === "0", pe = oe(z), fe = oe(V);
|
|
70
|
+
if (de || me || se && ae || pe === P && fe === w) {
|
|
71
|
+
b = !0, c.classList.add("content-render-svg-el--responsive"), c.classList.remove("content-render-svg-el--fixed"), c.style.width = "100%", c.style.height = "auto", !c.style.aspectRatio && w > 0 && (c.style.aspectRatio = `${P} / ${w}`);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
A = !0,
|
|
74
|
+
A = !0, c.classList.add("content-render-svg-el--fixed"), c.classList.remove("content-render-svg-el--responsive"), se && P > 0 && c.setAttribute("width", `${P}`), ae && w > 0 && c.setAttribute("height", `${w}`);
|
|
75
75
|
});
|
|
76
|
-
const l =
|
|
76
|
+
const l = b && !A;
|
|
77
77
|
u.classList.toggle("content-render-svg--responsive", l), u.classList.toggle("content-render-svg--fixed", !l);
|
|
78
78
|
}, [t]), /* @__PURE__ */ s(o, { className: "content-render-svg-scroll", children: /* @__PURE__ */ s(
|
|
79
79
|
o,
|
|
80
80
|
{
|
|
81
81
|
className: "content-render-svg",
|
|
82
82
|
ref: (u) => {
|
|
83
|
-
|
|
83
|
+
i.current = u;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
) });
|
|
87
|
-
},
|
|
87
|
+
}, le = X.createContext(
|
|
88
88
|
null
|
|
89
|
-
),
|
|
90
|
-
const { receivedTree: r, ...
|
|
89
|
+
), tt = (t) => {
|
|
90
|
+
const { receivedTree: r, ...i } = t, o = X.useContext(le), u = X.useContext(wt);
|
|
91
91
|
if (!o)
|
|
92
92
|
throw new Error("Markdown code renderer requires ContentRender context.");
|
|
93
|
-
const { className: m, children: y, ...
|
|
93
|
+
const { className: m, children: y, ...v } = i;
|
|
94
94
|
if (/language-(\w+)/.exec(m || "")?.[1] === "mermaid") {
|
|
95
|
-
const f = y?.toString().replace(/\n$/, "") || "",
|
|
95
|
+
const f = y?.toString().replace(/\n$/, "") || "", b = Rt(
|
|
96
96
|
o.current.renderContent,
|
|
97
97
|
f
|
|
98
98
|
);
|
|
@@ -100,7 +100,7 @@ const _t = 2, be = ({
|
|
|
100
100
|
ke,
|
|
101
101
|
{
|
|
102
102
|
chart: f,
|
|
103
|
-
frozen: r ? !
|
|
103
|
+
frozen: r ? !b : b,
|
|
104
104
|
messages: o.current.mermaidMessages
|
|
105
105
|
}
|
|
106
106
|
);
|
|
@@ -109,29 +109,29 @@ const _t = 2, be = ({
|
|
|
109
109
|
"code",
|
|
110
110
|
{
|
|
111
111
|
className: m,
|
|
112
|
-
...
|
|
113
|
-
dir:
|
|
112
|
+
...v,
|
|
113
|
+
dir: v.dir ?? (u ? void 0 : "ltr"),
|
|
114
114
|
children: y
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
|
-
},
|
|
117
|
+
}, nt = [
|
|
118
|
+
kt,
|
|
119
|
+
Ht,
|
|
118
120
|
vt,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
], Qe = ({ content: t, components: r, locale: c }) => {
|
|
129
|
-
const o = Se(c);
|
|
121
|
+
Tt
|
|
122
|
+
], rt = [
|
|
123
|
+
[qt, { languages: St, subset: bt }],
|
|
124
|
+
Qt
|
|
125
|
+
], Ut = [
|
|
126
|
+
...nt,
|
|
127
|
+
...rt
|
|
128
|
+
], Xe = ({ content: t, components: r, locale: i }) => {
|
|
129
|
+
const o = Se(i);
|
|
130
130
|
return /* @__PURE__ */ s("div", { className: "markdown-renderer", children: /* @__PURE__ */ s(
|
|
131
|
-
|
|
131
|
+
et,
|
|
132
132
|
{
|
|
133
|
-
remarkPlugins:
|
|
134
|
-
rehypePlugins:
|
|
133
|
+
remarkPlugins: Je,
|
|
134
|
+
rehypePlugins: Ut,
|
|
135
135
|
remarkRehypeOptions: {
|
|
136
136
|
footnoteLabel: o.footnoteLabel,
|
|
137
137
|
footnoteBackLabel: (u, m) => {
|
|
@@ -143,103 +143,103 @@ const _t = 2, be = ({
|
|
|
143
143
|
children: t
|
|
144
144
|
}
|
|
145
145
|
) });
|
|
146
|
-
},
|
|
146
|
+
}, Kt = function() {
|
|
147
147
|
this.parser = () => ({ type: "root", children: [] });
|
|
148
|
-
},
|
|
148
|
+
}, Yt = ({ plan: t, renderedSegments: r, components: i, locale: o }) => {
|
|
149
149
|
const u = h(() => {
|
|
150
|
-
const f = Se(o),
|
|
150
|
+
const f = Se(o), b = Ye().use(Je).use(jt, {
|
|
151
151
|
allowDangerousHtml: !0,
|
|
152
152
|
footnoteLabel: f.footnoteLabel,
|
|
153
|
-
footnoteBackLabel: (
|
|
153
|
+
footnoteBackLabel: (c, I) => f.footnoteBackLabel.replace(
|
|
154
154
|
"{reference}",
|
|
155
|
-
String(
|
|
155
|
+
String(c + 1) + (I > 1 ? `-${I}` : "")
|
|
156
156
|
)
|
|
157
|
-
}).use(
|
|
158
|
-
|
|
157
|
+
}).use(nt), A = Ye().use(rt), l = b.runSync(
|
|
158
|
+
zt(t),
|
|
159
159
|
t.markdownSource
|
|
160
160
|
);
|
|
161
|
-
return
|
|
161
|
+
return Ft(
|
|
162
162
|
t,
|
|
163
163
|
l,
|
|
164
|
-
(
|
|
164
|
+
(c) => A.runSync(c, t.fullSource)
|
|
165
165
|
);
|
|
166
166
|
}, [t, o]), m = h(
|
|
167
|
-
() =>
|
|
167
|
+
() => Gt(u, r),
|
|
168
168
|
[u, r]
|
|
169
|
-
), y =
|
|
170
|
-
y.current =
|
|
171
|
-
const
|
|
169
|
+
), y = T(i);
|
|
170
|
+
y.current = i;
|
|
171
|
+
const v = T(
|
|
172
172
|
/* @__PURE__ */ new Map()
|
|
173
173
|
), J = h(() => {
|
|
174
|
-
const f = /* @__PURE__ */ new Set(),
|
|
175
|
-
l.type === "element" && f.add(l.tagName), "children" in l && l.children.forEach(
|
|
174
|
+
const f = /* @__PURE__ */ new Set(), b = (l) => {
|
|
175
|
+
l.type === "element" && f.add(l.tagName), "children" in l && l.children.forEach(b);
|
|
176
176
|
};
|
|
177
|
-
|
|
177
|
+
b(u.tree);
|
|
178
178
|
const A = {};
|
|
179
179
|
for (const l of f) {
|
|
180
|
-
if (!
|
|
181
|
-
const
|
|
182
|
-
node:
|
|
180
|
+
if (!v.current.has(l)) {
|
|
181
|
+
const c = ({
|
|
182
|
+
node: I,
|
|
183
183
|
children: W,
|
|
184
|
-
...
|
|
184
|
+
...P
|
|
185
185
|
}) => {
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
if (
|
|
192
|
-
const
|
|
193
|
-
return
|
|
194
|
-
|
|
186
|
+
const w = _t(I);
|
|
187
|
+
if (w?.svg)
|
|
188
|
+
return w.svgSource ? /* @__PURE__ */ s(be, { svg: w.svgSource, inline: !0 }) : null;
|
|
189
|
+
if (w?.atomic)
|
|
190
|
+
return w.active ? /* @__PURE__ */ s(gt, { children: W }) : null;
|
|
191
|
+
if (w?.active === !1 && l !== "a") return null;
|
|
192
|
+
const V = y.current[l], U = w?.active === !1 ? { ...P, href: void 0, tabIndex: -1 } : P;
|
|
193
|
+
return V ? X.createElement(
|
|
194
|
+
V,
|
|
195
195
|
{
|
|
196
196
|
...U,
|
|
197
|
-
node:
|
|
198
|
-
...
|
|
197
|
+
node: I,
|
|
198
|
+
...V === tt ? { receivedTree: !0 } : {}
|
|
199
199
|
},
|
|
200
200
|
W
|
|
201
201
|
) : X.createElement(l, U, W);
|
|
202
202
|
};
|
|
203
|
-
|
|
203
|
+
c.displayName = `StableMarkdown(${l})`, v.current.set(l, c);
|
|
204
204
|
}
|
|
205
|
-
A[l] =
|
|
205
|
+
A[l] = v.current.get(l);
|
|
206
206
|
}
|
|
207
207
|
return A;
|
|
208
|
-
}, [u]),
|
|
208
|
+
}, [u]), O = h(
|
|
209
209
|
() => [() => () => m],
|
|
210
210
|
[m]
|
|
211
211
|
);
|
|
212
212
|
return /* @__PURE__ */ s("div", { className: "markdown-renderer", children: /* @__PURE__ */ s(
|
|
213
|
-
|
|
213
|
+
et,
|
|
214
214
|
{
|
|
215
|
-
remarkPlugins: [
|
|
216
|
-
rehypePlugins:
|
|
215
|
+
remarkPlugins: [Kt],
|
|
216
|
+
rehypePlugins: O,
|
|
217
217
|
components: J,
|
|
218
218
|
children: ""
|
|
219
219
|
}
|
|
220
220
|
) });
|
|
221
|
-
},
|
|
221
|
+
}, H = (t) => t.type === "markdown" && t.immediate === !0, Xt = (t) => {
|
|
222
222
|
if (t.length <= 1) return t;
|
|
223
223
|
const r = [];
|
|
224
|
-
return t.forEach((
|
|
225
|
-
if (
|
|
226
|
-
r.push(
|
|
224
|
+
return t.forEach((i) => {
|
|
225
|
+
if (i.type === "sandbox" || H(i)) {
|
|
226
|
+
r.push(i);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
const o = r[r.length - 1];
|
|
230
|
-
if (o && o.type !== "sandbox" && !
|
|
230
|
+
if (o && o.type !== "sandbox" && !H(o)) {
|
|
231
231
|
r[r.length - 1] = {
|
|
232
232
|
type: "markdown",
|
|
233
|
-
value: `${o.value}${
|
|
233
|
+
value: `${o.value}${i.value}`
|
|
234
234
|
};
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
r.push({ type: "markdown", value:
|
|
237
|
+
r.push({ type: "markdown", value: i.value });
|
|
238
238
|
}), r;
|
|
239
|
-
},
|
|
239
|
+
}, Zt = (t, r, i) => {
|
|
240
240
|
if (t.length >= r.length) return t;
|
|
241
|
-
const o =
|
|
242
|
-
({ start: y, end:
|
|
241
|
+
const o = i.find(
|
|
242
|
+
({ start: y, end: v }) => y < t.length && t.length < v
|
|
243
243
|
);
|
|
244
244
|
if (!o) return t;
|
|
245
245
|
const u = /^`+/.exec(r.slice(o.start))?.[0];
|
|
@@ -247,115 +247,117 @@ const _t = 2, be = ({
|
|
|
247
247
|
return t;
|
|
248
248
|
const m = o.end - u.length;
|
|
249
249
|
return t.length > m ? t + u.slice(t.length - m) : t + (t.endsWith("`") ? " " : "") + u;
|
|
250
|
-
},
|
|
251
|
-
const m =
|
|
250
|
+
}, Ze = (t, r, i, o, u = 0) => {
|
|
251
|
+
const m = Zt(t, r, i);
|
|
252
252
|
return Te(t, o, u) + m.slice(t.length);
|
|
253
|
-
},
|
|
254
|
-
const
|
|
253
|
+
}, Jt = (t, r) => {
|
|
254
|
+
const i = Math.max(1, r), o = Array.from(t);
|
|
255
255
|
return {
|
|
256
|
-
chunk: o.slice(0,
|
|
257
|
-
rest: o.slice(
|
|
256
|
+
chunk: o.slice(0, i).join(""),
|
|
257
|
+
rest: o.slice(i).join("")
|
|
258
258
|
};
|
|
259
|
-
},
|
|
260
|
-
const r =
|
|
261
|
-
return
|
|
262
|
-
},
|
|
259
|
+
}, en = (t, r) => t === r ? !0 : !t || !r || t.length !== r.length ? !1 : t.every((i, o) => i === r[o]), tn = (t) => {
|
|
260
|
+
const r = T(t);
|
|
261
|
+
return en(r.current, t) || (r.current = t), r.current;
|
|
262
|
+
}, Dn = ({
|
|
263
263
|
onPlaceholderAccepted: t,
|
|
264
264
|
content: r,
|
|
265
|
-
contentType:
|
|
265
|
+
contentType: i,
|
|
266
266
|
locale: o,
|
|
267
267
|
lang: u,
|
|
268
268
|
dir: m,
|
|
269
269
|
customRenderBar: y,
|
|
270
|
-
onSend:
|
|
270
|
+
onSend: v,
|
|
271
271
|
typingSpeed: J = 30,
|
|
272
|
-
enableTypewriter:
|
|
272
|
+
enableTypewriter: O = !1,
|
|
273
273
|
typewriterPacing: f = "fixed",
|
|
274
|
-
onTypeFinished:
|
|
274
|
+
onTypeFinished: b,
|
|
275
275
|
onTypewriterStateChange: A,
|
|
276
276
|
userInput: l,
|
|
277
|
-
interactionDefaultValueOptions:
|
|
278
|
-
defaultButtonText:
|
|
277
|
+
interactionDefaultValueOptions: c,
|
|
278
|
+
defaultButtonText: I,
|
|
279
279
|
defaultInputText: W,
|
|
280
|
-
defaultSelectedValues:
|
|
281
|
-
readonly:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
280
|
+
defaultSelectedValues: P,
|
|
281
|
+
readonly: w = !1,
|
|
282
|
+
showImageInput: z = !1,
|
|
283
|
+
imageInput: V,
|
|
284
|
+
confirmButtonText: U,
|
|
285
|
+
copyButtonText: oe,
|
|
286
|
+
copiedButtonText: de,
|
|
287
|
+
sandboxLoadingText: me,
|
|
288
|
+
sandboxStyleLoadingText: se,
|
|
289
|
+
sandboxScriptLoadingText: ae,
|
|
290
|
+
disableSandboxLoadingOverlay: pe = !1,
|
|
291
|
+
sandboxFullscreenButtonText: fe,
|
|
292
|
+
sandboxExitFullscreenButtonText: Re,
|
|
293
|
+
sandboxMode: Be = "content",
|
|
294
|
+
onClickCustomButtonAfterContent: D,
|
|
295
|
+
beforeSend: F
|
|
294
296
|
}) => {
|
|
295
|
-
const
|
|
297
|
+
const B = Se(o), ce = h(
|
|
296
298
|
() => ({
|
|
297
|
-
loading:
|
|
298
|
-
emptyChart:
|
|
299
|
-
error:
|
|
299
|
+
loading: B.mermaidLoadingText,
|
|
300
|
+
emptyChart: B.mermaidEmptyChartText,
|
|
301
|
+
error: B.mermaidErrorText
|
|
300
302
|
}),
|
|
301
|
-
[
|
|
302
|
-
),
|
|
303
|
-
() =>
|
|
303
|
+
[B]
|
|
304
|
+
), ee = m ?? Pt(o), te = u ?? Dt(o), Ne = U || B.confirmButtonText, Le = oe || B.copyButtonText, Me = de || B.copiedButtonText, ot = fe || B.sandboxFullscreenButtonText, st = Re || B.sandboxExitFullscreenButtonText, p = !!O && (!i || i === "text"), S = h(
|
|
305
|
+
() => Vt(r),
|
|
304
306
|
[r]
|
|
305
307
|
), N = h(
|
|
306
|
-
() =>
|
|
307
|
-
[
|
|
308
|
-
),
|
|
309
|
-
const e =
|
|
310
|
-
|
|
308
|
+
() => Bt(S),
|
|
309
|
+
[S]
|
|
310
|
+
), C = h(() => {
|
|
311
|
+
const e = Xt(
|
|
312
|
+
$t(S, !0, !0, N)
|
|
311
313
|
);
|
|
312
|
-
return
|
|
313
|
-
}, [r,
|
|
314
|
-
(e) => e.type === "sandbox" ||
|
|
315
|
-
),
|
|
316
|
-
(e) => e.type !== "sandbox" && !
|
|
317
|
-
).map((e) => e.value).join("") :
|
|
318
|
-
() => p ? "" :
|
|
319
|
-
),
|
|
314
|
+
return S !== r && e.length && (e[0].type === "sandbox" || H(e[0])) ? [{ type: "text", value: "" }, ...e] : e;
|
|
315
|
+
}, [r, S, N]), K = C.some(
|
|
316
|
+
(e) => e.type === "sandbox" || H(e)
|
|
317
|
+
), x = K ? C.filter(
|
|
318
|
+
(e) => e.type !== "sandbox" && !H(e)
|
|
319
|
+
).map((e) => e.value).join("") : S, Ae = Math.max(0, J), at = f === "fixed" ? x : void 0, [$, Ie] = Oe(
|
|
320
|
+
() => p ? "" : x
|
|
321
|
+
), ie = T($), L = T(""), E = T({
|
|
320
322
|
tokens: [],
|
|
321
323
|
head: 0,
|
|
322
324
|
trailingGrapheme: ""
|
|
323
|
-
}),
|
|
324
|
-
|
|
325
|
-
const e =
|
|
326
|
-
|
|
325
|
+
}), q = T(0), Ve = T(p), $e = T(f), Ee = T(x), he = T(r), ge = T(!1), [ct, it] = Oe(0);
|
|
326
|
+
re(() => {
|
|
327
|
+
const e = Ve.current, n = $e.current, a = Ee.current, d = !!L.current, k = he.current !== r, ye = k && r.startsWith(he.current);
|
|
328
|
+
he.current = r, Ve.current = p, $e.current = f, Ee.current = x, (k || p !== e) && (ge.current = !1);
|
|
327
329
|
const Y = () => {
|
|
328
|
-
L.current = "",
|
|
330
|
+
L.current = "", E.current = {
|
|
329
331
|
tokens: [],
|
|
330
332
|
head: 0,
|
|
331
333
|
trailingGrapheme: ""
|
|
332
|
-
},
|
|
333
|
-
}, Z = (
|
|
334
|
-
|
|
334
|
+
}, q.current = 0;
|
|
335
|
+
}, Z = (R) => {
|
|
336
|
+
ie.current = R, Ie(R);
|
|
335
337
|
};
|
|
336
338
|
if (!p) {
|
|
337
|
-
Y(), Z(
|
|
339
|
+
Y(), Z(x);
|
|
338
340
|
return;
|
|
339
341
|
}
|
|
340
342
|
e || (Y(), Z(""));
|
|
341
|
-
let M = e ?
|
|
342
|
-
if (!
|
|
343
|
+
let M = e ? ie.current : "";
|
|
344
|
+
if (!x.startsWith(M)) {
|
|
343
345
|
if (Y(), !ye) {
|
|
344
|
-
Z(
|
|
346
|
+
Z(x), f === "content-aware" && (E.current = {
|
|
345
347
|
tokens: [],
|
|
346
348
|
head: 0,
|
|
347
|
-
trailingGrapheme: Ce(
|
|
349
|
+
trailingGrapheme: Ce(x)
|
|
348
350
|
});
|
|
349
351
|
return;
|
|
350
352
|
}
|
|
351
|
-
let
|
|
352
|
-
for (;
|
|
353
|
-
|
|
354
|
-
M = M.slice(0,
|
|
353
|
+
let R = 0;
|
|
354
|
+
for (; R < M.length && R < x.length && M[R] === x[R]; )
|
|
355
|
+
R += 1;
|
|
356
|
+
M = M.slice(0, R), Z(M);
|
|
355
357
|
}
|
|
356
|
-
let
|
|
357
|
-
if (!
|
|
358
|
-
L.current = "",
|
|
358
|
+
let Q = x.slice(M.length);
|
|
359
|
+
if (!Q) {
|
|
360
|
+
L.current = "", q.current = 0, E.current = f === "content-aware" ? {
|
|
359
361
|
tokens: [],
|
|
360
362
|
head: 0,
|
|
361
363
|
trailingGrapheme: Ce(M)
|
|
@@ -363,46 +365,46 @@ const _t = 2, be = ({
|
|
|
363
365
|
return;
|
|
364
366
|
}
|
|
365
367
|
if (f === "content-aware") {
|
|
366
|
-
const
|
|
368
|
+
const R = a.slice(
|
|
367
369
|
M.length
|
|
368
370
|
);
|
|
369
|
-
if (e && n === "content-aware" &&
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
if (e && n === "content-aware" && x.startsWith(a) && L.current === R) {
|
|
372
|
+
const j = Ke(
|
|
373
|
+
E.current,
|
|
374
|
+
x.slice(a.length)
|
|
373
375
|
);
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
), Z(`${M}${
|
|
376
|
+
E.current = j.queue, j.immediateChunk && (Q = Q.slice(
|
|
377
|
+
j.immediateChunk.length
|
|
378
|
+
), Z(`${M}${j.immediateChunk}`));
|
|
377
379
|
} else {
|
|
378
|
-
const
|
|
380
|
+
const j = Ke(
|
|
379
381
|
{
|
|
380
382
|
tokens: [],
|
|
381
383
|
head: 0,
|
|
382
384
|
trailingGrapheme: Ce(M)
|
|
383
385
|
},
|
|
384
|
-
|
|
386
|
+
Q
|
|
385
387
|
);
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
), Z(`${M}${
|
|
388
|
+
E.current = j.queue, j.immediateChunk && (Q = Q.slice(
|
|
389
|
+
j.immediateChunk.length
|
|
390
|
+
), Z(`${M}${j.immediateChunk}`)), q.current = 0;
|
|
389
391
|
}
|
|
390
392
|
} else
|
|
391
|
-
|
|
393
|
+
E.current = {
|
|
392
394
|
tokens: [],
|
|
393
395
|
head: 0,
|
|
394
396
|
trailingGrapheme: ""
|
|
395
|
-
},
|
|
396
|
-
L.current =
|
|
397
|
-
}, [r,
|
|
398
|
-
p && (
|
|
397
|
+
}, q.current = 0;
|
|
398
|
+
L.current = Q, !d && Q && it((R) => R + 1);
|
|
399
|
+
}, [r, x, p, f]), re(() => {
|
|
400
|
+
p && (ge.current || L.current || $ !== x || (ge.current = !0, b?.()));
|
|
399
401
|
}, [
|
|
400
402
|
r,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
+
x,
|
|
404
|
+
$,
|
|
403
405
|
p,
|
|
404
|
-
|
|
405
|
-
]),
|
|
406
|
+
b
|
|
407
|
+
]), re(() => {
|
|
406
408
|
if (!p || !L.current)
|
|
407
409
|
return;
|
|
408
410
|
const e = window.setTimeout(() => {
|
|
@@ -410,189 +412,196 @@ const _t = 2, be = ({
|
|
|
410
412
|
return;
|
|
411
413
|
let n = "";
|
|
412
414
|
if (f === "content-aware") {
|
|
413
|
-
const d =
|
|
414
|
-
|
|
415
|
-
|
|
415
|
+
const d = Mt(
|
|
416
|
+
E.current,
|
|
417
|
+
q.current + At
|
|
416
418
|
);
|
|
417
|
-
n = d.chunk,
|
|
419
|
+
n = d.chunk, E.current = d.queue, It(d.queue) ? q.current = 0 : q.current = d.remainingBudget;
|
|
418
420
|
} else
|
|
419
|
-
n =
|
|
421
|
+
n = Jt(
|
|
420
422
|
L.current,
|
|
421
|
-
|
|
423
|
+
Ot
|
|
422
424
|
).chunk;
|
|
423
425
|
if (!n)
|
|
424
426
|
return;
|
|
425
|
-
L.current = L.current.slice(n.length), L.current || (
|
|
427
|
+
L.current = L.current.slice(n.length), L.current || (E.current = f === "content-aware" ? {
|
|
426
428
|
tokens: [],
|
|
427
429
|
head: 0,
|
|
428
|
-
trailingGrapheme:
|
|
429
|
-
} : { tokens: [], head: 0, trailingGrapheme: "" },
|
|
430
|
-
const a = `${
|
|
431
|
-
|
|
432
|
-
},
|
|
430
|
+
trailingGrapheme: E.current.trailingGrapheme
|
|
431
|
+
} : { tokens: [], head: 0, trailingGrapheme: "" }, q.current = 0);
|
|
432
|
+
const a = `${ie.current}${n}`;
|
|
433
|
+
ie.current = a, Ie(a);
|
|
434
|
+
}, Ae);
|
|
433
435
|
return () => window.clearTimeout(e);
|
|
434
436
|
}, [
|
|
435
|
-
|
|
436
|
-
|
|
437
|
+
$,
|
|
438
|
+
at,
|
|
437
439
|
p,
|
|
438
440
|
f,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
+
Ae,
|
|
442
|
+
ct
|
|
441
443
|
]);
|
|
442
|
-
const
|
|
444
|
+
const G = h(() => {
|
|
443
445
|
let e = 0;
|
|
444
|
-
return
|
|
446
|
+
return C.map((n) => {
|
|
445
447
|
if (!p) return n;
|
|
446
|
-
if (n.type === "sandbox" ||
|
|
447
|
-
return
|
|
448
|
-
const a =
|
|
448
|
+
if (n.type === "sandbox" || H(n))
|
|
449
|
+
return $.length >= e ? n : { ...n, value: "" };
|
|
450
|
+
const a = $.slice(
|
|
449
451
|
e,
|
|
450
452
|
e + n.value.length
|
|
451
453
|
);
|
|
452
454
|
return e += n.value.length, { ...n, value: a };
|
|
453
455
|
});
|
|
454
|
-
}, [
|
|
456
|
+
}, [C, $, p]), Pe = h(
|
|
455
457
|
() => ({
|
|
456
458
|
isTypewriterEnabled: p,
|
|
457
|
-
isTyping: p &&
|
|
458
|
-
isComplete:
|
|
459
|
-
renderedLength: r.length -
|
|
460
|
-
(e, n, a) => e + n.value.length -
|
|
459
|
+
isTyping: p && $ !== x,
|
|
460
|
+
isComplete: $ === x,
|
|
461
|
+
renderedLength: r.length - C.reduce(
|
|
462
|
+
(e, n, a) => e + n.value.length - G[a].value.length,
|
|
461
463
|
0
|
|
462
464
|
),
|
|
463
465
|
totalLength: r.length
|
|
464
466
|
}),
|
|
465
467
|
[
|
|
466
468
|
r,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
+
x,
|
|
470
|
+
$,
|
|
469
471
|
p,
|
|
470
|
-
|
|
471
|
-
|
|
472
|
+
C,
|
|
473
|
+
G
|
|
472
474
|
]
|
|
473
475
|
);
|
|
474
|
-
|
|
475
|
-
A?.(
|
|
476
|
-
}, [A,
|
|
477
|
-
const
|
|
476
|
+
re(() => {
|
|
477
|
+
A?.(Pe);
|
|
478
|
+
}, [A, Pe]);
|
|
479
|
+
const ve = h(() => {
|
|
478
480
|
let e = 0;
|
|
479
|
-
return
|
|
481
|
+
return C.map((n) => {
|
|
480
482
|
const a = e;
|
|
481
483
|
return e += n.value.length, a;
|
|
482
484
|
});
|
|
483
|
-
}, [
|
|
484
|
-
() => p ?
|
|
485
|
-
(e) => e.type === "sandbox" ||
|
|
485
|
+
}, [C]), ue = h(
|
|
486
|
+
() => p ? C.map(
|
|
487
|
+
(e) => e.type === "sandbox" || H(e) ? [] : e.value === S ? N.inline : Nt(e.value)
|
|
486
488
|
) : [],
|
|
487
|
-
[p,
|
|
488
|
-
),
|
|
489
|
-
() => K ?
|
|
490
|
-
(e, n) => e.type === "sandbox" ||
|
|
489
|
+
[p, C, S, N]
|
|
490
|
+
), ut = h(
|
|
491
|
+
() => K ? G.map(
|
|
492
|
+
(e, n) => e.type === "sandbox" || H(e) ? e.value : p ? Ze(
|
|
491
493
|
e.value,
|
|
492
|
-
|
|
493
|
-
|
|
494
|
+
C[n].value,
|
|
495
|
+
ue[n] ?? [],
|
|
494
496
|
N.metadata,
|
|
495
|
-
|
|
497
|
+
ve[n]
|
|
496
498
|
) : Te(
|
|
497
499
|
e.value,
|
|
498
500
|
N.metadata,
|
|
499
|
-
|
|
501
|
+
ve[n]
|
|
500
502
|
)
|
|
501
503
|
) : [],
|
|
502
504
|
[
|
|
503
505
|
K,
|
|
504
506
|
p,
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
G,
|
|
508
|
+
ue,
|
|
509
|
+
C,
|
|
508
510
|
N.metadata,
|
|
509
|
-
|
|
511
|
+
ve
|
|
510
512
|
]
|
|
511
|
-
),
|
|
513
|
+
), lt = h(() => {
|
|
512
514
|
const e = [];
|
|
513
|
-
|
|
515
|
+
C.forEach((n, a) => {
|
|
514
516
|
const d = e.at(-1);
|
|
515
517
|
n.type !== "sandbox" && d && !d.sandbox ? d.indices.push(a) : e.push({ indices: [a], sandbox: n.type === "sandbox" });
|
|
516
518
|
});
|
|
517
519
|
for (const n of e)
|
|
518
|
-
if (!n.sandbox && n.indices.some((a) =>
|
|
519
|
-
const a = n.indices.map((
|
|
520
|
-
n.plan =
|
|
520
|
+
if (!n.sandbox && n.indices.some((a) => H(C[a]))) {
|
|
521
|
+
const a = n.indices.map((k) => C[k]), d = a.map((k) => k.value).join("");
|
|
522
|
+
n.plan = Wt(
|
|
521
523
|
a,
|
|
522
|
-
d ===
|
|
524
|
+
d === S ? N : void 0
|
|
523
525
|
);
|
|
524
526
|
}
|
|
525
527
|
return e;
|
|
526
|
-
}, [
|
|
527
|
-
() => y ? we(
|
|
528
|
-
[y,
|
|
529
|
-
),
|
|
528
|
+
}, [C, S, N]), _ = K ? G.map((e) => e.value).join("") : p ? $ : S, dt = h(
|
|
529
|
+
() => y ? we(_) : "",
|
|
530
|
+
[y, _]
|
|
531
|
+
), De = h(
|
|
530
532
|
() => K ? "" : we(
|
|
531
|
-
p ?
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
p ? Ze(
|
|
534
|
+
_,
|
|
535
|
+
S,
|
|
536
|
+
ue[0] ?? [],
|
|
535
537
|
N.metadata
|
|
536
538
|
) : Te(
|
|
537
|
-
|
|
539
|
+
_,
|
|
538
540
|
N.metadata
|
|
539
541
|
)
|
|
540
542
|
),
|
|
541
543
|
[
|
|
542
|
-
|
|
544
|
+
S,
|
|
543
545
|
K,
|
|
544
546
|
p,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
+
_,
|
|
548
|
+
ue,
|
|
547
549
|
N.metadata
|
|
548
550
|
]
|
|
549
|
-
),
|
|
550
|
-
() =>
|
|
551
|
-
|
|
551
|
+
), We = z || !!V, ze = h(
|
|
552
|
+
() => We ? { ...c, allowImages: !0 } : c,
|
|
553
|
+
[We, c]
|
|
554
|
+
), ne = h(
|
|
555
|
+
() => Et(
|
|
556
|
+
_,
|
|
552
557
|
l,
|
|
553
|
-
|
|
558
|
+
ze
|
|
554
559
|
),
|
|
555
|
-
[
|
|
556
|
-
),
|
|
557
|
-
() => l ? l.split(",").map((e) =>
|
|
560
|
+
[ze, _, l]
|
|
561
|
+
), Fe = V ?? (ne.images?.length ? { images: ne.images } : void 0), Ge = (I ? Qe.trimVariablePadding(I) : void 0) || ne.buttonText, _e = W?.trim() || ne.inputText, mt = h(
|
|
562
|
+
() => l ? l.split(",").map((e) => Qe.trimVariablePadding(e)).filter(Boolean) : void 0,
|
|
558
563
|
[l]
|
|
559
|
-
),
|
|
560
|
-
|
|
561
|
-
),
|
|
564
|
+
), pt = P?.length ? P : ne.selectedValues || mt, je = tn(
|
|
565
|
+
pt
|
|
566
|
+
), g = T({
|
|
567
|
+
showImageInput: z,
|
|
568
|
+
imageInput: Fe,
|
|
562
569
|
onPlaceholderAccepted: t,
|
|
563
|
-
direction:
|
|
564
|
-
language:
|
|
565
|
-
mermaidMessages:
|
|
566
|
-
beforeSend:
|
|
570
|
+
direction: ee,
|
|
571
|
+
language: te,
|
|
572
|
+
mermaidMessages: ce,
|
|
573
|
+
beforeSend: F,
|
|
567
574
|
locale: o,
|
|
568
|
-
onClickCustomButtonAfterContent:
|
|
569
|
-
onSend:
|
|
570
|
-
readonly:
|
|
571
|
-
renderContent:
|
|
572
|
-
resolvedConfirmButtonText:
|
|
573
|
-
resolvedCopiedButtonText:
|
|
574
|
-
resolvedCopyButtonText:
|
|
575
|
-
resolvedDefaultButtonText:
|
|
576
|
-
resolvedDefaultInputText:
|
|
577
|
-
resolvedDefaultSelectedValues:
|
|
575
|
+
onClickCustomButtonAfterContent: D,
|
|
576
|
+
onSend: v,
|
|
577
|
+
readonly: w,
|
|
578
|
+
renderContent: _,
|
|
579
|
+
resolvedConfirmButtonText: Ne,
|
|
580
|
+
resolvedCopiedButtonText: Me,
|
|
581
|
+
resolvedCopyButtonText: Le,
|
|
582
|
+
resolvedDefaultButtonText: Ge,
|
|
583
|
+
resolvedDefaultInputText: _e,
|
|
584
|
+
resolvedDefaultSelectedValues: je
|
|
578
585
|
});
|
|
579
|
-
|
|
586
|
+
g.current = {
|
|
587
|
+
showImageInput: z,
|
|
588
|
+
imageInput: Fe,
|
|
580
589
|
onPlaceholderAccepted: t,
|
|
581
|
-
direction:
|
|
582
|
-
language:
|
|
583
|
-
mermaidMessages:
|
|
584
|
-
beforeSend:
|
|
590
|
+
direction: ee,
|
|
591
|
+
language: te,
|
|
592
|
+
mermaidMessages: ce,
|
|
593
|
+
beforeSend: F,
|
|
585
594
|
locale: o,
|
|
586
|
-
onClickCustomButtonAfterContent:
|
|
587
|
-
onSend:
|
|
588
|
-
readonly:
|
|
589
|
-
renderContent:
|
|
590
|
-
resolvedConfirmButtonText:
|
|
591
|
-
resolvedCopiedButtonText:
|
|
592
|
-
resolvedCopyButtonText:
|
|
593
|
-
resolvedDefaultButtonText:
|
|
594
|
-
resolvedDefaultInputText:
|
|
595
|
-
resolvedDefaultSelectedValues:
|
|
595
|
+
onClickCustomButtonAfterContent: D,
|
|
596
|
+
onSend: v,
|
|
597
|
+
readonly: w,
|
|
598
|
+
renderContent: _,
|
|
599
|
+
resolvedConfirmButtonText: Ne,
|
|
600
|
+
resolvedCopiedButtonText: Me,
|
|
601
|
+
resolvedCopyButtonText: Le,
|
|
602
|
+
resolvedDefaultButtonText: Ge,
|
|
603
|
+
resolvedDefaultInputText: _e,
|
|
604
|
+
resolvedDefaultSelectedValues: je
|
|
596
605
|
};
|
|
597
606
|
const xe = h(
|
|
598
607
|
() => ({
|
|
@@ -602,28 +611,30 @@ const _t = 2, be = ({
|
|
|
602
611
|
"button",
|
|
603
612
|
{
|
|
604
613
|
className: "content-render-custom-button-after-content",
|
|
605
|
-
onClick:
|
|
614
|
+
onClick: g.current.onClickCustomButtonAfterContent,
|
|
606
615
|
children: /* @__PURE__ */ s("span", { className: "content-render-custom-button-after-content-inner", children: e })
|
|
607
616
|
}
|
|
608
617
|
),
|
|
609
618
|
"custom-variable": (e) => /* @__PURE__ */ s(
|
|
610
|
-
|
|
619
|
+
Ct,
|
|
611
620
|
{
|
|
612
621
|
...e,
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
showImageInput: g.current.showImageInput,
|
|
623
|
+
imageInput: g.current.imageInput,
|
|
624
|
+
readonly: g.current.readonly,
|
|
625
|
+
defaultButtonText: g.current.resolvedDefaultButtonText,
|
|
626
|
+
defaultInputText: g.current.resolvedDefaultInputText,
|
|
627
|
+
defaultSelectedValues: g.current.resolvedDefaultSelectedValues,
|
|
628
|
+
onSend: g.current.onSend,
|
|
629
|
+
onPlaceholderAccepted: g.current.onPlaceholderAccepted,
|
|
630
|
+
beforeSend: g.current.beforeSend,
|
|
631
|
+
locale: g.current.locale,
|
|
632
|
+
dir: g.current.direction,
|
|
633
|
+
lang: g.current.language,
|
|
634
|
+
confirmButtonText: g.current.resolvedConfirmButtonText
|
|
624
635
|
}
|
|
625
636
|
),
|
|
626
|
-
code:
|
|
637
|
+
code: tt,
|
|
627
638
|
table: ({ ...e }) => /* @__PURE__ */ s("div", { className: "content-render-table-container", children: /* @__PURE__ */ s("table", { className: "content-render-table", ...e }) }),
|
|
628
639
|
th: ({ ...e }) => /* @__PURE__ */ s("th", { className: "content-render-th", ...e }),
|
|
629
640
|
td: ({ ...e }) => /* @__PURE__ */ s("td", { className: "content-render-td", ...e }),
|
|
@@ -645,119 +656,119 @@ const _t = 2, be = ({
|
|
|
645
656
|
) : /* @__PURE__ */ s("input", { ...e }),
|
|
646
657
|
a: ({ children: e, ...n }) => /* @__PURE__ */ s("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
|
|
647
658
|
pre: (e) => /* @__PURE__ */ s(
|
|
648
|
-
|
|
659
|
+
yt,
|
|
649
660
|
{
|
|
650
661
|
...e,
|
|
651
|
-
copyButtonText:
|
|
652
|
-
copiedButtonText:
|
|
662
|
+
copyButtonText: g.current.resolvedCopyButtonText,
|
|
663
|
+
copiedButtonText: g.current.resolvedCopiedButtonText
|
|
653
664
|
}
|
|
654
665
|
)
|
|
655
666
|
}),
|
|
656
667
|
[]
|
|
657
|
-
),
|
|
658
|
-
() =>
|
|
659
|
-
[
|
|
660
|
-
),
|
|
668
|
+
), ft = h(
|
|
669
|
+
() => Ue(De),
|
|
670
|
+
[De]
|
|
671
|
+
), ht = (e, n) => {
|
|
661
672
|
const a = we(e);
|
|
662
|
-
return
|
|
663
|
-
const Y = `${n}-${
|
|
664
|
-
return
|
|
665
|
-
|
|
673
|
+
return Ue(a).map((k, ye) => {
|
|
674
|
+
const Y = `${n}-${k.type}-${ye}`;
|
|
675
|
+
return k.type === "text" ? /* @__PURE__ */ s(
|
|
676
|
+
le.Provider,
|
|
666
677
|
{
|
|
667
|
-
value:
|
|
678
|
+
value: g,
|
|
668
679
|
children: /* @__PURE__ */ s(
|
|
669
|
-
|
|
680
|
+
Xe,
|
|
670
681
|
{
|
|
671
682
|
locale: o,
|
|
672
683
|
components: xe,
|
|
673
|
-
content:
|
|
684
|
+
content: k.value
|
|
674
685
|
}
|
|
675
686
|
)
|
|
676
687
|
},
|
|
677
688
|
Y
|
|
678
|
-
) :
|
|
689
|
+
) : k.type === "mermaid" ? /* @__PURE__ */ s(
|
|
679
690
|
ke,
|
|
680
691
|
{
|
|
681
|
-
chart:
|
|
682
|
-
frozen: !
|
|
683
|
-
messages:
|
|
692
|
+
chart: k.value,
|
|
693
|
+
frozen: !k.complete,
|
|
694
|
+
messages: ce
|
|
684
695
|
},
|
|
685
696
|
Y
|
|
686
|
-
) :
|
|
697
|
+
) : k.type === "svg" ? /* @__PURE__ */ s(be, { svg: k.value }, Y) : null;
|
|
687
698
|
});
|
|
688
|
-
},
|
|
699
|
+
}, He = y ? /* @__PURE__ */ s("div", { className: "content-render-custom-bar", children: X.createElement(y, {
|
|
689
700
|
content: r,
|
|
690
|
-
displayContent:
|
|
691
|
-
onSend:
|
|
701
|
+
displayContent: dt,
|
|
702
|
+
onSend: v
|
|
692
703
|
}) }) : null;
|
|
693
|
-
return K ? /* @__PURE__ */
|
|
704
|
+
return K ? /* @__PURE__ */ qe(
|
|
694
705
|
"div",
|
|
695
706
|
{
|
|
696
707
|
className: "content-render markdown-body",
|
|
697
|
-
dir:
|
|
698
|
-
lang:
|
|
708
|
+
dir: ee,
|
|
709
|
+
lang: te,
|
|
699
710
|
children: [
|
|
700
|
-
|
|
701
|
-
const n = e.indices[0], a =
|
|
711
|
+
lt.map((e) => {
|
|
712
|
+
const n = e.indices[0], a = G[n];
|
|
702
713
|
return e.sandbox ? a.type === "sandbox" && a.value && !a.pending ? /* @__PURE__ */ s(
|
|
703
|
-
|
|
714
|
+
Lt,
|
|
704
715
|
{
|
|
705
716
|
hideFullScreen: !0,
|
|
706
717
|
type: "sandbox",
|
|
707
718
|
content: a.value,
|
|
708
719
|
className: "content-render-iframe",
|
|
709
720
|
locale: o,
|
|
710
|
-
dir:
|
|
711
|
-
lang:
|
|
712
|
-
loadingText:
|
|
713
|
-
styleLoadingText:
|
|
714
|
-
scriptLoadingText:
|
|
715
|
-
disableLoadingOverlay:
|
|
716
|
-
fullScreenButtonText:
|
|
717
|
-
exitFullScreenButtonText:
|
|
718
|
-
mode:
|
|
721
|
+
dir: ee,
|
|
722
|
+
lang: te,
|
|
723
|
+
loadingText: me,
|
|
724
|
+
styleLoadingText: se,
|
|
725
|
+
scriptLoadingText: ae,
|
|
726
|
+
disableLoadingOverlay: pe,
|
|
727
|
+
fullScreenButtonText: ot,
|
|
728
|
+
exitFullScreenButtonText: st,
|
|
729
|
+
mode: Be
|
|
719
730
|
},
|
|
720
731
|
`sandbox-${n}`
|
|
721
732
|
) : null : e.plan ? /* @__PURE__ */ s(
|
|
722
|
-
|
|
733
|
+
le.Provider,
|
|
723
734
|
{
|
|
724
|
-
value:
|
|
735
|
+
value: g,
|
|
725
736
|
children: /* @__PURE__ */ s(
|
|
726
|
-
|
|
737
|
+
Yt,
|
|
727
738
|
{
|
|
728
739
|
locale: o,
|
|
729
740
|
components: xe,
|
|
730
741
|
plan: e.plan,
|
|
731
742
|
renderedSegments: e.indices.map(
|
|
732
|
-
(d) =>
|
|
743
|
+
(d) => G[d]
|
|
733
744
|
)
|
|
734
745
|
}
|
|
735
746
|
)
|
|
736
747
|
},
|
|
737
748
|
`md-${n}`
|
|
738
|
-
) : e.indices.map((d) => /* @__PURE__ */ s(X.Fragment, { children:
|
|
739
|
-
|
|
749
|
+
) : e.indices.map((d) => /* @__PURE__ */ s(X.Fragment, { children: G[d].type === "markdown" && G[d].pending ? null : ht(
|
|
750
|
+
ut[d],
|
|
740
751
|
`md-${d}`
|
|
741
752
|
) }, `md-${d}`));
|
|
742
753
|
}),
|
|
743
|
-
|
|
754
|
+
He
|
|
744
755
|
]
|
|
745
756
|
}
|
|
746
|
-
) : /* @__PURE__ */
|
|
757
|
+
) : /* @__PURE__ */ qe(
|
|
747
758
|
"div",
|
|
748
759
|
{
|
|
749
760
|
className: "content-render markdown-body",
|
|
750
|
-
dir:
|
|
751
|
-
lang:
|
|
761
|
+
dir: ee,
|
|
762
|
+
lang: te,
|
|
752
763
|
children: [
|
|
753
|
-
|
|
764
|
+
ft.map((e, n) => {
|
|
754
765
|
if (e.type === "text")
|
|
755
766
|
return /* @__PURE__ */ s(
|
|
756
|
-
|
|
767
|
+
le.Provider,
|
|
757
768
|
{
|
|
758
|
-
value:
|
|
769
|
+
value: g,
|
|
759
770
|
children: /* @__PURE__ */ s(
|
|
760
|
-
|
|
771
|
+
Xe,
|
|
761
772
|
{
|
|
762
773
|
locale: o,
|
|
763
774
|
components: xe,
|
|
@@ -773,20 +784,20 @@ const _t = 2, be = ({
|
|
|
773
784
|
{
|
|
774
785
|
chart: e.value,
|
|
775
786
|
frozen: !e.complete,
|
|
776
|
-
messages:
|
|
787
|
+
messages: ce
|
|
777
788
|
},
|
|
778
789
|
n
|
|
779
790
|
);
|
|
780
791
|
if (e.type === "svg")
|
|
781
792
|
return /* @__PURE__ */ s(be, { svg: e.value }, n);
|
|
782
793
|
}),
|
|
783
|
-
|
|
794
|
+
He
|
|
784
795
|
]
|
|
785
796
|
}
|
|
786
797
|
);
|
|
787
798
|
};
|
|
788
799
|
export {
|
|
789
|
-
|
|
790
|
-
|
|
800
|
+
Xe as MarkdownRenderer,
|
|
801
|
+
Dn as default
|
|
791
802
|
};
|
|
792
803
|
//# sourceMappingURL=ContentRender.es.js.map
|