// Path: conductor/src/main/java/com/bluelinelabs/conductor/ControllerChangeHandler.java
// public interface ControllerChangeListener {
//     /**
//      * Called when a {@link ControllerChangeHandler} has started changing {@link Controller}s
//      *
//      * @param to        The new Controller or {@code null} if no Controller is being transitioned to
//      * @param from      The old Controller or {@code null} if there was no Controller before this transition
//      * @param isPush    True if this is a push operation, or false if it's a pop.
//      * @param container The containing ViewGroup
//      * @param handler   The change handler being used.
//      */
//     void onChangeStarted(@Nullable Controller to, @Nullable Controller from, boolean isPush, @NonNull ViewGroup container, @NonNull ControllerChangeHandler handler);
// 
//     /**
//      * Called when a {@link ControllerChangeHandler} has completed changing {@link Controller}s
//      *
//      * @param to        The new Controller or {@code null} if no Controller is being transitioned to
//      * @param from      The old Controller or {@code null} if there was no Controller before this transition
//      * @param isPush    True if this was a push operation, or false if it's a pop
//      * @param container The containing ViewGroup
//      * @param handler   The change handler that was used.
//      */
//     void onChangeCompleted(@Nullable Controller to, @Nullable Controller from, boolean isPush, @NonNull ViewGroup container, @NonNull ControllerChangeHandler handler);
// }


import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.ViewGroup;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bluelinelabs.conductor.ControllerChangeHandler.ControllerChangeListener;
import com.bluelinelabs.conductor.internal.TransactionIndexer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
package com.bluelinelabs.conductor;





class ControllerHostedRouter extends Router {

    private final String KEY_HOST_ID = "ControllerHostedRouter.hostId";
    private final String KEY_TAG = "ControllerHostedRouter.tag";
    private final String KEY_BOUND_TO_CONTAINER = "ControllerHostedRouter.boundToContainer";

    private Controller hostController;

    @IdRes private int hostId;
    private String tag;
    private boolean isDetachFrozen;
    private boolean boundToContainer;

    ControllerHostedRouter() { }

    ControllerHostedRouter(int hostId, @Nullable String tag, boolean boundToContainer) {
        if (!boundToContainer && tag == null) {
            throw new IllegalStateException("ControllerHostedRouter can't be created without a tag if not bounded to its container");
        }
        this.hostId = hostId;
        this.tag = tag;
        this.boundToContainer = boundToContainer;
    }

    final void setHostController(@NonNull Controller controller) {
        if (hostController == null) {
            hostController = controller;
        }
    }

    final void setHostContainer(@NonNull Controller controller, @NonNull ViewGroup container) {
        if (hostController != controller || this.container != container) {
            removeHost();

// Path: conductor/src/main/java/com/bluelinelabs/conductor/ControllerChangeHandler.java
// public interface ControllerChangeListener {
//     /**
//      * Called when a {@link ControllerChangeHandler} has started changing {@link Controller}s
//      *
//      * @param to        The new Controller or {@code null} if no Controller is being transitioned to
//      * @param from      The old Controller or {@code null} if there was no Controller before this transition
//      * @param isPush    True if this is a push operation, or false if it's a pop.
//      * @param container The containing ViewGroup
//      * @param handler   The change handler being used.
//      */
//     void onChangeStarted(@Nullable Controller to, @Nullable Controller from, boolean isPush, @NonNull ViewGroup container, @NonNull ControllerChangeHandler handler);
// 
//     /**
//      * Called when a {@link ControllerChangeHandler} has completed changing {@link Controller}s
//      *
//      * @param to        The new Controller or {@code null} if no Controller is being transitioned to
//      * @param from      The old Controller or {@code null} if there was no Controller before this transition
//      * @param isPush    True if this was a push operation, or false if it's a pop
//      * @param container The containing ViewGroup
//      * @param handler   The change handler that was used.
//      */
//     void onChangeCompleted(@Nullable Controller to, @Nullable Controller from, boolean isPush, @NonNull ViewGroup container, @NonNull ControllerChangeHandler handler);
// }


// Path: conductor/src/main/java/com/bluelinelabs/conductor/ControllerHostedRouter.java
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.ViewGroup;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bluelinelabs.conductor.ControllerChangeHandler.ControllerChangeListener;
import com.bluelinelabs.conductor.internal.TransactionIndexer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

package com.bluelinelabs.conductor;





class ControllerHostedRouter extends Router {

    private final String KEY_HOST_ID = "ControllerHostedRouter.hostId";
    private final String KEY_TAG = "ControllerHostedRouter.tag";
    private final String KEY_BOUND_TO_CONTAINER = "ControllerHostedRouter.boundToContainer";

    private Controller hostController;

    @IdRes private int hostId;
    private String tag;
    private boolean isDetachFrozen;
    private boolean boundToContainer;

    ControllerHostedRouter() { }

    ControllerHostedRouter(int hostId, @Nullable String tag, boolean boundToContainer) {
        if (!boundToContainer && tag == null) {
            throw new IllegalStateException("ControllerHostedRouter can't be created without a tag if not bounded to its container");
        }
        this.hostId = hostId;
        this.tag = tag;
        this.boundToContainer = boundToContainer;
    }

    final void setHostController(@NonNull Controller controller) {
        if (hostController == null) {
            hostController = controller;
        }
    }

    final void setHostContainer(@NonNull Controller controller, @NonNull ViewGroup container) {
        if (hostController != controller || this.container != container) {
            removeHost();

            if (container instanceof ControllerChangeListener) {