@lazycatcloud/vue-media-preview 0.1.1 → 0.1.2

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