@eternalheart/vue-file-preview 1.3.6 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/FilePreviewContent.vue.d.ts.map +1 -1
  2. package/lib/FilePreviewEmbed.vue.d.ts.map +1 -1
  3. package/lib/FilePreviewModal.vue.d.ts.map +1 -1
  4. package/lib/chunks/index-BI0dSTSM.mjs +77 -0
  5. package/lib/chunks/index-BI0dSTSM.mjs.map +1 -0
  6. package/lib/chunks/index-BW61ZRev.mjs +111 -0
  7. package/lib/chunks/index-BW61ZRev.mjs.map +1 -0
  8. package/lib/chunks/index-C8ZF84WX.mjs +113 -0
  9. package/lib/chunks/index-C8ZF84WX.mjs.map +1 -0
  10. package/lib/chunks/index-CB0zCxJb.mjs +353 -0
  11. package/lib/chunks/index-CB0zCxJb.mjs.map +1 -0
  12. package/lib/chunks/index-CBCQs1ZC.mjs +116 -0
  13. package/lib/chunks/index-CBCQs1ZC.mjs.map +1 -0
  14. package/lib/chunks/index-CbKSdAt_.mjs +391 -0
  15. package/lib/chunks/index-CbKSdAt_.mjs.map +1 -0
  16. package/lib/chunks/index-CcJ5NmY1.mjs +152 -0
  17. package/lib/chunks/index-CcJ5NmY1.mjs.map +1 -0
  18. package/lib/chunks/index-ClxBxmPR.mjs +249 -0
  19. package/lib/chunks/index-ClxBxmPR.mjs.map +1 -0
  20. package/lib/chunks/index-D9lByoJw.mjs +111 -0
  21. package/lib/chunks/index-D9lByoJw.mjs.map +1 -0
  22. package/lib/chunks/index-DTLDLOGO.mjs +129 -0
  23. package/lib/chunks/index-DTLDLOGO.mjs.map +1 -0
  24. package/lib/chunks/index-DUUsS_T4.mjs +134 -0
  25. package/lib/chunks/index-DUUsS_T4.mjs.map +1 -0
  26. package/lib/chunks/index-Doy0FvQW.mjs +136 -0
  27. package/lib/chunks/index-Doy0FvQW.mjs.map +1 -0
  28. package/lib/chunks/index-DpAxU2JM.mjs +2017 -0
  29. package/lib/chunks/index-DpAxU2JM.mjs.map +1 -0
  30. package/lib/chunks/index-DsznjwsH.mjs +103 -0
  31. package/lib/chunks/index-DsznjwsH.mjs.map +1 -0
  32. package/lib/chunks/index-SAfVQyNJ.mjs +281 -0
  33. package/lib/chunks/index-SAfVQyNJ.mjs.map +1 -0
  34. package/lib/chunks/index-S_kGRh6H.mjs +203 -0
  35. package/lib/chunks/index-S_kGRh6H.mjs.map +1 -0
  36. package/lib/chunks/index-kBPb_OKm.mjs +139 -0
  37. package/lib/chunks/index-kBPb_OKm.mjs.map +1 -0
  38. package/lib/chunks/index-yMb1JUC4.mjs +84 -0
  39. package/lib/chunks/index-yMb1JUC4.mjs.map +1 -0
  40. package/lib/composables/useResolvedTheme.d.ts +15 -0
  41. package/lib/composables/useResolvedTheme.d.ts.map +1 -0
  42. package/lib/index.cjs +24 -499
  43. package/lib/index.cjs.map +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.mjs +12 -44597
  46. package/lib/index.mjs.map +1 -1
  47. package/lib/renderers/Audio/index.vue.d.ts.map +1 -1
  48. package/lib/renderers/Csv/index.vue.d.ts.map +1 -1
  49. package/lib/renderers/Json/index.vue.d.ts.map +1 -1
  50. package/lib/renderers/Markdown/index.vue.d.ts.map +1 -1
  51. package/lib/renderers/Pptx/index.vue.d.ts.map +1 -1
  52. package/lib/renderers/RendererLoading.vue.d.ts +3 -0
  53. package/lib/renderers/RendererLoading.vue.d.ts.map +1 -0
  54. package/lib/renderers/Text/index.vue.d.ts.map +1 -1
  55. package/lib/renderers/Video/index.vue.d.ts.map +1 -1
  56. package/lib/renderers/Xlsx/index.vue.d.ts.map +1 -1
  57. package/lib/renderers/Xml/index.vue.d.ts.map +1 -1
  58. package/lib/renderers/Zip/index.vue.d.ts.map +1 -1
  59. package/lib/renderers/lazy.d.ts +19 -0
  60. package/lib/renderers/lazy.d.ts.map +1 -0
  61. package/package.json +1 -1
