@mxmweb/fviewer 1.5.2 → 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 +302 -315
- 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
|
-
import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as
|
|
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 De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
|
|
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,48 +11,48 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
11
11
|
onAnnotationDelete: d,
|
|
12
12
|
readOnly: p = !1
|
|
13
13
|
}) => {
|
|
14
|
-
const f = X(null), [g,
|
|
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
|
-
const x = f.current.getBoundingClientRect(),
|
|
18
|
-
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: c.clientX, clientY: c.clientY, rect: x, x:
|
|
17
|
+
const x = f.current.getBoundingClientRect(), F = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
|
|
18
|
+
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: c.clientX, clientY: c.clientY, rect: x, x: F, y: k, scale: t }), h(!0), b({ x: F, y: k });
|
|
19
19
|
},
|
|
20
20
|
[o, t]
|
|
21
21
|
), C = $(
|
|
22
22
|
(c) => {
|
|
23
23
|
if (!g || !f.current) return;
|
|
24
|
-
const x = f.current.getBoundingClientRect(),
|
|
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(
|
|
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 (
|
|
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,
|
|
47
|
+
}, [g, w, e, r]), N = $((c) => {
|
|
48
48
|
l(a === c ? null : c);
|
|
49
49
|
}, [a]);
|
|
50
50
|
return $((c, x) => {
|
|
51
|
-
const
|
|
51
|
+
const F = {
|
|
52
52
|
...c,
|
|
53
53
|
content: x
|
|
54
54
|
};
|
|
55
|
-
r == null || r(
|
|
55
|
+
r == null || r(F);
|
|
56
56
|
}, [r]), $((c) => {
|
|
57
57
|
d == null || d(c), l(null);
|
|
58
58
|
}, [d]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
|
|
@@ -79,15 +79,15 @@ const De = "#FFEB3B", Be = () => `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 De = "#FFEB3B", Be = () => `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:", vt());
|
|
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"), yt(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
|
-
Ae();
|
|
133
|
-
const $e = {
|
|
120
|
+
}, ke = {
|
|
134
121
|
colors: {
|
|
135
122
|
primary: "#007bff",
|
|
136
123
|
secondary: "#6c757d",
|
|
@@ -154,14 +141,14 @@ const $e = {
|
|
|
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 $e = {
|
|
|
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,
|
|
@@ -180,24 +167,24 @@ const $e = {
|
|
|
180
167
|
isSlidesMode: p = !1,
|
|
181
168
|
onPageChange: f,
|
|
182
169
|
onScaleChange: g,
|
|
183
|
-
onAnnotationChange:
|
|
184
|
-
onAnnotationDelete:
|
|
170
|
+
onAnnotationChange: h,
|
|
171
|
+
onAnnotationDelete: v,
|
|
185
172
|
styles: b
|
|
186
173
|
}) => {
|
|
187
|
-
const [
|
|
188
|
-
if (!A.current || !
|
|
189
|
-
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) => {
|
|
175
|
+
if (!A.current || !F || !g) return null;
|
|
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,
|
|
198
185
|
finalScale: Z
|
|
199
186
|
}), Z;
|
|
200
|
-
}, [
|
|
187
|
+
}, [F, g]), J = $(async () => {
|
|
201
188
|
if (!(!e || !L.current)) {
|
|
202
189
|
if (P.current || V.current === t) {
|
|
203
190
|
console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
|
|
@@ -205,21 +192,21 @@ const $e = {
|
|
|
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),
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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
|
-
onAnnotationAdd:
|
|
277
|
-
onAnnotationDelete:
|
|
263
|
+
onAnnotationAdd: h,
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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,27 +399,27 @@ const $e = {
|
|
|
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
|
-
},
|
|
421
|
-
var u, r, d, p, f, g,
|
|
407
|
+
}, Se = (e, t, o = !1) => {
|
|
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
|
-
pdfDocument: ((
|
|
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,
|
|
@@ -456,12 +443,12 @@ const $e = {
|
|
|
456
443
|
styles: t.styles
|
|
457
444
|
}
|
|
458
445
|
);
|
|
459
|
-
},
|
|
460
|
-
var o, u, r, d, p, f, g,
|
|
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);
|
|
464
|
-
},
|
|
451
|
+
}, F = () => {
|
|
465
452
|
console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", D), q(!1), c(!0);
|
|
466
453
|
};
|
|
467
454
|
return /* @__PURE__ */ n.createElement("div", { style: {
|
|
@@ -488,12 +475,12 @@ const $e = {
|
|
|
488
475
|
width: "32px",
|
|
489
476
|
height: "32px",
|
|
490
477
|
border: `3px solid ${((p = (d = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : d.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
|
|
491
|
-
borderTop: `3px solid ${((
|
|
478
|
+
borderTop: `3px solid ${((h = (g = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : g.colors) == null ? void 0 : h.primary) || "#007bff"}`,
|
|
492
479
|
borderRadius: "50%",
|
|
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%",
|
|
@@ -513,7 +500,7 @@ const $e = {
|
|
|
513
500
|
src: D,
|
|
514
501
|
alt: e.fileName || "\u56FE\u7247",
|
|
515
502
|
onLoad: x,
|
|
516
|
-
onError:
|
|
503
|
+
onError: F,
|
|
517
504
|
style: {
|
|
518
505
|
maxWidth: "100%",
|
|
519
506
|
maxHeight: "100%",
|
|
@@ -529,20 +516,20 @@ const $e = {
|
|
|
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 = "";
|
|
536
523
|
typeof e.content == "string" ? f = e.content : (o = e.content) != null && o.text ? f = e.content.text : (u = e.content) != null && u.content && (f = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", f);
|
|
537
|
-
const g = X(null),
|
|
524
|
+
const g = X(null), h = X(null);
|
|
538
525
|
return te(() => {
|
|
539
|
-
if (g.current &&
|
|
540
|
-
const
|
|
526
|
+
if (g.current && h.current && f) {
|
|
527
|
+
const v = setTimeout(() => {
|
|
541
528
|
var b;
|
|
542
|
-
const
|
|
543
|
-
|
|
529
|
+
const w = ((b = g.current) == null ? void 0 : b.scrollHeight) || 0, B = Math.max(w + 80, 200);
|
|
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%",
|
|
@@ -556,7 +543,7 @@ const $e = {
|
|
|
556
543
|
} }, /* @__PURE__ */ n.createElement(
|
|
557
544
|
"div",
|
|
558
545
|
{
|
|
559
|
-
ref:
|
|
546
|
+
ref: h,
|
|
560
547
|
style: {
|
|
561
548
|
width: "100%",
|
|
562
549
|
maxWidth: "800px",
|
|
@@ -581,10 +568,10 @@ const $e = {
|
|
|
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 $e = {
|
|
|
617
604
|
borderTopRightRadius: "8px"
|
|
618
605
|
} })
|
|
619
606
|
));
|
|
620
|
-
},
|
|
621
|
-
var u, r, d, p, f, g,
|
|
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 s;
|
|
648
|
-
return (s = k.current) == null ? void 0 : s.call(k, i);
|
|
649
|
-
}, []), L = $(() => {
|
|
633
|
+
const O = n.useCallback((s) => {
|
|
650
634
|
var i;
|
|
635
|
+
return (i = k.current) == null ? void 0 : i.call(k, s);
|
|
636
|
+
}, []), L = $(() => {
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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
|
}
|
|
@@ -803,37 +790,37 @@ const $e = {
|
|
|
803
790
|
(H) => j < H.end && K > H.start
|
|
804
791
|
);
|
|
805
792
|
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
|
|
806
|
-
var E, z, Y, S, me,
|
|
807
|
-
const le = Math.max(0, j - W),
|
|
808
|
-
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd:
|
|
793
|
+
var E, z, Y, S, me, Fe;
|
|
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
|
-
|
|
801
|
+
const ie = document.createElement("span");
|
|
802
|
+
ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = fe;
|
|
816
803
|
const ae = document.createDocumentFragment();
|
|
817
|
-
ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(
|
|
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 $e = {
|
|
|
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 $e = {
|
|
|
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,27 +870,27 @@ const $e = {
|
|
|
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",
|
|
898
885
|
onScroll: o ? void 0 : c,
|
|
899
886
|
onScrollToTop: o ? void 0 : x,
|
|
900
|
-
onScrollToBottom: o ? void 0 :
|
|
887
|
+
onScrollToBottom: o ? void 0 : F,
|
|
901
888
|
onRendered: O,
|
|
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: ((a = (B = (
|
|
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,56 +903,56 @@ const $e = {
|
|
|
916
903
|
}
|
|
917
904
|
))
|
|
918
905
|
);
|
|
919
|
-
},
|
|
906
|
+
}, je = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
|
|
920
907
|
const u = X(null), r = (f) => {
|
|
921
908
|
const g = f.split(/\r?\n/).filter((a) => a.trim().length > 0);
|
|
922
|
-
let
|
|
909
|
+
let h = -1;
|
|
923
910
|
for (let a = 0; a < g.length - 1; a++) {
|
|
924
911
|
const l = g[a].trim(), D = g[a + 1].trim();
|
|
925
912
|
if (l.startsWith("|") && l.endsWith("|") && D.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
|
|
926
|
-
|
|
913
|
+
h = a;
|
|
927
914
|
break;
|
|
928
915
|
}
|
|
929
916
|
}
|
|
930
|
-
if (
|
|
931
|
-
const b = g[
|
|
932
|
-
for (let a =
|
|
917
|
+
if (h === -1) return null;
|
|
918
|
+
const b = g[h].split("|").slice(1, -1).map((a) => a.trim()), w = [];
|
|
919
|
+
for (let a = h + 2; a < g.length; a++) {
|
|
933
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(() => {
|
|
941
928
|
const f = () => {
|
|
942
929
|
try {
|
|
943
930
|
if (!u.current || !o.length) return;
|
|
944
|
-
const
|
|
945
|
-
if (!
|
|
946
|
-
o.forEach((
|
|
947
|
-
(
|
|
931
|
+
const h = u.current.querySelectorAll("table");
|
|
932
|
+
if (!h || h.length === 0) return;
|
|
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;
|
|
951
938
|
const x = C.tBodies && C.tBodies.length > 0 ? Array.from(C.tBodies[0].rows) : [];
|
|
952
|
-
let
|
|
939
|
+
let F;
|
|
953
940
|
if (x.length > 0)
|
|
954
|
-
|
|
941
|
+
F = x[l];
|
|
955
942
|
else {
|
|
956
943
|
const A = ((N = (q = C.tHead) == null ? void 0 : q.rows) == null ? void 0 : N.length) || 0;
|
|
957
|
-
|
|
944
|
+
F = Array.from(C.rows)[l + A];
|
|
958
945
|
}
|
|
959
|
-
if (!
|
|
960
|
-
const k = (c =
|
|
946
|
+
if (!F) return;
|
|
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
|
});
|
|
967
|
-
} catch (
|
|
968
|
-
console.warn("[MinimalMarkdownTable] apply annotations failed",
|
|
954
|
+
} catch (h) {
|
|
955
|
+
console.warn("[MinimalMarkdownTable] apply annotations failed", h);
|
|
969
956
|
}
|
|
970
957
|
}, g = requestAnimationFrame(() => {
|
|
971
958
|
f(), t && t();
|
|
@@ -983,8 +970,8 @@ const $e = {
|
|
|
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((
|
|
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 $e = {
|
|
|
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,
|
|
@@ -1030,27 +1017,27 @@ const $e = {
|
|
|
1030
1017
|
close: !0,
|
|
1031
1018
|
navigation: !0
|
|
1032
1019
|
},
|
|
1033
|
-
customComponents:
|
|
1034
|
-
className:
|
|
1020
|
+
customComponents: h,
|
|
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:", (
|
|
1040
|
-
const
|
|
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);
|
|
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 $e = {
|
|
|
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,45 +1053,45 @@ const $e = {
|
|
|
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(() => {
|
|
1083
|
-
const P =
|
|
1070
|
+
const P = F.current, V = k.current, ee = P !== e, J = V !== (e ? e.content : void 0);
|
|
1084
1071
|
console.log("[Fviewer useEffect:data] triggered", {
|
|
1085
1072
|
dataChanged: ee,
|
|
1086
1073
|
contentChanged: J,
|
|
1087
1074
|
hasData: !!e,
|
|
1088
1075
|
hasContent: !!(e != null && e.content),
|
|
1089
1076
|
isLoadingBefore: C
|
|
1090
|
-
}),
|
|
1077
|
+
}), F.current = e, k.current = e ? e.content : void 0;
|
|
1091
1078
|
}, [e == null ? void 0 : e.content]), n.useEffect(() => {
|
|
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(
|
|
1096
|
-
|
|
1082
|
+
}, [t, L]), /* @__PURE__ */ n.createElement(_e, { $theme: D, className: b }, C ? h != null && h.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1083
|
+
h.LoadingComponent,
|
|
1097
1084
|
{
|
|
1098
1085
|
status: N,
|
|
1099
1086
|
theme: D
|
|
1100
1087
|
}
|
|
1101
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1102
|
-
|
|
1088
|
+
) : /* @__PURE__ */ n.createElement(Te, { $theme: D }, N) : c ? h != null && h.ErrorComponent ? /* @__PURE__ */ n.createElement(
|
|
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 $e = {
|
|
|
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 Ye = {
|
|
|
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,
|
|
@@ -1146,11 +1133,11 @@ const Ge = Ce(
|
|
|
1146
1133
|
children: d,
|
|
1147
1134
|
iconNode: p,
|
|
1148
1135
|
...f
|
|
1149
|
-
}, g) =>
|
|
1136
|
+
}, g) => he(
|
|
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 Ge = Ce(
|
|
|
1159
1146
|
...f
|
|
1160
1147
|
},
|
|
1161
1148
|
[
|
|
1162
|
-
...p.map(([
|
|
1149
|
+
...p.map(([h, v]) => he(h, v)),
|
|
1163
1150
|
...Array.isArray(d) ? d : [d]
|
|
1164
1151
|
]
|
|
1165
1152
|
)
|
|
@@ -1172,10 +1159,10 @@ const Ge = Ce(
|
|
|
1172
1159
|
*/
|
|
1173
1160
|
const ue = (e, t) => {
|
|
1174
1161
|
const o = Ce(
|
|
1175
|
-
({ className: u, ...r }, d) =>
|
|
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 Ve = 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 Je = 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 Ke = 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 Qe = 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 et = 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 tt = 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 ot = 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 nt = 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 ut = 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 ut = 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",
|
|
@@ -1382,17 +1369,17 @@ const ut = ue("ZoomOut", [
|
|
|
1382
1369
|
onNextPage: p,
|
|
1383
1370
|
onZoomIn: f,
|
|
1384
1371
|
onZoomOut: g,
|
|
1385
|
-
onAnnotationToggle:
|
|
1386
|
-
onDownload:
|
|
1372
|
+
onAnnotationToggle: h,
|
|
1373
|
+
onDownload: v,
|
|
1387
1374
|
onRotateLeft: b,
|
|
1388
|
-
onRotateRight:
|
|
1375
|
+
onRotateRight: w,
|
|
1389
1376
|
onClose: B,
|
|
1390
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 ut = 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,7 +1396,7 @@ const ut = 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
|
{
|
|
@@ -1418,8 +1405,8 @@ const ut = ue("ZoomOut", [
|
|
|
1418
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,
|
|
@@ -1427,24 +1414,24 @@ const ut = ue("ZoomOut", [
|
|
|
1427
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
|
{
|
|
1434
1421
|
$theme: C,
|
|
1435
1422
|
$active: l,
|
|
1436
|
-
onClick:
|
|
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 ut = 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,10 +1455,10 @@ const ut = 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
|
-
if (
|
|
1460
|
+
}), ct = () => {
|
|
1461
|
+
if (Ct()) {
|
|
1475
1462
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
|
|
1476
1463
|
return;
|
|
1477
1464
|
}
|
|
@@ -1484,10 +1471,10 @@ const ut = ue("ZoomOut", [
|
|
|
1484
1471
|
if (!e && !t && !o) return "unknown";
|
|
1485
1472
|
const u = e || "", r = t || "";
|
|
1486
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";
|
|
1487
|
-
},
|
|
1474
|
+
}, dt = async (e, t = {}) => {
|
|
1488
1475
|
console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1489
1476
|
try {
|
|
1490
|
-
|
|
1477
|
+
ct();
|
|
1491
1478
|
let o;
|
|
1492
1479
|
if (typeof e == "string") {
|
|
1493
1480
|
console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
|
|
@@ -1526,7 +1513,7 @@ const ut = ue("ZoomOut", [
|
|
|
1526
1513
|
options: t
|
|
1527
1514
|
});
|
|
1528
1515
|
let u = "PDF\u89E3\u6790\u5931\u8D25";
|
|
1529
|
-
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}`), {
|
|
1530
1517
|
type: "pdf",
|
|
1531
1518
|
content: null,
|
|
1532
1519
|
fileName: t.fileName,
|
|
@@ -1534,7 +1521,7 @@ const ut = ue("ZoomOut", [
|
|
|
1534
1521
|
error: u
|
|
1535
1522
|
};
|
|
1536
1523
|
}
|
|
1537
|
-
},
|
|
1524
|
+
}, mt = async (e, t = {}) => {
|
|
1538
1525
|
console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1539
1526
|
try {
|
|
1540
1527
|
let o;
|
|
@@ -1580,7 +1567,7 @@ const ut = ue("ZoomOut", [
|
|
|
1580
1567
|
error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1581
1568
|
};
|
|
1582
1569
|
}
|
|
1583
|
-
},
|
|
1570
|
+
}, gt = async (e, t = {}) => {
|
|
1584
1571
|
try {
|
|
1585
1572
|
let o;
|
|
1586
1573
|
if (typeof e == "string") {
|
|
@@ -1610,7 +1597,7 @@ const ut = ue("ZoomOut", [
|
|
|
1610
1597
|
error: `\u6587\u672C\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1611
1598
|
};
|
|
1612
1599
|
}
|
|
1613
|
-
},
|
|
1600
|
+
}, ft = async (e, t = {}) => {
|
|
1614
1601
|
try {
|
|
1615
1602
|
let o;
|
|
1616
1603
|
if (typeof e == "string") {
|
|
@@ -1640,7 +1627,7 @@ const ut = ue("ZoomOut", [
|
|
|
1640
1627
|
error: `Markdown\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1641
1628
|
};
|
|
1642
1629
|
}
|
|
1643
|
-
},
|
|
1630
|
+
}, Et = async (e, t = {}) => {
|
|
1644
1631
|
console.log("=== parseHtmlFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
|
|
1645
1632
|
try {
|
|
1646
1633
|
let o;
|
|
@@ -1673,19 +1660,19 @@ const ut = ue("ZoomOut", [
|
|
|
1673
1660
|
error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
|
|
1674
1661
|
};
|
|
1675
1662
|
}
|
|
1676
|
-
},
|
|
1663
|
+
}, ht = async (e, t = {}) => {
|
|
1677
1664
|
switch (be(t.fileName, t.fileType)) {
|
|
1678
1665
|
case "pdf":
|
|
1679
|
-
return await
|
|
1666
|
+
return await dt(e, t);
|
|
1680
1667
|
case "image":
|
|
1681
|
-
return await
|
|
1668
|
+
return await mt(e, t);
|
|
1682
1669
|
case "text":
|
|
1683
|
-
return await
|
|
1670
|
+
return await gt(e, t);
|
|
1684
1671
|
case "markdown":
|
|
1685
1672
|
case "markdown_table":
|
|
1686
|
-
return await
|
|
1673
|
+
return await ft(e, t);
|
|
1687
1674
|
case "html":
|
|
1688
|
-
return await
|
|
1675
|
+
return await Et(e, t);
|
|
1689
1676
|
default:
|
|
1690
1677
|
return {
|
|
1691
1678
|
type: "unknown",
|
|
@@ -1705,7 +1692,7 @@ const ut = ue("ZoomOut", [
|
|
|
1705
1692
|
border-radius: ${(e) => e.$theme.space.radius};
|
|
1706
1693
|
overflow: hidden;
|
|
1707
1694
|
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
1708
|
-
`,
|
|
1695
|
+
`, Ft = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
|
|
1709
1696
|
display: "flex",
|
|
1710
1697
|
flexDirection: "column",
|
|
1711
1698
|
alignItems: "center",
|
|
@@ -1804,7 +1791,7 @@ const pe = G.div`
|
|
|
1804
1791
|
color: ${(e) => e.$theme.colors.error};
|
|
1805
1792
|
text-align: center;
|
|
1806
1793
|
padding: 20px;
|
|
1807
|
-
`,
|
|
1794
|
+
`, pt = {
|
|
1808
1795
|
colors: {
|
|
1809
1796
|
primary: "#007bff",
|
|
1810
1797
|
secondary: "#6c757d",
|
|
@@ -1828,7 +1815,7 @@ const pe = G.div`
|
|
|
1828
1815
|
shadow: "md",
|
|
1829
1816
|
lineHeight: "md"
|
|
1830
1817
|
}
|
|
1831
|
-
},
|
|
1818
|
+
}, bt = ({
|
|
1832
1819
|
fileUrl: e,
|
|
1833
1820
|
fileType: t,
|
|
1834
1821
|
annotations: o,
|
|
@@ -1839,24 +1826,24 @@ const pe = G.div`
|
|
|
1839
1826
|
eventsEmit: f = () => {
|
|
1840
1827
|
},
|
|
1841
1828
|
styles: g,
|
|
1842
|
-
tools:
|
|
1829
|
+
tools: h = {
|
|
1843
1830
|
annotation: !1,
|
|
1844
1831
|
download: !1,
|
|
1845
1832
|
zoom: !0,
|
|
1846
1833
|
close: !0,
|
|
1847
1834
|
navigation: !0
|
|
1848
1835
|
},
|
|
1849
|
-
customComponents:
|
|
1836
|
+
customComponents: v,
|
|
1850
1837
|
className: b,
|
|
1851
|
-
headerClass:
|
|
1838
|
+
headerClass: w,
|
|
1852
1839
|
contentClass: B
|
|
1853
1840
|
}) => {
|
|
1854
1841
|
var a;
|
|
1855
|
-
const l = (g == null ? void 0 : g.theme) ||
|
|
1856
|
-
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0),
|
|
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);
|
|
1857
1844
|
}, [d]), y = $(async () => {
|
|
1858
1845
|
var E, z;
|
|
1859
|
-
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) {
|
|
1860
1847
|
C(!1), x(null), k({
|
|
1861
1848
|
type: p.fileType || t || "text",
|
|
1862
1849
|
content: p.content,
|
|
@@ -1874,7 +1861,7 @@ const pe = G.div`
|
|
|
1874
1861
|
C(!0), x(null);
|
|
1875
1862
|
const Y = be(u, t);
|
|
1876
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...");
|
|
1877
|
-
const S = await
|
|
1864
|
+
const S = await ht(e, {
|
|
1878
1865
|
fileName: u,
|
|
1879
1866
|
fileType: t,
|
|
1880
1867
|
token: r
|
|
@@ -1885,7 +1872,7 @@ const pe = G.div`
|
|
|
1885
1872
|
} finally {
|
|
1886
1873
|
C(!1);
|
|
1887
1874
|
}
|
|
1888
|
-
}, [e, u, t, r, p,
|
|
1875
|
+
}, [e, u, t, r, p, i]);
|
|
1889
1876
|
te(() => {
|
|
1890
1877
|
y();
|
|
1891
1878
|
}, [y]);
|
|
@@ -1914,14 +1901,14 @@ const pe = G.div`
|
|
|
1914
1901
|
L(E), m("page:change", { page: E });
|
|
1915
1902
|
}
|
|
1916
1903
|
}, [O, m]), Z = $(() => {
|
|
1917
|
-
const E = (
|
|
1904
|
+
const E = (F == null ? void 0 : F.totalPages) || 0;
|
|
1918
1905
|
if (E && O < E) {
|
|
1919
1906
|
const z = O + 1;
|
|
1920
1907
|
L(z), m("page:change", { page: z });
|
|
1921
1908
|
}
|
|
1922
|
-
}, [O,
|
|
1909
|
+
}, [O, F == null ? void 0 : F.totalPages, m]), U = $(() => {
|
|
1923
1910
|
const E = !J;
|
|
1924
|
-
|
|
1911
|
+
s(E), m("annotation:toggle", { isAnnotating: E });
|
|
1925
1912
|
}, [J, m]), M = $(() => {
|
|
1926
1913
|
m("download:start", { fileUrl: e, fileName: u });
|
|
1927
1914
|
}, [m, e, u]), j = $(() => {
|
|
@@ -1950,7 +1937,7 @@ const pe = G.div`
|
|
|
1950
1937
|
}, []);
|
|
1951
1938
|
if (D) {
|
|
1952
1939
|
const E = Q(t || "unknown", {
|
|
1953
|
-
...
|
|
1940
|
+
...h,
|
|
1954
1941
|
navigation: !1
|
|
1955
1942
|
});
|
|
1956
1943
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -1976,16 +1963,16 @@ const pe = G.div`
|
|
|
1976
1963
|
onClose: oe,
|
|
1977
1964
|
scale: 1,
|
|
1978
1965
|
isAnnotating: !1,
|
|
1979
|
-
className:
|
|
1966
|
+
className: w
|
|
1980
1967
|
}
|
|
1981
|
-
),
|
|
1982
|
-
|
|
1968
|
+
), v != null && v.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1969
|
+
v.LoadingComponent,
|
|
1983
1970
|
{
|
|
1984
1971
|
status: q,
|
|
1985
1972
|
theme: l
|
|
1986
1973
|
}
|
|
1987
1974
|
) : /* @__PURE__ */ n.createElement(
|
|
1988
|
-
|
|
1975
|
+
Ft,
|
|
1989
1976
|
{
|
|
1990
1977
|
status: q,
|
|
1991
1978
|
theme: l
|
|
@@ -1994,7 +1981,7 @@ const pe = G.div`
|
|
|
1994
1981
|
}
|
|
1995
1982
|
if (c) {
|
|
1996
1983
|
const E = Q(t || "unknown", {
|
|
1997
|
-
...
|
|
1984
|
+
...h,
|
|
1998
1985
|
navigation: !1
|
|
1999
1986
|
});
|
|
2000
1987
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -2020,13 +2007,13 @@ const pe = G.div`
|
|
|
2020
2007
|
onClose: oe,
|
|
2021
2008
|
scale: 1,
|
|
2022
2009
|
isAnnotating: !1,
|
|
2023
|
-
className:
|
|
2010
|
+
className: w
|
|
2024
2011
|
}
|
|
2025
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)));
|
|
2026
2013
|
}
|
|
2027
|
-
if (!
|
|
2014
|
+
if (!F) {
|
|
2028
2015
|
const E = Q(t || "unknown", {
|
|
2029
|
-
...
|
|
2016
|
+
...h,
|
|
2030
2017
|
navigation: !1
|
|
2031
2018
|
});
|
|
2032
2019
|
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
|
|
@@ -2052,27 +2039,27 @@ const pe = G.div`
|
|
|
2052
2039
|
onClose: oe,
|
|
2053
2040
|
scale: 1,
|
|
2054
2041
|
isAnnotating: !1,
|
|
2055
|
-
className:
|
|
2042
|
+
className: w
|
|
2056
2043
|
}
|
|
2057
2044
|
), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
|
|
2058
2045
|
}
|
|
2059
2046
|
const H = {
|
|
2060
|
-
content:
|
|
2061
|
-
...(
|
|
2062
|
-
...(
|
|
2063
|
-
...
|
|
2064
|
-
}, W = Q(
|
|
2065
|
-
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:",
|
|
2047
|
+
content: F.content,
|
|
2048
|
+
...(F.fileName || u) && { fileName: F.fileName || u },
|
|
2049
|
+
...(F.fileType || t) && { fileType: F.fileType || t },
|
|
2050
|
+
...F.totalPages && { totalPages: F.totalPages }
|
|
2051
|
+
}, W = Q(F.type, h);
|
|
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(
|
|
2066
2053
|
ce,
|
|
2067
2054
|
{
|
|
2068
|
-
fileName: H.fileName ||
|
|
2069
|
-
currentPage:
|
|
2070
|
-
totalPage:
|
|
2055
|
+
fileName: H.fileName || F.fileName || u || "\u672A\u77E5\u6587\u4EF6",
|
|
2056
|
+
currentPage: F.type === "pdf" ? O : 1,
|
|
2057
|
+
totalPage: F.type === "pdf" && F.totalPages || 0,
|
|
2071
2058
|
tools: W,
|
|
2072
2059
|
styles: g,
|
|
2073
|
-
onPrevPage:
|
|
2060
|
+
onPrevPage: F.type === "pdf" ? I : () => {
|
|
2074
2061
|
},
|
|
2075
|
-
onNextPage:
|
|
2062
|
+
onNextPage: F.type === "pdf" ? Z : () => {
|
|
2076
2063
|
},
|
|
2077
2064
|
onZoomIn: W.zoom ? _ : () => {
|
|
2078
2065
|
},
|
|
@@ -2089,15 +2076,15 @@ const pe = G.div`
|
|
|
2089
2076
|
onClose: oe,
|
|
2090
2077
|
scale: A,
|
|
2091
2078
|
isAnnotating: J,
|
|
2092
|
-
className:
|
|
2079
|
+
className: w
|
|
2093
2080
|
}
|
|
2094
2081
|
), /* @__PURE__ */ n.createElement(
|
|
2095
|
-
|
|
2082
|
+
Ze,
|
|
2096
2083
|
{
|
|
2097
2084
|
data: H,
|
|
2098
2085
|
annotationData: o || [],
|
|
2099
|
-
totalPage:
|
|
2100
|
-
currentPage:
|
|
2086
|
+
totalPage: F.type === "pdf" && F.totalPages || 0,
|
|
2087
|
+
currentPage: F.type === "pdf" ? O : 1,
|
|
2101
2088
|
scale: A,
|
|
2102
2089
|
rotation: V,
|
|
2103
2090
|
eventsEmit: m,
|
|
@@ -2106,7 +2093,7 @@ const pe = G.div`
|
|
|
2106
2093
|
className: B
|
|
2107
2094
|
}
|
|
2108
2095
|
));
|
|
2109
|
-
},
|
|
2096
|
+
}, Ct = () => !!re.GlobalWorkerOptions.workerSrc, xt = () => re.GlobalWorkerOptions.workerSrc, Dt = (e = "/worker/pdf.worker.min.js") => {
|
|
2110
2097
|
try {
|
|
2111
2098
|
if (re.GlobalWorkerOptions.workerSrc) {
|
|
2112
2099
|
console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
|
|
@@ -2118,16 +2105,16 @@ const pe = G.div`
|
|
|
2118
2105
|
}
|
|
2119
2106
|
};
|
|
2120
2107
|
export {
|
|
2121
|
-
|
|
2122
|
-
|
|
2108
|
+
Ze as Fviewer,
|
|
2109
|
+
bt as StaticFileReader,
|
|
2123
2110
|
be as detectFileType,
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
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
|
|
2132
2119
|
};
|
|
2133
2120
|
//# sourceMappingURL=index.js.map
|