@mxmweb/fviewer 1.5.1 → 1.5.3
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/index.js +268 -282
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/stats.html +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as he } from "react";
|
|
2
2
|
import G from "styled-components";
|
|
3
|
+
import { Markdownit as ve, DataType as we } from "@mxmweb/rtext";
|
|
3
4
|
import * as re from "pdfjs-dist";
|
|
4
|
-
|
|
5
|
-
const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, Ae = ({
|
|
5
|
+
const xe = "#FFEB3B", De = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, Be = ({
|
|
6
6
|
pageNumber: e,
|
|
7
7
|
scale: t,
|
|
8
8
|
isAnnotating: o,
|
|
@@ -11,7 +11,7 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
11
11
|
onAnnotationDelete: d,
|
|
12
12
|
readOnly: p = !1
|
|
13
13
|
}) => {
|
|
14
|
-
const f = X(null), [g, h] = R(!1), [
|
|
14
|
+
const f = X(null), [g, h] = R(!1), [v, b] = R({ x: 0, y: 0 }), [w, B] = R(null), [a, l] = R(null), D = $(
|
|
15
15
|
(c) => {
|
|
16
16
|
if (!o || !f.current) return;
|
|
17
17
|
const x = f.current.getBoundingClientRect(), F = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
|
|
@@ -23,30 +23,30 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
23
23
|
if (!g || !f.current) return;
|
|
24
24
|
const x = f.current.getBoundingClientRect(), F = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
|
|
25
25
|
B({
|
|
26
|
-
x: Math.min(
|
|
27
|
-
y: Math.min(
|
|
28
|
-
width: Math.abs(F -
|
|
29
|
-
height: Math.abs(k -
|
|
26
|
+
x: Math.min(v.x, F),
|
|
27
|
+
y: Math.min(v.y, k),
|
|
28
|
+
width: Math.abs(F - v.x),
|
|
29
|
+
height: Math.abs(k - v.y)
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
|
-
[g,
|
|
32
|
+
[g, v, t]
|
|
33
33
|
), q = $(() => {
|
|
34
|
-
if (!g || !
|
|
35
|
-
if (h(!1),
|
|
34
|
+
if (!g || !w) return;
|
|
35
|
+
if (h(!1), w.width < 5 || w.height < 5) {
|
|
36
36
|
B(null);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const c = {
|
|
40
|
-
id:
|
|
40
|
+
id: De(),
|
|
41
41
|
pageNumber: e,
|
|
42
|
-
...
|
|
42
|
+
...w,
|
|
43
43
|
content: "",
|
|
44
|
-
color:
|
|
44
|
+
color: xe
|
|
45
45
|
};
|
|
46
46
|
r == null || r(c), B(null);
|
|
47
|
-
}, [g,
|
|
48
|
-
l(
|
|
49
|
-
}, [
|
|
47
|
+
}, [g, w, e, r]), N = $((c) => {
|
|
48
|
+
l(a === c ? null : c);
|
|
49
|
+
}, [a]);
|
|
50
50
|
return $((c, x) => {
|
|
51
51
|
const F = {
|
|
52
52
|
...c,
|
|
@@ -79,15 +79,15 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
79
79
|
onMouseUp: q,
|
|
80
80
|
onMouseLeave: q
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
w && /* @__PURE__ */ n.createElement(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: "absolute border-2 border-yellow-400 bg-yellow-100/30",
|
|
86
86
|
style: {
|
|
87
|
-
left: `${
|
|
88
|
-
top: `${
|
|
89
|
-
width: `${
|
|
90
|
-
height: `${
|
|
87
|
+
left: `${w.x * 100}%`,
|
|
88
|
+
top: `${w.y * 100}%`,
|
|
89
|
+
width: `${w.width * 100}%`,
|
|
90
|
+
height: `${w.height * 100}%`
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
),
|
|
@@ -117,20 +117,7 @@ const Be = "#FFEB3B", ke = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
117
117
|
}
|
|
118
118
|
))))
|
|
119
119
|
);
|
|
120
|
-
},
|
|
121
|
-
try {
|
|
122
|
-
if (xe())
|
|
123
|
-
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", yt());
|
|
124
|
-
else {
|
|
125
|
-
const e = "/worker/pdf.worker.min.js";
|
|
126
|
-
console.log("\u6B63\u5728\u6CE8\u518CPDF Worker\uFF0C\u8DEF\u5F84:", e, "\u73AF\u5883:", "\u751F\u4EA7"), De(e);
|
|
127
|
-
}
|
|
128
|
-
} catch (e) {
|
|
129
|
-
console.warn("PDF Worker \u81EA\u52A8\u6CE8\u518C\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6CE8\u518C:", e);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
$e();
|
|
133
|
-
const Pe = {
|
|
120
|
+
}, ke = {
|
|
134
121
|
colors: {
|
|
135
122
|
primary: "#007bff",
|
|
136
123
|
secondary: "#6c757d",
|
|
@@ -154,14 +141,14 @@ const Pe = {
|
|
|
154
141
|
shadow: "md",
|
|
155
142
|
lineHeight: "md"
|
|
156
143
|
}
|
|
157
|
-
},
|
|
144
|
+
}, Ae = G.div`
|
|
158
145
|
display: flex;
|
|
159
146
|
align-items: center;
|
|
160
147
|
justify-content: center;
|
|
161
148
|
height: 200px;
|
|
162
149
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
163
150
|
font-size: 14px;
|
|
164
|
-
`,
|
|
151
|
+
`, $e = G.div`
|
|
165
152
|
display: flex;
|
|
166
153
|
align-items: center;
|
|
167
154
|
justify-content: center;
|
|
@@ -169,7 +156,7 @@ const Pe = {
|
|
|
169
156
|
color: ${(e) => e.$theme.colors.error};
|
|
170
157
|
font-size: 14px;
|
|
171
158
|
text-align: center;
|
|
172
|
-
`,
|
|
159
|
+
`, Pe = ({
|
|
173
160
|
pdfDocument: e,
|
|
174
161
|
currentPage: t,
|
|
175
162
|
pdfStartPage: o = 1,
|
|
@@ -181,17 +168,17 @@ const Pe = {
|
|
|
181
168
|
onPageChange: f,
|
|
182
169
|
onScaleChange: g,
|
|
183
170
|
onAnnotationChange: h,
|
|
184
|
-
onAnnotationDelete:
|
|
171
|
+
onAnnotationDelete: v,
|
|
185
172
|
styles: b
|
|
186
173
|
}) => {
|
|
187
|
-
const [
|
|
174
|
+
const [w, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [F, k] = R(!0), O = (b == null ? void 0 : b.theme) || ke, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((s) => {
|
|
188
175
|
if (!A.current || !F || !g) return null;
|
|
189
|
-
const
|
|
176
|
+
const i = A.current, y = i.offsetWidth - 40, m = i.offsetHeight - 40, _ = y / s.width, T = m / s.height, I = Math.min(_, T, 1), Z = Math.max(0.3, Math.min(1, I));
|
|
190
177
|
return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
|
|
191
178
|
containerWidth: y,
|
|
192
179
|
containerHeight: m,
|
|
193
|
-
viewportWidth:
|
|
194
|
-
viewportHeight:
|
|
180
|
+
viewportWidth: s.width,
|
|
181
|
+
viewportHeight: s.height,
|
|
195
182
|
scaleX: _,
|
|
196
183
|
scaleY: T,
|
|
197
184
|
autoScale: I,
|
|
@@ -205,21 +192,21 @@ const Pe = {
|
|
|
205
192
|
}
|
|
206
193
|
try {
|
|
207
194
|
V.current = t, P.current = !0;
|
|
208
|
-
const
|
|
209
|
-
if (console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${
|
|
210
|
-
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${
|
|
211
|
-
const
|
|
195
|
+
const s = t - o + 1;
|
|
196
|
+
if (console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${s}`), s < 1 || s > e.numPages)
|
|
197
|
+
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${s}, PDF\u603B\u9875\u6570=${e.numPages}`), new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${t}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${e.numPages}\u9875`);
|
|
198
|
+
const i = await e.getPage(s), y = L.current, m = y.getContext("2d");
|
|
212
199
|
console.log("\u5F53\u524Dscale\u503C:", u);
|
|
213
|
-
const _ =
|
|
214
|
-
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), F && k(!1), y.width = _.width, y.height = _.height, await
|
|
200
|
+
const _ = i.getViewport({ scale: 1 });
|
|
201
|
+
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), F && k(!1), y.width = _.width, y.height = _.height, await i.render({
|
|
215
202
|
canvasContext: m,
|
|
216
203
|
viewport: _
|
|
217
204
|
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", y.width, "x", y.height), A.current) {
|
|
218
205
|
const T = A.current;
|
|
219
206
|
console.log("\u5BB9\u5668\u5C3A\u5BF8:", T.offsetWidth, "x", T.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", y.offsetWidth, "x", y.offsetHeight);
|
|
220
207
|
}
|
|
221
|
-
} catch (
|
|
222
|
-
console.error("PDF\u6E32\u67D3\u5931\u8D25:",
|
|
208
|
+
} catch (s) {
|
|
209
|
+
console.error("PDF\u6E32\u67D3\u5931\u8D25:", s);
|
|
223
210
|
} finally {
|
|
224
211
|
P.current = !1;
|
|
225
212
|
}
|
|
@@ -229,7 +216,7 @@ const Pe = {
|
|
|
229
216
|
e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), J());
|
|
230
217
|
}, [t, e, o]), te(() => {
|
|
231
218
|
e && t && J();
|
|
232
|
-
}, [u, e, t]),
|
|
219
|
+
}, [u, e, t]), w ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Ae, { $theme: O }, "\u52A0\u8F7D\u4E2D...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: O }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, a)))) : /* @__PURE__ */ n.createElement(
|
|
233
220
|
"div",
|
|
234
221
|
{
|
|
235
222
|
ref: A,
|
|
@@ -245,7 +232,7 @@ const Pe = {
|
|
|
245
232
|
overflow: "visible"
|
|
246
233
|
}
|
|
247
234
|
},
|
|
248
|
-
|
|
235
|
+
w ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20" }, /* @__PURE__ */ n.createElement("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900" }), /* @__PURE__ */ n.createElement("div", { className: "text-xs text-gray-600" }, "PDF\u52A0\u8F7D\u4E2D...")) : a ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20 text-red-500" }, /* @__PURE__ */ n.createElement("div", null, "\u6E32\u67D3\u9519\u8BEF"), /* @__PURE__ */ n.createElement("div", { className: "text-xs" }, a)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
|
|
249
236
|
"div",
|
|
250
237
|
{
|
|
251
238
|
className: "relative",
|
|
@@ -267,20 +254,20 @@ const Pe = {
|
|
|
267
254
|
}
|
|
268
255
|
),
|
|
269
256
|
/* @__PURE__ */ n.createElement(
|
|
270
|
-
|
|
257
|
+
Be,
|
|
271
258
|
{
|
|
272
259
|
pageNumber: t,
|
|
273
260
|
scale: u,
|
|
274
261
|
isAnnotating: d,
|
|
275
262
|
annotations: r,
|
|
276
263
|
onAnnotationAdd: h,
|
|
277
|
-
onAnnotationDelete:
|
|
264
|
+
onAnnotationDelete: v,
|
|
278
265
|
readOnly: !d
|
|
279
266
|
}
|
|
280
267
|
)
|
|
281
268
|
))
|
|
282
269
|
);
|
|
283
|
-
},
|
|
270
|
+
}, _e = G.div`
|
|
284
271
|
flex: 1;
|
|
285
272
|
background: ${(e) => e.$theme.colors.background};
|
|
286
273
|
position: relative;
|
|
@@ -293,13 +280,13 @@ const Pe = {
|
|
|
293
280
|
/* 支持大尺寸内容的滚动 */
|
|
294
281
|
overflow-x: auto;
|
|
295
282
|
overflow-y: auto; /* 改为auto,允许垂直滚动 */
|
|
296
|
-
`,
|
|
283
|
+
`, Te = G.div`
|
|
297
284
|
display: flex;
|
|
298
285
|
align-items: center;
|
|
299
286
|
justify-content: center;
|
|
300
287
|
height: 100%;
|
|
301
288
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
302
|
-
`,
|
|
289
|
+
`, Re = G.div`
|
|
303
290
|
display: flex;
|
|
304
291
|
flex-direction: column;
|
|
305
292
|
align-items: center;
|
|
@@ -308,7 +295,7 @@ const Pe = {
|
|
|
308
295
|
color: ${(e) => e.$theme.colors.error};
|
|
309
296
|
text-align: center;
|
|
310
297
|
padding: 20px;
|
|
311
|
-
`,
|
|
298
|
+
`, Ne = `
|
|
312
299
|
.md-annotation {
|
|
313
300
|
position: relative;
|
|
314
301
|
display: inline;
|
|
@@ -388,7 +375,7 @@ const Pe = {
|
|
|
388
375
|
.markdown-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
389
376
|
background: #a9a9a;
|
|
390
377
|
}
|
|
391
|
-
`,
|
|
378
|
+
`, Le = {
|
|
392
379
|
colors: {
|
|
393
380
|
primary: "#007bff",
|
|
394
381
|
secondary: "#6c757d",
|
|
@@ -412,52 +399,52 @@ const Pe = {
|
|
|
412
399
|
shadow: "md",
|
|
413
400
|
lineHeight: "md"
|
|
414
401
|
}
|
|
415
|
-
},
|
|
402
|
+
}, ze = (e) => {
|
|
416
403
|
if (console.log("=== detectFileType \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", e), !e)
|
|
417
404
|
return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"), "unknown";
|
|
418
405
|
const t = e.fileName || "", o = e.fileType || "", u = e.content;
|
|
419
406
|
return console.log("\u68C0\u6D4B\u53C2\u6570:", { fileName: t, fileType: o, content: u }), o === "pdf" || o === "pdf_slides" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), o) : o === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : o === "markdown_table" ? (console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"), "markdown_table") : o === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : o === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : o === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : t.toLowerCase().endsWith(".pdf") || (u == null ? void 0 : u.type) === "pdf" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), "pdf") : t.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || (u == null ? void 0 : u.type) === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : t.toLowerCase().endsWith(".md") || (u == null ? void 0 : u.type) === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : t.toLowerCase().match(/\.(html|htm)$/) || (u == null ? void 0 : u.type) === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : t.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || (u == null ? void 0 : u.type) === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : (console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"), "unknown");
|
|
420
|
-
},
|
|
407
|
+
}, Se = (e, t, o = !1) => {
|
|
421
408
|
var u, r, d, p, f, g, h;
|
|
422
409
|
console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:", "pdfStartPage:" + e.pdfStartPage, "currentPage:" + t.currentPage), console.log("=== renderPdfContent \u5F00\u59CB ==="), console.log("PDF\u6570\u636E:", e), console.log("PDF\u6587\u6863:", (u = e.content) == null ? void 0 : u.document), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof ((r = e.content) == null ? void 0 : r.document)), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:", ((d = e.content) == null ? void 0 : d.document) === null), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:", ((p = e.content) == null ? void 0 : p.document) === void 0), console.log("PDF\u6587\u6863\u65B9\u6CD5:", (f = e.content) != null && f.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"), console.log("PDF\u6587\u6863\u5C5E\u6027:", (g = e.content) != null && g.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863");
|
|
423
|
-
const
|
|
424
|
-
console.log("PDF\u8D77\u59CB\u9875:",
|
|
410
|
+
const v = e.pdfStartPage || 1;
|
|
411
|
+
console.log("PDF\u8D77\u59CB\u9875:", v);
|
|
425
412
|
const b = (t.annotationData || []).filter(
|
|
426
|
-
(
|
|
413
|
+
(a) => "pageNumber" in a && "x" in a && "y" in a
|
|
427
414
|
);
|
|
428
415
|
console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", b);
|
|
429
|
-
const
|
|
416
|
+
const w = o ? 0.82 : 1, B = t.initialZoom || t.scale || w;
|
|
430
417
|
return /* @__PURE__ */ n.createElement(
|
|
431
|
-
|
|
418
|
+
Pe,
|
|
432
419
|
{
|
|
433
420
|
pdfDocument: ((h = e.content) == null ? void 0 : h.document) || null,
|
|
434
421
|
currentPage: t.currentPage || 1,
|
|
435
|
-
pdfStartPage:
|
|
422
|
+
pdfStartPage: v,
|
|
436
423
|
scale: B,
|
|
437
424
|
annotations: b,
|
|
438
425
|
isAnnotating: !1,
|
|
439
426
|
isSlidesMode: o,
|
|
440
|
-
onPageChange: t.eventsEmit ? (
|
|
427
|
+
onPageChange: t.eventsEmit ? (a) => {
|
|
441
428
|
var l;
|
|
442
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber:
|
|
429
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber: a });
|
|
443
430
|
} : void 0,
|
|
444
|
-
onScaleChange: t.eventsEmit ? (
|
|
431
|
+
onScaleChange: t.eventsEmit ? (a) => {
|
|
445
432
|
var l;
|
|
446
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale:
|
|
433
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale: a });
|
|
447
434
|
} : void 0,
|
|
448
|
-
onAnnotationChange: t.eventsEmit ? (
|
|
435
|
+
onAnnotationChange: t.eventsEmit ? (a) => {
|
|
449
436
|
var l;
|
|
450
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation:
|
|
437
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation: a });
|
|
451
438
|
} : void 0,
|
|
452
|
-
onAnnotationDelete: t.eventsEmit ? (
|
|
439
|
+
onAnnotationDelete: t.eventsEmit ? (a) => {
|
|
453
440
|
var l;
|
|
454
|
-
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId:
|
|
441
|
+
return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId: a });
|
|
455
442
|
} : void 0,
|
|
456
443
|
styles: t.styles
|
|
457
444
|
}
|
|
458
445
|
);
|
|
459
|
-
},
|
|
460
|
-
var o, u, r, d, p, f, g, h,
|
|
446
|
+
}, Me = (e, t) => {
|
|
447
|
+
var o, u, r, d, p, f, g, h, v, b, w, B, a, l;
|
|
461
448
|
console.log("=== Fviewer renderImageContent ==="), console.log("data:", e), console.log("data.content:", e.content), console.log("data.content?.url:", (o = e.content) == null ? void 0 : o.url), console.log("rotation:", t.rotation);
|
|
462
449
|
const D = ((u = e.content) == null ? void 0 : u.url) || e.content, [C, q] = R(!0), [N, c] = R(!1), x = () => {
|
|
463
450
|
console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", D), q(!1), c(!1);
|
|
@@ -493,7 +480,7 @@ const Pe = {
|
|
|
493
480
|
animation: "spin 1s linear infinite"
|
|
494
481
|
} }), /* @__PURE__ */ n.createElement("div", { style: {
|
|
495
482
|
fontSize: "12px",
|
|
496
|
-
color: ((
|
|
483
|
+
color: ((w = (b = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : b.colors) == null ? void 0 : w.text) || "#343a40"
|
|
497
484
|
} }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), N && /* @__PURE__ */ n.createElement("div", { style: {
|
|
498
485
|
position: "absolute",
|
|
499
486
|
top: "50%",
|
|
@@ -506,7 +493,7 @@ const Pe = {
|
|
|
506
493
|
zIndex: 1
|
|
507
494
|
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
508
495
|
fontSize: "14px",
|
|
509
|
-
color: ((l = (
|
|
496
|
+
color: ((l = (a = (B = t.styles) == null ? void 0 : B.theme) == null ? void 0 : a.colors) == null ? void 0 : l.error) || "#dc3545"
|
|
510
497
|
} }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
|
|
511
498
|
"img",
|
|
512
499
|
{
|
|
@@ -529,7 +516,7 @@ const Pe = {
|
|
|
529
516
|
100% { transform: rotate(360deg); }
|
|
530
517
|
}
|
|
531
518
|
`));
|
|
532
|
-
},
|
|
519
|
+
}, We = (e, t) => {
|
|
533
520
|
var o, u, r, d, p;
|
|
534
521
|
console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
535
522
|
let f = "";
|
|
@@ -537,12 +524,12 @@ const Pe = {
|
|
|
537
524
|
const g = X(null), h = X(null);
|
|
538
525
|
return te(() => {
|
|
539
526
|
if (g.current && h.current && f) {
|
|
540
|
-
const
|
|
527
|
+
const v = setTimeout(() => {
|
|
541
528
|
var b;
|
|
542
|
-
const
|
|
529
|
+
const w = ((b = g.current) == null ? void 0 : b.scrollHeight) || 0, B = Math.max(w + 80, 200);
|
|
543
530
|
h.current && (h.current.style.minHeight = `${B}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", B));
|
|
544
531
|
}, 100);
|
|
545
|
-
return () => clearTimeout(
|
|
532
|
+
return () => clearTimeout(v);
|
|
546
533
|
}
|
|
547
534
|
}, [f]), /* @__PURE__ */ n.createElement("div", { style: {
|
|
548
535
|
height: "100%",
|
|
@@ -581,10 +568,10 @@ const Pe = {
|
|
|
581
568
|
}
|
|
582
569
|
},
|
|
583
570
|
/* @__PURE__ */ n.createElement(
|
|
584
|
-
|
|
571
|
+
ve,
|
|
585
572
|
{
|
|
586
573
|
dataSource: {
|
|
587
|
-
type:
|
|
574
|
+
type: we.TEXT,
|
|
588
575
|
content: f
|
|
589
576
|
},
|
|
590
577
|
size: "md",
|
|
@@ -617,41 +604,41 @@ const Pe = {
|
|
|
617
604
|
borderTopRightRadius: "8px"
|
|
618
605
|
} })
|
|
619
606
|
));
|
|
620
|
-
},
|
|
621
|
-
var u, r, d, p, f, g, h,
|
|
607
|
+
}, Ie = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
|
|
608
|
+
var u, r, d, p, f, g, h, v, b, w, B, a;
|
|
622
609
|
const l = X(null), D = X(null), C = X(null), q = X(!1);
|
|
623
610
|
X(0), X(null);
|
|
624
|
-
const [N] = R(!1), c = (
|
|
625
|
-
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop:
|
|
611
|
+
const [N] = R(!1), c = (s, i) => {
|
|
612
|
+
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: s, scrollHeight: i }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: s, scrollHeight: i });
|
|
626
613
|
}, x = () => {
|
|
627
614
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
|
|
628
615
|
}, F = () => {
|
|
629
616
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
|
|
630
617
|
}, k = X();
|
|
631
|
-
k.current = (
|
|
632
|
-
var
|
|
618
|
+
k.current = (s) => {
|
|
619
|
+
var i, y;
|
|
633
620
|
try {
|
|
634
621
|
if (!o) return;
|
|
635
|
-
const m = typeof e.content == "string" ? e.content : ((
|
|
622
|
+
const m = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
|
|
636
623
|
if (!m || P.length === 0) return;
|
|
637
624
|
const _ = JSON.stringify(P.map((Z) => ({ o: Z.offsets, c: Z.color }))), T = `${m.length}:${m.substring(0, 64)}:${m.substring(m.length - 64)}|${_}`;
|
|
638
|
-
if (((y =
|
|
625
|
+
if (((y = s.dataset) == null ? void 0 : y.tableAnnoRuntimeSig) === T) return;
|
|
639
626
|
setTimeout(() => {
|
|
640
|
-
ee(),
|
|
627
|
+
ee(), s.dataset && (s.dataset.tableAnnoRuntimeSig = T);
|
|
641
628
|
}, 50);
|
|
642
629
|
} catch (m) {
|
|
643
630
|
console.warn("[MarkdownRendered] apply failed", m);
|
|
644
631
|
}
|
|
645
632
|
};
|
|
646
|
-
const O = n.useCallback((
|
|
647
|
-
var
|
|
648
|
-
return (
|
|
633
|
+
const O = n.useCallback((s) => {
|
|
634
|
+
var i;
|
|
635
|
+
return (i = k.current) == null ? void 0 : i.call(k, s);
|
|
649
636
|
}, []), L = $(() => {
|
|
650
|
-
var
|
|
637
|
+
var s;
|
|
651
638
|
if (!N || !l.current) return;
|
|
652
|
-
const
|
|
653
|
-
if (!
|
|
654
|
-
const y =
|
|
639
|
+
const i = window.getSelection();
|
|
640
|
+
if (!i || i.isCollapsed) return;
|
|
641
|
+
const y = i.getRangeAt(0), m = y.toString().trim();
|
|
655
642
|
if (!m) return;
|
|
656
643
|
const _ = l.current;
|
|
657
644
|
let T = 0, I = 0;
|
|
@@ -671,7 +658,7 @@ const Pe = {
|
|
|
671
658
|
I = T + y.startOffset;
|
|
672
659
|
break;
|
|
673
660
|
}
|
|
674
|
-
T += ((
|
|
661
|
+
T += ((s = U.textContent) == null ? void 0 : s.length) || 0, U = Z.nextNode();
|
|
675
662
|
}
|
|
676
663
|
console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
|
|
677
664
|
text: m,
|
|
@@ -685,35 +672,35 @@ const Pe = {
|
|
|
685
672
|
end: I + m.length,
|
|
686
673
|
color: "#FFE599"
|
|
687
674
|
};
|
|
688
|
-
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M),
|
|
675
|
+
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M), i.removeAllRanges();
|
|
689
676
|
}, [N, t.eventsEmit]), A = o ? [] : (t.annotationData || []).filter(
|
|
690
|
-
(
|
|
677
|
+
(s) => "start" in s && "end" in s && !("pageNumber" in s)
|
|
691
678
|
), P = o ? (t.annotationData || []).filter(
|
|
692
|
-
(
|
|
679
|
+
(s) => "offsets" in s && Array.isArray(s.offsets)
|
|
693
680
|
) : [], V = $(() => {
|
|
694
681
|
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
|
|
695
682
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
|
|
696
683
|
return;
|
|
697
684
|
}
|
|
698
|
-
const
|
|
699
|
-
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",
|
|
700
|
-
const y =
|
|
701
|
-
y && y.replaceChild(document.createTextNode(
|
|
685
|
+
const s = l.current.querySelectorAll(".md-annotation");
|
|
686
|
+
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", s.length), s.length > 0 && s.forEach((i) => {
|
|
687
|
+
const y = i.parentNode;
|
|
688
|
+
y && y.replaceChild(document.createTextNode(i.textContent || ""), i);
|
|
702
689
|
}), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
|
|
703
690
|
}, []), ee = $(() => {
|
|
704
691
|
if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", P), !l.current || !P.length) {
|
|
705
692
|
console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");
|
|
706
693
|
return;
|
|
707
694
|
}
|
|
708
|
-
const
|
|
709
|
-
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",
|
|
695
|
+
const s = l.current.querySelectorAll("table");
|
|
696
|
+
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", s.length), s.length === 0) {
|
|
710
697
|
console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
|
|
711
698
|
return;
|
|
712
699
|
}
|
|
713
|
-
q.current = !0, P.forEach((
|
|
714
|
-
const m =
|
|
715
|
-
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",
|
|
716
|
-
console.warn("[TableAnnotation] annotation.offsets is not valid",
|
|
700
|
+
q.current = !0, P.forEach((i, y) => {
|
|
701
|
+
const m = i.offsets;
|
|
702
|
+
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", i), !Array.isArray(m) || !m.length || !Array.isArray(m[0]) || m[0].length !== 2) {
|
|
703
|
+
console.warn("[TableAnnotation] annotation.offsets is not valid", i);
|
|
717
704
|
return;
|
|
718
705
|
}
|
|
719
706
|
m.forEach((_, T) => {
|
|
@@ -722,7 +709,7 @@ const Pe = {
|
|
|
722
709
|
console.warn("[TableAnnotation] offset is not [number, number]", _);
|
|
723
710
|
return;
|
|
724
711
|
}
|
|
725
|
-
|
|
712
|
+
s.forEach((U, M) => {
|
|
726
713
|
var j, K, oe;
|
|
727
714
|
let Q;
|
|
728
715
|
const H = U.tBodies && U.tBodies.length > 0 ? Array.from(U.tBodies[0].rows) : [];
|
|
@@ -741,8 +728,8 @@ const Pe = {
|
|
|
741
728
|
console.warn("[TableAnnotation] cell is undefined", { row: I, col: Z, tableIndex: M });
|
|
742
729
|
return;
|
|
743
730
|
}
|
|
744
|
-
const E =
|
|
745
|
-
W.getAttribute("data-table-annotated") === "1" && (z === E || W.style.backgroundColor === E) || (W.style.setProperty("background", E, "important"), W.style.setProperty("background-color", E, "important"), W.setAttribute("data-table-annotated", "1")),
|
|
731
|
+
const E = i.color || "rgba(255, 229, 153, 0.5)", z = getComputedStyle(W).backgroundColor;
|
|
732
|
+
W.getAttribute("data-table-annotated") === "1" && (z === E || W.style.backgroundColor === E) || (W.style.setProperty("background", E, "important"), W.style.setProperty("background-color", E, "important"), W.setAttribute("data-table-annotated", "1")), i.content && (W.title = i.content), T === 0 && y === 0 && setTimeout(() => {
|
|
746
733
|
W.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
747
734
|
}, 300);
|
|
748
735
|
});
|
|
@@ -756,10 +743,10 @@ const Pe = {
|
|
|
756
743
|
return;
|
|
757
744
|
}
|
|
758
745
|
D.current && clearTimeout(D.current);
|
|
759
|
-
const
|
|
760
|
-
var
|
|
746
|
+
const s = () => {
|
|
747
|
+
var i;
|
|
761
748
|
console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
|
|
762
|
-
const y = (
|
|
749
|
+
const y = (i = l.current) == null ? void 0 : i.querySelectorAll(".md-annotation");
|
|
763
750
|
console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (y == null ? void 0 : y.length) || 0), y == null || y.forEach((M) => {
|
|
764
751
|
const j = M.parentNode;
|
|
765
752
|
j && j.replaceChild(document.createTextNode(M.textContent || ""), M);
|
|
@@ -779,7 +766,7 @@ const Pe = {
|
|
|
779
766
|
_.push(T);
|
|
780
767
|
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", _.length), _.length === 0) {
|
|
781
768
|
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), D.current = setTimeout(() => {
|
|
782
|
-
|
|
769
|
+
s();
|
|
783
770
|
}, 200);
|
|
784
771
|
return;
|
|
785
772
|
}
|
|
@@ -804,36 +791,36 @@ const Pe = {
|
|
|
804
791
|
);
|
|
805
792
|
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
|
|
806
793
|
var E, z, Y, S, me, Fe;
|
|
807
|
-
const le = Math.max(0, j - W),
|
|
808
|
-
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd:
|
|
794
|
+
const le = Math.max(0, j - W), se = Math.min(((E = H.textContent) == null ? void 0 : E.length) || 0, K - W);
|
|
795
|
+
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: se, nodeTextLength: (z = H.textContent) == null ? void 0 : z.length }), le >= se) {
|
|
809
796
|
console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
|
|
810
797
|
return;
|
|
811
798
|
}
|
|
812
|
-
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le,
|
|
799
|
+
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le, se)) || "", Ee = ((me = H.textContent) == null ? void 0 : me.slice(se)) || "";
|
|
813
800
|
console.log("\u5206\u5272\u6587\u672C:", { before: ge, annotatedText: fe, after: Ee });
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
ge &&
|
|
801
|
+
const ie = document.createElement("span");
|
|
802
|
+
ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = fe;
|
|
803
|
+
const ae = document.createDocumentFragment();
|
|
804
|
+
ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(ie), Ee && ae.appendChild(document.createTextNode(Ee)), (Fe = H.parentNode) == null || Fe.replaceChild(ae, H), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", fe);
|
|
818
805
|
});
|
|
819
806
|
});
|
|
820
807
|
};
|
|
821
808
|
D.current = setTimeout(() => {
|
|
822
|
-
|
|
809
|
+
s();
|
|
823
810
|
}, 100);
|
|
824
811
|
}, [A]);
|
|
825
812
|
return te(() => {
|
|
826
|
-
var
|
|
813
|
+
var s;
|
|
827
814
|
if (o) {
|
|
828
815
|
console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
|
|
829
816
|
return;
|
|
830
817
|
}
|
|
831
|
-
const
|
|
832
|
-
if (!
|
|
818
|
+
const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
|
|
819
|
+
if (!i || typeof i != "string") {
|
|
833
820
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
834
821
|
return;
|
|
835
822
|
}
|
|
836
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", A), console.log("tableAnnotations:", P), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:",
|
|
823
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", A), console.log("tableAnnotations:", P), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", i), !l.current) {
|
|
837
824
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
|
|
838
825
|
return;
|
|
839
826
|
}
|
|
@@ -848,18 +835,18 @@ const Pe = {
|
|
|
848
835
|
document.removeEventListener("mouseup", L);
|
|
849
836
|
};
|
|
850
837
|
}, [L, o]), te(() => {
|
|
851
|
-
var
|
|
852
|
-
const
|
|
853
|
-
if (!
|
|
838
|
+
var s;
|
|
839
|
+
const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
|
|
840
|
+
if (!i || typeof i != "string") {
|
|
854
841
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
|
|
855
842
|
return;
|
|
856
843
|
}
|
|
857
|
-
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:",
|
|
844
|
+
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", i.length || 0), typeof i == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", i.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", i.substring(i.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof i), console.log("\u5185\u5BB9\u503C:", i)), console.log("\u6807\u6CE8\u6570\u636E:", A), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", P);
|
|
858
845
|
}, [A, P, o]), te(() => {
|
|
859
846
|
if (o && l.current) {
|
|
860
|
-
const
|
|
861
|
-
var
|
|
862
|
-
const y = (
|
|
847
|
+
const s = setTimeout(() => {
|
|
848
|
+
var i;
|
|
849
|
+
const y = (i = l.current) == null ? void 0 : i.querySelectorAll("table");
|
|
863
850
|
y && y.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", y.length), y.forEach((m, _) => {
|
|
864
851
|
if (m instanceof HTMLTableElement) {
|
|
865
852
|
m.style.width = "100%", m.style.minWidth = "100%", m.style.tableLayout = "auto";
|
|
@@ -868,7 +855,7 @@ const Pe = {
|
|
|
868
855
|
}
|
|
869
856
|
}));
|
|
870
857
|
}, 500);
|
|
871
|
-
return () => clearTimeout(
|
|
858
|
+
return () => clearTimeout(s);
|
|
872
859
|
}
|
|
873
860
|
}, [o, e.content]), te(() => () => {
|
|
874
861
|
D.current && clearTimeout(D.current), C.current && (C.current.disconnect(), C.current = null);
|
|
@@ -883,15 +870,15 @@ const Pe = {
|
|
|
883
870
|
},
|
|
884
871
|
className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
|
|
885
872
|
},
|
|
886
|
-
/* @__PURE__ */ n.createElement("style", null,
|
|
873
|
+
/* @__PURE__ */ n.createElement("style", null, Ne),
|
|
887
874
|
/* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
|
|
888
|
-
|
|
875
|
+
ve,
|
|
889
876
|
{
|
|
890
877
|
dataSource: {
|
|
891
|
-
type:
|
|
878
|
+
type: we.MARKDOWN,
|
|
892
879
|
content: (() => {
|
|
893
|
-
var
|
|
894
|
-
return typeof e.content == "string" ? e.content : (
|
|
880
|
+
var s, i;
|
|
881
|
+
return typeof e.content == "string" ? e.content : (s = e.content) != null && s.text ? e.content.text : (i = e.content) != null && i.content ? e.content.content : "";
|
|
895
882
|
})()
|
|
896
883
|
},
|
|
897
884
|
size: "md",
|
|
@@ -902,8 +889,8 @@ const Pe = {
|
|
|
902
889
|
theme: {
|
|
903
890
|
primaryColor: ((d = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : d.primary) || "#007bff",
|
|
904
891
|
backgroundColor: ((g = (f = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : f.colors) == null ? void 0 : g.background) || "#f8f9fa",
|
|
905
|
-
textColor: ((b = (
|
|
906
|
-
borderColor: ((
|
|
892
|
+
textColor: ((b = (v = (h = t.styles) == null ? void 0 : h.theme) == null ? void 0 : v.colors) == null ? void 0 : b.text) || "#343a40",
|
|
893
|
+
borderColor: ((a = (B = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : B.colors) == null ? void 0 : a.border) || "#dee2e6",
|
|
907
894
|
borderRadius: o ? "0px" : "8px",
|
|
908
895
|
padding: o ? "0px" : "20px"
|
|
909
896
|
},
|
|
@@ -916,25 +903,25 @@ const Pe = {
|
|
|
916
903
|
}
|
|
917
904
|
))
|
|
918
905
|
);
|
|
919
|
-
},
|
|
906
|
+
}, je = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
|
|
920
907
|
const u = X(null), r = (f) => {
|
|
921
|
-
const g = f.split(/\r?\n/).filter((
|
|
908
|
+
const g = f.split(/\r?\n/).filter((a) => a.trim().length > 0);
|
|
922
909
|
let h = -1;
|
|
923
|
-
for (let
|
|
924
|
-
const l = g[
|
|
910
|
+
for (let a = 0; a < g.length - 1; a++) {
|
|
911
|
+
const l = g[a].trim(), D = g[a + 1].trim();
|
|
925
912
|
if (l.startsWith("|") && l.endsWith("|") && D.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
|
|
926
|
-
h =
|
|
913
|
+
h = a;
|
|
927
914
|
break;
|
|
928
915
|
}
|
|
929
916
|
}
|
|
930
917
|
if (h === -1) return null;
|
|
931
|
-
const b = g[h].split("|").slice(1, -1).map((
|
|
932
|
-
for (let
|
|
933
|
-
const l = g[
|
|
918
|
+
const b = g[h].split("|").slice(1, -1).map((a) => a.trim()), w = [];
|
|
919
|
+
for (let a = h + 2; a < g.length; a++) {
|
|
920
|
+
const l = g[a].trim();
|
|
934
921
|
if (!l.startsWith("|") || !l.endsWith("|")) break;
|
|
935
|
-
|
|
922
|
+
w.push(l);
|
|
936
923
|
}
|
|
937
|
-
const B =
|
|
924
|
+
const B = w.map((a) => a.split("|").slice(1, -1).map((l) => l.trim()));
|
|
938
925
|
return { headers: b, rows: B };
|
|
939
926
|
}, d = n.useMemo(() => r(e), [e]);
|
|
940
927
|
return te(() => {
|
|
@@ -943,8 +930,8 @@ const Pe = {
|
|
|
943
930
|
if (!u.current || !o.length) return;
|
|
944
931
|
const h = u.current.querySelectorAll("table");
|
|
945
932
|
if (!h || h.length === 0) return;
|
|
946
|
-
o.forEach((
|
|
947
|
-
(
|
|
933
|
+
o.forEach((v, b) => {
|
|
934
|
+
(v.offsets || []).forEach((B, a) => {
|
|
948
935
|
const [l, D] = B;
|
|
949
936
|
h.forEach((C) => {
|
|
950
937
|
var q, N, c;
|
|
@@ -959,8 +946,8 @@ const Pe = {
|
|
|
959
946
|
if (!F) return;
|
|
960
947
|
const k = (c = F.cells) == null ? void 0 : c[D];
|
|
961
948
|
if (!k) return;
|
|
962
|
-
const O =
|
|
963
|
-
k.getAttribute("data-table-annotated") === "1" || (k.style.setProperty("background", O, "important"), k.style.setProperty("background-color", O, "important"), k.setAttribute("data-table-annotated", "1"),
|
|
949
|
+
const O = v.color || "rgba(255, 229, 153, 0.5)";
|
|
950
|
+
k.getAttribute("data-table-annotated") === "1" || (k.style.setProperty("background", O, "important"), k.style.setProperty("background-color", O, "important"), k.setAttribute("data-table-annotated", "1"), v.content && (k.title = v.content)), b === 0 && a === 0 && setTimeout(() => k.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
|
|
964
951
|
});
|
|
965
952
|
});
|
|
966
953
|
});
|
|
@@ -983,8 +970,8 @@ const Pe = {
|
|
|
983
970
|
.z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
|
|
984
971
|
.z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
|
|
985
972
|
.z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
|
|
986
|
-
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, d.headers.map((f, g) => /* @__PURE__ */ n.createElement("th", { key: g }, f)))), /* @__PURE__ */ n.createElement("tbody", null, d.rows.map((f, g) => /* @__PURE__ */ n.createElement("tr", { key: g }, f.map((h,
|
|
987
|
-
},
|
|
973
|
+
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, d.headers.map((f, g) => /* @__PURE__ */ n.createElement("th", { key: g }, f)))), /* @__PURE__ */ n.createElement("tbody", null, d.rows.map((f, g) => /* @__PURE__ */ n.createElement("tr", { key: g }, f.map((h, v) => /* @__PURE__ */ n.createElement("td", { key: v }, h))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
|
|
974
|
+
}, Oe = (e, t) => {
|
|
988
975
|
var o, u;
|
|
989
976
|
console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
990
977
|
let r = "";
|
|
@@ -1006,13 +993,13 @@ const Pe = {
|
|
|
1006
993
|
sandbox: "allow-same-origin allow-scripts"
|
|
1007
994
|
}
|
|
1008
995
|
));
|
|
1009
|
-
},
|
|
996
|
+
}, He = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1010
997
|
display: "flex",
|
|
1011
998
|
justifyContent: "center",
|
|
1012
999
|
alignItems: "center",
|
|
1013
1000
|
height: "100%",
|
|
1014
1001
|
color: "#666"
|
|
1015
|
-
} }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))),
|
|
1002
|
+
} }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))), Ze = ({
|
|
1016
1003
|
data: e,
|
|
1017
1004
|
annotationData: t = [],
|
|
1018
1005
|
totalPage: o = 0,
|
|
@@ -1031,26 +1018,26 @@ const Pe = {
|
|
|
1031
1018
|
navigation: !0
|
|
1032
1019
|
},
|
|
1033
1020
|
customComponents: h,
|
|
1034
|
-
className:
|
|
1021
|
+
className: v,
|
|
1035
1022
|
contentClass: b
|
|
1036
1023
|
}) => {
|
|
1037
|
-
var
|
|
1038
|
-
const D = (f == null ? void 0 : f.theme) ||
|
|
1039
|
-
console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (
|
|
1024
|
+
var w, B, a, l;
|
|
1025
|
+
const D = (f == null ? void 0 : f.theme) || Le, [C, q] = R(!1), [N] = R("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [c, x] = R(null);
|
|
1026
|
+
console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (w = e == null ? void 0 : e.content) == null ? void 0 : w.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((B = e == null ? void 0 : e.content) == null ? void 0 : B.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((a = e == null ? void 0 : e.content) == null ? void 0 : a.document) === null), console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:", ((l = e == null ? void 0 : e.content) == null ? void 0 : l.document) === void 0), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", r);
|
|
1040
1027
|
const F = X(null), k = X(null), O = X(0);
|
|
1041
1028
|
O.current += 1, console.log("[Fviewer] render count:", O.current);
|
|
1042
|
-
const L =
|
|
1029
|
+
const L = ze(e);
|
|
1043
1030
|
console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", L), console.log("\u5B8C\u6574\u6570\u636E:", e);
|
|
1044
1031
|
const A = () => {
|
|
1045
1032
|
var P;
|
|
1046
1033
|
switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", L), L) {
|
|
1047
1034
|
case "pdf":
|
|
1048
1035
|
case "pdf_slides":
|
|
1049
|
-
return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u),
|
|
1036
|
+
return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), Se(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: f, tools: g, className: v, contentClass: b }, L === "pdf_slides");
|
|
1050
1037
|
case "image":
|
|
1051
|
-
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),
|
|
1038
|
+
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Me(e, { scale: r, rotation: d, styles: f });
|
|
1052
1039
|
case "text":
|
|
1053
|
-
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),
|
|
1040
|
+
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, { scale: r, styles: f });
|
|
1054
1041
|
case "markdown":
|
|
1055
1042
|
case "markdown_table":
|
|
1056
1043
|
if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", L), L === "markdown_table") {
|
|
@@ -1058,7 +1045,7 @@ const Pe = {
|
|
|
1058
1045
|
(J) => "offsets" in J && Array.isArray(J.offsets)
|
|
1059
1046
|
);
|
|
1060
1047
|
return /* @__PURE__ */ n.createElement(
|
|
1061
|
-
|
|
1048
|
+
je,
|
|
1062
1049
|
{
|
|
1063
1050
|
markdown: V,
|
|
1064
1051
|
tableAnnotations: ee
|
|
@@ -1066,17 +1053,17 @@ const Pe = {
|
|
|
1066
1053
|
);
|
|
1067
1054
|
}
|
|
1068
1055
|
return /* @__PURE__ */ n.createElement(
|
|
1069
|
-
|
|
1056
|
+
Ie,
|
|
1070
1057
|
{
|
|
1071
1058
|
data: e,
|
|
1072
|
-
parentProps: { data: e, annotationData: t, eventsEmit: p, styles: f, tools: g, className:
|
|
1059
|
+
parentProps: { data: e, annotationData: t, eventsEmit: p, styles: f, tools: g, className: v, contentClass: b },
|
|
1073
1060
|
isTableMode: !1
|
|
1074
1061
|
}
|
|
1075
1062
|
);
|
|
1076
1063
|
case "html":
|
|
1077
|
-
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),
|
|
1064
|
+
return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), Oe(e);
|
|
1078
1065
|
default:
|
|
1079
|
-
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),
|
|
1066
|
+
return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), He(e);
|
|
1080
1067
|
}
|
|
1081
1068
|
};
|
|
1082
1069
|
return n.useEffect(() => {
|
|
@@ -1092,19 +1079,19 @@ const Pe = {
|
|
|
1092
1079
|
c && q(!1);
|
|
1093
1080
|
}, [c]), n.useEffect(() => {
|
|
1094
1081
|
console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:", L);
|
|
1095
|
-
}, [t, L]), /* @__PURE__ */ n.createElement(
|
|
1082
|
+
}, [t, L]), /* @__PURE__ */ n.createElement(_e, { $theme: D, className: b }, C ? h != null && h.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1096
1083
|
h.LoadingComponent,
|
|
1097
1084
|
{
|
|
1098
1085
|
status: N,
|
|
1099
1086
|
theme: D
|
|
1100
1087
|
}
|
|
1101
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1088
|
+
) : /* @__PURE__ */ n.createElement(Te, { $theme: D }, N) : c ? h != null && h.ErrorComponent ? /* @__PURE__ */ n.createElement(
|
|
1102
1089
|
h.ErrorComponent,
|
|
1103
1090
|
{
|
|
1104
1091
|
error: c,
|
|
1105
1092
|
theme: D
|
|
1106
1093
|
}
|
|
1107
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1094
|
+
) : /* @__PURE__ */ n.createElement(Re, { $theme: D }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)) : A());
|
|
1108
1095
|
};
|
|
1109
1096
|
/**
|
|
1110
1097
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -1112,14 +1099,14 @@ const Pe = {
|
|
|
1112
1099
|
* This source code is licensed under the ISC license.
|
|
1113
1100
|
* See the LICENSE file in the root directory of this source tree.
|
|
1114
1101
|
*/
|
|
1115
|
-
const
|
|
1102
|
+
const Xe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
|
|
1116
1103
|
/**
|
|
1117
1104
|
* @license lucide-react v0.456.0 - ISC
|
|
1118
1105
|
*
|
|
1119
1106
|
* This source code is licensed under the ISC license.
|
|
1120
1107
|
* See the LICENSE file in the root directory of this source tree.
|
|
1121
1108
|
*/
|
|
1122
|
-
var
|
|
1109
|
+
var qe = {
|
|
1123
1110
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1124
1111
|
width: 24,
|
|
1125
1112
|
height: 24,
|
|
@@ -1136,7 +1123,7 @@ var Ge = {
|
|
|
1136
1123
|
* This source code is licensed under the ISC license.
|
|
1137
1124
|
* See the LICENSE file in the root directory of this source tree.
|
|
1138
1125
|
*/
|
|
1139
|
-
const
|
|
1126
|
+
const Ue = Ce(
|
|
1140
1127
|
({
|
|
1141
1128
|
color: e = "currentColor",
|
|
1142
1129
|
size: t = 24,
|
|
@@ -1150,7 +1137,7 @@ const Ve = Ce(
|
|
|
1150
1137
|
"svg",
|
|
1151
1138
|
{
|
|
1152
1139
|
ref: g,
|
|
1153
|
-
...
|
|
1140
|
+
...qe,
|
|
1154
1141
|
width: t,
|
|
1155
1142
|
height: t,
|
|
1156
1143
|
stroke: e,
|
|
@@ -1159,7 +1146,7 @@ const Ve = Ce(
|
|
|
1159
1146
|
...f
|
|
1160
1147
|
},
|
|
1161
1148
|
[
|
|
1162
|
-
...p.map(([h,
|
|
1149
|
+
...p.map(([h, v]) => he(h, v)),
|
|
1163
1150
|
...Array.isArray(d) ? d : [d]
|
|
1164
1151
|
]
|
|
1165
1152
|
)
|
|
@@ -1172,10 +1159,10 @@ const Ve = Ce(
|
|
|
1172
1159
|
*/
|
|
1173
1160
|
const ue = (e, t) => {
|
|
1174
1161
|
const o = Ce(
|
|
1175
|
-
({ className: u, ...r }, d) => he(
|
|
1162
|
+
({ className: u, ...r }, d) => he(Ue, {
|
|
1176
1163
|
ref: d,
|
|
1177
1164
|
iconNode: t,
|
|
1178
|
-
className: ye(`lucide-${
|
|
1165
|
+
className: ye(`lucide-${Xe(e)}`, u),
|
|
1179
1166
|
...r
|
|
1180
1167
|
})
|
|
1181
1168
|
);
|
|
@@ -1187,7 +1174,7 @@ const ue = (e, t) => {
|
|
|
1187
1174
|
* This source code is licensed under the ISC license.
|
|
1188
1175
|
* See the LICENSE file in the root directory of this source tree.
|
|
1189
1176
|
*/
|
|
1190
|
-
const
|
|
1177
|
+
const Ye = ue("ChevronLeft", [
|
|
1191
1178
|
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
1192
1179
|
]);
|
|
1193
1180
|
/**
|
|
@@ -1196,7 +1183,7 @@ const Je = ue("ChevronLeft", [
|
|
|
1196
1183
|
* This source code is licensed under the ISC license.
|
|
1197
1184
|
* See the LICENSE file in the root directory of this source tree.
|
|
1198
1185
|
*/
|
|
1199
|
-
const
|
|
1186
|
+
const Ge = ue("ChevronRight", [
|
|
1200
1187
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
1201
1188
|
]);
|
|
1202
1189
|
/**
|
|
@@ -1205,7 +1192,7 @@ const Ke = ue("ChevronRight", [
|
|
|
1205
1192
|
* This source code is licensed under the ISC license.
|
|
1206
1193
|
* See the LICENSE file in the root directory of this source tree.
|
|
1207
1194
|
*/
|
|
1208
|
-
const
|
|
1195
|
+
const Ve = ue("Download", [
|
|
1209
1196
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
1210
1197
|
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
1211
1198
|
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
@@ -1216,7 +1203,7 @@ const Qe = ue("Download", [
|
|
|
1216
1203
|
* This source code is licensed under the ISC license.
|
|
1217
1204
|
* See the LICENSE file in the root directory of this source tree.
|
|
1218
1205
|
*/
|
|
1219
|
-
const
|
|
1206
|
+
const Je = ue("Pencil", [
|
|
1220
1207
|
[
|
|
1221
1208
|
"path",
|
|
1222
1209
|
{
|
|
@@ -1232,7 +1219,7 @@ const et = ue("Pencil", [
|
|
|
1232
1219
|
* This source code is licensed under the ISC license.
|
|
1233
1220
|
* See the LICENSE file in the root directory of this source tree.
|
|
1234
1221
|
*/
|
|
1235
|
-
const
|
|
1222
|
+
const Ke = ue("RotateCcw", [
|
|
1236
1223
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
1237
1224
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
1238
1225
|
]);
|
|
@@ -1242,7 +1229,7 @@ const tt = ue("RotateCcw", [
|
|
|
1242
1229
|
* This source code is licensed under the ISC license.
|
|
1243
1230
|
* See the LICENSE file in the root directory of this source tree.
|
|
1244
1231
|
*/
|
|
1245
|
-
const
|
|
1232
|
+
const Qe = ue("RotateCw", [
|
|
1246
1233
|
["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
|
|
1247
1234
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }]
|
|
1248
1235
|
]);
|
|
@@ -1252,7 +1239,7 @@ const ot = ue("RotateCw", [
|
|
|
1252
1239
|
* This source code is licensed under the ISC license.
|
|
1253
1240
|
* See the LICENSE file in the root directory of this source tree.
|
|
1254
1241
|
*/
|
|
1255
|
-
const
|
|
1242
|
+
const et = ue("X", [
|
|
1256
1243
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
1257
1244
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
1258
1245
|
]);
|
|
@@ -1262,7 +1249,7 @@ const nt = ue("X", [
|
|
|
1262
1249
|
* This source code is licensed under the ISC license.
|
|
1263
1250
|
* See the LICENSE file in the root directory of this source tree.
|
|
1264
1251
|
*/
|
|
1265
|
-
const
|
|
1252
|
+
const tt = ue("ZoomIn", [
|
|
1266
1253
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1267
1254
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1268
1255
|
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
|
@@ -1274,11 +1261,11 @@ const ut = ue("ZoomIn", [
|
|
|
1274
1261
|
* This source code is licensed under the ISC license.
|
|
1275
1262
|
* See the LICENSE file in the root directory of this source tree.
|
|
1276
1263
|
*/
|
|
1277
|
-
const
|
|
1264
|
+
const ot = ue("ZoomOut", [
|
|
1278
1265
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1279
1266
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1280
1267
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
1281
|
-
]),
|
|
1268
|
+
]), nt = G.div`
|
|
1282
1269
|
display: flex;
|
|
1283
1270
|
align-items: center;
|
|
1284
1271
|
padding: 0px 12px;
|
|
@@ -1287,24 +1274,24 @@ const rt = ue("ZoomOut", [
|
|
|
1287
1274
|
border-bottom: 1px solid ${(e) => e.$theme.colors.border};
|
|
1288
1275
|
background: ${(e) => e.$theme.colors.background};
|
|
1289
1276
|
min-height: 52px;
|
|
1290
|
-
`,
|
|
1277
|
+
`, ut = G.div`
|
|
1291
1278
|
display: flex;
|
|
1292
1279
|
align-items: center;
|
|
1293
1280
|
gap: 8px;
|
|
1294
1281
|
flex: 1;
|
|
1295
1282
|
min-width: 0;
|
|
1296
|
-
`,
|
|
1283
|
+
`, rt = G.div`
|
|
1297
1284
|
font-size: 14px;
|
|
1298
1285
|
font-weight: 500;
|
|
1299
1286
|
color: ${(e) => e.$theme.colors.text};
|
|
1300
1287
|
white-space: nowrap;
|
|
1301
1288
|
overflow: hidden;
|
|
1302
1289
|
text-overflow: ellipsis;
|
|
1303
|
-
`,
|
|
1290
|
+
`, lt = G.div`
|
|
1304
1291
|
font-size: 12px;
|
|
1305
1292
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1306
1293
|
white-space: nowrap;
|
|
1307
|
-
`,
|
|
1294
|
+
`, st = G.div`
|
|
1308
1295
|
display: flex;
|
|
1309
1296
|
align-items: center;
|
|
1310
1297
|
gap: 4px;
|
|
@@ -1336,12 +1323,12 @@ const rt = ue("ZoomOut", [
|
|
|
1336
1323
|
opacity: 0.5;
|
|
1337
1324
|
cursor: not-allowed;
|
|
1338
1325
|
}
|
|
1339
|
-
`,
|
|
1326
|
+
`, it = G.div`
|
|
1340
1327
|
font-size: 12px;
|
|
1341
1328
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1342
1329
|
min-width: 40px;
|
|
1343
1330
|
text-align: center;
|
|
1344
|
-
`,
|
|
1331
|
+
`, at = {
|
|
1345
1332
|
colors: {
|
|
1346
1333
|
primary: "#007bff",
|
|
1347
1334
|
secondary: "#6c757d",
|
|
@@ -1383,16 +1370,16 @@ const rt = ue("ZoomOut", [
|
|
|
1383
1370
|
onZoomIn: f,
|
|
1384
1371
|
onZoomOut: g,
|
|
1385
1372
|
onAnnotationToggle: h,
|
|
1386
|
-
onDownload:
|
|
1373
|
+
onDownload: v,
|
|
1387
1374
|
onRotateLeft: b,
|
|
1388
|
-
onRotateRight:
|
|
1375
|
+
onRotateRight: w,
|
|
1389
1376
|
onClose: B,
|
|
1390
|
-
scale:
|
|
1377
|
+
scale: a = 1,
|
|
1391
1378
|
isAnnotating: l = !1,
|
|
1392
1379
|
className: D
|
|
1393
1380
|
}) => {
|
|
1394
|
-
const C = (r == null ? void 0 : r.theme) ||
|
|
1395
|
-
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(
|
|
1381
|
+
const C = (r == null ? void 0 : r.theme) || at;
|
|
1382
|
+
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(nt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(ut, { $theme: C }, /* @__PURE__ */ n.createElement(rt, { $theme: C }, e)), /* @__PURE__ */ n.createElement(st, { $theme: C }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1396
1383
|
ne,
|
|
1397
1384
|
{
|
|
1398
1385
|
$theme: C,
|
|
@@ -1400,8 +1387,8 @@ const rt = ue("ZoomOut", [
|
|
|
1400
1387
|
disabled: t <= 1,
|
|
1401
1388
|
title: "\u4E0A\u4E00\u9875"
|
|
1402
1389
|
},
|
|
1403
|
-
/* @__PURE__ */ n.createElement(
|
|
1404
|
-
), o > 0 && /* @__PURE__ */ n.createElement(
|
|
1390
|
+
/* @__PURE__ */ n.createElement(Ye, { size: 16 })
|
|
1391
|
+
), o > 0 && /* @__PURE__ */ n.createElement(lt, { $theme: C }, t, " / ", o), /* @__PURE__ */ n.createElement(
|
|
1405
1392
|
ne,
|
|
1406
1393
|
{
|
|
1407
1394
|
$theme: C,
|
|
@@ -1409,25 +1396,25 @@ const rt = ue("ZoomOut", [
|
|
|
1409
1396
|
disabled: !o || t >= o,
|
|
1410
1397
|
title: "\u4E0B\u4E00\u9875"
|
|
1411
1398
|
},
|
|
1412
|
-
/* @__PURE__ */ n.createElement(
|
|
1399
|
+
/* @__PURE__ */ n.createElement(Ge, { size: 16 })
|
|
1413
1400
|
)), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1414
1401
|
ne,
|
|
1415
1402
|
{
|
|
1416
1403
|
$theme: C,
|
|
1417
1404
|
onClick: g,
|
|
1418
|
-
disabled:
|
|
1405
|
+
disabled: a <= 0.3,
|
|
1419
1406
|
title: "\u7F29\u5C0F"
|
|
1420
1407
|
},
|
|
1421
|
-
/* @__PURE__ */ n.createElement(
|
|
1422
|
-
), /* @__PURE__ */ n.createElement(
|
|
1408
|
+
/* @__PURE__ */ n.createElement(ot, { size: 16 })
|
|
1409
|
+
), /* @__PURE__ */ n.createElement(it, { $theme: C }, Math.round(a * 100), "%"), /* @__PURE__ */ n.createElement(
|
|
1423
1410
|
ne,
|
|
1424
1411
|
{
|
|
1425
1412
|
$theme: C,
|
|
1426
1413
|
onClick: f,
|
|
1427
|
-
disabled:
|
|
1414
|
+
disabled: a >= 3,
|
|
1428
1415
|
title: "\u653E\u5927"
|
|
1429
1416
|
},
|
|
1430
|
-
/* @__PURE__ */ n.createElement(
|
|
1417
|
+
/* @__PURE__ */ n.createElement(tt, { size: 16 })
|
|
1431
1418
|
)), u.annotation && /* @__PURE__ */ n.createElement(
|
|
1432
1419
|
ne,
|
|
1433
1420
|
{
|
|
@@ -1436,15 +1423,15 @@ const rt = ue("ZoomOut", [
|
|
|
1436
1423
|
onClick: h,
|
|
1437
1424
|
title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
|
|
1438
1425
|
},
|
|
1439
|
-
/* @__PURE__ */ n.createElement(
|
|
1426
|
+
/* @__PURE__ */ n.createElement(Je, { size: 16 })
|
|
1440
1427
|
), u.download && /* @__PURE__ */ n.createElement(
|
|
1441
1428
|
ne,
|
|
1442
1429
|
{
|
|
1443
1430
|
$theme: C,
|
|
1444
|
-
onClick:
|
|
1431
|
+
onClick: v,
|
|
1445
1432
|
title: "\u4E0B\u8F7D"
|
|
1446
1433
|
},
|
|
1447
|
-
/* @__PURE__ */ n.createElement(
|
|
1434
|
+
/* @__PURE__ */ n.createElement(Ve, { size: 16 })
|
|
1448
1435
|
), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1449
1436
|
ne,
|
|
1450
1437
|
{
|
|
@@ -1452,15 +1439,15 @@ const rt = ue("ZoomOut", [
|
|
|
1452
1439
|
onClick: b,
|
|
1453
1440
|
title: "\u5411\u5DE6\u65CB\u8F6C"
|
|
1454
1441
|
},
|
|
1455
|
-
/* @__PURE__ */ n.createElement(
|
|
1442
|
+
/* @__PURE__ */ n.createElement(Ke, { size: 16 })
|
|
1456
1443
|
), /* @__PURE__ */ n.createElement(
|
|
1457
1444
|
ne,
|
|
1458
1445
|
{
|
|
1459
1446
|
$theme: C,
|
|
1460
|
-
onClick:
|
|
1447
|
+
onClick: w,
|
|
1461
1448
|
title: "\u5411\u53F3\u65CB\u8F6C"
|
|
1462
1449
|
},
|
|
1463
|
-
/* @__PURE__ */ n.createElement(
|
|
1450
|
+
/* @__PURE__ */ n.createElement(Qe, { size: 16 })
|
|
1464
1451
|
)), u.close && /* @__PURE__ */ n.createElement(
|
|
1465
1452
|
ne,
|
|
1466
1453
|
{
|
|
@@ -1468,27 +1455,26 @@ const rt = ue("ZoomOut", [
|
|
|
1468
1455
|
onClick: B,
|
|
1469
1456
|
title: "\u5173\u95ED"
|
|
1470
1457
|
},
|
|
1471
|
-
/* @__PURE__ */ n.createElement(
|
|
1458
|
+
/* @__PURE__ */ n.createElement(et, { size: 16 })
|
|
1472
1459
|
)));
|
|
1473
|
-
}),
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
return;
|
|
1478
|
-
}
|
|
1479
|
-
const e = "/worker/pdf.worker.min.js";
|
|
1480
|
-
De(e), console.log("PDF Worker \u5DF2\u901A\u8FC7\u7EDF\u4E00\u51FD\u6570\u6CE8\u518C:", e);
|
|
1481
|
-
} catch (e) {
|
|
1482
|
-
throw console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:", e), e;
|
|
1460
|
+
}), ct = () => {
|
|
1461
|
+
if (Ct()) {
|
|
1462
|
+
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
|
|
1463
|
+
return;
|
|
1483
1464
|
}
|
|
1465
|
+
const e = `PDF Worker \u672A\u6CE8\u518C\u3002\u8BF7\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker\u3002
|
|
1466
|
+
\u793A\u4F8B\uFF1Aimport { registerPDFWorker } from "@mxmweb/fviewer";
|
|
1467
|
+
registerPDFWorker("/worker/pdf.worker.min.js");
|
|
1468
|
+
\u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;
|
|
1469
|
+
throw console.error(e), new Error(e);
|
|
1484
1470
|
}, be = (e, t, o) => {
|
|
1485
1471
|
if (!e && !t && !o) return "unknown";
|
|
1486
1472
|
const u = e || "", r = t || "";
|
|
1487
1473
|
return u.toLowerCase().endsWith(".pdf") || r === "pdf" || (o == null ? void 0 : o.type) === "pdf" ? "pdf" : u.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || r === "image" || (o == null ? void 0 : o.type) === "image" ? "image" : u.toLowerCase().endsWith(".md") || r === "markdown" || (o == null ? void 0 : o.type) === "markdown" ? r === "markdown_table" || (o == null ? void 0 : o.type) === "markdown_table" ? "markdown_table" : "markdown" : u.toLowerCase().match(/\.(html|htm)$/) || r === "html" || (o == null ? void 0 : o.type) === "html" ? "html" : u.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || r === "text" || (o == null ? void 0 : o.type) === "text" ? "text" : "unknown";
|
|
1488
|
-
},
|
|
1474
|
+
}, dt = async (e, t = {}) => {
|
|
1489
1475
|
console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1490
1476
|
try {
|
|
1491
|
-
|
|
1477
|
+
ct();
|
|
1492
1478
|
let o;
|
|
1493
1479
|
if (typeof e == "string") {
|
|
1494
1480
|
console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
|
|
@@ -1527,7 +1513,7 @@ const rt = ue("ZoomOut", [
|
|
|
1527
1513
|
options: t
|
|
1528
1514
|
});
|
|
1529
1515
|
let u = "PDF\u89E3\u6790\u5931\u8D25";
|
|
1530
|
-
return o instanceof Error && (o.message.includes("Invalid PDF structure") ? u = "PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6" : o.message.includes("Failed to fetch") ? u = "PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL" : o.message.includes("Worker") ? u = "PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\
|
|
1516
|
+
return o instanceof Error && (o.message.includes("PDF Worker \u672A\u6CE8\u518C") || o.message.includes("Worker \u672A\u6CE8\u518C") ? u = o.message : o.message.includes("Invalid PDF structure") ? u = "PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6" : o.message.includes("Failed to fetch") ? u = "PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL" : o.message.includes("Worker") || o.message.includes("worker") ? u = "PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\u3002\u8BF7\u786E\u4FDD\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker \u6587\u4EF6\u3002" : u = `PDF\u89E3\u6790\u5931\u8D25: ${o.message}`), {
|
|
1531
1517
|
type: "pdf",
|
|
1532
1518
|
content: null,
|
|
1533
1519
|
fileName: t.fileName,
|
|
@@ -1535,7 +1521,7 @@ const rt = ue("ZoomOut", [
|
|
|
1535
1521
|
error: u
|
|
1536
1522
|
};
|
|
1537
1523
|
}
|
|
1538
|
-
},
|
|
1524
|
+
}, mt = async (e, t = {}) => {
|
|
1539
1525
|
console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1540
1526
|
try {
|
|
1541
1527
|
let o;
|
|
@@ -1581,7 +1567,7 @@ const rt = ue("ZoomOut", [
|
|
|
1581
1567
|
error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1582
1568
|
};
|
|
1583
1569
|
}
|
|
1584
|
-
},
|
|
1570
|
+
}, gt = async (e, t = {}) => {
|
|
1585
1571
|
try {
|
|
1586
1572
|
let o;
|
|
1587
1573
|
if (typeof e == "string") {
|
|
@@ -1611,7 +1597,7 @@ const rt = ue("ZoomOut", [
|
|
|
1611
1597
|
error: `\u6587\u672C\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1612
1598
|
};
|
|
1613
1599
|
}
|
|
1614
|
-
},
|
|
1600
|
+
}, ft = async (e, t = {}) => {
|
|
1615
1601
|
try {
|
|
1616
1602
|
let o;
|
|
1617
1603
|
if (typeof e == "string") {
|
|
@@ -1641,7 +1627,7 @@ const rt = ue("ZoomOut", [
|
|
|
1641
1627
|
error: `Markdown\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1642
1628
|
};
|
|
1643
1629
|
}
|
|
1644
|
-
},
|
|
1630
|
+
}, Et = async (e, t = {}) => {
|
|
1645
1631
|
console.log("=== parseHtmlFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1646
1632
|
try {
|
|
1647
1633
|
let o;
|
|
@@ -1674,19 +1660,19 @@ const rt = ue("ZoomOut", [
|
|
|
1674
1660
|
error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1675
1661
|
};
|
|
1676
1662
|
}
|
|
1677
|
-
},
|
|
1663
|
+
}, ht = async (e, t = {}) => {
|
|
1678
1664
|
switch (be(t.fileName, t.fileType)) {
|
|
1679
1665
|
case "pdf":
|
|
1680
|
-
return await
|
|
1666
|
+
return await dt(e, t);
|
|
1681
1667
|
case "image":
|
|
1682
|
-
return await
|
|
1668
|
+
return await mt(e, t);
|
|
1683
1669
|
case "text":
|
|
1684
|
-
return await
|
|
1670
|
+
return await gt(e, t);
|
|
1685
1671
|
case "markdown":
|
|
1686
1672
|
case "markdown_table":
|
|
1687
|
-
return await
|
|
1673
|
+
return await ft(e, t);
|
|
1688
1674
|
case "html":
|
|
1689
|
-
return await
|
|
1675
|
+
return await Et(e, t);
|
|
1690
1676
|
default:
|
|
1691
1677
|
return {
|
|
1692
1678
|
type: "unknown",
|
|
@@ -1706,7 +1692,7 @@ const rt = ue("ZoomOut", [
|
|
|
1706
1692
|
border-radius: ${(e) => e.$theme.space.radius};
|
|
1707
1693
|
overflow: hidden;
|
|
1708
1694
|
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
1709
|
-
`,
|
|
1695
|
+
`, Ft = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1710
1696
|
display: "flex",
|
|
1711
1697
|
flexDirection: "column",
|
|
1712
1698
|
alignItems: "center",
|
|
@@ -1805,7 +1791,7 @@ const pe = G.div`
|
|
|
1805
1791
|
color: ${(e) => e.$theme.colors.error};
|
|
1806
1792
|
text-align: center;
|
|
1807
1793
|
padding: 20px;
|
|
1808
|
-
`,
|
|
1794
|
+
`, pt = {
|
|
1809
1795
|
colors: {
|
|
1810
1796
|
primary: "#007bff",
|
|
1811
1797
|
secondary: "#6c757d",
|
|
@@ -1829,7 +1815,7 @@ const pe = G.div`
|
|
|
1829
1815
|
shadow: "md",
|
|
1830
1816
|
lineHeight: "md"
|
|
1831
1817
|
}
|
|
1832
|
-
},
|
|
1818
|
+
}, bt = ({
|
|
1833
1819
|
fileUrl: e,
|
|
1834
1820
|
fileType: t,
|
|
1835
1821
|
annotations: o,
|
|
@@ -1847,17 +1833,17 @@ const pe = G.div`
|
|
|
1847
1833
|
close: !0,
|
|
1848
1834
|
navigation: !0
|
|
1849
1835
|
},
|
|
1850
|
-
customComponents:
|
|
1836
|
+
customComponents: v,
|
|
1851
1837
|
className: b,
|
|
1852
|
-
headerClass:
|
|
1838
|
+
headerClass: w,
|
|
1853
1839
|
contentClass: B
|
|
1854
1840
|
}) => {
|
|
1855
|
-
var
|
|
1856
|
-
const l = (g == null ? void 0 : g.theme) ||
|
|
1857
|
-
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0),
|
|
1841
|
+
var a;
|
|
1842
|
+
const l = (g == null ? void 0 : g.theme) || pt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [F, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J, s] = R(!1), i = $(() => {
|
|
1843
|
+
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0), s(!1);
|
|
1858
1844
|
}, [d]), y = $(async () => {
|
|
1859
1845
|
var E, z;
|
|
1860
|
-
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }),
|
|
1846
|
+
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), i(), p) {
|
|
1861
1847
|
C(!1), x(null), k({
|
|
1862
1848
|
type: p.fileType || t || "text",
|
|
1863
1849
|
content: p.content,
|
|
@@ -1875,7 +1861,7 @@ const pe = G.div`
|
|
|
1875
1861
|
C(!0), x(null);
|
|
1876
1862
|
const Y = be(u, t);
|
|
1877
1863
|
N(Y === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : Y === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : Y === "markdown" || Y === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
|
|
1878
|
-
const S = await
|
|
1864
|
+
const S = await ht(e, {
|
|
1879
1865
|
fileName: u,
|
|
1880
1866
|
fileType: t,
|
|
1881
1867
|
token: r
|
|
@@ -1886,7 +1872,7 @@ const pe = G.div`
|
|
|
1886
1872
|
} finally {
|
|
1887
1873
|
C(!1);
|
|
1888
1874
|
}
|
|
1889
|
-
}, [e, u, t, r, p,
|
|
1875
|
+
}, [e, u, t, r, p, i]);
|
|
1890
1876
|
te(() => {
|
|
1891
1877
|
y();
|
|
1892
1878
|
}, [y]);
|
|
@@ -1922,7 +1908,7 @@ const pe = G.div`
|
|
|
1922
1908
|
}
|
|
1923
1909
|
}, [O, F == null ? void 0 : F.totalPages, m]), U = $(() => {
|
|
1924
1910
|
const E = !J;
|
|
1925
|
-
|
|
1911
|
+
s(E), m("annotation:toggle", { isAnnotating: E });
|
|
1926
1912
|
}, [J, m]), M = $(() => {
|
|
1927
1913
|
m("download:start", { fileUrl: e, fileName: u });
|
|
1928
1914
|
}, [m, e, u]), j = $(() => {
|
|
@@ -1977,16 +1963,16 @@ const pe = G.div`
|
|
|
1977
1963
|
onClose: oe,
|
|
1978
1964
|
scale: 1,
|
|
1979
1965
|
isAnnotating: !1,
|
|
1980
|
-
className:
|
|
1966
|
+
className: w
|
|
1981
1967
|
}
|
|
1982
|
-
),
|
|
1983
|
-
|
|
1968
|
+
), v != null && v.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1969
|
+
v.LoadingComponent,
|
|
1984
1970
|
{
|
|
1985
1971
|
status: q,
|
|
1986
1972
|
theme: l
|
|
1987
1973
|
}
|
|
1988
1974
|
) : /* @__PURE__ */ n.createElement(
|
|
1989
|
-
|
|
1975
|
+
Ft,
|
|
1990
1976
|
{
|
|
1991
1977
|
status: q,
|
|
1992
1978
|
theme: l
|
|
@@ -2021,7 +2007,7 @@ const pe = G.div`
|
|
|
2021
2007
|
onClose: oe,
|
|
2022
2008
|
scale: 1,
|
|
2023
2009
|
isAnnotating: !1,
|
|
2024
|
-
className:
|
|
2010
|
+
className: w
|
|
2025
2011
|
}
|
|
2026
2012
|
), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)));
|
|
2027
2013
|
}
|
|
@@ -2053,7 +2039,7 @@ const pe = G.div`
|
|
|
2053
2039
|
onClose: oe,
|
|
2054
2040
|
scale: 1,
|
|
2055
2041
|
isAnnotating: !1,
|
|
2056
|
-
className:
|
|
2042
|
+
className: w
|
|
2057
2043
|
}
|
|
2058
2044
|
), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
|
|
2059
2045
|
}
|
|
@@ -2063,7 +2049,7 @@ const pe = G.div`
|
|
|
2063
2049
|
...(F.fileType || t) && { fileType: F.fileType || t },
|
|
2064
2050
|
...F.totalPages && { totalPages: F.totalPages }
|
|
2065
2051
|
}, W = Q(F.type, h);
|
|
2066
|
-
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", H), console.log("viewerData.content:", H.content), console.log("viewerData.content.document:", (
|
|
2052
|
+
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", H), console.log("viewerData.content:", H.content), console.log("viewerData.content.document:", (a = H.content) == null ? void 0 : a.document), console.log("\u6587\u4EF6\u7C7B\u578B:", F.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", W), console.log("=== \u6807\u6CE8\u6570\u636E\u4F20\u9012 ==="), console.log("annotations prop:", o), console.log("annotations \u957F\u5EA6:", (o == null ? void 0 : o.length) || 0), /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
2067
2053
|
ce,
|
|
2068
2054
|
{
|
|
2069
2055
|
fileName: H.fileName || F.fileName || u || "\u672A\u77E5\u6587\u4EF6",
|
|
@@ -2090,10 +2076,10 @@ const pe = G.div`
|
|
|
2090
2076
|
onClose: oe,
|
|
2091
2077
|
scale: A,
|
|
2092
2078
|
isAnnotating: J,
|
|
2093
|
-
className:
|
|
2079
|
+
className: w
|
|
2094
2080
|
}
|
|
2095
2081
|
), /* @__PURE__ */ n.createElement(
|
|
2096
|
-
|
|
2082
|
+
Ze,
|
|
2097
2083
|
{
|
|
2098
2084
|
data: H,
|
|
2099
2085
|
annotationData: o || [],
|
|
@@ -2107,7 +2093,7 @@ const pe = G.div`
|
|
|
2107
2093
|
className: B
|
|
2108
2094
|
}
|
|
2109
2095
|
));
|
|
2110
|
-
},
|
|
2096
|
+
}, Ct = () => !!re.GlobalWorkerOptions.workerSrc, xt = () => re.GlobalWorkerOptions.workerSrc, Dt = (e = "/worker/pdf.worker.min.js") => {
|
|
2111
2097
|
try {
|
|
2112
2098
|
if (re.GlobalWorkerOptions.workerSrc) {
|
|
2113
2099
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
|
|
@@ -2119,16 +2105,16 @@ const pe = G.div`
|
|
|
2119
2105
|
}
|
|
2120
2106
|
};
|
|
2121
2107
|
export {
|
|
2122
|
-
|
|
2123
|
-
|
|
2108
|
+
Ze as Fviewer,
|
|
2109
|
+
bt as StaticFileReader,
|
|
2124
2110
|
be as detectFileType,
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2111
|
+
xt as getPDFWorkerPath,
|
|
2112
|
+
Ct as isPDFWorkerRegistered,
|
|
2113
|
+
ht as parseFile,
|
|
2114
|
+
mt as parseImageFile,
|
|
2115
|
+
ft as parseMarkdownFile,
|
|
2116
|
+
dt as parsePdfFile,
|
|
2117
|
+
gt as parseTextFile,
|
|
2118
|
+
Dt as registerPDFWorker
|
|
2133
2119
|
};
|
|
2134
2120
|
//# sourceMappingURL=index.js.map
|