package androidx.compose.foundation; import androidx.compose.ui.Modifier; import androidx.compose.ui.layout.PinnableContainer; import androidx.compose.ui.layout.PinnableContainerKt; import androidx.compose.ui.node.CompositionLocalConsumerModifierNode; import androidx.compose.ui.node.CompositionLocalConsumerModifierNodeKt; import androidx.compose.ui.node.ObserverModifierNode; import androidx.compose.ui.node.ObserverModifierNodeKt; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Ref; /* compiled from: Focusable.kt */ @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0002\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u0005¢\u0006\u0002\u0010\u0004J\b\u0010\t\u001a\u00020\nH\u0016J\b\u0010\u000b\u001a\u00020\nH\u0016J\n\u0010\f\u001a\u0004\u0018\u00010\rH\u0002J\u000e\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000f\u001a\u00020\u0006R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0010"}, d2 = {"Landroidx/compose/foundation/FocusablePinnableContainerNode;", "Landroidx/compose/ui/Modifier$Node;", "Landroidx/compose/ui/node/CompositionLocalConsumerModifierNode;", "Landroidx/compose/ui/node/ObserverModifierNode;", "()V", "isFocused", "", "pinnedHandle", "Landroidx/compose/ui/layout/PinnableContainer$PinnedHandle;", "onObservedReadsChanged", "", "onReset", "retrievePinnableContainer", "Landroidx/compose/ui/layout/PinnableContainer;", "setFocus", "focused", "foundation_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ final class FocusablePinnableContainerNode extends Modifier.Node implements CompositionLocalConsumerModifierNode, ObserverModifierNode { private boolean isFocused; private PinnableContainer.PinnedHandle pinnedHandle; private final PinnableContainer retrievePinnableContainer() { final Ref.ObjectRef objectRef = new Ref.ObjectRef(); ObserverModifierNodeKt.observeReads(this, new Function0() { // from class: androidx.compose.foundation.FocusablePinnableContainerNode$retrievePinnableContainer$1 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* JADX WARN: Type inference failed for: r2v3, types: [T, java.lang.Object] */ /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { objectRef.element = CompositionLocalConsumerModifierNodeKt.currentValueOf(this, PinnableContainerKt.getLocalPinnableContainer()); } }); return (PinnableContainer) objectRef.element; } public final void setFocus(boolean focused) { if (focused) { PinnableContainer retrievePinnableContainer = retrievePinnableContainer(); this.pinnedHandle = retrievePinnableContainer != null ? retrievePinnableContainer.pin() : null; } else { PinnableContainer.PinnedHandle pinnedHandle = this.pinnedHandle; if (pinnedHandle != null) { pinnedHandle.release(); } this.pinnedHandle = null; } this.isFocused = focused; } @Override // androidx.compose.ui.Modifier.Node public void onReset() { PinnableContainer.PinnedHandle pinnedHandle = this.pinnedHandle; if (pinnedHandle != null) { pinnedHandle.release(); } this.pinnedHandle = null; } @Override // androidx.compose.ui.node.ObserverModifierNode public void onObservedReadsChanged() { PinnableContainer retrievePinnableContainer = retrievePinnableContainer(); if (this.isFocused) { PinnableContainer.PinnedHandle pinnedHandle = this.pinnedHandle; if (pinnedHandle != null) { pinnedHandle.release(); } this.pinnedHandle = retrievePinnableContainer != null ? retrievePinnableContainer.pin() : null; } } }