S T G SuperAPPS v9.99.99版本的 MD5 值为:ec866d8c695a659ed10459d6bd169615

以下内容为反编译后的 e.java 源代码,内容仅作参考


package com.taxsee.driver.feature.fileuploader;

import ao.r;
import ao.s;
import bm.q;
import bo.o;
import bo.p;
import cm.a0;
import cm.n;
import com.taxsee.driver.responses.PhotoResponse;
import ia.a1;
import ia.b1;
import java.io.File;
import java.io.FileInputStream;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.CancellationException;
import kn.a;
import kotlinx.coroutines.flow.f0;
import nm.m0;
import nm.r2;
import nm.y;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.internal.Util;
import pl.k;
import pl.u;
import pl.z;
import wa.j;
import xf.m;
import zf.l;

public final class e implements m0, kn.a {

    private final x9.a f12526t;

    private final y f12527u;

    private final Map<String, kotlinx.coroutines.flow.e<l>> f12528v;

    private final kotlinx.coroutines.sync.b f12529w;

    private final Interceptor f12530x;

    private final pl.h f12531y;

    public static final class a {
        private a() {
        }

        public a(cm.h hVar) {
            this();
        }
    }

    public interface b {
        @o
        Object a(@bo.y String str, @bo.i("token") String str2, @bo.i("Content-MD5") String str3, sl.d<? super r<b1>> dVar);

        @p
        Object b(@bo.y String str, @bo.i("Content-Range") String str2, @bo.a RequestBody requestBody, sl.d<? super r<b1>> dVar);
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader", f = "FileUploader.kt", l = {146, 153}, m = "createFileUploadSession")
    public static final class c extends ul.d {
        int B;

        Object f12532w;

        Object f12533x;

        Object f12534y;

        Object f12535z;

        c(sl.d<? super c> dVar) {
            super(dVar);
        }

        @Override
        public final Object s(Object obj) {
            this.f12535z = obj;
            this.B |= Integer.MIN_VALUE;
            return e.this.j(null, this);
        }
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader$createUpload$1", f = "FileUploader.kt", l = {95}, m = "invokeSuspend")
    public static final class d extends ul.l implements bm.p<kotlinx.coroutines.flow.f<? super l>, sl.d<? super z>, Object> {
        final PhotoResponse A;

        int f12536x;

        private Object f12537y;

        d(PhotoResponse photoResponse, sl.d<? super d> dVar) {
            super(2, dVar);
            this.A = photoResponse;
        }

        @Override
        public final sl.d<z> n(Object obj, sl.d<?> dVar) {
            d dVar2 = new d(this.A, dVar);
            dVar2.f12537y = obj;
            return dVar2;
        }

        @Override
        public final Object s(Object obj) {
            Object d10;
            d10 = tl.d.d();
            int i10 = this.f12536x;
            if (i10 == 0) {
                pl.r.b(obj);
                kotlinx.coroutines.flow.f fVar = (kotlinx.coroutines.flow.f) this.f12537y;
                e eVar = e.this;
                PhotoResponse photoResponse = this.A;
                this.f12536x = 1;
                if (eVar.p(fVar, photoResponse, this) == d10) {
                    return d10;
                }
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                pl.r.b(obj);
            }
            return z.f25438a;
        }

        @Override
        public final Object x(kotlinx.coroutines.flow.f<? super l> fVar, sl.d<? super z> dVar) {
            return ((d) n(fVar, dVar)).s(z.f25438a);
        }
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader$createUpload$2", f = "FileUploader.kt", l = {185}, m = "invokeSuspend")
    public static final class C0183e extends ul.l implements q<kotlinx.coroutines.flow.f<? super l>, Throwable, sl.d<? super z>, Object> {
        int A;
        final PhotoResponse C;

        Object f12539x;

        Object f12540y;

        Object f12541z;

        C0183e(PhotoResponse photoResponse, sl.d<? super C0183e> dVar) {
            super(3, dVar);
            this.C = photoResponse;
        }

