package nn;

import java.util.List;
import kn.k;
import tn.i1;
import tn.t0;
import tn.w0;

/* loaded from: classes3.dex */
public final class l0 {

    /* renamed from: a, reason: collision with root package name */
    public static final l0 f30202a = new l0();

    /* renamed from: b, reason: collision with root package name */
    private static final kotlin.reflect.jvm.internal.impl.renderer.c f30203b = kotlin.reflect.jvm.internal.impl.renderer.c.f26358g;

    /* loaded from: classes3.dex */
    public /* synthetic */ class a {

        /* renamed from: a, reason: collision with root package name */
        public static final /* synthetic */ int[] f30204a;

        static {
            int[] iArr = new int[k.a.values().length];
            try {
                iArr[k.a.EXTENSION_RECEIVER.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[k.a.INSTANCE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[k.a.VALUE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            f30204a = iArr;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static final class b extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        public static final b f30205p = new b();

        b() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final CharSequence invoke(i1 i1Var) {
            l0 l0Var = l0.f30202a;
            hp.e0 type = i1Var.getType();
            kotlin.jvm.internal.t.f(type, "getType(...)");
            return l0Var.h(type);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static final class c extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        public static final c f30206p = new c();

        c() {
            super(1);
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final CharSequence invoke(i1 i1Var) {
            l0 l0Var = l0.f30202a;
            hp.e0 type = i1Var.getType();
            kotlin.jvm.internal.t.f(type, "getType(...)");
            return l0Var.h(type);
        }
    }

    private l0() {
    }

    private final void a(StringBuilder sb2, w0 w0Var) {
        if (w0Var != null) {
            hp.e0 type = w0Var.getType();
            kotlin.jvm.internal.t.f(type, "getType(...)");
            sb2.append(h(type));
            sb2.append(".");
        }
    }

    private final void b(StringBuilder sb2, tn.a aVar) {
        w0 i10 = p0.i(aVar);
        w0 g02 = aVar.g0();
        a(sb2, i10);
        boolean z10 = (i10 == null || g02 == null) ? false : true;
        if (z10) {
            sb2.append("(");
        }
        a(sb2, g02);
        if (z10) {
            sb2.append(")");
        }
    }

    private final String c(tn.a aVar) {
        if (aVar instanceof t0) {
            return g((t0) aVar);
        }
        if (aVar instanceof tn.y) {
            return d((tn.y) aVar);
        }
        throw new IllegalStateException(("Illegal callable: " + aVar).toString());
    }

    public final String d(tn.y descriptor) {
        kotlin.jvm.internal.t.g(descriptor, "descriptor");
        StringBuilder sb2 = new StringBuilder();
        sb2.append("fun ");
        l0 l0Var = f30202a;
        l0Var.b(sb2, descriptor);
        kotlin.reflect.jvm.internal.impl.renderer.c cVar = f30203b;
        ro.f name = descriptor.getName();
        kotlin.jvm.internal.t.f(name, "getName(...)");
        sb2.append(cVar.v(name, true));
        List i10 = descriptor.i();
        kotlin.jvm.internal.t.f(i10, "getValueParameters(...)");
        sm.c0.k0(i10, sb2, ", ", "(", ")", 0, null, b.f30205p, 48, null);
        sb2.append(": ");
        hp.e0 returnType = descriptor.getReturnType();
        kotlin.jvm.internal.t.d(returnType);
        sb2.append(l0Var.h(returnType));
        String sb3 = sb2.toString();
        kotlin.jvm.internal.t.f(sb3, "toString(...)");
        return sb3;
    }

    public final String e(tn.y invoke) {
        kotlin.jvm.internal.t.g(invoke, "invoke");
        StringBuilder sb2 = new StringBuilder();
        l0 l0Var = f30202a;
        l0Var.b(sb2, invoke);
        List i10 = invoke.i();
        kotlin.jvm.internal.t.f(i10, "getValueParameters(...)");
        sm.c0.k0(i10, sb2, ", ", "(", ")", 0, null, c.f30206p, 48, null);
        sb2.append(" -> ");
        hp.e0 returnType = invoke.getReturnType();
        kotlin.jvm.internal.t.d(returnType);
        sb2.append(l0Var.h(returnType));
        String sb3 = sb2.toString();
        kotlin.jvm.internal.t.f(sb3, "toString(...)");
        return sb3;
    }

    public final String f(y parameter) {
        kotlin.jvm.internal.t.g(parameter, "parameter");
        StringBuilder sb2 = new StringBuilder();
        int i10 = a.f30204a[parameter.g().ordinal()];
        if (i10 == 1) {
            sb2.append("extension receiver parameter");
        } else if (i10 == 2) {
            sb2.append("instance parameter");
        } else if (i10 == 3) {
            sb2.append("parameter #" + parameter.getIndex() + ' ' + parameter.getName());
        }
        sb2.append(" of ");
        sb2.append(f30202a.c(parameter.l().G()));
        String sb3 = sb2.toString();
        kotlin.jvm.internal.t.f(sb3, "toString(...)");
        return sb3;
    }

    public final String g(t0 descriptor) {
        kotlin.jvm.internal.t.g(descriptor, "descriptor");
        StringBuilder sb2 = new StringBuilder();
        sb2.append(descriptor.e0() ? "var " : "val ");
        l0 l0Var = f30202a;
        l0Var.b(sb2, descriptor);
        kotlin.reflect.jvm.internal.impl.renderer.c cVar = f30203b;
        ro.f name = descriptor.getName();
        kotlin.jvm.internal.t.f(name, "getName(...)");
        sb2.append(cVar.v(name, true));
        sb2.append(": ");
        hp.e0 type = descriptor.getType();
        kotlin.jvm.internal.t.f(type, "getType(...)");
        sb2.append(l0Var.h(type));
        String sb3 = sb2.toString();
        kotlin.jvm.internal.t.f(sb3, "toString(...)");
        return sb3;
    }

    public final String h(hp.e0 type) {
        kotlin.jvm.internal.t.g(type, "type");
        return f30203b.w(type);
    }
}
