markdown-flow-ui 0.2.30 → 0.2.31

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