Currency Plus v2.10.8版本的 MD5 值为:8586f74edd9ace5aa261a19c9da51484

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


package lo;

import fi.a0;
import fi.m;
import gi.e0;
import gi.u;
import gi.v;
import j$.time.LocalDate;
import j$.time.format.DateTimeFormatter;
import j$.time.temporal.TemporalQueries;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import kotlin.NoWhenBranchMatchedException;
import li.i;
import ll.r;
import ll.t;
import ll.x;
import lo.a;
import nl.g0;
import nl.k0;
import nl.n0;
import nl.o0;
import nl.w0;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
import si.p;
import ti.l;
public final class c {
    public static final int f23453a = 0;

    public static final class a {
        public a(ti.g gVar) {
        }
    }

    @li.e(c = "sk.halmi.ccalc.datastore.remote.RcbApiService", f = "RcbApiService.kt", l = {22}, m = "getTimeSeries")
    public static final class b extends li.c {
        public Object f23454a;
        public int f23456c;

        public b(ji.d<? super b> dVar) {
            super(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            this.f23454a = obj;
            this.f23456c |= Integer.MIN_VALUE;
            return c.this.d(null, null, this);
        }
    }

    @li.e(c = "sk.halmi.ccalc.datastore.remote.RcbApiService$getTimeSeries$2$1", f = "RcbApiService.kt", l = {25, 26}, m = "invokeSuspend")
    public static final class C0512c extends i implements p<g0, ji.d<? super List<? extends d>>, Object> {
        public int f23457a;
        public Object f23458b;
        public final String f23460d;
        public final String f23461e;

        @li.e(c = "sk.halmi.ccalc.datastore.remote.RcbApiService$getTimeSeries$2$1$bynToRubRatesRequest$1", f = "RcbApiService.kt", l = {}, m = "invokeSuspend")
        public static final class a extends i implements p<g0, ji.d<? super List<? extends d>>, Object> {
            public final c f23462a;
            public final String f23463b;
            public final String f23464c;

            public a(c cVar, String str, String str2, ji.d<? super a> dVar) {
                super(2, dVar);
                this.f23462a = cVar;
                this.f23463b = str;
                this.f23464c = str2;
            }

            @Override
            public final ji.d<a0> create(Object obj, ji.d<?> dVar) {
                return new a(this.f23462a, this.f23463b, this.f23464c, dVar);
            }

            @Override
            public final Object invoke(g0 g0Var, ji.d<? super List<? extends d>> dVar) {
                return ((a) create(g0Var, dVar)).invokeSuspend(a0.f17744a);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                ki.a aVar = ki.a.f22122a;
                k0.i1(obj);
                int i10 = c.f23453a;
                this.f23462a.getClass();
                return c.c(this.f23463b, this.f23464c, "R01239");
            }
        }

        @li.e(c = "sk.halmi.ccalc.datastore.remote.RcbApiService$getTimeSeries$2$1$eurToRubRatesRequest$1", f = "RcbApiService.kt", l = {}, m = "invokeSuspend")
        public static final class b extends i implements p<g0, ji.d<? super List<? extends d>>, Object> {
            public final c f23465a;
            public final String f23466b;
            public final String f23467c;

            public b(c cVar, String str, String str2, ji.d<? super b> dVar) {
                super(2, dVar);
                this.f23465a = cVar;
                this.f23466b = str;
                this.f23467c = str2;
            }

            @Override
            public final ji.d<a0> create(Object obj, ji.d<?> dVar) {
                return new b(this.f23465a, this.f23466b, this.f23467c, dVar);
            }

            @Override
            public final Object invoke(g0 g0Var, ji.d<? super List<? extends d>> dVar) {
                return ((b) create(g0Var, dVar)).invokeSuspend(a0.f17744a);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                ki.a aVar = ki.a.f22122a;
                k0.i1(obj);
                int i10 = c.f23453a;
                this.f23465a.getClass();
                return c.c(this.f23466b, this.f23467c, "R01090B");
            }
        }

        public C0512c(String str, String str2, ji.d<? super C0512c> dVar) {
            super(2, dVar);
            this.f23460d = str;
            this.f23461e = str2;
        }

        @Override
        public final ji.d<a0> create(Object obj, ji.d<?> dVar) {
            C0512c c0512c = new C0512c(this.f23460d, this.f23461e, dVar);
            c0512c.f23458b = obj;
            return c0512c;
        }

