package w2;

/* loaded from: classes.dex */
public final class o0 implements i {

    /* renamed from: a, reason: collision with root package name */
    private final q2.d f40795a;

    /* renamed from: b, reason: collision with root package name */
    private final int f40796b;

    public o0(q2.d dVar, int i10) {
        this.f40795a = dVar;
        this.f40796b = i10;
    }

    @Override // w2.i
    public void a(l lVar) {
        int k10;
        if (lVar.l()) {
            int f10 = lVar.f();
            lVar.m(lVar.f(), lVar.e(), c());
            if (c().length() > 0) {
                lVar.n(f10, c().length() + f10);
            }
        } else {
            int k11 = lVar.k();
            lVar.m(lVar.k(), lVar.j(), c());
            if (c().length() > 0) {
                lVar.n(k11, c().length() + k11);
            }
        }
        int g10 = lVar.g();
        int i10 = this.f40796b;
        k10 = jn.o.k(i10 > 0 ? (g10 + i10) - 1 : (g10 + i10) - c().length(), 0, lVar.h());
        lVar.o(k10);
    }

    public final int b() {
        return this.f40796b;
    }

    public final String c() {
        return this.f40795a.j();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof o0)) {
            return false;
        }
        o0 o0Var = (o0) obj;
        return kotlin.jvm.internal.t.b(c(), o0Var.c()) && this.f40796b == o0Var.f40796b;
    }

    public int hashCode() {
        return (c().hashCode() * 31) + this.f40796b;
    }

    public String toString() {
        return "SetComposingTextCommand(text='" + c() + "', newCursorPosition=" + this.f40796b + ')';
    }

    public o0(String str, int i10) {
        this(new q2.d(str, null, null, 6, null), i10);
    }
}
