package o; import com.google.zxing.WriterException; import java.util.Map; /* loaded from: classes2.dex */ public final class VjS implements InterfaceC16283mxN { @Override // o.InterfaceC16283mxN public final C8902dZc d(String str, PTS pts, int i, int i2, Map map) throws WriterException { if (str.isEmpty()) { throw new IllegalArgumentException("Found empty contents"); } if (pts != PTS.QR_CODE) { throw new IllegalArgumentException("Can only encode QR_CODE, but got ".concat(String.valueOf(pts))); } if (i < 0 || i2 < 0) { StringBuilder sb = new StringBuilder("Requested dimensions are too small: "); sb.append(i); sb.append('x'); sb.append(i2); throw new IllegalArgumentException(sb.toString()); } FVz fVz = FVz.L; int i3 = 4; if (map != null) { if (map.containsKey(EnumC14826gQH.ERROR_CORRECTION)) { fVz = FVz.valueOf(map.get(EnumC14826gQH.ERROR_CORRECTION).toString()); } if (map.containsKey(EnumC14826gQH.MARGIN)) { i3 = Integer.parseInt(map.get(EnumC14826gQH.MARGIN).toString()); } } mUk muk = VNp.b(str, fVz, map).b; if (muk == null) { throw new IllegalStateException(); } int i4 = muk.c; int i5 = muk.d; int i6 = i3 << 1; int i7 = i4 + i6; int i8 = i6 + i5; int max = Math.max(i, i7); int max2 = Math.max(i2, i8); int min = Math.min(max / i7, max2 / i8); int i9 = (max - (i4 * min)) / 2; int i10 = (max2 - (i5 * min)) / 2; C8902dZc c8902dZc = new C8902dZc(max, max2); int i11 = 0; while (i11 < i5) { int i12 = 0; int i13 = i9; while (i12 < i4) { if (muk.e[i11][i12] == 1) { c8902dZc.b(i13, i10, min, min); } i12++; i13 += min; } i11++; i10 += min; } return c8902dZc; } }