package com.google.android.m4b.maps.bq;

import android.graphics.Bitmap;
import android.os.Build.VERSION;
import com.google.android.m4b.maps.bc.ao;
import com.google.android.m4b.maps.bc.as;
import com.google.android.m4b.maps.bc.ax;
import com.google.android.m4b.maps.bc.ay;
import com.google.android.m4b.maps.bc.k;
import com.google.android.m4b.maps.bc.s;
import com.google.android.m4b.maps.bc.s.a;
import com.google.android.m4b.maps.bc.u;
import com.google.android.m4b.maps.bi.a;
import com.google.android.m4b.maps.bl.ak;
import com.google.android.m4b.maps.bl.ak.a;
import com.google.android.m4b.maps.bl.j;
import com.google.android.m4b.maps.bo.e;
import com.google.android.m4b.maps.bo.l.a;
import com.google.android.m4b.maps.bp.f;
import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.Iterator;
import javax.microedition.khronos.opengles.GL10;

public final class i
  implements c
{
  private c a;
  private final f b;
  private final ArrayList<ArrayList<e>> c;
  private final ArrayList<com.google.android.m4b.maps.bo.l> d;
  private final com.google.android.m4b.maps.bp.l e;
  private final com.google.android.m4b.maps.bp.h f;
  private final com.google.android.m4b.maps.bo.g g;
  private final f h;
  private float i;
  private float j;
  private float k;
  private float l;
  private boolean m;
  private boolean n;

  i(ArrayList<ArrayList<e>> paramArrayList, c paramc, f paramf)
  {
    this.c = paramArrayList;
    this.d = new ArrayList(paramArrayList.size());
    new ArrayList(paramArrayList.size());
    this.g = new com.google.android.m4b.maps.bo.g(4 * paramArrayList.size(), 9, false);
    this.h = new f(this.g.d());
    this.e = this.g;
    this.f = this.g;
    this.a = paramc;
    this.b = paramf;
    d();
    this.m = false;
    this.n = true;
  }

  public static i a(s params, k paramk, com.google.android.m4b.maps.bn.b paramb, l.a<Bitmap> parama, ak paramak, com.google.android.m4b.maps.bs.c paramc)
  {
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    localArrayList1.add(localArrayList2);
    int i1 = 0;
    Object localObject1 = localArrayList2;
    s.a locala;
    as localas;
    int i2;
    label106: ak.a locala2;
    label132: Object localObject2;
    if (i1 < params.b())
    {
      locala = params.a(i1);
      if (locala.a())
      {
        localas = locala.j();
        String str = locala.i();
        if ((str == null) || (str.length() == 0) || (paramak == null) || (localas == null) || (!localas.e()))
        {
          i2 = 0;
          if (i2 != 0)
          {
            locala2 = paramc.d;
            if (!(paramk instanceof ao))
              break label222;
            locala2 = paramc.a;
            ((ArrayList)localObject1).add(new d(paramak, locala.i(), n.a(localas, paramc, paramb.g()), localas, locala2));
          }
          localObject2 = localObject1;
        }
      }
    }
    while (true)
    {
      i1++;
      localObject1 = localObject2;
      break;
      int i3 = localas.i().d();
      if ((localas.i().f() > 0) && ((i3 & 0xFF000000) != 0))
      {
        i2 = 1;
        break label106;
      }
      i2 = 0;
      break label106;
      label222: if (!(paramk instanceof u))
        break label132;
      locala2 = paramc.h;
      break label132;
      if (locala.b())
      {
        a locala1 = com.google.android.m4b.maps.bi.c.c().a(locala.g(), null, false);
        if (locala1.b())
        {
          Bitmap localBitmap = locala1.c();
          float f1 = locala.h();
          com.google.android.m4b.maps.bk.i.a().a();
          if (locala.g().contains("/road_shields/"));
          for (float f2 = f1 * paramc.m; ; f2 = f1 * paramc.n)
          {
            ((ArrayList)localObject1).add(new a(localBitmap, f2 * paramb.g(), parama));
            localObject2 = localObject1;
            break;
          }
        }
        return null;
      }
      if (locala.e())
      {
        ((ArrayList)localObject1).add(new b(locala.k()));
        localObject2 = localObject1;
      }
      else if (locala.f())
      {
        ArrayList localArrayList3 = new ArrayList();
        localArrayList1.add(localArrayList3);
        localObject2 = localArrayList3;
        continue;
        return new i(localArrayList1, c.a(params.c().a()), f.a(params.c().b()));
      }
      else
      {
        localObject2 = localObject1;
      }
    }
  }

  private void a(e parame)
  {
    this.g.f();
    this.h.b(parame);
    this.g.a(4 * this.d.size());
    float f1 = this.j - this.k;
    int i1 = 0;
    int i2 = 0;
    float f2;
    float f5;
    label168: e locale1;
    float f7;
    float f8;
    float f9;
    if (i2 < this.c.size())
    {
      ArrayList localArrayList1 = (ArrayList)this.c.get(i2);
      Iterator localIterator1 = localArrayList1.iterator();
      f2 = 0.0F;
      e locale2;
      for (float f3 = 0.0F; localIterator1.hasNext(); f3 += locale2.a())
      {
        locale2 = (e)localIterator1.next();
        f2 = Math.max(f2, locale2.e());
      }
      float f4;
      if (this.a == c.a)
        f4 = (this.i - f3) / 2.0F;
      while (true)
      {
        Iterator localIterator2 = localArrayList1.iterator();
        for (f5 = f4; ; f5 += locale1.a())
        {
          if (!localIterator2.hasNext())
            break label499;
          locale1 = (e)localIterator2.next();
          if (!(locale1 instanceof b))
            break;
        }
        c localc1 = this.a;
        c localc2 = c.c;
        f4 = 0.0F;
        if (localc1 == localc2)
          f4 = this.i - f3;
      }
      f7 = locale1.a();
      f8 = locale1.b();
      if (this.b == f.a)
        f9 = f1 - (f2 - locale1.e()) / 2.0F;
    }
    while (true)
    {
      float f10 = f9 + locale1.c();
      ArrayList localArrayList2 = this.d;
      int i3 = i1 + 1;
      com.google.android.m4b.maps.bo.l locall = (com.google.android.m4b.maps.bo.l)localArrayList2.get(i1);
      float f11 = locall.b();
      float f12 = locall.c();
      this.e.a(f5, 0.0F, f10 - f8);
      this.e.a(f5 + f7, 0.0F, f10 - f8);
      this.e.a(f7 + f5, 0.0F, f10);
      this.e.a(f5, 0.0F, f10);
      this.f.a(0.0F, f12);
      this.f.a(f11, f12);
      this.f.a(f11, 0.0F);
      this.f.a(0.0F, 0.0F);
      f5 += locale1.a();
      i1 = i3;
      break label168;
      if (this.b == f.c)
      {
        f9 = f1 - (f2 - locale1.e());
        continue;
        label499: float f6 = f1 - f2;
        i2++;
        f1 = f6;
        break;
        this.n = false;
        this.g.c();
        this.h.a(this.g.e());
        return;
      }
      f9 = f1;
    }
  }

  private void d()
  {
    float f1 = 0.0F;
    this.i = 0.0F;
    int i1 = 0;
    float f2 = 0.0F;
    while (i1 < this.c.size())
    {
      Iterator localIterator7 = ((ArrayList)this.c.get(i1)).iterator();
      float f12 = 0.0F;
      float f13 = 0.0F;
      while (localIterator7.hasNext())
      {
        e locale7 = (e)localIterator7.next();
        f13 += locale7.a();
        f12 = Math.max(f12, locale7.e());
      }
      this.i = Math.max(this.i, f13);
      f2 += f12;
      i1++;
    }
    ArrayList localArrayList1 = (ArrayList)this.c.get(0);
    ArrayList localArrayList2 = (ArrayList)this.c.get(-1 + this.c.size());
    this.k = 0.0F;
    this.l = 0.0F;
    switch (1.a[this.b.ordinal()])
    {
    default:
    case 1:
    case 2:
    case 3:
    }
    while (true)
    {
      this.j = (f2 + this.k + this.l);
      return;
      Iterator localIterator5 = localArrayList1.iterator();
      while (localIterator5.hasNext())
      {
        e locale6 = (e)localIterator5.next();
        this.k = Math.max(this.k, locale6.c());
      }
      Iterator localIterator6 = localArrayList2.iterator();
      float f10 = 0.0F;
      while (localIterator6.hasNext())
      {
        e locale5 = (e)localIterator6.next();
        float f11 = locale5.e();
        f10 = Math.max(f10, f11);
        f1 = Math.max(f1, f11 + locale5.d());
      }
      if (f1 > f10)
      {
        this.l = (f1 - f10);
        continue;
        Iterator localIterator3 = localArrayList1.iterator();
        float f8 = 0.0F;
        while (localIterator3.hasNext())
        {
          e locale4 = (e)localIterator3.next();
          float f9 = locale4.e();
          f8 = Math.max(f8, f9);
          f1 = Math.max(f1, f9 + locale4.c());
        }
        if (f1 > f8)
          this.k = (f1 - f8);
        Iterator localIterator4 = localArrayList2.iterator();
        while (localIterator4.hasNext())
        {
          e locale3 = (e)localIterator4.next();
          this.l = Math.max(this.l, locale3.d());
        }
        Iterator localIterator1 = localArrayList1.iterator();
        float f3 = 0.0F;
        float f4 = 0.0F;
        while (localIterator1.hasNext())
        {
          e locale2 = (e)localIterator1.next();
          float f7 = locale2.e() / 2.0F;
          f4 = Math.max(f4, f7);
          f3 = Math.max(f3, f7 + locale2.c());
        }
        if (f3 > f4)
          this.k = (f3 - f4);
        Iterator localIterator2 = localArrayList2.iterator();
        float f5 = 0.0F;
        while (localIterator2.hasNext())
        {
          e locale1 = (e)localIterator2.next();
          float f6 = locale1.e() / 2.0F;
          f5 = Math.max(f5, f6);
          f1 = Math.max(f1, f6 + locale1.d());
        }
        if (f1 > f5)
          this.l = (f1 - f5);
      }
    }
  }

  public final float a()
  {
    return this.i;
  }

  public final void a(e parame, com.google.android.m4b.maps.bn.b paramb, j paramj)
  {
    int i1 = 0;
    com.google.android.m4b.maps.bl.i locali;
    label71: com.google.android.m4b.maps.bo.l locall;
    int i2;
    label162: int i3;
    if (!this.m)
    {
      locali = paramj.a();
      if (!this.d.isEmpty())
        throw new IllegalStateException("this.textureArray should be empty.");
      Iterator localIterator1 = this.c.iterator();
      if (localIterator1.hasNext())
      {
        Iterator localIterator4 = ((ArrayList)localIterator1.next()).iterator();
        while (true)
          if (localIterator4.hasNext())
          {
            e locale2 = (e)localIterator4.next();
            if (!(locale2 instanceof b))
            {
              locall = locale2.a(locali);
              if (locall == null)
              {
                Iterator localIterator5 = this.d.iterator();
                while (localIterator5.hasNext())
                  ((com.google.android.m4b.maps.bo.l)localIterator5.next()).f();
                this.d.clear();
                i2 = 0;
                if (i2 != 0)
                  break label311;
                if (parame.a(10000))
                  break label205;
                i3 = 0;
                label180: if (i3 != 0)
                  break label327;
              }
            }
          }
      }
    }
    while (true)
    {
      return;
      this.d.add(locall);
      break label71;
      break;
      i2 = 1;
      break label162;
      label205: if (!this.d.isEmpty())
        throw new IllegalStateException("this.textureArray should be empty on initialize.");
      Iterator localIterator2 = this.c.iterator();
      while (localIterator2.hasNext())
      {
        Iterator localIterator3 = ((ArrayList)localIterator2.next()).iterator();
        while (localIterator3.hasNext())
        {
          e locale1 = (e)localIterator3.next();
          if (!(locale1 instanceof b))
            this.d.add(locale1.a(parame, locali));
        }
      }
      label311: a(parame);
      this.m = true;
      i3 = 1;
      break label180;
      label327: if (this.n)
        a(parame);
      GL10 localGL10 = parame.x();
      if (this.h.a() != 0)
      {
        this.h.a(parame);
        while (i1 < this.d.size())
        {
          ((com.google.android.m4b.maps.bo.l)this.d.get(i1)).a(localGL10);
          localGL10.glDrawArrays(6, i1 * 4, 4);
          i1++;
        }
      }
    }
  }

  public final void a(c paramc)
  {
    if (this.a != paramc)
      this.n = true;
    this.a = paramc;
  }

  public final float b()
  {
    return this.j;
  }

  public final void b(e parame)
  {
    Iterator localIterator1 = this.d.iterator();
    while (localIterator1.hasNext())
      ((com.google.android.m4b.maps.bo.l)localIterator1.next()).f();
    this.d.clear();
    Iterator localIterator2 = this.c.iterator();
    while (localIterator2.hasNext())
    {
      ArrayList localArrayList = (ArrayList)localIterator2.next();
      Iterator localIterator3 = localArrayList.iterator();
      while (localIterator3.hasNext())
        ((e)localIterator3.next()).f();
      localArrayList.clear();
    }
    this.c.clear();
    this.h.d(parame);
  }

  public final void c(e parame)
  {
    b(parame);
    this.h.c(parame);
  }

  public final boolean c()
  {
    return (this.c.isEmpty()) || (this.i == 0.0F) || (this.j == 0.0F);
  }

  public static final class a
    implements i.e
  {
    private final Bitmap a;
    private final l.a<Bitmap> b;
    private final int c;
    private final int d;

    a(Bitmap paramBitmap, float paramFloat, l.a<Bitmap> parama)
    {
      this.a = paramBitmap;
      this.b = parama;
      this.c = ((int)(paramFloat * this.a.getWidth()));
      this.d = ((int)(paramFloat * this.a.getHeight()));
    }

    public final float a()
    {
      return this.c;
    }

    public final com.google.android.m4b.maps.bo.l a(com.google.android.m4b.maps.bl.i parami)
    {
      com.google.android.m4b.maps.bo.l locall = (com.google.android.m4b.maps.bo.l)this.b.b(this.a);
      if (locall != null)
        locall.e();
      return locall;
    }

    public final com.google.android.m4b.maps.bo.l a(e parame, com.google.android.m4b.maps.bl.i parami)
    {
      boolean bool = true;
      com.google.android.m4b.maps.bo.l locall = (com.google.android.m4b.maps.bo.l)this.b.b(this.a);
      if (locall == null)
      {
        locall = new com.google.android.m4b.maps.bo.l(parame, false);
        locall.c(bool);
        locall.d(false);
        if (Build.VERSION.SDK_INT < 9)
          break label94;
        if ((!bool) || (com.google.android.m4b.maps.am.b.c))
          break label99;
        locall.a(this.a);
      }
      while (true)
      {
        this.b.c(this.a, locall);
        locall.e();
        return locall;
        label94: bool = false;
        break;
        label99: locall.b(this.a);
      }
    }

    public final float b()
    {
      return this.d;
    }

    public final float c()
    {
      return 0.0F;
    }

    public final float d()
    {
      return 0.0F;
    }

    public final float e()
    {
      return this.d;
    }

    public final void f()
    {
    }
  }

  static final class b
    implements i.e
  {
    private float a;

    b(float paramFloat)
    {
      this.a = paramFloat;
    }

    public final float a()
    {
      return this.a;
    }

    public final com.google.android.m4b.maps.bo.l a(com.google.android.m4b.maps.bl.i parami)
    {
      return null;
    }

    public final com.google.android.m4b.maps.bo.l a(e parame, com.google.android.m4b.maps.bl.i parami)
    {
      return null;
    }

    public final float b()
    {
      return 0.0F;
    }

    public final float c()
    {
      return 0.0F;
    }

    public final float d()
    {
      return 0.0F;
    }

    public final float e()
    {
      return 0.0F;
    }

    public final void f()
    {
    }
  }

  public static enum c
  {
    static
    {
      c[] arrayOfc = new c[3];
      arrayOfc[0] = a;
      arrayOfc[1] = b;
      arrayOfc[2] = c;
    }

    public static c a(int paramInt)
    {
      switch (paramInt)
      {
      default:
        throw new IllegalArgumentException("Unknown justification");
      case 1:
        return a;
      case 2:
        return b;
      case 3:
      }
      return c;
    }
  }

  public static final class d
    implements i.e
  {
    private final ak a;
    private final String b;
    private final int c;
    private final as d;
    private final ak.a e;
    private final float f;
    private final float g;
    private final float h;
    private final float i;
    private final int j;

    d(ak paramak, String paramString, int paramInt, as paramas, ak.a parama)
    {
      this.a = paramak;
      this.b = paramString;
      this.c = paramInt;
      this.d = paramas;
      float f1 = 1.0F;
      int k;
      ay localay;
      label92: float[] arrayOfFloat;
      if (paramas.f())
      {
        k = paramas.j().b();
        this.j = k;
        if (paramas.e())
          f1 = paramas.i().g();
        this.e = parama;
        if (this.d == null)
          break label158;
        localay = this.d.i();
        arrayOfFloat = paramak.a(paramString, parama, localay, paramInt, true, f1);
        if (parama != ak.b)
          break label164;
      }
      label158: label164: for (this.f = (0.8F * arrayOfFloat[0]); ; this.f = arrayOfFloat[0])
      {
        this.g = arrayOfFloat[1];
        this.h = arrayOfFloat[2];
        this.i = arrayOfFloat[3];
        return;
        k = 0;
        break;
        localay = null;
        break label92;
      }
    }

    public final float a()
    {
      return this.f;
    }

    public final com.google.android.m4b.maps.bo.l a(com.google.android.m4b.maps.bl.i parami)
    {
      ak localak = this.a;
      String str = this.b;
      ak.a locala = this.e;
      if (this.d != null);
      for (ay localay = this.d.i(); ; localay = null)
        return localak.a(str, locala, localay, this.c, h.a(this.d, parami), h.b(this.d, parami), this.j);
    }

    public final com.google.android.m4b.maps.bo.l a(e parame, com.google.android.m4b.maps.bl.i parami)
    {
      int k = h.b(this.d, parami);
      int m = h.a(this.d, parami);
      if (this.j != 0)
      {
        k = 0;
        if (parami != com.google.android.m4b.maps.bl.i.b)
        {
          com.google.android.m4b.maps.bl.i locali = com.google.android.m4b.maps.bl.i.c;
          k = 0;
          if (parami != locali);
        }
        else
        {
          m = h.b(this.j);
        }
      }
      ak localak = this.a;
      String str = this.b;
      ak.a locala = this.e;
      if (this.d != null);
      for (ay localay = this.d.i(); ; localay = null)
        return localak.a(parame, str, locala, localay, this.c, m, k, this.j);
    }

    public final float b()
    {
      return this.g;
    }

    public final float c()
    {
      return this.h;
    }

    public final float d()
    {
      return this.i;
    }

    public final float e()
    {
      return this.g - this.h - this.i;
    }

    public final void f()
    {
    }
  }

  @VisibleForTesting
  static abstract interface e
  {
    public abstract float a();

    public abstract com.google.android.m4b.maps.bo.l a(com.google.android.m4b.maps.bl.i parami);

    public abstract com.google.android.m4b.maps.bo.l a(e parame, com.google.android.m4b.maps.bl.i parami);

    public abstract float b();

    public abstract float c();

    public abstract float d();

    public abstract float e();

    public abstract void f();
  }

  public static enum f
  {
    static
    {
      f[] arrayOff = new f[3];
      arrayOff[0] = a;
      arrayOff[1] = b;
      arrayOff[2] = c;
    }

    public static f a(int paramInt)
    {
      switch (paramInt)
      {
      default:
        throw new IllegalArgumentException("Unknown alignment");
      case 1:
        return a;
      case 2:
        return b;
      case 3:
      }
      return c;
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bq.i
 * JD-Core Version:    0.6.2
 */