package com.discord.utilities.views; import android.view.View; import c.q.a.k.a; import d0.z.d.m; import kotlin.coroutines.CoroutineContext; import kotlin.jvm.internal.Ref$ObjectRef; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineScope; import s.a.a.n; import s.a.g1; import s.a.j0; import s.a.t; /* compiled from: ViewCoroutineScope.kt */ public final class ViewCoroutineScopeKt { private static final int SCOPE_TAG_KEY = -53661613; /* JADX WARNING: Unknown variable types count: 2 */ public static final CoroutineScope getCoroutineScope(View view) { m.checkNotNullParameter(view, "$this$coroutineScope"); if (!view.isAttachedToWindow()) { return null; } Ref$ObjectRef ref$ObjectRef = new Ref$ObjectRef(); int i = SCOPE_TAG_KEY; Object tag = view.getTag(i); if (!(tag instanceof CoroutineScope)) { tag = null; } ?? r3 = (CoroutineScope) tag; ref$ObjectRef.element = r3; if (((CoroutineScope) r3) != null) { return (CoroutineScope) r3; } t b = a.b(null, 1); CoroutineDispatcher coroutineDispatcher = j0.a; ref$ObjectRef.element = a.a(CoroutineContext.Element.a.plus((g1) b, n.b.H())); view.getViewTreeObserver().addOnWindowAttachListener(new ViewCoroutineScopeKt$coroutineScope$1(ref$ObjectRef)); view.setTag(i, ref$ObjectRef.element); return ref$ObjectRef.element; } }