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