package androidx.compose.ui.viewinterop; import android.content.Context; import android.os.Parcelable; import android.util.SparseArray; import android.view.View; import androidx.compose.runtime.CompositionContext; import androidx.compose.runtime.saveable.SaveableStateRegistry; import androidx.compose.ui.input.nestedscroll.NestedScrollDispatcher; import androidx.compose.ui.platform.ViewRootForInspector; import androidx.exifinterface.media.ExifInterface; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* compiled from: AndroidView.android.kt */ @Metadata(d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\n\b\u0000\u0018\u0000*\b\b\u0000\u0010\u0001*\u00020\u00022\u00020\u00032\u00020\u0004BA\b\u0016\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0012\u0010\u0007\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00028\u00000\b\u0012\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\n\u0012\b\u0010\u000b\u001a\u0004\u0018\u00010\f\u0012\u0006\u0010\r\u001a\u00020\u000e¢\u0006\u0002\u0010\u000fB?\b\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\n\u0012\u0006\u0010\u0010\u001a\u00028\u0000\u0012\b\b\u0002\u0010\u0011\u001a\u00020\u0012\u0012\b\u0010\u000b\u001a\u0004\u0018\u00010\f\u0012\u0006\u0010\r\u001a\u00020\u000e¢\u0006\u0002\u0010\u0013J\b\u0010-\u001a\u00020\u0017H\u0002J\b\u0010.\u001a\u00020\u0017H\u0002R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0011\u001a\u00020\u0012¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R<\u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b2\u0012\u0010\u0016\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0019\u0010\u001a\"\u0004\b\u001b\u0010\u001cR<\u0010\u001d\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b2\u0012\u0010\u0016\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001e\u0010\u001a\"\u0004\b\u001f\u0010\u001cR\"\u0010!\u001a\u0004\u0018\u00010 2\b\u0010\u0016\u001a\u0004\u0018\u00010 @BX\u0082\u000e¢\u0006\b\n\u0000\"\u0004\b\"\u0010#R\u000e\u0010$\u001a\u00020%X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0010\u001a\u00028\u0000X\u0082\u0004¢\u0006\u0004\n\u0002\u0010&R<\u0010'\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b2\u0012\u0010\u0016\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u00170\b@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b(\u0010\u001a\"\u0004\b)\u0010\u001cR\u0014\u0010*\u001a\u00020\u00028VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b+\u0010,¨\u0006/"}, d2 = {"Landroidx/compose/ui/viewinterop/ViewFactoryHolder;", ExifInterface.GPS_DIRECTION_TRUE, "Landroid/view/View;", "Landroidx/compose/ui/viewinterop/AndroidViewHolder;", "Landroidx/compose/ui/platform/ViewRootForInspector;", "context", "Landroid/content/Context;", "factory", "Lkotlin/Function1;", "parentContext", "Landroidx/compose/runtime/CompositionContext;", "saveStateRegistry", "Landroidx/compose/runtime/saveable/SaveableStateRegistry;", "compositeKeyHash", "", "(Landroid/content/Context;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/CompositionContext;Landroidx/compose/runtime/saveable/SaveableStateRegistry;I)V", "typedView", "dispatcher", "Landroidx/compose/ui/input/nestedscroll/NestedScrollDispatcher;", "(Landroid/content/Context;Landroidx/compose/runtime/CompositionContext;Landroid/view/View;Landroidx/compose/ui/input/nestedscroll/NestedScrollDispatcher;Landroidx/compose/runtime/saveable/SaveableStateRegistry;I)V", "getDispatcher", "()Landroidx/compose/ui/input/nestedscroll/NestedScrollDispatcher;", "value", "", "releaseBlock", "getReleaseBlock", "()Lkotlin/jvm/functions/Function1;", "setReleaseBlock", "(Lkotlin/jvm/functions/Function1;)V", "resetBlock", "getResetBlock", "setResetBlock", "Landroidx/compose/runtime/saveable/SaveableStateRegistry$Entry;", "savableRegistryEntry", "setSavableRegistryEntry", "(Landroidx/compose/runtime/saveable/SaveableStateRegistry$Entry;)V", "saveStateKey", "", "Landroid/view/View;", "updateBlock", "getUpdateBlock", "setUpdateBlock", "viewRoot", "getViewRoot", "()Landroid/view/View;", "registerSaveStateProvider", "unregisterSaveStateProvider", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class ViewFactoryHolder extends AndroidViewHolder implements ViewRootForInspector { private final int compositeKeyHash; private final NestedScrollDispatcher dispatcher; private Function1 releaseBlock; private Function1 resetBlock; private SaveableStateRegistry.Entry savableRegistryEntry; private final String saveStateKey; private final SaveableStateRegistry saveStateRegistry; private final T typedView; private Function1 updateBlock; public final NestedScrollDispatcher getDispatcher() { return this.dispatcher; } public final Function1 getReleaseBlock() { return this.releaseBlock; } public final Function1 getResetBlock() { return this.resetBlock; } public final Function1 getUpdateBlock() { return this.updateBlock; } /* synthetic */ ViewFactoryHolder(Context context, CompositionContext compositionContext, View view, NestedScrollDispatcher nestedScrollDispatcher, SaveableStateRegistry saveableStateRegistry, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) { this(context, (i2 & 2) != 0 ? null : compositionContext, view, (i2 & 8) != 0 ? new NestedScrollDispatcher() : nestedScrollDispatcher, saveableStateRegistry, i); } private ViewFactoryHolder(Context context, CompositionContext compositionContext, T t, NestedScrollDispatcher nestedScrollDispatcher, SaveableStateRegistry saveableStateRegistry, int i) { super(context, compositionContext, i, nestedScrollDispatcher, t); this.typedView = t; this.dispatcher = nestedScrollDispatcher; this.saveStateRegistry = saveableStateRegistry; this.compositeKeyHash = i; setClipChildren(false); String valueOf = String.valueOf(i); this.saveStateKey = valueOf; Object consumeRestored = saveableStateRegistry != null ? saveableStateRegistry.consumeRestored(valueOf) : null; SparseArray sparseArray = consumeRestored instanceof SparseArray ? (SparseArray) consumeRestored : null; if (sparseArray != null) { t.restoreHierarchyState(sparseArray); } registerSaveStateProvider(); this.updateBlock = AndroidView_androidKt.getNoOpUpdate(); this.resetBlock = AndroidView_androidKt.getNoOpUpdate(); this.releaseBlock = AndroidView_androidKt.getNoOpUpdate(); } public /* synthetic */ ViewFactoryHolder(Context context, Function1 function1, CompositionContext compositionContext, SaveableStateRegistry saveableStateRegistry, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) { this(context, function1, (i2 & 4) != 0 ? null : compositionContext, saveableStateRegistry, i); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public ViewFactoryHolder(Context context, Function1 factory, CompositionContext compositionContext, SaveableStateRegistry saveableStateRegistry, int i) { this(context, compositionContext, factory.invoke(context), null, saveableStateRegistry, i, 8, null); Intrinsics.checkNotNullParameter(context, "context"); Intrinsics.checkNotNullParameter(factory, "factory"); } @Override // androidx.compose.ui.platform.ViewRootForInspector public View getViewRoot() { return this; } private final void setSavableRegistryEntry(SaveableStateRegistry.Entry entry) { SaveableStateRegistry.Entry entry2 = this.savableRegistryEntry; if (entry2 != null) { entry2.unregister(); } this.savableRegistryEntry = entry; } public final void setUpdateBlock(Function1 value) { Intrinsics.checkNotNullParameter(value, "value"); this.updateBlock = value; setUpdate(new Function0(this) { // from class: androidx.compose.ui.viewinterop.ViewFactoryHolder$updateBlock$1 final /* synthetic */ ViewFactoryHolder this$0; /* 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); this.this$0 = this; } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { View view; view = ((ViewFactoryHolder) this.this$0).typedView; this.this$0.getUpdateBlock().invoke(view); } }); } public final void setResetBlock(Function1 value) { Intrinsics.checkNotNullParameter(value, "value"); this.resetBlock = value; setReset(new Function0(this) { // from class: androidx.compose.ui.viewinterop.ViewFactoryHolder$resetBlock$1 final /* synthetic */ ViewFactoryHolder this$0; /* 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); this.this$0 = this; } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { View view; view = ((ViewFactoryHolder) this.this$0).typedView; this.this$0.getResetBlock().invoke(view); } }); } public final void setReleaseBlock(Function1 value) { Intrinsics.checkNotNullParameter(value, "value"); this.releaseBlock = value; setRelease(new Function0(this) { // from class: androidx.compose.ui.viewinterop.ViewFactoryHolder$releaseBlock$1 final /* synthetic */ ViewFactoryHolder this$0; /* 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); this.this$0 = this; } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { View view; view = ((ViewFactoryHolder) this.this$0).typedView; this.this$0.getReleaseBlock().invoke(view); this.this$0.unregisterSaveStateProvider(); } }); } private final void registerSaveStateProvider() { SaveableStateRegistry saveableStateRegistry = this.saveStateRegistry; if (saveableStateRegistry != null) { setSavableRegistryEntry(saveableStateRegistry.registerProvider(this.saveStateKey, new Function0(this) { // from class: androidx.compose.ui.viewinterop.ViewFactoryHolder$registerSaveStateProvider$1 final /* synthetic */ ViewFactoryHolder this$0; /* 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); this.this$0 = this; } @Override // kotlin.jvm.functions.Function0 public final Object invoke() { View view; SparseArray sparseArray = new SparseArray<>(); view = ((ViewFactoryHolder) this.this$0).typedView; view.saveHierarchyState(sparseArray); return sparseArray; } })); } } /* JADX INFO: Access modifiers changed from: private */ public final void unregisterSaveStateProvider() { setSavableRegistryEntry(null); } }