markdown-flow-ui 0.1.83-beta.16 → 0.1.83-beta.18

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 (30) 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.js +1 -1
  2. 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.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.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/sequenceDiagram-WL72ISMW.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.js +1 -1
  13. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.js +1 -1
  14. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.js +1 -1
  15. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.js +1 -1
  16. package/dist/_virtual/index3.js +5 -4
  17. package/dist/_virtual/index3.js.map +1 -1
  18. package/dist/_virtual/index4.js +4 -5
  19. package/dist/_virtual/index4.js.map +1 -1
  20. package/dist/_virtual/index5.js +5 -3
  21. package/dist/_virtual/index5.js.map +1 -1
  22. package/dist/_virtual/index6.js +4 -4
  23. package/dist/_virtual/index7.js +3 -5
  24. package/dist/_virtual/index7.js.map +1 -1
  25. package/dist/components/ContentRender/SandboxApp.js +27 -26
  26. package/dist/components/ContentRender/SandboxApp.js.map +1 -1
  27. package/dist/components/ContentRender/utils/split-content.js +24 -13
  28. package/dist/components/ContentRender/utils/split-content.js.map +1 -1
  29. package/dist/components/ui/inputGroup/textarea.js +1 -1
  30. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { __exports as c } from "../../../../../../../../../../_virtual/index8.js";
1
+ import { __exports as c } from "../../../../../../../../../../_virtual/index9.js";
2
2
  import { __require as v } from "./constants.js";
3
3
  var m;
