176 lines
4.8 KiB
JavaScript
176 lines
4.8 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 72789
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(740151),
|
|
n = e.i(295085),
|
|
i = e.i(168161),
|
|
r = e.i(217884);
|
|
let a = new Set();
|
|
function o() {
|
|
a.clear(), (0, r.resetScheduler)();
|
|
}
|
|
let s =
|
|
"function" == typeof requestIdleCallback
|
|
? (e) => requestIdleCallback(e, { timeout: 8e3 })
|
|
: (e) => setTimeout(e, 3e3);
|
|
function c(e) {
|
|
if (!e || e.startsWith("blob:") || e.startsWith("data:")) return !1;
|
|
let n = (0, t.convertToChinaCdn)(e);
|
|
return (
|
|
n.includes("libtv-res.liblib.art") &&
|
|
n.startsWith("http") &&
|
|
!n.includes("x-oss-process=")
|
|
);
|
|
}
|
|
function l(e, t) {
|
|
let n = e.includes("?") ? "&" : "?";
|
|
return `${e}${n}x-oss-process=image/resize,w_${t},m_lfit/format,webp/ignore-error,1`;
|
|
}
|
|
function u(e, t) {
|
|
let n = e.includes("?") ? "&" : "?";
|
|
return `${e}${n}x-oss-process=video/snapshot,t_0,f_jpg,w_${t},m_fast`;
|
|
}
|
|
function h(e) {
|
|
return a.has(e)
|
|
? Promise.resolve()
|
|
: (a.add(e),
|
|
fetch(e, { mode: "cors", priority: "low" })
|
|
.then(() => void 0)
|
|
.catch(() => void 0));
|
|
}
|
|
function f(e) {
|
|
a.has(e) ||
|
|
(a.add(e),
|
|
(0, r.markUrlKnown)(e),
|
|
fetch(e, { mode: "cors" }).catch(() => void 0));
|
|
}
|
|
function d(e, i, o, u) {
|
|
if (!c(e) || (o && o > n.OSS_PROCESS_MAX_FILE_SIZE)) return;
|
|
let d = (0, t.convertToChinaCdn)(e),
|
|
p = g(i),
|
|
b = new Set([i, ...p]);
|
|
for (let e of b) f(l(d, e));
|
|
let m = n.RESPONSIVE_WIDTHS.filter((e) => !b.has(e));
|
|
if ((0, r.isTierSchedulerEnabled)()) {
|
|
for (let e of m) {
|
|
let t = l(d, e);
|
|
a.has(t) ||
|
|
(a.add(t), (0, r.enqueueTierPrefetch)(t, "image", "idle", u));
|
|
}
|
|
return;
|
|
}
|
|
let w = 0;
|
|
m.length > 0 &&
|
|
s(function e() {
|
|
w >= m.length ||
|
|
h(l(d, m[w++])).then(() => {
|
|
w < m.length && s(e);
|
|
});
|
|
});
|
|
}
|
|
function p(e, i, o) {
|
|
if (!c(e)) return;
|
|
let l = (0, t.convertToChinaCdn)(e);
|
|
f(u(l, i));
|
|
let d = g(i),
|
|
p = new Set([i, ...d]),
|
|
b = n.RESPONSIVE_WIDTHS.filter((e) => !p.has(e));
|
|
if ((0, r.isTierSchedulerEnabled)()) {
|
|
for (let e of d) {
|
|
let t = u(l, e);
|
|
a.has(t) ||
|
|
(a.add(t),
|
|
(0, r.enqueueTierPrefetch)(t, "video-snapshot", "warm", o));
|
|
}
|
|
for (let e of b) {
|
|
let t = u(l, e);
|
|
a.has(t) ||
|
|
(a.add(t),
|
|
(0, r.enqueueTierPrefetch)(t, "video-snapshot", "idle", o));
|
|
}
|
|
return;
|
|
}
|
|
let m = [...d, ...b],
|
|
w = 0;
|
|
m.length > 0 &&
|
|
s(function e() {
|
|
w >= m.length ||
|
|
h(u(l, m[w++])).then(() => {
|
|
w < m.length && s(e);
|
|
});
|
|
});
|
|
}
|
|
function g(e) {
|
|
let t = n.RESPONSIVE_WIDTHS.indexOf(e);
|
|
if (-1 === t) return [];
|
|
let i = [];
|
|
return (
|
|
t > 0 && i.push(n.RESPONSIVE_WIDTHS[t - 1]),
|
|
t < n.RESPONSIVE_WIDTHS.length - 1 &&
|
|
i.push(n.RESPONSIVE_WIDTHS[t + 1]),
|
|
i
|
|
);
|
|
}
|
|
function b(e, r, a) {
|
|
if (!c(e) || (a && a > n.OSS_PROCESS_MAX_FILE_SIZE)) return;
|
|
let o = (0, t.convertToChinaCdn)(e);
|
|
for (let e of g(r)) {
|
|
let t = l(o, e),
|
|
n = i.imgPool.tryAcquire(t);
|
|
if (n) {
|
|
i.imgPool.release(n);
|
|
continue;
|
|
}
|
|
let r = new Image();
|
|
(r.decoding = "async"),
|
|
(r.src = t),
|
|
(r.onload = () => {
|
|
(r.onload = null), (r.onerror = null), i.imgPool.release(r, t);
|
|
}),
|
|
(r.onerror = () => {
|
|
(r.onload = null), (r.onerror = null);
|
|
});
|
|
}
|
|
}
|
|
function m(e, n) {
|
|
if (!c(e)) return;
|
|
let r = (0, t.convertToChinaCdn)(e);
|
|
for (let e of g(n)) {
|
|
let t = u(r, e),
|
|
n = i.imgPool.tryAcquire(t);
|
|
if (n) {
|
|
i.imgPool.release(n);
|
|
continue;
|
|
}
|
|
let a = new Image();
|
|
(a.decoding = "async"),
|
|
(a.src = t),
|
|
(a.onload = () => {
|
|
(a.onload = null), (a.onerror = null), i.imgPool.release(a, t);
|
|
}),
|
|
(a.onerror = () => {
|
|
(a.onload = null), (a.onerror = null);
|
|
});
|
|
}
|
|
}
|
|
e.s([
|
|
"clearAllTierPrefetchState",
|
|
() => o,
|
|
"preDecodeAdjacentImageTiers",
|
|
() => b,
|
|
"preDecodeAdjacentVideoTiers",
|
|
() => m,
|
|
"prefetchAllImageTiers",
|
|
() => d,
|
|
"prefetchAllVideoTiers",
|
|
() => p,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|