package V2;

import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class o3 extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public /* synthetic */ Object f7988a;

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        o3 o3Var = new o3(2, dVar);
        o3Var.f7988a = obj;
        return o3Var;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        o3 o3Var = (o3) create((S1.b) obj, (A4.d) obj2);
        C3137A c3137a = C3137A.f25453a;
        o3Var.invokeSuspend(c3137a);
        return c3137a;
    }

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        B4.a aVar = B4.a.f492a;
        AbstractC2467b.l(obj);
        S1.b bVar = (S1.b) this.f7988a;
        S1.e eVar = AbstractC0696m3.f7935c0;
        Integer num = (Integer) bVar.b(eVar);
        if ((num != null ? num.intValue() : 0) < 1) {
            S1.e eVar2 = AbstractC0696m3.f7933b0;
            Integer num2 = (Integer) bVar.b(eVar2);
            int iIntValue = num2 != null ? num2.intValue() : 0;
            a5.c cVar = u3.f8110a;
            switch (iIntValue) {
                case 0:
                case 1:
                    break;
                case 2:
                    iIntValue = 3;
                    break;
                case 3:
                    iIntValue = 5;
                    break;
                case 4:
                    iIntValue = 7;
                    break;
                case 5:
                    iIntValue = 9;
                    break;
                case 6:
                    iIntValue = 11;
                    break;
                case 7:
                    iIntValue = 13;
                    break;
                default:
                    iIntValue = L4.a.v(iIntValue, 0, 14);
                    break;
            }
            bVar.d(eVar2, new Integer(iIntValue));
            bVar.d(eVar, new Integer(1));
        }
        return C3137A.f25453a;
    }
}
package V2;

import m3.AbstractC2467b;
import w4.C3137A;

/**
 * This class represents a coroutine builder for handling a sequence of state transitions.
 * It extends the base coroutine builder class (C4.j) and implements the J4.e interface.
 * The primary purpose is to create and invoke a coroutine that manages a specific state machine
 * defined by the S1.b object, transitioning through various states based on the values
 * retrieved from the state object.
 */
public final class o3 extends C4.j implements J4.e {

    /**
     * The underlying state object that holds the current state and its associated data.
     * This is passed into the coroutine builder and used to determine the next state.
     */
    public /* synthetic */ Object f7988a;

    /**
     * Creates a new coroutine builder instance.
     * @param obj The state object (S1.b) to be managed by this coroutine.
     * @param dVar The coroutine dispatcher to use for executing the coroutine.
     * @return A new instance of o3 configured with the provided state and dispatcher.
     */
    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        // Instantiate a new o3 with the provided dispatcher (index 2 likely refers to a specific dispatcher type)
        o3 o3Var = new o3(2, dVar);
        // Store the state object for later use in the coroutine logic
        o3Var.f7988a = obj;
        return o3Var;
    }

    /**
     * Invokes the coroutine with the provided state and dispatcher.
     * This method starts the coroutine execution.
     * @param obj The state object (S1.b) to process.
     * @param obj2 The coroutine dispatcher to use.
     * @return The coroutine dispatcher (C3137A.f25453a) after invocation.
     */
    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        // Create the coroutine builder with the provided state and dispatcher
        o3 o3Var = (o3) create((S1.b) obj, (A4.d) obj2);
        // Reference to the default dispatcher (likely the main thread or IO dispatcher)
        C3137A c3137a = C3137A.f25453a;
        // Start the coroutine execution
        o3Var.invokeSuspend(c3137a);
        return c3137a;
    }

    /**
     * Executes the coroutine logic, handling state transitions.
     * This method processes the current state, determines the next state based on predefined mappings,
     * and updates the state object accordingly.
     * @param obj The coroutine dispatcher to use for suspension.
     * @return The coroutine dispatcher (C3137A.f25453a) after execution.
     */
    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        // Reference to the default dispatcher
        B4.a aVar = B4.a.f492a;
        // Handle any exception that might have occurred during suspension
        AbstractC2467b.l(obj);
        
        // Retrieve the state object stored in this builder
        S1.b bVar = (S1.b) this.f7988a;
        
        // Reference to the 'Start' state constant
        S1.e eVar = AbstractC0696m3.f7935c0;
        
        // Get the current state value from the state object
        Integer num = (Integer) bVar.b(eVar);
        
        // If the current state is not 'Start' (value < 1), proceed with state transition logic
        if ((num != null ? num.intValue() : 0) < 1) {
            // Reference to the 'End' state constant
            S1.e eVar2 = AbstractC0696m3.f7933b0;
            
            // Get the 'End' state value from the state object
            Integer num2 = (Integer) bVar.b(eVar2);
            
            // Convert the 'End' state value to an integer (defaulting to 0 if null)
            int iIntValue = num2 != null ? num2.intValue() : 0;
            
            // Reference to the 'Idle' state constant
            a5.c cVar = u3.f8110a;
            
            // Switch statement to map the 'End' state value to a corresponding 'Idle' state value
            switch (iIntValue) {
                case 0:
                case 1:
                    // States 0 and 1 map to themselves (no change needed)
                    break;
                case 2:
                    // State 2 maps to 3
                    iIntValue = 3;
                    break;
                case 3:
                    // State 3 maps to 5
                    iIntValue = 5;
                    break;
                case 4:
                    // State 4 maps to 7
                    iIntValue = 7;
                    break;
                case 5:
                    // State 5 maps to 9
                    iIntValue = 9;
                    break;
                case 6:
                    // State 6 maps to 11
                    iIntValue = 11;
                    break;
                case 7:
                    // State 7 maps to 13
                    iIntValue = 13;
                    break;
                default:
                    // For any other state, use a fallback mapping function
                    iIntValue = L4.a.v(iIntValue, 0, 14);
                    break;
            }
            
            // Update the 'End' state in the state object with the new mapped value
            bVar.d(eVar2, new Integer(iIntValue));
            
            // Update the 'Start' state in the state object to indicate the coroutine has started
            bVar.d(eVar, new Integer(1));
        }
        
        // Return the default dispatcher
        return C3137A.f25453a;
    }
}