markdown-flow-ui 0.1.100-beta.39 → 0.1.100-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  13. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  14. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  15. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  16. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  17. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
  18. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
  19. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
  20. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
  21. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
  22. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
  23. package/dist/_virtual/index.cjs10.js +1 -1
  24. package/dist/_virtual/index.cjs11.js +1 -1
  25. package/dist/_virtual/index.cjs5.js +1 -1
  26. package/dist/_virtual/index.cjs6.js +1 -1
  27. package/dist/_virtual/index.cjs7.js +1 -1
  28. package/dist/_virtual/index.cjs8.js +1 -1
  29. package/dist/_virtual/index.cjs9.js +1 -1
  30. package/dist/_virtual/index.es10.js +2 -3
  31. package/dist/_virtual/index.es10.js.map +1 -1
  32. package/dist/_virtual/index.es11.js +3 -2
  33. package/dist/_virtual/index.es11.js.map +1 -1
  34. package/dist/_virtual/index.es5.js +4 -4
  35. package/dist/_virtual/index.es6.js +4 -4
  36. package/dist/_virtual/index.es7.js +3 -2
  37. package/dist/_virtual/index.es7.js.map +1 -1
  38. package/dist/_virtual/index.es8.js +2 -2
  39. package/dist/_virtual/index.es9.js +2 -3
  40. package/dist/_virtual/index.es9.js.map +1 -1
  41. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  42. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  43. package/dist/components/ContentRender/ContentRender.es.js +211 -140
  44. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  45. package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
  46. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  47. package/dist/components/ContentRender/IframeSandbox.es.js +211 -260
  48. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  49. package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
  50. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  51. package/dist/components/ContentRender/SandboxApp.es.js +109 -135
  52. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  53. package/dist/components/ContentRender/index.cjs.js +1 -1
  54. package/dist/components/ContentRender/index.es.js +5 -6
  55. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  56. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  57. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +2 -2
  58. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { j as I } from "../../_virtual/jsx-runtime.es.js";
