markdown-flow-ui 0.1.129 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/_virtual/index.cjs8.js +1 -1
  2. package/dist/_virtual/index.cjs9.js +1 -1
  3. package/dist/_virtual/index.es8.js +2 -2
  4. package/dist/_virtual/index.es9.js +2 -2
  5. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  6. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  7. package/dist/components/ContentRender/ContentRender.d.ts +4 -0
  8. package/dist/components/ContentRender/ContentRender.es.js +217 -211
  9. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  10. package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -0
  11. package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
  12. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  13. package/dist/components/ContentRender/IframeSandbox.d.ts +3 -0
  14. package/dist/components/ContentRender/IframeSandbox.es.js +210 -196
  15. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  16. package/dist/components/ContentRender/MarkdownFlowInput.cjs.js +1 -1
  17. package/dist/components/ContentRender/MarkdownFlowInput.cjs.js.map +1 -1
  18. package/dist/components/ContentRender/MarkdownFlowInput.d.ts +3 -0
  19. package/dist/components/ContentRender/MarkdownFlowInput.es.js +35 -32
  20. package/dist/components/ContentRender/MarkdownFlowInput.es.js.map +1 -1
  21. package/dist/components/ContentRender/MarkdownFlowInput.stories.d.ts +6 -0
  22. package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
  23. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  24. package/dist/components/ContentRender/SandboxApp.d.ts +3 -0
  25. package/dist/components/ContentRender/SandboxApp.es.js +117 -104
  26. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  27. package/dist/components/ContentRender/blackboard-vendor.cjs.js +1 -1
  28. package/dist/components/ContentRender/blackboard-vendor.cjs.js.map +1 -1
  29. package/dist/components/ContentRender/blackboard-vendor.es.js +14 -9
  30. package/dist/components/ContentRender/blackboard-vendor.es.js.map +1 -1
  31. package/dist/components/ContentRender/cjkFontFamily.cjs.js +2 -0
  32. package/dist/components/ContentRender/cjkFontFamily.cjs.js.map +1 -0
  33. package/dist/components/ContentRender/cjkFontFamily.d.ts +5 -0
  34. package/dist/components/ContentRender/cjkFontFamily.es.js +45 -0
  35. package/dist/components/ContentRender/cjkFontFamily.es.js.map +1 -0
  36. package/dist/components/ContentRender/cjkFontFamily.test.d.ts +1 -0
  37. package/dist/components/ContentRender/contentRenderI18n.cjs.js +2 -0
  38. package/dist/components/ContentRender/contentRenderI18n.cjs.js.map +1 -0
  39. package/dist/components/ContentRender/contentRenderI18n.d.ts +15 -0
  40. package/dist/components/ContentRender/contentRenderI18n.es.js +59 -0
  41. package/dist/components/ContentRender/contentRenderI18n.es.js.map +1 -0
  42. package/dist/components/ContentRender/index.cjs.js +1 -1
  43. package/dist/components/ContentRender/index.d.ts +1 -0
  44. package/dist/components/ContentRender/index.es.js +1 -0
  45. package/dist/components/ContentRender/index.es.js.map +1 -1
  46. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
  47. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
  48. package/dist/components/ContentRender/plugins/CustomVariable.d.ts +3 -1
  49. package/dist/components/ContentRender/plugins/CustomVariable.es.js +131 -124
  50. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  51. package/dist/components/ContentRender/plugins/MermaidChart.cjs.js +1 -1
  52. package/dist/components/ContentRender/plugins/MermaidChart.cjs.js.map +1 -1
  53. package/dist/components/ContentRender/plugins/MermaidChart.es.js +19 -18
  54. package/dist/components/ContentRender/plugins/MermaidChart.es.js.map +1 -1
  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.d.ts +3 -0
  58. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +18 -15
  59. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  60. package/dist/components/MarkdownFlow/MarkdownFlow.stories.d.ts +6 -0
  61. package/dist/components/MarkdownFlow/ScrollableMarkdownFlow.d.ts +1 -0
  62. package/dist/components/MarkdownFlow/index.cjs.js +1 -1
  63. package/dist/components/MarkdownFlow/index.es.js +1 -0
  64. package/dist/components/MarkdownFlow/index.es.js.map +1 -1
  65. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js +1 -1
  66. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.js.map +1 -1
  67. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -2
  68. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +23 -22
  69. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  70. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.stories.d.ts +1 -1
  71. package/dist/components/MarkdownFlowEditor/editorI18n.cjs.js +1 -1
  72. package/dist/components/MarkdownFlowEditor/editorI18n.cjs.js.map +1 -1
  73. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -2
  74. package/dist/components/MarkdownFlowEditor/editorI18n.es.js +12 -24
  75. package/dist/components/MarkdownFlowEditor/editorI18n.es.js.map +1 -1
  76. package/dist/components/MarkdownFlowEditor/index.d.ts +1 -1
  77. package/dist/components/Slide/Player.cjs.js +1 -1
  78. package/dist/components/Slide/Player.cjs.js.map +1 -1
  79. package/dist/components/Slide/Player.d.ts +14 -30
  80. package/dist/components/Slide/Player.es.js +395 -383
  81. package/dist/components/Slide/Player.es.js.map +1 -1
  82. package/dist/components/Slide/Slide.cjs.js +1 -1
  83. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  84. package/dist/components/Slide/Slide.d.ts +22 -4
  85. package/dist/components/Slide/Slide.es.js +701 -659
  86. package/dist/components/Slide/Slide.es.js.map +1 -1
  87. package/dist/components/Slide/Slide.stories.d.ts +19 -20
  88. package/dist/components/Slide/constants.d.ts +0 -24
  89. package/dist/components/Slide/index.d.ts +2 -1
  90. package/dist/components/Slide/slideI18n.cjs.js +2 -0
  91. package/dist/components/Slide/slideI18n.cjs.js.map +1 -0
  92. package/dist/components/Slide/slideI18n.d.ts +44 -0
  93. package/dist/components/Slide/slideI18n.es.js +158 -0
  94. package/dist/components/Slide/slideI18n.es.js.map +1 -0
  95. package/dist/components/Slide/slideI18n.test.d.ts +1 -0
  96. package/dist/components/Slide/utils/playerVisibility.cjs.js +2 -0
  97. package/dist/components/Slide/utils/playerVisibility.cjs.js.map +1 -0
  98. package/dist/components/Slide/utils/playerVisibility.d.ts +10 -0
  99. package/dist/components/Slide/utils/playerVisibility.es.js +11 -0
  100. package/dist/components/Slide/utils/playerVisibility.es.js.map +1 -0
  101. package/dist/components/Slide/utils/playerVisibility.test.d.ts +1 -0
  102. package/dist/components/index.d.ts +2 -1
  103. package/dist/editor.d.ts +3 -2
  104. package/dist/index.cjs.js +1 -1
  105. package/dist/index.es.js +14 -13
  106. package/dist/index.es.js.map +1 -1
  107. package/dist/lib/locale.cjs.js +2 -0
  108. package/dist/lib/locale.cjs.js.map +1 -0
  109. package/dist/lib/locale.d.ts +4 -0
  110. package/dist/lib/locale.es.js +19 -0
  111. package/dist/lib/locale.es.js.map +1 -0
  112. package/dist/lib/localeTextMap.cjs.js +2 -0
  113. package/dist/lib/localeTextMap.cjs.js.map +1 -0
  114. package/dist/lib/localeTextMap.d.ts +4 -0
  115. package/dist/lib/localeTextMap.es.js +5 -0
  116. package/dist/lib/localeTextMap.es.js.map +1 -0
  117. package/dist/markdown-flow-ui-lib.css +1 -1
  118. package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  119. package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  120. package/dist/node_modules/classnames/index.cjs.js +1 -1
  121. package/dist/node_modules/classnames/index.es.js +1 -1
  122. package/dist/renderer.cjs.js +1 -1
  123. package/dist/renderer.d.ts +1 -0
  124. package/dist/renderer.es.js +15 -14
  125. package/dist/renderer.es.js.map +1 -1
  126. package/dist/slide.d.ts +1 -0
  127. package/package.json +1 -1
  128. package/dist/components/Slide/constants.cjs.js +0 -2
  129. package/dist/components/Slide/constants.cjs.js.map +0 -1
  130. package/dist/components/Slide/constants.es.js +0 -28
  131. package/dist/components/Slide/constants.es.js.map +0 -1
