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