@eternalheart/react-file-preview 1.3.9 → 1.3.11

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 (124) hide show
  1. package/README.md +10 -0
  2. package/README.zh-CN.md +10 -0
  3. package/lib/FilePreviewContent.d.ts.map +1 -1
  4. package/lib/RequestContext.d.ts +1 -1
  5. package/lib/RequestContext.d.ts.map +1 -1
  6. package/lib/chunks/RendererError-BH6fzLrN.mjs +15 -0
  7. package/lib/chunks/RendererError-BH6fzLrN.mjs.map +1 -0
  8. package/lib/chunks/avifLoader-BP3fgcMm-BnpxLhxp.mjs +56 -0
  9. package/lib/chunks/avifLoader-BP3fgcMm-BnpxLhxp.mjs.map +1 -0
  10. package/lib/chunks/heicLoader-CH_raQNn-1fBLaICM.mjs +37 -0
  11. package/lib/chunks/heicLoader-CH_raQNn-1fBLaICM.mjs.map +1 -0
  12. package/lib/chunks/index-B57rEPin.mjs +54 -0
  13. package/lib/chunks/index-B57rEPin.mjs.map +1 -0
  14. package/lib/chunks/index-BCuRRLYt.mjs +222 -0
  15. package/lib/chunks/index-BCuRRLYt.mjs.map +1 -0
  16. package/lib/chunks/{index-BSD3w5eG.mjs → index-BJ6vTNxc.mjs} +76 -75
  17. package/lib/chunks/index-BJ6vTNxc.mjs.map +1 -0
  18. package/lib/chunks/index-BYdqrqnR.mjs +161 -0
  19. package/lib/chunks/index-BYdqrqnR.mjs.map +1 -0
  20. package/lib/chunks/index-BiyghBxu.mjs +136 -0
  21. package/lib/chunks/index-BiyghBxu.mjs.map +1 -0
  22. package/lib/chunks/{index-DdOEWhrk.mjs → index-C8CyS_sj.mjs} +66 -63
  23. package/lib/chunks/index-C8CyS_sj.mjs.map +1 -0
  24. package/lib/chunks/index-C8OrFLd5.mjs +594 -0
  25. package/lib/chunks/index-C8OrFLd5.mjs.map +1 -0
  26. package/lib/chunks/{index-DGuiWJr7.mjs → index-CCkHAeLh.mjs} +40 -37
  27. package/lib/chunks/index-CCkHAeLh.mjs.map +1 -0
  28. package/lib/chunks/index-CdmkF0CO.mjs +105 -0
  29. package/lib/chunks/index-CdmkF0CO.mjs.map +1 -0
  30. package/lib/chunks/index-CuAALtwC.mjs +2299 -0
  31. package/lib/chunks/index-CuAALtwC.mjs.map +1 -0
  32. package/lib/chunks/index-D660ENHx.mjs +114 -0
  33. package/lib/chunks/index-D660ENHx.mjs.map +1 -0
  34. package/lib/chunks/{index-DV5Jd7Qe.mjs → index-DBEG73K1.mjs} +79 -78
  35. package/lib/chunks/index-DBEG73K1.mjs.map +1 -0
  36. package/lib/chunks/index-DaFlk9dd.mjs +13097 -0
  37. package/lib/chunks/index-DaFlk9dd.mjs.map +1 -0
  38. package/lib/chunks/index-_mP0FkqE.mjs +113 -0
  39. package/lib/chunks/index-_mP0FkqE.mjs.map +1 -0
  40. package/lib/chunks/{index-U3w45GW8.mjs → index-nLTQXCV7.mjs} +84 -82
  41. package/lib/chunks/index-nLTQXCV7.mjs.map +1 -0
  42. package/lib/chunks/index-nVblatyi.mjs +55 -0
  43. package/lib/chunks/index-nVblatyi.mjs.map +1 -0
  44. package/lib/chunks/{index-zEVVgWCH.mjs → index-ow-nGpuu.mjs} +99 -98
  45. package/lib/chunks/index-ow-nGpuu.mjs.map +1 -0
  46. package/lib/chunks/index-qOC5xQyK.mjs +96 -0
  47. package/lib/chunks/index-qOC5xQyK.mjs.map +1 -0
  48. package/lib/chunks/index-rUfsiVR8.mjs +12335 -0
  49. package/lib/chunks/index-rUfsiVR8.mjs.map +1 -0
  50. package/lib/chunks/jp2Loader-Bn-qPMbD-Bn-qPMbD.mjs +122 -0
  51. package/lib/chunks/jp2Loader-Bn-qPMbD-Bn-qPMbD.mjs.map +1 -0
  52. package/lib/chunks/psdLoader-Doxw3mWm-DVOGFSlh.mjs +73 -0
  53. package/lib/chunks/psdLoader-Doxw3mWm-DVOGFSlh.mjs.map +1 -0
  54. package/lib/chunks/rawLoader-0mLvxCNp-CJmERiK7.mjs +82 -0
  55. package/lib/chunks/rawLoader-0mLvxCNp-CJmERiK7.mjs.map +1 -0
  56. package/lib/chunks/tiffLoader-CTFKVLqJ-B84NfwhR.mjs +60 -0
  57. package/lib/chunks/tiffLoader-CTFKVLqJ-B84NfwhR.mjs.map +1 -0
  58. package/lib/chunks/{useShikiHighlight-DzEAK0S7.mjs → useShikiHighlight-ClbUXJ2p.mjs} +3 -3
  59. package/lib/chunks/{useShikiHighlight-DzEAK0S7.mjs.map → useShikiHighlight-ClbUXJ2p.mjs.map} +1 -1
  60. package/lib/index.cjs +33 -20
  61. package/lib/index.cjs.map +1 -1
  62. package/lib/index.css +1 -1
  63. package/lib/index.d.ts +1 -0
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/index.mjs +14 -13
  66. package/lib/renderers/Audio/index.d.ts.map +1 -1
  67. package/lib/renderers/Csv/index.d.ts.map +1 -1
  68. package/lib/renderers/Docx/index.d.ts.map +1 -1
  69. package/lib/renderers/Epub/index.d.ts.map +1 -1
  70. package/lib/renderers/Font/index.d.ts +6 -0
  71. package/lib/renderers/Font/index.d.ts.map +1 -0
  72. package/lib/renderers/Image/index.d.ts +2 -0
  73. package/lib/renderers/Image/index.d.ts.map +1 -1
  74. package/lib/renderers/Json/index.d.ts.map +1 -1
  75. package/lib/renderers/Markdown/index.d.ts.map +1 -1
  76. package/lib/renderers/Mobi/index.d.ts.map +1 -1
  77. package/lib/renderers/Msg/index.d.ts.map +1 -1
  78. package/lib/renderers/Pdf/index.d.ts +0 -1
  79. package/lib/renderers/Pdf/index.d.ts.map +1 -1
  80. package/lib/renderers/Pptx/index.d.ts.map +1 -1
  81. package/lib/renderers/RendererError.d.ts +8 -0
  82. package/lib/renderers/RendererError.d.ts.map +1 -0
  83. package/lib/renderers/Subtitle/index.d.ts.map +1 -1
  84. package/lib/renderers/Text/index.d.ts.map +1 -1
  85. package/lib/renderers/Video/index.d.ts +1 -0
  86. package/lib/renderers/Video/index.d.ts.map +1 -1
  87. package/lib/renderers/Xlsx/index.d.ts.map +1 -1
  88. package/lib/renderers/Xml/index.d.ts.map +1 -1
  89. package/lib/renderers/Zip/index.d.ts.map +1 -1
  90. package/lib/renderers/lazy.d.ts +2 -0
  91. package/lib/renderers/lazy.d.ts.map +1 -1
  92. package/lib/utils/pdfConfig.d.ts +2 -2
  93. package/lib/utils/pdfConfig.d.ts.map +1 -1
  94. package/package.json +14 -5
  95. package/lib/chunks/index-B-H9HQiI.mjs +0 -110
  96. package/lib/chunks/index-B-H9HQiI.mjs.map +0 -1
  97. package/lib/chunks/index-BGeyzo6u.mjs +0 -96
  98. package/lib/chunks/index-BGeyzo6u.mjs.map +0 -1
  99. package/lib/chunks/index-BNUiNUWa.mjs +0 -103
  100. package/lib/chunks/index-BNUiNUWa.mjs.map +0 -1
  101. package/lib/chunks/index-BSD3w5eG.mjs.map +0 -1
  102. package/lib/chunks/index-BcBe6KW7.mjs +0 -99
  103. package/lib/chunks/index-BcBe6KW7.mjs.map +0 -1
  104. package/lib/chunks/index-BdYkTSTt.mjs +0 -51
  105. package/lib/chunks/index-BdYkTSTt.mjs.map +0 -1
  106. package/lib/chunks/index-BqEuP_8r.mjs +0 -152
  107. package/lib/chunks/index-BqEuP_8r.mjs.map +0 -1
  108. package/lib/chunks/index-Bv93wiEK.mjs +0 -2031
  109. package/lib/chunks/index-Bv93wiEK.mjs.map +0 -1
  110. package/lib/chunks/index-CKirCT35.mjs +0 -52
  111. package/lib/chunks/index-CKirCT35.mjs.map +0 -1
  112. package/lib/chunks/index-CgV8T0G5.mjs +0 -257
  113. package/lib/chunks/index-CgV8T0G5.mjs.map +0 -1
  114. package/lib/chunks/index-D8GtNeDn.mjs +0 -116
  115. package/lib/chunks/index-D8GtNeDn.mjs.map +0 -1
  116. package/lib/chunks/index-DGuiWJr7.mjs.map +0 -1
  117. package/lib/chunks/index-DV5Jd7Qe.mjs.map +0 -1
  118. package/lib/chunks/index-DdOEWhrk.mjs.map +0 -1
  119. package/lib/chunks/index-DmepcY31.mjs +0 -96
  120. package/lib/chunks/index-DmepcY31.mjs.map +0 -1
  121. package/lib/chunks/index-U3w45GW8.mjs.map +0 -1
  122. package/lib/chunks/index-r3q2xCCI.mjs +0 -129
  123. package/lib/chunks/index-r3q2xCCI.mjs.map +0 -1
  124. package/lib/chunks/index-zEVVgWCH.mjs.map +0 -1
