package io.flutter.plugins.urllauncher;

import ed.z;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class b extends z {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final b f28324d = new b();

    @Override // ed.z
    public final Object readValueOfType(byte b10, ByteBuffer byteBuffer) {
        if (b10 != -127) {
            if (b10 != -126) {
                return super.readValueOfType(b10, byteBuffer);
            }
            ArrayList arrayList = (ArrayList) readValue(byteBuffer);
            a aVar = new a();
            Boolean bool = (Boolean) arrayList.get(0);
            if (bool == null) {
                throw new IllegalStateException("Nonnull field \"showTitle\" is null.");
            }
            aVar.f28323a = bool;
            return aVar;
        }
        ArrayList arrayList2 = (ArrayList) readValue(byteBuffer);
        e eVar = new e();
        Boolean bool2 = (Boolean) arrayList2.get(0);
        if (bool2 == null) {
            throw new IllegalStateException("Nonnull field \"enableJavaScript\" is null.");
        }
        eVar.f28327a = bool2;
        Boolean bool3 = (Boolean) arrayList2.get(1);
        if (bool3 == null) {
            throw new IllegalStateException("Nonnull field \"enableDomStorage\" is null.");
        }
        eVar.f28328b = bool3;
        Map map = (Map) arrayList2.get(2);
        if (map == null) {
            throw new IllegalStateException("Nonnull field \"headers\" is null.");
        }
        eVar.f28329c = map;
        return eVar;
    }

    @Override // ed.z
    public final void writeValue(ByteArrayOutputStream byteArrayOutputStream, Object obj) {
        if (obj instanceof e) {
            byteArrayOutputStream.write(129);
            e eVar = (e) obj;
            eVar.getClass();
            ArrayList arrayList = new ArrayList(3);
            arrayList.add(eVar.f28327a);
            arrayList.add(eVar.f28328b);
            arrayList.add(eVar.f28329c);
            writeValue(byteArrayOutputStream, arrayList);
            return;
        }
        if (!(obj instanceof a)) {
            super.writeValue(byteArrayOutputStream, obj);
            return;
        }
        byteArrayOutputStream.write(130);
        a aVar = (a) obj;
        aVar.getClass();
        ArrayList arrayList2 = new ArrayList(1);
        arrayList2.add(aVar.f28323a);
        writeValue(byteArrayOutputStream, arrayList2);
    }
}
