package o; import java.util.Locale; import org.threeten.bp.DateTimeException; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gtu, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15560gtu { private Locale locale; private int optional; private C15559gtt symbols; private gtK temporal; /* JADX INFO: Access modifiers changed from: package-private */ public C15560gtu(gtK gtk, C15554gto c15554gto) { this.temporal = adjust(gtk, c15554gto); this.locale = c15554gto.getLocale(); this.symbols = c15554gto.getDecimalStyle(); } C15560gtu(gtK gtk, Locale locale, C15559gtt c15559gtt) { this.temporal = gtk; this.locale = locale; this.symbols = c15559gtt; } private static gtK adjust(gtK gtk, C15554gto c15554gto) { gsR chronology = c15554gto.getChronology(); AbstractC15502gsH zone = c15554gto.getZone(); if (chronology == null && zone == null) { return gtk; } gsR gsr = (gsR) gtk.query(gtM.chronology()); AbstractC15502gsH abstractC15502gsH = (AbstractC15502gsH) gtk.query(gtM.zoneId()); gsJ gsj = null; if (gtG.equals(gsr, chronology)) { chronology = null; } if (gtG.equals(abstractC15502gsH, zone)) { zone = null; } if (chronology == null && zone == null) { return gtk; } gsR gsr2 = chronology != null ? chronology : gsr; if (zone != null) { abstractC15502gsH = zone; } if (zone != null) { if (gtk.isSupported(EnumC15534gtD.INSTANT_SECONDS)) { if (gsr2 == null) { gsr2 = gsV.INSTANCE; } return gsr2.zonedDateTime(C15523gss.from(gtk), zone); } AbstractC15502gsH normalized = zone.normalized(); gsI gsi = (gsI) gtk.query(gtM.offset()); if ((normalized instanceof gsI) && gsi != null && !normalized.equals(gsi)) { StringBuilder sb = new StringBuilder("Invalid override zone for temporal: "); sb.append(zone); sb.append(" "); sb.append(gtk); throw new DateTimeException(sb.toString()); } } if (chronology != null) { if (gtk.isSupported(EnumC15534gtD.EPOCH_DAY)) { gsj = gsr2.date(gtk); } else if (chronology != gsV.INSTANCE || gsr != null) { for (EnumC15534gtD enumC15534gtD : EnumC15534gtD.values()) { if (enumC15534gtD.isDateBased() && gtk.isSupported(enumC15534gtD)) { StringBuilder sb2 = new StringBuilder("Invalid override chronology for temporal: "); sb2.append(chronology); sb2.append(" "); sb2.append(gtk); throw new DateTimeException(sb2.toString()); } } } } return new gtE(gsj, gtk, gsr2, abstractC15502gsH) { // from class: o.gtu.5 final gsR val$effectiveChrono; final gsJ val$effectiveDate; final AbstractC15502gsH val$effectiveZone; final gtK val$temporal; { this.val$effectiveDate = gsj; this.val$temporal = gtk; this.val$effectiveChrono = gsr2; this.val$effectiveZone = abstractC15502gsH; } @Override // o.gtK public final boolean isSupported(InterfaceC15537gtP interfaceC15537gtP) { if (this.val$effectiveDate != null && interfaceC15537gtP.isDateBased()) { return this.val$effectiveDate.isSupported(interfaceC15537gtP); } return this.val$temporal.isSupported(interfaceC15537gtP); } @Override // o.gtE, o.gtK public final gtT range(InterfaceC15537gtP interfaceC15537gtP) { if (this.val$effectiveDate != null && interfaceC15537gtP.isDateBased()) { return this.val$effectiveDate.range(interfaceC15537gtP); } return this.val$temporal.range(interfaceC15537gtP); } @Override // o.gtK public final long getLong(InterfaceC15537gtP interfaceC15537gtP) { if (this.val$effectiveDate != null && interfaceC15537gtP.isDateBased()) { return this.val$effectiveDate.getLong(interfaceC15537gtP); } return this.val$temporal.getLong(interfaceC15537gtP); } @Override // o.gtE, o.gtK public final R query(gtQ gtq) { if (gtq == gtM.chronology()) { return (R) this.val$effectiveChrono; } if (gtq == gtM.zoneId()) { return (R) this.val$effectiveZone; } if (gtq == gtM.precision()) { return (R) this.val$temporal.query(gtq); } return gtq.queryFrom(this); } }; } /* JADX INFO: Access modifiers changed from: package-private */ public final R getValue(gtQ gtq) { R r = (R) this.temporal.query(gtq); if (r != null || this.optional != 0) { return r; } StringBuilder sb = new StringBuilder("Unable to extract value: "); sb.append(this.temporal.getClass()); throw new DateTimeException(sb.toString()); } /* JADX INFO: Access modifiers changed from: package-private */ public final Long getValue(InterfaceC15537gtP interfaceC15537gtP) { try { return Long.valueOf(this.temporal.getLong(interfaceC15537gtP)); } catch (DateTimeException e) { if (this.optional > 0) { return null; } throw e; } } public final String toString() { return this.temporal.toString(); } final void setDateTime(gtK gtk) { gtG.requireNonNull(gtk, "temporal"); this.temporal = gtk; } final void setLocale(Locale locale) { gtG.requireNonNull(locale, "locale"); this.locale = locale; } /* JADX INFO: Access modifiers changed from: package-private */ public final void startOptional() { this.optional++; } /* JADX INFO: Access modifiers changed from: package-private */ public final gtK getTemporal() { return this.temporal; } /* JADX INFO: Access modifiers changed from: package-private */ public final C15559gtt getSymbols() { return this.symbols; } /* JADX INFO: Access modifiers changed from: package-private */ public final Locale getLocale() { return this.locale; } /* JADX INFO: Access modifiers changed from: package-private */ public final void endOptional() { this.optional--; } }