        @Override
        public final Object invoke(g0 g0Var, ji.d<? super List<? extends d>> dVar) {
            return ((C0512c) create(g0Var, dVar)).invokeSuspend(a0.f17744a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            n0 n0Var;
            List list;
            Iterator it;
            ki.a aVar = ki.a.f22122a;
            int i10 = this.f23457a;
            if (i10 == 0) {
                k0.i1(obj);
                g0 g0Var = (g0) this.f23458b;
                c cVar = c.this;
                String str = this.f23460d;
                String str2 = this.f23461e;
                o0 c10 = nl.f.c(g0Var, null, new b(cVar, str, str2, null), 3);
                o0 c11 = nl.f.c(g0Var, null, new a(cVar, str, str2, null), 3);
                this.f23458b = c11;
                this.f23457a = 1;
                Object v10 = c10.v(this);
                if (v10 == aVar) {
                    return aVar;
                }
                n0Var = c11;
                obj = v10;
            } else if (i10 != 1) {
                if (i10 == 2) {
                    list = (List) this.f23458b;
                    k0.i1(obj);
                    ArrayList j02 = e0.j0(list, (List) obj);
                    ArrayList arrayList = new ArrayList(v.l(j02, 10));
                    it = j02.iterator();
                    while (it.hasNext()) {
                        m mVar = (m) it.next();
                        d dVar = (d) mVar.f17762a;
                        arrayList.add(new d(dVar.f23468a, "EUR", "BYN", ((d) mVar.f17763b).f23471d / dVar.f23471d));
                    }
                    return arrayList;
                }
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                n0Var = (n0) this.f23458b;
                k0.i1(obj);
            }
            List list2 = (List) obj;
            this.f23458b = list2;
            this.f23457a = 2;
            Object o02 = n0Var.o0(this);
            if (o02 == aVar) {
                return aVar;
            }
            list = list2;
            obj = o02;
            ArrayList j022 = e0.j0(list, (List) obj);
            ArrayList arrayList2 = new ArrayList(v.l(j022, 10));
            it = j022.iterator();
            while (it.hasNext()) {
            }
            return arrayList2;
        }
    }

    static {
        new a(null);
    }

    public static ArrayList a(String str, String str2, hi.b bVar) {
        ArrayList arrayList = new ArrayList(v.l(bVar, 10));
        Iterator<E> it = bVar.iterator();
        while (it.hasNext()) {
            d dVar = (d) it.next();
            arrayList.add(new m(Double.valueOf(dVar.f23471d), DateTimeFormatter.ISO_DATE.parse(dVar.f23468a).query(TemporalQueries.localDate())));
        }
        ArrayList arrayList2 = new ArrayList();
        Iterator it2 = arrayList.iterator();
        int i10 = 0;
        while (true) {
            long j10 = 1;
            if (!it2.hasNext()) {
                DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_DATE;
                LocalDate localDate = (LocalDate) dateTimeFormatter.parse(str2).query(TemporalQueries.localDate());
                m mVar = (m) e0.C(arrayList);
                double doubleValue = ((Number) mVar.f17762a).doubleValue();
                LocalDate localDate2 = (LocalDate) mVar.f17763b;
                int epochDay = (int) (localDate2.toEpochDay() - ((LocalDate) dateTimeFormatter.parse(str).query(TemporalQueries.localDate())).toEpochDay());
                int i11 = 0;
                while (i11 < epochDay) {
                    String localDate3 = localDate2.minusDays(i11 + j10).toString();
                    l.e(localDate3, "toString(...)");
                    arrayList2.add(0, new d(localDate3, "EUR", "RUB", doubleValue));
                    i11++;
                    j10 = 1;
                }
                m mVar2 = (m) e0.K(arrayList);
                double doubleValue2 = ((Number) mVar2.f17762a).doubleValue();
                LocalDate localDate4 = (LocalDate) mVar2.f17763b;
                int epochDay2 = (int) (localDate.toEpochDay() - localDate4.toEpochDay());
                for (int i12 = 0; i12 < epochDay2; i12++) {
                    String localDate5 = localDate4.plusDays(i12 + 1).toString();
                    l.e(localDate5, "toString(...)");
                    arrayList2.add(new d(localDate5, "EUR", "RUB", doubleValue2));
                }
                return arrayList2;
            }
            Object next = it2.next();
            int i13 = i10 + 1;
            if (i10 < 0) {
                u.k();
                throw null;
            }
            m mVar3 = (m) next;
            double doubleValue3 = ((Number) mVar3.f17762a).doubleValue();
            LocalDate localDate6 = (LocalDate) mVar3.f17763b;
            String localDate7 = localDate6.toString();
            l.e(localDate7, "toString(...)");
            arrayList2.add(new d(localDate7, "EUR", "RUB", doubleValue3));
            if (i13 <= u.f(arrayList)) {
                long epochDay3 = ((LocalDate) ((m) arrayList.get(i13)).f17763b).toEpochDay() - localDate6.toEpochDay();
                if (epochDay3 > 1) {
                    int i14 = (int) (epochDay3 - 1);
                    for (int i15 = 0; i15 < i14; i15++) {
                        String localDate8 = localDate6.plusDays(i15 + 1).toString();
                        l.e(localDate8, "toString(...)");
                        arrayList2.add(new d(localDate8, "EUR", "RUB", doubleValue3));
                    }
                }
            }
            i10 = i13;
        }
    }