        @Override
        public final Object s(Object obj) {
            Object d10;
            e eVar;
            kotlinx.coroutines.sync.b bVar;
            PhotoResponse photoResponse;
            d10 = tl.d.d();
            int i10 = this.A;
            if (i10 == 0) {
                pl.r.b(obj);
                kotlinx.coroutines.sync.b bVar2 = e.this.f12529w;
                eVar = e.this;
                PhotoResponse photoResponse2 = this.C;
                this.f12539x = bVar2;
                this.f12540y = eVar;
                this.f12541z = photoResponse2;
                this.A = 1;
                if (bVar2.a(null, this) == d10) {
                    return d10;
                }
                bVar = bVar2;
                photoResponse = photoResponse2;
            } else {
                if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                photoResponse = (PhotoResponse) this.f12541z;
                eVar = (e) this.f12540y;
                bVar = (kotlinx.coroutines.sync.b) this.f12539x;
                pl.r.b(obj);
            }
            try {
                eVar.f12528v.remove(eVar.o(photoResponse));
                return z.f25438a;
            } finally {
                bVar.b(null);
            }
        }

        @Override
        public final Object i(kotlinx.coroutines.flow.f<? super l> fVar, Throwable th2, sl.d<? super z> dVar) {
            return new C0183e(this.C, dVar).s(z.f25438a);
        }
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader", f = "FileUploader.kt", l = {185}, m = "getUpload")
    public static final class f extends ul.d {
        int B;

        Object f12542w;

        Object f12543x;

        Object f12544y;

        Object f12545z;

        f(sl.d<? super f> dVar) {
            super(dVar);
        }

        @Override
        public final Object s(Object obj) {
            this.f12545z = obj;
            this.B |= Integer.MIN_VALUE;
            return e.this.m(null, this);
        }
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader", f = "FileUploader.kt", l = {104, 116, 121, 130, 139}, m = "processUpload")
    public static final class g extends ul.d {
        Object A;
        Object B;
        Object C;
        int D;
        int E;
        Object F;
        int H;

        Object f12546w;

        Object f12547x;

        Object f12548y;

        Object f12549z;

        g(sl.d<? super g> dVar) {
            super(dVar);
        }

        @Override
        public final Object s(Object obj) {
            this.F = obj;
            this.H |= Integer.MIN_VALUE;
            return e.this.p(null, null, this);
        }
    }

    @ul.f(c = "com.taxsee.driver.feature.fileuploader.FileUploader$upload$1", f = "FileUploader.kt", l = {87, 87}, m = "invokeSuspend")
    static final class h extends ul.l implements bm.p<kotlinx.coroutines.flow.f<? super l>, sl.d<? super z>, Object> {
        final PhotoResponse A;

        int f12550x;

        private Object f12551y;

        h(PhotoResponse photoResponse, sl.d<? super h> dVar) {
            super(2, dVar);
            this.A = photoResponse;
        }

        @Override
        public final sl.d<z> n(Object obj, sl.d<?> dVar) {
            h hVar = new h(this.A, dVar);
            hVar.f12551y = obj;
            return hVar;
        }

        @Override
        public final Object s(Object obj) {
            Object d10;
            kotlinx.coroutines.flow.f fVar;
            d10 = tl.d.d();
            int i10 = this.f12550x;
            if (i10 == 0) {
                pl.r.b(obj);
                fVar = (kotlinx.coroutines.flow.f) this.f12551y;
                e eVar = e.this;
                PhotoResponse photoResponse = this.A;
                this.f12551y = fVar;
                this.f12550x = 1;
                obj = eVar.m(photoResponse, this);
                if (obj == d10) {
                    return d10;
                }
            } else {
                if (i10 != 1) {
                    if (i10 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    pl.r.b(obj);
                    return z.f25438a;
                }
                fVar = (kotlinx.coroutines.flow.f) this.f12551y;
                pl.r.b(obj);
            }
            this.f12551y = null;
            this.f12550x = 2;
            if (kotlinx.coroutines.flow.g.m(fVar, (kotlinx.coroutines.flow.e) obj, this) == d10) {
                return d10;
            }
            return z.f25438a;
        }

        @Override
        public final Object x(kotlinx.coroutines.flow.f<? super l> fVar, sl.d<? super z> dVar) {
            return ((h) n(fVar, dVar)).s(z.f25438a);
        }
    }

    static final class i extends cm.o implements bm.a<b> {
        i() {
            super(0);
        }

        @Override
        public final b invoke() {
            return (b) new s.b().b("http://127.0.0.1/").f(x9.b.f30646t.i(e.this.f12530x)).a(new v9.e()).a(v9.c.d(null, 1, null)).d().b(b.class);
        }
    }