2
- import { useRef as l, useState as D, useEffect as M } from "react";
3
- import te from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
4
- const re = [
1
+ import { j as C } from "../../_virtual/jsx-runtime.es.js";
2
+ import { useRef as i, useState as B, useEffect as D } from "react";
3
+ import ee from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
4
+ const te = [
5
5
  "src",
6
6
  "srcset",
7
7
  "sizes",
@@ -15,73 +15,53 @@ const re = [
15
15
  "crossorigin",
16
16
  "referrerpolicy",
17
17
  "fetchpriority"
18
- ], O = (o) => re.map(
19
- (t) => `${t}:${o.getAttribute(t) || ""}`
20
- ).join("|"), ne = (o) => {
18
+ ], $ = (c) => te.map(
19
+ (t) => `${t}:${c.getAttribute(t) || ""}`
20
+ ).join("|"), re = (c) => {
21
21
  const t = /* @__PURE__ */ new Map();
22
- return o.querySelectorAll("img").forEach((e) => {
23
- const i = e, s = O(i), u = t.get(s) || [];
24
- u.push(i), t.set(s, u);
22
+ return c.querySelectorAll("img").forEach((u) => {
23
+ const o = u, r = $(o), f = t.get(r) || [];
24
+ f.push(o), t.set(r, f);
25
25
  }), t;
26
- }, se = (o) => {
27
- o.querySelectorAll("img").forEach((t) => {
28
- const e = t;
29
- e.getAttribute("loading") || e.setAttribute("loading", "eager"), e.getAttribute("decoding") || e.setAttribute("decoding", "async"), e.getAttribute("fetchpriority") || e.setAttribute("fetchpriority", "high");
30
- });
31
- }, oe = (o, t) => {
32
- const e = Array.from(o.attributes), i = new Set(
33
- e.map((s) => s.name)
26
+ }, ne = (c, t) => {
27
+ const u = Array.from(c.attributes), o = new Set(
28
+ u.map((r) => r.name)
34
29
  );
35
- Array.from(t.attributes).forEach((s) => {
36
- i.has(s.name) || t.removeAttribute(s.name);
37
- }), e.forEach((s) => {
38
- t.setAttribute(s.name, s.value);
39
- });
40
- }, ie = (o) => {
41
- const t = Array.from(o.querySelectorAll("img"));
42
- return t.length === 0 ? Promise.resolve() : Promise.allSettled(
43
- t.map((e) => {
44
- const i = () => typeof e.decode != "function" ? Promise.resolve() : e.decode().catch(() => {
45
- });
46
- return e.complete && e.naturalWidth > 0 ? i() : new Promise((s) => {
47
- const u = () => {
48
- i().finally(() => s());
49
- };
50
- e.addEventListener("load", u, { once: !0 }), e.addEventListener("error", () => s(), { once: !0 });
51
- });
52
- })
53
- ).then(() => {
30
+ Array.from(t.attributes).forEach((r) => {
31
+ o.has(r.name) || t.removeAttribute(r.name);
32
+ }), u.forEach((r) => {
33
+ t.setAttribute(r.name, r.value);
54
34
  });
55
- }, ce = (o, t) => {
56
- t.size && o.querySelectorAll("img").forEach((e) => {
57
- const i = e, s = O(i), u = t.get(s), b = u?.shift();
58
- if (!b) return;
59
- const v = b.cloneNode(!0);
60
- oe(i, v), i.replaceWith(v), u && u.length === 0 && t.delete(s);
35
+ }, se = (c, t) => {
36
+ t.size && c.querySelectorAll("img").forEach((u) => {
37
+ const o = u, r = $(o), f = t.get(r), y = f?.shift();
38
+ if (!y) return;
39
+ const g = y.cloneNode(!0);
40
+ ne(o, g), o.replaceWith(g), f && f.length === 0 && t.delete(r);
61
41
  });
62
- }, pe = ({
63
- html: o,
42
+ }, le = ({
43
+ html: c,
64
44
  styleLoadingText: t,
65
- scriptLoadingText: e,
66
- resetToken: i = 0,
67
- mode: s = "content",
68
- hasRootVhHeight: u = !1,
69
- stretchRootHeight: b = !1
45
+ scriptLoadingText: u,
46
+ resetToken: o = 0,
47
+ mode: r = "content",
48
+ hasRootVhHeight: f = !1,
49
+ stretchRootHeight: y = !1
70
50
  }) => {
71
- const v = l(null), R = l(null), [, z] = D(!0), [U, N] = D(!1), [$, j] = D(!1), F = l([]), L = l([]), B = l(0), G = l(0), x = l(null), A = l(null), S = l(!1), E = l(!1), k = l(!1), P = l(i), Q = 200, m = (n) => {
51
+ const g = i(null), R = i(null), [, G] = B(!0), [K, I] = B(!1), [O, N] = B(!1), j = i([]), T = i([]), z = i(0), W = i(0), x = i(null), b = i(null), v = i(!1), S = i(!1), k = i(!1), _ = i(o), Q = 200, d = (n) => {
72
52
  n.current && (clearTimeout(n.current), n.current = null);
73
- }, W = (n, a, f, T) => {
74
- const y = performance.now() - f.current, p = Math.max(0, Q - y);
75
- m(a), a.current = window.setTimeout(() => {
76
- n(!1), T?.(), a.current = null;
53
+ }, q = (n, a, l, M) => {
54
+ const A = performance.now() - l.current, p = Math.max(0, Q - A);
55
+ d(a), a.current = window.setTimeout(() => {
56
+ n(!1), M?.(), a.current = null;
77
57
  }, p);
78
58
  };
79
- M(() => {
59
+ D(() => {
80
60
  const n = R.current?.ownerDocument;
81
61
  if (!n) return;
82
62
  const a = "sandbox-spinner-style";
83
- let f = n.getElementById(a);
84
- f || (f = n.createElement("style"), f.id = a, n.head?.appendChild(f)), f.textContent = `
63
+ let l = n.getElementById(a);
64
+ l || (l = n.createElement("style"), l.id = a, n.head?.appendChild(l)), l.textContent = `
85
65
  @keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }
86
66
  .sandbox-wrapper { align-items: center; }
87
67
  .sandbox-container { position: relative; width: 100%; }
@@ -91,126 +71,120 @@ const re = [
91
71
  justify-content: safe center;
92
72
  }
93
73
  `;
94
- }, []), M(() => {
95
- i !== P.current && (k.current = !1, P.current = i), m(x), m(A), S.current = !1, E.current = !1;
74
+ }, []), D(() => {
75
+ o !== _.current && (k.current = !1, _.current = o), d(x), d(b), v.current = !1, S.current = !1;
96
76
  const n = R.current;
97
77
  if (!n) return;
98
- const a = n.ownerDocument, f = a?.body;
99
- if (!f) return;
100
- const T = ne(n);
101
- F.current.forEach((r) => r.remove()), F.current = [], L.current.forEach((r) => r.remove()), L.current = [];
102
- const y = k.current;
103
- z(!y), N(!1), j(!1);
78
+ const a = n.ownerDocument, l = a?.body;
79
+ if (!l) return;
80
+ const M = re(n);
81
+ j.current.forEach((e) => e.remove()), j.current = [], T.current.forEach((e) => e.remove()), T.current = [];
82
+ const A = k.current;
83
+ G(!A), I(!1), N(!1);
104
84
  const p = a.createElement("div");
105
- p.innerHTML = o;
106
- const _ = (o.match(/<script[\s>]/gi) || []).length, Y = (o.match(/<\/script>/gi) || []).length, Z = _ > 0 && _ === Y, g = [];
107
- Array.from(p.querySelectorAll("style, script")).forEach((r) => {
108
- if (r.tagName.toLowerCase() === "style") {
109
- const c = a.createElement("style");
110
- c.textContent = r.textContent || "", Array.from(r.attributes).forEach((h) => {
111
- c.setAttribute(h.name, h.value);
112
- }), g.push(c);
85
+ p.innerHTML = c;
86
+ const F = (c.match(/<script[\s>]/gi) || []).length, X = (c.match(/<\/script>/gi) || []).length, Y = F > 0 && F === X, h = [];
87
+ Array.from(p.querySelectorAll("style, script")).forEach((e) => {
88
+ if (e.tagName.toLowerCase() === "style") {
89
+ const s = a.createElement("style");
90
+ s.textContent = e.textContent || "", Array.from(e.attributes).forEach((m) => {
91
+ s.setAttribute(m.name, m.value);
92
+ }), h.push(s);
113
93
  } else {
114
- const c = a.createElement("script");
115
- Array.from(r.attributes).forEach((h) => {
116
- c.setAttribute(h.name, h.value);
117
- }), c.textContent = r.textContent || "", g.push(c);
94
+ const s = a.createElement("script");
95
+ Array.from(e.attributes).forEach((m) => {
96
+ s.setAttribute(m.name, m.value);
97
+ }), s.textContent = e.textContent || "", h.push(s);
118
98
  }
119
- r.remove();
120
- }), se(p), ce(p, T);
121
- const H = g.some(
122
- (r) => r.tagName.toLowerCase() === "style"
123
- ), V = g.some(
124
- (r) => r.tagName.toLowerCase() === "script"
99
+ e.remove();
100
+ }), se(p, M);
101
+ const H = h.some(
102
+ (e) => e.tagName.toLowerCase() === "style"
103
+ ), U = h.some(
104
+ (e) => e.tagName.toLowerCase() === "script"
125
105
  );
126
- H && (S.current = !0, B.current = performance.now(), m(x), N(!0)), V && (E.current = !0, G.current = performance.now(), m(A), j(!0));
127
- const K = !!p.firstElementChild;
128
- z(!K && !y), K && (k.current = !0);
129
- const d = y && n.childNodes.length > 0 && p.querySelector("img") !== null ? n.cloneNode(!0) : null;
130
- d && (d.setAttribute("aria-hidden", "true"), d.style.position = "absolute", d.style.inset = "0", d.style.zIndex = "2", d.style.pointerEvents = "none", d.style.background = "transparent");
131
- const ee = Array.from(p.childNodes);
132
- n.replaceChildren(...ee), d && (n.appendChild(d), ie(n).finally(() => {
133
- requestAnimationFrame(() => {
134
- d.remove();
135
- });
136
- })), g.forEach((r) => {
137
- if (r.tagName.toLowerCase() === "style") {
138
- a.head?.appendChild(r), F.current.push(r);
106
+ H && (v.current = !0, z.current = performance.now(), d(x), I(!0)), U && (S.current = !0, W.current = performance.now(), d(b), N(!0));
107
+ const V = !!p.firstElementChild;
108
+ G(!V && !A), V && (k.current = !0);
109
+ const Z = Array.from(p.childNodes);
110
+ n.replaceChildren(...Z), h.forEach((e) => {
111
+ if (e.tagName.toLowerCase() === "style") {
112
+ a.head?.appendChild(e), j.current.push(e);
139
113
  return;
140
114
  }
141
- if (Z) {
142
- const c = r, h = c.textContent || "";
143
- if (!c.src)
115
+ if (Y) {
116
+ const s = e, m = s.textContent || "";
117
+ if (!s.src)
144
118
  try {
145
- new Function(h);
119
+ new Function(m);
146
120
  } catch {
147
- c.remove();
121
+ s.remove();
148
122
  return;
149
123
  }
150
124
  try {
151
- f.appendChild(c), L.current.push(c);
125
+ l.appendChild(s), T.current.push(s);
152
126
  } catch {
153
- c.remove();
127
+ s.remove();
154
128
  }
155
129
  } else
156
- r.remove();
130
+ e.remove();
157
131
  }), requestAnimationFrame(() => {
158
- H && W(
159
- N,
132
+ H && q(
133
+ I,
160
134
  x,
161
- B,
135
+ z,
162
136
  () => {
163
- S.current = !1;
137
+ v.current = !1;
164
138
  }
165
- ), V && W(
166
- j,
167
- A,
168
- G,
139
+ ), U && q(
140
+ N,
141
+ b,
142
+ W,
169
143
  () => {
170
- E.current = !1;
144
+ S.current = !1;
171
145
  }
172
146
  );
173
147
  });
174
- }, [o, i]), M(
148
+ }, [c, o]), D(
175
149
  () => () => {
176
- m(x), m(A);
150
+ d(x), d(b);
177
151
  },
178
152
  []
179
153
  );
180
- const w = $ || E.current ? e || "Building scripts cache..." : U || S.current ? t || "Building styles..." : null, q = s === "blackboard", C = q && b, J = {
154
+ const E = O || S.current ? u || "Building scripts cache..." : K || v.current ? t || "Building styles..." : null, L = r === "blackboard", w = L && y, J = {
181
155
  position: "relative",
182
156
  width: "100%",
183
157
  height: "100%",
184
158
  display: "flex",
185
159
  flexDirection: "column",
186
160
  // Keep blackboard scroll behavior while centering content in non-blackboard mode
187
- justifyContent: C ? "flex-start" : q ? "space-around" : "flex-start"
188
- }, X = {
189
- pointerEvents: w ? "none" : void 0,
190
- margin: q ? void 0 : "auto 0",
161
+ justifyContent: w ? "flex-start" : L ? "space-around" : "flex-start"
162
+ }, P = {
163
+ pointerEvents: E ? "none" : void 0,
164
+ margin: L ? void 0 : "auto 0",
191
165
  width: "100%",
192
- height: C ? "100%" : void 0,
193
- minHeight: C ? 0 : void 0,
194
- flex: C ? "1 1 auto" : void 0
166
+ height: w ? "100%" : void 0,
167
+ minHeight: w ? 0 : void 0,
168
+ flex: w ? "1 1 auto" : void 0
195
169
  };
196
- return /* @__PURE__ */ I.jsxs(
170
+ return /* @__PURE__ */ C.jsxs(
197
171
  "div",
198
172
  {
199
- ref: v,
200
- "data-root-vh": u ? "true" : "false",
173
+ ref: g,
174
+ "data-root-vh": f ? "true" : "false",
201
175
  className: "sandbox-wrapper",
202
176
  style: J,
203
- "aria-busy": !!w,
177
+ "aria-busy": !!E,
204
178
  children: [
205
- /* @__PURE__ */ I.jsx(
179
+ /* @__PURE__ */ C.jsx(
206
180
  "div",
207
181
  {
208
182
  ref: R,
209
183
  className: "sandbox-container",
210
- style: X
184
+ style: P
211
185
  }
212
186
  ),
213
- w && /* @__PURE__ */ I.jsxs(
187
+ E && /* @__PURE__ */ C.jsxs(
214
188
  "div",
215
189
  {
216
190
  style: {
@@ -228,15 +202,15 @@ const re = [
228
202
  zIndex: 20
229
203
  },
230
204
  children: [
231
- /* @__PURE__ */ I.jsx(
232
- te,
205
+ /* @__PURE__ */ C.jsx(
206
+ ee,
233
207
  {
234
208
  "aria-hidden": !0,
235
209
  size: 20,
236
210
  style: { animation: "sandbox-spin 1s linear infinite" }
237
211
  }
238
212
  ),
239
- w
213
+ E
240
214
  ]
241
215
  }
242
216
  )
@@ -245,6 +219,6 @@ const re = [
245
219
  );
246
220
  };
247
221
  export {
248
- pe as default
222
+ le as default
249
223
  };
250
224
  //# sourceMappingURL=SandboxApp.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxApp.es.js","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nexport interface SandboxAppProps {\n html: string;\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n fullScreenButtonText?: string;\n hideFullScreen?: boolean;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst applyImageLoadingHints = (root: ParentNode) => {\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n\n if (!image.getAttribute(\"loading\")) {\n image.setAttribute(\"loading\", \"eager\");\n }\n\n if (!image.getAttribute(\"decoding\")) {\n image.setAttribute(\"decoding\", \"async\");\n }\n\n if (!image.getAttribute(\"fetchpriority\")) {\n image.setAttribute(\"fetchpriority\", \"high\");\n }\n });\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst waitForImagesReady = (root: ParentNode) => {\n const images = Array.from(root.querySelectorAll(\"img\")) as HTMLImageElement[];\n\n if (images.length === 0) {\n return Promise.resolve();\n }\n\n return Promise.allSettled(\n images.map((image) => {\n const waitForDecode = () => {\n if (typeof image.decode !== \"function\") {\n return Promise.resolve();\n }\n\n return image.decode().catch(() => undefined);\n };\n\n if (image.complete && image.naturalWidth > 0) {\n return waitForDecode();\n }\n\n return new Promise<void>((resolve) => {\n const settle = () => {\n void waitForDecode().finally(() => resolve());\n };\n\n image.addEventListener(\"load\", settle, { once: true });\n image.addEventListener(\"error\", () => resolve(), { once: true });\n });\n })\n ).then(() => undefined);\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n // Clone the already-rendered image instead of moving the live node out of\n // the visible tree before the next DOM commit.\n const clonedImage = preservedImage.cloneNode(true) as HTMLImageElement;\n syncImageAttributes(nextImage, clonedImage);\n nextImage.replaceWith(clonedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n}) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [, setIsWaitingFirstDiv] = useState(true);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const hasRenderedContentRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n @keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n hasRenderedContentRef.current = false;\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n const hasRenderedBefore = hasRenderedContentRef.current;\n setIsWaitingFirstDiv(!hasRenderedBefore);\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n applyImageLoadingHints(wrapper);\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const hasFirstElement = !!wrapper.firstElementChild;\n setIsWaitingFirstDiv(!hasFirstElement && !hasRenderedBefore);\n if (hasFirstElement) {\n hasRenderedContentRef.current = true;\n }\n\n const shouldKeepPreviousFrameVisible =\n hasRenderedBefore &&\n container.childNodes.length > 0 &&\n wrapper.querySelector(\"img\") !== null;\n const previousFrameOverlay = shouldKeepPreviousFrameVisible\n ? (container.cloneNode(true) as HTMLDivElement)\n : null;\n\n if (previousFrameOverlay) {\n previousFrameOverlay.setAttribute(\"aria-hidden\", \"true\");\n previousFrameOverlay.style.position = \"absolute\";\n previousFrameOverlay.style.inset = \"0\";\n previousFrameOverlay.style.zIndex = \"2\";\n previousFrameOverlay.style.pointerEvents = \"none\";\n previousFrameOverlay.style.background = \"transparent\";\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n container.replaceChildren(...contentNodes);\n\n if (previousFrameOverlay) {\n container.appendChild(previousFrameOverlay);\n void waitForImagesReady(container).finally(() => {\n requestAnimationFrame(() => {\n previousFrameOverlay.remove();\n });\n });\n }\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n }, [html, resetToken]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n const overlayMessage = (() => {\n if (isGeneratingScripts || hasScriptsRef.current)\n return scriptLoadingText || \"Building scripts cache...\";\n if (isGeneratingStyles || hasStylesRef.current)\n return styleLoadingText || \"Building styles...\";\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n ref={wrapperRef}\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"rgba(51, 51, 51, 0.80)\",\n color: \"#ffffff\",\n fontSize: 16,\n fontWeight: 700,\n gap: 10,\n pointerEvents: \"auto\",\n zIndex: 20,\n }}\n >\n <Loader2\n aria-hidden\n size={20}\n style={{ animation: \"sandbox-spin 1s linear infinite\" }}\n />\n {overlayMessage}\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","applyImageLoadingHints","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","waitForImagesReady","images","waitForDecode","resolve","settle","reuseRenderedImages","nextImage","preservedImage","clonedImage","SandboxApp","html","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","wrapperRef","useRef","containerRef","setIsWaitingFirstDiv","useState","isGeneratingStyles","setIsGeneratingStyles","isGeneratingScripts","setIsGeneratingScripts","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","hasRenderedContentRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","hasRenderedBefore","wrapper","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","hasFirstElement","previousFrameOverlay","contentNodes","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","jsx","Loader2"],"mappings":";;;AAgBA,MAAMA,KAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,GAAuB;AAAA,EACrB,CAACG,MAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,KAAK,EAAE;AACpE,EAAE,KAAK,GAAG,GAENC,KAAwB,CAACC,MAAqB;AAClD,QAAMC,wBAAe,IAAA;AACrB,SAAAD,EAAK,iBAAiB,KAAK,EAAE,QAAQ,CAACE,MAAS;AAC7C,UAAML,IAAQK,GACRC,IAAMP,EAAiBC,CAAK,GAC5BO,IAASH,EAAS,IAAIE,CAAG,KAAK,CAAA;AACpC,IAAAC,EAAO,KAAKP,CAAK,GACjBI,EAAS,IAAIE,GAAKC,CAAM;AAAA,EAC1B,CAAC,GACMH;AACT,GAEMI,KAAyB,CAACL,MAAqB;AACnD,EAAAA,EAAK,iBAAiB,KAAK,EAAE,QAAQ,CAACE,MAAS;AAC7C,UAAML,IAAQK;AAEd,IAAKL,EAAM,aAAa,SAAS,KAC/BA,EAAM,aAAa,WAAW,OAAO,GAGlCA,EAAM,aAAa,UAAU,KAChCA,EAAM,aAAa,YAAY,OAAO,GAGnCA,EAAM,aAAa,eAAe,KACrCA,EAAM,aAAa,iBAAiB,MAAM;AAAA,EAE9C,CAAC;AACH,GAEMS,KAAsB,CAC1BC,GACAC,MACG;AACH,QAAMC,IAAmB,MAAM,KAAKF,EAAY,UAAU,GACpDG,IAA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,QAERJ,KACCK,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,cACL,UAAU;AAAA,cACV,OAAO;AAAA,cACP,SAAS;AAAA,cACT,YAAY;AAAA,cACZ,gBAAgB;AAAA,cAChB,YAAY;AAAA,cACZ,OAAO;AAAA,cACP,UAAU;AAAA,cACV,YAAY;AAAA,cACZ,KAAK;AAAA,cACL,eAAe;AAAA,cACf,QAAQ;AAAA,YAAA;AAAA,YAGV,UAAA;AAAA,cAAAC,gBAAAA,EAAAA;AAAAA,gBAACC;AAAAA,gBAAA;AAAA,kBACC,eAAW;AAAA,kBACX,MAAM;AAAA,kBACN,OAAO,EAAE,WAAW,kCAAA;AAAA,gBAAkC;AAAA,cAAA;AAAA,cAEvDP;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"SandboxApp.es.js","sources":["../../../src/components/ContentRender/SandboxApp.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { Loader2 } from \"lucide-react\";\n\nexport interface SandboxAppProps {\n html: string;\n loadingText?: string;\n styleLoadingText?: string;\n scriptLoadingText?: string;\n fullScreenButtonText?: string;\n hideFullScreen?: boolean;\n resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n hasRootVhHeight?: boolean;\n stretchRootHeight?: boolean;\n}\n\nconst IMAGE_REUSE_ATTRIBUTES = [\n \"src\",\n \"srcset\",\n \"sizes\",\n \"alt\",\n \"class\",\n \"width\",\n \"height\",\n \"style\",\n \"loading\",\n \"decoding\",\n \"crossorigin\",\n \"referrerpolicy\",\n \"fetchpriority\",\n];\n\nconst getImageReuseKey = (image: HTMLImageElement) =>\n IMAGE_REUSE_ATTRIBUTES.map(\n (attribute) => `${attribute}:${image.getAttribute(attribute) || \"\"}`\n ).join(\"|\");\n\nconst collectReusableImages = (root: ParentNode) => {\n const imageMap = new Map<string, HTMLImageElement[]>();\n root.querySelectorAll(\"img\").forEach((node) => {\n const image = node as HTMLImageElement;\n const key = getImageReuseKey(image);\n const bucket = imageMap.get(key) || [];\n bucket.push(image);\n imageMap.set(key, bucket);\n });\n return imageMap;\n};\n\nconst syncImageAttributes = (\n sourceImage: HTMLImageElement,\n targetImage: HTMLImageElement\n) => {\n const sourceAttributes = Array.from(sourceImage.attributes);\n const sourceAttributeNames = new Set(\n sourceAttributes.map((attribute) => attribute.name)\n );\n\n Array.from(targetImage.attributes).forEach((attribute) => {\n if (!sourceAttributeNames.has(attribute.name)) {\n targetImage.removeAttribute(attribute.name);\n }\n });\n\n sourceAttributes.forEach((attribute) => {\n targetImage.setAttribute(attribute.name, attribute.value);\n });\n};\n\nconst reuseRenderedImages = (\n root: ParentNode,\n imageMap: Map<string, HTMLImageElement[]>\n) => {\n if (!imageMap.size) return;\n\n root.querySelectorAll(\"img\").forEach((node) => {\n const nextImage = node as HTMLImageElement;\n const key = getImageReuseKey(nextImage);\n const bucket = imageMap.get(key);\n const preservedImage = bucket?.shift();\n if (!preservedImage) return;\n\n // Clone the already-rendered image instead of moving the live node out of\n // the visible tree before the next DOM commit.\n const clonedImage = preservedImage.cloneNode(true) as HTMLImageElement;\n syncImageAttributes(nextImage, clonedImage);\n nextImage.replaceWith(clonedImage);\n\n if (bucket && bucket.length === 0) {\n imageMap.delete(key);\n }\n });\n};\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n hasRootVhHeight = false,\n stretchRootHeight = false,\n}) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [, setIsWaitingFirstDiv] = useState(true);\n const [isGeneratingStyles, setIsGeneratingStyles] = useState(false);\n const [isGeneratingScripts, setIsGeneratingScripts] = useState(false);\n const appendedStylesRef = useRef<HTMLStyleElement[]>([]);\n const appendedScriptsRef = useRef<HTMLScriptElement[]>([]);\n const styleStartRef = useRef(0);\n const scriptStartRef = useRef(0);\n const styleTimerRef = useRef<number | null>(null);\n const scriptTimerRef = useRef<number | null>(null);\n const hasStylesRef = useRef(false);\n const hasScriptsRef = useRef(false);\n const hasRenderedContentRef = useRef(false);\n const prevResetTokenRef = useRef(resetToken);\n const MIN_LOADING_MS = 200;\n\n const clearTimer = (timerRef: React.MutableRefObject<number | null>) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }\n };\n\n const settleStateWithMinimumDelay = (\n setter: React.Dispatch<React.SetStateAction<boolean>>,\n timerRef: React.MutableRefObject<number | null>,\n startRef: React.MutableRefObject<number>,\n onDone?: () => void\n ) => {\n const elapsed = performance.now() - startRef.current;\n const delay = Math.max(0, MIN_LOADING_MS - elapsed);\n clearTimer(timerRef);\n timerRef.current = window.setTimeout(() => {\n setter(false);\n onDone?.();\n timerRef.current = null;\n }, delay);\n };\n\n useEffect(() => {\n const doc = containerRef.current?.ownerDocument;\n if (!doc) return;\n const styleId = \"sandbox-spinner-style\";\n let styleEl = doc.getElementById(styleId) as HTMLStyleElement | null;\n if (!styleEl) {\n styleEl = doc.createElement(\"style\");\n styleEl.id = styleId;\n doc.head?.appendChild(styleEl);\n }\n styleEl.textContent = `\n @keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }\n .sandbox-wrapper { align-items: center; }\n .sandbox-container { position: relative; width: 100%; }\n .sandbox-container svg,\n .sandbox-container img { display: block; margin-left: auto; margin-right: auto; }\n .justify-\\\\[safe_center\\\\]{\n justify-content: safe center;\n }\n `;\n }, []);\n\n useEffect(() => {\n if (resetToken !== prevResetTokenRef.current) {\n hasRenderedContentRef.current = false;\n prevResetTokenRef.current = resetToken;\n }\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n hasStylesRef.current = false;\n hasScriptsRef.current = false;\n\n const container = containerRef.current;\n if (!container) return;\n const doc = container.ownerDocument;\n const body = doc?.body;\n if (!body) return;\n const reusableImages = collectReusableImages(container);\n\n appendedStylesRef.current.forEach((node) => node.remove());\n appendedStylesRef.current = [];\n appendedScriptsRef.current.forEach((node) => node.remove());\n appendedScriptsRef.current = [];\n\n const hasRenderedBefore = hasRenderedContentRef.current;\n setIsWaitingFirstDiv(!hasRenderedBefore);\n setIsGeneratingStyles(false);\n setIsGeneratingScripts(false);\n const wrapper = doc.createElement(\"div\");\n wrapper.innerHTML = html;\n\n const openScriptCount = (html.match(/<script[\\s>]/gi) || []).length;\n const closeScriptCount = (html.match(/<\\/script>/gi) || []).length;\n const shouldExecuteScripts =\n openScriptCount > 0 && openScriptCount === closeScriptCount;\n\n const resourceQueue: HTMLElement[] = [];\n\n Array.from(wrapper.querySelectorAll(\"style, script\")).forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n const cloned = doc.createElement(\"style\");\n cloned.textContent = node.textContent || \"\";\n Array.from(node.attributes).forEach((attr) => {\n cloned.setAttribute(attr.name, attr.value);\n });\n resourceQueue.push(cloned);\n } else {\n const replacement = doc.createElement(\"script\");\n Array.from(node.attributes).forEach((attr) => {\n replacement.setAttribute(attr.name, attr.value);\n });\n replacement.textContent = node.textContent || \"\";\n resourceQueue.push(replacement);\n }\n node.remove();\n });\n reuseRenderedImages(wrapper, reusableImages);\n\n const hasStyles = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"style\"\n );\n const hasScripts = resourceQueue.some(\n (node) => node.tagName.toLowerCase() === \"script\"\n );\n if (hasStyles) {\n hasStylesRef.current = true;\n styleStartRef.current = performance.now();\n clearTimer(styleTimerRef);\n setIsGeneratingStyles(true);\n }\n if (hasScripts) {\n hasScriptsRef.current = true;\n scriptStartRef.current = performance.now();\n clearTimer(scriptTimerRef);\n setIsGeneratingScripts(true);\n }\n\n const hasFirstElement = !!wrapper.firstElementChild;\n setIsWaitingFirstDiv(!hasFirstElement && !hasRenderedBefore);\n if (hasFirstElement) {\n hasRenderedContentRef.current = true;\n }\n\n const contentNodes = Array.from(wrapper.childNodes);\n container.replaceChildren(...contentNodes);\n\n resourceQueue.forEach((node) => {\n if (node.tagName.toLowerCase() === \"style\") {\n doc.head?.appendChild(node);\n appendedStylesRef.current.push(node as HTMLStyleElement);\n return;\n }\n\n if (shouldExecuteScripts) {\n const scriptNode = node as HTMLScriptElement;\n const scriptText = scriptNode.textContent || \"\";\n const shouldValidate = !scriptNode.src;\n\n if (shouldValidate) {\n try {\n // Validate script is syntactically complete before executing\n\n new Function(scriptText);\n } catch {\n scriptNode.remove();\n return;\n }\n }\n\n try {\n body.appendChild(scriptNode);\n appendedScriptsRef.current.push(scriptNode);\n } catch {\n scriptNode.remove();\n }\n } else {\n // Defer execution until all script tags are fully received\n node.remove();\n }\n });\n requestAnimationFrame(() => {\n if (hasStyles) {\n settleStateWithMinimumDelay(\n setIsGeneratingStyles,\n styleTimerRef,\n styleStartRef,\n () => {\n hasStylesRef.current = false;\n }\n );\n }\n if (hasScripts) {\n settleStateWithMinimumDelay(\n setIsGeneratingScripts,\n scriptTimerRef,\n scriptStartRef,\n () => {\n hasScriptsRef.current = false;\n }\n );\n }\n });\n }, [html, resetToken]);\n\n useEffect(\n () => () => {\n clearTimer(styleTimerRef);\n clearTimer(scriptTimerRef);\n },\n []\n );\n\n const overlayMessage = (() => {\n if (isGeneratingScripts || hasScriptsRef.current)\n return scriptLoadingText || \"Building scripts cache...\";\n if (isGeneratingStyles || hasStylesRef.current)\n return styleLoadingText || \"Building styles...\";\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n const shouldStretchRootHeight = isBlackboard && stretchRootHeight;\n const sandboxWrapperStyle: React.CSSProperties = {\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n // Keep blackboard scroll behavior while centering content in non-blackboard mode\n justifyContent: shouldStretchRootHeight\n ? \"flex-start\"\n : isBlackboard\n ? \"space-around\"\n : \"flex-start\",\n };\n const sandboxContainerStyle: React.CSSProperties = {\n pointerEvents: overlayMessage ? \"none\" : undefined,\n margin: isBlackboard ? undefined : \"auto 0\",\n width: \"100%\",\n height: shouldStretchRootHeight ? \"100%\" : undefined,\n minHeight: shouldStretchRootHeight ? 0 : undefined,\n flex: shouldStretchRootHeight ? \"1 1 auto\" : undefined,\n };\n\n return (\n <div\n ref={wrapperRef}\n data-root-vh={hasRootVhHeight ? \"true\" : \"false\"}\n className=\"sandbox-wrapper\"\n style={sandboxWrapperStyle}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n className=\"sandbox-container\"\n style={sandboxContainerStyle}\n />\n {overlayMessage && (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"rgba(51, 51, 51, 0.80)\",\n color: \"#ffffff\",\n fontSize: 16,\n fontWeight: 700,\n gap: 10,\n pointerEvents: \"auto\",\n zIndex: 20,\n }}\n >\n <Loader2\n aria-hidden\n size={20}\n style={{ animation: \"sandbox-spin 1s linear infinite\" }}\n />\n {overlayMessage}\n </div>\n )}\n </div>\n );\n};\n\nexport default SandboxApp;\n"],"names":["IMAGE_REUSE_ATTRIBUTES","getImageReuseKey","image","attribute","collectReusableImages","root","imageMap","node","key","bucket","syncImageAttributes","sourceImage","targetImage","sourceAttributes","sourceAttributeNames","reuseRenderedImages","nextImage","preservedImage","clonedImage","SandboxApp","html","styleLoadingText","scriptLoadingText","resetToken","mode","hasRootVhHeight","stretchRootHeight","wrapperRef","useRef","containerRef","setIsWaitingFirstDiv","useState","isGeneratingStyles","setIsGeneratingStyles","isGeneratingScripts","setIsGeneratingScripts","appendedStylesRef","appendedScriptsRef","styleStartRef","scriptStartRef","styleTimerRef","scriptTimerRef","hasStylesRef","hasScriptsRef","hasRenderedContentRef","prevResetTokenRef","MIN_LOADING_MS","clearTimer","timerRef","settleStateWithMinimumDelay","setter","startRef","onDone","elapsed","delay","useEffect","doc","styleId","styleEl","container","body","reusableImages","hasRenderedBefore","wrapper","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","hasFirstElement","contentNodes","scriptNode","scriptText","overlayMessage","isBlackboard","shouldStretchRootHeight","sandboxWrapperStyle","sandboxContainerStyle","jsxs","jsx","Loader2"],"mappings":";;;AAgBA,MAAMA,KAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAmB,CAACC,MACxBF,GAAuB;AAAA,EACrB,CAACG,MAAc,GAAGA,CAAS,IAAID,EAAM,aAAaC,CAAS,KAAK,EAAE;AACpE,EAAE,KAAK,GAAG,GAENC,KAAwB,CAACC,MAAqB;AAClD,QAAMC,wBAAe,IAAA;AACrB,SAAAD,EAAK,iBAAiB,KAAK,EAAE,QAAQ,CAACE,MAAS;AAC7C,UAAML,IAAQK,GACRC,IAAMP,EAAiBC,CAAK,GAC5BO,IAASH,EAAS,IAAIE,CAAG,KAAK,CAAA;AACpC,IAAAC,EAAO,KAAKP,CAAK,GACjBI,EAAS,IAAIE,GAAKC,CAAM;AAAA,EAC1B,CAAC,GACMH;AACT,GAEMI,KAAsB,CAC1BC,GACAC,MACG;AACH,QAAMC,IAAmB,MAAM,KAAKF,EAAY,UAAU,GACpDG,IAAuB,IAAI;AAAA,IAC/BD,EAAiB,IAAI,CAACV,MAAcA,EAAU,IAAI;AAAA,EAAA;AAGpD,QAAM,KAAKS,EAAY,UAAU,EAAE,QAAQ,CAACT,MAAc;AACxD,IAAKW,EAAqB,IAAIX,EAAU,IAAI,KAC1CS,EAAY,gBAAgBT,EAAU,IAAI;AAAA,EAE9C,CAAC,GAEDU,EAAiB,QAAQ,CAACV,MAAc;AACtC,IAAAS,EAAY,aAAaT,EAAU,MAAMA,EAAU,KAAK;AAAA,EAC1D,CAAC;AACH,GAEMY,KAAsB,CAC1BV,GACAC,MACG;AACH,EAAKA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AAA,cAAAC,gBAAAA,EAAAA;AAAAA,gBAACC;AAAAA,gBAAA;AAAA,kBACC,eAAW;AAAA,kBACX,MAAM;AAAA,kBACN,OAAO,EAAE,WAAW,kCAAA;AAAA,gBAAkC;AAAA,cAAA;AAAA,cAEvDP;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ContentRender.cjs.js"),r=require("./IframeSandbox.cjs.js");require("../../_virtual/jsx-runtime.cjs.js");require("../ui/inputGroup/input-group.cjs.js");require("react");exports.ContentRender=e.default;exports.default=e.default;exports.IframeSandbox=r.default;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ContentRender.cjs.js");require("../../_virtual/jsx-runtime.cjs.js");require("react");require("react-dom/client");require("../ui/inputGroup/input-group.cjs.js");exports.ContentRender=e.default;exports.default=e.default;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,11 +1,10 @@
1
- import r from "./ContentRender.es.js";
2
- import { default as f } from "./IframeSandbox.es.js";
1
+ import o from "./ContentRender.es.js";
3
2
  import "../../_virtual/jsx-runtime.es.js";
4
- import "../ui/inputGroup/input-group.es.js";
5
3
  import "react";
4
+ import "react-dom/client";
5
+ import "../ui/inputGroup/input-group.es.js";
6
6
  export {
7
- r as ContentRender,
8
- f as IframeSandbox,
9
- r as default
7
+ o as ContentRender,
8
+ o as default
10
9
  };
11
10
  //# sourceMappingURL=index.es.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../../_virtual/jsx-runtime.cjs.js"),B=require("../ContentRender/ContentRender.cjs.js");require("../ContentRender/IframeSandbox.cjs.js");require("../ui/inputGroup/input-group.cjs.js");require("react");;/* empty css */const C=({initialContentList:s=[],customRenderBar:n,onSend:d,typingSpeed:i,enableTypewriter:a=!1,onBlockComplete:o,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,beforeSend:p,interactionDefaultValueOptions:x})=>u.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:s.map((e,r)=>{const t=e.isFinished??!1,y=!t&&a,S=t?void 0:d,T=t?void 0:i,f=p??(()=>!0);return u.jsxRuntimeExports.jsx(B.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,enableTypewriter:y,customRenderBar:e.customRenderBar||n,onSend:S,beforeSend:f,interactionDefaultValueOptions:x,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,typingSpeed:T,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat,onTypeFinished:()=>{o?.(r)}},r)})});exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../../_virtual/jsx-runtime.cjs.js"),B=require("../ContentRender/ContentRender.cjs.js");require("react");require("react-dom/client");require("../ui/inputGroup/input-group.cjs.js");;/* empty css */const C=({initialContentList:s=[],customRenderBar:n,onSend:d,typingSpeed:i,enableTypewriter:a=!1,onBlockComplete:o,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,beforeSend:p,interactionDefaultValueOptions:x})=>u.jsxRuntimeExports.jsx("div",{className:"markdown-flow",children:s.map((e,r)=>{const t=e.isFinished??!1,y=!t&&a,S=t?void 0:d,T=t?void 0:i,f=p??(()=>!0);return u.jsxRuntimeExports.jsx(B.default,{content:e.content,userInput:e.userInput,defaultInputText:e.defaultInputText,defaultButtonText:e.defaultButtonText,defaultSelectedValues:e.defaultSelectedValues,readonly:e.readonly,enableTypewriter:y,customRenderBar:e.customRenderBar||n,onSend:S,beforeSend:f,interactionDefaultValueOptions:x,onClickCustomButtonAfterContent:e.onClickCustomButtonAfterContent,typingSpeed:T,confirmButtonText:l,copyButtonText:c,copiedButtonText:m,dynamicInteractionFormat:e.dynamicInteractionFormat,onTypeFinished:()=>{o?.(r)}},r)})});exports.default=C;
2
2
  //# sourceMappingURL=MarkdownFlow.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":"0WAkCA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,YAAaC,EACb,iBAAAC,EAAmB,GACnB,gBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAA2B,CAACD,GAAcV,EAC1CY,EAASF,EAAa,OAAYZ,EAClCe,EAAcH,EAAa,OAAYX,EACvCe,EAAaT,IAAmB,IAAM,IAC5C,OACEE,EAAAA,kBAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASP,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,iBAAkBG,EAClB,gBAAiBH,EAAY,iBAAmBX,EAChD,OAAAe,EACA,WAAAE,EACA,+BAAAR,EACA,gCACEE,EAAY,gCAEd,YAAAK,EACA,kBAAAX,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BI,EAAY,yBACtC,eAAgB,IAAM,CACpBP,IAAkBQ,CAAK,CACzB,CAAA,EAtBKA,CAAA,CAyBX,CAAC,CAAA,CACH"}
1
+ {"version":3,"file":"MarkdownFlow.cjs.js","sources":["../../../src/components/MarkdownFlow/MarkdownFlow.tsx"],"sourcesContent":["import React from \"react\";\nimport type { InteractionDefaultValueOptions } from \"../../lib/interaction-defaults\";\nimport ContentRender from \"../ContentRender\";\nimport { CustomRenderBarProps, OnSendContentParams } from \"../types\";\nimport \"./markdownFlow.css\";\n\nexport interface MarkdownFlowProps {\n initialContentList?: {\n content: string;\n isFinished?: boolean;\n userInput?: string;\n defaultInputText?: string;\n defaultButtonText?: string;\n defaultSelectedValues?: string[];\n readonly?: boolean;\n customRenderBar?: CustomRenderBarProps;\n onClickCustomButtonAfterContent?: () => void;\n dynamicInteractionFormat?: string;\n }[];\n customRenderBar?: CustomRenderBarProps;\n onSend?: (content: OnSendContentParams) => void;\n typingSpeed?: number;\n enableTypewriter?: boolean;\n onBlockComplete?: (blockIndex: number) => void;\n // Multi-select confirm button text (i18n support)\n confirmButtonText?: string;\n // Copy button text for code blocks\n copyButtonText?: string;\n // Copied state text for code blocks\n copiedButtonText?: string;\n beforeSend?: (content: OnSendContentParams) => boolean;\n interactionDefaultValueOptions?: InteractionDefaultValueOptions;\n}\n\nconst MarkdownFlow: React.FC<MarkdownFlowProps> = ({\n initialContentList = [],\n customRenderBar,\n onSend: onSendProp,\n typingSpeed: typingSpeedProp,\n enableTypewriter = false,\n onBlockComplete,\n confirmButtonText,\n copyButtonText,\n copiedButtonText,\n beforeSend: beforeSendProp,\n interactionDefaultValueOptions,\n}) => {\n return (\n <div className=\"markdown-flow\">\n {initialContentList.map((contentInfo, index) => {\n const isFinished = contentInfo.isFinished ?? false;\n const enableTypewriterForBlock = !isFinished && enableTypewriter;\n const onSend = isFinished ? undefined : onSendProp;\n const typingSpeed = isFinished ? undefined : typingSpeedProp;\n const beforeSend = beforeSendProp ?? (() => true);\n return (\n <ContentRender\n key={index}\n content={contentInfo.content}\n userInput={contentInfo.userInput}\n defaultInputText={contentInfo.defaultInputText}\n defaultButtonText={contentInfo.defaultButtonText}\n defaultSelectedValues={contentInfo.defaultSelectedValues}\n readonly={contentInfo.readonly}\n enableTypewriter={enableTypewriterForBlock}\n customRenderBar={contentInfo.customRenderBar || customRenderBar}\n onSend={onSend}\n beforeSend={beforeSend}\n interactionDefaultValueOptions={interactionDefaultValueOptions}\n onClickCustomButtonAfterContent={\n contentInfo.onClickCustomButtonAfterContent\n }\n typingSpeed={typingSpeed}\n confirmButtonText={confirmButtonText}\n copyButtonText={copyButtonText}\n copiedButtonText={copiedButtonText}\n dynamicInteractionFormat={contentInfo.dynamicInteractionFormat}\n onTypeFinished={() => {\n onBlockComplete?.(index);\n }}\n />\n );\n })}\n </div>\n );\n};\n\nexport default MarkdownFlow;\n"],"names":["MarkdownFlow","initialContentList","customRenderBar","onSendProp","typingSpeedProp","enableTypewriter","onBlockComplete","confirmButtonText","copyButtonText","copiedButtonText","beforeSendProp","interactionDefaultValueOptions","jsx","contentInfo","index","isFinished","enableTypewriterForBlock","onSend","typingSpeed","beforeSend","ContentRender"],"mappings":"qVAkCA,MAAMA,EAA4C,CAAC,CACjD,mBAAAC,EAAqB,CAAA,EACrB,gBAAAC,EACA,OAAQC,EACR,YAAaC,EACb,iBAAAC,EAAmB,GACnB,gBAAAC,EACA,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,WAAYC,EACZ,+BAAAC,CACF,IAEIC,wBAAC,OAAI,UAAU,gBACZ,WAAmB,IAAI,CAACC,EAAaC,IAAU,CAC9C,MAAMC,EAAaF,EAAY,YAAc,GACvCG,EAA2B,CAACD,GAAcV,EAC1CY,EAASF,EAAa,OAAYZ,EAClCe,EAAcH,EAAa,OAAYX,EACvCe,EAAaT,IAAmB,IAAM,IAC5C,OACEE,EAAAA,kBAAAA,IAACQ,EAAAA,QAAA,CAEC,QAASP,EAAY,QACrB,UAAWA,EAAY,UACvB,iBAAkBA,EAAY,iBAC9B,kBAAmBA,EAAY,kBAC/B,sBAAuBA,EAAY,sBACnC,SAAUA,EAAY,SACtB,iBAAkBG,EAClB,gBAAiBH,EAAY,iBAAmBX,EAChD,OAAAe,EACA,WAAAE,EACA,+BAAAR,EACA,gCACEE,EAAY,gCAEd,YAAAK,EACA,kBAAAX,EACA,eAAAC,EACA,iBAAAC,EACA,yBAA0BI,EAAY,yBACtC,eAAgB,IAAM,CACpBP,IAAkBQ,CAAK,CACzB,CAAA,EAtBKA,CAAA,CAyBX,CAAC,CAAA,CACH"}
@@ -1,8 +1,8 @@
1
1
  import { j as o } from "../../_virtual/jsx-runtime.es.js";
2
2
  import C from "../ContentRender/ContentRender.es.js";
3
- import "../ContentRender/IframeSandbox.es.js";
4
- import "../ui/inputGroup/input-group.es.js";
5
3
  import "react";
4
+ import "react-dom/client";
5
+ import "../ui/inputGroup/input-group.es.js";
6
6
  /* empty css */
7
7
  const j = ({
8
8
  initialContentList: a = [],
package/package.json CHANGED
@@ -171,7 +171,7 @@
171
171
  ]
172
172
  }
173
173
  },
174
- "version": "0.1.100-beta.39",
174
+ "version": "0.1.100-beta.40",
175
175
  "type": "module",
176
176
  "exports": {
177
177
  ".": {