@eternalheart/react-file-preview 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -60
- package/README.zh-CN.md +437 -60
- package/lib/FilePreviewContent.d.ts +1 -0
- package/lib/FilePreviewContent.d.ts.map +1 -1
- package/lib/FilePreviewEmbed.d.ts +2 -0
- package/lib/FilePreviewEmbed.d.ts.map +1 -1
- package/lib/FilePreviewModal.d.ts +2 -0
- package/lib/FilePreviewModal.d.ts.map +1 -1
- package/lib/chunks/index-BBYKNNLb.mjs +329 -0
- package/lib/chunks/index-BBYKNNLb.mjs.map +1 -0
- package/lib/chunks/index-BFh22D_W.mjs +78 -0
- package/lib/chunks/index-BFh22D_W.mjs.map +1 -0
- package/lib/chunks/{index-DoFsoBKL.mjs → index-BKXvtJh5.mjs} +27 -25
- package/lib/chunks/index-BKXvtJh5.mjs.map +1 -0
- package/lib/chunks/index-Bw3Fh4b5.mjs +116 -0
- package/lib/chunks/index-Bw3Fh4b5.mjs.map +1 -0
- package/lib/chunks/{index-kALp0tqz.mjs → index-CEC_DHgr.mjs} +22 -20
- package/lib/chunks/index-CEC_DHgr.mjs.map +1 -0
- package/lib/chunks/{index-CzM2mxrD.mjs → index-COOUxB5e.mjs} +130 -128
- package/lib/chunks/{index-CzM2mxrD.mjs.map → index-COOUxB5e.mjs.map} +1 -1
- package/lib/chunks/index-CU1Lc3lV.mjs +120 -0
- package/lib/chunks/index-CU1Lc3lV.mjs.map +1 -0
- package/lib/chunks/index-CgFv7B_G.mjs +359 -0
- package/lib/chunks/index-CgFv7B_G.mjs.map +1 -0
- package/lib/chunks/index-Cn4ZyhGM.mjs +587 -0
- package/lib/chunks/index-Cn4ZyhGM.mjs.map +1 -0
- package/lib/chunks/{index-DaAXRBWL.mjs → index-DGNNEnWE.mjs} +864 -862
- package/lib/chunks/{index-DaAXRBWL.mjs.map → index-DGNNEnWE.mjs.map} +1 -1
- package/lib/chunks/index-DLk08ylq.mjs +313 -0
- package/lib/chunks/index-DLk08ylq.mjs.map +1 -0
- package/lib/chunks/index-DVtPyN-s.mjs +200 -0
- package/lib/chunks/index-DVtPyN-s.mjs.map +1 -0
- package/lib/chunks/index-DreA69iU.mjs +2409 -0
- package/lib/chunks/index-DreA69iU.mjs.map +1 -0
- package/lib/chunks/{index-Cp68OevR.mjs → index-Dta7iGov.mjs} +1299 -1297
- package/lib/chunks/{index-Cp68OevR.mjs.map → index-Dta7iGov.mjs.map} +1 -1
- package/lib/chunks/index-fQGAUFAX.mjs +275 -0
- package/lib/chunks/index-fQGAUFAX.mjs.map +1 -0
- package/lib/chunks/{index-C_BJatqr.mjs → index-fSw6Hl5e.mjs} +42 -40
- package/lib/chunks/index-fSw6Hl5e.mjs.map +1 -0
- package/lib/chunks/index-jvNrkVkp.mjs +291 -0
- package/lib/chunks/index-jvNrkVkp.mjs.map +1 -0
- package/lib/chunks/index-oVJyD-FV.mjs +107 -0
- package/lib/chunks/index-oVJyD-FV.mjs.map +1 -0
- package/lib/chunks/{index-DuP0Tlpo.mjs → index-vRLKumL8.mjs} +43 -41
- package/lib/chunks/index-vRLKumL8.mjs.map +1 -0
- package/lib/chunks/useShikiHighlight-C6nJcETW.mjs +36 -0
- package/lib/chunks/useShikiHighlight-C6nJcETW.mjs.map +1 -0
- package/lib/components/preview/FilePreviewToolbar.d.ts +1 -0
- package/lib/components/preview/FilePreviewToolbar.d.ts.map +1 -1
- package/lib/components/preview/ToolbarButton.d.ts +3 -1
- package/lib/components/preview/ToolbarButton.d.ts.map +1 -1
- package/lib/hooks/index.d.ts +0 -6
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/useShikiHighlight.d.ts +3 -1
- package/lib/hooks/useShikiHighlight.d.ts.map +1 -1
- package/lib/index.cjs +32 -30
- package/lib/index.cjs.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.mjs +1 -1
- package/lib/renderers/Audio/index.d.ts +2 -1
- package/lib/renderers/Audio/index.d.ts.map +1 -1
- package/lib/renderers/Csv/index.d.ts +2 -1
- package/lib/renderers/Csv/index.d.ts.map +1 -1
- package/lib/renderers/Docx/index.d.ts +2 -1
- package/lib/renderers/Docx/index.d.ts.map +1 -1
- package/lib/renderers/Epub/index.d.ts +2 -3
- package/lib/renderers/Epub/index.d.ts.map +1 -1
- package/lib/renderers/Font/index.d.ts +2 -1
- package/lib/renderers/Font/index.d.ts.map +1 -1
- package/lib/renderers/Image/index.d.ts +6 -7
- package/lib/renderers/Image/index.d.ts.map +1 -1
- package/lib/renderers/Json/index.d.ts +2 -1
- package/lib/renderers/Json/index.d.ts.map +1 -1
- package/lib/renderers/Markdown/index.d.ts +2 -2
- package/lib/renderers/Markdown/index.d.ts.map +1 -1
- package/lib/renderers/Mobi/index.d.ts +2 -3
- package/lib/renderers/Mobi/index.d.ts.map +1 -1
- package/lib/renderers/Msg/index.d.ts +2 -1
- package/lib/renderers/Msg/index.d.ts.map +1 -1
- package/lib/renderers/Pdf/index.d.ts +4 -8
- package/lib/renderers/Pdf/index.d.ts.map +1 -1
- package/lib/renderers/Pptx/index.d.ts +2 -1
- package/lib/renderers/Pptx/index.d.ts.map +1 -1
- package/lib/renderers/Subtitle/index.d.ts +2 -1
- package/lib/renderers/Subtitle/index.d.ts.map +1 -1
- package/lib/renderers/Text/index.d.ts +2 -3
- package/lib/renderers/Text/index.d.ts.map +1 -1
- package/lib/renderers/Video/index.d.ts +2 -1
- package/lib/renderers/Video/index.d.ts.map +1 -1
- package/lib/renderers/Xlsx/index.d.ts +2 -1
- package/lib/renderers/Xlsx/index.d.ts.map +1 -1
- package/lib/renderers/Xml/index.d.ts +2 -1
- package/lib/renderers/Xml/index.d.ts.map +1 -1
- package/lib/renderers/Zip/index.d.ts +7 -2
- package/lib/renderers/Zip/index.d.ts.map +1 -1
- package/lib/renderers/base.types.d.ts +38 -0
- package/lib/renderers/base.types.d.ts.map +1 -0
- package/lib/renderers/registry.d.ts +36 -0
- package/lib/renderers/registry.d.ts.map +1 -0
- package/lib/renderers/toolbar.types.d.ts +2 -0
- package/lib/renderers/toolbar.types.d.ts.map +1 -1
- package/lib/toolbar/renderItems.d.ts.map +1 -1
- package/package.json +3 -3
- package/lib/chunks/index-0v5STX5f.mjs +0 -105
- package/lib/chunks/index-0v5STX5f.mjs.map +0 -1
- package/lib/chunks/index-10O8tfTH.mjs +0 -529
- package/lib/chunks/index-10O8tfTH.mjs.map +0 -1
- package/lib/chunks/index-BCyv1HM9.mjs +0 -175
- package/lib/chunks/index-BCyv1HM9.mjs.map +0 -1
- package/lib/chunks/index-Bo90aGhy.mjs +0 -114
- package/lib/chunks/index-Bo90aGhy.mjs.map +0 -1
- package/lib/chunks/index-CEeKt7L3.mjs +0 -2808
- package/lib/chunks/index-CEeKt7L3.mjs.map +0 -1
- package/lib/chunks/index-CWKbnvW6.mjs +0 -270
- package/lib/chunks/index-CWKbnvW6.mjs.map +0 -1
- package/lib/chunks/index-C_BJatqr.mjs.map +0 -1
- package/lib/chunks/index-Cbz5Z6ZK.mjs +0 -263
- package/lib/chunks/index-Cbz5Z6ZK.mjs.map +0 -1
- package/lib/chunks/index-DTYBFuAH.mjs +0 -357
- package/lib/chunks/index-DTYBFuAH.mjs.map +0 -1
- package/lib/chunks/index-DoFsoBKL.mjs.map +0 -1
- package/lib/chunks/index-DuP0Tlpo.mjs.map +0 -1
- package/lib/chunks/index-Dv3RQz86.mjs +0 -270
- package/lib/chunks/index-Dv3RQz86.mjs.map +0 -1
- package/lib/chunks/index-QfpHck8N.mjs +0 -55
- package/lib/chunks/index-QfpHck8N.mjs.map +0 -1
- package/lib/chunks/index-gjSQeou7.mjs +0 -194
- package/lib/chunks/index-gjSQeou7.mjs.map +0 -1
- package/lib/chunks/index-kALp0tqz.mjs.map +0 -1
- package/lib/chunks/index-kCeSnFs-.mjs +0 -54
- package/lib/chunks/index-kCeSnFs-.mjs.map +0 -1
- package/lib/chunks/useShikiHighlight-BA9qgdGA.mjs +0 -23
- package/lib/chunks/useShikiHighlight-BA9qgdGA.mjs.map +0 -1
- package/lib/hooks/rendererReducer.d.ts +0 -10
- package/lib/hooks/rendererReducer.d.ts.map +0 -1
- package/lib/hooks/types.d.ts +0 -152
- package/lib/hooks/types.d.ts.map +0 -1
- package/lib/hooks/useBookRenderer.d.ts +0 -14
- package/lib/hooks/useBookRenderer.d.ts.map +0 -1
- package/lib/hooks/useFilePreviewState.d.ts +0 -10
- package/lib/hooks/useFilePreviewState.d.ts.map +0 -1
- package/lib/hooks/useImageAutoFit.d.ts +0 -13
- package/lib/hooks/useImageAutoFit.d.ts.map +0 -1
- package/lib/hooks/useToolbarConfig.d.ts +0 -25
- package/lib/hooks/useToolbarConfig.d.ts.map +0 -1
- package/lib/renderers/Epub/toolbar.d.ts +0 -13
- package/lib/renderers/Epub/toolbar.d.ts.map +0 -1
- package/lib/renderers/Image/toolbar.d.ts +0 -15
- package/lib/renderers/Image/toolbar.d.ts.map +0 -1
- package/lib/renderers/Markdown/toolbar.d.ts +0 -9
- package/lib/renderers/Markdown/toolbar.d.ts.map +0 -1
- package/lib/renderers/Mobi/toolbar.d.ts +0 -13
- package/lib/renderers/Mobi/toolbar.d.ts.map +0 -1
- package/lib/renderers/Pdf/toolbar.d.ts +0 -16
- package/lib/renderers/Pdf/toolbar.d.ts.map +0 -1
- package/lib/renderers/Text/toolbar.d.ts +0 -12
- package/lib/renderers/Text/toolbar.d.ts.map +0 -1
- package/lib/renderers/Zip/toolbar.d.ts +0 -13
- package/lib/renderers/Zip/toolbar.d.ts.map +0 -1
- package/lib/toolbar/registry.d.ts +0 -51
- package/lib/toolbar/registry.d.ts.map +0 -1
|
@@ -0,0 +1,2409 @@
|
|
|
1
|
+
var Ne = Object.defineProperty;
|
|
2
|
+
var je = (e, t, r) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var se = (e, t, r) => je(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as d, jsxs as y, Fragment as Pe } from "react/jsx-runtime";
|
|
5
|
+
import be, { useMemo as M, useContext as D, createContext as X, useState as S, useRef as E, useEffect as j, Suspense as Re, useCallback as z, lazy as F } from "react";
|
|
6
|
+
import { createPortal as Te } from "react-dom";
|
|
7
|
+
import { motion as V, AnimatePresence as Ee } from "framer-motion";
|
|
8
|
+
import Me from "jszip";
|
|
9
|
+
import { FileQuestion as ze, Download as J, X as Le, AlertCircle as Se, RotateCw as De, ChevronLeft as Ue, ChevronRight as $e } from "lucide-react";
|
|
10
|
+
import * as Ae from "pdfjs-dist/build/pdf.mjs";
|
|
11
|
+
const We = "1.5.1", Be = {
|
|
12
|
+
version: We
|
|
13
|
+
}, hr = [
|
|
14
|
+
"image",
|
|
15
|
+
"pdf",
|
|
16
|
+
"docx",
|
|
17
|
+
"xlsx",
|
|
18
|
+
"pptx",
|
|
19
|
+
"msg",
|
|
20
|
+
"epub",
|
|
21
|
+
"mobi",
|
|
22
|
+
"video",
|
|
23
|
+
"audio",
|
|
24
|
+
"markdown",
|
|
25
|
+
"json",
|
|
26
|
+
"csv",
|
|
27
|
+
"xml",
|
|
28
|
+
"subtitle",
|
|
29
|
+
"zip",
|
|
30
|
+
"text",
|
|
31
|
+
"font"
|
|
32
|
+
];
|
|
33
|
+
function Ie(e) {
|
|
34
|
+
try {
|
|
35
|
+
const t = new URL(e).pathname.split("/").pop() || "file";
|
|
36
|
+
return decodeURIComponent(t);
|
|
37
|
+
} catch {
|
|
38
|
+
const t = e.split("/").pop() || "file";
|
|
39
|
+
return decodeURIComponent(t);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function G(e) {
|
|
43
|
+
var t;
|
|
44
|
+
const r = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
45
|
+
return {
|
|
46
|
+
// 图片
|
|
47
|
+
jpg: "image/jpeg",
|
|
48
|
+
jpeg: "image/jpeg",
|
|
49
|
+
png: "image/png",
|
|
50
|
+
gif: "image/gif",
|
|
51
|
+
webp: "image/webp",
|
|
52
|
+
svg: "image/svg+xml",
|
|
53
|
+
bmp: "image/bmp",
|
|
54
|
+
ico: "image/x-icon",
|
|
55
|
+
// 视频
|
|
56
|
+
mp4: "video/mp4",
|
|
57
|
+
webm: "video/webm",
|
|
58
|
+
ogg: "video/ogg",
|
|
59
|
+
ogv: "video/ogg",
|
|
60
|
+
mov: "video/quicktime",
|
|
61
|
+
avi: "video/x-msvideo",
|
|
62
|
+
mkv: "video/x-matroska",
|
|
63
|
+
m4v: "video/x-m4v",
|
|
64
|
+
"3gp": "video/3gpp",
|
|
65
|
+
flv: "video/x-flv",
|
|
66
|
+
// 音频
|
|
67
|
+
mp3: "audio/mpeg",
|
|
68
|
+
wav: "audio/wav",
|
|
69
|
+
m4a: "audio/mp4",
|
|
70
|
+
aac: "audio/aac",
|
|
71
|
+
flac: "audio/flac",
|
|
72
|
+
// 文档
|
|
73
|
+
pdf: "application/pdf",
|
|
74
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
75
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
76
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
77
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
78
|
+
msg: "application/vnd.ms-outlook",
|
|
79
|
+
mobi: "application/x-mobipocket-ebook",
|
|
80
|
+
azw: "application/vnd.amazon.ebook",
|
|
81
|
+
azw3: "application/vnd.amazon.ebook",
|
|
82
|
+
kf8: "application/vnd.amazon.ebook",
|
|
83
|
+
// 文本
|
|
84
|
+
txt: "text/plain",
|
|
85
|
+
md: "text/markdown",
|
|
86
|
+
markdown: "text/markdown",
|
|
87
|
+
json: "application/json",
|
|
88
|
+
xml: "application/xml",
|
|
89
|
+
html: "text/html",
|
|
90
|
+
css: "text/css",
|
|
91
|
+
js: "text/javascript",
|
|
92
|
+
ts: "text/typescript",
|
|
93
|
+
jsx: "text/javascript",
|
|
94
|
+
tsx: "text/typescript",
|
|
95
|
+
py: "text/x-python",
|
|
96
|
+
java: "text/x-java",
|
|
97
|
+
cpp: "text/x-c++src",
|
|
98
|
+
c: "text/x-csrc",
|
|
99
|
+
cs: "text/x-csharp",
|
|
100
|
+
php: "text/x-php",
|
|
101
|
+
rb: "text/x-ruby",
|
|
102
|
+
go: "text/x-go",
|
|
103
|
+
rs: "text/x-rust",
|
|
104
|
+
yaml: "text/yaml",
|
|
105
|
+
yml: "text/yaml",
|
|
106
|
+
toml: "text/toml",
|
|
107
|
+
ini: "text/plain",
|
|
108
|
+
env: "text/plain",
|
|
109
|
+
diff: "text/x-diff",
|
|
110
|
+
patch: "text/x-diff",
|
|
111
|
+
log: "text/plain",
|
|
112
|
+
csv: "text/csv",
|
|
113
|
+
tsv: "text/tab-separated-values",
|
|
114
|
+
srt: "application/x-subrip",
|
|
115
|
+
vtt: "text/vtt",
|
|
116
|
+
zip: "application/zip"
|
|
117
|
+
}[r] || "application/octet-stream";
|
|
118
|
+
}
|
|
119
|
+
function Ve(e, t = 0) {
|
|
120
|
+
if (e instanceof File)
|
|
121
|
+
return {
|
|
122
|
+
id: `file-${Date.now()}-${t}`,
|
|
123
|
+
name: e.name,
|
|
124
|
+
url: URL.createObjectURL(e),
|
|
125
|
+
type: e.type || G(e.name),
|
|
126
|
+
size: e.size
|
|
127
|
+
};
|
|
128
|
+
if (typeof e == "string") {
|
|
129
|
+
const r = Ie(e);
|
|
130
|
+
return {
|
|
131
|
+
id: `url-${Date.now()}-${t}`,
|
|
132
|
+
name: r,
|
|
133
|
+
url: e,
|
|
134
|
+
type: G(r)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
id: e.id || `link-${Date.now()}-${t}`,
|
|
139
|
+
name: e.name,
|
|
140
|
+
url: e.url,
|
|
141
|
+
type: e.type || G(e.name),
|
|
142
|
+
size: e.size
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function Oe(e) {
|
|
146
|
+
return e.map((t, r) => Ve(t, r));
|
|
147
|
+
}
|
|
148
|
+
function qe(e) {
|
|
149
|
+
var t;
|
|
150
|
+
const r = ((t = e.name.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "", o = e.type.toLowerCase();
|
|
151
|
+
if (o.startsWith("image/") || [
|
|
152
|
+
"jpg",
|
|
153
|
+
"jpeg",
|
|
154
|
+
"png",
|
|
155
|
+
"gif",
|
|
156
|
+
"webp",
|
|
157
|
+
"svg",
|
|
158
|
+
"bmp",
|
|
159
|
+
"ico",
|
|
160
|
+
// 高级图片格式
|
|
161
|
+
"heic",
|
|
162
|
+
"heif",
|
|
163
|
+
"avif",
|
|
164
|
+
"tif",
|
|
165
|
+
"tiff",
|
|
166
|
+
// RAW 格式
|
|
167
|
+
"cr2",
|
|
168
|
+
"nef",
|
|
169
|
+
"arw",
|
|
170
|
+
"dng",
|
|
171
|
+
"raf",
|
|
172
|
+
"orf",
|
|
173
|
+
// 其他专业格式
|
|
174
|
+
"psd",
|
|
175
|
+
"jp2",
|
|
176
|
+
"jpx",
|
|
177
|
+
"j2k"
|
|
178
|
+
].includes(r))
|
|
179
|
+
return "image";
|
|
180
|
+
if (o.includes("pdf") || r === "pdf")
|
|
181
|
+
return "pdf";
|
|
182
|
+
if (o.includes("wordprocessingml") || r === "docx")
|
|
183
|
+
return "docx";
|
|
184
|
+
if (o.includes("spreadsheetml") || r === "xlsx")
|
|
185
|
+
return "xlsx";
|
|
186
|
+
if (o.includes("presentationml") || r === "pptx" || r === "ppt")
|
|
187
|
+
return "pptx";
|
|
188
|
+
if (o.includes("ms-outlook") || r === "msg")
|
|
189
|
+
return "msg";
|
|
190
|
+
if (o.includes("epub") || r === "epub")
|
|
191
|
+
return "epub";
|
|
192
|
+
if (["mobi", "azw", "azw3", "kf8"].includes(r) || o === "application/x-mobipocket-ebook" || o === "application/vnd.amazon.ebook")
|
|
193
|
+
return "mobi";
|
|
194
|
+
if (["csv", "tsv"].includes(r) || o === "text/csv" || o === "text/tab-separated-values")
|
|
195
|
+
return "csv";
|
|
196
|
+
if (r === "xml" || o === "application/xml" || o === "text/xml")
|
|
197
|
+
return "xml";
|
|
198
|
+
if (["srt", "vtt", "lrc", "elrc", "ass", "ssa", "ttml", "dfxp"].includes(r) || o === "text/vtt" || o === "application/x-subrip" || o === "application/ttml+xml")
|
|
199
|
+
return "subtitle";
|
|
200
|
+
if (r === "zip" || o === "application/zip" || o === "application/x-zip-compressed")
|
|
201
|
+
return "zip";
|
|
202
|
+
if (["ttf", "otf", "woff", "woff2"].includes(r) || o.startsWith("font/") || o === "application/font-woff" || o === "application/font-woff2" || o === "application/x-font-ttf" || o === "application/x-font-otf" || o === "application/font-sfnt")
|
|
203
|
+
return "font";
|
|
204
|
+
if (o.startsWith("video/") || ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv", "m4v", "3gp", "flv"].includes(r))
|
|
205
|
+
return "video";
|
|
206
|
+
if (o.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac", "aac"].includes(r))
|
|
207
|
+
return "audio";
|
|
208
|
+
if (r === "md" || r === "markdown")
|
|
209
|
+
return "markdown";
|
|
210
|
+
if (o === "application/json" || r === "json" || r === "jsonc")
|
|
211
|
+
return "json";
|
|
212
|
+
const a = [
|
|
213
|
+
"txt",
|
|
214
|
+
"log",
|
|
215
|
+
"lock",
|
|
216
|
+
"js",
|
|
217
|
+
"jsx",
|
|
218
|
+
"ts",
|
|
219
|
+
"tsx",
|
|
220
|
+
"cjs",
|
|
221
|
+
"mjs",
|
|
222
|
+
"cts",
|
|
223
|
+
"mts",
|
|
224
|
+
"py",
|
|
225
|
+
"java",
|
|
226
|
+
"cpp",
|
|
227
|
+
"c",
|
|
228
|
+
"h",
|
|
229
|
+
"cs",
|
|
230
|
+
"php",
|
|
231
|
+
"rb",
|
|
232
|
+
"go",
|
|
233
|
+
"mod",
|
|
234
|
+
"rs",
|
|
235
|
+
"swift",
|
|
236
|
+
"kt",
|
|
237
|
+
"lua",
|
|
238
|
+
"vim",
|
|
239
|
+
"html",
|
|
240
|
+
"css",
|
|
241
|
+
"scss",
|
|
242
|
+
"sass",
|
|
243
|
+
"less",
|
|
244
|
+
"yaml",
|
|
245
|
+
"yml",
|
|
246
|
+
"toml",
|
|
247
|
+
"ini",
|
|
248
|
+
"conf",
|
|
249
|
+
"env",
|
|
250
|
+
"diff",
|
|
251
|
+
"patch",
|
|
252
|
+
"sh",
|
|
253
|
+
"bash",
|
|
254
|
+
"zsh",
|
|
255
|
+
"sql"
|
|
256
|
+
];
|
|
257
|
+
return o.startsWith("text/") || a.includes(r) || e.name.startsWith(".") && !e.name.includes("/") ? "text" : "unsupported";
|
|
258
|
+
}
|
|
259
|
+
function gr(e) {
|
|
260
|
+
var t;
|
|
261
|
+
const r = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "", o = {
|
|
262
|
+
js: "javascript",
|
|
263
|
+
jsx: "jsx",
|
|
264
|
+
ts: "typescript",
|
|
265
|
+
tsx: "tsx",
|
|
266
|
+
cjs: "javascript",
|
|
267
|
+
mjs: "javascript",
|
|
268
|
+
cts: "typescript",
|
|
269
|
+
mts: "typescript",
|
|
270
|
+
py: "python",
|
|
271
|
+
java: "java",
|
|
272
|
+
cpp: "cpp",
|
|
273
|
+
c: "c",
|
|
274
|
+
cs: "csharp",
|
|
275
|
+
php: "php",
|
|
276
|
+
rb: "ruby",
|
|
277
|
+
go: "go",
|
|
278
|
+
mod: "go",
|
|
279
|
+
rs: "rust",
|
|
280
|
+
swift: "swift",
|
|
281
|
+
kt: "kotlin",
|
|
282
|
+
lua: "lua",
|
|
283
|
+
vim: "vim",
|
|
284
|
+
scala: "scala",
|
|
285
|
+
sh: "bash",
|
|
286
|
+
bash: "bash",
|
|
287
|
+
zsh: "bash",
|
|
288
|
+
json: "json",
|
|
289
|
+
jsonc: "json",
|
|
290
|
+
xml: "xml",
|
|
291
|
+
html: "html",
|
|
292
|
+
css: "css",
|
|
293
|
+
scss: "scss",
|
|
294
|
+
sass: "sass",
|
|
295
|
+
less: "less",
|
|
296
|
+
sql: "sql",
|
|
297
|
+
yaml: "yaml",
|
|
298
|
+
yml: "yaml",
|
|
299
|
+
toml: "toml",
|
|
300
|
+
ini: "ini",
|
|
301
|
+
env: "bash",
|
|
302
|
+
conf: "nginx",
|
|
303
|
+
diff: "diff",
|
|
304
|
+
patch: "diff",
|
|
305
|
+
log: "log",
|
|
306
|
+
md: "markdown",
|
|
307
|
+
txt: "text"
|
|
308
|
+
};
|
|
309
|
+
if (o[r])
|
|
310
|
+
return o[r];
|
|
311
|
+
if (e.startsWith(".")) {
|
|
312
|
+
const a = e.toLowerCase(), n = {
|
|
313
|
+
// Git 相关
|
|
314
|
+
".gitignore": "ini",
|
|
315
|
+
".gitattributes": "ini",
|
|
316
|
+
".gitmodules": "ini",
|
|
317
|
+
".gitkeep": "text",
|
|
318
|
+
// 编辑器配置
|
|
319
|
+
".editorconfig": "ini",
|
|
320
|
+
".prettierrc": "json",
|
|
321
|
+
".prettierignore": "ini",
|
|
322
|
+
".eslintrc": "json",
|
|
323
|
+
".eslintignore": "ini",
|
|
324
|
+
".stylelintrc": "json",
|
|
325
|
+
// Shell 配置
|
|
326
|
+
".bashrc": "bash",
|
|
327
|
+
".zshrc": "bash",
|
|
328
|
+
".bash_profile": "bash",
|
|
329
|
+
".zprofile": "bash",
|
|
330
|
+
".profile": "bash",
|
|
331
|
+
".vimrc": "vim",
|
|
332
|
+
// 环境变量
|
|
333
|
+
".env": "bash",
|
|
334
|
+
".env.local": "bash",
|
|
335
|
+
".env.development": "bash",
|
|
336
|
+
".env.production": "bash",
|
|
337
|
+
".env.test": "bash",
|
|
338
|
+
// 其他配置
|
|
339
|
+
".npmrc": "ini",
|
|
340
|
+
".yarnrc": "ini",
|
|
341
|
+
".nvmrc": "text",
|
|
342
|
+
".dockerignore": "ini"
|
|
343
|
+
};
|
|
344
|
+
if (n[a])
|
|
345
|
+
return n[a];
|
|
346
|
+
if (a.startsWith(".env"))
|
|
347
|
+
return "bash";
|
|
348
|
+
if (a.endsWith("rc"))
|
|
349
|
+
return "json";
|
|
350
|
+
if (a.endsWith("ignore"))
|
|
351
|
+
return "ini";
|
|
352
|
+
}
|
|
353
|
+
return "text";
|
|
354
|
+
}
|
|
355
|
+
function br(e) {
|
|
356
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
357
|
+
}
|
|
358
|
+
function xr(e) {
|
|
359
|
+
var t;
|
|
360
|
+
return (((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "") === "tsv" ? " " : ",";
|
|
361
|
+
}
|
|
362
|
+
function vr(e, t = {}) {
|
|
363
|
+
const r = t.delimiter ?? ",", o = t.firstRowAsHeader ?? !0, a = [];
|
|
364
|
+
let n = [], i = "", s = !1, l = 0;
|
|
365
|
+
const c = e.length;
|
|
366
|
+
for (; l < c; ) {
|
|
367
|
+
const u = e[l];
|
|
368
|
+
if (s) {
|
|
369
|
+
if (u === '"') {
|
|
370
|
+
if (e[l + 1] === '"') {
|
|
371
|
+
i += '"', l += 2;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
s = !1, l += 1;
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
i += u, l += 1;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
if (u === '"') {
|
|
381
|
+
s = !0, l += 1;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (u === r) {
|
|
385
|
+
n.push(i), i = "", l += 1;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (u === "\r") {
|
|
389
|
+
e[l + 1] === `
|
|
390
|
+
` && (l += 1), n.push(i), a.push(n), n = [], i = "", l += 1;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (u === `
|
|
394
|
+
`) {
|
|
395
|
+
n.push(i), a.push(n), n = [], i = "", l += 1;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
i += u, l += 1;
|
|
399
|
+
}
|
|
400
|
+
for ((i.length > 0 || n.length > 0) && (n.push(i), a.push(n)); a.length > 0; ) {
|
|
401
|
+
const u = a[a.length - 1];
|
|
402
|
+
if (u.length === 1 && u[0] === "")
|
|
403
|
+
a.pop();
|
|
404
|
+
else
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
let p = [], f = a;
|
|
408
|
+
o && a.length > 0 && (p = a[0], f = a.slice(1));
|
|
409
|
+
const m = Math.max(
|
|
410
|
+
p.length,
|
|
411
|
+
...f.map((u) => u.length),
|
|
412
|
+
0
|
|
413
|
+
);
|
|
414
|
+
for (const u of f)
|
|
415
|
+
for (; u.length < m; ) u.push("");
|
|
416
|
+
return {
|
|
417
|
+
header: p,
|
|
418
|
+
rows: f,
|
|
419
|
+
columnCount: m,
|
|
420
|
+
delimiter: r
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function Ge(e) {
|
|
424
|
+
const t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
425
|
+
if (t.length >= 3 && t[0] === 239 && t[1] === 187 && t[2] === 191)
|
|
426
|
+
return new TextDecoder("utf-8").decode(t);
|
|
427
|
+
if (t.length >= 2 && t[0] === 255 && t[1] === 254)
|
|
428
|
+
return new TextDecoder("utf-16le").decode(t);
|
|
429
|
+
if (t.length >= 2 && t[0] === 254 && t[1] === 255)
|
|
430
|
+
return new TextDecoder("utf-16be").decode(t);
|
|
431
|
+
try {
|
|
432
|
+
return new TextDecoder("utf-8", { fatal: !0 }).decode(t);
|
|
433
|
+
} catch {
|
|
434
|
+
}
|
|
435
|
+
try {
|
|
436
|
+
return new TextDecoder("gbk").decode(t);
|
|
437
|
+
} catch {
|
|
438
|
+
}
|
|
439
|
+
return new TextDecoder("utf-8", { fatal: !1 }).decode(t);
|
|
440
|
+
}
|
|
441
|
+
async function wr(e, t) {
|
|
442
|
+
const r = !!t && ("fetcher" in t || "init" in t || "signal" in t), o = r ? t.fetcher ?? fetch : fetch, a = r ? t.signal : void 0, n = r ? t.init : t, i = a ? { ...n, signal: a } : n, s = await o(e, i);
|
|
443
|
+
if (!s.ok) throw new Error(`请求失败: ${s.status}`);
|
|
444
|
+
const l = await s.arrayBuffer();
|
|
445
|
+
return Ge(l);
|
|
446
|
+
}
|
|
447
|
+
async function He(e, t) {
|
|
448
|
+
if (e)
|
|
449
|
+
return typeof e == "function" ? await e(t) : e;
|
|
450
|
+
}
|
|
451
|
+
function Ze(e, t) {
|
|
452
|
+
if (!e && !t) return;
|
|
453
|
+
if (!e) return t;
|
|
454
|
+
if (!t) return e;
|
|
455
|
+
const r = new Headers(e.headers || {});
|
|
456
|
+
return t.headers && new Headers(t.headers).forEach((o, a) => {
|
|
457
|
+
r.set(a, o);
|
|
458
|
+
}), {
|
|
459
|
+
...e,
|
|
460
|
+
...t,
|
|
461
|
+
headers: r
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function Ke(e) {
|
|
465
|
+
const t = (e == null ? void 0 : e.requestHandler) ?? ((o, a) => fetch(o, a)), r = e == null ? void 0 : e.requestInit;
|
|
466
|
+
return async (o, a) => {
|
|
467
|
+
const n = await He(r, o), i = Ze(n, a);
|
|
468
|
+
return t(o, i);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
async function Xe(e, t = fetch, r) {
|
|
472
|
+
const o = await t(e, r);
|
|
473
|
+
if (!o.ok) throw new Error(`请求失败: ${o.status}`);
|
|
474
|
+
const a = await o.blob();
|
|
475
|
+
return URL.createObjectURL(a);
|
|
476
|
+
}
|
|
477
|
+
async function Je(e, t, r = fetch, o) {
|
|
478
|
+
const a = await r(e, o);
|
|
479
|
+
if (!a.ok) throw new Error(`请求失败: ${a.status}`);
|
|
480
|
+
const n = await a.blob(), i = URL.createObjectURL(n);
|
|
481
|
+
try {
|
|
482
|
+
const s = document.createElement("a");
|
|
483
|
+
s.href = i, s.download = t, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s);
|
|
484
|
+
} finally {
|
|
485
|
+
setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
function le(e) {
|
|
489
|
+
const t = e.trim().replace(",", "."), r = t.split(":").map((o) => o.trim());
|
|
490
|
+
if (r.length === 3) {
|
|
491
|
+
const [o, a, n] = r;
|
|
492
|
+
return Number(o) * 3600 + Number(a) * 60 + Number(n);
|
|
493
|
+
}
|
|
494
|
+
if (r.length === 2) {
|
|
495
|
+
const [o, a] = r;
|
|
496
|
+
return Number(o) * 60 + Number(a);
|
|
497
|
+
}
|
|
498
|
+
return Number(t) || 0;
|
|
499
|
+
}
|
|
500
|
+
function yr(e) {
|
|
501
|
+
if (!isFinite(e) || e < 0) return "00:00:00.000";
|
|
502
|
+
const t = Math.floor(e * 1e3), r = t % 1e3, o = Math.floor(t / 1e3) % 60, a = Math.floor(t / 6e4) % 60, n = Math.floor(t / 36e5), i = (s, l = 2) => s.toString().padStart(l, "0");
|
|
503
|
+
return `${i(n)}:${i(a)}:${i(o)}.${i(r, 3)}`;
|
|
504
|
+
}
|
|
505
|
+
const ce = /(\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}/, Qe = /^\s*\[\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?\]/;
|
|
506
|
+
function Ye(e) {
|
|
507
|
+
const t = e.replace(/^\uFEFF/, "").trimStart();
|
|
508
|
+
return /^WEBVTT/.test(t) ? "vtt" : /^<\?xml/i.test(t) || /<tt\b[^>]*>/i.test(t) ? "ttml" : /^\[Script Info\]/im.test(t) || /^Dialogue:/m.test(t) ? /ScriptType:\s*v4\.00\s*$/im.test(t) ? "ssa" : "ass" : Qe.test(t) || /^\[(ti|ar|al|au|by|length|offset|re|ve):/im.test(t) ? /<\d{1,2}:\d{1,2}(?:[.:]\d{1,3})?>/.test(t) ? "elrc" : "lrc" : "srt";
|
|
509
|
+
}
|
|
510
|
+
function pe(e, t) {
|
|
511
|
+
const r = e.replace(/\r\n?/g, `
|
|
512
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
513
|
+
`), o = [];
|
|
514
|
+
let a, n = 0;
|
|
515
|
+
if (t === "vtt") {
|
|
516
|
+
const i = [];
|
|
517
|
+
for (; n < r.length && r[n].trim() !== ""; )
|
|
518
|
+
i.push(r[n]), n++;
|
|
519
|
+
for (a = i.join(`
|
|
520
|
+
`); n < r.length && r[n].trim() === ""; ) n++;
|
|
521
|
+
}
|
|
522
|
+
for (; n < r.length; ) {
|
|
523
|
+
for (; n < r.length && r[n].trim() === ""; ) n++;
|
|
524
|
+
if (n >= r.length) break;
|
|
525
|
+
let i, s = null;
|
|
526
|
+
if (ce.test(r[n]))
|
|
527
|
+
s = r[n], n++;
|
|
528
|
+
else if (i = r[n].trim() || void 0, n++, n < r.length && ce.test(r[n]))
|
|
529
|
+
s = r[n], n++;
|
|
530
|
+
else
|
|
531
|
+
continue;
|
|
532
|
+
if (!s) continue;
|
|
533
|
+
const l = s.match(/([\d:.,]+)\s*-->\s*([\d:.,]+)/);
|
|
534
|
+
if (!l) continue;
|
|
535
|
+
const c = le(l[1]), p = le(l[2]), f = [];
|
|
536
|
+
for (; n < r.length && r[n].trim() !== ""; )
|
|
537
|
+
f.push(r[n]), n++;
|
|
538
|
+
o.push({ id: i, start: c, end: p, text: f.join(`
|
|
539
|
+
`) });
|
|
540
|
+
}
|
|
541
|
+
return { format: t, cues: o, header: a };
|
|
542
|
+
}
|
|
543
|
+
function K(e, t, r) {
|
|
544
|
+
const o = Number(e), a = Number(t);
|
|
545
|
+
let n = 0;
|
|
546
|
+
if (r) {
|
|
547
|
+
const i = (r + "000").slice(0, 3);
|
|
548
|
+
n = Number(i);
|
|
549
|
+
}
|
|
550
|
+
return o * 60 + a + n / 1e3;
|
|
551
|
+
}
|
|
552
|
+
function xe(e, t) {
|
|
553
|
+
const r = /^\[(ti|ar|al|au|by|length|offset|re|ve):(.*)\]$/i.exec(e.trim());
|
|
554
|
+
if (!r) return !1;
|
|
555
|
+
const o = r[1].toLowerCase(), a = r[2].trim();
|
|
556
|
+
if (t.metadata[o] = a, o === "offset") {
|
|
557
|
+
const n = Number(a);
|
|
558
|
+
isNaN(n) || (t.offsetMs = n);
|
|
559
|
+
}
|
|
560
|
+
return !0;
|
|
561
|
+
}
|
|
562
|
+
function et(e) {
|
|
563
|
+
const t = e.replace(/\r\n?/g, `
|
|
564
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
565
|
+
`), r = { metadata: {}, offsetMs: 0 }, o = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, a = [];
|
|
566
|
+
for (const i of t) {
|
|
567
|
+
const s = i.trim();
|
|
568
|
+
if (!s || xe(s, r)) continue;
|
|
569
|
+
const l = [];
|
|
570
|
+
let c = 0;
|
|
571
|
+
o.lastIndex = 0;
|
|
572
|
+
let p;
|
|
573
|
+
for (; (p = o.exec(s)) !== null && p.index === c; )
|
|
574
|
+
l.push(K(p[1], p[2], p[3])), c = p.index + p[0].length;
|
|
575
|
+
if (l.length === 0) continue;
|
|
576
|
+
const f = s.slice(c).trim();
|
|
577
|
+
for (const m of l)
|
|
578
|
+
a.push({ start: m, text: f });
|
|
579
|
+
}
|
|
580
|
+
a.sort((i, s) => i.start - s.start);
|
|
581
|
+
const n = r.offsetMs / 1e3;
|
|
582
|
+
return { format: "lrc", cues: a.map((i, s) => {
|
|
583
|
+
const l = Math.max(0, i.start - n), c = a[s + 1], p = c ? Math.max(l, c.start - n) : l + 5;
|
|
584
|
+
return { start: l, end: p, text: i.text };
|
|
585
|
+
}), metadata: r.metadata };
|
|
586
|
+
}
|
|
587
|
+
function tt(e) {
|
|
588
|
+
const t = e.replace(/\r\n?/g, `
|
|
589
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
590
|
+
`), r = { metadata: {}, offsetMs: 0 }, o = /\[(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?\]/g, a = /<(\d{1,2}):(\d{1,2})(?:[.:](\d{1,3}))?>/g, n = [];
|
|
591
|
+
for (const s of t) {
|
|
592
|
+
const l = s.trim();
|
|
593
|
+
if (!l || xe(l, r)) continue;
|
|
594
|
+
const c = [];
|
|
595
|
+
let p = 0;
|
|
596
|
+
o.lastIndex = 0;
|
|
597
|
+
let f;
|
|
598
|
+
for (; (f = o.exec(l)) !== null && f.index === p; )
|
|
599
|
+
c.push(K(f[1], f[2], f[3])), p = f.index + f[0].length;
|
|
600
|
+
if (c.length === 0) continue;
|
|
601
|
+
const m = l.slice(p);
|
|
602
|
+
for (const u of c)
|
|
603
|
+
n.push({ start: u, raw: m });
|
|
604
|
+
}
|
|
605
|
+
n.sort((s, l) => s.start - l.start);
|
|
606
|
+
const i = r.offsetMs / 1e3;
|
|
607
|
+
return { format: "elrc", cues: n.map((s, l) => {
|
|
608
|
+
const c = [];
|
|
609
|
+
let p = "", f = 0, m = null;
|
|
610
|
+
a.lastIndex = 0;
|
|
611
|
+
let u;
|
|
612
|
+
for (; (u = a.exec(s.raw)) !== null; ) {
|
|
613
|
+
const w = s.raw.slice(f, u.index);
|
|
614
|
+
m !== null && w && c.push({ start: Math.max(0, m - i), text: w }), p += w, m = K(u[1], u[2], u[3]), f = u.index + u[0].length;
|
|
615
|
+
}
|
|
616
|
+
const g = s.raw.slice(f);
|
|
617
|
+
m !== null && g && c.push({ start: Math.max(0, m - i), text: g }), p += g;
|
|
618
|
+
const v = Math.max(0, s.start - i), C = n[l + 1], x = C ? Math.max(v, C.start - i) : v + 5;
|
|
619
|
+
return {
|
|
620
|
+
start: v,
|
|
621
|
+
end: x,
|
|
622
|
+
text: p.trim(),
|
|
623
|
+
words: c.length ? c : void 0
|
|
624
|
+
};
|
|
625
|
+
}), metadata: r.metadata };
|
|
626
|
+
}
|
|
627
|
+
function fe(e) {
|
|
628
|
+
const t = e.trim().split(":");
|
|
629
|
+
return t.length !== 3 ? 0 : Number(t[0]) * 3600 + Number(t[1]) * 60 + Number(t[2].replace(",", "."));
|
|
630
|
+
}
|
|
631
|
+
function de(e, t) {
|
|
632
|
+
const r = e.replace(/\r\n?/g, `
|
|
633
|
+
`).replace(/^\uFEFF/, "").split(`
|
|
634
|
+
`);
|
|
635
|
+
let o = "", a = [];
|
|
636
|
+
const n = [], i = [];
|
|
637
|
+
for (const s of r) {
|
|
638
|
+
const l = s.replace(/\s+$/, ""), c = l.trim(), p = /^\[([^\]]+)\]\s*$/.exec(c);
|
|
639
|
+
if (p) {
|
|
640
|
+
o = p[1].toLowerCase(), i.push(l);
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
if (o !== "events") {
|
|
644
|
+
i.push(l);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
const f = /^Format:\s*(.+)$/i.exec(c);
|
|
648
|
+
if (f) {
|
|
649
|
+
a = f[1].split(",").map((_) => _.trim());
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
const m = /^(Dialogue|Comment):\s*(.+)$/i.exec(c);
|
|
653
|
+
if (!m || m[1].toLowerCase() === "comment" || a.length === 0) continue;
|
|
654
|
+
const u = a.length, g = m[2].split(","), v = g.slice(0, u - 1), C = g.slice(u - 1).join(","), x = {};
|
|
655
|
+
a.forEach((_, k) => {
|
|
656
|
+
x[_] = k === u - 1 ? C : v[k] ?? "";
|
|
657
|
+
});
|
|
658
|
+
const w = fe(x.Start || ""), N = fe(x.End || ""), h = (x.Text || "").replace(/\\N/g, `
|
|
659
|
+
`).replace(/\\n/g, `
|
|
660
|
+
`).replace(/\\h/g, " ").replace(/\{[^}]*\}/g, "");
|
|
661
|
+
n.push({ start: w, end: N, text: h, style: x.Style });
|
|
662
|
+
}
|
|
663
|
+
return n.sort((s, l) => s.start - l.start), {
|
|
664
|
+
format: t,
|
|
665
|
+
cues: n,
|
|
666
|
+
header: i.join(`
|
|
667
|
+
`).trim() || void 0
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function L(e) {
|
|
671
|
+
const t = e.trim();
|
|
672
|
+
if (!t) return 0;
|
|
673
|
+
const r = /^(\d+(?:\.\d+)?)(h|m|s|ms|f|t)$/i.exec(t);
|
|
674
|
+
if (r) {
|
|
675
|
+
const a = Number(r[1]), n = r[2].toLowerCase();
|
|
676
|
+
return n === "h" ? a * 3600 : n === "m" ? a * 60 : n === "ms" ? a / 1e3 : a;
|
|
677
|
+
}
|
|
678
|
+
const o = t.split(":");
|
|
679
|
+
return o.length === 3 ? Number(o[0]) * 3600 + Number(o[1]) * 60 + Number(o[2]) : o.length === 2 ? Number(o[0]) * 60 + Number(o[1]) : Number(t) || 0;
|
|
680
|
+
}
|
|
681
|
+
function rt(e) {
|
|
682
|
+
return e.replace(/&#x([0-9a-fA-F]+);/g, (t, r) => String.fromCharCode(parseInt(r, 16))).replace(/&#(\d+);/g, (t, r) => String.fromCharCode(Number(r))).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/&/g, "&");
|
|
683
|
+
}
|
|
684
|
+
function ot(e) {
|
|
685
|
+
var t, r, o;
|
|
686
|
+
const a = [], n = /<(?:[\w-]+:)?p\b([^>]*)>([\s\S]*?)<\/(?:[\w-]+:)?p\s*>/gi;
|
|
687
|
+
let i;
|
|
688
|
+
for (; (i = n.exec(e)) !== null; ) {
|
|
689
|
+
const s = i[1], l = i[2], c = ((t = /\bbegin\s*=\s*["']([^"']+)["']/i.exec(s)) == null ? void 0 : t[1]) || "", p = ((r = /\bend\s*=\s*["']([^"']+)["']/i.exec(s)) == null ? void 0 : r[1]) || "", f = ((o = /\bdur\s*=\s*["']([^"']+)["']/i.exec(s)) == null ? void 0 : o[1]) || "", m = L(c);
|
|
690
|
+
let u;
|
|
691
|
+
p ? u = L(p) : f ? u = m + L(f) : u = m + 5;
|
|
692
|
+
const g = rt(
|
|
693
|
+
l.replace(/<(?:[\w-]+:)?br\s*\/?>/gi, `
|
|
694
|
+
`).replace(/<[^>]+>/g, "")
|
|
695
|
+
).replace(/[ \t]+/g, " ").replace(/\n /g, `
|
|
696
|
+
`).trim();
|
|
697
|
+
(g || m || u) && a.push({ start: m, end: u, text: g });
|
|
698
|
+
}
|
|
699
|
+
return a.sort((s, l) => s.start - l.start), { format: "ttml", cues: a };
|
|
700
|
+
}
|
|
701
|
+
function nt(e) {
|
|
702
|
+
const t = e.replace(/^\uFEFF/, "");
|
|
703
|
+
if (typeof DOMParser < "u") {
|
|
704
|
+
const r = new DOMParser().parseFromString(t, "application/xml");
|
|
705
|
+
if (r.getElementsByTagName("parsererror").length === 0) {
|
|
706
|
+
const o = r.getElementsByTagNameNS ? r.getElementsByTagNameNS("*", "p") : r.getElementsByTagName("p");
|
|
707
|
+
if (o.length > 0) {
|
|
708
|
+
const a = [];
|
|
709
|
+
for (let n = 0; n < o.length; n++) {
|
|
710
|
+
const i = o[n], s = i.getAttribute("begin") || "", l = i.getAttribute("end") || "", c = i.getAttribute("dur") || "", p = L(s);
|
|
711
|
+
let f;
|
|
712
|
+
l ? f = L(l) : c ? f = p + L(c) : f = p + 5;
|
|
713
|
+
let m = "";
|
|
714
|
+
i.childNodes.forEach((g) => {
|
|
715
|
+
if (g.nodeType === 3)
|
|
716
|
+
m += g.nodeValue || "";
|
|
717
|
+
else if (g.nodeType === 1) {
|
|
718
|
+
const v = g;
|
|
719
|
+
(v.localName || v.tagName).toLowerCase() === "br" ? m += `
|
|
720
|
+
` : m += v.textContent || "";
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
const u = m.replace(/[ \t]+/g, " ").replace(/\n /g, `
|
|
724
|
+
`).trim();
|
|
725
|
+
(u || p || f) && a.push({ start: p, end: f, text: u });
|
|
726
|
+
}
|
|
727
|
+
return a.sort((n, i) => n.start - i.start), { format: "ttml", cues: a };
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return ot(t);
|
|
732
|
+
}
|
|
733
|
+
function Fr(e, t) {
|
|
734
|
+
switch (t ?? Ye(e)) {
|
|
735
|
+
case "lrc":
|
|
736
|
+
return et(e);
|
|
737
|
+
case "elrc":
|
|
738
|
+
return tt(e);
|
|
739
|
+
case "ass":
|
|
740
|
+
return de(e, "ass");
|
|
741
|
+
case "ssa":
|
|
742
|
+
return de(e, "ssa");
|
|
743
|
+
case "ttml":
|
|
744
|
+
return nt(e);
|
|
745
|
+
case "vtt":
|
|
746
|
+
return pe(e, "vtt");
|
|
747
|
+
case "srt":
|
|
748
|
+
default:
|
|
749
|
+
return pe(e, "srt");
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
async function kr(e) {
|
|
753
|
+
return Me.loadAsync(e);
|
|
754
|
+
}
|
|
755
|
+
function _r(e) {
|
|
756
|
+
const t = [];
|
|
757
|
+
return e.forEach((r, o) => {
|
|
758
|
+
var a;
|
|
759
|
+
const n = o.dir, i = n && !r.endsWith("/") ? r + "/" : r, s = n ? i.replace(/\/$/, "") : i, l = s.lastIndexOf("/"), c = l >= 0 ? s.slice(l + 1) : s, p = l >= 0 ? s.slice(0, l) : "", f = n ? 0 : ((a = o._data) == null ? void 0 : a.uncompressedSize) ?? 0;
|
|
760
|
+
t.push({
|
|
761
|
+
path: i,
|
|
762
|
+
name: c,
|
|
763
|
+
dir: p,
|
|
764
|
+
isDir: n,
|
|
765
|
+
size: f,
|
|
766
|
+
date: o.date
|
|
767
|
+
});
|
|
768
|
+
}), t;
|
|
769
|
+
}
|
|
770
|
+
function Cr(e) {
|
|
771
|
+
const t = { name: "", path: "", isDir: !0, children: [], size: 0 }, r = /* @__PURE__ */ new Map();
|
|
772
|
+
r.set("", t);
|
|
773
|
+
const o = (n) => {
|
|
774
|
+
if (r.has(n)) return r.get(n);
|
|
775
|
+
const i = n.split("/").filter(Boolean);
|
|
776
|
+
let s = t, l = "";
|
|
777
|
+
for (const c of i) {
|
|
778
|
+
l = l ? `${l}/${c}` : c;
|
|
779
|
+
let p = r.get(l);
|
|
780
|
+
p || (p = { name: c, path: l + "/", isDir: !0, children: [], size: 0 }, s.children.push(p), r.set(l, p)), s = p;
|
|
781
|
+
}
|
|
782
|
+
return s;
|
|
783
|
+
};
|
|
784
|
+
for (const n of e) {
|
|
785
|
+
if (n.isDir) {
|
|
786
|
+
o(n.path.replace(/\/$/, ""));
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
o(n.dir).children.push({
|
|
790
|
+
name: n.name,
|
|
791
|
+
path: n.path,
|
|
792
|
+
isDir: !1,
|
|
793
|
+
size: n.size
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
const a = (n) => {
|
|
797
|
+
if (n.children) {
|
|
798
|
+
n.children.sort((i, s) => i.isDir !== s.isDir ? i.isDir ? -1 : 1 : i.name.localeCompare(s.name));
|
|
799
|
+
for (const i of n.children) a(i);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
return a(t), t;
|
|
803
|
+
}
|
|
804
|
+
async function Nr(e, t, r) {
|
|
805
|
+
const o = e.file(t);
|
|
806
|
+
if (!o) throw new Error(`ZIP entry not found: ${t}`);
|
|
807
|
+
const a = await o.async("arraybuffer");
|
|
808
|
+
return new Blob([a], r ? { type: r } : void 0);
|
|
809
|
+
}
|
|
810
|
+
function at(e) {
|
|
811
|
+
return e ? e.startsWith("#") ? e : e.length === 8 ? "#" + e.substring(2) : e.length === 6 ? "#" + e : "#000000" : "#000000";
|
|
812
|
+
}
|
|
813
|
+
const it = [
|
|
814
|
+
"FFFFFF",
|
|
815
|
+
"000000",
|
|
816
|
+
"E7E6E6",
|
|
817
|
+
"44546A",
|
|
818
|
+
"4472C4",
|
|
819
|
+
"ED7D31",
|
|
820
|
+
"A5A5A5",
|
|
821
|
+
"FFC000",
|
|
822
|
+
"5B9BD5",
|
|
823
|
+
"70AD47"
|
|
824
|
+
], st = [
|
|
825
|
+
"000000",
|
|
826
|
+
"FFFFFF",
|
|
827
|
+
"FF0000",
|
|
828
|
+
"00FF00",
|
|
829
|
+
"0000FF",
|
|
830
|
+
"FFFF00",
|
|
831
|
+
"FF00FF",
|
|
832
|
+
"00FFFF",
|
|
833
|
+
"000000",
|
|
834
|
+
"FFFFFF",
|
|
835
|
+
"FF0000",
|
|
836
|
+
"00FF00",
|
|
837
|
+
"0000FF",
|
|
838
|
+
"FFFF00",
|
|
839
|
+
"FF00FF",
|
|
840
|
+
"00FFFF",
|
|
841
|
+
"800000",
|
|
842
|
+
"008000",
|
|
843
|
+
"000080",
|
|
844
|
+
"808000",
|
|
845
|
+
"800080",
|
|
846
|
+
"008080",
|
|
847
|
+
"C0C0C0",
|
|
848
|
+
"808080",
|
|
849
|
+
"9999FF",
|
|
850
|
+
"993366",
|
|
851
|
+
"FFFFCC",
|
|
852
|
+
"CCFFFF",
|
|
853
|
+
"660066",
|
|
854
|
+
"FF8080",
|
|
855
|
+
"0066CC",
|
|
856
|
+
"CCCCFF",
|
|
857
|
+
"000080",
|
|
858
|
+
"FF00FF",
|
|
859
|
+
"FFFF00",
|
|
860
|
+
"00FFFF",
|
|
861
|
+
"800080",
|
|
862
|
+
"800000",
|
|
863
|
+
"008080",
|
|
864
|
+
"0000FF",
|
|
865
|
+
"00CCFF",
|
|
866
|
+
"CCFFFF",
|
|
867
|
+
"CCFFCC",
|
|
868
|
+
"FFFF99",
|
|
869
|
+
"99CCFF",
|
|
870
|
+
"FF99CC",
|
|
871
|
+
"CC99FF",
|
|
872
|
+
"FFCC99",
|
|
873
|
+
"3366FF",
|
|
874
|
+
"33CCCC",
|
|
875
|
+
"99CC00",
|
|
876
|
+
"FFCC00",
|
|
877
|
+
"FF9900",
|
|
878
|
+
"FF6600",
|
|
879
|
+
"666699",
|
|
880
|
+
"969696",
|
|
881
|
+
"003366",
|
|
882
|
+
"339966",
|
|
883
|
+
"003300",
|
|
884
|
+
"333300",
|
|
885
|
+
"993300",
|
|
886
|
+
"993366",
|
|
887
|
+
"333399",
|
|
888
|
+
"333333"
|
|
889
|
+
];
|
|
890
|
+
function lt(e, t) {
|
|
891
|
+
const r = parseInt(e.substring(0, 2), 16), o = parseInt(e.substring(2, 4), 16), a = parseInt(e.substring(4, 6), 16), n = (c) => t < 0 ? Math.round(c * (1 + t)) : Math.round(c + (255 - c) * t), i = Math.min(255, Math.max(0, n(r))), s = Math.min(255, Math.max(0, n(o))), l = Math.min(255, Math.max(0, n(a)));
|
|
892
|
+
return i.toString(16).padStart(2, "0") + s.toString(16).padStart(2, "0") + l.toString(16).padStart(2, "0");
|
|
893
|
+
}
|
|
894
|
+
function ct(e) {
|
|
895
|
+
if (e && e.type === "pattern" && e.pattern === "solid") {
|
|
896
|
+
const t = e.fgColor;
|
|
897
|
+
if (t)
|
|
898
|
+
return Q(t);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
function Q(e) {
|
|
902
|
+
if (e) {
|
|
903
|
+
if ("argb" in e && typeof e.argb == "string" && e.argb)
|
|
904
|
+
return at(e.argb);
|
|
905
|
+
if ("theme" in e && typeof e.theme == "number") {
|
|
906
|
+
const t = it[e.theme] || "000000", r = "tint" in e && typeof e.tint == "number" ? e.tint : 0;
|
|
907
|
+
return "#" + (r !== 0 ? lt(t, r) : t);
|
|
908
|
+
}
|
|
909
|
+
if ("indexed" in e && typeof e.indexed == "number") {
|
|
910
|
+
const t = st[e.indexed];
|
|
911
|
+
if (t) return "#" + t;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
function pt(e) {
|
|
916
|
+
if (!e || !e.style) return;
|
|
917
|
+
const t = Q(e.color) || "#000000";
|
|
918
|
+
return [e.style, t];
|
|
919
|
+
}
|
|
920
|
+
function ft(e) {
|
|
921
|
+
const t = {};
|
|
922
|
+
let r = !1;
|
|
923
|
+
if (e.font) {
|
|
924
|
+
const a = e.font;
|
|
925
|
+
if ((a.name || a.size || a.bold || a.italic) && (r = !0, t.font = {}, a.name && (t.font.name = a.name), a.size && (t.font.size = a.size), a.bold && (t.font.bold = !0), a.italic && (t.font.italic = !0)), a.color) {
|
|
926
|
+
const n = Q(a.color);
|
|
927
|
+
n && (r = !0, t.color = n);
|
|
928
|
+
}
|
|
929
|
+
a.underline && (r = !0, t.underline = !0), a.strike && (r = !0, t.strike = !0);
|
|
930
|
+
}
|
|
931
|
+
const o = ct(e.fill);
|
|
932
|
+
if (o && (r = !0, t.bgcolor = o), e.alignment) {
|
|
933
|
+
const a = e.alignment;
|
|
934
|
+
a.horizontal && (r = !0, t.align = a.horizontal), a.vertical && (r = !0, t.valign = a.vertical), a.wrapText && (r = !0, t.textwrap = !0);
|
|
935
|
+
}
|
|
936
|
+
if (e.border) {
|
|
937
|
+
const a = {};
|
|
938
|
+
let n = !1;
|
|
939
|
+
const i = ["top", "bottom", "left", "right"];
|
|
940
|
+
for (const s of i) {
|
|
941
|
+
const l = pt(e.border[s]);
|
|
942
|
+
l && (a[s] = l, n = !0);
|
|
943
|
+
}
|
|
944
|
+
n && (r = !0, t.border = a);
|
|
945
|
+
}
|
|
946
|
+
return r ? t : null;
|
|
947
|
+
}
|
|
948
|
+
function dt(e) {
|
|
949
|
+
return JSON.stringify(e);
|
|
950
|
+
}
|
|
951
|
+
function ut(e, t, r) {
|
|
952
|
+
const o = ft(e);
|
|
953
|
+
if (!o) return -1;
|
|
954
|
+
const a = dt(o), n = r.get(a);
|
|
955
|
+
if (n !== void 0) return n;
|
|
956
|
+
const i = t.length;
|
|
957
|
+
return t.push(o), r.set(a, i), i;
|
|
958
|
+
}
|
|
959
|
+
function mt(e) {
|
|
960
|
+
const t = e.value;
|
|
961
|
+
if (t == null) return "";
|
|
962
|
+
if (typeof t == "string") return t;
|
|
963
|
+
if (typeof t == "number") return String(t);
|
|
964
|
+
if (typeof t == "boolean") return t ? "TRUE" : "FALSE";
|
|
965
|
+
if (t instanceof Date)
|
|
966
|
+
return t.toLocaleDateString();
|
|
967
|
+
if (typeof t == "object" && "formula" in t) {
|
|
968
|
+
const r = t.result;
|
|
969
|
+
return r != null ? String(r) : "";
|
|
970
|
+
}
|
|
971
|
+
return typeof t == "object" && "richText" in t ? t.richText.map((r) => r.text).join("") : typeof t == "object" && "hyperlink" in t ? t.text || "" : typeof t == "object" && "error" in t ? String(t.error) : String(t);
|
|
972
|
+
}
|
|
973
|
+
function ht(e) {
|
|
974
|
+
const t = e.split(":"), r = ue(t[0]), o = t[1] ? ue(t[1]) : r;
|
|
975
|
+
return {
|
|
976
|
+
top: r.row,
|
|
977
|
+
left: r.col,
|
|
978
|
+
bottom: o.row,
|
|
979
|
+
right: o.col
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
function ue(e) {
|
|
983
|
+
const t = e.match(/^([A-Z]+)(\d+)$/);
|
|
984
|
+
if (!t) return { row: 1, col: 1 };
|
|
985
|
+
const r = t[1], o = parseInt(t[2], 10);
|
|
986
|
+
let a = 0;
|
|
987
|
+
for (let n = 0; n < r.length; n++)
|
|
988
|
+
a = a * 26 + (r.charCodeAt(n) - 64);
|
|
989
|
+
return { row: o, col: a };
|
|
990
|
+
}
|
|
991
|
+
function jr(e) {
|
|
992
|
+
const t = [];
|
|
993
|
+
return e.eachSheet((r) => {
|
|
994
|
+
const o = [], a = /* @__PURE__ */ new Map(), n = [], i = {}, s = {}, l = r.columnCount;
|
|
995
|
+
for (let m = 1; m <= l; m++) {
|
|
996
|
+
const u = r.getColumn(m);
|
|
997
|
+
u.width && (s[String(m - 1)] = { width: Math.round(u.width * 7.5) });
|
|
998
|
+
}
|
|
999
|
+
s.len = Math.max(l, 26);
|
|
1000
|
+
const c = /* @__PURE__ */ new Map(), p = r.model, f = (p == null ? void 0 : p.merges) || [];
|
|
1001
|
+
for (const m of f) {
|
|
1002
|
+
n.push(m);
|
|
1003
|
+
const { top: u, left: g, bottom: v, right: C } = ht(m), x = v - u, w = C - g;
|
|
1004
|
+
c.set(`${u - 1},${g - 1}`, [x, w]);
|
|
1005
|
+
}
|
|
1006
|
+
r.eachRow({ includeEmpty: !0 }, (m, u) => {
|
|
1007
|
+
const g = u - 1, v = {};
|
|
1008
|
+
m.eachCell({ includeEmpty: !1 }, (x, w) => {
|
|
1009
|
+
const N = w - 1;
|
|
1010
|
+
if (x.isMerged && x.master !== x) return;
|
|
1011
|
+
const h = mt(x), _ = ut(x, o, a), k = { text: h };
|
|
1012
|
+
_ !== -1 && (k.style = _);
|
|
1013
|
+
const R = `${g},${N}`;
|
|
1014
|
+
c.has(R) && (k.merge = c.get(R)), v[String(N)] = k;
|
|
1015
|
+
});
|
|
1016
|
+
const C = { cells: v };
|
|
1017
|
+
m.height && (C.height = Math.round(m.height * 1.333)), i[String(g)] = C;
|
|
1018
|
+
}), t.push({
|
|
1019
|
+
name: r.name,
|
|
1020
|
+
styles: o,
|
|
1021
|
+
merges: n,
|
|
1022
|
+
rows: i,
|
|
1023
|
+
cols: s
|
|
1024
|
+
});
|
|
1025
|
+
}), t;
|
|
1026
|
+
}
|
|
1027
|
+
function Pr(e, t, r = "Sheet1") {
|
|
1028
|
+
const o = e.length > 0, a = o ? [{ font: { bold: !0 } }] : [], n = {};
|
|
1029
|
+
if (o) {
|
|
1030
|
+
const s = {};
|
|
1031
|
+
e.forEach((l, c) => {
|
|
1032
|
+
s[String(c)] = { text: l, style: 0 };
|
|
1033
|
+
}), n[0] = { cells: s };
|
|
1034
|
+
}
|
|
1035
|
+
const i = o ? 1 : 0;
|
|
1036
|
+
return t.forEach((s, l) => {
|
|
1037
|
+
const c = {};
|
|
1038
|
+
s.forEach((p, f) => {
|
|
1039
|
+
p !== void 0 && p !== "" && (c[String(f)] = { text: p });
|
|
1040
|
+
}), n[String(l + i)] = { cells: c };
|
|
1041
|
+
}), [{ name: r, styles: a, rows: n }];
|
|
1042
|
+
}
|
|
1043
|
+
function gt(e, t) {
|
|
1044
|
+
var r;
|
|
1045
|
+
if (typeof window > "u") return;
|
|
1046
|
+
const o = (e == null ? void 0 : e.version) || ((r = e == null ? void 0 : e.GlobalWorkerOptions) == null ? void 0 : r.version) || "", {
|
|
1047
|
+
workerSrc: a = `https://unpkg.com/pdfjs-dist@${o}/build/pdf.worker.min.mjs`,
|
|
1048
|
+
cMapUrl: n = `https://unpkg.com/pdfjs-dist@${o}/cmaps/`,
|
|
1049
|
+
cMapPacked: i = !0
|
|
1050
|
+
} = t || {};
|
|
1051
|
+
e.GlobalWorkerOptions && (e.GlobalWorkerOptions.workerSrc = a, e.GlobalWorkerOptions.cMapUrl = n, e.GlobalWorkerOptions.cMapPacked = i);
|
|
1052
|
+
}
|
|
1053
|
+
const bt = {
|
|
1054
|
+
// ─────── common ───────
|
|
1055
|
+
"common.download": "下载",
|
|
1056
|
+
"common.close": "关闭",
|
|
1057
|
+
"common.loading": "加载中",
|
|
1058
|
+
"common.unknown_error": "未知错误",
|
|
1059
|
+
"common.unsupported_preview": "不支持预览此文件类型 ({type})",
|
|
1060
|
+
"common.retry": "重试",
|
|
1061
|
+
// ─────── accessibility ───────
|
|
1062
|
+
"accessibility.previousFile": "上一个文件",
|
|
1063
|
+
"accessibility.nextFile": "下一个文件",
|
|
1064
|
+
"accessibility.closePreview": "关闭预览",
|
|
1065
|
+
"accessibility.downloadFile": "下载文件",
|
|
1066
|
+
// ─────── toolbar ───────
|
|
1067
|
+
"toolbar.zoom_in": "放大",
|
|
1068
|
+
"toolbar.zoom_out": "缩小",
|
|
1069
|
+
"toolbar.rotate_left": "向左旋转",
|
|
1070
|
+
"toolbar.rotate_right": "向右旋转",
|
|
1071
|
+
"toolbar.reset": "复原",
|
|
1072
|
+
"toolbar.fit_to_window": "适应窗口",
|
|
1073
|
+
"toolbar.original_size": "原始尺寸",
|
|
1074
|
+
"toolbar.toc": "目录",
|
|
1075
|
+
"toolbar.outline": "大纲",
|
|
1076
|
+
"toolbar.prev_page": "上一页",
|
|
1077
|
+
"toolbar.next_page": "下一页",
|
|
1078
|
+
"toolbar.full_width": "全屏宽度",
|
|
1079
|
+
"toolbar.normal_width": "正常宽度",
|
|
1080
|
+
"toolbar.wrap_on": "自动换行",
|
|
1081
|
+
"toolbar.wrap_off": "不换行",
|
|
1082
|
+
"toolbar.source": "源码",
|
|
1083
|
+
"toolbar.preview": "预览",
|
|
1084
|
+
// ─────── image ───────
|
|
1085
|
+
"image.load_failed": "图片加载失败",
|
|
1086
|
+
"image.decode_failed": "图片解码失败",
|
|
1087
|
+
// ─────── pdf ───────
|
|
1088
|
+
"pdf.load_failed": "PDF 文件加载失败",
|
|
1089
|
+
// ─────── docx ───────
|
|
1090
|
+
"docx.parse_failed": "Word 文档解析失败",
|
|
1091
|
+
// ─────── xlsx ───────
|
|
1092
|
+
"xlsx.loading": "加载 Excel 中...",
|
|
1093
|
+
"xlsx.load_failed": "Excel 加载失败",
|
|
1094
|
+
"xlsx.parse_failed": "Excel 文件解析失败",
|
|
1095
|
+
"xlsx.not_found": "Excel 文件不存在",
|
|
1096
|
+
// ─────── pptx ───────
|
|
1097
|
+
"pptx.loading": "加载 PPT 中...",
|
|
1098
|
+
"pptx.load_failed": "PPT 加载失败",
|
|
1099
|
+
"pptx.parse_failed": "PPT 文件解析失败",
|
|
1100
|
+
"pptx.not_found": "PPT 文件不存在",
|
|
1101
|
+
"pptx.invalid_format": "PPT 文件格式错误或已损坏",
|
|
1102
|
+
"pptx.no_pages": "PPT 文件无有效页面",
|
|
1103
|
+
"pptx.timeout": "加载超时,请检查网络或稍后重试",
|
|
1104
|
+
// ─────── msg ───────
|
|
1105
|
+
"msg.parse_failed": "Outlook 邮件解析失败",
|
|
1106
|
+
"msg.parse_failed_short": "邮件解析失败",
|
|
1107
|
+
"msg.empty_body": "(无邮件正文)",
|
|
1108
|
+
// ─────── epub ───────
|
|
1109
|
+
"epub.load_failed": "EPUB 文件加载失败",
|
|
1110
|
+
// ─────── mobi ───────
|
|
1111
|
+
"mobi.load_failed": "电子书加载失败,文件可能已损坏或带有 DRM 保护",
|
|
1112
|
+
// ─────── video ───────
|
|
1113
|
+
"video.loading": "加载视频中...",
|
|
1114
|
+
"video.load_failed": "视频加载失败",
|
|
1115
|
+
"video.load_failed_with_error": "视频加载失败: {error}",
|
|
1116
|
+
"video.format_not_supported": "浏览器不支持 {format} 格式,建议转换为 MP4/WebM 格式",
|
|
1117
|
+
"video.unsupported_title": "该视频格式无法在浏览器中直接播放",
|
|
1118
|
+
"video.unsupported_detail": "{format} 是浏览器原生不支持的容器/编码(常见于 AVI / WMV / FLV 及部分 MKV)。请下载到本地播放器观看,或转换为 MP4(H.264 + AAC)。",
|
|
1119
|
+
"video.codec_not_supported_detail": "视频或音频编码 {codecs} 浏览器无法解码。请转换为 MP4(H.264 + AAC)后再预览。",
|
|
1120
|
+
// ─────── audio (aria-label) ───────
|
|
1121
|
+
"audio.aria.play": "播放",
|
|
1122
|
+
"audio.aria.pause": "暂停",
|
|
1123
|
+
"audio.aria.forward_10": "前进 10 秒",
|
|
1124
|
+
"audio.aria.backward_10": "后退 10 秒",
|
|
1125
|
+
"audio.aria.mute": "静音",
|
|
1126
|
+
"audio.aria.unmute": "取消静音",
|
|
1127
|
+
"audio.aria.loop_on": "开启循环",
|
|
1128
|
+
"audio.aria.loop_off": "关闭循环",
|
|
1129
|
+
"audio.aria.progress": "播放进度",
|
|
1130
|
+
"audio.aria.volume": "音量",
|
|
1131
|
+
// ─────── markdown ───────
|
|
1132
|
+
"markdown.load_failed": "Markdown 文件加载失败",
|
|
1133
|
+
"markdown.copy_code": "复制代码",
|
|
1134
|
+
"markdown.copied": "已复制",
|
|
1135
|
+
// ─────── json ───────
|
|
1136
|
+
"json.load_failed": "JSON 文件加载失败",
|
|
1137
|
+
"json.items": "items",
|
|
1138
|
+
"json.keys": "keys",
|
|
1139
|
+
// ─────── csv ───────
|
|
1140
|
+
"csv.loading": "加载 CSV 中...",
|
|
1141
|
+
"csv.load_failed": "CSV 文件加载失败",
|
|
1142
|
+
"csv.parse_failed": "CSV 解析失败",
|
|
1143
|
+
// ─────── xml ───────
|
|
1144
|
+
"xml.load_failed": "XML 文件加载失败",
|
|
1145
|
+
// ─────── subtitle / lyric ───────
|
|
1146
|
+
"subtitle.load_failed": "字幕文件加载失败",
|
|
1147
|
+
"subtitle.parse_failed": "字幕解析失败",
|
|
1148
|
+
"subtitle.lines": "lines",
|
|
1149
|
+
"subtitle.cues": "cues",
|
|
1150
|
+
"subtitle.meta.title": "标题",
|
|
1151
|
+
"subtitle.meta.artist": "艺术家",
|
|
1152
|
+
"subtitle.meta.album": "专辑",
|
|
1153
|
+
"subtitle.meta.author": "作者",
|
|
1154
|
+
"subtitle.meta.by": "制作",
|
|
1155
|
+
"subtitle.meta.length": "时长",
|
|
1156
|
+
"subtitle.meta.offset": "偏移",
|
|
1157
|
+
"subtitle.meta.editor": "编辑器",
|
|
1158
|
+
"subtitle.meta.version": "版本",
|
|
1159
|
+
// ─────── zip ───────
|
|
1160
|
+
"zip.load_failed": "ZIP 文件加载失败",
|
|
1161
|
+
"zip.parse_failed": "ZIP 解析失败",
|
|
1162
|
+
// ─────── text ───────
|
|
1163
|
+
"text.load_failed": "文本文件加载失败",
|
|
1164
|
+
// ─────── font ───────
|
|
1165
|
+
"font.loading": "加载字体中...",
|
|
1166
|
+
"font.load_failed": "字体文件加载失败",
|
|
1167
|
+
"font.parse_failed": "字体解析失败",
|
|
1168
|
+
"font.metadata_loading": "解析元数据中...",
|
|
1169
|
+
"font.metadata_unavailable": "元数据不可用",
|
|
1170
|
+
"font.meta.family": "字体家族",
|
|
1171
|
+
"font.meta.subfamily": "子系列",
|
|
1172
|
+
"font.meta.version": "版本",
|
|
1173
|
+
"font.meta.designer": "设计师",
|
|
1174
|
+
"font.meta.glyphs": "字形数量",
|
|
1175
|
+
"font.meta.format": "格式",
|
|
1176
|
+
"font.sample_text_placeholder": "输入自定义文本..."
|
|
1177
|
+
}, xt = {
|
|
1178
|
+
// ─────── common ───────
|
|
1179
|
+
"common.download": "Download",
|
|
1180
|
+
"common.close": "Close",
|
|
1181
|
+
"common.loading": "Loading",
|
|
1182
|
+
"common.unknown_error": "Unknown error",
|
|
1183
|
+
"common.unsupported_preview": "Preview not supported for this file type ({type})",
|
|
1184
|
+
"common.retry": "Retry",
|
|
1185
|
+
// ─────── accessibility ───────
|
|
1186
|
+
"accessibility.previousFile": "Previous file",
|
|
1187
|
+
"accessibility.nextFile": "Next file",
|
|
1188
|
+
"accessibility.closePreview": "Close preview",
|
|
1189
|
+
"accessibility.downloadFile": "Download file",
|
|
1190
|
+
// ─────── toolbar ───────
|
|
1191
|
+
"toolbar.zoom_in": "Zoom in",
|
|
1192
|
+
"toolbar.zoom_out": "Zoom out",
|
|
1193
|
+
"toolbar.rotate_left": "Rotate left",
|
|
1194
|
+
"toolbar.rotate_right": "Rotate right",
|
|
1195
|
+
"toolbar.reset": "Reset",
|
|
1196
|
+
"toolbar.fit_to_window": "Fit to window",
|
|
1197
|
+
"toolbar.original_size": "Original size",
|
|
1198
|
+
"toolbar.toc": "Table of contents",
|
|
1199
|
+
"toolbar.outline": "Outline",
|
|
1200
|
+
"toolbar.prev_page": "Previous page",
|
|
1201
|
+
"toolbar.next_page": "Next page",
|
|
1202
|
+
"toolbar.full_width": "Full width",
|
|
1203
|
+
"toolbar.normal_width": "Normal width",
|
|
1204
|
+
"toolbar.wrap_on": "Word wrap",
|
|
1205
|
+
"toolbar.wrap_off": "No wrap",
|
|
1206
|
+
"toolbar.source": "Source",
|
|
1207
|
+
"toolbar.preview": "Preview",
|
|
1208
|
+
// ─────── image ───────
|
|
1209
|
+
"image.load_failed": "Failed to load image",
|
|
1210
|
+
"image.decode_failed": "Failed to decode image",
|
|
1211
|
+
// ─────── pdf ───────
|
|
1212
|
+
"pdf.load_failed": "Failed to load PDF",
|
|
1213
|
+
// ─────── docx ───────
|
|
1214
|
+
"docx.parse_failed": "Failed to parse Word document",
|
|
1215
|
+
// ─────── xlsx ───────
|
|
1216
|
+
"xlsx.loading": "Loading Excel...",
|
|
1217
|
+
"xlsx.load_failed": "Failed to load Excel",
|
|
1218
|
+
"xlsx.parse_failed": "Failed to parse Excel file",
|
|
1219
|
+
"xlsx.not_found": "Excel file not found",
|
|
1220
|
+
// ─────── pptx ───────
|
|
1221
|
+
"pptx.loading": "Loading PPT...",
|
|
1222
|
+
"pptx.load_failed": "Failed to load PPT",
|
|
1223
|
+
"pptx.parse_failed": "Failed to parse PPT file",
|
|
1224
|
+
"pptx.not_found": "PPT file not found",
|
|
1225
|
+
"pptx.invalid_format": "PPT file format is invalid or corrupted",
|
|
1226
|
+
"pptx.no_pages": "PPT file has no valid pages",
|
|
1227
|
+
"pptx.timeout": "Loading timed out, please check your network and retry",
|
|
1228
|
+
// ─────── msg ───────
|
|
1229
|
+
"msg.parse_failed": "Failed to parse Outlook message",
|
|
1230
|
+
"msg.parse_failed_short": "Failed to parse message",
|
|
1231
|
+
"msg.empty_body": "(No message body)",
|
|
1232
|
+
// ─────── epub ───────
|
|
1233
|
+
"epub.load_failed": "Failed to load EPUB",
|
|
1234
|
+
// ─────── mobi ───────
|
|
1235
|
+
"mobi.load_failed": "Failed to load ebook — file may be corrupted or DRM-protected",
|
|
1236
|
+
// ─────── video ───────
|
|
1237
|
+
"video.loading": "Loading video...",
|
|
1238
|
+
"video.load_failed": "Failed to load video",
|
|
1239
|
+
"video.load_failed_with_error": "Failed to load video: {error}",
|
|
1240
|
+
"video.format_not_supported": "Browser does not support {format} format. Please convert to MP4/WebM",
|
|
1241
|
+
"video.unsupported_title": "This video format cannot be played in the browser",
|
|
1242
|
+
"video.unsupported_detail": "{format} is a container/codec that browsers do not natively support (typical for AVI / WMV / FLV and some MKV files). Please download and play it in a local player, or convert to MP4 (H.264 + AAC).",
|
|
1243
|
+
"video.codec_not_supported_detail": "The video or audio codec ({codecs}) cannot be decoded by the browser. Please convert to MP4 (H.264 + AAC) before previewing.",
|
|
1244
|
+
// ─────── audio (aria-label) ───────
|
|
1245
|
+
"audio.aria.play": "Play",
|
|
1246
|
+
"audio.aria.pause": "Pause",
|
|
1247
|
+
"audio.aria.forward_10": "Forward 10 seconds",
|
|
1248
|
+
"audio.aria.backward_10": "Back 10 seconds",
|
|
1249
|
+
"audio.aria.mute": "Mute",
|
|
1250
|
+
"audio.aria.unmute": "Unmute",
|
|
1251
|
+
"audio.aria.loop_on": "Enable loop",
|
|
1252
|
+
"audio.aria.loop_off": "Disable loop",
|
|
1253
|
+
"audio.aria.progress": "Playback progress",
|
|
1254
|
+
"audio.aria.volume": "Volume",
|
|
1255
|
+
// ─────── markdown ───────
|
|
1256
|
+
"markdown.load_failed": "Failed to load Markdown",
|
|
1257
|
+
"markdown.copy_code": "Copy code",
|
|
1258
|
+
"markdown.copied": "Copied",
|
|
1259
|
+
// ─────── json ───────
|
|
1260
|
+
"json.load_failed": "Failed to load JSON",
|
|
1261
|
+
"json.items": "items",
|
|
1262
|
+
"json.keys": "keys",
|
|
1263
|
+
// ─────── csv ───────
|
|
1264
|
+
"csv.loading": "Loading CSV...",
|
|
1265
|
+
"csv.load_failed": "Failed to load CSV",
|
|
1266
|
+
"csv.parse_failed": "Failed to parse CSV",
|
|
1267
|
+
// ─────── xml ───────
|
|
1268
|
+
"xml.load_failed": "Failed to load XML",
|
|
1269
|
+
// ─────── subtitle / lyric ───────
|
|
1270
|
+
"subtitle.load_failed": "Failed to load subtitle",
|
|
1271
|
+
"subtitle.parse_failed": "Failed to parse subtitle",
|
|
1272
|
+
"subtitle.lines": "lines",
|
|
1273
|
+
"subtitle.cues": "cues",
|
|
1274
|
+
"subtitle.meta.title": "Title",
|
|
1275
|
+
"subtitle.meta.artist": "Artist",
|
|
1276
|
+
"subtitle.meta.album": "Album",
|
|
1277
|
+
"subtitle.meta.author": "Author",
|
|
1278
|
+
"subtitle.meta.by": "By",
|
|
1279
|
+
"subtitle.meta.length": "Length",
|
|
1280
|
+
"subtitle.meta.offset": "Offset",
|
|
1281
|
+
"subtitle.meta.editor": "Editor",
|
|
1282
|
+
"subtitle.meta.version": "Version",
|
|
1283
|
+
// ─────── zip ───────
|
|
1284
|
+
"zip.load_failed": "Failed to load ZIP",
|
|
1285
|
+
"zip.parse_failed": "Failed to parse ZIP",
|
|
1286
|
+
// ─────── text ───────
|
|
1287
|
+
"text.load_failed": "Failed to load text file",
|
|
1288
|
+
// ─────── font ───────
|
|
1289
|
+
"font.loading": "Loading font...",
|
|
1290
|
+
"font.load_failed": "Failed to load font",
|
|
1291
|
+
"font.parse_failed": "Failed to parse font",
|
|
1292
|
+
"font.metadata_loading": "Parsing metadata...",
|
|
1293
|
+
"font.metadata_unavailable": "Metadata unavailable",
|
|
1294
|
+
"font.meta.family": "Family",
|
|
1295
|
+
"font.meta.subfamily": "Subfamily",
|
|
1296
|
+
"font.meta.version": "Version",
|
|
1297
|
+
"font.meta.designer": "Designer",
|
|
1298
|
+
"font.meta.glyphs": "Glyphs",
|
|
1299
|
+
"font.meta.format": "Format",
|
|
1300
|
+
"font.sample_text_placeholder": "Type custom text..."
|
|
1301
|
+
}, B = {
|
|
1302
|
+
"zh-CN": bt,
|
|
1303
|
+
"en-US": xt
|
|
1304
|
+
}, vt = /\{(\w+)\}/g;
|
|
1305
|
+
function wt(e, t) {
|
|
1306
|
+
return t ? e.replace(vt, (r, o) => {
|
|
1307
|
+
const a = t[o];
|
|
1308
|
+
return a === void 0 ? `{${o}}` : String(a);
|
|
1309
|
+
}) : e;
|
|
1310
|
+
}
|
|
1311
|
+
function Y(e) {
|
|
1312
|
+
var t;
|
|
1313
|
+
const r = e.fallbackLocale ?? "zh-CN", o = B[e.locale] ?? B[r] ?? B["zh-CN"], a = (t = e.messages) == null ? void 0 : t[e.locale], n = a ? { ...o, ...a } : o, i = B["zh-CN"];
|
|
1314
|
+
return (s, l) => {
|
|
1315
|
+
const c = n[s] ?? i[s] ?? s;
|
|
1316
|
+
return wt(c, l);
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
const yt = {
|
|
1320
|
+
// 标准图片格式
|
|
1321
|
+
jpg: "image/jpeg",
|
|
1322
|
+
jpeg: "image/jpeg",
|
|
1323
|
+
png: "image/png",
|
|
1324
|
+
gif: "image/gif",
|
|
1325
|
+
webp: "image/webp",
|
|
1326
|
+
svg: "image/svg+xml",
|
|
1327
|
+
bmp: "image/bmp",
|
|
1328
|
+
ico: "image/x-icon",
|
|
1329
|
+
// 高级图片格式
|
|
1330
|
+
heic: "image/heic",
|
|
1331
|
+
heif: "image/heif",
|
|
1332
|
+
avif: "image/avif",
|
|
1333
|
+
tif: "image/tiff",
|
|
1334
|
+
tiff: "image/tiff",
|
|
1335
|
+
// RAW 格式
|
|
1336
|
+
cr2: "image/x-canon-cr2",
|
|
1337
|
+
nef: "image/x-nikon-nef",
|
|
1338
|
+
arw: "image/x-sony-arw",
|
|
1339
|
+
dng: "image/x-adobe-dng",
|
|
1340
|
+
raf: "image/x-fuji-raf",
|
|
1341
|
+
orf: "image/x-olympus-orf",
|
|
1342
|
+
// 其他专业格式
|
|
1343
|
+
psd: "image/vnd.adobe.photoshop",
|
|
1344
|
+
jp2: "image/jp2",
|
|
1345
|
+
jpx: "image/jpx",
|
|
1346
|
+
j2k: "image/jp2",
|
|
1347
|
+
// 文档格式
|
|
1348
|
+
pdf: "application/pdf",
|
|
1349
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1350
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1351
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
1352
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
1353
|
+
// 其他
|
|
1354
|
+
msg: "application/vnd.ms-outlook",
|
|
1355
|
+
epub: "application/epub+zip",
|
|
1356
|
+
mobi: "application/x-mobipocket-ebook",
|
|
1357
|
+
azw: "application/vnd.amazon.ebook",
|
|
1358
|
+
azw3: "application/vnd.amazon.ebook",
|
|
1359
|
+
kf8: "application/vnd.amazon.ebook",
|
|
1360
|
+
csv: "text/csv",
|
|
1361
|
+
tsv: "text/tab-separated-values",
|
|
1362
|
+
xml: "application/xml",
|
|
1363
|
+
json: "application/json",
|
|
1364
|
+
md: "text/markdown",
|
|
1365
|
+
markdown: "text/markdown",
|
|
1366
|
+
txt: "text/plain",
|
|
1367
|
+
zip: "application/zip",
|
|
1368
|
+
// 字体
|
|
1369
|
+
ttf: "font/ttf",
|
|
1370
|
+
otf: "font/otf",
|
|
1371
|
+
woff: "font/woff",
|
|
1372
|
+
woff2: "font/woff2",
|
|
1373
|
+
// 视频
|
|
1374
|
+
mp4: "video/mp4",
|
|
1375
|
+
webm: "video/webm",
|
|
1376
|
+
ogg: "video/ogg",
|
|
1377
|
+
ogv: "video/ogg",
|
|
1378
|
+
mov: "video/quicktime",
|
|
1379
|
+
avi: "video/x-msvideo",
|
|
1380
|
+
mkv: "video/x-matroska",
|
|
1381
|
+
m4v: "video/mp4",
|
|
1382
|
+
"3gp": "video/3gpp",
|
|
1383
|
+
flv: "video/x-flv",
|
|
1384
|
+
// 音频
|
|
1385
|
+
mp3: "audio/mpeg",
|
|
1386
|
+
wav: "audio/wav",
|
|
1387
|
+
m4a: "audio/mp4",
|
|
1388
|
+
flac: "audio/flac",
|
|
1389
|
+
aac: "audio/aac",
|
|
1390
|
+
// 字幕
|
|
1391
|
+
srt: "application/x-subrip",
|
|
1392
|
+
vtt: "text/vtt",
|
|
1393
|
+
lrc: "application/x-lrc",
|
|
1394
|
+
elrc: "application/x-lrc",
|
|
1395
|
+
ass: "text/x-ssa",
|
|
1396
|
+
ssa: "text/x-ssa",
|
|
1397
|
+
ttml: "application/ttml+xml",
|
|
1398
|
+
dfxp: "application/ttml+xml"
|
|
1399
|
+
};
|
|
1400
|
+
function Ft(e) {
|
|
1401
|
+
const t = e.toLowerCase();
|
|
1402
|
+
return yt[t] || "application/octet-stream";
|
|
1403
|
+
}
|
|
1404
|
+
function kt(e) {
|
|
1405
|
+
var t;
|
|
1406
|
+
const r = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
1407
|
+
return Ft(r);
|
|
1408
|
+
}
|
|
1409
|
+
function _t(e) {
|
|
1410
|
+
return [
|
|
1411
|
+
"image/heic",
|
|
1412
|
+
"image/heif",
|
|
1413
|
+
"image/avif",
|
|
1414
|
+
"image/tiff",
|
|
1415
|
+
"image/x-canon-cr2",
|
|
1416
|
+
"image/x-nikon-nef",
|
|
1417
|
+
"image/x-sony-arw",
|
|
1418
|
+
"image/x-adobe-dng",
|
|
1419
|
+
"image/x-fuji-raf",
|
|
1420
|
+
"image/x-olympus-orf",
|
|
1421
|
+
"image/vnd.adobe.photoshop",
|
|
1422
|
+
"image/jp2",
|
|
1423
|
+
"image/jpx"
|
|
1424
|
+
].includes(e);
|
|
1425
|
+
}
|
|
1426
|
+
const H = /* @__PURE__ */ new Map();
|
|
1427
|
+
async function Rr(e) {
|
|
1428
|
+
if (H.has(e))
|
|
1429
|
+
return H.get(e);
|
|
1430
|
+
if (!_t(e))
|
|
1431
|
+
return null;
|
|
1432
|
+
try {
|
|
1433
|
+
let t = null;
|
|
1434
|
+
return e === "image/heic" || e === "image/heif" ? t = (await import("./heicLoader-CH_raQNn-1fBLaICM.mjs")).default : e === "image/avif" ? t = (await import("./avifLoader-BP3fgcMm-BnpxLhxp.mjs")).default : e === "image/tiff" ? t = (await import("./tiffLoader-CTFKVLqJ-B84NfwhR.mjs")).default : e === "image/x-canon-cr2" || e === "image/x-nikon-nef" || e === "image/x-sony-arw" || e === "image/x-adobe-dng" || e === "image/x-fuji-raf" || e === "image/x-olympus-orf" ? t = (await import("./rawLoader-0mLvxCNp-CJmERiK7.mjs")).default : e === "image/vnd.adobe.photoshop" ? t = (await import("./psdLoader-Doxw3mWm-DVOGFSlh.mjs")).default : (e === "image/jp2" || e === "image/jpx") && (t = (await import("./jp2Loader-Bn-qPMbD-Bn-qPMbD.mjs")).default), t && H.set(e, t), t;
|
|
1435
|
+
} catch (t) {
|
|
1436
|
+
return console.warn(`Failed to load image decoder for ${e}:`, t), null;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
async function Tr(e) {
|
|
1440
|
+
if (e.type && e.type !== "application/octet-stream")
|
|
1441
|
+
return e.type;
|
|
1442
|
+
const t = kt(e.name);
|
|
1443
|
+
if (t !== "application/octet-stream")
|
|
1444
|
+
return t;
|
|
1445
|
+
if (e instanceof Blob || e instanceof File) {
|
|
1446
|
+
const r = await Ct(e);
|
|
1447
|
+
if (r !== "application/octet-stream")
|
|
1448
|
+
return r;
|
|
1449
|
+
}
|
|
1450
|
+
return "application/octet-stream";
|
|
1451
|
+
}
|
|
1452
|
+
async function Ct(e) {
|
|
1453
|
+
try {
|
|
1454
|
+
const t = new Uint8Array(await e.slice(0, 12).arrayBuffer());
|
|
1455
|
+
if (t[4] === 102 && t[5] === 116 && t[6] === 121 && t[7] === 112) {
|
|
1456
|
+
const r = String.fromCharCode(...t.slice(8, 12));
|
|
1457
|
+
if (r === "heic" || r === "heix" || r === "mif1")
|
|
1458
|
+
return "image/heic";
|
|
1459
|
+
}
|
|
1460
|
+
if (t[0] === 73 && t[1] === 73 && t[2] === 42 && t[3] === 0 || t[0] === 77 && t[1] === 77 && t[2] === 0 && t[3] === 42)
|
|
1461
|
+
return "image/tiff";
|
|
1462
|
+
if (t[4] === 102 && t[5] === 116 && t[6] === 121 && t[7] === 112 && String.fromCharCode(...t.slice(8, 12)) === "avif")
|
|
1463
|
+
return "image/avif";
|
|
1464
|
+
if (t[0] === 56 && t[1] === 66 && t[2] === 80 && t[3] === 83)
|
|
1465
|
+
return "image/vnd.adobe.photoshop";
|
|
1466
|
+
if (t[0] === 255 && t[1] === 79 && t[2] === 255 && t[3] === 81)
|
|
1467
|
+
return "image/jp2";
|
|
1468
|
+
} catch (t) {
|
|
1469
|
+
console.warn("Failed to detect image format by magic number:", t);
|
|
1470
|
+
}
|
|
1471
|
+
return "application/octet-stream";
|
|
1472
|
+
}
|
|
1473
|
+
const ee = X(null), Nt = ({
|
|
1474
|
+
locale: e = "zh-CN",
|
|
1475
|
+
messages: t,
|
|
1476
|
+
children: r
|
|
1477
|
+
}) => {
|
|
1478
|
+
const o = M(() => {
|
|
1479
|
+
const a = Y({ locale: e, messages: t });
|
|
1480
|
+
return { locale: e, t: a };
|
|
1481
|
+
}, [e, t]);
|
|
1482
|
+
return /* @__PURE__ */ d(ee.Provider, { value: o, children: r });
|
|
1483
|
+
};
|
|
1484
|
+
let Z = null;
|
|
1485
|
+
function jt() {
|
|
1486
|
+
return Z || (Z = Y({ locale: "zh-CN" })), Z;
|
|
1487
|
+
}
|
|
1488
|
+
function ve() {
|
|
1489
|
+
const e = D(ee);
|
|
1490
|
+
return (e == null ? void 0 : e.t) ?? jt();
|
|
1491
|
+
}
|
|
1492
|
+
function Er() {
|
|
1493
|
+
const e = D(ee);
|
|
1494
|
+
return (e == null ? void 0 : e.locale) ?? "zh-CN";
|
|
1495
|
+
}
|
|
1496
|
+
const we = X(null), Pt = ({ theme: e, children: t }) => /* @__PURE__ */ d(we.Provider, { value: e, children: t });
|
|
1497
|
+
function Mr() {
|
|
1498
|
+
return D(we) ?? "dark";
|
|
1499
|
+
}
|
|
1500
|
+
const Rt = {
|
|
1501
|
+
fetcher: (e, t) => fetch(e, t)
|
|
1502
|
+
}, te = X(Rt), Tt = ({
|
|
1503
|
+
requestInit: e,
|
|
1504
|
+
requestHandler: t,
|
|
1505
|
+
shouldFetchAsBlob: r,
|
|
1506
|
+
children: o
|
|
1507
|
+
}) => {
|
|
1508
|
+
const a = M(
|
|
1509
|
+
() => ({
|
|
1510
|
+
fetcher: Ke({ requestInit: e, requestHandler: t }),
|
|
1511
|
+
shouldFetchAsBlob: r
|
|
1512
|
+
}),
|
|
1513
|
+
[e, t, r]
|
|
1514
|
+
);
|
|
1515
|
+
return /* @__PURE__ */ d(te.Provider, { value: a, children: o });
|
|
1516
|
+
};
|
|
1517
|
+
function Et() {
|
|
1518
|
+
return D(te).fetcher;
|
|
1519
|
+
}
|
|
1520
|
+
function Mt(e) {
|
|
1521
|
+
const { fetcher: t, shouldFetchAsBlob: r } = D(te), o = !!(e && (r != null && r(e))), [a, n] = S(""), i = E(null);
|
|
1522
|
+
return j(() => {
|
|
1523
|
+
if (!e || !o) {
|
|
1524
|
+
i.current && (URL.revokeObjectURL(i.current), i.current = null), n("");
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
let s = !1;
|
|
1528
|
+
return n(""), Xe(e.url, t).then((l) => {
|
|
1529
|
+
if (s) {
|
|
1530
|
+
URL.revokeObjectURL(l);
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
i.current && URL.revokeObjectURL(i.current), i.current = l, n(l);
|
|
1534
|
+
}).catch((l) => {
|
|
1535
|
+
s || (console.error("[file-preview] resolve blob url failed:", l), n(e.url));
|
|
1536
|
+
}), () => {
|
|
1537
|
+
s = !0;
|
|
1538
|
+
};
|
|
1539
|
+
}, [e == null ? void 0 : e.id, e == null ? void 0 : e.url, o, t]), j(() => () => {
|
|
1540
|
+
i.current && (URL.revokeObjectURL(i.current), i.current = null);
|
|
1541
|
+
}, []), e ? o ? a : e.url : "";
|
|
1542
|
+
}
|
|
1543
|
+
const me = ({
|
|
1544
|
+
fileName: e,
|
|
1545
|
+
fileType: t,
|
|
1546
|
+
onDownload: r
|
|
1547
|
+
}) => {
|
|
1548
|
+
const o = ve();
|
|
1549
|
+
return /* @__PURE__ */ y("div", { className: "rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-p-6 rfp-gap-4", children: [
|
|
1550
|
+
/* @__PURE__ */ d("div", { className: "rfp-w-20 rfp-h-20 rfp-rounded-full rfp-bg-surface-2 rfp-flex rfp-items-center rfp-justify-center", children: /* @__PURE__ */ d(ze, { className: "rfp-w-10 rfp-h-10 rfp-text-fg-secondary" }) }),
|
|
1551
|
+
/* @__PURE__ */ y("div", { className: "rfp-text-fg-primary rfp-text-center", children: [
|
|
1552
|
+
/* @__PURE__ */ d("p", { className: "rfp-text-lg rfp-font-medium rfp-mb-2", children: e }),
|
|
1553
|
+
/* @__PURE__ */ d("p", { className: "rfp-text-fg-secondary", children: o("common.unsupported_preview", { type: t }) })
|
|
1554
|
+
] }),
|
|
1555
|
+
/* @__PURE__ */ y(
|
|
1556
|
+
"button",
|
|
1557
|
+
{
|
|
1558
|
+
onClick: r,
|
|
1559
|
+
className: "rfp-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 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",
|
|
1560
|
+
children: [
|
|
1561
|
+
/* @__PURE__ */ d(J, { className: "rfp-w-5 rfp-h-5" }),
|
|
1562
|
+
o("common.download")
|
|
1563
|
+
]
|
|
1564
|
+
}
|
|
1565
|
+
)
|
|
1566
|
+
] });
|
|
1567
|
+
};
|
|
1568
|
+
function zt({
|
|
1569
|
+
mode: e,
|
|
1570
|
+
currentIndex: t,
|
|
1571
|
+
totalFiles: r,
|
|
1572
|
+
onNavigate: o,
|
|
1573
|
+
onClose: a,
|
|
1574
|
+
rootRef: n
|
|
1575
|
+
}) {
|
|
1576
|
+
const i = E({ onNavigate: o, onClose: a });
|
|
1577
|
+
j(() => {
|
|
1578
|
+
i.current = { onNavigate: o, onClose: a };
|
|
1579
|
+
}, [o, a]), j(() => {
|
|
1580
|
+
const s = (l) => {
|
|
1581
|
+
const { onNavigate: c, onClose: p } = i.current;
|
|
1582
|
+
l.key === "Escape" && e === "modal" ? p == null || p() : l.key === "ArrowLeft" && t > 0 ? c == null || c(t - 1) : l.key === "ArrowRight" && t < r - 1 && (c == null || c(t + 1));
|
|
1583
|
+
};
|
|
1584
|
+
if (e === "modal")
|
|
1585
|
+
return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
|
|
1586
|
+
{
|
|
1587
|
+
const l = n == null ? void 0 : n.current;
|
|
1588
|
+
return l ? (l.addEventListener("keydown", s), () => l.removeEventListener("keydown", s)) : void 0;
|
|
1589
|
+
}
|
|
1590
|
+
}, [e, t, r, n]);
|
|
1591
|
+
}
|
|
1592
|
+
function Lt(e) {
|
|
1593
|
+
const [t, r] = S(
|
|
1594
|
+
() => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
1595
|
+
);
|
|
1596
|
+
return j(() => {
|
|
1597
|
+
if (e !== "auto") return;
|
|
1598
|
+
const o = window.matchMedia("(prefers-color-scheme: dark)"), a = (n) => r(n.matches);
|
|
1599
|
+
return o.addEventListener("change", a), () => o.removeEventListener("change", a);
|
|
1600
|
+
}, [e]), e === "auto" ? t ? "dark" : "light" : e;
|
|
1601
|
+
}
|
|
1602
|
+
const St = ({
|
|
1603
|
+
icon: e,
|
|
1604
|
+
label: t,
|
|
1605
|
+
onClick: r,
|
|
1606
|
+
disabled: o,
|
|
1607
|
+
active: a,
|
|
1608
|
+
ariaKeyshortcuts: n
|
|
1609
|
+
}) => {
|
|
1610
|
+
let i;
|
|
1611
|
+
return o ? i = "rfp-text-fg-disabled rfp-cursor-not-allowed" : a ? i = "rfp-text-fg-primary rfp-bg-surface-3 hover:rfp-bg-surface-3 active:rfp-bg-surface-3" : i = "rfp-text-fg-primary hover:rfp-bg-surface-2 active:rfp-bg-surface-3", /* @__PURE__ */ y(
|
|
1612
|
+
"button",
|
|
1613
|
+
{
|
|
1614
|
+
onClick: r,
|
|
1615
|
+
disabled: o,
|
|
1616
|
+
"aria-label": t,
|
|
1617
|
+
"aria-pressed": a,
|
|
1618
|
+
"aria-keyshortcuts": n,
|
|
1619
|
+
"aria-disabled": o,
|
|
1620
|
+
className: `rfp-relative rfp-group rfp-p-2 md:rfp-p-1.5 rfp-rounded-md rfp-transition-all rfp-select-none ${i}`,
|
|
1621
|
+
children: [
|
|
1622
|
+
e,
|
|
1623
|
+
/* @__PURE__ */ y("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 max-[1023px]:!rfp-hidden", children: [
|
|
1624
|
+
/* @__PURE__ */ d("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" }),
|
|
1625
|
+
/* @__PURE__ */ d("span", { className: "rfp-relative", children: t })
|
|
1626
|
+
] })
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
);
|
|
1630
|
+
};
|
|
1631
|
+
function I(e, t) {
|
|
1632
|
+
return e.map((r, o, a) => /* @__PURE__ */ y(be.Fragment, { children: [
|
|
1633
|
+
r.items.map(
|
|
1634
|
+
(n, i) => n.type === "button" ? /* @__PURE__ */ d(
|
|
1635
|
+
St,
|
|
1636
|
+
{
|
|
1637
|
+
icon: n.icon,
|
|
1638
|
+
label: n.tooltip,
|
|
1639
|
+
onClick: n.action,
|
|
1640
|
+
disabled: n.disabled,
|
|
1641
|
+
active: n.active,
|
|
1642
|
+
ariaKeyshortcuts: n.ariaKeyshortcuts
|
|
1643
|
+
},
|
|
1644
|
+
`${o}-${i}`
|
|
1645
|
+
) : /* @__PURE__ */ d(
|
|
1646
|
+
"span",
|
|
1647
|
+
{
|
|
1648
|
+
className: "rfp-text-xs rfp-text-center rfp-font-medium rfp-tabular-nums rfp-text-fg-tertiary",
|
|
1649
|
+
style: { minWidth: n.minWidth || "auto" },
|
|
1650
|
+
children: n.content
|
|
1651
|
+
},
|
|
1652
|
+
`${o}-${i}`
|
|
1653
|
+
)
|
|
1654
|
+
),
|
|
1655
|
+
o < a.length - 1 && /* @__PURE__ */ d("div", { className: `rfp-w-px rfp-h-4 rfp-bg-divide ${t}` })
|
|
1656
|
+
] }, o));
|
|
1657
|
+
}
|
|
1658
|
+
const Dt = ({
|
|
1659
|
+
fileName: e,
|
|
1660
|
+
currentIndex: t,
|
|
1661
|
+
totalFiles: r,
|
|
1662
|
+
toolGroups: o,
|
|
1663
|
+
t: a,
|
|
1664
|
+
onDownload: n,
|
|
1665
|
+
onClose: i,
|
|
1666
|
+
showDownload: s
|
|
1667
|
+
}) => {
|
|
1668
|
+
const l = !!i, c = [
|
|
1669
|
+
...s ? [
|
|
1670
|
+
{
|
|
1671
|
+
items: [
|
|
1672
|
+
{
|
|
1673
|
+
type: "button",
|
|
1674
|
+
icon: /* @__PURE__ */ d(J, { className: "rfp-w-4 rfp-h-4" }),
|
|
1675
|
+
tooltip: a("accessibility.downloadFile"),
|
|
1676
|
+
action: n
|
|
1677
|
+
}
|
|
1678
|
+
]
|
|
1679
|
+
}
|
|
1680
|
+
] : [],
|
|
1681
|
+
...l ? [
|
|
1682
|
+
{
|
|
1683
|
+
items: [
|
|
1684
|
+
{
|
|
1685
|
+
type: "button",
|
|
1686
|
+
icon: /* @__PURE__ */ d(Le, { className: "rfp-w-4 rfp-h-4" }),
|
|
1687
|
+
tooltip: a("accessibility.closePreview"),
|
|
1688
|
+
action: i,
|
|
1689
|
+
ariaKeyshortcuts: "Escape"
|
|
1690
|
+
}
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
] : []
|
|
1694
|
+
];
|
|
1695
|
+
return /* @__PURE__ */ y(
|
|
1696
|
+
V.div,
|
|
1697
|
+
{
|
|
1698
|
+
initial: { opacity: 0 },
|
|
1699
|
+
animate: { opacity: 1 },
|
|
1700
|
+
exit: { opacity: 0 },
|
|
1701
|
+
className: "rfp-flex-shrink-0 rfp-z-10 rfp-backdrop-blur-md rfp-border-b rfp-bg-surface-toolbar rfp-border-line",
|
|
1702
|
+
style: { paddingTop: "env(safe-area-inset-top, 0px)" },
|
|
1703
|
+
children: [
|
|
1704
|
+
/* @__PURE__ */ y("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: [
|
|
1705
|
+
/* @__PURE__ */ y("div", { className: "rfp-flex rfp-items-center rfp-flex-1 rfp-min-w-0 rfp-mr-2 md:rfp-mr-3", children: [
|
|
1706
|
+
/* @__PURE__ */ d("h2", { className: "rfp-font-medium rfp-text-xs md:rfp-text-sm rfp-truncate rfp-text-fg-primary", children: e }),
|
|
1707
|
+
/* @__PURE__ */ y(
|
|
1708
|
+
"span",
|
|
1709
|
+
{
|
|
1710
|
+
className: "rfp-text-xs rfp-ml-2 rfp-flex-shrink-0 rfp-text-fg-muted",
|
|
1711
|
+
"aria-live": "polite",
|
|
1712
|
+
"aria-atomic": "true",
|
|
1713
|
+
children: [
|
|
1714
|
+
t + 1,
|
|
1715
|
+
"/",
|
|
1716
|
+
r
|
|
1717
|
+
]
|
|
1718
|
+
}
|
|
1719
|
+
)
|
|
1720
|
+
] }),
|
|
1721
|
+
/* @__PURE__ */ d("div", { className: "rfp-flex rfp-items-center rfp-gap-1 md:rfp-hidden rfp-flex-shrink-0", children: I(c, "rfp-mx-0.5") }),
|
|
1722
|
+
/* @__PURE__ */ y("div", { className: "rfp-hidden md:rfp-flex rfp-items-center rfp-gap-1 rfp-flex-shrink-0", children: [
|
|
1723
|
+
I(o, "rfp-mx-1"),
|
|
1724
|
+
o.length > 0 && /* @__PURE__ */ d("div", { className: "rfp-w-px rfp-h-4 rfp-mx-1 rfp-bg-divide" }),
|
|
1725
|
+
I(c, "rfp-mx-1")
|
|
1726
|
+
] })
|
|
1727
|
+
] }),
|
|
1728
|
+
o.length > 0 && /* @__PURE__ */ d("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: I(o, "rfp-mx-0.5") })
|
|
1729
|
+
]
|
|
1730
|
+
}
|
|
1731
|
+
);
|
|
1732
|
+
}, he = ({
|
|
1733
|
+
error: e,
|
|
1734
|
+
fileName: t,
|
|
1735
|
+
t: r,
|
|
1736
|
+
onRetry: o,
|
|
1737
|
+
onDownload: a
|
|
1738
|
+
}) => /* @__PURE__ */ y("div", { className: "rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-h-full rfp-px-4 rfp-text-fg-primary", children: [
|
|
1739
|
+
/* @__PURE__ */ d(Se, { className: "rfp-w-16 rfp-h-16 rfp-mb-4 rfp-text-error" }),
|
|
1740
|
+
/* @__PURE__ */ d("h3", { className: "rfp-text-lg rfp-font-semibold rfp-mb-2", children: r("common.unknown_error") }),
|
|
1741
|
+
/* @__PURE__ */ d("p", { className: "rfp-text-sm rfp-text-fg-secondary rfp-mb-1 rfp-max-w-md rfp-text-center", children: e.message }),
|
|
1742
|
+
/* @__PURE__ */ d("p", { className: "rfp-text-xs rfp-text-fg-tertiary rfp-mb-6 rfp-max-w-md rfp-text-center", children: t }),
|
|
1743
|
+
/* @__PURE__ */ y("div", { className: "rfp-flex rfp-gap-3", children: [
|
|
1744
|
+
/* @__PURE__ */ y(
|
|
1745
|
+
"button",
|
|
1746
|
+
{
|
|
1747
|
+
onClick: o,
|
|
1748
|
+
"aria-label": r("common.retry"),
|
|
1749
|
+
className: "rfp-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-rounded-md rfp-text-sm rfp-font-medium rfp-transition-colors",
|
|
1750
|
+
children: [
|
|
1751
|
+
/* @__PURE__ */ d(De, { className: "rfp-w-4 rfp-h-4" }),
|
|
1752
|
+
r("common.retry")
|
|
1753
|
+
]
|
|
1754
|
+
}
|
|
1755
|
+
),
|
|
1756
|
+
/* @__PURE__ */ y(
|
|
1757
|
+
"button",
|
|
1758
|
+
{
|
|
1759
|
+
onClick: a,
|
|
1760
|
+
"aria-label": r("accessibility.downloadFile"),
|
|
1761
|
+
className: "rfp-flex rfp-items-center rfp-gap-2 rfp-px-4 rfp-py-2 rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-rounded-md rfp-text-sm rfp-font-medium rfp-transition-colors",
|
|
1762
|
+
children: [
|
|
1763
|
+
/* @__PURE__ */ d(J, { className: "rfp-w-4 rfp-h-4" }),
|
|
1764
|
+
r("common.download")
|
|
1765
|
+
]
|
|
1766
|
+
}
|
|
1767
|
+
)
|
|
1768
|
+
] })
|
|
1769
|
+
] });
|
|
1770
|
+
class ge extends be.Component {
|
|
1771
|
+
constructor(r) {
|
|
1772
|
+
super(r);
|
|
1773
|
+
se(this, "reset", () => {
|
|
1774
|
+
this.setState({ hasError: !1, error: null });
|
|
1775
|
+
});
|
|
1776
|
+
this.state = { hasError: !1, error: null };
|
|
1777
|
+
}
|
|
1778
|
+
static getDerivedStateFromError(r) {
|
|
1779
|
+
return { hasError: !0, error: r };
|
|
1780
|
+
}
|
|
1781
|
+
componentDidCatch(r, o) {
|
|
1782
|
+
var a, n;
|
|
1783
|
+
console.error("[file-preview] Renderer error:", r, o), (n = (a = this.props).onError) == null || n.call(a, r, o);
|
|
1784
|
+
}
|
|
1785
|
+
render() {
|
|
1786
|
+
return this.state.hasError && this.state.error ? this.props.fallback(this.state.error, this.reset) : this.props.children;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
const Ut = () => {
|
|
1790
|
+
const e = ve();
|
|
1791
|
+
return /* @__PURE__ */ d("div", { className: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-text-fg-muted", children: /* @__PURE__ */ y("div", { className: "rfp-flex rfp-flex-col rfp-items-center rfp-gap-3", children: [
|
|
1792
|
+
/* @__PURE__ */ d("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" }),
|
|
1793
|
+
/* @__PURE__ */ d("span", { className: "rfp-text-sm", children: e("common.loading") ?? "Loading..." })
|
|
1794
|
+
] }) });
|
|
1795
|
+
}, $t = ({
|
|
1796
|
+
currentFile: e,
|
|
1797
|
+
customRenderer: t,
|
|
1798
|
+
customRendererContext: r,
|
|
1799
|
+
t: o,
|
|
1800
|
+
onDownload: a,
|
|
1801
|
+
onError: n,
|
|
1802
|
+
children: i
|
|
1803
|
+
}) => t ? /* @__PURE__ */ d(
|
|
1804
|
+
ge,
|
|
1805
|
+
{
|
|
1806
|
+
fallback: (s, l) => /* @__PURE__ */ d(
|
|
1807
|
+
he,
|
|
1808
|
+
{
|
|
1809
|
+
error: s,
|
|
1810
|
+
fileName: e.name,
|
|
1811
|
+
t: o,
|
|
1812
|
+
onRetry: l,
|
|
1813
|
+
onDownload: a
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
onError: n,
|
|
1817
|
+
children: t.render(e, r)
|
|
1818
|
+
}
|
|
1819
|
+
) : /* @__PURE__ */ d(Re, { fallback: /* @__PURE__ */ d(Ut, {}), children: /* @__PURE__ */ d(
|
|
1820
|
+
ge,
|
|
1821
|
+
{
|
|
1822
|
+
fallback: (s, l) => /* @__PURE__ */ d(
|
|
1823
|
+
he,
|
|
1824
|
+
{
|
|
1825
|
+
error: s,
|
|
1826
|
+
fileName: e.name,
|
|
1827
|
+
t: o,
|
|
1828
|
+
onRetry: l,
|
|
1829
|
+
onDownload: a
|
|
1830
|
+
}
|
|
1831
|
+
),
|
|
1832
|
+
onError: n,
|
|
1833
|
+
children: i
|
|
1834
|
+
}
|
|
1835
|
+
) }, e.url), At = 2e3, Wt = ({
|
|
1836
|
+
containerRef: e,
|
|
1837
|
+
hasPrev: t,
|
|
1838
|
+
hasNext: r,
|
|
1839
|
+
onPrev: o,
|
|
1840
|
+
onNext: a,
|
|
1841
|
+
resetKey: n,
|
|
1842
|
+
t: i
|
|
1843
|
+
}) => {
|
|
1844
|
+
const [s, l] = S(!0), c = E(null), p = z(() => {
|
|
1845
|
+
c.current && clearTimeout(c.current), c.current = window.setTimeout(() => l(!1), At);
|
|
1846
|
+
}, []), f = z(() => {
|
|
1847
|
+
l((m) => m || !0), p();
|
|
1848
|
+
}, [p]);
|
|
1849
|
+
return j(() => {
|
|
1850
|
+
const m = e.current;
|
|
1851
|
+
if (!m) return;
|
|
1852
|
+
const u = () => f();
|
|
1853
|
+
return m.addEventListener("mousemove", u), () => {
|
|
1854
|
+
m.removeEventListener("mousemove", u);
|
|
1855
|
+
};
|
|
1856
|
+
}, [e, f]), j(() => (l(!0), p(), () => {
|
|
1857
|
+
c.current && clearTimeout(c.current);
|
|
1858
|
+
}), [n, p]), /* @__PURE__ */ y(Pe, { children: [
|
|
1859
|
+
t && /* @__PURE__ */ d(
|
|
1860
|
+
V.button,
|
|
1861
|
+
{
|
|
1862
|
+
initial: { opacity: 0 },
|
|
1863
|
+
animate: { opacity: s ? 1 : 0, x: s ? 0 : -20 },
|
|
1864
|
+
transition: { duration: 0.2 },
|
|
1865
|
+
onClick: o,
|
|
1866
|
+
onMouseEnter: f,
|
|
1867
|
+
style: { pointerEvents: s ? "auto" : "none" },
|
|
1868
|
+
"aria-label": i("accessibility.previousFile") || "上一个文件",
|
|
1869
|
+
"aria-keyshortcuts": "ArrowLeft",
|
|
1870
|
+
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",
|
|
1871
|
+
children: /* @__PURE__ */ d(Ue, { className: "rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6" })
|
|
1872
|
+
}
|
|
1873
|
+
),
|
|
1874
|
+
r && /* @__PURE__ */ d(
|
|
1875
|
+
V.button,
|
|
1876
|
+
{
|
|
1877
|
+
initial: { opacity: 0 },
|
|
1878
|
+
animate: { opacity: s ? 1 : 0, x: s ? 0 : 20 },
|
|
1879
|
+
transition: { duration: 0.2 },
|
|
1880
|
+
onClick: a,
|
|
1881
|
+
onMouseEnter: f,
|
|
1882
|
+
style: { pointerEvents: s ? "auto" : "none" },
|
|
1883
|
+
"aria-label": i("accessibility.nextFile") || "下一个文件",
|
|
1884
|
+
"aria-keyshortcuts": "ArrowRight",
|
|
1885
|
+
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",
|
|
1886
|
+
children: /* @__PURE__ */ d($e, { className: "rfp-w-5 rfp-h-5 md:rfp-w-6 md:rfp-h-6" })
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
] });
|
|
1890
|
+
}, Bt = F(
|
|
1891
|
+
() => import("./index-BBYKNNLb.mjs").then((e) => ({ default: e.ImageRenderer }))
|
|
1892
|
+
), It = F(
|
|
1893
|
+
() => import("./index-DLk08ylq.mjs").then((e) => ({ default: e.PdfRenderer }))
|
|
1894
|
+
), Vt = F(
|
|
1895
|
+
() => import("./index-oVJyD-FV.mjs").then((e) => ({ default: e.DocxRenderer }))
|
|
1896
|
+
), Ot = F(
|
|
1897
|
+
() => import("./index-vRLKumL8.mjs").then((e) => ({ default: e.XlsxRenderer }))
|
|
1898
|
+
), qt = F(
|
|
1899
|
+
() => import("./index-BKXvtJh5.mjs").then((e) => ({ default: e.PptxRenderer }))
|
|
1900
|
+
), Gt = F(
|
|
1901
|
+
() => import("./index-DGNNEnWE.mjs").then((e) => ({ default: e.MsgRenderer }))
|
|
1902
|
+
), Ht = F(
|
|
1903
|
+
() => import("./index-jvNrkVkp.mjs").then((e) => ({ default: e.EpubRenderer }))
|
|
1904
|
+
), Zt = F(
|
|
1905
|
+
() => import("./index-fQGAUFAX.mjs").then((e) => ({ default: e.MobiRenderer }))
|
|
1906
|
+
), Kt = F(
|
|
1907
|
+
() => import("./index-Bw3Fh4b5.mjs").then((e) => ({ default: e.VideoRenderer }))
|
|
1908
|
+
), Xt = F(
|
|
1909
|
+
() => import("./index-Cn4ZyhGM.mjs").then((e) => ({ default: e.AudioRenderer }))
|
|
1910
|
+
), Jt = F(
|
|
1911
|
+
() => import("./index-DVtPyN-s.mjs").then((e) => ({ default: e.MarkdownRenderer }))
|
|
1912
|
+
), Qt = F(
|
|
1913
|
+
() => import("./index-COOUxB5e.mjs").then((e) => ({ default: e.JsonRenderer }))
|
|
1914
|
+
), Yt = F(
|
|
1915
|
+
() => import("./index-CEC_DHgr.mjs").then((e) => ({ default: e.CsvRenderer }))
|
|
1916
|
+
), er = F(
|
|
1917
|
+
() => import("./index-BFh22D_W.mjs").then((e) => ({ default: e.XmlRenderer }))
|
|
1918
|
+
), tr = F(
|
|
1919
|
+
() => import("./index-fSw6Hl5e.mjs").then((e) => ({ default: e.SubtitleRenderer }))
|
|
1920
|
+
), rr = F(
|
|
1921
|
+
() => import("./index-CgFv7B_G.mjs").then((e) => ({ default: e.ZipRenderer }))
|
|
1922
|
+
), or = F(
|
|
1923
|
+
() => import("./index-CU1Lc3lV.mjs").then((e) => ({ default: e.TextRenderer }))
|
|
1924
|
+
), nr = F(
|
|
1925
|
+
() => import("./index-Dta7iGov.mjs").then((e) => ({ default: e.FontRenderer }))
|
|
1926
|
+
), ar = [
|
|
1927
|
+
{
|
|
1928
|
+
fileType: "image",
|
|
1929
|
+
component: Bt,
|
|
1930
|
+
getProps: (e) => ({
|
|
1931
|
+
url: e.resolvedUrl,
|
|
1932
|
+
fileSize: e.currentFile.size,
|
|
1933
|
+
file: e.currentFile
|
|
1934
|
+
})
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
fileType: "pdf",
|
|
1938
|
+
component: It,
|
|
1939
|
+
getProps: (e) => ({
|
|
1940
|
+
url: e.resolvedUrl
|
|
1941
|
+
})
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
fileType: "docx",
|
|
1945
|
+
component: Vt,
|
|
1946
|
+
getProps: (e) => ({
|
|
1947
|
+
url: e.resolvedUrl
|
|
1948
|
+
})
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
fileType: "xlsx",
|
|
1952
|
+
component: Ot,
|
|
1953
|
+
getProps: (e) => ({
|
|
1954
|
+
url: e.resolvedUrl
|
|
1955
|
+
})
|
|
1956
|
+
},
|
|
1957
|
+
{
|
|
1958
|
+
fileType: "pptx",
|
|
1959
|
+
component: qt,
|
|
1960
|
+
getProps: (e) => ({
|
|
1961
|
+
url: e.resolvedUrl
|
|
1962
|
+
})
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
fileType: "msg",
|
|
1966
|
+
component: Gt,
|
|
1967
|
+
getProps: (e) => ({
|
|
1968
|
+
url: e.resolvedUrl
|
|
1969
|
+
})
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
fileType: "epub",
|
|
1973
|
+
component: Ht,
|
|
1974
|
+
getProps: (e) => ({
|
|
1975
|
+
url: e.resolvedUrl
|
|
1976
|
+
})
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
fileType: "mobi",
|
|
1980
|
+
component: Zt,
|
|
1981
|
+
getProps: (e) => ({
|
|
1982
|
+
url: e.resolvedUrl
|
|
1983
|
+
})
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
fileType: "video",
|
|
1987
|
+
component: Kt,
|
|
1988
|
+
getProps: (e) => ({
|
|
1989
|
+
url: e.resolvedUrl,
|
|
1990
|
+
fileName: e.currentFile.name
|
|
1991
|
+
})
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
fileType: "audio",
|
|
1995
|
+
component: Xt,
|
|
1996
|
+
getProps: (e) => ({
|
|
1997
|
+
url: e.resolvedUrl,
|
|
1998
|
+
fileName: e.currentFile.name
|
|
1999
|
+
})
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
fileType: "markdown",
|
|
2003
|
+
component: Jt,
|
|
2004
|
+
getProps: (e) => ({
|
|
2005
|
+
url: e.resolvedUrl
|
|
2006
|
+
})
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
fileType: "json",
|
|
2010
|
+
component: Qt,
|
|
2011
|
+
getProps: (e) => ({
|
|
2012
|
+
url: e.resolvedUrl,
|
|
2013
|
+
fileName: e.currentFile.name
|
|
2014
|
+
})
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
fileType: "csv",
|
|
2018
|
+
component: Yt,
|
|
2019
|
+
getProps: (e) => ({
|
|
2020
|
+
url: e.resolvedUrl,
|
|
2021
|
+
fileName: e.currentFile.name
|
|
2022
|
+
})
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
fileType: "xml",
|
|
2026
|
+
component: er,
|
|
2027
|
+
getProps: (e) => ({
|
|
2028
|
+
url: e.resolvedUrl,
|
|
2029
|
+
fileName: e.currentFile.name
|
|
2030
|
+
})
|
|
2031
|
+
},
|
|
2032
|
+
{
|
|
2033
|
+
fileType: "subtitle",
|
|
2034
|
+
component: tr,
|
|
2035
|
+
getProps: (e) => ({
|
|
2036
|
+
url: e.resolvedUrl,
|
|
2037
|
+
fileName: e.currentFile.name
|
|
2038
|
+
})
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
fileType: "zip",
|
|
2042
|
+
component: rr,
|
|
2043
|
+
getProps: (e) => ({
|
|
2044
|
+
url: e.resolvedUrl,
|
|
2045
|
+
nestingDepth: e.zipNestingDepth
|
|
2046
|
+
})
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
fileType: "text",
|
|
2050
|
+
component: or,
|
|
2051
|
+
getProps: (e) => ({
|
|
2052
|
+
url: e.resolvedUrl,
|
|
2053
|
+
fileName: e.currentFile.name
|
|
2054
|
+
})
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
fileType: "font",
|
|
2058
|
+
component: nr,
|
|
2059
|
+
getProps: (e) => ({
|
|
2060
|
+
url: e.resolvedUrl
|
|
2061
|
+
})
|
|
2062
|
+
}
|
|
2063
|
+
], ir = 3, re = (e) => {
|
|
2064
|
+
const { requestInit: t, requestHandler: r, shouldFetchAsBlob: o } = e;
|
|
2065
|
+
return /* @__PURE__ */ d(
|
|
2066
|
+
Tt,
|
|
2067
|
+
{
|
|
2068
|
+
requestInit: t,
|
|
2069
|
+
requestHandler: r,
|
|
2070
|
+
shouldFetchAsBlob: o,
|
|
2071
|
+
children: /* @__PURE__ */ d(sr, { ...e })
|
|
2072
|
+
}
|
|
2073
|
+
);
|
|
2074
|
+
}, sr = ({
|
|
2075
|
+
files: e,
|
|
2076
|
+
currentIndex: t,
|
|
2077
|
+
onNavigate: r,
|
|
2078
|
+
customRenderers: o = [],
|
|
2079
|
+
mode: a = "modal",
|
|
2080
|
+
onClose: n,
|
|
2081
|
+
zipNestingDepth: i = 0,
|
|
2082
|
+
locale: s = "zh-CN",
|
|
2083
|
+
messages: l,
|
|
2084
|
+
headless: c = !1,
|
|
2085
|
+
theme: p = "dark",
|
|
2086
|
+
onCustomEvent: f,
|
|
2087
|
+
onDownload: m,
|
|
2088
|
+
onError: u,
|
|
2089
|
+
showDownload: g = !0,
|
|
2090
|
+
requestInit: v,
|
|
2091
|
+
requestHandler: C,
|
|
2092
|
+
shouldFetchAsBlob: x
|
|
2093
|
+
}) => {
|
|
2094
|
+
const w = M(
|
|
2095
|
+
() => Y({ locale: s, messages: l }),
|
|
2096
|
+
[s, l]
|
|
2097
|
+
), N = M(() => Oe(e), [e]), h = N[t], _ = Mt(h), k = Et(), R = M(() => h ? o.find((b) => b.test(h)) : null, [h, o]), U = h ? qe(h) : "unsupported", $ = Lt(p), oe = E(null), ne = E(null), ye = E(null), [Fe, A] = S([]), P = E(null), ae = z((b) => {
|
|
2098
|
+
if (P.current && (P.current(), P.current = null), ye.current = b, !(b != null && b.getToolbarGroups)) {
|
|
2099
|
+
A([]);
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
const T = b.getToolbarGroups();
|
|
2103
|
+
if (A(T), b.onToolbarChange) {
|
|
2104
|
+
const q = b.onToolbarChange(() => {
|
|
2105
|
+
const Ce = b.getToolbarGroups();
|
|
2106
|
+
A(Ce);
|
|
2107
|
+
});
|
|
2108
|
+
P.current = q;
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
const O = setInterval(() => {
|
|
2112
|
+
const q = b.getToolbarGroups();
|
|
2113
|
+
A(q);
|
|
2114
|
+
}, 100);
|
|
2115
|
+
P.current = () => clearInterval(O);
|
|
2116
|
+
}, []), ke = z((b) => {
|
|
2117
|
+
ae(b);
|
|
2118
|
+
}, [ae]);
|
|
2119
|
+
j(() => () => {
|
|
2120
|
+
P.current && (P.current(), P.current = null);
|
|
2121
|
+
}, []), zt({
|
|
2122
|
+
mode: a,
|
|
2123
|
+
currentIndex: t,
|
|
2124
|
+
totalFiles: N.length,
|
|
2125
|
+
onNavigate: r,
|
|
2126
|
+
onClose: n,
|
|
2127
|
+
rootRef: ne
|
|
2128
|
+
});
|
|
2129
|
+
const ie = z(
|
|
2130
|
+
(b, T) => {
|
|
2131
|
+
h && (f == null || f({ name: b, payload: T, file: h }));
|
|
2132
|
+
},
|
|
2133
|
+
[h, f]
|
|
2134
|
+
), _e = M(
|
|
2135
|
+
() => ({ emit: ie, t: w, theme: $, locale: s }),
|
|
2136
|
+
[ie, w, $, s]
|
|
2137
|
+
), W = z(async () => {
|
|
2138
|
+
if (h) {
|
|
2139
|
+
if (m) {
|
|
2140
|
+
await m(h);
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
try {
|
|
2144
|
+
await Je(h.url, h.name, k);
|
|
2145
|
+
} catch (b) {
|
|
2146
|
+
console.error("[file-preview] download failed:", b);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
}, [h, m, k]);
|
|
2150
|
+
return h ? /* @__PURE__ */ d(Nt, { locale: s, messages: l, children: /* @__PURE__ */ d(Pt, { theme: $, children: /* @__PURE__ */ y(
|
|
2151
|
+
"div",
|
|
2152
|
+
{
|
|
2153
|
+
ref: ne,
|
|
2154
|
+
tabIndex: a === "embed" ? 0 : -1,
|
|
2155
|
+
"data-theme": $,
|
|
2156
|
+
className: "rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-flex-col rfp-overflow-hidden rfp-outline-none",
|
|
2157
|
+
children: [
|
|
2158
|
+
!c && /* @__PURE__ */ d(
|
|
2159
|
+
Dt,
|
|
2160
|
+
{
|
|
2161
|
+
fileName: h.name,
|
|
2162
|
+
currentIndex: t,
|
|
2163
|
+
totalFiles: N.length,
|
|
2164
|
+
toolGroups: Fe,
|
|
2165
|
+
t: w,
|
|
2166
|
+
onDownload: W,
|
|
2167
|
+
onClose: n,
|
|
2168
|
+
showDownload: g
|
|
2169
|
+
}
|
|
2170
|
+
),
|
|
2171
|
+
/* @__PURE__ */ d(
|
|
2172
|
+
"div",
|
|
2173
|
+
{
|
|
2174
|
+
ref: oe,
|
|
2175
|
+
className: "rfp-flex-1 rfp-flex rfp-items-center rfp-justify-center rfp-overflow-auto",
|
|
2176
|
+
children: /* @__PURE__ */ d(
|
|
2177
|
+
$t,
|
|
2178
|
+
{
|
|
2179
|
+
currentFile: h,
|
|
2180
|
+
customRenderer: R,
|
|
2181
|
+
customRendererContext: _e,
|
|
2182
|
+
t: w,
|
|
2183
|
+
onDownload: W,
|
|
2184
|
+
onError: u,
|
|
2185
|
+
children: (() => {
|
|
2186
|
+
if (U === "zip" && i >= ir)
|
|
2187
|
+
return /* @__PURE__ */ d(
|
|
2188
|
+
me,
|
|
2189
|
+
{
|
|
2190
|
+
fileName: h.name,
|
|
2191
|
+
fileType: h.type,
|
|
2192
|
+
onDownload: W
|
|
2193
|
+
}
|
|
2194
|
+
);
|
|
2195
|
+
const b = ar.find(
|
|
2196
|
+
(T) => T.fileType === U
|
|
2197
|
+
);
|
|
2198
|
+
if (b) {
|
|
2199
|
+
const T = b.component, O = b.getProps({
|
|
2200
|
+
resolvedUrl: _,
|
|
2201
|
+
zipNestingDepth: i,
|
|
2202
|
+
currentFile: h
|
|
2203
|
+
});
|
|
2204
|
+
return /* @__PURE__ */ d(T, { ref: ke, ...O });
|
|
2205
|
+
}
|
|
2206
|
+
return /* @__PURE__ */ d(
|
|
2207
|
+
me,
|
|
2208
|
+
{
|
|
2209
|
+
fileName: h.name,
|
|
2210
|
+
fileType: h.type,
|
|
2211
|
+
onDownload: W
|
|
2212
|
+
}
|
|
2213
|
+
);
|
|
2214
|
+
})()
|
|
2215
|
+
}
|
|
2216
|
+
)
|
|
2217
|
+
}
|
|
2218
|
+
),
|
|
2219
|
+
!c && N.length > 1 && /* @__PURE__ */ d(
|
|
2220
|
+
Wt,
|
|
2221
|
+
{
|
|
2222
|
+
containerRef: oe,
|
|
2223
|
+
hasPrev: t > 0,
|
|
2224
|
+
hasNext: t < N.length - 1,
|
|
2225
|
+
onPrev: () => r == null ? void 0 : r(t - 1),
|
|
2226
|
+
onNext: () => r == null ? void 0 : r(t + 1),
|
|
2227
|
+
resetKey: t,
|
|
2228
|
+
t: w
|
|
2229
|
+
}
|
|
2230
|
+
)
|
|
2231
|
+
]
|
|
2232
|
+
}
|
|
2233
|
+
) }) }) : null;
|
|
2234
|
+
}, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2235
|
+
__proto__: null,
|
|
2236
|
+
FilePreviewContent: re
|
|
2237
|
+
}, Symbol.toStringTag, { value: "Module" })), Lr = ({
|
|
2238
|
+
files: e,
|
|
2239
|
+
currentIndex: t,
|
|
2240
|
+
isOpen: r,
|
|
2241
|
+
onClose: o,
|
|
2242
|
+
onNavigate: a,
|
|
2243
|
+
customRenderers: n = [],
|
|
2244
|
+
locale: i,
|
|
2245
|
+
messages: s,
|
|
2246
|
+
headless: l,
|
|
2247
|
+
theme: c = "dark",
|
|
2248
|
+
onCustomEvent: p,
|
|
2249
|
+
requestInit: f,
|
|
2250
|
+
requestHandler: m,
|
|
2251
|
+
shouldFetchAsBlob: u,
|
|
2252
|
+
onDownload: g,
|
|
2253
|
+
showDownload: v
|
|
2254
|
+
}) => {
|
|
2255
|
+
const [C, x] = S(
|
|
2256
|
+
() => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
2257
|
+
);
|
|
2258
|
+
j(() => {
|
|
2259
|
+
if (c !== "auto") return;
|
|
2260
|
+
const h = window.matchMedia("(prefers-color-scheme: dark)"), _ = (k) => x(k.matches);
|
|
2261
|
+
return h.addEventListener("change", _), () => h.removeEventListener("change", _);
|
|
2262
|
+
}, [c]);
|
|
2263
|
+
const w = c === "auto" ? C ? "dark" : "light" : c;
|
|
2264
|
+
if (j(() => {
|
|
2265
|
+
if (r) {
|
|
2266
|
+
const h = document.body.style.overflow, _ = document.body.style.paddingRight, k = window.innerWidth - document.documentElement.clientWidth;
|
|
2267
|
+
return document.body.style.overflow = "hidden", k > 0 && (document.body.style.paddingRight = `${k}px`), () => {
|
|
2268
|
+
document.body.style.overflow = h, document.body.style.paddingRight = _;
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
}, [r]), !r) return null;
|
|
2272
|
+
const N = /* @__PURE__ */ d("div", { className: "rfp-root", "data-theme": w, children: /* @__PURE__ */ d(Ee, { children: r && /* @__PURE__ */ d(
|
|
2273
|
+
V.div,
|
|
2274
|
+
{
|
|
2275
|
+
initial: { opacity: 0 },
|
|
2276
|
+
animate: { opacity: 1 },
|
|
2277
|
+
exit: { opacity: 0 },
|
|
2278
|
+
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",
|
|
2279
|
+
onClick: o,
|
|
2280
|
+
onWheel: (h) => h.stopPropagation(),
|
|
2281
|
+
children: /* @__PURE__ */ d(
|
|
2282
|
+
"div",
|
|
2283
|
+
{
|
|
2284
|
+
className: "rfp-relative rfp-w-full rfp-h-full",
|
|
2285
|
+
onClick: (h) => h.stopPropagation(),
|
|
2286
|
+
children: /* @__PURE__ */ d(
|
|
2287
|
+
re,
|
|
2288
|
+
{
|
|
2289
|
+
mode: "modal",
|
|
2290
|
+
files: e,
|
|
2291
|
+
currentIndex: t,
|
|
2292
|
+
onClose: o,
|
|
2293
|
+
onNavigate: a,
|
|
2294
|
+
customRenderers: n,
|
|
2295
|
+
locale: i,
|
|
2296
|
+
messages: s,
|
|
2297
|
+
headless: l,
|
|
2298
|
+
theme: c,
|
|
2299
|
+
onCustomEvent: p,
|
|
2300
|
+
requestInit: f,
|
|
2301
|
+
requestHandler: m,
|
|
2302
|
+
shouldFetchAsBlob: u,
|
|
2303
|
+
onDownload: g,
|
|
2304
|
+
showDownload: v
|
|
2305
|
+
}
|
|
2306
|
+
)
|
|
2307
|
+
}
|
|
2308
|
+
)
|
|
2309
|
+
}
|
|
2310
|
+
) }) });
|
|
2311
|
+
return Te(N, document.body);
|
|
2312
|
+
}, Sr = ({
|
|
2313
|
+
files: e,
|
|
2314
|
+
currentIndex: t = 0,
|
|
2315
|
+
onNavigate: r,
|
|
2316
|
+
customRenderers: o = [],
|
|
2317
|
+
width: a = "100%",
|
|
2318
|
+
height: n = "100%",
|
|
2319
|
+
className: i,
|
|
2320
|
+
style: s,
|
|
2321
|
+
locale: l,
|
|
2322
|
+
messages: c,
|
|
2323
|
+
headless: p,
|
|
2324
|
+
theme: f = "dark",
|
|
2325
|
+
onCustomEvent: m,
|
|
2326
|
+
requestInit: u,
|
|
2327
|
+
requestHandler: g,
|
|
2328
|
+
shouldFetchAsBlob: v,
|
|
2329
|
+
onDownload: C,
|
|
2330
|
+
onClose: x,
|
|
2331
|
+
showDownload: w
|
|
2332
|
+
}) => {
|
|
2333
|
+
const [N, h] = S(
|
|
2334
|
+
() => typeof window < "u" ? window.matchMedia("(prefers-color-scheme: dark)").matches : !0
|
|
2335
|
+
);
|
|
2336
|
+
j(() => {
|
|
2337
|
+
if (f !== "auto") return;
|
|
2338
|
+
const k = window.matchMedia("(prefers-color-scheme: dark)"), R = (U) => h(U.matches);
|
|
2339
|
+
return k.addEventListener("change", R), () => k.removeEventListener("change", R);
|
|
2340
|
+
}, [f]);
|
|
2341
|
+
const _ = f === "auto" ? N ? "dark" : "light" : f;
|
|
2342
|
+
return /* @__PURE__ */ d(
|
|
2343
|
+
"div",
|
|
2344
|
+
{
|
|
2345
|
+
className: `rfp-root ${i ?? ""}`,
|
|
2346
|
+
style: { width: a, height: n, ...s },
|
|
2347
|
+
"data-theme": _,
|
|
2348
|
+
children: /* @__PURE__ */ d("div", { className: "rfp-relative rfp-w-full rfp-h-full rfp-overflow-hidden rfp-bg-surface-overlay", children: /* @__PURE__ */ d(
|
|
2349
|
+
re,
|
|
2350
|
+
{
|
|
2351
|
+
mode: "embed",
|
|
2352
|
+
files: e,
|
|
2353
|
+
currentIndex: t,
|
|
2354
|
+
onNavigate: r,
|
|
2355
|
+
customRenderers: o,
|
|
2356
|
+
locale: l,
|
|
2357
|
+
messages: c,
|
|
2358
|
+
headless: p,
|
|
2359
|
+
theme: f,
|
|
2360
|
+
onCustomEvent: m,
|
|
2361
|
+
requestInit: u,
|
|
2362
|
+
requestHandler: g,
|
|
2363
|
+
shouldFetchAsBlob: v,
|
|
2364
|
+
onDownload: C,
|
|
2365
|
+
onClose: x,
|
|
2366
|
+
showDownload: w
|
|
2367
|
+
}
|
|
2368
|
+
) })
|
|
2369
|
+
}
|
|
2370
|
+
);
|
|
2371
|
+
};
|
|
2372
|
+
function Dr(e) {
|
|
2373
|
+
gt(Ae, e);
|
|
2374
|
+
}
|
|
2375
|
+
const Ur = Be.version;
|
|
2376
|
+
export {
|
|
2377
|
+
Cr as A,
|
|
2378
|
+
br as C,
|
|
2379
|
+
_r as D,
|
|
2380
|
+
qe as F,
|
|
2381
|
+
Tr as G,
|
|
2382
|
+
jr as I,
|
|
2383
|
+
Nt as L,
|
|
2384
|
+
xr as M,
|
|
2385
|
+
kr as N,
|
|
2386
|
+
yr as P,
|
|
2387
|
+
Nr as R,
|
|
2388
|
+
vr as S,
|
|
2389
|
+
Fr as T,
|
|
2390
|
+
Pr as U,
|
|
2391
|
+
Ur as V,
|
|
2392
|
+
Ve as W,
|
|
2393
|
+
Et as a,
|
|
2394
|
+
Mr as b,
|
|
2395
|
+
G as c,
|
|
2396
|
+
re as d,
|
|
2397
|
+
Sr as e,
|
|
2398
|
+
Lr as f,
|
|
2399
|
+
Dr as g,
|
|
2400
|
+
Er as h,
|
|
2401
|
+
zr as i,
|
|
2402
|
+
Rr as q,
|
|
2403
|
+
ve as u,
|
|
2404
|
+
hr as v,
|
|
2405
|
+
Oe as w,
|
|
2406
|
+
gr as y,
|
|
2407
|
+
wr as z
|
|
2408
|
+
};
|
|
2409
|
+
//# sourceMappingURL=index-DreA69iU.mjs.map
|