    public static String b(String str) {
        return e0.I(e0.S(x.K(str, new String[]{"-"})), "/", null, null, null, 62);
    }

    public static ArrayList c(String str, String str2, String str3) {
        String format = String.format("https://www.cbr.ru/scripts/XML_dynamic.asp?date_req1=%s&date_req2=%s&VAL_NM_RQ=%s", Arrays.copyOf(new Object[]{b(str), b(str2), str3}, 3));
        l.e(format, "format(this, *args)");
        URLConnection openConnection = new URL(format).openConnection();
        l.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
        HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
        TimeUnit timeUnit = TimeUnit.SECONDS;
        httpURLConnection.setReadTimeout((int) timeUnit.toMillis(20L));
        httpURLConnection.setConnectTimeout((int) timeUnit.toMillis(20L));
        httpURLConnection.setRequestMethod("GET");
        httpURLConnection.setDoInput(true);
        httpURLConnection.connect();
        InputStream inputStream = httpURLConnection.getInputStream();
        l.e(inputStream, "getInputStream(...)");
        InputStreamReader inputStreamReader = new InputStreamReader(inputStream, ll.c.f23394b);
        BufferedReader bufferedReader = inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192);
        try {
            XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance();
            newInstance.setNamespaceAware(true);
            XmlPullParser newPullParser = newInstance.newPullParser();
            newPullParser.setInput(bufferedReader);
            ArrayList a10 = a(str, str2, e(newPullParser));
            cm.p.f(bufferedReader, null);
            return a10;
        } finally {
        }
    }

    public static hi.b e(XmlPullParser xmlPullParser) {
        hi.b bVar = new hi.b();
        int eventType = xmlPullParser.getEventType();
        String str = null;
        double d10 = 0.0d;
        while (eventType != 1) {
            String name = xmlPullParser.getName();
            if (eventType != 2) {
                if (eventType == 3 && l.a(name, "Record")) {
                    if (str == null) {
                        l.l("date");
                        throw null;
                    }
                    bVar.add(new d(str, "EUR", "RUB", d10));
                }
            } else if (l.a(name, "Record")) {
                String attributeValue = xmlPullParser.getAttributeValue(0);
                l.e(attributeValue, "getAttributeValue(...)");
                str = e0.I(e0.S(x.K(attributeValue, new String[]{"."})), "-", null, null, null, 62);
            } else if (l.a(name, "Value")) {
                String nextText = xmlPullParser.nextText();
                l.e(nextText, "nextText(...)");
                Double d11 = r.d(t.m(nextText, ',', '.'));
                d10 = d11 != null ? d11.doubleValue() : 0.0d;
            }
            eventType = xmlPullParser.next();
        }
        return gi.t.a(bVar);
    }

    public final Object d(String str, String str2, ji.d<? super be.c<? extends List<d>, ? extends lo.a>> dVar) {
        b bVar;
        int i10;
        Object aVar;
        if (dVar instanceof b) {
            bVar = (b) dVar;
            int i11 = bVar.f23456c;
            if ((i11 & Integer.MIN_VALUE) != 0) {
                bVar.f23456c = i11 - Integer.MIN_VALUE;
                Object obj = bVar.f23454a;
                ki.a aVar2 = ki.a.f22122a;
                i10 = bVar.f23456c;
                if (i10 != 0) {
                    k0.i1(obj);
                    ul.b bVar2 = w0.f24636b;
                    C0512c c0512c = new C0512c(str, str2, null);
                    bVar.f23456c = 1;
                    obj = nl.f.l(bVar, bVar2, c0512c);
                    if (obj == aVar2) {
                        return aVar2;
                    }
                } else if (i10 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                } else {
                    k0.i1(obj);
                }
                aVar = new be.b((List) obj);
                if (aVar instanceof be.b) {
                    if (aVar instanceof be.a) {
                        return new be.a(new a.c((Throwable) ((be.a) aVar).f5115a));
                    }
                    throw new NoWhenBranchMatchedException();
                }
                return aVar;
            }
        }
        bVar = new b(dVar);
        Object obj2 = bVar.f23454a;
        ki.a aVar22 = ki.a.f22122a;
        i10 = bVar.f23456c;
        if (i10 != 0) {
        }
        aVar = new be.b((List) obj2);
        if (aVar instanceof be.b) {
        }
    }
}