markdown-flow-ui 0.2.15 → 0.2.16-dev.1

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 (43) hide show
  1. package/dist/_virtual/index.es3.js +4 -5
  2. package/dist/_virtual/index.es3.js.map +1 -1
  3. package/dist/_virtual/index.es4.js +5 -4
  4. package/dist/_virtual/index.es4.js.map +1 -1
  5. package/dist/_virtual/index.es8.js +2 -2
  6. package/dist/_virtual/index.es9.js +2 -2
  7. package/dist/_virtual/index3.cjs +1 -1
  8. package/dist/_virtual/index4.cjs +1 -1
  9. package/dist/_virtual/index8.cjs +1 -1
  10. package/dist/_virtual/index9.cjs +1 -1
  11. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  12. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  13. package/dist/components/ContentRender/ContentRender.d.ts +3 -0
  14. package/dist/components/ContentRender/ContentRender.es.js +301 -262
  15. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  16. package/dist/components/ContentRender/index.d.ts +1 -1
  17. package/dist/components/ContentRender/typewriterPacing.fixtures.d.ts +14 -0
  18. package/dist/components/ContentRender/utils/typewriter-pacing.cjs +3 -0
  19. package/dist/components/ContentRender/utils/typewriter-pacing.cjs.map +1 -0
  20. package/dist/components/ContentRender/utils/typewriter-pacing.d.ts +27 -0
  21. package/dist/components/ContentRender/utils/typewriter-pacing.es.js +98 -0
  22. package/dist/components/ContentRender/utils/typewriter-pacing.es.js.map +1 -0
  23. package/dist/components/ContentRender/utils/typewriter-pacing.test.d.ts +1 -0
  24. package/dist/components/index.d.ts +1 -1
  25. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  26. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  27. package/dist/markdown-flow-ui-lib.css +1 -1
  28. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
  29. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  30. package/dist/node_modules/classnames/index.cjs +1 -1
  31. package/dist/node_modules/classnames/index.es.js +1 -1
  32. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  33. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  34. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  35. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  36. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  37. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  38. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  39. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  40. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  41. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
  42. package/dist/renderer.d.ts +2 -2
  43. package/package.json +1 -1
@@ -1,91 +1,92 @@
1
- import { jsx as r, jsxs as Re } from "react/jsx-runtime";
2
- import F, { useMemo as g, useState as Le, useRef as M, useEffect as D } from "react";
3
- import Me from "../../_virtual/index.es.js";
4
- import { sanitizeInvalidTagName as Ae } from "./utils/sanitize-invalid-tag-name.es.js";
5
- import { stripSvgTextLineBreaks as $e } from "./utils/strip-svg-text-line-breaks.es.js";
1
+ import { jsx as r, jsxs as ze } from "react/jsx-runtime";
2
+ import Q, { useMemo as y, useState as Ce, useRef as g, useEffect as H } from "react";
3
+ import We from "../../_virtual/index.es.js";
4
+ import { sanitizeInvalidTagName as Pe } from "./utils/sanitize-invalid-tag-name.es.js";
5
+ import { stripSvgTextLineBreaks as He } from "./utils/strip-svg-text-line-breaks.es.js";
6
6
  /* empty css */
7
7
  /* empty css */
8
8
  /* empty css */
9
9
  /* empty css */
