package ck;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

/* loaded from: classes3.dex */
public abstract class d {

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

        /* renamed from: a, reason: collision with root package name */
        private final String f11986a;

        /* renamed from: b, reason: collision with root package name */
        private final a f11987b;

        /* renamed from: c, reason: collision with root package name */
        private a f11988c;

        /* renamed from: d, reason: collision with root package name */
        private boolean f11989d;

        /* renamed from: e, reason: collision with root package name */
        private boolean f11990e;

        /* JADX INFO: Access modifiers changed from: private */
        /* loaded from: classes3.dex */
        public static class a {

            /* renamed from: a, reason: collision with root package name */
            String f11991a;

            /* renamed from: b, reason: collision with root package name */
            Object f11992b;

            /* renamed from: c, reason: collision with root package name */
            a f11993c;

            private a() {
            }
        }

        private a a() {
            a aVar = new a();
            this.f11988c.f11993c = aVar;
            this.f11988c = aVar;
            return aVar;
        }

        private b b(Object obj) {
            a().f11992b = obj;
            return this;
        }

        private static boolean d(Object obj) {
            return obj instanceof CharSequence ? ((CharSequence) obj).length() == 0 : obj instanceof Collection ? ((Collection) obj).isEmpty() : obj instanceof Map ? ((Map) obj).isEmpty() : obj instanceof g ? !((g) obj).c() : obj.getClass().isArray() && Array.getLength(obj) == 0;
        }

        public b c(Object obj) {
            return b(obj);
        }

        /* JADX WARN: Removed duplicated region for block: B:8:0x0033  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public String toString() {
            String str;
            boolean z10 = this.f11989d;
            boolean z11 = this.f11990e;
            StringBuilder sb2 = new StringBuilder(32);
            sb2.append(this.f11986a);
            sb2.append('{');
            String str2 = "";
            for (a aVar = this.f11987b.f11993c; aVar != null; aVar = aVar.f11993c) {
                Object obj = aVar.f11992b;
                if (obj == null) {
                    if (z10) {
                    }
                    sb2.append(str2);
                    str = aVar.f11991a;
                    if (str != null) {
                        sb2.append(str);
                        sb2.append('=');
                    }
                    if (obj == null && obj.getClass().isArray()) {
                        String deepToString = Arrays.deepToString(new Object[]{obj});
                        sb2.append((CharSequence) deepToString, 1, deepToString.length() - 1);
                    } else {
                        sb2.append(obj);
                    }
                    str2 = ", ";
                } else {
                    if (z11 && d(obj)) {
                    }
                    sb2.append(str2);
                    str = aVar.f11991a;
                    if (str != null) {
                    }
                    if (obj == null) {
                    }
                    sb2.append(obj);
                    str2 = ", ";
                }
            }
            sb2.append('}');
            return sb2.toString();
        }

        private b(String str) {
            a aVar = new a();
            this.f11987b = aVar;
            this.f11988c = aVar;
            this.f11989d = false;
            this.f11990e = false;
            this.f11986a = (String) j.i(str);
        }
    }

    public static b a(Object obj) {
        return new b(obj.getClass().getSimpleName());
    }
}
