markstream-angular 0.0.1 → 0.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { CommonModule as S } from "@angular/common";
2
- import { Input as l, Component as b, ChangeDetectionStrategy as k, forwardRef as p, inject as Q, ChangeDetectorRef as De, ViewChild as j, ViewContainerRef as fi, ElementRef as co, Renderer2 as pi, Directive as gi, HostListener as uo, EventEmitter as mt, Output as Pt } from "@angular/core";
3
- import { normalizeCustomHtmlTags as dt, normalizeCustomHtmlTagName as Vt, mergeCustomHtmlTags as or, parseMarkdownToStructure as Qr, getMarkdown as en, BLOCKED_HTML_TAGS as yi, VOID_HTML_TAGS as ho, DANGEROUS_HTML_ATTRS as vi, URL_HTML_ATTRS as wi, isUnsafeHtmlUrl as xi, stripCustomHtmlWrapper as bi, getHtmlTagFromContent as ki, STANDARD_HTML_TAGS as Ci, hasCompleteHtmlTagContent as Ti } from "stream-markdown-parser";
2
+ import { Input as l, Component as b, ChangeDetectionStrategy as k, forwardRef as p, inject as Q, ChangeDetectorRef as De, ViewChild as j, ViewContainerRef as fi, ElementRef as co, Renderer2 as pi, Directive as gi, HostListener as uo, EventEmitter as mt, Output as Tt } from "@angular/core";
3
+ import { normalizeCustomHtmlTags as dt, normalizeCustomHtmlTagName as Vt, mergeCustomHtmlTags as or, parseMarkdownToStructure as Qr, getMarkdown as en, BLOCKED_HTML_TAGS as yi, VOID_HTML_TAGS as ho, DANGEROUS_HTML_ATTRS as vi, URL_HTML_ATTRS as wi, isUnsafeHtmlUrl as xi, stripCustomHtmlWrapper as bi, getHtmlTagFromContent as ki, STANDARD_HTML_TAGS as Ci, hasCompleteHtmlTagContent as Pi } from "stream-markdown-parser";
4
4
  const At = /<\/?([A-Z][\w:-]*)(?:\s[^<>]*)?>/gi;
