导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - XOneOpenStreetMapView.java 源代码

正在查看: Minits v4.9.3.32 应用的 XOneOpenStreetMapView.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xone.android.openstreetmap.views;

import Yb.c;
import Yb.e;
import Yb.f;
import Yb.g;
import Yb.k;
import Yb.l;
import Yb.m;
import Yb.n;
import Yb.p;
import ab.AbstractC0399a;
import ac.C0404a;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.CornerPathEffect;
import android.graphics.DashPathEffect;
import android.graphics.DiscretePathEffect;
import android.graphics.Paint;
import android.graphics.PathEffect;
import android.graphics.SumPathEffect;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.net.Uri;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import androidx.annotation.Keep;
import androidx.drawerlayout.widget.DrawerLayout;
import bc.d;
import bc.o;
import cc.h;
import cc.i;
import cc.j;
import cc.n;
import cc.r;
import cc.s;
import cc.t;
import cc.u;
import com.xone.android.javascript.XOneJavascript;
import com.xone.android.nfc.runtimeobjects.XoneNFCRuntime;
import com.xone.android.openstreetmap.views.XOneOpenStreetMapView;
import com.xone.android.script.events.EventCallbackTask;
import com.xone.android.script.events.EventOnMapClicked;
import com.xone.android.script.events.EventOnMapLongClicked;
import com.xone.android.script.events.EventOnMapReady;
import com.xone.android.script.events.EventOnMapZoomChanged;
import com.xone.android.script.events.EventOnMarkerDragEnd;
import com.xone.android.script.runtimeobjects.FutureScriptWrapper;
import com.xone.android.script.runtimeobjects.GpsTools;
import com.xone.android.utils.Utils;
import com.xone.annotations.ScriptAllowed;
import com.xone.interfaces.IXoneCollection;
import com.xone.interfaces.IXoneObject;
import com.xone.interfaces.IXoneView;
import fb.q;
import fb.v;
import gc.d;
import ha.AbstractC0751f;
import j$.util.concurrent.ConcurrentHashMap;
import ja.C0789a;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
import org.json.JSONException;
import org.mozilla.javascript.C0893d0;
import org.mozilla.javascript.C0932x0;
import org.mozilla.javascript.Q0;
import r9.AbstractC0978a;
import s9.C0984c;
import t9.C0994c;
import ua.E;
import ua.F;
import ua.InterfaceC1036l0;
import ua.InterfaceC1038m0;
import ua.InterfaceC1042o0;
import ua.P;
import va.C1066a;
import w9.C1079b;
import y9.C1098a;
import z9.C1110a;

@ScriptAllowed
public final class XOneOpenStreetMapView extends DrawerLayout implements IXoneView, P, i, View.OnClickListener, Sb.a, j, Sb.b {
    public boolean A0;
    public boolean B0;
    public boolean C0;
    public String D0;
    public String E0;
    public String F0;
    public boolean G0;
    public float H0;
    public float I0;
    public boolean J0;
    public String K0;
    public C0984c L0;
    public Object M0;
    public bc.i N0;
    public Future O0;
    public final Map P0;
    public final Map Q0;
    public final Map R0;
    public final Map S0;
    public final Map T0;
    public d U0;
    public ec.b V0;
    public h W0;
    public dc.a X0;
    public r Y0;
    public boolean Z0;
    public boolean a1;
    public boolean b1;
    public String c1;
    public Double d1;
    public boolean e0;
    public Double e1;
    public String f0;
    public String f1;
    public E g0;
    public s g1;
    public IXoneObject h0;
    public Double h1;
    public C1066a i0;
    public Wb.a i1;
    public FrameLayout j0;
    public ListView k0;
    public Button l0;
    public int m0;
    public int n0;
    public int o0;
    public int p0;
    public IXoneCollection q0;
    public boolean r0;
    public boolean s0;
    public boolean t0;
    public boolean u0;
    public boolean v0;
    public boolean w0;
    public boolean x0;
    public boolean y0;
    public boolean z0;

    public static class a {
        public static final int[] a;

