package V2;

import android.content.Context;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: renamed from: V2.y2, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0743y2 extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f8186a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ String f8188c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0743y2(String str, A4.d dVar) {
        super(2, dVar);
        this.f8188c = str;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        C0743y2 c0743y2 = new C0743y2(this.f8188c, dVar);
        c0743y2.f8187b = obj;
        return c0743y2;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((C0743y2) create((V4.C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        Object objD;
        String string;
        Object objD2;
        String string2;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f8186a;
        String str = null;
        try {
            if (i6 == 0) {
                AbstractC2467b.l(obj);
                String str2 = this.f8188c;
                this.f8186a = 1;
                c5.e eVar = V4.N.f8259a;
                obj = V4.E.H(c5.d.f13466b, new C0747z2(str2, null), this);
                if (obj == aVar) {
                    return aVar;
                }
            } else {
                if (i6 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
            }
            objD = (String) obj;
        } catch (Throwable th) {
            objD = AbstractC2467b.d(th);
        }
        if (objD instanceof w4.m) {
            objD = null;
        }
        String str3 = (String) objD;
        if (str3 == null || (string = S4.p.o1(str3).toString()) == null || string.length() <= 0) {
            string = null;
        }
        if (string != null) {
            String url = this.f8188c;
            kotlin.jvm.internal.o.h(url, "url");
            Context context = W.c.f8375h;
            if (context == null) {
                return string;
            }
            String string3 = S4.p.o1(string).toString();
            if (string3.length() == 0) {
                return string;
            }
            context.getSharedPreferences("debridstream_remote_map", 0).edit().putString(url, string3).apply();
            return string;
        }
        String url2 = this.f8188c;
        kotlin.jvm.internal.o.h(url2, "url");
        Context context2 = W.c.f8375h;
        if (context2 != null) {
            try {
                objD2 = context2.getSharedPreferences("debridstream_remote_map", 0).getString(url2, null);
            } catch (Throwable th2) {
                objD2 = AbstractC2467b.d(th2);
            }
            if (objD2 instanceof w4.m) {
                objD2 = null;
            }
            String str4 = (String) objD2;
            if (str4 != null && (string2 = S4.p.o1(str4).toString()) != null && string2.length() > 0) {
                str = string2;
            }
        }
        return str;
    }
}