    static {
        new a(null);
    }

    public e(x9.a aVar) {
        pl.h a10;
        n.f(aVar, "apiProvider");
        this.f12526t = aVar;
        this.f12527u = r2.b(null, 1, null);
        this.f12528v = new LinkedHashMap();
        this.f12529w = kotlinx.coroutines.sync.d.b(false, 1, null);
        this.f12530x = new Interceptor() {
            @Override
            public final Response intercept(Interceptor.Chain chain) {
                Response q10;
                q10 = e.q(chain);
                return q10;
            }
        };
        a10 = k.a(new i());
        this.f12531y = a10;
    }

    public final Object j(PhotoResponse photoResponse, sl.d<? super u<String, String, ? extends File>> dVar) {
        c cVar;
        Object d10;
        int i10;
        e eVar;
        a1 a1Var;
        Integer i11;
        String j10;
        boolean z10;
        String b10;
        File file;
        a1 a1Var2;
        boolean p10;
        r rVar;
        if (dVar instanceof c) {
            cVar = (c) dVar;
            int i12 = cVar.B;
            if ((i12 & Integer.MIN_VALUE) != 0) {
                cVar.B = i12 - Integer.MIN_VALUE;
                Object obj = cVar.f12535z;
                d10 = tl.d.d();
                i10 = cVar.B;
                if (i10 != 0) {
                    pl.r.b(obj);
                    u9.b l10 = l();
                    String o10 = o(photoResponse);
                    int i13 = photoResponse.N;
                    cVar.f12532w = this;
                    cVar.f12533x = photoResponse;
                    cVar.B = 1;
                    obj = l10.Q0(o10, i13, cVar);
                    if (obj == d10) {
                        return d10;
                    }
                    eVar = this;
                } else {
                    if (i10 != 1) {
                        if (i10 != 2) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        b10 = (String) cVar.f12534y;
                        file = (File) cVar.f12533x;
                        a1Var2 = (a1) cVar.f12532w;
                        pl.r.b(obj);
                        rVar = (r) obj;
                        Object a10 = rVar.a();
                        n.d(a10);
                        n.e(a10, "session.body()!!");
                        b1 b1Var = (b1) a10;
                        if (rVar.f()) {
                            if (!(b10.length() == 0)) {
                                long length = file.length();
                                Long a11 = b1Var.a();
                                n.d(a11);
                                if (length <= a11.longValue()) {
                                    String c10 = b1Var.c();
                                    n.d(c10);
                                    String g10 = a1Var2.g();
                                    n.d(g10);
                                    return new u(c10, g10, file);
                                }
                            }
                        }
                        throw new j(null, 1, null);
                    }
                    photoResponse = (PhotoResponse) cVar.f12533x;
                    eVar = (e) cVar.f12532w;
                    pl.r.b(obj);
                }
                a1Var = (a1) obj;
                if (a1Var.e() && ((i11 = a1Var.i()) == null || i11.intValue() != 5)) {
                    j10 = a1Var.j();
                    if (j10 != null) {
                        p10 = lm.q.p(j10);
                        if (!p10) {
                            z10 = false;
                            if (!z10) {
                                String str = photoResponse.L;
                                File file2 = new File(str != null ? str : "");
                                b10 = m.f30983a.b(file2);
                                b n10 = eVar.n();
                                String str2 = a1Var.g() + "v2/hello";
                                String j11 = a1Var.j();
                                cVar.f12532w = a1Var;
                                cVar.f12533x = file2;
                                cVar.f12534y = b10;
                                cVar.B = 2;
                                Object a12 = n10.a(str2, j11, b10, cVar);
                                if (a12 == d10) {
                                    return d10;
                                }
                                file = file2;
                                a1Var2 = a1Var;
                                obj = a12;
                                rVar = (r) obj;
                                Object a102 = rVar.a();
                                n.d(a102);
                                n.e(a102, "session.body()!!");
                                b1 b1Var2 = (b1) a102;
                                if (rVar.f()) {
                                }
                                throw new j(null, 1, null);
                            }
                        }
                    }
                    z10 = true;
                    if (!z10) {
                    }
                }
                String h10 = a1Var.h();
                throw new j(h10 != null ? h10 : "");
            }
        }
        cVar = new c(dVar);
        Object obj2 = cVar.f12535z;
        d10 = tl.d.d();
        i10 = cVar.B;
        if (i10 != 0) {
        }
        a1Var = (a1) obj2;
        if (a1Var.e()) {
            j10 = a1Var.j();
            if (j10 != null) {
            }
            z10 = true;
            if (!z10) {
            }
        }
        String h102 = a1Var.h();
        throw new j(h102 != null ? h102 : "");
    }

