@eternalheart/react-file-preview 1.0.0 → 1.0.2

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.
Files changed (186) hide show
  1. package/README.md +69 -0
  2. package/README.zh-CN.md +69 -0
  3. package/lib/FilePreviewModal.d.ts +2 -1
  4. package/lib/FilePreviewModal.d.ts.map +1 -1
  5. package/lib/index.cjs +1 -1
  6. package/lib/index.cjs.map +1 -1
  7. package/lib/index.css +1 -1
  8. package/lib/index.d.ts +5 -1
  9. package/lib/index.d.ts.map +1 -1
  10. package/lib/index.mjs +494 -478
  11. package/lib/index.mjs.map +1 -1
  12. package/lib/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  13. package/lib/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  14. package/lib/pdfjs/cmaps/78-H.bcmap +0 -0
  15. package/lib/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  16. package/lib/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  17. package/lib/pdfjs/cmaps/78-V.bcmap +0 -0
  18. package/lib/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  19. package/lib/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  20. package/lib/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  21. package/lib/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  22. package/lib/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  23. package/lib/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  24. package/lib/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  25. package/lib/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  26. package/lib/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  27. package/lib/pdfjs/cmaps/Add-H.bcmap +0 -0
  28. package/lib/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  29. package/lib/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  30. package/lib/pdfjs/cmaps/Add-V.bcmap +0 -0
  31. package/lib/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  32. package/lib/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  33. package/lib/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  34. package/lib/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  35. package/lib/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  36. package/lib/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  37. package/lib/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  38. package/lib/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  39. package/lib/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  40. package/lib/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  41. package/lib/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  42. package/lib/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  43. package/lib/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  44. package/lib/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  45. package/lib/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  46. package/lib/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  47. package/lib/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  48. package/lib/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  49. package/lib/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  50. package/lib/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  51. package/lib/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  52. package/lib/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  53. package/lib/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  54. package/lib/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  55. package/lib/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  56. package/lib/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  57. package/lib/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  58. package/lib/pdfjs/cmaps/B5-H.bcmap +0 -0
  59. package/lib/pdfjs/cmaps/B5-V.bcmap +0 -0
  60. package/lib/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  61. package/lib/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  62. package/lib/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  63. package/lib/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  64. package/lib/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  65. package/lib/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  66. package/lib/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  67. package/lib/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  68. package/lib/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  69. package/lib/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  70. package/lib/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  71. package/lib/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  72. package/lib/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  73. package/lib/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  74. package/lib/pdfjs/cmaps/EUC-H.bcmap +0 -0
  75. package/lib/pdfjs/cmaps/EUC-V.bcmap +0 -0
  76. package/lib/pdfjs/cmaps/Ext-H.bcmap +0 -0
  77. package/lib/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  78. package/lib/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  79. package/lib/pdfjs/cmaps/Ext-V.bcmap +0 -0
  80. package/lib/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  81. package/lib/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  82. package/lib/pdfjs/cmaps/GB-H.bcmap +4 -0
  83. package/lib/pdfjs/cmaps/GB-V.bcmap +0 -0
  84. package/lib/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  85. package/lib/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  86. package/lib/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  87. package/lib/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  88. package/lib/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  89. package/lib/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  90. package/lib/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  91. package/lib/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  92. package/lib/pdfjs/cmaps/GBT-H.bcmap +0 -0
  93. package/lib/pdfjs/cmaps/GBT-V.bcmap +0 -0
  94. package/lib/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  95. package/lib/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  96. package/lib/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  97. package/lib/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  98. package/lib/pdfjs/cmaps/H.bcmap +0 -0
  99. package/lib/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  100. package/lib/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  101. package/lib/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  102. package/lib/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  103. package/lib/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  104. package/lib/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  105. package/lib/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  106. package/lib/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  107. package/lib/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  108. package/lib/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  109. package/lib/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  110. package/lib/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  111. package/lib/pdfjs/cmaps/Hankaku.bcmap +0 -0
  112. package/lib/pdfjs/cmaps/Hiragana.bcmap +0 -0
  113. package/lib/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  114. package/lib/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  115. package/lib/pdfjs/cmaps/KSC-H.bcmap +0 -0
  116. package/lib/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  117. package/lib/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  118. package/lib/pdfjs/cmaps/KSC-V.bcmap +0 -0
  119. package/lib/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  120. package/lib/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  121. package/lib/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  122. package/lib/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  123. package/lib/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  124. package/lib/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  125. package/lib/pdfjs/cmaps/Katakana.bcmap +0 -0
  126. package/lib/pdfjs/cmaps/LICENSE +36 -0
  127. package/lib/pdfjs/cmaps/NWP-H.bcmap +0 -0
  128. package/lib/pdfjs/cmaps/NWP-V.bcmap +0 -0
  129. package/lib/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  130. package/lib/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  131. package/lib/pdfjs/cmaps/Roman.bcmap +0 -0
  132. package/lib/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  133. package/lib/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  134. package/lib/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  135. package/lib/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  136. package/lib/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  137. package/lib/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  138. package/lib/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  139. package/lib/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  140. package/lib/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  141. package/lib/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  142. package/lib/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  143. package/lib/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  144. package/lib/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  145. package/lib/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  146. package/lib/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  147. package/lib/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  148. package/lib/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  149. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  150. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  151. package/lib/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  152. package/lib/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  153. package/lib/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  154. package/lib/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  155. package/lib/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  156. package/lib/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  157. package/lib/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  158. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  159. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  160. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  161. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  162. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  163. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  164. package/lib/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  165. package/lib/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  166. package/lib/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  167. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  168. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  169. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  170. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  171. package/lib/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  172. package/lib/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  173. package/lib/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  174. package/lib/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  175. package/lib/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  176. package/lib/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  177. package/lib/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  178. package/lib/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  179. package/lib/pdfjs/cmaps/V.bcmap +0 -0
  180. package/lib/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  181. package/lib/pdfjs/pdf.worker.min.mjs +21 -0
  182. package/lib/types.d.ts +4 -0
  183. package/lib/types.d.ts.map +1 -1
  184. package/lib/utils/pdfConfig.d.ts +40 -0
  185. package/lib/utils/pdfConfig.d.ts.map +1 -1
  186. package/package.json +19 -27
