@mxmweb/fviewer 1.5.2 → 1.5.4

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 CHANGED
@@ -1,69 +1,69 @@
1
- import n, { useRef as X, useState as R, useCallback as $, useEffect as te, forwardRef as Ce, createElement as Fe } from "react";
1
+ import n, { useRef as H, useState as P, useCallback as A, useEffect as te, forwardRef as ve, createElement as Ee } from "react";
2
2
  import G from "styled-components";
3
+ import { Markdownit as we, DataType as ye } from "@mxmweb/rtext";
3
4
  import * as re from "pdfjs-dist";
4
- import { Markdownit as we, DataType as ve } from "@mxmweb/rtext";
5
5
  const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
6
6
  pageNumber: e,
7
7
  scale: t,
8
8
  isAnnotating: o,
9
9
  annotations: u = [],
10
10
  onAnnotationAdd: r,
11
- onAnnotationDelete: d,
11
+ onAnnotationDelete: c,
12
12
  readOnly: p = !1
13
13
  }) => {
14
- const f = X(null), [g, F] = R(!1), [w, b] = R({ x: 0, y: 0 }), [v, B] = R(null), [a, l] = R(null), D = $(
15
- (c) => {
16
- if (!o || !f.current) return;
17
- const x = f.current.getBoundingClientRect(), h = (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: h, y: k, scale: t }), F(!0), b({ x: h, y: k });
14
+ const g = H(null), [m, f] = P(!1), [C, x] = P({ x: 0, y: 0 }), [v, D] = P(null), [s, a] = P(null), B = A(
15
+ (i) => {
16
+ if (!o || !g.current) return;
17
+ const b = g.current.getBoundingClientRect(), h = (i.clientX - b.left) / b.width, j = (i.clientY - b.top) / b.height;
18
+ console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: i.clientX, clientY: i.clientY, rect: b, x: h, y: j, scale: t }), f(!0), x({ x: h, y: j });
19
19
  },
20
20
  [o, t]
21
- ), C = $(
22
- (c) => {
23
- if (!g || !f.current) return;
24
- const x = f.current.getBoundingClientRect(), h = (c.clientX - x.left) / x.width, k = (c.clientY - x.top) / x.height;
25
- B({
26
- x: Math.min(w.x, h),
27
- y: Math.min(w.y, k),
28
- width: Math.abs(h - w.x),
29
- height: Math.abs(k - w.y)
21
+ ), y = A(
22
+ (i) => {
23
+ if (!m || !g.current) return;
24
+ const b = g.current.getBoundingClientRect(), h = (i.clientX - b.left) / b.width, j = (i.clientY - b.top) / b.height;
25
+ D({
26
+ x: Math.min(C.x, h),
27
+ y: Math.min(C.y, j),
28
+ width: Math.abs(h - C.x),
29
+ height: Math.abs(j - C.y)
30
30
  });
31
31
  },
32
- [g, w, t]
33
- ), q = $(() => {
34
- if (!g || !v) return;
35
- if (F(!1), v.width < 5 || v.height < 5) {
36
- B(null);
32
+ [m, C, t]
33
+ ), Z = A(() => {
34
+ if (!m || !v) return;
35
+ if (f(!1), v.width < 5 || v.height < 5) {
36
+ D(null);
37
37
  return;
38
38
  }
39
- const c = {
39
+ const i = {
40
40
  id: Be(),
41
41
  pageNumber: e,
42
42
  ...v,
43
43
  content: "",
44
44
  color: De
45
45
  };
46
- r == null || r(c), B(null);
47
- }, [g, v, e, r]), N = $((c) => {
48
- l(a === c ? null : c);
49
- }, [a]);
50
- return $((c, x) => {
46
+ r == null || r(i), D(null);
47
+ }, [m, v, e, r]), z = A((i) => {
48
+ a(s === i ? null : i);
49
+ }, [s]);
50
+ return A((i, b) => {
51
51
  const h = {
52
- ...c,
53
- content: x
52
+ ...i,
53
+ content: b
54
54
  };
55
55
  r == null || r(h);
56
- }, [r]), $((c) => {
57
- d == null || d(c), l(null);
58
- }, [d]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
56
+ }, [r]), A((i) => {
57
+ c == null || c(i), a(null);
58
+ }, [c]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
59
59
  pageNumber: e,
60
60
  annotations: u.length,
61
- currentPageAnnotationsCount: u.filter((c) => c.pageNumber === e).length,
62
- currentPageAnnotations: u.filter((c) => c.pageNumber === e)
61
+ currentPageAnnotationsCount: u.filter((i) => i.pageNumber === e).length,
62
+ currentPageAnnotations: u.filter((i) => i.pageNumber === e)
63
63
  }), /* @__PURE__ */ n.createElement(
64
64
  "div",
65
65
  {
66
- ref: f,
66
+ ref: g,
67
67
  style: {
68
68
  position: "absolute",
69
69
  top: 0,
@@ -74,10 +74,10 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
74
74
  pointerEvents: "auto"
75
75
  // 确保可以接收鼠标事件
76
76
  },
77
- onMouseDown: D,
78
- onMouseMove: C,
79
- onMouseUp: q,
80
- onMouseLeave: q
77
+ onMouseDown: B,
78
+ onMouseMove: y,
79
+ onMouseUp: Z,
80
+ onMouseLeave: Z
81
81
  },
82
82
  v && /* @__PURE__ */ n.createElement(
83
83
  "div",
@@ -91,7 +91,7 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
91
91
  }
92
92
  }
93
93
  ),
94
- u.filter((c) => c.pageNumber === e).map((c) => (console.log("\u6E32\u67D3\u6807\u6CE8:", c.id, `\u4F4D\u7F6E: ${c.x * 100}%, ${c.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: c.id, style: {
94
+ u.filter((i) => i.pageNumber === e).map((i) => (console.log("\u6E32\u67D3\u6807\u6CE8:", i.id, `\u4F4D\u7F6E: ${i.x * 100}%, ${i.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: i.id, style: {
95
95
  width: "100%",
96
96
  height: "100%",
97
97
  position: "absolute",
@@ -103,34 +103,21 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
103
103
  className: "border border-solid",
104
104
  style: {
105
105
  position: "absolute",
106
- left: `${c.x * 100}%`,
107
- top: `${c.y * 100}%`,
108
- width: `${c.width * 100}%`,
109
- height: `${c.height * 100}%`,
106
+ left: `${i.x * 100}%`,
107
+ top: `${i.y * 100}%`,
108
+ width: `${i.width * 100}%`,
109
+ height: `${i.height * 100}%`,
110
110
  borderWidth: "2px",
111
- borderColor: `${c.color}`,
112
- backgroundColor: `${c.color}4D`,
111
+ borderColor: `${i.color}`,
112
+ backgroundColor: `${i.color}4D`,
113
113
  // 30%透明度 (4D = 77/255 ≈ 0.3)
114
114
  zIndex: 1e3
115
115
  },
116
- onClick: () => N(c.id)
116
+ onClick: () => z(i.id)
117
117
  }
118
118
  ))))
119
119
  );
120
- }, Ae = () => {
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
+ }, Ae = {
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
- }, Pe = G.div`
144
+ }, $e = 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
- `, _e = G.div`
151
+ `, Pe = G.div`
165
152
  display: flex;
166
153
  align-items: center;
167
154
  justify-content: center;
@@ -176,63 +163,63 @@ const $e = {
176
163
  // 默认从第1页开始
177
164
  scale: u,
178
165
  annotations: r,
179
- isAnnotating: d,
166
+ isAnnotating: c,
180
167
  isSlidesMode: p = !1,
181
- onPageChange: f,
182
- onScaleChange: g,
183
- onAnnotationChange: F,
184
- onAnnotationDelete: w,
185
- styles: b
168
+ onPageChange: g,
169
+ onScaleChange: m,
170
+ onAnnotationChange: f,
171
+ onAnnotationDelete: C,
172
+ styles: x
186
173
  }) => {
187
- const [v, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [h, k] = R(!0), O = (b == null ? void 0 : b.theme) || $e, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((i) => {
188
- if (!A.current || !h || !g) return null;
189
- const s = A.current, y = s.offsetWidth - 40, m = s.offsetHeight - 40, _ = y / i.width, T = m / i.height, I = Math.min(_, T, 1), Z = Math.max(0.3, Math.min(1, I));
174
+ const [v, D] = P(!1), [s, a] = P(null), [B, y] = P(0), [Z, z] = P(0), [i, b] = P(!1), [h, j] = P(!0), q = (x == null ? void 0 : x.theme) || Ae, R = H(null), T = H(null), _ = H(!1), V = H(null), Q = A((X) => {
175
+ if (!T.current || !h || !m) return null;
176
+ const d = T.current, l = d.offsetWidth - 40, E = d.offsetHeight - 40, w = l / X.width, k = E / X.height, S = Math.min(w, k, 1), W = Math.max(0.3, Math.min(1, S));
190
177
  return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
191
- containerWidth: y,
192
- containerHeight: m,
193
- viewportWidth: i.width,
194
- viewportHeight: i.height,
195
- scaleX: _,
196
- scaleY: T,
197
- autoScale: I,
198
- finalScale: Z
199
- }), Z;
200
- }, [h, g]), J = $(async () => {
201
- if (!(!e || !L.current)) {
202
- if (P.current || V.current === t) {
178
+ containerWidth: l,
179
+ containerHeight: E,
180
+ viewportWidth: X.width,
181
+ viewportHeight: X.height,
182
+ scaleX: w,
183
+ scaleY: k,
184
+ autoScale: S,
185
+ finalScale: W
186
+ }), W;
187
+ }, [h, m]), K = A(async () => {
188
+ if (!(!e || !R.current)) {
189
+ if (_.current || V.current === t) {
203
190
  console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
204
191
  return;
205
192
  }
206
193
  try {
207
- V.current = t, P.current = !0;
208
- const i = t - o + 1;
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=${i}`), i < 1 || i > e.numPages)
210
- throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${i}, 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`);
211
- const s = await e.getPage(i), y = L.current, m = y.getContext("2d");
194
+ V.current = t, _.current = !0;
195
+ const X = 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=${X}`), X < 1 || X > e.numPages)
197
+ throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${X}, 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 d = await e.getPage(X), l = R.current, E = l.getContext("2d");
212
199
  console.log("\u5F53\u524Dscale\u503C:", u);
213
- const _ = s.getViewport({ scale: 1 });
214
- if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), h && k(!1), y.width = _.width, y.height = _.height, await s.render({
215
- canvasContext: m,
216
- viewport: _
217
- }).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", y.width, "x", y.height), A.current) {
218
- const T = A.current;
219
- console.log("\u5BB9\u5668\u5C3A\u5BF8:", T.offsetWidth, "x", T.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", y.offsetWidth, "x", y.offsetHeight);
200
+ const w = d.getViewport({ scale: 1 });
201
+ if (console.log("viewport\u5C3A\u5BF8:", w.width, "x", w.height), h && j(!1), l.width = w.width, l.height = w.height, await d.render({
202
+ canvasContext: E,
203
+ viewport: w
204
+ }).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", l.width, "x", l.height), T.current) {
205
+ const k = T.current;
206
+ console.log("\u5BB9\u5668\u5C3A\u5BF8:", k.offsetWidth, "x", k.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", l.offsetWidth, "x", l.offsetHeight);
220
207
  }
221
- } catch (i) {
222
- console.error("PDF\u6E32\u67D3\u5931\u8D25:", i);
208
+ } catch (X) {
209
+ console.error("PDF\u6E32\u67D3\u5931\u8D25:", X);
223
210
  } finally {
224
- P.current = !1;
211
+ _.current = !1;
225
212
  }
226
213
  }
