markdown-flow-ui 0.1.100-beta.39 → 0.1.100-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs11.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs7.js +1 -1
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es10.js +2 -3
- package/dist/_virtual/index.es10.js.map +1 -1
- package/dist/_virtual/index.es11.js +3 -2
- package/dist/_virtual/index.es11.js.map +1 -1
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +4 -4
- package/dist/_virtual/index.es7.js +3 -2
- package/dist/_virtual/index.es7.js.map +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -3
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +211 -140
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
- package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.es.js +211 -260
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.es.js +109 -135
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/ContentRender/index.cjs.js +1 -1
- package/dist/components/ContentRender/index.es.js +5 -6
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +2 -2
- package/package.json +1 -1
|
@@ -1,85 +1,50 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import { splitContentSegments as
|
|
6
|
-
import
|
|
7
|
-
import { SANDBOX_INTERACTION_MESSAGE_TYPE as
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
(
|
|
11
|
-
)),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return console.log("[IframeSandbox][SandboxLoad] start", { startedAt: t }), be().then((n) => (console.log("[IframeSandbox][SandboxLoad] done", {
|
|
16
|
-
startedAt: t,
|
|
1
|
+
import { j as b } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import N, { useRef as d, useState as V, useCallback as Ae, useEffect as y } from "react";
|
|
3
|
+
import { createRoot as Re } from "react-dom/client";
|
|
4
|
+
import Te from "./SandboxApp.es.js";
|
|
5
|
+
import { splitContentSegments as Me } from "./utils/split-content.es.js";
|
|
6
|
+
import Ne from "./ContentRender.es.js";
|
|
7
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as Ve, SANDBOX_INTERACTION_MESSAGE_SOURCE as Fe } from "../../lib/sandboxInteraction.es.js";
|
|
8
|
+
let U = null;
|
|
9
|
+
const Ie = () => (U || (U = import("./blackboard-vendor.es.js").then(
|
|
10
|
+
(t) => t.injectBlackboardLibraries
|
|
11
|
+
)), U), ke = () => {
|
|
12
|
+
const t = performance.now(), e = (/* @__PURE__ */ new Date()).toISOString();
|
|
13
|
+
return console.log("[IframeSandbox][SandboxLoad] start", { startedAt: e }), Ie().then((n) => (console.log("[IframeSandbox][SandboxLoad] done", {
|
|
14
|
+
startedAt: e,
|
|
17
15
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18
|
-
durationMs: Number((performance.now() -
|
|
16
|
+
durationMs: Number((performance.now() - t).toFixed(2))
|
|
19
17
|
}), n)).catch((n) => {
|
|
20
18
|
throw console.error("[IframeSandbox][SandboxLoad] failed", {
|
|
21
|
-
startedAt:
|
|
19
|
+
startedAt: e,
|
|
22
20
|
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23
|
-
durationMs: Number((performance.now() -
|
|
21
|
+
durationMs: Number((performance.now() - t).toFixed(2)),
|
|
24
22
|
error: n
|
|
25
23
|
}), n;
|
|
26
24
|
});
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
t.map((n) => n[1]?.trim()).filter((n) => !!n)
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
}, Xe = (e) => {
|
|
35
|
-
if (!e)
|
|
36
|
-
return Promise.resolve();
|
|
37
|
-
const t = fe.get(e);
|
|
38
|
-
if (t)
|
|
39
|
-
return t;
|
|
40
|
-
const n = new Promise((s) => {
|
|
41
|
-
if (typeof window > "u") {
|
|
42
|
-
$.add(e), s();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const o = new window.Image();
|
|
46
|
-
o.decoding = "sync", o.loading = "eager", o.fetchPriority = "high";
|
|
47
|
-
const l = () => {
|
|
48
|
-
(typeof o.decode == "function" ? o.decode().catch(() => {
|
|
49
|
-
}) : Promise.resolve()).finally(() => {
|
|
50
|
-
$.add(e), s();
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
o.onload = () => {
|
|
54
|
-
l();
|
|
55
|
-
}, o.onerror = () => {
|
|
56
|
-
$.add(e), s();
|
|
57
|
-
}, o.src = e, o.complete && o.naturalWidth > 0 && l();
|
|
58
|
-
});
|
|
59
|
-
return fe.set(e, n), n;
|
|
60
|
-
}, ge = (e = []) => Promise.allSettled(e.map((t) => Xe(t))), we = (e) => e.split(/\s+/).filter(Boolean).map((t) => t.split(":").pop() || t), j = (e) => {
|
|
61
|
-
const t = e.trim().toLowerCase();
|
|
62
|
-
if (!t) return null;
|
|
63
|
-
const n = t.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
|
|
25
|
+
}, De = /<img\b[^>]*>/i, Oe = 180, _e = 240, he = (t) => t.split(/\s+/).filter(Boolean).map((e) => e.split(":").pop() || e), L = (t) => {
|
|
26
|
+
const e = t.trim().toLowerCase();
|
|
27
|
+
if (!e) return null;
|
|
28
|
+
const n = e.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
|
|
64
29
|
return n ? `${n[1]}${n[2].toLowerCase()}` : null;
|
|
65
|
-
},
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
30
|
+
}, W = (t) => {
|
|
31
|
+
if (!t.trim()) return null;
|
|
32
|
+
const e = he(t);
|
|
33
|
+
if (e.includes("h-screen") || e.includes("h-dvh") || e.includes("min-h-screen") || e.includes("min-h-dvh"))
|
|
69
34
|
return "100dvh";
|
|
70
|
-
if (
|
|
35
|
+
if (e.includes("h-svh") || e.includes("min-h-svh"))
|
|
71
36
|
return "100svh";
|
|
72
|
-
if (
|
|
37
|
+
if (e.includes("h-lvh") || e.includes("min-h-lvh"))
|
|
73
38
|
return "100lvh";
|
|
74
|
-
const n =
|
|
75
|
-
(
|
|
39
|
+
const n = e.find(
|
|
40
|
+
(i) => /^(h|min-h)-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(i)
|
|
76
41
|
);
|
|
77
42
|
if (!n) return null;
|
|
78
43
|
const s = n.match(
|
|
79
44
|
/^(h|min-h)-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i
|
|
80
45
|
);
|
|
81
46
|
return s ? `${s[2]}${s[3].toLowerCase()}` : null;
|
|
82
|
-
},
|
|
47
|
+
}, Le = /* @__PURE__ */ new Set([
|
|
83
48
|
"base",
|
|
84
49
|
"link",
|
|
85
50
|
"meta",
|
|
@@ -87,175 +52,161 @@ const Be = () => {
|
|
|
87
52
|
"style",
|
|
88
53
|
"template",
|
|
89
54
|
"title"
|
|
90
|
-
]),
|
|
91
|
-
(
|
|
92
|
-
) || null,
|
|
93
|
-
const
|
|
94
|
-
let n =
|
|
55
|
+
]), de = (t) => !Le.has(t.tagName.toLowerCase()), $e = (t) => Array.from(t.childNodes).find(
|
|
56
|
+
(e) => e.nodeType === Node.ELEMENT_NODE && de(e)
|
|
57
|
+
) || null, je = (t) => {
|
|
58
|
+
const e = [];
|
|
59
|
+
let n = $e(t);
|
|
95
60
|
for (; n; ) {
|
|
96
|
-
|
|
61
|
+
e.push(n);
|
|
97
62
|
const s = Array.from(n.children).filter(
|
|
98
|
-
(
|
|
63
|
+
(i) => de(i)
|
|
99
64
|
);
|
|
100
65
|
if (s.length !== 1)
|
|
101
66
|
break;
|
|
102
67
|
n = s[0];
|
|
103
68
|
}
|
|
104
|
-
return
|
|
105
|
-
},
|
|
106
|
-
const
|
|
69
|
+
return e;
|
|
70
|
+
}, Be = (t) => {
|
|
71
|
+
const e = t.getAttribute("height"), n = e ? L(e) : null;
|
|
107
72
|
if (n)
|
|
108
73
|
return n;
|
|
109
|
-
const s =
|
|
110
|
-
return
|
|
111
|
-
|
|
74
|
+
const s = t.getAttribute("style")?.match(/\bheight\s*:\s*([^;]+)/i)?.[1] || null, i = s ? L(s) : null;
|
|
75
|
+
return i || W(
|
|
76
|
+
t.getAttribute("class") || ""
|
|
112
77
|
);
|
|
113
|
-
},
|
|
114
|
-
const
|
|
78
|
+
}, me = (t) => t === "100vh" || t === "100dvh" || t === "100svh" || t === "100lvh", fe = (t) => {
|
|
79
|
+
const e = je(t);
|
|
115
80
|
let n = null, s = !1;
|
|
116
|
-
return
|
|
117
|
-
const l =
|
|
118
|
-
!n && l && (n = l),
|
|
81
|
+
return e.forEach((i) => {
|
|
82
|
+
const l = Be(i);
|
|
83
|
+
!n && l && (n = l), me(l) && (s = !0);
|
|
119
84
|
}), {
|
|
120
85
|
viewportHeightCss: n,
|
|
121
86
|
hasFullViewportHeight: s
|
|
122
87
|
};
|
|
123
|
-
},
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
88
|
+
}, ze = (t) => {
|
|
89
|
+
const e = t.trim();
|
|
90
|
+
if (!e)
|
|
126
91
|
return {
|
|
127
92
|
viewportHeightCss: null,
|
|
128
93
|
hasFullViewportHeight: !1
|
|
129
94
|
};
|
|
130
|
-
const s =
|
|
95
|
+
const s = e.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/)?.[2] || "", i = s.match(/\bheight\s*=\s*["']([^"']+)["']/i)?.[1], m = s.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
|
|
131
96
|
/\bheight\s*:\s*([^;]+)/i
|
|
132
|
-
)?.[1],
|
|
97
|
+
)?.[1], C = s.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1], h = (i ? L(i) : null) || (m ? L(m) : null) || (C ? W(C) : null);
|
|
133
98
|
return {
|
|
134
99
|
viewportHeightCss: h,
|
|
135
|
-
hasFullViewportHeight:
|
|
100
|
+
hasFullViewportHeight: me(h)
|
|
136
101
|
};
|
|
137
|
-
},
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
102
|
+
}, ue = (t) => {
|
|
103
|
+
const e = t.trim();
|
|
104
|
+
if (!e)
|
|
140
105
|
return {
|
|
141
106
|
viewportHeightCss: null,
|
|
142
107
|
hasFullViewportHeight: !1
|
|
143
108
|
};
|
|
144
109
|
if (typeof document > "u")
|
|
145
|
-
return
|
|
110
|
+
return ze(e);
|
|
146
111
|
const n = document.createElement("template");
|
|
147
|
-
return n.innerHTML =
|
|
148
|
-
},
|
|
149
|
-
const n =
|
|
150
|
-
return n[n.length - 1] !== "h-screen" && n[n.length - 1] !== "min-h-screen" ?
|
|
151
|
-
}).join(" "),
|
|
112
|
+
return n.innerHTML = e, fe(n.content);
|
|
113
|
+
}, Pe = (t) => t.split(/\s+/).filter(Boolean).map((e) => {
|
|
114
|
+
const n = e.split(":");
|
|
115
|
+
return n[n.length - 1] !== "h-screen" && n[n.length - 1] !== "min-h-screen" ? e : (n[n.length - 1] = "h-full", n.join(":"));
|
|
116
|
+
}).join(" "), qe = (t, e) => !e || !t.trim() ? t : t.replace(
|
|
152
117
|
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
153
|
-
(n, s,
|
|
154
|
-
const l =
|
|
118
|
+
(n, s, i = "") => {
|
|
119
|
+
const l = i.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
155
120
|
if (!l)
|
|
156
121
|
return n;
|
|
157
|
-
const m =
|
|
158
|
-
return m === l[2] ? n : `${s}${
|
|
122
|
+
const m = Pe(l[2]);
|
|
123
|
+
return m === l[2] ? n : `${s}${i.replace(
|
|
159
124
|
l[0],
|
|
160
125
|
`class=${l[1]}${m}${l[1]}`
|
|
161
126
|
)}>`;
|
|
162
127
|
}
|
|
163
|
-
),
|
|
164
|
-
content:
|
|
165
|
-
type:
|
|
128
|
+
), Ke = ({
|
|
129
|
+
content: t,
|
|
130
|
+
type: e,
|
|
166
131
|
className: n,
|
|
167
132
|
loadingText: s,
|
|
168
|
-
styleLoadingText:
|
|
133
|
+
styleLoadingText: i,
|
|
169
134
|
scriptLoadingText: l,
|
|
170
135
|
fullScreenButtonText: m,
|
|
171
|
-
hideFullScreen:
|
|
136
|
+
hideFullScreen: C = !1,
|
|
172
137
|
mode: h = "content",
|
|
173
|
-
replaceRootScreenHeightWithFull:
|
|
138
|
+
replaceRootScreenHeightWithFull: F = !1
|
|
174
139
|
}) => {
|
|
175
|
-
const
|
|
176
|
-
}), [
|
|
177
|
-
const r =
|
|
178
|
-
return (h === "blackboard" ? r[r.length - 1]?.value || "" : r.map((
|
|
140
|
+
const Y = d(null), E = d(null), $ = d(null), Z = d(null), j = d(() => {
|
|
141
|
+
}), [ge, pe] = V(480), J = d(0), [K, be] = V(0), [we, ve] = V(!1), [, B] = V(!0), xe = e === "sandbox", z = h === "blackboard", P = d(""), I = N.useMemo(() => {
|
|
142
|
+
const r = Me(t).filter((g) => g.type === "sandbox");
|
|
143
|
+
return (h === "blackboard" ? r[r.length - 1]?.value || "" : r.map((g) => g.value).join(`
|
|
179
144
|
`)) || "";
|
|
180
|
-
}, [
|
|
181
|
-
() =>
|
|
182
|
-
|
|
183
|
-
|
|
145
|
+
}, [t, h]), c = N.useMemo(
|
|
146
|
+
() => qe(
|
|
147
|
+
I,
|
|
148
|
+
F
|
|
184
149
|
),
|
|
185
|
-
[
|
|
186
|
-
),
|
|
187
|
-
() =>
|
|
188
|
-
[
|
|
189
|
-
),
|
|
190
|
-
() =>
|
|
191
|
-
[
|
|
192
|
-
),
|
|
193
|
-
() => V && le.hasFullViewportHeight,
|
|
194
|
-
[le.hasFullViewportHeight, V]
|
|
195
|
-
), [O, W] = F(
|
|
150
|
+
[I, F]
|
|
151
|
+
), Q = N.useMemo(
|
|
152
|
+
() => ue(I),
|
|
153
|
+
[I]
|
|
154
|
+
), ee = N.useMemo(
|
|
155
|
+
() => F && Q.hasFullViewportHeight,
|
|
156
|
+
[Q.hasFullViewportHeight, F]
|
|
157
|
+
), [k, te] = V(
|
|
196
158
|
c
|
|
197
|
-
),
|
|
159
|
+
), ne = d(c), re = d(c), A = d(null), R = d(null), S = Ae((o) => {
|
|
198
160
|
if (typeof window > "u")
|
|
199
161
|
return;
|
|
200
162
|
const r = Date.now();
|
|
201
|
-
r -
|
|
163
|
+
r - J.current < _e || (J.current = r, window.postMessage(
|
|
202
164
|
{
|
|
203
|
-
source:
|
|
204
|
-
type:
|
|
205
|
-
eventType:
|
|
165
|
+
source: Fe,
|
|
166
|
+
type: Ve,
|
|
167
|
+
eventType: o
|
|
206
168
|
},
|
|
207
169
|
window.location.origin
|
|
208
170
|
));
|
|
209
|
-
}, []),
|
|
210
|
-
|
|
211
|
-
},
|
|
212
|
-
|
|
171
|
+
}, []), oe = () => {
|
|
172
|
+
A.current !== null && (window.clearTimeout(A.current), A.current = null);
|
|
173
|
+
}, He = () => {
|
|
174
|
+
R.current !== null && (window.cancelAnimationFrame(R.current), R.current = null);
|
|
213
175
|
};
|
|
214
|
-
|
|
176
|
+
y(
|
|
215
177
|
() => () => {
|
|
216
|
-
|
|
178
|
+
oe(), He();
|
|
217
179
|
},
|
|
218
180
|
[]
|
|
219
|
-
),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
ae.current = c;
|
|
224
|
-
const r = !!i && c.length > i.length && c.startsWith(i), g = $e.test(
|
|
181
|
+
), y(() => {
|
|
182
|
+
const o = ne.current;
|
|
183
|
+
ne.current = c;
|
|
184
|
+
const r = !!o && c.length > o.length && c.startsWith(o), w = De.test(
|
|
225
185
|
c
|
|
226
|
-
),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (Y.current = c, ue(), p) {
|
|
230
|
-
const v = J.current + 1;
|
|
231
|
-
J.current = v, ge(I).then(() => {
|
|
232
|
-
J.current === v && W(Y.current);
|
|
233
|
-
});
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
if (!D) {
|
|
237
|
-
W(c);
|
|
186
|
+
), g = r && w;
|
|
187
|
+
if (re.current = c, oe(), !g) {
|
|
188
|
+
te(c);
|
|
238
189
|
return;
|
|
239
190
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
}, [
|
|
244
|
-
const
|
|
245
|
-
() =>
|
|
246
|
-
[
|
|
247
|
-
),
|
|
248
|
-
|
|
191
|
+
A.current = window.setTimeout(() => {
|
|
192
|
+
te(re.current), A.current = null;
|
|
193
|
+
}, Oe);
|
|
194
|
+
}, [c]);
|
|
195
|
+
const se = N.useMemo(
|
|
196
|
+
() => ue(k).viewportHeightCss,
|
|
197
|
+
[k]
|
|
198
|
+
), ie = !!se, T = z && e === "sandbox" ? ee ? "100%" : se ?? `${ge}px` : void 0;
|
|
199
|
+
y(() => {
|
|
249
200
|
if (h !== "blackboard") {
|
|
250
|
-
|
|
201
|
+
P.current = c;
|
|
251
202
|
return;
|
|
252
203
|
}
|
|
253
|
-
const
|
|
254
|
-
!(
|
|
255
|
-
}, [h, c]),
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
258
|
-
const r =
|
|
204
|
+
const o = P.current;
|
|
205
|
+
!(o && c.startsWith(o)) && o && be((w) => w + 1), P.current = c;
|
|
206
|
+
}, [h, c]), y(() => {
|
|
207
|
+
const o = E.current;
|
|
208
|
+
if (!o) return;
|
|
209
|
+
const r = o.contentDocument;
|
|
259
210
|
if (!r) return;
|
|
260
211
|
r.open(), r.write(`<!DOCTYPE html>
|
|
261
212
|
<html${h === "blackboard" ? ' style="height: 100%;"' : ""}>
|
|
@@ -272,35 +223,35 @@ const Be = () => {
|
|
|
272
223
|
<body>
|
|
273
224
|
<div id="root"></div>
|
|
274
225
|
</body>
|
|
275
|
-
</html>`), r.close(), r.documentElement.setAttribute("data-theme", "light"), r.documentElement.style.colorScheme = "light", r.body?.style.setProperty("color-scheme", "light"),
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
let
|
|
283
|
-
const
|
|
226
|
+
</html>`), r.close(), r.documentElement.setAttribute("data-theme", "light"), r.documentElement.style.colorScheme = "light", r.body?.style.setProperty("color-scheme", "light"), Z.current = r;
|
|
227
|
+
const w = z && e === "sandbox", g = () => S("pointerdown"), le = () => S("mousedown"), ce = () => S("touchstart");
|
|
228
|
+
w && (r.addEventListener("pointerdown", g, !0), r.addEventListener("mousedown", le, !0), r.addEventListener("touchstart", ce, !0));
|
|
229
|
+
const D = r.getElementById("root");
|
|
230
|
+
if (!D) return;
|
|
231
|
+
const ae = Re(D);
|
|
232
|
+
$.current = ae;
|
|
233
|
+
let M = !1;
|
|
234
|
+
const q = (a, p) => {
|
|
284
235
|
const u = a.trim().toLowerCase();
|
|
285
236
|
if (!u) return null;
|
|
286
|
-
const
|
|
287
|
-
return Number.isNaN(
|
|
288
|
-
},
|
|
237
|
+
const v = Number.parseFloat(u);
|
|
238
|
+
return Number.isNaN(v) ? null : /(dvh|svh|lvh|vh)$/i.test(u) ? v / 100 * p : u.endsWith("px") || /^[0-9.]+$/.test(u) ? v : null;
|
|
239
|
+
}, ye = (a, p) => {
|
|
289
240
|
if (!a.trim()) return null;
|
|
290
|
-
const u =
|
|
241
|
+
const u = W(a);
|
|
291
242
|
if (u)
|
|
292
|
-
return
|
|
293
|
-
const f =
|
|
294
|
-
(
|
|
243
|
+
return q(u, p);
|
|
244
|
+
const f = he(a).find(
|
|
245
|
+
(_) => /^h-\[[0-9.]+px\]$/i.test(_)
|
|
295
246
|
);
|
|
296
247
|
if (!f) return null;
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
299
|
-
const H = Number.parseFloat(
|
|
248
|
+
const x = f.match(/^h-\[([0-9.]+)px\]$/i);
|
|
249
|
+
if (!x) return null;
|
|
250
|
+
const H = Number.parseFloat(x[1]);
|
|
300
251
|
return Number.isNaN(H) ? null : H;
|
|
301
|
-
},
|
|
302
|
-
if (!
|
|
303
|
-
const a =
|
|
252
|
+
}, Ce = () => {
|
|
253
|
+
if (!E.current || !r.body) return null;
|
|
254
|
+
const a = E.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, { viewportHeightCss: p } = fe(r.body), u = p ? q(p, a) : null;
|
|
304
255
|
if (u !== null)
|
|
305
256
|
return Math.ceil(u);
|
|
306
257
|
const f = r.body.querySelector(
|
|
@@ -309,133 +260,133 @@ const Be = () => {
|
|
|
309
260
|
".sandbox-container > *"
|
|
310
261
|
);
|
|
311
262
|
if (!f) return null;
|
|
312
|
-
const
|
|
263
|
+
const x = f.style.height || f.getAttribute("height"), H = x ? q(x, a) : null;
|
|
313
264
|
if (H !== null)
|
|
314
265
|
return Math.ceil(H);
|
|
315
|
-
const
|
|
266
|
+
const _ = ye(
|
|
316
267
|
f.getAttribute("class") || "",
|
|
317
268
|
a
|
|
318
269
|
);
|
|
319
|
-
return
|
|
320
|
-
},
|
|
321
|
-
if (!
|
|
322
|
-
const a = r.body.getBoundingClientRect(),
|
|
270
|
+
return _ !== null ? Math.ceil(_) : null;
|
|
271
|
+
}, G = () => {
|
|
272
|
+
if (!E.current || !r.body) return;
|
|
273
|
+
const a = r.body.getBoundingClientRect(), p = r.documentElement?.getBoundingClientRect(), u = a.height, v = p?.height || 0, f = Math.max(u, v), x = Ce(), H = Math.max(
|
|
323
274
|
200,
|
|
324
|
-
|
|
275
|
+
x ?? Math.ceil(f)
|
|
325
276
|
);
|
|
326
|
-
|
|
327
|
-
},
|
|
277
|
+
pe(H);
|
|
278
|
+
}, O = () => {
|
|
328
279
|
requestAnimationFrame(() => {
|
|
329
|
-
|
|
280
|
+
M || G();
|
|
330
281
|
});
|
|
331
282
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
283
|
+
j.current = O, G(), O(), xe ? ke().then((a) => {
|
|
284
|
+
M || (a(r), requestAnimationFrame(() => {
|
|
285
|
+
M || (B(!0), O());
|
|
335
286
|
}));
|
|
336
287
|
}).catch(() => {
|
|
337
|
-
|
|
338
|
-
}) :
|
|
339
|
-
const
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
288
|
+
M || (B(!0), O());
|
|
289
|
+
}) : B(!0);
|
|
290
|
+
const X = new ResizeObserver(() => G());
|
|
291
|
+
return X.observe(r.body), D && X.observe(D), () => {
|
|
292
|
+
M = !0, X.disconnect(), w && (r.removeEventListener("pointerdown", g, !0), r.removeEventListener("mousedown", le, !0), r.removeEventListener("touchstart", ce, !0)), setTimeout(() => {
|
|
293
|
+
ae.unmount(), $.current = null, Z.current = null, j.current = () => {
|
|
343
294
|
};
|
|
344
295
|
}, 0);
|
|
345
296
|
};
|
|
346
|
-
}, []),
|
|
347
|
-
const
|
|
348
|
-
|
|
297
|
+
}, []), y(() => {
|
|
298
|
+
const o = () => {
|
|
299
|
+
ve(!!document.fullscreenElement);
|
|
349
300
|
};
|
|
350
|
-
return document.addEventListener("fullscreenchange",
|
|
301
|
+
return document.addEventListener("fullscreenchange", o), () => document.removeEventListener("fullscreenchange", o);
|
|
351
302
|
}, []);
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
303
|
+
const Ee = () => {
|
|
304
|
+
const o = Y.current || E.current;
|
|
305
|
+
if (o) {
|
|
355
306
|
if (document.fullscreenElement) {
|
|
356
307
|
document.exitFullscreen().catch(() => {
|
|
357
308
|
});
|
|
358
309
|
return;
|
|
359
310
|
}
|
|
360
|
-
|
|
311
|
+
o.requestFullscreen && o.requestFullscreen().catch(() => {
|
|
361
312
|
});
|
|
362
313
|
}
|
|
363
314
|
};
|
|
364
|
-
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
/* @__PURE__ */
|
|
368
|
-
|
|
315
|
+
y(() => {
|
|
316
|
+
const o = $.current;
|
|
317
|
+
o && (o.render(
|
|
318
|
+
/* @__PURE__ */ b.jsx(
|
|
319
|
+
Te,
|
|
369
320
|
{
|
|
370
|
-
html:
|
|
321
|
+
html: k,
|
|
371
322
|
loadingText: s,
|
|
372
|
-
styleLoadingText:
|
|
323
|
+
styleLoadingText: i,
|
|
373
324
|
scriptLoadingText: l,
|
|
374
325
|
fullScreenButtonText: m,
|
|
375
|
-
hideFullScreen:
|
|
376
|
-
resetToken:
|
|
377
|
-
hasRootVhHeight:
|
|
326
|
+
hideFullScreen: C,
|
|
327
|
+
resetToken: K,
|
|
328
|
+
hasRootVhHeight: ie,
|
|
378
329
|
mode: h,
|
|
379
|
-
stretchRootHeight:
|
|
330
|
+
stretchRootHeight: ee
|
|
380
331
|
}
|
|
381
332
|
)
|
|
382
|
-
),
|
|
383
|
-
|
|
333
|
+
), R.current = window.requestAnimationFrame(() => {
|
|
334
|
+
j.current?.(), R.current = null;
|
|
384
335
|
}));
|
|
385
336
|
}, [
|
|
386
|
-
|
|
337
|
+
k,
|
|
387
338
|
s,
|
|
388
|
-
|
|
339
|
+
i,
|
|
389
340
|
l,
|
|
390
341
|
m,
|
|
391
|
-
|
|
342
|
+
K,
|
|
392
343
|
h
|
|
393
344
|
]);
|
|
394
|
-
const
|
|
345
|
+
const Se = [
|
|
395
346
|
"w-full relative content-render-iframe-sandbox",
|
|
396
|
-
|
|
347
|
+
z ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
397
348
|
].filter(Boolean).join(" ");
|
|
398
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ b.jsxs(
|
|
399
350
|
"div",
|
|
400
351
|
{
|
|
401
|
-
ref:
|
|
402
|
-
"data-root-vh":
|
|
403
|
-
className:
|
|
404
|
-
style:
|
|
405
|
-
height:
|
|
406
|
-
minHeight:
|
|
352
|
+
ref: Y,
|
|
353
|
+
"data-root-vh": ie ? "true" : "false",
|
|
354
|
+
className: Se,
|
|
355
|
+
style: T ? {
|
|
356
|
+
height: T,
|
|
357
|
+
minHeight: T
|
|
407
358
|
} : void 0,
|
|
408
359
|
children: [
|
|
409
|
-
!
|
|
360
|
+
!C && /* @__PURE__ */ b.jsx(
|
|
410
361
|
"button",
|
|
411
362
|
{
|
|
412
363
|
type: "button",
|
|
413
|
-
onClick:
|
|
364
|
+
onClick: Ee,
|
|
414
365
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
415
|
-
children:
|
|
366
|
+
children: we ? "退出全屏" : m || "全屏浏览"
|
|
416
367
|
}
|
|
417
368
|
),
|
|
418
|
-
h === "blackboard" &&
|
|
369
|
+
h === "blackboard" && e === "markdown" ? /* @__PURE__ */ b.jsx(
|
|
419
370
|
"div",
|
|
420
371
|
{
|
|
421
|
-
onMouseDown: () =>
|
|
422
|
-
onPointerDown: () =>
|
|
423
|
-
onTouchStart: () =>
|
|
424
|
-
children: /* @__PURE__ */
|
|
372
|
+
onMouseDown: () => S("mousedown"),
|
|
373
|
+
onPointerDown: () => S("pointerdown"),
|
|
374
|
+
onTouchStart: () => S("touchstart"),
|
|
375
|
+
children: /* @__PURE__ */ b.jsx(Ne, { content: t })
|
|
425
376
|
}
|
|
426
|
-
) : /* @__PURE__ */
|
|
377
|
+
) : /* @__PURE__ */ b.jsxs(b.Fragment, { children: [
|
|
427
378
|
null,
|
|
428
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ b.jsx(
|
|
429
380
|
"iframe",
|
|
430
381
|
{
|
|
431
|
-
ref:
|
|
382
|
+
ref: E,
|
|
432
383
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
433
384
|
allow: "fullscreen",
|
|
434
385
|
allowFullScreen: !0,
|
|
435
386
|
className: [n, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
436
387
|
style: {
|
|
437
|
-
height:
|
|
438
|
-
minHeight:
|
|
388
|
+
height: T ?? "100%",
|
|
389
|
+
minHeight: T,
|
|
439
390
|
margin: "auto",
|
|
440
391
|
visibility: "visible"
|
|
441
392
|
}
|
|
@@ -448,6 +399,6 @@ const Be = () => {
|
|
|
448
399
|
);
|
|
449
400
|
};
|
|
450
401
|
export {
|
|
451
|
-
|
|
402
|
+
Ke as default
|
|
452
403
|
};
|
|
453
404
|
//# sourceMappingURL=IframeSandbox.es.js.map
|