@@ -0,0 +1,391 @@
1
+ import { ref as p, watch as z, onUnmounted as D, defineComponent as U, toRef as O, computed as $, onMounted as q, onBeforeUnmount as H, unref as t, openBlock as b, createElementBlock as I, createElementVNode as a, toDisplayString as G, normalizeStyle as M, createStaticVNode as W, normalizeClass as A, createVNode as C, createBlock as R, resolveDynamicComponent as X, Transition as J, withCtx as K, createCommentVNode as Q } from "vue";
2
+ import { VolumeX as Y, Volume1 as Z, Volume2 as ee, Repeat as te, SkipBack as ae, Pause as re, Play as ne, SkipForward as oe } from "lucide-vue-next";
3
+ import { f as se, u as le, _ as ie } from "./index-DpAxU2JM.mjs";
4
+ function pe(x) {
5
+ const f = p(null), m = p(!1), o = p(!0), h = p(0), d = p(0), y = p(1), u = p(!1), v = p(!1), c = p(null);
6
+ let l = null;
7
+ const w = () => {
8
+ const e = f.value;
9
+ if (!e) return;
10
+ o.value = !0, c.value = null;
11
+ const n = () => {
12
+ isNaN(e.currentTime) || (h.value = e.currentTime);
13
+ }, s = () => {
14
+ !isNaN(e.duration) && isFinite(e.duration) && (d.value = e.duration);
15
+ }, g = () => {
16
+ o.value = !1, s();
17
+ }, T = () => {
18
+ o.value = !0;
19
+ }, V = () => {
20
+ o.value = !1, m.value = !0;
21
+ }, k = () => {
22
+ m.value = !0;
23
+ }, _ = () => {
24
+ m.value = !1;
25
+ }, L = () => {
26
+ m.value = !1;
27
+ }, E = () => {
28
+ c.value = "音频加载失败", o.value = !1;
29
+ };
30
+ e.addEventListener("timeupdate", n), e.addEventListener("loadedmetadata", s), e.addEventListener("durationchange", s), e.addEventListener("canplay", g), e.addEventListener("waiting", T), e.addEventListener("playing", V), e.addEventListener("play", k), e.addEventListener("pause", _), e.addEventListener("ended", L), e.addEventListener("error", E), e.readyState >= 3 ? (o.value = !1, s()) : e.readyState >= 1 && s(), l = () => {
31
+ e.removeEventListener("timeupdate", n), e.removeEventListener("loadedmetadata", s), e.removeEventListener("durationchange", s), e.removeEventListener("canplay", g), e.removeEventListener("waiting", T), e.removeEventListener("playing", V), e.removeEventListener("play", k), e.removeEventListener("pause", _), e.removeEventListener("ended", L), e.removeEventListener("error", E);
32
+ };
33
+ };
34
+ return z(
35
+ x,
36
+ () => {
37
+ l == null || l(), l = null, requestAnimationFrame(() => w());
38
+ },
39
+ { flush: "post" }
40
+ ), z(
41
+ f,
42
+ (e) => {
43
+ e && w();
44
+ },
45
+ { flush: "post" }
46
+ ), D(() => {
47
+ l == null || l(), l = null;
48
+ }), {
49
+ audioRef: f,
50
+ isPlaying: m,
51
+ isLoading: o,
52
+ isLoop: v,
53
+ currentTime: h,
54
+ duration: d,
55
+ volume: y,
56
+ isMuted: u,
57
+ error: c,
58
+ togglePlay: () => {
59
+ const e = f.value;
60
+ e && (e.paused ? e.play().catch(() => {
61
+ }) : e.pause());
62
+ },
63
+ seek: (e) => {
64
+ const n = f.value;
65
+ n && (n.currentTime = e, h.value = e);
66
+ },
67
+ skip: (e) => {
68
+ const n = f.value;
69
+ n && (n.currentTime = Math.max(
70
+ 0,
71
+ Math.min(n.currentTime + e, n.duration || 1 / 0)
72
+ ));
73
+ },
74
+ setVolume: (e) => {
75
+ const n = f.value;
76
+ if (!n) return;
77
+ const s = Math.max(0, Math.min(1, e));
78
+ n.volume = s, y.value = s, s > 0 && (n.muted = !1, u.value = !1);
79
+ },
80
+ toggleMute: () => {
81
+ const e = f.value;
82
+ e && (e.muted = !e.muted, u.value = e.muted);
83
+ },
84
+ toggleLoop: () => {
85
+ const e = f.value;
86
+ if (!e) return;
87
+ const n = !e.loop;
88
+ e.loop = n, v.value = n;
89
+ },
90
+ formatTime: se
91
+ };
92
+ }
93
+ const fe = {
94
+ key: 0,
95
+ class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
96
+ }, de = { class: "vfp-text-fg-secondary vfp-text-center" }, ve = { class: "vfp-text-lg" }, ce = {
97
+ key: 1,
98
+ class: "vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 md:vfp-p-8 vfp-gap-5 md:vfp-gap-8 vfp-select-none"
99
+ }, ue = {
100
+ class: "vfp-relative",
101
+ style: { width: "260px", height: "240px" }
102
+ }, me = { class: "vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4" }, ge = { class: "vfp-text-lg md:vfp-text-xl vfp-font-medium vfp-mb-1 vfp-truncate vfp-text-fg-primary" }, be = {
103
+ class: "vfp-w-full vfp-max-w-sm md:vfp-max-w-md vfp-rounded-2xl vfp-p-4 md:vfp-p-6 vfp-border vfp-bg-surface-1 vfp-border-line-weak",
104
+ style: { backdropFilter: "blur(16px)" }
105
+ }, xe = { class: "vfp-mb-5" }, he = { class: "vfp-relative vfp-h-4 vfp-flex vfp-items-center" }, ye = ["max", "value", "disabled", "aria-label"], we = { class: "vfp-flex vfp-justify-between vfp-text-xs vfp-mt-2.5 vfp-text-fg-tertiary" }, ke = { style: { "font-variant-numeric": "tabular-nums" } }, _e = { style: { "font-variant-numeric": "tabular-nums" } }, Le = { class: "vfp-flex vfp-items-center vfp-justify-center vfp-gap-3" }, Ee = ["aria-label"], Ge = ["aria-label"], Me = ["aria-label"], Te = ["aria-label"], Ve = ["aria-label"], Ce = {
106
+ class: "vfp-flex vfp-flex-col vfp-items-center vfp-gap-2",
107
+ style: { height: "100px" }
108
+ }, Pe = {
109
+ class: "vfp-relative vfp-flex vfp-items-center vfp-justify-center",
110
+ style: { width: "24px", height: "80px" }
111
+ }, Se = ["value", "aria-label"], je = { class: "vfp-text-[10px] vfp-tabular-nums vfp-text-fg-tertiary" }, Ne = ["src"], Ie = /* @__PURE__ */ U({
112
+ __name: "index",
113
+ props: {
114
+ url: {},
115
+ fileName: {}
116
+ },
117
+ setup(x) {
118
+ const m = O(x, "url"), { t: o } = le(), {
119
+ audioRef: h,
120
+ isPlaying: d,
121
+ isLoop: y,
122
+ currentTime: u,
123
+ duration: v,
124
+ volume: c,
125
+ isMuted: l,
126
+ error: w,
127
+ togglePlay: P,
128
+ seek: F,
129
+ skip: S,
130
+ setVolume: B,
131
+ toggleMute: j,
132
+ toggleLoop: N,
133
+ formatTime: e
134
+ } = pe(m), n = p(!1);
135
+ let s = null;
136
+ const g = p(null), T = $(() => v.value > 0 ? u.value / v.value : 0), V = $(() => l.value || c.value === 0 ? Y : c.value < 0.5 ? Z : ee), k = (E) => {
137
+ g.value && !g.value.contains(E.target) && (n.value = !1);
138
+ };
139
+ q(() => {
140
+ document.addEventListener("mousedown", k);
141
+ }), H(() => {
142
+ document.removeEventListener("mousedown", k), s !== null && clearTimeout(s);
143
+ });
144
+ const _ = () => {
145
+ s !== null && clearTimeout(s), n.value = !0;
146
+ }, L = () => {
147
+ s = window.setTimeout(() => {
148
+ n.value = !1;
149
+ }, 300);
150
+ };
151
+ return (E, r) => t(w) ? (b(), I("div", fe, [
152
+ a("div", de, [
153
+ a("p", ve, G(t(w)), 1)
154
+ ])
155
+ ])) : (b(), I("div", ce, [
156
+ a("div", ue, [
157
+ a("div", {
158
+ class: "vfp-absolute vfp-rounded-full",
159
+ style: M({
160
+ width: "220px",
161
+ height: "220px",
162
+ top: "18px",
163
+ left: "8px",
164
+ background: "radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)",
165
+ opacity: t(d) ? 0.7 : 0.2,
166
+ transition: "opacity 0.5s"
167
+ })
168
+ }, null, 4),
169
+ a("div", {
170
+ class: "vfp-absolute vfp-rounded-full vfp-overflow-hidden",
171
+ style: M({
172
+ width: "200px",
173
+ height: "200px",
174
+ top: "28px",
175
+ left: "18px",
176
+ background: `
177
+ radial-gradient(circle at center, transparent 95%, rgba(30,30,30,0.8) 95.5%, #111 97%),
178
+ radial-gradient(circle at center, transparent 38%, rgba(50,50,50,0.5) 38.15%, transparent 38.4%),
179
+ radial-gradient(circle at center, transparent 45%, rgba(50,50,50,0.3) 45.15%, transparent 45.4%),
180
+ radial-gradient(circle at center, transparent 52%, rgba(50,50,50,0.5) 52.15%, transparent 52.4%),
181
+ radial-gradient(circle at center, transparent 59%, rgba(50,50,50,0.3) 59.15%, transparent 59.4%),
182
+ radial-gradient(circle at center, transparent 66%, rgba(50,50,50,0.5) 66.15%, transparent 66.4%),
183
+ radial-gradient(circle at center, transparent 73%, rgba(50,50,50,0.3) 73.15%, transparent 73.4%),
184
+ radial-gradient(circle at center, transparent 80%, rgba(50,50,50,0.4) 80.15%, transparent 80.4%),
185
+ radial-gradient(circle at center, transparent 87%, rgba(50,50,50,0.3) 87.15%, transparent 87.4%),
186
+ conic-gradient(from 0deg, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c, #212121, #1a1a1a, #252525, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c)
187
+ `,
188
+ boxShadow: t(d) ? "0 0 36px rgba(129,140,248,0.1), 0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)" : "0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)",
189
+ animation: "vfp-vinyl-spin 8s linear infinite",
190
+ animationPlayState: t(d) ? "running" : "paused"
191
+ })
192
+ }, [...r[7] || (r[7] = [
193
+ a("div", {
194
+ class: "vfp-absolute vfp-rounded-full",
195
+ style: {
196
+ width: "34%",
197
+ height: "34%",
198
+ top: "33%",
199
+ left: "33%",
200
+ background: "radial-gradient(circle at 40% 38%, #818cf8, #6366f1, #4f46e5, #4338ca)",
201
+ boxShadow: "inset 0 1px 3px rgba(255,255,255,0.25), inset 0 -1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.3)"
202
+ }
203
+ }, [
204
+ a("div", {
205
+ class: "vfp-absolute vfp-rounded-full",
206
+ style: {
207
+ width: "14%",
208
+ height: "14%",
209
+ top: "43%",
210
+ left: "43%",
211
+ background: "radial-gradient(circle at 40% 40%, #333, #0d0d0d)",
212
+ boxShadow: "inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)"
213
+ }
214
+ })
215
+ ], -1)
216
+ ])], 4),
217
+ a("div", {
218
+ class: "vfp-absolute",
219
+ style: M({
220
+ top: "-6px",
221
+ right: "2px",
222
+ width: "100px",
223
+ height: "120px",
224
+ transformOrigin: "76px 16px",
225
+ zIndex: 5,
226
+ transform: t(d) ? "rotate(16deg)" : "rotate(0deg)",
227
+ transition: "transform 0.8s cubic-bezier(0.4, 0, 0.2, 1)"
228
+ })
229
+ }, [...r[8] || (r[8] = [
230
+ W('<svg width="100" height="120" viewBox="0 0 100 120" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-e903bc52><circle cx="76" cy="16" r="13" fill="rgba(0,0,0,0.3)" data-v-e903bc52></circle><circle cx="76" cy="16" r="11" fill="url(#vfp-baseGrad)" data-v-e903bc52></circle><circle cx="76" cy="16" r="6" fill="url(#vfp-baseInnerGrad)" data-v-e903bc52></circle><circle cx="76" cy="16" r="2.5" fill="#222" stroke="#555" stroke-width="0.5" data-v-e903bc52></circle><path d="M74 22 L56 88" stroke="url(#vfp-armGrad)" stroke-width="3.5" stroke-linecap="round" data-v-e903bc52></path><rect x="50" y="86" width="12" height="7" rx="1.5" fill="url(#vfp-headGrad)" data-v-e903bc52></rect><rect x="52.5" y="92" width="7" height="9" rx="1" fill="url(#vfp-cartridgeGrad)" data-v-e903bc52></rect><line x1="56" y1="101" x2="56" y2="105" stroke="#bbb" stroke-width="1.2" stroke-linecap="round" data-v-e903bc52></line><circle cx="56" cy="105.5" r="0.8" fill="#ddd" data-v-e903bc52></circle><defs data-v-e903bc52><radialGradient id="vfp-baseGrad" cx="40%" cy="35%" data-v-e903bc52><stop offset="0%" stop-color="#555" data-v-e903bc52></stop><stop offset="100%" stop-color="#1a1a1a" data-v-e903bc52></stop></radialGradient><radialGradient id="vfp-baseInnerGrad" cx="40%" cy="35%" data-v-e903bc52><stop offset="0%" stop-color="#666" data-v-e903bc52></stop><stop offset="100%" stop-color="#333" data-v-e903bc52></stop></radialGradient><linearGradient id="vfp-armGrad" x1="0" y1="0" x2="0" y2="1" data-v-e903bc52><stop offset="0%" stop-color="#555" data-v-e903bc52></stop><stop offset="50%" stop-color="#444" data-v-e903bc52></stop><stop offset="100%" stop-color="#333" data-v-e903bc52></stop></linearGradient><linearGradient id="vfp-headGrad" x1="0" y1="0" x2="0" y2="1" data-v-e903bc52><stop offset="0%" stop-color="#555" data-v-e903bc52></stop><stop offset="100%" stop-color="#333" data-v-e903bc52></stop></linearGradient><linearGradient id="vfp-cartridgeGrad" x1="0" y1="0" x2="0" y2="1" data-v-e903bc52><stop offset="0%" stop-color="#444" data-v-e903bc52></stop><stop offset="100%" stop-color="#222" data-v-e903bc52></stop></linearGradient></defs></svg>', 1)
231
+ ])], 4)
232
+ ]),
233
+ a("div", me, [
234
+ a("div", ge, G(x.fileName), 1),
235
+ r[9] || (r[9] = a("p", { class: "vfp-text-xs vfp-tracking-widest vfp-uppercase vfp-text-accent" }, "Audio", -1))
236
+ ]),
237
+ a("div", be, [
238
+ a("div", xe, [
239
+ a("div", he, [
240
+ r[10] || (r[10] = a("div", { class: "vfp-absolute vfp-w-full vfp-h-[5px] vfp-rounded-full vfp-bg-surface-2" }, null, -1)),
241
+ a("div", {
242
+ class: "vfp-absolute vfp-h-[5px] vfp-rounded-full vfp-pointer-events-none",
243
+ style: M({
244
+ width: `${T.value * 100}%`,
245
+ background: "linear-gradient(90deg, var(--fp-accent), var(--fp-accent-hover))",
246
+ boxShadow: t(d) ? "0 0 8px rgba(129,140,248,0.4)" : "none",
247
+ transition: "width 0.1s linear"
248
+ })
249
+ }, null, 4),
250
+ a("input", {
251
+ type: "range",
252
+ min: "0",
253
+ max: t(v) > 0 ? t(v) : t(u) || 100,
254
+ step: "any",
255
+ value: t(u),
256
+ disabled: t(v) <= 0,
257
+ "aria-label": t(o)("audio.aria.progress"),
258
+ class: "audio-slider vfp-absolute vfp-w-full",
259
+ onInput: r[0] || (r[0] = (i) => t(F)(parseFloat(i.target.value)))
260
+ }, null, 40, ye)
261
+ ]),
262
+ a("div", we, [
263
+ a("span", ke, G(t(e)(t(u))), 1),
264
+ a("span", _e, G(t(v) > 0 ? t(e)(t(v)) : "--:--"), 1)
265
+ ])
266
+ ]),
267
+ a("div", Le, [
268
+ a("button", {
269
+ class: A([
270
+ "vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn",
271
+ t(y) ? "vfp-bg-accent-soft vfp-text-accent" : "vfp-bg-surface-2 vfp-text-fg-tertiary"
272
+ ]),
273
+ "aria-label": t(y) ? t(o)("audio.aria.loop_off") : t(o)("audio.aria.loop_on"),
274
+ onClick: r[1] || (r[1] = //@ts-ignore
275
+ (...i) => t(N) && t(N)(...i))
276
+ }, [
277
+ C(t(te), { class: "vfp-w-4 vfp-h-4" })
278
+ ], 10, Ee),
279
+ a("button", {
280
+ class: "vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn vfp-bg-surface-2 vfp-text-fg-secondary",
281
+ "aria-label": t(o)("audio.aria.backward_10"),
282
+ onClick: r[2] || (r[2] = (i) => t(S)(-10))
283
+ }, [
284
+ C(t(ae), { class: "vfp-w-[18px] vfp-h-[18px]" })
285
+ ], 8, Ge),
286
+ a("button", {
287
+ class: "vfp-w-14 vfp-h-14 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center audio-ctrl-btn",
288
+ style: {
289
+ background: "linear-gradient(135deg, var(--fp-accent-hover), var(--fp-accent))",
290
+ color: "#fff",
291
+ boxShadow: "0 4px 20px rgba(99,102,241,0.35)"
292
+ },
293
+ "aria-label": t(d) ? t(o)("audio.aria.pause") : t(o)("audio.aria.play"),
294
+ onClick: r[3] || (r[3] = //@ts-ignore
295
+ (...i) => t(P) && t(P)(...i))
296
+ }, [
297
+ t(d) ? (b(), R(t(re), {
298
+ key: 0,
299
+ class: "vfp-w-6 vfp-h-6"
300
+ })) : (b(), R(t(ne), {
301
+ key: 1,
302
+ class: "vfp-w-6 vfp-h-6 vfp-ml-0.5"
303
+ }))
304
+ ], 8, Me),
305
+ a("button", {
306
+ class: "vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn vfp-bg-surface-2 vfp-text-fg-secondary",
307
+ "aria-label": t(o)("audio.aria.forward_10"),
308
+ onClick: r[4] || (r[4] = (i) => t(S)(10))
309
+ }, [
310
+ C(t(oe), { class: "vfp-w-[18px] vfp-h-[18px]" })
311
+ ], 8, Te),
312
+ a("div", {
313
+ ref_key: "volumeRef",
314
+ ref: g,
315
+ class: "vfp-relative",
316
+ onMouseenter: _,
317
+ onMouseleave: L
318
+ }, [
319
+ a("button", {
320
+ class: A([
321
+ "vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn",
322
+ n.value ? "vfp-bg-accent-soft vfp-text-accent" : "vfp-bg-surface-2 vfp-text-fg-secondary"
323
+ ]),
324
+ "aria-label": t(l) ? t(o)("audio.aria.unmute") : t(o)("audio.aria.mute"),
325
+ onClick: r[5] || (r[5] = //@ts-ignore
326
+ (...i) => t(j) && t(j)(...i))
327
+ }, [
328
+ (b(), R(X(V.value), { class: "vfp-w-4 vfp-h-4" }))
329
+ ], 10, Ve),
330
+ C(J, { name: "vfp-fade" }, {
331
+ default: K(() => [
332
+ n.value ? (b(), I("div", {
333
+ key: 0,
334
+ class: "vfp-absolute vfp-bottom-full vfp-mb-2 vfp-rounded-xl vfp-p-3 vfp-border vfp-bg-surface-3 vfp-border-line",
335
+ style: {
336
+ left: "50%",
337
+ marginLeft: "-27px",
338
+ backdropFilter: "blur(16px)"
339
+ },
340
+ onMouseenter: _,
341
+ onMouseleave: L
342
+ }, [
343
+ a("div", Ce, [
344
+ a("div", Pe, [
345
+ r[11] || (r[11] = a("div", {
346
+ class: "vfp-absolute vfp-rounded-full vfp-bg-surface-2",
347
+ style: { width: "3px", height: "100%" }
348
+ }, null, -1)),
349
+ a("div", {
350
+ class: "vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none",
351
+ style: M({
352
+ width: "3px",
353
+ height: `${(t(l) ? 0 : t(c)) * 100}%`,
354
+ background: "var(--fp-accent-hover)",
355
+ transition: "height 0.1s linear"
356
+ })
357
+ }, null, 4),
358
+ a("input", {
359
+ type: "range",
360
+ min: "0",
361
+ max: "1",
362
+ step: "0.01",
363
+ value: t(l) ? 0 : t(c),
364
+ "aria-label": t(o)("audio.aria.volume"),
365
+ class: "volume-slider-vertical vfp-absolute",
366
+ style: { width: "80px", height: "24px", transform: "rotate(-90deg)", "transform-origin": "center center" },
367
+ onInput: r[6] || (r[6] = (i) => t(B)(parseFloat(i.target.value)))
368
+ }, null, 40, Se)
369
+ ]),
370
+ a("span", je, G(Math.round((t(l) ? 0 : t(c)) * 100)), 1)
371
+ ])
372
+ ], 32)) : Q("", !0)
373
+ ]),
374
+ _: 1
375
+ })
376
+ ], 544)
377
+ ])
378
+ ]),
379
+ a("audio", {
380
+ ref_key: "audioRef",
381
+ ref: h,
382
+ src: x.url,
383
+ class: "vfp-hidden"
384
+ }, null, 8, Ne)
385
+ ]));
386
+ }
387
+ }), ze = /* @__PURE__ */ ie(Ie, [["__scopeId", "data-v-e903bc52"]]);
388
+ export {
389
+ ze as default
390
+ };
391
+ //# sourceMappingURL=index-CbKSdAt_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CbKSdAt_.mjs","sources":["../../src/composables/useAudioPlayer.ts","../../src/renderers/Audio/index.vue"],"sourcesContent":["import { ref, watch, onUnmounted, type Ref } from 'vue';\nimport { formatTime } from '@eternalheart/file-preview-core';\n\n/**\n * Vue 3 版本的音频播放器 composable\n * 与 React 版的 useAudioPlayer 行为对齐\n */\nexport function useAudioPlayer(url: Ref<string>) {\n const audioRef = ref<HTMLAudioElement | null>(null);\n const isPlaying = ref(false);\n const isLoading = ref(true);\n const currentTime = ref(0);\n const duration = ref(0);\n const volume = ref(1);\n const isMuted = ref(false);\n const isLoop = ref(false);\n const error = ref<string | null>(null);\n\n let cleanup: (() => void) | null = null;\n\n const bindEvents = () => {\n const audio = audioRef.value;\n if (!audio) return;\n\n isLoading.value = true;\n error.value = null;\n\n const onTimeUpdate = () => {\n if (!isNaN(audio.currentTime)) {\n currentTime.value = audio.currentTime;\n }\n };\n\n const onDurationChange = () => {\n if (!isNaN(audio.duration) && isFinite(audio.duration)) {\n duration.value = audio.duration;\n }\n };\n\n const onCanPlay = () => {\n isLoading.value = false;\n onDurationChange();\n };\n\n const onWaiting = () => {\n isLoading.value = true;\n };\n const onPlaying = () => {\n isLoading.value = false;\n isPlaying.value = true;\n };\n\n const onPlay = () => {\n isPlaying.value = true;\n };\n const onPause = () => {\n isPlaying.value = false;\n };\n const onEnded = () => {\n isPlaying.value = false;\n };\n\n const onError = () => {\n error.value = '音频加载失败';\n isLoading.value = false;\n };\n\n audio.addEventListener('timeupdate', onTimeUpdate);\n audio.addEventListener('loadedmetadata', onDurationChange);\n audio.addEventListener('durationchange', onDurationChange);\n audio.addEventListener('canplay', onCanPlay);\n audio.addEventListener('waiting', onWaiting);\n audio.addEventListener('playing', onPlaying);\n audio.addEventListener('play', onPlay);\n audio.addEventListener('pause', onPause);\n audio.addEventListener('ended', onEnded);\n audio.addEventListener('error', onError);\n\n if (audio.readyState >= 3) {\n isLoading.value = false;\n onDurationChange();\n } else if (audio.readyState >= 1) {\n onDurationChange();\n }\n\n cleanup = () => {\n audio.removeEventListener('timeupdate', onTimeUpdate);\n audio.removeEventListener('loadedmetadata', onDurationChange);\n audio.removeEventListener('durationchange', onDurationChange);\n audio.removeEventListener('canplay', onCanPlay);\n audio.removeEventListener('waiting', onWaiting);\n audio.removeEventListener('playing', onPlaying);\n audio.removeEventListener('play', onPlay);\n audio.removeEventListener('pause', onPause);\n audio.removeEventListener('ended', onEnded);\n audio.removeEventListener('error', onError);\n };\n };\n\n // url 变化时重新绑定\n watch(\n url,\n () => {\n cleanup?.();\n cleanup = null;\n // 等待 DOM 更新(audio src 变化)\n requestAnimationFrame(() => bindEvents());\n },\n { flush: 'post' }\n );\n\n // 在 audioRef 挂载后首次绑定\n watch(\n audioRef,\n (el) => {\n if (el) bindEvents();\n },\n { flush: 'post' }\n );\n\n onUnmounted(() => {\n cleanup?.();\n cleanup = null;\n });\n\n const togglePlay = () => {\n const audio = audioRef.value;\n if (!audio) return;\n if (audio.paused) {\n audio.play().catch(() => {});\n } else {\n audio.pause();\n }\n };\n\n const seek = (time: number) => {\n const audio = audioRef.value;\n if (!audio) return;\n audio.currentTime = time;\n currentTime.value = time;\n };\n\n const skip = (seconds: number) => {\n const audio = audioRef.value;\n if (!audio) return;\n audio.currentTime = Math.max(\n 0,\n Math.min(audio.currentTime + seconds, audio.duration || Infinity)\n );\n };\n\n const setVolume = (vol: number) => {\n const audio = audioRef.value;\n if (!audio) return;\n const clamped = Math.max(0, Math.min(1, vol));\n audio.volume = clamped;\n volume.value = clamped;\n if (clamped > 0) {\n audio.muted = false;\n isMuted.value = false;\n }\n };\n\n const toggleMute = () => {\n const audio = audioRef.value;\n if (!audio) return;\n audio.muted = !audio.muted;\n isMuted.value = audio.muted;\n };\n\n const toggleLoop = () => {\n const audio = audioRef.value;\n if (!audio) return;\n const next = !audio.loop;\n audio.loop = next;\n isLoop.value = next;\n };\n\n return {\n audioRef,\n isPlaying,\n isLoading,\n isLoop,\n currentTime,\n duration,\n volume,\n isMuted,\n error,\n togglePlay,\n seek,\n skip,\n setVolume,\n toggleMute,\n toggleLoop,\n formatTime,\n };\n}\n","<script setup lang=\"ts\">\nimport { ref, computed, onMounted, onBeforeUnmount, toRef } from 'vue';\nimport { Play, Pause, Volume2, VolumeX, Volume1, SkipBack, SkipForward, Repeat } from 'lucide-vue-next';\nimport { useAudioPlayer } from '../../composables/useAudioPlayer';\nimport { useTranslator } from '../../composables/useTranslator';\n\nconst props = defineProps<{\n url: string;\n fileName: string;\n}>();\n\nconst urlRef = toRef(props, 'url');\n\nconst { t } = useTranslator();\n\nconst {\n audioRef,\n isPlaying,\n isLoop,\n currentTime,\n duration,\n volume,\n isMuted,\n error,\n togglePlay,\n seek,\n skip,\n setVolume,\n toggleMute,\n toggleLoop,\n formatTime,\n} = useAudioPlayer(urlRef);\n\nconst showVolume = ref(false);\nlet volumeHideTimer: number | null = null;\nconst volumeRef = ref<HTMLDivElement | null>(null);\n\nconst progress = computed(() => (duration.value > 0 ? currentTime.value / duration.value : 0));\n\nconst VolumeIcon = computed(() => {\n if (isMuted.value || volume.value === 0) return VolumeX;\n if (volume.value < 0.5) return Volume1;\n return Volume2;\n});\n\nconst handleClickOutside = (e: MouseEvent) => {\n if (volumeRef.value && !volumeRef.value.contains(e.target as Node)) {\n showVolume.value = false;\n }\n};\n\nonMounted(() => {\n document.addEventListener('mousedown', handleClickOutside);\n});\n\nonBeforeUnmount(() => {\n document.removeEventListener('mousedown', handleClickOutside);\n if (volumeHideTimer !== null) clearTimeout(volumeHideTimer);\n});\n\nconst handleVolumeEnter = () => {\n if (volumeHideTimer !== null) clearTimeout(volumeHideTimer);\n showVolume.value = true;\n};\n\nconst handleVolumeLeave = () => {\n volumeHideTimer = window.setTimeout(() => {\n showVolume.value = false;\n }, 300);\n};\n</script>\n\n<template>\n <div v-if=\"error\" class=\"vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full\">\n <div class=\"vfp-text-fg-secondary vfp-text-center\">\n <p class=\"vfp-text-lg\">{{ error }}</p>\n </div>\n </div>\n\n <div\n v-else\n class=\"vfp-flex vfp-flex-col vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 md:vfp-p-8 vfp-gap-5 md:vfp-gap-8 vfp-select-none\"\n >\n <!-- 唱片机 -->\n <div class=\"vfp-relative\" style=\"width: 260px; height: 240px\">\n <!-- 外圈光晕 -->\n <div\n class=\"vfp-absolute vfp-rounded-full\"\n :style=\"{\n width: '220px',\n height: '220px',\n top: '18px',\n left: '8px',\n background: 'radial-gradient(circle, rgba(129,140,248,0.12) 0%, transparent 70%)',\n opacity: isPlaying ? 0.7 : 0.2,\n transition: 'opacity 0.5s',\n }\"\n />\n\n <!-- 唱片主体 -->\n <div\n class=\"vfp-absolute vfp-rounded-full vfp-overflow-hidden\"\n :style=\"{\n width: '200px',\n height: '200px',\n top: '28px',\n left: '18px',\n background: `\n radial-gradient(circle at center, transparent 95%, rgba(30,30,30,0.8) 95.5%, #111 97%),\n radial-gradient(circle at center, transparent 38%, rgba(50,50,50,0.5) 38.15%, transparent 38.4%),\n radial-gradient(circle at center, transparent 45%, rgba(50,50,50,0.3) 45.15%, transparent 45.4%),\n radial-gradient(circle at center, transparent 52%, rgba(50,50,50,0.5) 52.15%, transparent 52.4%),\n radial-gradient(circle at center, transparent 59%, rgba(50,50,50,0.3) 59.15%, transparent 59.4%),\n radial-gradient(circle at center, transparent 66%, rgba(50,50,50,0.5) 66.15%, transparent 66.4%),\n radial-gradient(circle at center, transparent 73%, rgba(50,50,50,0.3) 73.15%, transparent 73.4%),\n radial-gradient(circle at center, transparent 80%, rgba(50,50,50,0.4) 80.15%, transparent 80.4%),\n radial-gradient(circle at center, transparent 87%, rgba(50,50,50,0.3) 87.15%, transparent 87.4%),\n conic-gradient(from 0deg, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c, #212121, #1a1a1a, #252525, #1c1c1c, #232323, #1a1a1a, #262626, #1c1c1c)\n `,\n boxShadow: isPlaying\n ? '0 0 36px rgba(129,140,248,0.1), 0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)'\n : '0 8px 32px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.4)',\n animation: 'vfp-vinyl-spin 8s linear infinite',\n animationPlayState: isPlaying ? 'running' : 'paused',\n }\"\n >\n <!-- 中心标签 -->\n <div\n class=\"vfp-absolute vfp-rounded-full\"\n :style=\"{\n width: '34%',\n height: '34%',\n top: '33%',\n left: '33%',\n background: 'radial-gradient(circle at 40% 38%, #818cf8, #6366f1, #4f46e5, #4338ca)',\n boxShadow: 'inset 0 1px 3px rgba(255,255,255,0.25), inset 0 -1px 3px rgba(0,0,0,0.3), 0 0 8px rgba(0,0,0,0.3)',\n }\"\n >\n <div\n class=\"vfp-absolute vfp-rounded-full\"\n :style=\"{\n width: '14%',\n height: '14%',\n top: '43%',\n left: '43%',\n background: 'radial-gradient(circle at 40% 40%, #333, #0d0d0d)',\n boxShadow: 'inset 0 1px 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.5)',\n }\"\n />\n </div>\n </div>\n\n <!-- 唱臂 -->\n <div\n class=\"vfp-absolute\"\n :style=\"{\n top: '-6px',\n right: '2px',\n width: '100px',\n height: '120px',\n transformOrigin: '76px 16px',\n zIndex: 5,\n transform: isPlaying ? 'rotate(16deg)' : 'rotate(0deg)',\n transition: 'transform 0.8s cubic-bezier(0.4, 0, 0.2, 1)',\n }\"\n >\n <svg width=\"100\" height=\"120\" viewBox=\"0 0 100 120\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"76\" cy=\"16\" r=\"13\" fill=\"rgba(0,0,0,0.3)\" />\n <circle cx=\"76\" cy=\"16\" r=\"11\" fill=\"url(#vfp-baseGrad)\" />\n <circle cx=\"76\" cy=\"16\" r=\"6\" fill=\"url(#vfp-baseInnerGrad)\" />\n <circle cx=\"76\" cy=\"16\" r=\"2.5\" fill=\"#222\" stroke=\"#555\" stroke-width=\"0.5\" />\n <path d=\"M74 22 L56 88\" stroke=\"url(#vfp-armGrad)\" stroke-width=\"3.5\" stroke-linecap=\"round\" />\n <rect x=\"50\" y=\"86\" width=\"12\" height=\"7\" rx=\"1.5\" fill=\"url(#vfp-headGrad)\" />\n <rect x=\"52.5\" y=\"92\" width=\"7\" height=\"9\" rx=\"1\" fill=\"url(#vfp-cartridgeGrad)\" />\n <line x1=\"56\" y1=\"101\" x2=\"56\" y2=\"105\" stroke=\"#bbb\" stroke-width=\"1.2\" stroke-linecap=\"round\" />\n <circle cx=\"56\" cy=\"105.5\" r=\"0.8\" fill=\"#ddd\" />\n\n <defs>\n <radialGradient id=\"vfp-baseGrad\" cx=\"40%\" cy=\"35%\">\n <stop offset=\"0%\" stop-color=\"#555\" />\n <stop offset=\"100%\" stop-color=\"#1a1a1a\" />\n </radialGradient>\n <radialGradient id=\"vfp-baseInnerGrad\" cx=\"40%\" cy=\"35%\">\n <stop offset=\"0%\" stop-color=\"#666\" />\n <stop offset=\"100%\" stop-color=\"#333\" />\n </radialGradient>\n <linearGradient id=\"vfp-armGrad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stop-color=\"#555\" />\n <stop offset=\"50%\" stop-color=\"#444\" />\n <stop offset=\"100%\" stop-color=\"#333\" />\n </linearGradient>\n <linearGradient id=\"vfp-headGrad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stop-color=\"#555\" />\n <stop offset=\"100%\" stop-color=\"#333\" />\n </linearGradient>\n <linearGradient id=\"vfp-cartridgeGrad\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stop-color=\"#444\" />\n <stop offset=\"100%\" stop-color=\"#222\" />\n </linearGradient>\n </defs>\n </svg>\n </div>\n </div>\n\n <!-- 文件名 -->\n <div class=\"vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4\">\n <div class=\"vfp-text-lg md:vfp-text-xl vfp-font-medium vfp-mb-1 vfp-truncate vfp-text-fg-primary\">\n {{ fileName }}\n </div>\n <p class=\"vfp-text-xs vfp-tracking-widest vfp-uppercase vfp-text-accent\">Audio</p>\n </div>\n\n <!-- 控制面板 -->\n <div\n class=\"vfp-w-full vfp-max-w-sm md:vfp-max-w-md vfp-rounded-2xl vfp-p-4 md:vfp-p-6 vfp-border vfp-bg-surface-1 vfp-border-line-weak\"\n :style=\"{ backdropFilter: 'blur(16px)' }\"\n >\n <!-- 进度条 -->\n <div class=\"vfp-mb-5\">\n <div class=\"vfp-relative vfp-h-4 vfp-flex vfp-items-center\">\n <div\n class=\"vfp-absolute vfp-w-full vfp-h-[5px] vfp-rounded-full vfp-bg-surface-2\"\n />\n <div\n class=\"vfp-absolute vfp-h-[5px] vfp-rounded-full vfp-pointer-events-none\"\n :style=\"{\n width: `${progress * 100}%`,\n background: 'linear-gradient(90deg, var(--fp-accent), var(--fp-accent-hover))',\n boxShadow: isPlaying ? '0 0 8px rgba(129,140,248,0.4)' : 'none',\n transition: 'width 0.1s linear',\n }\"\n />\n <input\n type=\"range\"\n min=\"0\"\n :max=\"duration > 0 ? duration : currentTime || 100\"\n step=\"any\"\n :value=\"currentTime\"\n :disabled=\"duration <= 0\"\n :aria-label=\"t('audio.aria.progress')\"\n class=\"audio-slider vfp-absolute vfp-w-full\"\n @input=\"(e) => seek(parseFloat((e.target as HTMLInputElement).value))\"\n />\n </div>\n <div\n class=\"vfp-flex vfp-justify-between vfp-text-xs vfp-mt-2.5 vfp-text-fg-tertiary\"\n >\n <span style=\"font-variant-numeric: tabular-nums\">{{ formatTime(currentTime) }}</span>\n <span style=\"font-variant-numeric: tabular-nums\">{{ duration > 0 ? formatTime(duration) : '--:--' }}</span>\n </div>\n </div>\n\n <!-- 控制按钮 -->\n <div class=\"vfp-flex vfp-items-center vfp-justify-center vfp-gap-3\">\n <!-- 循环 -->\n <button\n :class=\"[\n 'vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn',\n isLoop ? 'vfp-bg-accent-soft vfp-text-accent' : 'vfp-bg-surface-2 vfp-text-fg-tertiary',\n ]\"\n :aria-label=\"isLoop ? t('audio.aria.loop_off') : t('audio.aria.loop_on')\"\n @click=\"toggleLoop\"\n >\n <Repeat class=\"vfp-w-4 vfp-h-4\" />\n </button>\n\n <!-- 后退 -->\n <button\n class=\"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn vfp-bg-surface-2 vfp-text-fg-secondary\"\n :aria-label=\"t('audio.aria.backward_10')\"\n @click=\"skip(-10)\"\n >\n <SkipBack class=\"vfp-w-[18px] vfp-h-[18px]\" />\n </button>\n\n <!-- 播放/暂停 -->\n <button\n class=\"vfp-w-14 vfp-h-14 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center audio-ctrl-btn\"\n :style=\"{\n background: 'linear-gradient(135deg, var(--fp-accent-hover), var(--fp-accent))',\n color: '#fff',\n boxShadow: '0 4px 20px rgba(99,102,241,0.35)',\n }\"\n :aria-label=\"isPlaying ? t('audio.aria.pause') : t('audio.aria.play')\"\n @click=\"togglePlay\"\n >\n <Pause v-if=\"isPlaying\" class=\"vfp-w-6 vfp-h-6\" />\n <Play v-else class=\"vfp-w-6 vfp-h-6 vfp-ml-0.5\" />\n </button>\n\n <!-- 前进 -->\n <button\n class=\"vfp-w-10 vfp-h-10 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn vfp-bg-surface-2 vfp-text-fg-secondary\"\n :aria-label=\"t('audio.aria.forward_10')\"\n @click=\"skip(10)\"\n >\n <SkipForward class=\"vfp-w-[18px] vfp-h-[18px]\" />\n </button>\n\n <!-- 音量 -->\n <div ref=\"volumeRef\" class=\"vfp-relative\" @mouseenter=\"handleVolumeEnter\" @mouseleave=\"handleVolumeLeave\">\n <button\n :class=\"[\n 'vfp-w-9 vfp-h-9 vfp-rounded-full vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors audio-ctrl-btn',\n showVolume ? 'vfp-bg-accent-soft vfp-text-accent' : 'vfp-bg-surface-2 vfp-text-fg-secondary',\n ]\"\n :aria-label=\"isMuted ? t('audio.aria.unmute') : t('audio.aria.mute')\"\n @click=\"toggleMute\"\n >\n <component :is=\"VolumeIcon\" class=\"vfp-w-4 vfp-h-4\" />\n </button>\n\n <Transition name=\"vfp-fade\">\n <div\n v-if=\"showVolume\"\n class=\"vfp-absolute vfp-bottom-full vfp-mb-2 vfp-rounded-xl vfp-p-3 vfp-border vfp-bg-surface-3 vfp-border-line\"\n :style=\"{\n left: '50%',\n marginLeft: '-27px',\n backdropFilter: 'blur(16px)',\n }\"\n @mouseenter=\"handleVolumeEnter\"\n @mouseleave=\"handleVolumeLeave\"\n >\n <div class=\"vfp-flex vfp-flex-col vfp-items-center vfp-gap-2\" style=\"height: 100px\">\n <div\n class=\"vfp-relative vfp-flex vfp-items-center vfp-justify-center\"\n style=\"width: 24px; height: 80px\"\n >\n <div\n class=\"vfp-absolute vfp-rounded-full vfp-bg-surface-2\"\n style=\"width: 3px; height: 100%\"\n />\n <div\n class=\"vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none\"\n :style=\"{\n width: '3px',\n height: `${(isMuted ? 0 : volume) * 100}%`,\n background: 'var(--fp-accent-hover)',\n transition: 'height 0.1s linear',\n }\"\n />\n <input\n type=\"range\"\n min=\"0\"\n max=\"1\"\n step=\"0.01\"\n :value=\"isMuted ? 0 : volume\"\n :aria-label=\"t('audio.aria.volume')\"\n class=\"volume-slider-vertical vfp-absolute\"\n style=\"width: 80px; height: 24px; transform: rotate(-90deg); transform-origin: center center\"\n @input=\"(e) => setVolume(parseFloat((e.target as HTMLInputElement).value))\"\n />\n </div>\n <span class=\"vfp-text-[10px] vfp-tabular-nums vfp-text-fg-tertiary\">\n {{ Math.round((isMuted ? 0 : volume) * 100) }}\n </span>\n </div>\n </div>\n </Transition>\n </div>\n </div>\n </div>\n\n <audio ref=\"audioRef\" :src=\"url\" class=\"vfp-hidden\" />\n </div>\n</template>\n\n<style scoped>\n.audio-ctrl-btn {\n border: 0;\n cursor: pointer;\n}\n</style>\n"],"names":["useAudioPlayer","url","audioRef","ref","isPlaying","isLoading","currentTime","duration","volume","isMuted","isLoop","error","cleanup","bindEvents","audio","onTimeUpdate","onDurationChange","onCanPlay","onWaiting","onPlaying","onPlay","onPause","onEnded","onError","watch","el","onUnmounted","time","seconds","vol","clamped","next","formatTime","urlRef","toRef","__props","t","useTranslator","togglePlay","seek","skip","setVolume","toggleMute","toggleLoop","showVolume","volumeHideTimer","volumeRef","progress","computed","VolumeIcon","VolumeX","Volume1","Volume2","handleClickOutside","e","onMounted","onBeforeUnmount","handleVolumeEnter","handleVolumeLeave","_unref","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_normalizeStyle","_hoisted_6","_hoisted_7","_cache","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_normalizeClass","args","_createVNode","Repeat","SkipBack","_createBlock","Pause","Play","SkipForward","_resolveDynamicComponent","_Transition","_hoisted_21","_hoisted_22","_hoisted_24"],"mappings":";;;AAOO,SAASA,GAAeC,GAAkB;AAC/C,QAAMC,IAAWC,EAA6B,IAAI,GAC5CC,IAAYD,EAAI,EAAK,GACrBE,IAAYF,EAAI,EAAI,GACpBG,IAAcH,EAAI,CAAC,GACnBI,IAAWJ,EAAI,CAAC,GAChBK,IAASL,EAAI,CAAC,GACdM,IAAUN,EAAI,EAAK,GACnBO,IAASP,EAAI,EAAK,GAClBQ,IAAQR,EAAmB,IAAI;AAErC,MAAIS,IAA+B;AAEnC,QAAMC,IAAa,MAAM;AACvB,UAAMC,IAAQZ,EAAS;AACvB,QAAI,CAACY,EAAO;AAEZ,IAAAT,EAAU,QAAQ,IAClBM,EAAM,QAAQ;AAEd,UAAMI,IAAe,MAAM;AACzB,MAAK,MAAMD,EAAM,WAAW,MAC1BR,EAAY,QAAQQ,EAAM;AAAA,IAE9B,GAEME,IAAmB,MAAM;AAC7B,MAAI,CAAC,MAAMF,EAAM,QAAQ,KAAK,SAASA,EAAM,QAAQ,MACnDP,EAAS,QAAQO,EAAM;AAAA,IAE3B,GAEMG,IAAY,MAAM;AACtB,MAAAZ,EAAU,QAAQ,IAClBW,EAAA;AAAA,IACF,GAEME,IAAY,MAAM;AACtB,MAAAb,EAAU,QAAQ;AAAA,IACpB,GACMc,IAAY,MAAM;AACtB,MAAAd,EAAU,QAAQ,IAClBD,EA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,EAAAlD,CAAA,IAAO,IAAOkD,EAAAnD,CAAA;AAAA,wBACrB,cAAYmD,EAAAvB,CAAA,EAAC,mBAAA;AAAA,wBACd,OAAM;AAAA,wBACN,OAAA,EAAA,OAAA,QAAA,QAAA,QAAA,WAAA,kBAAA,oBAAA,gBAAA;AAAA,wBACC,SAAKoC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAGlB,MAAMK,EAAAlB,CAAA,EAAU,WAAYa,EAAE,OAA4B,KAAK,CAAA;AAAA,sBAAA;;oBAG5ES,EAEO,QAFP8B,IAEO3B,EADF,KAAK,OAAOP,EAAAlD,CAAA,IAAO,IAAOkD,EAAAnD,CAAA,KAAM,GAAA,CAAA,GAAA,CAAA;AAAA,kBAAA;;;;;;;;MASjDuD,EAAsD,SAAA;AAAA,iBAA3C;AAAA,QAAJ,KAAI7D;AAAA,QAAY,KAAKiC,EAAA;AAAA,QAAK,OAAM;AAAA,MAAA;;;;"}
@@ -0,0 +1,152 @@
1
+ import { defineComponent as C, ref as y, onMounted as P, watch as W, onBeforeUnmount as R, openBlock as g, createElementBlock as b, createElementVNode as f, toDisplayString as E, unref as T, createCommentVNode as k, createVNode as j, normalizeStyle as L } from "vue";
2
+ import { Presentation as N } from "lucide-vue-next";
3
+ import { init as D } from "pptx-preview";
4
+ import { u as S } from "./index-DpAxU2JM.mjs";
5
+ const V = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, q = {
6
+ key: 0,
7
+ class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
8
+ }, A = { class: "vfp-text-center" }, F = { class: "vfp-text-xs md:vfp-text-sm vfp-text-fg-secondary vfp-font-medium" }, H = {
9
+ key: 1,
10
+ class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
11
+ }, I = { class: "vfp-text-center vfp-max-w-sm md:vfp-max-w-md vfp-px-4" }, O = { class: "vfp-w-24 vfp-h-24 md:vfp-w-32 md:vfp-h-32 vfp-mx-auto vfp-mb-4 md:vfp-mb-6 vfp-rounded-2xl md:vfp-rounded-3xl vfp-bg-gradient-to-br vfp-from-orange-500 vfp-via-red-500 vfp-to-pink-500 vfp-flex vfp-items-center vfp-justify-center vfp-shadow-2xl" }, U = { class: "vfp-text-lg md:vfp-text-xl vfp-text-fg-primary vfp-mb-2 md:vfp-mb-3 vfp-font-medium" }, $ = { class: "vfp-text-xs md:vfp-text-sm vfp-text-fg-tertiary vfp-mb-4 md:vfp-mb-6" }, G = ["href"], Y = /* @__PURE__ */ C({
12
+ __name: "index",
13
+ props: {
14
+ url: {},
15
+ tiled: { type: Boolean, default: !0 }
16
+ },
17
+ setup(M) {
18
+ const a = M, { t: l } = S(), s = y(!0), p = y(null), c = y(0), r = y(null);
19
+ let o = null, m = null, d = null, u = null, h = { width: 0, height: 0 };
20
+ const w = () => {
21
+ var v;
22
+ if (!r.value) return { width: 960, height: 540 };
23
+ const t = r.value.clientWidth, e = ((v = r.value.parentElement) == null ? void 0 : v.clientWidth) || 0, i = t > 100 ? t : e > 100 ? e : 300, n = Math.floor(i * 9 / 16);
24
+ return { width: i, height: n };
25
+ }, B = async () => {
26
+ if (!(!r.value || !d || c.value === 0))
27
+ try {
28
+ if (o)
29
+ try {
30
+ o.destroy();
31
+ } catch {
32
+ }
33
+ r.value.innerHTML = "";
34
+ const t = w();
35
+ o = D(r.value, {
36
+ width: t.width,
37
+ height: a.tiled ? t.height * c.value : t.height,
38
+ mode: a.tiled ? "list" : "slide"
39
+ }), await o.preview(d);
40
+ } catch {
41
+ }
42
+ }, z = async () => {
43
+ if (!r.value) return;
44
+ s.value = !0, p.value = null;
45
+ let t = window.setTimeout(() => {
46
+ p.value = l.value("pptx.timeout"), s.value = !1;
47
+ }, 3e4);
48
+ try {
49
+ const e = await fetch(a.url, {
50
+ mode: "cors",
51
+ credentials: "omit",
52
+ redirect: "follow"
53
+ });
54
+ if (!e.ok)
55
+ throw e.status === 404 ? new Error(l.value("pptx.not_found")) : e.status === 403 ? new Error("无权限访问此文件") : e.status >= 500 ? new Error("服务器错误,请稍后重试") : new Error(`文件加载失败 (${e.status})`);
56
+ const i = await e.arrayBuffer();
57
+ if (i.byteLength === 0) throw new Error("文件为空");
58
+ d = i;
59
+ const n = document.createElement("div");
60
+ n.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden", document.body.appendChild(n);
61
+ try {
62
+ const v = D(n, {
63
+ width: 100,
64
+ height: 100,
65
+ mode: "slide"
66
+ });
67
+ try {
68
+ await v.preview(i);
69
+ } catch {
70
+ throw new Error(l.value("pptx.invalid_format"));
71
+ }
72
+ const x = v.slideCount;
73
+ if (!x || x === 0) throw new Error(l.value("pptx.no_pages"));
74
+ v.destroy(), c.value = x, r.value && (r.value.innerHTML = "");
75
+ const _ = w();
76
+ o = D(r.value, {
77
+ width: _.width,
78
+ height: a.tiled ? _.height * x : _.height,
79
+ mode: a.tiled ? "list" : "slide"
80
+ }), await o.preview(i), t !== null && (clearTimeout(t), t = null), s.value = !1;
81
+ } finally {
82
+ document.body.contains(n) && document.body.removeChild(n);
83
+ }
84
+ } catch (e) {
85
+ t !== null && clearTimeout(t);
86
+ let i = l.value("pptx.parse_failed");
87
+ e instanceof Error ? i = e.message : typeof e == "string" && (i = e), p.value = i, s.value = !1;
88
+ }
89
+ };
90
+ return P(() => {
91
+ if (!r.value) return;
92
+ let t = !0;
93
+ m = new ResizeObserver(() => {
94
+ if (t) {
95
+ t = !1, h = w();
96
+ return;
97
+ }
98
+ const e = w(), i = Math.abs(h.width - e.width), n = Math.abs(h.height - e.height);
99
+ i < 10 && n < 10 || (h = e, u !== null && clearTimeout(u), u = window.setTimeout(() => {
100
+ o && d && B();
101
+ }, 800));
102
+ }), m.observe(r.value), setTimeout(() => {
103
+ requestAnimationFrame(() => requestAnimationFrame(() => z()));
104
+ }, 150);
105
+ }), W(
106
+ () => a.url,
107
+ () => {
108
+ z();
109
+ }
110
+ ), R(() => {
111
+ if (m && m.disconnect(), u !== null && clearTimeout(u), d = null, c.value = 0, o)
112
+ try {
113
+ o.destroy();
114
+ } catch {
115
+ }
116
+ o = null;
117
+ }), (t, e) => (g(), b("div", V, [
118
+ s.value ? (g(), b("div", q, [
119
+ f("div", A, [
120
+ e[0] || (e[0] = f("div", { class: "vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)),
121
+ f("p", F, E(T(l)("pptx.loading")), 1)
122
+ ])
123
+ ])) : k("", !0),
124
+ p.value && !s.value ? (g(), b("div", H, [
125
+ f("div", I, [
126
+ f("div", O, [
127
+ j(T(N), { class: "vfp-w-12 vfp-h-12 md:vfp-w-16 md:vfp-h-16 vfp-text-fg-primary" })
128
+ ]),
129
+ f("p", U, E(T(l)("pptx.load_failed")), 1),
130
+ f("p", $, E(p.value), 1),
131
+ f("a", {
132
+ href: M.url,
133
+ download: "",
134
+ class: "vfp-inline-flex vfp-items-center vfp-gap-2 vfp-px-4 vfp-py-2 md:vfp-px-6 md:vfp-py-3 vfp-bg-gradient-to-r vfp-from-purple-500 vfp-to-pink-500 vfp-text-fg-primary vfp-text-sm md:vfp-text-base vfp-rounded-lg md:vfp-rounded-xl hover:vfp-scale-105 vfp-transition-all vfp-shadow-lg"
135
+ }, " 下载文件 ", 8, G),
136
+ e[1] || (e[1] = f("p", { class: "vfp-text-xs vfp-text-fg-muted vfp-mt-3 md:vfp-mt-4" }, " 提示:可以使用 Microsoft PowerPoint 或 WPS 打开 ", -1))
137
+ ])
138
+ ])) : k("", !0),
139
+ p.value ? k("", !0) : (g(), b("div", {
140
+ key: 2,
141
+ ref_key: "containerRef",
142
+ ref: r,
143
+ class: "pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",
144
+ style: L({ opacity: s.value ? 0 : 1 })
145
+ }, null, 4))
146
+ ]));
147
+ }
148
+ });
149
+ export {
150
+ Y as default
151
+ };
152
+ //# sourceMappingURL=index-CcJ5NmY1.mjs.map