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