content: package kotlinx.coroutines.internal;
  
  import kotlin.ExceptionsKt;
  import kotlin.Metadata;
  import kotlin.Unit;
  import kotlin.coroutines.CoroutineContext;
  import kotlin.jvm.functions.Function1;
  import kotlin.jvm.internal.Intrinsics;
  import kotlinx.coroutines.CoroutineExceptionHandlerKt;
  import mt.Log1F380D;
  
  @Metadata(d1 = {"\u0000(\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\u001aI\u0010\u0000\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0000¢\u0006\u0002\u0010\t\u001a=\u0010\n\u001a\u00020\u0003\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0000¢\u0006\u0002\u0010\u000b\u001aC\u0010\f\u001a\u0004\u0018\u00010\r\"\u0004\b\u0000\u0010\u0004*\u0018\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001j\b\u0012\u0004\u0012\u0002H\u0004`\u00052\u0006\u0010\u0006\u001a\u0002H\u00042\n\b\u0002\u0010\u000e\u001a\u0004\u0018\u00010\rH\u0000¢\u0006\u0002\u0010\u000f**\b\u0000\u0010\u0010\u001a\u0004\b\u0000\u0010\u0004\"\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u00012\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u00020\u00030\u0001¨\u0006\u0011"}, d2 = {"bindCancellationFun", "Lkotlin/Function1;", "", "", "E", "Lkotlinx/coroutines/internal/OnUndeliveredElement;", "element", "context", "Lkotlin/coroutines/CoroutineContext;", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlin/coroutines/CoroutineContext;)Lkotlin/jvm/functions/Function1;", "callUndeliveredElement", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlin/coroutines/CoroutineContext;)V", "callUndeliveredElementCatchingException", "Lkotlinx/coroutines/internal/UndeliveredElementException;", "undeliveredElementException", "(Lkotlin/jvm/functions/Function1;Ljava/lang/Object;Lkotlinx/coroutines/internal/UndeliveredElementException;)Lkotlinx/coroutines/internal/UndeliveredElementException;", "OnUndeliveredElement", "kotlinx-coroutines-core"}, k = 2, mv = {1, 6, 0}, xi = 48)
  /* compiled from: 01A3 */
  public final class OnUndeliveredElementKt {
      public static final <E> Function1<Throwable, Unit> bindCancellationFun(Function1<? super E, Unit> $this$bindCancellationFun, E element, CoroutineContext context) {
          return new OnUndeliveredElementKt$bindCancellationFun$1($this$bindCancellationFun, element, context);
      }
  
      public static final <E> void callUndeliveredElement(Function1<? super E, Unit> $this$callUndeliveredElement, E element, CoroutineContext context) {
          UndeliveredElementException callUndeliveredElementCatchingException = callUndeliveredElementCatchingException($this$callUndeliveredElement, element, (UndeliveredElementException) null);
          if (callUndeliveredElementCatchingException != null) {
              CoroutineExceptionHandlerKt.handleCoroutineException(context, callUndeliveredElementCatchingException);
          }
      }
  
      public static final <E> UndeliveredElementException callUndeliveredElementCatchingException(Function1<? super E, Unit> $this$callUndeliveredElementCatchingException, E element, UndeliveredElementException undeliveredElementException) {
          try {
              $this$callUndeliveredElementCatchingException.invoke(element);
          } catch (Throwable th) {
              if (undeliveredElementException == null || undeliveredElementException.getCause() == th) {
                  String stringPlus = Intrinsics.stringPlus("Exception in undelivered element handler for ", element);
                  Log1F380D.a((Object) stringPlus);
                  return new UndeliveredElementException(stringPlus, th);
              }
              ExceptionsKt.addSuppressed(undeliveredElementException, th);
          }
          return undeliveredElementException;
      }
  
      public static /* synthetic */ UndeliveredElementException callUndeliveredElementCatchingException$default(Function1 function1, Object obj, UndeliveredElementException undeliveredElementException, int i, Object obj2) {
          if ((i & 2) != 0) {
              undeliveredElementException = null;
          }
          return callUndeliveredElementCatchingException(function1, obj, undeliveredElementException);
      }
  }
  