@@ -1,112 +1,117 @@
1
- import { j as y } from "../../_virtual/jsx-runtime.es.js";
2
- import j, { useRef as i, useState as C, useCallback as De, useEffect as p, useMemo as Pe } from "react";
3
- import { createRoot as $e } from "react-dom/client";
4
- import ze from "./SandboxApp.es.js";
5
- import qe from "./ContentRender.es.js";
6
- import { inspectViewportHeightFromHtmlRootString as Ce, EMPTY_ROOT_HEIGHT_META as Ge, parseExplicitHeight as Me, inspectViewportHeightFromNodeChain as Le, resolveExplicitHeightFromNodeChain as Ue } from "./utils/iframe-viewport-height.es.js";
7
- import { SANDBOX_INTERACTION_MESSAGE_TYPE as Ye, SANDBOX_INTERACTION_MESSAGE_SOURCE as Xe } from "../../lib/sandboxInteraction.es.js";
8
- import { injectScalingSystem as Ze } from "./utils/iframe-scaling.es.js";
9
- let ie = null;
10
- const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
1
+ import { j as M } from "../../_virtual/jsx-runtime.es.js";
2
+ import W, { useRef as i, useState as y, useCallback as Ge, useEffect as H, useMemo as Ye } from "react";
3
+ import { createRoot as Ue } from "react-dom/client";
4
+ import Xe from "./SandboxApp.es.js";
5
+ import Je from "./ContentRender.es.js";
6
+ import { inspectViewportHeightFromHtmlRootString as ye, EMPTY_ROOT_HEIGHT_META as Ke, parseExplicitHeight as Te, inspectViewportHeightFromNodeChain as Ze, resolveExplicitHeightFromNodeChain as Qe } from "./utils/iframe-viewport-height.es.js";
7
+ import { SANDBOX_INTERACTION_MESSAGE_TYPE as et, SANDBOX_INTERACTION_MESSAGE_SOURCE as tt } from "../../lib/sandboxInteraction.es.js";
8
+ import { injectScalingSystem as nt } from "./utils/iframe-scaling.es.js";
9
+ import { getContentRenderLocaleTexts as rt } from "./contentRenderI18n.es.js";
10
+ import { CJK_SAFE_SANS_FONT_FAMILY as ot } from "./cjkFontFamily.es.js";
11
+ let le = null;
12
+ const it = () => (le || (le = import("./blackboard-vendor.es.js").then(
11
13
  (c) => c.injectBlackboardLibraries
12
- )), ie), Ke = /<img\b[^>]*>/i, Qe = 180, et = 240, tt = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
14
+ )), le), st = /<img\b[^>]*>/i, ct = 180, lt = 240, at = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
13
15
  const s = o.split(":");
