decord/source/modules/activities/utils/useEmbeddedActivityBackground.tsx

80 lines
2.3 KiB
TypeScript
Raw Normal View History

// Module ID: 9652
// Function ID: 9653
2026-07-20 16:05:17 +00:00
// Name: useEmbeddedActivityBackground
// Dependencies: [32, 19, 8139, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 9652 (useEmbeddedActivityBackground)
2026-08-24 06:08:38 +00:00
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
let closure_4 = ["embedded_cover", "embedded_background"];
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/activities/utils/useEmbeddedActivityBackground.tsx");
2026-07-20 16:05:17 +00:00
export default function useEmbeddedActivityBackground(applicationId) {
applicationId = applicationId.applicationId;
({ size, names } = applicationId);
if (names === undefined) {
names = closure_4;
}
let str = applicationId.format;
if (str === undefined) {
str = "png";
}
let callback;
let React;
closure_4 = undefined;
2026-07-29 08:29:29 +00:00
[tmp2, c2] = callback(React.useState(null), 2);
const tmp3 = callback(React.useState(true), 2);
React = tmp3[1];
2026-07-20 16:05:17 +00:00
const tmp = callback(React.useState(null), 2);
2026-07-29 08:29:29 +00:00
const url = applicationId(names[2]).getAssetImage(applicationId, tmp2, size, str);
let state = "loading";
if (!tmp3[0]) {
2026-07-20 16:05:17 +00:00
let str3 = "not-found";
2026-07-29 08:29:29 +00:00
if (null != url) {
2026-07-20 16:05:17 +00:00
str3 = "fetched";
}
2026-07-29 08:29:29 +00:00
state = str3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_4 = obj.useRef(names);
const effect = obj.useEffect(() => {
2026-07-20 16:05:17 +00:00
closure_4.current = names;
});
const items = [applicationId];
2026-07-29 08:29:29 +00:00
const effect1 = obj.useEffect(() => {
2026-07-23 10:11:24 +00:00
const current = ref.current;
if (null != current) {
2026-07-29 08:29:29 +00:00
const assets = applicationId(names[2]).getAssets(tmp);
2026-07-20 16:05:17 +00:00
assets.then((arg0) => {
2026-08-24 06:08:38 +00:00
closure_1_3(false);
2026-07-20 16:05:17 +00:00
const entries = Object.entries(arg0);
2026-07-29 08:29:29 +00:00
const obj = entries[Symbol.iterator]();
while (obj !== undefined) {
let tmp4 = callback;
let tmp5 = callback(tmp3, 2);
[r10020, tmp6] = tmp5;
let tmp7 = tmp6;
if (null != tmp6) {
let tmp8 = tmp6;
if ("" !== tmp7.id) {
let tmp9 = current;
let tmp10 = tmp6;
if (current.includes(tmp7.name)) {
2026-08-24 06:08:38 +00:00
let tmp11 = closure_1_2;
let tmp12 = closure_1_2(tmp6.id);
2026-07-29 08:29:29 +00:00
let tmp13 = obj;
obj.return();
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
let obj = applicationId(names[2]);
2026-07-20 16:05:17 +00:00
}
}, items);
2026-07-29 08:29:29 +00:00
return { url, state };
2026-07-20 16:05:17 +00:00
};