markdown-flow-ui 0.1.116 → 0.1.117-beta.0

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