Files
discord-decomp/sources/modules/mfa/native/screens/TotpScreen.tsx
T
2026-07-28 01:06:53 +03:00

197 lines
10 KiB
TypeScript

/* Metro module 14218; source: modules/mfa/native/screens/TotpScreen.tsx; dependencies: [5, 57, 31, 33, 14219, 14214, 1244, 14220, 14217, 2] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import MfaOptionScreen from './MfaOptionScreen.tsx'; /* Metro dependency 14214 */
import Button from '../components/button.tsx'; /* Metro dependency 14217 */
import ClipboardCopyInput from '../components/ClipboardCopyInput.tsx'; /* Metro dependency 14220 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as MFAModule from '../../../../external/discord_common/js/shared/MFA.tsx'; /* Metro dependency 14219 */
function _fun107508(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:6, offset: 0x022ff298, size: 185 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/mfa/native/screens/TotpScreen.tsx');
exports.default = TotpScreen;
function isValidClipboardCode(a0) { // fn#107509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:140, offset: 0x022ff351, size: 72 bytes, params: 2, frame: 13
const length = a0.length;
const TOTP_CODE_LENGTH = (MFAModule).TOTP_CODE_LENGTH;
return length === TOTP_CODE_LENGTH && RegExp('^\\d+$', '').test(a0);
}
function TotpScreen({mfaChallenge, finish}) { // fn#107510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:318, offset: 0x022ff399, size: 691 bytes, params: 2, frame: 30
var object2;
const binding = env0_5;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_4;
const value3 = binding2(value2, 2);
const property = value3[0];
const env0_1 = value3[1];
useState = binding.useState;
const value4 = binding2(Reflect.apply(useState, binding, ['']), 2);
const property2 = value4[0];
const env0_3 = value4[1];
useState = binding.useState;
const value5 = binding2(Reflect.apply(useState, binding, [undefined]), 2);
const property3 = value5[0];
var env0_4 = value5[1];
useState = binding.useState;
const value6 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property4 = value6[0];
var env0_5 = value6[1];
const value8 = binding.useCallback(_fun107511(), [finish]);
object2 = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
object2.headerText = Reflect.apply(string, intl,
[(require(1244) /* metro dependency 1244: indexNative */).t.uc00u5]);
const object = {};
string = intl.string;
const HZPBOd = (require(1244) /* metro dependency 1244: indexNative */).t.HZPBOd;
object.label = Reflect.apply(string, intl, [HZPBOd]);
object.placeholder = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.tARzgo);
object.isValidClipboardCode = isValidClipboardCode;
const TOTP_CODE_LENGTH = (require(14219) /* metro dependency 14219: MFA */).TOTP_CODE_LENGTH;
object.maxLength = TOTP_CODE_LENGTH;
object.onChangeCode = value8;
object.error = property3;
object.isDisabled = property || property4;
object.textContentType = 'oneTimeCode';
object.autoComplete = 'one-time-code';
object.keyboardType = 'number-pad';
object2.input = <ClipboardCopyInput {...object} />;
const defaultImport3 = Button;
const defaultImport3Props = {variant: 'primary',
text: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.geKm7t),
loading: property || property4, onPress: onPress_107515};
let r9 = property || property4;
r9 = !r9 ? property2.length !== (require(14219) /* metro dependency 14219: MFA */).TOTP_CODE_LENGTH : r9;
defaultImport3Props.disabled = r9;
object2.submit = ((Component) => <Component {...defaultImport3Props} />)(defaultImport3);
object2.screenProps = {mfaChallenge: mfaChallenge, finish: finish};
object2.mfaMethod = 'totp';
return <MfaOptionScreen {...object2} />;
function _fun107511() { // fn#107511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:549, offset: 0x022ff64c, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107513);
return _fun107514;
function* _fun107513(a0) { // fn#107513, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:569, offset: 0x022ff67b, size: 204 bytes, params: 2, frame: 19
var message;
var r3;
var object;
var moduleValue;
var value5;
var value6;
var binding;
var error;
var body;
let value = undefined;
if (true) {
value = undefined;
env2_3(a0);
if (env3_7(a0)) {
env2_4(value);
importDefault(true);
reducibleJoin4: while (true) {
reduciblePort21: while (true) {
exceptionLanding15: while (true) {
try {
} catch (error) {
break exceptionLanding15;
}
break reducibleJoin4;
}
binding = env2_4;
reducibleJoin18: while (true) {
if (error == null) {
message = value;
break reducibleJoin18;
}
body = error.body;
if (body == null) {
message = value;
break reducibleJoin18;
}
message = body.message;
break reducibleJoin18;
}
reducibleJoin20: while (true) {
if (message != null) {
r3 = message;
break reducibleJoin20;
}
message = error.message;
r3 = message;
break reducibleJoin20;
}
binding(r3);
break reduciblePort21;
}
importDefault(false);
return value;
}
try {
object = {};
} catch (error) {
break exceptionLanding15;
}
try {
object.mfaType = 'totp';
} catch (error) {
break exceptionLanding15;
}
try {
object.data = a0;
} catch (error) {
break exceptionLanding15;
}
try {
moduleValue = require(object);
} catch (error) {
break exceptionLanding15;
}
yield moduleValue;
try {
value5 = undefined;
value6 = false;
} catch (error) {
break exceptionLanding15;
}
if (value6) {
return value5;
}
try {
binding = env2_5;
} catch (error) {
break exceptionLanding15;
}
try {
binding(true);
} catch (error) {
break exceptionLanding15;
}
importDefault(false);
}
}
return value;
}
function _fun107514() { // fn#107514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:776, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function TotpScreenOnPress() { // fn#107515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:1308, owner: TotpScreen.onPress, offset: 0x022ff747, size: 20 bytes, params: 1, frame: 11
(0, JsxRuntimeModule.jsx)(env0_2);
}
}
}
global.__d(_fun107508, 14218, [5, 57, 31, 33, 14219, 14214, 1244, 14220, 14217,
2]) /* metro module 14218, dependencies: [5, 57, 31, 33, 14219, 14214, 1244, 14220, 14217, 2] */;