@lazycatcloud/vue-media-preview 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/MediaPreview.vue.d.ts +2 -2
- package/dist/components/PreviewStage.vue.d.ts +5 -2
- package/dist/core/rendering/image.d.ts +17 -0
- package/dist/core/resources/bitmap/client.d.ts +4 -0
- package/dist/core/resources/bitmap/decode.worker.d.ts +1 -0
- package/dist/core/resources/bitmap/types.d.ts +14 -0
- package/dist/core/resources/imageLimits.d.ts +1 -1
- package/dist/core/resources/imageOwnership.d.ts +8 -0
- package/dist/core/resources/imageRequest.d.ts +1 -1
- package/dist/core/resources/imageResource.d.ts +11 -0
- package/dist/core/resources/imageStore.d.ts +3 -0
- package/dist/core/resources/imageTransport.d.ts +4 -4
- package/dist/core/resources/validation/image.d.ts +13 -0
- package/dist/core/video/source/session.d.ts +8 -0
- package/dist/core/video/source/types.d.ts +8 -0
- package/dist/core/video/timeline/buffered.d.ts +12 -0
- package/dist/core/video/timeline/index.d.ts +15 -0
- package/dist/core/video/timeline/time.d.ts +3 -0
- package/dist/core/video/useVideoPlayback.d.ts +22 -6
- package/dist/core/video/useVideoSource.d.ts +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/renderers/ImageCanvasRenderer.vue.d.ts +12 -3
- package/dist/renderers/LivePhotoRenderer.vue.d.ts +2 -2
- package/dist/renderers/VideoDomRenderer.vue.d.ts +23 -7
- package/dist/vue-media-preview.cjs +2 -1
- package/dist/vue-media-preview.css +1 -1
- package/dist/vue-media-preview.js +1719 -1443
- package/docs/testing.md +12 -2
- package/docs/vue-media-preview.md +24 -8
- package/package.json +1 -1
|
@@ -1,95 +1,124 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var Ht = (t, n, o) => n in t ? Yt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
|
+
var at = (t, n, o) => Ht(t, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
+
import { ref as L, onMounted as qe, watch as J, onBeforeUnmount as Fe, shallowRef as pt, reactive as ht, computed as Y, defineComponent as $e, nextTick as we, openBlock as O, createElementBlock as V, Fragment as Le, createElementVNode as T, createCommentVNode as re, withModifiers as ae, unref as g, normalizeClass as Ie, normalizeStyle as Se, mergeProps as Ne, toHandlers as vt, createVNode as De, renderList as Ze, createTextVNode as Xt, toDisplayString as de, withKeys as it, createBlock as rt, Teleport as $t, resolveDynamicComponent as Wt, useAttrs as Nt, getCurrentInstance as Zt, withDirectives as jt, vShow as Kt, renderSlot as ft } from "vue";
|
|
5
|
+
function _e(t) {
|
|
6
|
+
return t instanceof Error ? t : new Error(String(t));
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
function Gt(t) {
|
|
9
|
+
let n = 0, o = () => {
|
|
10
|
+
};
|
|
11
|
+
function e() {
|
|
12
|
+
n += 1;
|
|
13
|
+
const i = o;
|
|
14
|
+
o = () => {
|
|
15
|
+
}, i();
|
|
16
|
+
}
|
|
17
|
+
function a() {
|
|
18
|
+
e(), t.reset();
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
clear: a,
|
|
22
|
+
dispose: e,
|
|
23
|
+
start(i, l, r) {
|
|
24
|
+
a();
|
|
25
|
+
const u = n;
|
|
26
|
+
o = r(
|
|
27
|
+
i,
|
|
28
|
+
l,
|
|
29
|
+
(v) => {
|
|
30
|
+
u === n && t.error(v);
|
|
31
|
+
},
|
|
32
|
+
(v) => {
|
|
33
|
+
u === n && t.duration(v);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const lt = (t, n) => (t.src = n.videoSrc || n.src, () => {
|
|
40
|
+
t.removeAttribute("src"), t.load();
|
|
10
41
|
});
|
|
11
|
-
function
|
|
12
|
-
const i =
|
|
13
|
-
let
|
|
14
|
-
}, r = () => {
|
|
42
|
+
function Tt(t, n, o, e, a) {
|
|
43
|
+
const i = L(0), l = Gt(a);
|
|
44
|
+
let r = () => {
|
|
15
45
|
};
|
|
16
|
-
return
|
|
17
|
-
r =
|
|
18
|
-
() => [
|
|
46
|
+
return qe(() => {
|
|
47
|
+
r = J(
|
|
48
|
+
() => [n().id, n().src, n().videoSrc, o(), e(), i.value],
|
|
19
49
|
() => {
|
|
20
|
-
|
|
21
|
-
}, e() && (s = n()(a(), t(), o));
|
|
50
|
+
o() ? l.start(t(), n(), e()) : l.clear();
|
|
22
51
|
},
|
|
23
52
|
{ immediate: !0, flush: "post" }
|
|
24
53
|
);
|
|
25
|
-
}),
|
|
26
|
-
r(),
|
|
54
|
+
}), Fe(() => {
|
|
55
|
+
r(), l.dispose();
|
|
27
56
|
}), () => i.value++;
|
|
28
57
|
}
|
|
29
|
-
function
|
|
30
|
-
return Math.min(Math.max(
|
|
58
|
+
function K(t, n, o) {
|
|
59
|
+
return Math.min(Math.max(t, n), o);
|
|
31
60
|
}
|
|
32
|
-
function
|
|
33
|
-
return Number(
|
|
61
|
+
function bt(t, n = 2) {
|
|
62
|
+
return Number(t.toFixed(n));
|
|
34
63
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
64
|
+
function Qt(t, n) {
|
|
65
|
+
return t.width <= 0 || t.height <= 0 || n.width <= 0 || n.height <= 0 ? 1 : Math.min(n.width / t.width, n.height / t.height);
|
|
37
66
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
return
|
|
67
|
+
function kt(t) {
|
|
68
|
+
const n = (t % 360 + 360) % 360;
|
|
69
|
+
return n === 90 || n === 180 || n === 270 ? n : 0;
|
|
41
70
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
71
|
+
function Jt(t, n) {
|
|
72
|
+
return n === 90 || n === 270 ? { width: t.height, height: t.width } : t;
|
|
44
73
|
}
|
|
45
|
-
function
|
|
46
|
-
return `translate3d(${
|
|
74
|
+
function en(t, n, o) {
|
|
75
|
+
return `translate3d(${bt(t)}px, ${bt(n)}px, 0) scale3d(${o}, ${o}, 1)`;
|
|
47
76
|
}
|
|
48
|
-
function
|
|
49
|
-
return 1 - (1 -
|
|
77
|
+
function tn(t) {
|
|
78
|
+
return 1 - (1 - t) ** 3;
|
|
50
79
|
}
|
|
51
|
-
function
|
|
52
|
-
return Math.hypot(
|
|
80
|
+
function We(t, n) {
|
|
81
|
+
return Math.hypot(t.x - n.x, t.y - n.y);
|
|
53
82
|
}
|
|
54
|
-
function
|
|
55
|
-
return { x: (
|
|
83
|
+
function xt(t, n) {
|
|
84
|
+
return { x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 };
|
|
56
85
|
}
|
|
57
|
-
function
|
|
58
|
-
return Math.hypot(
|
|
86
|
+
function nn(t, n, o) {
|
|
87
|
+
return Math.hypot(t, n) < 9 ? "pending" : o > 1.01 ? "pan" : Math.abs(t) > Math.abs(n) * 1.1 ? "page" : n > 0 && Math.abs(n) > Math.abs(t) * 1.1 ? "dismiss" : "pending";
|
|
59
88
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
89
|
+
function an(t, n) {
|
|
90
|
+
return t.deltaMode === 1 ? 2 ** (-t.deltaY * 0.05) : t.deltaMode === 2 ? 2 ** -t.deltaY : n || Math.abs(t.deltaY) >= 40 ? 2 ** (-t.deltaY * 2e-3) : Math.exp(-t.deltaY * 8e-3);
|
|
62
91
|
}
|
|
63
|
-
function
|
|
64
|
-
let
|
|
65
|
-
function
|
|
66
|
-
const
|
|
67
|
-
|
|
92
|
+
function on(t, n, o = 650) {
|
|
93
|
+
let e = { kind: "idle" };
|
|
94
|
+
function a() {
|
|
95
|
+
const l = e;
|
|
96
|
+
e = { kind: "idle" }, l.kind === "pending" && clearTimeout(l.timer), l.kind === "active" && n();
|
|
68
97
|
}
|
|
69
98
|
function i() {
|
|
70
|
-
|
|
99
|
+
a(), e = {
|
|
71
100
|
kind: "pending",
|
|
72
101
|
timer: setTimeout(() => {
|
|
73
|
-
|
|
74
|
-
},
|
|
102
|
+
e = { kind: "active" }, t();
|
|
103
|
+
}, o)
|
|
75
104
|
};
|
|
76
105
|
}
|
|
77
|
-
return { arm: i, cancel:
|
|
106
|
+
return { arm: i, cancel: a };
|
|
78
107
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
return { offsetX:
|
|
108
|
+
function rn(t, n, o) {
|
|
109
|
+
const e = K(t, -n, n);
|
|
110
|
+
return { offsetX: e, pageOffset: o ? t - e : 0 };
|
|
82
111
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
112
|
+
function ln(t = {}) {
|
|
113
|
+
const n = {
|
|
85
114
|
motionActive: () => !1,
|
|
86
115
|
onTap: () => {
|
|
87
116
|
},
|
|
88
117
|
onDoubleTap: () => {
|
|
89
118
|
},
|
|
90
|
-
onScale: (
|
|
119
|
+
onScale: (d) => {
|
|
91
120
|
},
|
|
92
|
-
onSwipeDownProgress: (
|
|
121
|
+
onSwipeDownProgress: (d) => {
|
|
93
122
|
},
|
|
94
123
|
onSwipeDownClose: () => {
|
|
95
124
|
},
|
|
@@ -97,10 +126,10 @@ function Gt(a = {}) {
|
|
|
97
126
|
},
|
|
98
127
|
onSwipeRight: () => {
|
|
99
128
|
},
|
|
100
|
-
onPageDrag: (
|
|
129
|
+
onPageDrag: (d) => {
|
|
101
130
|
},
|
|
102
|
-
onPageRelease: (
|
|
103
|
-
Math.abs(
|
|
131
|
+
onPageRelease: (d, F) => {
|
|
132
|
+
Math.abs(d) < 60 || (d < 0 ? n.onSwipeLeft() : n.onSwipeRight());
|
|
104
133
|
},
|
|
105
134
|
interactive: () => !0,
|
|
106
135
|
zoomable: () => !0,
|
|
@@ -111,8 +140,8 @@ function Gt(a = {}) {
|
|
|
111
140
|
},
|
|
112
141
|
onHoldEnd: () => {
|
|
113
142
|
},
|
|
114
|
-
...
|
|
115
|
-
},
|
|
143
|
+
...t
|
|
144
|
+
}, o = L(), e = L(), a = pt(), i = L({ width: 1, height: 1 }), l = L({ width: 1, height: 1 }), r = ht({
|
|
116
145
|
level: 1,
|
|
117
146
|
offsetX: 0,
|
|
118
147
|
offsetY: 0,
|
|
@@ -122,233 +151,288 @@ function Gt(a = {}) {
|
|
|
122
151
|
downOffsetX: 0,
|
|
123
152
|
downOffsetY: 0,
|
|
124
153
|
downScale: 1
|
|
125
|
-
}),
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
128
|
-
})),
|
|
129
|
-
transform:
|
|
130
|
-
})),
|
|
131
|
-
() => P.value ||
|
|
154
|
+
}), u = Y(() => Jt(l.value, r.rotation)), v = Y(() => Qt(u.value, i.value)), c = Y(() => v.value * r.level), M = Y(() => ({
|
|
155
|
+
width: u.value.width * c.value,
|
|
156
|
+
height: u.value.height * c.value
|
|
157
|
+
})), C = Y(() => ({
|
|
158
|
+
transform: en(r.downOffsetX, r.downOffsetY, r.downScale)
|
|
159
|
+
})), S = /* @__PURE__ */ new Set(), P = L(!1), k = L(!1), p = L(!1), $ = Y(
|
|
160
|
+
() => P.value || k.value || p.value || n.motionActive()
|
|
132
161
|
);
|
|
133
|
-
let I,
|
|
134
|
-
}, 0),
|
|
135
|
-
const
|
|
136
|
-
let
|
|
137
|
-
const q =
|
|
162
|
+
let I, y = 0, x = 0, m = setTimeout(() => {
|
|
163
|
+
}, 0), w = -1e3, R = { x: 0, y: 0 }, f = !1, h = "idle", D = !0, z = !1, A = 0;
|
|
164
|
+
const H = /* @__PURE__ */ new Map();
|
|
165
|
+
let j = { x: 0, y: 0 }, U = { x: 0, y: 0, time: 0 }, Pe = 0, ue = 0, ce = 0, ee = { left: 0, top: 0 }, Re = 1, Oe = { x: 0, y: 0 }, B = G();
|
|
166
|
+
const q = on(
|
|
138
167
|
() => {
|
|
139
|
-
|
|
168
|
+
h = "hold", clearTimeout(m), w = -1e3, n.onHoldStart();
|
|
140
169
|
},
|
|
141
|
-
() =>
|
|
142
|
-
), W = new ResizeObserver((
|
|
143
|
-
for (const F of
|
|
144
|
-
}),
|
|
145
|
-
(
|
|
146
|
-
}, te = (
|
|
147
|
-
q.cancel(),
|
|
148
|
-
},
|
|
170
|
+
() => n.onHoldEnd()
|
|
171
|
+
), W = new ResizeObserver((d) => {
|
|
172
|
+
for (const F of d) Q(F.contentRect);
|
|
173
|
+
}), Ee = /* @__PURE__ */ new Set(), Qe = (d) => {
|
|
174
|
+
(d.key === "Control" || d.key === "Meta") && Ee.add(d.key);
|
|
175
|
+
}, te = (d) => Ee.delete(d.key), ge = () => {
|
|
176
|
+
q.cancel(), Ee.clear();
|
|
177
|
+
}, Te = () => {
|
|
149
178
|
document.hidden && q.cancel();
|
|
150
179
|
};
|
|
151
|
-
|
|
152
|
-
W.observe(
|
|
153
|
-
}),
|
|
154
|
-
|
|
180
|
+
qe(() => {
|
|
181
|
+
W.observe(o.value), Q(o.value.getBoundingClientRect()), window.addEventListener("keydown", Qe), window.addEventListener("keyup", te), window.addEventListener("blur", ge), document.addEventListener("visibilitychange", Te);
|
|
182
|
+
}), Fe(() => {
|
|
183
|
+
f = !0, q.cancel(), window.removeEventListener("keydown", Qe), window.removeEventListener("keyup", te), window.removeEventListener("blur", ge), document.removeEventListener("visibilitychange", Te), W.disconnect(), cancelAnimationFrame(y), cancelAnimationFrame(x), clearTimeout(m), clearTimeout(I);
|
|
155
184
|
});
|
|
156
|
-
function
|
|
157
|
-
i.value = { width:
|
|
185
|
+
function Q(d) {
|
|
186
|
+
i.value = { width: d.width, height: d.height }, Object.assign(r, he(r.offsetX, r.offsetY, r.level)), pe();
|
|
158
187
|
}
|
|
159
188
|
function pe() {
|
|
160
|
-
|
|
161
|
-
|
|
189
|
+
f || y || (y = requestAnimationFrame(() => {
|
|
190
|
+
y = 0, S.forEach((d) => d());
|
|
162
191
|
}));
|
|
163
192
|
}
|
|
164
|
-
function
|
|
193
|
+
function G() {
|
|
165
194
|
return { level: r.level, offsetX: r.offsetX, offsetY: r.offsetY };
|
|
166
195
|
}
|
|
167
|
-
function
|
|
168
|
-
const
|
|
196
|
+
function he(d, F, X) {
|
|
197
|
+
const N = Math.max(
|
|
169
198
|
0,
|
|
170
|
-
(
|
|
171
|
-
),
|
|
199
|
+
(u.value.width * v.value * X - i.value.width) / 2
|
|
200
|
+
), ne = Math.max(
|
|
172
201
|
0,
|
|
173
|
-
(
|
|
202
|
+
(u.value.height * v.value * X - i.value.height) / 2
|
|
174
203
|
);
|
|
175
|
-
return { offsetX:
|
|
204
|
+
return { offsetX: K(d, -N, N), offsetY: K(F, -ne, ne) };
|
|
176
205
|
}
|
|
177
|
-
function me(
|
|
178
|
-
Object.assign(r,
|
|
206
|
+
function me(d) {
|
|
207
|
+
Object.assign(r, d), n.onScale(r.level), pe();
|
|
179
208
|
}
|
|
180
|
-
function xe(
|
|
181
|
-
cancelAnimationFrame(
|
|
182
|
-
const X =
|
|
183
|
-
const
|
|
209
|
+
function xe(d, F = 250) {
|
|
210
|
+
cancelAnimationFrame(x), P.value = !0;
|
|
211
|
+
const X = G(), N = performance.now(), ne = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : F, le = (ye) => {
|
|
212
|
+
const oe = ne === 0 ? 1 : K((ye - N) / ne, 0, 1), be = tn(oe);
|
|
184
213
|
me({
|
|
185
|
-
level: X.level + (
|
|
186
|
-
offsetX: X.offsetX + (
|
|
187
|
-
offsetY: X.offsetY + (
|
|
188
|
-
}),
|
|
214
|
+
level: X.level + (d.level - X.level) * be,
|
|
215
|
+
offsetX: X.offsetX + (d.offsetX - X.offsetX) * be,
|
|
216
|
+
offsetY: X.offsetY + (d.offsetY - X.offsetY) * be
|
|
217
|
+
}), oe < 1 ? x = requestAnimationFrame(le) : P.value = !1;
|
|
189
218
|
};
|
|
190
|
-
|
|
219
|
+
x = requestAnimationFrame(le);
|
|
191
220
|
}
|
|
192
|
-
function
|
|
221
|
+
function ie() {
|
|
193
222
|
return { x: i.value.width / 2, y: i.value.height / 2 };
|
|
194
223
|
}
|
|
195
|
-
function
|
|
196
|
-
if (!
|
|
197
|
-
cancelAnimationFrame(
|
|
198
|
-
const
|
|
199
|
-
F.x -
|
|
200
|
-
F.y -
|
|
201
|
-
|
|
202
|
-
),
|
|
203
|
-
X ? xe(
|
|
224
|
+
function ve(d, F = ie(), X = !1) {
|
|
225
|
+
if (!n.zoomable()) return;
|
|
226
|
+
cancelAnimationFrame(x), P.value = !1;
|
|
227
|
+
const N = K(d, 1, n.zoomLimit()), ne = N / r.level, le = ie(), ye = he(
|
|
228
|
+
F.x - le.x - (F.x - le.x - r.offsetX) * ne,
|
|
229
|
+
F.y - le.y - (F.y - le.y - r.offsetY) * ne,
|
|
230
|
+
N
|
|
231
|
+
), oe = { level: N, ...ye };
|
|
232
|
+
X ? xe(oe) : me(oe);
|
|
204
233
|
}
|
|
205
|
-
function
|
|
206
|
-
r.draggingDown = !1, r.downOffsetX = 0, r.downOffsetY = 0, r.downScale = 1,
|
|
234
|
+
function Ce() {
|
|
235
|
+
r.draggingDown = !1, r.downOffsetX = 0, r.downOffsetY = 0, r.downScale = 1, n.onSwipeDownProgress(0);
|
|
207
236
|
}
|
|
208
|
-
function Me(
|
|
209
|
-
|
|
237
|
+
function Me(d = !1) {
|
|
238
|
+
d && (cancelAnimationFrame(x), P.value = !1), q.cancel(), H.clear(), k.value = !1, p.value = !1, clearTimeout(I), h = "idle", A = 0, r.zooming = !1, d || (Ce(), n.onPageDrag(0)), clearTimeout(m), w = -1e3;
|
|
210
239
|
}
|
|
211
|
-
function
|
|
212
|
-
cancelAnimationFrame(
|
|
240
|
+
function Be(d = 0) {
|
|
241
|
+
cancelAnimationFrame(x), P.value = !1, Me();
|
|
213
242
|
const F = { level: 1, offsetX: 0, offsetY: 0 };
|
|
214
|
-
|
|
243
|
+
d > 0 && (r.level !== 1 || r.offsetX !== 0 || r.offsetY !== 0) ? xe(F, d) : me(F);
|
|
215
244
|
}
|
|
216
|
-
function
|
|
217
|
-
return { x:
|
|
245
|
+
function ze(d, F = ee) {
|
|
246
|
+
return { x: d.clientX - F.left, y: d.clientY - F.top };
|
|
218
247
|
}
|
|
219
248
|
function st() {
|
|
220
|
-
q.cancel(),
|
|
221
|
-
const [
|
|
222
|
-
|
|
249
|
+
q.cancel(), D = !1, z = !1, A = 0;
|
|
250
|
+
const [d, F] = [...H.values()];
|
|
251
|
+
Re = Math.max(1, We(d, F)), Oe = xt(d, F), B = G(), h = "pinch", r.zooming = !0, Ce(), n.onPageDrag(0), clearTimeout(m), w = -1e3;
|
|
223
252
|
}
|
|
224
|
-
function ut(
|
|
225
|
-
if (!
|
|
253
|
+
function ut(d, F = o.value.getBoundingClientRect()) {
|
|
254
|
+
if (!n.interactive() || d.pointerType === "mouse" && d.button !== 0)
|
|
226
255
|
return !1;
|
|
227
|
-
const X =
|
|
228
|
-
if (X.closest("button, input, a, select") || X instanceof HTMLVideoElement && X.controls &&
|
|
256
|
+
const X = d.target;
|
|
257
|
+
if (X.closest("button, input, a, select") || X instanceof HTMLVideoElement && X.controls && d.clientY > X.getBoundingClientRect().bottom - 48)
|
|
229
258
|
return !1;
|
|
230
|
-
if (cancelAnimationFrame(
|
|
259
|
+
if (cancelAnimationFrame(x), P.value = !1, k.value = !0, H.size === 0 && (ee = F), H.set(d.pointerId, ze(d)), o.value.setPointerCapture(d.pointerId), H.size >= 2)
|
|
231
260
|
return st(), !0;
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
return
|
|
235
|
-
}
|
|
236
|
-
function ct(
|
|
237
|
-
if (!
|
|
238
|
-
const F =
|
|
239
|
-
if (
|
|
240
|
-
if (!
|
|
241
|
-
const [
|
|
242
|
-
|
|
261
|
+
j = ze(d), U = { ...j, time: performance.now() }, Pe = U.time, ue = 0, ce = 0, B = G(), h = "pending", D = !0, z = !1, A = 0;
|
|
262
|
+
const N = M.value.width / 2, ne = M.value.height / 2, le = ie();
|
|
263
|
+
return n.holdable() && Math.abs(j.x - le.x - r.offsetX) <= N && Math.abs(j.y - le.y - r.offsetY) <= ne && (clearTimeout(m), q.arm()), !0;
|
|
264
|
+
}
|
|
265
|
+
function ct(d) {
|
|
266
|
+
if (!H.has(d.pointerId)) return;
|
|
267
|
+
const F = ze(d);
|
|
268
|
+
if (H.set(d.pointerId, F), h === "pinch" && H.size >= 2) {
|
|
269
|
+
if (!n.zoomable()) return;
|
|
270
|
+
const [ye, oe] = [...H.values()], be = ie(), Ye = xt(ye, oe), He = K(
|
|
271
|
+
B.level * We(ye, oe) / Re,
|
|
243
272
|
0.75,
|
|
244
|
-
|
|
245
|
-
),
|
|
273
|
+
n.zoomLimit()
|
|
274
|
+
), tt = He / B.level;
|
|
246
275
|
me({
|
|
247
|
-
level:
|
|
248
|
-
...
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
276
|
+
level: He,
|
|
277
|
+
...he(
|
|
278
|
+
Ye.x - be.x - (Oe.x - be.x - B.offsetX) * tt,
|
|
279
|
+
Ye.y - be.y - (Oe.y - be.y - B.offsetY) * tt,
|
|
280
|
+
He
|
|
252
281
|
)
|
|
253
|
-
}),
|
|
282
|
+
}), B = G(), Re = Math.max(1, We(ye, oe)), Oe = Ye, d.preventDefault();
|
|
254
283
|
return;
|
|
255
284
|
}
|
|
256
|
-
if (
|
|
257
|
-
const X = F.x -
|
|
258
|
-
if (
|
|
259
|
-
if (
|
|
260
|
-
q.cancel(),
|
|
261
|
-
}
|
|
262
|
-
Math.hypot(X,
|
|
263
|
-
const
|
|
264
|
-
if (
|
|
265
|
-
if (clearTimeout(
|
|
266
|
-
const
|
|
267
|
-
me({ level: r.level, ...
|
|
268
|
-
} else
|
|
269
|
-
}
|
|
270
|
-
function
|
|
271
|
-
if (!
|
|
272
|
-
if (q.cancel(),
|
|
273
|
-
|
|
285
|
+
if (h === "idle") return;
|
|
286
|
+
const X = F.x - j.x, N = F.y - j.y;
|
|
287
|
+
if (h === "hold") {
|
|
288
|
+
if (d.preventDefault(), Math.hypot(X, N) < 9) return;
|
|
289
|
+
q.cancel(), h = "pending";
|
|
290
|
+
}
|
|
291
|
+
Math.hypot(X, N) >= 9 && q.cancel();
|
|
292
|
+
const ne = performance.now(), le = Math.max(8, ne - U.time);
|
|
293
|
+
if (ue = (F.x - U.x) / le, ce = (F.y - U.y) / le, U = { ...F, time: ne }, h === "pending" && (h = nn(X, N, r.level), z = h === "pan" && D && Math.abs(X) > Math.abs(N) * 1.1), h !== "pending")
|
|
294
|
+
if (clearTimeout(m), w = -1e3, d.preventDefault(), h === "pan") {
|
|
295
|
+
const ye = Math.max(0, (M.value.width - i.value.width) / 2), oe = rn(B.offsetX + X, ye, z);
|
|
296
|
+
me({ level: r.level, ...he(oe.offsetX, B.offsetY + N, r.level) }), oe.pageOffset !== A && (A = oe.pageOffset, n.onPageDrag(A));
|
|
297
|
+
} else h === "page" ? n.onPageDrag(X) : h === "dismiss" && (r.draggingDown = !0, r.downOffsetX = X * 0.65, r.downOffsetY = Math.max(0, N), r.downScale = K(1 - Math.max(0, N) / i.value.height * 0.6, 0.65, 1), n.onSwipeDownProgress(K(N / (i.value.height * 0.55), 0, 0.85)));
|
|
298
|
+
}
|
|
299
|
+
function Z(d) {
|
|
300
|
+
if (!H.has(d.pointerId)) return;
|
|
301
|
+
if (q.cancel(), H.delete(d.pointerId), k.value = H.size > 0, h === "pinch") {
|
|
302
|
+
H.size > 0 ? (j = [...H.values()][0], B = G(), h = "pan") : (h = "idle", r.zooming = !1, ve(Math.max(1, r.level), ie(), !0));
|
|
274
303
|
return;
|
|
275
304
|
}
|
|
276
|
-
if (
|
|
277
|
-
const F =
|
|
278
|
-
|
|
305
|
+
if (H.size > 0) return;
|
|
306
|
+
const F = ze(d), X = F.x - j.x, N = F.y - j.y, ne = performance.now() - U.time < 100;
|
|
307
|
+
h === "page" || h === "pan" && A !== 0 ? n.onPageRelease(h === "page" ? X : A, ne ? ue : 0) : h === "dismiss" ? N > i.value.height * 0.18 || N > 45 && ne && ce > 0.7 ? n.onSwipeDownClose() : Ce() : h === "pending" && performance.now() - Pe < 300 && We(j, F) < 9 ? et(F) : r.level < 1 && ve(1, ie(), !0), r.zooming = !1, h = "idle";
|
|
279
308
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!
|
|
282
|
-
const F =
|
|
283
|
-
Me(), F &&
|
|
309
|
+
function Je(d) {
|
|
310
|
+
if (!H.has(d.pointerId)) return;
|
|
311
|
+
const F = h === "page" || h === "pan" && A !== 0;
|
|
312
|
+
Me(), F && n.onPageRelease(0, 0), r.level < 1 && ve(1, ie(), !0);
|
|
284
313
|
}
|
|
285
|
-
function
|
|
314
|
+
function et(d) {
|
|
286
315
|
const F = performance.now();
|
|
287
|
-
F -
|
|
288
|
-
}
|
|
289
|
-
function
|
|
290
|
-
if (
|
|
291
|
-
if (q.cancel(),
|
|
292
|
-
|
|
293
|
-
}, 120),
|
|
294
|
-
|
|
295
|
-
r.level *
|
|
296
|
-
|
|
316
|
+
F - w < 280 && We(d, R) < 36 ? (clearTimeout(m), w = -1e3, n.onDoubleTap(), ve(r.level > 1.01 ? 1 : n.doubleTapZoom(), d, !0)) : (w = F, R = d, m = setTimeout(n.onTap, 280));
|
|
317
|
+
}
|
|
318
|
+
function Ve(d) {
|
|
319
|
+
if (n.interactive()) {
|
|
320
|
+
if (q.cancel(), p.value = !0, clearTimeout(I), I = setTimeout(() => {
|
|
321
|
+
p.value = !1;
|
|
322
|
+
}, 120), d.ctrlKey || d.metaKey)
|
|
323
|
+
d.preventDefault(), ve(
|
|
324
|
+
r.level * an(d, Ee.size > 0),
|
|
325
|
+
ze(d, o.value.getBoundingClientRect())
|
|
297
326
|
);
|
|
298
327
|
else if (r.level > 1) {
|
|
299
|
-
|
|
300
|
-
const F =
|
|
328
|
+
d.preventDefault();
|
|
329
|
+
const F = d.deltaMode === 1 ? 16 : 1;
|
|
301
330
|
me({
|
|
302
331
|
level: r.level,
|
|
303
|
-
...
|
|
304
|
-
r.offsetX -
|
|
305
|
-
r.offsetY -
|
|
332
|
+
...he(
|
|
333
|
+
r.offsetX - d.deltaX * F,
|
|
334
|
+
r.offsetY - d.deltaY * F,
|
|
306
335
|
r.level
|
|
307
336
|
)
|
|
308
337
|
});
|
|
309
338
|
}
|
|
310
339
|
}
|
|
311
340
|
}
|
|
312
|
-
const
|
|
341
|
+
const Ue = {
|
|
313
342
|
state: r,
|
|
314
|
-
motionActive:
|
|
315
|
-
containerRef:
|
|
316
|
-
canvasRef:
|
|
317
|
-
mediaRef:
|
|
343
|
+
motionActive: $,
|
|
344
|
+
containerRef: o,
|
|
345
|
+
canvasRef: e,
|
|
346
|
+
mediaRef: a,
|
|
318
347
|
viewportSize: i,
|
|
319
|
-
mediaSize:
|
|
320
|
-
visualMediaSize:
|
|
321
|
-
displaySize:
|
|
322
|
-
displayScale:
|
|
323
|
-
downDragStyle:
|
|
348
|
+
mediaSize: l,
|
|
349
|
+
visualMediaSize: u,
|
|
350
|
+
displaySize: M,
|
|
351
|
+
displayScale: c,
|
|
352
|
+
downDragStyle: C,
|
|
324
353
|
requestRender: pe,
|
|
325
|
-
renderNow: () =>
|
|
326
|
-
zoomTo:
|
|
327
|
-
resetTransform:
|
|
354
|
+
renderNow: () => S.forEach((d) => d()),
|
|
355
|
+
zoomTo: ve,
|
|
356
|
+
resetTransform: Be,
|
|
328
357
|
cancelGesture: Me,
|
|
329
|
-
setMediaElement(
|
|
330
|
-
|
|
358
|
+
setMediaElement(d) {
|
|
359
|
+
a.value = d, d instanceof HTMLVideoElement && pe();
|
|
331
360
|
},
|
|
332
|
-
setMediaSize(
|
|
333
|
-
|
|
361
|
+
setMediaSize(d) {
|
|
362
|
+
l.value = d, pe();
|
|
334
363
|
},
|
|
335
364
|
clearMedia() {
|
|
336
|
-
|
|
365
|
+
a.value = void 0;
|
|
366
|
+
},
|
|
367
|
+
registerRenderHandler(d) {
|
|
368
|
+
return S.add(d), () => S.delete(d);
|
|
369
|
+
},
|
|
370
|
+
setRotation(d, F = !0) {
|
|
371
|
+
r.rotation = kt(d), F && Be(), pe();
|
|
372
|
+
},
|
|
373
|
+
rotateBy(d = 90) {
|
|
374
|
+
Ue.setRotation(kt(r.rotation + d));
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
return { core: Ue, onPointerDown: ut, onPointerMove: ct, onPointerUp: Z, onPointerCancel: Je, onWheel: Ve };
|
|
378
|
+
}
|
|
379
|
+
function sn(t) {
|
|
380
|
+
const n = t.rotation * Math.PI / 180, o = Math.round(Math.cos(n)), e = Math.round(Math.sin(n)), a = t.size.width / 2 - o * t.offsetX - e * t.offsetY, i = t.size.height / 2 + e * t.offsetX - o * t.offsetY, l = (Math.abs(o) * t.viewport.width + Math.abs(e) * t.viewport.height) / 2, r = (Math.abs(e) * t.viewport.width + Math.abs(o) * t.viewport.height) / 2, u = K(a - l, 0, t.size.width), v = K(i - r, 0, t.size.height);
|
|
381
|
+
return {
|
|
382
|
+
x: u,
|
|
383
|
+
y: v,
|
|
384
|
+
width: K(a + l, 0, t.size.width) - u,
|
|
385
|
+
height: K(i + r, 0, t.size.height) - v
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function un(t, n, o, e) {
|
|
389
|
+
const a = sn(o);
|
|
390
|
+
if (a.width <= 0 || a.height <= 0) return;
|
|
391
|
+
t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = e ? "low" : "high", t.translate(
|
|
392
|
+
o.viewport.width / 2 + o.offsetX,
|
|
393
|
+
o.viewport.height / 2 + o.offsetY
|
|
394
|
+
), t.rotate(o.rotation * Math.PI / 180);
|
|
395
|
+
const { width: i, height: l } = o.size, r = "naturalWidth" in n ? n.naturalWidth : n.width, u = "naturalHeight" in n ? n.naturalHeight : n.height;
|
|
396
|
+
if (a.width === i && a.height === l) {
|
|
397
|
+
t.drawImage(n, -i / 2, -l / 2, i, l);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
t.drawImage(
|
|
401
|
+
n,
|
|
402
|
+
a.x / i * r,
|
|
403
|
+
a.y / l * u,
|
|
404
|
+
a.width / i * r,
|
|
405
|
+
a.height / l * u,
|
|
406
|
+
a.x - i / 2,
|
|
407
|
+
a.y - l / 2,
|
|
408
|
+
a.width,
|
|
409
|
+
a.height
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
function cn() {
|
|
413
|
+
const t = /* @__PURE__ */ new Set();
|
|
414
|
+
let n = [], o = { kind: "empty" };
|
|
415
|
+
function e() {
|
|
416
|
+
for (const a of t)
|
|
417
|
+
n.includes(a) || o.kind === "owned" && o.lease === a || (a.release(), t.delete(a));
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
replace(a) {
|
|
421
|
+
n = a, a.forEach((i) => t.add(i)), e();
|
|
337
422
|
},
|
|
338
|
-
|
|
339
|
-
|
|
423
|
+
display(a) {
|
|
424
|
+
o = { kind: "owned", lease: a }, e();
|
|
340
425
|
},
|
|
341
|
-
|
|
342
|
-
|
|
426
|
+
clearDisplay() {
|
|
427
|
+
o = { kind: "empty" }, e();
|
|
343
428
|
},
|
|
344
|
-
|
|
345
|
-
|
|
429
|
+
dispose() {
|
|
430
|
+
t.forEach((a) => a.release()), t.clear(), n = [], o = { kind: "empty" };
|
|
346
431
|
}
|
|
347
432
|
};
|
|
348
|
-
return { core: Ve, onPointerDown: ut, onPointerMove: ct, onPointerUp: j, onPointerCancel: Ke, onWheel: _e };
|
|
349
433
|
}
|
|
350
|
-
const
|
|
351
|
-
maxDecodedPixels:
|
|
434
|
+
const se = {
|
|
435
|
+
maxDecodedPixels: 64e6,
|
|
352
436
|
maxCanvasPixels: 6e6,
|
|
353
437
|
maxDevicePixelRatio: 2.5,
|
|
354
438
|
maxOriginalBytes: 32 * 1024 * 1024,
|
|
@@ -357,196 +441,304 @@ const ue = {
|
|
|
357
441
|
cacheEntries: 24,
|
|
358
442
|
concurrency: 3
|
|
359
443
|
};
|
|
360
|
-
class
|
|
361
|
-
constructor(
|
|
362
|
-
super(
|
|
444
|
+
class je extends Error {
|
|
445
|
+
constructor(n) {
|
|
446
|
+
super(n), this.name = "ImageLimitError";
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function Bt(t, n) {
|
|
450
|
+
if (t.naturalWidth * t.naturalHeight > n)
|
|
451
|
+
throw new je("图片像素超过解码保护限制,请提供较小的适屏资源");
|
|
452
|
+
}
|
|
453
|
+
const gt = "原图超过资源限制";
|
|
454
|
+
function dn(t) {
|
|
455
|
+
return t instanceof je ? { status: "blocked", reason: gt } : {
|
|
456
|
+
status: "error",
|
|
457
|
+
reason: t instanceof Error ? t.message : "原图加载失败,可重试"
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
const zt = `(function(){"use strict";self.onmessage=async({data:a})=>{try{const t=await createImageBitmap(a.blob);let e=t;try{const s=Math.min(1,Math.sqrt(a.maxMotionPixels/(t.width*t.height)));s<1&&(e=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(t.width*s)),resizeHeight:Math.max(1,Math.floor(t.height*s)),resizeQuality:"high"}));const r=e===t?[t]:[t,e];self.postMessage({status:"ready",full:t,motion:e},{transfer:r})}catch(s){throw e!==t&&e.close(),t.close(),s}}catch(t){self.postMessage({status:"error",message:t instanceof Error?t.message:"图片位图准备失败"})}}})();
|
|
461
|
+
`, Mt = typeof self < "u" && self.Blob && new Blob([zt], { type: "text/javascript;charset=utf-8" });
|
|
462
|
+
function fn(t) {
|
|
463
|
+
let n;
|
|
464
|
+
try {
|
|
465
|
+
if (n = Mt && (self.URL || self.webkitURL).createObjectURL(Mt), !n) throw "";
|
|
466
|
+
const o = new Worker(n, {
|
|
467
|
+
name: t == null ? void 0 : t.name
|
|
468
|
+
});
|
|
469
|
+
return o.addEventListener("error", () => {
|
|
470
|
+
(self.URL || self.webkitURL).revokeObjectURL(n);
|
|
471
|
+
}), o;
|
|
472
|
+
} catch {
|
|
473
|
+
return new Worker(
|
|
474
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(zt),
|
|
475
|
+
{
|
|
476
|
+
name: t == null ? void 0 : t.name
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
} finally {
|
|
480
|
+
n && (self.URL || self.webkitURL).revokeObjectURL(n);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function mt({ full: t, motion: n }) {
|
|
484
|
+
n !== t && n.close(), t.close();
|
|
485
|
+
}
|
|
486
|
+
function gn(t, n, o) {
|
|
487
|
+
return o.throwIfAborted(), new Promise((e, a) => {
|
|
488
|
+
const i = new fn(), l = () => {
|
|
489
|
+
o.removeEventListener("abort", r), i.terminate();
|
|
490
|
+
}, r = () => {
|
|
491
|
+
l(), a(o.reason);
|
|
492
|
+
};
|
|
493
|
+
i.onmessage = ({ data: u }) => {
|
|
494
|
+
if (l(), u.status === "error") {
|
|
495
|
+
a(new Error(u.message));
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (o.aborted) {
|
|
499
|
+
mt(u), a(o.reason);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
e(u);
|
|
503
|
+
}, i.onerror = (u) => {
|
|
504
|
+
l(), a(new Error(u.message || "图片位图准备失败"));
|
|
505
|
+
}, o.addEventListener("abort", r, { once: !0 });
|
|
506
|
+
try {
|
|
507
|
+
i.postMessage({ blob: t, maxMotionPixels: n });
|
|
508
|
+
} catch (u) {
|
|
509
|
+
l(), a(u);
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
function Dt(t) {
|
|
514
|
+
return {
|
|
515
|
+
image: t,
|
|
516
|
+
source: t,
|
|
517
|
+
motionSource: t,
|
|
518
|
+
bytes: t.naturalWidth * t.naturalHeight * 4,
|
|
519
|
+
dispose: () => {
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
async function mn(t, n, o) {
|
|
524
|
+
const e = new Uint8Array(await n.slice(0, 3).arrayBuffer());
|
|
525
|
+
if (o.throwIfAborted(), !(e[0] === 255 && e[1] === 216 && e[2] === 255))
|
|
526
|
+
return await t.decode(), o.throwIfAborted(), Dt(t);
|
|
527
|
+
const a = await gn(n, se.maxCanvasPixels, o);
|
|
528
|
+
try {
|
|
529
|
+
o.throwIfAborted();
|
|
530
|
+
const { full: i, motion: l } = a, r = l === i ? 0 : l.width * l.height * 4;
|
|
531
|
+
return {
|
|
532
|
+
image: t,
|
|
533
|
+
source: i,
|
|
534
|
+
motionSource: l,
|
|
535
|
+
// Include the DOM image and both retained pixel sizes in the cache budget.
|
|
536
|
+
bytes: (t.naturalWidth * t.naturalHeight + i.width * i.height) * 4 + r,
|
|
537
|
+
dispose: () => mt(a)
|
|
538
|
+
};
|
|
539
|
+
} catch (i) {
|
|
540
|
+
throw mt(a), i;
|
|
363
541
|
}
|
|
364
542
|
}
|
|
365
|
-
const
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
368
|
-
if (Number(
|
|
369
|
-
throw await
|
|
370
|
-
const
|
|
371
|
-
let
|
|
543
|
+
const pn = async (t, n) => {
|
|
544
|
+
const o = await fetch(t, { signal: n.signal, credentials: "same-origin" });
|
|
545
|
+
if (!o.ok) throw new Error(`图片加载失败:HTTP ${o.status}`);
|
|
546
|
+
if (Number(o.headers.get("content-length")) > n.maxBytes)
|
|
547
|
+
throw await o.body.cancel(), new je("资源超过下载保护限制,请使用适屏图或下载原文件");
|
|
548
|
+
const a = o.body.getReader(), i = [];
|
|
549
|
+
let l = 0;
|
|
372
550
|
try {
|
|
373
551
|
for (; ; ) {
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
if (
|
|
377
|
-
throw new
|
|
378
|
-
i.push(new Uint8Array(
|
|
379
|
-
}
|
|
380
|
-
} catch (
|
|
381
|
-
throw await
|
|
552
|
+
const c = await a.read();
|
|
553
|
+
if (c.done) break;
|
|
554
|
+
if (l += c.value.byteLength, l > n.maxBytes)
|
|
555
|
+
throw new je("资源超过下载保护限制,请使用适屏图或下载原文件");
|
|
556
|
+
i.push(new Uint8Array(c.value));
|
|
557
|
+
}
|
|
558
|
+
} catch (c) {
|
|
559
|
+
throw await a.cancel(), c;
|
|
382
560
|
} finally {
|
|
383
|
-
|
|
561
|
+
a.releaseLock();
|
|
384
562
|
}
|
|
385
|
-
|
|
386
|
-
const r = new Blob(i, { type:
|
|
387
|
-
|
|
563
|
+
n.signal.throwIfAborted();
|
|
564
|
+
const r = new Blob(i, { type: o.headers.get("content-type") }), u = URL.createObjectURL(r), v = new Image();
|
|
565
|
+
v.decoding = "async";
|
|
388
566
|
try {
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
567
|
+
return await new Promise((c, M) => {
|
|
568
|
+
const C = () => {
|
|
569
|
+
v.removeAttribute("src"), M(new DOMException("请求已取消", "AbortError"));
|
|
392
570
|
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
},
|
|
398
|
-
}),
|
|
399
|
-
throw new Xe("图片像素超过解码保护限制,请提供较小的适屏资源");
|
|
400
|
-
return await y.decode(), t.signal.throwIfAborted(), y;
|
|
571
|
+
v.onload = () => {
|
|
572
|
+
n.signal.removeEventListener("abort", C), c();
|
|
573
|
+
}, v.onerror = () => {
|
|
574
|
+
n.signal.removeEventListener("abort", C), M(new Error("图片解码失败或格式不受支持"));
|
|
575
|
+
}, n.signal.addEventListener("abort", C, { once: !0 }), v.src = u;
|
|
576
|
+
}), n.signal.throwIfAborted(), Bt(v, n.maxPixels), await mn(v, r, n.signal);
|
|
401
577
|
} finally {
|
|
402
|
-
URL.revokeObjectURL(
|
|
578
|
+
URL.revokeObjectURL(u);
|
|
403
579
|
}
|
|
404
580
|
};
|
|
405
|
-
class
|
|
406
|
-
constructor(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
this.budget =
|
|
581
|
+
class hn {
|
|
582
|
+
constructor(n = se.cacheBytes, o = se.concurrency, e = pn) {
|
|
583
|
+
at(this, "entries", /* @__PURE__ */ new Map());
|
|
584
|
+
at(this, "active", 0);
|
|
585
|
+
at(this, "cancelled", 0);
|
|
586
|
+
this.budget = n, this.concurrency = o, this.loader = e;
|
|
411
587
|
}
|
|
412
588
|
get stats() {
|
|
413
589
|
return {
|
|
414
590
|
active: this.active,
|
|
415
|
-
queued: [...this.entries.values()].filter((
|
|
591
|
+
queued: [...this.entries.values()].filter((n) => n.state === "queued").length,
|
|
416
592
|
entries: this.entries.size,
|
|
417
|
-
bytes: [...this.entries.values()].reduce((
|
|
593
|
+
bytes: [...this.entries.values()].reduce((n, o) => n + o.bytes, 0),
|
|
418
594
|
cancelled: this.cancelled
|
|
419
595
|
};
|
|
420
596
|
}
|
|
421
|
-
acquire(
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
597
|
+
acquire(n, o = {}) {
|
|
598
|
+
const e = {
|
|
599
|
+
priority: 0,
|
|
600
|
+
maxBytes: se.maxOriginalBytes,
|
|
601
|
+
maxPixels: se.maxDecodedPixels,
|
|
602
|
+
...o
|
|
603
|
+
};
|
|
604
|
+
if (this.entries.has(n) && ["error", "aborted"].includes(this.entries.get(n).state) && this.entries.delete(n), !this.entries.has(n)) {
|
|
605
|
+
let u, v;
|
|
606
|
+
const c = new Promise((M, C) => {
|
|
607
|
+
u = M, v = C;
|
|
427
608
|
});
|
|
428
|
-
|
|
429
|
-
}), this.entries.set(
|
|
430
|
-
promise:
|
|
431
|
-
resolve:
|
|
432
|
-
reject:
|
|
609
|
+
c.catch(() => {
|
|
610
|
+
}), this.entries.set(n, {
|
|
611
|
+
promise: c,
|
|
612
|
+
resolve: u,
|
|
613
|
+
reject: v,
|
|
433
614
|
controller: new AbortController(),
|
|
434
615
|
users: 0,
|
|
435
616
|
bytes: 0,
|
|
436
|
-
|
|
437
|
-
|
|
617
|
+
dispose: () => {
|
|
618
|
+
},
|
|
619
|
+
priority: e.priority,
|
|
620
|
+
maxBytes: e.maxBytes,
|
|
621
|
+
maxPixels: e.maxPixels,
|
|
438
622
|
state: "queued"
|
|
439
623
|
});
|
|
440
624
|
}
|
|
441
|
-
const
|
|
442
|
-
|
|
625
|
+
const a = this.entries.get(n);
|
|
626
|
+
a.users++, a.priority = Math.min(a.priority, e.priority), a.maxBytes = Math.max(a.maxBytes, e.maxBytes), a.maxPixels = Math.max(a.maxPixels, e.maxPixels), this.entries.delete(n), this.entries.set(n, a), this.pump();
|
|
443
627
|
let i = !1;
|
|
444
|
-
|
|
445
|
-
|
|
628
|
+
const l = a.promise.then((u) => (Bt(u.image, e.maxPixels), u)), r = l.then((u) => u.image);
|
|
629
|
+
return l.catch(() => {
|
|
630
|
+
}), r.catch(() => {
|
|
631
|
+
}), {
|
|
632
|
+
ready: r,
|
|
633
|
+
resource: l,
|
|
446
634
|
release: () => {
|
|
447
|
-
i || (i = !0,
|
|
635
|
+
i || (i = !0, a.users--, a.users === 0 && (a.state === "queued" || a.state === "loading") && (a.state = "aborted", this.cancelled++, a.controller.abort(), a.reject(new DOMException("请求已取消", "AbortError")), this.entries.get(n) === a && this.entries.delete(n)), a.users === 0 && a.state === "error" && this.entries.get(n) === a && this.entries.delete(n), this.trim(), this.pump());
|
|
448
636
|
}
|
|
449
637
|
};
|
|
450
638
|
}
|
|
451
639
|
pump() {
|
|
452
640
|
for (; this.active < this.concurrency; ) {
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
455
|
-
const [
|
|
456
|
-
|
|
457
|
-
signal:
|
|
641
|
+
const n = [...this.entries].filter(([, a]) => a.state === "queued" && a.users > 0).sort((a, i) => a[1].priority - i[1].priority);
|
|
642
|
+
if (n.length === 0) return;
|
|
643
|
+
const [o, e] = n[0];
|
|
644
|
+
e.state = "loading", this.active++, this.loader(o, {
|
|
645
|
+
signal: e.controller.signal,
|
|
458
646
|
get maxBytes() {
|
|
459
|
-
return
|
|
647
|
+
return e.maxBytes;
|
|
648
|
+
},
|
|
649
|
+
get maxPixels() {
|
|
650
|
+
return e.maxPixels;
|
|
460
651
|
}
|
|
461
|
-
}).then((
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
652
|
+
}).then((a) => {
|
|
653
|
+
if (e.state === "aborted") {
|
|
654
|
+
a.dispose();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
e.bytes = a.bytes, e.dispose = a.dispose, e.state = "ready", e.resolve(a);
|
|
658
|
+
}).catch((a) => {
|
|
659
|
+
e.state !== "aborted" && (e.state = "error", e.reject(_e(a)));
|
|
465
660
|
}).finally(() => {
|
|
466
661
|
this.active--, this.trim(), this.pump();
|
|
467
662
|
});
|
|
468
663
|
}
|
|
469
664
|
}
|
|
470
665
|
trim() {
|
|
471
|
-
let
|
|
472
|
-
for (const [
|
|
473
|
-
if (!(
|
|
474
|
-
if (
|
|
475
|
-
|
|
666
|
+
let n = this.stats.bytes;
|
|
667
|
+
for (const [o, e] of this.entries)
|
|
668
|
+
if (!(e.users > 0 || e.state === "loading" || e.state === "queued")) {
|
|
669
|
+
if (n <= this.budget && this.entries.size <= se.cacheEntries) break;
|
|
670
|
+
n -= e.bytes, e.dispose(), this.entries.delete(o);
|
|
476
671
|
}
|
|
477
672
|
}
|
|
478
673
|
}
|
|
479
|
-
const
|
|
480
|
-
function
|
|
481
|
-
return
|
|
674
|
+
const vn = new hn(), ke = { kind: "empty" };
|
|
675
|
+
function yn(t) {
|
|
676
|
+
return t.kind === "element" && t.element instanceof HTMLImageElement && t.element.complete && t.element.naturalWidth > 0 ? { kind: "image", image: t.element } : ke;
|
|
482
677
|
}
|
|
483
|
-
function
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
return
|
|
678
|
+
function St() {
|
|
679
|
+
const t = document.createElement("canvas");
|
|
680
|
+
t.width = t.height = 1;
|
|
681
|
+
const n = t.getContext("2d");
|
|
682
|
+
return n.fillStyle = "#f3f4f5", n.fillRect(0, 0, 1, 1), t;
|
|
488
683
|
}
|
|
489
|
-
const
|
|
490
|
-
maxOriginalPixels:
|
|
491
|
-
maxOriginalBytes:
|
|
492
|
-
maxPreviewBytes:
|
|
493
|
-
},
|
|
494
|
-
function
|
|
495
|
-
return
|
|
684
|
+
const It = ["thumbnail", "screen", "full"], Ke = {
|
|
685
|
+
maxOriginalPixels: se.maxDecodedPixels,
|
|
686
|
+
maxOriginalBytes: se.maxOriginalBytes,
|
|
687
|
+
maxPreviewBytes: se.maxPreviewBytes
|
|
688
|
+
}, Ge = (t, n) => n === "full" ? t.src : n === "screen" ? t.previewSrc : t.thumbnail;
|
|
689
|
+
function wn(t, n) {
|
|
690
|
+
return t.width * t.height <= n.maxOriginalPixels;
|
|
496
691
|
}
|
|
497
|
-
function
|
|
498
|
-
const
|
|
692
|
+
function Pt(t, n) {
|
|
693
|
+
const o = Math.min(n.width / t.width, n.height / t.height);
|
|
499
694
|
return Math.min(
|
|
500
695
|
8,
|
|
501
696
|
Math.max(
|
|
502
697
|
2,
|
|
503
698
|
Math.min(
|
|
504
|
-
1 /
|
|
505
|
-
Math.max(
|
|
699
|
+
1 / o,
|
|
700
|
+
Math.max(n.width / (t.width * o), n.height / (t.height * o))
|
|
506
701
|
)
|
|
507
702
|
)
|
|
508
703
|
);
|
|
509
704
|
}
|
|
510
|
-
function
|
|
511
|
-
const
|
|
705
|
+
function bn(t, n, o, e, a, i = !0) {
|
|
706
|
+
const l = wn(t, o), r = {
|
|
512
707
|
sources: [],
|
|
513
|
-
originalStatus:
|
|
708
|
+
originalStatus: i && n === "full" ? l ? "loading" : "blocked" : "idle",
|
|
514
709
|
originalReason: ""
|
|
515
710
|
};
|
|
516
|
-
|
|
517
|
-
for (const [
|
|
518
|
-
if (
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
711
|
+
r.originalStatus === "blocked" && (r.originalReason = gt);
|
|
712
|
+
for (const [u, v] of It.entries()) {
|
|
713
|
+
if (v === "screen" && n === "thumbnail" || v === "full" && (!i || n !== "full" || !l))
|
|
714
|
+
continue;
|
|
715
|
+
const c = e(t, v, a);
|
|
716
|
+
if (i && !l && c === t.src) {
|
|
717
|
+
r.originalStatus = "blocked", r.originalReason = gt;
|
|
522
718
|
continue;
|
|
523
719
|
}
|
|
524
|
-
|
|
720
|
+
r.sources.push({ url: c, quality: v, rank: u });
|
|
525
721
|
}
|
|
526
|
-
return
|
|
722
|
+
return r;
|
|
527
723
|
}
|
|
528
|
-
const
|
|
724
|
+
const kn = ["aria-label"], xn = {
|
|
529
725
|
key: 0,
|
|
530
726
|
class: "mp-resource-state",
|
|
531
727
|
role: "status",
|
|
532
728
|
"aria-label": "加载中"
|
|
533
|
-
},
|
|
729
|
+
}, Mn = /* @__PURE__ */ T("span", {
|
|
534
730
|
class: "mp-spinner",
|
|
535
731
|
"aria-hidden": "true"
|
|
536
|
-
}, null, -1),
|
|
537
|
-
|
|
538
|
-
],
|
|
732
|
+
}, null, -1), Sn = [
|
|
733
|
+
Mn
|
|
734
|
+
], Pn = {
|
|
539
735
|
key: 1,
|
|
540
736
|
class: "mp-resource-state",
|
|
541
737
|
role: "alert"
|
|
542
|
-
},
|
|
738
|
+
}, Rn = /* @__PURE__ */ T("span", null, "图片暂时无法加载", -1), En = {
|
|
543
739
|
key: 2,
|
|
544
|
-
class: "mp-quality-notice",
|
|
545
|
-
role: "status"
|
|
546
|
-
}, da = {
|
|
547
|
-
key: 3,
|
|
548
740
|
class: "mp-quality-notice"
|
|
549
|
-
},
|
|
741
|
+
}, yt = /* @__PURE__ */ $e({
|
|
550
742
|
inheritAttrs: !1,
|
|
551
743
|
__name: "ImageCanvasRenderer",
|
|
552
744
|
props: {
|
|
@@ -556,49 +748,52 @@ const ia = ["aria-label"], oa = {
|
|
|
556
748
|
rendering: { type: Boolean, default: !0 },
|
|
557
749
|
requestVersion: { default: 0 },
|
|
558
750
|
loadEnabled: { type: Boolean, default: !0 },
|
|
751
|
+
originalEnabled: { type: Boolean, default: !0 },
|
|
559
752
|
priority: { default: 0 },
|
|
560
|
-
resourcePolicy: { default: () =>
|
|
561
|
-
resolveSource: { type: Function, default:
|
|
753
|
+
resourcePolicy: { default: () => Ke },
|
|
754
|
+
resolveSource: { type: Function, default: Ge },
|
|
562
755
|
initialImage: { default: () => ke }
|
|
563
756
|
},
|
|
564
757
|
emits: ["ready", "error", "originalState"],
|
|
565
|
-
setup(
|
|
566
|
-
const e =
|
|
567
|
-
|
|
568
|
-
[
|
|
569
|
-
() =>
|
|
758
|
+
setup(t, { expose: n, emit: o }) {
|
|
759
|
+
const e = t, a = o, i = L(), l = pt({ status: "empty" }), r = L("loading"), u = L(!1), v = L("idle"), c = L("");
|
|
760
|
+
J(
|
|
761
|
+
[v, c],
|
|
762
|
+
() => a("originalState", v.value, c.value)
|
|
570
763
|
);
|
|
571
|
-
let
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
764
|
+
let M = !0, C = 0, S = e.media.id;
|
|
765
|
+
const P = cn();
|
|
766
|
+
let k = () => {
|
|
767
|
+
}, p, $ = !1, I = { kind: "empty" };
|
|
768
|
+
function y() {
|
|
769
|
+
if (e.core.motionActive.value && e.loadEnabled && S === e.media.id) {
|
|
770
|
+
$ = !0;
|
|
576
771
|
return;
|
|
577
772
|
}
|
|
578
|
-
|
|
773
|
+
$ = !1, w();
|
|
579
774
|
}
|
|
580
|
-
function
|
|
581
|
-
|
|
775
|
+
function x(f, h, D, z) {
|
|
776
|
+
l.value = { status: "ready", value: f, rank: D }, P.display(h), e.core.setMediaElement(f.image), r.value = "ready", u.value = !1, z === "full" && (v.value = "ready"), e.core.requestRender(), a("ready", z);
|
|
582
777
|
}
|
|
583
|
-
|
|
778
|
+
J(
|
|
584
779
|
() => e.core.motionActive.value,
|
|
585
|
-
(
|
|
586
|
-
if (!
|
|
587
|
-
if (
|
|
588
|
-
const
|
|
589
|
-
|
|
780
|
+
(f) => {
|
|
781
|
+
if (e.core.requestRender(), !f) {
|
|
782
|
+
if (I.kind === "ready") {
|
|
783
|
+
const h = I;
|
|
784
|
+
I = { kind: "empty" }, h.token === C && x(h.value, h.lease, h.rank, h.quality);
|
|
590
785
|
}
|
|
591
|
-
|
|
786
|
+
$ && y();
|
|
592
787
|
}
|
|
593
788
|
}
|
|
594
|
-
),
|
|
595
|
-
const
|
|
596
|
-
p =
|
|
597
|
-
|
|
789
|
+
), qe(() => {
|
|
790
|
+
const f = i.value;
|
|
791
|
+
p = f.getContext("2d"), e.core.canvasRef.value = f, k = e.core.registerRenderHandler(R), m(), we(() => {
|
|
792
|
+
M && y();
|
|
598
793
|
});
|
|
599
|
-
}),
|
|
600
|
-
|
|
601
|
-
}),
|
|
794
|
+
}), Fe(() => {
|
|
795
|
+
M = !1, C += 1, k(), P.dispose();
|
|
796
|
+
}), J(
|
|
602
797
|
[
|
|
603
798
|
() => e.media.id,
|
|
604
799
|
() => e.media.src,
|
|
@@ -608,169 +803,254 @@ const ia = ["aria-label"], oa = {
|
|
|
608
803
|
() => e.loadEnabled,
|
|
609
804
|
() => e.priority,
|
|
610
805
|
() => e.resolveSource,
|
|
806
|
+
() => e.resourcePolicy,
|
|
807
|
+
() => e.originalEnabled,
|
|
611
808
|
() => e.requestVersion
|
|
612
809
|
],
|
|
613
810
|
() => {
|
|
614
|
-
|
|
811
|
+
y();
|
|
615
812
|
}
|
|
616
|
-
),
|
|
813
|
+
), J(() => e.initialImage, m), J(
|
|
617
814
|
() => e.rendering,
|
|
618
|
-
(
|
|
619
|
-
|
|
815
|
+
(f) => {
|
|
816
|
+
f && e.core.requestRender();
|
|
620
817
|
}
|
|
621
818
|
);
|
|
622
|
-
function
|
|
623
|
-
e.initialImage.kind !== "image" ||
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
819
|
+
function m() {
|
|
820
|
+
e.initialImage.kind !== "image" || l.value.status === "ready" || (l.value = {
|
|
821
|
+
status: "ready",
|
|
822
|
+
value: Dt(e.initialImage.image),
|
|
823
|
+
rank: 0
|
|
824
|
+
}, e.core.setMediaElement(e.initialImage.image), r.value = "ready", e.core.requestRender(), a("ready", "thumbnail"));
|
|
825
|
+
}
|
|
826
|
+
async function w() {
|
|
827
|
+
const f = ++C;
|
|
828
|
+
if (I = { kind: "empty" }, u.value = !1, S !== e.media.id && (S = e.media.id, l.value = { status: "empty" }, P.clearDisplay(), r.value = "loading", e.core.clearMedia(), m()), !e.loadEnabled) {
|
|
829
|
+
P.replace([]);
|
|
629
830
|
return;
|
|
630
831
|
}
|
|
631
|
-
const
|
|
632
|
-
e.core.viewportSize.value.width * Math.min(devicePixelRatio,
|
|
633
|
-
),
|
|
832
|
+
const h = Math.ceil(
|
|
833
|
+
e.core.viewportSize.value.width * Math.min(devicePixelRatio, se.maxDevicePixelRatio) * e.core.state.level
|
|
834
|
+
), D = bn(
|
|
634
835
|
e.media,
|
|
635
836
|
e.quality,
|
|
636
837
|
e.resourcePolicy,
|
|
637
838
|
e.resolveSource,
|
|
638
|
-
|
|
839
|
+
h,
|
|
840
|
+
e.originalEnabled
|
|
639
841
|
);
|
|
640
|
-
|
|
641
|
-
const { sources:
|
|
642
|
-
(
|
|
842
|
+
c.value = D.originalReason, v.value = D.originalStatus;
|
|
843
|
+
const { sources: z } = D, A = z.map(
|
|
844
|
+
(U) => vn.acquire(U.url, {
|
|
643
845
|
priority: e.priority,
|
|
644
|
-
|
|
846
|
+
maxPixels: e.resourcePolicy.maxOriginalPixels,
|
|
847
|
+
maxBytes: U.quality === "full" ? e.resourcePolicy.maxOriginalBytes : e.resourcePolicy.maxPreviewBytes
|
|
645
848
|
})
|
|
646
|
-
)
|
|
647
|
-
|
|
648
|
-
let
|
|
849
|
+
);
|
|
850
|
+
P.replace(A), z.length === 0 && l.value.status === "empty" && (r.value = "error", a("error", new je(c.value))), l.value.status === "ready" && a("ready", It[l.value.rank]);
|
|
851
|
+
let H = l.value.status === "ready" ? l.value.rank : -1, j = 0;
|
|
649
852
|
await Promise.all(
|
|
650
|
-
|
|
651
|
-
const
|
|
853
|
+
z.map(async (U, Pe) => {
|
|
854
|
+
const ue = U.rank, ce = A[Pe];
|
|
652
855
|
try {
|
|
653
|
-
const
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
856
|
+
const ee = await ce.resource;
|
|
857
|
+
if (f !== C || ue < H) return;
|
|
858
|
+
H = ue, e.core.motionActive.value && l.value.status === "ready" ? I = {
|
|
859
|
+
kind: "ready",
|
|
860
|
+
token: f,
|
|
861
|
+
value: ee,
|
|
862
|
+
lease: ce,
|
|
863
|
+
rank: ue,
|
|
864
|
+
quality: U.quality
|
|
865
|
+
} : x(ee, ce, ue, U.quality);
|
|
866
|
+
} catch (ee) {
|
|
867
|
+
if (f !== C || ee instanceof Error && ee.name === "AbortError") return;
|
|
868
|
+
if (U.quality === "full") {
|
|
869
|
+
const Re = dn(ee);
|
|
870
|
+
v.value = Re.status, c.value = Re.reason;
|
|
871
|
+
}
|
|
872
|
+
j += 1, ue > H && l.value.status === "ready" && (u.value = !0), j === z.length && l.value.status === "empty" && (r.value = "error"), a("error", _e(ee));
|
|
659
873
|
}
|
|
660
874
|
})
|
|
661
875
|
);
|
|
662
876
|
}
|
|
663
|
-
function
|
|
664
|
-
if (!e.rendering ||
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
const
|
|
877
|
+
function R() {
|
|
878
|
+
if (!e.rendering || l.value.status !== "ready") return;
|
|
879
|
+
const f = i.value, h = e.core.viewportSize.value;
|
|
880
|
+
if (h.width <= 0 || h.height <= 0) return;
|
|
881
|
+
const D = Math.min(
|
|
668
882
|
devicePixelRatio,
|
|
669
|
-
|
|
670
|
-
Math.sqrt(
|
|
671
|
-
),
|
|
672
|
-
(
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
883
|
+
se.maxDevicePixelRatio,
|
|
884
|
+
Math.sqrt(se.maxCanvasPixels / (h.width * h.height))
|
|
885
|
+
), z = Math.max(1, Math.round(h.width * D)), A = Math.max(1, Math.round(h.height * D));
|
|
886
|
+
(f.width !== z || f.height !== A) && (f.width = z, f.height = A), p.setTransform(D, 0, 0, D, 0, 0), p.clearRect(0, 0, h.width, h.height);
|
|
887
|
+
const { width: H, height: j } = e.core.mediaSize.value, U = e.core.displayScale.value;
|
|
888
|
+
un(
|
|
889
|
+
p,
|
|
890
|
+
e.core.motionActive.value ? l.value.value.motionSource : l.value.value.source,
|
|
891
|
+
{
|
|
892
|
+
viewport: h,
|
|
893
|
+
size: { width: H * U, height: j * U },
|
|
894
|
+
offsetX: e.core.state.offsetX,
|
|
895
|
+
offsetY: e.core.state.offsetY,
|
|
896
|
+
rotation: e.core.state.rotation
|
|
897
|
+
},
|
|
898
|
+
e.core.motionActive.value
|
|
683
899
|
);
|
|
684
900
|
}
|
|
685
|
-
return (
|
|
686
|
-
|
|
901
|
+
return n({
|
|
902
|
+
captureFrame: () => {
|
|
903
|
+
if (l.value.status !== "ready") throw new Error("图片画面尚未就绪");
|
|
904
|
+
return { image: l.value.value.motionSource, scale: 1 };
|
|
905
|
+
}
|
|
906
|
+
}), (f, h) => (O(), V(Le, null, [
|
|
907
|
+
T("canvas", {
|
|
687
908
|
ref_key: "canvasRef",
|
|
688
|
-
ref:
|
|
909
|
+
ref: i,
|
|
689
910
|
class: "mp-canvas-renderer",
|
|
690
|
-
"aria-label":
|
|
691
|
-
}, null, 8,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
911
|
+
"aria-label": f.media.title
|
|
912
|
+
}, null, 8, kn),
|
|
913
|
+
r.value === "loading" ? (O(), V("div", xn, Sn)) : re("", !0),
|
|
914
|
+
r.value === "error" ? (O(), V("div", Pn, [
|
|
915
|
+
Rn,
|
|
916
|
+
T("button", {
|
|
696
917
|
type: "button",
|
|
697
|
-
onClick:
|
|
918
|
+
onClick: ae(w, ["stop"])
|
|
698
919
|
}, "重新加载")
|
|
699
|
-
])) :
|
|
700
|
-
|
|
920
|
+
])) : re("", !0),
|
|
921
|
+
u.value && v.value !== "blocked" ? (O(), V("span", En, " 高清图加载失败,当前显示预览图 ")) : re("", !0)
|
|
701
922
|
], 64));
|
|
702
923
|
}
|
|
703
924
|
});
|
|
704
|
-
function
|
|
705
|
-
const
|
|
706
|
-
|
|
925
|
+
function Cn(t, n, o) {
|
|
926
|
+
const { buffered: e } = t;
|
|
927
|
+
if (!Number.isFinite(n) || n <= 0) return [];
|
|
928
|
+
const a = [], i = Math.min(0.25, n * 0.05);
|
|
929
|
+
for (let l = 0; l < e.length; l++) {
|
|
930
|
+
const r = K(e.start(l), 0, n);
|
|
931
|
+
let u = K(e.end(l), r, n);
|
|
932
|
+
l === e.length - 1 && (t.ended || o.kind === "retained" && e.end(l) >= o.end || t.readyState >= 4 && n - u <= i) && (u = n), u > r && a.push({ start: r, end: u });
|
|
933
|
+
}
|
|
934
|
+
return a;
|
|
935
|
+
}
|
|
936
|
+
function Ae(t) {
|
|
937
|
+
const n = Math.max(0, Math.floor(Number.isFinite(t) ? t : 0));
|
|
938
|
+
return `${String(Math.floor(n / 60)).padStart(2, "0")}:${String(n % 60).padStart(2, "0")}`;
|
|
939
|
+
}
|
|
940
|
+
function Rt(t) {
|
|
941
|
+
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
942
|
+
}
|
|
943
|
+
function Et() {
|
|
944
|
+
return { duration: 0, time: 0, buffered: 0, bufferedRanges: [] };
|
|
945
|
+
}
|
|
946
|
+
function Ln() {
|
|
947
|
+
let t = 0, n = { kind: "pending" };
|
|
948
|
+
return {
|
|
949
|
+
setDuration(o) {
|
|
950
|
+
t = Rt(o);
|
|
951
|
+
},
|
|
952
|
+
complete(o) {
|
|
953
|
+
const { buffered: e } = o;
|
|
954
|
+
n = e.length > 0 ? { kind: "retained", end: e.end(e.length - 1) } : { kind: "pending" };
|
|
955
|
+
},
|
|
956
|
+
reset() {
|
|
957
|
+
t = 0, n = { kind: "pending" };
|
|
958
|
+
},
|
|
959
|
+
read(o, e) {
|
|
960
|
+
const a = t > 0 ? t : Rt(o.duration), i = Cn(o, a, n);
|
|
961
|
+
return {
|
|
962
|
+
duration: a,
|
|
963
|
+
time: e ? a : K(o.currentTime, 0, a),
|
|
964
|
+
buffered: i.length > 0 ? i[i.length - 1].end : 0,
|
|
965
|
+
bufferedRanges: i
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
};
|
|
707
969
|
}
|
|
708
|
-
function
|
|
709
|
-
const e =
|
|
970
|
+
function qt(t, n) {
|
|
971
|
+
const o = Ln(), e = ht({
|
|
710
972
|
playing: !1,
|
|
711
973
|
buffering: !1,
|
|
712
|
-
|
|
713
|
-
time: 0,
|
|
714
|
-
buffered: 0,
|
|
974
|
+
...Et(),
|
|
715
975
|
muted: !1,
|
|
716
976
|
ended: !1,
|
|
717
977
|
scrubbing: !1,
|
|
718
978
|
scrubTime: 0,
|
|
719
979
|
status: "loading"
|
|
720
980
|
});
|
|
721
|
-
let
|
|
722
|
-
const
|
|
723
|
-
() =>
|
|
981
|
+
let a = !1, i = 0, l = !1;
|
|
982
|
+
const r = Y(() => e.duration > 0 && e.status !== "error"), u = Y(() => e.scrubbing ? e.scrubTime : e.time), v = Y(() => r.value ? u.value / e.duration * 100 : 0), c = Y(
|
|
983
|
+
() => r.value ? e.buffered / e.duration * 100 : 0
|
|
984
|
+
), M = Y(
|
|
985
|
+
() => e.bufferedRanges.map(({ start: z, end: A }) => ({
|
|
986
|
+
left: z / e.duration * 100,
|
|
987
|
+
width: (A - z) / e.duration * 100
|
|
988
|
+
}))
|
|
724
989
|
);
|
|
725
|
-
function
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
990
|
+
function C() {
|
|
991
|
+
Object.assign(e, o.read(t(), e.ended));
|
|
992
|
+
}
|
|
993
|
+
function S(z) {
|
|
994
|
+
l || (o.setDuration(z), C(), e.scrubTime = K(e.scrubTime, 0, e.duration));
|
|
995
|
+
}
|
|
996
|
+
function P() {
|
|
997
|
+
o.reset(), a = !1, i += 1, Object.assign(e, {
|
|
998
|
+
playing: !1,
|
|
999
|
+
buffering: !1,
|
|
1000
|
+
...Et(),
|
|
1001
|
+
ended: !1,
|
|
1002
|
+
scrubbing: !1,
|
|
1003
|
+
scrubTime: 0,
|
|
1004
|
+
status: "loading"
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
async function k() {
|
|
1008
|
+
if (l) return;
|
|
1009
|
+
const z = ++i;
|
|
1010
|
+
e.ended && (t().currentTime = 0, e.time = 0), e.ended = !1, e.buffering = !0;
|
|
735
1011
|
try {
|
|
736
|
-
await
|
|
737
|
-
} catch (
|
|
738
|
-
if (
|
|
739
|
-
e.buffering = !1, e.playing = !1,
|
|
1012
|
+
await t().play();
|
|
1013
|
+
} catch (A) {
|
|
1014
|
+
if (z !== i) return;
|
|
1015
|
+
e.buffering = !1, e.playing = !1, A instanceof Error && A.name !== "NotAllowedError" && A.name !== "AbortError" && n(A);
|
|
740
1016
|
}
|
|
741
1017
|
}
|
|
742
|
-
function
|
|
743
|
-
|
|
1018
|
+
function p() {
|
|
1019
|
+
i += 1, a = !1, e.scrubbing = !1, e.buffering = !1, t().pause();
|
|
744
1020
|
}
|
|
745
|
-
function
|
|
746
|
-
e.playing ?
|
|
1021
|
+
function $() {
|
|
1022
|
+
e.playing ? p() : k();
|
|
747
1023
|
}
|
|
748
|
-
function
|
|
749
|
-
!
|
|
1024
|
+
function I() {
|
|
1025
|
+
!r.value || e.scrubbing || (a = e.playing, e.scrubbing = !0, e.scrubTime = e.time, t().pause());
|
|
750
1026
|
}
|
|
751
|
-
function
|
|
752
|
-
e.scrubTime =
|
|
1027
|
+
function y(z) {
|
|
1028
|
+
e.scrubTime = K(z, 0, e.duration);
|
|
753
1029
|
}
|
|
754
|
-
function
|
|
1030
|
+
function x(z = !0) {
|
|
755
1031
|
if (!e.scrubbing) return;
|
|
756
|
-
const
|
|
757
|
-
|
|
1032
|
+
const A = a;
|
|
1033
|
+
a = !1, e.scrubbing = !1, z && (t().currentTime = e.scrubTime, e.time = e.scrubTime, e.ended = !1), A && k();
|
|
758
1034
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
1035
|
+
function m() {
|
|
1036
|
+
t().muted = !t().muted, e.muted = t().muted;
|
|
761
1037
|
}
|
|
762
|
-
|
|
1038
|
+
function w(z) {
|
|
1039
|
+
e.status = "error", e.playing = !1, e.buffering = !1, n(z);
|
|
1040
|
+
}
|
|
1041
|
+
const f = Object.fromEntries(
|
|
763
1042
|
Object.entries({
|
|
764
|
-
loadedmetadata:
|
|
765
|
-
durationchange:
|
|
766
|
-
timeupdate:
|
|
767
|
-
progress:
|
|
1043
|
+
loadedmetadata: C,
|
|
1044
|
+
durationchange: C,
|
|
1045
|
+
timeupdate: C,
|
|
1046
|
+
progress: C,
|
|
768
1047
|
loadeddata: () => {
|
|
769
|
-
|
|
1048
|
+
C(), e.status = "ready", e.buffering = !1;
|
|
770
1049
|
},
|
|
771
1050
|
canplay: () => {
|
|
772
|
-
e.buffering = !1;
|
|
1051
|
+
C(), e.buffering = !1;
|
|
773
1052
|
},
|
|
1053
|
+
canplaythrough: C,
|
|
774
1054
|
play: () => {
|
|
775
1055
|
e.playing = !0, e.ended = !1;
|
|
776
1056
|
},
|
|
@@ -781,7 +1061,7 @@ function Lt(a, t) {
|
|
|
781
1061
|
e.playing = !1, e.buffering = !1;
|
|
782
1062
|
},
|
|
783
1063
|
ended: () => {
|
|
784
|
-
e.playing = !1, e.ended = !0, e.buffering = !1,
|
|
1064
|
+
e.playing = !1, e.ended = !0, e.buffering = !1, o.complete(t()), C();
|
|
785
1065
|
},
|
|
786
1066
|
waiting: () => {
|
|
787
1067
|
e.buffering = e.playing;
|
|
@@ -790,46 +1070,50 @@ function Lt(a, t) {
|
|
|
790
1070
|
e.buffering = !0;
|
|
791
1071
|
},
|
|
792
1072
|
seeked: () => {
|
|
793
|
-
e.buffering = !1,
|
|
1073
|
+
e.buffering = !1, C();
|
|
794
1074
|
},
|
|
795
1075
|
volumechange: () => {
|
|
796
|
-
e.muted =
|
|
1076
|
+
e.muted = t().muted;
|
|
797
1077
|
},
|
|
798
1078
|
error: () => {
|
|
799
|
-
|
|
1079
|
+
w(new Error("视频暂时无法播放,请重试或检查资源格式"));
|
|
800
1080
|
}
|
|
801
|
-
}).map(([
|
|
802
|
-
|
|
1081
|
+
}).map(([z, A]) => [
|
|
1082
|
+
z,
|
|
803
1083
|
() => {
|
|
804
|
-
|
|
1084
|
+
l || A();
|
|
805
1085
|
}
|
|
806
1086
|
])
|
|
807
1087
|
);
|
|
808
|
-
function
|
|
809
|
-
|
|
1088
|
+
function h() {
|
|
1089
|
+
l = !0, p();
|
|
810
1090
|
}
|
|
811
|
-
function
|
|
812
|
-
|
|
1091
|
+
function D() {
|
|
1092
|
+
P(), e.buffering = !0, t().load();
|
|
813
1093
|
}
|
|
814
1094
|
return {
|
|
815
1095
|
state: e,
|
|
816
|
-
seekable:
|
|
817
|
-
displayTime:
|
|
818
|
-
progress:
|
|
819
|
-
bufferedProgress:
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1096
|
+
seekable: r,
|
|
1097
|
+
displayTime: u,
|
|
1098
|
+
progress: v,
|
|
1099
|
+
bufferedProgress: c,
|
|
1100
|
+
bufferedRanges: M,
|
|
1101
|
+
events: f,
|
|
1102
|
+
play: k,
|
|
1103
|
+
pause: p,
|
|
1104
|
+
toggle: $,
|
|
1105
|
+
beginScrub: I,
|
|
1106
|
+
scrub: y,
|
|
1107
|
+
endScrub: x,
|
|
1108
|
+
toggleMuted: m,
|
|
1109
|
+
retry: D,
|
|
1110
|
+
setSourceDuration: S,
|
|
1111
|
+
resetSource: P,
|
|
1112
|
+
sourceObserver: { error: w, duration: S, reset: P },
|
|
1113
|
+
dispose: h
|
|
830
1114
|
};
|
|
831
1115
|
}
|
|
832
|
-
const
|
|
1116
|
+
const Fn = ["data-live-state"], $n = { class: "mp-dom-renderer mp-live-photo__motion" }, Tn = ["preload"], Bn = /* @__PURE__ */ $e({
|
|
833
1117
|
__name: "LivePhotoRenderer",
|
|
834
1118
|
props: {
|
|
835
1119
|
media: {},
|
|
@@ -840,139 +1124,139 @@ const fa = ["data-live-state"], ga = { class: "mp-dom-renderer mp-live-photo__mo
|
|
|
840
1124
|
requestVersion: { default: 0 },
|
|
841
1125
|
loadEnabled: { type: Boolean, default: !0 },
|
|
842
1126
|
priority: { default: 0 },
|
|
843
|
-
resourcePolicy: { default: () =>
|
|
844
|
-
resolveSource: { type: Function, default:
|
|
1127
|
+
resourcePolicy: { default: () => Ke },
|
|
1128
|
+
resolveSource: { type: Function, default: Ge },
|
|
845
1129
|
rendering: { type: Boolean, default: !0 },
|
|
846
1130
|
initialImage: { default: () => ke },
|
|
847
1131
|
quality: { default: "screen" }
|
|
848
1132
|
},
|
|
849
1133
|
emits: ["ready", "error", "originalState", "liveState", "liveEnded"],
|
|
850
|
-
setup(
|
|
851
|
-
const
|
|
1134
|
+
setup(t, { expose: n, emit: o }) {
|
|
1135
|
+
const e = t, a = o, i = L(), l = L(), r = L(), u = L(), v = qt(
|
|
852
1136
|
() => i.value,
|
|
853
|
-
(
|
|
854
|
-
), { state:
|
|
855
|
-
|
|
1137
|
+
(m) => a("error", m)
|
|
1138
|
+
), { state: c } = v;
|
|
1139
|
+
Tt(
|
|
856
1140
|
() => i.value,
|
|
857
|
-
() =>
|
|
858
|
-
() =>
|
|
1141
|
+
() => e.media,
|
|
1142
|
+
() => e.active && e.loadEnabled,
|
|
859
1143
|
() => lt,
|
|
860
|
-
|
|
861
|
-
y.status = "error", o("error", u);
|
|
862
|
-
}
|
|
1144
|
+
v.sourceObserver
|
|
863
1145
|
);
|
|
864
|
-
let
|
|
1146
|
+
let M = !1, C = () => {
|
|
865
1147
|
};
|
|
866
|
-
const
|
|
867
|
-
() =>
|
|
868
|
-
),
|
|
869
|
-
transform: `translate(-50%, -50%) translate3d(${
|
|
870
|
-
})),
|
|
871
|
-
width: `${
|
|
872
|
-
height: `${
|
|
873
|
-
transform: `rotate(${
|
|
1148
|
+
const S = Y(
|
|
1149
|
+
() => e.active && e.enabled && c.playing && c.status === "ready" && !c.buffering
|
|
1150
|
+
), P = Y(() => ({
|
|
1151
|
+
transform: `translate(-50%, -50%) translate3d(${e.core.state.offsetX}px, ${e.core.state.offsetY}px, 0)`
|
|
1152
|
+
})), k = Y(() => ({
|
|
1153
|
+
width: `${e.core.mediaSize.value.width * e.core.displayScale.value}px`,
|
|
1154
|
+
height: `${e.core.mediaSize.value.height * e.core.displayScale.value}px`,
|
|
1155
|
+
transform: `rotate(${e.core.state.rotation}deg)`
|
|
874
1156
|
}));
|
|
875
1157
|
function p() {
|
|
876
|
-
|
|
1158
|
+
v.pause(), i.value.readyState >= HTMLMediaElement.HAVE_METADATA && (i.value.currentTime = 0);
|
|
877
1159
|
}
|
|
878
|
-
function
|
|
879
|
-
!
|
|
880
|
-
!
|
|
1160
|
+
function $() {
|
|
1161
|
+
!e.active || !e.enabled || !e.loadEnabled || !e.playing || c.status !== "ready" || c.buffering ? p() : v.play().then(() => {
|
|
1162
|
+
!M && !c.playing && e.playing && a("liveEnded");
|
|
881
1163
|
});
|
|
882
1164
|
}
|
|
883
|
-
|
|
884
|
-
() => [
|
|
1165
|
+
J(
|
|
1166
|
+
() => [c.status, c.playing, c.buffering],
|
|
885
1167
|
() => {
|
|
886
|
-
const
|
|
887
|
-
|
|
1168
|
+
const m = c.status === "error" ? "error" : c.buffering || c.status === "loading" ? "loading" : S.value ? "playing" : "idle";
|
|
1169
|
+
a("liveState", m);
|
|
888
1170
|
},
|
|
889
1171
|
{ immediate: !0 }
|
|
890
1172
|
);
|
|
891
|
-
function T() {
|
|
892
|
-
m || (p(), o("liveEnded"));
|
|
893
|
-
}
|
|
894
1173
|
function I() {
|
|
895
|
-
|
|
1174
|
+
M || (p(), a("liveEnded"));
|
|
896
1175
|
}
|
|
897
|
-
|
|
898
|
-
|
|
1176
|
+
function y() {
|
|
1177
|
+
document.hidden && (p(), a("liveEnded"));
|
|
1178
|
+
}
|
|
1179
|
+
qe(() => {
|
|
1180
|
+
C = J(() => [e.active, e.enabled, e.loadEnabled, e.playing], $, {
|
|
899
1181
|
flush: "post"
|
|
900
|
-
}),
|
|
901
|
-
}),
|
|
902
|
-
|
|
1182
|
+
}), $(), document.addEventListener("visibilitychange", y);
|
|
1183
|
+
}), Fe(() => {
|
|
1184
|
+
C(), M = !0, v.dispose(), document.removeEventListener("visibilitychange", y);
|
|
903
1185
|
});
|
|
904
|
-
function
|
|
905
|
-
const
|
|
1186
|
+
function x() {
|
|
1187
|
+
const m = document.createElement("canvas"), w = Math.min(
|
|
906
1188
|
1,
|
|
907
|
-
Math.sqrt(
|
|
1189
|
+
Math.sqrt(se.maxCanvasPixels / (e.media.width * e.media.height))
|
|
908
1190
|
);
|
|
909
|
-
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
const
|
|
913
|
-
return
|
|
1191
|
+
m.width = Math.round(e.media.width * w), m.height = Math.round(e.media.height * w);
|
|
1192
|
+
const R = m.getContext("2d"), f = Number(getComputedStyle(r.value).opacity);
|
|
1193
|
+
R.drawImage(u.value.captureFrame().image, 0, 0, m.width, m.height), f < 1 && i.value.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && (R.globalAlpha = 1 - f, R.drawImage(i.value, 0, 0, m.width, m.height));
|
|
1194
|
+
const h = new DOMMatrixReadOnly(getComputedStyle(l.value).transform).a;
|
|
1195
|
+
return v.pause(), { image: m, scale: h };
|
|
914
1196
|
}
|
|
915
|
-
return
|
|
1197
|
+
return n({ captureFrame: x }), (m, w) => (O(), V("div", {
|
|
916
1198
|
class: "mp-live-photo-renderer",
|
|
917
|
-
"data-live-state": g(
|
|
1199
|
+
"data-live-state": g(c).status === "error" ? "error" : S.value ? "playing" : "idle"
|
|
918
1200
|
}, [
|
|
919
|
-
|
|
1201
|
+
T("div", {
|
|
920
1202
|
ref_key: "effectsRef",
|
|
921
|
-
ref:
|
|
922
|
-
class:
|
|
1203
|
+
ref: l,
|
|
1204
|
+
class: Ie(["mp-live-photo__effects", { "is-playing": S.value }])
|
|
923
1205
|
}, [
|
|
924
|
-
|
|
925
|
-
|
|
1206
|
+
T("div", $n, [
|
|
1207
|
+
T("div", {
|
|
926
1208
|
class: "mp-dom-renderer__frame",
|
|
927
|
-
style: Se(
|
|
1209
|
+
style: Se(P.value)
|
|
928
1210
|
}, [
|
|
929
|
-
|
|
1211
|
+
T("video", Ne({
|
|
930
1212
|
ref_key: "videoRef",
|
|
931
1213
|
ref: i,
|
|
932
1214
|
class: "mp-dom-renderer__node",
|
|
933
|
-
style:
|
|
934
|
-
preload:
|
|
1215
|
+
style: k.value,
|
|
1216
|
+
preload: m.active && m.enabled && m.loadEnabled ? "auto" : "none",
|
|
935
1217
|
playsinline: "",
|
|
936
1218
|
"webkit-playsinline": "true",
|
|
937
1219
|
crossorigin: "anonymous"
|
|
938
|
-
},
|
|
939
|
-
onEnded:
|
|
940
|
-
onError:
|
|
941
|
-
}), null, 16,
|
|
1220
|
+
}, vt(g(v).events, !0), {
|
|
1221
|
+
onEnded: I,
|
|
1222
|
+
onError: w[0] || (w[0] = (R) => a("liveEnded"))
|
|
1223
|
+
}), null, 16, Tn)
|
|
942
1224
|
], 4)
|
|
943
1225
|
]),
|
|
944
|
-
|
|
1226
|
+
T("div", {
|
|
945
1227
|
ref_key: "stillRef",
|
|
946
1228
|
ref: r,
|
|
947
|
-
class:
|
|
1229
|
+
class: Ie(["mp-live-photo__still", { "is-playing": S.value }])
|
|
948
1230
|
}, [
|
|
949
|
-
|
|
950
|
-
"
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
"
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
"
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1231
|
+
De(yt, {
|
|
1232
|
+
ref_key: "imageRendererRef",
|
|
1233
|
+
ref: u,
|
|
1234
|
+
"request-version": m.requestVersion,
|
|
1235
|
+
"load-enabled": m.loadEnabled,
|
|
1236
|
+
priority: m.priority,
|
|
1237
|
+
"resource-policy": m.resourcePolicy,
|
|
1238
|
+
"resolve-source": m.resolveSource,
|
|
1239
|
+
onOriginalState: w[1] || (w[1] = (R, f) => a("originalState", R, f)),
|
|
1240
|
+
media: m.media,
|
|
1241
|
+
"initial-image": m.initialImage,
|
|
1242
|
+
rendering: m.rendering,
|
|
1243
|
+
core: m.core,
|
|
1244
|
+
quality: m.quality,
|
|
1245
|
+
onReady: w[2] || (w[2] = (R) => a("ready", R)),
|
|
1246
|
+
onError: w[3] || (w[3] = (R) => a("error", R))
|
|
963
1247
|
}, null, 8, ["request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "media", "initial-image", "rendering", "core", "quality"])
|
|
964
1248
|
], 2)
|
|
965
1249
|
], 2)
|
|
966
|
-
], 8,
|
|
1250
|
+
], 8, Fn));
|
|
967
1251
|
}
|
|
968
1252
|
});
|
|
969
|
-
function
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
return
|
|
1253
|
+
function zn(t, n) {
|
|
1254
|
+
const o = document.createElement("canvas"), e = Math.min(1, Math.sqrt(se.maxCanvasPixels / (n.width * n.height)));
|
|
1255
|
+
o.width = Math.max(1, Math.round(n.width * e)), o.height = Math.max(1, Math.round(n.height * e));
|
|
1256
|
+
const a = Math.min(o.width / t.videoWidth, o.height / t.videoHeight), i = t.videoWidth * a, l = t.videoHeight * a;
|
|
1257
|
+
return o.getContext("2d").drawImage(t, (o.width - i) / 2, (o.height - l) / 2, i, l), t.pause(), o;
|
|
974
1258
|
}
|
|
975
|
-
const
|
|
1259
|
+
const Dn = {
|
|
976
1260
|
class: "mp-video-icon--generic",
|
|
977
1261
|
width: "22",
|
|
978
1262
|
height: "22",
|
|
@@ -983,19 +1267,19 @@ const ha = {
|
|
|
983
1267
|
"stroke-linecap": "round",
|
|
984
1268
|
"stroke-linejoin": "round",
|
|
985
1269
|
"aria-hidden": "true"
|
|
986
|
-
},
|
|
1270
|
+
}, In = ["d", "fill"], qn = ["src"], On = ["src"], ot = /* @__PURE__ */ $e({
|
|
987
1271
|
__name: "VideoIcon",
|
|
988
1272
|
props: {
|
|
989
1273
|
name: {}
|
|
990
1274
|
},
|
|
991
|
-
setup(
|
|
992
|
-
const
|
|
1275
|
+
setup(t) {
|
|
1276
|
+
const n = t, o = {
|
|
993
1277
|
play: ["mobile-play", "pc-play"],
|
|
994
1278
|
replay: ["mobile-play", "pc-play"],
|
|
995
1279
|
pause: ["mobile-pause", "pc-pause"],
|
|
996
1280
|
fullscreen: ["mobile-fullscreen", "pc-fullscreen"],
|
|
997
1281
|
exit: ["mobile-fullscreen", "pc-exit"]
|
|
998
|
-
},
|
|
1282
|
+
}, e = {
|
|
999
1283
|
"mobile-play": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='18px'%20height='18px'%20viewBox='0%200%2018%2018'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e三角形%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2时间轴-查看视频'%20transform='translate(-18.000000,%20-687.000000)'%20fill='%23333333'%3e%3cg%20id='编组-5'%20transform='translate(0.000000,%20672.000000)'%3e%3cg%20id='编组-4'%20transform='translate(18.000000,%2012.913043)'%3e%3cpath%20d='M13.5185936,7.08213339%20L18.1443888,14.1750193%20C19.2003225,15.7941177%2018.7437874,17.9626598%2017.1246889,19.0185936%20C16.5559936,19.3894818%2015.8917011,19.5869565%2015.2127517,19.5869565%20L5.96116137,19.5869565%20C4.02816475,19.5869565%202.46116137,18.0199531%202.46116137,16.0869565%20C2.46116137,15.4080071%202.65863607,14.7437145%203.02952428,14.1750193%20L7.65531943,7.08213339%20C8.71125321,5.46303494%2010.8797953,5.00649976%2012.4988938,6.06243353%20C12.9058908,6.3278664%2013.2531607,6.67513633%2013.5185936,7.08213339%20Z'%20id='三角形'%20transform='translate(10.586957,%2011.086957)%20rotate(90.000000)%20translate(-10.586957,%20-11.086957)%20'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1000
1284
|
"mobile-pause": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='18px'%20height='18px'%20viewBox='0%200%2018%2018'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e暂停%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2时间轴-观看视频'%20transform='translate(-17.000000,%20-687.000000)'%20fill='%23333333'%3e%3cg%20id='编组-5'%20transform='translate(0.000000,%20672.000000)'%3e%3cg%20id='编组-3'%20transform='translate(17.000000,%2012.913043)'%3e%3cg%20id='暂停-2'%20transform='translate(0.000000,%202.086957)'%3e%3cg%20id='暂停'%20transform='translate(3.000000,%201.500000)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='3.5'%20height='15'%20rx='1.75'%3e%3c/rect%3e%3crect%20id='矩形备份-7'%20x='9'%20y='0'%20width='3.5'%20height='15'%20rx='1.75'%3e%3c/rect%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1001
1285
|
"mobile-fullscreen": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='24px'%20height='24px'%20viewBox='0%200%2024%2024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e横竖屏备份%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='懒猫微服-图标库2.0'%20transform='translate(-449.000000,%20-196.000000)'%20stroke='%23333333'%20stroke-width='1.5'%3e%3cg%20id='横竖屏'%20transform='translate(449.000000,%20196.000000)'%3e%3crect%20id='矩形'%20x='3.75'%20y='9.75'%20width='16.5'%20height='10.5'%20rx='4'%3e%3c/rect%3e%3crect%20id='矩形'%20fill='%23FFFFFF'%20x='3.75'%20y='3.75'%20width='10.5'%20height='16.5'%20rx='4'%3e%3c/rect%3e%3cline%20x1='7.5'%20y1='7'%20x2='10.5'%20y2='7'%20id='路径-83'%20stroke-linecap='round'%3e%3c/line%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
@@ -1004,7 +1288,7 @@ const ha = {
|
|
|
1004
1288
|
"pc-pause": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e暂停%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-737.000000,%20-1017.000000)'%20fill='%23FFFFFF'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组'%20transform='translate(646.000000,%20970.000000)'%3e%3cg%20id='暂停-2'%20transform='translate(23.000000,%2047.000000)'%3e%3cg%20id='暂停'%20transform='translate(1.000000,%200.000000)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='4'%20height='16'%20rx='2'%3e%3c/rect%3e%3crect%20id='矩形备份-4'%20x='10'%20y='0'%20width='4'%20height='16'%20rx='2'%3e%3c/rect%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1005
1289
|
"pc-fullscreen": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e形状%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-1236.000000,%20-1017.000000)'%20fill='%23FFFFFF'%20fill-rule='nonzero'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组'%20transform='translate(646.000000,%20970.000000)'%3e%3cg%20id='形状-2'%20transform='translate(522.000000,%2047.000000)'%3e%3cpath%20d='M2.64896326,8.31181102%20C3.0069116,8.31181102%203.29792652,8.60254391%203.29792652,8.96014537%20L3.297,11.774%20L6.30847581,8.766808%20C6.56165879,8.51387038%206.97344489,8.51387038%207.22662786,8.766808%20C7.47981084,9.01974561%207.47981084,9.43113265%207.22662786,9.68407026%20L4.204,12.701%20L7.04328847,12.7018776%20C7.40123681,12.7018776%207.69225716,12.9926105%207.69225716,13.350212%20C7.6937068,13.7092671%207.40269189,14%207.04328847,14%20L3.79410695,14%20C2.80465624,14%202,13.1961236%202,12.2076317%20L2,8.96014537%20C2,8.60254391%202.29101491,8.31181102%202.64896326,8.31181102%20Z%20M12.2058931,2%20C12.6893524,2%2013.1286932,2.19192028%2013.4516066,2.50352194%20C13.4593844,2.50982425%2013.4671226,2.51718474%2013.4747181,2.52477286%20L13.4959896,2.54786191%20C13.8078935,2.87046237%2014,3.30937746%2014,3.79236826%20L14,7.03985463%20C14,7.39745609%2013.7089851,7.68818898%2013.3510367,7.68818898%20C12.9930884,7.68818898%2012.7020735,7.39745609%2012.7020735,7.03985463%20L12.702,4.213%20L9.67842852,7.23464567%20C9.55183703,7.36111448%209.38450346,7.42507571%209.21862495,7.42507571%20C9.05274645,7.42507571%208.88686795,7.36111448%208.76027646,7.23464567%20C8.50709349,6.98170806%208.50709349,6.57032102%208.76027646,6.3173834%20L11.783,3.296%20L8.95525646,3.29666869%20C8.59730811,3.29666869%208.3062932,3.0059358%208.3062932,2.64833434%20C8.3062932,2.29073289%208.59730811,2%208.95525646,2%20L12.2058931,2%20Z'%20id='全屏'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1006
1290
|
"pc-exit": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e形状备份%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-1275.000000,%20-1007.000000)'%20fill='%23FFFFFF'%20fill-rule='nonzero'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组备份'%20transform='translate(601.000000,%20987.000000)'%3e%3cg%20id='形状-2'%20transform='translate(606.000000,%2020.000000)'%3e%3cpath%20d='M5.89959985,8.31181102%20C6.88905056,8.31181102%207.6937068,9.11568746%207.6937068,10.1041793%20L7.6937068,13.3516657%20C7.6937068,13.7092671%207.40269189,14%207.04474354,14%20C6.6867952,14%206.39578028,13.7092671%206.39578028,13.3516657%20L6.395,10.514%20L3.43761368,13.4679588%20C3.31102219,13.5958813%203.14514369,13.6583889%202.97926519,13.6583889%20C2.81338669,13.6583889%202.64750818,13.5944276%202.5209167,13.4679588%20C2.26773372,13.2150212%202.26773372,12.8036342%202.5209167,12.5506965%20L5.465,9.608%20L2.64896326,9.60847971%20C2.29101491,9.60847971%202,9.31774682%202,8.96014537%20C2,8.60254391%202.29101491,8.31181102%202.64896326,8.31181102%20L5.89959985,8.31181102%20Z%20M8.9567061,2%20C9.31465444,2%209.60566936,2.29073289%209.60566936,2.64833434%20L9.605,5.473%20L12.556566,2.52477286%20C12.809749,2.27183525%2013.2215351,2.27183525%2013.4747181,2.52477286%20C13.7279011,2.77771048%2013.7279011,3.18909752%2013.4747181,3.44203513%20L10.523,6.39%20L13.3510313,6.39006663%20C13.7089797,6.39006663%2014,6.68079952%2014,7.03840097%20C14.0014496,7.39745609%2013.7104347,7.68818898%2013.3510313,7.68818898%20L10.1018498,7.68818898%20C9.11239908,7.68818898%208.30774284,6.88431254%208.30774284,5.89582071%20L8.30774284,2.64833434%20C8.30774284,2.29073289%208.59875775,2%208.9567061,2%20Z'%20id='全屏'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href
|
|
1007
|
-
},
|
|
1291
|
+
}, a = {
|
|
1008
1292
|
play: ["m9 5 11 7-11 7Z"],
|
|
1009
1293
|
pause: ["M8 5v14M16 5v14"],
|
|
1010
1294
|
replay: ["M4 10a8 8 0 1 1 1 7", "M4 4v6h6"],
|
|
@@ -1013,38 +1297,38 @@ const ha = {
|
|
|
1013
1297
|
volume: ["m11 4-6 5H2v6h3l6 5Z", "M15 8a6 6 0 0 1 0 8M18 5a10 10 0 0 1 0 14"],
|
|
1014
1298
|
muted: ["m11 4-6 5H2v6h3l6 5Z", "m16 9 6 6m0-6-6 6"]
|
|
1015
1299
|
};
|
|
1016
|
-
return (i,
|
|
1017
|
-
class:
|
|
1300
|
+
return (i, l) => (O(), V("span", {
|
|
1301
|
+
class: Ie(["mp-video-icon", { "has-album-icon": n.name in o }])
|
|
1018
1302
|
}, [
|
|
1019
|
-
(
|
|
1020
|
-
(
|
|
1021
|
-
key:
|
|
1303
|
+
(O(), V("svg", Dn, [
|
|
1304
|
+
(O(!0), V(Le, null, Ze(a[i.name], (r, u) => (O(), V("path", {
|
|
1305
|
+
key: u,
|
|
1022
1306
|
d: r,
|
|
1023
1307
|
fill: i.name === "play" ? "currentColor" : "none"
|
|
1024
|
-
}, null, 8,
|
|
1308
|
+
}, null, 8, In))), 128))
|
|
1025
1309
|
])),
|
|
1026
|
-
i.name in
|
|
1027
|
-
|
|
1310
|
+
i.name in o ? (O(), V(Le, { key: 0 }, [
|
|
1311
|
+
T("img", {
|
|
1028
1312
|
class: "mp-video-icon--mobile",
|
|
1029
|
-
src:
|
|
1313
|
+
src: e[o[i.name][0]],
|
|
1030
1314
|
alt: "",
|
|
1031
1315
|
"aria-hidden": "true",
|
|
1032
1316
|
draggable: "false"
|
|
1033
|
-
}, null, 8,
|
|
1034
|
-
|
|
1317
|
+
}, null, 8, qn),
|
|
1318
|
+
T("img", {
|
|
1035
1319
|
class: "mp-video-icon--desktop",
|
|
1036
|
-
src:
|
|
1320
|
+
src: e[o[i.name][1]],
|
|
1037
1321
|
alt: "",
|
|
1038
1322
|
"aria-hidden": "true",
|
|
1039
1323
|
draggable: "false"
|
|
1040
|
-
}, null, 8,
|
|
1041
|
-
], 64)) :
|
|
1324
|
+
}, null, 8, On)
|
|
1325
|
+
], 64)) : re("", !0)
|
|
1042
1326
|
], 2));
|
|
1043
1327
|
}
|
|
1044
|
-
}),
|
|
1328
|
+
}), An = {
|
|
1045
1329
|
key: 0,
|
|
1046
1330
|
class: "mp-video-seek-preview"
|
|
1047
|
-
},
|
|
1331
|
+
}, _n = ["aria-label", "disabled"], Vn = { class: "mp-video-time" }, Un = ["tabindex", "aria-disabled", "aria-valuemax", "aria-valuenow", "aria-valuetext"], Yn = /* @__PURE__ */ T("span", { class: "mp-video-progress__rail" }, null, -1), Hn = { class: "mp-video-time" }, Xn = ["aria-label", "aria-pressed"], Wn = ["aria-label", "disabled"], Nn = /* @__PURE__ */ $e({
|
|
1048
1332
|
__name: "VideoControls",
|
|
1049
1333
|
props: {
|
|
1050
1334
|
playback: {},
|
|
@@ -1052,133 +1336,134 @@ const ha = {
|
|
|
1052
1336
|
canFullscreen: { type: Boolean }
|
|
1053
1337
|
},
|
|
1054
1338
|
emits: ["fullscreen"],
|
|
1055
|
-
setup(
|
|
1056
|
-
const
|
|
1057
|
-
function
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1339
|
+
setup(t, { emit: n }) {
|
|
1340
|
+
const o = t, e = n, a = L(), { state: i, seekable: l, displayTime: r, progress: u, bufferedRanges: v } = o.playback;
|
|
1341
|
+
function c(k) {
|
|
1342
|
+
const p = a.value.getBoundingClientRect();
|
|
1343
|
+
o.playback.scrub((k.clientX - p.left) / Math.max(1, p.width) * i.duration);
|
|
1060
1344
|
}
|
|
1061
|
-
function
|
|
1062
|
-
!
|
|
1345
|
+
function M(k) {
|
|
1346
|
+
!l.value || k.pointerType === "mouse" && k.button !== 0 || (a.value.setPointerCapture(k.pointerId), o.playback.beginScrub(), c(k));
|
|
1063
1347
|
}
|
|
1064
|
-
function
|
|
1065
|
-
i.scrubbing &&
|
|
1348
|
+
function C(k) {
|
|
1349
|
+
i.scrubbing && c(k);
|
|
1066
1350
|
}
|
|
1067
|
-
function
|
|
1068
|
-
i.scrubbing && (
|
|
1351
|
+
function S(k) {
|
|
1352
|
+
i.scrubbing && (c(k), o.playback.endScrub());
|
|
1069
1353
|
}
|
|
1070
|
-
function P(
|
|
1071
|
-
|
|
1354
|
+
function P(k) {
|
|
1355
|
+
o.playback.beginScrub(), o.playback.scrub(r.value + k), o.playback.endScrub();
|
|
1072
1356
|
}
|
|
1073
|
-
return (
|
|
1357
|
+
return (k, p) => (O(), V("div", {
|
|
1074
1358
|
class: "mp-video-controls",
|
|
1075
1359
|
"data-preview-control": "",
|
|
1076
|
-
onPointerdown:
|
|
1360
|
+
onPointerdown: p[9] || (p[9] = ae(() => {
|
|
1077
1361
|
}, ["stop"])),
|
|
1078
|
-
onPointermove:
|
|
1362
|
+
onPointermove: p[10] || (p[10] = ae(() => {
|
|
1079
1363
|
}, ["stop"])),
|
|
1080
|
-
onPointerup:
|
|
1364
|
+
onPointerup: p[11] || (p[11] = ae(() => {
|
|
1081
1365
|
}, ["stop"])),
|
|
1082
|
-
onPointercancel:
|
|
1366
|
+
onPointercancel: p[12] || (p[12] = ae(() => {
|
|
1083
1367
|
}, ["stop"])),
|
|
1084
|
-
onClick:
|
|
1368
|
+
onClick: p[13] || (p[13] = ae(() => {
|
|
1085
1369
|
}, ["stop"])),
|
|
1086
|
-
onDblclick:
|
|
1370
|
+
onDblclick: p[14] || (p[14] = ae(() => {
|
|
1087
1371
|
}, ["stop"])),
|
|
1088
|
-
onKeydown:
|
|
1372
|
+
onKeydown: p[15] || (p[15] = ae(() => {
|
|
1089
1373
|
}, ["stop"]))
|
|
1090
1374
|
}, [
|
|
1091
|
-
g(i).scrubbing ? (
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
])) :
|
|
1095
|
-
|
|
1375
|
+
g(i).scrubbing ? (O(), V("div", An, [
|
|
1376
|
+
Xt(de(g(Ae)(g(r))), 1),
|
|
1377
|
+
T("span", null, " / " + de(g(Ae)(g(i).duration)), 1)
|
|
1378
|
+
])) : re("", !0),
|
|
1379
|
+
T("button", {
|
|
1096
1380
|
type: "button",
|
|
1097
1381
|
"aria-label": g(i).ended ? "重新播放视频" : g(i).playing ? "暂停视频" : "播放视频",
|
|
1098
1382
|
disabled: g(i).status === "error",
|
|
1099
|
-
onClick:
|
|
1100
|
-
(
|
|
1383
|
+
onClick: p[0] || (p[0] = //@ts-ignore
|
|
1384
|
+
(...$) => k.playback.toggle && k.playback.toggle(...$))
|
|
1101
1385
|
}, [
|
|
1102
|
-
|
|
1386
|
+
De(ot, {
|
|
1103
1387
|
name: g(i).ended ? "replay" : g(i).playing ? "pause" : "play"
|
|
1104
1388
|
}, null, 8, ["name"])
|
|
1105
|
-
], 8,
|
|
1106
|
-
|
|
1107
|
-
|
|
1389
|
+
], 8, _n),
|
|
1390
|
+
T("time", Vn, de(g(Ae)(g(r))), 1),
|
|
1391
|
+
T("div", {
|
|
1108
1392
|
ref_key: "track",
|
|
1109
|
-
ref:
|
|
1110
|
-
class:
|
|
1393
|
+
ref: a,
|
|
1394
|
+
class: Ie(["mp-video-progress", { "is-scrubbing": g(i).scrubbing }]),
|
|
1111
1395
|
role: "slider",
|
|
1112
1396
|
"aria-label": "视频进度",
|
|
1113
|
-
tabindex: g(
|
|
1114
|
-
"aria-disabled": !g(
|
|
1397
|
+
tabindex: g(l) ? 0 : -1,
|
|
1398
|
+
"aria-disabled": !g(l),
|
|
1115
1399
|
"aria-valuemin": "0",
|
|
1116
1400
|
"aria-valuemax": g(i).duration,
|
|
1117
1401
|
"aria-valuenow": g(r),
|
|
1118
|
-
"aria-valuetext": `${g(
|
|
1119
|
-
onPointerdown:
|
|
1120
|
-
onPointermove:
|
|
1121
|
-
onPointerup:
|
|
1122
|
-
onPointercancel:
|
|
1123
|
-
onLostpointercapture:
|
|
1402
|
+
"aria-valuetext": `${g(Ae)(g(r))} / ${g(Ae)(g(i).duration)}`,
|
|
1403
|
+
onPointerdown: ae(M, ["prevent"]),
|
|
1404
|
+
onPointermove: ae(C, ["prevent"]),
|
|
1405
|
+
onPointerup: ae(S, ["prevent"]),
|
|
1406
|
+
onPointercancel: p[1] || (p[1] = ($) => k.playback.endScrub(!1)),
|
|
1407
|
+
onLostpointercapture: p[2] || (p[2] = ($) => k.playback.endScrub(!1)),
|
|
1124
1408
|
onKeydown: [
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1409
|
+
p[3] || (p[3] = it(ae(($) => P(-5), ["prevent"]), ["left"])),
|
|
1410
|
+
p[4] || (p[4] = it(ae(($) => P(5), ["prevent"]), ["right"])),
|
|
1411
|
+
p[5] || (p[5] = it(ae(($) => P(-g(i).duration), ["prevent"]), ["home"])),
|
|
1412
|
+
p[6] || (p[6] = it(ae(($) => P(g(i).duration), ["prevent"]), ["end"]))
|
|
1129
1413
|
]
|
|
1130
1414
|
}, [
|
|
1131
|
-
|
|
1132
|
-
|
|
1415
|
+
Yn,
|
|
1416
|
+
(O(!0), V(Le, null, Ze(g(v), ($, I) => (O(), V("span", {
|
|
1417
|
+
key: I,
|
|
1133
1418
|
class: "mp-video-progress__buffered",
|
|
1134
|
-
style: Se({ width: `${
|
|
1135
|
-
}, null, 4),
|
|
1136
|
-
|
|
1419
|
+
style: Se({ left: `${$.left}%`, width: `${$.width}%` })
|
|
1420
|
+
}, null, 4))), 128)),
|
|
1421
|
+
T("span", {
|
|
1137
1422
|
class: "mp-video-progress__played",
|
|
1138
|
-
style: Se({ width: `${g(
|
|
1423
|
+
style: Se({ width: `${g(u)}%` })
|
|
1139
1424
|
}, null, 4),
|
|
1140
|
-
|
|
1425
|
+
T("span", {
|
|
1141
1426
|
class: "mp-video-progress__thumb",
|
|
1142
|
-
style: Se({ left: `${g(
|
|
1427
|
+
style: Se({ left: `${g(u)}%` })
|
|
1143
1428
|
}, null, 4)
|
|
1144
|
-
], 42,
|
|
1145
|
-
|
|
1146
|
-
|
|
1429
|
+
], 42, Un),
|
|
1430
|
+
T("time", Hn, de(g(Ae)(g(i).duration)), 1),
|
|
1431
|
+
T("button", {
|
|
1147
1432
|
type: "button",
|
|
1148
1433
|
class: "mp-video-volume",
|
|
1149
1434
|
"aria-label": g(i).muted ? "开启声音" : "静音视频",
|
|
1150
1435
|
"aria-pressed": g(i).muted,
|
|
1151
|
-
onClick:
|
|
1152
|
-
(
|
|
1436
|
+
onClick: p[7] || (p[7] = //@ts-ignore
|
|
1437
|
+
(...$) => k.playback.toggleMuted && k.playback.toggleMuted(...$))
|
|
1153
1438
|
}, [
|
|
1154
|
-
|
|
1439
|
+
De(ot, {
|
|
1155
1440
|
name: g(i).muted ? "muted" : "volume"
|
|
1156
1441
|
}, null, 8, ["name"])
|
|
1157
|
-
], 8,
|
|
1158
|
-
|
|
1442
|
+
], 8, Xn),
|
|
1443
|
+
T("button", {
|
|
1159
1444
|
type: "button",
|
|
1160
|
-
"aria-label":
|
|
1161
|
-
disabled: !
|
|
1162
|
-
onClick:
|
|
1445
|
+
"aria-label": k.fullscreen ? "退出视频全屏" : "视频全屏",
|
|
1446
|
+
disabled: !k.canFullscreen,
|
|
1447
|
+
onClick: p[8] || (p[8] = ($) => e("fullscreen"))
|
|
1163
1448
|
}, [
|
|
1164
|
-
|
|
1165
|
-
name:
|
|
1449
|
+
De(ot, {
|
|
1450
|
+
name: k.fullscreen ? "exit" : "fullscreen"
|
|
1166
1451
|
}, null, 8, ["name"])
|
|
1167
|
-
], 8,
|
|
1452
|
+
], 8, Wn)
|
|
1168
1453
|
], 32));
|
|
1169
1454
|
}
|
|
1170
|
-
}),
|
|
1455
|
+
}), Zn = ["data-playback"], jn = ["muted", "loop", "preload"], Kn = {
|
|
1171
1456
|
key: 1,
|
|
1172
1457
|
class: "mp-video-loading",
|
|
1173
1458
|
role: "status",
|
|
1174
1459
|
"aria-label": "视频缓冲中"
|
|
1175
|
-
},
|
|
1176
|
-
|
|
1177
|
-
],
|
|
1460
|
+
}, Gn = /* @__PURE__ */ T("span", { class: "mp-spinner" }, null, -1), Qn = [
|
|
1461
|
+
Gn
|
|
1462
|
+
], Jn = ["aria-label"], ea = {
|
|
1178
1463
|
key: 3,
|
|
1179
|
-
class: "mp-
|
|
1464
|
+
class: "mp-video-error",
|
|
1180
1465
|
role: "alert"
|
|
1181
|
-
},
|
|
1466
|
+
}, ta = ["inert"], na = /* @__PURE__ */ $e({
|
|
1182
1467
|
inheritAttrs: !1,
|
|
1183
1468
|
__name: "VideoDomRenderer",
|
|
1184
1469
|
props: {
|
|
@@ -1187,8 +1472,8 @@ const ha = {
|
|
|
1187
1472
|
quality: { default: "screen" },
|
|
1188
1473
|
requestVersion: { default: 0 },
|
|
1189
1474
|
priority: { default: 0 },
|
|
1190
|
-
resourcePolicy: { default: () =>
|
|
1191
|
-
resolveSource: { type: Function, default:
|
|
1475
|
+
resourcePolicy: { default: () => Ke },
|
|
1476
|
+
resolveSource: { type: Function, default: Ge },
|
|
1192
1477
|
media: {},
|
|
1193
1478
|
videoLoader: { type: Function, default: lt },
|
|
1194
1479
|
core: {},
|
|
@@ -1204,159 +1489,150 @@ const ha = {
|
|
|
1204
1489
|
controlsTarget: { default: "body" }
|
|
1205
1490
|
},
|
|
1206
1491
|
emits: ["originalState", "ready", "error"],
|
|
1207
|
-
setup(
|
|
1208
|
-
const
|
|
1209
|
-
...
|
|
1492
|
+
setup(t, { expose: n, emit: o }) {
|
|
1493
|
+
const e = t, a = o, i = L(!1), l = Y(() => ({
|
|
1494
|
+
...e.media,
|
|
1210
1495
|
type: "image",
|
|
1211
|
-
src:
|
|
1212
|
-
})), r =
|
|
1496
|
+
src: e.media.poster || e.media.previewSrc || e.media.thumbnail
|
|
1497
|
+
})), r = L(), u = L(), v = L(!1), c = L(!1), M = qt(
|
|
1213
1498
|
() => r.value,
|
|
1214
|
-
(
|
|
1215
|
-
)
|
|
1499
|
+
(f) => a("error", f)
|
|
1500
|
+
);
|
|
1501
|
+
Tt(
|
|
1216
1502
|
() => r.value,
|
|
1217
|
-
() =>
|
|
1218
|
-
() =>
|
|
1219
|
-
() =>
|
|
1220
|
-
|
|
1221
|
-
b.state.status = "error", b.state.buffering = !1, o("error", E);
|
|
1222
|
-
}
|
|
1503
|
+
() => e.media,
|
|
1504
|
+
() => e.active && e.loadEnabled,
|
|
1505
|
+
() => e.videoLoader,
|
|
1506
|
+
M.sourceObserver
|
|
1223
1507
|
);
|
|
1224
|
-
|
|
1225
|
-
b.state.status = "loading", b.state.buffering = !0, B();
|
|
1226
|
-
}
|
|
1227
|
-
let P = () => {
|
|
1508
|
+
let C = () => {
|
|
1228
1509
|
};
|
|
1229
|
-
const { state:
|
|
1230
|
-
() =>
|
|
1510
|
+
const { state: S } = M, P = Y(
|
|
1511
|
+
() => e.controls && e.active && e.enabled && e.controlsVisible
|
|
1231
1512
|
);
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
1513
|
+
function k() {
|
|
1514
|
+
return e.teleportControls ? u.value.closest(".mp-viewer") : e.core.containerRef.value;
|
|
1234
1515
|
}
|
|
1235
|
-
async function
|
|
1236
|
-
if (
|
|
1516
|
+
async function p() {
|
|
1517
|
+
if (c.value)
|
|
1237
1518
|
try {
|
|
1238
|
-
document.fullscreenElement ===
|
|
1239
|
-
} catch (
|
|
1240
|
-
|
|
1519
|
+
document.fullscreenElement === k() ? await document.exitFullscreen() : document.fullscreenEnabled ? await k().requestFullscreen() : r.value.webkitEnterFullscreen();
|
|
1520
|
+
} catch (f) {
|
|
1521
|
+
a("error", _e(f));
|
|
1241
1522
|
}
|
|
1242
1523
|
}
|
|
1243
|
-
function
|
|
1244
|
-
|
|
1524
|
+
function $() {
|
|
1525
|
+
v.value = document.fullscreenElement === k();
|
|
1245
1526
|
}
|
|
1246
|
-
function
|
|
1247
|
-
!
|
|
1527
|
+
function I() {
|
|
1528
|
+
!e.active || !e.enabled ? M.pause() : e.autoplay && M.play();
|
|
1248
1529
|
}
|
|
1249
|
-
function
|
|
1250
|
-
document.hidden &&
|
|
1530
|
+
function y() {
|
|
1531
|
+
document.hidden && M.pause();
|
|
1251
1532
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1533
|
+
qe(() => {
|
|
1534
|
+
S.muted = r.value.muted, c.value = document.fullscreenEnabled || "webkitEnterFullscreen" in r.value, document.addEventListener("fullscreenchange", $), document.addEventListener("visibilitychange", y), C = J(() => [e.active, e.enabled, e.autoplay], I, {
|
|
1254
1535
|
flush: "post"
|
|
1255
|
-
}),
|
|
1256
|
-
}),
|
|
1257
|
-
|
|
1536
|
+
}), I();
|
|
1537
|
+
}), Fe(() => {
|
|
1538
|
+
C(), M.dispose(), document.removeEventListener("fullscreenchange", $), document.removeEventListener("visibilitychange", y), document.fullscreenElement === k() && document.exitFullscreen().catch(() => {
|
|
1258
1539
|
});
|
|
1259
1540
|
});
|
|
1260
|
-
const
|
|
1261
|
-
transform: `translate(-50%, -50%) translate3d(${
|
|
1262
|
-
})),
|
|
1263
|
-
width: `${
|
|
1264
|
-
height: `${
|
|
1265
|
-
transform: `rotate(${
|
|
1541
|
+
const x = Y(() => ({
|
|
1542
|
+
transform: `translate(-50%, -50%) translate3d(${e.core.state.offsetX}px, ${e.core.state.offsetY}px, 0)`
|
|
1543
|
+
})), m = Y(() => ({
|
|
1544
|
+
width: `${e.core.mediaSize.value.width * e.core.displayScale.value}px`,
|
|
1545
|
+
height: `${e.core.mediaSize.value.height * e.core.displayScale.value}px`,
|
|
1546
|
+
transform: `rotate(${e.core.state.rotation}deg)`
|
|
1266
1547
|
}));
|
|
1267
|
-
function
|
|
1268
|
-
i.value = !0,
|
|
1548
|
+
function w() {
|
|
1549
|
+
i.value = !0, e.core.setMediaElement(r.value), a("ready", "screen");
|
|
1269
1550
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return { image: i.value ?
|
|
1551
|
+
function R() {
|
|
1552
|
+
return { image: i.value ? zn(r.value, e.core.mediaSize.value) : e.core.mediaRef.value, scale: 1 };
|
|
1272
1553
|
}
|
|
1273
|
-
return
|
|
1554
|
+
return n({ togglePlayback: M.toggle, toggleFullscreen: p, playback: M, captureFrame: R }), (f, h) => (O(), V("div", {
|
|
1274
1555
|
ref_key: "host",
|
|
1275
|
-
ref:
|
|
1556
|
+
ref: u,
|
|
1276
1557
|
class: "mp-dom-renderer mp-video-player",
|
|
1277
|
-
"data-playback": g(
|
|
1558
|
+
"data-playback": g(S).ended ? "ended" : g(S).playing ? "playing" : "paused"
|
|
1278
1559
|
}, [
|
|
1279
|
-
i.value ?
|
|
1560
|
+
i.value ? re("", !0) : (O(), rt(yt, {
|
|
1280
1561
|
key: 0,
|
|
1281
|
-
media:
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
"
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
"
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1562
|
+
media: l.value,
|
|
1563
|
+
"original-enabled": !1,
|
|
1564
|
+
core: f.core,
|
|
1565
|
+
"initial-image": f.initialImage,
|
|
1566
|
+
rendering: f.rendering,
|
|
1567
|
+
quality: f.quality,
|
|
1568
|
+
"request-version": f.requestVersion,
|
|
1569
|
+
"load-enabled": f.loadEnabled,
|
|
1570
|
+
priority: f.priority,
|
|
1571
|
+
"resource-policy": f.resourcePolicy,
|
|
1572
|
+
"resolve-source": f.resolveSource,
|
|
1573
|
+
onReady: h[0] || (h[0] = (D) => a("ready", D)),
|
|
1574
|
+
onError: h[1] || (h[1] = (D) => a("error", D)),
|
|
1575
|
+
onOriginalState: h[2] || (h[2] = (D, z) => a("originalState", D, z))
|
|
1294
1576
|
}, null, 8, ["media", "core", "initial-image", "rendering", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source"])),
|
|
1295
|
-
|
|
1577
|
+
T("div", {
|
|
1296
1578
|
class: "mp-dom-renderer__frame",
|
|
1297
|
-
style: Se([
|
|
1579
|
+
style: Se([x.value, { visibility: i.value ? "inherit" : "hidden" }])
|
|
1298
1580
|
}, [
|
|
1299
|
-
|
|
1581
|
+
T("video", Ne({
|
|
1300
1582
|
ref_key: "videoRef",
|
|
1301
1583
|
ref: r,
|
|
1302
1584
|
class: "mp-dom-renderer__node",
|
|
1303
|
-
muted:
|
|
1304
|
-
loop:
|
|
1585
|
+
muted: f.muted,
|
|
1586
|
+
loop: f.loop,
|
|
1305
1587
|
playsinline: "",
|
|
1306
1588
|
"webkit-playsinline": "true",
|
|
1307
1589
|
crossorigin: "anonymous",
|
|
1308
|
-
preload:
|
|
1309
|
-
style:
|
|
1310
|
-
},
|
|
1590
|
+
preload: f.active && f.loadEnabled ? "auto" : "none",
|
|
1591
|
+
style: m.value
|
|
1592
|
+
}, vt(g(M).events, !0), { onPlaying: w }), null, 16, jn)
|
|
1311
1593
|
], 4),
|
|
1312
|
-
|
|
1313
|
-
|
|
1594
|
+
f.active && f.enabled && g(S).buffering && g(S).status !== "error" ? (O(), V("div", Kn, Qn)) : re("", !0),
|
|
1595
|
+
P.value && !g(S).playing && !g(S).buffering && g(S).status !== "error" ? (O(), V("button", {
|
|
1314
1596
|
key: 2,
|
|
1315
1597
|
type: "button",
|
|
1316
1598
|
class: "mp-video-center-play",
|
|
1317
1599
|
"data-preview-control": "",
|
|
1318
|
-
"aria-label": g(
|
|
1319
|
-
onPointerdown:
|
|
1600
|
+
"aria-label": g(S).ended ? "重新播放" : "开始播放视频",
|
|
1601
|
+
onPointerdown: h[3] || (h[3] = ae(() => {
|
|
1320
1602
|
}, ["stop"])),
|
|
1321
|
-
onPointerup:
|
|
1603
|
+
onPointerup: h[4] || (h[4] = ae(() => {
|
|
1322
1604
|
}, ["stop"])),
|
|
1323
|
-
onClick:
|
|
1605
|
+
onClick: h[5] || (h[5] = ae(
|
|
1324
1606
|
//@ts-ignore
|
|
1325
|
-
(...
|
|
1607
|
+
(...D) => g(M).toggle && g(M).toggle(...D),
|
|
1326
1608
|
["stop"]
|
|
1327
1609
|
))
|
|
1328
1610
|
}, [
|
|
1329
|
-
|
|
1330
|
-
name: g(
|
|
1611
|
+
De(ot, {
|
|
1612
|
+
name: g(S).ended ? "replay" : "play"
|
|
1331
1613
|
}, null, 8, ["name"])
|
|
1332
|
-
], 40,
|
|
1333
|
-
g(
|
|
1334
|
-
|
|
1335
|
-
$("button", {
|
|
1336
|
-
type: "button",
|
|
1337
|
-
onClick: J(L, ["stop"])
|
|
1338
|
-
}, "重新加载视频")
|
|
1339
|
-
])) : ie("", !0),
|
|
1340
|
-
E.controls && E.active && E.enabled ? (z(), rt(Ct, {
|
|
1614
|
+
], 40, Jn)) : re("", !0),
|
|
1615
|
+
g(S).status === "error" ? (O(), V("div", ea, "视频暂时无法播放")) : re("", !0),
|
|
1616
|
+
f.controls && f.active && f.enabled ? (O(), rt($t, {
|
|
1341
1617
|
key: 4,
|
|
1342
|
-
to:
|
|
1343
|
-
disabled: !
|
|
1618
|
+
to: f.controlsTarget,
|
|
1619
|
+
disabled: !f.teleportControls
|
|
1344
1620
|
}, [
|
|
1345
|
-
|
|
1346
|
-
class:
|
|
1347
|
-
inert: !
|
|
1621
|
+
T("div", {
|
|
1622
|
+
class: Ie(["mp-video-control-layer", { "is-hidden": !P.value }]),
|
|
1623
|
+
inert: !P.value
|
|
1348
1624
|
}, [
|
|
1349
|
-
|
|
1350
|
-
playback: g(
|
|
1351
|
-
fullscreen:
|
|
1352
|
-
"can-fullscreen":
|
|
1353
|
-
onFullscreen:
|
|
1625
|
+
De(Nn, {
|
|
1626
|
+
playback: g(M),
|
|
1627
|
+
fullscreen: v.value,
|
|
1628
|
+
"can-fullscreen": c.value,
|
|
1629
|
+
onFullscreen: p
|
|
1354
1630
|
}, null, 8, ["playback", "fullscreen", "can-fullscreen"])
|
|
1355
|
-
], 10,
|
|
1356
|
-
], 8, ["to", "disabled"])) :
|
|
1357
|
-
], 8,
|
|
1631
|
+
], 10, ta)
|
|
1632
|
+
], 8, ["to", "disabled"])) : re("", !0)
|
|
1633
|
+
], 8, Zn));
|
|
1358
1634
|
}
|
|
1359
|
-
}),
|
|
1635
|
+
}), aa = ["data-scale", "data-rotation", "data-live-holding"], ia = /* @__PURE__ */ $e({
|
|
1360
1636
|
__name: "PreviewStage",
|
|
1361
1637
|
props: {
|
|
1362
1638
|
media: {},
|
|
@@ -1365,8 +1641,8 @@ const ha = {
|
|
|
1365
1641
|
active: { type: Boolean, default: !0 },
|
|
1366
1642
|
requestVersion: { default: 0 },
|
|
1367
1643
|
loadEnabled: { type: Boolean, default: !0 },
|
|
1368
|
-
resourcePolicy: { default: () =>
|
|
1369
|
-
resolveSource: { type: Function, default:
|
|
1644
|
+
resourcePolicy: { default: () => Ke },
|
|
1645
|
+
resolveSource: { type: Function, default: Ge },
|
|
1370
1646
|
inactiveResetDuration: { default: 0 },
|
|
1371
1647
|
disabled: { type: Boolean, default: !1 },
|
|
1372
1648
|
externalGestures: { type: Boolean, default: !1 },
|
|
@@ -1379,80 +1655,80 @@ const ha = {
|
|
|
1379
1655
|
quality: { default: "screen" }
|
|
1380
1656
|
},
|
|
1381
1657
|
emits: ["tap", "doubleTap", "scale", "swipeDownProgress", "close", "previous", "next", "pageDrag", "pageRelease", "ready", "error", "originalState", "liveState", "liveEnded"],
|
|
1382
|
-
setup(
|
|
1383
|
-
const
|
|
1384
|
-
motionActive: () =>
|
|
1385
|
-
interactive: () =>
|
|
1658
|
+
setup(t, { expose: n, emit: o }) {
|
|
1659
|
+
const e = t, a = o, i = L(!1), l = L("loading"), r = ln({
|
|
1660
|
+
motionActive: () => e.paging,
|
|
1661
|
+
interactive: () => e.active && !e.disabled,
|
|
1386
1662
|
zoomable: () => !0,
|
|
1387
|
-
doubleTapZoom: () =>
|
|
1388
|
-
zoomLimit: () => Math.max(8,
|
|
1389
|
-
holdable: () =>
|
|
1663
|
+
doubleTapZoom: () => Pt(e.media, r.core.viewportSize.value),
|
|
1664
|
+
zoomLimit: () => Math.max(8, Pt(e.media, r.core.viewportSize.value) * 2),
|
|
1665
|
+
holdable: () => e.media.type === "live-photo" && M.value === "ready" && l.value === "idle",
|
|
1390
1666
|
onHoldStart: () => {
|
|
1391
1667
|
i.value = !0;
|
|
1392
1668
|
},
|
|
1393
1669
|
onHoldEnd: () => {
|
|
1394
|
-
i.value = !1,
|
|
1670
|
+
i.value = !1, a("liveEnded");
|
|
1395
1671
|
},
|
|
1396
|
-
onTap: () =>
|
|
1397
|
-
onDoubleTap: () =>
|
|
1398
|
-
onScale: (
|
|
1399
|
-
|
|
1672
|
+
onTap: () => a("tap"),
|
|
1673
|
+
onDoubleTap: () => a("doubleTap"),
|
|
1674
|
+
onScale: (y) => {
|
|
1675
|
+
e.active && a("scale", y);
|
|
1400
1676
|
},
|
|
1401
|
-
onSwipeDownProgress: (
|
|
1402
|
-
|
|
1677
|
+
onSwipeDownProgress: (y) => {
|
|
1678
|
+
e.active && a("swipeDownProgress", y);
|
|
1403
1679
|
},
|
|
1404
|
-
onSwipeDownClose: () =>
|
|
1405
|
-
onSwipeLeft: () =>
|
|
1406
|
-
onSwipeRight: () =>
|
|
1407
|
-
onPageDrag: (
|
|
1408
|
-
|
|
1680
|
+
onSwipeDownClose: () => a("close"),
|
|
1681
|
+
onSwipeLeft: () => a("next"),
|
|
1682
|
+
onSwipeRight: () => a("previous"),
|
|
1683
|
+
onPageDrag: (y) => {
|
|
1684
|
+
e.active && a("pageDrag", y);
|
|
1409
1685
|
},
|
|
1410
|
-
onPageRelease: (
|
|
1411
|
-
}),
|
|
1412
|
-
() =>
|
|
1413
|
-
),
|
|
1414
|
-
() =>
|
|
1686
|
+
onPageRelease: (y, x) => a("pageRelease", y, x)
|
|
1687
|
+
}), u = r.core.containerRef, v = r.core.downDragStyle, c = r.core.state, M = L("loading"), C = L("thumbnail"), S = L(), P = Y(
|
|
1688
|
+
() => e.media.type === "video" ? na : e.media.type === "live-photo" ? Bn : yt
|
|
1689
|
+
), k = Y(
|
|
1690
|
+
() => C.value === "full" || e.quality === "full" ? "full" : e.quality
|
|
1415
1691
|
);
|
|
1416
|
-
|
|
1692
|
+
J(
|
|
1417
1693
|
[
|
|
1418
|
-
() =>
|
|
1419
|
-
() =>
|
|
1420
|
-
() =>
|
|
1421
|
-
() =>
|
|
1694
|
+
() => e.media.id,
|
|
1695
|
+
() => e.media.src,
|
|
1696
|
+
() => e.media.previewSrc,
|
|
1697
|
+
() => e.media.thumbnail
|
|
1422
1698
|
],
|
|
1423
1699
|
() => {
|
|
1424
|
-
|
|
1700
|
+
C.value = "thumbnail";
|
|
1425
1701
|
}
|
|
1426
|
-
),
|
|
1427
|
-
() =>
|
|
1702
|
+
), J(
|
|
1703
|
+
() => e.media.id,
|
|
1428
1704
|
() => {
|
|
1429
|
-
|
|
1705
|
+
M.value = "loading", r.core.setRotation(0);
|
|
1430
1706
|
}
|
|
1431
|
-
),
|
|
1432
|
-
[() =>
|
|
1433
|
-
([
|
|
1434
|
-
r.core.setMediaSize({ width:
|
|
1707
|
+
), J(
|
|
1708
|
+
[() => e.media.width, () => e.media.height],
|
|
1709
|
+
([y, x]) => {
|
|
1710
|
+
r.core.setMediaSize({ width: y, height: x });
|
|
1435
1711
|
},
|
|
1436
1712
|
{ immediate: !0 }
|
|
1437
|
-
),
|
|
1438
|
-
() =>
|
|
1439
|
-
(
|
|
1440
|
-
|
|
1713
|
+
), J(
|
|
1714
|
+
() => e.active,
|
|
1715
|
+
(y) => {
|
|
1716
|
+
y || r.core.resetTransform(e.inactiveResetDuration);
|
|
1441
1717
|
}
|
|
1442
|
-
),
|
|
1443
|
-
() =>
|
|
1444
|
-
(
|
|
1445
|
-
|
|
1718
|
+
), J(
|
|
1719
|
+
() => e.disabled,
|
|
1720
|
+
(y) => {
|
|
1721
|
+
y && r.core.cancelGesture(!0);
|
|
1446
1722
|
}
|
|
1447
1723
|
);
|
|
1448
|
-
function
|
|
1449
|
-
|
|
1724
|
+
function p(y) {
|
|
1725
|
+
y === "full" && (C.value = y), M.value = "ready", a("ready", y);
|
|
1450
1726
|
}
|
|
1451
|
-
function
|
|
1452
|
-
|
|
1727
|
+
function $(y) {
|
|
1728
|
+
l.value = y, a("liveState", y);
|
|
1453
1729
|
}
|
|
1454
|
-
const I =
|
|
1455
|
-
() =>
|
|
1730
|
+
const I = Y(
|
|
1731
|
+
() => e.externalGestures ? {} : {
|
|
1456
1732
|
wheel: r.onWheel,
|
|
1457
1733
|
pointerdown: r.onPointerDown,
|
|
1458
1734
|
pointermove: r.onPointerMove,
|
|
@@ -1461,311 +1737,311 @@ const ha = {
|
|
|
1461
1737
|
lostpointercapture: r.onPointerCancel
|
|
1462
1738
|
}
|
|
1463
1739
|
);
|
|
1464
|
-
return
|
|
1740
|
+
return n({
|
|
1465
1741
|
onPointerDown: r.onPointerDown,
|
|
1466
1742
|
onPointerMove: r.onPointerMove,
|
|
1467
1743
|
onPointerUp: r.onPointerUp,
|
|
1468
1744
|
onPointerCancel: r.onPointerCancel,
|
|
1469
1745
|
onWheel: r.onWheel,
|
|
1470
|
-
readiness:
|
|
1746
|
+
readiness: M,
|
|
1471
1747
|
core: r.core,
|
|
1472
1748
|
rotateBy: r.core.rotateBy,
|
|
1473
1749
|
resetTransform: r.core.resetTransform,
|
|
1474
|
-
zoomIn: () => r.core.zoomTo(
|
|
1475
|
-
zoomOut: () => r.core.zoomTo(
|
|
1476
|
-
togglePlayback: () =>
|
|
1477
|
-
toggleFullscreen: () =>
|
|
1478
|
-
captureFrame: () =>
|
|
1479
|
-
}), (
|
|
1750
|
+
zoomIn: () => r.core.zoomTo(c.level * 1.5, void 0, !0),
|
|
1751
|
+
zoomOut: () => r.core.zoomTo(c.level / 1.5, void 0, !0),
|
|
1752
|
+
togglePlayback: () => S.value.togglePlayback(),
|
|
1753
|
+
toggleFullscreen: () => S.value.toggleFullscreen(),
|
|
1754
|
+
captureFrame: () => S.value.captureFrame()
|
|
1755
|
+
}), (y, x) => (O(), V("div", Ne({
|
|
1480
1756
|
ref_key: "containerRef",
|
|
1481
|
-
ref:
|
|
1482
|
-
class: ["mp-stage", { "is-zoomed": g(
|
|
1483
|
-
style: g(
|
|
1484
|
-
"data-scale": g(
|
|
1485
|
-
"data-rotation": g(
|
|
1757
|
+
ref: u,
|
|
1758
|
+
class: ["mp-stage", { "is-zoomed": g(c).level > 1, "is-dismissing": g(c).draggingDown }],
|
|
1759
|
+
style: g(v),
|
|
1760
|
+
"data-scale": g(c).level.toFixed(3),
|
|
1761
|
+
"data-rotation": g(c).rotation,
|
|
1486
1762
|
"data-live-holding": i.value,
|
|
1487
|
-
onContextmenu:
|
|
1488
|
-
|
|
1763
|
+
onContextmenu: x[3] || (x[3] = (m) => {
|
|
1764
|
+
y.media.type === "live-photo" && m.preventDefault();
|
|
1489
1765
|
})
|
|
1490
|
-
},
|
|
1491
|
-
(
|
|
1766
|
+
}, vt(I.value, !0)), [
|
|
1767
|
+
(O(), rt(Wt(P.value), Ne({
|
|
1492
1768
|
ref_key: "rendererRef",
|
|
1493
|
-
ref:
|
|
1494
|
-
media:
|
|
1495
|
-
},
|
|
1496
|
-
"initial-image":
|
|
1497
|
-
rendering:
|
|
1769
|
+
ref: S,
|
|
1770
|
+
media: y.media
|
|
1771
|
+
}, y.media.type === "video" ? { videoLoader: y.videoLoader } : {}, {
|
|
1772
|
+
"initial-image": y.initialImage,
|
|
1773
|
+
rendering: y.rendering,
|
|
1498
1774
|
core: g(r).core,
|
|
1499
|
-
quality:
|
|
1500
|
-
"request-version":
|
|
1501
|
-
"load-enabled":
|
|
1502
|
-
priority:
|
|
1503
|
-
"resource-policy":
|
|
1504
|
-
"resolve-source":
|
|
1505
|
-
playing: (
|
|
1506
|
-
enabled: !
|
|
1507
|
-
"controls-visible":
|
|
1508
|
-
"teleport-controls":
|
|
1509
|
-
"controls-target":
|
|
1510
|
-
active:
|
|
1511
|
-
onReady:
|
|
1512
|
-
onError:
|
|
1513
|
-
onOriginalState:
|
|
1514
|
-
onLiveState:
|
|
1515
|
-
onLiveEnded:
|
|
1775
|
+
quality: k.value,
|
|
1776
|
+
"request-version": y.requestVersion,
|
|
1777
|
+
"load-enabled": y.loadEnabled,
|
|
1778
|
+
priority: y.active ? 0 : 2,
|
|
1779
|
+
"resource-policy": y.resourcePolicy,
|
|
1780
|
+
"resolve-source": y.resolveSource,
|
|
1781
|
+
playing: (y.livePlaying || i.value) && y.active,
|
|
1782
|
+
enabled: !y.disabled,
|
|
1783
|
+
"controls-visible": y.controlsVisible,
|
|
1784
|
+
"teleport-controls": y.teleportControls,
|
|
1785
|
+
"controls-target": y.controlsTarget,
|
|
1786
|
+
active: y.active,
|
|
1787
|
+
onReady: p,
|
|
1788
|
+
onError: x[0] || (x[0] = (m) => a("error", m)),
|
|
1789
|
+
onOriginalState: x[1] || (x[1] = (m, w) => a("originalState", m, w)),
|
|
1790
|
+
onLiveState: $,
|
|
1791
|
+
onLiveEnded: x[2] || (x[2] = (m) => a("liveEnded"))
|
|
1516
1792
|
}), null, 16, ["media", "initial-image", "rendering", "core", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "playing", "enabled", "controls-visible", "teleport-controls", "controls-target", "active"]))
|
|
1517
|
-
], 16,
|
|
1793
|
+
], 16, aa));
|
|
1518
1794
|
}
|
|
1519
1795
|
});
|
|
1520
|
-
function
|
|
1521
|
-
const
|
|
1796
|
+
function oa(t, n) {
|
|
1797
|
+
const o = L(/* @__PURE__ */ new Set()), e = L("idle"), a = L(""), i = L(0), l = L("");
|
|
1522
1798
|
function r() {
|
|
1523
|
-
|
|
1799
|
+
l.value = "", e.value = "idle", a.value = "", i.value = 0;
|
|
1524
1800
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1801
|
+
function u() {
|
|
1802
|
+
e.value !== "ready" && (e.value = "loading", a.value = "", i.value++, o.value = /* @__PURE__ */ new Set([...o.value, t().id]));
|
|
1527
1803
|
}
|
|
1528
|
-
function
|
|
1529
|
-
|
|
1804
|
+
function v(c, M) {
|
|
1805
|
+
e.value = c, a.value = M, n(t(), c, M);
|
|
1530
1806
|
}
|
|
1531
1807
|
return {
|
|
1532
|
-
originalIds:
|
|
1533
|
-
originalStatus:
|
|
1534
|
-
originalReason:
|
|
1808
|
+
originalIds: o,
|
|
1809
|
+
originalStatus: e,
|
|
1810
|
+
originalReason: a,
|
|
1535
1811
|
originalRequest: i,
|
|
1536
|
-
readyId:
|
|
1812
|
+
readyId: l,
|
|
1537
1813
|
reset: r,
|
|
1538
|
-
requestOriginal:
|
|
1539
|
-
updateOriginal:
|
|
1814
|
+
requestOriginal: u,
|
|
1815
|
+
updateOriginal: v
|
|
1540
1816
|
};
|
|
1541
1817
|
}
|
|
1542
|
-
function
|
|
1543
|
-
const
|
|
1818
|
+
function ra(t, n, o, e = {}) {
|
|
1819
|
+
const a = L(0), i = ht({
|
|
1544
1820
|
offset: 0,
|
|
1545
1821
|
dragging: !1,
|
|
1546
1822
|
settling: !1,
|
|
1547
1823
|
preparing: !1,
|
|
1548
1824
|
grabbed: !1,
|
|
1549
1825
|
duration: 360
|
|
1550
|
-
}),
|
|
1551
|
-
}, ...
|
|
1552
|
-
() => [
|
|
1826
|
+
}), l = { readOffset: () => i.offset, flushLayout: () => {
|
|
1827
|
+
}, ...e }, r = 16, u = () => n() + r, v = Y(
|
|
1828
|
+
() => [a.value - 1, a.value, a.value + 1].filter((R) => R >= 0 && R < t())
|
|
1553
1829
|
);
|
|
1554
|
-
let
|
|
1555
|
-
}, 0),
|
|
1556
|
-
},
|
|
1830
|
+
let c = setTimeout(() => {
|
|
1831
|
+
}, 0), M = () => {
|
|
1832
|
+
}, C = 0, S = 0;
|
|
1557
1833
|
function P() {
|
|
1558
|
-
|
|
1834
|
+
C += 1, clearTimeout(c), M(), i.settling = !1, i.preparing = !1;
|
|
1559
1835
|
}
|
|
1560
|
-
|
|
1561
|
-
function
|
|
1836
|
+
Fe(P);
|
|
1837
|
+
function k() {
|
|
1562
1838
|
if (!i.settling && !i.preparing) return;
|
|
1563
|
-
const
|
|
1564
|
-
P(), i.offset =
|
|
1839
|
+
const R = i.preparing ? i.offset : l.readOffset();
|
|
1840
|
+
P(), i.offset = R, i.grabbed = !0;
|
|
1565
1841
|
}
|
|
1566
|
-
function
|
|
1567
|
-
if (
|
|
1568
|
-
P(), i.dragging = !1, i.grabbed = !1, i.offset = 0,
|
|
1842
|
+
function p(R) {
|
|
1843
|
+
if (R === 0) {
|
|
1844
|
+
P(), i.dragging = !1, i.grabbed = !1, i.offset = 0, S = 0;
|
|
1569
1845
|
return;
|
|
1570
1846
|
}
|
|
1571
|
-
i.dragging || (
|
|
1572
|
-
const
|
|
1573
|
-
i.offset =
|
|
1847
|
+
i.dragging || (k(), S = i.offset, P(), i.dragging = !0, i.grabbed = !0);
|
|
1848
|
+
const f = S + R, h = a.value === 0 && f > 0 || a.value === t() - 1 && f < 0;
|
|
1849
|
+
i.offset = h ? Math.sign(f) * Math.sqrt(Math.abs(f)) * 6 : f;
|
|
1574
1850
|
}
|
|
1575
|
-
async function
|
|
1851
|
+
async function $(R, f = 0) {
|
|
1576
1852
|
P();
|
|
1577
|
-
const
|
|
1578
|
-
i.offset += (
|
|
1579
|
-
const
|
|
1580
|
-
i.duration = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 :
|
|
1581
|
-
|
|
1582
|
-
}),
|
|
1853
|
+
const h = C, D = a.value;
|
|
1854
|
+
i.offset += (R - D) * u();
|
|
1855
|
+
const z = Math.abs(i.offset), A = K(z / u(), 0, 1), H = K(220 + A * 140 - Math.min(Math.abs(f), 2) * 35, 240, 360);
|
|
1856
|
+
i.duration = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : H, a.value = R, i.dragging = !1, i.grabbed = !1, i.preparing = !0, R !== D && o(R), await we(), h === C && (l.flushLayout(), i.preparing = !1, i.settling = !0, i.offset = 0, await new Promise((j) => {
|
|
1857
|
+
M = j, c = setTimeout(j, i.duration);
|
|
1858
|
+
}), h === C && (i.settling = !1, M = () => {
|
|
1583
1859
|
}));
|
|
1584
1860
|
}
|
|
1585
|
-
function I(
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1861
|
+
function I(R, f) {
|
|
1862
|
+
const h = i.offset, D = Math.abs(f) > 0.35 && Math.abs(R) > 16, z = Math.sign(D ? f : h), A = D || Math.abs(h) > n() * 0.14;
|
|
1863
|
+
$(K(a.value - (A ? z : 0), 0, t() - 1), f);
|
|
1588
1864
|
}
|
|
1589
|
-
function
|
|
1590
|
-
i.grabbed && !i.dragging &&
|
|
1865
|
+
function y() {
|
|
1866
|
+
i.grabbed && !i.dragging && $(a.value);
|
|
1591
1867
|
}
|
|
1592
|
-
function
|
|
1868
|
+
function x(R) {
|
|
1593
1869
|
if (i.dragging) return;
|
|
1594
|
-
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1870
|
+
k();
|
|
1871
|
+
const f = K(a.value + R, 0, t() - 1);
|
|
1872
|
+
f !== a.value ? $(f) : y();
|
|
1597
1873
|
}
|
|
1598
|
-
function
|
|
1599
|
-
P(),
|
|
1874
|
+
function m(R) {
|
|
1875
|
+
P(), a.value = R, i.offset = 0, i.dragging = !1, i.grabbed = !1;
|
|
1600
1876
|
}
|
|
1601
|
-
function
|
|
1602
|
-
|
|
1877
|
+
function w(R) {
|
|
1878
|
+
a.value = R;
|
|
1603
1879
|
}
|
|
1604
|
-
return { index:
|
|
1880
|
+
return { index: a, state: i, slots: v, stride: u, drag: p, release: I, go: x, grab: k, resume: y, reset: m, rebase: w, cancel: P };
|
|
1605
1881
|
}
|
|
1606
|
-
function
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1609
|
-
|
|
1882
|
+
function Ot(t, n, o) {
|
|
1883
|
+
const e = Math[o === "cover" ? "max" : "min"](
|
|
1884
|
+
n.width / t.width,
|
|
1885
|
+
n.height / t.height
|
|
1610
1886
|
);
|
|
1611
1887
|
return {
|
|
1612
|
-
x:
|
|
1613
|
-
y:
|
|
1614
|
-
width:
|
|
1615
|
-
height:
|
|
1888
|
+
x: n.left + n.width / 2,
|
|
1889
|
+
y: n.top + n.height / 2,
|
|
1890
|
+
width: t.width * e,
|
|
1891
|
+
height: t.height * e,
|
|
1616
1892
|
rotation: 0,
|
|
1617
|
-
clip: { left:
|
|
1893
|
+
clip: { left: n.left, top: n.top, width: n.width, height: n.height },
|
|
1618
1894
|
radius: 0
|
|
1619
1895
|
};
|
|
1620
1896
|
}
|
|
1621
|
-
function
|
|
1622
|
-
const
|
|
1897
|
+
function la(t, n, o) {
|
|
1898
|
+
const e = (a, i) => a + (i - a) * o;
|
|
1623
1899
|
return {
|
|
1624
|
-
x:
|
|
1625
|
-
y:
|
|
1626
|
-
width:
|
|
1627
|
-
height:
|
|
1628
|
-
rotation:
|
|
1629
|
-
radius:
|
|
1900
|
+
x: e(t.x, n.x),
|
|
1901
|
+
y: e(t.y, n.y),
|
|
1902
|
+
width: e(t.width, n.width),
|
|
1903
|
+
height: e(t.height, n.height),
|
|
1904
|
+
rotation: e(t.rotation, n.rotation),
|
|
1905
|
+
radius: e(t.radius, n.radius),
|
|
1630
1906
|
clip: {
|
|
1631
|
-
left:
|
|
1632
|
-
top:
|
|
1633
|
-
width:
|
|
1634
|
-
height:
|
|
1907
|
+
left: e(t.clip.left, n.clip.left),
|
|
1908
|
+
top: e(t.clip.top, n.clip.top),
|
|
1909
|
+
width: e(t.clip.width, n.clip.width),
|
|
1910
|
+
height: e(t.clip.height, n.clip.height)
|
|
1635
1911
|
}
|
|
1636
1912
|
};
|
|
1637
1913
|
}
|
|
1638
|
-
function
|
|
1639
|
-
const
|
|
1914
|
+
function Ct(t) {
|
|
1915
|
+
const n = t.rotation * Math.PI / 180, o = Math.abs(Math.cos(n)) * t.width + Math.abs(Math.sin(n)) * t.height, e = Math.abs(Math.sin(n)) * t.width + Math.abs(Math.cos(n)) * t.height, a = Math.max(t.x - o / 2, t.clip.left), i = Math.max(t.y - e / 2, t.clip.top);
|
|
1640
1916
|
return {
|
|
1641
|
-
left:
|
|
1917
|
+
left: a,
|
|
1642
1918
|
top: i,
|
|
1643
|
-
width: Math.max(0, Math.min(
|
|
1644
|
-
height: Math.max(0, Math.min(
|
|
1919
|
+
width: Math.max(0, Math.min(t.x + o / 2, t.clip.left + t.clip.width) - a),
|
|
1920
|
+
height: Math.max(0, Math.min(t.y + e / 2, t.clip.top + t.clip.height) - i)
|
|
1645
1921
|
};
|
|
1646
1922
|
}
|
|
1647
|
-
function
|
|
1648
|
-
const i =
|
|
1649
|
-
width: Math.max(i.width,
|
|
1650
|
-
height: Math.max(i.height,
|
|
1651
|
-
},
|
|
1652
|
-
for (let
|
|
1653
|
-
const
|
|
1654
|
-
let
|
|
1655
|
-
if (
|
|
1656
|
-
|
|
1657
|
-
left: i.left + (
|
|
1658
|
-
top: i.top + (
|
|
1659
|
-
width: i.width + (
|
|
1660
|
-
height: i.height + (
|
|
1923
|
+
function sa(t, n, o, e, a) {
|
|
1924
|
+
const i = Ct(t), l = Ct(n), r = Math.min(i.width / l.width, i.height / l.height), u = {
|
|
1925
|
+
width: Math.max(i.width, l.width, 1),
|
|
1926
|
+
height: Math.max(i.height, l.height, 1)
|
|
1927
|
+
}, v = 128, c = [], M = [];
|
|
1928
|
+
for (let C = 0; C <= v; C += 1) {
|
|
1929
|
+
const S = C / v, P = la(t, n, S);
|
|
1930
|
+
let k;
|
|
1931
|
+
if (a)
|
|
1932
|
+
k = {
|
|
1933
|
+
left: i.left + (l.left - i.left) * S,
|
|
1934
|
+
top: i.top + (l.top - i.top) * S,
|
|
1935
|
+
width: i.width + (l.width - i.width) * S,
|
|
1936
|
+
height: i.height + (l.height - i.height) * S
|
|
1661
1937
|
};
|
|
1662
1938
|
else {
|
|
1663
|
-
const I = Math.min(
|
|
1664
|
-
|
|
1665
|
-
left: i.left + i.width / 2 + (
|
|
1666
|
-
top: i.top + i.height / 2 + (
|
|
1667
|
-
width:
|
|
1668
|
-
height:
|
|
1939
|
+
const I = Math.min(S / 0.78, 1), y = 1 - I * I * I * (I * (I * 6 - 15) + 10), x = r + (1 - r) * S, m = l.width * x + (i.width - l.width * r) * y, w = l.height * x + (i.height - l.height * r) * y;
|
|
1940
|
+
k = {
|
|
1941
|
+
left: i.left + i.width / 2 + (l.left + l.width / 2 - i.left - i.width / 2) * S - m / 2,
|
|
1942
|
+
top: i.top + i.height / 2 + (l.top + l.height / 2 - i.top - i.height / 2) * S - w / 2,
|
|
1943
|
+
width: m,
|
|
1944
|
+
height: w
|
|
1669
1945
|
};
|
|
1670
1946
|
}
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
transform: `scale(${1 /
|
|
1674
|
-
offset:
|
|
1675
|
-
}),
|
|
1676
|
-
transform: `translate3d(${
|
|
1677
|
-
...
|
|
1678
|
-
offset:
|
|
1947
|
+
const p = Math.max(k.width, 1e-3) / u.width, $ = Math.max(k.height, 1e-3) / u.height;
|
|
1948
|
+
c.push({
|
|
1949
|
+
transform: `scale(${1 / p},${1 / $}) translate3d(${P.x - k.left}px,${P.y - k.top}px,0) rotate(${P.rotation}deg) scale(${P.width / e.width}) translate3d(${-e.width / 2}px,${-e.height / 2}px,0)`,
|
|
1950
|
+
offset: S
|
|
1951
|
+
}), M.push({
|
|
1952
|
+
transform: `translate3d(${k.left - o.left}px,${k.top - o.top}px,0) scale(${p},${$})`,
|
|
1953
|
+
...t.radius === 0 && n.radius === 0 ? {} : { borderRadius: `${P.radius / p}px / ${P.radius / $}px` },
|
|
1954
|
+
offset: S
|
|
1679
1955
|
});
|
|
1680
1956
|
}
|
|
1681
|
-
return { pictures:
|
|
1957
|
+
return { pictures: c, masks: M, maskSize: u };
|
|
1682
1958
|
}
|
|
1683
|
-
function
|
|
1684
|
-
let
|
|
1685
|
-
function
|
|
1686
|
-
|
|
1959
|
+
function ua() {
|
|
1960
|
+
let t = { kind: "idle" };
|
|
1961
|
+
function n() {
|
|
1962
|
+
t.kind === "playing" && t.animations.forEach((a) => a.cancel()), t = { kind: "idle" };
|
|
1687
1963
|
}
|
|
1688
|
-
function
|
|
1689
|
-
return
|
|
1964
|
+
function o() {
|
|
1965
|
+
return t.kind !== "playing" || !t.entering ? { kind: "inactive" } : (t.entering = !1, t.animations.forEach((a) => a.reverse()), t.finished = Promise.all(t.animations.map((a) => a.finished)).then(() => {
|
|
1690
1966
|
}).catch(() => {
|
|
1691
|
-
}), { kind: "reversing", finished:
|
|
1967
|
+
}), { kind: "reversing", finished: t.finished });
|
|
1692
1968
|
}
|
|
1693
|
-
async function
|
|
1694
|
-
|
|
1695
|
-
const P = Math.max(r.width,
|
|
1969
|
+
async function e(a, i, l, r, u, v, c, M, C = M ? 0 : 1, S = 340) {
|
|
1970
|
+
n();
|
|
1971
|
+
const P = Math.max(r.width, u.width), k = P * u.height / u.width, p = Math.min(
|
|
1696
1972
|
devicePixelRatio,
|
|
1697
1973
|
2,
|
|
1698
|
-
Math.sqrt(
|
|
1974
|
+
Math.sqrt(se.maxCanvasPixels / (P * k))
|
|
1699
1975
|
);
|
|
1700
|
-
|
|
1701
|
-
const
|
|
1702
|
-
((
|
|
1703
|
-
|
|
1704
|
-
})(
|
|
1705
|
-
const
|
|
1706
|
-
i.style.width = `${
|
|
1707
|
-
const
|
|
1708
|
-
duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0,
|
|
1976
|
+
a.width = Math.max(1, Math.round(P * p)), a.height = Math.max(1, Math.round(k * p)), a.style.width = `${P}px`, a.style.height = `${k}px`;
|
|
1977
|
+
const $ = a.getContext("2d");
|
|
1978
|
+
((f) => {
|
|
1979
|
+
$.clearRect(0, 0, a.width, a.height), $.imageSmoothingEnabled = !0, $.imageSmoothingQuality = "high", $.drawImage(f, 0, 0, a.width, a.height);
|
|
1980
|
+
})(l);
|
|
1981
|
+
const y = sa(r, u, v, { width: P, height: k }, M);
|
|
1982
|
+
i.style.width = `${y.maskSize.width}px`, i.style.height = `${y.maskSize.height}px`, i.style.borderRadius = "0";
|
|
1983
|
+
const m = {
|
|
1984
|
+
duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, S),
|
|
1709
1985
|
easing: "cubic-bezier(.2,.78,.2,1)",
|
|
1710
1986
|
fill: "both"
|
|
1711
|
-
},
|
|
1712
|
-
|
|
1713
|
-
i.animate(
|
|
1714
|
-
|
|
1715
|
-
],
|
|
1987
|
+
}, w = [
|
|
1988
|
+
a.animate(y.pictures, m),
|
|
1989
|
+
i.animate(y.masks, m),
|
|
1990
|
+
c.animate([{ opacity: C }, { opacity: M ? 1 : 0 }], m)
|
|
1991
|
+
], R = Promise.all(w.map((f) => f.finished)).then(() => {
|
|
1716
1992
|
}).catch(() => {
|
|
1717
1993
|
});
|
|
1718
|
-
|
|
1994
|
+
t = { kind: "playing", entering: M, animations: w, finished: R }, await R;
|
|
1719
1995
|
}
|
|
1720
|
-
return { play:
|
|
1996
|
+
return { play: e, cancel: n, reverseOpening: o };
|
|
1721
1997
|
}
|
|
1722
|
-
function
|
|
1723
|
-
const
|
|
1998
|
+
function At(t, n) {
|
|
1999
|
+
const o = Math.max(t.left, n.left), e = Math.max(t.top, n.top);
|
|
1724
2000
|
return {
|
|
1725
|
-
left:
|
|
1726
|
-
top:
|
|
1727
|
-
width: Math.max(0, Math.min(
|
|
1728
|
-
height: Math.max(0, Math.min(
|
|
2001
|
+
left: o,
|
|
2002
|
+
top: e,
|
|
2003
|
+
width: Math.max(0, Math.min(t.left + t.width, n.left + n.width) - o),
|
|
2004
|
+
height: Math.max(0, Math.min(t.top + t.height, n.top + n.height) - e)
|
|
1729
2005
|
};
|
|
1730
2006
|
}
|
|
1731
|
-
function
|
|
1732
|
-
let
|
|
1733
|
-
const
|
|
1734
|
-
for (let
|
|
1735
|
-
const i = getComputedStyle(
|
|
1736
|
-
if (!
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1739
|
-
left:
|
|
1740
|
-
top: r ?
|
|
1741
|
-
width:
|
|
1742
|
-
height: r ? Math.max(0,
|
|
2007
|
+
function ca(t, n) {
|
|
2008
|
+
let o = { ...n };
|
|
2009
|
+
const e = /^(auto|scroll|overlay)$/;
|
|
2010
|
+
for (let a = t.parentElement; a !== document.documentElement; a = a.parentElement) {
|
|
2011
|
+
const i = getComputedStyle(a), l = e.test(i.overflowX), r = e.test(i.overflowY);
|
|
2012
|
+
if (!l && !r) continue;
|
|
2013
|
+
const u = a.getBoundingClientRect(), v = Number(a.style.getPropertyValue("--mp-transition-inset-top"));
|
|
2014
|
+
o = At(o, {
|
|
2015
|
+
left: l ? u.left : o.left,
|
|
2016
|
+
top: r ? u.top + v : o.top,
|
|
2017
|
+
width: l ? u.width : o.width,
|
|
2018
|
+
height: r ? Math.max(0, u.height - v) : o.height
|
|
1743
2019
|
});
|
|
1744
2020
|
}
|
|
1745
|
-
return
|
|
2021
|
+
return o;
|
|
1746
2022
|
}
|
|
1747
|
-
function
|
|
1748
|
-
if (
|
|
1749
|
-
const
|
|
1750
|
-
return
|
|
2023
|
+
function Lt(t, n, o) {
|
|
2024
|
+
if (t.kind === "unavailable") return t;
|
|
2025
|
+
const e = Ot(n, t.element.getBoundingClientRect(), "cover");
|
|
2026
|
+
return e.clip = At(e.clip, ca(t.element, o)), e.clip.width <= 0 || e.clip.height <= 0 ? { kind: "unavailable" } : (e.radius = parseFloat(getComputedStyle(t.element).borderTopLeftRadius) || 0, { kind: "element", element: t.element, frame: e, viewport: o });
|
|
1751
2027
|
}
|
|
1752
|
-
const
|
|
2028
|
+
const da = ["aria-label", "data-phase", "data-chrome", "inert"], fa = ["aria-hidden", "inert", "data-media-id"], ga = {
|
|
1753
2029
|
key: 0,
|
|
1754
2030
|
class: "mp-resource-state mp-viewer__loading mp-viewer__pages",
|
|
1755
2031
|
role: "status",
|
|
1756
2032
|
"aria-label": "加载中"
|
|
1757
|
-
},
|
|
2033
|
+
}, ma = /* @__PURE__ */ T("span", {
|
|
1758
2034
|
class: "mp-spinner",
|
|
1759
2035
|
"aria-hidden": "true"
|
|
1760
|
-
}, null, -1),
|
|
1761
|
-
|
|
1762
|
-
],
|
|
2036
|
+
}, null, -1), pa = [
|
|
2037
|
+
ma
|
|
2038
|
+
], ha = ["inert"], va = { class: "mp-viewer__toolbar" }, ya = { class: "mp-viewer__title" }, wa = ["disabled"], ba = { class: "mp-viewer__footer" }, ka = {
|
|
1763
2039
|
class: "mp-viewer__counter",
|
|
1764
2040
|
"aria-live": "polite"
|
|
1765
|
-
},
|
|
2041
|
+
}, xa = {
|
|
1766
2042
|
key: 1,
|
|
1767
2043
|
class: "mp-viewer__detail"
|
|
1768
|
-
},
|
|
2044
|
+
}, La = /* @__PURE__ */ $e({
|
|
1769
2045
|
inheritAttrs: !1,
|
|
1770
2046
|
__name: "MediaPreview",
|
|
1771
2047
|
props: {
|
|
@@ -1776,8 +2052,8 @@ const Za = ["aria-label", "data-phase", "data-chrome", "inert"], ja = ["aria-hid
|
|
|
1776
2052
|
gesturesEnabled: { type: Boolean, default: !0 },
|
|
1777
2053
|
persistentChrome: { type: Boolean, default: !1 },
|
|
1778
2054
|
videoLoader: { type: Function, default: lt },
|
|
1779
|
-
resourcePolicy: { default: () =>
|
|
1780
|
-
resolveImageSource: { type: Function, default:
|
|
2055
|
+
resourcePolicy: { default: () => Ke },
|
|
2056
|
+
resolveImageSource: { type: Function, default: Ge },
|
|
1781
2057
|
hasMore: { type: Boolean, default: !1 },
|
|
1782
2058
|
appearance: { default: "dark" },
|
|
1783
2059
|
closeDuration: { default: 240 },
|
|
@@ -1785,520 +2061,520 @@ const Za = ["aria-label", "data-phase", "data-chrome", "inert"], ja = ["aria-hid
|
|
|
1785
2061
|
resolveAnchor: { type: Function, default: () => ({ kind: "unavailable" }) }
|
|
1786
2062
|
},
|
|
1787
2063
|
emits: ["open", "opened", "ready", "closing", "close", "change", "error", "originalState", "loadMore", "phaseChange", "chromeChange"],
|
|
1788
|
-
setup(
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1791
|
-
const r = `mp-video-controls-${
|
|
2064
|
+
setup(t, { expose: n, emit: o }) {
|
|
2065
|
+
const e = Nt(), a = t, i = o, l = L("closed");
|
|
2066
|
+
J(l, (s) => i("phaseChange", s), { flush: "sync" });
|
|
2067
|
+
const r = `mp-video-controls-${Zt().uid}`, u = L(), v = L(), c = oa(
|
|
1792
2068
|
() => W.value,
|
|
1793
|
-
(
|
|
1794
|
-
), { originalIds:
|
|
1795
|
-
let
|
|
1796
|
-
const I =
|
|
1797
|
-
|
|
1798
|
-
const
|
|
1799
|
-
let Pe = "",
|
|
1800
|
-
const
|
|
1801
|
-
function
|
|
1802
|
-
return (
|
|
1803
|
-
|
|
2069
|
+
(s, b, E) => i("originalState", s, b, E)
|
|
2070
|
+
), { originalIds: M, originalStatus: C, originalReason: S, originalRequest: P, readyId: k } = c;
|
|
2071
|
+
let p = "", $ = -1;
|
|
2072
|
+
const I = L(), y = L(), x = L(), m = L(!1), w = L(0), R = L(!0);
|
|
2073
|
+
J(R, (s) => i("chromeChange", s), { flush: "sync" });
|
|
2074
|
+
const f = L(!1), h = L("loading"), D = L(1), z = L(!1), A = L(1), H = L(!1), j = L(!1), U = pt(ke);
|
|
2075
|
+
let Pe = "", ue = { kind: "unavailable" };
|
|
2076
|
+
const ce = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map();
|
|
2077
|
+
function Re(s) {
|
|
2078
|
+
return (b) => {
|
|
2079
|
+
ee.set(s, b);
|
|
1804
2080
|
};
|
|
1805
2081
|
}
|
|
1806
|
-
function Oe(
|
|
1807
|
-
return (
|
|
1808
|
-
|
|
2082
|
+
function Oe(s) {
|
|
2083
|
+
return (b) => {
|
|
2084
|
+
ce.set(s, b);
|
|
1809
2085
|
};
|
|
1810
2086
|
}
|
|
1811
|
-
const
|
|
1812
|
-
() =>
|
|
1813
|
-
() =>
|
|
1814
|
-
(
|
|
1815
|
-
|
|
2087
|
+
const B = ra(
|
|
2088
|
+
() => a.items.length,
|
|
2089
|
+
() => A.value,
|
|
2090
|
+
(s) => {
|
|
2091
|
+
p = a.items[s].id, c.reset(), D.value = 1, f.value = !1, h.value = "loading", i("change", s), Be(s);
|
|
1816
2092
|
},
|
|
1817
2093
|
{
|
|
1818
|
-
readOffset: () => new DOMMatrixReadOnly(getComputedStyle(
|
|
2094
|
+
readOffset: () => new DOMMatrixReadOnly(getComputedStyle(ee.get(p)).transform).m41,
|
|
1819
2095
|
flushLayout: () => {
|
|
1820
|
-
|
|
2096
|
+
ee.get(p).getBoundingClientRect();
|
|
1821
2097
|
}
|
|
1822
2098
|
}
|
|
1823
|
-
), q =
|
|
1824
|
-
() =>
|
|
2099
|
+
), q = B.index, W = Y(() => a.items[q.value]), Ee = B.slots, Qe = Y(
|
|
2100
|
+
() => l.value === "opening" || m.value ? [q.value] : Ee.value
|
|
1825
2101
|
);
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
const
|
|
1829
|
-
for (const
|
|
1830
|
-
for (const
|
|
2102
|
+
J(Ee, () => {
|
|
2103
|
+
we(() => {
|
|
2104
|
+
const s = new Set(Ee.value.map((b) => a.items[b].id));
|
|
2105
|
+
for (const b of ce.keys()) s.has(b) || ce.delete(b);
|
|
2106
|
+
for (const b of ee.keys()) s.has(b) || ee.delete(b);
|
|
1831
2107
|
});
|
|
1832
2108
|
});
|
|
1833
2109
|
const te = {
|
|
1834
2110
|
close: F,
|
|
1835
|
-
setChromeVisible: (
|
|
1836
|
-
|
|
2111
|
+
setChromeVisible: (s) => {
|
|
2112
|
+
R.value = s;
|
|
1837
2113
|
},
|
|
1838
2114
|
goTo: ut,
|
|
1839
|
-
previous: () =>
|
|
1840
|
-
next: () =>
|
|
1841
|
-
rotate: (
|
|
1842
|
-
reset: () =>
|
|
1843
|
-
zoomIn: () =>
|
|
1844
|
-
zoomOut: () =>
|
|
1845
|
-
original:
|
|
1846
|
-
fullscreen:
|
|
1847
|
-
togglePlayback: () =>
|
|
2115
|
+
previous: () => B.go(-1),
|
|
2116
|
+
next: () => B.go(1),
|
|
2117
|
+
rotate: (s = 90) => Z().rotateBy(s),
|
|
2118
|
+
reset: () => Z().resetTransform(),
|
|
2119
|
+
zoomIn: () => Z().zoomIn(),
|
|
2120
|
+
zoomOut: () => Z().zoomOut(),
|
|
2121
|
+
original: c.requestOriginal,
|
|
2122
|
+
fullscreen: ne,
|
|
2123
|
+
togglePlayback: () => Z().togglePlayback(),
|
|
1848
2124
|
toggleLive: () => {
|
|
1849
|
-
|
|
2125
|
+
l.value !== "open" || h.value === "loading" || h.value === "error" || (f.value = !f.value);
|
|
1850
2126
|
},
|
|
1851
2127
|
toggleDetail: () => {
|
|
1852
|
-
|
|
2128
|
+
z.value = !z.value;
|
|
1853
2129
|
}
|
|
1854
|
-
}, ge =
|
|
1855
|
-
let
|
|
1856
|
-
},
|
|
1857
|
-
const
|
|
1858
|
-
const
|
|
1859
|
-
|
|
2130
|
+
}, ge = ua();
|
|
2131
|
+
let Te = Promise.resolve(), Q = 0, pe = "", G = !1, he = "", me = "", xe = () => {
|
|
2132
|
+
}, ie = { kind: "idle" }, ve = 0;
|
|
2133
|
+
const Ce = () => new Promise((s) => requestAnimationFrame(() => s())), Me = new ResizeObserver(() => {
|
|
2134
|
+
const s = `${v.value.clientWidth}:${v.value.clientHeight}`, b = `${u.value.clientWidth}:${u.value.clientHeight}`, E = he !== "" && he !== s, _ = me !== "" && me !== b;
|
|
2135
|
+
he = s, me = b, A.value = v.value.clientWidth, E && l.value === "open" && B.reset(q.value), _ && ge.cancel();
|
|
1860
2136
|
});
|
|
1861
|
-
function
|
|
1862
|
-
|
|
2137
|
+
function Be(s) {
|
|
2138
|
+
a.hasMore && s >= a.items.length - 3 && $ !== a.items.length && ($ = a.items.length, i("loadMore", s));
|
|
1863
2139
|
}
|
|
1864
|
-
function
|
|
1865
|
-
|
|
2140
|
+
function ze(s, b) {
|
|
2141
|
+
s === q.value && (j.value && (k.value = W.value.id), i("ready", s, b));
|
|
1866
2142
|
}
|
|
1867
|
-
function st(
|
|
1868
|
-
|
|
2143
|
+
function st(s, b, E) {
|
|
2144
|
+
s === q.value && c.updateOriginal(b, E);
|
|
1869
2145
|
}
|
|
1870
|
-
|
|
1871
|
-
() =>
|
|
1872
|
-
(
|
|
1873
|
-
if (
|
|
1874
|
-
if (
|
|
1875
|
-
|
|
2146
|
+
J(
|
|
2147
|
+
() => a.items.map((s) => s.id),
|
|
2148
|
+
(s) => {
|
|
2149
|
+
if (l.value === "closed") return;
|
|
2150
|
+
if (s.length === 0) {
|
|
2151
|
+
Q++, ge.cancel(), B.cancel(), ve++, ie.kind === "active" && ie.animation.cancel(), Me.disconnect(), he = "", me = "", xe(), i("closing"), l.value = "closed", U.value = ke, ce.clear(), ee.clear(), document.body.style.overflow = pe, i("close");
|
|
1876
2152
|
return;
|
|
1877
2153
|
}
|
|
1878
|
-
const
|
|
1879
|
-
(
|
|
2154
|
+
const b = s.indexOf(p), E = b >= 0 ? b : Math.min(q.value, s.length - 1);
|
|
2155
|
+
(E !== q.value || b < 0) && (b >= 0 ? B.rebase(E) : (B.reset(E), p = s[E], c.reset(), D.value = 1, f.value = !1, i("change", E))), Be(E);
|
|
1880
2156
|
},
|
|
1881
2157
|
{ flush: "sync" }
|
|
1882
2158
|
);
|
|
1883
|
-
function ut(
|
|
1884
|
-
if (!Number.isInteger(
|
|
2159
|
+
function ut(s) {
|
|
2160
|
+
if (!Number.isInteger(s) || s < 0 || s >= a.items.length)
|
|
1885
2161
|
throw new RangeError("无效的预览下标");
|
|
1886
|
-
if (!(
|
|
1887
|
-
if (Math.abs(
|
|
1888
|
-
|
|
2162
|
+
if (!(l.value !== "open" || s === q.value)) {
|
|
2163
|
+
if (Math.abs(s - q.value) === 1) {
|
|
2164
|
+
B.go(s - q.value);
|
|
1889
2165
|
return;
|
|
1890
2166
|
}
|
|
1891
|
-
|
|
2167
|
+
B.reset(s), p = a.items[s].id, c.reset(), D.value = 1, f.value = !1, h.value = "loading", i("change", s), Be(s);
|
|
1892
2168
|
}
|
|
1893
2169
|
}
|
|
1894
2170
|
function ct() {
|
|
1895
|
-
|
|
2171
|
+
a.persistentChrome || (R.value = !R.value);
|
|
1896
2172
|
}
|
|
1897
|
-
function
|
|
1898
|
-
return
|
|
2173
|
+
function Z() {
|
|
2174
|
+
return ce.get(p);
|
|
1899
2175
|
}
|
|
1900
|
-
function
|
|
2176
|
+
function Je(s) {
|
|
1901
2177
|
xe();
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
|
|
2178
|
+
const b = s.element.classList.contains("mp-transition-source");
|
|
2179
|
+
s.element.classList.add("mp-transition-source"), xe = () => {
|
|
2180
|
+
s.element.classList.toggle("mp-transition-source", b);
|
|
1905
2181
|
};
|
|
1906
2182
|
}
|
|
1907
|
-
function
|
|
1908
|
-
const
|
|
1909
|
-
return { left:
|
|
2183
|
+
function et() {
|
|
2184
|
+
const s = u.value.getBoundingClientRect();
|
|
2185
|
+
return { left: s.left, top: s.top, width: s.width, height: s.height };
|
|
1910
2186
|
}
|
|
1911
|
-
function
|
|
1912
|
-
return
|
|
2187
|
+
function Ve() {
|
|
2188
|
+
return v.value.getBoundingClientRect();
|
|
1913
2189
|
}
|
|
1914
|
-
function
|
|
1915
|
-
const
|
|
2190
|
+
function Ue(s = 1) {
|
|
2191
|
+
const b = Ve(), E = Z().core, _ = E.state, fe = _.downScale;
|
|
1916
2192
|
return {
|
|
1917
|
-
x:
|
|
1918
|
-
y:
|
|
1919
|
-
width:
|
|
1920
|
-
height:
|
|
1921
|
-
rotation:
|
|
1922
|
-
clip:
|
|
2193
|
+
x: b.left + b.width / 2 + B.state.offset + _.offsetX * fe * s + _.downOffsetX,
|
|
2194
|
+
y: b.top + b.height / 2 + _.offsetY * fe * s + _.downOffsetY,
|
|
2195
|
+
width: E.mediaSize.value.width * E.displayScale.value * fe * s,
|
|
2196
|
+
height: E.mediaSize.value.height * E.displayScale.value * fe * s,
|
|
2197
|
+
rotation: _.rotation,
|
|
2198
|
+
clip: b,
|
|
1923
2199
|
radius: 0
|
|
1924
2200
|
};
|
|
1925
2201
|
}
|
|
1926
|
-
async function
|
|
1927
|
-
if (!Number.isInteger(
|
|
2202
|
+
async function d(s = 0) {
|
|
2203
|
+
if (!Number.isInteger(s) || s < 0 || s >= a.items.length)
|
|
1928
2204
|
throw new RangeError("无效的预览下标");
|
|
1929
|
-
if (
|
|
1930
|
-
const
|
|
1931
|
-
if (pe = document.body.style.overflow, document.body.style.overflow = "hidden",
|
|
1932
|
-
|
|
2205
|
+
if (l.value === "closing" && await Te, l.value !== "closed" || G) return;
|
|
2206
|
+
const b = ++Q;
|
|
2207
|
+
if (pe = document.body.style.overflow, document.body.style.overflow = "hidden", B.reset(s), p = a.items[s].id, c.reset(), D.value = 1, R.value = !0, f.value = !1, h.value = "loading", z.value = !1, w.value = 0, j.value = !1, l.value = "opening", U.value = ke, H.value = !1, Pe = W.value.id, ue = { kind: "unavailable" }, m.value = !1, i("open", s), await we(), !(b !== Q || G)) {
|
|
2208
|
+
A.value = v.value.clientWidth, Me.observe(u.value), Me.observe(v.value);
|
|
1933
2209
|
try {
|
|
1934
|
-
const
|
|
1935
|
-
if (
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1938
|
-
const
|
|
1939
|
-
if (
|
|
1940
|
-
const
|
|
1941
|
-
if (
|
|
1942
|
-
|
|
2210
|
+
const E = await a.resolveAnchor(W.value);
|
|
2211
|
+
if (b !== Q) return;
|
|
2212
|
+
const _ = Lt(E, W.value, et());
|
|
2213
|
+
ue = _, U.value = yn(_), H.value = U.value.kind === "image" || Z().readiness === "ready";
|
|
2214
|
+
const fe = Ve();
|
|
2215
|
+
if (_.kind === "element") {
|
|
2216
|
+
const Xe = Z().readiness === "ready" ? Z().core.mediaRef.value : U.value.kind === "image" ? U.value.image : St();
|
|
2217
|
+
if (m.value = !0, await we(), b !== Q || G) return;
|
|
2218
|
+
Je(_), await ge.play(
|
|
1943
2219
|
I.value,
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2220
|
+
y.value,
|
|
2221
|
+
Xe,
|
|
2222
|
+
_.frame,
|
|
2223
|
+
Ot(W.value, fe, "contain"),
|
|
2224
|
+
_.viewport,
|
|
2225
|
+
x.value,
|
|
1950
2226
|
!0,
|
|
1951
2227
|
0,
|
|
1952
|
-
|
|
2228
|
+
a.transitionDuration
|
|
1953
2229
|
);
|
|
1954
2230
|
} else
|
|
1955
|
-
|
|
1956
|
-
} catch (
|
|
1957
|
-
if (
|
|
1958
|
-
i("error",
|
|
2231
|
+
w.value = 1, m.value = !1, await N(!0);
|
|
2232
|
+
} catch (E) {
|
|
2233
|
+
if (b !== Q) return;
|
|
2234
|
+
i("error", _e(E), W.value);
|
|
1959
2235
|
}
|
|
1960
|
-
|
|
2236
|
+
b !== Q || G || (w.value = 1, l.value = "open", await we(), !(b !== Q || G) && (Z().core.renderNow(), await Ce(), !(b !== Q || G) && (m.value = !1, ge.cancel(), xe(), i("opened", s), await Ce(), !(b !== Q || G || l.value !== "open") && (j.value = !0, Be(s)))));
|
|
1961
2237
|
}
|
|
1962
2238
|
}
|
|
1963
2239
|
function F() {
|
|
1964
|
-
return
|
|
2240
|
+
return l.value === "closed" || l.value === "closing" || (Te = X()), Te;
|
|
1965
2241
|
}
|
|
1966
2242
|
async function X() {
|
|
1967
|
-
|
|
1968
|
-
const
|
|
1969
|
-
image:
|
|
2243
|
+
B.grab();
|
|
2244
|
+
const s = w.value, b = l.value === "opening", E = !b && Z().readiness === "ready" ? Z().captureFrame() : {
|
|
2245
|
+
image: U.value.kind === "image" && W.value.id === Pe ? U.value.image : St(),
|
|
1970
2246
|
scale: 1
|
|
1971
2247
|
};
|
|
1972
|
-
let
|
|
1973
|
-
|
|
1974
|
-
const
|
|
1975
|
-
|
|
2248
|
+
let _ = b ? { kind: "opening" } : { kind: "captured", frame: Ue(E.scale) };
|
|
2249
|
+
b || Z().core.cancelGesture(!0);
|
|
2250
|
+
const fe = ++Q, Xe = b ? ge.reverseOpening() : { kind: "inactive" };
|
|
2251
|
+
Xe.kind === "inactive" && ge.cancel(), B.cancel(), f.value = !1, l.value = "closing", i("closing");
|
|
1976
2252
|
try {
|
|
1977
|
-
if (await
|
|
1978
|
-
const dt =
|
|
1979
|
-
if (
|
|
1980
|
-
const
|
|
1981
|
-
if (
|
|
1982
|
-
await
|
|
1983
|
-
else if (
|
|
1984
|
-
const
|
|
1985
|
-
|
|
2253
|
+
if (await we(), fe !== Q || G || (document.fullscreenElement === u.value && (await document.exitFullscreen(), await Ce(), await Ce(), _.kind === "captured" && (_.frame = Ue(E.scale))), fe !== Q || G)) return;
|
|
2254
|
+
const dt = b ? ue : await a.resolveAnchor(W.value);
|
|
2255
|
+
if (fe !== Q || G) return;
|
|
2256
|
+
const nt = b ? ue : Lt(dt, W.value, et());
|
|
2257
|
+
if (Xe.kind === "reversing")
|
|
2258
|
+
await Xe.finished;
|
|
2259
|
+
else if (_.kind === "captured" && nt.kind === "element") {
|
|
2260
|
+
const Ut = E.image;
|
|
2261
|
+
Je(nt), m.value = !0, await we(), await ge.play(
|
|
1986
2262
|
I.value,
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2263
|
+
y.value,
|
|
2264
|
+
Ut,
|
|
2265
|
+
_.frame,
|
|
2266
|
+
nt.frame,
|
|
2267
|
+
nt.viewport,
|
|
2268
|
+
x.value,
|
|
1993
2269
|
!1,
|
|
1994
|
-
|
|
1995
|
-
|
|
2270
|
+
s,
|
|
2271
|
+
a.closeDuration
|
|
1996
2272
|
);
|
|
1997
2273
|
} else
|
|
1998
|
-
|
|
2274
|
+
m.value = !1, await N(!1);
|
|
1999
2275
|
} catch (dt) {
|
|
2000
|
-
i("error",
|
|
2276
|
+
i("error", _e(dt), W.value), await N(!1);
|
|
2001
2277
|
}
|
|
2002
|
-
|
|
2278
|
+
fe !== Q || G || (Me.disconnect(), he = "", me = "", w.value = 0, l.value = "closed", U.value = ke, ce.clear(), ee.clear(), xe(), document.body.style.overflow = pe, i("close"), await we(), ge.cancel());
|
|
2003
2279
|
}
|
|
2004
|
-
async function
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2007
|
-
const
|
|
2280
|
+
async function N(s) {
|
|
2281
|
+
const b = ++ve, E = s ? 0 : Number(getComputedStyle(u.value).opacity);
|
|
2282
|
+
ie.kind === "active" && ie.animation.cancel(), u.value.style.opacity = String(E);
|
|
2283
|
+
const _ = u.value.animate([{ opacity: E }, { opacity: s ? 1 : 0 }], {
|
|
2008
2284
|
duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 180,
|
|
2009
2285
|
fill: "forwards"
|
|
2010
2286
|
});
|
|
2011
|
-
|
|
2012
|
-
}), !(
|
|
2287
|
+
ie = { kind: "active", animation: _ }, await _.finished.catch(() => {
|
|
2288
|
+
}), !(b !== ve || G) && (u.value.style.opacity = s ? "1" : "0", _.cancel(), ie = { kind: "idle" });
|
|
2013
2289
|
}
|
|
2014
|
-
async function
|
|
2290
|
+
async function ne() {
|
|
2015
2291
|
if (document.fullscreenEnabled)
|
|
2016
2292
|
try {
|
|
2017
|
-
document.fullscreenElement ===
|
|
2018
|
-
} catch (
|
|
2019
|
-
i("error",
|
|
2293
|
+
document.fullscreenElement === u.value ? await document.exitFullscreen() : await u.value.requestFullscreen();
|
|
2294
|
+
} catch (s) {
|
|
2295
|
+
i("error", _e(s), W.value);
|
|
2020
2296
|
}
|
|
2021
2297
|
}
|
|
2022
|
-
function
|
|
2023
|
-
|
|
2298
|
+
function le(s) {
|
|
2299
|
+
l.value !== "open" || !a.gesturesEnabled || Z().onPointerDown(s, Ve()) && B.grab();
|
|
2024
2300
|
}
|
|
2025
|
-
function
|
|
2026
|
-
|
|
2301
|
+
function ye(s) {
|
|
2302
|
+
l.value === "open" && (Z().onPointerUp(s), l.value === "open" && B.resume());
|
|
2027
2303
|
}
|
|
2028
|
-
function
|
|
2029
|
-
|
|
2304
|
+
function oe(s) {
|
|
2305
|
+
l.value === "open" && (Z().onPointerCancel(s), l.value === "open" && B.resume());
|
|
2030
2306
|
}
|
|
2031
|
-
function be(
|
|
2032
|
-
|
|
2307
|
+
function be(s) {
|
|
2308
|
+
l.value === "open" && Z().onPointerMove(s);
|
|
2033
2309
|
}
|
|
2034
|
-
function
|
|
2035
|
-
|
|
2310
|
+
function Ye(s) {
|
|
2311
|
+
l.value === "open" && a.gesturesEnabled && Z().onWheel(s);
|
|
2036
2312
|
}
|
|
2037
|
-
function
|
|
2038
|
-
|
|
2313
|
+
function He(s) {
|
|
2314
|
+
l.value === "open" && (w.value = 1 - s);
|
|
2039
2315
|
}
|
|
2040
|
-
function
|
|
2041
|
-
|
|
2316
|
+
function tt(s) {
|
|
2317
|
+
l.value === "open" && B.drag(s);
|
|
2042
2318
|
}
|
|
2043
|
-
function
|
|
2044
|
-
|
|
2319
|
+
function _t(s, b) {
|
|
2320
|
+
l.value === "open" && (f.value = !1, B.release(s, b));
|
|
2045
2321
|
}
|
|
2046
|
-
function
|
|
2047
|
-
|
|
2322
|
+
function Vt(s) {
|
|
2323
|
+
D.value = s, s > 1.02 && !a.persistentChrome && (R.value = !1);
|
|
2048
2324
|
}
|
|
2049
|
-
function
|
|
2050
|
-
if (!(
|
|
2051
|
-
if (
|
|
2052
|
-
|
|
2325
|
+
function wt(s) {
|
|
2326
|
+
if (!(l.value === "closed" || !a.keyboardEnabled) && !(s.key === "Escape" && document.fullscreenElement === u.value)) {
|
|
2327
|
+
if (s.key === "Escape") {
|
|
2328
|
+
s.preventDefault(), F();
|
|
2053
2329
|
return;
|
|
2054
2330
|
}
|
|
2055
|
-
if (!(
|
|
2331
|
+
if (!(l.value !== "open" || s.target.matches("input, textarea, select, button, [role='slider']"))) {
|
|
2056
2332
|
if (W.value.type === "video") {
|
|
2057
|
-
if (
|
|
2058
|
-
|
|
2333
|
+
if (s.code === "Space") {
|
|
2334
|
+
s.preventDefault(), Z().togglePlayback();
|
|
2059
2335
|
return;
|
|
2060
2336
|
}
|
|
2061
|
-
if (
|
|
2062
|
-
|
|
2337
|
+
if (s.key === "Enter") {
|
|
2338
|
+
s.preventDefault(), Z().toggleFullscreen();
|
|
2063
2339
|
return;
|
|
2064
2340
|
}
|
|
2065
2341
|
}
|
|
2066
|
-
if (W.value.type === "live-photo" &&
|
|
2067
|
-
|
|
2342
|
+
if (W.value.type === "live-photo" && s.code === "Space") {
|
|
2343
|
+
s.preventDefault(), te.toggleLive();
|
|
2068
2344
|
return;
|
|
2069
2345
|
}
|
|
2070
|
-
|
|
2346
|
+
s.key === "ArrowLeft" && (s.preventDefault(), B.go(-1)), s.key === "ArrowRight" && (s.preventDefault(), B.go(1)), (s.key === "+" || s.key === "=") && te.zoomIn(), s.key === "-" && te.zoomOut(), s.key === "0" && te.reset();
|
|
2071
2347
|
}
|
|
2072
2348
|
}
|
|
2073
2349
|
}
|
|
2074
|
-
return
|
|
2075
|
-
document.addEventListener("keydown",
|
|
2076
|
-
}),
|
|
2077
|
-
|
|
2078
|
-
}),
|
|
2079
|
-
open:
|
|
2350
|
+
return qe(() => {
|
|
2351
|
+
document.addEventListener("keydown", wt);
|
|
2352
|
+
}), Fe(() => {
|
|
2353
|
+
G = !0, Q += 1, ge.cancel(), ve += 1, ie.kind === "active" && ie.animation.cancel(), xe(), Me.disconnect(), document.removeEventListener("keydown", wt), l.value !== "closed" && (document.body.style.overflow = pe);
|
|
2354
|
+
}), n({
|
|
2355
|
+
open: d,
|
|
2080
2356
|
...te,
|
|
2081
2357
|
currentIndex: q,
|
|
2082
|
-
phase:
|
|
2083
|
-
element:
|
|
2084
|
-
mediaElement: () =>
|
|
2085
|
-
canvasElement: () =>
|
|
2086
|
-
}), (
|
|
2358
|
+
phase: l,
|
|
2359
|
+
element: u,
|
|
2360
|
+
mediaElement: () => Z().core.mediaRef.value,
|
|
2361
|
+
canvasElement: () => Z().core.canvasRef.value
|
|
2362
|
+
}), (s, b) => (O(), rt($t, {
|
|
2087
2363
|
to: "body",
|
|
2088
|
-
disabled:
|
|
2364
|
+
disabled: s.teleportDisabled
|
|
2089
2365
|
}, [
|
|
2090
|
-
|
|
2366
|
+
l.value !== "closed" ? (O(), V("div", Ne({
|
|
2091
2367
|
key: 0,
|
|
2092
2368
|
ref_key: "root",
|
|
2093
|
-
ref:
|
|
2094
|
-
}, g(
|
|
2095
|
-
class: ["mp-viewer", { "is-mobile":
|
|
2369
|
+
ref: u
|
|
2370
|
+
}, g(e), {
|
|
2371
|
+
class: ["mp-viewer", { "is-mobile": s.mobile, "is-album": s.appearance === "album" }],
|
|
2096
2372
|
role: "dialog",
|
|
2097
2373
|
"aria-modal": "true",
|
|
2098
2374
|
"aria-label": W.value.title,
|
|
2099
|
-
"data-phase":
|
|
2100
|
-
"data-chrome":
|
|
2101
|
-
inert:
|
|
2102
|
-
onPointerdown:
|
|
2375
|
+
"data-phase": l.value,
|
|
2376
|
+
"data-chrome": R.value ? "visible" : "hidden",
|
|
2377
|
+
inert: l.value === "closing",
|
|
2378
|
+
onPointerdown: le,
|
|
2103
2379
|
onPointermove: be,
|
|
2104
|
-
onPointerup:
|
|
2105
|
-
onPointercancel:
|
|
2106
|
-
onLostpointercapture:
|
|
2107
|
-
onWheel:
|
|
2380
|
+
onPointerup: ye,
|
|
2381
|
+
onPointercancel: oe,
|
|
2382
|
+
onLostpointercapture: oe,
|
|
2383
|
+
onWheel: Ye
|
|
2108
2384
|
}), [
|
|
2109
|
-
|
|
2385
|
+
T("div", {
|
|
2110
2386
|
ref_key: "backdrop",
|
|
2111
|
-
ref:
|
|
2387
|
+
ref: x,
|
|
2112
2388
|
class: "mp-viewer__backdrop",
|
|
2113
|
-
style: Se({ opacity:
|
|
2389
|
+
style: Se({ opacity: w.value })
|
|
2114
2390
|
}, null, 4),
|
|
2115
|
-
|
|
2391
|
+
T("div", {
|
|
2116
2392
|
id: r,
|
|
2117
2393
|
class: "mp-viewer__video-controls"
|
|
2118
2394
|
}),
|
|
2119
|
-
|
|
2395
|
+
T("div", {
|
|
2120
2396
|
ref_key: "mediaViewport",
|
|
2121
|
-
ref:
|
|
2122
|
-
class:
|
|
2397
|
+
ref: v,
|
|
2398
|
+
class: Ie(["mp-viewer__pages", { "is-transitioning": m.value }])
|
|
2123
2399
|
}, [
|
|
2124
|
-
(
|
|
2125
|
-
key:
|
|
2400
|
+
(O(!0), V(Le, null, Ze(Qe.value, (E) => (O(), V("div", {
|
|
2401
|
+
key: s.items[E].id,
|
|
2126
2402
|
ref_for: !0,
|
|
2127
|
-
ref:
|
|
2403
|
+
ref: Re(s.items[E].id),
|
|
2128
2404
|
class: "mp-viewer__page",
|
|
2129
2405
|
style: Se({
|
|
2130
|
-
transform: `translate3d(${(
|
|
2131
|
-
transition: g(
|
|
2406
|
+
transform: `translate3d(${(E - g(q)) * g(B).stride() + g(B).state.offset}px,0,0)`,
|
|
2407
|
+
transition: g(B).state.settling ? `transform ${g(B).state.duration}ms cubic-bezier(.22,.61,.36,1)` : "none"
|
|
2132
2408
|
}),
|
|
2133
|
-
"aria-hidden":
|
|
2134
|
-
inert:
|
|
2135
|
-
"data-media-id":
|
|
2409
|
+
"aria-hidden": E !== g(q),
|
|
2410
|
+
inert: E !== g(q),
|
|
2411
|
+
"data-media-id": s.items[E].id
|
|
2136
2412
|
}, [
|
|
2137
|
-
|
|
2413
|
+
De(ia, {
|
|
2138
2414
|
ref_for: !0,
|
|
2139
|
-
ref: Oe(
|
|
2140
|
-
media:
|
|
2141
|
-
"video-loader":
|
|
2142
|
-
rendering:
|
|
2143
|
-
paging: g(
|
|
2415
|
+
ref: Oe(s.items[E].id),
|
|
2416
|
+
media: s.items[E],
|
|
2417
|
+
"video-loader": s.videoLoader,
|
|
2418
|
+
rendering: l.value === "open",
|
|
2419
|
+
paging: g(B).state.dragging || g(B).state.preparing || g(B).state.settling || g(B).state.grabbed,
|
|
2144
2420
|
"external-gestures": "",
|
|
2145
|
-
active:
|
|
2146
|
-
disabled:
|
|
2147
|
-
"inactive-reset-duration": g(
|
|
2148
|
-
"resource-policy":
|
|
2149
|
-
"resolve-source":
|
|
2150
|
-
"request-version":
|
|
2151
|
-
"load-enabled":
|
|
2421
|
+
active: E === g(q),
|
|
2422
|
+
disabled: l.value !== "open" || !s.gesturesEnabled,
|
|
2423
|
+
"inactive-reset-duration": g(B).state.duration,
|
|
2424
|
+
"resource-policy": s.resourcePolicy,
|
|
2425
|
+
"resolve-source": s.resolveImageSource,
|
|
2426
|
+
"request-version": E === g(q) ? g(P) : 0,
|
|
2427
|
+
"load-enabled": E === g(q) ? j.value && l.value === "open" : l.value === "open" && !m.value && g(k) === W.value.id,
|
|
2152
2428
|
"teleport-controls": "",
|
|
2153
2429
|
"controls-target": `#${r}`,
|
|
2154
|
-
"controls-visible":
|
|
2155
|
-
"initial-image":
|
|
2156
|
-
quality:
|
|
2157
|
-
"live-playing":
|
|
2430
|
+
"controls-visible": R.value && w.value === 1,
|
|
2431
|
+
"initial-image": s.items[E].id === g(Pe) ? U.value : g(ke),
|
|
2432
|
+
quality: E === g(q) && g(M).has(s.items[E].id) ? "full" : E === g(q) ? "screen" : "thumbnail",
|
|
2433
|
+
"live-playing": f.value,
|
|
2158
2434
|
onTap: ct,
|
|
2159
|
-
onScale:
|
|
2160
|
-
onPageDrag:
|
|
2161
|
-
onPageRelease:
|
|
2435
|
+
onScale: Vt,
|
|
2436
|
+
onPageDrag: tt,
|
|
2437
|
+
onPageRelease: _t,
|
|
2162
2438
|
onClose: F,
|
|
2163
|
-
onSwipeDownProgress:
|
|
2164
|
-
onLiveState: (
|
|
2165
|
-
|
|
2439
|
+
onSwipeDownProgress: He,
|
|
2440
|
+
onLiveState: (_) => {
|
|
2441
|
+
E === g(q) && (h.value = _);
|
|
2166
2442
|
},
|
|
2167
2443
|
onLiveEnded: () => {
|
|
2168
|
-
|
|
2444
|
+
E === g(q) && (f.value = !1);
|
|
2169
2445
|
},
|
|
2170
|
-
onReady: (
|
|
2171
|
-
onOriginalState: (
|
|
2172
|
-
onError: (
|
|
2446
|
+
onReady: (_) => ze(E, _),
|
|
2447
|
+
onOriginalState: (_, fe) => st(E, _, fe),
|
|
2448
|
+
onError: (_) => i("error", _, s.items[E])
|
|
2173
2449
|
}, null, 8, ["media", "video-loader", "rendering", "paging", "active", "disabled", "inactive-reset-duration", "resource-policy", "resolve-source", "request-version", "load-enabled", "controls-target", "controls-visible", "initial-image", "quality", "live-playing", "onLiveState", "onLiveEnded", "onReady", "onOriginalState", "onError"])
|
|
2174
|
-
], 12,
|
|
2450
|
+
], 12, fa))), 128))
|
|
2175
2451
|
], 2),
|
|
2176
|
-
|
|
2452
|
+
jt(T("div", {
|
|
2177
2453
|
ref_key: "transitionMask",
|
|
2178
|
-
ref:
|
|
2454
|
+
ref: y,
|
|
2179
2455
|
class: "mp-shared-clip",
|
|
2180
2456
|
"aria-hidden": "true"
|
|
2181
2457
|
}, [
|
|
2182
|
-
|
|
2458
|
+
T("canvas", {
|
|
2183
2459
|
ref_key: "transitionCanvas",
|
|
2184
2460
|
ref: I,
|
|
2185
2461
|
class: "mp-shared-transition"
|
|
2186
2462
|
}, null, 512)
|
|
2187
2463
|
], 512), [
|
|
2188
|
-
[
|
|
2464
|
+
[Kt, m.value]
|
|
2189
2465
|
]),
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
class:
|
|
2193
|
-
inert: !
|
|
2466
|
+
l.value === "opening" && !H.value ? (O(), V("div", ga, pa)) : re("", !0),
|
|
2467
|
+
T("div", {
|
|
2468
|
+
class: Ie(["mp-viewer__chrome", { "is-hidden": !R.value || l.value !== "open" || w.value < 1 }]),
|
|
2469
|
+
inert: !R.value || l.value !== "open" || w.value < 1
|
|
2194
2470
|
}, [
|
|
2195
|
-
ft(
|
|
2471
|
+
ft(s.$slots, "toolbar", {
|
|
2196
2472
|
media: W.value,
|
|
2197
2473
|
index: g(q),
|
|
2198
|
-
total:
|
|
2199
|
-
scale:
|
|
2474
|
+
total: s.items.length,
|
|
2475
|
+
scale: D.value,
|
|
2200
2476
|
controls: te,
|
|
2201
|
-
originalStatus: g(
|
|
2202
|
-
originalReason: g(
|
|
2203
|
-
livePlaying:
|
|
2204
|
-
liveStatus:
|
|
2477
|
+
originalStatus: g(C),
|
|
2478
|
+
originalReason: g(S),
|
|
2479
|
+
livePlaying: f.value,
|
|
2480
|
+
liveStatus: h.value
|
|
2205
2481
|
}, () => [
|
|
2206
|
-
|
|
2207
|
-
|
|
2482
|
+
T("header", va, [
|
|
2483
|
+
T("button", {
|
|
2208
2484
|
type: "button",
|
|
2209
2485
|
"aria-label": "关闭预览",
|
|
2210
2486
|
onClick: F
|
|
2211
2487
|
}, "‹"),
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2488
|
+
T("div", ya, [
|
|
2489
|
+
T("strong", null, de(W.value.title), 1),
|
|
2490
|
+
T("span", null, de(g(q) + 1) + " / " + de(s.items.length), 1)
|
|
2215
2491
|
]),
|
|
2216
|
-
|
|
2492
|
+
T("button", {
|
|
2217
2493
|
type: "button",
|
|
2218
2494
|
"aria-label": "旋转图片",
|
|
2219
2495
|
disabled: W.value.type === "video",
|
|
2220
|
-
onClick:
|
|
2221
|
-
}, " ↻ ", 8,
|
|
2496
|
+
onClick: b[0] || (b[0] = (E) => te.rotate())
|
|
2497
|
+
}, " ↻ ", 8, wa)
|
|
2222
2498
|
]),
|
|
2223
|
-
|
|
2224
|
-
W.value.type !== "video" ? (
|
|
2225
|
-
|
|
2499
|
+
T("footer", ba, [
|
|
2500
|
+
W.value.type !== "video" ? (O(), V(Le, { key: 0 }, [
|
|
2501
|
+
T("button", {
|
|
2226
2502
|
type: "button",
|
|
2227
2503
|
"aria-label": "缩小",
|
|
2228
|
-
onClick:
|
|
2229
|
-
(...
|
|
2504
|
+
onClick: b[1] || (b[1] = //@ts-ignore
|
|
2505
|
+
(...E) => te.zoomOut && te.zoomOut(...E))
|
|
2230
2506
|
}, "−"),
|
|
2231
|
-
|
|
2507
|
+
T("button", {
|
|
2232
2508
|
type: "button",
|
|
2233
2509
|
"aria-label": "放大",
|
|
2234
|
-
onClick:
|
|
2235
|
-
(...
|
|
2510
|
+
onClick: b[2] || (b[2] = //@ts-ignore
|
|
2511
|
+
(...E) => te.zoomIn && te.zoomIn(...E))
|
|
2236
2512
|
}, "+"),
|
|
2237
|
-
|
|
2513
|
+
T("button", {
|
|
2238
2514
|
type: "button",
|
|
2239
2515
|
"aria-label": "复位",
|
|
2240
|
-
onClick:
|
|
2241
|
-
(...
|
|
2516
|
+
onClick: b[3] || (b[3] = //@ts-ignore
|
|
2517
|
+
(...E) => te.reset && te.reset(...E))
|
|
2242
2518
|
}, "复位")
|
|
2243
|
-
], 64)) :
|
|
2244
|
-
|
|
2519
|
+
], 64)) : re("", !0),
|
|
2520
|
+
T("button", {
|
|
2245
2521
|
type: "button",
|
|
2246
2522
|
"aria-label": "图片详情",
|
|
2247
|
-
onClick:
|
|
2248
|
-
(...
|
|
2523
|
+
onClick: b[4] || (b[4] = //@ts-ignore
|
|
2524
|
+
(...E) => te.toggleDetail && te.toggleDetail(...E))
|
|
2249
2525
|
}, "ⓘ")
|
|
2250
2526
|
])
|
|
2251
2527
|
]),
|
|
2252
|
-
!
|
|
2528
|
+
!s.mobile && g(q) > 0 ? (O(), V("button", {
|
|
2253
2529
|
key: 0,
|
|
2254
2530
|
class: "mp-viewer__arrow is-left",
|
|
2255
2531
|
"aria-label": "上一张",
|
|
2256
|
-
onClick:
|
|
2257
|
-
}, " ‹ ")) :
|
|
2258
|
-
!
|
|
2532
|
+
onClick: b[5] || (b[5] = (E) => g(B).go(-1))
|
|
2533
|
+
}, " ‹ ")) : re("", !0),
|
|
2534
|
+
!s.mobile && g(q) < s.items.length - 1 ? (O(), V("button", {
|
|
2259
2535
|
key: 1,
|
|
2260
2536
|
class: "mp-viewer__arrow is-right",
|
|
2261
2537
|
"aria-label": "下一张",
|
|
2262
|
-
onClick:
|
|
2263
|
-
}, " › ")) :
|
|
2264
|
-
|
|
2265
|
-
], 10,
|
|
2266
|
-
|
|
2267
|
-
|
|
2538
|
+
onClick: b[6] || (b[6] = (E) => g(B).go(1))
|
|
2539
|
+
}, " › ")) : re("", !0),
|
|
2540
|
+
T("div", ka, de(g(q) + 1) + " / " + de(s.items.length), 1)
|
|
2541
|
+
], 10, ha),
|
|
2542
|
+
z.value ? (O(), V("aside", xa, [
|
|
2543
|
+
T("button", {
|
|
2268
2544
|
type: "button",
|
|
2269
2545
|
"aria-label": "关闭详情",
|
|
2270
|
-
onClick:
|
|
2546
|
+
onClick: b[7] || (b[7] = (E) => z.value = !1)
|
|
2271
2547
|
}, "×"),
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
])) :
|
|
2276
|
-
], 16,
|
|
2548
|
+
T("strong", null, de(W.value.title), 1),
|
|
2549
|
+
T("span", null, de(W.value.width) + " × " + de(W.value.height), 1),
|
|
2550
|
+
T("span", null, de(W.value.type) + " · " + de(D.value.toFixed(2)) + "×", 1)
|
|
2551
|
+
])) : re("", !0)
|
|
2552
|
+
], 16, da)) : re("", !0)
|
|
2277
2553
|
], 8, ["disabled"]));
|
|
2278
2554
|
}
|
|
2279
2555
|
});
|
|
2280
|
-
function
|
|
2281
|
-
const
|
|
2282
|
-
let r = 0,
|
|
2283
|
-
return
|
|
2284
|
-
|
|
2285
|
-
for (let
|
|
2286
|
-
const
|
|
2287
|
-
i.push({ kind: "items", group:
|
|
2288
|
-
for (let P = 0; P <
|
|
2289
|
-
|
|
2290
|
-
}
|
|
2291
|
-
}), { rows: i, locations:
|
|
2556
|
+
function Ma(t, n, o, e = 2) {
|
|
2557
|
+
const a = Math.max(1, (n - e * (o - 1)) / o), i = [], l = /* @__PURE__ */ new Map();
|
|
2558
|
+
let r = 0, u = 0;
|
|
2559
|
+
return t.forEach((v, c) => {
|
|
2560
|
+
c > 0 && (i.push({ kind: "header", group: c, first: 0, count: 0, start: r, end: r + 52 }), r += 52);
|
|
2561
|
+
for (let M = 0; M < v.items.length; M += o) {
|
|
2562
|
+
const C = Math.min(o, v.items.length - M), S = i.length;
|
|
2563
|
+
i.push({ kind: "items", group: c, first: M, count: C, start: r, end: r + a });
|
|
2564
|
+
for (let P = 0; P < C; P++) l.set(v.items[M + P].id, S);
|
|
2565
|
+
u += C, r += a + (M + C < v.items.length ? e : 0);
|
|
2566
|
+
}
|
|
2567
|
+
}), { rows: i, locations: l, height: r, size: a, total: u };
|
|
2292
2568
|
}
|
|
2293
|
-
function
|
|
2294
|
-
let
|
|
2295
|
-
for (;
|
|
2296
|
-
const
|
|
2297
|
-
a
|
|
2569
|
+
function Ft(t, n) {
|
|
2570
|
+
let o = 0, e = t.length;
|
|
2571
|
+
for (; o < e; ) {
|
|
2572
|
+
const a = o + e >>> 1;
|
|
2573
|
+
t[a].end < n ? o = a + 1 : e = a;
|
|
2298
2574
|
}
|
|
2299
|
-
return Math.min(
|
|
2575
|
+
return Math.min(o, Math.max(0, t.length - 1));
|
|
2300
2576
|
}
|
|
2301
|
-
const
|
|
2577
|
+
const Sa = ["data-total-items", "data-rendered-items"], Pa = /* @__PURE__ */ $e({
|
|
2302
2578
|
__name: "VirtualTimeline",
|
|
2303
2579
|
props: {
|
|
2304
2580
|
groups: {},
|
|
@@ -2307,97 +2583,97 @@ const sn = ["data-total-items", "data-rendered-items"], un = /* @__PURE__ */ Le(
|
|
|
2307
2583
|
hasMore: { type: Boolean, default: !1 }
|
|
2308
2584
|
},
|
|
2309
2585
|
emits: ["loadMore", "date"],
|
|
2310
|
-
setup(
|
|
2311
|
-
const
|
|
2312
|
-
() =>
|
|
2313
|
-
),
|
|
2314
|
-
const
|
|
2315
|
-
let
|
|
2316
|
-
for (;
|
|
2317
|
-
return
|
|
2318
|
-
}),
|
|
2319
|
-
let
|
|
2586
|
+
setup(t, { expose: n, emit: o }) {
|
|
2587
|
+
const e = t, a = o, i = L(), l = L(390), r = L(844), u = L(0), v = Y(
|
|
2588
|
+
() => e.mobile ? l.value >= 640 ? 5 : l.value >= 480 ? 4 : 3 : Math.max(1, Math.floor((l.value + 2) / 172))
|
|
2589
|
+
), c = Y(() => Ma(e.groups, l.value, v.value)), M = Y(() => {
|
|
2590
|
+
const x = c.value.rows, m = Ft(x, Math.max(0, u.value - c.value.size * 3)), w = u.value + r.value + c.value.size * 3;
|
|
2591
|
+
let R = m;
|
|
2592
|
+
for (; R < x.length && x[R].start <= w; ) R++;
|
|
2593
|
+
return x.slice(m, R);
|
|
2594
|
+
}), C = Y(() => M.value.reduce((x, m) => x + m.count, 0));
|
|
2595
|
+
let S = 0, P = !1, k = () => {
|
|
2320
2596
|
};
|
|
2321
|
-
function
|
|
2322
|
-
const
|
|
2323
|
-
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2326
|
-
}
|
|
2327
|
-
function
|
|
2328
|
-
|
|
2329
|
-
|
|
2597
|
+
function p() {
|
|
2598
|
+
const x = e.scrollElement();
|
|
2599
|
+
l.value = x.clientWidth, r.value = x.clientHeight, u.value = x.scrollTop, c.value.rows.length > 0 && a("date", e.groups[c.value.rows[Ft(c.value.rows, u.value)].group].key);
|
|
2600
|
+
const m = u.value + r.value >= c.value.height - c.value.size * 3;
|
|
2601
|
+
m && e.hasMore && !P && (P = !0, a("loadMore")), m || (P = !1);
|
|
2602
|
+
}
|
|
2603
|
+
function $() {
|
|
2604
|
+
S === 0 && (S = requestAnimationFrame(() => {
|
|
2605
|
+
S = 0, p();
|
|
2330
2606
|
}));
|
|
2331
2607
|
}
|
|
2332
|
-
const I = new ResizeObserver(
|
|
2333
|
-
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
},
|
|
2338
|
-
}),
|
|
2339
|
-
|
|
2340
|
-
}),
|
|
2341
|
-
() =>
|
|
2608
|
+
const I = new ResizeObserver(p);
|
|
2609
|
+
qe(() => {
|
|
2610
|
+
const x = e.scrollElement(), m = x.style.overflowAnchor;
|
|
2611
|
+
x.style.overflowAnchor = "none", k = () => {
|
|
2612
|
+
x.style.overflowAnchor = m;
|
|
2613
|
+
}, x.addEventListener("scroll", $, { passive: !0 }), I.observe(x), p();
|
|
2614
|
+
}), Fe(() => {
|
|
2615
|
+
e.scrollElement().removeEventListener("scroll", $), I.disconnect(), cancelAnimationFrame(S), k();
|
|
2616
|
+
}), J(
|
|
2617
|
+
() => e.groups,
|
|
2342
2618
|
() => {
|
|
2343
|
-
P = !1,
|
|
2619
|
+
P = !1, we(p);
|
|
2344
2620
|
}
|
|
2345
2621
|
);
|
|
2346
|
-
async function
|
|
2347
|
-
if (!
|
|
2348
|
-
const
|
|
2349
|
-
return (
|
|
2350
|
-
(
|
|
2622
|
+
async function y(x) {
|
|
2623
|
+
if (!c.value.locations.has(x)) return { kind: "unavailable" };
|
|
2624
|
+
const m = c.value.rows[c.value.locations.get(x)], w = e.scrollElement();
|
|
2625
|
+
return (m.start < w.scrollTop || m.end > w.scrollTop + w.clientHeight) && (w.scrollTop = Math.max(0, m.start - (w.clientHeight - c.value.size) / 2)), p(), await we(), await new Promise((f) => requestAnimationFrame(() => f())), { kind: "element", element: [...i.value.querySelectorAll("[data-id]")].find(
|
|
2626
|
+
(f) => f.dataset.id === x
|
|
2351
2627
|
).querySelector("img") };
|
|
2352
2628
|
}
|
|
2353
|
-
return
|
|
2629
|
+
return n({ resolveAnchor: y, rendered: C, total: Y(() => c.value.total) }), (x, m) => (O(), V("div", {
|
|
2354
2630
|
ref_key: "root",
|
|
2355
2631
|
ref: i,
|
|
2356
2632
|
class: "mp-virtual-timeline",
|
|
2357
|
-
style: Se({ height:
|
|
2358
|
-
"data-total-items":
|
|
2359
|
-
"data-rendered-items":
|
|
2633
|
+
style: Se({ height: c.value.height + "px" }),
|
|
2634
|
+
"data-total-items": c.value.total,
|
|
2635
|
+
"data-rendered-items": C.value
|
|
2360
2636
|
}, [
|
|
2361
|
-
(
|
|
2362
|
-
key:
|
|
2637
|
+
(O(!0), V(Le, null, Ze(M.value, (w) => (O(), V("div", {
|
|
2638
|
+
key: x.groups[w.group].key + ":" + w.kind + ":" + w.first,
|
|
2363
2639
|
class: "mp-timeline-row",
|
|
2364
2640
|
style: Se({
|
|
2365
|
-
top:
|
|
2366
|
-
height:
|
|
2367
|
-
display:
|
|
2368
|
-
gridTemplateColumns: `repeat(${
|
|
2641
|
+
top: w.start + "px",
|
|
2642
|
+
height: w.end - w.start + "px",
|
|
2643
|
+
display: w.kind === "items" ? "grid" : "block",
|
|
2644
|
+
gridTemplateColumns: `repeat(${v.value},minmax(0,1fr))`,
|
|
2369
2645
|
gap: "2px"
|
|
2370
2646
|
})
|
|
2371
2647
|
}, [
|
|
2372
|
-
|
|
2648
|
+
w.kind === "header" ? ft(x.$slots, "header", {
|
|
2373
2649
|
key: 0,
|
|
2374
|
-
group:
|
|
2375
|
-
index:
|
|
2376
|
-
}, void 0, !0) : (
|
|
2377
|
-
key:
|
|
2378
|
-
item:
|
|
2650
|
+
group: x.groups[w.group],
|
|
2651
|
+
index: w.group
|
|
2652
|
+
}, void 0, !0) : (O(!0), V(Le, { key: 1 }, Ze(x.groups[w.group].items.slice(w.first, w.first + w.count), (R) => ft(x.$slots, "item", {
|
|
2653
|
+
key: R.id,
|
|
2654
|
+
item: R
|
|
2379
2655
|
}, void 0, !0)), 128))
|
|
2380
2656
|
], 4))), 128))
|
|
2381
|
-
], 12,
|
|
2382
|
-
}
|
|
2383
|
-
}),
|
|
2384
|
-
const
|
|
2385
|
-
for (const [
|
|
2386
|
-
e
|
|
2387
|
-
return
|
|
2388
|
-
},
|
|
2657
|
+
], 12, Sa));
|
|
2658
|
+
}
|
|
2659
|
+
}), Ra = (t, n) => {
|
|
2660
|
+
const o = t.__vccOpts || t;
|
|
2661
|
+
for (const [e, a] of n)
|
|
2662
|
+
o[e] = a;
|
|
2663
|
+
return o;
|
|
2664
|
+
}, Fa = /* @__PURE__ */ Ra(Pa, [["__scopeId", "data-v-05c756fb"]]);
|
|
2389
2665
|
export {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2666
|
+
yt as ImageCanvasRenderer,
|
|
2667
|
+
hn as ImageStore,
|
|
2668
|
+
Bn as LivePhotoRenderer,
|
|
2669
|
+
La as MediaPreview,
|
|
2670
|
+
ia as PreviewStage,
|
|
2671
|
+
na as VideoDomRenderer,
|
|
2672
|
+
Fa as VirtualTimeline,
|
|
2673
|
+
Ke as defaultImagePolicy,
|
|
2674
|
+
Ge as defaultImageSource,
|
|
2675
|
+
Ae as formatVideoTime,
|
|
2400
2676
|
lt as nativeVideoSource,
|
|
2401
|
-
|
|
2402
|
-
|
|
2677
|
+
vn as previewImageStore,
|
|
2678
|
+
ln as usePreviewViewport
|
|
2403
2679
|
};
|