content: package androidx.savedstate;
  
  import android.os.Bundle;
  import androidx.lifecycle.Lifecycle;
  import kotlin.Metadata;
  import kotlin.jvm.JvmStatic;
  import kotlin.jvm.internal.DefaultConstructorMarker;
  import kotlin.jvm.internal.Intrinsics;
  
  @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u0000 \u00122\u00020\u0001:\u0001\u0012B\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u000b\u001a\u00020\fH\u0007J\u0012\u0010\r\u001a\u00020\f2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0007J\u0010\u0010\u0010\u001a\u00020\f2\u0006\u0010\u0011\u001a\u00020\u000fH\u0007R\u000e\u0010\u0005\u001a\u00020\u0006X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0007\u001a\u00020\b¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\n¨\u0006\u0013"}, d2 = {"Landroidx/savedstate/SavedStateRegistryController;", "", "owner", "Landroidx/savedstate/SavedStateRegistryOwner;", "(Landroidx/savedstate/SavedStateRegistryOwner;)V", "attached", "", "savedStateRegistry", "Landroidx/savedstate/SavedStateRegistry;", "getSavedStateRegistry", "()Landroidx/savedstate/SavedStateRegistry;", "performAttach", "", "performRestore", "savedState", "Landroid/os/Bundle;", "performSave", "outBundle", "Companion", "savedstate_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
  /* compiled from: SavedStateRegistryController.kt */
  public final class SavedStateRegistryController {
      public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
      private boolean attached;
      private final SavedStateRegistryOwner owner;
      private final SavedStateRegistry savedStateRegistry;
  
      @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¨\u0006\u0007"}, d2 = {"Landroidx/savedstate/SavedStateRegistryController$Companion;", "", "()V", "create", "Landroidx/savedstate/SavedStateRegistryController;", "owner", "Landroidx/savedstate/SavedStateRegistryOwner;", "savedstate_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
      /* compiled from: SavedStateRegistryController.kt */
      public static final class Companion {
          private Companion() {
          }
  
          public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
              this();
          }
  
          @JvmStatic
          public final SavedStateRegistryController create(SavedStateRegistryOwner owner) {
              Intrinsics.checkNotNullParameter(owner, "owner");
              return new SavedStateRegistryController(owner, (DefaultConstructorMarker) null);
          }
      }
  
      private SavedStateRegistryController(SavedStateRegistryOwner owner2) {
          this.owner = owner2;
          this.savedStateRegistry = new SavedStateRegistry();
      }
  
      public /* synthetic */ SavedStateRegistryController(SavedStateRegistryOwner savedStateRegistryOwner, DefaultConstructorMarker defaultConstructorMarker) {
          this(savedStateRegistryOwner);
      }
  
      @JvmStatic
      public static final SavedStateRegistryController create(SavedStateRegistryOwner savedStateRegistryOwner) {
          return Companion.create(savedStateRegistryOwner);
      }
  
      public final SavedStateRegistry getSavedStateRegistry() {
          return this.savedStateRegistry;
      }
  
      public final void performAttach() {
          Lifecycle lifecycle = this.owner.getLifecycle();
          Intrinsics.checkNotNullExpressionValue(lifecycle, "owner.lifecycle");
          if (lifecycle.getCurrentState() == Lifecycle.State.INITIALIZED) {
              lifecycle.addObserver(new Recreator(this.owner));
              this.savedStateRegistry.performAttach$savedstate_release(lifecycle);
              this.attached = true;
              return;
          }
          throw new IllegalStateException("Restarter must be created only during owner's initialization stage".toString());
      }
  
      public final void performRestore(Bundle savedState) {
          if (!this.attached) {
              performAttach();
          }
          Lifecycle lifecycle = this.owner.getLifecycle();
          Intrinsics.checkNotNullExpressionValue(lifecycle, "owner.lifecycle");
          if (!lifecycle.getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
              this.savedStateRegistry.performRestore$savedstate_release(savedState);
              return;
          }
          throw new IllegalStateException(("performRestore cannot be called when owner is " + lifecycle.getCurrentState()).toString());
      }
  
      public final void performSave(Bundle outBundle) {
          Intrinsics.checkNotNullParameter(outBundle, "outBundle");
          this.savedStateRegistry.performSave(outBundle);
      }
  }
  