Files
discord-decomp/sources/modules/auth/native/components/MFACodeInput.tsx
T
2026-07-27 16:20:00 +03:00

170 lines
8.5 KiB
TypeScript

/* Metro module 13313; source: modules/auth/native/components/MFACodeInput.tsx; dependencies: [57, 31, 27, 1226, 661, 33, 4501, 697, 4002, 6797, 4594, 5076, 8967, 1244, 4573, 2] */
function _fun101432(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:6, offset: 0x02214733, size: 389 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
let value = importAll(31) /* metro dependency 31 */;
const value2 = require(27) /* metro dependency 27 */;
const env0_5 = value2.ActivityIndicator;
const env0_6 = value2.View;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const env0_8 = (require(661) /* metro dependency 661: Constants */).AppStates;
const value3 = require(33) /* metro dependency 33 */;
const env0_9 = value3.jsx;
const env0_10 = value3.Fragment;
const env0_11 = value3.jsxs;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
const RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400;
const env0_12 = Reflect.apply(createStyles, createStylesModule, [{inputContainer: {'marginTop': 20,
'flexDirection': 'row', 'justifyContent': 'center', 'alignSelf': 'stretch'}, input: {'flex': 1, 'maxWidth': 336,
'flexDirection': 'row', 'alignSelf': 'stretch'}, status: {'flex': 1, 'maxHeight': 20, 'alignItems': 'center',
'marginTop': 8}, error: {color: RED_400}, minHeightGuard: {minHeight: 20}}]);
value = value.forwardRef(_fun101433);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth/native/components/MFACodeInput.tsx');
exports.default = value;
}
function _fun101433({appState, handleSubmit, style, error, showActivityIndicator, resetLoginOnClose}, a1) { // fn#101433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:569, offset: 0x022148b8, size: 750 bytes, params: 3, frame: 32
var r8;
var isThemeDark2;
var unsafe_rawColors;
if (resetLoginOnClose !== undefined) {
}
const styles = useStyles();
const sharedModule = require(4002) /* metro dependency 4002: shared */;
const useThemeContext = sharedModule.useThemeContext;
const theme = Reflect.apply(useThemeContext, sharedModule, []).theme;
const binding = undefined;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, ['']);
const binding2 = undefined;
const value3 = binding2(value2, 2);
const property = value3[0];
const property2 = value3[1];
useState = binding.useState;
const value5 = binding2(Reflect.apply(useState, binding, [null]), 2);
const property3 = value5[0];
const env0_6 = value5[1];
const value6 = binding.useCallback(_fun101434, [property3]);
(importDefault(4594) /* metro dependency 4594: useMountEffect */)(_fun101436);
binding.useEffect(_fun101439, [appState, value6]);
binding.useEffect(_fun101440, [property, handleSubmit]);
binding.useImperativeHandle(a1, function() {
return {clear: _fun101442};
}, []);
const jsxRuntimeEnv0_10Binding = jsxRuntimeEnv0_10;
const FreeFormInputGroup = importDefault(8967) /* metro dependency 8967: FreeFormInputGroup */;
const items2 = [styles.inputContainer, style];
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const freeFormInputGroup = <FreeFormInputGroup autoFocus style={items2} textStyle={styles.input} value={property} autoCapitalize="none" maxLength={8} textContentType="oneTimeCode" onChangeText={property2} accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.yO4lAM)} />;
const items3 = [styles.status];
const Boolean = global.Boolean;
items3[1] = Boolean(error) && styles.minHeightGuard;
if (showActivityIndicator) {
isThemeDark2 = sharedModule.isThemeDark(theme);
unsafe_rawColors = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors;
r8 = <ActivityIndicator color={isThemeDark2 ? unsafe_rawColors.WHITE : unsafe_rawColors.PRIMARY_500} />;
} else if (error != null) {
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
r8 = <Text style={styles.error} variant="text-md/medium">{error}</Text>;
} else {
r8 = null;
}
return (
<>
{freeFormInputGroup}
<View style={items3}>
{r8}
</View>
</>
);
}
function _fun101434() { // fn#101434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:815, offset: 0x02214ba6, size: 56 bytes, params: 1, frame: 12
var environment;
let value = environment.__proto__;
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
value = value.getString();
value.then(_fun101435);
}
function _fun101436() { // fn#101436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:982, offset: 0x02214c6b, size: 24 bytes, params: 1, frame: 9
env0_7();
return _fun101437;
}
function _fun101439() { // fn#101439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:1150, offset: 0x02214d4e, size: 38 bytes, params: 1, frame: 10
const appStateBinding = appState;
const ACTIVE = AppStates.ACTIVE;
if (appStateBinding === ACTIVE) {
env0_7();
}
}
function _fun101440() { // fn#101440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:1195, offset: 0x02214d74, size: 91 bytes, params: 1, frame: 13
let r1 = env0_3.length === 6 && RegExp('^\\d+$', '').test(env0_3);
r1 = !r1 ? env0_3.length === 8 : r1;
if (r1) {
handleSubmit(env0_3);
}
}
function _fun101441() { // fn#101441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:1286, offset: 0x02214dcf, size: 18 bytes, params: 1, frame: 2
return {clear: clear_101442};
}
function _fun101435(a0) { // fn#101435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:846, offset: 0x02214bde, size: 141 bytes, params: 2, frame: 15
var r3;
var r1;
const value = a0.trim();
const value3 = value !== env1_5;
if (value3) {
r3 = value.length === 6 && RegExp('^\\d+$', '').test(value);
r3 = !r3 ? value.length === 8 && RegExp('^[a-z0-9]+$', 'i').test(value) : r3;
r1 = r3;
} else {
r1 = value3;
}
if (r1) {
env1_4(value);
env1_6(value);
}
}
function _fun101437() { // fn#101437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:991, offset: 0x02214c83, size: 131 bytes, params: 1, frame: 13
var environment;
var value2;
var resetLoginOnCloseBinding;
let value = environment.__proto__.__proto__;
if (AuthenticationStore.isAuthenticated()) {
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
value = value.getString();
value.then(_fun101438);
} else {
value2 = environment.__proto__;
resetLoginOnCloseBinding = resetLoginOnClose;
value = importDefault(5076) /* metro dependency 5076: AuthenticationActionCreators */;
if (resetLoginOnCloseBinding) {
value.loginReset();
} else {
value.loginStatusReset();
}
}
}
function clear_101442() { // fn#101442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:1292, offset: 0x02214de1, size: 20 bytes, params: 1, frame: 11
env1_4('');
}
function _fun101438(a0) { // fn#101438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13503:1042, offset: 0x02214d06, size: 72 bytes, params: 2, frame: 12
let value = environment.__proto__.__proto__;
if (env2_3 !== '' && env2_3 === a0) {
value = environment.__proto__.__proto__.__proto__;
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
value.copy('');
}
}