import {
  Unit_instance14hm69wy3kr8u as Unit_instance,
  protoOf180f3jzyo7rfj as protoOf,
  THROW_CCE2g6jy02ryeudk as THROW_CCE,
  Element2gr7ezmxqaln7 as Element,
  Continuation1aa2oekvx7jm7 as Continuation,
  initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
  VOID7hggqo3abtya as VOID,
  EmptyCoroutineContext_getInstance2qfbu6z39urjq as EmptyCoroutineContext_getInstance,
  createCoroutineUnintercepted3gya308dmbbtg as createCoroutineUnintercepted,
  initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
  UnsupportedOperationException_init_$Create$1usmxm8d6ijjz as UnsupportedOperationException_init_$Create$,
  isInterface3d6p8outrmvmk as isInterface,
  toString1pkumu07cwy4m as toString,
  IllegalStateException_init_$Create$1nm9y6jd3c9iy as IllegalStateException_init_$Create$,
  toString30pk9tzaqopn as toString_0,
  get_COROUTINE_SUSPENDED3ujt3p13qm4iy as get_COROUTINE_SUSPENDED,
  initMetadataForObject1cxne3s9w65el as initMetadataForObject,
  hashCodeq5arwsb9dgti as hashCode,
  equals2au1ep9vhcato as equals,
  CancellationException_init_$Create$abblhb9ra5mk as CancellationException_init_$Create$,
  Result__exceptionOrNull_impl_p6xea93g9kuxe56cw2k as Result__exceptionOrNull_impl_p6xea9,
  _Result___get_value__impl__bjfvqgbxrwpgk5sesh as _Result___get_value__impl__bjfvqg,
  AbstractCoroutineContextKey9xr9r6wlj5bm as AbstractCoroutineContextKey,
  Key_instance10ebq86xndg52 as Key_instance,
  AbstractCoroutineContextElement2rpehg0hv5szw as AbstractCoroutineContextElement,
  getxe4seun860fg as get,
  minusKey2uxs00uz5ceqp as minusKey,
  ContinuationInterceptor2624y0vaqwxwf as ContinuationInterceptor,
  RuntimeException_init_$Create$1uo9cv0rggpzf as RuntimeException_init_$Create$,
  addSuppressedu5jwjfvsc039 as addSuppressed,
  Enum3alwj03lh1n41 as Enum,
  startCoroutine327fwvtqvedik as startCoroutine,
  noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
  Long2qws0ah9gnpki as Long,
  intercepted2ogpsikxxj4u0 as intercepted,
  ArrayDeque_init_$Create$3radqcftj9po2 as ArrayDeque_init_$Create$,
  RuntimeException1r3t0zl97011n as RuntimeException,
  RuntimeException_init_$Init$2bxjdc47ga271 as RuntimeException_init_$Init$,
  captureStack1fzi4aczwc4hg as captureStack,
  Error3ofk6owajcepa as Error_0,
  Error_init_$Init$2zp3hflsgcgv as Error_init_$Init$,
  StringBuilder_init_$Create$zzhi687lupah as StringBuilder_init_$Create$,
  throwUninitializedPropertyAccessExceptionyynx7gkm73wd as throwUninitializedPropertyAccessException,
  ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$,
  CancellationException3b36o9qz53rgr as CancellationException,
  ArrayList3it5z8td81qkl as ArrayList,
  IllegalStateException_init_$Create$1re2ox2t9owo2 as IllegalStateException_init_$Create$_0,
  plusolev77jfy5r9 as plus,
  get6d5x931vk0s as get_0,
  fold36i9psb7d5v48 as fold,
  minusKeyyqanvso9aovh as minusKey_0,
  anyToString3ho3k49fc56mj as anyToString,
  UnsupportedOperationException2tkumpmhredt3 as UnsupportedOperationException,
  ensureNotNull1e947j3ixpazm as ensureNotNull,
  toLongw1zpgk99d84b as toLong,
  Exceptiondt2hlxn7j7vw as Exception,
  IllegalArgumentException_init_$Create$sfel9vrfa7w2 as IllegalArgumentException_init_$Create$,
  Companion_instance1et3290wko23u as Companion_instance,
  createFailure8paxfkfa5dc7 as createFailure,
  _Result___init__impl__xyqfz8oelep8i0cbta as _Result___init__impl__xyqfz8,
  Exception_init_$Init$2t8qsqvbxaqim as Exception_init_$Init$,
  defineProp3hxgpk2knu2px as defineProp,
  toLongOrNullutqivezb0wx1 as toLongOrNull,
  startCoroutineUninterceptedOrReturnNonGeneratorVersionyfrrvzbtl8bf as startCoroutineUninterceptedOrReturnNonGeneratorVersion,
  getKClassFromExpression3vpejubogshaw as getKClassFromExpression,
  Exception_init_$Create$1f9k5rt5gytdg as Exception_init_$Create$,
  removeFirstOrNull15yg2tczrh8a7 as removeFirstOrNull,
  KtList3hktaavzmj137 as KtList,
  Collection1k04j3hzsbod0 as Collection,
  coerceIn302bduskdb54x as coerceIn,
  CancellationException_init_$Init$yjd67q19gh18 as CancellationException_init_$Init$,
  getStringHashCode26igk1bx568vk as getStringHashCode,
  HashSet_init_$Create$35v8jtxapyyka as HashSet_init_$Create$,
  RuntimeException_init_$Init$2i94smf8ys3t6 as RuntimeException_init_$Init$_0,
  LinkedHashSet_init_$Create$161uomhguzhxi as LinkedHashSet_init_$Create$,
} from './kotlin-kotlin-stdlib.mjs';
import {
  atomic$int$11d5swdyn6j0pu as atomic$int$1,
  atomic$ref$130aurmcwdfdf1 as atomic$ref$1,
  atomic$boolean$1iggki4z65a2h as atomic$boolean$1,
  atomic$long$129k9zwo6n9ogd as atomic$long$1,
  atomicfu$AtomicRefArray$ofNulls2kz3j9ehigwa3 as atomicfu$AtomicRefArray$ofNulls,
} from './kotlinx-atomicfu.mjs';
//region block: imports
var imul = Math.imul;
//endregion
//region block: pre-declaration
initMetadataForInterface(ParentJob, 'ParentJob', VOID, VOID, [Element], [0]);
initMetadataForClass(JobSupport, 'JobSupport', VOID, VOID, [Element, ParentJob], [0]);
initMetadataForInterface(CoroutineScope, 'CoroutineScope');
initMetadataForClass(AbstractCoroutine, 'AbstractCoroutine', VOID, JobSupport, [JobSupport, Element, Continuation, CoroutineScope], [0]);
initMetadataForClass(StandaloneCoroutine, 'StandaloneCoroutine', VOID, AbstractCoroutine, VOID, [0]);
initMetadataForClass(LazyStandaloneCoroutine, 'LazyStandaloneCoroutine', VOID, StandaloneCoroutine, VOID, [0]);
initMetadataForInterface(CancellableContinuation, 'CancellableContinuation', VOID, VOID, [Continuation]);
initMetadataForInterface(Runnable, 'Runnable');
initMetadataForClass(SchedulerTask, 'SchedulerTask', VOID, VOID, [Runnable]);
initMetadataForClass(DispatchedTask, 'DispatchedTask', VOID, SchedulerTask);
initMetadataForInterface(Waiter, 'Waiter');
initMetadataForClass(CancellableContinuationImpl, 'CancellableContinuationImpl', VOID, DispatchedTask, [DispatchedTask, CancellableContinuation, Waiter]);
initMetadataForInterface(NotCompleted, 'NotCompleted');
initMetadataForInterface(CancelHandler, 'CancelHandler', VOID, VOID, [NotCompleted]);
initMetadataForObject(Active, 'Active', VOID, VOID, [NotCompleted]);
initMetadataForClass(CompletedContinuation, 'CompletedContinuation');
initMetadataForClass(LockFreeLinkedListNode, 'LockFreeLinkedListNode', LockFreeLinkedListNode);
initMetadataForInterface(Incomplete, 'Incomplete');
initMetadataForClass(JobNode, 'JobNode', VOID, LockFreeLinkedListNode, [LockFreeLinkedListNode, Incomplete]);
initMetadataForClass(ChildContinuation, 'ChildContinuation', VOID, JobNode);
initMetadataForClass(CompletedExceptionally, 'CompletedExceptionally');
initMetadataForClass(CancelledContinuation, 'CancelledContinuation', VOID, CompletedExceptionally);
initMetadataForObject(Key, 'Key', VOID, AbstractCoroutineContextKey);
initMetadataForClass(CoroutineDispatcher, 'CoroutineDispatcher', VOID, AbstractCoroutineContextElement, [AbstractCoroutineContextElement, ContinuationInterceptor]);
initMetadataForObject(Key_0, 'Key');
initMetadataForClass(CoroutineStart, 'CoroutineStart', VOID, Enum);
initMetadataForInterface(Delay, 'Delay', VOID, VOID, VOID, [1]);
initMetadataForClass(EventLoop, 'EventLoop', VOID, CoroutineDispatcher);
initMetadataForObject(ThreadLocalEventLoop, 'ThreadLocalEventLoop');
initMetadataForClass(CompletionHandlerException, 'CompletionHandlerException', VOID, RuntimeException);
initMetadataForClass(CoroutinesInternalError, 'CoroutinesInternalError', VOID, Error_0);
initMetadataForObject(Key_1, 'Key');
initMetadataForObject(NonDisposableHandle, 'NonDisposableHandle');
initMetadataForClass(Empty, 'Empty', VOID, VOID, [Incomplete]);
initMetadataForClass(LockFreeLinkedListHead, 'LockFreeLinkedListHead', LockFreeLinkedListHead, LockFreeLinkedListNode);
initMetadataForClass(NodeList, 'NodeList', NodeList, LockFreeLinkedListHead, [LockFreeLinkedListHead, Incomplete]);
initMetadataForClass(SynchronizedObject, 'SynchronizedObject', SynchronizedObject);
initMetadataForClass(Finishing, 'Finishing', VOID, SynchronizedObject, [SynchronizedObject, Incomplete]);
initMetadataForClass(ChildCompletion, 'ChildCompletion', VOID, JobNode);
initMetadataForClass(InactiveNodeList, 'InactiveNodeList', VOID, VOID, [Incomplete]);
initMetadataForClass(InvokeOnCompletion, 'InvokeOnCompletion', VOID, JobNode);
initMetadataForClass(InvokeOnCancelling, 'InvokeOnCancelling', VOID, JobNode);
initMetadataForClass(ChildHandleNode, 'ChildHandleNode', VOID, JobNode);
initMetadataForClass(IncompleteStateBox, 'IncompleteStateBox');
initMetadataForClass(JobImpl, 'JobImpl', VOID, JobSupport, [JobSupport, Element], [0]);
initMetadataForClass(MainCoroutineDispatcher, 'MainCoroutineDispatcher', VOID, CoroutineDispatcher);
initMetadataForClass(SupervisorJobImpl, 'SupervisorJobImpl', VOID, JobImpl, VOID, [0]);
initMetadataForClass(TimeoutCancellationException, 'TimeoutCancellationException', VOID, CancellationException);
initMetadataForObject(Unconfined, 'Unconfined', VOID, CoroutineDispatcher);
initMetadataForObject(Key_2, 'Key');
initMetadataForClass(ConcurrentLinkedListNode, 'ConcurrentLinkedListNode');
initMetadataForClass(Segment, 'Segment', VOID, ConcurrentLinkedListNode, [ConcurrentLinkedListNode, NotCompleted]);
initMetadataForObject(ExceptionSuccessfullyProcessed, 'ExceptionSuccessfullyProcessed', VOID, Exception);
initMetadataForClass(DispatchedContinuation, 'DispatchedContinuation', VOID, DispatchedTask, [DispatchedTask, Continuation]);
initMetadataForClass(DispatchException, 'DispatchException', VOID, Exception);
initMetadataForClass(ContextScope, 'ContextScope', VOID, VOID, [CoroutineScope]);
initMetadataForClass(Symbol, 'Symbol');
initMetadataForInterface(SelectInstance, 'SelectInstance');
function tryLock$default(owner, $super) {
  owner = owner === VOID ? null : owner;
  return $super === VOID ? this.wn(owner) : $super.wn.call(this, owner);
}
function unlock$default(owner, $super) {
  owner = owner === VOID ? null : owner;
  var tmp;
  if ($super === VOID) {
    this.yn(owner);
    tmp = Unit_instance;
  } else {
    tmp = $super.yn.call(this, owner);
  }
  return tmp;
}
initMetadataForInterface(Mutex, 'Mutex', VOID, VOID, VOID, [1]);
initMetadataForClass(SemaphoreAndMutexImpl, 'SemaphoreAndMutexImpl', VOID, VOID, VOID, [0]);
initMetadataForClass(MutexImpl, 'MutexImpl', VOID, SemaphoreAndMutexImpl, [SemaphoreAndMutexImpl, Mutex], [1, 0]);
initMetadataForClass(SemaphoreSegment, 'SemaphoreSegment', VOID, Segment);
initMetadataForClass(SetTimeoutBasedDispatcher, 'SetTimeoutBasedDispatcher', VOID, CoroutineDispatcher, [CoroutineDispatcher, Delay], [1]);
initMetadataForObject(NodeDispatcher, 'NodeDispatcher', VOID, SetTimeoutBasedDispatcher, VOID, [1]);
initMetadataForClass(MessageQueue, 'MessageQueue', VOID, VOID, [KtList, Collection]);
initMetadataForClass(ScheduledMessageQueue, 'ScheduledMessageQueue', VOID, MessageQueue);
initMetadataForClass(WindowMessageQueue, 'WindowMessageQueue', VOID, MessageQueue);
initMetadataForClass(UnconfinedEventLoop, 'UnconfinedEventLoop', UnconfinedEventLoop, EventLoop);
initMetadataForObject(SetTimeoutDispatcher, 'SetTimeoutDispatcher', VOID, SetTimeoutBasedDispatcher, VOID, [1]);
initMetadataForClass(ClearTimeout, 'ClearTimeout', VOID, VOID, [CancelHandler]);
initMetadataForClass(WindowClearTimeout, 'WindowClearTimeout', VOID, ClearTimeout);
initMetadataForClass(WindowDispatcher, 'WindowDispatcher', VOID, CoroutineDispatcher, [CoroutineDispatcher, Delay], [1]);
initMetadataForObject(Dispatchers, 'Dispatchers');
initMetadataForClass(JsMainDispatcher, 'JsMainDispatcher', VOID, MainCoroutineDispatcher);
initMetadataForClass(JobCancellationException, 'JobCancellationException', VOID, CancellationException);
initMetadataForClass(DiagnosticCoroutineContextException, 'DiagnosticCoroutineContextException', VOID, RuntimeException);
initMetadataForClass(ListClosed, 'ListClosed', VOID, LockFreeLinkedListNode);
initMetadataForClass(CommonThreadLocal, 'CommonThreadLocal', CommonThreadLocal);
//endregion
function AbstractCoroutine(parentContext, initParentJob, active) {
  JobSupport.call(this, active);
  if (initParentJob) {
    this.ve(parentContext.p6(Key_instance_2));
  }
  this.ye_1 = parentContext.zb(this);
}
protoOf(AbstractCoroutine).i6 = function () {
  return this.ye_1;
};
protoOf(AbstractCoroutine).ze = function () {
  return this.ye_1;
};
protoOf(AbstractCoroutine).af = function () {
  return protoOf(JobSupport).af.call(this);
};
protoOf(AbstractCoroutine).bf = function (value) {
};
protoOf(AbstractCoroutine).cf = function (cause, handled) {
};
protoOf(AbstractCoroutine).df = function () {
  return get_classSimpleName(this) + ' was cancelled';
};
protoOf(AbstractCoroutine).ef = function (state) {
  if (state instanceof CompletedExceptionally) {
    this.cf(state.ff_1, state.hf());
  } else {
    this.bf((state == null ? true : !(state == null)) ? state : THROW_CCE());
  }
};
protoOf(AbstractCoroutine).n6 = function (result) {
  var state = this.if(toState_0(result));
  if (state === get_COMPLETING_WAITING_CHILDREN())
    return Unit_instance;
  this.jf(state);
};
protoOf(AbstractCoroutine).jf = function (state) {
  return this.kf(state);
};
protoOf(AbstractCoroutine).lf = function (exception) {
  handleCoroutineException(this.ye_1, exception);
};
protoOf(AbstractCoroutine).mf = function () {
  var tmp0_elvis_lhs = get_coroutineName(this.ye_1);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return protoOf(JobSupport).mf.call(this);
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var coroutineName = tmp;
  return '"' + coroutineName + '":' + protoOf(JobSupport).mf.call(this);
};
protoOf(AbstractCoroutine).nf = function (start, receiver, block) {
  start.qf(block, receiver, this);
};
function launch(_this__u8e3s4, context, start, block) {
  context = context === VOID ? EmptyCoroutineContext_getInstance() : context;
  start = start === VOID ? CoroutineStart_DEFAULT_getInstance() : start;
  var newContext = newCoroutineContext(_this__u8e3s4, context);
  var coroutine = start.og() ? new LazyStandaloneCoroutine(newContext, block) : new StandaloneCoroutine(newContext, true);
  coroutine.nf(start, coroutine, block);
  return coroutine;
}
function StandaloneCoroutine(parentContext, active) {
  AbstractCoroutine.call(this, parentContext, true, active);
}
protoOf(StandaloneCoroutine).mg = function (exception) {
  handleCoroutineException(this.ye_1, exception);
  return true;
};
function LazyStandaloneCoroutine(parentContext, block) {
  StandaloneCoroutine.call(this, parentContext, false);
  this.vg_1 = createCoroutineUnintercepted(block, this, this);
}
protoOf(LazyStandaloneCoroutine).wf = function () {
  startCoroutineCancellable(this.vg_1, this);
};
function CancellableContinuation() {
}
function invokeOnCancellation(_this__u8e3s4, handler) {
  var tmp;
  if (_this__u8e3s4 instanceof CancellableContinuationImpl) {
    _this__u8e3s4.gh(handler);
    tmp = Unit_instance;
  } else {
    throw UnsupportedOperationException_init_$Create$('third-party implementation of CancellableContinuation is not supported');
  }
  return tmp;
}
function get_RESUME_TOKEN() {
  _init_properties_CancellableContinuationImpl_kt__6rrtdd();
  return RESUME_TOKEN;
}
var RESUME_TOKEN;
function _get_parentHandle__f8dcex($this) {
  return $this.fh_1.kotlinx$atomicfu$value;
}
function _get_stateDebugRepresentation__bf18u4($this) {
  var tmp0_subject = $this.tf();
  var tmp;
  if (!(tmp0_subject == null) ? isInterface(tmp0_subject, NotCompleted) : false) {
    tmp = 'Active';
  } else {
    if (tmp0_subject instanceof CancelledContinuation) {
      tmp = 'Cancelled';
    } else {
      tmp = 'Completed';
    }
  }
  return tmp;
}
function isReusable($this) {
  var tmp;
  if (get_isReusableMode($this.oh_1)) {
    var tmp_0 = $this.bh_1;
    tmp = (tmp_0 instanceof DispatchedContinuation ? tmp_0 : THROW_CCE()).nh();
  } else {
    tmp = false;
  }
  return tmp;
}
function cancelLater($this, cause) {
  if (!isReusable($this))
    return false;
  var tmp = $this.bh_1;
  var dispatched = tmp instanceof DispatchedContinuation ? tmp : THROW_CCE();
  return dispatched.ph(cause);
}
function callSegmentOnCancellation($this, segment, cause) {
  // Inline function 'kotlinx.coroutines.index' call
  var index = $this.dh_1.kotlinx$atomicfu$value & 536870911;
  // Inline function 'kotlin.check' call
  if (!!(index === 536870911)) {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.callSegmentOnCancellation.<anonymous>' call
    var message = 'The index for Segment.onCancellation(..) is broken';
    throw IllegalStateException_init_$Create$(toString(message));
  }
  // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.callCancelHandlerSafely' call
  try {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.callSegmentOnCancellation.<anonymous>' call
    segment.uh(index, cause, $this.i6());
  } catch ($p) {
    if ($p instanceof Error) {
      var ex = $p;
      handleCoroutineException($this.i6(), new CompletionHandlerException('Exception in invokeOnCancellation handler for ' + $this.toString(), ex));
    } else {
      throw $p;
    }
  }
}
function trySuspend($this) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = $this.dh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.trySuspend.<anonymous>' call
    var cur = this_0.kotlinx$atomicfu$value;
    // Inline function 'kotlinx.coroutines.decision' call
    switch (cur >> 29) {
      case 0:
        // Inline function 'kotlinx.coroutines.index' call

        // Inline function 'kotlinx.coroutines.decisionAndIndex' call

        var tmp$ret$2 = (1 << 29) + (cur & 536870911) | 0;
        if ($this.dh_1.atomicfu$compareAndSet(cur, tmp$ret$2))
          return true;
        break;
      case 2:
        return false;
      default:
        // Inline function 'kotlin.error' call

        var message = 'Already suspended';
        throw IllegalStateException_init_$Create$(toString(message));
    }
  }
}
function tryResume($this) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = $this.dh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.tryResume.<anonymous>' call
    var cur = this_0.kotlinx$atomicfu$value;
    // Inline function 'kotlinx.coroutines.decision' call
    switch (cur >> 29) {
      case 0:
        // Inline function 'kotlinx.coroutines.index' call

        // Inline function 'kotlinx.coroutines.decisionAndIndex' call

        var tmp$ret$2 = (2 << 29) + (cur & 536870911) | 0;
        if ($this.dh_1.atomicfu$compareAndSet(cur, tmp$ret$2))
          return true;
        break;
      case 1:
        return false;
      default:
        // Inline function 'kotlin.error' call

        var message = 'Already resumed';
        throw IllegalStateException_init_$Create$(toString(message));
    }
  }
}
function installParentHandle($this) {
  var tmp0_elvis_lhs = $this.i6().p6(Key_instance_2);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return null;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var parent = tmp;
  var handle = invokeOnCompletion(parent, VOID, new ChildContinuation($this));
  $this.fh_1.atomicfu$compareAndSet(null, handle);
  return handle;
}
function invokeOnCancellationImpl($this, handler) {
  // Inline function 'kotlinx.coroutines.assert' call
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = $this.eh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.invokeOnCancellationImpl.<anonymous>' call
    var state = this_0.kotlinx$atomicfu$value;
    if (state instanceof Active) {
      if ($this.eh_1.atomicfu$compareAndSet(state, handler))
        return Unit_instance;
    } else {
      var tmp;
      if (!(state == null) ? isInterface(state, CancelHandler) : false) {
        tmp = true;
      } else {
        tmp = state instanceof Segment;
      }
      if (tmp) {
        multipleHandlersError($this, handler, state);
      } else {
        if (state instanceof CompletedExceptionally) {
          if (!state.di()) {
            multipleHandlersError($this, handler, state);
          }
          if (state instanceof CancelledContinuation) {
            var tmp1_safe_receiver = state instanceof CompletedExceptionally ? state : null;
            var cause = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.ff_1;
            if (isInterface(handler, CancelHandler)) {
              $this.ai(handler, cause);
            } else {
              var segment = handler instanceof Segment ? handler : THROW_CCE();
              callSegmentOnCancellation($this, segment, cause);
            }
          }
          return Unit_instance;
        } else {
          if (state instanceof CompletedContinuation) {
            if (!(state.wh_1 == null)) {
              multipleHandlersError($this, handler, state);
            }
            if (handler instanceof Segment)
              return Unit_instance;
            if (!isInterface(handler, CancelHandler))
              THROW_CCE();
            if (state.bi()) {
              $this.ai(handler, state.zh_1);
              return Unit_instance;
            }
            var update = state.ci(VOID, handler);
            if ($this.eh_1.atomicfu$compareAndSet(state, update))
              return Unit_instance;
          } else {
            if (handler instanceof Segment)
              return Unit_instance;
            if (!isInterface(handler, CancelHandler))
              THROW_CCE();
            var update_0 = new CompletedContinuation(state, handler);
            if ($this.eh_1.atomicfu$compareAndSet(state, update_0))
              return Unit_instance;
          }
        }
      }
    }
  }
}
function multipleHandlersError($this, handler, state) {
  // Inline function 'kotlin.error' call
  var message = "It's prohibited to register multiple handlers, tried to register " + toString(handler) + ', already has ' + toString_0(state);
  throw IllegalStateException_init_$Create$(toString(message));
}
function dispatchResume($this, mode) {
  if (tryResume($this))
    return Unit_instance;
  dispatch($this, mode);
}
function resumedState($this, state, proposedUpdate, resumeMode, onCancellation, idempotent) {
  var tmp;
  if (proposedUpdate instanceof CompletedExceptionally) {
    // Inline function 'kotlinx.coroutines.assert' call
    // Inline function 'kotlinx.coroutines.assert' call
    tmp = proposedUpdate;
  } else {
    if (!get_isCancellableMode(resumeMode) && idempotent == null) {
      tmp = proposedUpdate;
    } else {
      var tmp_0;
      var tmp_1;
      if (!(onCancellation == null)) {
        tmp_1 = true;
      } else {
        tmp_1 = isInterface(state, CancelHandler);
      }
      if (tmp_1) {
        tmp_0 = true;
      } else {
        tmp_0 = !(idempotent == null);
      }
      if (tmp_0) {
        tmp = new CompletedContinuation(proposedUpdate, isInterface(state, CancelHandler) ? state : null, onCancellation, idempotent);
      } else {
        tmp = proposedUpdate;
      }
    }
  }
  return tmp;
}
function tryResumeImpl($this, proposedUpdate, idempotent, onCancellation) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = $this.eh_1;
  while (true) {
    var tmp1 = this_0.kotlinx$atomicfu$value;
    $l$block: {
      // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.tryResumeImpl.<anonymous>' call
      if (!(tmp1 == null) ? isInterface(tmp1, NotCompleted) : false) {
        var update = resumedState($this, tmp1, proposedUpdate, $this.oh_1, onCancellation, idempotent);
        if (!$this.eh_1.atomicfu$compareAndSet(tmp1, update)) {
          break $l$block;
        }
        detachChildIfNonReusable($this);
        return get_RESUME_TOKEN();
      } else {
        if (tmp1 instanceof CompletedContinuation) {
          var tmp;
          if (!(idempotent == null) && tmp1.yh_1 === idempotent) {
            // Inline function 'kotlinx.coroutines.assert' call
            tmp = get_RESUME_TOKEN();
          } else {
            tmp = null;
          }
          return tmp;
        } else {
          return null;
        }
      }
    }
  }
}
function alreadyResumedError($this, proposedUpdate) {
  // Inline function 'kotlin.error' call
  var message = 'Already resumed, but proposed with update ' + toString_0(proposedUpdate);
  throw IllegalStateException_init_$Create$(toString(message));
}
function detachChildIfNonReusable($this) {
  if (!isReusable($this)) {
    $this.ei();
  }
}
function CancellableContinuationImpl(delegate, resumeMode) {
  DispatchedTask.call(this, resumeMode);
  this.bh_1 = delegate;
  // Inline function 'kotlinx.coroutines.assert' call
  this.ch_1 = this.bh_1.i6();
  var tmp = this;
  // Inline function 'kotlinx.coroutines.decisionAndIndex' call
  var tmp$ret$0 = (0 << 29) + 536870911 | 0;
  tmp.dh_1 = atomic$int$1(tmp$ret$0);
  this.eh_1 = atomic$ref$1(Active_instance);
  this.fh_1 = atomic$ref$1(null);
}
protoOf(CancellableContinuationImpl).fi = function () {
  return this.bh_1;
};
protoOf(CancellableContinuationImpl).i6 = function () {
  return this.ch_1;
};
protoOf(CancellableContinuationImpl).tf = function () {
  return this.eh_1.kotlinx$atomicfu$value;
};
protoOf(CancellableContinuationImpl).uf = function () {
  var tmp = this.tf();
  return !(!(tmp == null) ? isInterface(tmp, NotCompleted) : false);
};
protoOf(CancellableContinuationImpl).gi = function () {
  var tmp0_elvis_lhs = installParentHandle(this);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return Unit_instance;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var handle = tmp;
  if (this.uf()) {
    handle.hi();
    this.fh_1.kotlinx$atomicfu$value = NonDisposableHandle_instance;
  }
};
protoOf(CancellableContinuationImpl).ii = function () {
  return this.tf();
};
protoOf(CancellableContinuationImpl).ji = function (takenState, cause) {
  var this_0 = this.eh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult.<anonymous>' call
    var state = this_0.kotlinx$atomicfu$value;
    if (!(state == null) ? isInterface(state, NotCompleted) : false) {
      // Inline function 'kotlin.error' call
      var message = 'Not completed';
      throw IllegalStateException_init_$Create$(toString(message));
    } else {
      if (state instanceof CompletedExceptionally)
        return Unit_instance;
      else {
        if (state instanceof CompletedContinuation) {
          // Inline function 'kotlin.check' call
          if (!!state.bi()) {
            // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.cancelCompletedResult.<anonymous>.<anonymous>' call
            var message_0 = 'Must be called at most once';
            throw IllegalStateException_init_$Create$(toString(message_0));
          }
          var update = state.ci(VOID, VOID, VOID, VOID, cause);
          if (this.eh_1.atomicfu$compareAndSet(state, update)) {
            state.ki(this, cause);
            return Unit_instance;
          }
        } else {
          if (this.eh_1.atomicfu$compareAndSet(state, new CompletedContinuation(state, VOID, VOID, VOID, cause))) {
            return Unit_instance;
          }
        }
      }
    }
  }
  return Unit_instance;
};
protoOf(CancellableContinuationImpl).li = function (cause) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = this.eh_1;
  while (true) {
    var tmp1 = this_0.kotlinx$atomicfu$value;
    $l$block: {
      // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.cancel.<anonymous>' call
      if (!(!(tmp1 == null) ? isInterface(tmp1, NotCompleted) : false))
        return false;
      var tmp;
      if (isInterface(tmp1, CancelHandler)) {
        tmp = true;
      } else {
        tmp = tmp1 instanceof Segment;
      }
      var update = new CancelledContinuation(this, cause, tmp);
      if (!this.eh_1.atomicfu$compareAndSet(tmp1, update)) {
        break $l$block;
      }
      if (isInterface(tmp1, CancelHandler)) {
        this.ai(tmp1, cause);
      } else {
        if (tmp1 instanceof Segment) {
          callSegmentOnCancellation(this, tmp1, cause);
        }
      }
      detachChildIfNonReusable(this);
      dispatchResume(this, this.oh_1);
      return true;
    }
  }
};
protoOf(CancellableContinuationImpl).mi = function (cause) {
  if (cancelLater(this, cause))
    return Unit_instance;
  this.li(cause);
  detachChildIfNonReusable(this);
};
protoOf(CancellableContinuationImpl).ai = function (handler, cause) {
  var tmp;
  try {
    handler.ni(cause);
    tmp = Unit_instance;
  } catch ($p) {
    var tmp_0;
    if ($p instanceof Error) {
      var ex = $p;
      handleCoroutineException(this.i6(), new CompletionHandlerException('Exception in invokeOnCancellation handler for ' + this.toString(), ex));
      tmp_0 = Unit_instance;
    } else {
      throw $p;
    }
    tmp = tmp_0;
  }
  return tmp;
};
protoOf(CancellableContinuationImpl).oi = function (onCancellation, cause, value) {
  try {
    onCancellation(cause, value, this.i6());
  } catch ($p) {
    if ($p instanceof Error) {
      var ex = $p;
      handleCoroutineException(this.i6(), new CompletionHandlerException('Exception in resume onCancellation handler for ' + this.toString(), ex));
    } else {
      throw $p;
    }
  }
};
protoOf(CancellableContinuationImpl).pi = function (parent) {
  return parent.xf();
};
protoOf(CancellableContinuationImpl).qi = function () {
  var isReusable_0 = isReusable(this);
  if (trySuspend(this)) {
    if (_get_parentHandle__f8dcex(this) == null) {
      installParentHandle(this);
    }
    if (isReusable_0) {
      this.ri();
    }
    return get_COROUTINE_SUSPENDED();
  }
  if (isReusable_0) {
    this.ri();
  }
  var state = this.tf();
  if (state instanceof CompletedExceptionally)
    throw recoverStackTrace(state.ff_1, this);
  if (get_isCancellableMode(this.oh_1)) {
    var job = this.i6().p6(Key_instance_2);
    if (!(job == null) && !job.af()) {
      var cause = job.xf();
      this.ji(state, cause);
      throw recoverStackTrace(cause, this);
    }
  }
  return this.si(state);
};
protoOf(CancellableContinuationImpl).ri = function () {
  var tmp = this.bh_1;
  var tmp0_safe_receiver = tmp instanceof DispatchedContinuation ? tmp : null;
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ti(this);
  var tmp_0;
  if (tmp1_elvis_lhs == null) {
    return Unit_instance;
  } else {
    tmp_0 = tmp1_elvis_lhs;
  }
  var cancellationCause = tmp_0;
  this.ei();
  this.li(cancellationCause);
};
protoOf(CancellableContinuationImpl).n6 = function (result) {
  return this.ui(toState(result, this), this.oh_1);
};
protoOf(CancellableContinuationImpl).zg = function (value, onCancellation) {
  return this.vi(value, this.oh_1, onCancellation);
};
protoOf(CancellableContinuationImpl).wi = function (segment, index) {
  var tmp0 = this.dh_1;
  $l$block: {
    // Inline function 'kotlinx.atomicfu.update' call
    while (true) {
      var cur = tmp0.kotlinx$atomicfu$value;
      // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.invokeOnCancellation.<anonymous>' call
      // Inline function 'kotlinx.coroutines.index' call
      // Inline function 'kotlin.check' call
      if (!((cur & 536870911) === 536870911)) {
        // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.invokeOnCancellation.<anonymous>.<anonymous>' call
        var message = 'invokeOnCancellation should be called at most once';
        throw IllegalStateException_init_$Create$(toString(message));
      }
      // Inline function 'kotlinx.coroutines.decision' call
      // Inline function 'kotlinx.coroutines.decisionAndIndex' call
      var upd = (cur >> 29 << 29) + index | 0;
      if (tmp0.atomicfu$compareAndSet(cur, upd)) {
        break $l$block;
      }
    }
  }
  invokeOnCancellationImpl(this, segment);
};
protoOf(CancellableContinuationImpl).gh = function (handler) {
  return invokeOnCancellationImpl(this, handler);
};
protoOf(CancellableContinuationImpl).vi = function (proposedUpdate, resumeMode, onCancellation) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = this.eh_1;
  while (true) {
    var tmp1 = this_0.kotlinx$atomicfu$value;
    $l$block: {
      // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.resumeImpl.<anonymous>' call
      if (!(tmp1 == null) ? isInterface(tmp1, NotCompleted) : false) {
        var update = resumedState(this, tmp1, proposedUpdate, resumeMode, onCancellation, null);
        if (!this.eh_1.atomicfu$compareAndSet(tmp1, update)) {
          break $l$block;
        }
        detachChildIfNonReusable(this);
        dispatchResume(this, resumeMode);
        return Unit_instance;
      } else {
        if (tmp1 instanceof CancelledContinuation) {
          if (tmp1.aj()) {
            if (onCancellation == null)
              null;
            else {
              // Inline function 'kotlin.let' call
              // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.resumeImpl.<anonymous>.<anonymous>' call
              this.oi(onCancellation, tmp1.ff_1, proposedUpdate);
            }
            return Unit_instance;
          }
        }
      }
      alreadyResumedError(this, proposedUpdate);
    }
  }
};
protoOf(CancellableContinuationImpl).ui = function (proposedUpdate, resumeMode, onCancellation, $super) {
  onCancellation = onCancellation === VOID ? null : onCancellation;
  var tmp;
  if ($super === VOID) {
    this.vi(proposedUpdate, resumeMode, onCancellation);
    tmp = Unit_instance;
  } else {
    tmp = $super.vi.call(this, proposedUpdate, resumeMode, onCancellation);
  }
  return tmp;
};
protoOf(CancellableContinuationImpl).ei = function () {
  var tmp0_elvis_lhs = _get_parentHandle__f8dcex(this);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return Unit_instance;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var handle = tmp;
  handle.hi();
  this.fh_1.kotlinx$atomicfu$value = NonDisposableHandle_instance;
};
protoOf(CancellableContinuationImpl).wg = function (value, idempotent, onCancellation) {
  return tryResumeImpl(this, value, idempotent, onCancellation);
};
protoOf(CancellableContinuationImpl).xg = function (token) {
  // Inline function 'kotlinx.coroutines.assert' call
  dispatchResume(this, this.oh_1);
};
protoOf(CancellableContinuationImpl).yg = function (_this__u8e3s4, value) {
  var tmp = this.bh_1;
  var dc = tmp instanceof DispatchedContinuation ? tmp : null;
  var tmp_0;
  if ((dc == null ? null : dc.ih_1) === _this__u8e3s4) {
    tmp_0 = 4;
  } else {
    tmp_0 = this.oh_1;
  }
  this.ui(value, tmp_0);
};
protoOf(CancellableContinuationImpl).si = function (state) {
  var tmp;
  if (state instanceof CompletedContinuation) {
    var tmp_0 = state.vh_1;
    tmp = (tmp_0 == null ? true : !(tmp_0 == null)) ? tmp_0 : THROW_CCE();
  } else {
    tmp = (state == null ? true : !(state == null)) ? state : THROW_CCE();
  }
  return tmp;
};
protoOf(CancellableContinuationImpl).bj = function (state) {
  var tmp0_safe_receiver = protoOf(DispatchedTask).bj.call(this, state);
  var tmp;
  if (tmp0_safe_receiver == null) {
    tmp = null;
  } else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.getExceptionalResult.<anonymous>' call
    tmp = recoverStackTrace(tmp0_safe_receiver, this.bh_1);
  }
  return tmp;
};
protoOf(CancellableContinuationImpl).toString = function () {
  return this.cj() + '(' + toDebugString(this.bh_1) + '){' + _get_stateDebugRepresentation__bf18u4(this) + '}@' + get_hexAddress(this);
};
protoOf(CancellableContinuationImpl).cj = function () {
  return 'CancellableContinuation';
};
function NotCompleted() {
}
function CancelHandler() {
}
function Active() {
}
protoOf(Active).toString = function () {
  return 'Active';
};
var Active_instance;
function Active_getInstance() {
  return Active_instance;
}
function CompletedContinuation(result, cancelHandler, onCancellation, idempotentResume, cancelCause) {
  cancelHandler = cancelHandler === VOID ? null : cancelHandler;
  onCancellation = onCancellation === VOID ? null : onCancellation;
  idempotentResume = idempotentResume === VOID ? null : idempotentResume;
  cancelCause = cancelCause === VOID ? null : cancelCause;
  this.vh_1 = result;
  this.wh_1 = cancelHandler;
  this.xh_1 = onCancellation;
  this.yh_1 = idempotentResume;
  this.zh_1 = cancelCause;
}
protoOf(CompletedContinuation).bi = function () {
  return !(this.zh_1 == null);
};
protoOf(CompletedContinuation).ki = function (cont, cause) {
  var tmp0_safe_receiver = this.wh_1;
  if (tmp0_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.CompletedContinuation.invokeHandlers.<anonymous>' call
    cont.ai(tmp0_safe_receiver, cause);
  }
  var tmp1_safe_receiver = this.xh_1;
  if (tmp1_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.CompletedContinuation.invokeHandlers.<anonymous>' call
    cont.oi(tmp1_safe_receiver, cause, this.vh_1);
  }
};
protoOf(CompletedContinuation).fj = function (result, cancelHandler, onCancellation, idempotentResume, cancelCause) {
  return new CompletedContinuation(result, cancelHandler, onCancellation, idempotentResume, cancelCause);
};
protoOf(CompletedContinuation).ci = function (result, cancelHandler, onCancellation, idempotentResume, cancelCause, $super) {
  result = result === VOID ? this.vh_1 : result;
  cancelHandler = cancelHandler === VOID ? this.wh_1 : cancelHandler;
  onCancellation = onCancellation === VOID ? this.xh_1 : onCancellation;
  idempotentResume = idempotentResume === VOID ? this.yh_1 : idempotentResume;
  cancelCause = cancelCause === VOID ? this.zh_1 : cancelCause;
  return $super === VOID ? this.fj(result, cancelHandler, onCancellation, idempotentResume, cancelCause) : $super.fj.call(this, result, cancelHandler, onCancellation, idempotentResume, cancelCause);
};
protoOf(CompletedContinuation).toString = function () {
  return 'CompletedContinuation(result=' + toString_0(this.vh_1) + ', cancelHandler=' + toString_0(this.wh_1) + ', onCancellation=' + toString_0(this.xh_1) + ', idempotentResume=' + toString_0(this.yh_1) + ', cancelCause=' + toString_0(this.zh_1) + ')';
};
protoOf(CompletedContinuation).hashCode = function () {
  var result = this.vh_1 == null ? 0 : hashCode(this.vh_1);
  result = imul(result, 31) + (this.wh_1 == null ? 0 : hashCode(this.wh_1)) | 0;
  result = imul(result, 31) + (this.xh_1 == null ? 0 : hashCode(this.xh_1)) | 0;
  result = imul(result, 31) + (this.yh_1 == null ? 0 : hashCode(this.yh_1)) | 0;
  result = imul(result, 31) + (this.zh_1 == null ? 0 : hashCode(this.zh_1)) | 0;
  return result;
};
protoOf(CompletedContinuation).equals = function (other) {
  if (this === other)
    return true;
  if (!(other instanceof CompletedContinuation))
    return false;
  var tmp0_other_with_cast = other instanceof CompletedContinuation ? other : THROW_CCE();
  if (!equals(this.vh_1, tmp0_other_with_cast.vh_1))
    return false;
  if (!equals(this.wh_1, tmp0_other_with_cast.wh_1))
    return false;
  if (!equals(this.xh_1, tmp0_other_with_cast.xh_1))
    return false;
  if (!equals(this.yh_1, tmp0_other_with_cast.yh_1))
    return false;
  if (!equals(this.zh_1, tmp0_other_with_cast.zh_1))
    return false;
  return true;
};
function ChildContinuation(child) {
  JobNode.call(this);
  this.kj_1 = child;
}
protoOf(ChildContinuation).lj = function () {
  return true;
};
protoOf(ChildContinuation).ni = function (cause) {
  this.kj_1.mi(this.kj_1.pi(this.qj()));
};
var properties_initialized_CancellableContinuationImpl_kt_xtzb03;
function _init_properties_CancellableContinuationImpl_kt__6rrtdd() {
  if (!properties_initialized_CancellableContinuationImpl_kt_xtzb03) {
    properties_initialized_CancellableContinuationImpl_kt_xtzb03 = true;
    RESUME_TOKEN = new Symbol('RESUME_TOKEN');
  }
}
function CompletedExceptionally(cause, handled) {
  handled = handled === VOID ? false : handled;
  this.ff_1 = cause;
  this.gf_1 = atomic$boolean$1(handled);
}
protoOf(CompletedExceptionally).hf = function () {
  return this.gf_1.kotlinx$atomicfu$value;
};
protoOf(CompletedExceptionally).di = function () {
  return this.gf_1.atomicfu$compareAndSet(false, true);
};
protoOf(CompletedExceptionally).toString = function () {
  return get_classSimpleName(this) + '[' + this.ff_1.toString() + ']';
};
function CancelledContinuation(continuation, cause, handled) {
  CompletedExceptionally.call(this, cause == null ? CancellationException_init_$Create$('Continuation ' + toString(continuation) + ' was cancelled normally') : cause, handled);
  this.zi_1 = atomic$boolean$1(false);
}
protoOf(CancelledContinuation).aj = function () {
  return this.zi_1.atomicfu$compareAndSet(false, true);
};
function toState(_this__u8e3s4, caller) {
  // Inline function 'kotlin.getOrElse' call
  var exception = Result__exceptionOrNull_impl_p6xea9(_this__u8e3s4);
  var tmp;
  if (exception == null) {
    var tmp_0 = _Result___get_value__impl__bjfvqg(_this__u8e3s4);
    tmp = (tmp_0 == null ? true : !(tmp_0 == null)) ? tmp_0 : THROW_CCE();
  } else {
    // Inline function 'kotlinx.coroutines.toState.<anonymous>' call
    tmp = new CompletedExceptionally(recoverStackTrace(exception, caller));
  }
  return tmp;
}
function toState_0(_this__u8e3s4) {
  // Inline function 'kotlin.getOrElse' call
  var exception = Result__exceptionOrNull_impl_p6xea9(_this__u8e3s4);
  var tmp;
  if (exception == null) {
    var tmp_0 = _Result___get_value__impl__bjfvqg(_this__u8e3s4);
    tmp = (tmp_0 == null ? true : !(tmp_0 == null)) ? tmp_0 : THROW_CCE();
  } else {
    // Inline function 'kotlinx.coroutines.toState.<anonymous>' call
    tmp = new CompletedExceptionally(exception);
  }
  return tmp;
}
function CoroutineDispatcher$Key$_init_$lambda_akl8b5(it) {
  return it instanceof CoroutineDispatcher ? it : null;
}
function Key() {
  Key_instance_0 = this;
  var tmp = Key_instance;
  AbstractCoroutineContextKey.call(this, tmp, CoroutineDispatcher$Key$_init_$lambda_akl8b5);
}
var Key_instance_0;
function Key_getInstance() {
  if (Key_instance_0 == null)
    new Key();
  return Key_instance_0;
}
function CoroutineDispatcher() {
  Key_getInstance();
  AbstractCoroutineContextElement.call(this, Key_instance);
}
protoOf(CoroutineDispatcher).zj = function (context) {
  return true;
};
protoOf(CoroutineDispatcher).q6 = function (continuation) {
  return new DispatchedContinuation(this, continuation);
};
protoOf(CoroutineDispatcher).r6 = function (continuation) {
  var dispatched = continuation instanceof DispatchedContinuation ? continuation : THROW_CCE();
  dispatched.bk();
};
protoOf(CoroutineDispatcher).toString = function () {
  return get_classSimpleName(this) + '@' + get_hexAddress(this);
};
function handleCoroutineException(context, exception) {
  var tmp;
  if (exception instanceof DispatchException) {
    tmp = exception.ck_1;
  } else {
    tmp = exception;
  }
  var reportException = tmp;
  try {
    var tmp0_safe_receiver = context.p6(Key_instance_1);
    if (tmp0_safe_receiver == null)
      null;
    else {
      // Inline function 'kotlin.let' call
      tmp0_safe_receiver.dk(context, reportException);
      return Unit_instance;
    }
  } catch ($p) {
    if ($p instanceof Error) {
      var t = $p;
      handleUncaughtCoroutineException(context, handlerException(reportException, t));
      return Unit_instance;
    } else {
      throw $p;
    }
  }
  handleUncaughtCoroutineException(context, reportException);
}
function Key_0() {
}
var Key_instance_1;
function Key_getInstance_0() {
  return Key_instance_1;
}
function handlerException(originalException, thrownException) {
  if (originalException === thrownException)
    return originalException;
  // Inline function 'kotlin.apply' call
  var this_0 = RuntimeException_init_$Create$('Exception while trying to handle coroutine exception', thrownException);
  // Inline function 'kotlinx.coroutines.handlerException.<anonymous>' call
  addSuppressed(this_0, originalException);
  return this_0;
}
function CoroutineScope() {
}
function MainScope() {
  return new ContextScope(SupervisorJob().zb(Dispatchers_getInstance().ik()));
}
var CoroutineStart_DEFAULT_instance;
var CoroutineStart_LAZY_instance;
var CoroutineStart_ATOMIC_instance;
var CoroutineStart_UNDISPATCHED_instance;
var CoroutineStart_entriesInitialized;
function CoroutineStart_initEntries() {
  if (CoroutineStart_entriesInitialized)
    return Unit_instance;
  CoroutineStart_entriesInitialized = true;
  CoroutineStart_DEFAULT_instance = new CoroutineStart('DEFAULT', 0);
  CoroutineStart_LAZY_instance = new CoroutineStart('LAZY', 1);
  CoroutineStart_ATOMIC_instance = new CoroutineStart('ATOMIC', 2);
  CoroutineStart_UNDISPATCHED_instance = new CoroutineStart('UNDISPATCHED', 3);
}
function CoroutineStart(name, ordinal) {
  Enum.call(this, name, ordinal);
}
protoOf(CoroutineStart).qf = function (block, receiver, completion) {
  var tmp;
  switch (this.i1_1) {
    case 0:
      startCoroutineCancellable_0(block, receiver, completion);
      tmp = Unit_instance;
      break;
    case 2:
      startCoroutine(block, receiver, completion);
      tmp = Unit_instance;
      break;
    case 3:
      startCoroutineUndispatched(block, receiver, completion);
      tmp = Unit_instance;
      break;
    case 1:
      tmp = Unit_instance;
      break;
    default:
      noWhenBranchMatchedException();
      break;
  }
  return tmp;
};
protoOf(CoroutineStart).og = function () {
  return this === CoroutineStart_LAZY_getInstance();
};
function CoroutineStart_DEFAULT_getInstance() {
  CoroutineStart_initEntries();
  return CoroutineStart_DEFAULT_instance;
}
function CoroutineStart_LAZY_getInstance() {
  CoroutineStart_initEntries();
  return CoroutineStart_LAZY_instance;
}
function Delay() {
}
function get_delay(_this__u8e3s4) {
  var tmp = _this__u8e3s4.p6(Key_instance);
  var tmp0_elvis_lhs = (!(tmp == null) ? isInterface(tmp, Delay) : false) ? tmp : null;
  return tmp0_elvis_lhs == null ? get_DefaultDelay() : tmp0_elvis_lhs;
}
function delay(timeMillis, $completion) {
  if (timeMillis.y(new Long(0, 0)) <= 0)
    return Unit_instance;
  // Inline function 'kotlinx.coroutines.suspendCancellableCoroutine.<anonymous>' call
  var cancellable = new CancellableContinuationImpl(intercepted($completion), 1);
  cancellable.gi();
  // Inline function 'kotlinx.coroutines.delay.<anonymous>' call
  if (timeMillis.y(new Long(-1, 2147483647)) < 0) {
    get_delay(cancellable.i6()).jk(timeMillis, cancellable);
  }
  return cancellable.qi();
}
function delta($this, unconfined) {
  return unconfined ? new Long(0, 1) : new Long(1, 0);
}
function EventLoop() {
  CoroutineDispatcher.call(this);
  this.lk_1 = new Long(0, 0);
  this.mk_1 = false;
  this.nk_1 = null;
}
protoOf(EventLoop).ok = function () {
  var tmp0_elvis_lhs = this.nk_1;
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return false;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var queue = tmp;
  var tmp1_elvis_lhs = queue.n9();
  var tmp_0;
  if (tmp1_elvis_lhs == null) {
    return false;
  } else {
    tmp_0 = tmp1_elvis_lhs;
  }
  var task = tmp_0;
  task.dj();
  return true;
};
protoOf(EventLoop).pk = function (task) {
  var tmp0_elvis_lhs = this.nk_1;
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlin.also' call
    var this_0 = ArrayDeque_init_$Create$();
    // Inline function 'kotlinx.coroutines.EventLoop.dispatchUnconfined.<anonymous>' call
    this.nk_1 = this_0;
    tmp = this_0;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var queue = tmp;
  queue.l9(task);
};
protoOf(EventLoop).qk = function () {
  return this.lk_1.y(delta(this, true)) >= 0;
};
protoOf(EventLoop).rk = function () {
  var tmp0_safe_receiver = this.nk_1;
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.f();
  return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs;
};
protoOf(EventLoop).sk = function (unconfined) {
  this.lk_1 = this.lk_1.r1(delta(this, unconfined));
  if (!unconfined)
    this.mk_1 = true;
};
protoOf(EventLoop).tk = function (unconfined) {
  this.lk_1 = this.lk_1.s1(delta(this, unconfined));
  if (this.lk_1.y(new Long(0, 0)) > 0)
    return Unit_instance;
  // Inline function 'kotlinx.coroutines.assert' call
  if (this.mk_1) {
    this.uk();
  }
};
protoOf(EventLoop).uk = function () {
};
function ThreadLocalEventLoop() {
  ThreadLocalEventLoop_instance = this;
  this.vk_1 = commonThreadLocal(new Symbol('ThreadLocalEventLoop'));
}
protoOf(ThreadLocalEventLoop).wk = function () {
  var tmp0_elvis_lhs = this.vk_1.yk();
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlin.also' call
    var this_0 = createEventLoop();
    // Inline function 'kotlinx.coroutines.ThreadLocalEventLoop.<get-eventLoop>.<anonymous>' call
    ThreadLocalEventLoop_getInstance().vk_1.zk(this_0);
    tmp = this_0;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  return tmp;
};
var ThreadLocalEventLoop_instance;
function ThreadLocalEventLoop_getInstance() {
  if (ThreadLocalEventLoop_instance == null)
    new ThreadLocalEventLoop();
  return ThreadLocalEventLoop_instance;
}
function CompletionHandlerException(message, cause) {
  RuntimeException_init_$Init$(message, cause, this);
  captureStack(this, CompletionHandlerException);
}
function CoroutinesInternalError(message, cause) {
  Error_init_$Init$(message, cause, this);
  captureStack(this, CoroutinesInternalError);
}
function Key_1() {
}
var Key_instance_2;
function Key_getInstance_1() {
  return Key_instance_2;
}
function ParentJob() {
}
function NonDisposableHandle() {
}
protoOf(NonDisposableHandle).hi = function () {
};
protoOf(NonDisposableHandle).fg = function (cause) {
  return false;
};
protoOf(NonDisposableHandle).toString = function () {
  return 'NonDisposableHandle';
};
var NonDisposableHandle_instance;
function NonDisposableHandle_getInstance() {
  return NonDisposableHandle_instance;
}
function invokeOnCompletion(_this__u8e3s4, invokeImmediately, handler) {
  invokeImmediately = invokeImmediately === VOID ? true : invokeImmediately;
  var tmp;
  if (_this__u8e3s4 instanceof JobSupport) {
    tmp = _this__u8e3s4.bg(invokeImmediately, handler);
  } else {
    var tmp_0 = handler.lj();
    tmp = _this__u8e3s4.ag(tmp_0, invokeImmediately, JobNode$invoke$ref(handler));
  }
  return tmp;
}
function JobNode$invoke$ref($boundThis) {
  var l = function (p0) {
    $boundThis.ni(p0);
    return Unit_instance;
  };
  l.callableName = 'invoke';
  return l;
}
function get_COMPLETING_ALREADY() {
  _init_properties_JobSupport_kt__68f172();
  return COMPLETING_ALREADY;
}
var COMPLETING_ALREADY;
function get_COMPLETING_WAITING_CHILDREN() {
  _init_properties_JobSupport_kt__68f172();
  return COMPLETING_WAITING_CHILDREN;
}
var COMPLETING_WAITING_CHILDREN;
function get_COMPLETING_RETRY() {
  _init_properties_JobSupport_kt__68f172();
  return COMPLETING_RETRY;
}
var COMPLETING_RETRY;
function get_TOO_LATE_TO_CANCEL() {
  _init_properties_JobSupport_kt__68f172();
  return TOO_LATE_TO_CANCEL;
}
var TOO_LATE_TO_CANCEL;
function get_SEALED() {
  _init_properties_JobSupport_kt__68f172();
  return SEALED;
}
var SEALED;
function get_EMPTY_NEW() {
  _init_properties_JobSupport_kt__68f172();
  return EMPTY_NEW;
}
var EMPTY_NEW;
function get_EMPTY_ACTIVE() {
  _init_properties_JobSupport_kt__68f172();
  return EMPTY_ACTIVE;
}
var EMPTY_ACTIVE;
function Empty(isActive) {
  this.al_1 = isActive;
}
protoOf(Empty).af = function () {
  return this.al_1;
};
protoOf(Empty).rj = function () {
  return null;
};
protoOf(Empty).toString = function () {
  return 'Empty{' + (this.al_1 ? 'Active' : 'New') + '}';
};
function Incomplete() {
}
function NodeList() {
  LockFreeLinkedListHead.call(this);
}
protoOf(NodeList).af = function () {
  return true;
};
protoOf(NodeList).rj = function () {
  return this;
};
protoOf(NodeList).el = function (state) {
  // Inline function 'kotlin.text.buildString' call
  // Inline function 'kotlin.apply' call
  var this_0 = StringBuilder_init_$Create$();
  // Inline function 'kotlinx.coroutines.NodeList.getString.<anonymous>' call
  this_0.w5('List{');
  this_0.w5(state);
  this_0.w5('}[');
  var first = true;
  // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListHead.forEach' call
  var cur = this.sj_1;
  while (!equals(cur, this)) {
    // Inline function 'kotlinx.coroutines.NodeList.getString.<anonymous>.<anonymous>' call
    var node = cur;
    if (node instanceof JobNode) {
      if (first) {
        first = false;
      } else
        this_0.w5(', ');
      this_0.v5(node);
    }
    cur = cur.sj_1;
  }
  this_0.w5(']');
  return this_0.toString();
};
protoOf(NodeList).toString = function () {
  return get_DEBUG() ? this.el('Active') : protoOf(LockFreeLinkedListHead).toString.call(this);
};
function JobNode() {
  LockFreeLinkedListNode.call(this);
}
protoOf(JobNode).qj = function () {
  var tmp = this.pj_1;
  if (!(tmp == null))
    return tmp;
  else {
    throwUninitializedPropertyAccessException('job');
  }
};
protoOf(JobNode).af = function () {
  return true;
};
protoOf(JobNode).rj = function () {
  return null;
};
protoOf(JobNode).hi = function () {
  return this.qj().cg(this);
};
protoOf(JobNode).toString = function () {
  return get_classSimpleName(this) + '@' + get_hexAddress(this) + '[job@' + get_hexAddress(this.qj()) + ']';
};
function _set_exceptionsHolder__tqm22h($this, value) {
  $this.jl_1.kotlinx$atomicfu$value = value;
}
function _get_exceptionsHolder__nhszp($this) {
  return $this.jl_1.kotlinx$atomicfu$value;
}
function allocateList($this) {
  return ArrayList_init_$Create$(4);
}
function finalizeFinishingState($this, state, proposedUpdate) {
  // Inline function 'kotlinx.coroutines.assert' call
  // Inline function 'kotlinx.coroutines.assert' call
  // Inline function 'kotlinx.coroutines.assert' call
  var tmp0_safe_receiver = proposedUpdate instanceof CompletedExceptionally ? proposedUpdate : null;
  var proposedException = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ff_1;
  var wasCancelling;
  // Inline function 'kotlinx.coroutines.internal.synchronized' call
  // Inline function 'kotlinx.coroutines.internal.synchronizedImpl' call
  // Inline function 'kotlinx.coroutines.JobSupport.finalizeFinishingState.<anonymous>' call
  wasCancelling = state.kl();
  var exceptions = state.ll(proposedException);
  var finalCause = getFinalRootCause($this, state, exceptions);
  if (!(finalCause == null)) {
    addSuppressedExceptions($this, finalCause, exceptions);
  }
  var finalException = finalCause;
  var finalState = finalException == null ? proposedUpdate : finalException === proposedException ? proposedUpdate : new CompletedExceptionally(finalException);
  if (!(finalException == null)) {
    var handled = cancelParent($this, finalException) || $this.mg(finalException);
    if (handled) {
      (finalState instanceof CompletedExceptionally ? finalState : THROW_CCE()).di();
    }
  }
  if (!wasCancelling) {
    $this.jg(finalException);
  }
  $this.ef(finalState);
  var casSuccess = $this.te_1.atomicfu$compareAndSet(state, boxIncomplete(finalState));
  // Inline function 'kotlinx.coroutines.assert' call
  completeStateFinalization($this, state, finalState);
  return finalState;
}
function getFinalRootCause($this, state, exceptions) {
  if (exceptions.f()) {
    if (state.kl()) {
      // Inline function 'kotlinx.coroutines.JobSupport.defaultCancellationException' call
      return new JobCancellationException(null == null ? $this.df() : null, null, $this);
    }
    return null;
  }
  var tmp$ret$2;
  $l$block: {
    // Inline function 'kotlin.collections.firstOrNull' call
    var _iterator__ex2g4s = exceptions.k();
    while (_iterator__ex2g4s.l()) {
      var element = _iterator__ex2g4s.m();
      // Inline function 'kotlinx.coroutines.JobSupport.getFinalRootCause.<anonymous>' call
      if (!(element instanceof CancellationException)) {
        tmp$ret$2 = element;
        break $l$block;
      }
    }
    tmp$ret$2 = null;
  }
  var firstNonCancellation = tmp$ret$2;
  if (!(firstNonCancellation == null))
    return firstNonCancellation;
  var first = exceptions.t(0);
  if (first instanceof TimeoutCancellationException) {
    var tmp$ret$4;
    $l$block_0: {
      // Inline function 'kotlin.collections.firstOrNull' call
      var _iterator__ex2g4s_0 = exceptions.k();
      while (_iterator__ex2g4s_0.l()) {
        var element_0 = _iterator__ex2g4s_0.m();
        // Inline function 'kotlinx.coroutines.JobSupport.getFinalRootCause.<anonymous>' call
        var tmp;
        if (!(element_0 === first)) {
          tmp = element_0 instanceof TimeoutCancellationException;
        } else {
          tmp = false;
        }
        if (tmp) {
          tmp$ret$4 = element_0;
          break $l$block_0;
        }
      }
      tmp$ret$4 = null;
    }
    var detailedTimeoutException = tmp$ret$4;
    if (!(detailedTimeoutException == null))
      return detailedTimeoutException;
  }
  return first;
}
function addSuppressedExceptions($this, rootCause, exceptions) {
  if (exceptions.n() <= 1)
    return Unit_instance;
  var seenExceptions = identitySet(exceptions.n());
  var unwrappedCause = unwrap(rootCause);
  var _iterator__ex2g4s = exceptions.k();
  while (_iterator__ex2g4s.l()) {
    var exception = _iterator__ex2g4s.m();
    var unwrapped = unwrap(exception);
    var tmp;
    var tmp_0;
    if (!(unwrapped === rootCause) && !(unwrapped === unwrappedCause)) {
      tmp_0 = !(unwrapped instanceof CancellationException);
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = seenExceptions.u(unwrapped);
    } else {
      tmp = false;
    }
    if (tmp) {
      addSuppressed(rootCause, unwrapped);
    }
  }
}
function tryFinalizeSimpleState($this, state, update) {
  // Inline function 'kotlinx.coroutines.assert' call
  // Inline function 'kotlinx.coroutines.assert' call
  if (!$this.te_1.atomicfu$compareAndSet(state, boxIncomplete(update)))
    return false;
  $this.jg(null);
  $this.ef(update);
  completeStateFinalization($this, state, update);
  return true;
}
function completeStateFinalization($this, state, update) {
  var tmp0_safe_receiver = $this.sf();
  if (tmp0_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.JobSupport.completeStateFinalization.<anonymous>' call
    tmp0_safe_receiver.hi();
    $this.rf(NonDisposableHandle_instance);
  }
  var tmp1_safe_receiver = update instanceof CompletedExceptionally ? update : null;
  var cause = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.ff_1;
  if (state instanceof JobNode) {
    try {
      state.ni(cause);
    } catch ($p) {
      if ($p instanceof Error) {
        var ex = $p;
        $this.lf(new CompletionHandlerException('Exception in completion handler ' + state.toString() + ' for ' + $this.toString(), ex));
      } else {
        throw $p;
      }
    }
  } else {
    var tmp2_safe_receiver = state.rj();
    if (tmp2_safe_receiver == null)
      null;
    else {
      notifyCompletion(tmp2_safe_receiver, $this, cause);
    }
  }
}
function notifyCancelling($this, list, cause) {
  $this.jg(cause);
  list.fl(4);
  // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers' call
  var exception = null;
  // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListHead.forEach' call
  var cur = list.sj_1;
  while (!equals(cur, list)) {
    // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>' call
    var node = cur;
    var tmp;
    if (node instanceof JobNode) {
      // Inline function 'kotlinx.coroutines.JobSupport.notifyCancelling.<anonymous>' call
      tmp = node.lj();
    } else {
      tmp = false;
    }
    if (tmp) {
      try {
        node.ni(cause);
      } catch ($p) {
        if ($p instanceof Error) {
          var ex = $p;
          var tmp0_safe_receiver = exception;
          var tmp_0;
          if (tmp0_safe_receiver == null) {
            tmp_0 = null;
          } else {
            // Inline function 'kotlin.apply' call
            // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>.<anonymous>' call
            addSuppressed(tmp0_safe_receiver, ex);
            tmp_0 = tmp0_safe_receiver;
          }
          if (tmp_0 == null) {
            // Inline function 'kotlin.run' call
            // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>.<anonymous>' call
            exception = new CompletionHandlerException('Exception in completion handler ' + node.toString() + ' for ' + $this.toString(), ex);
          }
        } else {
          throw $p;
        }
      }
    }
    cur = cur.sj_1;
  }
  var tmp0_safe_receiver_0 = exception;
  if (tmp0_safe_receiver_0 == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>' call
    $this.lf(tmp0_safe_receiver_0);
  }
  cancelParent($this, cause);
}
function cancelParent($this, cause) {
  if ($this.kg())
    return true;
  var isCancellation = cause instanceof CancellationException;
  var parent = $this.sf();
  if (parent === null || parent === NonDisposableHandle_instance) {
    return isCancellation;
  }
  return parent.fg(cause) || isCancellation;
}
function notifyCompletion(_this__u8e3s4, $this, cause) {
  _this__u8e3s4.fl(1);
  // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers' call
  var exception = null;
  // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListHead.forEach' call
  var cur = _this__u8e3s4.sj_1;
  while (!equals(cur, _this__u8e3s4)) {
    // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>' call
    var node = cur;
    var tmp;
    if (node instanceof JobNode) {
      // Inline function 'kotlinx.coroutines.JobSupport.notifyCompletion.<anonymous>' call
      tmp = true;
    } else {
      tmp = false;
    }
    if (tmp) {
      try {
        node.ni(cause);
      } catch ($p) {
        if ($p instanceof Error) {
          var ex = $p;
          var tmp0_safe_receiver = exception;
          var tmp_0;
          if (tmp0_safe_receiver == null) {
            tmp_0 = null;
          } else {
            // Inline function 'kotlin.apply' call
            // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>.<anonymous>' call
            addSuppressed(tmp0_safe_receiver, ex);
            tmp_0 = tmp0_safe_receiver;
          }
          if (tmp_0 == null) {
            // Inline function 'kotlin.run' call
            // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>.<anonymous>' call
            exception = new CompletionHandlerException('Exception in completion handler ' + node.toString() + ' for ' + $this.toString(), ex);
          }
        } else {
          throw $p;
        }
      }
    }
    cur = cur.sj_1;
  }
  var tmp0_safe_receiver_0 = exception;
  if (tmp0_safe_receiver_0 == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.JobSupport.notifyHandlers.<anonymous>' call
    $this.lf(tmp0_safe_receiver_0);
  }
}
function startInternal($this, state) {
  if (state instanceof Empty) {
    if (state.al_1)
      return 0;
    if (!$this.te_1.atomicfu$compareAndSet(state, get_EMPTY_ACTIVE()))
      return -1;
    $this.wf();
    return 1;
  } else {
    if (state instanceof InactiveNodeList) {
      if (!$this.te_1.atomicfu$compareAndSet(state, state.ml_1))
        return -1;
      $this.wf();
      return 1;
    } else {
      return 0;
    }
  }
}
function promoteEmptyToNodeList($this, state) {
  var list = new NodeList();
  var update = state.al_1 ? list : new InactiveNodeList(list);
  $this.te_1.atomicfu$compareAndSet(state, update);
}
function promoteSingleToNodeList($this, state) {
  state.xj(new NodeList());
  // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListNode.nextNode' call
  var list = state.sj_1;
  $this.te_1.atomicfu$compareAndSet(state, list);
}
function cancelMakeCompleting($this, cause) {
  // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
  while (true) {
    // Inline function 'kotlinx.coroutines.JobSupport.cancelMakeCompleting.<anonymous>' call
    var state = $this.tf();
    var tmp;
    if (!(!(state == null) ? isInterface(state, Incomplete) : false)) {
      tmp = true;
    } else {
      var tmp_0;
      if (state instanceof Finishing) {
        tmp_0 = state.nl();
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    }
    if (tmp) {
      return get_COMPLETING_ALREADY();
    }
    var proposedUpdate = new CompletedExceptionally(createCauseException($this, cause));
    var finalState = tryMakeCompleting($this, state, proposedUpdate);
    if (!(finalState === get_COMPLETING_RETRY()))
      return finalState;
  }
}
function createCauseException($this, cause) {
  var tmp;
  if (cause == null ? true : cause instanceof Error) {
    var tmp_0;
    if (cause == null) {
      // Inline function 'kotlinx.coroutines.JobSupport.defaultCancellationException' call
      tmp_0 = new JobCancellationException(null == null ? $this.df() : null, null, $this);
    } else {
      tmp_0 = cause;
    }
    tmp = tmp_0;
  } else {
    tmp = ((!(cause == null) ? isInterface(cause, ParentJob) : false) ? cause : THROW_CCE()).hg();
  }
  return tmp;
}
function makeCancelling($this, cause) {
  var causeExceptionCache = null;
  // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
  while (true) {
    var tmp1 = $this.tf();
    $l$block: {
      // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>' call
      if (tmp1 instanceof Finishing) {
        // Inline function 'kotlinx.coroutines.internal.synchronized' call
        // Inline function 'kotlinx.coroutines.internal.synchronizedImpl' call
        // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>.<anonymous>' call
        if (tmp1.ol())
          return get_TOO_LATE_TO_CANCEL();
        var wasCancelling = tmp1.kl();
        if (!(cause == null) || !wasCancelling) {
          var tmp0_elvis_lhs = causeExceptionCache;
          var tmp;
          if (tmp0_elvis_lhs == null) {
            // Inline function 'kotlin.also' call
            var this_0 = createCauseException($this, cause);
            // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>.<anonymous>.<anonymous>' call
            causeExceptionCache = this_0;
            tmp = this_0;
          } else {
            tmp = tmp0_elvis_lhs;
          }
          var causeException = tmp;
          tmp1.pl(causeException);
        }
        // Inline function 'kotlin.takeIf' call
        var this_1 = tmp1.ql();
        var tmp_0;
        // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>.<anonymous>.<anonymous>' call
        if (!wasCancelling) {
          tmp_0 = this_1;
        } else {
          tmp_0 = null;
        }
        var notifyRootCause = tmp_0;
        if (notifyRootCause == null)
          null;
        else {
          // Inline function 'kotlin.let' call
          // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>.<anonymous>' call
          notifyCancelling($this, tmp1.gl_1, notifyRootCause);
        }
        return get_COMPLETING_ALREADY();
      } else {
        if (!(tmp1 == null) ? isInterface(tmp1, Incomplete) : false) {
          var tmp2_elvis_lhs = causeExceptionCache;
          var tmp_1;
          if (tmp2_elvis_lhs == null) {
            // Inline function 'kotlin.also' call
            var this_2 = createCauseException($this, cause);
            // Inline function 'kotlinx.coroutines.JobSupport.makeCancelling.<anonymous>.<anonymous>' call
            causeExceptionCache = this_2;
            tmp_1 = this_2;
          } else {
            tmp_1 = tmp2_elvis_lhs;
          }
          var causeException_0 = tmp_1;
          if (tmp1.af()) {
            if (tryMakeCancelling($this, tmp1, causeException_0))
              return get_COMPLETING_ALREADY();
          } else {
            var finalState = tryMakeCompleting($this, tmp1, new CompletedExceptionally(causeException_0));
            if (finalState === get_COMPLETING_ALREADY()) {
              // Inline function 'kotlin.error' call
              var message = 'Cannot happen in ' + toString(tmp1);
              throw IllegalStateException_init_$Create$(toString(message));
            } else if (finalState === get_COMPLETING_RETRY()) {
              break $l$block;
            } else
              return finalState;
          }
        } else {
          return get_TOO_LATE_TO_CANCEL();
        }
      }
    }
  }
}
function getOrPromoteCancellingList($this, state) {
  var tmp0_elvis_lhs = state.rj();
  var tmp;
  if (tmp0_elvis_lhs == null) {
    var tmp_0;
    if (state instanceof Empty) {
      tmp_0 = new NodeList();
    } else {
      if (state instanceof JobNode) {
        promoteSingleToNodeList($this, state);
        tmp_0 = null;
      } else {
        var message = 'State should have list: ' + toString(state);
        throw IllegalStateException_init_$Create$(toString(message));
      }
    }
    tmp = tmp_0;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  return tmp;
}
function tryMakeCancelling($this, state, rootCause) {
  // Inline function 'kotlinx.coroutines.assert' call
  // Inline function 'kotlinx.coroutines.assert' call
  var tmp0_elvis_lhs = getOrPromoteCancellingList($this, state);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return false;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var list = tmp;
  var cancelling = new Finishing(list, false, rootCause);
  if (!$this.te_1.atomicfu$compareAndSet(state, cancelling))
    return false;
  notifyCancelling($this, list, rootCause);
  return true;
}
function tryMakeCompleting($this, state, proposedUpdate) {
  if (!(!(state == null) ? isInterface(state, Incomplete) : false))
    return get_COMPLETING_ALREADY();
  var tmp;
  var tmp_0;
  var tmp_1;
  if (state instanceof Empty) {
    tmp_1 = true;
  } else {
    tmp_1 = state instanceof JobNode;
  }
  if (tmp_1) {
    tmp_0 = !(state instanceof ChildHandleNode);
  } else {
    tmp_0 = false;
  }
  if (tmp_0) {
    tmp = !(proposedUpdate instanceof CompletedExceptionally);
  } else {
    tmp = false;
  }
  if (tmp) {
    if (tryFinalizeSimpleState($this, state, proposedUpdate)) {
      return proposedUpdate;
    }
    return get_COMPLETING_RETRY();
  }
  return tryMakeCompletingSlowPath($this, state, proposedUpdate);
}
function tryMakeCompletingSlowPath($this, state, proposedUpdate) {
  var tmp0_elvis_lhs = getOrPromoteCancellingList($this, state);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return get_COMPLETING_RETRY();
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var list = tmp;
  var tmp1_elvis_lhs = state instanceof Finishing ? state : null;
  var finishing = tmp1_elvis_lhs == null ? new Finishing(list, false, null) : tmp1_elvis_lhs;
  var notifyRootCause;
  // Inline function 'kotlinx.coroutines.internal.synchronized' call
  // Inline function 'kotlinx.coroutines.internal.synchronizedImpl' call
  if (finishing.nl())
    return get_COMPLETING_ALREADY();
  finishing.rl(true);
  if (!(finishing === state)) {
    if (!$this.te_1.atomicfu$compareAndSet(state, finishing))
      return get_COMPLETING_RETRY();
  }
  // Inline function 'kotlinx.coroutines.assert' call
  var wasCancelling = finishing.kl();
  var tmp0_safe_receiver = proposedUpdate instanceof CompletedExceptionally ? proposedUpdate : null;
  if (tmp0_safe_receiver == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath.<anonymous>.<anonymous>' call
    finishing.pl(tmp0_safe_receiver.ff_1);
  }
  // Inline function 'kotlin.takeIf' call
  var this_0 = finishing.ql();
  var tmp_0;
  // Inline function 'kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath.<anonymous>.<anonymous>' call
  if (!wasCancelling) {
    tmp_0 = this_0;
  } else {
    tmp_0 = null;
  }
  notifyRootCause = tmp_0;
  if (notifyRootCause == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath.<anonymous>' call
    notifyCancelling($this, list, notifyRootCause);
  }
  var child = nextChild(list, $this);
  if (!(child == null) && tryWaitForChild($this, finishing, child, proposedUpdate))
    return get_COMPLETING_WAITING_CHILDREN();
  list.fl(2);
  var anotherChild = nextChild(list, $this);
  if (!(anotherChild == null) && tryWaitForChild($this, finishing, anotherChild, proposedUpdate))
    return get_COMPLETING_WAITING_CHILDREN();
  return finalizeFinishingState($this, finishing, proposedUpdate);
}
function _get_exceptionOrNull__b3j7js(_this__u8e3s4, $this) {
  var tmp0_safe_receiver = _this__u8e3s4 instanceof CompletedExceptionally ? _this__u8e3s4 : null;
  return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ff_1;
}
function tryWaitForChild($this, state, child, proposedUpdate) {
  var $this_0 = $this;
  var state_0 = state;
  var child_0 = child;
  var proposedUpdate_0 = proposedUpdate;
  $l$1: do {
    $l$0: do {
      var handle = invokeOnCompletion(child_0.wl_1, false, new ChildCompletion($this_0, state_0, child_0, proposedUpdate_0));
      if (!(handle === NonDisposableHandle_instance))
        return true;
      var tmp0_elvis_lhs = nextChild(child_0, $this_0);
      var tmp;
      if (tmp0_elvis_lhs == null) {
        return false;
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var nextChild_0 = tmp;
      var tmp0 = $this_0;
      var tmp1 = state_0;
      var tmp3 = proposedUpdate_0;
      $this_0 = tmp0;
      state_0 = tmp1;
      child_0 = nextChild_0;
      proposedUpdate_0 = tmp3;
      continue $l$0;
    }
     while (false);
  }
   while (true);
}
function continueCompleting($this, state, lastChild, proposedUpdate) {
  // Inline function 'kotlinx.coroutines.assert' call
  var waitChild = nextChild(lastChild, $this);
  if (!(waitChild == null) && tryWaitForChild($this, state, waitChild, proposedUpdate))
    return Unit_instance;
  state.gl_1.fl(2);
  var waitChildAgain = nextChild(lastChild, $this);
  if (!(waitChildAgain == null) && tryWaitForChild($this, state, waitChildAgain, proposedUpdate)) {
    return Unit_instance;
  }
  var finalState = finalizeFinishingState($this, state, proposedUpdate);
  $this.kf(finalState);
}
function nextChild(_this__u8e3s4, $this) {
  var cur = _this__u8e3s4;
  $l$loop: while (true) {
    // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListNode.isRemoved' call
    if (!cur.uj_1) {
      break $l$loop;
    }
    // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListNode.prevNode' call
    cur = cur.tj_1;
  }
  $l$loop_0: while (true) {
    // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListNode.nextNode' call
    cur = cur.sj_1;
    // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListNode.isRemoved' call
    if (cur.uj_1)
      continue $l$loop_0;
    if (cur instanceof ChildHandleNode)
      return cur;
    if (cur instanceof NodeList)
      return null;
  }
}
function stateString($this, state) {
  var tmp;
  if (state instanceof Finishing) {
    tmp = state.kl() ? 'Cancelling' : state.nl() ? 'Completing' : 'Active';
  } else {
    if (!(state == null) ? isInterface(state, Incomplete) : false) {
      tmp = state.af() ? 'Active' : 'New';
    } else {
      if (state instanceof CompletedExceptionally) {
        tmp = 'Cancelled';
      } else {
        tmp = 'Completed';
      }
    }
  }
  return tmp;
}
function Finishing(list, isCompleting, rootCause) {
  SynchronizedObject.call(this);
  this.gl_1 = list;
  this.hl_1 = atomic$boolean$1(isCompleting);
  this.il_1 = atomic$ref$1(rootCause);
  this.jl_1 = atomic$ref$1(null);
}
protoOf(Finishing).rj = function () {
  return this.gl_1;
};
protoOf(Finishing).rl = function (value) {
  this.hl_1.kotlinx$atomicfu$value = value;
};
protoOf(Finishing).nl = function () {
  return this.hl_1.kotlinx$atomicfu$value;
};
protoOf(Finishing).xl = function (value) {
  this.il_1.kotlinx$atomicfu$value = value;
};
protoOf(Finishing).ql = function () {
  return this.il_1.kotlinx$atomicfu$value;
};
protoOf(Finishing).ol = function () {
  return _get_exceptionsHolder__nhszp(this) === get_SEALED();
};
protoOf(Finishing).kl = function () {
  return !(this.ql() == null);
};
protoOf(Finishing).af = function () {
  return this.ql() == null;
};
protoOf(Finishing).ll = function (proposedException) {
  var eh = _get_exceptionsHolder__nhszp(this);
  var tmp;
  if (eh == null) {
    tmp = allocateList(this);
  } else {
    if (eh instanceof Error) {
      // Inline function 'kotlin.also' call
      var this_0 = allocateList(this);
      // Inline function 'kotlinx.coroutines.Finishing.sealLocked.<anonymous>' call
      this_0.u(eh);
      tmp = this_0;
    } else {
      if (eh instanceof ArrayList) {
        tmp = eh instanceof ArrayList ? eh : THROW_CCE();
      } else {
        var message = 'State is ' + toString_0(eh);
        throw IllegalStateException_init_$Create$(toString(message));
      }
    }
  }
  var list = tmp;
  var rootCause = this.ql();
  if (rootCause == null)
    null;
  else {
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.Finishing.sealLocked.<anonymous>' call
    list.z2(0, rootCause);
  }
  if (!(proposedException == null) && !equals(proposedException, rootCause)) {
    list.u(proposedException);
  }
  _set_exceptionsHolder__tqm22h(this, get_SEALED());
  return list;
};
protoOf(Finishing).pl = function (exception) {
  var rootCause = this.ql();
  if (rootCause == null) {
    this.xl(exception);
    return Unit_instance;
  }
  if (exception === rootCause)
    return Unit_instance;
  var eh = _get_exceptionsHolder__nhszp(this);
  if (eh == null) {
    _set_exceptionsHolder__tqm22h(this, exception);
  } else {
    if (eh instanceof Error) {
      if (exception === eh)
        return Unit_instance;
      // Inline function 'kotlin.apply' call
      var this_0 = allocateList(this);
      // Inline function 'kotlinx.coroutines.Finishing.addExceptionLocked.<anonymous>' call
      this_0.u(eh);
      this_0.u(exception);
      _set_exceptionsHolder__tqm22h(this, this_0);
    } else {
      if (eh instanceof ArrayList) {
        (eh instanceof ArrayList ? eh : THROW_CCE()).u(exception);
      } else {
        // Inline function 'kotlin.error' call
        var message = 'State is ' + toString_0(eh);
        throw IllegalStateException_init_$Create$(toString(message));
      }
    }
  }
};
protoOf(Finishing).toString = function () {
  return 'Finishing[cancelling=' + this.kl() + ', completing=' + this.nl() + ', rootCause=' + toString_0(this.ql()) + ', exceptions=' + toString_0(_get_exceptionsHolder__nhszp(this)) + ', list=' + this.gl_1.toString() + ']';
};
function ChildCompletion(parent, state, child, proposedUpdate) {
  JobNode.call(this);
  this.cm_1 = parent;
  this.dm_1 = state;
  this.em_1 = child;
  this.fm_1 = proposedUpdate;
}
protoOf(ChildCompletion).lj = function () {
  return false;
};
protoOf(ChildCompletion).ni = function (cause) {
  continueCompleting(this.cm_1, this.dm_1, this.em_1, this.fm_1);
};
function JobSupport(active) {
  this.te_1 = atomic$ref$1(active ? get_EMPTY_ACTIVE() : get_EMPTY_NEW());
  this.ue_1 = atomic$ref$1(null);
}
protoOf(JobSupport).c1 = function () {
  return Key_instance_2;
};
protoOf(JobSupport).rf = function (value) {
  this.ue_1.kotlinx$atomicfu$value = value;
};
protoOf(JobSupport).sf = function () {
  return this.ue_1.kotlinx$atomicfu$value;
};
protoOf(JobSupport).ve = function (parent) {
  // Inline function 'kotlinx.coroutines.assert' call
  if (parent == null) {
    this.rf(NonDisposableHandle_instance);
    return Unit_instance;
  }
  parent.vf();
  var handle = parent.ig(this);
  this.rf(handle);
  if (this.uf()) {
    handle.hi();
    this.rf(NonDisposableHandle_instance);
  }
};
protoOf(JobSupport).tf = function () {
  return this.te_1.kotlinx$atomicfu$value;
};
protoOf(JobSupport).af = function () {
  var state = this.tf();
  var tmp;
  if (!(state == null) ? isInterface(state, Incomplete) : false) {
    tmp = state.af();
  } else {
    tmp = false;
  }
  return tmp;
};
protoOf(JobSupport).uf = function () {
  var tmp = this.tf();
  return !(!(tmp == null) ? isInterface(tmp, Incomplete) : false);
};
protoOf(JobSupport).vf = function () {
  // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
  while (true) {
    // Inline function 'kotlinx.coroutines.JobSupport.start.<anonymous>' call
    var state = this.tf();
    var tmp0_subject = startInternal(this, state);
    if (tmp0_subject === 0)
      return false;
    else if (tmp0_subject === 1)
      return true;
  }
};
protoOf(JobSupport).wf = function () {
};
protoOf(JobSupport).xf = function () {
  var state = this.tf();
  var tmp;
  if (state instanceof Finishing) {
    var tmp0_safe_receiver = state.ql();
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yf(tmp0_safe_receiver, get_classSimpleName(this) + ' is cancelling');
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      var message = 'Job is still new or active: ' + this.toString();
      throw IllegalStateException_init_$Create$(toString(message));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    tmp = tmp_0;
  } else {
    if (!(state == null) ? isInterface(state, Incomplete) : false) {
      var message_0 = 'Job is still new or active: ' + this.toString();
      throw IllegalStateException_init_$Create$(toString(message_0));
    } else {
      if (state instanceof CompletedExceptionally) {
        tmp = this.zf(state.ff_1);
      } else {
        tmp = new JobCancellationException(get_classSimpleName(this) + ' has completed normally', null, this);
      }
    }
  }
  return tmp;
};
protoOf(JobSupport).yf = function (_this__u8e3s4, message) {
  var tmp0_elvis_lhs = _this__u8e3s4 instanceof CancellationException ? _this__u8e3s4 : null;
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlinx.coroutines.JobSupport.defaultCancellationException' call
    tmp = new JobCancellationException(message == null ? this.df() : message, _this__u8e3s4, this);
  } else {
    tmp = tmp0_elvis_lhs;
  }
  return tmp;
};
protoOf(JobSupport).zf = function (_this__u8e3s4, message, $super) {
  message = message === VOID ? null : message;
  return $super === VOID ? this.yf(_this__u8e3s4, message) : $super.yf.call(this, _this__u8e3s4, message);
};
protoOf(JobSupport).ag = function (onCancelling, invokeImmediately, handler) {
  var tmp;
  if (onCancelling) {
    tmp = new InvokeOnCancelling(handler);
  } else {
    tmp = new InvokeOnCompletion(handler);
  }
  return this.bg(invokeImmediately, tmp);
};
protoOf(JobSupport).bg = function (invokeImmediately, node) {
  node.pj_1 = this;
  var tmp$ret$0;
  $l$block_1: {
    // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList' call
    // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
    while (true) {
      // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList.<anonymous>' call
      var state = this.tf();
      if (state instanceof Empty) {
        if (state.al_1) {
          if (this.te_1.atomicfu$compareAndSet(state, node)) {
            tmp$ret$0 = true;
            break $l$block_1;
          }
        } else {
          promoteEmptyToNodeList(this, state);
        }
      } else {
        if (!(state == null) ? isInterface(state, Incomplete) : false) {
          var list = state.rj();
          if (list == null) {
            promoteSingleToNodeList(this, state instanceof JobNode ? state : THROW_CCE());
          } else {
            // Inline function 'kotlinx.coroutines.JobSupport.invokeOnCompletionInternal.<anonymous>' call
            var tmp;
            if (node.lj()) {
              var tmp0_safe_receiver = state instanceof Finishing ? state : null;
              var rootCause = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ql();
              var tmp_0;
              if (rootCause == null) {
                tmp_0 = list.vj(node, 5);
              } else {
                if (invokeImmediately) {
                  node.ni(rootCause);
                }
                return NonDisposableHandle_instance;
              }
              tmp = tmp_0;
            } else {
              tmp = list.vj(node, 1);
            }
            if (tmp) {
              tmp$ret$0 = true;
              break $l$block_1;
            }
          }
        } else {
          tmp$ret$0 = false;
          break $l$block_1;
        }
      }
    }
  }
  var added = tmp$ret$0;
  if (added)
    return node;
  else if (invokeImmediately) {
    var tmp_1 = this.tf();
    var tmp0_safe_receiver_0 = tmp_1 instanceof CompletedExceptionally ? tmp_1 : null;
    node.ni(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.ff_1);
  }
  return NonDisposableHandle_instance;
};
protoOf(JobSupport).cg = function (node) {
  // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
  while (true) {
    // Inline function 'kotlinx.coroutines.JobSupport.removeNode.<anonymous>' call
    var state = this.tf();
    if (state instanceof JobNode) {
      if (!(state === node))
        return Unit_instance;
      if (this.te_1.atomicfu$compareAndSet(state, get_EMPTY_ACTIVE()))
        return Unit_instance;
    } else {
      if (!(state == null) ? isInterface(state, Incomplete) : false) {
        if (!(state.rj() == null)) {
          node.wj();
        }
        return Unit_instance;
      } else {
        return Unit_instance;
      }
    }
  }
};
protoOf(JobSupport).dg = function () {
  return false;
};
protoOf(JobSupport).df = function () {
  return 'Job was cancelled';
};
protoOf(JobSupport).eg = function (parentJob) {
  this.gg(parentJob);
};
protoOf(JobSupport).fg = function (cause) {
  if (cause instanceof CancellationException)
    return true;
  return this.gg(cause) && this.lg();
};
protoOf(JobSupport).gg = function (cause) {
  var finalState = get_COMPLETING_ALREADY();
  if (this.dg()) {
    finalState = cancelMakeCompleting(this, cause);
    if (finalState === get_COMPLETING_WAITING_CHILDREN())
      return true;
  }
  if (finalState === get_COMPLETING_ALREADY()) {
    finalState = makeCancelling(this, cause);
  }
  var tmp;
  if (finalState === get_COMPLETING_ALREADY()) {
    tmp = true;
  } else if (finalState === get_COMPLETING_WAITING_CHILDREN()) {
    tmp = true;
  } else if (finalState === get_TOO_LATE_TO_CANCEL()) {
    tmp = false;
  } else {
    this.kf(finalState);
    tmp = true;
  }
  return tmp;
};
protoOf(JobSupport).hg = function () {
  var state = this.tf();
  var tmp;
  if (state instanceof Finishing) {
    tmp = state.ql();
  } else {
    if (state instanceof CompletedExceptionally) {
      tmp = state.ff_1;
    } else {
      if (!(state == null) ? isInterface(state, Incomplete) : false) {
        var message = 'Cannot be cancelling child in this state: ' + toString(state);
        throw IllegalStateException_init_$Create$(toString(message));
      } else {
        tmp = null;
      }
    }
  }
  var rootCause = tmp;
  var tmp1_elvis_lhs = rootCause instanceof CancellationException ? rootCause : null;
  return tmp1_elvis_lhs == null ? new JobCancellationException('Parent job is ' + stateString(this, state), rootCause, this) : tmp1_elvis_lhs;
};
protoOf(JobSupport).if = function (proposedUpdate) {
  // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
  while (true) {
    var tmp1 = this.tf();
    $l$block: {
      // Inline function 'kotlinx.coroutines.JobSupport.makeCompletingOnce.<anonymous>' call
      var finalState = tryMakeCompleting(this, tmp1, proposedUpdate);
      if (finalState === get_COMPLETING_ALREADY())
        throw IllegalStateException_init_$Create$_0('Job ' + this.toString() + ' is already complete or completing, ' + ('but is being completed with ' + toString_0(proposedUpdate)), _get_exceptionOrNull__b3j7js(proposedUpdate, this));
      else if (finalState === get_COMPLETING_RETRY()) {
        break $l$block;
      } else
        return finalState;
    }
  }
};
protoOf(JobSupport).ig = function (child) {
  // Inline function 'kotlin.also' call
  var this_0 = new ChildHandleNode(child);
  // Inline function 'kotlinx.coroutines.JobSupport.attachChild.<anonymous>' call
  this_0.pj_1 = this;
  var node = this_0;
  var tmp$ret$1;
  $l$block_1: {
    // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList' call
    // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call
    while (true) {
      // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList.<anonymous>' call
      var state = this.tf();
      if (state instanceof Empty) {
        if (state.al_1) {
          if (this.te_1.atomicfu$compareAndSet(state, node)) {
            tmp$ret$1 = true;
            break $l$block_1;
          }
        } else {
          promoteEmptyToNodeList(this, state);
        }
      } else {
        if (!(state == null) ? isInterface(state, Incomplete) : false) {
          var list = state.rj();
          if (list == null) {
            promoteSingleToNodeList(this, state instanceof JobNode ? state : THROW_CCE());
          } else {
            // Inline function 'kotlinx.coroutines.JobSupport.attachChild.<anonymous>' call
            var addedBeforeCancellation = list.vj(node, 7);
            var tmp;
            if (addedBeforeCancellation) {
              tmp = true;
            } else {
              var addedBeforeCompletion = list.vj(node, 3);
              var latestState = this.tf();
              var tmp_0;
              if (latestState instanceof Finishing) {
                tmp_0 = latestState.ql();
              } else {
                // Inline function 'kotlinx.coroutines.assert' call
                var tmp0_safe_receiver = latestState instanceof CompletedExceptionally ? latestState : null;
                tmp_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ff_1;
              }
              var rootCause = tmp_0;
              node.ni(rootCause);
              var tmp_1;
              if (addedBeforeCompletion) {
                // Inline function 'kotlinx.coroutines.assert' call
                tmp_1 = true;
              } else {
                return NonDisposableHandle_instance;
              }
              tmp = tmp_1;
            }
            if (tmp) {
              tmp$ret$1 = true;
              break $l$block_1;
            }
          }
        } else {
          tmp$ret$1 = false;
          break $l$block_1;
        }
      }
    }
  }
  var added = tmp$ret$1;
  if (added)
    return node;
  var tmp_2 = this.tf();
  var tmp0_safe_receiver_0 = tmp_2 instanceof CompletedExceptionally ? tmp_2 : null;
  node.ni(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.ff_1);
  return NonDisposableHandle_instance;
};
protoOf(JobSupport).lf = function (exception) {
  throw exception;
};
protoOf(JobSupport).jg = function (cause) {
};
protoOf(JobSupport).kg = function () {
  return false;
};
protoOf(JobSupport).lg = function () {
  return true;
};
protoOf(JobSupport).mg = function (exception) {
  return false;
};
protoOf(JobSupport).ef = function (state) {
};
protoOf(JobSupport).kf = function (state) {
};
protoOf(JobSupport).toString = function () {
  return this.ng() + '@' + get_hexAddress(this);
};
protoOf(JobSupport).ng = function () {
  return this.mf() + '{' + stateString(this, this.tf()) + '}';
};
protoOf(JobSupport).mf = function () {
  return get_classSimpleName(this);
};
function boxIncomplete(_this__u8e3s4) {
  _init_properties_JobSupport_kt__68f172();
  var tmp;
  if (!(_this__u8e3s4 == null) ? isInterface(_this__u8e3s4, Incomplete) : false) {
    tmp = new IncompleteStateBox(_this__u8e3s4);
  } else {
    tmp = _this__u8e3s4;
  }
  return tmp;
}
function InactiveNodeList(list) {
  this.ml_1 = list;
}
protoOf(InactiveNodeList).rj = function () {
  return this.ml_1;
};
protoOf(InactiveNodeList).af = function () {
  return false;
};
protoOf(InactiveNodeList).toString = function () {
  return get_DEBUG() ? this.ml_1.el('New') : anyToString(this);
};
function InvokeOnCompletion(handler) {
  JobNode.call(this);
  this.km_1 = handler;
}
protoOf(InvokeOnCompletion).lj = function () {
  return false;
};
protoOf(InvokeOnCompletion).ni = function (cause) {
  return this.km_1(cause);
};
function InvokeOnCancelling(handler) {
  JobNode.call(this);
  this.pm_1 = handler;
  this.qm_1 = atomic$boolean$1(false);
}
protoOf(InvokeOnCancelling).lj = function () {
  return true;
};
protoOf(InvokeOnCancelling).ni = function (cause) {
  if (this.qm_1.atomicfu$compareAndSet(false, true))
    this.pm_1(cause);
};
function ChildHandleNode(childJob) {
  JobNode.call(this);
  this.wl_1 = childJob;
}
protoOf(ChildHandleNode).lj = function () {
  return true;
};
protoOf(ChildHandleNode).ni = function (cause) {
  return this.wl_1.eg(this.qj());
};
protoOf(ChildHandleNode).fg = function (cause) {
  return this.qj().fg(cause);
};
function IncompleteStateBox(state) {
  this.rm_1 = state;
}
function handlesExceptionF($this) {
  var tmp = $this.sf();
  var tmp0_safe_receiver = tmp instanceof ChildHandleNode ? tmp : null;
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qj();
  var tmp_0;
  if (tmp1_elvis_lhs == null) {
    return false;
  } else {
    tmp_0 = tmp1_elvis_lhs;
  }
  var parentJob = tmp_0;
  while (true) {
    if (parentJob.lg())
      return true;
    var tmp_1 = parentJob.sf();
    var tmp2_safe_receiver = tmp_1 instanceof ChildHandleNode ? tmp_1 : null;
    var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.qj();
    var tmp_2;
    if (tmp3_elvis_lhs == null) {
      return false;
    } else {
      tmp_2 = tmp3_elvis_lhs;
    }
    parentJob = tmp_2;
  }
}
function JobImpl(parent) {
  JobSupport.call(this, true);
  this.ve(parent);
  this.um_1 = handlesExceptionF(this);
}
protoOf(JobImpl).dg = function () {
  return true;
};
protoOf(JobImpl).lg = function () {
  return this.um_1;
};
var properties_initialized_JobSupport_kt_5iq8a4;
function _init_properties_JobSupport_kt__68f172() {
  if (!properties_initialized_JobSupport_kt_5iq8a4) {
    properties_initialized_JobSupport_kt_5iq8a4 = true;
    COMPLETING_ALREADY = new Symbol('COMPLETING_ALREADY');
    COMPLETING_WAITING_CHILDREN = new Symbol('COMPLETING_WAITING_CHILDREN');
    COMPLETING_RETRY = new Symbol('COMPLETING_RETRY');
    TOO_LATE_TO_CANCEL = new Symbol('TOO_LATE_TO_CANCEL');
    SEALED = new Symbol('SEALED');
    EMPTY_NEW = new Empty(false);
    EMPTY_ACTIVE = new Empty(true);
  }
}
function MainCoroutineDispatcher() {
  CoroutineDispatcher.call(this);
}
protoOf(MainCoroutineDispatcher).toString = function () {
  var tmp0_elvis_lhs = this.xm();
  return tmp0_elvis_lhs == null ? get_classSimpleName(this) + '@' + get_hexAddress(this) : tmp0_elvis_lhs;
};
protoOf(MainCoroutineDispatcher).xm = function () {
  var main = Dispatchers_getInstance().ik();
  if (this === main)
    return 'Dispatchers.Main';
  var tmp;
  try {
    tmp = main.wm();
  } catch ($p) {
    var tmp_0;
    if ($p instanceof UnsupportedOperationException) {
      var e = $p;
      tmp_0 = null;
    } else {
      throw $p;
    }
    tmp = tmp_0;
  }
  var immediate = tmp;
  if (this === immediate)
    return 'Dispatchers.Main.immediate';
  return null;
};
function SupervisorJob(parent) {
  parent = parent === VOID ? null : parent;
  return new SupervisorJobImpl(parent);
}
function SupervisorJobImpl(parent) {
  JobImpl.call(this, parent);
}
protoOf(SupervisorJobImpl).fg = function (cause) {
  return false;
};
function TimeoutCancellationException() {
}
function Unconfined() {
  Unconfined_instance = this;
  CoroutineDispatcher.call(this);
}
protoOf(Unconfined).zj = function (context) {
  return false;
};
protoOf(Unconfined).ak = function (context, block) {
  var yieldContext = context.p6(Key_instance_3);
  if (!(yieldContext == null)) {
    yieldContext.dn_1 = true;
    return Unit_instance;
  }
  throw UnsupportedOperationException_init_$Create$('Dispatchers.Unconfined.dispatch function can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.');
};
protoOf(Unconfined).toString = function () {
  return 'Dispatchers.Unconfined';
};
var Unconfined_instance;
function Unconfined_getInstance() {
  if (Unconfined_instance == null)
    new Unconfined();
  return Unconfined_instance;
}
function Key_2() {
}
var Key_instance_3;
function Key_getInstance_2() {
  return Key_instance_3;
}
function Waiter() {
}
function get_CLOSED() {
  _init_properties_ConcurrentLinkedList_kt__5gcgzy();
  return CLOSED;
}
var CLOSED;
function Segment(id, prev, pointers) {
  ConcurrentLinkedListNode.call(this, prev);
  this.sh_1 = id;
  this.th_1 = atomic$int$1(pointers << 16);
}
protoOf(Segment).fn = function () {
  return this.th_1.kotlinx$atomicfu$value === this.en() && !this.in();
};
protoOf(Segment).jn = function () {
  var tmp0 = this.th_1;
  var tmp$ret$1;
  $l$block_0: {
    // Inline function 'kotlinx.coroutines.internal.addConditionally' call
    while (true) {
      var cur = tmp0.kotlinx$atomicfu$value;
      // Inline function 'kotlinx.coroutines.internal.Segment.tryIncPointers.<anonymous>' call
      if (!(!(cur === this.en()) || this.in())) {
        tmp$ret$1 = false;
        break $l$block_0;
      }
      if (tmp0.atomicfu$compareAndSet(cur, cur + 65536 | 0)) {
        tmp$ret$1 = true;
        break $l$block_0;
      }
    }
  }
  return tmp$ret$1;
};
protoOf(Segment).kn = function () {
  return this.th_1.atomicfu$addAndGet(-65536) === this.en() && !this.in();
};
protoOf(Segment).ln = function () {
  if (this.th_1.atomicfu$incrementAndGet() === this.en()) {
    this.mn();
  }
};
function _SegmentOrClosed___init__impl__jnexvb(value) {
  return value;
}
function _get_value__a43j40($this) {
  return $this;
}
function _SegmentOrClosed___get_isClosed__impl__qmxmlo($this) {
  return _get_value__a43j40($this) === get_CLOSED();
}
function _SegmentOrClosed___get_segment__impl__jvcr9l($this) {
  var tmp;
  if (_get_value__a43j40($this) === get_CLOSED()) {
    var message = 'Does not contain segment';
    throw IllegalStateException_init_$Create$(toString(message));
  } else {
    var tmp_0 = _get_value__a43j40($this);
    tmp = tmp_0 instanceof Segment ? tmp_0 : THROW_CCE();
  }
  return tmp;
}
function _get_nextOrClosed__w0gmuv($this) {
  return $this.gn_1.kotlinx$atomicfu$value;
}
function _get_aliveSegmentLeft__mr4ndu($this) {
  var cur = $this.pn();
  while (!(cur === null) && cur.fn())
    cur = cur.hn_1.kotlinx$atomicfu$value;
  return cur;
}
function _get_aliveSegmentRight__7ulr0b($this) {
  // Inline function 'kotlinx.coroutines.assert' call
  var cur = ensureNotNull($this.nn());
  while (cur.fn()) {
    var tmp0_elvis_lhs = cur.nn();
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return cur;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    cur = tmp;
  }
  return cur;
}
function access$_get_nextOrClosed__ywzond($this) {
  return _get_nextOrClosed__w0gmuv($this);
}
function ConcurrentLinkedListNode(prev) {
  this.gn_1 = atomic$ref$1(null);
  this.hn_1 = atomic$ref$1(prev);
}
protoOf(ConcurrentLinkedListNode).nn = function () {
  // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.nextOrIfClosed' call
  // Inline function 'kotlin.let' call
  // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.nextOrIfClosed.<anonymous>' call
  var it = access$_get_nextOrClosed__ywzond(this);
  var tmp;
  if (it === access$_get_CLOSED_$tConcurrentLinkedListKt_wmtpdy()) {
    // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.<get-next>.<anonymous>' call
    return null;
  } else {
    tmp = (it == null ? true : it instanceof ConcurrentLinkedListNode) ? it : THROW_CCE();
  }
  return tmp;
};
protoOf(ConcurrentLinkedListNode).on = function (value) {
  return this.gn_1.atomicfu$compareAndSet(null, value);
};
protoOf(ConcurrentLinkedListNode).in = function () {
  return this.nn() == null;
};
protoOf(ConcurrentLinkedListNode).pn = function () {
  return this.hn_1.kotlinx$atomicfu$value;
};
protoOf(ConcurrentLinkedListNode).qn = function () {
  // Inline function 'kotlinx.atomicfu.AtomicRef.lazySet' call
  this.hn_1.kotlinx$atomicfu$value = null;
};
protoOf(ConcurrentLinkedListNode).mn = function () {
  // Inline function 'kotlinx.coroutines.assert' call
  if (this.in())
    return Unit_instance;
  $l$loop_0: while (true) {
    var prev = _get_aliveSegmentLeft__mr4ndu(this);
    var next = _get_aliveSegmentRight__7ulr0b(this);
    var tmp0 = next.hn_1;
    $l$block: {
      // Inline function 'kotlinx.atomicfu.update' call
      while (true) {
        var cur = tmp0.kotlinx$atomicfu$value;
        // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.remove.<anonymous>' call
        var upd = cur === null ? null : prev;
        if (tmp0.atomicfu$compareAndSet(cur, upd)) {
          break $l$block;
        }
      }
    }
    if (!(prev === null))
      prev.gn_1.kotlinx$atomicfu$value = next;
    if (next.fn() && !next.in())
      continue $l$loop_0;
    if (!(prev === null) && prev.fn())
      continue $l$loop_0;
    return Unit_instance;
  }
};
function findSegmentInternal(_this__u8e3s4, id, createNewSegment) {
  _init_properties_ConcurrentLinkedList_kt__5gcgzy();
  var cur = _this__u8e3s4;
  $l$loop: while (cur.sh_1.y(id) < 0 || cur.fn()) {
    // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.nextOrIfClosed' call
    var this_0 = cur;
    // Inline function 'kotlin.let' call
    // Inline function 'kotlinx.coroutines.internal.ConcurrentLinkedListNode.nextOrIfClosed.<anonymous>' call
    var it = access$_get_nextOrClosed__ywzond(this_0);
    var tmp;
    if (it === access$_get_CLOSED_$tConcurrentLinkedListKt_wmtpdy()) {
      // Inline function 'kotlinx.coroutines.internal.findSegmentInternal.<anonymous>' call
      return _SegmentOrClosed___init__impl__jnexvb(get_CLOSED());
    } else {
      tmp = (it == null ? true : it instanceof ConcurrentLinkedListNode) ? it : THROW_CCE();
    }
    var next = tmp;
    if (!(next == null)) {
      cur = next;
      continue $l$loop;
    }
    // Inline function 'kotlin.Long.plus' call
    var newTail = createNewSegment(cur.sh_1.r1(toLong(1)), cur);
    if (cur.on(newTail)) {
      if (cur.fn()) {
        cur.mn();
      }
      cur = newTail;
    }
  }
  return _SegmentOrClosed___init__impl__jnexvb(cur);
}
function access$_get_CLOSED_$tConcurrentLinkedListKt_wmtpdy() {
  return get_CLOSED();
}
var properties_initialized_ConcurrentLinkedList_kt_kwt434;
function _init_properties_ConcurrentLinkedList_kt__5gcgzy() {
  if (!properties_initialized_ConcurrentLinkedList_kt_kwt434) {
    properties_initialized_ConcurrentLinkedList_kt_kwt434 = true;
    CLOSED = new Symbol('CLOSED');
  }
}
function handleUncaughtCoroutineException(context, exception) {
  var _iterator__ex2g4s = get_platformExceptionHandlers().k();
  while (_iterator__ex2g4s.l()) {
    var handler = _iterator__ex2g4s.m();
    try {
      handler.dk(context, exception);
    } catch ($p) {
      if ($p instanceof ExceptionSuccessfullyProcessed) {
        var _unused_var__etf5q3 = $p;
        return Unit_instance;
      } else {
        if ($p instanceof Error) {
          var t = $p;
          propagateExceptionFinalResort(handlerException(exception, t));
        } else {
          throw $p;
        }
      }
    }
  }
  try {
    addSuppressed(exception, new DiagnosticCoroutineContextException(context));
  } catch ($p) {
    if ($p instanceof Error) {
      var e = $p;
    } else {
      throw $p;
    }
  }
  propagateExceptionFinalResort(exception);
}
function ExceptionSuccessfullyProcessed() {
}
function get_UNDEFINED() {
  _init_properties_DispatchedContinuation_kt__tnmqc0();
  return UNDEFINED;
}
var UNDEFINED;
function get_REUSABLE_CLAIMED() {
  _init_properties_DispatchedContinuation_kt__tnmqc0();
  return REUSABLE_CLAIMED;
}
var REUSABLE_CLAIMED;
function _get_reusableCancellableContinuation__9qex09($this) {
  var tmp = $this.mh_1.kotlinx$atomicfu$value;
  return tmp instanceof CancellableContinuationImpl ? tmp : null;
}
function DispatchedContinuation(dispatcher, continuation) {
  DispatchedTask.call(this, -1);
  this.ih_1 = dispatcher;
  this.jh_1 = continuation;
  this.kh_1 = get_UNDEFINED();
  this.lh_1 = threadContextElements(this.i6());
  this.mh_1 = atomic$ref$1(null);
}
protoOf(DispatchedContinuation).nh = function () {
  return !(this.mh_1.kotlinx$atomicfu$value == null);
};
protoOf(DispatchedContinuation).rn = function () {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = this.mh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.awaitReusability.<anonymous>' call
    if (!(this_0.kotlinx$atomicfu$value === get_REUSABLE_CLAIMED()))
      return Unit_instance;
  }
};
protoOf(DispatchedContinuation).bk = function () {
  this.rn();
  var tmp0_safe_receiver = _get_reusableCancellableContinuation__9qex09(this);
  if (tmp0_safe_receiver == null)
    null;
  else {
    tmp0_safe_receiver.ei();
  }
};
protoOf(DispatchedContinuation).ti = function (continuation) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = this.mh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.tryReleaseClaimedContinuation.<anonymous>' call
    var state = this_0.kotlinx$atomicfu$value;
    if (state === get_REUSABLE_CLAIMED()) {
      if (this.mh_1.atomicfu$compareAndSet(get_REUSABLE_CLAIMED(), continuation))
        return null;
    } else {
      if (state instanceof Error) {
        // Inline function 'kotlin.require' call
        // Inline function 'kotlin.require' call
        if (!this.mh_1.atomicfu$compareAndSet(state, null)) {
          // Inline function 'kotlin.require.<anonymous>' call
          var message = 'Failed requirement.';
          throw IllegalArgumentException_init_$Create$(toString(message));
        }
        return state;
      } else {
        // Inline function 'kotlin.error' call
        var message_0 = 'Inconsistent state ' + toString_0(state);
        throw IllegalStateException_init_$Create$(toString(message_0));
      }
    }
  }
};
protoOf(DispatchedContinuation).ph = function (cause) {
  // Inline function 'kotlinx.atomicfu.loop' call
  var this_0 = this.mh_1;
  while (true) {
    // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.postponeCancellation.<anonymous>' call
    var state = this_0.kotlinx$atomicfu$value;
    if (equals(state, get_REUSABLE_CLAIMED())) {
      if (this.mh_1.atomicfu$compareAndSet(get_REUSABLE_CLAIMED(), cause))
        return true;
    } else {
      if (state instanceof Error)
        return true;
      else {
        if (this.mh_1.atomicfu$compareAndSet(state, null))
          return false;
      }
    }
  }
};
protoOf(DispatchedContinuation).ii = function () {
  var state = this.kh_1;
  // Inline function 'kotlinx.coroutines.assert' call
  this.kh_1 = get_UNDEFINED();
  return state;
};
protoOf(DispatchedContinuation).fi = function () {
  return this;
};
protoOf(DispatchedContinuation).n6 = function (result) {
  var state = toState_0(result);
  if (safeIsDispatchNeeded(this.ih_1, this.i6())) {
    this.kh_1 = state;
    this.oh_1 = 0;
    safeDispatch(this.ih_1, this.i6(), this);
  } else {
    $l$block: {
      // Inline function 'kotlinx.coroutines.internal.executeUnconfined' call
      // Inline function 'kotlinx.coroutines.assert' call
      var eventLoop = ThreadLocalEventLoop_getInstance().wk();
      if (false && eventLoop.rk()) {
        break $l$block;
      }
      var tmp;
      if (eventLoop.qk()) {
        this.kh_1 = state;
        this.oh_1 = 0;
        eventLoop.pk(this);
        tmp = true;
      } else {
        // Inline function 'kotlinx.coroutines.runUnconfinedEventLoop' call
        eventLoop.sk(true);
        try {
          // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeWith.<anonymous>' call
          this.i6();
          // Inline function 'kotlinx.coroutines.withCoroutineContext' call
          this.lh_1;
          // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeWith.<anonymous>.<anonymous>' call
          this.jh_1.n6(result);
          $l$loop: while (eventLoop.ok()) {
          }
        } catch ($p) {
          if ($p instanceof Error) {
            var e = $p;
            this.ej(e);
          } else {
            throw $p;
          }
        }
        finally {
          eventLoop.tk(true);
        }
        tmp = false;
      }
    }
  }
};
protoOf(DispatchedContinuation).toString = function () {
  return 'DispatchedContinuation[' + this.ih_1.toString() + ', ' + toDebugString(this.jh_1) + ']';
};
protoOf(DispatchedContinuation).i6 = function () {
  return this.jh_1.i6();
};
function safeDispatch(_this__u8e3s4, context, runnable) {
  _init_properties_DispatchedContinuation_kt__tnmqc0();
  try {
    _this__u8e3s4.ak(context, runnable);
  } catch ($p) {
    if ($p instanceof Error) {
      var e = $p;
      throw new DispatchException(e, _this__u8e3s4, context);
    } else {
      throw $p;
    }
  }
}
function safeIsDispatchNeeded(_this__u8e3s4, context) {
  _init_properties_DispatchedContinuation_kt__tnmqc0();
  try {
    return _this__u8e3s4.zj(context);
  } catch ($p) {
    if ($p instanceof Error) {
      var e = $p;
      throw new DispatchException(e, _this__u8e3s4, context);
    } else {
      throw $p;
    }
  }
}
function resumeCancellableWith(_this__u8e3s4, result) {
  _init_properties_DispatchedContinuation_kt__tnmqc0();
  var tmp;
  if (_this__u8e3s4 instanceof DispatchedContinuation) {
    var state = toState_0(result);
    if (safeIsDispatchNeeded(_this__u8e3s4.ih_1, _this__u8e3s4.i6())) {
      _this__u8e3s4.kh_1 = state;
      _this__u8e3s4.oh_1 = 1;
      safeDispatch(_this__u8e3s4.ih_1, _this__u8e3s4.i6(), _this__u8e3s4);
    } else {
      $l$block: {
        // Inline function 'kotlinx.coroutines.internal.executeUnconfined' call
        // Inline function 'kotlinx.coroutines.assert' call
        var eventLoop = ThreadLocalEventLoop_getInstance().wk();
        if (false && eventLoop.rk()) {
          break $l$block;
        }
        var tmp_0;
        if (eventLoop.qk()) {
          _this__u8e3s4.kh_1 = state;
          _this__u8e3s4.oh_1 = 1;
          eventLoop.pk(_this__u8e3s4);
          tmp_0 = true;
        } else {
          // Inline function 'kotlinx.coroutines.runUnconfinedEventLoop' call
          eventLoop.sk(true);
          try {
            // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeCancellableWith.<anonymous>' call
            var tmp$ret$3;
            $l$block_0: {
              // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeCancelled' call
              var job = _this__u8e3s4.i6().p6(Key_instance_2);
              if (!(job == null) && !job.af()) {
                var cause = job.xf();
                _this__u8e3s4.ji(state, cause);
                // Inline function 'kotlin.coroutines.resumeWithException' call
                // Inline function 'kotlin.Companion.failure' call
                var tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure(cause));
                _this__u8e3s4.n6(tmp$ret$1);
                tmp$ret$3 = true;
                break $l$block_0;
              }
              tmp$ret$3 = false;
            }
            if (!tmp$ret$3) {
              // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith' call
              _this__u8e3s4.jh_1;
              // Inline function 'kotlinx.coroutines.withContinuationContext' call
              _this__u8e3s4.lh_1;
              // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith.<anonymous>' call
              _this__u8e3s4.jh_1.n6(result);
            }
            $l$loop: while (eventLoop.ok()) {
            }
          } catch ($p) {
            if ($p instanceof Error) {
              var e = $p;
              _this__u8e3s4.ej(e);
            } else {
              throw $p;
            }
          }
          finally {
            eventLoop.tk(true);
          }
          tmp_0 = false;
        }
      }
    }
    tmp = Unit_instance;
  } else {
    _this__u8e3s4.n6(result);
    tmp = Unit_instance;
  }
  return tmp;
}
var properties_initialized_DispatchedContinuation_kt_2siadq;
function _init_properties_DispatchedContinuation_kt__tnmqc0() {
  if (!properties_initialized_DispatchedContinuation_kt_2siadq) {
    properties_initialized_DispatchedContinuation_kt_2siadq = true;
    UNDEFINED = new Symbol('UNDEFINED');
    REUSABLE_CLAIMED = new Symbol('REUSABLE_CLAIMED');
  }
}
function DispatchedTask(resumeMode) {
  SchedulerTask.call(this);
  this.oh_1 = resumeMode;
}
protoOf(DispatchedTask).ji = function (takenState, cause) {
};
protoOf(DispatchedTask).si = function (state) {
  return (state == null ? true : !(state == null)) ? state : THROW_CCE();
};
protoOf(DispatchedTask).bj = function (state) {
  var tmp0_safe_receiver = state instanceof CompletedExceptionally ? state : null;
  return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ff_1;
};
protoOf(DispatchedTask).dj = function () {
  // Inline function 'kotlinx.coroutines.assert' call
  try {
    var tmp = this.fi();
    var delegate = tmp instanceof DispatchedContinuation ? tmp : THROW_CCE();
    var continuation = delegate.jh_1;
    // Inline function 'kotlinx.coroutines.withContinuationContext' call
    delegate.lh_1;
    // Inline function 'kotlinx.coroutines.DispatchedTask.run.<anonymous>' call
    var context = continuation.i6();
    var state = this.ii();
    var exception = this.bj(state);
    var job = exception == null && get_isCancellableMode(this.oh_1) ? context.p6(Key_instance_2) : null;
    if (!(job == null) && !job.af()) {
      var cause = job.xf();
      this.ji(state, cause);
      // Inline function 'kotlinx.coroutines.resumeWithStackTrace' call
      // Inline function 'kotlin.Companion.failure' call
      var exception_0 = recoverStackTrace(cause, continuation);
      var tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(exception_0));
      continuation.n6(tmp$ret$0);
    } else {
      if (!(exception == null)) {
        // Inline function 'kotlin.coroutines.resumeWithException' call
        // Inline function 'kotlin.Companion.failure' call
        var tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure(exception));
        continuation.n6(tmp$ret$1);
      } else {
        // Inline function 'kotlin.coroutines.resume' call
        // Inline function 'kotlin.Companion.success' call
        var value = this.si(state);
        var tmp$ret$3 = _Result___init__impl__xyqfz8(value);
        continuation.n6(tmp$ret$3);
      }
    }
  } catch ($p) {
    if ($p instanceof DispatchException) {
      var e = $p;
      handleCoroutineException(this.fi().i6(), e.ck_1);
    } else {
      if ($p instanceof Error) {
        var e_0 = $p;
        this.ej(e_0);
      } else {
        throw $p;
      }
    }
  }
};
protoOf(DispatchedTask).ej = function (exception) {
  var reason = new CoroutinesInternalError('Fatal exception in coroutines machinery for ' + toString(this) + '. ' + "Please read KDoc to 'handleFatalException' method and report this incident to maintainers", exception);
  handleCoroutineException(this.fi().i6(), reason);
};
function get_isReusableMode(_this__u8e3s4) {
  return _this__u8e3s4 === 2;
}
function get_isCancellableMode(_this__u8e3s4) {
  return _this__u8e3s4 === 1 || _this__u8e3s4 === 2;
}
function dispatch(_this__u8e3s4, mode) {
  // Inline function 'kotlinx.coroutines.assert' call
  var delegate = _this__u8e3s4.fi();
  var undispatched = mode === 4;
  var tmp;
  var tmp_0;
  if (!undispatched) {
    tmp_0 = delegate instanceof DispatchedContinuation;
  } else {
    tmp_0 = false;
  }
  if (tmp_0) {
    tmp = get_isCancellableMode(mode) === get_isCancellableMode(_this__u8e3s4.oh_1);
  } else {
    tmp = false;
  }
  if (tmp) {
    var dispatcher = delegate.ih_1;
    var context = delegate.i6();
    if (safeIsDispatchNeeded(dispatcher, context)) {
      safeDispatch(dispatcher, context, _this__u8e3s4);
    } else {
      resumeUnconfined(_this__u8e3s4);
    }
  } else {
    resume(_this__u8e3s4, delegate, undispatched);
  }
}
function DispatchException(cause, dispatcher, context) {
  Exception_init_$Init$('Coroutine dispatcher ' + dispatcher.toString() + ' threw an exception, context = ' + toString(context), cause, this);
  captureStack(this, DispatchException);
  this.ck_1 = cause;
}
protoOf(DispatchException).t6 = function () {
  return this.ck_1;
};
function resumeUnconfined(_this__u8e3s4) {
  var eventLoop = ThreadLocalEventLoop_getInstance().wk();
  if (eventLoop.qk()) {
    eventLoop.pk(_this__u8e3s4);
  } else {
    // Inline function 'kotlinx.coroutines.runUnconfinedEventLoop' call
    eventLoop.sk(true);
    try {
      // Inline function 'kotlinx.coroutines.resumeUnconfined.<anonymous>' call
      resume(_this__u8e3s4, _this__u8e3s4.fi(), true);
      $l$loop: while (eventLoop.ok()) {
      }
    } catch ($p) {
      if ($p instanceof Error) {
        var e = $p;
        _this__u8e3s4.ej(e);
      } else {
        throw $p;
      }
    }
    finally {
      eventLoop.tk(true);
    }
  }
}
function resume(_this__u8e3s4, delegate, undispatched) {
  var state = _this__u8e3s4.ii();
  var exception = _this__u8e3s4.bj(state);
  var tmp;
  if (!(exception == null)) {
    // Inline function 'kotlin.Companion.failure' call
    tmp = _Result___init__impl__xyqfz8(createFailure(exception));
  } else {
    // Inline function 'kotlin.Companion.success' call
    var value = _this__u8e3s4.si(state);
    tmp = _Result___init__impl__xyqfz8(value);
  }
  var result = tmp;
  if (undispatched) {
    // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith' call
    var this_0 = delegate instanceof DispatchedContinuation ? delegate : THROW_CCE();
    this_0.jh_1;
    // Inline function 'kotlinx.coroutines.withContinuationContext' call
    this_0.lh_1;
    // Inline function 'kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith.<anonymous>' call
    this_0.jh_1.n6(result);
  } else {
    delegate.n6(result);
  }
}
function ContextScope(context) {
  this.sn_1 = context;
}
protoOf(ContextScope).ze = function () {
  return this.sn_1;
};
protoOf(ContextScope).toString = function () {
  return 'CoroutineScope(coroutineContext=' + toString(this.sn_1) + ')';
};
function Symbol(symbol) {
  this.tn_1 = symbol;
}
protoOf(Symbol).toString = function () {
  return '<' + this.tn_1 + '>';
};
function systemProp(propertyName, defaultValue, minValue, maxValue) {
  minValue = minValue === VOID ? 1 : minValue;
  maxValue = maxValue === VOID ? 2147483647 : maxValue;
  return systemProp_0(propertyName, toLong(defaultValue), toLong(minValue), toLong(maxValue)).g2();
}
function systemProp_0(propertyName, defaultValue, minValue, maxValue) {
  minValue = minValue === VOID ? new Long(1, 0) : minValue;
  maxValue = maxValue === VOID ? new Long(-1, 2147483647) : maxValue;
  var tmp0_elvis_lhs = systemProp_1(propertyName);
  var tmp;
  if (tmp0_elvis_lhs == null) {
    return defaultValue;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  var value = tmp;
  var tmp1_elvis_lhs = toLongOrNull(value);
  var tmp_0;
  if (tmp1_elvis_lhs == null) {
    var message = "System property '" + propertyName + "' has unrecognized value '" + value + "'";
    throw IllegalStateException_init_$Create$(toString(message));
  } else {
    tmp_0 = tmp1_elvis_lhs;
  }
  var parsed = tmp_0;
  if (!(minValue.y(parsed) <= 0 ? parsed.y(maxValue) <= 0 : false)) {
    // Inline function 'kotlin.error' call
    var message_0 = "System property '" + propertyName + "' should be in range " + minValue.toString() + '..' + maxValue.toString() + ", but is '" + parsed.toString() + "'";
    throw IllegalStateException_init_$Create$(toString(message_0));
  }
  return parsed;
}
function startCoroutineCancellable(_this__u8e3s4, fatalCompletion) {
  var tmp;
  try {
    var tmp_0 = intercepted(_this__u8e3s4);
    // Inline function 'kotlin.Companion.success' call
    var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
    resumeCancellableWith(tmp_0, tmp$ret$0);
    tmp = Unit_instance;
  } catch ($p) {
    var tmp_1;
    if ($p instanceof Error) {
      var e = $p;
      dispatcherFailure(fatalCompletion, e);
      tmp_1 = Unit_instance;
    } else {
      throw $p;
    }
    tmp = tmp_1;
  }
  return tmp;
}
function startCoroutineCancellable_0(_this__u8e3s4, receiver, completion) {
  var tmp;
  try {
    var tmp_0 = intercepted(createCoroutineUnintercepted(_this__u8e3s4, receiver, completion));
    // Inline function 'kotlin.Companion.success' call
    var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
    resumeCancellableWith(tmp_0, tmp$ret$0);
    tmp = Unit_instance;
  } catch ($p) {
    var tmp_1;
    if ($p instanceof Error) {
      var e = $p;
      dispatcherFailure(completion, e);
      tmp_1 = Unit_instance;
    } else {
      throw $p;
    }
    tmp = tmp_1;
  }
  return tmp;
}
function dispatcherFailure(completion, e) {
  var tmp;
  if (e instanceof DispatchException) {
    tmp = e.ck_1;
  } else {
    tmp = e;
  }
  var reportException = tmp;
  // Inline function 'kotlin.Companion.failure' call
  var tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(reportException));
  completion.n6(tmp$ret$0);
  throw reportException;
}
function startCoroutineUndispatched(_this__u8e3s4, receiver, completion) {
  // Inline function 'kotlinx.coroutines.internal.probeCoroutineCreated' call
  var actualCompletion = completion;
  var tmp;
  try {
    // Inline function 'kotlinx.coroutines.withCoroutineContext' call
    actualCompletion.i6();
    // Inline function 'kotlinx.coroutines.intrinsics.startCoroutineUndispatched.<anonymous>' call
    // Inline function 'kotlinx.coroutines.internal.probeCoroutineResumed' call
    // Inline function 'kotlin.coroutines.intrinsics.startCoroutineUninterceptedOrReturn' call
    tmp = startCoroutineUninterceptedOrReturnNonGeneratorVersion(_this__u8e3s4, receiver, actualCompletion);
  } catch ($p) {
    var tmp_0;
    if ($p instanceof Error) {
      var e = $p;
      var tmp_1;
      if (e instanceof DispatchException) {
        tmp_1 = e.ck_1;
      } else {
        tmp_1 = e;
      }
      var reportException = tmp_1;
      // Inline function 'kotlin.coroutines.resumeWithException' call
      // Inline function 'kotlin.Companion.failure' call
      var tmp$ret$4 = _Result___init__impl__xyqfz8(createFailure(reportException));
      actualCompletion.n6(tmp$ret$4);
      return Unit_instance;
    } else {
      throw $p;
    }
  }
  var value = tmp;
  if (!(value === get_COROUTINE_SUSPENDED())) {
    // Inline function 'kotlin.coroutines.resume' call
    // Inline function 'kotlin.Companion.success' call
    var value_0 = (value == null ? true : !(value == null)) ? value : THROW_CCE();
    var tmp$ret$6 = _Result___init__impl__xyqfz8(value_0);
    actualCompletion.n6(tmp$ret$6);
  }
}
function SelectInstance() {
}
function get_NO_OWNER() {
  _init_properties_Mutex_kt__jod56b();
  return NO_OWNER;
}
var NO_OWNER;
var ON_LOCK_ALREADY_LOCKED_BY_OWNER;
function Mutex() {
}
function Mutex_0(locked) {
  locked = locked === VOID ? false : locked;
  _init_properties_Mutex_kt__jod56b();
  return new MutexImpl(locked);
}
function holdsLockImpl($this, owner) {
  $l$loop: while (true) {
    if (!$this.jo())
      return 0;
    var curOwner = $this.ho_1.kotlinx$atomicfu$value;
    if (curOwner === get_NO_OWNER())
      continue $l$loop;
    return curOwner === owner ? 1 : 2;
  }
}
function tryLockImpl($this, owner) {
  $l$loop: while (true) {
    if ($this.ro()) {
      // Inline function 'kotlinx.coroutines.assert' call
      $this.ho_1.kotlinx$atomicfu$value = owner;
      return 0;
    } else {
      if (owner == null)
        return 1;
      switch (holdsLockImpl($this, owner)) {
        case 1:
          return 2;
        case 2:
          return 1;
        case 0:
          continue $l$loop;
      }
    }
  }
}
function MutexImpl$onSelectCancellationUnlockConstructor$lambda$lambda(this$0, $owner) {
  return function (_unused_var__etf5q3, _unused_var__etf5q3_0, _unused_var__etf5q3_1) {
    this$0.yn($owner);
    return Unit_instance;
  };
}
function MutexImpl$onSelectCancellationUnlockConstructor$lambda(this$0) {
  return function (_unused_var__etf5q3, owner, _unused_var__etf5q3_0) {
    return MutexImpl$onSelectCancellationUnlockConstructor$lambda$lambda(this$0, owner);
  };
}
function MutexImpl(locked) {
  SemaphoreAndMutexImpl.call(this, 1, locked ? 1 : 0);
  this.ho_1 = atomic$ref$1(locked ? null : get_NO_OWNER());
  var tmp = this;
  tmp.io_1 = MutexImpl$onSelectCancellationUnlockConstructor$lambda(this);
}
protoOf(MutexImpl).jo = function () {
  return this.so() === 0;
};
protoOf(MutexImpl).wn = function (owner) {
  var tmp;
  switch (tryLockImpl(this, owner)) {
    case 0:
      tmp = true;
      break;
    case 1:
      tmp = false;
      break;
    case 2:
      var message = 'This mutex is already locked by the specified owner: ' + toString_0(owner);
      throw IllegalStateException_init_$Create$(toString(message));
    default:
      var message_0 = 'unexpected';
      throw IllegalStateException_init_$Create$(toString(message_0));
  }
  return tmp;
};
protoOf(MutexImpl).yn = function (owner) {
  $l$loop_0: while (true) {
    // Inline function 'kotlin.check' call
    if (!this.jo()) {
      // Inline function 'kotlinx.coroutines.sync.MutexImpl.unlock.<anonymous>' call
      var message = 'This mutex is not locked';
      throw IllegalStateException_init_$Create$(toString(message));
    }
    var curOwner = this.ho_1.kotlinx$atomicfu$value;
    if (curOwner === get_NO_OWNER())
      continue $l$loop_0;
    // Inline function 'kotlin.check' call
    if (!(curOwner === owner || owner == null)) {
      // Inline function 'kotlinx.coroutines.sync.MutexImpl.unlock.<anonymous>' call
      var message_0 = 'This mutex is locked by ' + toString_0(curOwner) + ', but ' + toString_0(owner) + ' is expected';
      throw IllegalStateException_init_$Create$(toString(message_0));
    }
    if (!this.ho_1.atomicfu$compareAndSet(curOwner, get_NO_OWNER()))
      continue $l$loop_0;
    this.to();
    return Unit_instance;
  }
};
protoOf(MutexImpl).toString = function () {
  return 'Mutex@' + get_hexAddress(this) + '[isLocked=' + this.jo() + ',owner=' + toString_0(this.ho_1.kotlinx$atomicfu$value) + ']';
};
var properties_initialized_Mutex_kt_yv4p3j;
function _init_properties_Mutex_kt__jod56b() {
  if (!properties_initialized_Mutex_kt_yv4p3j) {
    properties_initialized_Mutex_kt_yv4p3j = true;
    NO_OWNER = new Symbol('NO_OWNER');
    ON_LOCK_ALREADY_LOCKED_BY_OWNER = new Symbol('ALREADY_LOCKED_BY_OWNER');
  }
}
function get_MAX_SPIN_CYCLES() {
  _init_properties_Semaphore_kt__t514r6();
  return MAX_SPIN_CYCLES;
}
var MAX_SPIN_CYCLES;
function get_PERMIT() {
  _init_properties_Semaphore_kt__t514r6();
  return PERMIT;
}
var PERMIT;
function get_TAKEN() {
  _init_properties_Semaphore_kt__t514r6();
  return TAKEN;
}
var TAKEN;
function get_BROKEN() {
  _init_properties_Semaphore_kt__t514r6();
  return BROKEN;
}
var BROKEN;
function get_CANCELLED() {
  _init_properties_Semaphore_kt__t514r6();
  return CANCELLED;
}
var CANCELLED;
function get_SEGMENT_SIZE() {
  _init_properties_Semaphore_kt__t514r6();
  return SEGMENT_SIZE;
}
var SEGMENT_SIZE;
function decPermits($this) {
  $l$loop: while (true) {
    var p = $this.po_1.atomicfu$getAndDecrement();
    if (p > $this.ko_1)
      continue $l$loop;
    return p;
  }
}
function coerceAvailablePermitsAtMaximum($this) {
  $l$loop_0: while (true) {
    var cur = $this.po_1.kotlinx$atomicfu$value;
    if (cur <= $this.ko_1)
      break $l$loop_0;
    if ($this.po_1.atomicfu$compareAndSet(cur, $this.ko_1))
      break $l$loop_0;
  }
}
function addAcquireToQueue($this, waiter) {
  var curTail = $this.no_1.kotlinx$atomicfu$value;
  var enqIdx = $this.oo_1.atomicfu$getAndIncrement$long();
  var createNewSegment = createSegment$ref();
  var tmp2 = $this.no_1;
  // Inline function 'kotlin.Long.div' call
  var other = get_SEGMENT_SIZE();
  var tmp3 = enqIdx.u1(toLong(other));
  var tmp$ret$2;
  $l$block_2: {
    // Inline function 'kotlinx.coroutines.internal.findSegmentAndMoveForward' call
    while (true) {
      var s = findSegmentInternal(curTail, tmp3, createNewSegment);
      var tmp;
      if (_SegmentOrClosed___get_isClosed__impl__qmxmlo(s)) {
        tmp = true;
      } else {
        var tmp1 = _SegmentOrClosed___get_segment__impl__jvcr9l(s);
        var tmp$ret$1;
        $l$block_1: {
          // Inline function 'kotlinx.coroutines.internal.moveForward' call
          while (true) {
            // Inline function 'kotlinx.coroutines.internal.moveForward.<anonymous>' call
            var cur = tmp2.kotlinx$atomicfu$value;
            if (cur.sh_1.y(tmp1.sh_1) >= 0) {
              tmp$ret$1 = true;
              break $l$block_1;
            }
            if (!tmp1.jn()) {
              tmp$ret$1 = false;
              break $l$block_1;
            }
            if (tmp2.atomicfu$compareAndSet(cur, tmp1)) {
              if (cur.kn()) {
                cur.mn();
              }
              tmp$ret$1 = true;
              break $l$block_1;
            }
            if (tmp1.kn()) {
              tmp1.mn();
            }
          }
          tmp$ret$1 = Unit_instance;
        }
        tmp = tmp$ret$1;
      }
      if (tmp) {
        tmp$ret$2 = s;
        break $l$block_2;
      }
    }
  }
  var segment = _SegmentOrClosed___get_segment__impl__jvcr9l(tmp$ret$2);
  // Inline function 'kotlin.Long.rem' call
  var other_0 = get_SEGMENT_SIZE();
  var i = enqIdx.v1(toLong(other_0)).g2();
  // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.cas' call
  if (segment.yo_1.atomicfu$get(i).atomicfu$compareAndSet(null, waiter)) {
    waiter.wi(segment, i);
    return true;
  }
  var tmp14 = get_PERMIT();
  // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.cas' call
  var value = get_TAKEN();
  if (segment.yo_1.atomicfu$get(i).atomicfu$compareAndSet(tmp14, value)) {
    if (isInterface(waiter, CancellableContinuation)) {
      if (!isInterface(waiter, CancellableContinuation))
        THROW_CCE();
      waiter.zg(Unit_instance, $this.qo_1);
    } else {
      if (isInterface(waiter, SelectInstance)) {
        waiter.vn(Unit_instance);
      } else {
        // Inline function 'kotlin.error' call
        var message = 'unexpected: ' + toString(waiter);
        throw IllegalStateException_init_$Create$(toString(message));
      }
    }
    return true;
  }
  // Inline function 'kotlinx.coroutines.assert' call
  return false;
}
function tryResumeNextFromQueue($this) {
  var curHead = $this.lo_1.kotlinx$atomicfu$value;
  var deqIdx = $this.mo_1.atomicfu$getAndIncrement$long();
  // Inline function 'kotlin.Long.div' call
  var other = get_SEGMENT_SIZE();
  var id = deqIdx.u1(toLong(other));
  var createNewSegment = createSegment$ref_0();
  var tmp2 = $this.lo_1;
  var tmp$ret$2;
  $l$block_2: {
    // Inline function 'kotlinx.coroutines.internal.findSegmentAndMoveForward' call
    while (true) {
      var s = findSegmentInternal(curHead, id, createNewSegment);
      var tmp;
      if (_SegmentOrClosed___get_isClosed__impl__qmxmlo(s)) {
        tmp = true;
      } else {
        var tmp1 = _SegmentOrClosed___get_segment__impl__jvcr9l(s);
        var tmp$ret$1;
        $l$block_1: {
          // Inline function 'kotlinx.coroutines.internal.moveForward' call
          while (true) {
            // Inline function 'kotlinx.coroutines.internal.moveForward.<anonymous>' call
            var cur = tmp2.kotlinx$atomicfu$value;
            if (cur.sh_1.y(tmp1.sh_1) >= 0) {
              tmp$ret$1 = true;
              break $l$block_1;
            }
            if (!tmp1.jn()) {
              tmp$ret$1 = false;
              break $l$block_1;
            }
            if (tmp2.atomicfu$compareAndSet(cur, tmp1)) {
              if (cur.kn()) {
                cur.mn();
              }
              tmp$ret$1 = true;
              break $l$block_1;
            }
            if (tmp1.kn()) {
              tmp1.mn();
            }
          }
          tmp$ret$1 = Unit_instance;
        }
        tmp = tmp$ret$1;
      }
      if (tmp) {
        tmp$ret$2 = s;
        break $l$block_2;
      }
    }
  }
  var segment = _SegmentOrClosed___get_segment__impl__jvcr9l(tmp$ret$2);
  segment.qn();
  if (segment.sh_1.y(id) > 0)
    return false;
  // Inline function 'kotlin.Long.rem' call
  var other_0 = get_SEGMENT_SIZE();
  var i = deqIdx.v1(toLong(other_0)).g2();
  // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.getAndSet' call
  var value = get_PERMIT();
  var cellState = segment.yo_1.atomicfu$get(i).atomicfu$getAndSet(value);
  if (cellState === null) {
    // Inline function 'kotlin.repeat' call
    var times = get_MAX_SPIN_CYCLES();
    var inductionVariable = 0;
    if (inductionVariable < times)
      do {
        var index = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.tryResumeNextFromQueue.<anonymous>' call
        // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.get' call
        if (segment.yo_1.atomicfu$get(i).kotlinx$atomicfu$value === get_TAKEN())
          return true;
      }
       while (inductionVariable < times);
    var tmp15 = get_PERMIT();
    // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.cas' call
    var value_0 = get_BROKEN();
    return !segment.yo_1.atomicfu$get(i).atomicfu$compareAndSet(tmp15, value_0);
  } else if (cellState === get_CANCELLED())
    return false;
  else
    return tryResumeAcquire(cellState, $this);
}
function tryResumeAcquire(_this__u8e3s4, $this) {
  var tmp;
  if (isInterface(_this__u8e3s4, CancellableContinuation)) {
    if (!isInterface(_this__u8e3s4, CancellableContinuation))
      THROW_CCE();
    var token = _this__u8e3s4.wg(Unit_instance, null, $this.qo_1);
    var tmp_0;
    if (!(token == null)) {
      _this__u8e3s4.xg(token);
      tmp_0 = true;
    } else {
      tmp_0 = false;
    }
    tmp = tmp_0;
  } else {
    if (isInterface(_this__u8e3s4, SelectInstance)) {
      tmp = _this__u8e3s4.un($this, Unit_instance);
    } else {
      var message = 'unexpected: ' + toString(_this__u8e3s4);
      throw IllegalStateException_init_$Create$(toString(message));
    }
  }
  return tmp;
}
function SemaphoreAndMutexImpl$onCancellationRelease$lambda(this$0) {
  return function (_unused_var__etf5q3, _unused_var__etf5q3_0, _unused_var__etf5q3_1) {
    this$0.to();
    return Unit_instance;
  };
}
function createSegment$ref() {
  var l = function (p0, p1) {
    return createSegment(p0, p1);
  };
  l.callableName = 'createSegment';
  return l;
}
function createSegment$ref_0() {
  var l = function (p0, p1) {
    return createSegment(p0, p1);
  };
  l.callableName = 'createSegment';
  return l;
}
function SemaphoreAndMutexImpl(permits, acquiredPermits) {
  this.ko_1 = permits;
  this.mo_1 = atomic$long$1(new Long(0, 0));
  this.oo_1 = atomic$long$1(new Long(0, 0));
  // Inline function 'kotlin.require' call
  if (!(this.ko_1 > 0)) {
    // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.<anonymous>' call
    var message = 'Semaphore should have at least 1 permit, but had ' + this.ko_1;
    throw IllegalArgumentException_init_$Create$(toString(message));
  }
  // Inline function 'kotlin.require' call
  if (!(0 <= acquiredPermits ? acquiredPermits <= this.ko_1 : false)) {
    // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.<anonymous>' call
    var message_0 = 'The number of acquired permits should be in 0..' + this.ko_1;
    throw IllegalArgumentException_init_$Create$(toString(message_0));
  }
  var s = new SemaphoreSegment(new Long(0, 0), null, 2);
  this.lo_1 = atomic$ref$1(s);
  this.no_1 = atomic$ref$1(s);
  this.po_1 = atomic$int$1(this.ko_1 - acquiredPermits | 0);
  var tmp = this;
  tmp.qo_1 = SemaphoreAndMutexImpl$onCancellationRelease$lambda(this);
}
protoOf(SemaphoreAndMutexImpl).so = function () {
  // Inline function 'kotlin.math.max' call
  var a = this.po_1.kotlinx$atomicfu$value;
  return Math.max(a, 0);
};
protoOf(SemaphoreAndMutexImpl).ro = function () {
  $l$loop: while (true) {
    var p = this.po_1.kotlinx$atomicfu$value;
    if (p > this.ko_1) {
      coerceAvailablePermitsAtMaximum(this);
      continue $l$loop;
    }
    if (p <= 0)
      return false;
    if (this.po_1.atomicfu$compareAndSet(p, p - 1 | 0))
      return true;
  }
};
protoOf(SemaphoreAndMutexImpl).acquireCont = function (waiter) {
  var tmp$ret$0;
  $l$block_0: {
    // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.acquire' call
    while (true) {
      var p = decPermits(this);
      if (p > 0) {
        // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.acquire.<anonymous>' call
        waiter.zg(Unit_instance, this.qo_1);
        tmp$ret$0 = Unit_instance;
        break $l$block_0;
      }
      // Inline function 'kotlinx.coroutines.sync.SemaphoreAndMutexImpl.acquire.<anonymous>' call
      if (addAcquireToQueue(this, isInterface(waiter, Waiter) ? waiter : THROW_CCE())) {
        tmp$ret$0 = Unit_instance;
        break $l$block_0;
      }
    }
  }
  return tmp$ret$0;
};
protoOf(SemaphoreAndMutexImpl).to = function () {
  while (true) {
    var p = this.po_1.atomicfu$getAndIncrement();
    if (p >= this.ko_1) {
      coerceAvailablePermitsAtMaximum(this);
      // Inline function 'kotlin.error' call
      var message = 'The number of released permits cannot be greater than ' + this.ko_1;
      throw IllegalStateException_init_$Create$(toString(message));
    }
    if (p >= 0)
      return Unit_instance;
    if (tryResumeNextFromQueue(this))
      return Unit_instance;
  }
};
function SemaphoreSegment(id, prev, pointers) {
  Segment.call(this, id, prev, pointers);
  this.yo_1 = atomicfu$AtomicRefArray$ofNulls(get_SEGMENT_SIZE());
}
protoOf(SemaphoreSegment).en = function () {
  return get_SEGMENT_SIZE();
};
protoOf(SemaphoreSegment).uh = function (index, cause, context) {
  // Inline function 'kotlinx.coroutines.sync.SemaphoreSegment.set' call
  var value = get_CANCELLED();
  this.yo_1.atomicfu$get(index).kotlinx$atomicfu$value = value;
  this.ln();
};
protoOf(SemaphoreSegment).toString = function () {
  return 'SemaphoreSegment[id=' + this.sh_1.toString() + ', hashCode=' + hashCode(this) + ']';
};
function createSegment(id, prev) {
  _init_properties_Semaphore_kt__t514r6();
  return new SemaphoreSegment(id, prev, 0);
}
var properties_initialized_Semaphore_kt_uqcwok;
function _init_properties_Semaphore_kt__t514r6() {
  if (!properties_initialized_Semaphore_kt_uqcwok) {
    properties_initialized_Semaphore_kt_uqcwok = true;
    MAX_SPIN_CYCLES = systemProp('kotlinx.coroutines.semaphore.maxSpinCycles', 100);
    PERMIT = new Symbol('PERMIT');
    TAKEN = new Symbol('TAKEN');
    BROKEN = new Symbol('BROKEN');
    CANCELLED = new Symbol('CANCELLED');
    SEGMENT_SIZE = systemProp('kotlinx.coroutines.semaphore.segmentSize', 16);
  }
}
function createDefaultDispatcher() {
  var tmp;
  if (isJsdom()) {
    tmp = NodeDispatcher_getInstance();
  } else {
    var tmp_0;
    var tmp_1;
    if (!(typeof window === 'undefined')) {
      // Inline function 'kotlin.js.asDynamic' call
      tmp_1 = window != null;
    } else {
      tmp_1 = false;
    }
    if (tmp_1) {
      // Inline function 'kotlin.js.asDynamic' call
      tmp_0 = !(typeof window.addEventListener === 'undefined');
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = asCoroutineDispatcher(window);
    } else {
      if (typeof process === 'undefined' || typeof process.nextTick === 'undefined') {
        tmp = SetTimeoutDispatcher_getInstance();
      } else {
        tmp = NodeDispatcher_getInstance();
      }
    }
  }
  return tmp;
}
function isJsdom() {
  return !(typeof navigator === 'undefined') && navigator != null && navigator.userAgent != null && !(typeof navigator.userAgent === 'undefined') && !(typeof navigator.userAgent.match === 'undefined') && navigator.userAgent.match('\\bjsdom\\b');
}
var counter;
function get_DEBUG() {
  return DEBUG;
}
var DEBUG;
function get_classSimpleName(_this__u8e3s4) {
  var tmp0_elvis_lhs = getKClassFromExpression(_this__u8e3s4).o7();
  return tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs;
}
function get_hexAddress(_this__u8e3s4) {
  // Inline function 'kotlin.js.asDynamic' call
  var result = _this__u8e3s4.__debug_counter;
  if (!(typeof result === 'number')) {
    counter = counter + 1 | 0;
    result = counter;
    // Inline function 'kotlin.js.asDynamic' call
    _this__u8e3s4.__debug_counter = result;
  }
  return ((!(result == null) ? typeof result === 'number' : false) ? result : THROW_CCE()).toString();
}
function NodeDispatcher() {
  NodeDispatcher_instance = this;
  SetTimeoutBasedDispatcher.call(this);
}
protoOf(NodeDispatcher).bp = function () {
  process.nextTick(this.ip_1.gp_1);
};
var NodeDispatcher_instance;
function NodeDispatcher_getInstance() {
  if (NodeDispatcher_instance == null)
    new NodeDispatcher();
  return NodeDispatcher_instance;
}
function ScheduledMessageQueue$processQueue$lambda(this$0) {
  return function () {
    this$0.mp();
    return Unit_instance;
  };
}
function ScheduledMessageQueue(dispatcher) {
  MessageQueue.call(this);
  this.fp_1 = dispatcher;
  var tmp = this;
  tmp.gp_1 = ScheduledMessageQueue$processQueue$lambda(this);
}
protoOf(ScheduledMessageQueue).np = function () {
  this.fp_1.bp();
};
protoOf(ScheduledMessageQueue).op = function () {
  setTimeout(this.gp_1, 0);
};
protoOf(ScheduledMessageQueue).pp = function (timeout) {
  setTimeout(this.gp_1, timeout);
};
function w3cSetTimeout(handler, timeout) {
  return setTimeout(handler, timeout);
}
function WindowMessageQueue$lambda(this$0) {
  return function (event) {
    var tmp;
    if (event.source == this$0.wp_1 && event.data == this$0.xp_1) {
      event.stopPropagation();
      this$0.mp();
      tmp = Unit_instance;
    }
    return Unit_instance;
  };
}
function WindowMessageQueue$schedule$lambda(this$0) {
  return function (it) {
    this$0.mp();
    return Unit_instance;
  };
}
function WindowMessageQueue(window_0) {
  MessageQueue.call(this);
  this.wp_1 = window_0;
  this.xp_1 = 'dispatchCoroutine';
  this.wp_1.addEventListener('message', WindowMessageQueue$lambda(this), true);
}
protoOf(WindowMessageQueue).np = function () {
  var tmp = Promise.resolve(Unit_instance);
  tmp.then(WindowMessageQueue$schedule$lambda(this));
};
protoOf(WindowMessageQueue).op = function () {
  this.wp_1.postMessage(this.xp_1, '*');
};
function w3cSetTimeout_0(window_0, handler, timeout) {
  return setTimeout_0(window_0, handler, timeout);
}
function w3cClearTimeout(window_0, handle) {
  return window_0.clearTimeout(handle);
}
function w3cClearTimeout_0(handle) {
  return clearTimeout(handle);
}
function setTimeout_0(window_0, handler, timeout) {
  return window_0.setTimeout(handler, timeout);
}
function await_0(_this__u8e3s4, $completion) {
  // Inline function 'kotlinx.coroutines.suspendCancellableCoroutine.<anonymous>' call
  var cancellable = new CancellableContinuationImpl(intercepted($completion), 1);
  cancellable.gi();
  // Inline function 'kotlinx.coroutines.await.<anonymous>' call
  var tmp = await$lambda(cancellable);
  _this__u8e3s4.then(tmp, await$lambda_0(cancellable));
  return cancellable.qi();
}
function await$lambda($cont) {
  return function (it) {
    // Inline function 'kotlin.coroutines.resume' call
    var this_0 = $cont;
    // Inline function 'kotlin.Companion.success' call
    var tmp$ret$0 = _Result___init__impl__xyqfz8(it);
    this_0.n6(tmp$ret$0);
    return Unit_instance;
  };
}
function await$lambda_0($cont) {
  return function (it) {
    var tmp0 = $cont;
    var tmp0_elvis_lhs = it instanceof Error ? it : null;
    // Inline function 'kotlin.coroutines.resumeWithException' call
    // Inline function 'kotlin.Companion.failure' call
    var exception = tmp0_elvis_lhs == null ? Exception_init_$Create$('Non-Kotlin exception ' + it.toString()) : tmp0_elvis_lhs;
    var tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(exception));
    tmp0.n6(tmp$ret$0);
    return Unit_instance;
  };
}
function asCoroutineDispatcher(_this__u8e3s4) {
  // Inline function 'kotlin.js.asDynamic' call
  var tmp0_elvis_lhs = _this__u8e3s4.coroutineDispatcher;
  var tmp;
  if (tmp0_elvis_lhs == null) {
    // Inline function 'kotlin.also' call
    var this_0 = new WindowDispatcher(_this__u8e3s4);
    // Inline function 'kotlinx.coroutines.asCoroutineDispatcher.<anonymous>' call
    // Inline function 'kotlin.js.asDynamic' call
    _this__u8e3s4.coroutineDispatcher = this_0;
    tmp = this_0;
  } else {
    tmp = tmp0_elvis_lhs;
  }
  return tmp;
}
function propagateExceptionFinalResort(exception) {
  console.error(exception.toString());
}
function createEventLoop() {
  return new UnconfinedEventLoop();
}
function UnconfinedEventLoop() {
  EventLoop.call(this);
}
protoOf(UnconfinedEventLoop).ak = function (context, block) {
  unsupported();
};
function unsupported() {
  throw UnsupportedOperationException_init_$Create$('runBlocking event loop is not supported');
}
function SetTimeoutDispatcher() {
  SetTimeoutDispatcher_instance = this;
  SetTimeoutBasedDispatcher.call(this);
}
protoOf(SetTimeoutDispatcher).bp = function () {
  this.ip_1.pp(0);
};
var SetTimeoutDispatcher_instance;
function SetTimeoutDispatcher_getInstance() {
  if (SetTimeoutDispatcher_instance == null)
    new SetTimeoutDispatcher();
  return SetTimeoutDispatcher_instance;
}
function SetTimeoutBasedDispatcher$scheduleResumeAfterDelay$lambda($continuation, this$0) {
  return function () {
    // Inline function 'kotlin.with' call
    // Inline function 'kotlinx.coroutines.SetTimeoutBasedDispatcher.scheduleResumeAfterDelay.<anonymous>.<anonymous>' call
    $continuation.yg(this$0, Unit_instance);
    return Unit_instance;
  };
}
function SetTimeoutBasedDispatcher() {
  CoroutineDispatcher.call(this);
  this.ip_1 = new ScheduledMessageQueue(this);
}
protoOf(SetTimeoutBasedDispatcher).ak = function (context, block) {
  this.ip_1.qp(block);
};
protoOf(SetTimeoutBasedDispatcher).jk = function (timeMillis, continuation) {
  var handle = w3cSetTimeout(SetTimeoutBasedDispatcher$scheduleResumeAfterDelay$lambda(continuation, this), delayToInt(timeMillis));
  invokeOnCancellation(continuation, new ClearTimeout(handle));
};
function MessageQueue() {
  this.jp_1 = ArrayDeque_init_$Create$();
  this.kp_1 = 16;
  this.lp_1 = false;
}
protoOf(MessageQueue).qp = function (element) {
  this.rp(element);
  if (!this.lp_1) {
    this.lp_1 = true;
    this.np();
  }
};
protoOf(MessageQueue).mp = function () {
  try {
    // Inline function 'kotlin.repeat' call
    var times = this.kp_1;
    var inductionVariable = 0;
    if (inductionVariable < times)
      do {
        var index = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        // Inline function 'kotlinx.coroutines.MessageQueue.process.<anonymous>' call
        var tmp0_elvis_lhs = removeFirstOrNull(this);
        var tmp;
        if (tmp0_elvis_lhs == null) {
          return Unit_instance;
        } else {
          tmp = tmp0_elvis_lhs;
        }
        var element = tmp;
        element.dj();
      }
       while (inductionVariable < times);
  }finally {
    if (this.f()) {
      this.lp_1 = false;
    } else {
      this.op();
    }
  }
};
protoOf(MessageQueue).rp = function (element) {
  return this.jp_1.u(element);
};
protoOf(MessageQueue).u = function (element) {
  return this.rp((!(element == null) ? isInterface(element, Runnable) : false) ? element : THROW_CCE());
};
protoOf(MessageQueue).sp = function (elements) {
  return this.jp_1.r(elements);
};
protoOf(MessageQueue).r = function (elements) {
  return this.sp(elements);
};
protoOf(MessageQueue).d3 = function (index) {
  return this.jp_1.d3(index);
};
protoOf(MessageQueue).s = function (fromIndex, toIndex) {
  return this.jp_1.s(fromIndex, toIndex);
};
protoOf(MessageQueue).f = function () {
  return this.jp_1.f();
};
protoOf(MessageQueue).k = function () {
  return this.jp_1.k();
};
protoOf(MessageQueue).t = function (index) {
  return this.jp_1.t(index);
};
protoOf(MessageQueue).n = function () {
  return this.jp_1.h9_1;
};
function WindowClearTimeout($outer, handle) {
  this.fq_1 = $outer;
  ClearTimeout.call(this, handle);
}
protoOf(WindowClearTimeout).hi = function () {
  w3cClearTimeout(this.fq_1.hq_1, this.jq_1);
};
function WindowDispatcher$scheduleResumeAfterDelay$lambda($continuation, this$0) {
  return function () {
    // Inline function 'kotlin.with' call
    // Inline function 'kotlinx.coroutines.WindowDispatcher.scheduleResumeAfterDelay.<anonymous>.<anonymous>' call
    $continuation.yg(this$0, Unit_instance);
    return Unit_instance;
  };
}
function WindowDispatcher(window_0) {
  CoroutineDispatcher.call(this);
  this.hq_1 = window_0;
  this.iq_1 = new WindowMessageQueue(this.hq_1);
}
protoOf(WindowDispatcher).ak = function (context, block) {
  return this.iq_1.qp(block);
};
protoOf(WindowDispatcher).jk = function (timeMillis, continuation) {
  var handle = w3cSetTimeout_0(this.hq_1, WindowDispatcher$scheduleResumeAfterDelay$lambda(continuation, this), delayToInt(timeMillis));
  invokeOnCancellation(continuation, new WindowClearTimeout(this, handle));
};
function delayToInt(timeMillis) {
  return coerceIn(timeMillis, new Long(0, 0), new Long(2147483647, 0)).g2();
}
function ClearTimeout(handle) {
  this.jq_1 = handle;
}
protoOf(ClearTimeout).hi = function () {
  w3cClearTimeout_0(this.jq_1);
};
protoOf(ClearTimeout).ni = function (cause) {
  this.hi();
};
protoOf(ClearTimeout).toString = function () {
  return 'ClearTimeout[' + this.jq_1 + ']';
};
function toDebugString(_this__u8e3s4) {
  return toString(_this__u8e3s4);
}
function get_DefaultDelay() {
  var tmp = Dispatchers_getInstance().ek_1;
  return isInterface(tmp, Delay) ? tmp : THROW_CCE();
}
function newCoroutineContext(_this__u8e3s4, context) {
  var combined = _this__u8e3s4.ze().zb(context);
  return !(combined === Dispatchers_getInstance().ek_1) && combined.p6(Key_instance) == null ? combined.zb(Dispatchers_getInstance().ek_1) : combined;
}
function get_coroutineName(_this__u8e3s4) {
  return null;
}
function Dispatchers() {
  Dispatchers_instance = this;
  this.ek_1 = createDefaultDispatcher();
  this.fk_1 = Unconfined_getInstance();
  this.gk_1 = new JsMainDispatcher(this.ek_1, false);
  this.hk_1 = null;
}
protoOf(Dispatchers).ik = function () {
  var tmp0_elvis_lhs = this.hk_1;
  return tmp0_elvis_lhs == null ? this.gk_1 : tmp0_elvis_lhs;
};
var Dispatchers_instance;
function Dispatchers_getInstance() {
  if (Dispatchers_instance == null)
    new Dispatchers();
  return Dispatchers_instance;
}
function JsMainDispatcher(delegate, invokeImmediately) {
  MainCoroutineDispatcher.call(this);
  this.lq_1 = delegate;
  this.mq_1 = invokeImmediately;
  this.nq_1 = this.mq_1 ? this : new JsMainDispatcher(this.lq_1, true);
}
protoOf(JsMainDispatcher).wm = function () {
  return this.nq_1;
};
protoOf(JsMainDispatcher).zj = function (context) {
  return !this.mq_1;
};
protoOf(JsMainDispatcher).ak = function (context, block) {
  return this.lq_1.ak(context, block);
};
protoOf(JsMainDispatcher).toString = function () {
  var tmp0_elvis_lhs = this.xm();
  return tmp0_elvis_lhs == null ? this.lq_1.toString() : tmp0_elvis_lhs;
};
function JobCancellationException(message, cause, job) {
  CancellationException_init_$Init$(message, cause, this);
  captureStack(this, JobCancellationException);
  this.oq_1 = job;
}
protoOf(JobCancellationException).toString = function () {
  return protoOf(CancellationException).toString.call(this) + '; job=' + toString(this.oq_1);
};
protoOf(JobCancellationException).equals = function (other) {
  var tmp;
  if (other === this) {
    tmp = true;
  } else {
    var tmp_0;
    var tmp_1;
    var tmp_2;
    if (other instanceof JobCancellationException) {
      tmp_2 = other.message == this.message;
    } else {
      tmp_2 = false;
    }
    if (tmp_2) {
      tmp_1 = equals(other.oq_1, this.oq_1);
    } else {
      tmp_1 = false;
    }
    if (tmp_1) {
      tmp_0 = equals(other.cause, this.cause);
    } else {
      tmp_0 = false;
    }
    tmp = tmp_0;
  }
  return tmp;
};
protoOf(JobCancellationException).hashCode = function () {
  var tmp = imul(imul(getStringHashCode(ensureNotNull(this.message)), 31) + hashCode(this.oq_1) | 0, 31);
  var tmp0_safe_receiver = this.cause;
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver);
  return tmp + (tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs) | 0;
};
function Runnable() {
}
function SchedulerTask() {
}
function identitySet(expectedSize) {
  return HashSet_init_$Create$(expectedSize);
}
function get_platformExceptionHandlers_() {
  _init_properties_CoroutineExceptionHandlerImpl_kt__37d7wf();
  return platformExceptionHandlers_;
}
var platformExceptionHandlers_;
function get_platformExceptionHandlers() {
  _init_properties_CoroutineExceptionHandlerImpl_kt__37d7wf();
  return get_platformExceptionHandlers_();
}
function DiagnosticCoroutineContextException(context) {
  RuntimeException_init_$Init$_0(toString(context), this);
  captureStack(this, DiagnosticCoroutineContextException);
}
var properties_initialized_CoroutineExceptionHandlerImpl_kt_qhrgvx;
function _init_properties_CoroutineExceptionHandlerImpl_kt__37d7wf() {
  if (!properties_initialized_CoroutineExceptionHandlerImpl_kt_qhrgvx) {
    properties_initialized_CoroutineExceptionHandlerImpl_kt_qhrgvx = true;
    // Inline function 'kotlin.collections.mutableSetOf' call
    platformExceptionHandlers_ = LinkedHashSet_init_$Create$();
  }
}
function LockFreeLinkedListHead() {
  LockFreeLinkedListNode.call(this);
}
function LockFreeLinkedListNode() {
  this.sj_1 = this;
  this.tj_1 = this;
  this.uj_1 = false;
}
protoOf(LockFreeLinkedListNode).vj = function (node, permissionsBitmask) {
  var prev = this.tj_1;
  var tmp;
  if (prev instanceof ListClosed) {
    tmp = ((prev.sq_1 & permissionsBitmask) === 0 && prev.vj(node, permissionsBitmask));
  } else {
    node.sj_1 = this;
    node.tj_1 = prev;
    prev.sj_1 = node;
    this.tj_1 = node;
    tmp = true;
  }
  return tmp;
};
protoOf(LockFreeLinkedListNode).fl = function (forbiddenElementsBit) {
  this.vj(new ListClosed(forbiddenElementsBit), forbiddenElementsBit);
};
protoOf(LockFreeLinkedListNode).wj = function () {
  if (this.uj_1)
    return false;
  var prev = this.tj_1;
  var next = this.sj_1;
  prev.sj_1 = next;
  next.tj_1 = prev;
  this.uj_1 = true;
  return true;
};
protoOf(LockFreeLinkedListNode).xj = function (node) {
  if (!(this.sj_1 === this))
    return false;
  this.vj(node, -2147483648);
  return true;
};
function ListClosed(forbiddenElementsBitmask) {
  LockFreeLinkedListNode.call(this);
  this.sq_1 = forbiddenElementsBitmask;
}
function unwrap(exception) {
  return exception;
}
function recoverStackTrace(exception, continuation) {
  return exception;
}
function SynchronizedObject() {
}
function systemProp_1(propertyName) {
  return null;
}
function threadContextElements(context) {
  return 0;
}
function CommonThreadLocal() {
  this.xk_1 = null;
}
protoOf(CommonThreadLocal).yk = function () {
  var tmp = this.xk_1;
  return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE();
};
protoOf(CommonThreadLocal).zk = function (value) {
  this.xk_1 = value;
};
function commonThreadLocal(name) {
  return new CommonThreadLocal();
}
//region block: post-declaration
protoOf(JobSupport).zb = plus;
protoOf(JobSupport).p6 = get_0;
protoOf(JobSupport).yb = fold;
protoOf(JobSupport).xb = minusKey_0;
protoOf(CoroutineDispatcher).p6 = get;
protoOf(CoroutineDispatcher).xb = minusKey;
defineProp(protoOf(DispatchException), 'cause', function () {
  return this.t6();
});
protoOf(MutexImpl).xn = tryLock$default;
protoOf(MutexImpl).zn = unlock$default;
//endregion
//region block: init
Active_instance = new Active();
Key_instance_1 = new Key_0();
Key_instance_2 = new Key_1();
NonDisposableHandle_instance = new NonDisposableHandle();
Key_instance_3 = new Key_2();
counter = 0;
DEBUG = false;
//endregion
//region block: exports
export {
  await_0 as awaitopqeg9l1dqx0,
  delay as delay2673xnmlkmidc,
  Mutex_0 as Mutex16li1l0asjv17,
  CoroutineScope as CoroutineScopefcb5f5dwqcas,
  MainScope as MainScope1gi1r4abhrtmm,
  launch as launch1c91vkjzdi9sd,
};
//endregion

//# sourceMappingURL=kotlinx-coroutines-core.mjs.map