227
- }, [e, u, o, ee, g, t]);
214
+ }, [e, u, o, Q, m, t]);
228
215
  return te(() => {
229
- e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), J());
216
+ e && t && o && (console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:", "pdfStartPage:" + o, "currentPage:" + t, "pdfDocument:", e), K());
230
217
  }, [t, e, o]), te(() => {
231
- e && t && J();
232
- }, [u, e, t]), v ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $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(
218
+ e && t && K();
219
+ }, [u, e, t]), v ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: q }, "\u52A0\u8F7D\u4E2D...")) : s ? /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $theme: q }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, s)))) : /* @__PURE__ */ n.createElement(
233
220
  "div",
234
221
  {
235
- ref: A,
222
+ ref: T,
236
223
  className: "bg-gray-100",
237
224
  style: {
238
225
  display: p ? "block" : "flex",
@@ -245,7 +232,7 @@ const $e = {
245
232
  overflow: "visible"
246
233
  }
247
234
  },
248
- v ? /* @__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(
235
+ v ? /* @__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...")) : s ? /* @__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" }, s)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
249
236
  "div",
250
237
  {
251
238
  className: "relative",
@@ -259,7 +246,7 @@ const $e = {
259
246
  /* @__PURE__ */ n.createElement(
260
247
  "canvas",
261
248
  {
262
- ref: L,
249
+ ref: R,
263
250
  className: "shadow-lg bg-white border border-gray-300",
264
251
  style: {
265
252
  display: "block"
@@ -271,16 +258,16 @@ const $e = {
271
258
  {
272
259
  pageNumber: t,
273
260
  scale: u,
274
- isAnnotating: d,
261
+ isAnnotating: c,
275
262
  annotations: r,
276
- onAnnotationAdd: F,
277
- onAnnotationDelete: w,
278
- readOnly: !d
263
+ onAnnotationAdd: f,
264
+ onAnnotationDelete: C,
265
+ readOnly: !c
279
266
  }
280
267
  )
281
268
  ))
282
269
  );
283
- }, Re = G.div`
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
- `, Ne = G.div`
283
+ `, Re = 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
- `, Le = G.div`
289
+ `, Ne = 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
- `, ze = `
298
+ `, Le = `
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
- `, Se = {
378
+ `, ze = {
392
379
  colors: {
393
380
  primary: "#007bff",
394
381
  secondary: "#6c757d",
@@ -412,57 +399,57 @@ const $e = {
412
399
  shadow: "md",
413
400
  lineHeight: "md"
414
401
  }
415
- }, Me = (e) => {
402
+ }, Se = (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
- }, We = (e, t, o = !1) => {
421
- var u, r, d, p, f, g, F;
422
- 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 w = e.pdfStartPage || 1;
424
- console.log("PDF\u8D77\u59CB\u9875:", w);
425
- const b = (t.annotationData || []).filter(
426
- (a) => "pageNumber" in a && "x" in a && "y" in a
407
+ }, Me = (e, t, o = !1) => {
408
+ var u, r, c, p, g, m, f;
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:", ((c = e.content) == null ? void 0 : c.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:", (g = e.content) != null && g.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"), console.log("PDF\u6587\u6863\u5C5E\u6027:", (m = e.content) != null && m.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863");
410
+ const C = e.pdfStartPage || 1;
411
+ console.log("PDF\u8D77\u59CB\u9875:", C);
412
+ const x = (t.annotationData || []).filter(
413
+ (s) => "pageNumber" in s && "x" in s && "y" in s
427
414
  );
428
- console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", b);
429
- const v = o ? 0.82 : 1, B = t.initialZoom || t.scale || v;
415
+ console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", x);
416
+ const v = o ? 0.82 : 1, D = t.initialZoom || t.scale || v;
430
417
  return /* @__PURE__ */ n.createElement(
431
418
  Te,
432
419
  {
433
- pdfDocument: ((F = e.content) == null ? void 0 : F.document) || null,
420
+ pdfDocument: ((f = e.content) == null ? void 0 : f.document) || null,
434
421
  currentPage: t.currentPage || 1,
435
- pdfStartPage: w,
436
- scale: B,
437
- annotations: b,
422
+ pdfStartPage: C,
423
+ scale: D,
424
+ annotations: x,
438
425
  isAnnotating: !1,
439
426
  isSlidesMode: o,
440
- onPageChange: t.eventsEmit ? (a) => {
441
- var l;
442
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "pageChange", { pageNumber: a });
427
+ onPageChange: t.eventsEmit ? (s) => {
428
+ var a;
429
+ return (a = t.eventsEmit) == null ? void 0 : a.call(t, "pageChange", { pageNumber: s });
443
430
  } : void 0,
444
- onScaleChange: t.eventsEmit ? (a) => {
445
- var l;
446
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "scaleChange", { scale: a });
431
+ onScaleChange: t.eventsEmit ? (s) => {
432
+ var a;
433
+ return (a = t.eventsEmit) == null ? void 0 : a.call(t, "scaleChange", { scale: s });
447
434
  } : void 0,
448
- onAnnotationChange: t.eventsEmit ? (a) => {
449
- var l;
450
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationChange", { annotation: a });
435
+ onAnnotationChange: t.eventsEmit ? (s) => {
436
+ var a;
437
+ return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationChange", { annotation: s });
451
438
  } : void 0,
452
- onAnnotationDelete: t.eventsEmit ? (a) => {
453
- var l;
454
- return (l = t.eventsEmit) == null ? void 0 : l.call(t, "annotationDelete", { annotationId: a });
439
+ onAnnotationDelete: t.eventsEmit ? (s) => {
440
+ var a;
441
+ return (a = t.eventsEmit) == null ? void 0 : a.call(t, "annotationDelete", { annotationId: s });
455
442
  } : void 0,
456
443
  styles: t.styles
457
444
  }
458
445
  );
459
- }, Ie = (e, t) => {
460
- var o, u, r, d, p, f, g, F, w, b, v, B, a, l;
446
+ }, We = (e, t) => {
447
+ var o, u, r, c, p, g, m, f, C, x, v, D, s, a;
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
- const D = ((u = e.content) == null ? void 0 : u.url) || e.content, [C, q] = R(!0), [N, c] = R(!1), x = () => {
463
- console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", D), q(!1), c(!1);
449
+ const B = ((u = e.content) == null ? void 0 : u.url) || e.content, [y, Z] = P(!0), [z, i] = P(!1), b = () => {
450
+ console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", B), Z(!1), i(!1);
464
451
  }, h = () => {
465
- console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", D), q(!1), c(!0);
452
+ console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", B), Z(!1), i(!0);
466
453
  };
467
454
  return /* @__PURE__ */ n.createElement("div", { style: {
468
455
  display: "flex",
@@ -474,7 +461,7 @@ const $e = {
474
461
  position: "relative",
475
462
  backgroundColor: "#272727"
476
463
  // 图片模式深色背景
477
- } }, C && /* @__PURE__ */ n.createElement("div", { style: {
464
+ } }, y && /* @__PURE__ */ n.createElement("div", { style: {
478
465
  position: "absolute",
479
466
  top: "50%",
480
467
  left: "50%",
@@ -487,14 +474,14 @@ const $e = {
487
474
  } }, /* @__PURE__ */ n.createElement("div", { style: {
488
475
  width: "32px",
489
476
  height: "32px",
490
- 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 ${((F = (g = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : g.colors) == null ? void 0 : F.primary) || "#007bff"}`,
477
+ border: `3px solid ${((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
478
+ borderTop: `3px solid ${((f = (m = (g = t.styles) == null ? void 0 : g.theme) == null ? void 0 : m.colors) == null ? void 0 : f.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: ((v = (b = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : b.colors) == null ? void 0 : v.text) || "#343a40"
497
- } }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), N && /* @__PURE__ */ n.createElement("div", { style: {
483
+ color: ((v = (x = (C = t.styles) == null ? void 0 : C.theme) == null ? void 0 : x.colors) == null ? void 0 : v.text) || "#343a40"
484
+ } }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), z && /* @__PURE__ */ n.createElement("div", { style: {
498
485
  position: "absolute",
499
486
  top: "50%",
500
487
  left: "50%",
@@ -506,20 +493,20 @@ const $e = {
506
493
  zIndex: 1
507
494
  } }, /* @__PURE__ */ n.createElement("div", { style: {
508
495
  fontSize: "14px",
509
- color: ((l = (a = (B = t.styles) == null ? void 0 : B.theme) == null ? void 0 : a.colors) == null ? void 0 : l.error) || "#dc3545"
496
+ color: ((a = (s = (D = t.styles) == null ? void 0 : D.theme) == null ? void 0 : s.colors) == null ? void 0 : a.error) || "#dc3545"
510
497
  } }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
511
498
  "img",
512
499
  {
513
- src: D,
500
+ src: B,
514
501
  alt: e.fileName || "\u56FE\u7247",
515
- onLoad: x,
502
+ onLoad: b,
516
503
  onError: h,
517
504
  style: {
518
505
  maxWidth: "100%",
519
506
  maxHeight: "100%",
520
507
  objectFit: "contain",
521
508
  transform: `scale(${t.scale || 1}) rotate(${t.rotation || 0}deg)`,
522
- opacity: C ? 0 : 1,
509
+ opacity: y ? 0 : 1,
523
510
  transition: "opacity 0.3s ease-in-out, transform 0.2s ease-in-out"
524
511
  }
525
512
  }
@@ -529,22 +516,22 @@ const $e = {
529
516
  100% { transform: rotate(360deg); }
530
517
  }
531
518
  `));
532
- }, je = (e, t) => {
533
- var o, u, r, d, p;
519
+ }, Ie = (e, t) => {
520
+ var o, u, r, c, p;
534
521
  console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
535
- let f = "";
536
- 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), F = X(null);
522
+ let g = "";
523
+ typeof e.content == "string" ? g = e.content : (o = e.content) != null && o.text ? g = e.content.text : (u = e.content) != null && u.content && (g = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", g);
524
+ const m = H(null), f = H(null);
538
525
  return te(() => {
539
- if (g.current && F.current && f) {
540
- const w = setTimeout(() => {
541
- var b;
542
- const v = ((b = g.current) == null ? void 0 : b.scrollHeight) || 0, B = Math.max(v + 80, 200);
543
- F.current && (F.current.style.minHeight = `${B}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", B));
526
+ if (m.current && f.current && g) {
527
+ const C = setTimeout(() => {
528
+ var x;
529
+ const v = ((x = m.current) == null ? void 0 : x.scrollHeight) || 0, D = Math.max(v + 80, 200);
530
+ f.current && (f.current.style.minHeight = `${D}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", D));
544
531
  }, 100);
545
- return () => clearTimeout(w);
532
+ return () => clearTimeout(C);
546
533
  }
547
- }, [f]), /* @__PURE__ */ n.createElement("div", { style: {
534
+ }, [g]), /* @__PURE__ */ n.createElement("div", { style: {
548
535
  height: "100%",
549
536
  overflow: "auto",
550
537
  backgroundColor: "#f5f5f5",
@@ -556,7 +543,7 @@ const $e = {
556
543
  } }, /* @__PURE__ */ n.createElement(
557
544
  "div",
558
545
  {
559
- ref: F,
546
+ ref: f,
560
547
  style: {
561
548
  width: "100%",
562
549
  maxWidth: "800px",
@@ -574,7 +561,7 @@ const $e = {
574
561
  /* @__PURE__ */ n.createElement(
575
562
  "div",
576
563
  {
577
- ref: g,
564
+ ref: m,
578
565
  style: {
579
566
  width: "100%",
580
567
  overflow: "visible"
@@ -584,12 +571,12 @@ const $e = {
584
571
  we,
585
572
  {
586
573
  dataSource: {
587
- type: ve.TEXT,
588
- content: f
574
+ type: ye.TEXT,
575
+ content: g
589
576
  },
590
577
  size: "md",
591
578
  theme: {
592
- primaryColor: ((p = (d = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : d.colors) == null ? void 0 : p.primary) || "#007bff",
579
+ primaryColor: ((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.primary) || "#007bff",
593
580
  backgroundColor: "transparent",
594
581
  textColor: "#333",
595
582
  borderColor: "transparent",
@@ -617,261 +604,267 @@ const $e = {
617
604
  borderTopRightRadius: "8px"
618
605
  } })
619
606
  ));
620
- }, Oe = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
621
- var u, r, d, p, f, g, F, w, b, v, B, a;
622
- const l = X(null), D = X(null), C = X(null), q = X(!1);
623
- X(0), X(null);
624
- const [N] = R(!1), c = (i, s) => {
625
- console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: i, scrollHeight: s }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: i, scrollHeight: s });
626
- }, x = () => {
607
+ }, je = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
608
+ var u, r, c, p, g, m, f, C, x, v, D, s;
609
+ const a = H(null), B = H(null), y = H(null), Z = H(!1);
610
+ H(0), H(null);
611
+ const [z] = P(!1), i = (d, l) => {
612
+ console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: d, scrollHeight: l }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: d, scrollHeight: l });
613
+ }, b = () => {
627
614
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
628
615
  }, h = () => {
629
616
  console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
630
- }, k = X();
631
- k.current = (i) => {
632
- var s, y;
617
+ }, j = H();
618
+ j.current = (d) => {
619
+ var l, E;
633
620
  try {
634
621
  if (!o) return;
635
- const m = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
636
- if (!m || P.length === 0) return;
637
- 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 = i.dataset) == null ? void 0 : y.tableAnnoRuntimeSig) === T) return;
622
+ const w = typeof e.content == "string" ? e.content : ((l = e.content) == null ? void 0 : l.content) || "";
623
+ if (!w || _.length === 0) return;
624
+ const k = JSON.stringify(_.map((U) => ({ o: U.offsets, c: U.color }))), S = `${w.length}:${w.substring(0, 64)}:${w.substring(w.length - 64)}|${k}`;
625
+ if (((E = d.dataset) == null ? void 0 : E.tableAnnoRuntimeSig) === S) return;
639
626
  setTimeout(() => {
640
- ee(), i.dataset && (i.dataset.tableAnnoRuntimeSig = T);
627
+ K(), d.dataset && (d.dataset.tableAnnoRuntimeSig = S);
641
628
  }, 50);
642
- } catch (m) {
643
- console.warn("[MarkdownRendered] apply failed", m);
629
+ } catch (w) {
630
+ console.warn("[MarkdownRendered] apply failed", w);
644
631
  }
645
632
  };
646
- const O = n.useCallback((i) => {
647
- var s;
648
- return (s = k.current) == null ? void 0 : s.call(k, i);
649
- }, []), L = $(() => {
650
- var i;
651
- if (!N || !l.current) return;
652
- const s = window.getSelection();
653
- if (!s || s.isCollapsed) return;
654
- const y = s.getRangeAt(0), m = y.toString().trim();
655
- if (!m) return;
656
- const _ = l.current;
657
- let T = 0, I = 0;
658
- const Z = document.createTreeWalker(
659
- _,
633
+ const q = n.useCallback((d) => {
634
+ var l;
635
+ return (l = j.current) == null ? void 0 : l.call(j, d);
636
+ }, []), R = A(() => {
637
+ var d;
638
+ if (!z || !a.current) return;
639
+ const l = window.getSelection();
640
+ if (!l || l.isCollapsed) return;
641
+ const E = l.getRangeAt(0), w = E.toString().trim();
642
+ if (!w) return;
643
+ const k = a.current;
644
+ let S = 0, W = 0;
645
+ const U = document.createTreeWalker(
646
+ k,
660
647
  NodeFilter.SHOW_TEXT,
661
648
  {
662
- acceptNode: (j) => {
663
- var K;
664
- return (K = j.parentElement) != null && K.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
649
+ acceptNode: (I) => {
650
+ var Y;
651
+ return (Y = I.parentElement) != null && Y.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
665
652
  }
666
653
  }
667
654
  );
668
- let U = Z.nextNode();
669
- for (; U; ) {
670
- if (U === y.startContainer) {
671
- I = T + y.startOffset;
655
+ let ee = U.nextNode();
656
+ for (; ee; ) {
657
+ if (ee === E.startContainer) {
658
+ W = S + E.startOffset;
672
659
  break;
673
660
  }
674
- T += ((i = U.textContent) == null ? void 0 : i.length) || 0, U = Z.nextNode();
661
+ S += ((d = ee.textContent) == null ? void 0 : d.length) || 0, ee = U.nextNode();
675
662
  }
676
663
  console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
677
- text: m,
678
- startOffset: I,
679
- charCount: T,
680
- container: y.startContainer.textContent
664
+ text: w,
665
+ startOffset: W,
666
+ charCount: S,
667
+ container: E.startContainer.textContent
681
668
  });
682
- const M = {
669
+ const N = {
683
670
  id: `md-anno-${Date.now()}`,
684
- start: I,
685
- end: I + m.length,
671
+ start: W,
672
+ end: W + w.length,
686
673
  color: "#FFE599"
687
674
  };
688
- console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M), s.removeAllRanges();
689
- }, [N, t.eventsEmit]), A = o ? [] : (t.annotationData || []).filter(
690
- (i) => "start" in i && "end" in i && !("pageNumber" in i)
691
- ), P = o ? (t.annotationData || []).filter(
692
- (i) => "offsets" in i && Array.isArray(i.offsets)
693
- ) : [], V = $(() => {
694
- if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
675
+ console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N), l.removeAllRanges();
676
+ }, [z, t.eventsEmit]), T = o ? [] : (t.annotationData || []).filter(
677
+ (d) => "start" in d && "end" in d && !("pageNumber" in d)
678
+ ), _ = o ? (t.annotationData || []).filter(
679
+ (d) => "offsets" in d && Array.isArray(d.offsets)
680
+ ) : [], V = A(() => {
681
+ if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !a.current) {
695
682
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
696
683
  return;
697
684
  }
698
- const i = l.current.querySelectorAll(".md-annotation");
699
- console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", i.length), i.length > 0 && i.forEach((s) => {
700
- const y = s.parentNode;
701
- y && y.replaceChild(document.createTextNode(s.textContent || ""), s);
685
+ const d = a.current.querySelectorAll(".md-annotation");
686
+ console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", d.length), d.length > 0 && d.forEach((l) => {
687
+ const E = l.parentNode;
688
+ E && E.replaceChild(document.createTextNode(l.textContent || ""), l);
702
689
  }), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
703
- }, []), ee = $(() => {
704
- if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", P), !l.current || !P.length) {
705
- console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");
690
+ }, []), Q = A(() => {
691
+ if (!a.current) return;
692
+ a.current.querySelectorAll("table").forEach((l) => {
693
+ Array.from(l.rows).forEach((w) => {
694
+ Array.from(w.cells).forEach((k) => {
695
+ k.getAttribute("data-table-annotated") === "1" && (k.style.removeProperty("background"), k.style.removeProperty("background-color"), k.removeAttribute("data-table-annotated"), k.removeAttribute("title"));
696
+ });
697
+ });
698
+ }), console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8");
699
+ }, []), K = A(() => {
700
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !a.current) {
701
+ console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
706
702
  return;
707
703
  }
708
- const i = l.current.querySelectorAll("table");
709
- if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", i.length), i.length === 0) {
704
+ if (Q(), !_.length) {
705
+ console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
706
+ return;
707
+ }
708
+ const d = a.current.querySelectorAll("table");
709
+ if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", d.length), d.length === 0) {
710
710
  console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
711
711
  return;
712
712
  }
713
- q.current = !0, P.forEach((s, y) => {
714
- const m = s.offsets;
715
- if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", s), !Array.isArray(m) || !m.length || !Array.isArray(m[0]) || m[0].length !== 2) {
716
- console.warn("[TableAnnotation] annotation.offsets is not valid", s);
713
+ Z.current = !0, _.forEach((l, E) => {
714
+ const w = l.offsets;
715
+ if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", l), !Array.isArray(w) || !w.length || !Array.isArray(w[0]) || w[0].length !== 2) {
716
+ console.warn("[TableAnnotation] annotation.offsets is not valid", l);
717
717
  return;
718
718
  }
719
- m.forEach((_, T) => {
720
- const [I, Z] = _;
721
- if (typeof I != "number" || typeof Z != "number") {
722
- console.warn("[TableAnnotation] offset is not [number, number]", _);
719
+ w.forEach((k, S) => {
720
+ const [W, U] = k;
721
+ if (typeof W != "number" || typeof U != "number") {
722
+ console.warn("[TableAnnotation] offset is not [number, number]", k);
723
723
  return;
724
724
  }
725
- i.forEach((U, M) => {
726
- var j, K, oe;
727
- let Q;
728
- const H = U.tBodies && U.tBodies.length > 0 ? Array.from(U.tBodies[0].rows) : [];
729
- if (H.length > 0)
730
- Q = H[I];
731
- else {
732
- const S = ((K = (j = U.tHead) == null ? void 0 : j.rows) == null ? void 0 : K.length) || 0;
733
- Q = Array.from(U.rows)[I + S];
734
- }
735
- if (!Q) {
736
- console.warn("[TableAnnotation] row out of range", { row: I, tableIndex: M });
725
+ d.forEach((ee, N) => {
726
+ var I;
727
+ const Y = Array.from(ee.rows), oe = Y[W];
728
+ if (!oe) {
729
+ console.warn("[TableAnnotation] row out of range", { row: W, tableIndex: N, totalRows: Y.length });
737
730
  return;
738
731
  }
739
- const W = (oe = Q.cells) == null ? void 0 : oe[Z];
740
- if (!W) {
741
- console.warn("[TableAnnotation] cell is undefined", { row: I, col: Z, tableIndex: M });
732
+ const O = (I = oe.cells) == null ? void 0 : I[U];
733
+ if (!O) {
734
+ console.warn("[TableAnnotation] cell is undefined", { row: W, col: U, tableIndex: N });
742
735
  return;
743
736
  }
744
- const E = s.color || "rgba(255, 229, 153, 0.5)", z = getComputedStyle(W).backgroundColor;
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")), s.content && (W.title = s.content), T === 0 && y === 0 && setTimeout(() => {
746
- W.scrollIntoView({ behavior: "smooth", block: "start" });
737
+ const $ = l.color || "rgba(255, 229, 153, 0.5)", F = getComputedStyle(O).backgroundColor;
738
+ O.getAttribute("data-table-annotated") === "1" && (F === $ || O.style.backgroundColor === $) || (O.style.setProperty("background", $, "important"), O.style.setProperty("background-color", $, "important"), O.setAttribute("data-table-annotated", "1")), l.content && (O.title = l.content), S === 0 && E === 0 && setTimeout(() => {
739
+ O.scrollIntoView({ behavior: "smooth", block: "start" });
747
740
  }, 300);
748
741
  });
749
742
  });
750
743
  }), requestAnimationFrame(() => {
751
- q.current = !1;
744
+ Z.current = !1;
752
745
  });
753
- }, [P]), J = $(() => {
754
- if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !A.length) {
746
+ }, [_, Q]), X = A(() => {
747
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !a.current || !T.length) {
755
748
  console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
756
749
  return;
757
750
  }
758
- D.current && clearTimeout(D.current);
759
- const i = () => {
760
- var s;
751
+ B.current && clearTimeout(B.current);
752
+ const d = () => {
753
+ var l;
761
754
  console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
762
- const y = (s = l.current) == null ? void 0 : s.querySelectorAll(".md-annotation");
763
- console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (y == null ? void 0 : y.length) || 0), y == null || y.forEach((M) => {
764
- const j = M.parentNode;
765
- j && j.replaceChild(document.createTextNode(M.textContent || ""), M);
755
+ const E = (l = a.current) == null ? void 0 : l.querySelectorAll(".md-annotation");
756
+ console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (E == null ? void 0 : E.length) || 0), E == null || E.forEach((N) => {
757
+ const I = N.parentNode;
758
+ I && I.replaceChild(document.createTextNode(N.textContent || ""), N);
766
759
  });
767
- const m = document.createTreeWalker(
768
- l.current,
760
+ const w = document.createTreeWalker(
761
+ a.current,
769
762
  NodeFilter.SHOW_TEXT,
770
763
  {
771
- acceptNode: (M) => {
772
- var j;
773
- return (j = M.parentElement) != null && j.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
764
+ acceptNode: (N) => {
765
+ var I;
766
+ return (I = N.parentElement) != null && I.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
774
767
  }
775
768
  }
776
- ), _ = [];
777
- let T;
778
- for (; T = m.nextNode(); )
779
- _.push(T);
780
- if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", _.length), _.length === 0) {
781
- console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), D.current = setTimeout(() => {
782
- i();
769
+ ), k = [];
770
+ let S;
771
+ for (; S = w.nextNode(); )
772
+ k.push(S);
773
+ if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", k.length), k.length === 0) {
774
+ console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), B.current = setTimeout(() => {
775
+ d();
783
776
  }, 200);
784
777
  return;
785
778
  }
786
- let I = 0;
787
- const Z = _.map((M) => {
788
- var j;
789
- const K = I;
790
- return I += ((j = M.textContent) == null ? void 0 : j.length) || 0, {
791
- node: M,
792
- start: K,
793
- end: I,
794
- text: M.textContent
779
+ let W = 0;
780
+ const U = k.map((N) => {
781
+ var I;
782
+ const Y = W;
783
+ return W += ((I = N.textContent) == null ? void 0 : I.length) || 0, {
784
+ node: N,
785
+ start: Y,
786
+ end: W,
787
+ text: N.textContent
795
788
  };
796
789
  });
797
- console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", Z), console.log("\u603B\u6587\u672C\u957F\u5EA6:", I);
798
- const U = [...A].sort((M, j) => j.start - M.start);
799
- console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", U), U.forEach((M) => {
800
- const { start: j, end: K, color: oe } = M;
801
- console.log("\u5904\u7406\u6807\u6CE8:", { annotation: M, nodePositions: Z });
802
- const Q = Z.filter(
803
- (H) => j < H.end && K > H.start
790
+ console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", U), console.log("\u603B\u6587\u672C\u957F\u5EA6:", W);
791
+ const ee = [...T].sort((N, I) => I.start - N.start);
792
+ console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", ee), ee.forEach((N) => {
793
+ const { start: I, end: Y, color: oe } = N;
794
+ console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions: U });
795
+ const O = U.filter(
796
+ ($) => I < $.end && Y > $.start
804
797
  );
805
- console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
806
- var E, z, Y, S, me, he;
807
- const le = Math.max(0, j - W), ie = Math.min(((E = H.textContent) == null ? void 0 : E.length) || 0, K - W);
808
- if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: ie, nodeTextLength: (z = H.textContent) == null ? void 0 : z.length }), le >= ie) {
798
+ console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", O.length), O.forEach(({ node: $, start: F }) => {
799
+ var L, J, M, he, Fe, pe;
800
+ const le = Math.max(0, I - F), ae = Math.min(((L = $.textContent) == null ? void 0 : L.length) || 0, Y - F);
801
+ if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: ae, nodeTextLength: (J = $.textContent) == null ? void 0 : J.length }), le >= ae) {
809
802
  console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
810
803
  return;
811
804
  }
812
- const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le, ie)) || "", Ee = ((me = H.textContent) == null ? void 0 : me.slice(ie)) || "";
813
- console.log("\u5206\u5272\u6587\u672C:", { before: ge, annotatedText: fe, after: Ee });
805
+ const me = ((M = $.textContent) == null ? void 0 : M.slice(0, le)) || "", ge = ((he = $.textContent) == null ? void 0 : he.slice(le, ae)) || "", fe = ((Fe = $.textContent) == null ? void 0 : Fe.slice(ae)) || "";
806
+ console.log("\u5206\u5272\u6587\u672C:", { before: me, annotatedText: ge, after: fe });
814
807
  const se = document.createElement("span");
815
- se.className = "md-annotation", se.style.backgroundColor = oe || "#FFE599", se.textContent = fe;
816
- const ae = document.createDocumentFragment();
817
- ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(se), Ee && ae.appendChild(document.createTextNode(Ee)), (he = H.parentNode) == null || he.replaceChild(ae, H), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", fe);
808
+ se.className = "md-annotation", se.style.backgroundColor = oe || "#FFE599", se.textContent = ge;
809
+ const ie = document.createDocumentFragment();
810
+ me && ie.appendChild(document.createTextNode(me)), ie.appendChild(se), fe && ie.appendChild(document.createTextNode(fe)), (pe = $.parentNode) == null || pe.replaceChild(ie, $), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", ge);
818
811
  });
819
812
  });
820
813
  };
821
- D.current = setTimeout(() => {
822
- i();
814
+ B.current = setTimeout(() => {
815
+ d();
823
816
  }, 100);
824
- }, [A]);
817
+ }, [T]);
825
818
  return te(() => {
826
- var i;
819
+ var d;
827
820
  if (o) {
828
821
  console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
829
822
  return;
830
823
  }
831
- const s = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
832
- if (!s || typeof s != "string") {
824
+ const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
825
+ if (!l || typeof l != "string") {
833
826
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
834
827
  return;
835
828
  }
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:", s), !l.current) {
829
+ if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", a.current), console.log("isTableMode:", o), console.log("mdAnnotations:", T), console.log("tableAnnotations:", _), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", l), !a.current) {
837
830
  console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
838
831
  return;
839
832
  }
840
- if (o || V(), !o && A.length > 0) {
841
- J();
833
+ if (o || V(), !o && T.length > 0) {
834
+ X();
842
835
  return;
843
836
  }
844
837
  console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
845
- }, [o, P, A]), te(() => {
838
+ }, [o, _, T]), te(() => {
846
839
  if (!o)
847
- return document.addEventListener("mouseup", L), () => {
848
- document.removeEventListener("mouseup", L);
840
+ return document.addEventListener("mouseup", R), () => {
841
+ document.removeEventListener("mouseup", R);
849
842
  };
850
- }, [L, o]), te(() => {
851
- var i;
852
- const s = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
853
- if (!s || typeof s != "string") {
843
+ }, [R, o]), te(() => {
844
+ var d;
845
+ const l = typeof e.content == "string" ? e.content : ((d = e.content) == null ? void 0 : d.content) || "";
846
+ if (!l || typeof l != "string") {
854
847
  console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
855
848
  return;
856
849
  }
857
- console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", s.length || 0), typeof s == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", s.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", s.substring(s.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof s), console.log("\u5185\u5BB9\u503C:", s)), console.log("\u6807\u6CE8\u6570\u636E:", A), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", P);
858
- }, [A, P, o]), te(() => {
859
- if (o && l.current) {
860
- const i = setTimeout(() => {
861
- var s;
862
- const y = (s = l.current) == null ? void 0 : s.querySelectorAll("table");
863
- 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
- if (m instanceof HTMLTableElement) {
865
- m.style.width = "100%", m.style.minWidth = "100%", m.style.tableLayout = "auto";
866
- const T = m.closest(".markdown-table-mode");
867
- T && T instanceof HTMLElement && (T.style.width = "100%", T.style.overflowX = "auto"), console.log(`\u8868\u683C ${_ + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
850
+ console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", l.length || 0), typeof l == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", l.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", l.substring(l.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof l), console.log("\u5185\u5BB9\u503C:", l)), console.log("\u6807\u6CE8\u6570\u636E:", T), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", _);
851
+ }, [T, _, o]), te(() => {
852
+ if (o && a.current) {
853
+ const d = setTimeout(() => {
854
+ var l;
855
+ const E = (l = a.current) == null ? void 0 : l.querySelectorAll("table");
856
+ E && E.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", E.length), E.forEach((w, k) => {
857
+ if (w instanceof HTMLTableElement) {
858
+ w.style.width = "100%", w.style.minWidth = "100%", w.style.tableLayout = "auto";
859
+ const S = w.closest(".markdown-table-mode");
860
+ S && S instanceof HTMLElement && (S.style.width = "100%", S.style.overflowX = "auto"), console.log(`\u8868\u683C ${k + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
868
861
  }
869
862
  }));
870
863
  }, 500);
871
- return () => clearTimeout(i);
864
+ return () => clearTimeout(d);
872
865
  }
873
866
  }, [o, e.content]), te(() => () => {
874
- D.current && clearTimeout(D.current), C.current && (C.current.disconnect(), C.current = null);
867
+ B.current && clearTimeout(B.current), y.current && (y.current.disconnect(), y.current = null);
875
868
  }, []), /* @__PURE__ */ n.createElement(
876
869
  "div",
877
870
  {
@@ -883,27 +876,27 @@ const $e = {
883
876
  },
884
877
  className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
885
878
  },
886
- /* @__PURE__ */ n.createElement("style", null, ze),
887
- /* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
879
+ /* @__PURE__ */ n.createElement("style", null, Le),
880
+ /* @__PURE__ */ n.createElement("div", { ref: a }, /* @__PURE__ */ n.createElement(
888
881
  we,
889
882
  {
890
883
  dataSource: {
891
- type: ve.MARKDOWN,
884
+ type: ye.MARKDOWN,
892
885
  content: (() => {
893
- var i, s;
894
- return typeof e.content == "string" ? e.content : (i = e.content) != null && i.text ? e.content.text : (s = e.content) != null && s.content ? e.content.content : "";
886
+ var d, l;
887
+ return typeof e.content == "string" ? e.content : (d = e.content) != null && d.text ? e.content.text : (l = e.content) != null && l.content ? e.content.content : "";
895
888
  })()
896
889
  },
897
890
  size: "md",
898
- onScroll: o ? void 0 : c,
899
- onScrollToTop: o ? void 0 : x,
891
+ onScroll: o ? void 0 : i,
892
+ onScrollToTop: o ? void 0 : b,
900
893
  onScrollToBottom: o ? void 0 : h,
901
- onRendered: O,
894
+ onRendered: q,
902
895
  theme: {
903
- primaryColor: ((d = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : d.primary) || "#007bff",
904
- 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 = (w = (F = t.styles) == null ? void 0 : F.theme) == null ? void 0 : w.colors) == null ? void 0 : b.text) || "#343a40",
906
- borderColor: ((a = (B = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : B.colors) == null ? void 0 : a.border) || "#dee2e6",
896
+ primaryColor: ((c = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : c.primary) || "#007bff",
897
+ backgroundColor: ((m = (g = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : g.colors) == null ? void 0 : m.background) || "#f8f9fa",
898
+ textColor: ((x = (C = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : C.colors) == null ? void 0 : x.text) || "#343a40",
899
+ borderColor: ((s = (D = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : D.colors) == null ? void 0 : s.border) || "#dee2e6",
907
900
  borderRadius: o ? "0px" : "8px",
908
901
  padding: o ? "0px" : "20px"
909
902
  },
@@ -916,66 +909,65 @@ const $e = {
916
909
  }
917
910
  ))
918
911
  );
919
- }, He = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
920
- const u = X(null), r = (f) => {
921
- const g = f.split(/\r?\n/).filter((a) => a.trim().length > 0);
922
- let F = -1;
923
- for (let a = 0; a < g.length - 1; a++) {
924
- const l = g[a].trim(), D = g[a + 1].trim();
925
- if (l.startsWith("|") && l.endsWith("|") && D.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
926
- F = a;
912
+ }, Oe = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
913
+ const u = H(null), r = (g) => {
914
+ const m = g.split(/\r?\n/).filter((s) => s.trim().length > 0);
915
+ let f = -1;
916
+ for (let s = 0; s < m.length - 1; s++) {
917
+ const a = m[s].trim(), B = m[s + 1].trim();
918
+ if (a.startsWith("|") && a.endsWith("|") && B.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
919
+ f = s;
927
920
  break;
928
921
  }
929
922
  }
930
- if (F === -1) return null;
931
- const b = g[F].split("|").slice(1, -1).map((a) => a.trim()), v = [];
932
- for (let a = F + 2; a < g.length; a++) {
933
- const l = g[a].trim();
934
- if (!l.startsWith("|") || !l.endsWith("|")) break;
935
- v.push(l);
923
+ if (f === -1) return null;
924
+ const x = m[f].split("|").slice(1, -1).map((s) => s.trim()), v = [];
925
+ for (let s = f + 2; s < m.length; s++) {
926
+ const a = m[s].trim();
927
+ if (!a.startsWith("|") || !a.endsWith("|")) break;
928
+ v.push(a);
936
929
  }
937
- const B = v.map((a) => a.split("|").slice(1, -1).map((l) => l.trim()));
938
- return { headers: b, rows: B };
939
- }, d = n.useMemo(() => r(e), [e]);
930
+ const D = v.map((s) => s.split("|").slice(1, -1).map((a) => a.trim()));
931
+ return { headers: x, rows: D };
932
+ }, c = n.useMemo(() => r(e), [e]);
940
933
  return te(() => {
941
- const f = () => {
934
+ const g = () => {
942
935
  try {
943
- if (!u.current || !o.length) return;
944
- const F = u.current.querySelectorAll("table");
945
- if (!F || F.length === 0) return;
946
- o.forEach((w, b) => {
947
- (w.offsets || []).forEach((B, a) => {
948
- const [l, D] = B;
949
- F.forEach((C) => {
950
- var q, N, c;
951
- const x = C.tBodies && C.tBodies.length > 0 ? Array.from(C.tBodies[0].rows) : [];
952
- let h;
953
- if (x.length > 0)
954
- h = x[l];
955
- else {
956
- const A = ((N = (q = C.tHead) == null ? void 0 : q.rows) == null ? void 0 : N.length) || 0;
957
- h = Array.from(C.rows)[l + A];
958
- }
959
- if (!h) return;
960
- const k = (c = h.cells) == null ? void 0 : c[D];
961
- if (!k) return;
962
- const O = w.color || "rgba(255, 229, 153, 0.5)";
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"), w.content && (k.title = w.content)), b === 0 && a === 0 && setTimeout(() => k.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
936
+ if (!u.current) return;
937
+ const f = u.current.querySelectorAll("table");
938
+ if (f.forEach((C) => {
939
+ Array.from(C.rows).forEach((v) => {
940
+ Array.from(v.cells).forEach((D) => {
941
+ D.getAttribute("data-table-annotated") === "1" && (D.style.removeProperty("background"), D.style.removeProperty("background-color"), D.removeAttribute("data-table-annotated"), D.removeAttribute("title"));
942
+ });
943
+ });
944
+ }), !o.length || !f || f.length === 0) return;
945
+ o.forEach((C, x) => {
946
+ (C.offsets || []).forEach((D, s) => {
947
+ const [a, B] = D;
948
+ f.forEach((y) => {
949
+ var Z;
950
+ const i = Array.from(y.rows)[a];
951
+ if (!i) return;
952
+ const b = (Z = i.cells) == null ? void 0 : Z[B];
953
+ if (!b) return;
954
+ const h = C.color || "rgba(255, 229, 153, 0.5)";
955
+ b.getAttribute("data-table-annotated") === "1" || (b.style.setProperty("background", h, "important"), b.style.setProperty("background-color", h, "important"), b.setAttribute("data-table-annotated", "1"), C.content && (b.title = C.content)), x === 0 && s === 0 && setTimeout(() => b.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
964
956
  });
965
957
  });
966
958
  });
967
- } catch (F) {
968
- console.warn("[MinimalMarkdownTable] apply annotations failed", F);
959
+ } catch (f) {
960
+ console.warn("[MinimalMarkdownTable] apply annotations failed", f);
969
961
  }
970
- }, g = requestAnimationFrame(() => {
971
- f(), t && t();
962
+ }, m = requestAnimationFrame(() => {
963
+ g(), t && t();
972
964
  });
973
- return () => cancelAnimationFrame(g);
974
- }, [e, o, t]), d ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
965
+ return () => cancelAnimationFrame(m);
966
+ }, [e, o, t]), c ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
975
967
  .z-mdtbl-wrapper { overflow: auto; position: relative; }
976
968
  .z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
977
969
  .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
978
- .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
970
+ .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; }
979
971
  .z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
980
972
  .z-mdtbl tbody tr:hover { background: transparent; }
981
973
  .z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
@@ -983,8 +975,8 @@ const $e = {
983
975
  .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
984
976
  .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
985
977
  .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((F, w) => /* @__PURE__ */ n.createElement("td", { key: w }, F))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
987
- }, Ze = (e, t) => {
978
+ `), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, c.headers.map((g, m) => /* @__PURE__ */ n.createElement("th", { key: m }, g)))), /* @__PURE__ */ n.createElement("tbody", null, c.rows.map((g, m) => /* @__PURE__ */ n.createElement("tr", { key: m }, g.map((f, C) => /* @__PURE__ */ n.createElement("td", { key: C }, f))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
979
+ }, He = (e, t) => {
988
980
  var o, u;
989
981
  console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
990
982
  let r = "";
@@ -1006,105 +998,105 @@ const $e = {
1006
998
  sandbox: "allow-same-origin allow-scripts"
1007
999
  }
1008
1000
  ));
1009
- }, Xe = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
1001
+ }, Ze = (e, t) => /* @__PURE__ */ n.createElement("div", { style: {
1010
1002
  display: "flex",
1011
1003
  justifyContent: "center",
1012
1004
  alignItems: "center",
1013
1005
  height: "100%",
1014
1006
  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"))), qe = ({
1007
+ } }, /* @__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"))), Xe = ({
1016
1008
  data: e,
1017
1009
  annotationData: t = [],
1018
1010
  totalPage: o = 0,
1019
1011
  currentPage: u = 1,
1020
1012
  scale: r,
1021
1013
  // 重命名避免冲突
1022
- rotation: d = 0,
1014
+ rotation: c = 0,
1023
1015
  // 添加rotation参数
1024
1016
  eventsEmit: p,
1025
- styles: f,
1026
- tools: g = {
1017
+ styles: g,
1018
+ tools: m = {
1027
1019
  annotation: !0,
1028
1020
  download: !0,
1029
1021
  zoom: !0,
1030
1022
  close: !0,
1031
1023
  navigation: !0
1032
1024
  },
1033
- customComponents: F,
1034
- className: w,
1035
- contentClass: b
1025
+ customComponents: f,
1026
+ className: C,
1027
+ contentClass: x
1036
1028
  }) => {
1037
- var v, B, a, l;
1038
- const D = (f == null ? void 0 : f.theme) || Se, [C, q] = R(!1), [N] = R("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [c, x] = R(null);
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:", (v = e == null ? void 0 : e.content) == null ? void 0 : v.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
- const h = X(null), k = X(null), O = X(0);
1041
- O.current += 1, console.log("[Fviewer] render count:", O.current);
1042
- const L = Me(e);
1043
- console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", L), console.log("\u5B8C\u6574\u6570\u636E:", e);
1044
- const A = () => {
1045
- var P;
1046
- switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", L), L) {
1029
+ var v, D, s, a;
1030
+ const B = (g == null ? void 0 : g.theme) || ze, [y, Z] = P(!1), [z] = P("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [i, b] = P(null);
1031
+ 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:", (v = e == null ? void 0 : e.content) == null ? void 0 : v.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((D = e == null ? void 0 : e.content) == null ? void 0 : D.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((s = e == null ? void 0 : e.content) == null ? void 0 : s.document) === null), console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:", ((a = e == null ? void 0 : e.content) == null ? void 0 : a.document) === void 0), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", r);
1032
+ const h = H(null), j = H(null), q = H(0);
1033
+ q.current += 1, console.log("[Fviewer] render count:", q.current);
1034
+ const R = Se(e);
1035
+ console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", R), console.log("\u5B8C\u6574\u6570\u636E:", e);
1036
+ const T = () => {
1037
+ var _;
1038
+ switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", R), R) {
1047
1039
  case "pdf":
1048
1040
  case "pdf_slides":
1049
- return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", L, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), We(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: f, tools: g, className: w, contentClass: b }, L === "pdf_slides");
1041
+ return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:", R, "pdfStartPage:" + e.pdfStartPage, "currentPage:" + u), Me(e, { data: e, annotationData: t, totalPage: o, currentPage: u, scale: r, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x }, R === "pdf_slides");
1050
1042
  case "image":
1051
- return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, { scale: r, rotation: d, styles: f });
1043
+ return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), We(e, { scale: r, rotation: c, styles: g });
1052
1044
  case "text":
1053
- return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), je(e, { scale: r, styles: f });
1045
+ return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), Ie(e, { scale: r, styles: g });
1054
1046
  case "markdown":
1055
1047
  case "markdown_table":
1056
- if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", L), L === "markdown_table") {
1057
- const V = typeof e.content == "string" ? e.content : ((P = e.content) == null ? void 0 : P.content) || "", ee = (t || []).filter(
1058
- (J) => "offsets" in J && Array.isArray(J.offsets)
1048
+ if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", R), R === "markdown_table") {
1049
+ const V = typeof e.content == "string" ? e.content : ((_ = e.content) == null ? void 0 : _.content) || "", Q = (t || []).filter(
1050
+ (K) => "offsets" in K && Array.isArray(K.offsets)
1059
1051
  );
1060
1052
  return /* @__PURE__ */ n.createElement(
1061
- He,
1053
+ Oe,
1062
1054
  {
1063
1055
  markdown: V,
1064
- tableAnnotations: ee
1056
+ tableAnnotations: Q
1065
1057
  }
1066
1058
  );
1067
1059
  }
1068
1060
  return /* @__PURE__ */ n.createElement(
1069
- Oe,
1061
+ je,
1070
1062
  {
1071
1063
  data: e,
1072
- parentProps: { data: e, annotationData: t, eventsEmit: p, styles: f, tools: g, className: w, contentClass: b },
1064
+ parentProps: { data: e, annotationData: t, eventsEmit: p, styles: g, tools: m, className: C, contentClass: x },
1073
1065
  isTableMode: !1
1074
1066
  }
1075
1067
  );
1076
1068
  case "html":
1077
- return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), Ze(e);
1069
+ return console.log("\u6E32\u67D3HTML\u5185\u5BB9"), He(e);
1078
1070
  default:
1079
- return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), Xe(e);
1071
+ return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"), Ze(e);
1080
1072
  }
1081
1073
  };
1082
1074
  return n.useEffect(() => {
1083
- const P = h.current, V = k.current, ee = P !== e, J = V !== (e ? e.content : void 0);
1075
+ const _ = h.current, V = j.current, Q = _ !== e, K = V !== (e ? e.content : void 0);
1084
1076
  console.log("[Fviewer useEffect:data] triggered", {
1085
- dataChanged: ee,
1086
- contentChanged: J,
1077
+ dataChanged: Q,
1078
+ contentChanged: K,
1087
1079
  hasData: !!e,
1088
1080
  hasContent: !!(e != null && e.content),
1089
- isLoadingBefore: C
1090
- }), h.current = e, k.current = e ? e.content : void 0;
1081
+ isLoadingBefore: y
1082
+ }), h.current = e, j.current = e ? e.content : void 0;
1091
1083
  }, [e == null ? void 0 : e.content]), n.useEffect(() => {
1092
- c && q(!1);
1093
- }, [c]), n.useEffect(() => {
1094
- 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(Re, { $theme: D, className: b }, C ? F != null && F.LoadingComponent ? /* @__PURE__ */ n.createElement(
1096
- F.LoadingComponent,
1084
+ i && Z(!1);
1085
+ }, [i]), n.useEffect(() => {
1086
+ 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:", R);
1087
+ }, [t, R]), /* @__PURE__ */ n.createElement(_e, { $theme: B, className: x }, y ? f != null && f.LoadingComponent ? /* @__PURE__ */ n.createElement(
1088
+ f.LoadingComponent,
1097
1089
  {
1098
- status: N,
1099
- theme: D
1090
+ status: z,
1091
+ theme: B
1100
1092
  }
1101
- ) : /* @__PURE__ */ n.createElement(Ne, { $theme: D }, N) : c ? F != null && F.ErrorComponent ? /* @__PURE__ */ n.createElement(
1102
- F.ErrorComponent,
1093
+ ) : /* @__PURE__ */ n.createElement(Re, { $theme: B }, z) : i ? f != null && f.ErrorComponent ? /* @__PURE__ */ n.createElement(
1094
+ f.ErrorComponent,
1103
1095
  {
1104
- error: c,
1105
- theme: D
1096
+ error: i,
1097
+ theme: B
1106
1098
  }
1107
- ) : /* @__PURE__ */ n.createElement(Le, { $theme: D }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, c)) : A());
1099
+ ) : /* @__PURE__ */ n.createElement(Ne, { $theme: B }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, i)) : T());
1108
1100
  };
1109
1101
  /**
1110
1102
  * @license lucide-react v0.456.0 - ISC
@@ -1112,14 +1104,14 @@ const $e = {
1112
1104
  * This source code is licensed under the ISC license.
1113
1105
  * See the LICENSE file in the root directory of this source tree.
1114
1106
  */
1115
- const Ue = (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();
1107
+ const qe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (...e) => e.filter((t, o, u) => !!t && t.trim() !== "" && u.indexOf(t) === o).join(" ").trim();
1116
1108
  /**
1117
1109
  * @license lucide-react v0.456.0 - ISC
1118
1110
  *
1119
1111
  * This source code is licensed under the ISC license.
1120
1112
  * See the LICENSE file in the root directory of this source tree.
1121
1113
  */
1122
- var Ye = {
1114
+ var Ue = {
1123
1115
  xmlns: "http://www.w3.org/2000/svg",
1124
1116
  width: 24,
1125
1117
  height: 24,
@@ -1136,31 +1128,31 @@ var Ye = {
1136
1128
  * This source code is licensed under the ISC license.
1137
1129
  * See the LICENSE file in the root directory of this source tree.
1138
1130
  */
1139
- const Ge = Ce(
1131
+ const Ye = ve(
1140
1132
  ({
1141
1133
  color: e = "currentColor",
1142
1134
  size: t = 24,
1143
1135
  strokeWidth: o = 2,
1144
1136
  absoluteStrokeWidth: u,
1145
1137
  className: r = "",
1146
- children: d,
1138
+ children: c,
1147
1139
  iconNode: p,
1148
- ...f
1149
- }, g) => Fe(
1140
+ ...g
1141
+ }, m) => Ee(
1150
1142
  "svg",
1151
1143
  {
1152
- ref: g,
1153
- ...Ye,
1144
+ ref: m,
1145
+ ...Ue,
1154
1146
  width: t,
1155
1147
  height: t,
1156
1148
  stroke: e,
1157
1149
  strokeWidth: u ? Number(o) * 24 / Number(t) : o,
1158
- className: ye("lucide", r),
1159
- ...f
1150
+ className: be("lucide", r),
1151
+ ...g
1160
1152
  },
1161
1153
  [
1162
- ...p.map(([F, w]) => Fe(F, w)),
1163
- ...Array.isArray(d) ? d : [d]
1154
+ ...p.map(([f, C]) => Ee(f, C)),
1155
+ ...Array.isArray(c) ? c : [c]
1164
1156
  ]
1165
1157
  )
1166
1158
  );
@@ -1171,11 +1163,11 @@ const Ge = Ce(
1171
1163
  * See the LICENSE file in the root directory of this source tree.
1172
1164
  */
1173
1165
  const ue = (e, t) => {
1174
- const o = Ce(
1175
- ({ className: u, ...r }, d) => Fe(Ge, {
1176
- ref: d,
1166
+ const o = ve(
1167
+ ({ className: u, ...r }, c) => Ee(Ye, {
1168
+ ref: c,
1177
1169
  iconNode: t,
1178
- className: ye(`lucide-${Ue(e)}`, u),
1170
+ className: be(`lucide-${qe(e)}`, u),
1179
1171
  ...r
1180
1172
  })
1181
1173
  );
@@ -1187,7 +1179,7 @@ const ue = (e, t) => {
1187
1179
  * This source code is licensed under the ISC license.
1188
1180
  * See the LICENSE file in the root directory of this source tree.
1189
1181
  */
1190
- const Ve = ue("ChevronLeft", [
1182
+ const Ge = ue("ChevronLeft", [
1191
1183
  ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
1192
1184
  ]);
1193
1185
  /**
@@ -1196,7 +1188,7 @@ const Ve = ue("ChevronLeft", [
1196
1188
  * This source code is licensed under the ISC license.
1197
1189
  * See the LICENSE file in the root directory of this source tree.
1198
1190
  */
1199
- const Je = ue("ChevronRight", [
1191
+ const Ve = ue("ChevronRight", [
1200
1192
  ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
1201
1193
  ]);
1202
1194
  /**
@@ -1205,7 +1197,7 @@ const Je = ue("ChevronRight", [
1205
1197
  * This source code is licensed under the ISC license.
1206
1198
  * See the LICENSE file in the root directory of this source tree.
1207
1199
  */
1208
- const Ke = ue("Download", [
1200
+ const Je = ue("Download", [
1209
1201
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
1210
1202
  ["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
1211
1203
  ["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
@@ -1216,7 +1208,7 @@ const Ke = ue("Download", [
1216
1208
  * This source code is licensed under the ISC license.
1217
1209
  * See the LICENSE file in the root directory of this source tree.
1218
1210
  */
1219
- const Qe = ue("Pencil", [
1211
+ const Ke = ue("Pencil", [
1220
1212
  [
1221
1213
  "path",
1222
1214
  {
@@ -1232,7 +1224,7 @@ const Qe = ue("Pencil", [
1232
1224
  * This source code is licensed under the ISC license.
1233
1225
  * See the LICENSE file in the root directory of this source tree.
1234
1226
  */
1235
- const et = ue("RotateCcw", [
1227
+ const Qe = ue("RotateCcw", [
1236
1228
  ["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
1229
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1238
1230
  ]);
@@ -1242,7 +1234,7 @@ const et = ue("RotateCcw", [
1242
1234
  * This source code is licensed under the ISC license.
1243
1235
  * See the LICENSE file in the root directory of this source tree.
1244
1236
  */
1245
- const tt = ue("RotateCw", [
1237
+ const et = ue("RotateCw", [
1246
1238
  ["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
1247
1239
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }]
1248
1240
  ]);
@@ -1252,7 +1244,7 @@ const tt = ue("RotateCw", [
1252
1244
  * This source code is licensed under the ISC license.
1253
1245
  * See the LICENSE file in the root directory of this source tree.
1254
1246
  */
1255
- const ot = ue("X", [
1247
+ const tt = ue("X", [
1256
1248
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1257
1249
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1258
1250
  ]);
@@ -1262,7 +1254,7 @@ const ot = ue("X", [
1262
1254
  * This source code is licensed under the ISC license.
1263
1255
  * See the LICENSE file in the root directory of this source tree.
1264
1256
  */
1265
- const nt = ue("ZoomIn", [
1257
+ const ot = ue("ZoomIn", [
1266
1258
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1267
1259
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1268
1260
  ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
@@ -1274,11 +1266,11 @@ const nt = ue("ZoomIn", [
1274
1266
  * This source code is licensed under the ISC license.
1275
1267
  * See the LICENSE file in the root directory of this source tree.
1276
1268
  */
1277
- const ut = ue("ZoomOut", [
1269
+ const nt = ue("ZoomOut", [
1278
1270
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
1279
1271
  ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
1280
1272
  ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
1281
- ]), rt = G.div`
1273
+ ]), ut = G.div`
1282
1274
  display: flex;
1283
1275
  align-items: center;
1284
1276
  padding: 0px 12px;
@@ -1287,24 +1279,24 @@ const ut = ue("ZoomOut", [
1287
1279
  border-bottom: 1px solid ${(e) => e.$theme.colors.border};
1288
1280
  background: ${(e) => e.$theme.colors.background};
1289
1281
  min-height: 52px;
1290
- `, lt = G.div`
1282
+ `, rt = G.div`
1291
1283
  display: flex;
1292
1284
  align-items: center;
1293
1285
  gap: 8px;
1294
1286
  flex: 1;
1295
1287
  min-width: 0;
1296
- `, it = G.div`
1288
+ `, lt = G.div`
1297
1289
  font-size: 14px;
1298
1290
  font-weight: 500;
1299
1291
  color: ${(e) => e.$theme.colors.text};
1300
1292
  white-space: nowrap;
1301
1293
  overflow: hidden;
1302
1294
  text-overflow: ellipsis;
1303
- `, st = G.div`
1295
+ `, at = G.div`
1304
1296
  font-size: 12px;
1305
1297
  color: ${(e) => e.$theme.colors.disabledText};
1306
1298
  white-space: nowrap;
1307
- `, at = G.div`
1299
+ `, st = G.div`
1308
1300
  display: flex;
1309
1301
  align-items: center;
1310
1302
  gap: 4px;
@@ -1336,12 +1328,12 @@ const ut = ue("ZoomOut", [
1336
1328
  opacity: 0.5;
1337
1329
  cursor: not-allowed;
1338
1330
  }
1339
- `, ct = G.div`
1331
+ `, it = G.div`
1340
1332
  font-size: 12px;
1341
1333
  color: ${(e) => e.$theme.colors.disabledText};
1342
1334
  min-width: 40px;
1343
1335
  text-align: center;
1344
- `, dt = {
1336
+ `, ct = {
1345
1337
  colors: {
1346
1338
  primary: "#007bff",
1347
1339
  secondary: "#6c757d",
@@ -1378,100 +1370,100 @@ const ut = ue("ZoomOut", [
1378
1370
  rotate: !0
1379
1371
  },
1380
1372
  styles: r,
1381
- onPrevPage: d,
1373
+ onPrevPage: c,
1382
1374
  onNextPage: p,
1383
- onZoomIn: f,
1384
- onZoomOut: g,
1385
- onAnnotationToggle: F,
1386
- onDownload: w,
1387
- onRotateLeft: b,
1375
+ onZoomIn: g,
1376
+ onZoomOut: m,
1377
+ onAnnotationToggle: f,
1378
+ onDownload: C,
1379
+ onRotateLeft: x,
1388
1380
  onRotateRight: v,
1389
- onClose: B,
1390
- scale: a = 1,
1391
- isAnnotating: l = !1,
1392
- className: D
1381
+ onClose: D,
1382
+ scale: s = 1,
1383
+ isAnnotating: a = !1,
1384
+ className: B
1393
1385
  }) => {
1394
- const C = (r == null ? void 0 : r.theme) || dt;
1395
- return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(rt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(lt, { $theme: C }, /* @__PURE__ */ n.createElement(it, { $theme: C }, e)), /* @__PURE__ */ n.createElement(at, { $theme: C }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1386
+ const y = (r == null ? void 0 : r.theme) || ct;
1387
+ return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(ut, { $theme: y, className: B }, /* @__PURE__ */ n.createElement(rt, { $theme: y }, /* @__PURE__ */ n.createElement(lt, { $theme: y }, e)), /* @__PURE__ */ n.createElement(st, { $theme: y }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1396
1388
  ne,
1397
1389
  {
1398
- $theme: C,
1399
- onClick: d,
1390
+ $theme: y,
1391
+ onClick: c,
1400
1392
  disabled: t <= 1,
1401
1393
  title: "\u4E0A\u4E00\u9875"
1402
1394
  },
1403
- /* @__PURE__ */ n.createElement(Ve, { size: 16 })
1404
- ), o > 0 && /* @__PURE__ */ n.createElement(st, { $theme: C }, t, " / ", o), /* @__PURE__ */ n.createElement(
1395
+ /* @__PURE__ */ n.createElement(Ge, { size: 16 })
1396
+ ), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: y }, t, " / ", o), /* @__PURE__ */ n.createElement(
1405
1397
  ne,
1406
1398
  {
1407
- $theme: C,
1399
+ $theme: y,
1408
1400
  onClick: p,
1409
1401
  disabled: !o || t >= o,
1410
1402
  title: "\u4E0B\u4E00\u9875"
1411
1403
  },
1412
- /* @__PURE__ */ n.createElement(Je, { size: 16 })
1404
+ /* @__PURE__ */ n.createElement(Ve, { size: 16 })
1413
1405
  )), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1414
1406
  ne,
1415
1407
  {
1416
- $theme: C,
1417
- onClick: g,
1418
- disabled: a <= 0.3,
1408
+ $theme: y,
1409
+ onClick: m,
1410
+ disabled: s <= 0.3,
1419
1411
  title: "\u7F29\u5C0F"
1420
1412
  },
1421
- /* @__PURE__ */ n.createElement(ut, { size: 16 })
1422
- ), /* @__PURE__ */ n.createElement(ct, { $theme: C }, Math.round(a * 100), "%"), /* @__PURE__ */ n.createElement(
1413
+ /* @__PURE__ */ n.createElement(nt, { size: 16 })
1414
+ ), /* @__PURE__ */ n.createElement(it, { $theme: y }, Math.round(s * 100), "%"), /* @__PURE__ */ n.createElement(
1423
1415
  ne,
1424
1416
  {
1425
- $theme: C,
1426
- onClick: f,
1427
- disabled: a >= 3,
1417
+ $theme: y,
1418
+ onClick: g,
1419
+ disabled: s >= 3,
1428
1420
  title: "\u653E\u5927"
1429
1421
  },
1430
- /* @__PURE__ */ n.createElement(nt, { size: 16 })
1422
+ /* @__PURE__ */ n.createElement(ot, { size: 16 })
1431
1423
  )), u.annotation && /* @__PURE__ */ n.createElement(
1432
1424
  ne,
1433
1425
  {
1434
- $theme: C,
1435
- $active: l,
1436
- onClick: F,
1437
- title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1426
+ $theme: y,
1427
+ $active: a,
1428
+ onClick: f,
1429
+ title: a ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
1438
1430
  },
1439
- /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1431
+ /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1440
1432
  ), u.download && /* @__PURE__ */ n.createElement(
1441
1433
  ne,
1442
1434
  {
1443
- $theme: C,
1444
- onClick: w,
1435
+ $theme: y,
1436
+ onClick: C,
1445
1437
  title: "\u4E0B\u8F7D"
1446
1438
  },
1447
- /* @__PURE__ */ n.createElement(Ke, { size: 16 })
1439
+ /* @__PURE__ */ n.createElement(Je, { size: 16 })
1448
1440
  ), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
1449
1441
  ne,
1450
1442
  {
1451
- $theme: C,
1452
- onClick: b,
1443
+ $theme: y,
1444
+ onClick: x,
1453
1445
  title: "\u5411\u5DE6\u65CB\u8F6C"
1454
1446
  },
1455
- /* @__PURE__ */ n.createElement(et, { size: 16 })
1447
+ /* @__PURE__ */ n.createElement(Qe, { size: 16 })
1456
1448
  ), /* @__PURE__ */ n.createElement(
1457
1449
  ne,
1458
1450
  {
1459
- $theme: C,
1451
+ $theme: y,
1460
1452
  onClick: v,
1461
1453
  title: "\u5411\u53F3\u65CB\u8F6C"
1462
1454
  },
1463
- /* @__PURE__ */ n.createElement(tt, { size: 16 })
1455
+ /* @__PURE__ */ n.createElement(et, { size: 16 })
1464
1456
  )), u.close && /* @__PURE__ */ n.createElement(
1465
1457
  ne,
1466
1458
  {
1467
- $theme: C,
1468
- onClick: B,
1459
+ $theme: y,
1460
+ onClick: D,
1469
1461
  title: "\u5173\u95ED"
1470
1462
  },
1471
- /* @__PURE__ */ n.createElement(ot, { size: 16 })
1463
+ /* @__PURE__ */ n.createElement(tt, { size: 16 })
1472
1464
  )));
1473
- }), mt = () => {
1474
- if (xe()) {
1465
+ }), dt = () => {
1466
+ if (vt()) {
1475
1467
  console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");
1476
1468
  return;
1477
1469
  }
@@ -1480,28 +1472,28 @@ const ut = ue("ZoomOut", [
1480
1472
  registerPDFWorker("/worker/pdf.worker.min.js");
1481
1473
  \u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;
1482
1474
  throw console.error(e), new Error(e);
1483
- }, be = (e, t, o) => {
1475
+ }, xe = (e, t, o) => {
1484
1476
  if (!e && !t && !o) return "unknown";
1485
1477
  const u = e || "", r = t || "";
1486
1478
  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
- }, gt = async (e, t = {}) => {
1479
+ }, mt = async (e, t = {}) => {
1488
1480
  console.log("=== parsePdfFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
1489
1481
  try {
1490
- mt();
1482
+ dt();
1491
1483
  let o;
1492
1484
  if (typeof e == "string") {
1493
1485
  console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
1494
- const d = re.getDocument({
1486
+ const c = re.getDocument({
1495
1487
  url: e,
1496
1488
  httpHeaders: t.token ? { Authorization: t.token } : void 0
1497
1489
  });
1498
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(d))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(d)), o = await d.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o), console.log("PDF\u6587\u6863\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(o))), console.log("PDF\u6587\u6863\u5C5E\u6027:", Object.keys(o));
1490
+ console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(c))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(c)), o = await c.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o), console.log("PDF\u6587\u6863\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(o))), console.log("PDF\u6587\u6863\u5C5E\u6027:", Object.keys(o));
1499
1491
  } else {
1500
1492
  console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
1501
- const d = re.getDocument({
1493
+ const c = re.getDocument({
1502
1494
  data: e
1503
1495
  });
1504
- console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", d), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof d), o = await d.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o);
1496
+ console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", c), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof c), o = await c.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o);
1505
1497
  }
1506
1498
  const u = o.numPages;
1507
1499
  console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:", u), console.log("PDF\u6307\u7EB9:", o.fingerprints), console.log("PDF\u4F20\u8F93\u5BF9\u8C61:", o._transport);
@@ -1526,7 +1518,7 @@ const ut = ue("ZoomOut", [
1526
1518
  options: t
1527
1519
  });
1528
1520
  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\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u91CD\u8BD5" : u = `PDF\u89E3\u6790\u5931\u8D25: ${o.message}`), {
1521
+ 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
1522
  type: "pdf",
1531
1523
  content: null,
1532
1524
  fileName: t.fileName,
@@ -1534,7 +1526,7 @@ const ut = ue("ZoomOut", [
1534
1526
  error: u
1535
1527
  };
1536
1528
  }
1537
- }, ft = async (e, t = {}) => {
1529
+ }, gt = async (e, t = {}) => {
1538
1530
  console.log("=== parseImageFile \u5F00\u59CB ==="), console.log("\u8F93\u5165\u6570\u636E:", { data: typeof e, options: t });
1539
1531
  try {
1540
1532
  let o;
@@ -1545,20 +1537,20 @@ const ut = ue("ZoomOut", [
1545
1537
  const r = new Blob([e]);
1546
1538
  o = URL.createObjectURL(r);
1547
1539
  }
1548
- console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, d) => {
1540
+ console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, c) => {
1549
1541
  const p = new Image();
1550
1542
  p.onload = () => {
1551
1543
  console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1552
1544
  }, p.onerror = () => {
1553
- console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), d(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1545
+ console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1554
1546
  };
1555
- const f = setTimeout(() => {
1556
- d(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1547
+ const g = setTimeout(() => {
1548
+ c(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
1557
1549
  }, 1e4);
1558
1550
  p.onload = () => {
1559
- clearTimeout(f), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1551
+ clearTimeout(g), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", p.width, "x", p.height), r();
1560
1552
  }, p.onerror = () => {
1561
- clearTimeout(f), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), d(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1553
+ clearTimeout(g), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), c(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
1562
1554
  }, p.src = o;
1563
1555
  });
1564
1556
  const u = {
@@ -1580,7 +1572,7 @@ const ut = ue("ZoomOut", [
1580
1572
  error: `\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1581
1573
  };
1582
1574
  }
1583
- }, Et = async (e, t = {}) => {
1575
+ }, ft = async (e, t = {}) => {
1584
1576
  try {
1585
1577
  let o;
1586
1578
  if (typeof e == "string") {
@@ -1610,7 +1602,7 @@ const ut = ue("ZoomOut", [
1610
1602
  error: `\u6587\u672C\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1611
1603
  };
1612
1604
  }
1613
- }, Ft = async (e, t = {}) => {
1605
+ }, Et = async (e, t = {}) => {
1614
1606
  try {
1615
1607
  let o;
1616
1608
  if (typeof e == "string") {
@@ -1673,17 +1665,17 @@ const ut = ue("ZoomOut", [
1673
1665
  error: `HTML\u89E3\u6790\u5931\u8D25: ${o instanceof Error ? o.message : "\u672A\u77E5\u9519\u8BEF"}`
1674
1666
  };
1675
1667
  }
1676
- }, pt = async (e, t = {}) => {
1677
- switch (be(t.fileName, t.fileType)) {
1668
+ }, Ft = async (e, t = {}) => {
1669
+ switch (xe(t.fileName, t.fileType)) {
1678
1670
  case "pdf":
1679
- return await gt(e, t);
1671
+ return await mt(e, t);
1680
1672
  case "image":
1681
- return await ft(e, t);
1673
+ return await gt(e, t);
1682
1674
  case "text":
1683
- return await Et(e, t);
1675
+ return await ft(e, t);
1684
1676
  case "markdown":
1685
1677
  case "markdown_table":
1686
- return await Ft(e, t);
1678
+ return await Et(e, t);
1687
1679
  case "html":
1688
1680
  return await ht(e, t);
1689
1681
  default:
@@ -1705,7 +1697,7 @@ const ut = ue("ZoomOut", [
1705
1697
  border-radius: ${(e) => e.$theme.space.radius};
1706
1698
  overflow: hidden;
1707
1699
  min-height: 0; /* 确保flex子元素可以收缩 */
1708
- `, Ct = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
1700
+ `, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement("div", { style: {
1709
1701
  display: "flex",
1710
1702
  flexDirection: "column",
1711
1703
  alignItems: "center",
@@ -1795,7 +1787,7 @@ G.div`
1795
1787
  color: ${(e) => e.$theme.colors.disabledText};
1796
1788
  font-size: 14px;
1797
1789
  `;
1798
- const pe = G.div`
1790
+ const Ce = G.div`
1799
1791
  display: flex;
1800
1792
  flex-direction: column;
1801
1793
  align-items: center;
@@ -1804,7 +1796,7 @@ const pe = G.div`
1804
1796
  color: ${(e) => e.$theme.colors.error};
1805
1797
  text-align: center;
1806
1798
  padding: 20px;
1807
- `, wt = {
1799
+ `, Ct = {
1808
1800
  colors: {
1809
1801
  primary: "#007bff",
1810
1802
  secondary: "#6c757d",
@@ -1828,36 +1820,36 @@ const pe = G.div`
1828
1820
  shadow: "md",
1829
1821
  lineHeight: "md"
1830
1822
  }
1831
- }, Bt = ({
1823
+ }, xt = ({
1832
1824
  fileUrl: e,
1833
1825
  fileType: t,
1834
1826
  annotations: o,
1835
1827
  fileName: u,
1836
1828
  token: r,
1837
- initialPage: d = 1,
1829
+ initialPage: c = 1,
1838
1830
  data: p,
1839
- eventsEmit: f = () => {
1831
+ eventsEmit: g = () => {
1840
1832
  },
1841
- styles: g,
1842
- tools: F = {
1833
+ styles: m,
1834
+ tools: f = {
1843
1835
  annotation: !1,
1844
1836
  download: !1,
1845
1837
  zoom: !0,
1846
1838
  close: !0,
1847
1839
  navigation: !0
1848
1840
  },
1849
- customComponents: w,
1850
- className: b,
1841
+ customComponents: C,
1842
+ className: x,
1851
1843
  headerClass: v,
1852
- contentClass: B
1844
+ contentClass: D
1853
1845
  }) => {
1854
- var a;
1855
- const l = (g == null ? void 0 : g.theme) || wt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [h, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J, i] = R(!1), s = $(() => {
1856
- C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0), i(!1);
1857
- }, [d]), y = $(async () => {
1858
- var E, z;
1859
- if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), s(), p) {
1860
- C(!1), x(null), k({
1846
+ var s;
1847
+ const a = (m == null ? void 0 : m.theme) || Ct, [B, y] = P(!0), [Z, z] = P("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [i, b] = P(null), [h, j] = P(null), [q, R] = P(c), [T, _] = P(1), [V, Q] = P(0), [K, X] = P(!1), d = A(() => {
1848
+ y(!0), z("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), b(null), j(null), R(c), _(1), Q(0), X(!1);
1849
+ }, [c]), l = A(async () => {
1850
+ var F, L;
1851
+ if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), d(), p) {
1852
+ y(!1), b(null), j({
1861
1853
  type: p.fileType || t || "text",
1862
1854
  content: p.content,
1863
1855
  fileName: p.fileName || u,
@@ -1867,100 +1859,100 @@ const pe = G.div`
1867
1859
  return;
1868
1860
  }
1869
1861
  if (!e) {
1870
- x("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), C(!1);
1862
+ b("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), y(!1);
1871
1863
  return;
1872
1864
  }
1873
1865
  try {
1874
- C(!0), x(null);
1875
- const Y = be(u, t);
1876
- 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 pt(e, {
1866
+ y(!0), b(null);
1867
+ const J = xe(u, t);
1868
+ z(J === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : J === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : J === "markdown" || J === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
1869
+ const M = await Ft(e, {
1878
1870
  fileName: u,
1879
1871
  fileType: t,
1880
1872
  token: r
1881
1873
  });
1882
- console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", S), console.log("result.type:", S.type), console.log("result.content:", S.content), console.log("result.content?.text:", (E = S.content) == null ? void 0 : E.text), console.log("result.fileName:", S.fileName), console.log("result.fileType:", S.fileType), S.error ? x(S.error) : (S.type === "image" ? N("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : S.type === "pdf" ? N("PDF\u52A0\u8F7D\u5B8C\u6210") : S.type === "markdown" || S.type === "markdown_table" ? N("Markdown\u52A0\u8F7D\u5B8C\u6210") : N("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", S), console.log("parseResult.content:", S.content), console.log("parseResult.content.document:", (z = S.content) == null ? void 0 : z.document), k(S));
1883
- } catch (Y) {
1884
- x(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${Y instanceof Error ? Y.message : "\u672A\u77E5\u9519\u8BEF"}`);
1874
+ console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", M), console.log("result.type:", M.type), console.log("result.content:", M.content), console.log("result.content?.text:", (F = M.content) == null ? void 0 : F.text), console.log("result.fileName:", M.fileName), console.log("result.fileType:", M.fileType), M.error ? b(M.error) : (M.type === "image" ? z("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : M.type === "pdf" ? z("PDF\u52A0\u8F7D\u5B8C\u6210") : M.type === "markdown" || M.type === "markdown_table" ? z("Markdown\u52A0\u8F7D\u5B8C\u6210") : z("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", M), console.log("parseResult.content:", M.content), console.log("parseResult.content.document:", (L = M.content) == null ? void 0 : L.document), j(M));
1875
+ } catch (J) {
1876
+ b(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${J instanceof Error ? J.message : "\u672A\u77E5\u9519\u8BEF"}`);
1885
1877
  } finally {
1886
- C(!1);
1878
+ y(!1);
1887
1879
  }
1888
- }, [e, u, t, r, p, s]);
1880
+ }, [e, u, t, r, p, d]);
1889
1881
  te(() => {
1890
- y();
1891
- }, [y]);
1892
- const m = $((E, z, Y) => {
1893
- switch (E) {
1882
+ l();
1883
+ }, [l]);
1884
+ const E = A((F, L, J) => {
1885
+ switch (F) {
1894
1886
  case "pageChange":
1895
- z != null && z.pageNumber && L(z.pageNumber);
1887
+ L != null && L.pageNumber && R(L.pageNumber);
1896
1888
  break;
1897
1889
  // if (data?.annotationId) {
1898
1890
  // setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
1899
1891
  // }
1900
1892
  // break;
1901
1893
  default:
1902
- f(E, z, Y);
1894
+ g(F, L, J);
1903
1895
  break;
1904
1896
  }
1905
- }, [f]), _ = $(() => {
1906
- const E = Math.min(3, A + 0.1);
1907
- P(E), m("zoom:change", { scale: E });
1908
- }, [A, m]), T = $(() => {
1909
- const E = Math.max(0.3, A - 0.1);
1910
- P(E), m("zoom:change", { scale: E });
1911
- }, [A, m]), I = $(() => {
1912
- if (O > 1) {
1913
- const E = O - 1;
1914
- L(E), m("page:change", { page: E });
1897
+ }, [g]), w = A(() => {
1898
+ const F = Math.min(3, T + 0.1);
1899
+ _(F), E("zoom:change", { scale: F });
1900
+ }, [T, E]), k = A(() => {
1901
+ const F = Math.max(0.3, T - 0.1);
1902
+ _(F), E("zoom:change", { scale: F });
1903
+ }, [T, E]), S = A(() => {
1904
+ if (q > 1) {
1905
+ const F = q - 1;
1906
+ R(F), E("page:change", { page: F });
1915
1907
  }
1916
- }, [O, m]), Z = $(() => {
1917
- const E = (h == null ? void 0 : h.totalPages) || 0;
1918
- if (E && O < E) {
1919
- const z = O + 1;
1920
- L(z), m("page:change", { page: z });
1908
+ }, [q, E]), W = A(() => {
1909
+ const F = (h == null ? void 0 : h.totalPages) || 0;
1910
+ if (F && q < F) {
1911
+ const L = q + 1;
1912
+ R(L), E("page:change", { page: L });
1921
1913
  }
1922
- }, [O, h == null ? void 0 : h.totalPages, m]), U = $(() => {
1923
- const E = !J;
1924
- i(E), m("annotation:toggle", { isAnnotating: E });
1925
- }, [J, m]), M = $(() => {
1926
- m("download:start", { fileUrl: e, fileName: u });
1927
- }, [m, e, u]), j = $(() => {
1928
- ee((E) => (E - 90) % 360), m("rotate:left", { rotation: (V - 90) % 360 });
1929
- }, [V, m]), K = $(() => {
1930
- ee((E) => (E + 90) % 360), m("rotate:right", { rotation: (V + 90) % 360 });
1931
- }, [V, m]), oe = $(() => {
1932
- m("viewer:close");
1933
- }, [m]), Q = $((E, z) => {
1934
- const Y = E === "pdf", S = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
1914
+ }, [q, h == null ? void 0 : h.totalPages, E]), U = A(() => {
1915
+ const F = !K;
1916
+ X(F), E("annotation:toggle", { isAnnotating: F });
1917
+ }, [K, E]), ee = A(() => {
1918
+ E("download:start", { fileUrl: e, fileName: u });
1919
+ }, [E, e, u]), N = A(() => {
1920
+ Q((F) => (F - 90) % 360), E("rotate:left", { rotation: (V - 90) % 360 });
1921
+ }, [V, E]), I = A(() => {
1922
+ Q((F) => (F + 90) % 360), E("rotate:right", { rotation: (V + 90) % 360 });
1923
+ }, [V, E]), Y = A(() => {
1924
+ E("viewer:close");
1925
+ }, [E]), oe = A((F, L) => {
1926
+ const J = F === "pdf", M = F === "text" || F === "markdown" || F === "markdown_table" || F === "html";
1935
1927
  return {
1936
- ...z,
1928
+ ...L,
1937
1929
  // 缩放功能:只有 PDF 和图片支持
1938
- zoom: z.zoom && !S,
1930
+ zoom: L.zoom && !M,
1939
1931
  // 导航功能:只有多页文件支持(PDF)
1940
- navigation: z.navigation && Y,
1932
+ navigation: L.navigation && J,
1941
1933
  // 标注功能:PDF、Markdown、Markdown表格都支持
1942
- annotation: z.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
1934
+ annotation: L.annotation && (F === "pdf" || F === "markdown" || F === "markdown_table"),
1943
1935
  // 旋转功能:只有图片支持
1944
- rotate: z.rotate && E === "image",
1936
+ rotate: L.rotate && F === "image",
1945
1937
  // 下载功能:所有文件都支持
1946
- download: z.download,
1938
+ download: L.download,
1947
1939
  // 关闭功能:所有文件都支持
1948
- close: z.close
1940
+ close: L.close
1949
1941
  };
1950
1942
  }, []);
1951
- if (D) {
1952
- const E = Q(t || "unknown", {
1953
- ...F,
1943
+ if (B) {
1944
+ const F = oe(t || "unknown", {
1945
+ ...f,
1954
1946
  navigation: !1
1955
1947
  });
1956
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
1948
+ return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
1957
1949
  ce,
1958
1950
  {
1959
1951
  fileName: u || "\u52A0\u8F7D\u4E2D...",
1960
1952
  currentPage: 1,
1961
1953
  totalPage: 0,
1962
- tools: E,
1963
- styles: g,
1954
+ tools: F,
1955
+ styles: m,
1964
1956
  onPrevPage: () => {
1965
1957
  },
1966
1958
  onNextPage: () => {
@@ -1973,38 +1965,38 @@ const pe = G.div`
1973
1965
  },
1974
1966
  onDownload: () => {
1975
1967
  },
1976
- onClose: oe,
1968
+ onClose: Y,
1977
1969
  scale: 1,
1978
1970
  isAnnotating: !1,
1979
1971
  className: v
1980
1972
  }
1981
- ), w != null && w.LoadingComponent ? /* @__PURE__ */ n.createElement(
1982
- w.LoadingComponent,
1973
+ ), C != null && C.LoadingComponent ? /* @__PURE__ */ n.createElement(
1974
+ C.LoadingComponent,
1983
1975
  {
1984
- status: q,
1985
- theme: l
1976
+ status: Z,
1977
+ theme: a
1986
1978
  }
1987
1979
  ) : /* @__PURE__ */ n.createElement(
1988
- Ct,
1980
+ pt,
1989
1981
  {
1990
- status: q,
1991
- theme: l
1982
+ status: Z,
1983
+ theme: a
1992
1984
  }
1993
1985
  ));
1994
1986
  }
1995
- if (c) {
1996
- const E = Q(t || "unknown", {
1997
- ...F,
1987
+ if (i) {
1988
+ const F = oe(t || "unknown", {
1989
+ ...f,
1998
1990
  navigation: !1
1999
1991
  });
2000
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
1992
+ return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2001
1993
  ce,
2002
1994
  {
2003
1995
  fileName: u || "\u9519\u8BEF",
2004
1996
  currentPage: 1,
2005
1997
  totalPage: 0,
2006
- tools: E,
2007
- styles: g,
1998
+ tools: F,
1999
+ styles: m,
2008
2000
  onPrevPage: () => {
2009
2001
  },
2010
2002
  onNextPage: () => {
@@ -2017,26 +2009,26 @@ const pe = G.div`
2017
2009
  },
2018
2010
  onDownload: () => {
2019
2011
  },
2020
- onClose: oe,
2012
+ onClose: Y,
2021
2013
  scale: 1,
2022
2014
  isAnnotating: !1,
2023
2015
  className: v
2024
2016
  }
2025
- ), /* @__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)));
2017
+ ), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, i)));
2026
2018
  }
2027
2019
  if (!h) {
2028
- const E = Q(t || "unknown", {
2029
- ...F,
2020
+ const F = oe(t || "unknown", {
2021
+ ...f,
2030
2022
  navigation: !1
2031
2023
  });
2032
- return /* @__PURE__ */ n.createElement(de, { $theme: l, className: b }, /* @__PURE__ */ n.createElement(
2024
+ return /* @__PURE__ */ n.createElement(de, { $theme: a, className: x }, /* @__PURE__ */ n.createElement(
2033
2025
  ce,
2034
2026
  {
2035
2027
  fileName: u || "\u672A\u77E5\u6587\u4EF6",
2036
2028
  currentPage: 1,
2037
2029
  totalPage: 0,
2038
- tools: E,
2039
- styles: g,
2030
+ tools: F,
2031
+ styles: m,
2040
2032
  onPrevPage: () => {
2041
2033
  },
2042
2034
  onNextPage: () => {
@@ -2049,64 +2041,64 @@ const pe = G.div`
2049
2041
  },
2050
2042
  onDownload: () => {
2051
2043
  },
2052
- onClose: oe,
2044
+ onClose: Y,
2053
2045
  scale: 1,
2054
2046
  isAnnotating: !1,
2055
2047
  className: v
2056
2048
  }
2057
- ), /* @__PURE__ */ n.createElement(pe, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2049
+ ), /* @__PURE__ */ n.createElement(Ce, { $theme: a }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
2058
2050
  }
2059
- const H = {
2051
+ const O = {
2060
2052
  content: h.content,
2061
2053
  ...(h.fileName || u) && { fileName: h.fileName || u },
2062
2054
  ...(h.fileType || t) && { fileType: h.fileType || t },
2063
2055
  ...h.totalPages && { totalPages: h.totalPages }
2064
- }, W = Q(h.type, F);
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:", h.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(
2056
+ }, $ = oe(h.type, f);
2057
+ return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", O), console.log("viewerData.content:", O.content), console.log("viewerData.content.document:", (s = O.content) == null ? void 0 : s.document), console.log("\u6587\u4EF6\u7C7B\u578B:", h.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", $), 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: a, className: x }, /* @__PURE__ */ n.createElement(
2066
2058
  ce,
2067
2059
  {
2068
- fileName: H.fileName || h.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2069
- currentPage: h.type === "pdf" ? O : 1,
2060
+ fileName: O.fileName || h.fileName || u || "\u672A\u77E5\u6587\u4EF6",
2061
+ currentPage: h.type === "pdf" ? q : 1,
2070
2062
  totalPage: h.type === "pdf" && h.totalPages || 0,
2071
- tools: W,
2072
- styles: g,
2073
- onPrevPage: h.type === "pdf" ? I : () => {
2063
+ tools: $,
2064
+ styles: m,
2065
+ onPrevPage: h.type === "pdf" ? S : () => {
2074
2066
  },
2075
- onNextPage: h.type === "pdf" ? Z : () => {
2067
+ onNextPage: h.type === "pdf" ? W : () => {
2076
2068
  },
2077
- onZoomIn: W.zoom ? _ : () => {
2069
+ onZoomIn: $.zoom ? w : () => {
2078
2070
  },
2079
- onZoomOut: W.zoom ? T : () => {
2071
+ onZoomOut: $.zoom ? k : () => {
2080
2072
  },
2081
- onAnnotationToggle: W.annotation ? U : () => {
2073
+ onAnnotationToggle: $.annotation ? U : () => {
2082
2074
  },
2083
- onDownload: W.download ? M : () => {
2075
+ onDownload: $.download ? ee : () => {
2084
2076
  },
2085
- onRotateLeft: W.rotate ? j : () => {
2077
+ onRotateLeft: $.rotate ? N : () => {
2086
2078
  },
2087
- onRotateRight: W.rotate ? K : () => {
2079
+ onRotateRight: $.rotate ? I : () => {
2088
2080
  },
2089
- onClose: oe,
2090
- scale: A,
2091
- isAnnotating: J,
2081
+ onClose: Y,
2082
+ scale: T,
2083
+ isAnnotating: K,
2092
2084
  className: v
2093
2085
  }
2094
2086
  ), /* @__PURE__ */ n.createElement(
2095
- qe,
2087
+ Xe,
2096
2088
  {
2097
- data: H,
2089
+ data: O,
2098
2090
  annotationData: o || [],
2099
2091
  totalPage: h.type === "pdf" && h.totalPages || 0,
2100
- currentPage: h.type === "pdf" ? O : 1,
2101
- scale: A,
2092
+ currentPage: h.type === "pdf" ? q : 1,
2093
+ scale: T,
2102
2094
  rotation: V,
2103
- eventsEmit: m,
2104
- styles: g,
2105
- tools: W,
2106
- className: B
2095
+ eventsEmit: E,
2096
+ styles: m,
2097
+ tools: $,
2098
+ className: D
2107
2099
  }
2108
2100
  ));
2109
- }, xe = () => !!re.GlobalWorkerOptions.workerSrc, vt = () => re.GlobalWorkerOptions.workerSrc, yt = (e = "/worker/pdf.worker.min.js") => {
2101
+ }, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {
2110
2102
  try {
2111
2103
  if (re.GlobalWorkerOptions.workerSrc) {
2112
2104
  console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:", re.GlobalWorkerOptions.workerSrc);
@@ -2118,16 +2110,16 @@ const pe = G.div`
2118
2110
  }
2119
2111
  };
2120
2112
  export {
2121
- qe as Fviewer,
2122
- Bt as StaticFileReader,
2123
- be as detectFileType,
2124
- vt as getPDFWorkerPath,
2125
- xe as isPDFWorkerRegistered,
2126
- pt as parseFile,
2127
- ft as parseImageFile,
2128
- Ft as parseMarkdownFile,
2129
- gt as parsePdfFile,
2130
- Et as parseTextFile,
2131
- yt as registerPDFWorker
2113
+ Xe as Fviewer,
2114
+ xt as StaticFileReader,
2115
+ xe as detectFileType,
2116
+ Dt as getPDFWorkerPath,
2117
+ vt as isPDFWorkerRegistered,
2118
+ Ft as parseFile,
2119
+ gt as parseImageFile,
2120
+ Et as parseMarkdownFile,
2121
+ mt as parsePdfFile,
2122
+ ft as parseTextFile,
2123
+ Bt as registerPDFWorker
2132
2124
  };
2133
2125
  //# sourceMappingURL=index.js.map