package com.google.android.gms.internal.p002firebaseauthapi;

import A0.a;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.Base64Utils;
import java.io.UnsupportedEncodingException;
import java.util.List;

/* JADX INFO: loaded from: classes3.dex */
public final class zzagy {
    public static long zza(String str) {
        zzagx zzagxVarZzb = zzb(str);
        return zzagxVarZzb.zza().longValue() - zzagxVarZzb.zzb().longValue();
    }

    private static zzagx zzb(String str) {
        Preconditions.checkNotEmpty(str);
        List<String> listZza = zzv.zza('.').zza((CharSequence) str);
        if (listZza.size() < 2) {
            throw new RuntimeException(a.n("Invalid idToken ", str));
        }
        try {
            return zzagx.zza(new String(Base64Utils.decodeUrlSafeNoPadding(listZza.get(1)), "UTF-8"));
        } catch (UnsupportedEncodingException e6) {
            throw new RuntimeException("Unable to decode token", e6);
        }
    }
}
