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