    private final kotlinx.coroutines.flow.e<l> k(PhotoResponse photoResponse) {
        kotlinx.coroutines.flow.z f10;
        f10 = kotlinx.coroutines.flow.s.f(kotlinx.coroutines.flow.g.y(kotlinx.coroutines.flow.g.t(new d(photoResponse, null)), new C0183e(photoResponse, null)), this, f0.f21703a.a(), 0, 4, null);
        return f10;
    }

    private final u9.b l() {
        return this.f12526t.f();
    }

    public final Object m(PhotoResponse photoResponse, sl.d<? super kotlinx.coroutines.flow.e<? extends l>> dVar) {
        f fVar;
        Object d10;
        int i10;
        kotlinx.coroutines.sync.b bVar;
        e eVar;
        kotlinx.coroutines.flow.e<l> eVar2;
        try {
            if (dVar instanceof f) {
                fVar = (f) dVar;
                int i11 = fVar.B;
                if ((i11 & Integer.MIN_VALUE) != 0) {
                    fVar.B = i11 - Integer.MIN_VALUE;
                    Object obj = fVar.f12545z;
                    d10 = tl.d.d();
                    i10 = fVar.B;
                    if (i10 != 0) {
                        pl.r.b(obj);
                        bVar = this.f12529w;
                        fVar.f12542w = this;
                        fVar.f12543x = photoResponse;
                        fVar.f12544y = bVar;
                        fVar.B = 1;
                        if (bVar.a(null, fVar) == d10) {
                            return d10;
                        }
                        eVar = this;
                    } else {
                        if (i10 != 1) {
                            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                        }
                        kotlinx.coroutines.sync.b bVar2 = (kotlinx.coroutines.sync.b) fVar.f12544y;
                        PhotoResponse photoResponse2 = (PhotoResponse) fVar.f12543x;
                        eVar = (e) fVar.f12542w;
                        pl.r.b(obj);
                        bVar = bVar2;
                        photoResponse = photoResponse2;
                    }
                    eVar2 = eVar.f12528v.get(eVar.o(photoResponse));
                    if (eVar2 == null) {
                        eVar2 = eVar.k(photoResponse);
                        eVar.f12528v.put(eVar.o(photoResponse), eVar2);
                    }
                    return eVar2;
                }
            }
            eVar2 = eVar.f12528v.get(eVar.o(photoResponse));
            if (eVar2 == null) {
            }
            return eVar2;
        } finally {
            bVar.b(null);
        }
        fVar = new f(dVar);
        Object obj2 = fVar.f12545z;
        d10 = tl.d.d();
        i10 = fVar.B;
        if (i10 != 0) {
        }
    }

    private final b n() {
        Object value = this.f12531y.getValue();
        n.e(value, "<get-uploaderApi>(...)");
        return (b) value;
    }

    public final String o(PhotoResponse photoResponse) {
        String str = photoResponse.B;
        n.d(str);
        return str;
    }

