decord/source/modules/auth/native/components/MFACodeInput.tsx

173 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 13693
// Function ID: 105086
// Dependencies: [57, 31, 27, 1194, 653, 33, 4130, 689, 3976, 5492, 4559, 5590, 9000, 1212, 4126, 2]
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
// Module 13693
import _slicedToArray from "_slicedToArray";
import importAllResult from "result";
import get_ActivityIndicator from "get ActivityIndicator";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import { AppStates } from "ME";
import jsxProd from "jsxProd";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
let closure_10;
let closure_11;
let closure_5;
let closure_6;
let closure_9;
const require = arg1;
({ ActivityIndicator: closure_5, View: closure_6 } = get_ActivityIndicator);
({ jsx: closure_9, Fragment: closure_10, jsxs: closure_11 } = jsxProd);
let obj = { 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 } };
obj = { color: require("_createForOfIteratorHelperLoose").unsafe_rawColors.RED_400 };
2026-07-20 16:05:17 +00:00
obj.error = obj;
obj.minHeightGuard = { minHeight: 20 };
2026-07-23 10:11:24 +00:00
let closure_12 = _createForOfIteratorHelperLoose.createStyles(obj);
2026-07-20 16:05:17 +00:00
const forwardRefResult = importAllResult.forwardRef((appState) => {
let error;
let resetLoginOnClose;
let showActivityIndicator;
let style;
appState = appState.appState;
const handleSubmit = appState.handleSubmit;
({ error, resetLoginOnClose } = appState);
({ style, showActivityIndicator } = appState);
if (resetLoginOnClose === undefined) {
resetLoginOnClose = true;
}
2026-07-23 10:11:24 +00:00
let first;
2026-07-20 16:05:17 +00:00
let importAllResult;
let first1;
let closure_6;
2026-07-23 10:11:24 +00:00
let callback;
let tmp = callback2();
let obj = appState(resetLoginOnClose[8]);
const tmp2 = first(importAllResult.useState(""), 2);
first = tmp2[0];
2026-07-20 16:05:17 +00:00
importAllResult = tmp4;
2026-07-23 10:11:24 +00:00
const tmp5 = first(importAllResult.useState(null), 2);
2026-07-20 16:05:17 +00:00
first1 = tmp5[0];
closure_6 = tmp5[1];
const items = [first1];
callback = importAllResult.useCallback(() => {
const string = appState(resetLoginOnClose[9]).getString();
string.then((str) => {
const trimmed = str.trim();
2026-07-23 10:11:24 +00:00
let tmp = trimmed !== outer1_5;
2026-07-20 16:05:17 +00:00
if (tmp) {
let isMatch = 6 === trimmed.length;
if (isMatch) {
isMatch = /^\d+$/.test(trimmed);
const obj = /^\d+$/;
}
if (!isMatch) {
let isMatch1 = 8 === trimmed.length;
if (isMatch1) {
isMatch1 = /^[a-z0-9]+$/i.test(trimmed);
const obj2 = /^[a-z0-9]+$/i;
}
isMatch = isMatch1;
}
tmp = isMatch;
}
if (tmp) {
2026-07-23 10:11:24 +00:00
outer1_4(trimmed);
outer1_6(trimmed);
2026-07-20 16:05:17 +00:00
}
});
}, items);
2026-07-23 10:11:24 +00:00
handleSubmit(resetLoginOnClose[10])(() => {
2026-07-20 16:05:17 +00:00
callback();
return () => {
2026-07-23 10:11:24 +00:00
if (callback.isAuthenticated()) {
const string = appState(resetLoginOnClose[9]).getString();
2026-07-20 16:05:17 +00:00
string.then((arg0) => {
2026-07-23 10:11:24 +00:00
let tmp = "" !== outer2_3;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-23 10:11:24 +00:00
tmp = outer2_3 === arg0;
2026-07-20 16:05:17 +00:00
}
if (tmp) {
2026-07-23 10:11:24 +00:00
appState(resetLoginOnClose[9]).copy("");
const obj = appState(resetLoginOnClose[9]);
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
const obj2 = appState(resetLoginOnClose[9]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = handleSubmit(resetLoginOnClose[11]);
if (outer1_2) {
2026-07-20 16:05:17 +00:00
obj.loginReset();
} else {
obj.loginStatusReset();
}
}
};
});
const items1 = [appState, callback];
const effect = importAllResult.useEffect(() => {
2026-07-23 10:11:24 +00:00
if (appState === outer1_8.ACTIVE) {
2026-07-20 16:05:17 +00:00
callback();
}
}, items1);
const items2 = [first, handleSubmit];
const effect1 = importAllResult.useEffect(() => {
let isMatch = 6 === first.length;
if (isMatch) {
isMatch = /^\d+$/.test(first);
const obj = /^\d+$/;
}
if (!isMatch) {
isMatch = 8 === first.length;
}
if (isMatch) {
handleSubmit(first);
}
}, items2);
const imperativeHandle = importAllResult.useImperativeHandle(arg1, () => ({
clear() {
2026-07-23 10:11:24 +00:00
outer1_4("");
2026-07-20 16:05:17 +00:00
}
}), []);
obj = {};
2026-07-23 10:11:24 +00:00
obj = { autoFocus: true, style: null, textStyle: null, value: null, autoCapitalize: "none", maxLength: 8, textContentType: "oneTimeCode" };
2026-07-20 16:05:17 +00:00
const items3 = [tmp.inputContainer, style];
2026-07-23 10:11:24 +00:00
obj.style = items3;
obj.textStyle = tmp.input;
obj.value = first;
obj.onChangeText = tmp2[1];
const intl = appState(resetLoginOnClose[13]).intl;
obj.accessibilityLabel = intl.string(appState(resetLoginOnClose[13]).t.yO4lAM);
const items4 = [callback(handleSubmit(resetLoginOnClose[12]), obj), ];
2026-07-20 16:05:17 +00:00
const obj1 = {};
const items5 = [tmp.status, ];
const tmp12 = closure_11;
const tmp13 = closure_10;
2026-07-23 10:11:24 +00:00
const tmp14 = callback;
const tmp15 = handleSubmit(resetLoginOnClose[12]);
2026-07-20 16:05:17 +00:00
const tmp16 = closure_6;
items5[1] = Boolean(error) && tmp.minHeightGuard;
obj1.style = items5;
if (showActivityIndicator) {
2026-07-23 10:11:24 +00:00
const obj6 = appState(resetLoginOnClose[8]);
let unsafe_rawColors = handleSubmit(resetLoginOnClose[7]).unsafe_rawColors;
const isThemeDarkResult = appState(resetLoginOnClose[8]).isThemeDark(obj.useThemeContext().theme);
2026-07-20 16:05:17 +00:00
unsafe_rawColors = first1;
2026-07-23 10:11:24 +00:00
let obj2 = { color: appState(resetLoginOnClose[8]).isThemeDark(obj.useThemeContext().theme) ? unsafe_rawColors.WHITE : unsafe_rawColors.PRIMARY_500 };
callback(first1, obj2);
const tmp27 = appState(resetLoginOnClose[8]).isThemeDark(obj.useThemeContext().theme) ? unsafe_rawColors.WHITE : unsafe_rawColors.PRIMARY_500;
2026-07-20 16:05:17 +00:00
} else {
let tmp18 = null;
if (null != error) {
const obj3 = { style: tmp.error, variant: "text-md/medium", children: error };
2026-07-23 10:11:24 +00:00
tmp18 = callback(appState(resetLoginOnClose[14]).Text, obj3);
2026-07-20 16:05:17 +00:00
}
obj1.children = tmp18;
items4[1] = tmp14(tmp16, obj1);
obj.children = items4;
return tmp12(tmp13, obj);
}
});
2026-07-23 10:11:24 +00:00
const result = require("get ActivityIndicator").fileFinishedImporting("modules/auth/native/components/MFACodeInput.tsx");
2026-07-20 16:05:17 +00:00
export default forwardRefResult;