@@ -1,2031 +0,0 @@
1
- import { jsx as l, jsxs as z, Fragment as Te } from "react/jsx-runtime";
2
- import Pe, { createContext as pt, useContext as J, useMemo as B, useState as y, useRef as V, useEffect as L, lazy as N, useCallback as P, Suspense as ze } from "react";
3
- import { createPortal as Ee } from "react-dom";
4
- import { motion as et, AnimatePresence as je } from "framer-motion";
5
- import { ZoomOut as At, ZoomIn as Ut, Scan as Se, RotateCcw as Le, RotateCw as We, RefreshCw as It, List as Ht, ChevronLeft as ct, ChevronRight as ft, Minimize2 as Vt, Maximize2 as Bt, WrapText as $e, Code as qt, Eye as Gt, FileQuestion as De, Download as Xt, X as Oe } from "lucide-react";
6
- import Ze from "jszip";
7
- import { pdfjs as X } from "react-pdf";
8
- const Ae = "1.3.9", Ue = {
9
- version: Ae
10
- };
11
- function Ie(t) {
12
- try {
13
- const e = new URL(t).pathname.split("/").pop() || "file";
14
- return decodeURIComponent(e);
15
- } catch {
16
- const e = t.split("/").pop() || "file";
17
- return decodeURIComponent(e);
18
- }
19
- }
20
- function at(t) {
21
- var e;
22
- const r = ((e = t.split(".").pop()) == null ? void 0 : e.toLowerCase()) || "";
23
- return {
24
- // 图片
25
- jpg: "image/jpeg",
26
- jpeg: "image/jpeg",
27
- png: "image/png",
28
- gif: "image/gif",
29
- webp: "image/webp",
30
- svg: "image/svg+xml",
31
- bmp: "image/bmp",
32
- ico: "image/x-icon",
33
- // 视频
34
- mp4: "video/mp4",
35
- webm: "video/webm",
36
- ogg: "video/ogg",
37
- ogv: "video/ogg",
38
- mov: "video/quicktime",
39
- avi: "video/x-msvideo",
40
- mkv: "video/x-matroska",
41
- m4v: "video/x-m4v",
42
- "3gp": "video/3gpp",
43
- flv: "video/x-flv",
44
- // 音频
45
- mp3: "audio/mpeg",
46
- wav: "audio/wav",
47
- m4a: "audio/mp4",
48
- aac: "audio/aac",
49
- flac: "audio/flac",
50
- // 文档
51
- pdf: "application/pdf",
52
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
53
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
54
- pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
55
- ppt: "application/vnd.ms-powerpoint",
56
- msg: "application/vnd.ms-outlook",
57
- mobi: "application/x-mobipocket-ebook",
58
- azw: "application/vnd.amazon.ebook",
59
- azw3: "application/vnd.amazon.ebook",
60
- kf8: "application/vnd.amazon.ebook",
61
- // 文本
62
- txt: "text/plain",
63
- md: "text/markdown",
64
- markdown: "text/markdown",
65
- json: "application/json",
66
- xml: "application/xml",
67
- html: "text/html",
68
- css: "text/css",
69
- js: "text/javascript",
70
- ts: "text/typescript",
71
- jsx: "text/javascript",
72
- tsx: "text/typescript",
73
- py: "text/x-python",
74
- java: "text/x-java",
75
- cpp: "text/x-c++src",
76
- c: "text/x-csrc",
77
- cs: "text/x-csharp",
78
- php: "text/x-php",
79
- rb: "text/x-ruby",
80
- go: "text/x-go",
81
- rs: "text/x-rust",
82
- yaml: "text/yaml",
83
- yml: "text/yaml",
84
- toml: "text/toml",
85
- ini: "text/plain",
86
- env: "text/plain",
87
- diff: "text/x-diff",
88
- patch: "text/x-diff",
89
- log: "text/plain",
90
- csv: "text/csv",
91
- tsv: "text/tab-separated-values",
92
- srt: "application/x-subrip",
93
- vtt: "text/vtt",
94
- zip: "application/zip"
95
- }[r] || "application/octet-stream";
96
- }
97
- function He(t, e = 0) {
98
- if (t instanceof File)
99
- return {
100
- id: `file-${Date.now()}-${e}`,
101
- name: t.name,
102
- url: URL.createObjectURL(t),
103
- type: t.type || at(t.name),
104
- size: t.size
105
- };
106
- if (typeof t == "string") {
107
- const r = Ie(t);
108
- return {
109
- id: `url-${Date.now()}-${e}`,
110
- name: r,
111
- url: t,
112
- type: at(r)
113
- };
114
- }
115
- return {
116
- id: t.id || `link-${Date.now()}-${e}`,
117
- name: t.name,
118
- url: t.url,
119
- type: t.type || at(t.name),
120
- size: t.size
121
- };
122
- }
123
- function Ve(t) {
124
- return t.map((e, r) => He(e, r));
125
- }
126
- function Be(t) {
127
- var e;
128
- const r = ((e = t.name.split(".").pop()) == null ? void 0 : e.toLowerCase()) || "", n = t.type.toLowerCase();
129
- if (n.startsWith("image/") || ["jpg", "jpeg", "png", "gif", "webp", "svg"].includes(r))
130
- return "image";
131
- if (n.includes("pdf") || r === "pdf")
132
- return "pdf";
133
- if (n.includes("wordprocessingml") || r === "docx")
134
- return "docx";
135
- if (n.includes("spreadsheetml") || r === "xlsx")
136
- return "xlsx";
137
- if (n.includes("presentationml") || r === "pptx" || r === "ppt")
138
- return "pptx";
139
- if (n.includes("ms-outlook") || r === "msg")
140
- return "msg";
141
- if (n.includes("epub") || r === "epub")
142
- return "epub";
143
- if (["mobi", "azw", "azw3", "kf8"].includes(r) || n === "application/x-mobipocket-ebook" || n === "application/vnd.amazon.ebook")
144
- return "mobi";
145
- if (["csv", "tsv"].includes(r) || n === "text/csv" || n === "text/tab-separated-values")
146
- return "csv";
147
- if (r === "xml" || n === "application/xml" || n === "text/xml")
148
- return "xml";
149
- if (["srt", "vtt", "lrc", "elrc", "ass", "ssa", "ttml", "dfxp"].includes(r) || n === "text/vtt" || n === "application/x-subrip" || n === "application/ttml+xml")
150
- return "subtitle";
151
- if (r === "zip" || n === "application/zip" || n === "application/x-zip-compressed")
152
- return "zip";
153
- if (n.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(r))
154
- return "video";
155
- if (n.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(r))
156
- return "audio";
157
- if (r === "md" || r === "markdown")
158
- return "markdown";
159
- if (n === "application/json" || r === "json")
160
- return "json";
161
- const a = [
162
- "txt",
163
- "log",
164
- "lock",
165
- "js",
166
- "jsx",
167
- "ts",
168
- "tsx",
169
- "py",
170
- "java",
171
- "cpp",
172
- "c",
173
- "h",
174
- "cs",
175
- "php",
176
- "rb",
177
- "go",
178
- "mod",
179
- "rs",
180
- "swift",
181
- "kt",
182
- "lua",
183
- "vim",
184
- "html",
185
- "css",
186
- "scss",
187
- "sass",
188
- "less",
189
- "yaml",
190
- "yml",
191
- "toml",
192
- "ini",
193
- "conf",
194
- "env",
195
- "diff",
196
- "patch",
197
- "sh",
198
- "bash",
199
- "zsh",
200
- "sql"
201
- ];
202
- return n.startsWith("text/") || a.includes(r) ? "text" : "unsupported";
203
- }
204
- function co(t) {
205
- var e;
206
- const r = ((e = t.split(".").pop()) == null ? void 0 : e.toLowerCase()) || "";
207
- return {
208
- js: "javascript",
209
- jsx: "jsx",
210
- ts: "typescript",
211
- tsx: "tsx",
212
- py: "python",
213
- java: "java",
214
- cpp: "cpp",
215
- c: "c",
216
- cs: "csharp",
217
- php: "php",
218
- rb: "ruby",
219
- go: "go",
220
- mod: "go",
221
- rs: "rust",
222
- swift: "swift",
223
- kt: "kotlin",
224
- lua: "lua",
225
- vim: "vim",
226
- scala: "scala",
227
- sh: "bash",
228
- bash: "bash",
229
- zsh: "bash",
230
- json: "json",
231
- xml: "xml",
232
- html: "html",
233
- css: "css",
234
- scss: "scss",
235
- sass: "sass",
236
- less: "less",
237
- sql: "sql",
238
- yaml: "yaml",
239
- yml: "yaml",
240
- toml: "toml",
241
- ini: "ini",
242
- env: "bash",
243
- conf: "nginx",
244
- diff: "diff",
245
- patch: "diff",
246
- log: "log",
247
- md: "markdown",
248
- txt: "text"
249
- }[r] || "text";
250
- }
251
- function qe(t) {
252
- return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
253
- }
254
- function fo(t) {
255
- var e;
256
- return (((e = t.split(".").pop()) == null ? void 0 : e.toLowerCase()) || "") === "tsv" ? " " : ",";
257
- }
258
- function uo(t, e = {}) {
259
- const r = e.delimiter ?? ",", n = e.firstRowAsHeader ?? !0, a = [];
260
- let o = [], i = "", s = !1, p = 0;
261
- const c = t.length;
262
- for (; p < c; ) {
263
- const u = t[p];
264
- if (s) {
265
- if (u === '"') {
266
- if (t[p + 1] === '"') {
267
- i += '"', p += 2;
268
- continue;
269
- }
270
- s = !1, p += 1;
271
- continue;
272
- }
273
- i += u, p += 1;
274
- continue;
275
- }
276
- if (u === '"') {
277
- s = !0, p += 1;
278
- continue;
279
- }
280
- if (u === r) {
281
- o.push(i), i = "", p += 1;
282
- continue;
283
- }
284
- if (u === "\r") {
285
- t[p + 1] === `
286
- ` && (p += 1), o.push(i), a.push(o), o = [], i = "", p += 1;
287
- continue;
288
- }
289
- if (u === `
290
- `) {
291
- o.push(i), a.push(o), o = [], i = "", p += 1;
292
- continue;
293
- }
294
- i += u, p += 1;
295
- }
296
- for ((i.length > 0 || o.length > 0) && (o.push(i), a.push(o)); a.length > 0; ) {
297
- const u = a[a.length - 1];
298
- if (u.length === 1 && u[0] === "")
299
- a.pop();
300
- else
301
- break;
302
- }
303
- let f = [], d = a;
304
- n && a.length > 0 && (f = a[0], d = a.slice(1));
305
- const h = Math.max(
306
- f.length,
307
- ...d.map((u) => u.length),
308
- 0
309
- );
310
- for (const u of d)
311
- for (; u.length < h; ) u.push("");
312
- return {
313
- header: f,
314
- rows: d,
315
- columnCount: h,
316
- delimiter: r
317
- };
318
- }
319
- function Ge(t) {
320
- const e = t instanceof Uint8Array ? t : new Uint8Array(t);
321
- if (e.length >= 3 && e[0] === 239 && e[1] === 187 && e[2] === 191)
322
- return new TextDecoder("utf-8").decode(e);
323
- if (e.length >= 2 && e[0] === 255 && e[1] === 254)
324
- return new TextDecoder("utf-16le").decode(e);
325
- if (e.length >= 2 && e[0] === 254 && e[1] === 255)
326
- return new TextDecoder("utf-16be").decode(e);
327
- try {
328
- return new TextDecoder("utf-8", { fatal: !0 }).decode(e);
329
- } catch {
330
- }
331
- try {
332
- return new TextDecoder("gbk").decode(e);
333
- } catch {
334
- }
335
- return new TextDecoder("utf-8", { fatal: !1 }).decode(e);
336
- }
337
- async function mo(t, e) {
338
- const r = !!e && ("fetcher" in e || "init" in e), n = r ? e.fetcher ?? fetch : fetch, a = r ? e.init : e, o = await n(t, a);
339
- if (!o.ok) throw new Error(`请求失败: ${o.status}`);
340
- const i = await o.arrayBuffer();
341
- return Ge(i);
342
- }
343
- async function Xe(t, e) {
344
- if (t)
345
- return typeof t == "function" ? await t(e) : t;
346
- }
347
- function Je(t, e) {
348
- if (!t && !e) return;
349
- if (!t) return e;
350
- if (!e) return t;
351
- const r = new Headers(t.headers || {});
352
- return e.headers && new Headers(e.headers).forEach((n, a) => {
353
- r.set(a, n);
354
- }), {
355
- ...t,
356
- ...e,
357
- headers: r
358
- };
359
- }
360
- function Ke(t) {
361
- const e = (t == null ? void 0 : t.requestHandler) ?? ((n, a) => fetch(n, a)), r = t == null ? void 0 : t.requestInit;
362
- return async (n, a) => {
363
- const o = await Xe(r, n), i = Je(o, a);
364
- return e(n, i);
365
- };
366
- }
367
- async function Ye(t, e = fetch, r) {
368
- const n = await e(t, r);
369
- if (!n.ok) throw new Error(`请求失败: ${n.status}`);
370
- const a = await n.blob();
371
- return URL.createObjectURL(a);
372
- }
373
- async function Qe(t, e, r = fetch, n) {
374
- const a = await r(t, n);
375
- if (!a.ok) throw new Error(`请求失败: ${a.status}`);
376
- const o = await a.blob(), i = URL.createObjectURL(o);
377
- try {
378
- const s = document.createElement("a");
379
- s.href = i, s.download = e, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s);
380
- } finally {
381
- setTimeout(() => URL.revokeObjectURL(i), 1e3);
382
- }
383
- }
384
- function St(t) {
385
- const e = t.trim().replace(",", "."), r = e.split(":").map((n) => n.trim());
386
- if (r.length === 3) {
387
- const [n, a, o] = r;
388
- return Number(n) * 3600 + Number(a) * 60 + Number(o);
389
- }
390
- if (r.length === 2) {
391
- const [n, a] = r;
392
- return Number(n) * 60 + Number(a);
393
- }
394
- return Number(e) || 0;
395
- }
396
- function ho(t) {
397
- if (!isFinite(t) || t < 0) return "00:00:00.000";
398
- const e = Math.floor(t * 1e3), r = e % 1e3, n = Math.floor(e / 1e3) % 60, a = Math.floor(e / 6e4) % 60, o = Math.floor(e / 36e5), i = (s, p = 2) => s.toString().padStart(p, "0");
399
- return `${i(o)}:${i(a)}:${i(n)}.${i(r, 3)}`;
400
- }
401
- const Lt = /(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}\s*-->\s*(\d{1,2}:)?\d{1,2}:\d{1,2}[.,]\d{1,3}/, tr = /^\s*\[\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?\]/;
402
- function er(t) {
403
- const e = t.replace(/^\uFEFF/, "").trimStart();
404
- return /^WEBVTT/.test(e) ? "vtt" : /^<\?xml/i.test(e) || /<tt\b[^>]*>/i.test(e) ? "ttml" : /^\[Script Info\]/im.test(e) || /^Dialogue:/m.test(e) ? /ScriptType:\s*v4\.00\s*$/im.test(e) ? "ssa" : "ass" : tr.test(e) || /^\[(ti|ar|al|au|by|length|offset|re|ve):/im.test(e) ? /<\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?>/.test(e) ? "elrc" : "lrc" : "srt";
405
- }
406
- function Wt(t, e) {
407
- const r = t.replace(/\r\n?/g, `
408
- `).replace(/^\uFEFF/, "").split(`
409
- `), n = [];
410
- let a, o = 0;
411
- if (e === "vtt") {
412
- const i = [];
413
- for (; o < r.length && r[o].trim() !== ""; )
414
- i.push(r[o]), o++;
415
- for (a = i.join(`
416
- `); o < r.length && r[o].trim() === ""; ) o++;
417
- }
418
- for (; o < r.length; ) {
419
- for (; o < r.length && r[o].trim() === ""; ) o++;
420
- if (o >= r.length) break;
421
- let i, s = null;
422
- if (Lt.test(r[o]))
423
- s = r[o], o++;
424
- else if (i = r[o].trim() || void 0, o++, o < r.length && Lt.test(r[o]))
425
- s = r[o], o++;
426
- else
427
- continue;
428
- if (!s) continue;
429
- const p = s.match(/([\d:.,]+)\s*-->\s*([\d:.,]+)/);
430
- if (!p) continue;
431
- const c = St(p[1]), f = St(p[2]), d = [];
432
- for (; o < r.length && r[o].trim() !== ""; )
433
- d.push(r[o]), o++;
434
- n.push({ id: i, start: c, end: f, text: d.join(`
435
- `) });
436
- }
437
- return { format: e, cues: n, header: a };
438
- }
439
- function lt(t, e, r) {
440
- const n = Number(t), a = Number(e);
441
- let o = 0;
442
- if (r) {
443
- const i = (r + "000").slice(0, 3);
444
- o = Number(i);
445
- }
446
- return n * 60 + a + o / 1e3;
447
- }
448
- function Jt(t, e) {
449
- const r = /^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(t.trim());
450
- if (!r) return !1;
451
- const n = r[1].toLowerCase(), a = r[2].trim();
452
- if (e.metadata[n] = a, n === "offset") {
453
- const o = Number(a);
454
- isNaN(o) || (e.offsetMs = o);
455
- }
456
- return !0;
457
- }
458
- function rr(t) {
459
- const e = t.replace(/\r\n?/g, `
460
- `).replace(/^\uFEFF/, "").split(`
461
- `), r = { metadata: {}, offsetMs: 0 }, n = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, a = [];
462
- for (const i of e) {
463
- const s = i.trim();
464
- if (!s || Jt(s, r)) continue;
465
- const p = [];
466
- let c = 0;
467
- n.lastIndex = 0;
468
- let f;
469
- for (; (f = n.exec(s)) !== null && f.index === c; )
470
- p.push(lt(f[1], f[2], f[3])), c = f.index + f[0].length;
471
- if (p.length === 0) continue;
472
- const d = s.slice(c).trim();
473
- for (const h of p)
474
- a.push({ start: h, text: d });
475
- }
476
- a.sort((i, s) => i.start - s.start);
477
- const o = r.offsetMs / 1e3;
478
- return { format: "lrc", cues: a.map((i, s) => {
479
- const p = Math.max(0, i.start - o), c = a[s + 1], f = c ? Math.max(p, c.start - o) : p + 5;
480
- return { start: p, end: f, text: i.text };
481
- }), metadata: r.metadata };
482
- }
483
- function or(t) {
484
- const e = t.replace(/\r\n?/g, `
485
- `).replace(/^\uFEFF/, "").split(`
486
- `), r = { metadata: {}, offsetMs: 0 }, n = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, a = /<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g, o = [];
487
- for (const s of e) {
488
- const p = s.trim();
489
- if (!p || Jt(p, r)) continue;
490
- const c = [];
491
- let f = 0;
492
- n.lastIndex = 0;
493
- let d;
494
- for (; (d = n.exec(p)) !== null && d.index === f; )
495
- c.push(lt(d[1], d[2], d[3])), f = d.index + d[0].length;
496
- if (c.length === 0) continue;
497
- const h = p.slice(f);
498
- for (const u of c)
499
- o.push({ start: u, raw: h });
500
- }
501
- o.sort((s, p) => s.start - p.start);
502
- const i = r.offsetMs / 1e3;
503
- return { format: "elrc", cues: o.map((s, p) => {
504
- const c = [];
505
- let f = "", d = 0, h = null;
506
- a.lastIndex = 0;
507
- let u;
508
- for (; (u = a.exec(s.raw)) !== null; ) {
509
- const T = s.raw.slice(d, u.index);
510
- h !== null && T && c.push({ start: Math.max(0, h - i), text: T }), f += T, h = lt(u[1], u[2], u[3]), d = u.index + u[0].length;
511
- }
512
- const _ = s.raw.slice(d);
513
- h !== null && _ && c.push({ start: Math.max(0, h - i), text: _ }), f += _;
514
- const M = Math.max(0, s.start - i), v = o[p + 1], F = v ? Math.max(M, v.start - i) : M + 5;
515
- return {
516
- start: M,
517
- end: F,
518
- text: f.trim(),
519
- words: c.length ? c : void 0
520
- };
521
- }), metadata: r.metadata };
522
- }
523
- function $t(t) {
524
- const e = t.trim().split(":");
525
- return e.length !== 3 ? 0 : Number(e[0]) * 3600 + Number(e[1]) * 60 + Number(e[2].replace(",", "."));
526
- }
527
- function Dt(t, e) {
528
- const r = t.replace(/\r\n?/g, `
529
- `).replace(/^\uFEFF/, "").split(`
530
- `);
531
- let n = "", a = [];
532
- const o = [], i = [];
533
- for (const s of r) {
534
- const p = s.replace(/\s+$/, ""), c = p.trim(), f = /^\[([^\]]+)\]\s*$/.exec(c);
535
- if (f) {
536
- n = f[1].toLowerCase(), i.push(p);
537
- continue;
538
- }
539
- if (n !== "events") {
540
- i.push(p);
541
- continue;
542
- }
543
- const d = /^Format:\s*(.+)$/i.exec(c);
544
- if (d) {
545
- a = d[1].split(",").map((x) => x.trim());
546
- continue;
547
- }
548
- const h = /^(Dialogue|Comment):\s*(.+)$/i.exec(c);
549
- if (!h || h[1].toLowerCase() === "comment" || a.length === 0) continue;
550
- const u = a.length, _ = h[2].split(","), M = _.slice(0, u - 1), v = _.slice(u - 1).join(","), F = {};
551
- a.forEach((x, S) => {
552
- F[x] = S === u - 1 ? v : M[S] ?? "";
553
- });
554
- const T = $t(F.Start || ""), k = $t(F.End || ""), R = (F.Text || "").replace(/\\N/g, `
555
- `).replace(/\\n/g, `
556
- `).replace(/\\h/g, " ").replace(/\{[^}]*\}/g, "");
557
- o.push({ start: T, end: k, text: R, style: F.Style });
558
- }
559
- return o.sort((s, p) => s.start - p.start), {
560
- format: e,
561
- cues: o,
562
- header: i.join(`
563
- `).trim() || void 0
564
- };
565
- }
566
- function it(t) {
567
- const e = t.trim();
568
- if (!e) return 0;
569
- const r = /^(\d+(?:\.\d+)?)(h|m|s|ms|f|t)$/i.exec(e);
570
- if (r) {
571
- const a = Number(r[1]), o = r[2].toLowerCase();
572
- return o === "h" ? a * 3600 : o === "m" ? a * 60 : o === "ms" ? a / 1e3 : a;
573
- }
574
- const n = e.split(":");
575
- return n.length === 3 ? Number(n[0]) * 3600 + Number(n[1]) * 60 + Number(n[2]) : n.length === 2 ? Number(n[0]) * 60 + Number(n[1]) : Number(e) || 0;
576
- }
577
- function nr(t) {
578
- if (typeof DOMParser > "u")
579
- throw new Error("TTML parsing requires a DOMParser environment");
580
- const e = new DOMParser().parseFromString(t, "application/xml");
581
- if (e.getElementsByTagName("parsererror").length > 0)
582
- throw new Error("TTML XML parse error");
583
- const r = e.getElementsByTagName("p"), n = [];
584
- for (let a = 0; a < r.length; a++) {
585
- const o = r[a], i = o.getAttribute("begin") || "", s = o.getAttribute("end") || "", p = o.getAttribute("dur") || "", c = it(i);
586
- let f;
587
- s ? f = it(s) : p ? f = c + it(p) : f = c + 5;
588
- let d = "";
589
- o.childNodes.forEach((u) => {
590
- if (u.nodeType === 3)
591
- d += u.nodeValue || "";
592
- else if (u.nodeType === 1) {
593
- const _ = u;
594
- _.tagName.toLowerCase() === "br" ? d += `
595
- ` : d += _.textContent || "";
596
- }
597
- });
598
- const h = d.replace(/[ \t]+/g, " ").replace(/\n /g, `
599
- `).trim();
600
- (h || c || f) && n.push({ start: c, end: f, text: h });
601
- }
602
- return n.sort((a, o) => a.start - o.start), { format: "ttml", cues: n };
603
- }
604
- function bo(t, e) {
605
- switch (e ?? er(t)) {
606
- case "lrc":
607
- return rr(t);
608
- case "elrc":
609
- return or(t);
610
- case "ass":
611
- return Dt(t, "ass");
612
- case "ssa":
613
- return Dt(t, "ssa");
614
- case "ttml":
615
- return nr(t);
616
- case "vtt":
617
- return Wt(t, "vtt");
618
- case "srt":
619
- default:
620
- return Wt(t, "srt");
621
- }
622
- }
623
- async function go(t) {
624
- return Ze.loadAsync(t);
625
- }
626
- function wo(t) {
627
- const e = [];
628
- return t.forEach((r, n) => {
629
- var a;
630
- const o = n.dir, i = o && !r.endsWith("/") ? r + "/" : r, s = o ? i.replace(/\/$/, "") : i, p = s.lastIndexOf("/"), c = p >= 0 ? s.slice(p + 1) : s, f = p >= 0 ? s.slice(0, p) : "", d = o ? 0 : ((a = n._data) == null ? void 0 : a.uncompressedSize) ?? 0;
631
- e.push({
632
- path: i,
633
- name: c,
634
- dir: f,
635
- isDir: o,
636
- size: d,
637
- date: n.date
638
- });
639
- }), e;
640
- }
641
- function vo(t) {
642
- const e = { name: "", path: "", isDir: !0, children: [], size: 0 }, r = /* @__PURE__ */ new Map();
643
- r.set("", e);
644
- const n = (o) => {
645
- if (r.has(o)) return r.get(o);
646
- const i = o.split("/").filter(Boolean);
647
- let s = e, p = "";
648
- for (const c of i) {
649
- p = p ? `${p}/${c}` : c;
650
- let f = r.get(p);
651
- f || (f = { name: c, path: p + "/", isDir: !0, children: [], size: 0 }, s.children.push(f), r.set(p, f)), s = f;
652
- }
653
- return s;
654
- };
655
- for (const o of t) {
656
- if (o.isDir) {
657
- n(o.path.replace(/\/$/, ""));
658
- continue;
659
- }
660
- n(o.dir).children.push({
661
- name: o.name,
662
- path: o.path,
663
- isDir: !1,
664
- size: o.size
665
- });
666
- }
667
- const a = (o) => {
668
- if (o.children) {
669
- o.children.sort((i, s) => i.isDir !== s.isDir ? i.isDir ? -1 : 1 : i.name.localeCompare(s.name));
670
- for (const i of o.children) a(i);
671
- }
672
- };
673
- return a(e), e;
674
- }
675
- async function xo(t, e, r) {
676
- const n = t.file(e);
677
- if (!n) throw new Error(`ZIP entry not found: ${e}`);
678
- const a = await n.async("arraybuffer");
679
- return new Blob([a], r ? { type: r } : void 0);
680
- }
681
- function ar(t) {
682
- return t ? t.startsWith("#") ? t : t.length === 8 ? "#" + t.substring(2) : t.length === 6 ? "#" + t : "#000000" : "#000000";
683
- }
684
- const ir = [
685
- "FFFFFF",
686
- "000000",
687
- "E7E6E6",
688
- "44546A",
689
- "4472C4",
690
- "ED7D31",
691
- "A5A5A5",
692
- "FFC000",
693
- "5B9BD5",
694
- "70AD47"
695
- ], sr = [
696
- "000000",
697
- "FFFFFF",
698
- "FF0000",
699
- "00FF00",
700
- "0000FF",
701
- "FFFF00",
702
- "FF00FF",
703
- "00FFFF",
704
- "000000",
705
- "FFFFFF",
706
- "FF0000",
707
- "00FF00",
708
- "0000FF",
709
- "FFFF00",
710
- "FF00FF",
711
- "00FFFF",
712
- "800000",
713
- "008000",
714
- "000080",
715
- "808000",
716
- "800080",
717
- "008080",
718
- "C0C0C0",
719
- "808080",
720
- "9999FF",
721
- "993366",
722
- "FFFFCC",
723
- "CCFFFF",
724
- "660066",
725
- "FF8080",
726
- "0066CC",
727
- "CCCCFF",
728
- "000080",
729
- "FF00FF",
730
- "FFFF00",
731
- "00FFFF",
732
- "800080",
733
- "800000",
734
- "008080",
735
- "0000FF",
736
- "00CCFF",
737
- "CCFFFF",
738
- "CCFFCC",
739
- "FFFF99",
740
- "99CCFF",
741
- "FF99CC",
742
- "CC99FF",
743
- "FFCC99",
744
- "3366FF",
745
- "33CCCC",
746
- "99CC00",
747
- "FFCC00",
748
- "FF9900",
749
- "FF6600",
750
- "666699",
751
- "969696",
752
- "003366",
753
- "339966",
754
- "003300",
755
- "333300",
756
- "993300",
757
- "993366",
758
- "333399",
759
- "333333"
760
- ];
761
- function lr(t, e) {
762
- const r = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), a = parseInt(t.substring(4, 6), 16), o = (c) => e < 0 ? Math.round(c * (1 + e)) : Math.round(c + (255 - c) * e), i = Math.min(255, Math.max(0, o(r))), s = Math.min(255, Math.max(0, o(n))), p = Math.min(255, Math.max(0, o(a)));
763
- return i.toString(16).padStart(2, "0") + s.toString(16).padStart(2, "0") + p.toString(16).padStart(2, "0");
764
- }
765
- function pr(t) {
766
- if (t && t.type === "pattern" && t.pattern === "solid") {
767
- const e = t.fgColor;
768
- if (e)
769
- return dt(e);
770
- }
771
- }
772
- function dt(t) {
773
- if (t) {
774
- if ("argb" in t && typeof t.argb == "string" && t.argb)
775
- return ar(t.argb);
776
- if ("theme" in t && typeof t.theme == "number") {
777
- const e = ir[t.theme] || "000000", r = "tint" in t && typeof t.tint == "number" ? t.tint : 0;
778
- return "#" + (r !== 0 ? lr(e, r) : e);
779
- }
780
- if ("indexed" in t && typeof t.indexed == "number") {
781
- const e = sr[t.indexed];
782
- if (e) return "#" + e;
783
- }
784
- }
785
- }
786
- function cr(t) {
787
- if (!t || !t.style) return;
788
- const e = dt(t.color) || "#000000";
789
- return [t.style, e];
790
- }
791
- function fr(t) {
792
- const e = {};
793
- let r = !1;
794
- if (t.font) {
795
- const a = t.font;
796
- if ((a.name || a.size || a.bold || a.italic) && (r = !0, e.font = {}, a.name && (e.font.name = a.name), a.size && (e.font.size = a.size), a.bold && (e.font.bold = !0), a.italic && (e.font.italic = !0)), a.color) {
797
- const o = dt(a.color);
798
- o && (r = !0, e.color = o);
799
- }
800
- a.underline && (r = !0, e.underline = !0), a.strike && (r = !0, e.strike = !0);
801
- }
802
- const n = pr(t.fill);
803
- if (n && (r = !0, e.bgcolor = n), t.alignment) {
804
- const a = t.alignment;
805
- a.horizontal && (r = !0, e.align = a.horizontal), a.vertical && (r = !0, e.valign = a.vertical), a.wrapText && (r = !0, e.textwrap = !0);
806
- }
807
- if (t.border) {
808
- const a = {};
809
- let o = !1;
810
- const i = ["top", "bottom", "left", "right"];
811
- for (const s of i) {
812
- const p = cr(t.border[s]);
813
- p && (a[s] = p, o = !0);
814
- }
815
- o && (r = !0, e.border = a);
816
- }
817
- return r ? e : null;
818
- }
819
- function dr(t) {
820
- return JSON.stringify(t);
821
- }
822
- function ur(t, e, r) {
823
- const n = fr(t);
824
- if (!n) return -1;
825
- const a = dr(n), o = r.get(a);
826
- if (o !== void 0) return o;
827
- const i = e.length;
828
- return e.push(n), r.set(a, i), i;
829
- }
830
- function mr(t) {
831
- const e = t.value;
832
- if (e == null) return "";
833
- if (typeof e == "string") return e;
834
- if (typeof e == "number") return String(e);
835
- if (typeof e == "boolean") return e ? "TRUE" : "FALSE";
836
- if (e instanceof Date)
837
- return e.toLocaleDateString();
838
- if (typeof e == "object" && "formula" in e) {
839
- const r = e.result;
840
- return r != null ? String(r) : "";
841
- }
842
- return typeof e == "object" && "richText" in e ? e.richText.map((r) => r.text).join("") : typeof e == "object" && "hyperlink" in e ? e.text || "" : typeof e == "object" && "error" in e ? String(e.error) : String(e);
843
- }
844
- function hr(t) {
845
- const e = t.split(":"), r = Ot(e[0]), n = e[1] ? Ot(e[1]) : r;
846
- return {
847
- top: r.row,
848
- left: r.col,
849
- bottom: n.row,
850
- right: n.col
851
- };
852
- }
853
- function Ot(t) {
854
- const e = t.match(/^([A-Z]+)(\d+)$/);
855
- if (!e) return { row: 1, col: 1 };
856
- const r = e[1], n = parseInt(e[2], 10);
857
- let a = 0;
858
- for (let o = 0; o < r.length; o++)
859
- a = a * 26 + (r.charCodeAt(o) - 64);
860
- return { row: n, col: a };
861
- }
862
- function yo(t) {
863
- const e = [];
864
- return t.eachSheet((r) => {
865
- const n = [], a = /* @__PURE__ */ new Map(), o = [], i = {}, s = {}, p = r.columnCount;
866
- for (let h = 1; h <= p; h++) {
867
- const u = r.getColumn(h);
868
- u.width && (s[String(h - 1)] = { width: Math.round(u.width * 7.5) });
869
- }
870
- s.len = Math.max(p, 26);
871
- const c = /* @__PURE__ */ new Map(), f = r.model, d = (f == null ? void 0 : f.merges) || [];
872
- for (const h of d) {
873
- o.push(h);
874
- const { top: u, left: _, bottom: M, right: v } = hr(h), F = M - u, T = v - _;
875
- c.set(`${u - 1},${_ - 1}`, [F, T]);
876
- }
877
- r.eachRow({ includeEmpty: !0 }, (h, u) => {
878
- const _ = u - 1, M = {};
879
- h.eachCell({ includeEmpty: !1 }, (F, T) => {
880
- const k = T - 1;
881
- if (F.isMerged && F.master !== F) return;
882
- const R = mr(F), x = ur(F, n, a), S = { text: R };
883
- x !== -1 && (S.style = x);
884
- const W = `${_},${k}`;
885
- c.has(W) && (S.merge = c.get(W)), M[String(k)] = S;
886
- });
887
- const v = { cells: M };
888
- h.height && (v.height = Math.round(h.height * 1.333)), i[String(_)] = v;
889
- }), e.push({
890
- name: r.name,
891
- styles: n,
892
- merges: o,
893
- rows: i,
894
- cols: s
895
- });
896
- }), e;
897
- }
898
- function Fo(t, e, r = "Sheet1") {
899
- const n = t.length > 0, a = n ? [{ font: { bold: !0 } }] : [], o = {};
900
- if (n) {
901
- const s = {};
902
- t.forEach((p, c) => {
903
- s[String(c)] = { text: p, style: 0 };
904
- }), o[0] = { cells: s };
905
- }
906
- const i = n ? 1 : 0;
907
- return e.forEach((s, p) => {
908
- const c = {};
909
- s.forEach((f, d) => {
910
- f !== void 0 && f !== "" && (c[String(d)] = { text: f });
911
- }), o[String(p + i)] = { cells: c };
912
- }), [{ name: r, styles: a, rows: o }];
913
- }
914
- const br = {
915
- // ─────── common ───────
916
- "common.download": "下载",
917
- "common.close": "关闭",
918
- "common.loading": "加载中",
919
- "common.unknown_error": "未知错误",
920
- "common.unsupported_preview": "不支持预览此文件类型 ({type})",
921
- // ─────── toolbar ───────
922
- "toolbar.zoom_in": "放大",
923
- "toolbar.zoom_out": "缩小",
924
- "toolbar.rotate_left": "向左旋转",
925
- "toolbar.rotate_right": "向右旋转",
926
- "toolbar.reset": "复原",
927
- "toolbar.fit_to_window": "适应窗口",
928
- "toolbar.original_size": "原始尺寸",
929
- "toolbar.toc": "目录",
930
- "toolbar.prev_page": "上一页",
931
- "toolbar.next_page": "下一页",
932
- "toolbar.full_width": "全屏宽度",
933
- "toolbar.normal_width": "正常宽度",
934
- "toolbar.wrap_on": "自动换行",
935
- "toolbar.wrap_off": "不换行",
936
- "toolbar.source": "源码",
937
- "toolbar.preview": "预览",
938
- // ─────── image ───────
939
- "image.load_failed": "图片加载失败",
940
- // ─────── pdf ───────
941
- "pdf.load_failed": "PDF 文件加载失败",
942
- // ─────── docx ───────
943
- "docx.parse_failed": "Word 文档解析失败",
944
- // ─────── xlsx ───────
945
- "xlsx.loading": "加载 Excel 中...",
946
- "xlsx.load_failed": "Excel 加载失败",
947
- "xlsx.parse_failed": "Excel 文件解析失败",
948
- "xlsx.not_found": "Excel 文件不存在",
949
- // ─────── pptx ───────
950
- "pptx.loading": "加载 PPT 中...",
951
- "pptx.load_failed": "PPT 加载失败",
952
- "pptx.parse_failed": "PPT 文件解析失败",
953
- "pptx.not_found": "PPT 文件不存在",
954
- "pptx.invalid_format": "PPT 文件格式错误或已损坏",
955
- "pptx.no_pages": "PPT 文件无有效页面",
956
- "pptx.timeout": "加载超时,请检查网络或稍后重试",
957
- // ─────── msg ───────
958
- "msg.parse_failed": "Outlook 邮件解析失败",
959
- "msg.parse_failed_short": "邮件解析失败",
960
- "msg.empty_body": "(无邮件正文)",
961
- // ─────── epub ───────
962
- "epub.load_failed": "EPUB 文件加载失败",
963
- // ─────── mobi ───────
964
- "mobi.load_failed": "电子书加载失败,文件可能已损坏或带有 DRM 保护",
965
- // ─────── video ───────
966
- "video.loading": "加载视频中...",
967
- "video.load_failed": "视频加载失败",
968
- "video.load_failed_with_error": "视频加载失败: {error}",
969
- // ─────── audio (aria-label) ───────
970
- "audio.aria.play": "播放",
971
- "audio.aria.pause": "暂停",
972
- "audio.aria.forward_10": "前进 10 秒",
973
- "audio.aria.backward_10": "后退 10 秒",
974
- "audio.aria.mute": "静音",
975
- "audio.aria.unmute": "取消静音",
976
- "audio.aria.loop_on": "开启循环",
977
- "audio.aria.loop_off": "关闭循环",
978
- "audio.aria.progress": "播放进度",
979
- "audio.aria.volume": "音量",
980
- // ─────── markdown ───────
981
- "markdown.load_failed": "Markdown 文件加载失败",
982
- "markdown.copy_code": "复制代码",
983
- "markdown.copied": "已复制",
984
- // ─────── json ───────
985
- "json.load_failed": "JSON 文件加载失败",
986
- "json.items": "items",
987
- "json.keys": "keys",
988
- // ─────── csv ───────
989
- "csv.loading": "加载 CSV 中...",
990
- "csv.load_failed": "CSV 文件加载失败",
991
- "csv.parse_failed": "CSV 解析失败",
992
- // ─────── xml ───────
993
- "xml.load_failed": "XML 文件加载失败",
994
- // ─────── subtitle / lyric ───────
995
- "subtitle.load_failed": "字幕文件加载失败",
996
- "subtitle.parse_failed": "字幕解析失败",
997
- "subtitle.lines": "lines",
998
- "subtitle.cues": "cues",
999
- "subtitle.meta.title": "标题",
1000
- "subtitle.meta.artist": "艺术家",
1001
- "subtitle.meta.album": "专辑",
1002
- "subtitle.meta.author": "作者",
1003
- "subtitle.meta.by": "制作",
1004
- "subtitle.meta.length": "时长",
1005
- "subtitle.meta.offset": "偏移",
1006
- "subtitle.meta.editor": "编辑器",
1007
- "subtitle.meta.version": "版本",
1008
- // ─────── zip ───────
1009
- "zip.load_failed": "ZIP 文件加载失败",
1010
- "zip.parse_failed": "ZIP 解析失败",
1011
- // ─────── text ───────
1012
- "text.load_failed": "文本文件加载失败"
1013
- }, gr = {
1014
- // ─────── common ───────
1015
- "common.download": "Download",
1016
- "common.close": "Close",
1017
- "common.loading": "Loading",
1018
- "common.unknown_error": "Unknown error",
1019
- "common.unsupported_preview": "Preview not supported for this file type ({type})",
1020
- // ─────── toolbar ───────
1021
- "toolbar.zoom_in": "Zoom in",
1022
- "toolbar.zoom_out": "Zoom out",
1023
- "toolbar.rotate_left": "Rotate left",
1024
- "toolbar.rotate_right": "Rotate right",
1025
- "toolbar.reset": "Reset",
1026
- "toolbar.fit_to_window": "Fit to window",
1027
- "toolbar.original_size": "Original size",
1028
- "toolbar.toc": "Table of contents",
1029
- "toolbar.prev_page": "Previous page",
1030
- "toolbar.next_page": "Next page",
1031
- "toolbar.full_width": "Full width",
1032
- "toolbar.normal_width": "Normal width",
1033
- "toolbar.wrap_on": "Word wrap",
1034
- "toolbar.wrap_off": "No wrap",
1035
- "toolbar.source": "Source",
1036
- "toolbar.preview": "Preview",
1037
- // ─────── image ───────
1038
- "image.load_failed": "Failed to load image",
1039
- // ─────── pdf ───────
1040
- "pdf.load_failed": "Failed to load PDF",
1041
- // ─────── docx ───────
1042
- "docx.parse_failed": "Failed to parse Word document",
1043
- // ─────── xlsx ───────
1044
- "xlsx.loading": "Loading Excel...",
1045
- "xlsx.load_failed": "Failed to load Excel",
1046
- "xlsx.parse_failed": "Failed to parse Excel file",
1047
- "xlsx.not_found": "Excel file not found",
1048
- // ─────── pptx ───────
1049
- "pptx.loading": "Loading PPT...",
1050
- "pptx.load_failed": "Failed to load PPT",
1051
- "pptx.parse_failed": "Failed to parse PPT file",
1052
- "pptx.not_found": "PPT file not found",
1053
- "pptx.invalid_format": "PPT file format is invalid or corrupted",
1054
- "pptx.no_pages": "PPT file has no valid pages",
1055
- "pptx.timeout": "Loading timed out, please check your network and retry",
1056
- // ─────── msg ───────
1057
- "msg.parse_failed": "Failed to parse Outlook message",
1058
- "msg.parse_failed_short": "Failed to parse message",
1059
- "msg.empty_body": "(No message body)",
1060
- // ─────── epub ───────
1061
- "epub.load_failed": "Failed to load EPUB",
1062
- // ─────── mobi ───────
1063
- "mobi.load_failed": "Failed to load ebook — file may be corrupted or DRM-protected",
1064
- // ─────── video ───────
1065
- "video.loading": "Loading video...",
1066
- "video.load_failed": "Failed to load video",
1067
- "video.load_failed_with_error": "Failed to load video: {error}",
1068
- // ─────── audio (aria-label) ───────
1069
- "audio.aria.play": "Play",
1070
- "audio.aria.pause": "Pause",
1071
- "audio.aria.forward_10": "Forward 10 seconds",
1072
- "audio.aria.backward_10": "Back 10 seconds",
1073
- "audio.aria.mute": "Mute",
1074
- "audio.aria.unmute": "Unmute",
1075
- "audio.aria.loop_on": "Enable loop",
1076
- "audio.aria.loop_off": "Disable loop",
1077
- "audio.aria.progress": "Playback progress",
1078
- "audio.aria.volume": "Volume",
1079
- // ─────── markdown ───────
1080
- "markdown.load_failed": "Failed to load Markdown",
1081
- "markdown.copy_code": "Copy code",
1082
- "markdown.copied": "Copied",
1083
- // ─────── json ───────
1084
- "json.load_failed": "Failed to load JSON",
1085
- "json.items": "items",
1086
- "json.keys": "keys",
1087
- // ─────── csv ───────
1088
- "csv.loading": "Loading CSV...",
1089
- "csv.load_failed": "Failed to load CSV",
1090
- "csv.parse_failed": "Failed to parse CSV",
1091
- // ─────── xml ───────
1092
- "xml.load_failed": "Failed to load XML",
1093
- // ─────── subtitle / lyric ───────
1094
- "subtitle.load_failed": "Failed to load subtitle",
1095
- "subtitle.parse_failed": "Failed to parse subtitle",
1096
- "subtitle.lines": "lines",
1097
- "subtitle.cues": "cues",
1098
- "subtitle.meta.title": "Title",
1099
- "subtitle.meta.artist": "Artist",
1100
- "subtitle.meta.album": "Album",
1101
- "subtitle.meta.author": "Author",
1102
- "subtitle.meta.by": "By",
1103
- "subtitle.meta.length": "Length",
1104
- "subtitle.meta.offset": "Offset",
1105
- "subtitle.meta.editor": "Editor",
1106
- "subtitle.meta.version": "Version",
1107
- // ─────── zip ───────
1108
- "zip.load_failed": "Failed to load ZIP",
1109
- "zip.parse_failed": "Failed to parse ZIP",
1110
- // ─────── text ───────
1111
- "text.load_failed": "Failed to load text file"
1112
- }, tt = {
1113
- "zh-CN": br,
1114
- "en-US": gr
1115
- }, wr = /\{(\w+)\}/g;
1116
- function vr(t, e) {
1117
- return e ? t.replace(wr, (r, n) => {
1118
- const a = e[n];
1119
- return a === void 0 ? `{${n}}` : String(a);
1120
- }) : t;
1121
- }
1122
- function ut(t) {
1123
- var e;
1124
- const r = t.fallbackLocale ?? "zh-CN", n = tt[t.locale] ?? tt[r] ?? tt["zh-CN"], a = (e = t.messages) == null ? void 0 : e[t.locale], o = a ? { ...n, ...a } : n, i = tt["zh-CN"];
1125
- return (s, p) => {
1126
- const c = o[s] ?? i[s] ?? s;
1127
- return vr(c, p);
1128
- };
1129
- }
1130
- const mt = pt(null), xr = ({
1131
- locale: t = "zh-CN",
1132
- messages: e,
1133
- children: r
1134
- }) => {
1135
- const n = B(() => {
1136
- const a = ut({ locale: t, messages: e });
1137
- return { locale: t, t: a };
1138
- }, [t, e]);
1139
- return /* @__PURE__ */ l(mt.Provider, { value: n, children: r });
1140
- };
1141
- let st = null;
1142
- function yr() {
1143
- return st || (st = ut({ locale: "zh-CN" })), st;
1144
- }
1145
- function Kt() {
1146
- const t = J(mt);
1147
- return (t == null ? void 0 : t.t) ?? yr();
1148
- }
1149
- function _o() {
1150
- const t = J(mt);
1151
- return (t == null ? void 0 : t.locale) ?? "zh-CN";
1152
- }
1153
- const Yt = pt(null), Fr = ({ theme: t, children: e }) => /* @__PURE__ */ l(Yt.Provider, { value: t, children: e });
1154
- function ko() {
1155
- return J(Yt) ?? "dark";
1156
- }
1157
- const _r = ({ className: t }) => /* @__PURE__ */ l(
1158
- "svg",
1159
- {
1160
- xmlns: "http://www.w3.org/2000/svg",
1161
- viewBox: "0 0 24 24",
1162
- fill: "none",
1163
- stroke: "currentColor",
1164
- strokeWidth: "2",
1165
- strokeLinecap: "round",
1166
- strokeLinejoin: "round",
1167
- className: t,
1168
- children: /* @__PURE__ */ l("text", { x: "12", y: "17.5", textAnchor: "middle", fontSize: "20", fontWeight: "bold", fill: "currentColor", stroke: "none", children: "1:1" })
1169
- }
1170
- );
1171
- function kr(t) {
1172
- return [
1173
- {
1174
- items: [
1175
- { type: "button", icon: /* @__PURE__ */ l(At, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.zoom_out"), action: t.onZoomOut, disabled: t.zoom <= 0.01 },
1176
- { type: "text", content: `${Math.round(t.zoom * 100)}%`, minWidth: "3rem" },
1177
- { type: "button", icon: /* @__PURE__ */ l(Ut, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.zoom_in"), action: t.onZoomIn, disabled: t.zoom >= 10 }
1178
- ]
1179
- },
1180
- {
1181
- items: [
1182
- { type: "button", icon: /* @__PURE__ */ l(Se, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.fit_to_window"), action: t.onFitToWidth },
1183
- { type: "button", icon: /* @__PURE__ */ l(_r, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.original_size"), action: t.onOriginalSize }
1184
- ]
1185
- },
1186
- {
1187
- items: [
1188
- { type: "button", icon: /* @__PURE__ */ l(Le, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.rotate_left"), action: t.onRotateLeft },
1189
- { type: "button", icon: /* @__PURE__ */ l(We, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.rotate_right"), action: t.onRotateRight }
1190
- ]
1191
- },
1192
- {
1193
- items: [
1194
- { type: "button", icon: /* @__PURE__ */ l(It, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.reset"), action: t.onReset }
1195
- ]
1196
- }
1197
- ];
1198
- }
1199
- function Cr(t) {
1200
- return [
1201
- {
1202
- items: [
1203
- { type: "button", icon: /* @__PURE__ */ l(At, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.zoom_out"), action: t.onZoomOut, disabled: t.zoom <= 0.01 },
1204
- { type: "text", content: `${Math.round(t.zoom * 100)}%`, minWidth: "3rem" },
1205
- { type: "button", icon: /* @__PURE__ */ l(Ut, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.zoom_in"), action: t.onZoomIn, disabled: t.zoom >= 10 }
1206
- ]
1207
- },
1208
- {
1209
- items: [
1210
- { type: "button", icon: /* @__PURE__ */ l(It, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.reset"), action: t.onReset }
1211
- ]
1212
- }
1213
- ];
1214
- }
1215
- function Nr(t) {
1216
- return [
1217
- {
1218
- items: [
1219
- { type: "button", icon: /* @__PURE__ */ l(Ht, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.toc"), action: () => {
1220
- var e;
1221
- return (e = t.epubRef.current) == null ? void 0 : e.toggleToc();
1222
- } }
1223
- ]
1224
- },
1225
- {
1226
- items: [
1227
- { type: "button", icon: /* @__PURE__ */ l(ct, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.prev_page"), action: () => {
1228
- var e;
1229
- return (e = t.epubRef.current) == null ? void 0 : e.prevPage();
1230
- } },
1231
- { type: "text", content: `${t.current} / ${t.total}`, minWidth: "4rem" },
1232
- { type: "button", icon: /* @__PURE__ */ l(ft, { className: "rfp-w-4 rfp-h-4" }), tooltip: t.t("toolbar.next_page"), action: () => {
1233
- var e;
1234
- return (e = t.epubRef.current) == null ? void 0 : e.nextPage();
1235
- } }
1236
- ]
1237
- },
1238
- {
1239
- items: [
1240
- {
1241
- type: "button",
1242
- icon: t.fullWidth ? /* @__PURE__ */ l(Vt, { className: "rfp-w-4 rfp-h-4" }) : /* @__PURE__ */ l(Bt, { className: "rfp-w-4 rfp-h-4" }),
1243
- tooltip: t.fullWidth ? t.t("toolbar.normal_width") : t.t("toolbar.full_width"),
1244
- action: () => {
1245
- var e;
1246
- return (e = t.epubRef.current) == null ? void 0 : e.toggleFullWidth();
1247
- }
1248
- }
1249
- ]
1250
- }
1251
- ];
1252
- }
1253
- function Rr(t) {
1254
- return [
1255
- {
1256
- items: [
1257
- {
1258
- type: "button",
1259
- icon: /* @__PURE__ */ l(Ht, { className: "rfp-w-4 rfp-h-4" }),
1260
- tooltip: t.t("toolbar.toc"),
1261
- action: () => {
1262
- var e;
1263
- return (e = t.mobiRef.current) == null ? void 0 : e.toggleToc();
1264
- }
1265
- }
1266
- ]
1267
- },
1268
- {
1269
- items: [
1270
- {
1271
- type: "button",
1272
- icon: /* @__PURE__ */ l(ct, { className: "rfp-w-4 rfp-h-4" }),
1273
- tooltip: t.t("toolbar.prev_page"),
1274
- action: () => {
1275
- var e;
1276
- return (e = t.mobiRef.current) == null ? void 0 : e.prevPage();
1277
- }
1278
- },
1279
- {
1280
- type: "text",
1281
- content: `${t.current} / ${t.total}`,
1282
- minWidth: "4rem"
1283
- },
1284
- {
1285
- type: "button",
1286
- icon: /* @__PURE__ */ l(ft, { className: "rfp-w-4 rfp-h-4" }),
1287
- tooltip: t.t("toolbar.next_page"),
1288
- action: () => {
1289
- var e;
1290
- return (e = t.mobiRef.current) == null ? void 0 : e.nextPage();
1291
- }
1292
- }
1293
- ]
1294
- },
1295
- {
1296
- items: [
1297
- {
1298
- type: "button",
1299
- icon: t.fullWidth ? /* @__PURE__ */ l(Vt, { className: "rfp-w-4 rfp-h-4" }) : /* @__PURE__ */ l(Bt, { className: "rfp-w-4 rfp-h-4" }),
1300
- tooltip: t.fullWidth ? t.t("toolbar.normal_width") : t.t("toolbar.full_width"),
1301
- action: () => {
1302
- var e;
1303
- return (e = t.mobiRef.current) == null ? void 0 : e.toggleFullWidth();
1304
- }
1305
- }
1306
- ]
1307
- }
1308
- ];
1309
- }
1310
- function Mr({ stats: t }) {
1311
- return t ? [
1312
- {
1313
- items: [
1314
- {
1315
- type: "text",
1316
- content: `${t.files} files · ${t.dirs} dirs · ${qe(t.size)}`,
1317
- minWidth: "10rem"
1318
- }
1319
- ]
1320
- }
1321
- ] : [];
1322
- }
1323
- function Tr(t) {
1324
- const e = [
1325
- {
1326
- items: [
1327
- {
1328
- type: "button",
1329
- icon: /* @__PURE__ */ l($e, { className: "rfp-w-4 rfp-h-4" }),
1330
- tooltip: t.wordWrap ? t.t("toolbar.wrap_off") : t.t("toolbar.wrap_on"),
1331
- action: t.onToggleWrap
1332
- }
1333
- ]
1334
- }
1335
- ];
1336
- return t.isHtml && e.push({
1337
- items: [
1338
- {
1339
- type: "button",
1340
- icon: t.htmlPreview ? /* @__PURE__ */ l(qt, { className: "rfp-w-4 rfp-h-4" }) : /* @__PURE__ */ l(Gt, { className: "rfp-w-4 rfp-h-4" }),
1341
- tooltip: t.htmlPreview ? t.t("toolbar.source") : t.t("toolbar.preview"),
1342
- action: t.onToggleHtmlPreview
1343
- }
1344
- ]
1345
- }), e;
1346
- }
1347
- function Pr(t) {
1348
- return [
1349
- {
1350
- items: [
1351
- {
1352
- type: "button",
1353
- icon: t.viewMode === "preview" ? /* @__PURE__ */ l(qt, { className: "rfp-w-4 rfp-h-4" }) : /* @__PURE__ */ l(Gt, { className: "rfp-w-4 rfp-h-4" }),
1354
- tooltip: t.viewMode === "preview" ? t.t("toolbar.source") : t.t("toolbar.preview"),
1355
- action: t.onToggleViewMode
1356
- }
1357
- ]
1358
- }
1359
- ];
1360
- }
1361
- const zr = {
1362
- fetcher: (t, e) => fetch(t, e)
1363
- }, ht = pt(zr), Er = ({
1364
- requestInit: t,
1365
- requestHandler: e,
1366
- shouldFetchAsBlob: r,
1367
- children: n
1368
- }) => {
1369
- const a = B(
1370
- () => ({
1371
- fetcher: Ke({ requestInit: t, requestHandler: e }),
1372
- shouldFetchAsBlob: r
1373
- }),
1374
- [t, e, r]
1375
- );
1376
- return /* @__PURE__ */ l(ht.Provider, { value: a, children: n });
1377
- };
1378
- function jr() {
1379
- return J(ht).fetcher;
1380
- }
1381
- function Sr(t) {
1382
- const { fetcher: e, shouldFetchAsBlob: r } = J(ht), n = !!(t && (r != null && r(t))), [a, o] = y(
1383
- () => t ? n ? "" : t.url : ""
1384
- ), i = V(null);
1385
- return L(() => {
1386
- if (!t) {
1387
- o("");
1388
- return;
1389
- }
1390
- if (!n) {
1391
- o(t.url);
1392
- return;
1393
- }
1394
- let s = !1;
1395
- return o(""), Ye(t.url, e).then((p) => {
1396
- if (s) {
1397
- URL.revokeObjectURL(p);
1398
- return;
1399
- }
1400
- i.current && URL.revokeObjectURL(i.current), i.current = p, o(p);
1401
- }).catch((p) => {
1402
- s || (console.error("[file-preview] resolve blob url failed:", p), o(t.url));
1403
- }), () => {
1404
- s = !0;
1405
- };
1406
- }, [t == null ? void 0 : t.id, t == null ? void 0 : t.url, n, e]), L(() => () => {
1407
- i.current && (URL.revokeObjectURL(i.current), i.current = null);
1408
- }, []), a;
1409
- }
1410
- const Lr = N(
1411
- () => import("./index-D8GtNeDn.mjs").then((t) => ({ default: t.ImageRenderer }))
1412
- ), Wr = N(
1413
- () => import("./index-DmepcY31.mjs").then((t) => ({ default: t.PdfRenderer }))
1414
- ), $r = N(
1415
- () => import("./index-BNUiNUWa.mjs").then((t) => ({ default: t.DocxRenderer }))
1416
- ), Dr = N(
1417
- () => import("./index-r3q2xCCI.mjs").then((t) => ({ default: t.XlsxRenderer }))
1418
- ), Or = N(
1419
- () => import("./index-BqEuP_8r.mjs").then((t) => ({ default: t.PptxRenderer }))
1420
- ), Zr = N(
1421
- () => import("./index-CgV8T0G5.mjs").then((t) => ({ default: t.MsgRenderer }))
1422
- ), Ar = N(
1423
- () => import("./index-BSD3w5eG.mjs").then((t) => ({ default: t.EpubRenderer }))
1424
- ), Ur = N(
1425
- () => import("./index-DV5Jd7Qe.mjs").then((t) => ({ default: t.MobiRenderer }))
1426
- ), Ir = N(
1427
- () => import("./index-BGeyzo6u.mjs").then((t) => ({ default: t.VideoRenderer }))
1428
- ), Hr = N(
1429
- () => import("./index-zEVVgWCH.mjs").then((t) => ({ default: t.AudioRenderer }))
1430
- ), Vr = N(
1431
- () => import("./index-DdOEWhrk.mjs").then((t) => ({ default: t.MarkdownRenderer }))
1432
- ), Br = N(
1433
- () => import("./index-B-H9HQiI.mjs").then((t) => ({ default: t.JsonRenderer }))
1434
- ), qr = N(
1435
- () => import("./index-BcBe6KW7.mjs").then((t) => ({ default: t.CsvRenderer }))
1436
- ), Gr = N(
1437
- () => import("./index-BdYkTSTt.mjs").then((t) => ({ default: t.XmlRenderer }))
1438
- ), Xr = N(
1439
- () => import("./index-DGuiWJr7.mjs").then((t) => ({ default: t.SubtitleRenderer }))
1440
- ), Jr = N(
1441
- () => import("./index-U3w45GW8.mjs").then((t) => ({ default: t.ZipRenderer }))
1442
- ), Kr = N(
1443
- () => import("./index-CKirCT35.mjs").then((t) => ({ default: t.TextRenderer }))
1444
- ), Zt = ({
1445
- fileName: t,
1446
- fileType: e,
1447
- onDownload: r
1448
- }) => {
1449
- const n = Kt();
1450
- return /* @__PURE__ */ z("div", { className: "rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-8 rfp-gap-6", children: [
1451
- /* @__PURE__ */ l("div", { className: "rfp-w-32 rfp-h-32 rfp-rounded-full rfp-bg-surface-2 rfp-flex rfp-items-center rfp-justify-center", children: /* @__PURE__ */ l(De, { className: "rfp-w-16 rfp-h-16 rfp-text-fg-secondary" }) }),
1452
- /* @__PURE__ */ z("div", { className: "rfp-text-fg-primary rfp-text-center", children: [
1453
- /* @__PURE__ */ l("p", { className: "rfp-text-xl rfp-font-medium rfp-mb-2", children: t }),
1454
- /* @__PURE__ */ l("p", { className: "rfp-text-fg-secondary", children: n("common.unsupported_preview", { type: e }) })
1455
- ] }),
1456
- /* @__PURE__ */ z(
1457
- "button",
1458
- {
1459
- onClick: r,
1460
- className: "rfp-flex rfp-items-center rfp-gap-2 rfp-px-6 rfp-py-3 rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-backdrop-blur-sm rfp-rounded-lg rfp-text-fg-primary rfp-font-medium rfp-transition-all",
1461
- children: [
1462
- /* @__PURE__ */ l(Xt, { className: "rfp-w-5 rfp-h-5" }),
1463
- n("common.download")
1464
- ]
1465
- }
1466
- )
1467
- ] });
1468
- }, Yr = () => {
1469
- const t = Kt();
1470
- return /* @__PURE__ */ l("div", { className: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-text-fg-muted", children: /* @__PURE__ */ z("div", { className: "rfp-flex rfp-flex-col rfp-items-center rfp-gap-3", children: [
1471
- /* @__PURE__ */ l("div", { className: "rfp-w-8 rfp-h-8 rfp-rounded-full rfp-border-2 rfp-border-fg-muted rfp-border-t-transparent rfp-animate-spin" }),
1472
- /* @__PURE__ */ l("span", { className: "rfp-text-sm", children: t("common.loading") ?? "Loading..." })
1473
- ] }) });
1474
- }, Qr = 3, bt = (t) => {
1475
- const { requestInit: e, requestHandler: r, shouldFetchAsBlob: n } = t;
1476
- return /* @__PURE__ */ l(
1477
- Er,
1478
- {
1479
- requestInit: e,
1480
- requestHandler: r,
1481
- shouldFetchAsBlob: n,
1482
- children: /* @__PURE__ */ l(to, { ...t })
1483
- }
1484
- );
1485
- }, to = ({
1486
- files: t,
1487
- currentIndex: e,
1488
- onNavigate: r,
1489
- customRenderers: n = [],
1490
- mode: a = "modal",
1491
- onClose: o,
1492
- zipNestingDepth: i = 0,
1493
- locale: s = "zh-CN",
1494
- messages: p,
1495
- headless: c = !1,
1496
- theme: f = "dark",
1497
- onCustomEvent: d,
1498
- onDownload: h,
1499
- // 以下三项已由外层 RequestProvider 消费,Inner 内不再直接使用
1500
- requestInit: u,
1501
- requestHandler: _,
1502
- shouldFetchAsBlob: M
1503
- }) => {
1504
- const v = B(
1505
- () => ut({ locale: s, messages: p }),
1506
- [s, p]
1507
- ), [F, T] = y(
1508
- () => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
1509
- );
1510
- L(() => {
1511
- if (f !== "auto") return;
1512
- const m = window.matchMedia("(prefers-color-scheme: dark)"), w = (E) => T(E.matches);
1513
- return m.addEventListener("change", w), () => m.removeEventListener("change", w);
1514
- }, [f]);
1515
- const k = f === "auto" ? F ? "dark" : "light" : f, [R, x] = y(1), [S, W] = y(0), [Qt, gt] = y(1), [, wt] = y(1), [A, rt] = y(0), [U, vt] = y(0), [te, ot] = y(0), D = V(null), xt = V(null), yt = V(null), [ee, re] = y(0), [oe, ne] = y(0), [ae, ie] = y(!1), Ft = V(null), [se, le] = y(0), [pe, ce] = y(0), [fe, de] = y(!1), [ue, me] = y(null), [_t, he] = y(!0), [kt, be] = y(!1), [Ct, ge] = y("preview"), [I, q] = y(!0), O = V(null), we = 2e3, K = P(() => {
1516
- q(!0), O.current && clearTimeout(O.current), O.current = window.setTimeout(() => {
1517
- q(!1);
1518
- }, we);
1519
- }, []), ve = P(() => {
1520
- K();
1521
- }, [K]), $ = B(() => Ve(t), [t]), b = $[e], C = Sr(b), H = B(() => b ? n.find((m) => m.test(b)) : null, [b, n]), g = b ? Be(b) : "unsupported", Nt = P(
1522
- (m, w) => {
1523
- b && (d == null || d({ name: m, payload: w, file: b }));
1524
- },
1525
- [b, d]
1526
- ), Rt = B(
1527
- () => ({
1528
- emit: Nt,
1529
- t: v,
1530
- theme: k,
1531
- locale: s
1532
- }),
1533
- [Nt, v, k, s]
1534
- );
1535
- L(() => {
1536
- x(1), W(0), gt(1), wt(1), rt(0), vt(0), q(!0), O.current && clearTimeout(O.current);
1537
- }, [e]), L(() => {
1538
- if (g === "image" && A > 0 && U > 0 && D.current) {
1539
- const m = D.current.clientWidth, w = D.current.clientHeight, E = m / A, j = w / U, G = Math.min(E, j);
1540
- x(Math.max(0.01, Math.min(10, G)));
1541
- }
1542
- }, [g, A, U]), L(() => ($.length > 1 && K(), () => {
1543
- O.current && clearTimeout(O.current);
1544
- }), [$.length, K]), L(() => {
1545
- const m = (w) => {
1546
- w.key === "Escape" && a === "modal" ? o == null || o() : w.key === "ArrowLeft" && e > 0 ? r == null || r(e - 1) : w.key === "ArrowRight" && e < $.length - 1 && (r == null || r(e + 1));
1547
- };
1548
- if (a === "modal")
1549
- return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
1550
- {
1551
- const w = xt.current;
1552
- return w ? (w.addEventListener("keydown", m), () => w.removeEventListener("keydown", m)) : void 0;
1553
- }
1554
- }, [a, e, $.length, o, r]);
1555
- const Mt = P(() => {
1556
- x((m) => Math.min(m + 0.1, 10));
1557
- }, []), Tt = P(() => {
1558
- x((m) => Math.max(m - 0.1, 0.01));
1559
- }, []), xe = P(() => {
1560
- W((m) => m + 90);
1561
- }, []), ye = P(() => {
1562
- W((m) => m - 90);
1563
- }, []), Fe = P(() => {
1564
- if (D.current && A > 0 && U > 0) {
1565
- const m = D.current.clientWidth, w = D.current.clientHeight, E = m / A, j = w / U, G = Math.min(E, j);
1566
- x(Math.max(0.01, Math.min(10, G)));
1567
- } else
1568
- x(1);
1569
- W(0), ot((m) => m + 1);
1570
- }, [A, U]), _e = P(() => {
1571
- x(1), W(0), ot((m) => m + 1);
1572
- }, []), ke = P((m) => {
1573
- x(m);
1574
- }, []), Pt = P(() => {
1575
- x(1), W(0), ot((m) => m + 1);
1576
- }, []), zt = jr(), nt = P(async () => {
1577
- if (b) {
1578
- if (h) {
1579
- await h(b);
1580
- return;
1581
- }
1582
- try {
1583
- await Qe(b.url, b.name, zt);
1584
- } catch (m) {
1585
- console.error("[file-preview] download failed:", m);
1586
- }
1587
- }
1588
- }, [b, h, zt]), Ce = P((m, w) => {
1589
- re(m), ne(w);
1590
- }, []), Ne = P((m, w) => {
1591
- le(m), ce(w);
1592
- }, []), Re = P((m) => {
1593
- me(m);
1594
- }, []);
1595
- if (!b) return null;
1596
- const Me = a === "modal" && !!o, Y = (() => {
1597
- var m, w;
1598
- if (H)
1599
- return ((m = H.getToolbarGroups) == null ? void 0 : m.call(H, b, Rt)) ?? [];
1600
- if (g === "image")
1601
- return kr({
1602
- zoom: R,
1603
- onZoomIn: Mt,
1604
- onZoomOut: Tt,
1605
- onFitToWidth: Fe,
1606
- onOriginalSize: _e,
1607
- onRotateLeft: ye,
1608
- onRotateRight: xe,
1609
- onReset: Pt,
1610
- t: v
1611
- });
1612
- if (g === "pdf")
1613
- return Cr({
1614
- zoom: R,
1615
- onZoomIn: Mt,
1616
- onZoomOut: Tt,
1617
- onReset: Pt,
1618
- t: v
1619
- });
1620
- if (g === "epub")
1621
- return Nr({
1622
- epubRef: yt,
1623
- current: ee,
1624
- total: oe,
1625
- fullWidth: ae,
1626
- t: v
1627
- });
1628
- if (g === "mobi")
1629
- return Rr({
1630
- mobiRef: Ft,
1631
- current: se,
1632
- total: pe,
1633
- fullWidth: fe,
1634
- t: v
1635
- });
1636
- if (g === "zip")
1637
- return Mr({ stats: ue });
1638
- if (g === "text") {
1639
- const E = ((w = b.name.split(".").pop()) == null ? void 0 : w.toLowerCase()) || "";
1640
- return Tr({
1641
- wordWrap: _t,
1642
- onToggleWrap: () => he((j) => !j),
1643
- isHtml: E === "html" || E === "htm",
1644
- htmlPreview: kt,
1645
- onToggleHtmlPreview: () => be((j) => !j),
1646
- t: v
1647
- });
1648
- }
1649
- return g === "markdown" ? Pr({
1650
- viewMode: Ct,
1651
- onToggleViewMode: () => ge((E) => E === "preview" ? "source" : "preview"),
1652
- t: v
1653
- }) : [];
1654
- })(), Et = [
1655
- {
1656
- items: [
1657
- { type: "button", icon: /* @__PURE__ */ l(Xt, { className: "rfp-w-4 rfp-h-4" }), tooltip: v("common.download"), action: nt }
1658
- ]
1659
- },
1660
- ...Me ? [{
1661
- items: [
1662
- { type: "button", icon: /* @__PURE__ */ l(Oe, { className: "rfp-w-4 rfp-h-4" }), tooltip: v("common.close"), action: o }
1663
- ]
1664
- }] : []
1665
- ], Q = (m, w) => m.map((E, j, G) => /* @__PURE__ */ z(Pe.Fragment, { children: [
1666
- E.items.map(
1667
- (Z, jt) => Z.type === "button" ? /* @__PURE__ */ l(
1668
- eo,
1669
- {
1670
- icon: Z.icon,
1671
- label: Z.tooltip,
1672
- onClick: Z.action,
1673
- disabled: Z.disabled
1674
- },
1675
- `${j}-${jt}`
1676
- ) : /* @__PURE__ */ l(
1677
- "span",
1678
- {
1679
- className: "rfp-text-xs rfp-text-center rfp-font-medium rfp-tabular-nums rfp-text-fg-tertiary",
1680
- style: { minWidth: Z.minWidth || "auto" },
1681
- children: Z.content
1682
- },
1683
- `${j}-${jt}`
1684
- )
1685
- ),
1686
- j < G.length - 1 && /* @__PURE__ */ l("div", { className: `rfp-w-px rfp-h-4 rfp-bg-divide ${w}` })
1687
- ] }, j));
1688
- return /* @__PURE__ */ l(xr, { locale: s, messages: p, children: /* @__PURE__ */ l(Fr, { theme: k, children: /* @__PURE__ */ z(
1689
- "div",
1690
- {
1691
- ref: xt,
1692
- tabIndex: a === "embed" ? 0 : -1,
1693
- "data-theme": k,
1694
- className: "rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-flex-col rfp-overflow-hidden rfp-outline-none",
1695
- children: [
1696
- !c && /* @__PURE__ */ z(
1697
- et.div,
1698
- {
1699
- initial: { opacity: 0 },
1700
- animate: { opacity: 1 },
1701
- exit: { opacity: 0 },
1702
- className: "rfp-flex-shrink-0 rfp-z-10 rfp-backdrop-blur-md rfp-border-b rfp-bg-surface-toolbar rfp-border-line",
1703
- style: { paddingTop: "env(safe-area-inset-top, 0px)" },
1704
- children: [
1705
- /* @__PURE__ */ z("div", { className: "rfp-flex rfp-items-center rfp-justify-between rfp-px-3 md:rfp-px-5 rfp-py-1.5 md:rfp-py-2.5", children: [
1706
- /* @__PURE__ */ z("div", { className: "rfp-flex rfp-items-center rfp-flex-1 rfp-min-w-0 rfp-mr-2 md:rfp-mr-3", children: [
1707
- /* @__PURE__ */ l("h2", { className: "rfp-font-medium rfp-text-xs md:rfp-text-sm rfp-truncate rfp-text-fg-primary", children: b.name }),
1708
- /* @__PURE__ */ z("span", { className: "rfp-text-xs rfp-ml-2 rfp-flex-shrink-0 rfp-text-fg-muted", children: [
1709
- e + 1,
1710
- "/",
1711
- $.length
1712
- ] })
1713
- ] }),
1714
- /* @__PURE__ */ l("div", { className: "rfp-flex rfp-items-center rfp-gap-1 md:rfp-hidden rfp-flex-shrink-0", children: Q(Et, "rfp-mx-0.5") }),
1715
- /* @__PURE__ */ z("div", { className: "rfp-hidden md:rfp-flex rfp-items-center rfp-gap-1 rfp-flex-shrink-0", children: [
1716
- Q(Y, "rfp-mx-1"),
1717
- Y.length > 0 && /* @__PURE__ */ l("div", { className: "rfp-w-px rfp-h-4 rfp-mx-1 rfp-bg-divide" }),
1718
- Q(Et, "rfp-mx-1")
1719
- ] })
1720
- ] }),
1721
- Y.length > 0 && /* @__PURE__ */ l("div", { className: "rfp-flex rfp-items-center rfp-gap-1 rfp-px-3 rfp-pb-1.5 rfp-overflow-x-auto scrollbar-hide md:rfp-hidden", children: Q(Y, "rfp-mx-0.5") })
1722
- ]
1723
- }
1724
- ),
1725
- /* @__PURE__ */ l(
1726
- "div",
1727
- {
1728
- ref: D,
1729
- className: "rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-overflow-auto",
1730
- onMouseMove: ve,
1731
- children: H ? H.render(b, Rt) : /* @__PURE__ */ z(ze, { fallback: /* @__PURE__ */ l(Yr, {}), children: [
1732
- g === "image" && /* @__PURE__ */ l(
1733
- Lr,
1734
- {
1735
- url: C,
1736
- zoom: R,
1737
- rotation: S,
1738
- resetKey: te,
1739
- fileSize: b.size,
1740
- onZoomChange: ke,
1741
- onNaturalWidthChange: rt,
1742
- onNaturalHeightChange: vt
1743
- }
1744
- ),
1745
- g === "pdf" && /* @__PURE__ */ l(
1746
- Wr,
1747
- {
1748
- url: C,
1749
- zoom: R,
1750
- currentPage: Qt,
1751
- onPageChange: gt,
1752
- onTotalPagesChange: wt,
1753
- onPageWidthChange: rt
1754
- }
1755
- ),
1756
- g === "docx" && /* @__PURE__ */ l($r, { url: C }),
1757
- g === "xlsx" && /* @__PURE__ */ l(Dr, { url: C }),
1758
- g === "pptx" && /* @__PURE__ */ l(Or, { url: C }),
1759
- g === "msg" && /* @__PURE__ */ l(Zr, { url: C }),
1760
- g === "epub" && /* @__PURE__ */ l(
1761
- Ar,
1762
- {
1763
- ref: yt,
1764
- url: C,
1765
- onChapterChange: Ce,
1766
- onFullWidthChange: ie
1767
- }
1768
- ),
1769
- g === "mobi" && /* @__PURE__ */ l(
1770
- Ur,
1771
- {
1772
- ref: Ft,
1773
- url: C,
1774
- onChapterChange: Ne,
1775
- onFullWidthChange: de
1776
- }
1777
- ),
1778
- g === "video" && /* @__PURE__ */ l(Ir, { url: C }),
1779
- g === "audio" && /* @__PURE__ */ l(Hr, { url: C, fileName: b.name }),
1780
- g === "markdown" && /* @__PURE__ */ l(Vr, { url: C, viewMode: Ct }),
1781
- g === "json" && /* @__PURE__ */ l(Br, { url: C, fileName: b.name }),
1782
- g === "csv" && /* @__PURE__ */ l(qr, { url: C, fileName: b.name }),
1783
- g === "xml" && /* @__PURE__ */ l(Gr, { url: C, fileName: b.name }),
1784
- g === "subtitle" && /* @__PURE__ */ l(Xr, { url: C, fileName: b.name }),
1785
- g === "zip" && (i >= Qr ? /* @__PURE__ */ l(
1786
- Zt,
1787
- {
1788
- fileName: b.name,
1789
- fileType: b.type,
1790
- onDownload: nt
1791
- }
1792
- ) : /* @__PURE__ */ l(Jr, { url: C, onStatsChange: Re, nestingDepth: i })),
1793
- g === "text" && /* @__PURE__ */ l(
1794
- Kr,
1795
- {
1796
- url: C,
1797
- fileName: b.name,
1798
- wordWrap: _t,
1799
- htmlPreview: kt
1800
- }
1801
- ),
1802
- g === "unsupported" && /* @__PURE__ */ l(
1803
- Zt,
1804
- {
1805
- fileName: b.name,
1806
- fileType: b.type,
1807
- onDownload: nt
1808
- }
1809
- )
1810
- ] })
1811
- }
1812
- ),
1813
- !c && $.length > 1 && /* @__PURE__ */ z(Te, { children: [
1814
- e > 0 && /* @__PURE__ */ l(
1815
- et.button,
1816
- {
1817
- initial: { opacity: 0 },
1818
- animate: { opacity: I ? 1 : 0, x: I ? 0 : -20 },
1819
- transition: { duration: 0.2 },
1820
- onClick: () => r == null ? void 0 : r(e - 1),
1821
- onMouseEnter: () => q(!0),
1822
- style: { pointerEvents: I ? "auto" : "none" },
1823
- className: "rfp-absolute rfp-z-20 rfp-left-2 md:rfp-left-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",
1824
- children: /* @__PURE__ */ l(ct, { className: "rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6" })
1825
- }
1826
- ),
1827
- e < $.length - 1 && /* @__PURE__ */ l(
1828
- et.button,
1829
- {
1830
- initial: { opacity: 0 },
1831
- animate: { opacity: I ? 1 : 0, x: I ? 0 : 20 },
1832
- transition: { duration: 0.2 },
1833
- onClick: () => r == null ? void 0 : r(e + 1),
1834
- onMouseEnter: () => q(!0),
1835
- style: { pointerEvents: I ? "auto" : "none" },
1836
- className: "rfp-absolute rfp-z-20 rfp-right-2 md:rfp-right-4 rfp-top-1/2 -rfp-translate-y-1/2 rfp-w-10 rfp-h-10 md:rfp-w-12 md:rfp-h-12 rfp-rounded-full rfp-backdrop-blur-xl rfp-border rfp-flex rfp-items-center rfp-justify-center rfp-transition-colors rfp-shadow-2xl rfp-bg-surface-nav rfp-border-line hover:rfp-bg-surface-nav-hover rfp-text-fg-primary",
1837
- children: /* @__PURE__ */ l(ft, { className: "rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6" })
1838
- }
1839
- )
1840
- ] })
1841
- ]
1842
- }
1843
- ) }) });
1844
- }, eo = ({ icon: t, label: e, onClick: r, disabled: n }) => /* @__PURE__ */ z(
1845
- "button",
1846
- {
1847
- onClick: r,
1848
- disabled: n,
1849
- className: `rfp-relative rfp-group rfp-p-2 md:rfp-p-1.5 rfp-rounded-md rfp-transition-all rfp-select-none ${n ? "rfp-text-fg-disabled rfp-cursor-not-allowed" : "rfp-text-fg-primary hover:rfp-bg-surface-2 active:rfp-bg-surface-3"}`,
1850
- children: [
1851
- t,
1852
- /* @__PURE__ */ z("span", { className: "rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 rfp-top-full rfp-mt-1.5 rfp-px-2 rfp-py-1 rfp-text-xs rfp-rounded rfp-whitespace-nowrap rfp-pointer-events-none rfp-opacity-0 rfp-invisible group-hover:rfp-opacity-100 group-hover:rfp-visible rfp-transition-opacity rfp-duration-200 rfp-z-50 rfp-bg-fg-primary rfp-text-fg-inverse", children: [
1853
- /* @__PURE__ */ l("span", { className: "rfp-absolute rfp-left-1/2 -rfp-translate-x-1/2 -rfp-top-1 rfp-w-2 rfp-h-2 rfp-rotate-45 rfp-bg-fg-primary" }),
1854
- /* @__PURE__ */ l("span", { className: "rfp-relative", children: e })
1855
- ] })
1856
- ]
1857
- }
1858
- ), Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1859
- __proto__: null,
1860
- FilePreviewContent: bt
1861
- }, Symbol.toStringTag, { value: "Module" })), No = ({
1862
- files: t,
1863
- currentIndex: e,
1864
- isOpen: r,
1865
- onClose: n,
1866
- onNavigate: a,
1867
- customRenderers: o = [],
1868
- locale: i,
1869
- messages: s,
1870
- headless: p,
1871
- theme: c = "dark",
1872
- onCustomEvent: f,
1873
- requestInit: d,
1874
- requestHandler: h,
1875
- shouldFetchAsBlob: u,
1876
- onDownload: _
1877
- }) => {
1878
- const [M, v] = y(
1879
- () => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
1880
- );
1881
- L(() => {
1882
- if (c !== "auto") return;
1883
- const k = window.matchMedia("(prefers-color-scheme: dark)"), R = (x) => v(x.matches);
1884
- return k.addEventListener("change", R), () => k.removeEventListener("change", R);
1885
- }, [c]);
1886
- const F = c === "auto" ? M ? "dark" : "light" : c;
1887
- if (L(() => {
1888
- if (r) {
1889
- const k = document.body.style.overflow, R = document.body.style.paddingRight, x = window.innerWidth - document.documentElement.clientWidth;
1890
- return document.body.style.overflow = "hidden", x > 0 && (document.body.style.paddingRight = `${x}px`), () => {
1891
- document.body.style.overflow = k, document.body.style.paddingRight = R;
1892
- };
1893
- }
1894
- }, [r]), !r) return null;
1895
- const T = /* @__PURE__ */ l("div", { className: "rfp-root", "data-theme": F, children: /* @__PURE__ */ l(je, { children: r && /* @__PURE__ */ l(
1896
- et.div,
1897
- {
1898
- initial: { opacity: 0 },
1899
- animate: { opacity: 1 },
1900
- exit: { opacity: 0 },
1901
- className: "rfp-fixed rfp-inset-0 rfp-z-[9999] rfp-flex rfp-items-center rfp-justify-center rfp-backdrop-blur-md rfp-overflow-hidden rfp-bg-surface-overlay",
1902
- onClick: n,
1903
- onWheel: (k) => k.stopPropagation(),
1904
- children: /* @__PURE__ */ l(
1905
- "div",
1906
- {
1907
- className: "rfp-relative rfp-w-full rfp-h-full",
1908
- onClick: (k) => k.stopPropagation(),
1909
- children: /* @__PURE__ */ l(
1910
- bt,
1911
- {
1912
- mode: "modal",
1913
- files: t,
1914
- currentIndex: e,
1915
- onClose: n,
1916
- onNavigate: a,
1917
- customRenderers: o,
1918
- locale: i,
1919
- messages: s,
1920
- headless: p,
1921
- theme: c,
1922
- onCustomEvent: f,
1923
- requestInit: d,
1924
- requestHandler: h,
1925
- shouldFetchAsBlob: u,
1926
- onDownload: _
1927
- }
1928
- )
1929
- }
1930
- )
1931
- }
1932
- ) }) });
1933
- return Ee(T, document.body);
1934
- }, Ro = ({
1935
- files: t,
1936
- currentIndex: e = 0,
1937
- onNavigate: r,
1938
- customRenderers: n = [],
1939
- width: a = "100%",
1940
- height: o = "100%",
1941
- className: i,
1942
- style: s,
1943
- locale: p,
1944
- messages: c,
1945
- headless: f,
1946
- theme: d = "dark",
1947
- onCustomEvent: h,
1948
- requestInit: u,
1949
- requestHandler: _,
1950
- shouldFetchAsBlob: M,
1951
- onDownload: v
1952
- }) => {
1953
- const [F, T] = y(
1954
- () => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
1955
- );
1956
- L(() => {
1957
- if (d !== "auto") return;
1958
- const R = window.matchMedia("(prefers-color-scheme: dark)"), x = (S) => T(S.matches);
1959
- return R.addEventListener("change", x), () => R.removeEventListener("change", x);
1960
- }, [d]);
1961
- const k = d === "auto" ? F ? "dark" : "light" : d;
1962
- return /* @__PURE__ */ l(
1963
- "div",
1964
- {
1965
- className: `rfp-root ${i ?? ""}`,
1966
- style: { width: a, height: o, ...s },
1967
- "data-theme": k,
1968
- children: /* @__PURE__ */ l("div", { className: "rfp-relative rfp-w-full rfp-h-full rfp-overflow-hidden rfp-bg-surface-overlay", children: /* @__PURE__ */ l(
1969
- bt,
1970
- {
1971
- mode: "embed",
1972
- files: t,
1973
- currentIndex: e,
1974
- onNavigate: r,
1975
- customRenderers: n,
1976
- locale: p,
1977
- messages: c,
1978
- headless: f,
1979
- theme: d,
1980
- onCustomEvent: h,
1981
- requestInit: u,
1982
- requestHandler: _,
1983
- shouldFetchAsBlob: M,
1984
- onDownload: v
1985
- }
1986
- ) })
1987
- }
1988
- );
1989
- };
1990
- function ro(t) {
1991
- if (typeof window > "u") return;
1992
- const {
1993
- workerSrc: e = `https://unpkg.com/pdfjs-dist@${X.version}/build/pdf.worker.min.mjs`,
1994
- cMapUrl: r = `https://unpkg.com/pdfjs-dist@${X.version}/cmaps/`,
1995
- cMapPacked: n = !0
1996
- } = t || {};
1997
- X.GlobalWorkerOptions.workerSrc = e, X.GlobalWorkerOptions.cMapUrl = r, X.GlobalWorkerOptions.cMapPacked = n;
1998
- }
1999
- ro();
2000
- const Mo = Ue.version;
2001
- export {
2002
- go as C,
2003
- Fo as E,
2004
- bt as F,
2005
- xr as L,
2006
- xo as M,
2007
- vo as S,
2008
- He as U,
2009
- Mo as V,
2010
- bo as _,
2011
- jr as a,
2012
- mo as b,
2013
- ko as c,
2014
- wo as d,
2015
- Be as e,
2016
- co as f,
2017
- fo as g,
2018
- Ro as h,
2019
- No as i,
2020
- ro as j,
2021
- at as k,
2022
- Ve as l,
2023
- qe as m,
2024
- _o as n,
2025
- Co as o,
2026
- Kt as u,
2027
- uo as x,
2028
- ho as y,
2029
- yo as z
2030
- };
2031
- //# sourceMappingURL=index-Bv93wiEK.mjs.map