package/lib/index.mjs CHANGED
@@ -1,27 +1,32 @@
1
- import { jsxs as p, jsx as e, Fragment as $ } from "react/jsx-runtime";
2
- import { useState as w, useRef as S, useEffect as M, useCallback as C, useMemo as Z } from "react";
3
- import { motion as F, AnimatePresence as _ } from "framer-motion";
4
- import { Presentation as G, Music as I, SkipBack as Y, Pause as K, Play as Q, SkipForward as J, VolumeX as ee, Volume2 as te, FileText as re, FileQuestion as oe, Download as V, ZoomOut as ne, ZoomIn as le, Minimize2 as ae, Maximize2 as se, RotateCcw as ie, RotateCw as ce, RefreshCw as de, X as me, ChevronLeft as ue, ChevronRight as he } from "lucide-react";
5
- import { pdfjs as W, Document as pe, Page as fe } from "react-pdf";
6
- import xe from "mammoth";
7
- import * as A from "xlsx";
8
- import { init as O } from "pptx-preview";
9
- import we from "video.js";
10
- import ge from "react-markdown";
11
- import be from "remark-gfm";
12
- import { Prism as X } from "react-syntax-highlighter";
13
- function ve(r) {
1
+ import { jsxs as f, jsx as e, Fragment as W } from "react/jsx-runtime";
2
+ import { useState as b, useRef as P, useEffect as C, useCallback as M, useMemo as O } from "react";
3
+ import { createPortal as I } from "react-dom";
4
+ import { motion as H, AnimatePresence as Y } from "framer-motion";
5
+ import { Presentation as J, Music as K, SkipBack as Q, Pause as ee, Play as te, SkipForward as re, VolumeX as oe, Volume2 as ne, FileText as le, FileQuestion as ae, Download as q, ZoomOut as se, ZoomIn as ie, Minimize2 as ce, Maximize2 as de, RotateCcw as me, RotateCw as ue, RefreshCw as he, X as pe, ChevronLeft as fe, ChevronRight as xe } from "lucide-react";
6
+ import { pdfjs as B, Document as we, Page as ge } from "react-pdf";
7
+ import { pdfjs as nt } from "react-pdf";
8
+ import be from "mammoth";
9
+ import * as V from "xlsx";
10
+ import { init as X } from "pptx-preview";
11
+ import ve from "video.js";
12
+ import ye from "react-markdown";
13
+ import Ne from "remark-gfm";
14
+ import { Prism as Z } from "react-syntax-highlighter";
15
+ const ke = "1.0.2", je = {
16
+ version: ke
17
+ };
18
+ function Me(t) {
14
19
  try {
15
- const i = new URL(r).pathname.split("/").pop() || "file";
16
- return decodeURIComponent(i);
20
+ const s = new URL(t).pathname.split("/").pop() || "file";
21
+ return decodeURIComponent(s);
17
22
  } catch {
18
- const t = r.split("/").pop() || "file";
19
- return decodeURIComponent(t);
23
+ const r = t.split("/").pop() || "file";
24
+ return decodeURIComponent(r);
20
25
  }
21
26
  }
22
- function B(r) {
23
- var i;
24
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase()) || "";
27
+ function A(t) {
28
+ var s;
29
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
25
30
  return {
26
31
  // 图片
27
32
  jpg: "image/jpeg",
@@ -78,101 +83,101 @@ function B(r) {
78
83
  rs: "text/x-rust",
79
84
  yaml: "text/yaml",
80
85
  yml: "text/yaml"
81
- }[t] || "application/octet-stream";
86
+ }[r] || "application/octet-stream";
82
87
  }
83
- function ye(r, t = 0) {
84
- if (r instanceof File)
88
+ function Ce(t, r = 0) {
89
+ if (t instanceof File)
85
90
  return {
86
- id: `file-${Date.now()}-${t}`,
87
- name: r.name,
88
- url: URL.createObjectURL(r),
89
- type: r.type || B(r.name),
90
- size: r.size
91
+ id: `file-${Date.now()}-${r}`,
92
+ name: t.name,
93
+ url: URL.createObjectURL(t),
94
+ type: t.type || A(t.name),
95
+ size: t.size
91
96
  };
92
- if (typeof r == "string") {
93
- const n = ve(r);
97
+ if (typeof t == "string") {
98
+ const n = Me(t);
94
99
  return {
95
- id: `url-${Date.now()}-${t}`,
100
+ id: `url-${Date.now()}-${r}`,
96
101
  name: n,
97
- url: r,
98
- type: B(n)
102
+ url: t,
103
+ type: A(n)
99
104
  };
100
105
  }
101
106
  return {
102
- id: r.id || `link-${Date.now()}-${t}`,
103
- name: r.name,
104
- url: r.url,
105
- type: r.type || B(r.name),
106
- size: r.size
107
+ id: t.id || `link-${Date.now()}-${r}`,
108
+ name: t.name,
109
+ url: t.url,
110
+ type: t.type || A(t.name),
111
+ size: t.size
107
112
  };
108
113
  }
109
- function Ne(r) {
110
- return r.map((t, n) => ye(t, n));
114
+ function Te(t) {
115
+ return t.map((r, n) => Ce(r, n));
111
116
  }
112
- const ke = ({
113
- url: r,
114
- zoom: t,
117
+ const Le = ({
118
+ url: t,
119
+ zoom: r,
115
120
  rotation: n,
116
- onZoomChange: i
121
+ onZoomChange: s
117
122
  }) => {
118
- const [c, d] = w(!1), [s, o] = w(null), [a, g] = w({ x: 0, y: 0 }), [u, h] = w(!1), [v, l] = w({ x: 0, y: 0 }), [m, f] = w(1), y = S(null);
119
- M(() => {
120
- d(!1), o(null), g({ x: 0, y: 0 }), f(1);
121
- }, [r]), M(() => {
122
- f(t);
123
- }, [t]), M(() => {
124
- g({ x: 0, y: 0 });
125
- }, [t, n]);
123
+ const [c, d] = b(!1), [i, o] = b(null), [a, w] = b({ x: 0, y: 0 }), [p, u] = b(!1), [v, h] = b({ x: 0, y: 0 }), [l, x] = b(1), m = P(null);
124
+ C(() => {
125
+ d(!1), o(null), w({ x: 0, y: 0 }), x(1);
126
+ }, [t]), C(() => {
127
+ x(r);
128
+ }, [r]), C(() => {
129
+ w({ x: 0, y: 0 });
130
+ }, [r, n]);
126
131
  const k = () => {
127
132
  d(!0);
128
133
  }, T = () => {
129
134
  o("图片加载失败"), d(!0);
130
135
  }, L = () => {
131
- g({ x: 0, y: 0 });
132
- }, P = C((N) => {
136
+ w({ x: 0, y: 0 });
137
+ }, R = M((N) => {
133
138
  N.preventDefault(), N.stopPropagation();
134
- const R = N.deltaY > 0 ? -0.1 : 0.1;
135
- f((b) => {
136
- const E = Math.max(0.5, Math.min(5, b + R));
137
- return i && i(E), E;
139
+ const D = N.deltaY > 0 ? -0.1 : 0.1;
140
+ x((S) => {
141
+ const F = Math.max(0.5, Math.min(5, S + D));
142
+ return s && s(F), F;
138
143
  });
139
- }, [i]), z = C((N) => {
140
- N.button === 0 && (h(!0), l({
144
+ }, [s]), z = M((N) => {
145
+ N.button === 0 && (u(!0), h({
141
146
  x: N.clientX - a.x,
142
147
  y: N.clientY - a.y
143
148
  }));
144
- }, [a]), x = C((N) => {
145
- u && g({
149
+ }, [a]), g = M((N) => {
150
+ p && w({
146
151
  x: N.clientX - v.x,
147
152
  y: N.clientY - v.y
148
153
  });
149
- }, [u, v]), j = C(() => {
150
- h(!1);
154
+ }, [p, v]), j = M(() => {
155
+ u(!1);
151
156
  }, []);
152
- return /* @__PURE__ */ p(
157
+ return /* @__PURE__ */ f(
153
158
  "div",
154
159
  {
155
- ref: y,
160
+ ref: m,
156
161
  className: "flex items-center justify-center w-full h-full overflow-hidden",
157
- onWheel: P,
162
+ onWheel: R,
158
163
  onMouseDown: z,
159
- onMouseMove: x,
164
+ onMouseMove: g,
160
165
  onMouseUp: j,
161
166
  onMouseLeave: j,
162
- style: { cursor: u ? "grabbing" : "grab" },
167
+ style: { cursor: p ? "grabbing" : "grab" },
163
168
  children: [
164
- !c && !s && /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
165
- s && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: s }) }),
169
+ !c && !i && /* @__PURE__ */ e("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
170
+ i && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: i }) }),
166
171
  /* @__PURE__ */ e(
167
- F.img,
172
+ H.img,
168
173
  {
169
- src: r,
174
+ src: t,
170
175
  alt: "Preview",
171
176
  className: `max-w-none select-none ${c ? "" : "hidden"}`,
172
177
  style: {
173
- transform: `translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${n}deg)`,
178
+ transform: `translate(${a.x}px, ${a.y}px) scale(${l}) rotate(${n}deg)`,
174
179
  transformOrigin: "center",
175
- transition: u ? "none" : "transform 0.3s ease-out"
180
+ transition: p ? "none" : "transform 0.3s ease-out"
176
181
  },
177
182
  onLoad: k,
178
183
  onError: T,
@@ -186,72 +191,76 @@ const ke = ({
186
191
  ]
187
192
  }
188
193
  );
189
- }, je = W.version, Ce = "/pdf.worker.min.mjs";
190
- W.GlobalWorkerOptions.workerSrc = Ce;
191
- const Me = W.GlobalWorkerOptions.workerSrc, U = `https://unpkg.com/pdfjs-dist@${je}/build/pdf.worker.min.mjs`;
192
- typeof window < "u" && window.addEventListener("error", (r) => {
193
- var t;
194
- (t = r.message) != null && t.includes("pdf.worker") && W.GlobalWorkerOptions.workerSrc === Me && (console.warn("本地 PDF worker 加载失败,切换到 CDN:", U), W.GlobalWorkerOptions.workerSrc = U);
195
- });
196
- const Te = ({
197
- url: r,
198
- zoom: t,
194
+ };
195
+ function Pe(t) {
196
+ if (typeof window > "u") return;
197
+ const {
198
+ workerSrc: r = `https://unpkg.com/pdfjs-dist@${B.version}/build/pdf.worker.min.mjs`,
199
+ cMapUrl: n = `https://unpkg.com/pdfjs-dist@${B.version}/cmaps/`,
200
+ cMapPacked: s = !0
201
+ } = t || {};
202
+ B.GlobalWorkerOptions.workerSrc = r, B.GlobalWorkerOptions.cMapUrl = n, B.GlobalWorkerOptions.cMapPacked = s;
203
+ }
204
+ Pe();
205
+ const Re = ({
206
+ url: t,
207
+ zoom: r,
199
208
  currentPage: n,
200
- onPageChange: i,
209
+ onPageChange: s,
201
210
  onTotalPagesChange: c
202
211
  }) => {
203
- const [d, s] = w(0), [o, a] = w(null), g = S(null), u = S(/* @__PURE__ */ new Map());
204
- M(() => {
212
+ const [d, i] = b(0), [o, a] = b(null), w = P(null), p = P(/* @__PURE__ */ new Map());
213
+ C(() => {
205
214
  a(null);
206
- }, [r]);
207
- const h = ({ numPages: f }) => {
208
- s(f), c(f), i(1);
209
- }, v = (f) => {
210
- console.error("PDF 加载错误:", f), a("PDF 文件加载失败");
211
- }, l = C(() => {
212
- if (!g.current) return;
213
- const f = g.current, y = f.scrollTop, k = f.clientHeight, T = y + k / 2;
214
- let L = 1, P = 1 / 0;
215
- u.current.forEach((z, x) => {
216
- const j = z.getBoundingClientRect(), N = f.getBoundingClientRect(), R = j.top - N.top + j.height / 2 + y, b = Math.abs(R - T);
217
- b < P && (P = b, L = x);
218
- }), L !== n && i(L);
219
- }, [n, i]);
220
- M(() => {
221
- const f = g.current;
222
- if (f)
223
- return f.addEventListener("scroll", l), () => f.removeEventListener("scroll", l);
224
- }, [l]);
225
- const m = C((f, y) => {
226
- y ? u.current.set(f, y) : u.current.delete(f);
215
+ }, [t]);
216
+ const u = ({ numPages: x }) => {
217
+ i(x), c(x), s(1);
218
+ }, v = (x) => {
219
+ console.error("PDF 加载错误:", x), a("PDF 文件加载失败");
220
+ }, h = M(() => {
221
+ if (!w.current) return;
222
+ const x = w.current, m = x.scrollTop, k = x.clientHeight, T = m + k / 2;
223
+ let L = 1, R = 1 / 0;
224
+ p.current.forEach((z, g) => {
225
+ const j = z.getBoundingClientRect(), N = x.getBoundingClientRect(), D = j.top - N.top + j.height / 2 + m, S = Math.abs(D - T);
226
+ S < R && (R = S, L = g);
227
+ }), L !== n && s(L);
228
+ }, [n, s]);
229
+ C(() => {
230
+ const x = w.current;
231
+ if (x)
232
+ return x.addEventListener("scroll", h), () => x.removeEventListener("scroll", h);
233
+ }, [h]);
234
+ const l = M((x, m) => {
235
+ m ? p.current.set(x, m) : p.current.delete(x);
227
236
  }, []);
228
- return /* @__PURE__ */ p(
237
+ return /* @__PURE__ */ f(
229
238
  "div",
230
239
  {
231
- ref: g,
240
+ ref: w,
232
241
  className: "flex flex-col items-center w-full h-full overflow-auto py-8 px-4",
233
242
  children: [
234
243
  o && /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: o }) }),
235
244
  !o && /* @__PURE__ */ e(
236
- pe,
245
+ we,
237
246
  {
238
- file: r,
239
- onLoadSuccess: h,
247
+ file: t,
248
+ onLoadSuccess: u,
240
249
  onLoadError: v,
241
250
  loading: /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
242
- children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-4", children: Array.from(new Array(d), (f, y) => {
243
- const k = y + 1;
244
- return /* @__PURE__ */ p(
251
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-4", children: Array.from(new Array(d), (x, m) => {
252
+ const k = m + 1;
253
+ return /* @__PURE__ */ f(
245
254
  "div",
246
255
  {
247
- ref: (T) => m(k, T),
256
+ ref: (T) => l(k, T),
248
257
  className: "relative",
249
258
  children: [
250
259
  /* @__PURE__ */ e(
251
- fe,
260
+ ge,
252
261
  {
253
262
  pageNumber: k,
254
- scale: t,
263
+ scale: r,
255
264
  loading: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8 bg-white/5 rounded-lg min-h-[600px]", children: /* @__PURE__ */ e("div", { className: "w-8 h-8 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }),
256
265
  renderTextLayer: !0,
257
266
  renderAnnotationLayer: !0,
@@ -266,7 +275,7 @@ const Te = ({
266
275
  }) })
267
276
  }
268
277
  ),
269
- d > 0 && /* @__PURE__ */ p("div", { className: "sticky bottom-4 mt-8 bg-black/60 backdrop-blur-xl text-white px-6 py-3 rounded-full text-sm font-medium shadow-2xl border border-white/10", children: [
278
+ d > 0 && /* @__PURE__ */ f("div", { className: "sticky bottom-4 mt-8 bg-black/60 backdrop-blur-xl text-white px-6 py-3 rounded-full text-sm font-medium shadow-2xl border border-white/10", children: [
270
279
  "第 ",
271
280
  n,
272
281
  " 页 / 共 ",
@@ -276,28 +285,28 @@ const Te = ({
276
285
  ]
277
286
  }
278
287
  );
279
- }, Le = ({ url: r }) => {
280
- const [t, n] = w(""), [i, c] = w(!0), [d, s] = w(null);
281
- return M(() => {
288
+ }, Se = ({ url: t }) => {
289
+ const [r, n] = b(""), [s, c] = b(!0), [d, i] = b(null);
290
+ return C(() => {
282
291
  (async () => {
283
- c(!0), s(null), n("");
292
+ c(!0), i(null), n("");
284
293
  try {
285
- const a = await fetch(r);
294
+ const a = await fetch(t);
286
295
  if (!a.ok)
287
296
  throw new Error("文件加载失败");
288
- const g = await a.arrayBuffer(), u = await xe.convertToHtml({ arrayBuffer: g });
289
- n(u.value);
297
+ const w = await a.arrayBuffer(), p = await be.convertToHtml({ arrayBuffer: w });
298
+ n(p.value);
290
299
  } catch (a) {
291
- console.error("Docx 解析错误:", a), s("Word 文档解析失败");
300
+ console.error("Docx 解析错误:", a), i("Word 文档解析失败");
292
301
  } finally {
293
302
  c(!1);
294
303
  }
295
304
  })();
296
- }, [r]), i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e(
305
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e(
297
306
  "div",
298
307
  {
299
308
  className: "max-w-4xl mx-auto bg-white rounded-lg shadow-2xl p-12",
300
- dangerouslySetInnerHTML: { __html: t },
309
+ dangerouslySetInnerHTML: { __html: r },
301
310
  style: {
302
311
  fontFamily: "system-ui, -apple-system, sans-serif",
303
312
  lineHeight: "1.6",
@@ -305,168 +314,168 @@ const Te = ({
305
314
  }
306
315
  }
307
316
  ) });
308
- }, Se = ({ url: r }) => {
309
- const [t, n] = w([]), [i, c] = w(0), [d, s] = w(!0), [o, a] = w(null);
310
- if (M(() => {
317
+ }, De = ({ url: t }) => {
318
+ const [r, n] = b([]), [s, c] = b(0), [d, i] = b(!0), [o, a] = b(null);
319
+ if (C(() => {
311
320
  (async () => {
312
- s(!0), a(null), n([]);
321
+ i(!0), a(null), n([]);
313
322
  try {
314
- const h = await fetch(r);
315
- if (!h.ok)
323
+ const u = await fetch(t);
324
+ if (!u.ok)
316
325
  throw new Error("文件加载失败");
317
- const v = await h.arrayBuffer(), l = A.read(v, { type: "array" }), m = l.SheetNames.map((f) => {
318
- const y = l.Sheets[f], k = A.utils.sheet_to_json(y, { header: 1 });
319
- return { name: f, data: k };
326
+ const v = await u.arrayBuffer(), h = V.read(v, { type: "array" }), l = h.SheetNames.map((x) => {
327
+ const m = h.Sheets[x], k = V.utils.sheet_to_json(m, { header: 1 });
328
+ return { name: x, data: k };
320
329
  });
321
- n(m), c(0);
322
- } catch (h) {
323
- console.error("Excel 解析错误:", h), a("Excel 文件解析失败");
330
+ n(l), c(0);
331
+ } catch (u) {
332
+ console.error("Excel 解析错误:", u), a("Excel 文件解析失败");
324
333
  } finally {
325
- s(!1);
334
+ i(!1);
326
335
  }
327
336
  })();
328
- }, [r]), d)
337
+ }, [t]), d)
329
338
  return /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) });
330
339
  if (o)
331
340
  return /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: o }) }) });
332
- const g = t[i];
333
- return /* @__PURE__ */ p("div", { className: "w-full h-full flex flex-col overflow-hidden", children: [
334
- t.length > 1 && /* @__PURE__ */ e("div", { className: "flex gap-2 p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10", children: t.map((u, h) => /* @__PURE__ */ e(
341
+ const w = r[s];
342
+ return /* @__PURE__ */ f("div", { className: "w-full h-full flex flex-col overflow-hidden", children: [
343
+ r.length > 1 && /* @__PURE__ */ e("div", { className: "flex gap-2 p-4 bg-black/20 backdrop-blur-sm overflow-x-auto border-b border-white/10", children: r.map((p, u) => /* @__PURE__ */ e(
335
344
  "button",
336
345
  {
337
- onClick: () => c(h),
338
- className: `px-4 py-2 rounded-lg text-sm font-medium transition-all ${i === h ? "bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg" : "bg-white/10 text-white hover:bg-white/20"}`,
339
- children: u.name
346
+ onClick: () => c(u),
347
+ className: `px-4 py-2 rounded-lg text-sm font-medium transition-all ${s === u ? "bg-gradient-to-r from-purple-500 to-pink-500 text-white shadow-lg" : "bg-white/10 text-white hover:bg-white/20"}`,
348
+ children: p.name
340
349
  },
341
- h
350
+ u
342
351
  )) }),
343
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "inline-block min-w-full bg-gradient-to-br from-gray-800/90 to-gray-900/90 backdrop-blur-xl rounded-2xl shadow-2xl overflow-hidden border border-white/10", children: /* @__PURE__ */ e("table", { className: "min-w-full divide-y divide-white/10", children: /* @__PURE__ */ e("tbody", { className: "divide-y divide-white/10", children: g == null ? void 0 : g.data.map((u, h) => /* @__PURE__ */ e(
352
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "inline-block min-w-full bg-gradient-to-br from-gray-800/90 to-gray-900/90 backdrop-blur-xl rounded-2xl shadow-2xl overflow-hidden border border-white/10", children: /* @__PURE__ */ e("table", { className: "min-w-full divide-y divide-white/10", children: /* @__PURE__ */ e("tbody", { className: "divide-y divide-white/10", children: w == null ? void 0 : w.data.map((p, u) => /* @__PURE__ */ e(
344
353
  "tr",
345
354
  {
346
- className: `transition-colors ${h === 0 ? "bg-gradient-to-r from-purple-500/20 to-pink-500/20 font-semibold" : "hover:bg-white/5"}`,
347
- children: u.map((v, l) => /* @__PURE__ */ e(
355
+ className: `transition-colors ${u === 0 ? "bg-gradient-to-r from-purple-500/20 to-pink-500/20 font-semibold" : "hover:bg-white/5"}`,
356
+ children: p.map((v, h) => /* @__PURE__ */ e(
348
357
  "td",
349
358
  {
350
359
  className: "px-6 py-4 whitespace-nowrap text-sm text-gray-200 border-r border-white/10",
351
360
  children: String(v ?? "")
352
361
  },
353
- l
362
+ h
354
363
  ))
355
364
  },
356
- h
365
+ u
357
366
  )) }) }) }) })
358
367
  ] });
359
- }, Pe = ({ url: r }) => {
360
- const [t, n] = w(!0), [i, c] = w(null), d = S(null), s = S(null), o = S(null), a = S(null), g = S(null), u = S({ width: 0, height: 0 }), h = C(() => {
368
+ }, Ee = ({ url: t }) => {
369
+ const [r, n] = b(!0), [s, c] = b(null), d = P(null), i = P(null), o = P(null), a = P(null), w = P(null), p = P({ width: 0, height: 0 }), u = M(() => {
361
370
  if (!d.current) return { width: 960, height: 540 };
362
- const l = d.current.clientWidth, m = Math.floor(l * 9 / 16);
363
- return console.log("计算尺寸:", { width: l, height: m }), { width: l, height: m };
364
- }, []), v = C(async () => {
371
+ const h = d.current.clientWidth, l = Math.floor(h * 9 / 16);
372
+ return console.log("计算尺寸:", { width: h, height: l }), { width: h, height: l };
373
+ }, []), v = M(async () => {
365
374
  if (!(!d.current || !a.current)) {
366
375
  console.log("重新初始化预览器...");
367
376
  try {
368
- if (s.current)
377
+ if (i.current)
369
378
  try {
370
- s.current.destroy();
371
- } catch (f) {
372
- console.error("销毁预览器失败:", f);
379
+ i.current.destroy();
380
+ } catch (x) {
381
+ console.error("销毁预览器失败:", x);
373
382
  }
374
383
  d.current.innerHTML = "";
375
- const l = h();
376
- console.log("重新初始化使用尺寸:", l);
377
- const m = O(d.current, {
378
- width: l.width,
379
- height: l.height
384
+ const h = u();
385
+ console.log("重新初始化使用尺寸:", h);
386
+ const l = X(d.current, {
387
+ width: h.width,
388
+ height: h.height
380
389
  });
381
- s.current = m, await m.preview(a.current), console.log("重新初始化成功");
382
- } catch (l) {
383
- console.error("重新初始化失败:", l);
390
+ i.current = l, await l.preview(a.current), console.log("重新初始化成功");
391
+ } catch (h) {
392
+ console.error("重新初始化失败:", h);
384
393
  }
385
394
  }
386
- }, [h]);
387
- return M(() => {
395
+ }, [u]);
396
+ return C(() => {
388
397
  if (!d.current) return;
389
- let l = !0;
390
- const m = () => {
391
- if (l) {
392
- l = !1;
393
- const L = h();
394
- u.current = L;
398
+ let h = !0;
399
+ const l = () => {
400
+ if (h) {
401
+ h = !1;
402
+ const L = u();
403
+ p.current = L;
395
404
  return;
396
405
  }
397
- const f = h(), y = u.current, k = Math.abs(y.width - f.width), T = Math.abs(y.height - f.height);
406
+ const x = u(), m = p.current, k = Math.abs(m.width - x.width), T = Math.abs(m.height - x.height);
398
407
  if (k < 10 && T < 10) {
399
408
  console.log("尺寸变化太小,忽略");
400
409
  return;
401
410
  }
402
411
  console.log("检测到尺寸变化:", {
403
- old: y,
404
- new: f,
412
+ old: m,
413
+ new: x,
405
414
  diff: { width: k, height: T }
406
- }), u.current = f, g.current && clearTimeout(g.current), g.current = window.setTimeout(() => {
407
- s.current && a.current && (console.log("尺寸变化,准备重新初始化"), v());
415
+ }), p.current = x, w.current && clearTimeout(w.current), w.current = window.setTimeout(() => {
416
+ i.current && a.current && (console.log("尺寸变化,准备重新初始化"), v());
408
417
  }, 800);
409
418
  };
410
419
  return o.current = new ResizeObserver(() => {
411
- m();
420
+ l();
412
421
  }), o.current.observe(d.current), () => {
413
- o.current && o.current.disconnect(), g.current && clearTimeout(g.current);
422
+ o.current && o.current.disconnect(), w.current && clearTimeout(w.current);
414
423
  };
415
- }, [h, v]), M(() => {
416
- let l = !0;
417
- const m = async () => {
424
+ }, [u, v]), C(() => {
425
+ let h = !0;
426
+ const l = async () => {
418
427
  if (!d.current) {
419
428
  console.log("Container ref not ready");
420
429
  return;
421
430
  }
422
431
  n(!0), c(null);
423
432
  try {
424
- console.log("开始加载 PPTX:", r);
425
- const y = await fetch(r);
426
- if (!y.ok)
433
+ console.log("开始加载 PPTX:", t);
434
+ const m = await fetch(t);
435
+ if (!m.ok)
427
436
  throw new Error("文件加载失败");
428
- const k = await y.arrayBuffer();
429
- if (a.current = k, console.log("文件加载成功,大小:", k.byteLength), !l) return;
437
+ const k = await m.arrayBuffer();
438
+ if (a.current = k, console.log("文件加载成功,大小:", k.byteLength), !h) return;
430
439
  d.current && (d.current.innerHTML = "");
431
- const T = h();
440
+ const T = u();
432
441
  console.log("使用尺寸:", T), console.log("初始化预览器...");
433
- const L = O(d.current, {
442
+ const L = X(d.current, {
434
443
  width: T.width,
435
444
  height: T.height
436
445
  });
437
- s.current = L, console.log("开始预览..."), L.preview(k).then(() => {
438
- console.log("预览成功"), l && n(!1);
439
- }).catch((P) => {
440
- console.error("预览失败:", P), l && (c("PPT 文件预览失败"), n(!1));
446
+ i.current = L, console.log("开始预览..."), L.preview(k).then(() => {
447
+ console.log("预览成功"), h && n(!1);
448
+ }).catch((R) => {
449
+ console.error("预览失败:", R), h && (c("PPT 文件预览失败"), n(!1));
441
450
  });
442
- } catch (y) {
443
- console.error("PPTX 解析错误:", y), l && (c(y instanceof Error ? y.message : "PPT 文件解析失败"), n(!1));
451
+ } catch (m) {
452
+ console.error("PPTX 解析错误:", m), h && (c(m instanceof Error ? m.message : "PPT 文件解析失败"), n(!1));
444
453
  }
445
- }, f = setTimeout(() => {
446
- m();
454
+ }, x = setTimeout(() => {
455
+ l();
447
456
  }, 100);
448
457
  return () => {
449
- if (l = !1, clearTimeout(f), a.current = null, s.current)
458
+ if (h = !1, clearTimeout(x), a.current = null, i.current)
450
459
  try {
451
- s.current.destroy();
452
- } catch (y) {
453
- console.error("销毁预览器失败:", y);
460
+ i.current.destroy();
461
+ } catch (m) {
462
+ console.error("销毁预览器失败:", m);
454
463
  }
455
- s.current = null;
464
+ i.current = null;
456
465
  };
457
- }, [r, h]), /* @__PURE__ */ p("div", { className: "relative flex flex-col items-center w-full h-full pt-[8px]", children: [
458
- t && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ p("div", { className: "text-center", children: [
466
+ }, [t, u]), /* @__PURE__ */ f("div", { className: "relative flex flex-col items-center w-full h-full pt-[8px]", children: [
467
+ r && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
459
468
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 border-4 border-white/20 border-t-white rounded-full animate-spin" }),
460
469
  /* @__PURE__ */ e("p", { className: "text-sm text-white/70 font-medium", children: "加载 PPT 中..." })
461
470
  ] }) }),
462
- i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ p("div", { className: "text-center max-w-md", children: [
463
- /* @__PURE__ */ e("div", { className: "w-32 h-32 mx-auto mb-6 rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl", children: /* @__PURE__ */ e(G, { className: "w-16 h-16 text-white" }) }),
471
+ s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50 backdrop-blur-sm z-10 rounded-2xl", children: /* @__PURE__ */ f("div", { className: "text-center max-w-md", children: [
472
+ /* @__PURE__ */ e("div", { className: "w-32 h-32 mx-auto mb-6 rounded-3xl bg-gradient-to-br from-orange-500 via-red-500 to-pink-500 flex items-center justify-center shadow-2xl", children: /* @__PURE__ */ e(J, { className: "w-16 h-16 text-white" }) }),
464
473
  /* @__PURE__ */ e("p", { className: "text-xl text-white/90 mb-3 font-medium", children: "PPT 预览" }),
465
- /* @__PURE__ */ e("p", { className: "text-sm text-white/60 mb-6", children: i || "浏览器暂不支持直接预览 PPT 文件" }),
466
- /* @__PURE__ */ p(
474
+ /* @__PURE__ */ e("p", { className: "text-sm text-white/60 mb-6", children: s || "浏览器暂不支持直接预览 PPT 文件" }),
475
+ /* @__PURE__ */ f(
467
476
  "a",
468
477
  {
469
- href: r,
478
+ href: t,
470
479
  download: !0,
471
480
  className: "inline-flex items-center gap-2 px-6 py-3 bg-gradient-to-r from-purple-500 to-pink-500 text-white rounded-xl hover:scale-105 transition-all shadow-lg",
472
481
  children: [
@@ -485,9 +494,9 @@ const Te = ({
485
494
  }
486
495
  )
487
496
  ] });
488
- }, Re = (r) => {
489
- var i;
490
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase().split("?")[0]) || "";
497
+ }, ze = (t) => {
498
+ var s;
499
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase().split("?")[0]) || "";
491
500
  return {
492
501
  mp4: "video/mp4",
493
502
  webm: "video/webm",
@@ -500,14 +509,14 @@ const Te = ({
500
509
  m4v: "video/mp4",
501
510
  "3gp": "video/3gpp",
502
511
  flv: "video/x-flv"
503
- }[t] || "video/mp4";
504
- }, De = ({ url: r }) => {
505
- const [t, n] = w(null), [i, c] = w(!0), d = S(null), s = S(null);
506
- return M(() => {
507
- if (!s.current && d.current) {
512
+ }[r] || "video/mp4";
513
+ }, Fe = ({ url: t }) => {
514
+ const [r, n] = b(null), [s, c] = b(!0), d = P(null), i = P(null);
515
+ return C(() => {
516
+ if (!i.current && d.current) {
508
517
  const o = document.createElement("video-js");
509
518
  o.classList.add("vjs-big-play-centered", "vjs-theme-apple"), d.current.appendChild(o);
510
- const a = Re(r), u = we(o, {
519
+ const a = ze(t), p = ve(o, {
511
520
  controls: !0,
512
521
  responsive: !0,
513
522
  fluid: !0,
@@ -536,29 +545,29 @@ const Te = ({
536
545
  nativeTextTracks: !1
537
546
  },
538
547
  sources: a === "video/quicktime" ? [
539
- { src: r, type: "video/quicktime" },
540
- { src: r, type: "video/mp4" }
548
+ { src: t, type: "video/quicktime" },
549
+ { src: t, type: "video/mp4" }
541
550
  // 备用方案
542
- ] : [{ src: r, type: a }]
551
+ ] : [{ src: t, type: a }]
543
552
  });
544
- u.on("loadeddata", () => {
553
+ p.on("loadeddata", () => {
545
554
  c(!1);
546
- }), u.on("error", () => {
547
- const h = u.error();
548
- console.error("Video.js error:", h), n(`视频加载失败: ${(h == null ? void 0 : h.message) || "未知错误"}`), c(!1);
549
- }), s.current = u;
555
+ }), p.on("error", () => {
556
+ const u = p.error();
557
+ console.error("Video.js error:", u), n(`视频加载失败: ${(u == null ? void 0 : u.message) || "未知错误"}`), c(!1);
558
+ }), i.current = p;
550
559
  }
551
- }, [r]), M(() => {
552
- const o = s.current;
560
+ }, [t]), C(() => {
561
+ const o = i.current;
553
562
  return () => {
554
- o && !o.isDisposed() && (o.dispose(), s.current = null);
563
+ o && !o.isDisposed() && (o.dispose(), i.current = null);
555
564
  };
556
- }, []), t ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ p("div", { className: "text-center", children: [
565
+ }, []), r ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
557
566
  /* @__PURE__ */ e("div", { className: "w-16 h-16 mx-auto mb-4 rounded-full bg-red-500/10 flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-8 h-8 text-red-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }),
558
567
  /* @__PURE__ */ e("p", { className: "text-lg font-medium text-white/90 mb-2", children: "视频加载失败" }),
559
- /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: t })
560
- ] }) }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full p-8", children: /* @__PURE__ */ p("div", { className: "w-full max-w-5xl relative", children: [
561
- i && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10", children: /* @__PURE__ */ p("div", { className: "text-center", children: [
568
+ /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: r })
569
+ ] }) }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full p-8", children: /* @__PURE__ */ f("div", { className: "w-full max-w-5xl relative", children: [
570
+ s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/20 backdrop-blur-sm rounded-2xl z-10", children: /* @__PURE__ */ f("div", { className: "text-center", children: [
562
571
  /* @__PURE__ */ e("div", { className: "w-12 h-12 mx-auto mb-3 border-3 border-white/20 border-t-white rounded-full animate-spin" }),
563
572
  /* @__PURE__ */ e("p", { className: "text-sm text-white/70 font-medium", children: "加载视频中..." })
564
573
  ] }) }),
@@ -573,55 +582,55 @@ const Te = ({
573
582
  }
574
583
  )
575
584
  ] }) });
576
- }, Ee = ({ url: r, fileName: t }) => {
577
- const [n, i] = w(null), [c, d] = w(!1), [s, o] = w(0), [a, g] = w(0), [u, h] = w(1), [v, l] = w(!1), m = S(null);
578
- M(() => {
579
- const x = m.current;
580
- if (!x) return;
585
+ }, $e = ({ url: t, fileName: r }) => {
586
+ const [n, s] = b(null), [c, d] = b(!1), [i, o] = b(0), [a, w] = b(0), [p, u] = b(1), [v, h] = b(!1), l = P(null);
587
+ C(() => {
588
+ const g = l.current;
589
+ if (!g) return;
581
590
  const j = () => {
582
- isNaN(x.currentTime) || o(x.currentTime);
591
+ isNaN(g.currentTime) || o(g.currentTime);
583
592
  }, N = () => {
584
- !isNaN(x.duration) && isFinite(x.duration) && g(x.duration);
585
- }, R = () => d(!1), b = () => N();
586
- return x.addEventListener("timeupdate", j), x.addEventListener("loadedmetadata", N), x.addEventListener("durationchange", N), x.addEventListener("canplay", b), x.addEventListener("ended", R), x.readyState >= 1 && N(), () => {
587
- x.removeEventListener("timeupdate", j), x.removeEventListener("loadedmetadata", N), x.removeEventListener("durationchange", N), x.removeEventListener("canplay", b), x.removeEventListener("ended", R);
593
+ !isNaN(g.duration) && isFinite(g.duration) && w(g.duration);
594
+ }, D = () => d(!1), S = () => N();
595
+ return g.addEventListener("timeupdate", j), g.addEventListener("loadedmetadata", N), g.addEventListener("durationchange", N), g.addEventListener("canplay", S), g.addEventListener("ended", D), g.readyState >= 1 && N(), () => {
596
+ g.removeEventListener("timeupdate", j), g.removeEventListener("loadedmetadata", N), g.removeEventListener("durationchange", N), g.removeEventListener("canplay", S), g.removeEventListener("ended", D);
588
597
  };
589
598
  }, []);
590
- const f = () => {
591
- m.current && (c ? m.current.pause() : m.current.play(), d(!c));
592
- }, y = (x) => {
593
- const j = parseFloat(x.target.value);
594
- o(j), m.current && (m.current.currentTime = j);
595
- }, k = (x) => {
596
- const j = parseFloat(x.target.value);
597
- h(j), m.current && (m.current.volume = j), j > 0 && l(!1);
599
+ const x = () => {
600
+ l.current && (c ? l.current.pause() : l.current.play(), d(!c));
601
+ }, m = (g) => {
602
+ const j = parseFloat(g.target.value);
603
+ o(j), l.current && (l.current.currentTime = j);
604
+ }, k = (g) => {
605
+ const j = parseFloat(g.target.value);
606
+ u(j), l.current && (l.current.volume = j), j > 0 && h(!1);
598
607
  }, T = () => {
599
- m.current && (m.current.muted = !v, l(!v));
600
- }, L = (x) => {
601
- m.current && (m.current.currentTime += x);
602
- }, P = (x) => {
603
- if (!isFinite(x) || isNaN(x) || x < 0) return "0:00";
604
- const j = Math.floor(x / 60), N = Math.floor(x % 60);
608
+ l.current && (l.current.muted = !v, h(!v));
609
+ }, L = (g) => {
610
+ l.current && (l.current.currentTime += g);
611
+ }, R = (g) => {
612
+ if (!isFinite(g) || isNaN(g) || g < 0) return "0:00";
613
+ const j = Math.floor(g / 60), N = Math.floor(g % 60);
605
614
  return `${j}:${N.toString().padStart(2, "0")}`;
606
615
  }, z = () => {
607
- i("音频加载失败");
616
+ s("音频加载失败");
608
617
  };
609
- return n ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: n }) }) }) : /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-8", children: [
610
- /* @__PURE__ */ e("div", { className: "w-64 h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl", children: /* @__PURE__ */ e(I, { className: "w-32 h-32 text-white" }) }),
611
- /* @__PURE__ */ p("div", { className: "text-white text-center max-w-md", children: [
612
- /* @__PURE__ */ e("p", { className: "text-2xl font-medium mb-1", children: t }),
618
+ return n ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: n }) }) }) : /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-8", children: [
619
+ /* @__PURE__ */ e("div", { className: "w-64 h-64 rounded-3xl bg-gradient-to-br from-purple-500 via-pink-500 to-rose-500 flex items-center justify-center shadow-2xl backdrop-blur-xl", children: /* @__PURE__ */ e(K, { className: "w-32 h-32 text-white" }) }),
620
+ /* @__PURE__ */ f("div", { className: "text-white text-center max-w-md", children: [
621
+ /* @__PURE__ */ e("p", { className: "text-2xl font-medium mb-1", children: r }),
613
622
  /* @__PURE__ */ e("p", { className: "text-sm text-white/60", children: "音频文件" })
614
623
  ] }),
615
- /* @__PURE__ */ p("div", { className: "w-full max-w-md bg-white/10 backdrop-blur-xl rounded-2xl p-6 border border-white/20", children: [
616
- /* @__PURE__ */ p("div", { className: "mb-4", children: [
617
- /* @__PURE__ */ p("div", { className: "relative h-4 flex items-center", children: [
624
+ /* @__PURE__ */ f("div", { className: "w-full max-w-md bg-white/10 backdrop-blur-xl rounded-2xl p-6 border border-white/20", children: [
625
+ /* @__PURE__ */ f("div", { className: "mb-4", children: [
626
+ /* @__PURE__ */ f("div", { className: "relative h-4 flex items-center", children: [
618
627
  /* @__PURE__ */ e("div", { className: "absolute w-full h-[6px] bg-white/20 rounded-full" }),
619
628
  /* @__PURE__ */ e(
620
629
  "div",
621
630
  {
622
631
  className: "absolute h-[6px] bg-gradient-to-r from-purple-500 to-pink-500 rounded-full transition-all duration-100 ease-linear pointer-events-none",
623
632
  style: {
624
- width: `${a > 0 ? s / a * 100 : s > 100 ? 100 : s}%`
633
+ width: `${a > 0 ? i / a * 100 : i > 100 ? 100 : i}%`
625
634
  }
626
635
  }
627
636
  ),
@@ -630,33 +639,33 @@ const Te = ({
630
639
  {
631
640
  type: "range",
632
641
  min: "0",
633
- max: a > 0 ? a : 100 + (s > 100 ? s % 100 : 0),
634
- value: s,
635
- onChange: y,
642
+ max: a > 0 ? a : 100 + (i > 100 ? i % 100 : 0),
643
+ value: i,
644
+ onChange: m,
636
645
  className: "audio-slider absolute w-full"
637
646
  }
638
647
  )
639
648
  ] }),
640
- /* @__PURE__ */ p("div", { className: "flex justify-between text-xs text-white/60 mt-3", children: [
641
- /* @__PURE__ */ e("span", { children: P(s) }),
642
- /* @__PURE__ */ e("span", { children: P(a) })
649
+ /* @__PURE__ */ f("div", { className: "flex justify-between text-xs text-white/60 mt-3", children: [
650
+ /* @__PURE__ */ e("span", { children: R(i) }),
651
+ /* @__PURE__ */ e("span", { children: R(a) })
643
652
  ] })
644
653
  ] }),
645
- /* @__PURE__ */ p("div", { className: "flex items-center justify-center gap-4 mb-4", children: [
654
+ /* @__PURE__ */ f("div", { className: "flex items-center justify-center gap-4 mb-4", children: [
646
655
  /* @__PURE__ */ e(
647
656
  "button",
648
657
  {
649
658
  onClick: () => L(-10),
650
659
  className: "w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",
651
- children: /* @__PURE__ */ e(Y, { className: "w-5 h-5" })
660
+ children: /* @__PURE__ */ e(Q, { className: "w-5 h-5" })
652
661
  }
653
662
  ),
654
663
  /* @__PURE__ */ e(
655
664
  "button",
656
665
  {
657
- onClick: f,
666
+ onClick: x,
658
667
  className: "w-14 h-14 rounded-full bg-gradient-to-br from-purple-500 to-pink-500 hover:scale-105 flex items-center justify-center text-white transition-all shadow-lg",
659
- children: c ? /* @__PURE__ */ e(K, { className: "w-6 h-6" }) : /* @__PURE__ */ e(Q, { className: "w-6 h-6 ml-1" })
668
+ children: c ? /* @__PURE__ */ e(ee, { className: "w-6 h-6" }) : /* @__PURE__ */ e(te, { className: "w-6 h-6 ml-1" })
660
669
  }
661
670
  ),
662
671
  /* @__PURE__ */ e(
@@ -664,27 +673,27 @@ const Te = ({
664
673
  {
665
674
  onClick: () => L(10),
666
675
  className: "w-10 h-10 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white transition-all",
667
- children: /* @__PURE__ */ e(J, { className: "w-5 h-5" })
676
+ children: /* @__PURE__ */ e(re, { className: "w-5 h-5" })
668
677
  }
669
678
  )
670
679
  ] }),
671
- /* @__PURE__ */ p("div", { className: "flex items-center gap-3", children: [
680
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-3", children: [
672
681
  /* @__PURE__ */ e(
673
682
  "button",
674
683
  {
675
684
  onClick: T,
676
685
  className: "text-white/80 hover:text-white transition-colors",
677
- children: v || u === 0 ? /* @__PURE__ */ e(ee, { className: "w-5 h-5" }) : /* @__PURE__ */ e(te, { className: "w-5 h-5" })
686
+ children: v || p === 0 ? /* @__PURE__ */ e(oe, { className: "w-5 h-5" }) : /* @__PURE__ */ e(ne, { className: "w-5 h-5" })
678
687
  }
679
688
  ),
680
- /* @__PURE__ */ p("div", { className: "flex-1 relative h-3 flex items-center", children: [
689
+ /* @__PURE__ */ f("div", { className: "flex-1 relative h-3 flex items-center", children: [
681
690
  /* @__PURE__ */ e("div", { className: "absolute w-full h-[4px] bg-white/20 rounded-full" }),
682
691
  /* @__PURE__ */ e(
683
692
  "div",
684
693
  {
685
694
  className: "absolute h-[4px] bg-purple-500 rounded-full transition-all duration-100 pointer-events-none",
686
695
  style: {
687
- width: `${(v ? 0 : u) * 100}%`
696
+ width: `${(v ? 0 : p) * 100}%`
688
697
  }
689
698
  }
690
699
  ),
@@ -695,7 +704,7 @@ const Te = ({
695
704
  min: "0",
696
705
  max: "1",
697
706
  step: "0.01",
698
- value: v ? 0 : u,
707
+ value: v ? 0 : p,
699
708
  onChange: k,
700
709
  className: "volume-slider absolute w-full"
701
710
  }
@@ -706,14 +715,14 @@ const Te = ({
706
715
  /* @__PURE__ */ e(
707
716
  "audio",
708
717
  {
709
- ref: m,
710
- src: r,
718
+ ref: l,
719
+ src: t,
711
720
  onError: z,
712
721
  className: "hidden"
713
722
  }
714
723
  )
715
724
  ] });
716
- }, q = {
725
+ }, _ = {
717
726
  'pre[class*="language-"]': {
718
727
  color: "#d4d4d4",
719
728
  fontSize: "13px",
@@ -994,41 +1003,41 @@ const Te = ({
994
1003
  boxShadow: "inset 5px 0 0 #f7d87c",
995
1004
  zIndex: "0"
996
1005
  }
997
- }, ze = ({ url: r }) => {
998
- const [t, n] = w(""), [i, c] = w(!0), [d, s] = w(null);
999
- return M(() => {
1006
+ }, We = ({ url: t }) => {
1007
+ const [r, n] = b(""), [s, c] = b(!0), [d, i] = b(null);
1008
+ return C(() => {
1000
1009
  (async () => {
1001
1010
  try {
1002
- c(!0), s(null);
1003
- const a = await fetch(r);
1011
+ c(!0), i(null);
1012
+ const a = await fetch(t);
1004
1013
  if (!a.ok)
1005
1014
  throw new Error("加载失败");
1006
- const g = await a.text();
1007
- n(g);
1015
+ const w = await a.text();
1016
+ n(w);
1008
1017
  } catch (a) {
1009
- s("Markdown 文件加载失败"), console.error(a);
1018
+ i("Markdown 文件加载失败"), console.error(a);
1010
1019
  } finally {
1011
1020
  c(!1);
1012
1021
  }
1013
1022
  })();
1014
- }, [r]), i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-8 border border-white/10", children: /* @__PURE__ */ e("div", { className: "prose prose-invert prose-lg max-w-none", children: /* @__PURE__ */ e(
1015
- ge,
1023
+ }, [t]), s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: d }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ e("div", { className: "max-w-4xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl p-8 border border-white/10", children: /* @__PURE__ */ e("div", { className: "prose prose-invert prose-lg max-w-none", children: /* @__PURE__ */ e(
1024
+ ye,
1016
1025
  {
1017
- remarkPlugins: [be],
1026
+ remarkPlugins: [Ne],
1018
1027
  components: {
1019
- code({ node: o, inline: a, className: g, children: u, ...h }) {
1020
- const v = /language-(\w+)/.exec(g || "");
1028
+ code({ node: o, inline: a, className: w, children: p, ...u }) {
1029
+ const v = /language-(\w+)/.exec(w || "");
1021
1030
  return !a && v ? /* @__PURE__ */ e(
1022
- X,
1031
+ Z,
1023
1032
  {
1024
- style: q,
1033
+ style: _,
1025
1034
  language: v[1],
1026
1035
  PreTag: "div",
1027
1036
  className: "rounded-lg",
1028
- ...h,
1029
- children: String(u).replace(/\n$/, "")
1037
+ ...u,
1038
+ children: String(p).replace(/\n$/, "")
1030
1039
  }
1031
- ) : /* @__PURE__ */ e("code", { className: "bg-white/10 px-1.5 py-0.5 rounded text-sm", ...h, children: u });
1040
+ ) : /* @__PURE__ */ e("code", { className: "bg-white/10 px-1.5 py-0.5 rounded text-sm", ...u, children: p });
1032
1041
  },
1033
1042
  h1: ({ children: o }) => /* @__PURE__ */ e("h1", { className: "text-4xl font-bold mb-4 text-white border-b border-white/20 pb-2", children: o }),
1034
1043
  h2: ({ children: o }) => /* @__PURE__ */ e("h2", { className: "text-3xl font-bold mb-3 text-white mt-8", children: o }),
@@ -1054,12 +1063,12 @@ const Te = ({
1054
1063
  hr: () => /* @__PURE__ */ e("hr", { className: "border-white/20 my-6" }),
1055
1064
  img: ({ src: o, alt: a }) => /* @__PURE__ */ e("img", { src: o, alt: a, className: "rounded-lg max-w-full h-auto my-4" })
1056
1065
  },
1057
- children: t
1066
+ children: r
1058
1067
  }
1059
1068
  ) }) }) });
1060
- }, Fe = (r) => {
1061
- var i;
1062
- const t = ((i = r.split(".").pop()) == null ? void 0 : i.toLowerCase()) || "";
1069
+ }, Be = (t) => {
1070
+ var s;
1071
+ const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
1063
1072
  return {
1064
1073
  js: "javascript",
1065
1074
  jsx: "jsx",
@@ -1095,35 +1104,35 @@ const Te = ({
1095
1104
  conf: "nginx",
1096
1105
  md: "markdown",
1097
1106
  txt: "text"
1098
- }[t] || "text";
1099
- }, We = ({ url: r, fileName: t }) => {
1100
- const [n, i] = w(""), [c, d] = w(!0), [s, o] = w(null), a = Fe(t);
1101
- return M(() => {
1107
+ }[r] || "text";
1108
+ }, He = ({ url: t, fileName: r }) => {
1109
+ const [n, s] = b(""), [c, d] = b(!0), [i, o] = b(null), a = Be(r);
1110
+ return C(() => {
1102
1111
  (async () => {
1103
1112
  try {
1104
1113
  d(!0), o(null);
1105
- const u = await fetch(r);
1106
- if (!u.ok)
1114
+ const p = await fetch(t);
1115
+ if (!p.ok)
1107
1116
  throw new Error("加载失败");
1108
- const h = await u.text();
1109
- i(h);
1110
- } catch (u) {
1111
- o("文本文件加载失败"), console.error(u);
1117
+ const u = await p.text();
1118
+ s(u);
1119
+ } catch (p) {
1120
+ o("文本文件加载失败"), console.error(p);
1112
1121
  } finally {
1113
1122
  d(!1);
1114
1123
  }
1115
1124
  })();
1116
- }, [r]), c ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : s ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: s }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ p("div", { className: "max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden", children: [
1117
- /* @__PURE__ */ p("div", { className: "flex items-center gap-3 px-6 py-4 bg-white/5 border-b border-white/10", children: [
1118
- /* @__PURE__ */ e(re, { className: "w-5 h-5 text-white/70" }),
1119
- /* @__PURE__ */ e("span", { className: "text-white font-medium", children: t }),
1125
+ }, [t]), c ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin" }) }) : i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ e("div", { className: "text-white/70 text-center", children: /* @__PURE__ */ e("p", { className: "text-lg", children: i }) }) }) : /* @__PURE__ */ e("div", { className: "w-full h-full overflow-auto p-8", children: /* @__PURE__ */ f("div", { className: "max-w-6xl mx-auto bg-white/5 backdrop-blur-sm rounded-2xl border border-white/10 overflow-hidden", children: [
1126
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-3 px-6 py-4 bg-white/5 border-b border-white/10", children: [
1127
+ /* @__PURE__ */ e(le, { className: "w-5 h-5 text-white/70" }),
1128
+ /* @__PURE__ */ e("span", { className: "text-white font-medium", children: r }),
1120
1129
  /* @__PURE__ */ e("span", { className: "ml-auto text-xs text-white/50 uppercase", children: a })
1121
1130
  ] }),
1122
1131
  /* @__PURE__ */ e("div", { className: "text-sm", children: a === "text" ? /* @__PURE__ */ e("pre", { className: "p-6 text-white/90 font-mono whitespace-pre-wrap break-words", children: n }) : /* @__PURE__ */ e(
1123
- X,
1132
+ Z,
1124
1133
  {
1125
1134
  language: a,
1126
- style: q,
1135
+ style: _,
1127
1136
  showLineNumbers: !0,
1128
1137
  customStyle: {
1129
1138
  margin: 0,
@@ -1141,51 +1150,51 @@ const Te = ({
1141
1150
  }
1142
1151
  ) })
1143
1152
  ] }) });
1144
- }, $e = ({
1145
- fileName: r,
1146
- fileType: t,
1153
+ }, Ae = ({
1154
+ fileName: t,
1155
+ fileType: r,
1147
1156
  onDownload: n
1148
- }) => /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-6", children: [
1149
- /* @__PURE__ */ e("div", { className: "w-32 h-32 rounded-full bg-white/10 flex items-center justify-center", children: /* @__PURE__ */ e(oe, { className: "w-16 h-16 text-white/70" }) }),
1150
- /* @__PURE__ */ p("div", { className: "text-white text-center", children: [
1151
- /* @__PURE__ */ e("p", { className: "text-xl font-medium mb-2", children: r }),
1152
- /* @__PURE__ */ p("p", { className: "text-white/70", children: [
1157
+ }) => /* @__PURE__ */ f("div", { className: "flex flex-col items-center justify-center w-full h-full p-8 gap-6", children: [
1158
+ /* @__PURE__ */ e("div", { className: "w-32 h-32 rounded-full bg-white/10 flex items-center justify-center", children: /* @__PURE__ */ e(ae, { className: "w-16 h-16 text-white/70" }) }),
1159
+ /* @__PURE__ */ f("div", { className: "text-white text-center", children: [
1160
+ /* @__PURE__ */ e("p", { className: "text-xl font-medium mb-2", children: t }),
1161
+ /* @__PURE__ */ f("p", { className: "text-white/70", children: [
1153
1162
  "不支持预览此文件类型 (",
1154
- t,
1163
+ r,
1155
1164
  ")"
1156
1165
  ] })
1157
1166
  ] }),
1158
- /* @__PURE__ */ p(
1167
+ /* @__PURE__ */ f(
1159
1168
  "button",
1160
1169
  {
1161
1170
  onClick: n,
1162
1171
  className: "flex items-center gap-2 px-6 py-3 bg-white/10 hover:bg-white/20 backdrop-blur-sm rounded-lg text-white font-medium transition-all",
1163
1172
  children: [
1164
- /* @__PURE__ */ e(V, { className: "w-5 h-5" }),
1173
+ /* @__PURE__ */ e(q, { className: "w-5 h-5" }),
1165
1174
  "下载文件查看"
1166
1175
  ]
1167
1176
  }
1168
1177
  )
1169
- ] }), Be = (r) => {
1178
+ ] }), Ue = (t) => {
1170
1179
  var c;
1171
- const t = ((c = r.name.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "", n = r.type.toLowerCase();
1172
- if (n.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(t))
1180
+ const r = ((c = t.name.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "", n = t.type.toLowerCase();
1181
+ if (n.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(r))
1173
1182
  return "image";
1174
- if (n.includes("pdf") || t === "pdf")
1183
+ if (n.includes("pdf") || r === "pdf")
1175
1184
  return "pdf";
1176
- if (n.includes("wordprocessingml") || t === "docx")
1185
+ if (n.includes("wordprocessingml") || r === "docx")
1177
1186
  return "docx";
1178
- if (n.includes("spreadsheetml") || t === "xlsx")
1187
+ if (n.includes("spreadsheetml") || r === "xlsx")
1179
1188
  return "xlsx";
1180
- if (n.includes("presentationml") || t === "pptx" || t === "ppt")
1189
+ if (n.includes("presentationml") || r === "pptx" || r === "ppt")
1181
1190
  return "pptx";
1182
- if (n.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(t))
1191
+ if (n.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(r))
1183
1192
  return "video";
1184
- if (n.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(t))
1193
+ if (n.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(r))
1185
1194
  return "audio";
1186
- if (t === "md" || t === "markdown")
1195
+ if (r === "md" || r === "markdown")
1187
1196
  return "markdown";
1188
- const i = [
1197
+ const s = [
1189
1198
  "txt",
1190
1199
  "log",
1191
1200
  "csv",
@@ -1222,236 +1231,239 @@ const Te = ({
1222
1231
  "zsh",
1223
1232
  "sql"
1224
1233
  ];
1225
- return n.startsWith("text/") || i.includes(t) ? "text" : "unsupported";
1226
- }, Ye = ({
1227
- files: r,
1228
- currentIndex: t,
1234
+ return n.startsWith("text/") || s.includes(r) ? "text" : "unsupported";
1235
+ }, et = ({
1236
+ files: t,
1237
+ currentIndex: r,
1229
1238
  isOpen: n,
1230
- onClose: i,
1231
- onNavigate: c
1239
+ onClose: s,
1240
+ onNavigate: c,
1241
+ customRenderers: d = []
1232
1242
  }) => {
1233
- const [d, s] = w(1), [o, a] = w(0), [g, u] = w(1), [, h] = w(1), v = Z(() => Ne(r), [r]), l = v[t], m = l ? Be(l) : "unsupported";
1234
- M(() => {
1235
- s(1), a(0), u(1), h(1);
1236
- }, [t]), M(() => {
1243
+ const [i, o] = b(1), [a, w] = b(0), [p, u] = b(1), [, v] = b(1), h = O(() => Te(t), [t]), l = h[r], x = O(() => l ? d.find((y) => y.test(l)) : null, [l, d]), m = l ? Ue(l) : "unsupported";
1244
+ C(() => {
1245
+ o(1), w(0), u(1), v(1);
1246
+ }, [r]), C(() => {
1237
1247
  if (n) {
1238
- const b = document.body.style.overflow, E = document.body.style.paddingRight, H = window.innerWidth - document.documentElement.clientWidth;
1239
- return document.body.style.overflow = "hidden", H > 0 && (document.body.style.paddingRight = `${H}px`), () => {
1240
- document.body.style.overflow = b, document.body.style.paddingRight = E;
1248
+ const y = document.body.style.overflow, $ = document.body.style.paddingRight, U = window.innerWidth - document.documentElement.clientWidth;
1249
+ return document.body.style.overflow = "hidden", U > 0 && (document.body.style.paddingRight = `${U}px`), () => {
1250
+ document.body.style.overflow = y, document.body.style.paddingRight = $;
1241
1251
  };
1242
1252
  }
1243
- }, [n]), M(() => {
1253
+ }, [n]), C(() => {
1244
1254
  if (!n) return;
1245
- const b = (E) => {
1246
- E.key === "Escape" ? i() : E.key === "ArrowLeft" && t > 0 ? c == null || c(t - 1) : E.key === "ArrowRight" && t < v.length - 1 && (c == null || c(t + 1));
1255
+ const y = ($) => {
1256
+ $.key === "Escape" ? s() : $.key === "ArrowLeft" && r > 0 ? c == null || c(r - 1) : $.key === "ArrowRight" && r < h.length - 1 && (c == null || c(r + 1));
1247
1257
  };
1248
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
1249
- }, [n, t, v.length, i, c]);
1250
- const f = C(() => {
1251
- s((b) => Math.min(b + 0.25, 5));
1252
- }, []), y = C(() => {
1253
- s((b) => Math.max(b - 0.25, 0.5));
1254
- }, []), k = C(() => {
1255
- a((b) => b + 90);
1256
- }, []), T = C(() => {
1257
- a((b) => b - 90);
1258
- }, []), L = C(() => {
1259
- s(1), a(0);
1260
- }, []), P = C(() => {
1261
- s(1);
1262
- }, []), z = C((b) => {
1263
- s(b);
1264
- }, []), x = C(() => {
1265
- s(1), a(0);
1266
- }, []), j = C(() => {
1258
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
1259
+ }, [n, r, h.length, s, c]);
1260
+ const k = M(() => {
1261
+ o((y) => Math.min(y + 0.25, 5));
1262
+ }, []), T = M(() => {
1263
+ o((y) => Math.max(y - 0.25, 0.5));
1264
+ }, []), L = M(() => {
1265
+ w((y) => y + 90);
1266
+ }, []), R = M(() => {
1267
+ w((y) => y - 90);
1268
+ }, []), z = M(() => {
1269
+ o(1), w(0);
1270
+ }, []), g = M(() => {
1271
+ o(1);
1272
+ }, []), j = M((y) => {
1273
+ o(y);
1274
+ }, []), N = M(() => {
1275
+ o(1), w(0);
1276
+ }, []), D = M(() => {
1267
1277
  if (!l) return;
1268
- const b = document.createElement("a");
1269
- b.href = l.url, b.download = l.name, b.click();
1278
+ const y = document.createElement("a");
1279
+ y.href = l.url, y.download = l.name, y.click();
1270
1280
  }, [l]);
1271
1281
  if (!n || !l) return null;
1272
- const N = m === "image" || m === "pdf", R = m === "image";
1273
- return /* @__PURE__ */ e(_, { children: n && /* @__PURE__ */ e(
1274
- F.div,
1282
+ const S = m === "image" || m === "pdf", F = m === "image", G = /* @__PURE__ */ e(Y, { children: n && /* @__PURE__ */ e(
1283
+ H.div,
1275
1284
  {
1276
1285
  initial: { opacity: 0 },
1277
1286
  animate: { opacity: 1 },
1278
1287
  exit: { opacity: 0 },
1279
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-md overflow-hidden",
1280
- onClick: i,
1281
- onWheel: (b) => b.stopPropagation(),
1282
- children: /* @__PURE__ */ p(
1288
+ className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-md overflow-hidden",
1289
+ onClick: s,
1290
+ onWheel: (y) => y.stopPropagation(),
1291
+ children: /* @__PURE__ */ f(
1283
1292
  "div",
1284
1293
  {
1285
1294
  className: "relative w-full h-full flex flex-col overflow-hidden",
1286
- onClick: (b) => b.stopPropagation(),
1295
+ onClick: (y) => y.stopPropagation(),
1287
1296
  children: [
1288
1297
  /* @__PURE__ */ e(
1289
- F.div,
1298
+ H.div,
1290
1299
  {
1291
1300
  initial: { y: -100 },
1292
1301
  animate: { y: 0 },
1293
1302
  exit: { y: -100 },
1294
1303
  className: "absolute top-0 left-0 right-0 z-10 p-4",
1295
- children: /* @__PURE__ */ p("div", { className: "max-w-7xl mx-auto flex items-center justify-between bg-black/40 backdrop-blur-xl rounded-2xl px-6 py-4 shadow-2xl border border-white/10", children: [
1296
- /* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
1304
+ children: /* @__PURE__ */ f("div", { className: "max-w-7xl mx-auto flex items-center justify-between bg-black/40 backdrop-blur-xl rounded-2xl px-6 py-4 shadow-2xl border border-white/10", children: [
1305
+ /* @__PURE__ */ f("div", { className: "flex-1 min-w-0", children: [
1297
1306
  /* @__PURE__ */ e("h2", { className: "text-white font-medium text-lg truncate", children: l.name }),
1298
- /* @__PURE__ */ p("p", { className: "text-white/60 text-sm", children: [
1299
- t + 1,
1307
+ /* @__PURE__ */ f("p", { className: "text-white/60 text-sm", children: [
1308
+ r + 1,
1300
1309
  " / ",
1301
- v.length
1310
+ h.length
1302
1311
  ] })
1303
1312
  ] }),
1304
- /* @__PURE__ */ p("div", { className: "flex items-center gap-2 ml-4", children: [
1305
- N && /* @__PURE__ */ p($, { children: [
1313
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-2 ml-4", children: [
1314
+ S && /* @__PURE__ */ f(W, { children: [
1306
1315
  /* @__PURE__ */ e(
1307
- D,
1316
+ E,
1308
1317
  {
1309
- icon: /* @__PURE__ */ e(ne, { className: "w-5 h-5" }),
1318
+ icon: /* @__PURE__ */ e(se, { className: "w-5 h-5" }),
1310
1319
  label: "缩小",
1311
- onClick: y,
1312
- disabled: d <= 0.5
1320
+ onClick: T,
1321
+ disabled: i <= 0.5
1313
1322
  }
1314
1323
  ),
1315
- /* @__PURE__ */ p("span", { className: "text-white/70 text-sm min-w-[4rem] text-center font-medium", children: [
1316
- Math.round(d * 100),
1324
+ /* @__PURE__ */ f("span", { className: "text-white/70 text-sm min-w-[4rem] text-center font-medium", children: [
1325
+ Math.round(i * 100),
1317
1326
  "%"
1318
1327
  ] }),
1319
1328
  /* @__PURE__ */ e(
1320
- D,
1329
+ E,
1321
1330
  {
1322
- icon: /* @__PURE__ */ e(le, { className: "w-5 h-5" }),
1331
+ icon: /* @__PURE__ */ e(ie, { className: "w-5 h-5" }),
1323
1332
  label: "放大",
1324
- onClick: f,
1325
- disabled: d >= 5
1333
+ onClick: k,
1334
+ disabled: i >= 5
1326
1335
  }
1327
1336
  ),
1328
1337
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" }),
1329
1338
  /* @__PURE__ */ e(
1330
- D,
1339
+ E,
1331
1340
  {
1332
- icon: /* @__PURE__ */ e(ae, { className: "w-5 h-5" }),
1341
+ icon: /* @__PURE__ */ e(ce, { className: "w-5 h-5" }),
1333
1342
  label: "适应窗口",
1334
- onClick: L
1343
+ onClick: z
1335
1344
  }
1336
1345
  ),
1337
1346
  /* @__PURE__ */ e(
1338
- D,
1347
+ E,
1339
1348
  {
1340
- icon: /* @__PURE__ */ e(se, { className: "w-5 h-5" }),
1349
+ icon: /* @__PURE__ */ e(de, { className: "w-5 h-5" }),
1341
1350
  label: "原始尺寸",
1342
- onClick: P
1351
+ onClick: g
1343
1352
  }
1344
1353
  ),
1345
1354
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" })
1346
1355
  ] }),
1347
- R && /* @__PURE__ */ p($, { children: [
1356
+ F && /* @__PURE__ */ f(W, { children: [
1348
1357
  /* @__PURE__ */ e(
1349
- D,
1358
+ E,
1350
1359
  {
1351
- icon: /* @__PURE__ */ e(ie, { className: "w-5 h-5" }),
1360
+ icon: /* @__PURE__ */ e(me, { className: "w-5 h-5" }),
1352
1361
  label: "向左旋转",
1353
- onClick: T
1362
+ onClick: R
1354
1363
  }
1355
1364
  ),
1356
1365
  /* @__PURE__ */ e(
1357
- D,
1366
+ E,
1358
1367
  {
1359
- icon: /* @__PURE__ */ e(ce, { className: "w-5 h-5" }),
1368
+ icon: /* @__PURE__ */ e(ue, { className: "w-5 h-5" }),
1360
1369
  label: "向右旋转",
1361
- onClick: k
1370
+ onClick: L
1362
1371
  }
1363
1372
  ),
1364
1373
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" })
1365
1374
  ] }),
1366
- (N || R) && /* @__PURE__ */ p($, { children: [
1375
+ (S || F) && /* @__PURE__ */ f(W, { children: [
1367
1376
  /* @__PURE__ */ e(
1368
- D,
1377
+ E,
1369
1378
  {
1370
- icon: /* @__PURE__ */ e(de, { className: "w-5 h-5" }),
1379
+ icon: /* @__PURE__ */ e(he, { className: "w-5 h-5" }),
1371
1380
  label: "复原",
1372
- onClick: x
1381
+ onClick: N
1373
1382
  }
1374
1383
  ),
1375
1384
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" })
1376
1385
  ] }),
1377
1386
  /* @__PURE__ */ e(
1378
- D,
1387
+ E,
1379
1388
  {
1380
- icon: /* @__PURE__ */ e(V, { className: "w-5 h-5" }),
1389
+ icon: /* @__PURE__ */ e(q, { className: "w-5 h-5" }),
1381
1390
  label: "下载",
1382
- onClick: j
1391
+ onClick: D
1383
1392
  }
1384
1393
  ),
1385
1394
  /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/20 mx-2" }),
1386
1395
  /* @__PURE__ */ e(
1387
- D,
1396
+ E,
1388
1397
  {
1389
- icon: /* @__PURE__ */ e(me, { className: "w-5 h-5" }),
1398
+ icon: /* @__PURE__ */ e(pe, { className: "w-5 h-5" }),
1390
1399
  label: "关闭",
1391
- onClick: i
1400
+ onClick: s
1392
1401
  }
1393
1402
  )
1394
1403
  ] })
1395
1404
  ] })
1396
1405
  }
1397
1406
  ),
1398
- /* @__PURE__ */ p("div", { className: "flex-1 flex items-center justify-center pt-24 pb-8 overflow-auto", children: [
1407
+ /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center pt-24 pb-8 overflow-auto", children: x ? (
1408
+ // 使用自定义渲染器
1409
+ x.render(l)
1410
+ ) : /* @__PURE__ */ f(W, { children: [
1399
1411
  m === "image" && /* @__PURE__ */ e(
1400
- ke,
1412
+ Le,
1401
1413
  {
1402
1414
  url: l.url,
1403
- zoom: d,
1404
- rotation: o,
1405
- onZoomChange: z
1415
+ zoom: i,
1416
+ rotation: a,
1417
+ onZoomChange: j
1406
1418
  }
1407
1419
  ),
1408
1420
  m === "pdf" && /* @__PURE__ */ e(
1409
- Te,
1421
+ Re,
1410
1422
  {
1411
1423
  url: l.url,
1412
- zoom: d,
1413
- currentPage: g,
1424
+ zoom: i,
1425
+ currentPage: p,
1414
1426
  onPageChange: u,
1415
- onTotalPagesChange: h
1427
+ onTotalPagesChange: v
1416
1428
  }
1417
1429
  ),
1418
- m === "docx" && /* @__PURE__ */ e(Le, { url: l.url }),
1419
- m === "xlsx" && /* @__PURE__ */ e(Se, { url: l.url }),
1420
- m === "pptx" && /* @__PURE__ */ e(Pe, { url: l.url }),
1421
- m === "video" && /* @__PURE__ */ e(De, { url: l.url }),
1422
- m === "audio" && /* @__PURE__ */ e(Ee, { url: l.url, fileName: l.name }),
1423
- m === "markdown" && /* @__PURE__ */ e(ze, { url: l.url }),
1424
- m === "text" && /* @__PURE__ */ e(We, { url: l.url, fileName: l.name }),
1430
+ m === "docx" && /* @__PURE__ */ e(Se, { url: l.url }),
1431
+ m === "xlsx" && /* @__PURE__ */ e(De, { url: l.url }),
1432
+ m === "pptx" && /* @__PURE__ */ e(Ee, { url: l.url }),
1433
+ m === "video" && /* @__PURE__ */ e(Fe, { url: l.url }),
1434
+ m === "audio" && /* @__PURE__ */ e($e, { url: l.url, fileName: l.name }),
1435
+ m === "markdown" && /* @__PURE__ */ e(We, { url: l.url }),
1436
+ m === "text" && /* @__PURE__ */ e(He, { url: l.url, fileName: l.name }),
1425
1437
  m === "unsupported" && /* @__PURE__ */ e(
1426
- $e,
1438
+ Ae,
1427
1439
  {
1428
1440
  fileName: l.name,
1429
1441
  fileType: l.type,
1430
- onDownload: j
1442
+ onDownload: D
1431
1443
  }
1432
1444
  )
1433
- ] }),
1434
- v.length > 1 && /* @__PURE__ */ p($, { children: [
1435
- t > 0 && /* @__PURE__ */ e(
1436
- F.button,
1445
+ ] }) }),
1446
+ h.length > 1 && /* @__PURE__ */ f(W, { children: [
1447
+ r > 0 && /* @__PURE__ */ e(
1448
+ H.button,
1437
1449
  {
1438
1450
  initial: { x: -100, opacity: 0 },
1439
1451
  animate: { x: 0, opacity: 1 },
1440
1452
  exit: { x: -100, opacity: 0 },
1441
- onClick: () => c == null ? void 0 : c(t - 1),
1453
+ onClick: () => c == null ? void 0 : c(r - 1),
1442
1454
  className: "absolute left-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",
1443
- children: /* @__PURE__ */ e(ue, { className: "w-6 h-6" })
1455
+ children: /* @__PURE__ */ e(fe, { className: "w-6 h-6" })
1444
1456
  }
1445
1457
  ),
1446
- t < v.length - 1 && /* @__PURE__ */ e(
1447
- F.button,
1458
+ r < h.length - 1 && /* @__PURE__ */ e(
1459
+ H.button,
1448
1460
  {
1449
1461
  initial: { x: 100, opacity: 0 },
1450
1462
  animate: { x: 0, opacity: 1 },
1451
1463
  exit: { x: 100, opacity: 0 },
1452
- onClick: () => c == null ? void 0 : c(t + 1),
1464
+ onClick: () => c == null ? void 0 : c(r + 1),
1453
1465
  className: "absolute right-4 top-1/2 -translate-y-1/2 w-12 h-12 rounded-full bg-black/40 backdrop-blur-xl border border-white/10 flex items-center justify-center text-white hover:bg-black/60 transition-all shadow-2xl",
1454
- children: /* @__PURE__ */ e(he, { className: "w-6 h-6" })
1466
+ children: /* @__PURE__ */ e(xe, { className: "w-6 h-6" })
1455
1467
  }
1456
1468
  )
1457
1469
  ] })
@@ -1460,19 +1472,23 @@ const Te = ({
1460
1472
  )
1461
1473
  }
1462
1474
  ) });
1463
- }, D = ({ icon: r, label: t, onClick: n, disabled: i }) => /* @__PURE__ */ e(
1475
+ return I(G, document.body);
1476
+ }, E = ({ icon: t, label: r, onClick: n, disabled: s }) => /* @__PURE__ */ e(
1464
1477
  "button",
1465
1478
  {
1466
1479
  onClick: n,
1467
- disabled: i,
1468
- title: t,
1469
- className: `p-2 rounded-lg transition-all ${i ? "text-white/30 cursor-not-allowed" : "text-white hover:bg-white/10 active:bg-white/20"}`,
1470
- children: r
1480
+ disabled: s,
1481
+ title: r,
1482
+ className: `p-2 rounded-lg transition-all ${s ? "text-white/30 cursor-not-allowed" : "text-white hover:bg-white/10 active:bg-white/20"}`,
1483
+ children: t
1471
1484
  }
1472
- );
1485
+ ), tt = je.version;
1473
1486
  export {
1474
- Ye as FilePreviewModal,
1475
- ye as normalizeFile,
1476
- Ne as normalizeFiles
1487
+ et as FilePreviewModal,
1488
+ tt as VERSION,
1489
+ Pe as configurePdfjs,
1490
+ Ce as normalizeFile,
1491
+ Te as normalizeFiles,
1492
+ nt as pdfjs
1477
1493
  };
1478
1494
  //# sourceMappingURL=index.mjs.map