5
5
  function tn(e, t, r) {
6
6
  const o = dt(r), n = new Set(o);
7
7
  if (!t || n.size === 0 || !Array.isArray(e) || e.length === 0)
8
8
  return Array.isArray(e) ? e.slice() : [];
9
- const i = Pi(t, n);
9
+ const i = Ti(t, n);
10
10
  if (i.length === 0)
11
11
  return e.slice();
12
12
  let s = 0;
@@ -27,7 +27,7 @@ function tn(e, t, r) {
27
27
  c(d);
28
28
  return a;
29
29
  }
30
- function Pi(e, t) {
30
+ function Ti(e, t) {
31
31
  const r = [], o = [];
32
32
  let n;
33
33
  for (At.lastIndex = 0; (n = At.exec(e)) !== null; ) {
@@ -110,7 +110,7 @@ function Ei(e, t = {}) {
110
110
  const o = Di(e);
111
111
  if (!o)
112
112
  return [];
113
- const n = Ii(e, t), i = $i(t);
113
+ const n = Ri(e, t), i = $i(t);
114
114
  return tn(
115
115
  Qr(o, i, n),
116
116
  o,
@@ -120,15 +120,15 @@ function Ei(e, t = {}) {
120
120
  function Di(e) {
121
121
  return typeof e.content == "string" ? e.content : typeof e.node?.content == "string" ? e.node.content : "";
122
122
  }
123
- function Ii(e, t) {
124
- const r = t.parseOptions ?? {}, o = t.final ?? Ri(e.node), n = or(t.customHtmlTags, r.customHtmlTags);
123
+ function Ri(e, t) {
124
+ const r = t.parseOptions ?? {}, o = t.final ?? Ii(e.node), n = or(t.customHtmlTags, r.customHtmlTags);
125
125
  return o == null && n.length === 0 ? r : {
126
126
  ...r,
127
127
  ...o == null ? {} : { final: o },
128
128
  ...n.length === 0 ? {} : { customHtmlTags: n }
129
129
  };
130
130
  }
131
- function Ri(e) {
131
+ function Ii(e) {
132
132
  if (!(!e || typeof e != "object") && typeof e.loading == "boolean")
133
133
  return !e.loading;
134
134
  }
@@ -142,7 +142,7 @@ function $i(e) {
142
142
  function Ni(e) {
143
143
  return Array.isArray(e) ? e : [];
144
144
  }
145
- const ir = "__global__", Ar = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", X = (() => {
145
+ const ir = "__global__", Ar = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__", G = (() => {
146
146
  const e = globalThis;
147
147
  if (e[Ar])
148
148
  return e[Ar];
@@ -154,29 +154,29 @@ const ir = "__global__", Ar = "__MARKSTREAM_ANGULAR_CUSTOM_COMPONENTS_STORE__",
154
154
  return e[Ar] = t, t;
155
155
  })();
156
156
  function rn() {
157
- X.revision += 1;
158
- for (const e of Array.from(X.listeners))
157
+ G.revision += 1;
158
+ for (const e of Array.from(G.listeners))
159
159
  try {
160
160
  e();
161
161
  } catch {
162
162
  }
163
163
  }
164
164
  function Ai(e) {
165
- return X.listeners.add(e), () => {
166
- X.listeners.delete(e);
165
+ return G.listeners.add(e), () => {
166
+ G.listeners.delete(e);
167
167
  };
168
168
  }
169
169
  function id() {
170
- return X.revision;
170
+ return G.revision;
171
171
  }
172
172
  function sd(e, t) {
173
- typeof e == "string" ? X.scopedComponents[e] = { ...t || {} } : X.scopedComponents[ir] = { ...e }, rn();
173
+ typeof e == "string" ? G.scopedComponents[e] = { ...t || {} } : G.scopedComponents[ir] = { ...e }, rn();
174
174
  }
175
175
  function mo(e) {
176
- const t = X.scopedComponents[ir] || {};
176
+ const t = G.scopedComponents[ir] || {};
177
177
  if (!e)
178
178
  return t;
179
- const r = X.scopedComponents[e] || {};
179
+ const r = G.scopedComponents[e] || {};
180
180
  return !t || Object.keys(t).length === 0 ? r : !r || Object.keys(r).length === 0 ? t : {
181
181
  ...t,
182
182
  ...r
@@ -185,12 +185,12 @@ function mo(e) {
185
185
  function ad(e) {
186
186
  if (e === ir)
187
187
  throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");
188
- delete X.scopedComponents[e], rn();
188
+ delete G.scopedComponents[e], rn();
189
189
  }
190
190
  function ld() {
191
- delete X.scopedComponents[ir], rn();
191
+ delete G.scopedComponents[ir], rn();
192
192
  }
193
- const In = /* @__PURE__ */ new Map(), Li = /* @__PURE__ */ new Set([
193
+ const Rn = /* @__PURE__ */ new Map(), Li = /* @__PURE__ */ new Set([
194
194
  "table",
195
195
  "code_block",
196
196
  "html_block",
@@ -254,8 +254,8 @@ function Hi(e) {
254
254
  ...e.customHtmlTags || [],
255
255
  ...e.parseOptions?.customHtmlTags || []
256
256
  ]), o = `${e.customId || "markstream-angular"}::${r.join(",")}`;
257
- let n = In.get(o);
258
- n || (n = en(o, { customHtmlTags: r }), In.set(o, n));
257
+ let n = Rn.get(o);
258
+ n || (n = en(o, { customHtmlTags: r }), Rn.set(o, n));
259
259
  const i = e.customMarkdownIt ? e.customMarkdownIt(n) : n, s = {
260
260
  ...e.parseOptions ?? {}
261
261
  };
@@ -333,7 +333,7 @@ function qi(e) {
333
333
  function Ui(e) {
334
334
  return !Array.isArray(e) || e.length === 0 ? null : e.reduce((t, [r, o]) => (!r || !nn(r) || (t[r] = o ?? !0), t), {});
335
335
  }
336
- function Xi(e) {
336
+ function Gi(e) {
337
337
  const t = [], r = [], o = () => {
338
338
  r.length && (t.push({ kind: "inline", nodes: r.slice() }), r.length = 0);
339
339
  };
@@ -341,10 +341,10 @@ function Xi(e) {
341
341
  Li.has(String(n?.type || "")) ? (o(), t.push({ kind: "block", node: n })) : r.push(n);
342
342
  return o(), t;
343
343
  }
344
- var Gi = Object.defineProperty, Zi = Object.getOwnPropertyDescriptor, sr = (e, t, r, o) => {
344
+ var Xi = Object.defineProperty, Zi = Object.getOwnPropertyDescriptor, sr = (e, t, r, o) => {
345
345
  for (var n = o > 1 ? void 0 : o ? Zi(t, r) : t, i = e.length - 1, s; i >= 0; i--)
346
346
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
347
- return o && n && Gi(t, r, n), n;
347
+ return o && n && Xi(t, r, n), n;
348
348
  };
349
349
  let We = class {
350
350
  get children() {
@@ -444,11 +444,11 @@ function wo() {
444
444
  }
445
445
  };
446
446
  }
447
- let pe = null, Lr = !1, ft = null, Rn = !1;
447
+ let pe = null, Lr = !1, ft = null, In = !1;
448
448
  async function es(e) {
449
- if (Rn)
449
+ if (In)
450
450
  return;
451
- Rn = !0;
451
+ In = !0;
452
452
  const t = globalThis?.MonacoEnvironment;
453
453
  t && (typeof t.getWorker == "function" || typeof t.getWorkerUrl == "function") || typeof e?.preloadMonacoWorkers == "function" && await e.preloadMonacoWorkers();
454
454
  }
@@ -734,9 +734,9 @@ var gs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, St = (e, t
734
734
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
735
735
  return o && n && gs(t, r, n), n;
736
736
  };
737
- let Te = class {
737
+ let Pe = class {
738
738
  constructor() {
739
- this.cdr = Q(De), this.i18n = wo(), this.useFallback = !1, this.copied = !1, this.collapsed = !1, this.expanded = !1, this.inlinePreviewOpen = !1, this.editorReady = !1, this.defaultFontSize = 14, this.fontSize = 14, this.helpers = null, this.createPromise = null, this.syncPromise = null, this.editorKind = null, this.viewReady = !1, this.destroyed = !1, this.copyTimer = null, this.closeInlinePreview = () => {
739
+ this.cdr = Q(De), this.i18n = wo(), this.useFallback = !1, this.copied = !1, this.collapsed = !1, this.expanded = !1, this.inlinePreviewOpen = !1, this.editorReady = !1, this.defaultFontSize = 14, this.fontSize = 14, this.helpers = null, this.createPromise = null, this.syncPromise = null, this.editorKind = null, this.viewReady = !1, this.destroyed = !1, this.copyTimer = null, this.deferredHeightSyncRaf = null, this.closeInlinePreview = () => {
740
740
  this.inlinePreviewOpen = !1, this.cdr.markForCheck();
741
741
  };
742
742
  }
@@ -864,7 +864,7 @@ let Te = class {
864
864
  this.applyInitialFontSize(), this.viewReady && this.syncEditorState();
865
865
  }
866
866
  ngOnDestroy() {
867
- this.destroyed = !0, this.copyTimer != null && typeof window < "u" && window.clearTimeout(this.copyTimer), this.cleanupEditor();
867
+ this.destroyed = !0, this.copyTimer != null && typeof window < "u" && window.clearTimeout(this.copyTimer), this.cancelDeferredHeightSync(), this.cleanupEditor();
868
868
  }
869
869
  tooltipFor(e) {
870
870
  return this.resolvedShowTooltips ? e : null;
@@ -930,7 +930,7 @@ let Te = class {
930
930
  return this.syncPromise ? this.syncPromise : (this.syncPromise = (async () => {
931
931
  try {
932
932
  const e = this.isDiff && typeof this.helpers?.createDiffEditor == "function" ? "diff" : "single";
933
- this.editorKind !== e ? await this.recreateEditor(e) : await this.updateEditor(), await Promise.resolve(this.helpers?.setTheme?.(this.resolvedIsDark ? this.resolvedDarkTheme : this.resolvedLightTheme)), this.applyEditorFontSize(), (this.expanded || !this.resolvedLoading || !this.editorReady) && this.applyEditorHeight(), this.editorReady = !0;
933
+ this.editorKind !== e ? await this.recreateEditor(e) : await this.updateEditor(), await Promise.resolve(this.helpers?.setTheme?.(this.resolvedIsDark ? this.resolvedDarkTheme : this.resolvedLightTheme)), this.applyEditorFontSize(), (this.expanded || !this.resolvedLoading || !this.editorReady) && this.applyEditorHeight(), this.editorReady = !0, this.scheduleDeferredHeightSync();
934
934
  } catch {
935
935
  this.useFallback = !0, this.editorReady = !1, this.cleanupEditor();
936
936
  } finally {
@@ -1011,7 +1011,7 @@ let Te = class {
1011
1011
  if (!e)
1012
1012
  return;
1013
1013
  const t = this.resolveMaxHeight();
1014
- e.style.maxHeight = this.expanded ? "none" : `${t}px`, e.style.overflow = this.expanded ? "visible" : "auto";
1014
+ e.style.minHeight = "0px", e.style.maxHeight = this.expanded ? "none" : `${t}px`, e.style.overflow = this.expanded ? "visible" : "auto";
1015
1015
  const r = this.editorKind === "diff" ? this.helpers?.getDiffEditorView?.() : this.helpers?.getEditorView?.();
1016
1016
  if (!r)
1017
1017
  return;
@@ -1027,25 +1027,57 @@ let Te = class {
1027
1027
  }
1028
1028
  }
1029
1029
  resolveEditorHeight(e, t) {
1030
- const r = this.isDiff ? 180 : 120;
1031
- let o = Number.NaN;
1030
+ let r = Number.NaN;
1032
1031
  try {
1033
- typeof e.getContentHeight == "function" ? o = Number(e.getContentHeight()) : this.editorKind === "diff" && typeof e.getModifiedEditor == "function" && (o = Number(e.getModifiedEditor()?.getContentHeight?.()));
1032
+ typeof e.getContentHeight == "function" ? r = Number(e.getContentHeight()) : this.editorKind === "diff" && typeof e.getModifiedEditor == "function" && (r = Number(e.getModifiedEditor()?.getContentHeight?.()));
1034
1033
  } catch {
1035
1034
  }
1036
- if (!Number.isFinite(o) || o <= 0) {
1037
- const n = Math.max(1, this.resolvedCode.split(`
1038
- `).length), i = r + n * (this.isDiff ? 20 : 18);
1039
- return Math.ceil(Math.max(120, this.expanded ? i : Math.min(i, t)));
1035
+ if (!Number.isFinite(r) || r <= 0) {
1036
+ const o = this.resolveEditorLineCount(e), n = this.resolveEditorLineHeight(), i = o * (n + 1.5) + 1;
1037
+ return Math.ceil(Math.max(1, this.expanded ? i : Math.min(i, t)));
1040
1038
  }
1041
- return Math.ceil(Math.max(120, this.expanded ? o : Math.min(o, t)));
1039
+ return Math.ceil(Math.max(1, this.expanded ? r : Math.min(r, t)));
1040
+ }
1041
+ resolveEditorLineCount(e) {
1042
+ try {
1043
+ if (this.editorKind === "diff" && typeof e?.getOriginalEditor == "function" && typeof e?.getModifiedEditor == "function") {
1044
+ const r = Number(e.getOriginalEditor?.()?.getModel?.()?.getLineCount?.() ?? 1), o = Number(e.getModifiedEditor?.()?.getModel?.()?.getLineCount?.() ?? 1);
1045
+ return Math.max(1, r, o);
1046
+ }
1047
+ const t = Number(e?.getModel?.()?.getLineCount?.() ?? 1);
1048
+ if (Number.isFinite(t) && t > 0)
1049
+ return t;
1050
+ } catch {
1051
+ }
1052
+ return Math.max(1, String(this.resolvedCode || "").split(`
1053
+ `).length);
1054
+ }
1055
+ resolveEditorLineHeight() {
1056
+ const e = Number(this.resolvedMonacoOptions.lineHeight);
1057
+ if (Number.isFinite(e) && e > 0)
1058
+ return e;
1059
+ const t = Number(this.resolvedMonacoOptions.fontSize);
1060
+ if (Number.isFinite(t) && t > 0)
1061
+ return Math.max(12, Math.round(t * 1.35));
1062
+ const r = Number(this.fontSize);
1063
+ return Number.isFinite(r) && r > 0 ? Math.max(12, Math.round(r * 1.35)) : 18;
1042
1064
  }
1043
1065
  resolveMaxHeight() {
1044
1066
  const e = this.resolvedMonacoOptions.MAX_HEIGHT ?? 500;
1045
1067
  if (typeof e == "number" && Number.isFinite(e))
1046
- return Math.max(120, e);
1068
+ return e > 0 ? e : 500;
1047
1069
  const t = String(e).match(/^(\d+(?:\.\d+)?)/), r = t ? Number.parseFloat(t[1]) : 500;
1048
- return Number.isFinite(r) ? Math.max(120, r) : 500;
1070
+ return Number.isFinite(r) && r > 0 ? r : 500;
1071
+ }
1072
+ cancelDeferredHeightSync() {
1073
+ this.deferredHeightSyncRaf == null || typeof window > "u" || (window.cancelAnimationFrame(this.deferredHeightSyncRaf), this.deferredHeightSyncRaf = null);
1074
+ }
1075
+ scheduleDeferredHeightSync() {
1076
+ typeof window > "u" || this.destroyed || (this.cancelDeferredHeightSync(), this.deferredHeightSyncRaf = window.requestAnimationFrame(() => {
1077
+ this.deferredHeightSyncRaf = window.requestAnimationFrame(() => {
1078
+ this.deferredHeightSyncRaf = null, this.applyEditorHeight();
1079
+ });
1080
+ }));
1049
1081
  }
1050
1082
  cleanupEditor() {
1051
1083
  try {
@@ -1076,17 +1108,17 @@ let Te = class {
1076
1108
  };
1077
1109
  St([
1078
1110
  j("editorHost")
1079
- ], Te.prototype, "editorHost", 2);
1111
+ ], Pe.prototype, "editorHost", 2);
1080
1112
  St([
1081
1113
  l({ required: !0 })
1082
- ], Te.prototype, "node", 2);
1114
+ ], Pe.prototype, "node", 2);
1083
1115
  St([
1084
1116
  l()
1085
- ], Te.prototype, "context", 2);
1117
+ ], Pe.prototype, "context", 2);
1086
1118
  St([
1087
1119
  l()
1088
- ], Te.prototype, "props", 2);
1089
- Te = St([
1120
+ ], Pe.prototype, "props", 2);
1121
+ Pe = St([
1090
1122
  b({
1091
1123
  selector: "markstream-angular-code-block-node",
1092
1124
  standalone: !0,
@@ -1267,7 +1299,7 @@ Te = St([
1267
1299
  `,
1268
1300
  changeDetection: k.OnPush
1269
1301
  })
1270
- ], Te);
1302
+ ], Pe);
1271
1303
  const an = () => import("@terrastruct/d2");
1272
1304
  let pt = null, ln = an, Le = null;
1273
1305
  function vs() {
@@ -1328,7 +1360,7 @@ function Cs(e) {
1328
1360
  const t = e.trim();
1329
1361
  return bs.test(t) ? t : "";
1330
1362
  }
1331
- function Ts(e) {
1363
+ function Ps(e) {
1332
1364
  const t = /* @__PURE__ */ new Set(["script"]), r = [e, ...Array.from(e.querySelectorAll("*"))];
1333
1365
  for (const o of r) {
1334
1366
  if (t.has(o.tagName.toLowerCase())) {
@@ -1364,9 +1396,9 @@ function cn(e) {
1364
1396
  if (!o || o.nodeName.toLowerCase() !== "svg")
1365
1397
  return "";
1366
1398
  const n = o;
1367
- return Ts(n), n.outerHTML;
1399
+ return Ps(n), n.outerHTML;
1368
1400
  }
1369
- function To(e) {
1401
+ function Po(e) {
1370
1402
  return e ? typeof e == "string" ? e : typeof e.svg == "string" ? e.svg : typeof e.data == "string" ? e.data : "" : "";
1371
1403
  }
1372
1404
  async function dn(e) {
@@ -1415,10 +1447,10 @@ function hn(e, t) {
1415
1447
  function Be(e, t, r) {
1416
1448
  return Math.min(r, Math.max(t, e));
1417
1449
  }
1418
- var Ps = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, Mt = (e, t, r, o) => {
1450
+ var Ts = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, Mt = (e, t, r, o) => {
1419
1451
  for (var n = o > 1 ? void 0 : o ? _s(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1420
1452
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1421
- return o && n && Ps(t, r, n), n;
1453
+ return o && n && Ts(t, r, n), n;
1422
1454
  };
1423
1455
  const Ss = {
1424
1456
  N1: "#E5E7EB",
@@ -1440,7 +1472,7 @@ const Ss = {
1440
1472
  AB4: "#FBBF24",
1441
1473
  AB5: "#F59E0B"
1442
1474
  };
1443
- let Pe = class {
1475
+ let Te = class {
1444
1476
  constructor() {
1445
1477
  this.cdr = Q(De), this.rendering = !1, this.copied = !1, this.collapsed = !1, this.showSource = !1, this.svgMarkup = "", this.error = "", this.viewReady = !1, this.destroyed = !1, this.renderToken = 0, this.copyTimer = null;
1446
1478
  }
@@ -1549,7 +1581,7 @@ let Pe = class {
1549
1581
  const c = await o.render(i, a);
1550
1582
  if (this.destroyed || t !== this.renderToken)
1551
1583
  return;
1552
- const d = cn(To(c));
1584
+ const d = cn(Po(c));
1553
1585
  if (!d)
1554
1586
  throw new Error("D2 render returned empty output.");
1555
1587
  this.svgMarkup = d, this.syncSvgHost();
@@ -1576,17 +1608,17 @@ let Pe = class {
1576
1608
  };
1577
1609
  Mt([
1578
1610
  j("previewHost")
1579
- ], Pe.prototype, "previewHost", 2);
1611
+ ], Te.prototype, "previewHost", 2);
1580
1612
  Mt([
1581
1613
  l({ required: !0 })
1582
- ], Pe.prototype, "node", 2);
1614
+ ], Te.prototype, "node", 2);
1583
1615
  Mt([
1584
1616
  l()
1585
- ], Pe.prototype, "context", 2);
1617
+ ], Te.prototype, "context", 2);
1586
1618
  Mt([
1587
1619
  l()
1588
- ], Pe.prototype, "props", 2);
1589
- Pe = Mt([
1620
+ ], Te.prototype, "props", 2);
1621
+ Te = Mt([
1590
1622
  b({
1591
1623
  selector: "markstream-angular-d2-block-node",
1592
1624
  standalone: !0,
@@ -1675,7 +1707,7 @@ Pe = Mt([
1675
1707
  `,
1676
1708
  changeDetection: k.OnPush
1677
1709
  })
1678
- ], Pe);
1710
+ ], Te);
1679
1711
  function Ms(e) {
1680
1712
  if (typeof e == "function") {
1681
1713
  const t = new e();
@@ -1745,8 +1777,8 @@ Ve = ar([
1745
1777
  changeDetection: k.OnPush
1746
1778
  })
1747
1779
  ], Ve);
1748
- var Ds = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, Ie = (e, t, r, o) => {
1749
- for (var n = o > 1 ? void 0 : o ? Is(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1780
+ var Ds = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, Re = (e, t, r, o) => {
1781
+ for (var n = o > 1 ? void 0 : o ? Rs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1750
1782
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1751
1783
  return o && n && Ds(t, r, n), n;
1752
1784
  };
@@ -1785,25 +1817,25 @@ let te = class {
1785
1817
  return !r || typeof r != "object" ? !1 : t in r ? !0 : Object.values(r).includes(t);
1786
1818
  }
1787
1819
  };
1788
- Ie([
1820
+ Re([
1789
1821
  l()
1790
1822
  ], te.prototype, "component", 2);
1791
- Ie([
1823
+ Re([
1792
1824
  l({ required: !0 })
1793
1825
  ], te.prototype, "node", 2);
1794
- Ie([
1826
+ Re([
1795
1827
  l()
1796
1828
  ], te.prototype, "context", 2);
1797
- Ie([
1829
+ Re([
1798
1830
  l()
1799
1831
  ], te.prototype, "indexKey", 2);
1800
- Ie([
1832
+ Re([
1801
1833
  l()
1802
1834
  ], te.prototype, "inputs", 2);
1803
- Ie([
1835
+ Re([
1804
1836
  j("container", { read: fi, static: !0 })
1805
1837
  ], te.prototype, "containerRef", 2);
1806
- te = Ie([
1838
+ te = Re([
1807
1839
  b({
1808
1840
  selector: "markstream-angular-dynamic-node-host",
1809
1841
  standalone: !0,
@@ -1811,20 +1843,20 @@ te = Ie([
1811
1843
  changeDetection: k.OnPush
1812
1844
  })
1813
1845
  ], te);
1814
- var Rs = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, Po = (e, t, r, o) => {
1846
+ var Is = Object.defineProperty, $s = Object.getOwnPropertyDescriptor, To = (e, t, r, o) => {
1815
1847
  for (var n = o > 1 ? void 0 : o ? $s(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1816
1848
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1817
- return o && n && Rs(t, r, n), n;
1849
+ return o && n && Is(t, r, n), n;
1818
1850
  };
1819
1851
  let Ut = class {
1820
1852
  get text() {
1821
1853
  return x(this.node?.raw || this.node?.markup || this.node?.content || this.node?.name);
1822
1854
  }
1823
1855
  };
1824
- Po([
1856
+ To([
1825
1857
  l({ required: !0 })
1826
1858
  ], Ut.prototype, "node", 2);
1827
- Ut = Po([
1859
+ Ut = To([
1828
1860
  b({
1829
1861
  selector: "markstream-angular-emoji-node",
1830
1862
  standalone: !0,
@@ -1946,7 +1978,7 @@ var Hs = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, _o = (e, t
1946
1978
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1947
1979
  return o && n && Hs(t, r, n), n;
1948
1980
  };
1949
- let Xt = class {
1981
+ let Gt = class {
1950
1982
  get id() {
1951
1983
  return x(this.node?.id);
1952
1984
  }
@@ -1959,8 +1991,8 @@ let Xt = class {
1959
1991
  };
1960
1992
  _o([
1961
1993
  l({ required: !0 })
1962
- ], Xt.prototype, "node", 2);
1963
- Xt = _o([
1994
+ ], Gt.prototype, "node", 2);
1995
+ Gt = _o([
1964
1996
  b({
1965
1997
  selector: "markstream-angular-footnote-anchor-node",
1966
1998
  standalone: !0,
@@ -1975,13 +2007,13 @@ Xt = _o([
1975
2007
  `,
1976
2008
  changeDetection: k.OnPush
1977
2009
  })
1978
- ], Xt);
2010
+ ], Gt);
1979
2011
  var Ks = Object.defineProperty, js = Object.getOwnPropertyDescriptor, dr = (e, t, r, o) => {
1980
2012
  for (var n = o > 1 ? void 0 : o ? js(t, r) : t, i = e.length - 1, s; i >= 0; i--)
1981
2013
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
1982
2014
  return o && n && Ks(t, r, n), n;
1983
2015
  };
1984
- let Xe = class {
2016
+ let Ge = class {
1985
2017
  get footnoteId() {
1986
2018
  return `fnref--${x(this.node?.id)}`;
1987
2019
  }
@@ -1994,14 +2026,14 @@ let Xe = class {
1994
2026
  };
1995
2027
  dr([
1996
2028
  l({ required: !0 })
1997
- ], Xe.prototype, "node", 2);
2029
+ ], Ge.prototype, "node", 2);
1998
2030
  dr([
1999
2031
  l()
2000
- ], Xe.prototype, "context", 2);
2032
+ ], Ge.prototype, "context", 2);
2001
2033
  dr([
2002
2034
  l()
2003
- ], Xe.prototype, "indexKey", 2);
2004
- Xe = dr([
2035
+ ], Ge.prototype, "indexKey", 2);
2036
+ Ge = dr([
2005
2037
  b({
2006
2038
  selector: "markstream-angular-footnote-node",
2007
2039
  standalone: !0,
@@ -2017,13 +2049,13 @@ Xe = dr([
2017
2049
  `,
2018
2050
  changeDetection: k.OnPush
2019
2051
  })
2020
- ], Xe);
2052
+ ], Ge);
2021
2053
  var zs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, So = (e, t, r, o) => {
2022
2054
  for (var n = o > 1 ? void 0 : o ? Ws(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2023
2055
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2024
2056
  return o && n && zs(t, r, n), n;
2025
2057
  };
2026
- let Gt = class {
2058
+ let Xt = class {
2027
2059
  get id() {
2028
2060
  return x(this.node?.id);
2029
2061
  }
@@ -2033,8 +2065,8 @@ let Gt = class {
2033
2065
  };
2034
2066
  So([
2035
2067
  l({ required: !0 })
2036
- ], Gt.prototype, "node", 2);
2037
- Gt = So([
2068
+ ], Xt.prototype, "node", 2);
2069
+ Xt = So([
2038
2070
  b({
2039
2071
  selector: "markstream-angular-footnote-reference-node",
2040
2072
  standalone: !0,
@@ -2045,7 +2077,7 @@ Gt = So([
2045
2077
  `,
2046
2078
  changeDetection: k.OnPush
2047
2079
  })
2048
- ], Gt);
2080
+ ], Xt);
2049
2081
  var Vs = Object.getOwnPropertyDescriptor, qs = (e, t, r, o) => {
2050
2082
  for (var n = o > 1 ? void 0 : o ? Vs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2051
2083
  (s = e[i]) && (n = s(n) || n);
@@ -2061,8 +2093,8 @@ Wr = qs([
2061
2093
  changeDetection: k.OnPush
2062
2094
  })
2063
2095
  ], Wr);
2064
- var Us = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, Mo = (e, t, r, o) => {
2065
- for (var n = o > 1 ? void 0 : o ? Xs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2096
+ var Us = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Mo = (e, t, r, o) => {
2097
+ for (var n = o > 1 ? void 0 : o ? Gs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2066
2098
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2067
2099
  return o && n && Us(t, r, n), n;
2068
2100
  };
@@ -2113,12 +2145,12 @@ xt = Mo([
2113
2145
  standalone: !0
2114
2146
  })
2115
2147
  ], xt);
2116
- var Gs = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, ur = (e, t, r, o) => {
2148
+ var Xs = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, ur = (e, t, r, o) => {
2117
2149
  for (var n = o > 1 ? void 0 : o ? Zs(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2118
2150
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2119
- return o && n && Gs(t, r, n), n;
2151
+ return o && n && Xs(t, r, n), n;
2120
2152
  };
2121
- let Ge = class {
2153
+ let Xe = class {
2122
2154
  get level() {
2123
2155
  return Wi(this.node?.level);
2124
2156
  }
@@ -2135,14 +2167,14 @@ let Ge = class {
2135
2167
  };
2136
2168
  ur([
2137
2169
  l({ required: !0 })
2138
- ], Ge.prototype, "node", 2);
2170
+ ], Xe.prototype, "node", 2);
2139
2171
  ur([
2140
2172
  l()
2141
- ], Ge.prototype, "context", 2);
2173
+ ], Xe.prototype, "context", 2);
2142
2174
  ur([
2143
2175
  l()
2144
- ], Ge.prototype, "indexKey", 2);
2145
- Ge = ur([
2176
+ ], Xe.prototype, "indexKey", 2);
2177
+ Xe = ur([
2146
2178
  b({
2147
2179
  selector: "markstream-angular-heading-node",
2148
2180
  standalone: !0,
@@ -2169,7 +2201,7 @@ Ge = ur([
2169
2201
  `,
2170
2202
  changeDetection: k.OnPush
2171
2203
  })
2172
- ], Ge);
2204
+ ], Xe);
2173
2205
  var Ys = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, hr = (e, t, r, o) => {
2174
2206
  for (var n = o > 1 ? void 0 : o ? Js(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2175
2207
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
@@ -2476,7 +2508,7 @@ async function Eo() {
2476
2508
  return typeof t == "function" && t.prototype && t.prototype.render ? r = t : e?.Infographic ? r = e.Infographic : t && t.Infographic && (r = t.Infographic), Br = r, r;
2477
2509
  }).catch((e) => (console.warn("[markstream-angular] Failed to load @antv/infographic", e), null)), await Lt));
2478
2510
  }
2479
- var aa = Object.defineProperty, la = Object.getOwnPropertyDescriptor, Re = (e, t, r, o) => {
2511
+ var aa = Object.defineProperty, la = Object.getOwnPropertyDescriptor, Ie = (e, t, r, o) => {
2480
2512
  for (var n = o > 1 ? void 0 : o ? la(t, r) : t, i = e.length - 1, s; i >= 0; i--)
2481
2513
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
2482
2514
  return o && n && aa(t, r, n), n;
@@ -2656,25 +2688,25 @@ let re = class {
2656
2688
  });
2657
2689
  }
2658
2690
  };
2659
- Re([
2691
+ Ie([
2660
2692
  j("previewHost")
2661
2693
  ], re.prototype, "previewHost", 2);
2662
- Re([
2694
+ Ie([
2663
2695
  j("modalHost")
2664
2696
  ], re.prototype, "modalHost", 2);
2665
- Re([
2697
+ Ie([
2666
2698
  l({ required: !0 })
2667
2699
  ], re.prototype, "node", 2);
2668
- Re([
2700
+ Ie([
2669
2701
  l()
2670
2702
  ], re.prototype, "context", 2);
2671
- Re([
2703
+ Ie([
2672
2704
  l()
2673
2705
  ], re.prototype, "props", 2);
2674
- Re([
2706
+ Ie([
2675
2707
  uo("window:keydown", ["$event"])
2676
2708
  ], re.prototype, "handleWindowKeydown", 1);
2677
- re = Re([
2709
+ re = Ie([
2678
2710
  b({
2679
2711
  selector: "markstream-angular-infographic-block-node",
2680
2712
  standalone: !0,
@@ -2948,10 +2980,10 @@ function Se(e) {
2948
2980
  function yr(e) {
2949
2981
  return e.split("-")[1];
2950
2982
  }
2951
- function Io(e) {
2983
+ function Ro(e) {
2952
2984
  return e === "x" ? "y" : "x";
2953
2985
  }
2954
- function Ro(e) {
2986
+ function Io(e) {
2955
2987
  return e === "y" ? "height" : "width";
2956
2988
  }
2957
2989
  function se(e) {
@@ -2959,11 +2991,11 @@ function se(e) {
2959
2991
  return t === "t" || t === "b" ? "y" : "x";
2960
2992
  }
2961
2993
  function $o(e) {
2962
- return Io(se(e));
2994
+ return Ro(se(e));
2963
2995
  }
2964
2996
  function fa(e, t, r) {
2965
2997
  r === void 0 && (r = !1);
2966
- const o = yr(e), n = $o(e), i = Ro(n);
2998
+ const o = yr(e), n = $o(e), i = Io(n);
2967
2999
  let s = n === "x" ? o === (r ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
2968
3000
  return t.reference[i] > t.floating[i] && (s = Qt(s)), [s, Qt(s)];
2969
3001
  }
@@ -3036,7 +3068,7 @@ function Kn(e, t, r) {
3036
3068
  reference: o,
3037
3069
  floating: n
3038
3070
  } = e;
3039
- const i = se(t), s = $o(t), a = Ro(s), c = Se(t), d = i === "y", u = o.x + o.width / 2 - n.width / 2, h = o.y + o.height / 2 - n.height / 2, m = o[a] / 2 - n[a] / 2;
3071
+ const i = se(t), s = $o(t), a = Io(s), c = Se(t), d = i === "y", u = o.x + o.width / 2 - n.width / 2, h = o.y + o.height / 2 - n.height / 2, m = o[a] / 2 - n[a] / 2;
3040
3072
  let f;
3041
3073
  switch (c) {
3042
3074
  case "top":
@@ -3095,8 +3127,8 @@ async function ka(e, t) {
3095
3127
  elementContext: h = "floating",
3096
3128
  altBoundary: m = !1,
3097
3129
  padding: f = 0
3098
- } = gr(t, e), g = ba(f), T = a[m ? h === "floating" ? "reference" : "floating" : h], v = er(await i.getClippingRect({
3099
- element: (r = await (i.isElement == null ? void 0 : i.isElement(T))) == null || r ? T : T.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(a.floating)),
3130
+ } = gr(t, e), g = ba(f), P = a[m ? h === "floating" ? "reference" : "floating" : h], v = er(await i.getClippingRect({
3131
+ element: (r = await (i.isElement == null ? void 0 : i.isElement(P))) == null || r ? P : P.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(a.floating)),
3100
3132
  boundary: d,
3101
3133
  rootBoundary: u,
3102
3134
  strategy: c
@@ -3124,7 +3156,7 @@ async function ka(e, t) {
3124
3156
  right: (z.right - v.right + g.right) / $.x
3125
3157
  };
3126
3158
  }
3127
- const Ca = 50, Ta = async (e, t, r) => {
3159
+ const Ca = 50, Pa = async (e, t, r) => {
3128
3160
  const {
3129
3161
  placement: o = "bottom",
3130
3162
  strategy: n = "absolute",
@@ -3144,13 +3176,13 @@ const Ca = 50, Ta = async (e, t, r) => {
3144
3176
  } = Kn(d, o, c), m = o, f = 0;
3145
3177
  const g = {};
3146
3178
  for (let y = 0; y < i.length; y++) {
3147
- const T = i[y];
3148
- if (!T)
3179
+ const P = i[y];
3180
+ if (!P)
3149
3181
  continue;
3150
3182
  const {
3151
3183
  name: v,
3152
3184
  fn: M
3153
- } = T, {
3185
+ } = P, {
3154
3186
  x: D,
3155
3187
  y: $,
3156
3188
  data: z,
@@ -3188,7 +3220,7 @@ const Ca = 50, Ta = async (e, t, r) => {
3188
3220
  strategy: n,
3189
3221
  middlewareData: g
3190
3222
  };
3191
- }, Pa = function(e) {
3223
+ }, Ta = function(e) {
3192
3224
  return e === void 0 && (e = {}), {
3193
3225
  name: "flip",
3194
3226
  options: e,
@@ -3208,13 +3240,13 @@ const Ca = 50, Ta = async (e, t, r) => {
3208
3240
  fallbackStrategy: f = "bestFit",
3209
3241
  fallbackAxisSideDirection: g = "none",
3210
3242
  flipAlignment: y = !0,
3211
- ...T
3243
+ ...P
3212
3244
  } = gr(e, t);
3213
3245
  if ((r = i.arrow) != null && r.alignmentOffset)
3214
3246
  return {};
3215
3247
  const v = Se(n), M = se(a), D = Se(a) === a, $ = await (c.isRTL == null ? void 0 : c.isRTL(d.floating)), z = m || (D || !y ? [Qt(a)] : pa(a)), H = g !== "none";
3216
3248
  !m && H && z.push(...wa(a, y, g, $));
3217
- const Ne = [a, ...z], $r = await c.detectOverflow(t, T), Nt = [];
3249
+ const Ne = [a, ...z], $r = await c.detectOverflow(t, P), Nt = [];
3218
3250
  let Ae = ((o = i.flip) == null ? void 0 : o.overflows) || [];
3219
3251
  if (u && Nt.push($r[v]), h) {
3220
3252
  const me = fa(n, s, $);
@@ -3348,7 +3380,7 @@ const Ma = function(e) {
3348
3380
  } = gr(e, t), u = {
3349
3381
  x: r,
3350
3382
  y: o
3351
- }, h = await i.detectOverflow(t, d), m = se(Se(n)), f = Io(m);
3383
+ }, h = await i.detectOverflow(t, d), m = se(Se(n)), f = Ro(m);
3352
3384
  let g = u[f], y = u[m];
3353
3385
  if (s) {
3354
3386
  const v = f === "y" ? "top" : "left", M = f === "y" ? "bottom" : "right", D = g + h[v], $ = g - h[M];
@@ -3358,16 +3390,16 @@ const Ma = function(e) {
3358
3390
  const v = m === "y" ? "top" : "left", M = m === "y" ? "bottom" : "right", D = y + h[v], $ = y - h[M];
3359
3391
  y = Bn(D, y, $);
3360
3392
  }
3361
- const T = c.fn({
3393
+ const P = c.fn({
3362
3394
  ...t,
3363
3395
  [f]: g,
3364
3396
  [m]: y
3365
3397
  });
3366
3398
  return {
3367
- ...T,
3399
+ ...P,
3368
3400
  data: {
3369
- x: T.x - r,
3370
- y: T.y - o,
3401
+ x: P.x - r,
3402
+ y: P.y - o,
3371
3403
  enabled: {
3372
3404
  [f]: s,
3373
3405
  [m]: a
@@ -3394,7 +3426,7 @@ function ee(e) {
3394
3426
  function No(e) {
3395
3427
  return vr() ? e instanceof Node || e instanceof K(e).Node : !1;
3396
3428
  }
3397
- function G(e) {
3429
+ function X(e) {
3398
3430
  return vr() ? e instanceof Element || e instanceof K(e).Element : !1;
3399
3431
  }
3400
3432
  function oe(e) {
@@ -3427,13 +3459,13 @@ function wr(e) {
3427
3459
  return !1;
3428
3460
  }
3429
3461
  }
3430
- const Da = /transform|translate|scale|rotate|perspective|filter/, Ia = /paint|layout|strict|content/, ge = (e) => !!e && e !== "none";
3462
+ const Da = /transform|translate|scale|rotate|perspective|filter/, Ra = /paint|layout|strict|content/, ge = (e) => !!e && e !== "none";
3431
3463
  let Hr;
3432
3464
  function fn(e) {
3433
- const t = G(e) ? Z(e) : e;
3434
- return ge(t.transform) || ge(t.translate) || ge(t.scale) || ge(t.rotate) || ge(t.perspective) || !pn() && (ge(t.backdropFilter) || ge(t.filter)) || Da.test(t.willChange || "") || Ia.test(t.contain || "");
3465
+ const t = X(e) ? Z(e) : e;
3466
+ return ge(t.transform) || ge(t.translate) || ge(t.scale) || ge(t.rotate) || ge(t.perspective) || !pn() && (ge(t.backdropFilter) || ge(t.filter)) || Da.test(t.willChange || "") || Ra.test(t.contain || "");
3435
3467
  }
3436
- function Ra(e) {
3468
+ function Ia(e) {
3437
3469
  let t = ce(e);
3438
3470
  for (; oe(t) && !et(t); ) {
3439
3471
  if (fn(t))
@@ -3454,7 +3486,7 @@ function Z(e) {
3454
3486
  return K(e).getComputedStyle(e);
3455
3487
  }
3456
3488
  function xr(e) {
3457
- return G(e) ? {
3489
+ return X(e) ? {
3458
3490
  scrollLeft: e.scrollLeft,
3459
3491
  scrollTop: e.scrollTop
3460
3492
  } : {
@@ -3502,7 +3534,7 @@ function Lo(e) {
3502
3534
  };
3503
3535
  }
3504
3536
  function gn(e) {
3505
- return G(e) ? e : e.contextElement;
3537
+ return X(e) ? e : e.contextElement;
3506
3538
  }
3507
3539
  function je(e) {
3508
3540
  const t = gn(e);
@@ -3534,15 +3566,15 @@ function Me(e, t, r, o) {
3534
3566
  t === void 0 && (t = !1), r === void 0 && (r = !1);
3535
3567
  const n = e.getBoundingClientRect(), i = gn(e);
3536
3568
  let s = J(1);
3537
- t && (o ? G(o) && (s = je(o)) : s = je(e));
3569
+ t && (o ? X(o) && (s = je(o)) : s = je(e));
3538
3570
  const a = Na(i, r, o) ? Bo(i) : J(0);
3539
3571
  let c = (n.left + a.x) / s.x, d = (n.top + a.y) / s.y, u = n.width / s.x, h = n.height / s.y;
3540
3572
  if (i) {
3541
- const m = K(i), f = o && G(o) ? K(o) : o;
3573
+ const m = K(i), f = o && X(o) ? K(o) : o;
3542
3574
  let g = m, y = qr(g);
3543
3575
  for (; y && o && f !== g; ) {
3544
- const T = je(y), v = y.getBoundingClientRect(), M = Z(y), D = v.left + (y.clientLeft + parseFloat(M.paddingLeft)) * T.x, $ = v.top + (y.clientTop + parseFloat(M.paddingTop)) * T.y;
3545
- c *= T.x, d *= T.y, u *= T.x, h *= T.y, c += D, d += $, g = K(y), y = qr(g);
3576
+ const P = je(y), v = y.getBoundingClientRect(), M = Z(y), D = v.left + (y.clientLeft + parseFloat(M.paddingLeft)) * P.x, $ = v.top + (y.clientTop + parseFloat(M.paddingTop)) * P.y;
3577
+ c *= P.x, d *= P.y, u *= P.x, h *= P.y, c += D, d += $, g = K(y), y = qr(g);
3546
3578
  }
3547
3579
  }
3548
3580
  return er({
@@ -3640,7 +3672,7 @@ function Wn(e, t, r) {
3640
3672
  o = Ha(e, r);
3641
3673
  else if (t === "document")
3642
3674
  o = Ba(ee(e));
3643
- else if (G(t))
3675
+ else if (X(t))
3644
3676
  o = Fa(t, r);
3645
3677
  else {
3646
3678
  const n = Bo(e);
@@ -3655,16 +3687,16 @@ function Wn(e, t, r) {
3655
3687
  }
3656
3688
  function Fo(e, t) {
3657
3689
  const r = ce(e);
3658
- return r === t || !G(r) || et(r) ? !1 : Z(r).position === "fixed" || Fo(r, t);
3690
+ return r === t || !X(r) || et(r) ? !1 : Z(r).position === "fixed" || Fo(r, t);
3659
3691
  }
3660
3692
  function Ka(e, t) {
3661
3693
  const r = t.get(e);
3662
3694
  if (r)
3663
3695
  return r;
3664
- let o = bt(e, [], !1).filter((a) => G(a) && ut(a) !== "body"), n = null;
3696
+ let o = bt(e, [], !1).filter((a) => X(a) && ut(a) !== "body"), n = null;
3665
3697
  const i = Z(e).position === "fixed";
3666
3698
  let s = i ? ce(e) : e;
3667
- for (; G(s) && !et(s); ) {
3699
+ for (; X(s) && !et(s); ) {
3668
3700
  const a = Z(s), c = fn(s);
3669
3701
  !c && a.position === "fixed" && (n = null), (i ? !c && !n : !c && a.position === "static" && !!n && (n.position === "absolute" || n.position === "fixed") || Et(s) && !c && Fo(e, s)) ? o = o.filter((u) => u !== s) : n = a, s = ce(s);
3670
3702
  }
@@ -3742,7 +3774,7 @@ function Ko(e, t) {
3742
3774
  if (!oe(e)) {
3743
3775
  let n = ce(e);
3744
3776
  for (; n && !et(n); ) {
3745
- if (G(n) && !Fr(n))
3777
+ if (X(n) && !Fr(n))
3746
3778
  return n;
3747
3779
  n = ce(n);
3748
3780
  }
@@ -3751,7 +3783,7 @@ function Ko(e, t) {
3751
3783
  let o = Vn(e, t);
3752
3784
  for (; o && Ea(o) && Fr(o); )
3753
3785
  o = Vn(o, t);
3754
- return o && et(o) && Fr(o) && !fn(o) ? r : o || Ra(e) || r;
3786
+ return o && et(o) && Fr(o) && !fn(o) ? r : o || Ia(e) || r;
3755
3787
  }
3756
3788
  const Va = async function(e) {
3757
3789
  const t = this.getOffsetParent || Ko, r = this.getDimensions, o = await r(e.floating);
@@ -3777,13 +3809,13 @@ const Ua = {
3777
3809
  getClientRects: La,
3778
3810
  getDimensions: za,
3779
3811
  getScale: je,
3780
- isElement: G,
3812
+ isElement: X,
3781
3813
  isRTL: qa
3782
3814
  };
3783
3815
  function jo(e, t) {
3784
3816
  return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
3785
3817
  }
3786
- function Xa(e, t) {
3818
+ function Ga(e, t) {
3787
3819
  let r = null, o;
3788
3820
  const n = ee(e);
3789
3821
  function i() {
@@ -3800,8 +3832,8 @@ function Xa(e, t) {
3800
3832
  } = d;
3801
3833
  if (a || t(), !m || !f)
3802
3834
  return;
3803
- const g = Bt(h), y = Bt(n.clientWidth - (u + m)), T = Bt(n.clientHeight - (h + f)), v = Bt(u), D = {
3804
- rootMargin: -g + "px " + -y + "px " + -T + "px " + -v + "px",
3835
+ const g = Bt(h), y = Bt(n.clientWidth - (u + m)), P = Bt(n.clientHeight - (h + f)), v = Bt(u), D = {
3836
+ rootMargin: -g + "px " + -y + "px " + -P + "px " + -v + "px",
3805
3837
  threshold: ke(0, Yt(1, c)) || 1
3806
3838
  };
3807
3839
  let $ = !0;
@@ -3829,7 +3861,7 @@ function Xa(e, t) {
3829
3861
  }
3830
3862
  return s(!0), i;
3831
3863
  }
3832
- function Ga(e, t, r, o) {
3864
+ function Xa(e, t, r, o) {
3833
3865
  o === void 0 && (o = {});
3834
3866
  const {
3835
3867
  ancestorScroll: n = !0,
@@ -3843,7 +3875,7 @@ function Ga(e, t, r, o) {
3843
3875
  passive: !0
3844
3876
  }), i && v.addEventListener("resize", r);
3845
3877
  });
3846
- const h = d && a ? Xa(d, r) : null;
3878
+ const h = d && a ? Ga(d, r) : null;
3847
3879
  let m = -1, f = null;
3848
3880
  s && (f = new ResizeObserver((v) => {
3849
3881
  let [M] = v;
@@ -3853,10 +3885,10 @@ function Ga(e, t, r, o) {
3853
3885
  })), r();
3854
3886
  }), d && !c && f.observe(d), t && f.observe(t));
3855
3887
  let g, y = c ? Me(e) : null;
3856
- c && T();
3857
- function T() {
3888
+ c && P();
3889
+ function P() {
3858
3890
  const v = Me(e);
3859
- y && !jo(y, v) && r(), y = v, g = requestAnimationFrame(T);
3891
+ y && !jo(y, v) && r(), y = v, g = requestAnimationFrame(P);
3860
3892
  }
3861
3893
  return r(), () => {
3862
3894
  var v;
@@ -3865,7 +3897,7 @@ function Ga(e, t, r, o) {
3865
3897
  }), h?.(), (v = f) == null || v.disconnect(), f = null, c && cancelAnimationFrame(g);
3866
3898
  };
3867
3899
  }
3868
- const Za = Ma, Ya = Oa, Ja = Pa, Qa = (e, t, r) => {
3900
+ const Za = Ma, Ya = Oa, Ja = Ta, Qa = (e, t, r) => {
3869
3901
  const o = /* @__PURE__ */ new Map(), n = {
3870
3902
  platform: Ua,
3871
3903
  ...r
@@ -3873,7 +3905,7 @@ const Za = Ma, Ya = Oa, Ja = Pa, Qa = (e, t, r) => {
3873
3905
  ...n.platform,
3874
3906
  _c: o
3875
3907
  };
3876
- return Ta(e, t, {
3908
+ return Pa(e, t, {
3877
3909
  ...n,
3878
3910
  platform: i
3879
3911
  });
@@ -3922,14 +3954,14 @@ function Un(e, t, r = "top", o = !1, n) {
3922
3954
  e.setAttribute("aria-describedby", vt);
3923
3955
  } catch {
3924
3956
  }
3925
- await qn(r), O.dataset.visible = "true", tr?.(), tr = Ga(e, O, () => {
3957
+ await qn(r), O.dataset.visible = "true", tr?.(), tr = Xa(e, O, () => {
3926
3958
  qn(r);
3927
3959
  });
3928
3960
  }
3929
3961
  };
3930
3962
  o ? s() : Kt = setTimeout(s, 80);
3931
3963
  }
3932
- function Xn(e = !1) {
3964
+ function Gn(e = !1) {
3933
3965
  if (!O)
3934
3966
  return;
3935
3967
  zo();
@@ -4024,7 +4056,7 @@ de = Dt([
4024
4056
  changeDetection: k.OnPush
4025
4057
  })
4026
4058
  ], de);
4027
- var ol = Object.defineProperty, il = Object.getOwnPropertyDescriptor, It = (e, t, r, o) => {
4059
+ var ol = Object.defineProperty, il = Object.getOwnPropertyDescriptor, Rt = (e, t, r, o) => {
4028
4060
  for (var n = o > 1 ? void 0 : o ? il(t, r) : t, i = e.length - 1, s; i >= 0; i--)
4029
4061
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
4030
4062
  return o && n && ol(t, r, n), n;
@@ -4076,31 +4108,31 @@ let Oe = class {
4076
4108
  this.syncTooltip();
4077
4109
  }
4078
4110
  ngOnDestroy() {
4079
- this.hovering && Xn(!0);
4111
+ this.hovering && Gn(!0);
4080
4112
  }
4081
4113
  onAnchorEnter() {
4082
4114
  this.resolvedShowTooltip && (this.hovering = !0, Un(this.anchorRef?.nativeElement || null, this.title, "top", !1, this.context?.isDark));
4083
4115
  }
4084
4116
  onAnchorLeave() {
4085
- this.resolvedShowTooltip && (this.hovering = !1, Xn());
4117
+ this.resolvedShowTooltip && (this.hovering = !1, Gn());
4086
4118
  }
4087
4119
  syncTooltip() {
4088
4120
  !this.hovering || !this.resolvedShowTooltip || Un(this.anchorRef?.nativeElement || null, this.title, "top", !0, this.context?.isDark);
4089
4121
  }
4090
4122
  };
4091
- It([
4123
+ Rt([
4092
4124
  j("anchorEl")
4093
4125
  ], Oe.prototype, "anchorRef", 2);
4094
- It([
4126
+ Rt([
4095
4127
  l({ required: !0 })
4096
4128
  ], Oe.prototype, "node", 2);
4097
- It([
4129
+ Rt([
4098
4130
  l()
4099
4131
  ], Oe.prototype, "context", 2);
4100
- It([
4132
+ Rt([
4101
4133
  l()
4102
4134
  ], Oe.prototype, "indexKey", 2);
4103
- Oe = It([
4135
+ Oe = Rt([
4104
4136
  b({
4105
4137
  selector: "markstream-angular-link-node",
4106
4138
  standalone: !0,
@@ -4152,7 +4184,7 @@ Oe = It([
4152
4184
  changeDetection: k.OnPush
4153
4185
  })
4154
4186
  ], Oe);
4155
- var sl = Object.defineProperty, al = Object.getOwnPropertyDescriptor, Rt = (e, t, r, o) => {
4187
+ var sl = Object.defineProperty, al = Object.getOwnPropertyDescriptor, It = (e, t, r, o) => {
4156
4188
  for (var n = o > 1 ? void 0 : o ? al(t, r) : t, i = e.length - 1, s; i >= 0; i--)
4157
4189
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
4158
4190
  return o && n && sl(t, r, n), n;
@@ -4165,19 +4197,19 @@ let ue = class {
4165
4197
  return `${this.indexKey || "list-item"}-item`;
4166
4198
  }
4167
4199
  };
4168
- Rt([
4200
+ It([
4169
4201
  l({ required: !0 })
4170
4202
  ], ue.prototype, "node", 2);
4171
- Rt([
4203
+ It([
4172
4204
  l()
4173
4205
  ], ue.prototype, "context", 2);
4174
- Rt([
4206
+ It([
4175
4207
  l()
4176
4208
  ], ue.prototype, "indexKey", 2);
4177
- Rt([
4209
+ It([
4178
4210
  l()
4179
4211
  ], ue.prototype, "value", 2);
4180
- ue = Rt([
4212
+ ue = It([
4181
4213
  b({
4182
4214
  selector: "markstream-angular-list-item-node",
4183
4215
  standalone: !0,
@@ -4338,7 +4370,7 @@ function kt() {
4338
4370
  } catch {
4339
4371
  }
4340
4372
  }
4341
- function Xo(e, t, r) {
4373
+ function Go(e, t, r) {
4342
4374
  if (gt.set(`${t ? "d" : "i"}:${e}`, r), gt.size > ul) {
4343
4375
  const o = gt.keys().next().value;
4344
4376
  o && gt.delete(o);
@@ -4352,7 +4384,7 @@ function gd(e) {
4352
4384
  a.reject(new Error(n));
4353
4385
  return;
4354
4386
  }
4355
- i && Xo(String(i), !!s, String(o || "")), a.resolve(String(o || ""));
4387
+ i && Go(String(i), !!s, String(o || "")), a.resolve(String(o || ""));
4356
4388
  }
4357
4389
  }, U.onerror = (t) => {
4358
4390
  for (const [, r] of F.entries())
@@ -4418,7 +4450,7 @@ async function ml(e, t = !0, r = 2e3, o) {
4418
4450
  });
4419
4451
  }
4420
4452
  function xn(e, t = !0, r) {
4421
- Xo(e, t, r);
4453
+ Go(e, t, r);
4422
4454
  }
4423
4455
  function wd() {
4424
4456
  return {
@@ -4574,7 +4606,7 @@ var vl = Object.defineProperty, wl = Object.getOwnPropertyDescriptor, Cn = (e, t
4574
4606
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
4575
4607
  return o && n && vl(t, r, n), n;
4576
4608
  };
4577
- let Tt = class {
4609
+ let Pt = class {
4578
4610
  constructor() {
4579
4611
  this.cdr = Q(De), this.loading = !0, this.destroyed = !1, this.renderVersion = 0, this.hasRenderedOnce = !1;
4580
4612
  }
@@ -4634,11 +4666,11 @@ let Tt = class {
4634
4666
  };
4635
4667
  Cn([
4636
4668
  j("mathRef")
4637
- ], Tt.prototype, "mathRef", 2);
4669
+ ], Pt.prototype, "mathRef", 2);
4638
4670
  Cn([
4639
4671
  l({ required: !0 })
4640
- ], Tt.prototype, "node", 2);
4641
- Tt = Cn([
4672
+ ], Pt.prototype, "node", 2);
4673
+ Pt = Cn([
4642
4674
  b({
4643
4675
  selector: "markstream-angular-math-inline-node",
4644
4676
  standalone: !0,
@@ -4654,9 +4686,9 @@ Tt = Cn([
4654
4686
  `,
4655
4687
  changeDetection: k.OnPush
4656
4688
  })
4657
- ], Tt);
4658
- const Go = () => import("mermaid"), Tn = "__MARKSTREAM_ANGULAR_MERMAID__";
4659
- let q = null, yt = !1, Xr = null, Fe = null, Pn = Go;
4689
+ ], Pt);
4690
+ const Xo = () => import("mermaid"), Pn = "__MARKSTREAM_ANGULAR_MERMAID__";
4691
+ let q = null, yt = !1, Gr = null, Fe = null, Tn = Xo;
4660
4692
  function xl(e) {
4661
4693
  const t = String(e?.securityLevel ?? "loose"), r = e?.flowchart?.htmlLabels;
4662
4694
  return `${t}|htmlLabels:${r === !1 ? "0" : "1"}`;
@@ -4678,7 +4710,7 @@ function Zo(e) {
4678
4710
  }
4679
4711
  return e?.mermaid && typeof e.mermaid.render == "function" ? e.mermaid : t;
4680
4712
  }
4681
- function Gn(e) {
4713
+ function Xn(e) {
4682
4714
  if (e)
4683
4715
  try {
4684
4716
  const t = e?.initialize;
@@ -4696,64 +4728,64 @@ function Ht(e, t) {
4696
4728
  if (!e || !t)
4697
4729
  return;
4698
4730
  const r = xl(t);
4699
- if (Xr !== r)
4731
+ if (Gr !== r)
4700
4732
  try {
4701
- typeof e.initialize == "function" ? e.initialize(t) : e.mermaidAPI?.initialize && e.mermaidAPI.initialize(t), Xr = r;
4733
+ typeof e.initialize == "function" ? e.initialize(t) : e.mermaidAPI?.initialize && e.mermaidAPI.initialize(t), Gr = r;
4702
4734
  } catch {
4703
4735
  }
4704
4736
  }
4705
4737
  function bl() {
4706
4738
  try {
4707
4739
  const e = globalThis;
4708
- return Zo(e?.[Tn] ?? e?.mermaid);
4740
+ return Zo(e?.[Pn] ?? e?.mermaid);
4709
4741
  } catch {
4710
4742
  return null;
4711
4743
  }
4712
4744
  }
4713
4745
  function Zn(e) {
4714
4746
  try {
4715
- globalThis[Tn] = e;
4747
+ globalThis[Pn] = e;
4716
4748
  } catch {
4717
4749
  }
4718
4750
  }
4719
4751
  function kl() {
4720
- q = null, yt = !1, Xr = null, Fe = null;
4752
+ q = null, yt = !1, Gr = null, Fe = null;
4721
4753
  try {
4722
- delete globalThis[Tn];
4754
+ delete globalThis[Pn];
4723
4755
  } catch {
4724
4756
  }
4725
4757
  }
4726
4758
  function Yo(e) {
4727
- Pn = e, kl();
4759
+ Tn = e, kl();
4728
4760
  }
4729
- function Td(e) {
4730
- Yo(e ?? Go);
4761
+ function Pd(e) {
4762
+ Yo(e ?? Xo);
4731
4763
  }
4732
- function Pd() {
4764
+ function Td() {
4733
4765
  Yo(null);
4734
4766
  }
4735
4767
  function Cl() {
4736
- return typeof Pn == "function";
4768
+ return typeof Tn == "function";
4737
4769
  }
4738
4770
  async function Jo(e) {
4739
4771
  if (q)
4740
4772
  return Ht(q, e), q;
4741
4773
  const t = bl();
4742
4774
  if (t)
4743
- return Gn(t), q = t, Zn(q), Ht(q, e), q;
4775
+ return Xn(t), q = t, Zn(q), Ht(q, e), q;
4744
4776
  if (Fe) {
4745
4777
  const o = await Fe;
4746
4778
  return o && Ht(o, e), o;
4747
4779
  }
4748
4780
  if (yt)
4749
4781
  return null;
4750
- const r = Pn;
4782
+ const r = Tn;
4751
4783
  if (!r)
4752
4784
  return yt = !0, null;
4753
4785
  Fe = (async () => {
4754
4786
  try {
4755
4787
  const o = await r(), n = Zo(o);
4756
- return n ? (Gn(n), q = n, Zn(q), q) : (yt = !0, null);
4788
+ return n ? (Xn(n), q = n, Zn(q), q) : (yt = !0, null);
4757
4789
  } catch {
4758
4790
  return yt = !0, null;
4759
4791
  }
@@ -4777,7 +4809,7 @@ function Sd(e) {
4777
4809
  function Md() {
4778
4810
  return { inFlight: N.size, max: rr };
4779
4811
  }
4780
- const Tl = "WORKER_BUSY", Pl = "MERMAID_DISABLED";
4812
+ const Pl = "WORKER_BUSY", Tl = "MERMAID_DISABLED";
4781
4813
  function Od(e) {
4782
4814
  L = e, le = null;
4783
4815
  const t = e;
@@ -4828,7 +4860,7 @@ function _l() {
4828
4860
  function ei(e, t, r = 1400) {
4829
4861
  if (!Cl()) {
4830
4862
  const n = new Error("Mermaid rendering disabled");
4831
- return n.name = "MermaidDisabled", n.code = Pl, Promise.reject(n);
4863
+ return n.name = "MermaidDisabled", n.code = Tl, Promise.reject(n);
4832
4864
  }
4833
4865
  if (le)
4834
4866
  return Promise.reject(le);
@@ -4837,7 +4869,7 @@ function ei(e, t, r = 1400) {
4837
4869
  return Promise.reject(le);
4838
4870
  if (N.size >= rr) {
4839
4871
  const n = new Error("Worker busy");
4840
- return n.name = "WorkerBusy", n.code = Tl, n.inFlight = N.size, n.max = rr, Promise.reject(n);
4872
+ return n.name = "WorkerBusy", n.code = Pl, n.inFlight = N.size, n.max = rr, Promise.reject(n);
4841
4873
  }
4842
4874
  return new Promise((n, i) => {
4843
4875
  const s = Math.random().toString(36).slice(2);
@@ -5044,18 +5076,19 @@ let ne = class {
5044
5076
  let n = e;
5045
5077
  if (this.resolvedLoading && this.resolvedProgressiveRender)
5046
5078
  try {
5047
- await this.canParseWithFallback(e, o, r, t);
5048
- } catch (u) {
5049
- if (u?.name === "AbortError")
5050
- return;
5051
- const h = await this.findPrefixCandidate(e, o, t);
5079
+ const u = await this.canParseOrPrefix(e, o, r, t);
5052
5080
  if (this.destroyed || t !== this.renderToken)
5053
5081
  return;
5054
- if (!h) {
5082
+ if (!u.fullOk && !u.prefix) {
5055
5083
  this.rendering = !1, this.cdr.markForCheck();
5056
5084
  return;
5057
5085
  }
5058
- n = h;
5086
+ u.prefix && (n = u.prefix);
5087
+ } catch (u) {
5088
+ if (u?.name === "AbortError")
5089
+ return;
5090
+ this.rendering = !1, this.cdr.markForCheck();
5091
+ return;
5059
5092
  }
5060
5093
  const i = `markstream-angular-mermaid-${++Yn}`, s = this.applyThemeTo(n, o), a = await Ol(() => this.withTimeout(
5061
5094
  () => Promise.resolve(r.render(i, s)),
@@ -5063,13 +5096,20 @@ let ne = class {
5063
5096
  ));
5064
5097
  if (this.destroyed || t !== this.renderToken)
5065
5098
  return;
5066
- const c = typeof a == "string" ? a : a?.svg, d = cn(c);
5099
+ const c = typeof a == "string" ? a : a?.svg;
5100
+ if (this.isBrokenMermaidSvg(c))
5101
+ throw new Error("Mermaid produced invalid SVG during preview");
5102
+ const d = cn(c);
5067
5103
  if (!d)
5068
5104
  throw new Error("Mermaid returned empty output.");
5069
5105
  this.svgMarkup = d, this.svgMarkup || (this.showSource = !0), this.syncSvgHosts();
5070
5106
  } catch (r) {
5071
5107
  if (this.destroyed || t !== this.renderToken)
5072
5108
  return;
5109
+ if (this.resolvedLoading && this.resolvedProgressiveRender) {
5110
+ this.svgMarkup = "", this.syncSvgHosts();
5111
+ return;
5112
+ }
5073
5113
  const o = this.mergedProps.onRenderError;
5074
5114
  if (typeof o == "function" && this.previewHost?.nativeElement && o(r, this.code, this.previewHost.nativeElement) === !0) {
5075
5115
  this.svgMarkup = "";
@@ -5114,6 +5154,28 @@ let ne = class {
5114
5154
  throw new DOMException("Aborted", "AbortError");
5115
5155
  return !0;
5116
5156
  }
5157
+ async canParseOrPrefix(e, t, r, o) {
5158
+ if (this.getMermaidDiagramKind(e) === "gantt") {
5159
+ const i = this.getSafePrefixCandidate(e);
5160
+ if (!i.trim())
5161
+ return { fullOk: !1, prefix: "" };
5162
+ if (await this.canParseWithFallback(i, t, r, o), this.destroyed || o !== this.renderToken)
5163
+ throw new DOMException("Aborted", "AbortError");
5164
+ return i === e ? { fullOk: !0, prefix: "" } : { fullOk: !1, prefix: i };
5165
+ }
5166
+ try {
5167
+ return await this.canParseWithFallback(e, t, r, o), { fullOk: !0, prefix: "" };
5168
+ } catch (i) {
5169
+ if (i?.name === "AbortError")
5170
+ throw i;
5171
+ }
5172
+ const n = await this.findPrefixCandidate(e, t, o);
5173
+ if (!n)
5174
+ return { fullOk: !1, prefix: "" };
5175
+ if (await this.canParseWithFallback(n, t, r, o), this.destroyed || o !== this.renderToken)
5176
+ throw new DOMException("Aborted", "AbortError");
5177
+ return { fullOk: !1, prefix: n };
5178
+ }
5117
5179
  async findPrefixCandidate(e, t, r) {
5118
5180
  try {
5119
5181
  const o = await ri(e, t, this.resolvedWorkerTimeout);
@@ -5130,8 +5192,38 @@ let ne = class {
5130
5192
  applyThemeTo(e, t) {
5131
5193
  return e.trimStart().startsWith("%%{") ? e : `%%{init: {"theme": "${t === "dark" ? "dark" : "default"}"}}%%
5132
5194
  ${e}`;
5195
+ }
5196
+ getMermaidDiagramKind(e) {
5197
+ for (const t of e.split(/\r?\n/)) {
5198
+ const r = t.trim();
5199
+ if (!r || r.startsWith("%%"))
5200
+ continue;
5201
+ return r.match(/^([A-Z][\w-]*)\b/i)?.[1]?.toLowerCase() || "";
5202
+ }
5203
+ return "";
5204
+ }
5205
+ isGanttTaskLine(e) {
5206
+ const t = e.trim();
5207
+ return !t || t.startsWith("%%") || /^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t) ? !1 : t.includes(":");
5208
+ }
5209
+ getSafeGanttPreviewCandidate(e) {
5210
+ const t = e.split(/\r?\n/);
5211
+ for (!/\r?\n$/.test(e) && t.length > 0 && t.pop(); t.length > 0; ) {
5212
+ const r = t[t.length - 1]?.trim();
5213
+ if (!r || r.startsWith("%%")) {
5214
+ t.pop();
5215
+ continue;
5216
+ }
5217
+ if (this.isGanttTaskLine(r))
5218
+ break;
5219
+ t.pop();
5220
+ }
5221
+ return t.some((r) => this.isGanttTaskLine(r)) ? t.join(`
5222
+ `) : "";
5133
5223
  }
5134
5224
  getSafePrefixCandidate(e) {
5225
+ if (this.getMermaidDiagramKind(e) === "gantt")
5226
+ return this.getSafeGanttPreviewCandidate(e);
5135
5227
  const t = e.split(`
5136
5228
  `);
5137
5229
  for (; t.length > 0; ) {
@@ -5147,6 +5239,28 @@ ${e}`;
5147
5239
  return t.join(`
5148
5240
  `);
5149
5241
  }
5242
+ isBrokenMermaidSvg(e) {
5243
+ if (!e || typeof DOMParser > "u")
5244
+ return !e;
5245
+ const r = new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
5246
+ if (!r || r.nodeName.toLowerCase() !== "svg")
5247
+ return !0;
5248
+ const o = r.getAttribute("viewBox");
5249
+ if (o) {
5250
+ const i = o.trim().split(/[\s,]+/);
5251
+ if (i.length === 4) {
5252
+ const s = Number.parseFloat(i[2] || ""), a = Number.parseFloat(i[3] || "");
5253
+ if (!Number.isFinite(s) || !Number.isFinite(a) || s <= 0 || a <= 0)
5254
+ return !0;
5255
+ }
5256
+ }
5257
+ const n = [r, ...Array.from(r.querySelectorAll("*"))];
5258
+ for (const i of n)
5259
+ for (const s of Array.from(i.attributes))
5260
+ if (/\bNaN\b/i.test(s.value) || s.name === "style" && /max-width:\s*0(?:px)?/i.test(s.value))
5261
+ return !0;
5262
+ return !1;
5263
+ }
5150
5264
  withTimeout(e, t) {
5151
5265
  return new Promise((r, o) => {
5152
5266
  let n = !1;
@@ -5336,7 +5450,7 @@ let rt = class {
5336
5450
  return E(this.node?.children);
5337
5451
  }
5338
5452
  ngOnChanges() {
5339
- this.segments = Xi(this.children).map((e) => {
5453
+ this.segments = Gi(this.children).map((e) => {
5340
5454
  if (e.kind === "block")
5341
5455
  return e;
5342
5456
  const t = fo(e.nodes);
@@ -5428,10 +5542,10 @@ rt = Cr([
5428
5542
  changeDetection: k.OnPush
5429
5543
  })
5430
5544
  ], rt);
5431
- var Il = Object.defineProperty, Rl = Object.getOwnPropertyDescriptor, ni = (e, t, r, o) => {
5432
- for (var n = o > 1 ? void 0 : o ? Rl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5545
+ var Rl = Object.defineProperty, Il = Object.getOwnPropertyDescriptor, ni = (e, t, r, o) => {
5546
+ for (var n = o > 1 ? void 0 : o ? Il(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5433
5547
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5434
- return o && n && Il(t, r, n), n;
5548
+ return o && n && Rl(t, r, n), n;
5435
5549
  };
5436
5550
  let nr = class {
5437
5551
  get id() {
@@ -5481,7 +5595,7 @@ function Al(e, t) {
5481
5595
  const r = oi(e, t);
5482
5596
  return r === "mermaid" ? t?.mermaidProps ?? null : r === "d2" ? t?.d2Props ?? null : r === "infographic" ? t?.infographicProps ?? null : t?.codeBlockProps ?? null;
5483
5597
  }
5484
- var Ll = Object.defineProperty, Bl = Object.getOwnPropertyDescriptor, Tr = (e, t, r, o) => {
5598
+ var Ll = Object.defineProperty, Bl = Object.getOwnPropertyDescriptor, Pr = (e, t, r, o) => {
5485
5599
  for (var n = o > 1 ? void 0 : o ? Bl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5486
5600
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5487
5601
  return o && n && Ll(t, r, n), n;
@@ -5494,16 +5608,16 @@ let nt = class {
5494
5608
  return `${this.indexKey || "strikethrough"}-strike`;
5495
5609
  }
5496
5610
  };
5497
- Tr([
5611
+ Pr([
5498
5612
  l({ required: !0 })
5499
5613
  ], nt.prototype, "node", 2);
5500
- Tr([
5614
+ Pr([
5501
5615
  l()
5502
5616
  ], nt.prototype, "context", 2);
5503
- Tr([
5617
+ Pr([
5504
5618
  l()
5505
5619
  ], nt.prototype, "indexKey", 2);
5506
- nt = Tr([
5620
+ nt = Pr([
5507
5621
  b({
5508
5622
  selector: "markstream-angular-strikethrough-node",
5509
5623
  standalone: !0,
@@ -5520,7 +5634,7 @@ nt = Tr([
5520
5634
  changeDetection: k.OnPush
5521
5635
  })
5522
5636
  ], nt);
5523
- var Hl = Object.defineProperty, Fl = Object.getOwnPropertyDescriptor, Pr = (e, t, r, o) => {
5637
+ var Hl = Object.defineProperty, Fl = Object.getOwnPropertyDescriptor, Tr = (e, t, r, o) => {
5524
5638
  for (var n = o > 1 ? void 0 : o ? Fl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5525
5639
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5526
5640
  return o && n && Hl(t, r, n), n;
@@ -5533,16 +5647,16 @@ let ot = class {
5533
5647
  return `${this.indexKey || "strong"}-strong`;
5534
5648
  }
5535
5649
  };
5536
- Pr([
5650
+ Tr([
5537
5651
  l({ required: !0 })
5538
5652
  ], ot.prototype, "node", 2);
5539
- Pr([
5653
+ Tr([
5540
5654
  l()
5541
5655
  ], ot.prototype, "context", 2);
5542
- Pr([
5656
+ Tr([
5543
5657
  l()
5544
5658
  ], ot.prototype, "indexKey", 2);
5545
- ot = Pr([
5659
+ ot = Tr([
5546
5660
  b({
5547
5661
  selector: "markstream-angular-strong-node",
5548
5662
  standalone: !0,
@@ -5713,25 +5827,25 @@ at = Mr([
5713
5827
  changeDetection: k.OnPush
5714
5828
  })
5715
5829
  ], at);
5716
- var Ul = Object.getOwnPropertyDescriptor, Xl = (e, t, r, o) => {
5830
+ var Ul = Object.getOwnPropertyDescriptor, Gl = (e, t, r, o) => {
5717
5831
  for (var n = o > 1 ? void 0 : o ? Ul(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5718
5832
  (s = e[i]) && (n = s(n) || n);
5719
5833
  return n;
5720
5834
  };
5721
- let Gr = class {
5835
+ let Xr = class {
5722
5836
  };
5723
- Gr = Xl([
5837
+ Xr = Gl([
5724
5838
  b({
5725
5839
  selector: "markstream-angular-thematic-break-node",
5726
5840
  standalone: !0,
5727
5841
  template: "<hr>",
5728
5842
  changeDetection: k.OnPush
5729
5843
  })
5730
- ], Gr);
5731
- var Gl = Object.defineProperty, Zl = Object.getOwnPropertyDescriptor, Or = (e, t, r, o) => {
5844
+ ], Xr);
5845
+ var Xl = Object.defineProperty, Zl = Object.getOwnPropertyDescriptor, Or = (e, t, r, o) => {
5732
5846
  for (var n = o > 1 ? void 0 : o ? Zl(t, r) : t, i = e.length - 1, s; i >= 0; i--)
5733
5847
  (s = e[i]) && (n = (o ? s(t, r, n) : s(n)) || n);
5734
- return o && n && Gl(t, r, n), n;
5848
+ return o && n && Xl(t, r, n), n;
5735
5849
  };
5736
5850
  let lt = class {
5737
5851
  get children() {
@@ -5817,7 +5931,7 @@ let he = class {
5817
5931
  if (e !== "html_block" && e !== "html_inline")
5818
5932
  return !1;
5819
5933
  const t = this.htmlTag;
5820
- return !(!t || (this.context?.customHtmlTags ?? []).some((n) => String(n).toLowerCase() === t) || Ci.has(t) || Ti(this.node?.content ?? this.node?.raw, t));
5934
+ return !(!t || (this.context?.customHtmlTags ?? []).some((n) => String(n).toLowerCase() === t) || Ci.has(t) || Pi(this.node?.content ?? this.node?.raw, t));
5821
5935
  }
5822
5936
  /**
5823
5937
  * Returns a text node for incomplete non-whitelisted, non-standard HTML tags.
@@ -5858,18 +5972,18 @@ he = Er([
5858
5972
  p(() => ct),
5859
5973
  p(() => We),
5860
5974
  p(() => qt),
5861
- p(() => Te),
5862
5975
  p(() => Pe),
5976
+ p(() => Te),
5863
5977
  p(() => Ve),
5864
5978
  p(() => te),
5865
5979
  p(() => Ut),
5866
5980
  p(() => qe),
5867
5981
  p(() => Ue),
5868
- p(() => Xt),
5869
- p(() => Xe),
5870
5982
  p(() => Gt),
5871
- p(() => Wr),
5872
5983
  p(() => Ge),
5984
+ p(() => Xt),
5985
+ p(() => Wr),
5986
+ p(() => Xe),
5873
5987
  p(() => Ze),
5874
5988
  p(() => Ye),
5875
5989
  p(() => Je),
@@ -5881,7 +5995,7 @@ he = Er([
5881
5995
  p(() => ue),
5882
5996
  p(() => tt),
5883
5997
  p(() => Ct),
5884
- p(() => Tt),
5998
+ p(() => Pt),
5885
5999
  p(() => ne),
5886
6000
  p(() => rt),
5887
6001
  p(() => wt),
@@ -5892,7 +6006,7 @@ he = Er([
5892
6006
  p(() => st),
5893
6007
  p(() => at),
5894
6008
  p(() => de),
5895
- p(() => Gr),
6009
+ p(() => Xr),
5896
6010
  p(() => lt)
5897
6011
  ],
5898
6012
  template: `
@@ -6334,7 +6448,7 @@ async function ac(e, t, r, o) {
6334
6448
  const a = s.parentElement, c = (s.textContent || "").trim();
6335
6449
  if (!a || !c)
6336
6450
  continue;
6337
- const d = a.cloneNode(!0), u = Ir(
6451
+ const d = a.cloneNode(!0), u = Rr(
6338
6452
  "mermaid",
6339
6453
  "Mermaid",
6340
6454
  c,
@@ -6351,8 +6465,8 @@ async function ac(e, t, r, o) {
6351
6465
  if (r.final === !1)
6352
6466
  try {
6353
6467
  await lc(c, h, n, r);
6354
- } catch (T) {
6355
- if (T?.name === "AbortError")
6468
+ } catch (P) {
6469
+ if (P?.name === "AbortError")
6356
6470
  return;
6357
6471
  const v = await cc(c, h, r);
6358
6472
  if (!o())
@@ -6451,7 +6565,7 @@ async function uc(e, t, r, o) {
6451
6565
  const a = s.parentElement, c = s.textContent || "";
6452
6566
  if (!a || !c.trim())
6453
6567
  continue;
6454
- const d = a.cloneNode(!0), u = Ir("infographic", "Infographic", c, !0, r, {
6568
+ const d = a.cloneNode(!0), u = Rr("infographic", "Infographic", c, !0, r, {
6455
6569
  showHeader: r.infographicProps?.showHeader !== !1
6456
6570
  });
6457
6571
  u.body.style.minHeight = "320px", u.body.style.height = "360px", a.replaceWith(u.wrapper);
@@ -6485,7 +6599,7 @@ async function hc(e, t, r, o) {
6485
6599
  const a = s.parentElement, c = s.textContent || "";
6486
6600
  if (!a || !c.trim())
6487
6601
  continue;
6488
- const d = a.cloneNode(!0), u = Ir("d2", "D2", c, !0, r, {
6602
+ const d = a.cloneNode(!0), u = Rr("d2", "D2", c, !0, r, {
6489
6603
  showHeader: r.d2Props?.showHeader !== !1
6490
6604
  });
6491
6605
  a.replaceWith(u.wrapper);
@@ -6493,8 +6607,8 @@ async function hc(e, t, r, o) {
6493
6607
  const h = fc(n);
6494
6608
  if (!h || typeof h.compile != "function" || typeof h.render != "function")
6495
6609
  throw new TypeError("D2 instance is missing compile/render methods.");
6496
- const m = await h.compile(c), f = m?.diagram ?? m, g = m?.renderOptions ?? m?.options ?? {}, y = r.d2ThemeId ?? g.themeID, T = r.d2DarkThemeId ?? g.darkThemeID, v = { ...g };
6497
- if (v.themeID = r.isDark && T != null ? T : y, v.darkThemeID = null, v.darkThemeOverrides = null, r.isDark) {
6610
+ const m = await h.compile(c), f = m?.diagram ?? m, g = m?.renderOptions ?? m?.options ?? {}, y = r.d2ThemeId ?? g.themeID, P = r.d2DarkThemeId ?? g.darkThemeID, v = { ...g };
6611
+ if (v.themeID = r.isDark && P != null ? P : y, v.darkThemeID = null, v.darkThemeOverrides = null, r.isDark) {
6498
6612
  const $ = g.themeOverrides && typeof g.themeOverrides == "object" ? g.themeOverrides : null;
6499
6613
  v.themeOverrides = {
6500
6614
  ...nc,
@@ -6504,7 +6618,7 @@ async function hc(e, t, r, o) {
6504
6618
  const M = await h.render(f, v);
6505
6619
  if (!o())
6506
6620
  return;
6507
- const D = cn(To(M));
6621
+ const D = cn(Po(M));
6508
6622
  if (!D)
6509
6623
  throw new Error("D2 render returned empty output.");
6510
6624
  u.body.innerHTML = D, u.wrapper.dataset.markstreamD2 = "1", t.push(() => {
@@ -6529,7 +6643,7 @@ async function mc(e, t, r, o) {
6529
6643
  const c = pc(s, a), d = c.trim().toLowerCase();
6530
6644
  if (d === "mermaid" || d === "infographic" || d === "d2" || d === "d2lang")
6531
6645
  continue;
6532
- const u = a.textContent || "", h = s.dataset.markstreamDiff === "1", m = vc(s.dataset.markstreamUpdated), f = gc(c), g = h ? "plaintext" : f, y = Ir(
6646
+ const u = a.textContent || "", h = s.dataset.markstreamDiff === "1", m = vc(s.dataset.markstreamUpdated), f = gc(c), g = h ? "plaintext" : f, y = Rr(
6533
6647
  "code",
6534
6648
  h ? `Diff / ${f}` : `Code / ${f}`,
6535
6649
  u,
@@ -6540,7 +6654,7 @@ async function mc(e, t, r, o) {
6540
6654
  }
6541
6655
  );
6542
6656
  y.body.classList.add("markstream-angular-enhanced-block__body--code"), y.body.style.minHeight = `${yc(h && m || u, h)}px`;
6543
- const T = s.cloneNode(!0);
6657
+ const P = s.cloneNode(!0);
6544
6658
  s.replaceWith(y.wrapper);
6545
6659
  const v = n.useMonaco({
6546
6660
  themes: ["vitesse-dark", "vitesse-light"],
@@ -6565,7 +6679,7 @@ async function mc(e, t, r, o) {
6565
6679
  try {
6566
6680
  v.cleanupEditor?.();
6567
6681
  } finally {
6568
- y.wrapper.isConnected && y.wrapper.replaceWith(T.cloneNode(!0));
6682
+ y.wrapper.isConnected && y.wrapper.replaceWith(P.cloneNode(!0));
6569
6683
  }
6570
6684
  });
6571
6685
  } catch {
@@ -6573,7 +6687,7 @@ async function mc(e, t, r, o) {
6573
6687
  v.cleanupEditor?.();
6574
6688
  } catch {
6575
6689
  }
6576
- y.wrapper.replaceWith(T);
6690
+ y.wrapper.replaceWith(P);
6577
6691
  }
6578
6692
  }
6579
6693
  }
@@ -6615,7 +6729,7 @@ function vc(e) {
6615
6729
  }
6616
6730
  return "";
6617
6731
  }
6618
- function Ir(e, t, r, o, n, i = {}) {
6732
+ function Rr(e, t, r, o, n, i = {}) {
6619
6733
  const s = document.createElement("div");
6620
6734
  if (s.className = `markstream-angular-enhanced-block markstream-angular-enhanced-block--${e}`, i.showHeader !== !1) {
6621
6735
  const c = document.createElement("div");
@@ -6671,13 +6785,13 @@ function Cc(e, t) {
6671
6785
  const o = Math.max(1, r);
6672
6786
  return e > o;
6673
6787
  }
6674
- function Tc(e) {
6788
+ function Pc(e) {
6675
6789
  if (e.deferNodesUntilVisible === !1)
6676
6790
  return !1;
6677
6791
  const t = Math.trunc(e.maxLiveNodes ?? 320);
6678
6792
  return !Number.isFinite(t) || t <= 0 || e.virtualizationEnabled || e.parsedNodeCount > kc ? !1 : e.viewportPriority !== !1;
6679
6793
  }
6680
- function Pc(e, t = bc) {
6794
+ function Tc(e, t = bc) {
6681
6795
  if (!e.size)
6682
6796
  return t;
6683
6797
  let r = 0;
@@ -6750,7 +6864,7 @@ let w = class {
6750
6864
  return this.batchRendering !== !1 && typeof window < "u" && !this.liveWindowEnabled && !this.virtualizationEnabled && this.parsedNodes.length > this.resolvedInitialBatchSize;
6751
6865
  }
6752
6866
  get deferNodesActive() {
6753
- return Tc({
6867
+ return Pc({
6754
6868
  deferNodesUntilVisible: this.deferNodesUntilVisible,
6755
6869
  maxLiveNodes: this.maxLiveNodes,
6756
6870
  parsedNodeCount: this.parsedNodes.length,
@@ -6818,7 +6932,7 @@ let w = class {
6818
6932
  t >= e && this.nodeVisibility.delete(t);
6819
6933
  }
6820
6934
  refreshVisibleEntries() {
6821
- const e = Pc(this.nodeHeights), t = this.parsedNodes.length, r = this.virtualizationEnabled ? this.parsedNodes.slice(this.liveRange.start, this.liveRange.end).map((o, n) => ({
6935
+ const e = Tc(this.nodeHeights), t = this.parsedNodes.length, r = this.virtualizationEnabled ? this.parsedNodes.slice(this.liveRange.start, this.liveRange.end).map((o, n) => ({
6822
6936
  node: o,
6823
6937
  index: this.liveRange.start + n
6824
6938
  })) : this.parsedNodes.map((o, n) => ({ node: o, index: n }));
@@ -7136,19 +7250,19 @@ C([
7136
7250
  l()
7137
7251
  ], w.prototype, "allowHtml", 2);
7138
7252
  C([
7139
- Pt()
7253
+ Tt()
7140
7254
  ], w.prototype, "copy", 2);
7141
7255
  C([
7142
- Pt()
7256
+ Tt()
7143
7257
  ], w.prototype, "handleArtifactClick", 2);
7144
7258
  C([
7145
- Pt()
7259
+ Tt()
7146
7260
  ], w.prototype, "click", 2);
7147
7261
  C([
7148
- Pt()
7262
+ Tt()
7149
7263
  ], w.prototype, "mouseover", 2);
7150
7264
  C([
7151
- Pt()
7265
+ Tt()
7152
7266
  ], w.prototype, "mouseout", 2);
7153
7267
  w = C([
7154
7268
  b({
@@ -7244,32 +7358,32 @@ const Mc = "markstream-angular-html", Oc = "div", so = /* @__PURE__ */ new Map()
7244
7358
  "text",
7245
7359
  "thematic_break"
7246
7360
  ]);
7247
- function Id(e) {
7361
+ function Rd(e) {
7248
7362
  const t = dt([
7249
7363
  ...e.customHtmlTags || [],
7250
7364
  ...e.parseOptions?.customHtmlTags || []
7251
- ]), r = Rr({
7365
+ ]), r = Ir({
7252
7366
  allowHtml: e.allowHtml,
7253
7367
  customHtmlTags: t
7254
7368
  }), o = Dc(e, r);
7255
- return I(o, r);
7369
+ return R(o, r);
7256
7370
  }
7257
- function Rd(e, t = {}) {
7258
- const r = Rr(t);
7259
- return Ic(e, r);
7371
+ function Id(e, t = {}) {
7372
+ const r = Ir(t);
7373
+ return Rc(e, r);
7260
7374
  }
7261
7375
  function $d(e, t = {}) {
7262
- const r = Rr(t);
7263
- return I(e, r);
7376
+ const r = Ir(t);
7377
+ return R(e, r);
7264
7378
  }
7265
7379
  function Nd(e, t = {}) {
7266
- const r = Rr(t);
7380
+ const r = Ir(t);
7267
7381
  return li(e, r);
7268
7382
  }
7269
7383
  function Dc(e, t) {
7270
7384
  if (Array.isArray(e.nodes))
7271
7385
  return e.nodes;
7272
- const r = P(e.content);
7386
+ const r = T(e.content);
7273
7387
  if (!r)
7274
7388
  return [];
7275
7389
  const o = dt([
@@ -7284,7 +7398,7 @@ function Dc(e, t) {
7284
7398
  o
7285
7399
  );
7286
7400
  }
7287
- function Rr(e) {
7401
+ function Ir(e) {
7288
7402
  const t = dt(e.customHtmlTags), r = `${e.cacheKey || Mc}::${t.join(",")}`;
7289
7403
  let o = so.get(r);
7290
7404
  return o || (o = en(r, {
@@ -7298,23 +7412,23 @@ function Rr(e) {
7298
7412
  }
7299
7413
  };
7300
7414
  }
7301
- function Ic(e, t) {
7415
+ function Rc(e, t) {
7302
7416
  if (Array.isArray(e.nodes) && e.nodes.length > 0)
7303
- return I(e.nodes, t);
7417
+ return R(e.nodes, t);
7304
7418
  const r = e.node;
7305
7419
  if (r) {
7306
- const o = R(r.children);
7420
+ const o = I(r.children);
7307
7421
  if (o.length > 0)
7308
- return I(o, t);
7309
- const n = P(r.content);
7422
+ return R(o, t);
7423
+ const n = T(r.content);
7310
7424
  if (n)
7311
7425
  return Jr(n, t);
7312
7426
  if (r.raw != null)
7313
- return A(P(r.raw));
7427
+ return A(T(r.raw));
7314
7428
  }
7315
- return e.content ? Jr(P(e.content), t) : "";
7429
+ return e.content ? Jr(T(e.content), t) : "";
7316
7430
  }
7317
- function I(e, t) {
7431
+ function R(e, t) {
7318
7432
  return (Array.isArray(e) ? e : []).map((r) => li(r, t)).join("");
7319
7433
  }
7320
7434
  function li(e, t) {
@@ -7322,37 +7436,37 @@ function li(e, t) {
7322
7436
  return "";
7323
7437
  switch (e.type) {
7324
7438
  case "text":
7325
- return A(P(e.content));
7439
+ return A(T(e.content));
7326
7440
  case "paragraph":
7327
- return `<p>${I(R(e.children), t)}</p>`;
7441
+ return `<p>${R(I(e.children), t)}</p>`;
7328
7442
  case "strong":
7329
- return `<strong>${I(R(e.children), t)}</strong>`;
7443
+ return `<strong>${R(I(e.children), t)}</strong>`;
7330
7444
  case "emphasis":
7331
- return `<em>${I(R(e.children), t)}</em>`;
7445
+ return `<em>${R(I(e.children), t)}</em>`;
7332
7446
  case "strikethrough":
7333
- return `<del>${I(R(e.children), t)}</del>`;
7447
+ return `<del>${R(I(e.children), t)}</del>`;
7334
7448
  case "highlight":
7335
- return `<mark>${I(R(e.children), t)}</mark>`;
7449
+ return `<mark>${R(I(e.children), t)}</mark>`;
7336
7450
  case "insert":
7337
- return `<ins>${I(R(e.children), t)}</ins>`;
7451
+ return `<ins>${R(I(e.children), t)}</ins>`;
7338
7452
  case "subscript":
7339
- return `<sub>${I(R(e.children), t)}</sub>`;
7453
+ return `<sub>${R(I(e.children), t)}</sub>`;
7340
7454
  case "superscript":
7341
- return `<sup>${I(R(e.children), t)}</sup>`;
7455
+ return `<sup>${R(I(e.children), t)}</sup>`;
7342
7456
  case "inline_code":
7343
- return `<code>${A(P(e.code))}</code>`;
7457
+ return `<code>${A(T(e.code))}</code>`;
7344
7458
  case "hardbreak":
7345
7459
  return "<br>";
7346
7460
  case "link":
7347
- return Rc(e, t);
7461
+ return Ic(e, t);
7348
7462
  case "image":
7349
7463
  return Ac(e);
7350
7464
  case "list":
7351
7465
  return Lc(e, t);
7352
7466
  case "list_item":
7353
- return `<li>${I(R(e.children), t)}</li>`;
7467
+ return `<li>${R(I(e.children), t)}</li>`;
7354
7468
  case "blockquote":
7355
- return `<blockquote>${I(R(e.children), t)}</blockquote>`;
7469
+ return `<blockquote>${R(I(e.children), t)}</blockquote>`;
7356
7470
  case "heading":
7357
7471
  return Bc(e, t);
7358
7472
  case "code_block":
@@ -7379,13 +7493,13 @@ function li(e, t) {
7379
7493
  case "checkbox_input":
7380
7494
  return `<input type="checkbox" disabled${e.checked ? " checked" : ""}>`;
7381
7495
  case "emoji":
7382
- return A(P(e.raw || e.markup || e.content || e.name));
7496
+ return A(T(e.raw || e.markup || e.content || e.name));
7383
7497
  case "math_inline":
7384
7498
  return $c(e);
7385
7499
  case "math_block":
7386
7500
  return Nc(e);
7387
7501
  case "reference":
7388
- return `<sup class="markstream-nested-reference">[${A(P(e.id))}]</sup>`;
7502
+ return `<sup class="markstream-nested-reference">[${A(T(e.id))}]</sup>`;
7389
7503
  case "html_inline":
7390
7504
  case "html_block":
7391
7505
  return Vc(e, t);
@@ -7393,93 +7507,93 @@ function li(e, t) {
7393
7507
  return qc(e, t);
7394
7508
  }
7395
7509
  }
7396
- function Rc(e, t) {
7397
- const r = P(e.href), o = P(e.title), n = R(e.children).length > 0 ? I(R(e.children), t) : A(P(e.text || r)), i = o ? ` title="${B(o)}"` : "";
7510
+ function Ic(e, t) {
7511
+ const r = T(e.href), o = T(e.title), n = I(e.children).length > 0 ? R(I(e.children), t) : A(T(e.text || r)), i = o ? ` title="${B(o)}"` : "";
7398
7512
  return `<a${r ? ` href="${B(r)}"` : ""}${i} target="_blank" rel="noreferrer noopener">${n}</a>`;
7399
7513
  }
7400
7514
  function $c(e) {
7401
- return `<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${A(P(e.content || e.markup || e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`;
7515
+ return `<span class="markstream-nested-math" data-display="inline"><span class="markstream-nested-math__source">${A(T(e.content || e.markup || e.raw))}</span><span class="markstream-nested-math__render" aria-hidden="true"></span></span>`;
7402
7516
  }
7403
7517
  function Nc(e) {
7404
- return `<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${A(P(e.content || e.markup || e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`;
7518
+ return `<div class="markstream-nested-math-block"><pre class="markstream-nested-math-block__source"><code>${A(T(e.content || e.markup || e.raw))}</code></pre><div class="markstream-nested-math-block__render" aria-hidden="true"></div></div>`;
7405
7519
  }
7406
7520
  function Ac(e) {
7407
- const t = P(e.src), r = P(e.alt), o = P(e.title), n = o ? ` title="${B(o)}"` : "";
7521
+ const t = T(e.src), r = T(e.alt), o = T(e.title), n = o ? ` title="${B(o)}"` : "";
7408
7522
  return `<img src="${B(t)}" alt="${B(r)}"${n}>`;
7409
7523
  }
7410
7524
  function Lc(e, t) {
7411
7525
  const r = e.ordered ? "ol" : "ul", o = e.ordered && Number.isFinite(e.start) ? ` start="${Number(e.start)}"` : "";
7412
- return `<${r}${o}>${I(R(e.items), t)}</${r}>`;
7526
+ return `<${r}${o}>${R(I(e.items), t)}</${r}>`;
7413
7527
  }
7414
7528
  function Bc(e, t) {
7415
7529
  const r = Jc(e.level);
7416
- return `<h${r}>${I(R(e.children), t)}</h${r}>`;
7530
+ return `<h${r}>${R(I(e.children), t)}</h${r}>`;
7417
7531
  }
7418
7532
  function Hc(e) {
7419
- const t = P(e.language).trim(), r = Sn(t), o = r ? ` class="language-${r}"` : "", n = !!e.diff;
7533
+ const t = T(e.language).trim(), r = Sn(t), o = r ? ` class="language-${r}"` : "", n = !!e.diff;
7420
7534
  return `<pre ${[
7421
7535
  'data-markstream-code-block="1"',
7422
7536
  t ? `data-markstream-language="${B(t)}"` : "",
7423
7537
  n ? 'data-markstream-diff="1"' : "",
7424
- n ? `data-markstream-original="${B(ao(P(e.originalCode)))}"` : "",
7425
- n ? `data-markstream-updated="${B(ao(P(e.updatedCode)))}"` : ""
7426
- ].filter(Boolean).join(" ")}><code${o}>${A(P(e.code))}</code></pre>`;
7538
+ n ? `data-markstream-original="${B(ao(T(e.originalCode)))}"` : "",
7539
+ n ? `data-markstream-updated="${B(ao(T(e.updatedCode)))}"` : ""
7540
+ ].filter(Boolean).join(" ")}><code${o}>${A(T(e.code))}</code></pre>`;
7427
7541
  }
7428
7542
  function Fc(e, t) {
7429
- const r = e.header ? ci(e.header, t, !0) : "", o = I(R(e.rows), t), n = r ? `<thead>${r}</thead>` : "", i = o ? `<tbody>${o}</tbody>` : "";
7543
+ const r = e.header ? ci(e.header, t, !0) : "", o = R(I(e.rows), t), n = r ? `<thead>${r}</thead>` : "", i = o ? `<tbody>${o}</tbody>` : "";
7430
7544
  return `<table>${n}${i}</table>`;
7431
7545
  }
7432
7546
  function ci(e, t, r = !1) {
7433
- return `<tr>${R(e.cells).map((n) => di(n, t, r)).join("")}</tr>`;
7547
+ return `<tr>${I(e.cells).map((n) => di(n, t, r)).join("")}</tr>`;
7434
7548
  }
7435
7549
  function di(e, t, r = !1) {
7436
- const o = r || e.header ? "th" : "td", n = P(e.align), i = n ? ` style="text-align:${B(n)}"` : "";
7437
- return `<${o}${i}>${I(R(e.children), t)}</${o}>`;
7550
+ const o = r || e.header ? "th" : "td", n = T(e.align), i = n ? ` style="text-align:${B(n)}"` : "";
7551
+ return `<${o}${i}>${R(I(e.children), t)}</${o}>`;
7438
7552
  }
7439
7553
  function Kc(e, t) {
7440
- return `<dl>${R(e.items).map((r) => ui(r, t)).join("")}</dl>`;
7554
+ return `<dl>${I(e.items).map((r) => ui(r, t)).join("")}</dl>`;
7441
7555
  }
7442
7556
  function ui(e, t) {
7443
- const r = I(R(e.term), t), o = I(R(e.definition), t);
7557
+ const r = R(I(e.term), t), o = R(I(e.definition), t);
7444
7558
  return `<dt>${r}</dt><dd>${o}</dd>`;
7445
7559
  }
7446
7560
  function jc(e, t) {
7447
- return `<div id="fnref--${B(P(e.id))}" class="markstream-nested-footnote">${I(R(e.children), t)}</div>`;
7561
+ return `<div id="fnref--${B(T(e.id))}" class="markstream-nested-footnote">${R(I(e.children), t)}</div>`;
7448
7562
  }
7449
7563
  function zc(e) {
7450
- const t = A(P(e.id));
7451
- return `<sup class="markstream-nested-footnote-ref"><a href="#fnref--${B(P(e.id))}">[${t}]</a></sup>`;
7564
+ const t = A(T(e.id));
7565
+ return `<sup class="markstream-nested-footnote-ref"><a href="#fnref--${B(T(e.id))}">[${t}]</a></sup>`;
7452
7566
  }
7453
7567
  function Wc(e, t) {
7454
- const r = Sn(P(e.kind || "note")) || "note", o = P(e.title) || Qc(r);
7455
- return `<div class="markstream-nested-admonition markstream-nested-admonition--${r}"><div class="markstream-nested-admonition__title">${A(o)}</div><div class="markstream-nested-admonition__content">${I(R(e.children), t)}</div></div>`;
7568
+ const r = Sn(T(e.kind || "note")) || "note", o = T(e.title) || Qc(r);
7569
+ return `<div class="markstream-nested-admonition markstream-nested-admonition--${r}"><div class="markstream-nested-admonition__title">${A(o)}</div><div class="markstream-nested-admonition__content">${R(I(e.children), t)}</div></div>`;
7456
7570
  }
7457
7571
  function Vc(e, t) {
7458
- const r = P(e.content);
7572
+ const r = T(e.content);
7459
7573
  return r ? !t.options.allowHtml || e.loading && !e.autoClosed ? A(r) : mn(r) : "";
7460
7574
  }
7461
7575
  function qc(e, t) {
7462
- const r = P(e.tag || e.type);
7576
+ const r = T(e.tag || e.type);
7463
7577
  if (!r || Ec.has(r))
7464
- return A(P(e.content || e.raw));
7578
+ return A(T(e.content || e.raw));
7465
7579
  const o = [
7466
7580
  "markstream-nested-custom",
7467
7581
  `markstream-nested-custom--${Sn(r) || "node"}`,
7468
- Xc(e, t.options.customNodeClass)
7469
- ].filter(Boolean).join(" "), n = Gc(e.attrs, o), i = Uc(e, t), s = t.options.customNodeTag;
7582
+ Gc(e, t.options.customNodeClass)
7583
+ ].filter(Boolean).join(" "), n = Xc(e.attrs, o), i = Uc(e, t), s = t.options.customNodeTag;
7470
7584
  return `<${s}${n} data-markstream-custom-tag="${B(r)}">${i}</${s}>`;
7471
7585
  }
7472
7586
  function Uc(e, t) {
7473
- const r = R(e.children);
7587
+ const r = I(e.children);
7474
7588
  if (r.length > 0)
7475
- return I(r, t);
7476
- const o = P(e.content);
7477
- return o ? Jr(o, t) : A(P(e.raw));
7589
+ return R(r, t);
7590
+ const o = T(e.content);
7591
+ return o ? Jr(o, t) : A(T(e.raw));
7478
7592
  }
7479
7593
  function Jr(e, t) {
7480
7594
  return e ? t.markdown.render(e) : "";
7481
7595
  }
7482
- function Xc(e, t) {
7596
+ function Gc(e, t) {
7483
7597
  if (!t)
7484
7598
  return "";
7485
7599
  const r = typeof t == "function" ? t(e) : t;
@@ -7488,7 +7602,7 @@ function Xc(e, t) {
7488
7602
  function hi(e) {
7489
7603
  return Array.isArray(e) ? e.map((t) => hi(t)).filter(Boolean).join(" ") : typeof e == "string" ? e.trim() : "";
7490
7604
  }
7491
- function Gc(e, t = "") {
7605
+ function Xc(e, t = "") {
7492
7606
  const r = Zc(e), o = [], n = [t];
7493
7607
  for (const [s, a] of r)
7494
7608
  if (Yc(s)) {
@@ -7512,10 +7626,10 @@ function Zc(e) {
7512
7626
  }
7513
7627
  return Object.entries(e).map(([t, r]) => [t, r]);
7514
7628
  }
7515
- function R(e) {
7629
+ function I(e) {
7516
7630
  return Array.isArray(e) ? e.filter((t) => !!t && typeof t == "object") : [];
7517
7631
  }
7518
- function P(e) {
7632
+ function T(e) {
7519
7633
  return typeof e == "string" ? e : e == null ? "" : String(e);
7520
7634
  }
7521
7635
  function Yc(e) {
@@ -7529,7 +7643,7 @@ function Jc(e) {
7529
7643
  return Math.min(6, Math.max(1, t));
7530
7644
  }
7531
7645
  function A(e) {
7532
- return P(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7646
+ return T(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7533
7647
  }
7534
7648
  function B(e) {
7535
7649
  return A(e).replace(/`/g, "&#96;");
@@ -7942,20 +8056,20 @@ function Ld(e) {
7942
8056
  }
7943
8057
  export {
7944
8058
  ct as AdmonitionNode,
7945
- Te as AngularCodeBlockNode,
8059
+ Pe as AngularCodeBlockNode,
7946
8060
  We as BlockquoteNode,
7947
8061
  qt as CheckboxNode,
7948
- Te as CodeBlockNode,
7949
- Pe as D2BlockNode,
8062
+ Pe as CodeBlockNode,
8063
+ Te as D2BlockNode,
7950
8064
  Ve as DefinitionListNode,
7951
8065
  Ut as EmojiNode,
7952
8066
  qe as EmphasisNode,
7953
8067
  Ue as FallbackComponent,
7954
- Xt as FootnoteAnchorNode,
7955
- Xe as FootnoteNode,
7956
- Gt as FootnoteReferenceNode,
8068
+ Gt as FootnoteAnchorNode,
8069
+ Ge as FootnoteNode,
8070
+ Xt as FootnoteReferenceNode,
7957
8071
  Wr as HardBreakNode,
7958
- Ge as HeadingNode,
8072
+ Xe as HeadingNode,
7959
8073
  Ze as HighlightNode,
7960
8074
  Ye as HtmlBlockNode,
7961
8075
  Je as HtmlInlineNode,
@@ -7967,13 +8081,13 @@ export {
7967
8081
  Oe as LinkNode,
7968
8082
  ue as ListItemNode,
7969
8083
  tt as ListNode,
7970
- Pl as MERMAID_DISABLED_CODE,
7971
- Tl as MERMAID_WORKER_BUSY_CODE,
7972
- Te as MarkdownCodeBlockNode,
8084
+ Tl as MERMAID_DISABLED_CODE,
8085
+ Pl as MERMAID_WORKER_BUSY_CODE,
8086
+ Pe as MarkdownCodeBlockNode,
7973
8087
  w as MarkdownRenderComponent,
7974
8088
  w as MarkstreamAngularComponent,
7975
8089
  Ct as MathBlockNode,
7976
- Tt as MathInlineNode,
8090
+ Pt as MathInlineNode,
7977
8091
  ne as MermaidBlockNode,
7978
8092
  _ as NestedRenderer,
7979
8093
  w as NodeRenderer,
@@ -7987,7 +8101,7 @@ export {
7987
8101
  st as SuperscriptNode,
7988
8102
  at as TableNode,
7989
8103
  de as TextNode,
7990
- Gr as ThematicBreakNode,
8104
+ Xr as ThematicBreakNode,
7991
8105
  lt as VmrContainerNode,
7992
8106
  $t as WORKER_BUSY_CODE,
7993
8107
  ed as buildKaTeXCDNWorkerSource,
@@ -8002,11 +8116,11 @@ export {
8002
8116
  w as default,
8003
8117
  hd as disableD2,
8004
8118
  pd as disableKatex,
8005
- Pd as disableMermaid,
8119
+ Td as disableMermaid,
8006
8120
  si as disposeRenderedHtmlEnhancements,
8007
8121
  ud as enableD2,
8008
8122
  fd as enableKatex,
8009
- Td as enableMermaid,
8123
+ Pd as enableMermaid,
8010
8124
  ic as enhanceRenderedHtml,
8011
8125
  ri as findPrefixOffthread,
8012
8126
  id as getCustomComponentsRevision,
@@ -8029,8 +8143,8 @@ export {
8029
8143
  bn as renderKaTeXWithBackpressure,
8030
8144
  Nd as renderMarkdownNodeToHtml,
8031
8145
  $d as renderMarkdownNodesToHtml,
8032
- Id as renderMarkdownToHtml,
8033
- Rd as renderNestedMarkdownToHtml,
8146
+ Rd as renderMarkdownToHtml,
8147
+ Id as renderNestedMarkdownToHtml,
8034
8148
  cs as resolveMonacoLanguageId,
8035
8149
  Hi as resolveParsedNodes,
8036
8150
  mn as sanitizeHtmlContent,