        static {
            int[] iArr = new int[x9.d.values().length];
            a = iArr;
            try {
                iArr[x9.d.Dashed.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[x9.d.Dotted.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[x9.d.Mixed.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[x9.d.Normal.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public static class b implements Wb.b {
        public final InterfaceC1038m0 a;
        public final Object b;
        public final Object c;
        public final Object d;
        public final IXoneObject e;

        public b(Context context, Object obj, Object obj2, Object obj3, IXoneObject iXoneObject) {
            this.a = (InterfaceC1038m0) context.getApplicationContext();
            this.b = obj;
            this.c = obj2;
            this.d = obj3;
            this.e = iXoneObject;
        }

        @Override
        public void a(int i, int i2, int i3, int i4) {
            e(this.c, Integer.valueOf(i), Integer.valueOf(i2));
        }

        @Override
        public void b(int i) {
            e(this.b, Integer.valueOf(i));
        }

        @Override
        public void c(int i) {
            e(this.d, Integer.valueOf(i));
        }

        public void d(Throwable th) {
            F g = this.a.g();
            if (g instanceof F) {
                g.b(th);
            } else {
                th.printStackTrace();
            }
        }

        public final void e(Object obj, Object... objArr) {
            if (obj == null) {
                return;
            }
            try {
                Q0 m = XOneJavascript.m();
                if (m == null) {
                    XOneJavascript.x(obj, new Object[0]);
                    return;
                }
                Object property = Q0.getProperty(m, "self");
                Q0.putProperty(m, "self", this.e);
                try {
                    XOneJavascript.x(obj, objArr);
                } finally {
                    Q0.putProperty(m, "self", property);
                }
            } catch (Exception e) {
                d(e);
            }
        }
    }

    public XOneOpenStreetMapView(Context context) {
        super(context);
        this.P0 = new HashMap();
        this.Q0 = new HashMap();
        this.R0 = new ConcurrentHashMap();
        this.S0 = new ConcurrentHashMap();
        this.T0 = new ConcurrentHashMap();
    }

    public static Set g1(Map map) {
        return new HashSet(map.keySet());
    }

    private <T extends Activity> T getActivity() {
        return (T) getContext();
    }

    private InterfaceC1038m0 getApp() {
        return (InterfaceC1038m0) getApplicationContext();
    }

    private Context getApplicationContext() {
        return getContext().getApplicationContext();
    }

    private C0404a getBoundsInternal() {
        o projection;
        bc.i iVar = this.N0;
        if (iVar == null || (projection = iVar.getProjection()) == null) {
            return null;
        }
        return projection.i();
    }

    private IXoneCollection getContentCollectionInternal() {
        String contentsName = getContentsName();
        if (TextUtils.isEmpty(contentsName)) {
            throw new IllegalArgumentException("Property " + this.f0 + " in collection " + this.h0.getOwnerCollection().getName() + " has not declared contents attribute");
        }
        try {
            IXoneCollection Contents = this.h0.Contents(contentsName);
            if (Contents != null) {
                return Contents;
            }
            throw new IllegalArgumentException("Collection " + contentsName + " not found");
        } catch (Exception e) {
            throw AbstractC0751f.e(e);
        }
    }

    private static PathEffect getCornerPathEffect() {
        return new CornerPathEffect(10.0f);
    }

    private static PathEffect getDashedPathEffect() {
        return new DashPathEffect(new float[]{10.0f, 20.0f}, 0.0f);
    }

    private static PathEffect getDiscretePathEffect() {
        return new DiscretePathEffect(20.0f, 10.0f);
    }

    private DisplayMetrics getDisplayMetrics() {
        return getResources().getDisplayMetrics();
    }

    private static PathEffect getDottedPathEffect() {
        return new x9.b(40.0f);
    }

    private static PathEffect getMixedPathEffect() {
        return new SumPathEffect(getDashedPathEffect(), getDottedPathEffect());
    }

    private IXoneObject getSelfObject() {
        Q0 m = XOneJavascript.m();
        if (m == null) {
            return null;
        }
        Object obj = m.get("self");
        return obj instanceof IXoneObject ? (IXoneObject) obj : this.h0;
    }

    private g getTileSource() {
        if (TextUtils.isEmpty(this.f1)) {
            return m.a();
        }
        String str = this.f1;
        str.getClass();
        switch (str) {
            case "chart_bundle_wac":
                return new Yb.d();
            case "hikebike":
                return new f();
            case "google":
                return new e();
            case "mapnik":
                return new Yb.h();
            case "open_sea":
                return new Yb.j();
            case "usgs_sat":
                return new n();
            case "chart_bundle_enrh":
                return new Yb.b();
            case "chart_bundle_enrl":
                return new c();
            case "open_topo":
                return new k();
            case "public_transport":
                return new l();
            case "usgs_topo":
                return new Yb.o();
            default:
                return new Yb.h();
        }
    }

    private void m1() {
        m2();
        if (this.C0) {
            return;
        }
        f1();
        c2();
        if (!this.v0) {
            k2();
        }
        if (this.u0) {
            return;
        }
        j2();
        i2();
        h2();
        g2();
    }

    private void r2(Runnable runnable) {
        getActivity().runOnUiThread(runnable);
    }

    public static C0932x0 w2(double d, double d2) {
        C0932x0 c0932x0 = new C0932x0();
        Q8.k.N(c0932x0, "latitude", d);
        Q8.k.N(c0932x0, "longitude", d2);
        Q8.k.N(c0932x0, "altitude", 0.0d);
        Q8.k.O(c0932x0, "accuracy", 0.0f);
        Q8.k.O(c0932x0, "bearing", 0.0f);
        Q8.k.O(c0932x0, "speed", 0.0f);
        Q8.k.Q(c0932x0, "time", 0L);
        return c0932x0;
    }

    public static PathEffect x1(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        str.getClass();
        switch (str) {
        }
        return null;
    }

    public static C0893d0 x2(C0404a c0404a) {
        double d;
        double d2;
        double d3;
        double d4;
        if (c0404a != null) {
            d = c0404a.n();
            d2 = c0404a.r();
            d3 = c0404a.o();
            d4 = c0404a.s();
        } else {
            d = 0.0d;
            d2 = 0.0d;
            d3 = 0.0d;
            d4 = 0.0d;
        }
        return new C0893d0(new C0932x0[]{w2(d, d2), w2(d3, d4)});
    }

    public static y9.b y1(String str, String str2, List list) {
        if (!TextUtils.isEmpty(str2)) {
            return x9.f.d(str2, (ac.h) list.get(0), (ac.h) list.get(1));
        }
        throw new IllegalArgumentException(str + "(): Empty url argument");
    }

    public static float y2(String str, float f) {
        if (str != null) {
            String lowerCase = str.trim().toLowerCase(Locale.US);
            if (!TextUtils.isEmpty(lowerCase)) {
                try {
                    return Float.parseFloat(lowerCase);
                } catch (NumberFormatException unused) {
                    lowerCase.getClass();
                    switch (lowerCase) {
                        case "bottom":
                            return 1.0f;
                        case "center":
                            return 0.5f;
                        case "top":
                        case "left":
                            return 0.0f;
                        case "right":
                            return 1.0f;
                    }
                }
            }
        }
        return f;
    }

    public void A1(Throwable th) {
        F f = (F) getActivity();
        if (f == null) {
            th.printStackTrace();
        } else {
            f.b(th);
        }
    }

    public void A2() {
        if (Q(8388611) == 1) {
            return;
        }
        if (d0(8388611)) {
            B(8388611);
        } else {
            k0(8388611);
        }
    }

    public void B1() {
        if (Q(8388611) == 1) {
            return;
        }
        B(8388611);
    }

    public void B2(List list) {
        if (list != null) {
            try {
                if (!list.isEmpty() && this.N0 != null) {
                    C0404a j = x9.e.j(list);
                    int z2 = z2(20.0f);
                    bc.i iVar = this.N0;
                    iVar.P(j, true, z2, iVar.getMaxZoomLevel(), 2000L);
                }
            } catch (Exception e) {
                A1(e);
            }
        }
    }

    public final void C1() {
        this.e0 = false;
        Context context = getContext();
        this.j0 = new FrameLayout(context);
        ListView listView = new ListView(context);
        this.k0 = listView;
        listView.setBackgroundColor(-1);
        C0984c c0984c = new C0984c(this);
        this.L0 = c0984c;
        this.k0.setAdapter((ListAdapter) c0984c);
        addView(this.j0, new FrameLayout.LayoutParams(-1, -1));
        addView(this.k0);
    }

    public final boolean C2(String[] strArr) {
        if (strArr.length == 0) {
            return false;
        }
        final C0404a k = x9.e.k(strArr);
        if (!Utils.s3()) {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.X1(k);
                }
            });
            return true;
        }
        bc.i iVar = this.N0;
        iVar.P(k, true, 0, iVar.getMaxZoomLevel(), null);
        return true;
    }

    public boolean D1() {
        return this.s0;
    }

    public final void E1(List list) {
        Iterator it = list.iterator();
        while (it.hasNext()) {
            Z0(x9.c.GeoJson, (cc.k) it.next());
        }
    }

    public final void F1(List list) {
        Iterator it = list.iterator();
        while (it.hasNext()) {
            Z0(x9.c.Kml, (cc.k) it.next());
        }
    }

    public final boolean G1(C1110a c1110a, cc.g gVar, bc.i iVar) {
        try {
            c1110a.c0();
            return true;
        } catch (Exception e) {
            A1(e);
            return true;
        }
    }

    public final void J1(cc.o oVar) {
        getOpenStreetMap().getOverlays().remove(oVar);
    }

    public final void K1() {
        C0404a i = x9.e.i(this.c1);
        bc.i iVar = this.N0;
        iVar.P(i, false, 0, iVar.getMaxZoomLevel(), null);
    }

    public final boolean L1(Object obj, IXoneObject iXoneObject, cc.n nVar, bc.i iVar, ac.h hVar) {
        return f2(obj, iXoneObject);
    }

    public final void M1(String str, t tVar) {
        cc.n nVar;
        if (this.S0.containsKey(str) && (nVar = (cc.n) this.S0.get(str)) != null) {
            getOpenStreetMap().getOverlays().remove(nVar);
        }
        Z0(x9.c.Area, tVar);
        this.S0.put(str, tVar);
    }

    public final void O1() {
        try {
            this.U0.J();
        } catch (Exception e) {
            A1(e);
        }
    }

    public final void P1(ac.h hVar) {
        try {
            d2(hVar);
        } catch (Exception e) {
            A1(e);
        }
    }

    public final void Q1(String[] strArr) {
        for (String str : strArr) {
            this.N0.z(str);
        }
    }

    public final void R1(String[] strArr) {
        for (String str : strArr) {
            this.N0.z(str);
        }
    }

    @Override
    public void Refresh(Context context, InterfaceC1038m0 interfaceC1038m0, E e, IXoneObject iXoneObject, C1066a c1066a, Boolean bool, InterfaceC1042o0 interfaceC1042o0, int i, int i2, int i3, int i4, int i5, List list, int i6, int i7) {
        this.g0 = e;
        this.h0 = iXoneObject;
        this.i0 = c1066a;
        this.m0 = i;
        this.n0 = i2;
        this.o0 = i3;
        this.p0 = i4;
        if (isCreated()) {
            m1();
        } else {
            Boolean bool2 = Boolean.FALSE;
            createView(context, interfaceC1038m0, e, iXoneObject, c1066a, bool2, bool2, bool2, bool, interfaceC1042o0, i, i2, i3, i4, i5, list, i6, i7);
        }
    }

    public final void S1(boolean z) {
        this.U0.V(z);
    }

    public final boolean T0(String str, boolean z) {
        if (this.q0 != null && !TextUtils.isEmpty(str)) {
            try {
                String CollPropertyValue = this.q0.CollPropertyValue(str);
                if (CollPropertyValue != null) {
                    return fb.t.l(CollPropertyValue, z);
                }
            } catch (Exception e) {
                throw AbstractC0751f.e(e);
            }
        }
        return z;
    }

    public final void T1(double d) {
        this.N0.M(d);
    }

    public final String U0(String str) {
        return V0(str, "");
    }

    public final void U1(ac.h hVar, double d, boolean z) {
        try {
            t2(hVar, d, z);
        } catch (Exception e) {
            A1(e);
        }
    }

    public final String V0(String str, String str2) {
        if (this.h0 != null && !TextUtils.isEmpty(this.f0) && !TextUtils.isEmpty(str)) {
            try {
                String FieldPropertyValue = this.h0.FieldPropertyValue(this.f0, str);
                if (!TextUtils.isEmpty(FieldPropertyValue)) {
                    return FieldPropertyValue;
                }
            } catch (Exception unused) {
            }
        }
        return str2;
    }

    public final void V1() {
        try {
            u2(this.U0.M(), 16.0d, false);
        } catch (Exception e) {
            A1(e);
        }
    }

    public final boolean W0(String str, boolean z) {
        if (this.h0 != null && !TextUtils.isEmpty(this.f0) && !TextUtils.isEmpty(str)) {
            try {
                String FieldPropertyValue = this.h0.FieldPropertyValue(this.f0, str);
                if (!TextUtils.isEmpty(FieldPropertyValue)) {
                    return fb.t.l(FieldPropertyValue, z);
                }
            } catch (Exception unused) {
            }
        }
        return z;
    }

    public final void W1(C0404a c0404a) {
        try {
            getOpenStreetMap().Q(c0404a, true);
        } catch (Exception e) {
            A1(e);
        }
    }

    public final void X0(u uVar) {
        Y0(uVar);
        this.L0.c(new C0994c.a().i(uVar).b());
    }

    public final void X1(C0404a c0404a) {
        try {
            bc.i openStreetMap = getOpenStreetMap();
            openStreetMap.P(c0404a, true, 0, openStreetMap.getMaxZoomLevel(), null);
        } catch (Exception e) {
            A1(e);
        }
    }

    public synchronized void Y0(u uVar) {
        try {
            int t1 = t1();
            List<cc.k> overlays = this.N0.getOverlays();
            if (t1 > overlays.size()) {
                int size = t1 - overlays.size();
                for (int i = 0; i < size; i++) {
                    overlays.add(null);
                }
            }
            overlays.add(t1, uVar);
        } catch (Throwable th) {
            throw th;
        }
    }

    public final void Y1(String str, ac.h hVar, String str2, String str3) {
        StringBuilder sb2 = new StringBuilder();
        sb2.append("google.navigation:q=");
        if (hVar != null) {
            sb2.append(hVar.f());
            sb2.append(",");
            sb2.append(hVar.g());
        } else if (TextUtils.isEmpty(str)) {
            return;
        } else {
            sb2.append(str);
        }
        if (!TextUtils.isEmpty(str2)) {
            sb2.append("&mode=");
            sb2.append(str2);
        }
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(sb2.toString()));
        intent.setPackage(str3);
        getActivity().startActivity(intent);
    }

    public synchronized void Z0(x9.c cVar, cc.k kVar) {
        try {
            int ordinal = cVar.ordinal();
            List<cc.k> overlays = this.N0.getOverlays();
            if (ordinal == 0 && !(kVar instanceof cc.f)) {
                throw new IllegalArgumentException("Overlay at index 0 can only be the maps event overlay");
            }
            if (ordinal > overlays.size()) {
                int size = ordinal - overlays.size();
                for (int i = 0; i < size; i++) {
                    overlays.add(null);
                }
            }
            overlays.add(ordinal, kVar);
        } catch (Throwable th) {
            throw th;
        }
    }

    public final void Z1(C0932x0 c0932x0, String str) {
        double k = Q8.k.k(c0932x0, "destinationLatitude", -1.0d);
        double k2 = Q8.k.k(c0932x0, "destinationLongitude", -1.0d);
        String E = Q8.k.E(c0932x0, "address", null);
        String E2 = Q8.k.E(c0932x0, "mode", "driving");
        Y1(E, (k == -1.0d && k2 == -1.0d) ? null : new ac.h(k, k2), TextUtils.isEmpty(E2) ? "d" : E2.substring(0, 1), str);
    }

    public final void a1() {
        Context context = getContext();
        DisplayMetrics displayMetrics = getDisplayMetrics();
        Z0(x9.c.MapEvents, new cc.f(this));
        d dVar = new d(new gc.a(context), this.N0);
        this.U0 = dVar;
        d1(dVar);
        this.U0.W(!this.J0);
        if (this.B0) {
            this.U0.J();
        }
        Z0(x9.c.Location, this.U0);
        if (this.w0) {
            ec.b bVar = new ec.b(this.N0);
            this.V0 = bVar;
            bVar.B(true);
            Z0(x9.c.Rotation, this.V0);
        }
        if (this.x0) {
            dc.a aVar = new dc.a(context, new dc.d(context), this.N0);
            this.X0 = aVar;
            if (this.t0) {
                this.X0.S(aVar.N() + 80.0f, this.X0.O());
            }
            this.X0.L();
            Z0(x9.c.Compass, this.X0);
        }
        if (this.y0) {
            r rVar = new r(this.N0);
            this.Y0 = rVar;
            rVar.M(true);
            this.Y0.N(displayMetrics.widthPixels / 2, 10);
            Z0(x9.c.Scale, this.Y0);
        }
        if (this.z0) {
            h hVar = new h(context, getTileSource(), this.N0.getTileRequestCompleteHandler());
            this.W0 = hVar;
            hVar.d0(displayMetrics.widthPixels / 5);
            this.W0.c0(displayMetrics.heightPixels / 5);
            Z0(x9.c.Minimap, this.W0);
        }
    }

    public final void a2(C0404a c0404a) {
        this.N0.setScrollableAreaLimitDouble(c0404a);
        this.N0.setMinZoomLevel(Double.valueOf(1.1d));
    }

    @Override
    @ScriptAllowed
    @Keep
    public void addGeoJson(Object... objArr) {
        Utils.i("AddGeoJson", objArr, 1);
        final ArrayList arrayList = new ArrayList();
        C0932x0[] c0932x0Arr = (C0932x0[]) Q8.m.i(objArr, C0932x0.class, C0932x0[].class);
        if (c0932x0Arr == null) {
            return;
        }
        for (C0932x0 c0932x0 : c0932x0Arr) {
            arrayList.add(u1(c0932x0));
        }
        r2(new Runnable() {
            @Override
            public final void run() {
                XOneOpenStreetMapView.this.E1(arrayList);
            }
        });
    }

    @Override
    @ScriptAllowed
    @Keep
    public void addKml(Object... objArr) {
        Utils.i("AddKml", objArr, 1);
        final ArrayList arrayList = new ArrayList();
        C0932x0[] c0932x0Arr = (C0932x0[]) Q8.m.i(objArr, C0932x0.class, C0932x0[].class);
        if (c0932x0Arr == null) {
            return;
        }
        for (C0932x0 c0932x0 : c0932x0Arr) {
            arrayList.add(w1(c0932x0));
        }
        r2(new Runnable() {
            @Override
            public final void run() {
                XOneOpenStreetMapView.this.F1(arrayList);
            }
        });
    }

    @Override
    public boolean b(ac.h hVar) {
        List<Wa.a> eventCallback = this.h0.getEventCallback("onmaplongclicked", this.f0);
        if (eventCallback == null) {
            return false;
        }
        Object[] objArr = {new C0789a("e", new EventOnMapLongClicked(this.h0.getOwnerApp(), this.h0, this.f0, hVar.f(), hVar.g()))};
        InterfaceC1036l0 interfaceC1036l0 = (InterfaceC1036l0) getActivity();
        new EventCallbackTask.b().b(interfaceC1036l0).e(this.h0).h(interfaceC1036l0.getHandler()).g(eventCallback).c(objArr).a().runSeriallyAsyncTask();
        return true;
    }

    public final void b1(String str, cc.o oVar) {
        List list = (List) this.Q0.get(str);
        if (list == null) {
            list = new ArrayList();
            this.Q0.put(str, list);
        }
        list.add(oVar);
    }

    public final void b2() {
        a2(x9.e.m());
        this.N0.M(3.0d);
    }

    @Override
    public boolean c(ac.h hVar) {
        List<Wa.a> eventCallback = this.h0.getEventCallback("onmapclicked", this.f0);
        if (eventCallback == null) {
            return false;
        }
        Object[] objArr = {new C0789a("e", new EventOnMapClicked(this.h0.getOwnerApp(), this.h0, this.f0, hVar.f(), hVar.g()))};
        InterfaceC1036l0 interfaceC1036l0 = (InterfaceC1036l0) getActivity();
        new EventCallbackTask.b().b(interfaceC1036l0).e(this.h0).h(interfaceC1036l0.getHandler()).g(eventCallback).c(objArr).a().runSeriallyAsyncTask();
        return true;
    }

    public final void c1() {
        Button button = new Button(getContext());
        this.l0 = button;
        button.setBackgroundResource(AbstractC0978a.a);
        this.l0.setTextColor(Color.parseColor("#777777"));
        this.l0.setText(r9.d.A);
        this.l0.setOnClickListener(this);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(z2(80.0f), z2(45.0f));
        layoutParams.setMargins(z2(10.0f), z2(9.0f), 0, 0);
        this.j0.addView(this.l0, layoutParams);
    }

    public final void c2() {
        Future future = this.O0;
        if (future != null) {
            future.cancel(true);
        }
        if (this.N0 == null) {
            return;
        }
        this.O0 = new A9.b(this, this.L0, this.q0, this.G0, this.H0, this.I0).runSeriallyAsyncTask();
    }

    @Override
    @ScriptAllowed
    @Keep
    public String captureImage(Object... objArr) {
        Throwable th;
        FileNotFoundException e;
        bc.i openStreetMap = getOpenStreetMap();
        if (openStreetMap == null) {
            return "";
        }
        int width = openStreetMap.getWidth();
        int height = openStreetMap.getHeight();
        if (width <= 0 || height <= 0) {
            return "";
        }
        Bitmap createBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        openStreetMap.draw(new Canvas(createBitmap));
        File file = new File(getApp().T(), "files");
        if (!file.exists() && !file.mkdirs()) {
            throw new IllegalStateException("CaptureImage(): Cannot create directory " + file);
        }
        ?? r2 = "map_capture_" + UUID.randomUUID().toString() + ".png";
        File file2 = new File(file, (String) r2);
        try {
            try {
                FileOutputStream fileOutputStream = new FileOutputStream(file2);
                try {
                    createBitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
                    String name = file2.getName();
                    Utils.L3(createBitmap);
                    Utils.N(fileOutputStream);
                    return name;
                } catch (FileNotFoundException e2) {
                    e = e2;
                    throw AbstractC0751f.e(e);
                }
            } catch (Throwable th2) {
                th = th2;
                Utils.L3(createBitmap);
                Utils.N(r2);
                throw th;
            }
        } catch (FileNotFoundException e3) {
            e = e3;
        } catch (Throwable th3) {
            r2 = 0;
            th = th3;
            Utils.L3(createBitmap);
            Utils.N(r2);
            throw th;
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public synchronized void clearAllAreas() {
        try {
            if (this.S0.isEmpty()) {
                return;
            }
            List<cc.k> overlays = this.N0.getOverlays();
            Iterator it = this.S0.entrySet().iterator();
            while (it.hasNext()) {
                overlays.remove((cc.n) ((Map.Entry) it.next()).getValue());
            }
            this.S0.clear();
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void clearAllLines() {
        if (this.Q0.isEmpty()) {
            return;
        }
        Iterator it = g1(this.Q0).iterator();
        while (it.hasNext()) {
            final List list = (List) this.Q0.remove((String) it.next());
            if (list == null || list.isEmpty()) {
                return;
            }
            if (Utils.s3()) {
                I1(list);
            } else {
                post(new Runnable() {
                    @Override
                    public final void run() {
                        XOneOpenStreetMapView.this.H1(list);
                    }
                });
            }
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void clearAllPolylines() {
        throw new UnsupportedOperationException("ClearAllPolylines(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public void clearAllRoutes() {
        if (this.P0.isEmpty()) {
            return;
        }
        clearRoute((String[]) this.P0.keySet().toArray(new String[0]));
    }

    @Override
    @ScriptAllowed
    @Keep
    public void clearLine(Object... objArr) {
        Utils.h("ClearLine", objArr, 1, -1);
        ArrayList arrayList = new ArrayList();
        int i = 0;
        for (Object obj : objArr) {
            if (obj != null) {
                arrayList.add(obj.toString());
            }
        }
        if (arrayList.isEmpty()) {
            throw new IllegalArgumentException("ClearLine(): Empty line ID argument");
        }
        if (this.Q0.isEmpty()) {
            return;
        }
        int size = arrayList.size();
        while (i < size) {
            Object obj2 = arrayList.get(i);
            i++;
            final List list = (List) this.Q0.remove((String) obj2);
            if (list == null || list.isEmpty()) {
                return;
            }
            if (Utils.s3()) {
                I1(list);
            } else {
                post(new Runnable() {
                    @Override
                    public final void run() {
                        XOneOpenStreetMapView.this.I1(list);
                    }
                });
            }
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void clearRoute(String... strArr) {
        List<cc.o> list;
        if (strArr == null) {
            return;
        }
        for (String str : strArr) {
            if (!this.P0.containsKey(str) || (list = (List) this.P0.get(str)) == null) {
                return;
            }
            for (final cc.o oVar : list) {
                if (Utils.s3()) {
                    this.N0.getOverlays().remove(oVar);
                } else {
                    post(new Runnable() {
                        @Override
                        public final void run() {
                            XOneOpenStreetMapView.this.J1(oVar);
                        }
                    });
                }
            }
            list.clear();
            this.P0.remove(str);
        }
    }

    @Override
    public void createView(Context context, InterfaceC1038m0 interfaceC1038m0, E e, IXoneObject iXoneObject, C1066a c1066a, Boolean bool, Boolean bool2, Boolean bool3, Boolean bool4, InterfaceC1042o0 interfaceC1042o0, int i, int i2, int i3, int i4, int i5, List list, int i6, int i7) {
        C1();
        this.g0 = e;
        this.h0 = iXoneObject;
        this.i0 = c1066a;
        this.m0 = i;
        this.n0 = i2;
        this.o0 = i3;
        this.p0 = i4;
        this.f0 = c1066a.q().f();
        this.j0.removeAllViews();
        setTag(this.f0);
        j1();
    }

    public final void d1(d dVar) {
        Bitmap v1 = v1(this.E0);
        Bitmap v12 = v1(this.F0);
        if (v1 == null && v12 == null) {
            return;
        }
        dVar.U(v1, v12);
    }

    public void d2(final ac.h hVar) {
        if (this.N0 == null || hVar == null) {
            return;
        }
        if (!Utils.s3()) {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.P1(hVar);
                }
            });
        } else {
            this.N0.P(x9.e.g(hVar), true, z2(20.0f), getZoom(), null);
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void disableRotation() {
        ec.b bVar = this.V0;
        if (bVar == null) {
            return;
        }
        o2(bVar);
    }

    @Override
    @ScriptAllowed
    @Keep
    public void disableUserLocation() {
        d dVar = this.U0;
        if (dVar == null) {
            return;
        }
        dVar.G();
    }

    @Override
    @ScriptAllowed
    @Keep
    public String drawArea(Object... objArr) {
        Utils.j("DrawArea", objArr);
        Utils.g("DrawArea", objArr, 1);
        Object obj = objArr[0];
        if (!(obj instanceof C0932x0)) {
            return "";
        }
        C0932x0 c0932x0 = (C0932x0) obj;
        List r = x9.e.r(Q8.k.z(c0932x0, "data", null));
        if (r == null) {
            r = new ArrayList();
        }
        return n1(c0932x0, r);
    }

    @Override
    @ScriptAllowed
    @Keep
    public Object drawCircle(Object... objArr) {
        throw new UnsupportedOperationException("DrawCircle(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public String drawEncode(Object... objArr) {
        throw new UnsupportedOperationException("DrawEncode(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public String drawEncodeArea(Object... objArr) {
        Utils.j("DrawEncodeArea", objArr);
        Utils.g("DrawEncodeArea", objArr, 1);
        Object obj = objArr[0];
        return obj instanceof C0932x0 ? o1((C0932x0) obj) : "";
    }

    @Override
    @ScriptAllowed
    @Keep
    public void drawLine(Object... objArr) {
        int parseColor;
        Object[] objArr2;
        String str;
        String str2;
        ArrayList arrayList;
        float f;
        Utils.j("DrawLine", objArr);
        Utils.h("DrawLine", objArr, 1, -1);
        Object obj = objArr[0];
        if (obj instanceof C0932x0) {
            C0932x0 c0932x0 = (C0932x0) obj;
            String E = Q8.k.E(c0932x0, "line", "");
            parseColor = Color.parseColor(Q8.k.E(c0932x0, "strokeColor", ""));
            float l = Q8.k.l(c0932x0, "strokeWidth", 5.0f);
            String E2 = Q8.k.E(c0932x0, "mode", "normal");
            String E3 = Q8.k.E(c0932x0, "data", "");
            str = E;
            arrayList = !TextUtils.isEmpty(E3) ? x9.g.a(E3) : x9.e.A(Q8.k.u(c0932x0, "locations", null));
            str2 = E2;
            f = l;
        } else {
            String y = fb.t.y(obj);
            parseColor = Color.parseColor(fb.t.y(objArr[1]));
            String z = fb.t.z(objArr[2], "normal");
            Object obj2 = objArr[3];
            if (obj2 instanceof C0893d0) {
                objArr2 = Q8.m.h((C0893d0) obj2, Double[].class);
            } else {
                Object[] objArr3 = new Object[objArr.length - 3];
                System.arraycopy(objArr, 3, objArr3, 0, objArr.length - 3);
                objArr2 = objArr3;
            }
            ArrayList arrayList2 = new ArrayList();
            for (int i = 0; i <= objArr2.length - 2; i += 2) {
                arrayList2.add(new ac.h(q.i(objArr2[i], -1.0d), q.i(objArr2[i + 1], -1.0d)));
            }
            str = y;
            str2 = z;
            arrayList = arrayList2;
            f = 5.0f;
        }
        final int i2 = parseColor;
        if (arrayList.isEmpty()) {
            throw new IllegalArgumentException("DrawLine(): List of points is empty");
        }
        if (Utils.s3()) {
            N1(str2, str, i2, f, arrayList);
            return;
        }
        final ArrayList arrayList3 = arrayList;
        final float f2 = f;
        final String str3 = str;
        final String str4 = str2;
        post(new Runnable() {
            @Override
            public final void run() {
                XOneOpenStreetMapView.this.N1(str4, str3, i2, f2, arrayList3);
            }
        });
    }

    @Override
    @ScriptAllowed
    @Keep
    public void drawRoute(Object... objArr) {
        int parseColor;
        String str;
        List list;
        String str2;
        String str3;
        float f;
        y9.b y1;
        Utils.j("DrawRoute", objArr);
        Utils.h("DrawRoute", objArr, 1, 7);
        Object obj = objArr[0];
        String str4 = null;
        if (obj instanceof C0932x0) {
            C0932x0 c0932x0 = (C0932x0) obj;
            str = Q8.k.E(c0932x0, "route", "");
            if (c0932x0.containsKey("waypoints")) {
                list = x9.e.s(Q8.k.u(c0932x0, "waypoints", null));
            } else {
                if (!c0932x0.containsKey("destinationLatitude")) {
                    throw new IllegalArgumentException("DrawRoute(): Error, empty destination latitude");
                }
                ac.h hVar = new ac.h(Q8.k.k(c0932x0, "destinationLatitude", -200.0d), Q8.k.k(c0932x0, "destinationLongitude", -200.0d));
                x9.e.D(hVar);
                list = new ArrayList();
                list.add(hVar);
                ac.h hVar2 = new ac.h(Q8.k.k(c0932x0, "sourceLatitude", -200.0d), Q8.k.k(c0932x0, "sourceLongitude", -200.0d));
                x9.e.D(hVar2);
                list.add(hVar2);
            }
            str3 = Q8.k.E(c0932x0, "mode", "driving");
            parseColor = Color.parseColor(Q8.k.E(c0932x0, "strokeColor", "#0000FF"));
            f = Q8.k.l(c0932x0, "strokeWidth", 5.0f);
            str2 = Q8.k.E(c0932x0, "urlType", "default");
            str4 = Q8.k.E(c0932x0, "url", null);
        } else {
            String y = fb.t.y(obj);
            ac.h hVar3 = new ac.h(q.i(objArr[1], -200.0d), q.i(objArr[2], -200.0d));
            x9.e.D(hVar3);
            ArrayList arrayList = new ArrayList();
            arrayList.add(hVar3);
            ac.h hVar4 = new ac.h(q.i(objArr[3], -200.0d), q.i(objArr[4], -200.0d));
            x9.e.D(hVar4);
            arrayList.add(hVar4);
            String y2 = objArr.length >= 6 ? fb.t.y(objArr[5]) : "driving";
            parseColor = objArr.length >= 7 ? Color.parseColor(fb.t.y(objArr[6])) : -16776961;
            str = y;
            list = arrayList;
            str2 = "default";
            str3 = y2;
            f = 5.0f;
        }
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("Empty route service type");
        }
        str2.getClass();
        switch (str2) {
            case "osm2po":
                y1 = y1("DrawRoute", str4, list);
                break;
            case "osrm":
                y1 = z1("DrawRoute", str4, str3, list);
                break;
            case "default":
                y1 = z1("DrawRoute", "https://router.project-osrm.org/route/v1/", str3, list);
                break;
            default:
                throw new IllegalArgumentException("DrawRoute(): Unknown service type " + str2);
        }
        if (y1 == null) {
            throw AbstractC0751f.e(new IOException("DrawRoute(): Route not found"));
        }
        cc.o a2 = y9.d.a(y1, parseColor, f);
        a2.C(str);
        List list2 = (List) this.P0.get(str);
        if (list2 == null) {
            list2 = new ArrayList();
        }
        list2.add(a2);
        this.P0.put(str, list2);
        Z0(x9.c.Route, a2);
    }

    @Override
    public void e(cc.g gVar) {
        ac.h T = gVar.T();
        List<Wa.a> eventCallback = this.h0.getEventCallback("onmarkerdragend", this.f0);
        if (eventCallback != null) {
            EventOnMarkerDragEnd eventOnMarkerDragEnd = new EventOnMarkerDragEnd(this.h0.getOwnerApp(), this.h0, this.f0, T.f(), T.g(), null);
            eventOnMarkerDragEnd.marker = new C1110a(this.N0, (u) gVar);
            Object[] objArr = {new C0789a("e", eventOnMarkerDragEnd)};
            InterfaceC1036l0 interfaceC1036l0 = (InterfaceC1036l0) getActivity();
            new EventCallbackTask.b().b(interfaceC1036l0).e(this.h0).h(interfaceC1036l0.getHandler()).g(eventCallback).c(objArr).a().runSeriallyAsyncTask();
        }
    }

    public final boolean e1() {
        return this.t0;
    }

    public boolean e2(View view, MotionEvent motionEvent) {
        if (this.N0 == null || (motionEvent.getSource() & 2) == 0 || motionEvent.getAction() != 8) {
            return false;
        }
        Qb.a controller = this.N0.getController();
        if (motionEvent.getAxisValue(9) < 0.0f) {
            controller.g();
            return true;
        }
        controller.a();
        return true;
    }

    @Override
    @ScriptAllowed
    @Keep
    public void enableRotation() {
        if (this.V0 == null) {
            ec.b bVar = new ec.b(this.N0);
            this.V0 = bVar;
            bVar.B(true);
            Z0(x9.c.Rotation, this.V0);
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void enableUserLocation() {
        if (this.U0 != null) {
            if (Utils.s3()) {
                this.U0.J();
                return;
            } else {
                r2(new Runnable() {
                    @Override
                    public final void run() {
                        XOneOpenStreetMapView.this.O1();
                    }
                });
                return;
            }
        }
        d dVar = new d(new gc.a(getContext()), this.N0);
        this.U0 = dVar;
        d1(dVar);
        this.U0.J();
        Z0(x9.c.Location, this.U0);
    }

    public final void f1() {
        List<cc.k> overlays;
        bc.i iVar = this.N0;
        if (iVar == null || (overlays = iVar.getOverlays()) == null || overlays.isEmpty()) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        for (cc.k kVar : overlays) {
            if (!(kVar instanceof ec.b) && !(kVar instanceof dc.a) && !(kVar instanceof r) && !(kVar instanceof h) && !(kVar instanceof d) && !(kVar instanceof cc.f)) {
                arrayList.add(kVar);
            }
        }
        overlays.removeAll(arrayList);
    }

    public final boolean f2(Object obj, IXoneObject iXoneObject) {
        try {
            Q0 m = XOneJavascript.m();
            if (m == null) {
                XOneJavascript.x(obj, new Object[0]);
                return false;
            }
            Object property = Q0.getProperty(m, "self");
            Q0.putProperty(m, "self", iXoneObject);
            try {
                XOneJavascript.x(obj, new Object[0]);
                return false;
            } finally {
                Q0.putProperty(m, "self", property);
            }
        } catch (Exception e) {
            A1(e);
            return false;
        }
    }

    public final void g2() {
        if (this.S0.isEmpty() || this.N0 == null) {
            return;
        }
        for (String str : (String[]) this.S0.keySet().toArray(new String[0])) {
            cc.n nVar = (cc.n) this.S0.get(str);
            if (nVar != null) {
                Z0(x9.c.Area, nVar);
            }
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public IXoneCollection getContentCollection() {
        return this.q0;
    }

    public String getContentsName() {
        if (this.h0 == null || TextUtils.isEmpty(this.f0)) {
            return null;
        }
        return U0("contents");
    }

    @Override
    public InterfaceC1042o0 getCssItem() {
        return null;
    }

    @Override
    public IXoneObject getDataObject() {
        return this.h0;
    }

    @Override
    @ScriptAllowed
    @Keep
    public Object getGeoJsonLayerIds(Object... objArr) {
        List<cc.k> overlays = this.N0.getOverlays();
        HashSet hashSet = new HashSet();
        for (cc.k kVar : overlays) {
            if (kVar != null && kVar.i() == x9.c.GeoJson) {
                hashSet.add(kVar.f());
            }
        }
        return Q8.m.v(hashSet);
    }

    @Override
    @ScriptAllowed
    @Keep
    public Object getKmlLayerIds(Object... objArr) {
        List<cc.k> overlays = this.N0.getOverlays();
        HashSet hashSet = new HashSet();
        for (cc.k kVar : overlays) {
            if (kVar != null && kVar.i() == x9.c.Kml) {
                hashSet.add(kVar.f());
            }
        }
        return Q8.m.v(hashSet);
    }

    @Override
    @ScriptAllowed
    @Keep
    public String getMapType() {
        throw new UnsupportedOperationException("GetMapType(): Not implemented yet");
    }

    public bc.i getOpenStreetMap() {
        return this.N0;
    }

    @Override
    public String getPropName() {
        return this.f0;
    }

    @Override
    @ScriptAllowed
    @Keep
    public double getZoom() {
        bc.i iVar = this.N0;
        if (iVar == null) {
            return 16.0d;
        }
        return iVar.getZoomLevel();
    }

    public void h1() {
        d dVar = this.U0;
        if (dVar == null) {
            return;
        }
        dVar.G();
    }

    public final void h2() {
        if (this.T0.isEmpty() || this.N0 == null) {
            return;
        }
        for (String str : (String[]) this.T0.keySet().toArray(new String[0])) {
            cc.o oVar = (cc.o) this.T0.get(str);
            if (oVar != null) {
                this.T0.put(str, oVar);
            }
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void hideCompass() {
        dc.a aVar = this.X0;
        if (aVar == null) {
            return;
        }
        aVar.I();
    }

    @Override
    @ScriptAllowed
    @Keep
    public void hideMinimap() {
        if (this.W0 == null) {
            return;
        }
        this.N0.getOverlays().remove(this.W0);
    }

    @Override
    @ScriptAllowed
    @Keep
    public void hidePoisMenu() {
        if (Utils.s3()) {
            B1();
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.B1();
                }
            });
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void hideScale() {
        if (this.Y0 == null) {
            return;
        }
        this.N0.getOverlays().remove(this.Y0);
    }

    @Override
    public boolean i(Sb.c cVar) {
        return false;
    }

    public final void i1(java.lang.String r4, java.lang.String r5) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.openstreetmap.views.XOneOpenStreetMapView.i1(java.lang.String, java.lang.String):void");
    }

    public final void i2() {
        if (this.Q0.isEmpty() || this.N0 == null) {
            return;
        }
        Iterator it = this.Q0.keySet().iterator();
        while (it.hasNext()) {
            List list = (List) this.Q0.get((String) it.next());
            if (list != null) {
                Iterator it2 = list.iterator();
                while (it2.hasNext()) {
                    Z0(x9.c.Line, (cc.o) it2.next());
                }
            }
        }
    }

    @Override
    public boolean isCreated() {
        return this.e0;
    }

    @Override
    @ScriptAllowed
    @Keep
    public boolean isUserLocationEnabled() {
        d dVar = this.U0;
        if (dVar == null) {
            return false;
        }
        return dVar.R();
    }

    public final void j1() {
        l2();
        this.q0 = getContentCollectionInternal();
        this.r0 = W0("zoom-to-my-location", false);
        this.s0 = W0("zoom-to-pois", true);
        this.t0 = W0("show-pois", true);
        this.u0 = W0("clear-lines-on-refresh", true);
        this.v0 = W0("clear-markers-on-refresh", false);
        this.w0 = W0("allow-rotate", true);
        this.x0 = W0("show-compass", true);
        this.y0 = W0("show-scale", true);
        this.z0 = W0("show-minimap", true);
        this.A0 = W0("offline-maps", false);
        this.B0 = W0("show-user-location", true);
        this.D0 = U0("storage-path");
        this.E0 = U0("user-location-icon");
        this.F0 = U0("direction-arrow-icon");
        if (Utils.d3(getApplicationContext())) {
            this.G0 = W0("ignore-geocoding-errors", false);
        } else {
            this.G0 = true;
        }
        this.H0 = y2(U0("marker-anchor-width"), 0.5f);
        this.I0 = y2(U0("marker-anchor-height"), 1.0f);
        this.J0 = W0("follow-location-on-background", false);
        this.K0 = V0("zoom-buttons-visibility", "show_and_fade");
        this.Z0 = T0("autocreatefill", true);
        this.a1 = T0("horizontal-map-repetition", true);
        this.b1 = T0("vertical-map-repetition", true);
        this.c1 = U0("encoded-initial-bounds");
        this.d1 = q.k(U0("min-zoom"), null);
        this.e1 = q.k(U0("max-zoom"), null);
        this.f1 = V0("tile-source", "");
        if (this.g0.getXoneActivity() instanceof androidx.fragment.app.j) {
            this.j0.setId(getApp().getId());
            this.g0.E(this);
            if (e1()) {
                c1();
            } else {
                t0(1, 8388611);
            }
            l1();
            this.e0 = true;
        }
    }

    public final void j2() {
        if (this.P0.isEmpty() || this.N0 == null) {
            return;
        }
        Iterator it = this.P0.keySet().iterator();
        while (it.hasNext()) {
            List list = (List) this.P0.get((String) it.next());
            if (list != null) {
                Iterator it2 = list.iterator();
                while (it2.hasNext()) {
                    Z0(x9.c.Route, (cc.o) it2.next());
                }
            }
        }
    }

    public final void k1() {
        List<Wa.a> eventCallback;
        IXoneObject iXoneObject = this.h0;
        if (iXoneObject == null || (eventCallback = iXoneObject.getEventCallback("onmapready", this.f0)) == null) {
            return;
        }
        Object[] objArr = {new C0789a("e", new EventOnMapReady(this.h0.getOwnerApp(), this.h0, this.f0))};
        InterfaceC1036l0 interfaceC1036l0 = (InterfaceC1036l0) getActivity();
        new EventCallbackTask.b().b(interfaceC1036l0).e(this.h0).h(interfaceC1036l0.getHandler()).g(eventCallback).c(objArr).a().runSeriallyAsyncTask();
    }

    public final void k2() {
        for (String str : (String[]) this.R0.keySet().toArray(new String[0])) {
            C1110a c1110a = (C1110a) this.R0.remove(str);
            if (c1110a != null) {
                X0(c1110a.getMarker());
            }
        }
    }

    @Override
    public boolean l(Sb.d dVar) {
        List<Wa.a> eventCallback;
        Double d = this.h1;
        if (d != null && d.doubleValue() == dVar.a()) {
            return false;
        }
        this.h1 = Double.valueOf(dVar.a());
        IXoneObject iXoneObject = this.h0;
        if (iXoneObject == null || (eventCallback = iXoneObject.getEventCallback("onmapzoomchanged", this.f0)) == null) {
            return false;
        }
        Object[] objArr = {new C0789a("e", new EventOnMapZoomChanged(this.h0.getOwnerApp(), this.h0, this.f0, this.h1.doubleValue(), x9.e.u(getBoundsInternal())))};
        InterfaceC1036l0 interfaceC1036l0 = (InterfaceC1036l0) getActivity();
        new EventCallbackTask.b().b(interfaceC1036l0).e(this.h0).h(interfaceC1036l0.getHandler()).g(eventCallback).c(objArr).a().runSeriallyAsyncTask();
        return false;
    }

    public final void l1() {
        InterfaceC1038m0 app = getApp();
        Rb.a k = Rb.a.k();
        File k1 = !TextUtils.isEmpty(this.D0) ? Utils.k1(app.Y(), app.T(), this.D0, false) : new File(app.getCacheDir(), "openStreetMap");
        k.y(k1);
        k.z(new File(k1, "tiles"));
        k.A(app.Y());
        this.N0 = new bc.i(getContext(), m.a());
        if (!TextUtils.isEmpty(this.c1)) {
            post(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.K1();
                }
            });
        }
        this.N0.setDestroyMode(false);
        this.N0.setTileSource(getTileSource());
        this.N0.setUseDataConnection(!this.A0);
        b2();
        this.N0.setHorizontalMapRepetitionEnabled(this.a1);
        this.N0.setVerticalMapRepetitionEnabled(this.b1);
        Double d = this.d1;
        if (d != null) {
            this.N0.setMinZoomLevel(d);
        }
        Double d2 = this.e1;
        if (d2 != null) {
            this.N0.setMaxZoomLevel(d2);
        }
        char c = 65535;
        this.j0.addView(this.N0, -1, -1);
        this.N0.setOnGenericMotionListener(new View.OnGenericMotionListener() {
            @Override
            public final boolean onGenericMotion(View view, MotionEvent motionEvent) {
                return XOneOpenStreetMapView.this.e2(view, motionEvent);
            }
        });
        bc.d zoomController = this.N0.getZoomController();
        String str = this.K0;
        int hashCode = str.hashCode();
        if (hashCode != -1414557169) {
            if (hashCode != 104712844) {
                if (hashCode == 789055206 && str.equals("show_and_fade")) {
                    c = 2;
                }
            } else if (str.equals("never")) {
                c = 0;
            }
        } else if (str.equals("always")) {
            c = 1;
        }
        if (c == 0) {
            zoomController.o(d.b.Never);
        } else if (c != 1) {
            zoomController.o(d.b.ShowAndFadeout);
        } else {
            zoomController.o(d.b.Always);
        }
        this.N0.setMultiTouchControls(true);
        this.N0.setTilesScaledToDpi(false);
        this.N0.f(this);
        a1();
        if (this.Z0) {
            c2();
        }
        v2();
        k1();
    }

    public final void l2() {
        String U0 = U0("width");
        String U02 = U0("height");
        Context context = getContext();
        InterfaceC1038m0 app = getApp();
        int V = app.V();
        int l = app.l();
        int e1 = Utils.e1(context, U0, V, this.m0, this.o0);
        int e12 = Utils.e1(context, U02, l, this.n0, this.p0);
        setLayoutParams(new LinearLayout.LayoutParams(e1, e12));
        ViewGroup.LayoutParams fVar = new DrawerLayout.f((int) (e1 / 1.5d), e12);
        ((DrawerLayout.f) fVar).a = 8388611;
        this.k0.setLayoutParams(fVar);
    }

    public final void m2() {
        try {
            boolean i = AbstractC0399a.i(this.h0, this.i0, this.f0);
            this.C0 = i;
            if (i) {
                setVisibility(8);
            } else {
                setVisibility(0);
            }
        } catch (InterruptedException e) {
            throw AbstractC0751f.e(e);
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void moveTo(Object... objArr) {
        Utils.g("MoveTo", objArr, 2);
        d2(new ac.h(Double.parseDouble(fb.t.y(objArr[0])), Double.parseDouble(fb.t.y(objArr[1]))));
    }

    public final String n1(C0932x0 c0932x0, List list) {
        cc.n nVar;
        final String E = Q8.k.E(c0932x0, XoneNFCRuntime.TAG_ID_FIELD, fb.t.y(Integer.valueOf(list.hashCode())));
        int g = Q8.k.g(c0932x0, "color", -16777216);
        int g2 = Q8.k.g(c0932x0, "fillcolor", Color.parseColor("#339966"));
        String E2 = Q8.k.E(c0932x0, "pattern", "");
        float l = Q8.k.l(c0932x0, "width", 2.0f);
        final Object y = Q8.k.y(c0932x0, "onClick");
        if (!x9.e.q(list) && list.size() > 2) {
            ac.h hVar = (ac.h) list.get(0);
            list.add(new ac.h(hVar.f(), hVar.g()));
        }
        final t tVar = new t();
        tVar.P(list);
        tVar.a0(g);
        tVar.R().setPathEffect(x1(E2));
        tVar.U(g2);
        tVar.b0(l);
        if (y != null) {
            final IXoneObject selfObject = getSelfObject();
            tVar.Y(new n.a() {
                @Override
                public final boolean a(cc.n nVar2, bc.i iVar, ac.h hVar2) {
                    boolean L1;
                    L1 = XOneOpenStreetMapView.this.L1(y, selfObject, nVar2, iVar, hVar2);
                    return L1;
                }
            });
        }
        if (!Utils.s3()) {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.M1(E, tVar);
                }
            });
            return E;
        }
        if (this.S0.containsKey(E) && (nVar = (cc.n) this.S0.get(E)) != null) {
            this.N0.getOverlays().remove(nVar);
        }
        Z0(x9.c.Area, tVar);
        this.S0.put(E, tVar);
        return E;
    }

    public final void n2(cc.g gVar) {
        bc.i iVar = this.N0;
        if (iVar == null) {
            return;
        }
        gVar.a0(iVar);
    }

    public final String o1(C0932x0 c0932x0) {
        return n1(c0932x0, x9.e.d(Q8.k.E(c0932x0, "data", "")));
    }

    public void o2(cc.k kVar) {
        List<cc.k> overlays;
        bc.i iVar = this.N0;
        if (iVar == null || kVar == null || (overlays = iVar.getOverlays()) == null || overlays.isEmpty()) {
            return;
        }
        overlays.remove(kVar);
    }

    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (this.M0 == null) {
            this.M0 = new C1079b(this);
        }
        ((Application) getApplicationContext()).registerActivityLifecycleCallbacks((Application.ActivityLifecycleCallbacks) this.M0);
    }

    @Override
    public void onClick(View view) {
        if (view != this.l0 || Q(8388611) == 1) {
            return;
        }
        k0(8388611);
    }

    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        Future future = this.O0;
        if (future != null) {
            future.cancel(true);
            this.O0 = null;
        }
        bc.i iVar = this.N0;
        if (iVar != null) {
            iVar.u();
        }
        if (this.M0 instanceof Application.ActivityLifecycleCallbacks) {
            ((Application) getApplicationContext()).unregisterActivityLifecycleCallbacks((Application.ActivityLifecycleCallbacks) this.M0);
        }
    }

    @Override
    public boolean p(cc.g gVar, bc.i iVar) {
        try {
            C0994c d = this.L0.d(gVar.f());
            if (d == null || d.d() == null) {
                return false;
            }
            return s1(d.d());
        } catch (Exception e) {
            A1(e);
            return false;
        }
    }

    public void N1(String str, String str2, int i, float f, List list) {
        str.getClass();
        switch (str) {
            case "dashed":
                q1(str2, i, f, x9.d.Dashed, list);
                break;
            case "dotted":
                q1(str2, i, f, x9.d.Dotted, list);
                break;
            case "mixed":
                q1(str2, i, f, x9.d.Mixed, list);
                break;
            default:
                q1(str2, i, f, x9.d.Normal, list);
                break;
        }
    }

    public void I1(List list) {
        if (list == null) {
            return;
        }
        Iterator it = list.iterator();
        while (it.hasNext()) {
            o2((cc.k) it.next());
        }
    }

    public final void q1(String str, int i, float f, x9.d dVar, List list) {
        PathEffect dashPathEffect;
        if (this.N0 == null) {
            return;
        }
        cc.o oVar = new cc.o();
        oVar.Q(list);
        oVar.U(i);
        oVar.a0(f);
        oVar.W(true);
        Paint S = oVar.S();
        int i2 = a.a[dVar.ordinal()];
        if (i2 == 1) {
            dashPathEffect = new DashPathEffect(new float[]{10.0f, 20.0f}, 0.0f);
        } else if (i2 != 2) {
            dashPathEffect = null;
            if (i2 != 3 && i2 != 4) {
                throw new IncompatibleClassChangeError();
            }
        } else {
            dashPathEffect = new x9.b(40.0f);
        }
        if (dashPathEffect != null) {
            S.setPathEffect(dashPathEffect);
        }
        Z0(x9.c.Line, oVar);
        b1(str, oVar);
    }

    public final void q2(boolean z) {
        s sVar = this.g1;
        if (sVar == null) {
            return;
        }
        Vb.i M = sVar.M();
        if (M != null && z) {
            M.f();
        }
        this.N0.getOverlays().remove(this.g1);
    }

    public void r1() {
        gc.d dVar = this.U0;
        if (dVar == null) {
            return;
        }
        dVar.J();
    }

    @Override
    @ScriptAllowed
    @Keep
    public boolean removeArea(Object... objArr) {
        Utils.j("RemoveArea", objArr);
        Utils.g("RemoveArea", objArr, 1);
        String y = fb.t.y(objArr[0]);
        if (TextUtils.isEmpty(y) || !this.S0.containsKey(y)) {
            return false;
        }
        cc.n nVar = (cc.n) this.S0.remove(y);
        if (nVar != null) {
            this.N0.getOverlays().remove(nVar);
        }
        return true;
    }

    @Override
    @ScriptAllowed
    @Keep
    public void removeGeoJson(Object... objArr) {
        final String[] strArr;
        Utils.g("RemoveGeoJson", objArr, 1);
        Object obj = objArr[0];
        if (obj instanceof C0893d0) {
            strArr = (String[]) Q8.m.g((C0893d0) obj);
        } else {
            if (!(obj instanceof CharSequence)) {
                if (obj == null) {
                    throw new IllegalArgumentException("RemoveGeoJson(): Empty IDs argument");
                }
                throw new IllegalArgumentException("RemoveGeoJson(): Invalid argument of type " + obj.getClass().getSimpleName());
            }
            strArr = new String[]{obj.toString()};
        }
        r2(new Runnable() {
            @Override
            public final void run() {
                XOneOpenStreetMapView.this.Q1(strArr);
            }
        });
    }

    @Override
    @ScriptAllowed
    @Keep
    public void removeKml(Object... objArr) {
        final String[] strArr;
        Utils.g("RemoveKml", objArr, 1);
        Object obj = objArr[0];
        if (obj instanceof C0893d0) {
            strArr = (String[]) Q8.m.g((C0893d0) obj);
        } else {
            if (!(obj instanceof CharSequence)) {
                if (obj == null) {
                    throw new IllegalArgumentException("RemoveKml(): Empty IDs argument");
                }
                throw new IllegalArgumentException("RemoveKml(): Invalid argument of type " + obj.getClass().getSimpleName());
            }
            strArr = new String[]{obj.toString()};
        }
        r2(new Runnable() {
            @Override
            public final void run() {
                XOneOpenStreetMapView.this.R1(strArr);
            }
        });
    }

    @Override
    @ScriptAllowed
    @Keep
    public boolean removeMarker(Object... objArr) {
        Utils.j("RemoveMarker", objArr);
        Utils.g("RemoveMarker", objArr, 1);
        Object obj = objArr[0];
        if (obj instanceof CharSequence) {
            String obj2 = obj.toString();
            if (this.R0.containsKey(obj2)) {
                C1110a c1110a = (C1110a) this.R0.remove(obj2);
                if (c1110a != null) {
                    n2(c1110a.getMarker());
                }
                return true;
            }
        } else if (obj instanceof C1110a) {
            return removeMarker(((C1110a) obj).getMarker());
        }
        return false;
    }

    @Override
    @ScriptAllowed
    @Keep
    public boolean removePolylines(Object... objArr) {
        throw new UnsupportedOperationException("RemovePolylines(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public void resetMinMaxZoom(Object... objArr) {
        bc.i iVar = this.N0;
        if (iVar == null) {
            return;
        }
        iVar.setMinZoomLevel(null);
        this.N0.setMaxZoomLevel(null);
    }

    @Override
    @ScriptAllowed
    @Keep
    public void restrictMapToBounds(Object... objArr) {
        throw new UnsupportedOperationException("RestrictMapToBounds(): Not implemented yet");
    }

    @Override
    @com.xone.annotations.ScriptAllowed
    @androidx.annotation.Keep
    public void routeTo(java.lang.Object... r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.openstreetmap.views.XOneOpenStreetMapView.routeTo(java.lang.Object[]):void");
    }

    public final boolean s1(IXoneObject iXoneObject) {
        if (TextUtils.isEmpty(this.f0) || getContentCollectionInternal().getProperties().W0("selecteditem") == null) {
            return false;
        }
        new A9.a((InterfaceC1036l0) getActivity(), iXoneObject).runSeriallyAsyncTask();
        return true;
    }

    public void s2() {
        if (Q(8388611) == 1) {
            return;
        }
        k0(8388611);
    }

    @Override
    public void setExternalEnabled(boolean z) {
    }

    @Override
    @ScriptAllowed
    @Keep
    public void setFollowUserLocation(Object... objArr) {
        Utils.g("SetFollowUserLocation", objArr, 1);
        final boolean H = fb.t.H(objArr[0]);
        if (Utils.s3()) {
            this.U0.V(H);
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.S1(H);
                }
            });
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void setMapType(Object... objArr) {
        throw new UnsupportedOperationException("SetMapType(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public void setMaxZoom(Object... objArr) {
        bc.i iVar;
        Utils.j("SetMaxZoom", objArr);
        Utils.g("SetMaxZoom", objArr, 1);
        double i = q.i(objArr[0], -1.0d);
        if (i == -1.0d || (iVar = this.N0) == null) {
            return;
        }
        iVar.setMaxZoomLevel(Double.valueOf(i));
    }

    @Override
    @ScriptAllowed
    @Keep
    public void setMinZoom(Object... objArr) {
        bc.i iVar;
        Utils.j("SetMinZoom", objArr);
        Utils.g("SetMinZoom", objArr, 1);
        double i = q.i(objArr[0], -1.0d);
        if (i == -1.0d || (iVar = this.N0) == null) {
            return;
        }
        iVar.setMinZoomLevel(Double.valueOf(i));
    }

    @Override
    @ScriptAllowed
    @Keep
    public void setZoom(Object... objArr) {
        Utils.g("SetZoom", objArr, 1);
        final double i = q.i(objArr[0], -1.0d);
        if (i == -1.0d || this.N0 == null) {
            return;
        }
        if (Utils.s3()) {
            this.N0.M(i);
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.T1(i);
                }
            });
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void showCompass() {
        dc.a aVar = this.X0;
        if (aVar != null) {
            aVar.L();
            return;
        }
        dc.a aVar2 = new dc.a(getContext(), new dc.d(getContext()), this.N0);
        this.X0 = aVar2;
        if (this.t0) {
            float N = aVar2.N();
            this.X0.S(N + 80.0f, this.X0.O());
        }
        this.X0.L();
        Z0(x9.c.Compass, this.X0);
    }

    @ScriptAllowed
    @Keep
    public XOneOpenStreetMapView showMap(Object... objArr) {
        throw new UnsupportedOperationException("ShowMap(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public void showMinimap() {
        if (this.W0 == null) {
            DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
            h hVar = new h(getContext(), getTileSource(), this.N0.getTileRequestCompleteHandler());
            this.W0 = hVar;
            hVar.d0(displayMetrics.widthPixels / 5);
            this.W0.c0(displayMetrics.heightPixels / 5);
            Z0(x9.c.Minimap, this.W0);
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void showPoisMenu() {
        if (Utils.s3()) {
            s2();
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.s2();
                }
            });
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void showScale() {
        if (this.Y0 == null) {
            DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
            r rVar = new r(this.N0);
            this.Y0 = rVar;
            rVar.M(true);
            this.Y0.N(displayMetrics.widthPixels / 2, 10);
            Z0(x9.c.Scale, this.Y0);
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void startDistanceMeter(Object... objArr) {
        throw new UnsupportedOperationException("StartDistanceMeter(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public void stopDistanceMeter() {
        throw new UnsupportedOperationException("StopDistanceMeter(): Not implemented yet");
    }

    public final synchronized int t1() {
        List<cc.k> overlays = this.N0.getOverlays();
        int size = overlays.size();
        int i = -1;
        for (int i2 = 0; i2 < size; i2++) {
            if (overlays.get(i2) instanceof t) {
                i = i2;
            }
        }
        if (i != -1) {
            return i + 1;
        }
        return x9.c.Marker.ordinal();
    }

    public void t2(final ac.h hVar, final double d, final boolean z) {
        if (this.N0 == null || hVar == null) {
            return;
        }
        if (Utils.s3()) {
            this.N0.P(z ? x9.e.h(hVar, d) : x9.e.g(hVar), true, z2(20.0f), d, 2000L);
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.U1(hVar, d, z);
                }
            });
        }
    }

    @ScriptAllowed
    @Keep
    public String toString() {
        StringBuilder sb2 = new StringBuilder();
        sb2.append("OpenStreetMap view object.");
        if (this.h0 != null) {
            sb2.append("\nData object: ");
            sb2.append(this.h0.toString());
        }
        if (this.q0 != null) {
            sb2.append("\nData collection: ");
            sb2.append(this.q0.toString());
        }
        return sb2.toString();
    }

    @Override
    @ScriptAllowed
    @Keep
    public void toggleCompass() {
        dc.a aVar = this.X0;
        if (aVar == null) {
            return;
        }
        if (aVar.R()) {
            this.X0.I();
        } else {
            this.X0.L();
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public void togglePoisMenu() {
        if (Utils.s3()) {
            A2();
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.A2();
                }
            });
        }
    }

    public final cc.k u1(C0932x0 c0932x0) {
        InputStream fileInputStream;
        InputStream inputStream = null;
        try {
            try {
                String E = Q8.k.E(c0932x0, XoneNFCRuntime.TAG_ID_FIELD, null);
                if (TextUtils.isEmpty(E)) {
                    throw new IllegalArgumentException("Empty layer id argument");
                }
                String E2 = Q8.k.E(c0932x0, "data", null);
                String E3 = Q8.k.E(c0932x0, "dataFile", null);
                if (TextUtils.isEmpty(E2) && TextUtils.isEmpty(E3)) {
                    throw new IllegalArgumentException("Empty data argument");
                }
                v9.f fVar = new v9.f(getContext());
                if (TextUtils.isEmpty(E2)) {
                    InterfaceC1038m0 app = getApp();
                    fileInputStream = new FileInputStream(Utils.q1(app.Y(), app.T(), E3, false, 1));
                } else {
                    fileInputStream = new ByteArrayInputStream(fb.t.S(E2));
                }
                try {
                    fVar.e(fileInputStream);
                    cc.k a2 = fVar.c().a(this.N0, null, fVar);
                    a2.C(E);
                    a2.D(x9.c.GeoJson);
                    Utils.N(fileInputStream);
                    return a2;
                } catch (IOException e) {
                    e = e;
                    throw AbstractC0751f.e(e);
                } catch (JSONException e2) {
                    e = e2;
                    throw AbstractC0751f.e(e);
                } catch (Throwable th) {
                    th = th;
                    inputStream = fileInputStream;
                    Utils.N(inputStream);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (IOException e3) {
            e = e3;
        } catch (JSONException e4) {
            e = e4;
        }
    }

    public void u2(Location location, double d, boolean z) {
        if (this.N0 == null || location == null) {
            return;
        }
        t2(new ac.h(location.getLatitude(), location.getLongitude()), d, z);
    }

    public final Bitmap v1(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        InterfaceC1038m0 app = getApp();
        File q1 = Utils.q1(app.Y(), app.T(), str, false, 2);
        if (q1 != null && q1.exists() && q1.isFile() && q1.canRead()) {
            return BitmapFactory.decodeFile(q1.getAbsolutePath());
        }
        return null;
    }

    public final void v2() {
        if (this.r0) {
            this.U0.S(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.V1();
                }
            });
        }
    }

    public final cc.k w1(C0932x0 c0932x0) {
        try {
            String E = Q8.k.E(c0932x0, XoneNFCRuntime.TAG_ID_FIELD, null);
            if (TextUtils.isEmpty(E)) {
                throw new IllegalArgumentException("Empty layer id argument");
            }
            String E2 = Q8.k.E(c0932x0, "data", null);
            String E3 = Q8.k.E(c0932x0, "dataFile", null);
            if (TextUtils.isEmpty(E2) && TextUtils.isEmpty(E3)) {
                throw new IllegalArgumentException("Empty data argument");
            }
            v9.f fVar = new v9.f(getContext());
            if (!TextUtils.isEmpty(E2)) {
                ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(fb.t.S(E2));
                try {
                    fVar.h(byteArrayInputStream, null);
                    Utils.N(byteArrayInputStream);
                    cc.k a2 = fVar.c().a(this.N0, null, fVar);
                    a2.C(E);
                    a2.D(x9.c.Kml);
                    return a2;
                } catch (Throwable th) {
                    Utils.N(byteArrayInputStream);
                    throw th;
                }
            }
            InterfaceC1038m0 app = getApp();
            File q1 = Utils.q1(app.Y(), app.T(), E3, false, 1);
            if (TextUtils.equals(Utils.t1(q1), "kmz")) {
                fVar.j(q1);
            } else {
                FileInputStream fileInputStream = new FileInputStream(q1);
                try {
                    fVar.h(fileInputStream, null);
                } finally {
                    Utils.N(fileInputStream);
                }
            }
            cc.k a22 = fVar.c().a(this.N0, null, fVar);
            a22.C(E);
            a22.D(x9.c.Kml);
            return a22;
        } catch (IOException e) {
            throw AbstractC0751f.e(e);
        }
    }

    public final y9.b z1(String str, String str2, String str3, List list) {
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException(str + "(): Empty url argument");
        }
        Context applicationContext = getApplicationContext();
        String d = v.d(applicationContext);
        if (TextUtils.isEmpty(d)) {
            d = getApp().Y() + "/1";
        }
        return new C1098a(applicationContext, str2, d, str3).i(list);
    }

    public final int z2(float f) {
        return x9.e.B(getDisplayMetrics(), f);
    }

    @Override
    @ScriptAllowed
    @Keep
    public void zoomTo(Object... objArr) {
        Utils.j("ZoomTo", objArr);
        Utils.h("ZoomTo", objArr, 2, 4);
        double parseDouble = Double.parseDouble(fb.t.y(objArr[0]));
        double parseDouble2 = Double.parseDouble(fb.t.y(objArr[1]));
        t2(new ac.h(parseDouble, parseDouble2), Utils.s(objArr, 2, 16.0d), Utils.q(objArr, 3, false));
    }

    @Override
    @ScriptAllowed
    @Keep
    public void zoomToBounds(Object... objArr) {
        Utils.j("ZoomToBounds", objArr);
        final C0404a j = x9.e.j(x9.e.t(objArr));
        if (Utils.s3()) {
            this.N0.Q(j, true);
        } else {
            r2(new Runnable() {
                @Override
                public final void run() {
                    XOneOpenStreetMapView.this.W1(j);
                }
            });
        }
    }

    @Override
    @ScriptAllowed
    @Keep
    public boolean zoomToEncodeData(Object... objArr) {
        Utils.j("ZoomToEncodeData", objArr);
        String[] strArr = (String[]) Q8.m.i(objArr, String.class, String[].class);
        if (strArr == null) {
            return false;
        }
        return C2(strArr);
    }

    @Override
    @ScriptAllowed
    @Keep
    public Object zoomToMyLocation(Object... objArr) {
        Location M;
        gc.d dVar = this.U0;
        if (dVar == null || !dVar.R() || (M = this.U0.M()) == null) {
            return null;
        }
        double s = Utils.s(objArr, 0, 14.0d);
        boolean q = Utils.q(objArr, 1, false);
        double latitude = M.getLatitude();
        double longitude = M.getLongitude();
        t2(new ac.h(latitude, longitude), s, q);
        C0932x0 c0932x0 = new C0932x0();
        Q0.putProperty(c0932x0, "latitude", Double.valueOf(latitude));
        Q0.putProperty(c0932x0, "longitude", Double.valueOf(longitude));
        return c0932x0;
    }

    @Override
    @ScriptAllowed
    @Keep
    public C1110a addMarker(Object... objArr) {
        Object obj;
        Object obj2;
        double i;
        float f;
        float f2;
        double i2;
        String str;
        Utils.j("AddMarker", objArr);
        boolean z = true;
        Utils.h("AddMarker", objArr, 1, 2);
        String str2 = "";
        boolean z2 = false;
        if (objArr.length == 1) {
            C0932x0 c0932x0 = (C0932x0) objArr[0];
            i = Q8.k.V(c0932x0, "latitude");
            i2 = Q8.k.V(c0932x0, "longitude");
            str = Utils.C0(getApp().Y(), getApp().T(), Q8.k.E(c0932x0, "icon", ""), 2);
            z2 = Q8.k.a(c0932x0, "draggable", false);
            z = Q8.k.a(c0932x0, "persist", true);
            f = Q8.k.l(c0932x0, "alpha", 1.0f);
            f2 = Q8.k.l(c0932x0, "rotation", 0.0f);
            str2 = Q8.k.E(c0932x0, "anchor", "");
            obj2 = Q8.k.z(c0932x0, "tag", null);
            obj = Q8.k.z(c0932x0, "onClick", null);
            if (obj == null) {
                obj = Q8.k.z(c0932x0, "callback", null);
            }
        } else {
            obj = null;
            obj2 = null;
            i = q.i(objArr[0], 0.0d);
            f = 1.0f;
            f2 = 0.0f;
            i2 = q.i(objArr[1], 0.0d);
            str = null;
        }
        ac.h hVar = new ac.h(i, i2);
        u uVar = new u(this.N0);
        uVar.j0(hVar);
        File file = TextUtils.isEmpty(str) ? null : new File(str);
        if (file != null && file.exists() && file.isFile()) {
            uVar.f0(Drawable.createFromPath(file.getAbsolutePath()));
        } else {
            uVar.f0(getResources().getDrawable(AbstractC0978a.h));
        }
        uVar.e0(z2);
        if (z2) {
            uVar.i0(this);
        }
        uVar.b0(f);
        uVar.k0(f2);
        if (TextUtils.equals(str2, "center")) {
            uVar.c0(0.5f, 0.5f);
        } else if (TextUtils.equals(str2, "top")) {
            uVar.c0(0.5f, 0.0f);
        } else if (TextUtils.equals(str2, "bottom")) {
            uVar.c0(0.5f, 1.0f);
        }
        if (obj2 == null) {
            obj2 = UUID.randomUUID().toString();
        }
        uVar.C(obj2.toString());
        X0(uVar);
        final C1110a c1110a = new C1110a(this.N0, uVar, obj, getSelfObject());
        if (obj != null) {
            uVar.h0(new i() {
                @Override
                public final boolean p(cc.g gVar, bc.i iVar) {
                    boolean G1;
                    G1 = XOneOpenStreetMapView.this.G1(c1110a, gVar, iVar);
                    return G1;
                }
            });
        }
        if (z) {
            this.R0.put(uVar.f(), c1110a);
        }
        return c1110a;
    }

    @Override
    @ScriptAllowed
    @Keep
    public XOneOpenStreetMapView addWmsTileOverlay(Object... objArr) {
        Utils.g("AddWmsTileOverlay", objArr, 1);
        C0932x0 c0932x0 = (C0932x0) objArr[0];
        p a2 = new p.a().e(Q8.k.a(c0932x0, "debug", false)).k(Q8.k.D(c0932x0, "name")).f(Q8.k.D(c0932x0, "urlDomain")).o(Q8.k.D(c0932x0, "version")).l(Q8.k.D(c0932x0, "request")).d(Q8.k.D(c0932x0, "cqlFilter")).j(Q8.k.D(c0932x0, "layers")).c(Q8.k.D(c0932x0, "boundingBox")).b(Q8.k.D(c0932x0, "backgroundColor")).p(Q8.k.n(c0932x0, "width")).i(Q8.k.n(c0932x0, "height")).m(Q8.k.D(c0932x0, "spatialReferenceSystem")).h(Q8.k.D(c0932x0, "format")).n(Q8.k.a(c0932x0, "transparent", true)).a();
        q2(false);
        Vb.k kVar = new Vb.k(getApplicationContext(), m.a());
        kVar.o().add(this.N0.getTileRequestCompleteHandler());
        s sVar = new s(kVar, getContext());
        this.g1 = sVar;
        sVar.R(0);
        Z0(x9.c.Wms, this.g1);
        kVar.t(a2);
        return this;
    }

    @Override
    @ScriptAllowed
    @Keep
    public FutureScriptWrapper<Integer> downloadTiles(Object... objArr) {
        Utils.g("DownloadTiles", objArr, 1);
        C0932x0 c0932x0 = (C0932x0) objArr[0];
        b bVar = null;
        C0893d0 u = Q8.k.u(c0932x0, "coordinates", null);
        Object z = Q8.k.z(c0932x0, "onCompleted", null);
        Object z2 = Q8.k.z(c0932x0, "onProgressUpdated", null);
        Object z3 = Q8.k.z(c0932x0, "onDownloadStarted", null);
        if (u == null || u.isEmpty()) {
            throw new IllegalArgumentException("DownloadTiles(): Empty coordinates argument");
        }
        List A = x9.e.A(u);
        if (A.isEmpty()) {
            throw new IllegalArgumentException("DownloadTiles(): Empty coordinates list");
        }
        bc.i iVar = this.N0;
        if (iVar == null) {
            throw new IllegalStateException("DownloadTiles(): Map is not loaded yet");
        }
        if (this.i1 == null) {
            this.i1 = new Wb.a(iVar);
        }
        int minZoomLevel = (int) this.N0.getMinZoomLevel();
        int maxZoomLevel = (int) this.N0.getMaxZoomLevel();
        if (z != null || z2 != null || z3 != null) {
            bVar = new b(getContext(), z, z2, z3, getSelfObject());
        }
        return new FutureScriptWrapper<>(this.i1.a(A, minZoomLevel, maxZoomLevel, bVar));
    }

    @Override
    @ScriptAllowed
    @Keep
    public C0893d0 getMapBounds() {
        return x2(getBoundsInternal());
    }

    @Override
    @ScriptAllowed
    @Keep
    public C0932x0 getMapCenter() {
        C0404a boundsInternal = getBoundsInternal();
        if (boundsInternal != null) {
            ac.h m = boundsInternal.m();
            return w2(m.f(), m.g());
        }
        C0932x0 c0932x0 = new C0932x0();
        Q8.k.N(c0932x0, "latitude", 0.0d);
        Q8.k.N(c0932x0, "longitude", 0.0d);
        Q8.k.N(c0932x0, "altitude", 0.0d);
        Q8.k.O(c0932x0, "accuracy", 0.0f);
        Q8.k.O(c0932x0, "bearing", 0.0f);
        Q8.k.O(c0932x0, "speed", 0.0f);
        Q8.k.Q(c0932x0, "time", 0L);
        return c0932x0;
    }

    @Override
    @ScriptAllowed
    @Keep
    public C0932x0 getUserLocation() {
        Location M;
        gc.d dVar = this.U0;
        if (dVar == null || !dVar.R() || (M = this.U0.M()) == null) {
            return null;
        }
        return GpsTools.Z0(M);
    }

    @Override
    @ScriptAllowed
    @Keep
    public XOneOpenStreetMapView removeStreetView(Object... objArr) {
        throw new UnsupportedOperationException("RemoveStreetView(): Not implemented yet");
    }

    @Override
    @ScriptAllowed
    @Keep
    public XOneOpenStreetMapView removeWmsTileOverlay(Object... objArr) {
        Utils.g("RemoveWmsTileOverlay", objArr, 1);
        q2(fb.t.k(objArr[0], false));
        return this;
    }

    @Override
    @ScriptAllowed
    @Keep
    public XOneOpenStreetMapView showStreetView(Object... objArr) {
        throw new UnsupportedOperationException("ShowStreetView(): Not implemented yet");
    }

    @ScriptAllowed
    @Keep
    public boolean zoomToEncodeData(C0893d0 c0893d0) {
        String[] strArr = (String[]) Q8.m.h(c0893d0, String[].class);
        if (strArr == null) {
            return false;
        }
        return C2(strArr);
    }

    @Override
    public void a(cc.g gVar) {
    }

    @Override
    public void t(cc.g gVar) {
    }
}