package kotlin.reflect.jvm.internal.impl.name;

import com.google.android.gms.measurement.api.AppMeasurementSdk;
import defpackage.cr4;
import defpackage.kp6;
import defpackage.m15;
import defpackage.pq6;
import defpackage.uz1;
import defpackage.vx8;
import defpackage.x15;
import java.util.List;

/* JADX INFO: loaded from: classes3.dex */
@vx8
public final class FqName {

    @kp6
    public static final Companion Companion = new Companion(null);

    @kp6
    @m15
    public static final FqName ROOT = new FqName("");

    @kp6
    private final FqNameUnsafe fqName;

    @pq6
    private transient FqName parent;

    public static final class Companion {
        public /* synthetic */ Companion(uz1 uz1Var) {
            this();
        }

        @x15
        @kp6
        public final FqName topLevel(@kp6 Name name) {
            cr4.g(name, "shortName");
            return new FqName(FqNameUnsafe.Companion.topLevel(name));
        }

        private Companion() {
        }
    }

    public FqName(@kp6 String str) {
        cr4.g(str, "fqName");
        this.fqName = new FqNameUnsafe(str, this);
    }

    @kp6
    public final String asString() {
        return this.fqName.asString();
    }

    @kp6
    public final FqName child(@kp6 Name name) {
        cr4.g(name, AppMeasurementSdk.ConditionalUserProperty.NAME);
        return new FqName(this.fqName.child(name), this);
    }

    public boolean equals(@pq6 Object obj) {
        if (this == obj) {
            return true;
        }
        return (obj instanceof FqName) && cr4.b(this.fqName, ((FqName) obj).fqName);
    }

    public int hashCode() {
        return this.fqName.hashCode();
    }

    public final boolean isRoot() {
        return this.fqName.isRoot();
    }

    @kp6
    public final FqName parent() {
        FqName fqName = this.parent;
        if (fqName != null) {
            return fqName;
        }
        if (isRoot()) {
            throw new IllegalStateException("root");
        }
        FqName fqName2 = new FqName(this.fqName.parent());
        this.parent = fqName2;
        return fqName2;
    }

    @kp6
    public final List<Name> pathSegments() {
        return this.fqName.pathSegments();
    }

    @kp6
    public final Name shortName() {
        return this.fqName.shortName();
    }

    @kp6
    public final Name shortNameOrSpecial() {
        return this.fqName.shortNameOrSpecial();
    }

    public final boolean startsWith(@kp6 Name name) {
        cr4.g(name, "segment");
        return this.fqName.startsWith(name);
    }

    @kp6
    public String toString() {
        return this.fqName.toString();
    }

    @kp6
    public final FqNameUnsafe toUnsafe() {
        return this.fqName;
    }

    public FqName(@kp6 FqNameUnsafe fqNameUnsafe) {
        cr4.g(fqNameUnsafe, "fqName");
        this.fqName = fqNameUnsafe;
    }

    private FqName(FqNameUnsafe fqNameUnsafe, FqName fqName) {
        this.fqName = fqNameUnsafe;
        this.parent = fqName;
    }
}
