decord/source/components_native/common/VoiceSensitivity.tsx

333 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 10938
// Function ID: 10939
2026-07-20 16:05:17 +00:00
// Name: VoiceSensitivity
2026-08-25 06:04:03 +00:00
// Dependencies: [5, 32, 19, 17, 4431, 5244, 7019, 676, 4618, 21, 4380, 712, 4228, 1494, 589, 4964, 4479, 1351, 1236, 1297, 8118, 8140, 500, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 10938 (VoiceSensitivity)
2026-08-24 06:08:38 +00:00
import ThemesDefault from "Themes" /* 712 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "_slicedToArray" /* 32 */;
import closure_5 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
2026-08-25 06:04:03 +00:00
import closure_7 from "_detectH265HardwareDecode" /* 4431 */;
import closure_8 from "anyoneHasFlagInContext" /* 5244 */;
import closure_9 from "getState" /* 7019 */;
2026-08-24 06:08:38 +00:00
import { AppStates } from "ME" /* 676 */;
2026-08-25 06:04:03 +00:00
import { NativePermissionTypes } from "NativePermissionStatus" /* 4618 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
import hexToRgba from "hexToRgba" /* 4228 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ jsx: closure_12, jsxs: map1 } = jsxProd);
createCacheKey = { sensitivity: { position: "relative", height: 20 }, sensitivityBar: { position: "absolute", top: 7, left: 0, right: 0, bottom: 7, flexDirection: "row" }, sensitivityFill: null, sensitivityCommon: null, sensitivityMin: null, sensitivityMax: null, sensitivityDefault: null, sensitivitySpeaking: null, sensitivitySlider: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { position: "absolute", backgroundColor: ThemesDefault.unsafe_rawColors.WHITE, opacity: 0.5, top: 7, left: 0, right: 0, bottom: 7 };
2026-07-29 08:29:29 +00:00
createCacheKey[2] = createCacheKey;
createCacheKey[3] = { height: 6, borderRadius: 3 };
2026-08-24 06:08:38 +00:00
createCacheKey[4] = { backgroundColor: ThemesDefault.unsafe_rawColors.YELLOW_300 };
let obj1 = { backgroundColor: ThemesDefault.unsafe_rawColors.YELLOW_300 };
createCacheKey[5] = { backgroundColor: ThemesDefault.unsafe_rawColors.GREEN_360 };
2026-07-29 08:29:29 +00:00
let obj3 = { flex: 1, backgroundColor: null };
2026-08-24 06:08:38 +00:00
obj3[1] = hexToRgba.hexWithOpacity(ThemesDefault.unsafe_rawColors.PRIMARY_400, 0.6);
2026-07-29 08:29:29 +00:00
createCacheKey[6] = obj3;
2026-08-24 06:08:38 +00:00
let obj2 = { backgroundColor: ThemesDefault.unsafe_rawColors.GREEN_360 };
createCacheKey[7] = { flex: 1, backgroundColor: ThemesDefault.unsafe_rawColors.GREEN_360 };
2026-07-29 08:29:29 +00:00
createCacheKey[8] = { flex: 1, backgroundColor: "transparent", marginVertical: -10 };
2026-08-24 06:08:38 +00:00
let closure_14 = createCacheKey.createStyles(createCacheKey);
let obj4 = { flex: 1, backgroundColor: ThemesDefault.unsafe_rawColors.GREEN_360 };
const result = require("set").fileFinishedImporting("components_native/common/VoiceSensitivity.tsx");
2026-07-20 16:05:17 +00:00
export default function VoiceSensitivity(auto) {
auto = auto.auto;
2026-07-23 10:11:24 +00:00
const onThresholdChange = auto.onThresholdChange;
2026-07-29 08:29:29 +00:00
let first;
2026-08-24 06:08:38 +00:00
closure_3 = undefined;
2026-07-29 08:29:29 +00:00
let width;
let stateFromStores;
let first1;
2026-08-24 06:08:38 +00:00
closure_7 = undefined;
2026-07-29 08:29:29 +00:00
let first2;
2026-08-24 06:08:38 +00:00
closure_9 = undefined;
2026-07-29 08:29:29 +00:00
c10 = undefined;
2026-08-24 06:08:38 +00:00
closure_11 = undefined;
2026-07-29 08:29:29 +00:00
let callback;
callback = undefined;
2026-08-24 06:08:38 +00:00
let callback2;
closure_15 = undefined;
let tmp = callback2();
2026-07-20 16:05:17 +00:00
const sum = auto.threshold + 100;
2026-07-23 10:11:24 +00:00
const ref = stateFromStores.useRef(null);
const ref1 = stateFromStores.useRef(null);
const tmp6 = width(stateFromStores.useState(first2.isCurrentUserSpeaking()), 2);
2026-07-29 08:29:29 +00:00
first = tmp6[0];
2026-08-24 06:08:38 +00:00
closure_3 = tmp6[1];
2026-07-23 10:11:24 +00:00
width = onThresholdChange(first[13])().width;
let obj = auto(first[14]);
2026-08-24 06:08:38 +00:00
const items = [closure_9];
2026-07-23 10:11:24 +00:00
stateFromStores = obj.useStateFromStores(items, () => state.getState(), []);
2026-07-29 08:29:29 +00:00
const tmp12 = width(stateFromStores.useState(0), 2);
first1 = tmp12[0];
2026-08-24 06:08:38 +00:00
closure_7 = tmp12[1];
2026-07-29 08:29:29 +00:00
const tmp14 = width(stateFromStores.useState(sum), 2);
first2 = tmp14[0];
2026-08-24 06:08:38 +00:00
closure_9 = tmp14[1];
2026-07-23 10:11:24 +00:00
const ref2 = stateFromStores.useRef(null);
2026-07-29 08:29:29 +00:00
const tmp8 = onThresholdChange;
[tmp17, c10] = width(stateFromStores.useState(first2 / 100), 2);
const tmp18 = width(stateFromStores.useState(width * (1 - first1 / -100)), 2);
closure_11 = tmp18[1];
2026-07-20 16:05:17 +00:00
const items1 = [auto, first2];
2026-07-23 10:11:24 +00:00
const effect = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!auto) {
2026-07-29 08:29:29 +00:00
_undefined(first2 / 100);
2026-07-20 16:05:17 +00:00
}
}, items1);
const items2 = [auto, first1, width];
2026-07-23 10:11:24 +00:00
const effect1 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!auto) {
2026-07-29 08:29:29 +00:00
callback3(width * (1 - first1 / -100));
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-07-29 08:29:29 +00:00
callback = stateFromStores.useCallback((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
callback(arg1);
callback2(arg0);
}, []);
const items3 = [callback, stateFromStores];
2026-07-23 10:11:24 +00:00
const callback1 = stateFromStores.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
state(arg0);
}, []);
2026-07-23 10:11:24 +00:00
const effect2 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
function _listenOnlyIfWeHavePermission() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback(function*() {
if (c2 === 2) {
c2 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw arg1;
} else if (arg0 === 2) {
c2 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_0 = tmp4;
let obj2 = v0(closure_2_2[15]);
2026-07-29 08:29:29 +00:00
c1 = 1;
c2 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = obj2.hasPermission(closure_2_11.AUDIO, { showAuthorizationError: false });
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (arg0 === 1) {
c2 = 3;
throw arg1;
} else if (arg0 === 2) {
c2 = 3;
obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
let tmp5 = arg1;
if (arg1) {
tmp5 = !closure_0;
}
if (tmp5) {
2026-08-24 06:08:38 +00:00
const mediaEngine = closure_2_7.getMediaEngine();
mediaEngine.on(closure_2_0(closure_2_2[16]).MediaEngineEvent.VoiceActivity, closure_1_12);
2026-07-29 08:29:29 +00:00
}
c2 = 3;
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} catch (tmp17) {
c2 = tmp;
throw tmp17;
}
}
});
2026-08-24 06:08:38 +00:00
closure_1 = 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-29 08:29:29 +00:00
if (stateFromStores === _undefined.ACTIVE) {
2026-08-24 06:08:38 +00:00
c0 = false;
2026-07-23 10:11:24 +00:00
(function listenOnlyIfWeHavePermission() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _listenOnlyIfWeHavePermission.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-23 10:11:24 +00:00
})();
2026-07-20 16:05:17 +00:00
return () => {
2026-08-24 06:08:38 +00:00
c0 = true;
2026-07-23 10:11:24 +00:00
mediaEngine = mediaEngine.getMediaEngine();
2026-08-24 06:08:38 +00:00
mediaEngine.removeListener(auto(first[16]).MediaEngineEvent.VoiceActivity, closure_1_12);
2026-07-20 16:05:17 +00:00
};
}
}, items3);
2026-07-23 10:11:24 +00:00
callback = stateFromStores.useRef(false);
2026-08-24 06:08:38 +00:00
callback2 = stateFromStores.useRef(false);
2026-07-29 08:29:29 +00:00
closure_15 = stateFromStores.useRef(null);
2026-07-20 16:05:17 +00:00
const items4 = [auto, first];
2026-07-23 10:11:24 +00:00
const effect3 = stateFromStores.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (ref.current) {
if (auto) {
if (tmp3.current) {
if (first) {
if (null != tmp5.current) {
2026-07-23 10:11:24 +00:00
let _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp5.current);
tmp5.current = null;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let AccessibilityAnnouncer = auto(first[17]).AccessibilityAnnouncer;
let intl = auto(first[18]).intl;
2026-07-20 16:05:17 +00:00
AccessibilityAnnouncer.announce(intl.string(auto(first[18]).t.haLKZ0));
} else {
const _setTimeout = setTimeout;
tmp5.current = setTimeout(() => {
2026-07-29 08:29:29 +00:00
closure_15.current = null;
2026-08-24 06:08:38 +00:00
const AccessibilityAnnouncer = closure_1_0(closure_1_2[17]).AccessibilityAnnouncer;
const intl = closure_1_0(closure_1_2[18]).intl;
AccessibilityAnnouncer.announce(intl.string(closure_1_0(closure_1_2[18]).t.X2hJL7));
2026-07-20 16:05:17 +00:00
}, 1000);
}
return () => {
2026-07-29 08:29:29 +00:00
if (null != ref.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
}
} else {
tmp3.current = false;
}
} else {
2026-07-29 08:29:29 +00:00
tmp.current = true;
2026-07-20 16:05:17 +00:00
}
}, items4);
if (auto) {
2026-07-29 08:29:29 +00:00
obj = { accessible: true, role: "meter", "aria-label": null, "aria-valuenow": null, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuetext": null, onAccessibilityFocus: null, onAccessibilityBlur: null, style: null, children: null };
let intl = tmp10(tmp9[18]).intl;
obj[2] = intl.string(tmp10(tmp9[18]).t.yZcOjo);
let num = 0;
2026-07-20 16:05:17 +00:00
if (first) {
2026-07-29 08:29:29 +00:00
num = 100;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = num;
const intl2 = tmp10(tmp9[18]).intl;
2026-07-20 16:05:17 +00:00
const string = intl2.string;
2026-07-29 08:29:29 +00:00
const t = tmp10(tmp9[18]).t;
2026-07-20 16:05:17 +00:00
if (first) {
let stringResult = string(t.haLKZ0);
} else {
stringResult = string(t.X2hJL7);
}
2026-07-29 08:29:29 +00:00
obj = { children: null };
obj[6] = stringResult;
obj[7] = function onAccessibilityFocus() {
2026-07-20 16:05:17 +00:00
closure_14.current = true;
};
2026-07-29 08:29:29 +00:00
obj[8] = function onAccessibilityBlur() {
2026-07-20 16:05:17 +00:00
closure_14.current = false;
if (null != ref2.current) {
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[9] = tmp.sensitivity;
2026-08-24 06:08:38 +00:00
obj1 = { style: null, children: null };
2026-07-29 08:29:29 +00:00
obj1[0] = tmp.sensitivityBar;
let obj2 = { style: null };
2026-07-20 16:05:17 +00:00
const items5 = [tmp.sensitivityCommon, first ? tmp.sensitivitySpeaking : tmp.sensitivityDefault];
2026-07-29 08:29:29 +00:00
obj2[0] = items5;
obj1[1] = callback(first1, obj2);
obj[10] = callback(first1, obj1);
const items6 = [callback(tmp10(tmp9[19]).AccessibilityFocusView, obj), ];
const obj3 = { inset: true, children: null };
const intl3 = tmp10(tmp9[18]).intl;
obj3[1] = intl3.string(tmp10(tmp9[18]).t.W3K5Im);
items6[1] = callback(tmp10(tmp9[20]).FormHint, obj3);
obj[0] = items6;
2026-07-23 10:11:24 +00:00
return callback(first1, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj4 = { style: null, children: null };
obj4[0] = tmp.sensitivity;
const obj5 = { style: null, children: null };
obj5[0] = tmp.sensitivityBar;
const obj6 = { ref: null, style: null };
obj6[0] = ref;
2026-07-20 16:05:17 +00:00
const items7 = [, , ];
({ sensitivityCommon: arr6[0], sensitivityMin: arr6[1] } = tmp);
2026-07-29 08:29:29 +00:00
const obj7 = { flex: null };
obj7[0] = tmp17;
2026-07-20 16:05:17 +00:00
items7[2] = obj7;
2026-07-29 08:29:29 +00:00
obj6[1] = items7;
2026-07-23 10:11:24 +00:00
const items8 = [callback(first1, obj6), ];
2026-07-29 08:29:29 +00:00
const obj8 = { ref: null, style: null };
obj8[0] = ref1;
2026-07-20 16:05:17 +00:00
const items9 = [, , ];
({ sensitivityCommon: arr8[0], sensitivityMax: arr8[1] } = tmp);
2026-07-29 08:29:29 +00:00
const obj9 = { flex: null };
obj9[0] = 1 - tmp17;
2026-07-20 16:05:17 +00:00
items9[2] = obj9;
2026-07-29 08:29:29 +00:00
obj8[1] = items9;
2026-07-23 10:11:24 +00:00
items8[1] = callback(first1, obj8);
2026-07-29 08:29:29 +00:00
obj5[1] = items8;
2026-07-23 10:11:24 +00:00
const items10 = [callback(first1, obj5), , ];
2026-07-29 08:29:29 +00:00
const obj10 = { ref: null, style: null };
obj10[0] = ref2;
2026-07-20 16:05:17 +00:00
const items11 = [tmp.sensitivityFill, ];
2026-07-29 08:29:29 +00:00
const obj11 = { left: null };
obj11[0] = tmp18[0];
2026-07-20 16:05:17 +00:00
items11[1] = obj11;
2026-07-29 08:29:29 +00:00
obj10[1] = items11;
2026-07-23 10:11:24 +00:00
items10[1] = callback(first1, obj10);
2026-07-29 08:29:29 +00:00
const obj12 = { style: null, value: null, minimumValue: 0, maximumValue: 100, minimumTrackTintColor: "transparent", maximumTrackTintColor: "transparent", onValueChange: null, onSlidingComplete: null, onResponderGrant: null };
obj12[0] = tmp.sensitivitySlider;
obj12[1] = sum;
obj12[6] = callback1;
obj12[7] = function handleSlidingComplete(arg0) {
onThresholdChange(-1 * (100 - arg0));
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
const tmp25 = callback;
const tmp26 = first1;
const tmp27 = callback;
const tmp8Result = tmp8(tmp9[21]);
2026-07-20 16:05:17 +00:00
let fn;
2026-07-29 08:29:29 +00:00
if (tmp10Result.isAndroid()) {
2026-07-20 16:05:17 +00:00
fn = () => true;
}
2026-07-29 08:29:29 +00:00
obj12[8] = fn;
items10[2] = tmp27(tmp8Result, obj12);
obj4[1] = items10;
return tmp25(tmp26, obj4);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp16 = width(stateFromStores.useState(first2 / 100), 2);
2026-07-20 16:05:17 +00:00
};