This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,43 @@
// Metro module 14169 (f14170).
import { useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import Module689 from "../../../../../_bundle/Module689";
import { useVideoQuestCaptions } from "../hooks/useVideoQuestCaptions";
import { findActiveCaption } from "./VideoQuestCaptionsUtils";
import VisualEffectView from "../../../../visual_effect_view/native/VisualEffectView";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
position: "absolute",
bottom: Module712.space.PX_32,
left: Module712.space.PX_16,
right: Module712.space.PX_16,
alignItems: "center",
justifyContent: "flex-end"
},
captionBox: {
backgroundColor: Module689(Module712.unsafe_rawColors.BLACK).alpha(0.35).hex(),
padding: Module712.space.PX_8,
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
captionText: {
color: Module712.colors.WHITE,
textAlign: "center"
}
});
export function VideoQuestCaptions(props) {
const { quest, currentTime, style, visible = true } = props;
let c21001_1 = visible;
const styles = useStyles();
const videoQuestCaptions = useVideoQuestCaptions(quest);
const { captions, status } = videoQuestCaptions;
const memo = useMemo(() => captions != null ? c21001_1 ? findActiveCaption(captions, currentTime) : null : null, [captions, currentTime, visible]);
return status === "success" ? memo == null ? null : <View style={[styles.container, style]} importantForAccessibility="no-hide-descendants" accessibilityRole="none" accessible={false}>
<VisualEffectView style={styles.captionBox} blurTheme="dark" blurStyle="default" blurAmount={0.2}>
<Text variant="heading-sm/medium" style={styles.captionText}>{memo.text}</Text>
</VisualEffectView>
</View> : null;
}
@@ -0,0 +1,25 @@
// Metro module 14172 (f14173).
export function findActiveCaption(a0, a1) {
let r21;
let r1 = a0.length - 1;
let r8 = 0;
while (r8 <= r1) {
const r13 = Math.floor((r8 + r1) / 2);
const r15 = a0[r13];
const start = r15.start;
let r17 = r1;
const r18 = r8;
if (a1 >= start && a1 <= r15.end) {
return r15;
}
if (a1 < r15.start) {
r17 = r13 - 1;
r21 = r18;
} else {
r21 = r13 + 1;
}
r1 = r17;
r8 = r21;
}
return null;
}
@@ -0,0 +1,200 @@
// Metro module 14171 (f14172).
import { HermesBuiltin, $callWithNewTarget } from "../../../../../_hermes/prelude";
let c9947_1;
class VttParserError extends Error {
constructor(a0, a1) {
super(a0);
this.error = a1;
this.name = "ParserError";
}
}
c9947_1 = /([0-9]+)?:?([0-9]{2}):([0-9]{2}\.[0-9]{2,3})/;
export { VttParserError };
export function parseVtt(a0, r4 = {}) {
const meta = r4.meta;
let r8 = meta !== void 0 && meta;
const strict2 = r4.strict;
const strict3 = strict2 === void 0 || strict2;
const r29 = a0.trim().replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n\n");
const r31 = r29.shift();
if (r31.startsWith("WEBVTT")) {
const r43 = r31.split("\n");
const r47 = r43[0].replace("WEBVTT", "");
if (r47.length > 0 && r47[0] !== " " && r47[0] !== "\t") {
const prototypeOf3 = Object.getPrototypeOf(VttParserError);
const r111 = Object.create(VttParserError.prototype);
const r114 = $callWithNewTarget(prototypeOf3, r111, VttParserError, "Header comment must start with space or tab");
const r115 = r114 instanceof Object ? r114 : r111;
r115.error = void 0;
r115.name = "ParserError";
throw r115;
}
if (r29.length === 0 && r43.length === 1) {
return {
valid: true,
strict: strict3,
cues: [],
errors: []
};
}
if (!r8 && r43.length > 1 && r43[1] !== "") {
const prototypeOf2 = Object.getPrototypeOf(VttParserError);
const r64 = Object.create(VttParserError.prototype);
const r67 = $callWithNewTarget(prototypeOf2, r64, VttParserError, "Missing blank line after signature");
const r68 = r67 instanceof Object ? r67 : r64;
r68.error = void 0;
r68.name = "ParserError";
throw r68;
}
const strict = strict3;
const errors = [];
let c21003_1 = errors;
const cues = r29.map((item, index) => {
let r7;
try {
r7 = (function parseCue(a0, a1, a2) {
const r9 = a0.split("\n").filter(Boolean);
if (r9.length > 0 && r9[0].trim().startsWith("NOTE")) {
return null;
}
if (r9.length === 1 && !r9[0].includes("-->")) {
const r41 = `Cue identifier cannot be standalone (cue #${a1})`;
const prototypeOf = Object.getPrototypeOf(VttParserError);
const r46 = Object.create(VttParserError.prototype);
const r48 = $callWithNewTarget(prototypeOf, r46, VttParserError, r41);
const r49 = r48 instanceof Object ? r48 : r46;
r49.error = void 0;
r49.name = "ParserError";
throw r49;
}
if (r9.length > 1 && !r9[0].includes("-->") && !r9[1].includes("-->")) {
const r65 = `Cue identifier needs to be followed by timestamp (cue #${a1})`;
const prototypeOf2 = Object.getPrototypeOf(VttParserError);
const r71 = Object.create(VttParserError.prototype);
const r74 = $callWithNewTarget(prototypeOf2, r71, VttParserError, r65);
const r75 = r74 instanceof Object ? r74 : r71;
r75.error = void 0;
r75.name = "ParserError";
throw r75;
}
const identifier = r9.length > 1 && r9[1].includes("-->") ? r9.shift() : "";
const r89 = r9[0].split(" --> ");
if (r89.length === 2 && c9947_1.test(r89[0]) && c9947_1.test(r89[1])) {
const r100 = r89[0].match(c9947_1);
const r4 = r100 == null;
let start = 0;
if (!r4) {
const r18 = parseFloat;
let r17 = r100[1];
if (r17 == null) {
r17 = "0";
}
start = 60 * r18(r17) * 60 + 60 * parseFloat(r100[2]) + parseFloat(r100[3]);
}
const r116 = r89[1].match(c9947_1);
const r117 = r116 == null;
let end = 0;
if (!r117) {
const r119 = parseFloat;
let r120 = r116[1];
if (r120 == null) {
r120 = "0";
}
end = 60 * r119(r120) * 60 + 60 * parseFloat(r116[2]) + parseFloat(r116[3]);
}
if (a2) {
if (start > end) {
const r190 = `Start timestamp greater than end (cue #${a1})`;
const prototypeOf5 = Object.getPrototypeOf(VttParserError);
const r196 = Object.create(VttParserError.prototype);
const r199 = $callWithNewTarget(prototypeOf5, r196, VttParserError, r190);
const r200 = r199 instanceof Object ? r199 : r196;
r200.error = void 0;
r200.name = "ParserError";
throw r200;
}
if (end <= start) {
const r171 = `End must be greater than start (cue #${a1})`;
const prototypeOf4 = Object.getPrototypeOf(VttParserError);
const r177 = Object.create(VttParserError.prototype);
const r180 = $callWithNewTarget(prototypeOf4, r177, VttParserError, r171);
const r181 = r180 instanceof Object ? r180 : r177;
r181.error = void 0;
r181.name = "ParserError";
throw r181;
}
}
if (!a2 && end < start) {
const r139 = `End must be greater or equal to start when not strict (cue #${a1})`;
const prototypeOf3 = Object.getPrototypeOf(VttParserError);
const r145 = Object.create(VttParserError.prototype);
const r148 = $callWithNewTarget(prototypeOf3, r145, VttParserError, r139);
const r149 = r148 instanceof Object ? r148 : r145;
r149.error = void 0;
r149.name = "ParserError";
throw r149;
}
const styles = r89[1].replace(c9947_1, "").trim();
r9.shift();
const text = r9.join("\n");
if (text.trim() === "") {
return false;
}
return {
identifier,
start,
end,
text,
styles
};
}
const r209 = `Invalid cue timestamp (cue #${a1})`;
const prototypeOf6 = Object.getPrototypeOf(VttParserError);
const r215 = Object.create(VttParserError.prototype);
const r218 = $callWithNewTarget(prototypeOf6, r215, VttParserError, r209);
const r219 = r218 instanceof Object ? r218 : r215;
r219.error = void 0;
r219.name = "ParserError";
throw r219;
})(item, index, strict);
} catch ($e) {
c21003_1.push($e);
return null;
}
return r7;
}).filter((item) => item !== null && item !== false);
if (strict && errors.length > 0) {
throw errors[0];
}
let meta2 = null;
if (r8) {
const r82 = {};
let c21004_0 = r82;
r43.slice(1).forEach((item) => {
const r6 = item.indexOf(":");
c21004_0[item.slice(0, r6).trim()] = item.slice(r6 + 1).trim();
});
meta2 = Object.keys(r82).length > 0 ? r82 : null;
}
const r97 = {
valid: errors.length === 0,
strict,
cues,
errors
};
if (r8) {
r8 = {
meta: meta2
};
}
HermesBuiltin.copyDataProperties(r97, r8);
return r97;
}
const prototypeOf = Object.getPrototypeOf(VttParserError);
const r12 = Object.create(VttParserError.prototype);
const r38 = $callWithNewTarget(prototypeOf, r12, VttParserError, "Must start with \"WEBVTT\"");
const r39 = r38 instanceof Object ? r38 : r12;
r39.error = void 0;
r39.name = "ParserError";
throw r39;
}