decord/source/modules/share/useFetchShareEmbed.tsx

220 lines
6.9 KiB
TypeScript
Raw Normal View History

// Module ID: 13904
// Function ID: 13905
2026-07-20 16:05:17 +00:00
// Name: useFetchShareEmbed
// Dependencies: [5, 32, 19, 1365, 11880, 1249, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 13904 (useFetchShareEmbed)
2026-08-24 06:08:38 +00:00
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "_slicedToArray" /* 32 */;
import closure_5 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/share/useFetchShareEmbed.tsx");
2026-07-20 16:05:17 +00:00
export default function useFetchShareEmbed(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const embed = callback(React.useState(undefined), 2);
2026-08-24 06:08:38 +00:00
closure_1 = embed[1];
2026-07-23 10:11:24 +00:00
[tmp3, dependencyMap] = callback(React.useState(false), 2);
2026-07-20 16:05:17 +00:00
const hasTriedResolving = callback(React.useState(false), 2);
2026-08-24 06:08:38 +00:00
closure_3 = hasTriedResolving[1];
2026-07-23 10:11:24 +00:00
callback = React.useRef(true);
React = React.useRef(undefined);
2026-08-27 16:17:25 +00:00
closure_6 = React.useRef(0);
2026-07-29 08:29:29 +00:00
let items = [arg0];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-08-27 16:17:25 +00:00
function _unfurl(arg0) {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback(function*() {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
2026-08-27 16:17:25 +00:00
} else if (tmp8 === 3) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp4;
2026-08-27 16:17:25 +00:00
c0 = tmp6;
c0 = undefined;
closure_1 = undefined;
2026-08-24 06:08:38 +00:00
if (null != closure_1_0) {
2026-08-27 16:17:25 +00:00
const sum = closure_1_6.current + 1;
closure_1_6.current = sum;
c0 = sum;
c5.current = closure_1_0;
2026-08-24 06:08:38 +00:00
c3 = 2;
closure_1_2(true);
const items = [closure_1_0];
2026-07-29 08:29:29 +00:00
c4 = 3;
c5 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_2_0(11880).unfurlEmbedUrl(items);
2026-07-29 08:29:29 +00:00
return obj1;
} else {
c5 = 3;
}
}
2026-08-27 16:17:25 +00:00
} else if (1 !== tmp9) {
if (2 === tmp9) {
2026-07-29 08:29:29 +00:00
c3 = 1;
2026-08-27 16:17:25 +00:00
if (closure_1_6.current === closure_1_0) {
closure_1_1(undefined);
}
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
closure_2_0(1249).batchUpdates(() => {
2026-07-29 08:29:29 +00:00
v0(true);
2026-08-27 16:17:25 +00:00
if (closure_1_6.current === c0) {
tmp62(false);
}
2026-07-29 08:29:29 +00:00
});
c5 = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
2026-08-27 16:17:25 +00:00
closure_1 = arg1;
if (closure_1_6.current !== c0) {
c3 = 0;
let obj3 = closure_2_0(1249);
2026-08-27 16:17:25 +00:00
obj3.batchUpdates(() => {
v0(true);
if (closure_1_6.current === c0) {
tmp62(false);
}
});
c5 = 3;
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-08-27 16:17:25 +00:00
} else if (0 === closure_1.embeds.length) {
2026-08-24 06:08:38 +00:00
closure_1_1(undefined);
2026-07-29 08:29:29 +00:00
c3 = 0;
obj1 = closure_2_0(1249);
2026-07-29 08:29:29 +00:00
obj1.batchUpdates(() => {
v0(true);
2026-08-27 16:17:25 +00:00
if (closure_1_6.current === c0) {
tmp62(false);
}
2026-07-29 08:29:29 +00:00
});
c5 = 3;
obj3 = { value: null, done: true };
obj3[0] = undefined;
return obj3;
} else {
obj = { embed: null, url: null };
2026-08-27 16:17:25 +00:00
obj[0] = closure_1.embeds[0];
obj[1] = c0;
2026-08-24 06:08:38 +00:00
closure_1_1(obj);
2026-07-29 08:29:29 +00:00
c3 = 1;
}
}
c3 = 0;
closure_2_0(1249).batchUpdates(() => {
2026-07-29 08:29:29 +00:00
v0(true);
2026-08-27 16:17:25 +00:00
if (closure_1_6.current === c0) {
tmp62(false);
}
2026-07-29 08:29:29 +00:00
});
const obj7 = closure_2_0(1249);
2026-07-29 08:29:29 +00:00
}
c3 = 0;
closure_2_0(1249).batchUpdates(() => {
2026-07-29 08:29:29 +00:00
v0(true);
2026-08-27 16:17:25 +00:00
if (closure_1_6.current === c0) {
tmp62(false);
}
2026-07-29 08:29:29 +00:00
});
throw dependencyMap;
2026-08-27 16:17:25 +00:00
} catch (tmp62) {
dependencyMap = tmp62;
2026-07-29 08:29:29 +00:00
if (tmp5 === c3) {
c5 = tmp3;
2026-08-27 16:17:25 +00:00
throw tmp62;
} else if (tmp2 === tmp64) {
2026-07-29 08:29:29 +00:00
c4 = tmp2;
} else {
c4 = tmp;
}
}
}
});
2026-08-24 06:08:38 +00:00
closure_2 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-07-29 08:29:29 +00:00
if ("" !== str) {
2026-08-24 06:08:38 +00:00
const match = str.match(callback(closure_1_2[3]).URL_REGEX);
2026-07-20 16:05:17 +00:00
let atResult;
2026-07-29 08:29:29 +00:00
if (match != null) {
2026-07-20 16:05:17 +00:00
atResult = match.at(0);
}
2026-07-23 10:11:24 +00:00
closure_0 = atResult;
2026-07-20 16:05:17 +00:00
if (atResult !== ref2.current) {
if (null == atResult) {
2026-08-27 16:17:25 +00:00
ref2.current = undefined;
ref3.current = ref3.current + 1;
2026-07-20 16:05:17 +00:00
callback(undefined);
2026-08-27 16:17:25 +00:00
_unfurl(false);
2026-07-20 16:05:17 +00:00
ref.current = false;
} else {
2026-07-29 08:29:29 +00:00
function unfurl() {
const self = this;
const apply = _unfurl.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}
2026-07-20 16:05:17 +00:00
if (ref.current) {
2026-07-29 08:29:29 +00:00
tmp2.current = false;
2026-07-20 16:05:17 +00:00
unfurl();
2026-08-27 16:17:25 +00:00
} else {
const _setTimeout = setTimeout;
callback = setTimeout(unfurl, 1000);
return () => {
clearTimeout(closure_1);
};
2026-07-20 16:05:17 +00:00
}
}
}
}
}
ref.current = false;
2026-08-27 16:17:25 +00:00
ref2.current = undefined;
ref3.current = ref3.current + 1;
2026-07-20 16:05:17 +00:00
callback(undefined);
2026-08-27 16:17:25 +00:00
_unfurl(false);
2026-07-20 16:05:17 +00:00
}, items);
return { embed: embed[0], isLoading, hasTriedResolving: hasTriedResolving[0] };
};