    public final Object p(kotlinx.coroutines.flow.f<? super l> fVar, PhotoResponse photoResponse, sl.d<? super z> dVar) {
        g gVar;
        Object d10;
        int i10;
        FileInputStream fileInputStream;
        kotlinx.coroutines.flow.f fVar2;
        FileInputStream fileInputStream2;
        e eVar;
        FileInputStream fileInputStream3;
        int length;
        a0 a0Var;
        e eVar2;
        byte[] bArr;
        FileInputStream fileInputStream4;
        String str;
        Object obj;
        g gVar2;
        int i11;
        l.c cVar;
        kotlinx.coroutines.flow.f fVar3;
        PhotoResponse photoResponse2;
        byte[] bArr2;
        String str2;
        a0 a0Var2;
        int i12;
        int i13;
        r rVar;
        Object a10;
        float f10;
        int read;
        PhotoResponse photoResponse3 = photoResponse;
        try {
            try {
                try {
                    if (dVar instanceof g) {
                        gVar = (g) dVar;
                        int i14 = gVar.H;
                        if ((i14 & Integer.MIN_VALUE) != 0) {
                            gVar.H = i14 - Integer.MIN_VALUE;
                            Object obj2 = gVar.F;
                            d10 = tl.d.d();
                            i10 = gVar.H;
                            int i15 = 262144;
                            int i16 = 0;
                            int i17 = 1;
                            if (i10 != 0) {
                                pl.r.b(obj2);
                                try {
                                    gVar.f12546w = this;
                                    fVar2 = fVar;
                                    try {
                                        gVar.f12547x = fVar2;
                                        gVar.f12548y = photoResponse3;
                                        gVar.H = 1;
                                        obj2 = j(photoResponse3, gVar);
                                        if (obj2 == d10) {
                                            return d10;
                                        }
                                        eVar = this;
                                    } catch (Exception e10) {
                                        e = e10;
                                        eVar = this;
                                        fileInputStream3 = null;
                                        cVar = new l.c(eVar.o(photoResponse3), e);
                                        gVar.f12546w = fileInputStream3;
                                        gVar.f12547x = null;
                                        gVar.f12548y = null;
                                        gVar.f12549z = null;
                                        gVar.A = null;
                                        gVar.B = null;
                                        gVar.C = null;
                                        gVar.H = 5;
                                        if (fVar2.a(cVar, gVar) == d10) {
                                        }
                                        Util.closeQuietly(fileInputStream3);
                                        return z.f25438a;
                                    }
                                } catch (CancellationException e11) {
                                    e = e11;
                                    fileInputStream2 = null;
                                    throw e;
                                } catch (Exception e12) {
                                    e = e12;
                                    fVar2 = fVar;
                                }
                            } else if (i10 == 1) {
                                photoResponse3 = (PhotoResponse) gVar.f12548y;
                                fVar2 = (kotlinx.coroutines.flow.f) gVar.f12547x;
                                eVar = (e) gVar.f12546w;
                                try {
                                    pl.r.b(obj2);
                                } catch (Exception e13) {
                                    e = e13;
                                    fileInputStream3 = null;
                                    cVar = new l.c(eVar.o(photoResponse3), e);
                                    gVar.f12546w = fileInputStream3;
                                    gVar.f12547x = null;
                                    gVar.f12548y = null;
                                    gVar.f12549z = null;
                                    gVar.A = null;
                                    gVar.B = null;
                                    gVar.C = null;
                                    gVar.H = 5;
                                    if (fVar2.a(cVar, gVar) == d10) {
                                    }
                                    Util.closeQuietly(fileInputStream3);
                                    return z.f25438a;
                                }
                            } else if (i10 == 2) {
                                i13 = gVar.E;
                                i12 = gVar.D;
                                a0 a0Var3 = (a0) gVar.C;
                                byte[] bArr3 = (byte[]) gVar.B;
                                String str3 = (String) gVar.A;
                                FileInputStream fileInputStream5 = (FileInputStream) gVar.f12549z;
                                photoResponse2 = (PhotoResponse) gVar.f12548y;
                                fVar3 = (kotlinx.coroutines.flow.f) gVar.f12547x;
                                e eVar3 = (e) gVar.f12546w;
                                try {
                                    pl.r.b(obj2);
                                    a0Var2 = a0Var3;
                                    str2 = str3;
                                    fileInputStream4 = fileInputStream5;
                                    eVar = eVar3;
                                    bArr2 = bArr3;
                                    rVar = (r) obj2;
                                    a10 = rVar.a();
                                    n.d(a10);
                                    if (((b1) a10).d()) {
                                    }
                                } catch (CancellationException e14) {
                                    throw e14;
                                } catch (Exception e15) {
                                    e = e15;
                                    photoResponse3 = photoResponse2;
                                    fVar2 = fVar3;
                                    fileInputStream3 = fileInputStream5;
                                    eVar = eVar3;
                                    cVar = new l.c(eVar.o(photoResponse3), e);
                                    gVar.f12546w = fileInputStream3;
                                    gVar.f12547x = null;
                                    gVar.f12548y = null;
                                    gVar.f12549z = null;
                                    gVar.A = null;
                                    gVar.B = null;
                                    gVar.C = null;
                                    gVar.H = 5;
                                    if (fVar2.a(cVar, gVar) == d10) {
                                    }
                                    Util.closeQuietly(fileInputStream3);
                                    return z.f25438a;
                                } catch (Throwable th2) {
                                    th = th2;
                                    fileInputStream = fileInputStream5;
                                    Util.closeQuietly(fileInputStream);
                                    throw th;
                                }
                            } else {
                                if (i10 == 3) {
                                    fileInputStream2 = (FileInputStream) gVar.f12549z;
                                    PhotoResponse photoResponse4 = (PhotoResponse) gVar.f12548y;
                                    kotlinx.coroutines.flow.f fVar4 = (kotlinx.coroutines.flow.f) gVar.f12547x;
                                    eVar = (e) gVar.f12546w;
                                    try {
                                        try {
                                            pl.r.b(obj2);
                                            photoResponse2 = photoResponse4;
                                            fVar3 = fVar4;
                                            z zVar = z.f25438a;
                                            Util.closeQuietly(fileInputStream2);
                                            return zVar;
                                        } catch (Exception e16) {
                                            e = e16;
                                            fileInputStream3 = fileInputStream2;
                                            photoResponse3 = photoResponse4;
                                            fVar2 = fVar4;
                                            cVar = new l.c(eVar.o(photoResponse3), e);
                                            gVar.f12546w = fileInputStream3;
                                            gVar.f12547x = null;
                                            gVar.f12548y = null;
                                            gVar.f12549z = null;
                                            gVar.A = null;
                                            gVar.B = null;
                                            gVar.C = null;
                                            gVar.H = 5;
                                            if (fVar2.a(cVar, gVar) == d10) {
                                            }
                                            Util.closeQuietly(fileInputStream3);
                                            return z.f25438a;
                                        }
                                    } catch (CancellationException e17) {
                                        e = e17;
                                        throw e;
                                    } catch (Throwable th3) {
                                        th = th3;
                                        fileInputStream = fileInputStream2;
                                        Util.closeQuietly(fileInputStream);
                                        throw th;
                                    }
                                }
                                if (i10 != 4) {
                                    if (i10 != 5) {
                                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                                    }
                                    fileInputStream3 = (FileInputStream) gVar.f12546w;
                                    pl.r.b(obj2);
                                    Util.closeQuietly(fileInputStream3);
                                    return z.f25438a;
                                }
                                int i18 = gVar.E;
                                i12 = gVar.D;
                                a0 a0Var4 = (a0) gVar.C;
                                bArr2 = (byte[]) gVar.B;
                                str2 = (String) gVar.A;
                                fileInputStream4 = (FileInputStream) gVar.f12549z;
                                photoResponse2 = (PhotoResponse) gVar.f12548y;
                                kotlinx.coroutines.flow.f fVar5 = (kotlinx.coroutines.flow.f) gVar.f12547x;
                                eVar = (e) gVar.f12546w;
                                try {
                                    try {
                                        pl.r.b(obj2);
                                        a0Var2 = a0Var4;
                                        fVar3 = fVar5;
                                        str = str2;
                                        obj = d10;
                                        gVar2 = gVar;
                                        i11 = i18;
                                        photoResponse3 = photoResponse2;
                                        eVar2 = eVar;
                                        bArr = bArr2;
                                        length = i12;
                                        fVar2 = fVar3;
                                        i16 = 0;
                                        i17 = 1;
                                        a0Var = a0Var2;
                                        i15 = 262144;
                                        read = fileInputStream4.read(bArr, i16, i15);
                                        a0Var.f6325t = read;
                                    } catch (Exception e18) {
                                        e = e18;
                                        fVar2 = fVar5;
                                        photoResponse3 = photoResponse2;
                                        fileInputStream3 = fileInputStream4;
                                        cVar = new l.c(eVar.o(photoResponse3), e);
                                        gVar.f12546w = fileInputStream3;
                                        gVar.f12547x = null;
                                        gVar.f12548y = null;
                                        gVar.f12549z = null;
                                        gVar.A = null;
                                        gVar.B = null;
                                        gVar.C = null;
                                        gVar.H = 5;
                                        if (fVar2.a(cVar, gVar) == d10) {
                                        }
                                        Util.closeQuietly(fileInputStream3);
                                        return z.f25438a;
                                    }
                                    if (read <= 0) {
                                        String str4 = "bytes " + i11 + "-" + ((read + i11) - i17) + "/" + length;
                                        RequestBody create = RequestBody.create(MediaType.get("application/octet-stream"), bArr, i16, a0Var.f6325t);
                                        b n10 = eVar2.n();
                                        n.e(create, "body");
                                        gVar2.f12546w = eVar2;
                                        gVar2.f12547x = fVar2;
                                        gVar2.f12548y = photoResponse3;
                                        gVar2.f12549z = fileInputStream4;
                                        gVar2.A = str;
                                        gVar2.B = bArr;
                                        gVar2.C = a0Var;
                                        gVar2.D = length;
                                        gVar2.E = i11;
                                        gVar2.H = 2;
                                        Object b10 = n10.b(str, str4, create, gVar2);
                                        if (b10 == obj) {
                                            return obj;
                                        }
                                        bArr2 = bArr;
                                        eVar = eVar2;
                                        photoResponse2 = photoResponse3;
                                        i13 = i11;
                                        gVar = gVar2;
                                        d10 = obj;
                                        str2 = str;
                                        kotlinx.coroutines.flow.f fVar6 = fVar2;
                                        i12 = length;
                                        obj2 = b10;
                                        a0Var2 = a0Var;
                                        fVar3 = fVar6;
                                        try {
                                            rVar = (r) obj2;
                                            a10 = rVar.a();
                                            n.d(a10);
                                        } catch (Exception e19) {
                                            e = e19;
                                            photoResponse3 = photoResponse2;
                                            fVar2 = fVar3;
                                            fileInputStream3 = fileInputStream4;
                                            cVar = new l.c(eVar.o(photoResponse3), e);
                                            gVar.f12546w = fileInputStream3;
                                            gVar.f12547x = null;
                                            gVar.f12548y = null;
                                            gVar.f12549z = null;
                                            gVar.A = null;
                                            gVar.B = null;
                                            gVar.C = null;
                                            gVar.H = 5;
                                            if (fVar2.a(cVar, gVar) == d10) {
                                            }
                                            Util.closeQuietly(fileInputStream3);
                                            return z.f25438a;
                                        }
                                        if (((b1) a10).d()) {
                                            int b11 = rVar.b();
                                            if (b11 == 201) {
                                                l.b bVar = new l.b(eVar.o(photoResponse2), null, 2, null);
                                                gVar.f12546w = eVar;
                                                gVar.f12547x = fVar3;
                                                gVar.f12548y = photoResponse2;
                                                gVar.f12549z = fileInputStream4;
                                                gVar.A = null;
                                                gVar.B = null;
                                                gVar.C = null;
                                                gVar.H = 3;
                                                if (fVar3.a(bVar, gVar) == d10) {
                                                    return d10;
                                                }
                                                fileInputStream2 = fileInputStream4;
                                                try {
                                                    z zVar2 = z.f25438a;
                                                    Util.closeQuietly(fileInputStream2);
                                                    return zVar2;
                                                } catch (Exception e20) {
                                                    e = e20;
                                                    fVar2 = fVar3;
                                                    PhotoResponse photoResponse5 = photoResponse2;
                                                    fileInputStream3 = fileInputStream2;
                                                    photoResponse3 = photoResponse5;
                                                    cVar = new l.c(eVar.o(photoResponse3), e);
                                                    gVar.f12546w = fileInputStream3;
                                                    gVar.f12547x = null;
                                                    gVar.f12548y = null;
                                                    gVar.f12549z = null;
                                                    gVar.A = null;
                                                    gVar.B = null;
                                                    gVar.C = null;
                                                    gVar.H = 5;
                                                    if (fVar2.a(cVar, gVar) == d10) {
                                                    }
                                                    Util.closeQuietly(fileInputStream3);
                                                    return z.f25438a;
                                                }
                                            }
                                            if (b11 == 208) {
                                                i18 = i13 + a0Var2.f6325t;
                                                Object a11 = rVar.a();
                                                n.d(a11);
                                                Integer b12 = ((b1) a11).b();
                                                n.d(b12);
                                                if (i18 == b12.intValue()) {
                                                    f10 = im.h.f(i18 / i12, 0.0f, 1.0f);
                                                    l.d dVar2 = new l.d(eVar.o(photoResponse2), f10);
                                                    gVar.f12546w = eVar;
                                                    gVar.f12547x = fVar3;
                                                    gVar.f12548y = photoResponse2;
                                                    gVar.f12549z = fileInputStream4;
                                                    gVar.A = str2;
                                                    gVar.B = bArr2;
                                                    gVar.C = a0Var2;
                                                    gVar.D = i12;
                                                    gVar.E = i18;
                                                    gVar.H = 4;
                                                    if (fVar3.a(dVar2, gVar) == d10) {
                                                        return d10;
                                                    }
                                                    str = str2;
                                                    obj = d10;
                                                    gVar2 = gVar;
                                                    i11 = i18;
                                                    photoResponse3 = photoResponse2;
                                                    eVar2 = eVar;
                                                    bArr = bArr2;
                                                    length = i12;
                                                    fVar2 = fVar3;
                                                    i16 = 0;
                                                    i17 = 1;
                                                    a0Var = a0Var2;
                                                    i15 = 262144;
                                                    read = fileInputStream4.read(bArr, i16, i15);
                                                    a0Var.f6325t = read;
                                                    if (read <= 0) {
                                                        Util.closeQuietly(fileInputStream4);
                                                        return z.f25438a;
                                                    }
                                                } else {
                                                    throw new IllegalStateException("Check failed.".toString());
                                                }
                                            } else {
                                                throw new j(null, 1, null);
                                            }
                                        } else {
                                            throw new IllegalStateException("Check failed.".toString());
                                        }
                                    }
                                } catch (CancellationException e21) {
                                    throw e21;
                                } catch (Throwable th4) {
                                    th = th4;
                                    fileInputStream = fileInputStream4;
                                    Util.closeQuietly(fileInputStream);
                                    throw th;
                                }
                            }
                            u uVar = (u) obj2;
                            String str5 = (String) uVar.a();
                            String str6 = (String) uVar.b();
                            File file = (File) uVar.c();
                            String str7 = str6 + "upload/" + str5;
                            FileInputStream fileInputStream6 = new FileInputStream(file);
                            length = (int) file.length();
                            byte[] bArr4 = new byte[262144];
                            a0Var = new a0();
                            eVar2 = eVar;
                            bArr = bArr4;
                            fileInputStream4 = fileInputStream6;
                            str = str7;
                            obj = d10;
                            gVar2 = gVar;
                            i11 = 0;
                            read = fileInputStream4.read(bArr, i16, i15);
                            a0Var.f6325t = read;
                            if (read <= 0) {
                            }
                        }
                    }
                    if (i10 != 0) {
                    }
                    u uVar2 = (u) obj2;
                    String str52 = (String) uVar2.a();
                    String str62 = (String) uVar2.b();
                    File file2 = (File) uVar2.c();
                    String str72 = str62 + "upload/" + str52;
                    FileInputStream fileInputStream62 = new FileInputStream(file2);
                    length = (int) file2.length();
                    byte[] bArr42 = new byte[262144];
                    a0Var = new a0();
                    eVar2 = eVar;
                    bArr = bArr42;
                    fileInputStream4 = fileInputStream62;
                    str = str72;
                    obj = d10;
                    gVar2 = gVar;
                    i11 = 0;
                    read = fileInputStream4.read(bArr, i16, i15);
                    a0Var.f6325t = read;
                    if (read <= 0) {
                    }
                } catch (Throwable th5) {
                    th = th5;
                    fileInputStream = null;
                }
            } catch (Throwable th6) {
                th = th6;
            }
        } catch (CancellationException e22) {
            throw e22;
        }
        gVar = new g(dVar);
        Object obj22 = gVar.F;
        d10 = tl.d.d();
        i10 = gVar.H;
        int i152 = 262144;
        int i162 = 0;
        int i172 = 1;
    }

    public static final Response q(Interceptor.Chain chain) {
        Response proceed = chain.proceed(chain.request());
        return proceed.code() == 308 ? proceed.newBuilder().code(208).build() : proceed;
    }

    @Override
    public jn.a getKoin() {
        return a.C0353a.a(this);
    }

    @Override
    public sl.g m0() {
        return nm.a1.b().plus(this.f12527u);
    }

    public final kotlinx.coroutines.flow.e<l> r(PhotoResponse photoResponse) {
        n.f(photoResponse, "data");
        return kotlinx.coroutines.flow.g.t(new h(photoResponse, null));
    }
}