14
16
  return s[s.length - 1] !== "h-screen" && s[s.length - 1] !== "min-h-screen" ? o : (s[s.length - 1] = "h-full", s.join(":"));
15
- }).join(" "), nt = (c, o) => !o || !c.trim() ? c : c.replace(
17
+ }).join(" "), ut = (c, o) => !o || !c.trim() ? c : c.replace(
16
18
  /^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
17
- (s, B, M = "") => {
18
- const m = M.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
19
- if (!m)
19
+ (s, E, T = "") => {
20
+ const h = T.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
21
+ if (!h)
20
22
  return s;
21
- const W = tt(m[2]);
22
- return W === m[2] ? s : `${B}${M.replace(
23
- m[0],
24
- `class=${m[1]}${W}${m[1]}`
23
+ const A = at(h[2]);
24
+ return A === h[2] ? s : `${E}${T.replace(
25
+ h[0],
26
+ `class=${h[1]}${A}${h[1]}`
25
27
  )}>`;
26
28
  }
27
- ), ht = ({
29
+ ), St = ({
28
30
  content: c,
29
31
  type: o,
30
32
  className: s,
31
- styleLoadingText: B,
32
- scriptLoadingText: M,
33
- fullScreenButtonText: m,
34
- hideFullScreen: W = !1,
33
+ locale: E,
34
+ loadingText: T,
35
+ styleLoadingText: h,
36
+ scriptLoadingText: A,
37
+ fullScreenButtonText: Ae,
38
+ exitFullScreenButtonText: _e,
39
+ hideFullScreen: Fe = !1,
35
40
  mode: a = "content",
36
- replaceRootScreenHeightWithFull: Te = !1,
37
- enableScaling: Ae = !1,
38
- disableLoadingOverlay: se = !1
41
+ replaceRootScreenHeightWithFull: ke = !1,
42
+ enableScaling: Ie = !1,
43
+ disableLoadingOverlay: U = !1
39
44
  }) => {
40
- const D = i(null), f = i(null), Y = i(null), T = i(() => {
41
- }), [ke, _e] = C(480), [ce, Fe] = C(0), [X, le] = C(0), Z = i(!1), J = i(!1), ae = i(0), [ue, Ie] = C(0), [K, Ne] = C(!1), Oe = o === "sandbox", g = a === "blackboard", H = Ae && g && o === "sandbox", A = g && o === "sandbox", R = A && Te, Q = i(""), P = j.useMemo(
45
+ const ae = rt(E), Ne = Ae || ae.sandboxFullscreenButtonText, Oe = _e || ae.sandboxExitFullscreenButtonText, D = i(null), f = i(null), X = i(null), _ = i(() => {
46
+ }), [Be, Ve] = y(480), [ue, je] = y(0), [J, he] = y(0), K = i(!1), Z = i(!1), de = i(0), [me, We] = y(0), [Q, De] = y(!1), Pe = o === "sandbox", g = a === "blackboard", b = Ie && g && o === "sandbox", F = g && o === "sandbox", C = F && ke, ee = i(""), P = W.useMemo(
42
47
  () => o === "sandbox" ? c : "",
43
48
  [c, o]
44
- ), n = j.useMemo(
45
- () => nt(
49
+ ), n = W.useMemo(
50
+ () => ut(
46
51
  P,
47
- R
52
+ C
48
53
  ),
49
- [P, R]
50
- ), he = j.useMemo(
51
- () => R ? Ce(P) : Ge,
52
- [P, R]
53
- ), de = j.useMemo(
54
- () => R && he.hasFullViewportHeight,
54
+ [P, C]
55
+ ), fe = W.useMemo(
56
+ () => C ? ye(P) : Ke,
57
+ [P, C]
58
+ ), te = W.useMemo(
59
+ () => C && fe.hasFullViewportHeight,
55
60
  [
56
- he.hasFullViewportHeight,
57
- R
61
+ fe.hasFullViewportHeight,
62
+ C
58
63
  ]
59
- ), [$, me] = C(
64
+ ), [$, ge] = y(
60
65
  n
61
- ), fe = i(n), ee = i(n), k = i(null), _ = i(null), ge = i(null), be = De((t) => {
66
+ ), be = i(n), ne = i(n), k = i(null), I = i(null), pe = i(null), He = Ge((t) => {
62
67
  if (typeof window > "u")
63
68
  return;
64
69
  const e = Date.now();
65
- e - ae.current < et || (ae.current = e, window.postMessage(
70
+ e - de.current < lt || (de.current = e, window.postMessage(
66
71
  {
67
- source: Xe,
68
- type: Ye,
72
+ source: tt,
73
+ type: et,
69
74
  eventType: t
70
75
  },
71
76
  window.location.origin
72
77
  ));
73
- }, []), te = () => {
78
+ }, []), re = () => {
74
79
  k.current !== null && (window.clearTimeout(k.current), k.current = null);
75
- }, Ve = () => {
76
- _.current !== null && (window.cancelAnimationFrame(_.current), _.current = null);
80
+ }, $e = () => {
81
+ I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null);
77
82
  };
78
- p(
83
+ H(
79
84
  () => () => {
80
- te(), Ve();
85
+ re(), $e();
81
86
  },
82
87
  []
83
- ), p(() => {
84
- const t = fe.current;
85
- fe.current = n;
86
- const e = !!t && n.length > t.length && n.startsWith(t), u = Ke.test(
88
+ ), H(() => {
89
+ const t = be.current;
90
+ be.current = n;
91
+ const e = !!t && n.length > t.length && n.startsWith(t), u = st.test(
87
92
  n
88
93
  );
89
94
  if (!(e && u)) {
90
- te(), ee.current = n, me(n);
95
+ re(), ne.current = n, ge(n);
91
96
  return;
92
97
  }
93
- ee.current = n, te(), k.current = window.setTimeout(() => {
94
- me(ee.current), k.current = null;
95
- }, Qe);
98
+ ne.current = n, re(), k.current = window.setTimeout(() => {
99
+ ge(ne.current), k.current = null;
100
+ }, ct);
96
101
  }, [n]);
97
- const z = j.useMemo(() => A ? Ce($).viewportHeightCss : null, [$, A]);
98
- p(() => {
99
- ge.current = z;
102
+ const z = W.useMemo(() => F ? ye($).viewportHeightCss : null, [$, F]);
103
+ H(() => {
104
+ pe.current = z;
100
105
  }, [z]);
101
- const pe = !!z, F = g && o === "sandbox" ? H || de ? "100%" : z ?? `${ke}px` : void 0;
102
- p(() => {
106
+ const oe = !!z, N = g && o === "sandbox" ? b || te ? "100%" : z ?? `${Be}px` : void 0;
107
+ H(() => {
103
108
  if (a !== "blackboard") {
104
- Q.current = n;
109
+ ee.current = n;
105
110
  return;
106
111
  }
107
- const t = Q.current;
108
- !(t && n.startsWith(t)) && t && Ie((u) => u + 1), Q.current = n;
109
- }, [a, n]), p(() => {
112
+ const t = ee.current;
113
+ !(t && n.startsWith(t)) && t && We((u) => u + 1), ee.current = n;
114
+ }, [a, n]), H(() => {
110
115
  const t = f.current;
111
116
  if (!t) return;
112
117
  const e = t.contentDocument;
@@ -118,9 +123,9 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
118
123
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
119
124
  <style>
120
125
  :root { color-scheme: light; }
121
- html, body, #root { width: 100%; }
126
+ html, body, #root { width: 100%; font-family: ${ot}; }
122
127
  ${a === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
123
- html, body { margin: 0; padding: 0; overflow: ${H ? "hidden auto" : a === "blackboard" ? "auto" : "hidden"}; }
128
+ html, body { margin: 0; padding: 0; overflow: ${b ? "hidden auto" : a === "blackboard" ? "auto" : "hidden"}; }
124
129
  *, *::before, *::after { box-sizing: border-box; }
125
130
  ${a !== "blackboard" ? `
126
131
  .h-screen { height: auto !important; }
@@ -134,136 +139,136 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
134
139
  <div id="root"></div>
135
140
  </body>
136
141
  </html>`), e.close(), e.documentElement.setAttribute("data-theme", "light"), e.documentElement.style.colorScheme = "light", e.body?.style.setProperty("color-scheme", "light");
137
- const u = g && o === "sandbox", q = () => be("click");
138
- u && e.addEventListener("click", q, !0);
139
- const I = e.getElementById("root");
140
- if (!I) return;
141
- const we = $e(I);
142
- Y.current = we;
143
- let N = !1;
144
- const xe = (r) => ({
142
+ const u = g && o === "sandbox", L = () => He("click");
143
+ u && e.addEventListener("click", L, !0);
144
+ const O = e.getElementById("root");
145
+ if (!O) return;
146
+ const we = Ue(O);
147
+ X.current = we;
148
+ let B = !1;
149
+ const Se = (r) => ({
145
150
  heightAttrValue: r.getAttribute("height"),
146
151
  styleAttrValue: r.getAttribute("style"),
147
152
  classAttrValue: r.getAttribute("class")
148
153
  }), ve = (r) => {
149
- const w = Array.from(r.children);
150
- return w.length === 1 ? w[0] : null;
151
- }, We = () => {
152
- if (!A || !f.current || !e.body) return null;
153
- const r = f.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, w = ge.current, G = w ? Me(
154
- w,
154
+ const x = Array.from(r.children);
155
+ return x.length === 1 ? x[0] : null;
156
+ }, qe = () => {
157
+ if (!F || !f.current || !e.body) return null;
158
+ const r = f.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = pe.current, q = x ? Te(
159
+ x,
155
160
  r
156
161
  ) : null;
157
- if (G !== null)
158
- return Math.ceil(G);
159
- const h = e.body.querySelector(
162
+ if (q !== null)
163
+ return Math.ceil(q);
164
+ const d = e.body.querySelector(
160
165
  ".sandbox-wrapper"
161
166
  )?.firstElementChild;
162
- if (!h) return null;
163
- const d = Array.from(h.children), x = d.length === 1 ? d[0] : null, L = Le(
164
- x,
167
+ if (!d) return null;
168
+ const m = Array.from(d.children), w = m.length === 1 ? m[0] : null, G = Ze(
169
+ w,
165
170
  {
166
- getNode: xe,
171
+ getNode: Se,
167
172
  getSingleChild: ve
168
173
  }
169
174
  ).viewportHeightCss;
170
- if (L) {
171
- const O = Me(
172
- L,
175
+ if (G) {
176
+ const V = Te(
177
+ G,
173
178
  r
174
179
  );
175
- if (O !== null)
176
- return Math.ceil(O);
180
+ if (V !== null)
181
+ return Math.ceil(V);
177
182
  }
178
- const l = Ue(
179
- x,
183
+ const l = Qe(
184
+ w,
180
185
  r,
181
186
  {
182
- getNode: xe,
187
+ getNode: Se,
183
188
  getSingleChild: ve
184
189
  }
185
190
  );
186
191
  return l !== null ? Math.ceil(l) : null;
187
- }, ne = () => {
192
+ }, ie = () => {
188
193
  if (!f.current || !e.body) return;
189
194
  if (!g) {
190
- if (Z.current) {
191
- J.current = !0;
195
+ if (K.current) {
196
+ Z.current = !0;
192
197
  return;
193
198
  }
194
- Z.current = !0;
195
- const h = f.current, d = D.current?.clientWidth || 0, x = h.style.height;
196
- if (d > 0) {
197
- const oe = Math.round(d * 9 / 16), L = Math.max(8192, d * 20);
198
- h.style.height = oe + "px", e.body.offsetHeight;
199
+ K.current = !0;
200
+ const d = f.current, m = D.current?.clientWidth || 0, w = d.style.height;
201
+ if (m > 0) {
202
+ const ce = Math.round(m * 9 / 16), G = Math.max(8192, m * 20);
203
+ d.style.height = ce + "px", e.body.offsetHeight;
199
204
  let l = e.body.scrollHeight;
200
- const O = e.defaultView;
201
- if (O) {
202
- const V = (b) => {
203
- let v = 0;
204
- const Se = (E) => {
205
- if (E !== b && E.scrollHeight > E.clientHeight + 1) {
206
- const U = O.getComputedStyle(E).overflowY;
207
- if (U === "auto" || U === "scroll") {
208
- const ye = E.getBoundingClientRect();
209
- ye.top >= 0 && (v = Math.max(
210
- v,
211
- Math.ceil(ye.top + E.scrollHeight)
205
+ const V = e.defaultView;
206
+ if (V) {
207
+ const j = (p) => {
208
+ let S = 0;
209
+ const Re = (v) => {
210
+ if (v !== p && v.scrollHeight > v.clientHeight + 1) {
211
+ const Y = V.getComputedStyle(v).overflowY;
212
+ if (Y === "auto" || Y === "scroll") {
213
+ const Me = v.getBoundingClientRect();
214
+ Me.top >= 0 && (S = Math.max(
215
+ S,
216
+ Math.ceil(Me.top + v.scrollHeight)
212
217
  ));
213
218
  }
214
219
  }
215
- for (const U of E.children) Se(U);
220
+ for (const Y of v.children) Re(Y);
216
221
  };
217
- return Se(b), v;
222
+ return Re(p), S;
218
223
  };
219
- l = Math.max(l, V(e.body));
220
- for (let b = 0; b < 8 && l > oe; b++) {
221
- h.style.height = l + "px", e.body.offsetHeight;
222
- const v = Math.max(
224
+ l = Math.max(l, j(e.body));
225
+ for (let p = 0; p < 8 && l > ce; p++) {
226
+ d.style.height = l + "px", e.body.offsetHeight;
227
+ const S = Math.max(
223
228
  e.body.scrollHeight,
224
- V(e.body)
229
+ j(e.body)
225
230
  );
226
- if (v <= l + 1 || v >= l * 1.5) break;
227
- l = v;
231
+ if (S <= l + 1 || S >= l * 1.5) break;
232
+ l = S;
228
233
  }
229
234
  }
230
- h.style.height = x, Fe((V) => {
231
- const b = Math.min(L, Math.max(200, Math.ceil(l)));
232
- return V === b ? V : b;
235
+ d.style.height = w, je((j) => {
236
+ const p = Math.min(G, Math.max(200, Math.ceil(l)));
237
+ return j === p ? j : p;
233
238
  });
234
239
  }
235
240
  setTimeout(() => {
236
- Z.current = !1, J.current && (J.current = !1, S());
241
+ K.current = !1, Z.current && (Z.current = !1, R());
237
242
  }, 50);
238
243
  return;
239
244
  }
240
- if (H) return;
241
- const r = e.body.scrollHeight, w = e.documentElement?.scrollHeight || 0, G = I?.scrollHeight || 0, Re = Math.max(r, w, G);
242
- if (A) {
243
- const h = We(), d = Math.max(
245
+ if (b) return;
246
+ const r = e.body.scrollHeight, x = e.documentElement?.scrollHeight || 0, q = O?.scrollHeight || 0, Ce = Math.max(r, x, q);
247
+ if (F) {
248
+ const d = qe(), m = Math.max(
244
249
  200,
245
- h ?? Math.ceil(Re)
250
+ d ?? Math.ceil(Ce)
246
251
  );
247
- _e(
248
- (x) => x === d ? x : d
252
+ Ve(
253
+ (w) => w === m ? w : m
249
254
  );
250
255
  }
251
- }, S = () => {
256
+ }, R = () => {
252
257
  requestAnimationFrame(() => {
253
- N || ne();
258
+ B || ie();
254
259
  });
255
260
  };
256
- T.current = S, ne(), S(), Oe && Je().then((r) => {
257
- N || (r(e), H && Ze(e), requestAnimationFrame(() => {
258
- N || S();
261
+ _.current = R, ie(), R(), Pe && it().then((r) => {
262
+ B || (r(e), b && nt(e), requestAnimationFrame(() => {
263
+ B || R();
259
264
  }));
260
265
  }).catch(() => {
261
- N || S();
266
+ B || R();
262
267
  });
263
- const re = new ResizeObserver(() => ne());
264
- re.observe(e.body), I && re.observe(I);
268
+ const se = new ResizeObserver(() => ie());
269
+ se.observe(e.body), O && se.observe(O);
265
270
  const Ee = new MutationObserver(() => {
266
- S();
271
+ R();
267
272
  });
268
273
  return Ee.observe(e.body, {
269
274
  childList: !0,
@@ -271,30 +276,30 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
271
276
  attributes: !0,
272
277
  attributeFilter: ["style", "class"]
273
278
  }), () => {
274
- N = !0, re.disconnect(), Ee.disconnect(), H && t.contentWindow?.__mdf_cleanupScaling?.(), u && e.removeEventListener("click", q, !0), setTimeout(() => {
275
- we.unmount(), Y.current = null, T.current = () => {
279
+ B = !0, se.disconnect(), Ee.disconnect(), b && t.contentWindow?.__mdf_cleanupScaling?.(), u && e.removeEventListener("click", L, !0), setTimeout(() => {
280
+ we.unmount(), X.current = null, _.current = () => {
276
281
  };
277
282
  }, 0);
278
283
  };
279
- }, []), p(() => {
284
+ }, []), H(() => {
280
285
  const t = () => {
281
- Ne(!!document.fullscreenElement);
286
+ De(!!document.fullscreenElement);
282
287
  };
283
288
  return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
284
- }, []), p(() => {
289
+ }, []), H(() => {
285
290
  const t = D.current;
286
291
  if (!t) return;
287
292
  const e = new ResizeObserver((u) => {
288
- le(u[0]?.contentRect.width ?? t.clientWidth);
293
+ he(u[0]?.contentRect.width ?? t.clientWidth);
289
294
  });
290
- return e.observe(t), le(t.clientWidth), () => e.disconnect();
295
+ return e.observe(t), he(t.clientWidth), () => e.disconnect();
291
296
  }, []);
292
- const He = Pe(() => {
293
- if (g || X === 0 || K)
297
+ const xe = Ye(() => {
298
+ if (g || J === 0 || Q)
294
299
  return;
295
- const t = Math.round(X * 9 / 16);
296
- return { height: Math.max(t, ce) };
297
- }, [g, X, ce, K]), je = () => {
300
+ const t = Math.round(J * 9 / 16);
301
+ return { height: Math.max(t, ue) };
302
+ }, [g, J, ue, Q]), ze = () => {
298
303
  const t = D.current || f.current;
299
304
  if (t) {
300
305
  if (document.fullscreenElement) {
@@ -306,69 +311,78 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
306
311
  });
307
312
  }
308
313
  };
309
- p(() => {
310
- const t = Y.current;
314
+ H(() => {
315
+ const t = X.current;
311
316
  if (!t) return;
312
317
  t.render(
313
- /* @__PURE__ */ y.jsx(
314
- ze,
318
+ /* @__PURE__ */ M.jsx(
319
+ Xe,
315
320
  {
316
321
  html: $,
317
- styleLoadingText: B,
318
- scriptLoadingText: M,
319
- disableLoadingOverlay: se,
320
- resetToken: ue,
321
- hasRootVhHeight: pe,
322
+ locale: E,
323
+ loadingText: T,
324
+ styleLoadingText: h,
325
+ scriptLoadingText: A,
326
+ disableLoadingOverlay: U,
327
+ resetToken: me,
328
+ hasRootVhHeight: oe,
322
329
  mode: a,
323
- stretchRootHeight: de,
324
- enableScaling: H
330
+ stretchRootHeight: te,
331
+ enableScaling: b
325
332
  }
326
333
  )
327
- ), _.current = window.requestAnimationFrame(() => {
328
- T.current?.(), H && f.current?.contentWindow?.__mdf_triggerFitContent?.(), _.current = null;
334
+ ), I.current = window.requestAnimationFrame(() => {
335
+ _.current?.(), b && f.current?.contentWindow?.__mdf_triggerFitContent?.(), I.current = null;
329
336
  });
330
- const e = setTimeout(() => T.current?.(), 100), u = setTimeout(() => T.current?.(), 500);
337
+ const e = setTimeout(() => _.current?.(), 100), u = setTimeout(() => _.current?.(), 500);
331
338
  return () => {
332
339
  clearTimeout(e), clearTimeout(u);
333
340
  };
334
341
  }, [
335
342
  $,
336
- B,
337
- M,
338
- ue,
339
- a
343
+ E,
344
+ T,
345
+ h,
346
+ A,
347
+ me,
348
+ U,
349
+ oe,
350
+ a,
351
+ te,
352
+ b
340
353
  ]);
341
- const Be = [
354
+ const Le = [
342
355
  "w-full relative content-render-iframe-sandbox",
343
- g ? "h-full overflow-auto flex flex-col" : He ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
356
+ g ? "h-full overflow-auto flex flex-col" : xe ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
344
357
  ].filter(Boolean).join(" ");
345
- return /* @__PURE__ */ y.jsxs(
358
+ return /* @__PURE__ */ M.jsxs(
346
359
  "div",
347
360
  {
348
361
  ref: D,
349
- "data-root-vh": pe ? "true" : "false",
350
- className: Be,
351
- style: F ? {
352
- height: F,
353
- minHeight: F
354
- } : He,
362
+ "data-root-vh": oe ? "true" : "false",
363
+ className: Le,
364
+ style: N ? {
365
+ height: N,
366
+ minHeight: N
367
+ } : xe,
355
368
  children: [
356
- !W && /* @__PURE__ */ y.jsx(
369
+ !Fe && /* @__PURE__ */ M.jsx(
357
370
  "button",
358
371
  {
359
372
  type: "button",
360
- onClick: je,
373
+ onClick: ze,
361
374
  className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
362
- children: K ? "退出全屏" : m || "全屏浏览"
375
+ children: Q ? Oe : Ne
363
376
  }
364
377
  ),
365
- a === "blackboard" && o === "markdown" ? /* @__PURE__ */ y.jsx("div", { onClick: () => be("click"), children: /* @__PURE__ */ y.jsx(
366
- qe,
378
+ a === "blackboard" && o === "markdown" ? /* @__PURE__ */ M.jsx("div", { onClick: () => He("click"), children: /* @__PURE__ */ M.jsx(
379
+ Je,
367
380
  {
368
381
  content: c,
369
- disableSandboxLoadingOverlay: se
382
+ locale: E,
383
+ disableSandboxLoadingOverlay: U
370
384
  }
371
- ) }) : /* @__PURE__ */ y.jsx(
385
+ ) }) : /* @__PURE__ */ M.jsx(
372
386
  "iframe",
373
387
  {
374
388
  ref: f,
@@ -377,8 +391,8 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
377
391
  allowFullScreen: !0,
378
392
  className: [s, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
379
393
  style: {
380
- height: F ?? "100%",
381
- minHeight: F,
394
+ height: N ?? "100%",
395
+ minHeight: N,
382
396
  margin: "auto"
383
397
  }
384
398
  }
@@ -388,6 +402,6 @@ const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
388
402
  );
389
403
  };
390
404
  export {
391
- ht as default
405
+ St as default
392
406
  };
393
407
  //# sourceMappingURL=IframeSandbox.es.js.map