decord/source/modules/activities/utils/useEmbeddedActivityBackground.tsx
2026-09-01 10:26:29 +00:00

79 lines
2.3 KiB
TypeScript

// Module ID: 9621
// Function ID: 9622
// Name: useEmbeddedActivityBackground
// Dependencies: [32, 19, 8049, 2]
// Exports: default
// Module 9621 (useEmbeddedActivityBackground)
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
const require = arg1;
let closure_4 = ["embedded_cover", "embedded_background"];
const result = require("set").fileFinishedImporting("modules/activities/utils/useEmbeddedActivityBackground.tsx");
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;
[tmp2, c2] = callback(React.useState(null), 2);
const tmp3 = callback(React.useState(true), 2);
React = tmp3[1];
const tmp = callback(React.useState(null), 2);
const url = applicationId(names[2]).getAssetImage(applicationId, tmp2, size, str);
let state = "loading";
if (!tmp3[0]) {
let str3 = "not-found";
if (null != url) {
str3 = "fetched";
}
state = str3;
}
closure_4 = obj.useRef(names);
const effect = obj.useEffect(() => {
closure_4.current = names;
});
const items = [applicationId];
const effect1 = obj.useEffect(() => {
const current = ref.current;
if (null != current) {
const assets = applicationId(names[2]).getAssets(tmp);
assets.then((arg0) => {
closure_1_3(false);
const entries = Object.entries(arg0);
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)) {
let tmp11 = closure_1_2;
let tmp12 = closure_1_2(tmp6.id);
let tmp13 = obj;
obj.return();
}
}
}
continue;
}
});
let obj = applicationId(names[2]);
}
}, items);
return { url, state };
};