4
4
  function g() {
@@ -2,7 +2,7 @@ import { stringify as w } from "../../../../comma-separated-tokens@2.0.3/node_mo
2
2
  import { ok as u } from "../../../../devlop@1.1.0/node_modules/devlop/lib/default.js";
3
3
  import { svg as m, html as C } from "../../../../property-information@7.1.0/node_modules/property-information/index.js";
4
4
  import { stringify as N } from "../../../../space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js";
5
- import S from "../../../../../../../../../_virtual/index6.js";
5
+ import S from "../../../../../../../../../_virtual/index5.js";
6
6
  import { whitespace as j } from "../../../../hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js";
7
7
  import { name as x } from "../../../../estree-util-is-identifier-name@3.0.0/node_modules/estree-util-is-identifier-name/lib/index.js";
8
8
  import { VFileMessage as h } from "../../../../vfile-message@4.0.3/node_modules/vfile-message/lib/index.js";
@@ -4,7 +4,7 @@ import { setAccDescription as Be, getAccDescription as Ie, getAccTitle as Me, se
4
4
  import { __name as g, log as fe } from "./chunk-AGHRB4JF.js";
5
5
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
6
6
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
7
- import { d as je } from "../../../../../../../../../../../_virtual/index5.js";
7
+ import { d as je } from "../../../../../../../../../../../_virtual/index7.js";
8
8
  import jt from "../../../../../../d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
9
9
  var Ft = (function() {
10
10
  var e = /* @__PURE__ */ g(function(_t, x, m, v) {
@@ -1,6 +1,6 @@
1
1
  import { common_default as b, assignWithDepth_default as E, directiveRegex as $, sanitizeDirective as X, detectType as Y } from "./chunk-ABZYJK2D.js";
2
2
  import { __name as s, log as g } from "./chunk-AGHRB4JF.js";
3
- import { d as G } from "../../../../../../../../../../../_virtual/index5.js";
3
+ import { d as G } from "../../../../../../../../../../../_virtual/index7.js";
4
4
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
5
5
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
6
6
  import w from "../../../../../../lodash-es@4.17.21/node_modules/lodash-es/memoize.js";
@@ -1,6 +1,6 @@
1
1
  import { lineBreakRegex as o } from "./chunk-ABZYJK2D.js";
2
2
  import { __name as n } from "./chunk-AGHRB4JF.js";
3
- import { d as l } from "../../../../../../../../../../../_virtual/index5.js";
3
+ import { d as l } from "../../../../../../../../../../../_virtual/index7.js";
4
4
  var x = /* @__PURE__ */ n((s, t) => {
5
5
  const r = s.append("rect");
6
6
  if (r.attr("x", t.x), r.attr("y", t.y), r.attr("fill", t.fill), r.attr("stroke", t.stroke), r.attr("width", t.width), r.attr("height", t.height), t.name && r.attr("name", t.name), t.rx && r.attr("rx", t.rx), t.ry && r.attr("ry", t.ry), t.attrs !== void 0)
@@ -1,7 +1,7 @@
1
1
  import { utils_default as ie } from "./chunk-S3R3BYOJ.js";
2
2
  import { getAccDescription as se, setAccDescription as ne, getDiagramTitle as ae, setDiagramTitle as oe, getAccTitle as ce, setAccTitle as le, getConfig2 as K, configureSvgSize as ue, common_default as de, clear as fe } from "./chunk-ABZYJK2D.js";
3
3
  import { __name as c, log as mt } from "./chunk-AGHRB4JF.js";
4
- import { d as he } from "../../../../../../../../../../../_virtual/index5.js";
4
+ import { d as he } from "../../../../../../../../../../../_virtual/index7.js";
5
5
  import L from "../../../../../../../../../../../_virtual/dayjs.min.js";
6
6
  import me from "../../../../../../../../../../../_virtual/isoWeek.js";
7
7
  import ke from "../../../../../../../../../../../_virtual/customParseFormat.js";
@@ -6,7 +6,7 @@ import { setConfig2 as ke, getConfig2 as st, configureSvgSize as Pe, assignWithD
6
6
  import { __name as f, log as Q } from "./chunk-AGHRB4JF.js";
7
7
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
8
8
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
9
- import { d as ne } from "../../../../../../../../../../../_virtual/index5.js";
9
+ import { d as ne } from "../../../../../../../../../../../_virtual/index7.js";
10
10
  import Mt from "../../../../../../d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
11
11
  var Ut = (function() {
12
12
  var e = /* @__PURE__ */ f(function(pt, v, A, L) {
@@ -2,7 +2,7 @@ import $ from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
2
2
  import oe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/extends.js";
3
3
  import r from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/defineProperty.js";
4
4
  import te from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
5
- import d from "../../../../../../../../../_virtual/index4.js";
5
+ import d from "../../../../../../../../../_virtual/index3.js";
6
6
  import l, { useRef as q, cloneElement as ie } from "react";
7
7
  import { hasPrefixSuffix as re, hasAddon as de } from "./utils/commonUtils.js";
8
8
  var xe = /* @__PURE__ */ l.forwardRef(function(e, z) {
@@ -4,7 +4,7 @@ import w from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
4
4
  import J from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
5
5
  import s from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
6
6
  import K from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
7
- import Q from "../../../../../../../../../_virtual/index4.js";
7
+ import Q from "../../../../../../../../../_virtual/index3.js";
8
8
  import ee from "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
9
9
  import M from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
10
10
  import te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
@@ -4,7 +4,7 @@ import d from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
4
4
  import Ae from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js";
5
5
  import x from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
6
6
  import Fe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
7
- import h from "../../../../../../../../../_virtual/index4.js";
7
+ import h from "../../../../../../../../../_virtual/index3.js";
8
8
  import Ne from "../../../../rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js";
9
9
  import Te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
10
10
  import o, { useRef as Y, useImperativeHandle as $e, useEffect as Ie } from "react";
@@ -1,5 +1,5 @@
1
1
  import t from "./TextArea.js";
2
- import "../../../../../../../../../_virtual/index4.js";
2
+ import "../../../../../../../../../_virtual/index3.js";
3
3
  import "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
4
4
  import "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
5
5
  import "react";
@@ -1,5 +1,5 @@
1
1
  import { __exports as a } from "../../../../../../../../../_virtual/remark-custom-variable.js";
2
- import g from "../../../../../../../../../_virtual/index3.js";
2
+ import g from "../../../../../../../../../_virtual/index4.js";
3
3
  import { __require as h } from "./interaction-parser.js";
4
4
  var m;
5
5
  function C() {
@@ -1,5 +1,5 @@
1
1
  import { __exports as n } from "../../../../../../../../../_virtual/remark-interaction.js";
2
- import I from "../../../../../../../../../_virtual/index3.js";
2
+ import I from "../../../../../../../../../_virtual/index4.js";
3
3
  import { __require as g } from "./interaction-parser.js";
4
4
  var m;
5
5
  function k() {
@@ -1,4 +1,4 @@
1
- import { __exports as r } from "../../../../../../../../../_virtual/index9.js";
1
+ import { __exports as r } from "../../../../../../../../../_virtual/index8.js";
2
2
  import { __require as p } from "../../../../inline-style-parser@0.2.4/node_modules/inline-style-parser/index.js";
3
3
  var f;
4
4
  function q() {
@@ -1,5 +1,5 @@
1
1
  import { bail as P } from "../../../../bail@2.0.2/node_modules/bail/index.js";
2
- import y from "../../../../../../../../../_virtual/index7.js";
2
+ import y from "../../../../../../../../../_virtual/index6.js";
3
3
  import z from "../../../../is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js";
4
4
  import { CallableInstance as C } from "./callable-instance.js";
5
5
  import { trough as A } from "../../../../trough@2.2.0/node_modules/trough/lib/index.js";
@@ -1,7 +1,8 @@
1
- import { getAugmentedNamespace as e } from "./_commonjsHelpers.js";
2
- import * as r from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js";
3
- const m = /* @__PURE__ */ e(r);
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as s } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
3
+ var e = s();
4
+ const t = /* @__PURE__ */ r(e);
4
5
  export {
5
- m as default
6
+ t as default
6
7
  };
7
8
  //# sourceMappingURL=index3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,8 +1,7 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as s } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
3
- var e = s();
4
- const t = /* @__PURE__ */ r(e);
1
+ import { getAugmentedNamespace as e } from "./_commonjsHelpers.js";
2
+ import * as r from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js";
3
+ const m = /* @__PURE__ */ e(r);
5
4
  export {
6
- t as default
5
+ m as default
7
6
  };
8
7
  //# sourceMappingURL=index4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,6 +1,8 @@
1
- import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js";
2
- var i = r();
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as o } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-js@1.1.18/node_modules/style-to-js/cjs/index.js";
3
+ var t = o();
4
+ const a = /* @__PURE__ */ r(t);
3
5
  export {
4
- i as d
6
+ a as default
5
7
  };
6
8
  //# sourceMappingURL=index5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,7 +1,7 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-js@1.1.18/node_modules/style-to-js/cjs/index.js";
3
- var t = o();
4
- const a = /* @__PURE__ */ r(t);
1
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
+ import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js";
3
+ var t = r();
4
+ const a = /* @__PURE__ */ e(t);
5
5
  export {
6
6
  a as default
7
7
  };
@@ -1,8 +1,6 @@
1
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
- import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/extend@3.0.2/node_modules/extend/index.js";
3
- var t = r();
4
- const a = /* @__PURE__ */ e(t);
1
+ import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js";
2
+ var i = r();
5
3
  export {
6
- a as default
4
+ i as d
7
5
  };
8
6
  //# sourceMappingURL=index7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -2,14 +2,14 @@ import { j as S } from "../../_virtual/jsx-runtime.js";
2
2
  import { useRef as n, useState as I, useEffect as L } from "react";
3
3
  import U 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.js";
4
4
  const ee = ({
5
- html: u,
5
+ html: f,
6
6
  loadingText: W,
7
7
  styleLoadingText: z,
8
8
  scriptLoadingText: k,
9
- resetToken: f = 0,
9
+ resetToken: d = 0,
10
10
  mode: q = "content"
11
11
  }) => {
12
- const H = n(null), C = n(null), [V, N] = I(!0), [_, E] = I(!1), [O, b] = I(!1), w = n([]), R = n([]), j = n(0), D = n(0), p = n(null), d = n(null), m = n(!1), h = n(!1), A = n(!1), M = n(f), Q = 200, c = (t) => {
12
+ const H = n(null), C = n(null), [V, N] = I(!0), [_, E] = I(!1), [O, b] = I(!1), w = n([]), R = n([]), j = n(0), D = n(0), p = n(null), m = n(null), h = n(!1), y = n(!1), A = n(!1), M = n(d), Q = 200, c = (t) => {
13
13
  t.current && (clearTimeout(t.current), t.current = null);
14
14
  }, T = (t, s, o, v) => {
15
15
  const a = performance.now() - o.current, x = Math.max(0, Q - a);
@@ -24,7 +24,7 @@ const ee = ({
24
24
  let o = t.getElementById(s);
25
25
  o || (o = t.createElement("style"), o.id = s, o.textContent = "@keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }", t.head?.appendChild(o));
26
26
  }, []), L(() => {
27
- f !== M.current && (A.current = !1, M.current = f), c(p), c(d), m.current = !1, h.current = !1;
27
+ d !== M.current && (A.current = !1, M.current = d), c(p), c(m), h.current = !1, y.current = !1;
28
28
  const t = C.current;
29
29
  if (!t) return;
30
30
  const s = t.ownerDocument, o = s?.body;
@@ -33,32 +33,32 @@ const ee = ({
33
33
  const v = A.current;
34
34
  N(!v), E(!1), b(!1), t.innerHTML = "";
35
35
  const a = document.createElement("div");
36
- a.innerHTML = u;
37
- const x = (u.match(/<script[\s>]/gi) || []).length, J = (u.match(/<\/script>/gi) || []).length, K = x > 0 && x === J, l = [];
36
+ a.innerHTML = f;
37
+ const x = (f.match(/<script[\s>]/gi) || []).length, J = (f.match(/<\/script>/gi) || []).length, K = x > 0 && x === J, u = [];
38
38
  Array.from(a.querySelectorAll("style, script")).forEach((e) => {
39
39
  if (e.tagName.toLowerCase() === "style") {
40
40
  const r = s.createElement("style");
41
41
  r.textContent = e.textContent || "", Array.from(e.attributes).forEach((i) => {
42
42
  r.setAttribute(i.name, i.value);
43
- }), l.push(r);
43
+ }), u.push(r);
44
44
  } else {
45
45
  const r = s.createElement("script");
46
46
  Array.from(e.attributes).forEach((i) => {
47
47
  r.setAttribute(i.name, i.value);
48
- }), r.textContent = e.textContent || "", l.push(r);
48
+ }), r.textContent = e.textContent || "", u.push(r);
49
49
  }
50
50
  e.remove();
51
51
  });
52
- const B = l.some(
52
+ const B = u.some(
53
53
  (e) => e.tagName.toLowerCase() === "style"
54
- ), F = l.some(
54
+ ), F = u.some(
55
55
  (e) => e.tagName.toLowerCase() === "script"
56
56
  );
57
- B && (m.current = !0, j.current = performance.now(), c(p), E(!0)), F && (h.current = !0, D.current = performance.now(), c(d), b(!0));
57
+ B && (h.current = !0, j.current = performance.now(), c(p), E(!0)), F && (y.current = !0, D.current = performance.now(), c(m), b(!0));
58
58
  const G = !!a.firstElementChild;
59
59
  N(!G && !v), G && (A.current = !0);
60
60
  const P = Array.from(a.childNodes);
61
- t.append(...P), l.forEach((e) => {
61
+ t.append(...P), u.forEach((e) => {
62
62
  if (e.tagName.toLowerCase() === "style") {
63
63
  s.head?.appendChild(e), w.current.push(e);
64
64
  return;
@@ -85,24 +85,24 @@ const ee = ({
85
85
  p,
86
86
  j,
87
87
  () => {
88
- m.current = !1;
88
+ h.current = !1;
89
89
  }
90
90
  ), F && T(
91
91
  b,
92
- d,
92
+ m,
93
93
  D,
94
94
  () => {
95
- h.current = !1;
95
+ y.current = !1;
96
96
  }
97
97
  );
98
98
  });
99
- }, [u, f]), L(
99
+ }, [f, d]), L(
100
100
  () => () => {
101
- c(p), c(d);
101
+ c(p), c(m);
102
102
  },
103
103
  []
104
104
  );
105
- const y = O || h.current ? k || "Building scripts cache..." : _ || m.current ? z || "Building styles..." : V ? W || "Loading..." : null, g = q === "blackboard";
105
+ const g = O || y.current ? k || "Building scripts cache..." : _ || h.current ? z || "Building styles..." : V ? W || "Loading..." : null, l = q === "blackboard";
106
106
  return /* @__PURE__ */ S.jsxs(
107
107
  "div",
108
108
  {
@@ -110,24 +110,25 @@ const ee = ({
110
110
  style: {
111
111
  position: "relative",
112
112
  width: "100%",
113
- height: g ? "100vh" : void 0,
114
- display: g ? "flex" : void 0,
115
- flexDirection: g ? "column" : void 0,
113
+ height: l ? "100vh" : void 0,
114
+ display: l ? "flex" : void 0,
115
+ flexDirection: l ? "column" : void 0,
116
116
  // if use center, too long iframe wont see header
117
- justifyContent: g ? "space-around" : void 0
117
+ justifyContent: l ? "space-around" : void 0,
118
+ alignItems: l ? "center" : void 0
118
119
  },
119
- "aria-busy": !!y,
120
+ "aria-busy": !!g,
120
121
  children: [
121
122
  /* @__PURE__ */ S.jsx(
122
123
  "div",
123
124
  {
124
125
  ref: C,
125
126
  style: {
126
- pointerEvents: y ? "none" : void 0
127
+ pointerEvents: g ? "none" : void 0
127
128
  }
128
129
  }
129
130
  ),
130
- y && /* @__PURE__ */ S.jsxs(
131
+ g && /* @__PURE__ */ S.jsxs(
131
132
  "div",
132
133
  {
133
134
  style: {
@@ -153,7 +154,7 @@ const ee = ({
153
154
  style: { animation: "sandbox-spin 1s linear infinite" }
154
155
  }
155
156
  ),
156
- y
157
+ g
157
158
  ]
158
159
  }
159
160
  )
@@ -1 +1 @@
1
- {"version":3,"file":"SandboxApp.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 resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n}\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n}) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isWaitingFirstDiv, 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 styleEl.textContent =\n \"@keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }\";\n doc.head?.appendChild(styleEl);\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\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 container.innerHTML = \"\";\n const wrapper = document.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\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.append(...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 if (isWaitingFirstDiv) return loadingText || \"Loading...\";\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n\n return (\n <div\n ref={wrapperRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: isBlackboard ? \"100vh\" : undefined,\n display: isBlackboard ? \"flex\" : undefined,\n flexDirection: isBlackboard ? \"column\" : undefined,\n // if use center, too long iframe wont see header\n justifyContent: isBlackboard ? \"space-around\" : undefined,\n }}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n style={{\n pointerEvents: overlayMessage ? \"none\" : undefined,\n }}\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":["SandboxApp","html","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","wrapperRef","useRef","containerRef","isWaitingFirstDiv","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","node","hasRenderedBefore","wrapper","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","hasFirstElement","contentNodes","scriptNode","scriptText","overlayMessage","isBlackboard","jsxs","jsx","Loader2"],"mappings":";;;AAYA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAAC,IAAO;AACT,MAAM;AACJ,QAAMC,IAAaC,EAAuB,IAAI,GACxCC,IAAeD,EAAuB,IAAI,GAC1C,CAACE,GAAmBC,CAAoB,IAAIC,EAAS,EAAI,GACzD,CAACC,GAAoBC,CAAqB,IAAIF,EAAS,EAAK,GAC5D,CAACG,GAAqBC,CAAsB,IAAIJ,EAAS,EAAK,GAC9DK,IAAoBT,EAA2B,EAAE,GACjDU,IAAqBV,EAA4B,EAAE,GACnDW,IAAgBX,EAAO,CAAC,GACxBY,IAAiBZ,EAAO,CAAC,GACzBa,IAAgBb,EAAsB,IAAI,GAC1Cc,IAAiBd,EAAsB,IAAI,GAC3Ce,IAAef,EAAO,EAAK,GAC3BgB,IAAgBhB,EAAO,EAAK,GAC5BiB,IAAwBjB,EAAO,EAAK,GACpCkB,IAAoBlB,EAAOH,CAAU,GACrCsB,IAAiB,KAEjBC,IAAa,CAACC,MAAoD;AACtE,IAAIA,EAAS,YACX,aAAaA,EAAS,OAAO,GAC7BA,EAAS,UAAU;AAAA,EAEvB,GAEMC,IAA8B,CAClCC,GACAF,GACAG,GACAC,MACG;AACH,UAAMC,IAAU,YAAY,IAAA,IAAQ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BR,KAAe,eACtC,MAGHyD,IAAerD,MAAS;AAE9B,SACEsD,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKrD;AAAA,MACL,OAAO;AAAA,QACL,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQoD,IAAe,UAAU;AAAA,QACjC,SAASA,IAAe,SAAS;AAAA,QACjC,eAAeA,IAAe,WAAW;AAAA;AAAA,QAEzC,gBAAgBA,IAAe,iBAAiB;AAAA,MAAA;AAAA,MAElD,aAAW,CAAC,CAACD;AAAA,MAEb,UAAA;AAAA,QAAAG,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKpD;AAAA,YACL,OAAO;AAAA,cACL,eAAeiD,IAAiB,SAAS;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,QAEDA,KACCE,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,cAEvDJ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"SandboxApp.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 resetToken?: number;\n mode?: \"content\" | \"blackboard\";\n}\n\nconst SandboxApp: React.FC<SandboxAppProps> = ({\n html,\n loadingText,\n styleLoadingText,\n scriptLoadingText,\n resetToken = 0,\n mode = \"content\",\n}) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const [isWaitingFirstDiv, 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 styleEl.textContent =\n \"@keyframes sandbox-spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }\";\n doc.head?.appendChild(styleEl);\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\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 container.innerHTML = \"\";\n const wrapper = document.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\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.append(...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 if (isWaitingFirstDiv) return loadingText || \"Loading...\";\n return null;\n })();\n\n const isBlackboard = mode === \"blackboard\";\n\n return (\n <div\n ref={wrapperRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: isBlackboard ? \"100vh\" : undefined,\n display: isBlackboard ? \"flex\" : undefined,\n flexDirection: isBlackboard ? \"column\" : undefined,\n // if use center, too long iframe wont see header\n justifyContent: isBlackboard ? \"space-around\" : undefined,\n alignItems: isBlackboard ? \"center\" : undefined,\n }}\n aria-busy={!!overlayMessage}\n >\n <div\n ref={containerRef}\n style={{\n pointerEvents: overlayMessage ? \"none\" : undefined,\n }}\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":["SandboxApp","html","loadingText","styleLoadingText","scriptLoadingText","resetToken","mode","wrapperRef","useRef","containerRef","isWaitingFirstDiv","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","node","hasRenderedBefore","wrapper","openScriptCount","closeScriptCount","shouldExecuteScripts","resourceQueue","cloned","attr","replacement","hasStyles","hasScripts","hasFirstElement","contentNodes","scriptNode","scriptText","overlayMessage","isBlackboard","jsxs","jsx","Loader2"],"mappings":";;;AAYA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,MAAAC;AAAA,E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AAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKpD;AAAA,YACL,OAAO;AAAA,cACL,eAAeiD,IAAiB,SAAS;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,QAEDA,KACCE,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,cAEvDJ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -28,37 +28,48 @@ const k = /<(script|style|link|iframe|html|head|body|meta|title|base|template|di
28
28
  if (!o.trim().startsWith("|")) break;
29
29
  m.push(o);
30
30
  }
31
- const d = m.join(`
31
+ const a = m.join(`
32
32
  `);
33
- return { start: e, block: d, end: e + d.length };
33
+ return { start: e, block: a, end: e + a.length };
34
34
  }, g = (t, n = !1) => {
35
35
  const s = t.indexOf("```");
36
- if (n && s !== -1 && t.indexOf("```", s + 3) === -1) {
37
- const i = t.slice(0, s).trimEnd(), u = t.slice(s), a = [];
38
- return i && a.push({ type: "text", value: i }), a.push({ type: "markdown", value: u }), a;
36
+ if (s !== -1 && t.indexOf("```", s + 3) === -1) {
37
+ if (n) {
38
+ const i = t.slice(0, s).trimEnd(), d = t.slice(s), u = [];
39
+ return i && u.push({ type: "text", value: i }), u.push({ type: "markdown", value: d }), u;
40
+ }
41
+ return [{ type: "markdown", value: t }];
39
42
  }
40
43
  const e = t.search(/<svg\b/i);
41
44
  if (n && e !== -1) {
42
- const l = t.slice(0, e), r = t.indexOf("</svg>", e), i = r === -1 ? `${t.slice(e)}</svg>` : t.slice(e, r + 6), u = r === -1 ? "" : t.slice(r + 6), a = [];
43
- return l.trim() && a.push({ type: "text", value: l }), a.push({ type: "markdown", value: i }), u.trim() && a.push(...g(u, !0)), a;
45
+ const l = t.slice(0, e), r = t.indexOf("</svg>", e), i = r === -1 ? `${t.slice(e)}</svg>` : t.slice(e, r + 6), d = r === -1 ? "" : t.slice(r + 6), u = [];
46
+ return l.trim() && u.push({ type: "text", value: l }), u.push({ type: "markdown", value: i }), d.trim() && u.push(...g(d, !0)), u;
44
47
  }
45
48
  if (e !== -1 && t.indexOf("</svg>", e) === -1)
46
- return [{ type: "markdown", value: t }];
49
+ return [{ type: "markdown", value: `${t}</svg>` }];
47
50
  const c = O(t);
48
51
  if (c) {
49
52
  const l = [], r = t.slice(0, c.start);
50
53
  n && r.trim() && l.push({ type: "text", value: r }), l.push({ type: "markdown", value: c.block });
51
- const i = t.slice(c.end), u = i.length < t.length;
52
- return i.trim() && u && l.push(
54
+ const i = t.slice(c.end), d = i.length < t.length;
55
+ return i.trim() && d && l.push(
53
56
  ...n ? g(i, !0) : g(i)
54
57
  ), l;
55
58
  }
56
59
  if (t.match(/<svg[\s\S]*?<\/svg>/i) && n)
57
60
  return t.trim().toLowerCase().endsWith("</svg>") ? [{ type: "markdown", value: t }] : [{ type: "markdown", value: `${t}</svg>` }];
58
- const d = t.search(k), o = E(t);
59
- if (d === -1 && !o)
61
+ const a = t.search(k), o = E(t);
62
+ if (a === -1 && !o)
60
63
  return n && t.trim() ? [{ type: "text", value: t }] : [];
61
- const f = !!o && (d === -1 || o.start < d), v = f ? o.start : d, p = f ? o.end : I(t, v), h = [], b = t.slice(0, v), S = t.slice(v, p), x = t.slice(p);
64
+ const f = !!o && (a === -1 || o.start < a);
65
+ if (!n)
66
+ return [
67
+ {
68
+ type: f ? "markdown" : "sandbox",
69
+ value: t
70
+ }
71
+ ];
72
+ const v = f ? o.start : a, p = f ? o.end : I(t, v), h = [], b = t.slice(0, v), S = t.slice(v, p), x = t.slice(p);
62
73
  return n && b.trim() && h.push({ type: "text", value: b }), h.push({
63
74
  type: f ? "markdown" : "sandbox",
64
75
  value: S
@@ -1 +1 @@
1
- {"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string }\n | { type: \"text\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\nconst extractTableBlock = (\n raw: string\n): { start: number; block: string; end: number } | null => {\n const tableMatch = raw.match(/^\\s*\\|.+\\|\\s*$/m);\n if (!tableMatch || typeof tableMatch.index !== \"number\") return null;\n\n const leadingSpaces = tableMatch[0].match(/^\\s*/)?.[0].length ?? 0;\n const tableStart = tableMatch.index + leadingSpaces;\n\n const lines = raw.slice(tableStart).split(\"\\n\");\n const tableLines: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"|\")) break;\n tableLines.push(line);\n }\n\n const block = tableLines.join(\"\\n\");\n return { start: tableStart, block, end: tableStart + block.length };\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (\n raw: string,\n keepText = false\n): RenderSegment[] => {\n const fenceStart = raw.indexOf(\"```\");\n if (keepText && fenceStart !== -1) {\n const closingFence = raw.indexOf(\"```\", fenceStart + 3);\n if (closingFence === -1) {\n const before = raw.slice(0, fenceStart);\n const beforeText = before.trimEnd();\n const fenceBlock = raw.slice(fenceStart);\n const segments: RenderSegment[] = [];\n if (beforeText) {\n segments.push({ type: \"text\", value: beforeText });\n }\n segments.push({ type: \"markdown\", value: fenceBlock });\n return segments;\n }\n }\n\n const svgOpenIndex = raw.search(/<svg\\b/i);\n if (keepText && svgOpenIndex !== -1) {\n const before = raw.slice(0, svgOpenIndex);\n const closeIdx = raw.indexOf(\"</svg>\", svgOpenIndex);\n const svgBlock =\n closeIdx === -1\n ? `${raw.slice(svgOpenIndex)}</svg>`\n : raw.slice(svgOpenIndex, closeIdx + \"</svg>\".length);\n const after = closeIdx === -1 ? \"\" : raw.slice(closeIdx + \"</svg>\".length);\n\n const segments: RenderSegment[] = [];\n if (before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: svgBlock });\n if (after.trim()) {\n segments.push(...splitContentSegments(after, true));\n }\n return segments;\n }\n if (svgOpenIndex !== -1 && raw.indexOf(\"</svg>\", svgOpenIndex) === -1) {\n return [{ type: \"markdown\", value: raw }];\n }\n\n const tableBlock = extractTableBlock(raw);\n if (tableBlock) {\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, tableBlock.start);\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: tableBlock.block });\n const after = raw.slice(tableBlock.end);\n const hasProgress = after.length < raw.length;\n if (after.trim() && hasProgress) {\n segments.push(\n ...(keepText\n ? splitContentSegments(after, true)\n : splitContentSegments(after))\n );\n }\n return segments;\n }\n\n const completeSvgMatch = raw.match(/<svg[\\s\\S]*?<\\/svg>/i);\n if (completeSvgMatch && keepText) {\n if (!raw.trim().toLowerCase().endsWith(\"</svg>\")) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n return [{ type: \"markdown\", value: raw }];\n }\n\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n if (keepText && raw.trim()) {\n return [{ type: \"text\", value: raw }];\n }\n return [];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, startIndex);\n const matchedBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: matchedBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after, keepText));\n }\n\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","extractTableBlock","tableMatch","leadingSpaces","tableStart","lines","tableLines","line","block","splitContentSegments","keepText","fenceStart","beforeText","fenceBlock","segments","svgOpenIndex","before","closeIdx","svgBlock","after","tableBlock","hasProgress","sandboxStartIndex","inlineMatch","shouldUseInline","matchedBlock"],"mappings":"AAKA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAgB,YAAY,GAEpBK,IAAQL,EAAgB,KAAKE,CAAG;AACtC,QAAI,EAAAG,EAAM,SAASF,IACnB;AAAA,MAAAC,IAAWC,EAAM,QAAQA,EAAM,CAAC,EAAE;AAClC;AAAA;AAGF,SAAOD;AACT,GAEME,IAAyB,CAACJ,MAAoC;AAClE,MAAIK,IAA+B;AAEnC,SAAAR,EAAwB,QAAQ,CAACS,MAAY;AAC3C,UAAMH,IAAQG,EAAQ,KAAKN,CAAG;AAC9B,QAAI,CAACG,KAAS,OAAOA,EAAM,SAAU,SAAU;AAC/C,UAAMI,IAAQJ,EAAM,OACdK,IAAML,EAAM,QAAQA,EAAM,CAAC,EAAE;AAEnC,KAAI,CAACE,KAAYE,IAAQF,EAAS,WAChCA,IAAW,EAAE,OAAAE,GAAO,KAAAC,EAAA;AAAA,EAExB,CAAC,GAEMH;AACT,GAEMI,IAAoB,CACxBT,MACyD;AACzD,QAAMU,IAAaV,EAAI,MAAM,iBAAiB;AAC9C,MAAI,CAACU,KAAc,OAAOA,EAAW,SAAU,SAAU,QAAO;AAEhE,QAAMC,IAAgBD,EAAW,CAAC,EAAE,MAAM,MAAM,IAAI,CAAC,EAAE,UAAU,GAC3DE,IAAaF,EAAW,QAAQC,GAEhCE,IAAQb,EAAI,MAAMY,CAAU,EAAE,MAAM;AAAA,CAAI,GACxCE,IAAuB,CAAA;AAE7B,aAAWC,KAAQF,GAAO;AAExB,QAAI,CADYE,EAAK,KAAA,EACR,WAAW,GAAG,EAAG;AAC9B,IAAAD,E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YM,EAAO,UACrBF,EAAS,KAAK,EAAE,MAAM,QAAQ,OAAOE,GAAQ,GAG/CF,EAAS,KAAK;AAAA,IACZ,MAAMU,IAAkB,aAAa;AAAA,IACrC,OAAOC;AAAA,EAAA,CACR,GAEGN,EAAM,UACRL,EAAS,KAAK,GAAGL,EAAqBU,GAAOT,CAAQ,CAAC,GAGjDI;AACT;"}
1
+ {"version":3,"file":"split-content.js","sources":["../../../../src/components/ContentRender/utils/split-content.ts"],"sourcesContent":["export type RenderSegment =\n | { type: \"markdown\"; value: string }\n | { type: \"sandbox\"; value: string }\n | { type: \"text\"; value: string };\n\nconst SANDBOX_START_PATTERN =\n /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\\s>]/i;\n\nconst INLINE_SANDBOX_PATTERNS: RegExp[] = [\n /<svg[\\s\\S]*?<\\/svg>/i,\n /<img\\b[^>]*?>/i,\n /```mermaid[\\s\\S]*?```/i,\n /```[a-zA-Z0-9]+[\\s\\S]*?```/i,\n];\n\nconst closingBoundary = /<\\/[a-z][^>]*>\\s*\\n(?=[^\\s<])/gi;\n\ntype MatchResult = { start: number; end: number };\n\nconst findHtmlBlockEnd = (raw: string, startIndex: number) => {\n let blockEnd = raw.length;\n let match: RegExpExecArray | null;\n closingBoundary.lastIndex = 0;\n\n while ((match = closingBoundary.exec(raw))) {\n if (match.index <= startIndex) continue;\n blockEnd = match.index + match[0].length;\n break;\n }\n\n return blockEnd;\n};\n\nconst findInlineSandboxMatch = (raw: string): MatchResult | null => {\n let earliest: MatchResult | null = null;\n\n INLINE_SANDBOX_PATTERNS.forEach((pattern) => {\n const match = pattern.exec(raw);\n if (!match || typeof match.index !== \"number\") return;\n const start = match.index;\n const end = match.index + match[0].length;\n\n if (!earliest || start < earliest.start) {\n earliest = { start, end };\n }\n });\n\n return earliest;\n};\n\nconst extractTableBlock = (\n raw: string\n): { start: number; block: string; end: number } | null => {\n const tableMatch = raw.match(/^\\s*\\|.+\\|\\s*$/m);\n if (!tableMatch || typeof tableMatch.index !== \"number\") return null;\n\n const leadingSpaces = tableMatch[0].match(/^\\s*/)?.[0].length ?? 0;\n const tableStart = tableMatch.index + leadingSpaces;\n\n const lines = raw.slice(tableStart).split(\"\\n\");\n const tableLines: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"|\")) break;\n tableLines.push(line);\n }\n\n const block = tableLines.join(\"\\n\");\n return { start: tableStart, block, end: tableStart + block.length };\n};\n\n// Split incoming markdown content into markdown and sandbox HTML segments\nexport const splitContentSegments = (\n raw: string,\n keepText = false\n): RenderSegment[] => {\n const fenceStart = raw.indexOf(\"```\");\n if (fenceStart !== -1) {\n const closingFence = raw.indexOf(\"```\", fenceStart + 3);\n if (closingFence === -1) {\n if (keepText) {\n const before = raw.slice(0, fenceStart);\n const beforeText = before.trimEnd();\n const fenceBlock = raw.slice(fenceStart);\n const segments: RenderSegment[] = [];\n if (beforeText) {\n segments.push({ type: \"text\", value: beforeText });\n }\n segments.push({ type: \"markdown\", value: fenceBlock });\n return segments;\n }\n return [{ type: \"markdown\", value: raw }];\n }\n }\n\n const svgOpenIndex = raw.search(/<svg\\b/i);\n if (keepText && svgOpenIndex !== -1) {\n const before = raw.slice(0, svgOpenIndex);\n const closeIdx = raw.indexOf(\"</svg>\", svgOpenIndex);\n const svgBlock =\n closeIdx === -1\n ? `${raw.slice(svgOpenIndex)}</svg>`\n : raw.slice(svgOpenIndex, closeIdx + \"</svg>\".length);\n const after = closeIdx === -1 ? \"\" : raw.slice(closeIdx + \"</svg>\".length);\n\n const segments: RenderSegment[] = [];\n if (before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: svgBlock });\n if (after.trim()) {\n segments.push(...splitContentSegments(after, true));\n }\n return segments;\n }\n if (svgOpenIndex !== -1 && raw.indexOf(\"</svg>\", svgOpenIndex) === -1) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n\n const tableBlock = extractTableBlock(raw);\n if (tableBlock) {\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, tableBlock.start);\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n segments.push({ type: \"markdown\", value: tableBlock.block });\n const after = raw.slice(tableBlock.end);\n const hasProgress = after.length < raw.length;\n if (after.trim() && hasProgress) {\n segments.push(\n ...(keepText\n ? splitContentSegments(after, true)\n : splitContentSegments(after))\n );\n }\n return segments;\n }\n\n const completeSvgMatch = raw.match(/<svg[\\s\\S]*?<\\/svg>/i);\n if (completeSvgMatch && keepText) {\n if (!raw.trim().toLowerCase().endsWith(\"</svg>\")) {\n return [{ type: \"markdown\", value: `${raw}</svg>` }];\n }\n return [{ type: \"markdown\", value: raw }];\n }\n\n const sandboxStartIndex = raw.search(SANDBOX_START_PATTERN);\n const inlineMatch = findInlineSandboxMatch(raw);\n\n if (sandboxStartIndex === -1 && !inlineMatch) {\n if (keepText && raw.trim()) {\n return [{ type: \"text\", value: raw }];\n }\n return [];\n }\n\n const shouldUseInline =\n !!inlineMatch &&\n (sandboxStartIndex === -1 || inlineMatch.start < sandboxStartIndex);\n\n if (!keepText) {\n return [\n {\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: raw,\n },\n ];\n }\n\n const startIndex = shouldUseInline ? inlineMatch!.start : sandboxStartIndex;\n const blockEnd = shouldUseInline\n ? inlineMatch!.end\n : findHtmlBlockEnd(raw, startIndex);\n\n const segments: RenderSegment[] = [];\n const before = raw.slice(0, startIndex);\n const matchedBlock = raw.slice(startIndex, blockEnd);\n const after = raw.slice(blockEnd);\n\n if (keepText && before.trim()) {\n segments.push({ type: \"text\", value: before });\n }\n\n segments.push({\n type: shouldUseInline ? \"markdown\" : \"sandbox\",\n value: matchedBlock,\n });\n\n if (after.trim()) {\n segments.push(...splitContentSegments(after, keepText));\n }\n\n return segments;\n};\n"],"names":["SANDBOX_START_PATTERN","INLINE_SANDBOX_PATTERNS","closingBoundary","findHtmlBlockEnd","raw","startIndex","blockEnd","match","findInlineSandboxMatch","earliest","pattern","start","end","extractTableBlock","tableMatch","leadingSpaces","tableStart","lines","tableLines","line","block","splitContentSegments","keepText","fenceStart","beforeText","fenceBlock","segments","svgOpenIndex","before","closeIdx","svgBlock","after","tableBlock","hasProgress","sandboxStartIndex","inlineMatch","shouldUseInline","matchedBlock"],"mappings":"AAKA,MAAMA,IACJ,sGAEIC,IAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAAkB,mCAIlBC,IAAmB,CAACC,GAAaC,MAAuB;AAC5D,MAAIC,IAAWF,EAAI,QACfG;AAGJ,OAFAL,EAAgB,YAAY,GAEpBK,IAAQL,EAAgB,KAAKE,CAAG;AACtC,QAAI,EAAAG,EAAM,SAASF,IACnB;AAAA,MAAAC,IAAWC,EAAM,QAAQA,EAAM,CAAC,EAAE;AAClC;AAAA;AAGF,SAAOD;AACT,GAEME,IAAyB,CAACJ,MAAoC;AAClE,MAAIK,IAA+B;AAEnC,SAAAR,EAAwB,QAAQ,CAACS,MAAY;AAC3C,UAAMH,IAAQG,EAAQ,KAAKN,CAAG;AAC9B,QAAI,CAACG,KAAS,OAAOA,EAAM,SAAU,SAAU;AAC/C,UAAMI,IAAQJ,EAAM,OACdK,IAAML,EAAM,QAAQA,EAAM,CAAC,EAAE;AAEnC,KAAI,CAACE,KAAYE,IAAQF,EAAS,WAChCA,IAAW,EAAE,OAAAE,GAAO,KAAAC,EAAA;AAAA,EAExB,CAAC,GAEMH;AACT,GAEMI,IAAoB,CACxBT,MACyD;AACzD,QAAMU,IAAaV,EAAI,MAAM,iBAAiB;AAC9C,MAAI,CAACU,KAAc,OAAOA,EAAW,SAAU,SAAU,QAAO;AAEhE,QAAMC,IAAgBD,EAAW,CAAC,EAAE,MAAM,MAAM,IAAI,CAAC,EAAE,UAAU,GAC3DE,IAAaF,EAAW,QAAQC,GAEhCE,IAAQb,EAAI,MAAMY,CAAU,EAAE,MAAM;AAAA,CAAI,GACxCE,I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a;AAAA,QACrC,OAAOhC;AAAA,MAAA;AAAA,IACT;AAIJ,QAAMC,IAAa+B,IAAkBD,EAAa,QAAQD,GACpD5B,IAAW8B,IACbD,EAAa,MACbhC,EAAiBC,GAAKC,CAAU,GAE9BqB,IAA4B,CAAA,GAC5BE,IAASxB,EAAI,MAAM,GAAGC,CAAU,GAChCgC,IAAejC,EAAI,MAAMC,GAAYC,CAAQ,GAC7CyB,IAAQ3B,EAAI,MAAME,CAAQ;AAEhC,SAAIgB,KAAYM,EAAO,UACrBF,EAAS,KAAK,EAAE,MAAM,QAAQ,OAAOE,GAAQ,GAG/CF,EAAS,KAAK;AAAA,IACZ,MAAMU,IAAkB,aAAa;AAAA,IACrC,OAAOC;AAAA,EAAA,CACR,GAEGN,EAAM,UACRL,EAAS,KAAK,GAAGL,EAAqBU,GAAOT,CAAQ,CAAC,GAGjDI;AACT;"}
@@ -1,7 +1,7 @@
1
1
  import { j as i } from "../../../_virtual/jsx-runtime.js";
2
2
  import * as d from "react";
3
3
  import n from "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.js";
4
- import "../../../_virtual/index4.js";
4
+ import "../../../_virtual/index3.js";
5
5
  import "../../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
6
6
  import "../../../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/hooks/useLayoutEffect.js";
7
7
  import "../../../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/raf.js";
package/package.json CHANGED
@@ -149,7 +149,7 @@
149
149
  "storybook": "storybook dev -p 6006",
150
150
  "test": "echo \"No tests specified\" && exit 0"
151
151
  },
152
- "version": "0.1.83-beta.16",
152
+ "version": "0.1.83-beta.18",
153
153
  "type": "module",
154
154
  "exports": {
155
155
  ".": {