10
- import Ve, { CodeBlockContext as ze } from "./CodeBlock.es.js";
11
- import De from "./plugins/CustomVariable.es.js";
12
- import ee from "./plugins/MermaidChart.es.js";
13
- import { preserveCustomVariableProperties as Fe, restoreCustomVariableProperties as Ie } from "./utils/custom-variable-props.es.js";
14
- import { subsetLanguages as Pe, highlightLanguages as Ee } from "./utils/highlight-languages.es.js";
15
- import { parseMarkdownSegments as fe, mermaidBlockIsComplete as He } from "./utils/mermaid-parse.es.js";
16
- import { normalizeInlineHtml as he } from "./utils/normalize-inline-html.es.js";
17
- import We from "./IframeSandbox.es.js";
18
- import { splitContentSegments as _e } from "./utils/split-content.es.js";
19
- import { getInteractionDefaultValues as je } from "../../lib/interaction-defaults.es.js";
20
- import { getMarkdownFlowDirection as qe, getMarkdownFlowLanguage as Ge } from "../../lib/locale.es.js";
21
- import { getContentRenderLocaleTexts as ve } from "./contentRenderI18n.es.js";
22
- import { Markdown as Oe } from "../../node_modules/react-markdown/lib/index.es.js";
23
- import Ue from "../../node_modules/rehype-raw/lib/index.es.js";
24
- import Ke from "../../node_modules/rehype-highlight/lib/index.es.js";
25
- import Xe from "../../node_modules/rehype-katex/lib/index.es.js";
26
- import Je from "../../node_modules/remark-gfm/lib/index.es.js";
27
- import Qe from "../../node_modules/remark-math/lib/index.es.js";
28
- import Ye from "../../node_modules/remark-breaks/lib/index.es.js";
29
- const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, ge = ({ svg: t }) => {
30
- const n = M(null);
31
- return D(() => {
10
+ import Qe, { CodeBlockContext as qe } from "./CodeBlock.es.js";
11
+ import je from "./plugins/CustomVariable.es.js";
12
+ import se from "./plugins/MermaidChart.es.js";
13
+ import { preserveCustomVariableProperties as Ue, restoreCustomVariableProperties as Ge } from "./utils/custom-variable-props.es.js";
14
+ import { subsetLanguages as Ke, highlightLanguages as Oe } from "./utils/highlight-languages.es.js";
15
+ import { parseMarkdownSegments as be, mermaidBlockIsComplete as Xe } from "./utils/mermaid-parse.es.js";
16
+ import { normalizeInlineHtml as ke } from "./utils/normalize-inline-html.es.js";
17
+ import Ye from "./IframeSandbox.es.js";
18
+ import { appendContentAwareTypewriterQueue as Ze, createContentAwareTypewriterQueue as Je, consumeContentAwareTypewriterQueue as et, CONTENT_AWARE_TYPEWRITER_TICK_BUDGET as tt, isContentAwareTypewriterQueueEmpty as rt } from "./utils/typewriter-pacing.es.js";
19
+ import { splitContentSegments as nt } from "./utils/split-content.es.js";
20
+ import { getInteractionDefaultValues as ot } from "../../lib/interaction-defaults.es.js";
21
+ import { getMarkdownFlowDirection as st, getMarkdownFlowLanguage as at } from "../../lib/locale.es.js";
22
+ import { getContentRenderLocaleTexts as Re } from "./contentRenderI18n.es.js";
23
+ import { Markdown as it } from "../../node_modules/react-markdown/lib/index.es.js";
24
+ import ct from "../../node_modules/rehype-raw/lib/index.es.js";
25
+ import lt from "../../node_modules/rehype-highlight/lib/index.es.js";
26
+ import ut from "../../node_modules/rehype-katex/lib/index.es.js";
27
+ import dt from "../../node_modules/remark-gfm/lib/index.es.js";
28
+ import mt from "../../node_modules/remark-math/lib/index.es.js";
29
+ import pt from "../../node_modules/remark-breaks/lib/index.es.js";
30
+ const ft = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, ht = 2, Be = ({ svg: t }) => {
31
+ const n = g(null);
32
+ return H(() => {
32
33
  const o = n.current;
33
34
  if (!o) return;
34
- const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }), x = "content-render-svg-style";
35
- let d = s.getElementById(x);
36
- d || (d = document.createElement("style"), d.id = x, d.textContent = `
35
+ const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }), T = "content-render-svg-style";
36
+ let u = s.getElementById(T);
37
+ u || (u = document.createElement("style"), u.id = T, u.textContent = `
37
38
  svg { height: auto; display: inline-block; }
38
39
  svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
39
40
  svg.content-render-svg-el--fixed { max-width: none; }
40
- `, s.appendChild(d)), Array.from(s.childNodes).filter(
41
- (a) => a !== d
41
+ `, s.appendChild(u)), Array.from(s.childNodes).filter(
42
+ (a) => a !== u
42
43
  ).forEach((a) => s.removeChild(a));
43
- const A = document.createElement("template"), S = $e(t);
44
- A.innerHTML = S, s.append(A.content.cloneNode(!0));
45
- let k = !1, $ = !1;
44
+ const V = document.createElement("template"), L = He(t);
45
+ V.innerHTML = L, s.append(V.content.cloneNode(!0));
46
+ let f = !1, I = !1;
46
47
  s.querySelectorAll("svg").forEach((a) => {
47
- const I = a.getAttribute("viewBox");
48
- if (!I) return;
49
- const V = I.trim().split(/[\s,]+/).map((c) => Number(c));
50
- if (V.length !== 4 || V.some(Number.isNaN)) return;
51
- const [, , C, y] = V, N = a.getAttribute("width"), R = a.getAttribute("height"), P = (c) => {
52
- if (!c) return !1;
53
- const p = c.trim().toLowerCase();
54
- return p === "auto" || p.endsWith("%");
55
- }, E = (c) => {
56
- if (!c) return null;
57
- const p = c.trim().toLowerCase();
58
- if (p === "auto" || p.endsWith("%"))
48
+ const F = a.getAttribute("viewBox");
49
+ if (!F) return;
50
+ const _ = F.trim().split(/[\s,]+/).map((x) => Number(x));
51
+ if (_.length !== 4 || _.some(Number.isNaN)) return;
52
+ const [, , M, b] = _, S = a.getAttribute("width"), D = a.getAttribute("height"), q = (x) => {
53
+ if (!x) return !1;
54
+ const c = x.trim().toLowerCase();
55
+ return c === "auto" || c.endsWith("%");
56
+ }, j = (x) => {
57
+ if (!x) return null;
58
+ const c = x.trim().toLowerCase();
59
+ if (c === "auto" || c.endsWith("%"))
59
60
  return null;
60
- const b = Number.parseFloat(p);
61
- return Number.isNaN(b) ? null : b;
62
- }, _ = P(N), j = P(R), H = !N || N === "0", W = !R || R === "0", q = E(N), G = E(R);
63
- if (_ || j || H && W || q === C && G === y) {
64
- k = !0, a.classList.add("content-render-svg-el--responsive"), a.classList.remove("content-render-svg-el--fixed"), a.style.width = "100%", a.style.height = "auto", !a.style.aspectRatio && y > 0 && (a.style.aspectRatio = `${C} / ${y}`);
61
+ const R = Number.parseFloat(c);
62
+ return Number.isNaN(R) ? null : R;
63
+ }, O = q(S), X = q(D), U = !S || S === "0", G = !D || D === "0", Y = j(S), Z = j(D);
64
+ if (O || X || U && G || Y === M && Z === b) {
65
+ f = !0, a.classList.add("content-render-svg-el--responsive"), a.classList.remove("content-render-svg-el--fixed"), a.style.width = "100%", a.style.height = "auto", !a.style.aspectRatio && b > 0 && (a.style.aspectRatio = `${M} / ${b}`);
65
66
  return;
66
67
  }
67
- $ = !0, a.classList.add("content-render-svg-el--fixed"), a.classList.remove("content-render-svg-el--responsive"), H && C > 0 && a.setAttribute("width", `${C}`), W && y > 0 && a.setAttribute("height", `${y}`);
68
+ I = !0, a.classList.add("content-render-svg-el--fixed"), a.classList.remove("content-render-svg-el--responsive"), U && M > 0 && a.setAttribute("width", `${M}`), G && b > 0 && a.setAttribute("height", `${b}`);
68
69
  });
69
- const v = k && !$;
70
- o.classList.toggle("content-render-svg--responsive", v), o.classList.toggle("content-render-svg--fixed", !v);
70
+ const $ = f && !I;
71
+ o.classList.toggle("content-render-svg--responsive", $), o.classList.toggle("content-render-svg--fixed", !$);
71
72
  }, [t]), /* @__PURE__ */ r("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ r("div", { className: "content-render-svg", ref: n }) });
72
- }, te = F.createContext(
73
+ }, ae = Q.createContext(
73
74
  null
74
- ), et = (t) => {
75
- const n = F.useContext(te), o = F.useContext(ze);
75
+ ), gt = (t) => {
76
+ const n = Q.useContext(ae), o = Q.useContext(qe);
76
77
  if (!n)
77
78
  throw new Error("Markdown code renderer requires ContentRender context.");
78
- const { className: s, children: x, ...d } = t;
79
+ const { className: s, children: T, ...u } = t;
79
80
  if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
80
- const S = x?.toString().replace(/\n$/, "") || "", k = He(
81
+ const L = T?.toString().replace(/\n$/, "") || "", f = Xe(
81
82
  n.current.renderContent,
82
- S
83
+ L
83
84
  );
84
85
  return /* @__PURE__ */ r(
85
- ee,
86
+ se,
86
87
  {
87
- chart: S,
88
- frozen: k,
88
+ chart: L,
89
+ frozen: f,
89
90
  messages: n.current.mermaidMessages
90
91
  }
91
92
  );
@@ -94,42 +95,42 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
94
95
  "code",
95
96
  {
96
97
  className: s,
97
- ...d,
98
- dir: d.dir ?? (o ? void 0 : "ltr"),
99
- children: x
98
+ ...u,
99
+ dir: u.dir ?? (o ? void 0 : "ltr"),
100
+ children: T
100
101
  }
101
102
  );
102
- }, tt = [
103
- Je,
104
- Qe,
105
- Me,
106
- Ye
107
- ], rt = [
108
- Fe,
103
+ }, xt = [
104
+ dt,
105
+ mt,
106
+ We,
107
+ pt
108
+ ], vt = [
109
109
  Ue,
110
- Ae,
111
- Ie,
112
- [Ke, { languages: Ee, subset: Pe }],
113
- Xe
114
- ], xe = ({ content: t, components: n, locale: o }) => {
115
- const s = ve(o);
110
+ ct,
111
+ Pe,
112
+ Ge,
113
+ [lt, { languages: Oe, subset: Ke }],
114
+ ut
115
+ ], Se = ({ content: t, components: n, locale: o }) => {
116
+ const s = Re(o);
116
117
  return /* @__PURE__ */ r("div", { className: "markdown-renderer", children: /* @__PURE__ */ r(
117
- Oe,
118
+ it,
118
119
  {
119
- remarkPlugins: tt,
120
- rehypePlugins: rt,
120
+ remarkPlugins: xt,
121
+ rehypePlugins: vt,
121
122
  remarkRehypeOptions: {
122
123
  footnoteLabel: s.footnoteLabel,
123
- footnoteBackLabel: (x, d) => {
124
- const w = String(x + 1) + (d > 1 ? `-${d}` : "");
125
- return s.footnoteBackLabel.replace("{reference}", w);
124
+ footnoteBackLabel: (T, u) => {
125
+ const B = String(T + 1) + (u > 1 ? `-${u}` : "");
126
+ return s.footnoteBackLabel.replace("{reference}", B);
126
127
  }
127
128
  },
128
129
  components: n,
129
130
  children: t
130
131
  }
131
132
  ) });
132
- }, nt = (t) => {
133
+ }, yt = (t) => {
133
134
  if (t.length <= 1) return t;
134
135
  const n = [];
135
136
  return t.forEach((o) => {
@@ -147,155 +148,193 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
147
148
  }
148
149
  n.push({ type: "markdown", value: o.value });
149
150
  }), n;
150
- }, ot = (t, n) => {
151
+ }, Tt = (t, n) => {
151
152
  const o = Math.max(1, n), s = Array.from(t);
152
153
  return {
153
154
  chunk: s.slice(0, o).join(""),
154
155
  rest: s.slice(o).join("")
155
156
  };
156
- }, st = (t, n) => t === n ? !0 : !t || !n || t.length !== n.length ? !1 : t.every((o, s) => o === n[s]), at = (t) => {
157
- const n = M(t);
158
- return st(n.current, t) || (n.current = t), n.current;
159
- }, Ft = ({
157
+ }, wt = (t, n) => t === n ? !0 : !t || !n || t.length !== n.length ? !1 : t.every((o, s) => o === n[s]), Ct = (t) => {
158
+ const n = g(t);
159
+ return wt(n.current, t) || (n.current = t), n.current;
160
+ }, er = ({
160
161
  content: t,
161
162
  contentType: n,
162
163
  locale: o,
163
164
  lang: s,
164
- dir: x,
165
- customRenderBar: d,
166
- onSend: w,
167
- typingSpeed: A = 40,
168
- enableTypewriter: S = !1,
169
- onTypeFinished: k,
165
+ dir: T,
166
+ customRenderBar: u,
167
+ onSend: B,
168
+ typingSpeed: V = 40,
169
+ enableTypewriter: L = !1,
170
+ typewriterPacing: f = "fixed",
171
+ onTypeFinished: I,
170
172
  onTypewriterStateChange: $,
171
- userInput: v,
172
- interactionDefaultValueOptions: a,
173
- defaultButtonText: I,
174
- defaultInputText: V,
175
- defaultSelectedValues: C,
176
- readonly: y = !1,
177
- confirmButtonText: N,
178
- copyButtonText: R,
179
- copiedButtonText: P,
180
- sandboxLoadingText: E,
181
- sandboxStyleLoadingText: _,
182
- sandboxScriptLoadingText: j,
183
- disableSandboxLoadingOverlay: H = !1,
184
- sandboxFullscreenButtonText: W,
185
- sandboxExitFullscreenButtonText: q,
186
- sandboxMode: G = "content",
187
- onClickCustomButtonAfterContent: O,
188
- beforeSend: U
173
+ userInput: a,
174
+ interactionDefaultValueOptions: F,
175
+ defaultButtonText: _,
176
+ defaultInputText: M,
177
+ defaultSelectedValues: b,
178
+ readonly: S = !1,
179
+ confirmButtonText: D,
180
+ copyButtonText: q,
181
+ copiedButtonText: j,
182
+ sandboxLoadingText: O,
183
+ sandboxStyleLoadingText: X,
184
+ sandboxScriptLoadingText: U,
185
+ disableSandboxLoadingOverlay: G = !1,
186
+ sandboxFullscreenButtonText: Y,
187
+ sandboxExitFullscreenButtonText: Z,
188
+ sandboxMode: ie = "content",
189
+ onClickCustomButtonAfterContent: J,
190
+ beforeSend: x
189
191
  // tooltipMinLength,
190
192
  }) => {
191
- const c = ve(o), p = g(
193
+ const c = Re(o), R = y(
192
194
  () => ({
193
195
  loading: c.mermaidLoadingText,
194
196
  emptyChart: c.mermaidEmptyChartText,
195
197
  error: c.mermaidErrorText
196
198
  }),
197
199
  [c]
198
- ), b = x ?? qe(o), z = s ?? Ge(o), re = N || c.confirmButtonText, ne = R || c.copyButtonText, oe = P || c.copiedButtonText, ye = W || c.sandboxFullscreenButtonText, be = q || c.sandboxExitFullscreenButtonText, u = !!S && (!n || n === "text"), se = 2, ae = Math.max(0, A), [T, K] = Le(
199
- () => u ? "" : t
200
- ), B = M(""), ie = M(u), X = M(!1);
201
- D(() => {
202
- const e = ie.current;
203
- if (ie.current = u, X.current = !1, !u) {
204
- B.current = "", K(t);
200
+ ), z = T ?? st(o), W = s ?? at(o), ce = D || c.confirmButtonText, le = q || c.copyButtonText, ue = j || c.copiedButtonText, Ne = Y || c.sandboxFullscreenButtonText, Ae = Z || c.sandboxExitFullscreenButtonText, d = !!L && (!n || n === "text"), de = Math.max(0, V), Le = f === "fixed" ? t : void 0, [w, me] = Ce(
201
+ () => d ? "" : t
202
+ ), K = g(w), h = g(""), k = g({
203
+ tokens: [],
204
+ head: 0
205
+ }), N = g(0), pe = g(d), fe = g(f), he = g(t), ee = g(!1), [Me, De] = Ce(0);
206
+ H(() => {
207
+ const e = pe.current, i = fe.current, m = he.current, C = !!h.current;
208
+ pe.current = d, fe.current = f, he.current = t, (t !== m || d !== e) && (ee.current = !1);
209
+ const p = () => {
210
+ h.current = "", k.current = { tokens: [], head: 0 }, N.current = 0;
211
+ }, P = (E) => {
212
+ K.current = E, me(E);
213
+ };
214
+ if (!d) {
215
+ p(), P(t);
205
216
  return;
206
217
  }
207
- K((i) => {
208
- const m = !e, L = t.startsWith(i);
209
- if (!m && !L)
210
- return B.current = "", t;
211
- const f = m || !L ? "" : i;
212
- return B.current = t.slice(f.length), f;
213
- });
214
- }, [t, u]), D(() => {
215
- u && (X.current || B.current || T !== t || (X.current = !0, k?.()));
216
- }, [t, T, u, k]), D(() => {
217
- if (!u || !B.current)
218
+ e || (p(), P(""));
219
+ const A = e ? K.current : "";
220
+ if (!t.startsWith(A)) {
221
+ p(), P(t);
222
+ return;
223
+ }
224
+ const oe = t.slice(A.length);
225
+ if (!oe) {
226
+ p();
227
+ return;
228
+ }
229
+ if (f === "content-aware") {
230
+ const E = m.slice(
231
+ A.length
232
+ );
233
+ e && i === "content-aware" && t.startsWith(m) && h.current === E ? k.current = Ze(
234
+ k.current,
235
+ t.slice(m.length)
236
+ ) : (k.current = Je(oe), N.current = 0);
237
+ } else
238
+ k.current = { tokens: [], head: 0 }, N.current = 0;
239
+ h.current = oe, C || De((E) => E + 1);
240
+ }, [t, d, f]), H(() => {
241
+ d && (ee.current || h.current || w !== t || (ee.current = !0, I?.()));
242
+ }, [t, w, d, I]), H(() => {
243
+ if (!d || !h.current)
218
244
  return;
219
245
  const e = window.setTimeout(() => {
220
- K((i) => {
221
- const { chunk: m, rest: L } = ot(
222
- B.current,
223
- se
246
+ if (!h.current)
247
+ return;
248
+ let i = "";
249
+ if (f === "content-aware") {
250
+ const C = et(
251
+ k.current,
252
+ N.current + tt
224
253
  );
225
- return m ? (B.current = L, `${i}${m}`) : i;
226
- });
227
- }, ae);
254
+ i = C.chunk, k.current = C.queue, rt(C.queue) ? N.current = 0 : N.current = C.remainingBudget;
255
+ } else
256
+ i = Tt(
257
+ h.current,
258
+ ht
259
+ ).chunk;
260
+ if (!i)
261
+ return;
262
+ h.current = h.current.slice(i.length), h.current || (k.current = { tokens: [], head: 0 }, N.current = 0);
263
+ const m = `${K.current}${i}`;
264
+ K.current = m, me(m);
265
+ }, de);
228
266
  return () => window.clearTimeout(e);
229
267
  }, [
230
- t,
231
- T,
232
- u,
233
- se,
234
- ae
268
+ w,
269
+ Le,
270
+ d,
271
+ f,
272
+ de,
273
+ Me
235
274
  ]);
236
- const ce = g(
275
+ const ge = y(
237
276
  () => ({
238
- isTypewriterEnabled: u,
239
- isTyping: u && T !== t,
240
- isComplete: T === t,
241
- renderedLength: T.length,
277
+ isTypewriterEnabled: d,
278
+ isTyping: d && w !== t,
279
+ isComplete: w === t,
280
+ renderedLength: w.length,
242
281
  totalLength: t.length
243
282
  }),
244
- [t, T, u]
283
+ [t, w, d]
245
284
  );
246
- D(() => {
247
- $?.(ce);
248
- }, [$, ce]);
249
- const h = u ? T : t, J = g(
250
- () => he(h),
251
- [h]
252
- ), Q = g(
253
- () => je(
254
- h,
285
+ H(() => {
286
+ $?.(ge);
287
+ }, [$, ge]);
288
+ const v = d ? w : t, te = y(
289
+ () => ke(v),
290
+ [v]
291
+ ), re = y(
292
+ () => ot(
255
293
  v,
256
- a
294
+ a,
295
+ F
257
296
  ),
258
- [a, h, v]
259
- ), le = I?.trim() || Q.buttonText, de = V?.trim() || Q.inputText, Te = g(
260
- () => v ? v.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
261
- [v]
262
- ), we = C?.length ? C : Q.selectedValues || Te, ue = at(
263
- we
264
- ), l = M({
265
- direction: b,
266
- language: z,
267
- mermaidMessages: p,
268
- beforeSend: U,
297
+ [F, v, a]
298
+ ), xe = _?.trim() || re.buttonText, ve = M?.trim() || re.inputText, Ee = y(
299
+ () => a ? a.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
300
+ [a]
301
+ ), Ve = b?.length ? b : re.selectedValues || Ee, ye = Ct(
302
+ Ve
303
+ ), l = g({
304
+ direction: z,
305
+ language: W,
306
+ mermaidMessages: R,
307
+ beforeSend: x,
269
308
  locale: o,
270
- onClickCustomButtonAfterContent: O,
271
- onSend: w,
272
- readonly: y,
273
- renderContent: h,
274
- resolvedConfirmButtonText: re,
275
- resolvedCopiedButtonText: oe,
276
- resolvedCopyButtonText: ne,
277
- resolvedDefaultButtonText: le,
278
- resolvedDefaultInputText: de,
279
- resolvedDefaultSelectedValues: ue
309
+ onClickCustomButtonAfterContent: J,
310
+ onSend: B,
311
+ readonly: S,
312
+ renderContent: v,
313
+ resolvedConfirmButtonText: ce,
314
+ resolvedCopiedButtonText: ue,
315
+ resolvedCopyButtonText: le,
316
+ resolvedDefaultButtonText: xe,
317
+ resolvedDefaultInputText: ve,
318
+ resolvedDefaultSelectedValues: ye
280
319
  });
281
320
  l.current = {
282
- direction: b,
283
- language: z,
284
- mermaidMessages: p,
285
- beforeSend: U,
321
+ direction: z,
322
+ language: W,
323
+ mermaidMessages: R,
324
+ beforeSend: x,
286
325
  locale: o,
287
- onClickCustomButtonAfterContent: O,
288
- onSend: w,
289
- readonly: y,
290
- renderContent: h,
291
- resolvedConfirmButtonText: re,
292
- resolvedCopiedButtonText: oe,
293
- resolvedCopyButtonText: ne,
294
- resolvedDefaultButtonText: le,
295
- resolvedDefaultInputText: de,
296
- resolvedDefaultSelectedValues: ue
326
+ onClickCustomButtonAfterContent: J,
327
+ onSend: B,
328
+ readonly: S,
329
+ renderContent: v,
330
+ resolvedConfirmButtonText: ce,
331
+ resolvedCopiedButtonText: ue,
332
+ resolvedCopyButtonText: le,
333
+ resolvedDefaultButtonText: xe,
334
+ resolvedDefaultInputText: ve,
335
+ resolvedDefaultSelectedValues: ye
297
336
  };
298
- const me = g(
337
+ const Te = y(
299
338
  () => ({
300
339
  "custom-button-after-content": ({
301
340
  children: e
@@ -308,7 +347,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
308
347
  }
309
348
  ),
310
349
  "custom-variable": (e) => /* @__PURE__ */ r(
311
- De,
350
+ je,
312
351
  {
313
352
  ...e,
314
353
  readonly: l.current.readonly,
@@ -323,7 +362,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
323
362
  confirmButtonText: l.current.resolvedConfirmButtonText
324
363
  }
325
364
  ),
326
- code: et,
365
+ code: gt,
327
366
  table: ({ ...e }) => /* @__PURE__ */ r("div", { className: "content-render-table-container", children: /* @__PURE__ */ r("table", { className: "content-render-table", ...e }) }),
328
367
  th: ({ ...e }) => /* @__PURE__ */ r("th", { className: "content-render-th", ...e }),
329
368
  td: ({ ...e }) => /* @__PURE__ */ r("td", { className: "content-render-td", ...e }),
@@ -345,7 +384,7 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
345
384
  ) : /* @__PURE__ */ r("input", { ...e }),
346
385
  a: ({ children: e, ...i }) => /* @__PURE__ */ r("a", { target: "_blank", rel: "noopener noreferrer", ...i, children: e }),
347
386
  pre: (e) => /* @__PURE__ */ r(
348
- Ve,
387
+ Qe,
349
388
  {
350
389
  ...e,
351
390
  copyButtonText: l.current.resolvedCopyButtonText,
@@ -354,96 +393,96 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
354
393
  )
355
394
  }),
356
395
  []
357
- ), pe = g(
358
- () => Ze.test(h),
359
- [h]
360
- ), Y = g(
361
- () => pe ? _e(h, !0) : [],
362
- [h, pe]
363
- ), ke = Y.some(
396
+ ), we = y(
397
+ () => ft.test(v),
398
+ [v]
399
+ ), ne = y(
400
+ () => we ? nt(v, !0) : [],
401
+ [v, we]
402
+ ), Ie = ne.some(
364
403
  (e) => e.type === "sandbox"
365
- ), Ce = g(
366
- () => nt(Y),
367
- [Y]
368
- ), Be = g(
369
- () => fe(J),
370
- [J]
371
- ), Se = (e, i) => {
372
- const m = he(e);
373
- return fe(m).map((f, Ne) => {
374
- const Z = `${i}-${f.type}-${Ne}`;
375
- return f.type === "text" ? /* @__PURE__ */ r(
376
- te.Provider,
404
+ ), $e = y(
405
+ () => yt(ne),
406
+ [ne]
407
+ ), Fe = y(
408
+ () => be(te),
409
+ [te]
410
+ ), _e = (e, i) => {
411
+ const m = ke(e);
412
+ return be(m).map((p, P) => {
413
+ const A = `${i}-${p.type}-${P}`;
414
+ return p.type === "text" ? /* @__PURE__ */ r(
415
+ ae.Provider,
377
416
  {
378
417
  value: l,
379
418
  children: /* @__PURE__ */ r(
380
- xe,
419
+ Se,
381
420
  {
382
421
  locale: o,
383
- components: me,
384
- content: f.value
422
+ components: Te,
423
+ content: p.value
385
424
  }
386
425
  )
387
426
  },
388
- Z
389
- ) : f.type === "mermaid" ? /* @__PURE__ */ r(
390
- ee,
427
+ A
428
+ ) : p.type === "mermaid" ? /* @__PURE__ */ r(
429
+ se,
391
430
  {
392
- chart: f.value,
393
- frozen: !f.complete,
394
- messages: p
431
+ chart: p.value,
432
+ frozen: !p.complete,
433
+ messages: R
395
434
  },
396
- Z
397
- ) : f.type === "svg" ? /* @__PURE__ */ r(ge, { svg: f.value }, Z) : null;
435
+ A
436
+ ) : p.type === "svg" ? /* @__PURE__ */ r(Be, { svg: p.value }, A) : null;
398
437
  });
399
438
  };
400
- return ke ? /* @__PURE__ */ r(
439
+ return Ie ? /* @__PURE__ */ r(
401
440
  "div",
402
441
  {
403
442
  className: "content-render markdown-body",
404
- dir: b,
405
- lang: z,
406
- children: Ce.map(
443
+ dir: z,
444
+ lang: W,
445
+ children: $e.map(
407
446
  (e, i) => e.type === "sandbox" ? /* @__PURE__ */ r(
408
- We,
447
+ Ye,
409
448
  {
410
449
  hideFullScreen: !0,
411
450
  type: "sandbox",
412
451
  content: e.value,
413
452
  className: "content-render-iframe",
414
453
  locale: o,
415
- dir: b,
416
- lang: z,
417
- loadingText: E,
418
- styleLoadingText: _,
419
- scriptLoadingText: j,
420
- disableLoadingOverlay: H,
421
- fullScreenButtonText: ye,
422
- exitFullScreenButtonText: be,
423
- mode: G
454
+ dir: z,
455
+ lang: W,
456
+ loadingText: O,
457
+ styleLoadingText: X,
458
+ scriptLoadingText: U,
459
+ disableLoadingOverlay: G,
460
+ fullScreenButtonText: Ne,
461
+ exitFullScreenButtonText: Ae,
462
+ mode: ie
424
463
  },
425
464
  `sandbox-${i}`
426
- ) : /* @__PURE__ */ r(F.Fragment, { children: Se(e.value, `md-${i}`) }, `md-${i}`)
465
+ ) : /* @__PURE__ */ r(Q.Fragment, { children: _e(e.value, `md-${i}`) }, `md-${i}`)
427
466
  )
428
467
  }
429
- ) : /* @__PURE__ */ Re(
468
+ ) : /* @__PURE__ */ ze(
430
469
  "div",
431
470
  {
432
471
  className: "content-render markdown-body",
433
- dir: b,
434
- lang: z,
472
+ dir: z,
473
+ lang: W,
435
474
  children: [
436
- Be.map((e, i) => {
475
+ Fe.map((e, i) => {
437
476
  if (e.type === "text")
438
477
  return /* @__PURE__ */ r(
439
- te.Provider,
478
+ ae.Provider,
440
479
  {
441
480
  value: l,
442
481
  children: /* @__PURE__ */ r(
443
- xe,
482
+ Se,
444
483
  {
445
484
  locale: o,
446
- components: me,
485
+ components: Te,
447
486
  content: e.value
448
487
  }
449
488
  )
@@ -452,28 +491,28 @@ const Ze = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
452
491
  );
453
492
  if (e.type === "mermaid")
454
493
  return /* @__PURE__ */ r(
455
- ee,
494
+ se,
456
495
  {
457
496
  chart: e.value,
458
497
  frozen: !e.complete,
459
- messages: p
498
+ messages: R
460
499
  },
461
500
  i
462
501
  );
463
502
  if (e.type === "svg")
464
- return /* @__PURE__ */ r(ge, { svg: e.value }, i);
503
+ return /* @__PURE__ */ r(Be, { svg: e.value }, i);
465
504
  }),
466
- d && /* @__PURE__ */ r("div", { className: "content-render-custom-bar", children: F.createElement(d, {
505
+ u && /* @__PURE__ */ r("div", { className: "content-render-custom-bar", children: Q.createElement(u, {
467
506
  content: t,
468
- displayContent: J,
469
- onSend: w
507
+ displayContent: te,
508
+ onSend: B
470
509
  }) })
471
510
  ]
472
511
  }
473
512
  );
474
513
  };
475
514
  export {
476
- xe as MarkdownRenderer,
477
- Ft as default
515
+ Se as MarkdownRenderer,
516
+ er as default
478
517
  };
479
518
  //# sourceMappingURL=ContentRender.es.js.map