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