// Metro module 16714 (f16715). import { useState, useEffect, useCallback } from "react"; import { Pressable } from "react-native"; import { resendVerificationCode } from "../../SafetyFlowsActionCreators"; import { showVerificationSent } from "../../../toast/native/ToastUtils"; import ToastActionCreators from "../../../toast/native/ToastActionCreators"; import { intl } from "../../../../intl/index.native"; import SafetyFlows_messages from "../../SafetyFlows.messages"; import Module13954 from "../../../../_bundle/Module13954"; import { XLargeIcon } from "../../../../design/components/Icon/native/redesign/generated/XLargeIcon"; import { Text } from "../../../../design/components/Text/native/Text"; export default function ResendVerificationCodeButton(props) { const { flowId, setLoading } = props; const [state, setState] = useState(0); useEffect(() => { if (state > 0) { let c28503_0 = setInterval(() => { setState((prevState) => prevState - 1); }, 1000); return () => clearInterval(c28503_0); } }, [state]); return { let c28504_2; let c28504_3 = 0; L14: { L13: { try { if (state > 0) { break L14; } setLoading(true); c28504_3 = 2; await resendVerificationCode(flowId); showVerificationSent(); (0, setState)(30); c28504_3 = 1; c28504_3 = 0; (0, setLoading)(false); } catch ($e) { const r29 = $e; let r7 = r29; c28504_2 = r29; let r30 = c28504_3; if (r30 !== 0) { while (true) { if (r30 === 1) { try { const r109 = c28504_2; c28504_3 = 0; (0, setLoading)(false); throw r109; } catch (r107) { r7 = r107; c28504_2 = r107; r30 = c28504_3; if (r30 === 0) { break; } } } else { try { c28504_3 = 1; ToastActionCreators.open({ key: "SAFETY_FLOWS_VERIFY_EMAIL_ERROR", content: intl.string(SafetyFlows_messages["3AXMYu"]), icon: Module13954, IconComponent: XLargeIcon, iconColor: "icon-feedback-critical" }); c28504_3 = 0; (0, setLoading)(false); break L13; } catch (r76) { r7 = r76; c28504_2 = r76; r30 = c28504_3; if (r30 === 0) { break; } } } } } throw r7; } } return void 0; } }, [setLoading, state, flowId])} disabled={state > 0} accessibilityRole="button" accessibilityLabel={intl.string(SafetyFlows_messages.ah0EUu)}> {state > 0 ? intl.format(SafetyFlows_messages["2+Lyn0"], { countdown: state }) : intl.string(SafetyFlows_messages.ah0EUu)} ; };