UNPKG

@cpaassdk/cpaas-sdk

Version:
10,163 lines 335 kB
(function (root, factory) {
  if (typeof define === 'function' && define.amd)
    define(['exports', './kotlin-kotlin-stdlib-js-ir.js', './88b0986a7186d029-atomicfu-js-ir.js'], factory);
  else if (typeof exports === 'object')
    factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./88b0986a7186d029-atomicfu-js-ir.js'));
  else {
    if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
      throw new Error("Error loading module 'kotlinx.coroutines-kotlinx-coroutines-core-js-ir'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'kotlinx.coroutines-kotlinx-coroutines-core-js-ir'.");
    }
    if (typeof this['88b0986a7186d029-atomicfu-js-ir'] === 'undefined') {
      throw new Error("Error loading module 'kotlinx.coroutines-kotlinx-coroutines-core-js-ir'. Its dependency '88b0986a7186d029-atomicfu-js-ir' was not found. Please, check whether '88b0986a7186d029-atomicfu-js-ir' is loaded prior to 'kotlinx.coroutines-kotlinx-coroutines-core-js-ir'.");
    }
    root['kotlinx.coroutines-kotlinx-coroutines-core-js-ir'] = factory(typeof this['kotlinx.coroutines-kotlinx-coroutines-core-js-ir'] === 'undefined' ? {} : this['kotlinx.coroutines-kotlinx-coroutines-core-js-ir'], this['kotlin-kotlin-stdlib-js-ir'], this['88b0986a7186d029-atomicfu-js-ir']);
  }
}(this, function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_atomicfu) {
  'use strict';
  //region block: imports
  var imul = Math.imul;
  var Unit_getInstance = kotlin_kotlin.$_$.h4;
  var THROW_CCE = kotlin_kotlin.$_$.qc;
  var isObject = kotlin_kotlin.$_$.s9;
  var plus = kotlin_kotlin.$_$.g8;
  var get = kotlin_kotlin.$_$.c8;
  var fold = kotlin_kotlin.$_$.b8;
  var minusKey = kotlin_kotlin.$_$.d8;
  var Continuation = kotlin_kotlin.$_$.a8;
  var classMeta = kotlin_kotlin.$_$.x8;
  var EmptyCoroutineContext_getInstance = kotlin_kotlin.$_$.q3;
  var Key_getInstance = kotlin_kotlin.$_$.p3;
  var equals = kotlin_kotlin.$_$.z8;
  var createCoroutineUnintercepted = kotlin_kotlin.$_$.t7;
  var isInterface = kotlin_kotlin.$_$.p9;
  var CoroutineImpl = kotlin_kotlin.$_$.h8;
  var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.s7;
  var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.e2;
  var atomic$int$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d;
  var intercepted = kotlin_kotlin.$_$.u7;
  var startCoroutine = kotlin_kotlin.$_$.n8;
  var noWhenBranchMatchedException = kotlin_kotlin.$_$.kd;
  var interfaceMeta = kotlin_kotlin.$_$.g9;
  var toString = kotlin_kotlin.$_$.od;
  var toString_0 = kotlin_kotlin.$_$.ha;
  var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.c;
  var objectMeta = kotlin_kotlin.$_$.da;
  var atomic$boolean$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.b;
  var CancellationException_init_$Create$ = kotlin_kotlin.$_$.o1;
  var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.a3;
  var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.c3;
  var hashCode = kotlin_kotlin.$_$.f9;
  var Companion_getInstance = kotlin_kotlin.$_$.c4;
  var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.z2;
  var createFailure = kotlin_kotlin.$_$.cd;
  var AbstractCoroutineContextKey = kotlin_kotlin.$_$.w7;
  var AbstractCoroutineContextElement = kotlin_kotlin.$_$.v7;
  var get_0 = kotlin_kotlin.$_$.x7;
  var minusKey_0 = kotlin_kotlin.$_$.y7;
  var ContinuationInterceptor = kotlin_kotlin.$_$.z7;
  var Key = kotlin_kotlin.$_$.f8;
  var Element = kotlin_kotlin.$_$.e8;
  var RuntimeException_init_$Create$ = kotlin_kotlin.$_$.m2;
  var getStringHashCode = kotlin_kotlin.$_$.e9;
  var CancellationException_init_$Create$_0 = kotlin_kotlin.$_$.q1;
  var Enum = kotlin_kotlin.$_$.gc;
  var Long = kotlin_kotlin.$_$.lc;
  var Companion_getInstance_0 = kotlin_kotlin.$_$.b4;
  var RuntimeException = kotlin_kotlin.$_$.pc;
  var RuntimeException_init_$Init$ = kotlin_kotlin.$_$.l2;
  var captureStack = kotlin_kotlin.$_$.s8;
  var Error_0 = kotlin_kotlin.$_$.hc;
  var Error_init_$Init$ = kotlin_kotlin.$_$.u1;
  var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.s1;
  var anyToString = kotlin_kotlin.$_$.p8;
  var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.nd;
  var ArrayList_init_$Create$ = kotlin_kotlin.$_$.z;
  var CancellationException = kotlin_kotlin.$_$.r7;
  var ArrayList = kotlin_kotlin.$_$.i4;
  var IllegalStateException_init_$Create$_0 = kotlin_kotlin.$_$.g2;
  var UnsupportedOperationException = kotlin_kotlin.$_$.yc;
  var UnsupportedOperationException_init_$Create$ = kotlin_kotlin.$_$.p2;
  var ensureNotNull = kotlin_kotlin.$_$.dd;
  var addSuppressed = kotlin_kotlin.$_$.zc;
  var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.a2;
  var NoSuchElementException = kotlin_kotlin.$_$.mc;
  var NoSuchElementException_init_$Init$ = kotlin_kotlin.$_$.k2;
  var IllegalStateException = kotlin_kotlin.$_$.kc;
  var IllegalStateException_init_$Init$ = kotlin_kotlin.$_$.d2;
  var Unit = kotlin_kotlin.$_$.xc;
  var returnIfSuspended = kotlin_kotlin.$_$.g;
  var toLong = kotlin_kotlin.$_$.fa;
  var copyOf = kotlin_kotlin.$_$.v5;
  var atomicfu$AtomicRefArray$ofNulls = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.a;
  var fillArrayVal = kotlin_kotlin.$_$.b9;
  var joinToString$default = kotlin_kotlin.$_$.h;
  var SuspendFunction1 = kotlin_kotlin.$_$.j8;
  var IntCompanionObject_getInstance = kotlin_kotlin.$_$.v3;
  var arrayCopy = kotlin_kotlin.$_$.g5;
  var toLongOrNull = kotlin_kotlin.$_$.rb;
  var getKClassFromExpression = kotlin_kotlin.$_$.c;
  var CancellationException_init_$Init$ = kotlin_kotlin.$_$.p1;
  var coerceIn = kotlin_kotlin.$_$.oa;
  var HashSet_init_$Create$ = kotlin_kotlin.$_$.f1;
  var UnsupportedOperationException_init_$Create$_0 = kotlin_kotlin.$_$.o2;
  //endregion
  //region block: pre-declaration
  function cancel$default(cause, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      cause = null;
    return $handler == null ? this.nl(cause) : $handler(cause);
  }
  function invokeOnCompletion$default(onCancelling, invokeImmediately, handler, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      onCancelling = false;
    if (!(($mask0 & 2) === 0))
      invokeImmediately = true;
    return $handler == null ? this.jl(onCancelling, invokeImmediately, handler) : $handler(onCancelling, invokeImmediately, handler);
  }
  AbstractCoroutine.prototype = Object.create(JobSupport.prototype);
  AbstractCoroutine.prototype.constructor = AbstractCoroutine;
  StandaloneCoroutine.prototype = Object.create(AbstractCoroutine.prototype);
  StandaloneCoroutine.prototype.constructor = StandaloneCoroutine;
  LazyStandaloneCoroutine.prototype = Object.create(StandaloneCoroutine.prototype);
  LazyStandaloneCoroutine.prototype.constructor = LazyStandaloneCoroutine;
  $awaitCOROUTINE$0.prototype = Object.create(CoroutineImpl.prototype);
  $awaitCOROUTINE$0.prototype.constructor = $awaitCOROUTINE$0;
  DeferredCoroutine.prototype = Object.create(AbstractCoroutine.prototype);
  DeferredCoroutine.prototype.constructor = DeferredCoroutine;
  LazyDeferredCoroutine.prototype = Object.create(DeferredCoroutine.prototype);
  LazyDeferredCoroutine.prototype.constructor = LazyDeferredCoroutine;
  ScopeCoroutine.prototype = Object.create(AbstractCoroutine.prototype);
  ScopeCoroutine.prototype.constructor = ScopeCoroutine;
  DispatchedCoroutine.prototype = Object.create(ScopeCoroutine.prototype);
  DispatchedCoroutine.prototype.constructor = DispatchedCoroutine;
  function tryResume$default(value, idempotent, $mask0, $handler) {
    if (!(($mask0 & 2) === 0))
      idempotent = null;
    return $handler == null ? this.xn(value, idempotent) : $handler(value, idempotent);
  }
  CancelHandler.prototype = Object.create(CancelHandlerBase.prototype);
  CancelHandler.prototype.constructor = CancelHandler;
  DisposeOnCancel.prototype = Object.create(CancelHandler.prototype);
  DisposeOnCancel.prototype.constructor = DisposeOnCancel;
  BeforeResumeCancelHandler.prototype = Object.create(CancelHandler.prototype);
  BeforeResumeCancelHandler.prototype.constructor = BeforeResumeCancelHandler;
  RemoveOnCancel.prototype = Object.create(BeforeResumeCancelHandler.prototype);
  RemoveOnCancel.prototype.constructor = RemoveOnCancel;
  DispatchedTask.prototype = Object.create(SchedulerTask.prototype);
  DispatchedTask.prototype.constructor = DispatchedTask;
  CancellableContinuationImpl.prototype = Object.create(DispatchedTask.prototype);
  CancellableContinuationImpl.prototype.constructor = CancellableContinuationImpl;
  InvokeOnCancel.prototype = Object.create(CancelHandler.prototype);
  InvokeOnCancel.prototype.constructor = InvokeOnCancel;
  $awaitCOROUTINE$1.prototype = Object.create(CoroutineImpl.prototype);
  $awaitCOROUTINE$1.prototype.constructor = $awaitCOROUTINE$1;
  CompletableDeferredImpl.prototype = Object.create(JobSupport.prototype);
  CompletableDeferredImpl.prototype.constructor = CompletableDeferredImpl;
  CancelledContinuation.prototype = Object.create(CompletedExceptionally.prototype);
  CancelledContinuation.prototype.constructor = CancelledContinuation;
  Key_0.prototype = Object.create(AbstractCoroutineContextKey.prototype);
  Key_0.prototype.constructor = Key_0;
  CoroutineDispatcher.prototype = Object.create(AbstractCoroutineContextElement.prototype);
  CoroutineDispatcher.prototype.constructor = CoroutineDispatcher;
  _no_name_provided__qut3iv.prototype = Object.create(AbstractCoroutineContextElement.prototype);
  _no_name_provided__qut3iv.prototype.constructor = _no_name_provided__qut3iv;
  CoroutineName.prototype = Object.create(AbstractCoroutineContextElement.prototype);
  CoroutineName.prototype.constructor = CoroutineName;
  CoroutineStart.prototype = Object.create(Enum.prototype);
  CoroutineStart.prototype.constructor = CoroutineStart;
  EventLoop.prototype = Object.create(CoroutineDispatcher.prototype);
  EventLoop.prototype.constructor = EventLoop;
  CompletionHandlerException.prototype = Object.create(RuntimeException.prototype);
  CompletionHandlerException.prototype.constructor = CompletionHandlerException;
  CoroutinesInternalError.prototype = Object.create(Error_0.prototype);
  CoroutinesInternalError.prototype.constructor = CoroutinesInternalError;
  LinkedListHead.prototype = Object.create(LinkedListNode.prototype);
  LinkedListHead.prototype.constructor = LinkedListHead;
  NodeList.prototype = Object.create(LinkedListHead.prototype);
  NodeList.prototype.constructor = NodeList;
  CompletionHandlerBase.prototype = Object.create(LinkedListNode.prototype);
  CompletionHandlerBase.prototype.constructor = CompletionHandlerBase;
  JobNode.prototype = Object.create(CompletionHandlerBase.prototype);
  JobNode.prototype.constructor = JobNode;
  ChildCompletion.prototype = Object.create(JobNode.prototype);
  ChildCompletion.prototype.constructor = ChildCompletion;
  AwaitContinuation.prototype = Object.create(CancellableContinuationImpl.prototype);
  AwaitContinuation.prototype.constructor = AwaitContinuation;
  JobCancellingNode.prototype = Object.create(JobNode.prototype);
  JobCancellingNode.prototype.constructor = JobCancellingNode;
  ChildHandleNode.prototype = Object.create(JobCancellingNode.prototype);
  ChildHandleNode.prototype.constructor = ChildHandleNode;
  InvokeOnCancelling.prototype = Object.create(JobCancellingNode.prototype);
  InvokeOnCancelling.prototype.constructor = InvokeOnCancelling;
  InvokeOnCompletion.prototype = Object.create(JobNode.prototype);
  InvokeOnCompletion.prototype.constructor = InvokeOnCompletion;
  ResumeOnCompletion.prototype = Object.create(JobNode.prototype);
  ResumeOnCompletion.prototype.constructor = ResumeOnCompletion;
  ResumeAwaitOnCompletion.prototype = Object.create(JobNode.prototype);
  ResumeAwaitOnCompletion.prototype.constructor = ResumeAwaitOnCompletion;
  ChildContinuation.prototype = Object.create(JobCancellingNode.prototype);
  ChildContinuation.prototype.constructor = ChildContinuation;
  JobImpl.prototype = Object.create(JobSupport.prototype);
  JobImpl.prototype.constructor = JobImpl;
  MainCoroutineDispatcher.prototype = Object.create(CoroutineDispatcher.prototype);
  MainCoroutineDispatcher.prototype.constructor = MainCoroutineDispatcher;
  SupervisorJobImpl.prototype = Object.create(JobImpl.prototype);
  SupervisorJobImpl.prototype.constructor = SupervisorJobImpl;
  TimeoutCancellationException.prototype = Object.create(CancellationException.prototype);
  TimeoutCancellationException.prototype.constructor = TimeoutCancellationException;
  Unconfined.prototype = Object.create(CoroutineDispatcher.prototype);
  Unconfined.prototype.constructor = Unconfined;
  RemoveReceiveOnCancel.prototype = Object.create(BeforeResumeCancelHandler.prototype);
  RemoveReceiveOnCancel.prototype.constructor = RemoveReceiveOnCancel;
  Receive.prototype = Object.create(LinkedListNode.prototype);
  Receive.prototype.constructor = Receive;
  ReceiveElement.prototype = Object.create(Receive.prototype);
  ReceiveElement.prototype.constructor = ReceiveElement;
  ReceiveElementWithUndeliveredHandler.prototype = Object.create(ReceiveElement.prototype);
  ReceiveElementWithUndeliveredHandler.prototype.constructor = ReceiveElementWithUndeliveredHandler;
  ReceiveHasNext.prototype = Object.create(Receive.prototype);
  ReceiveHasNext.prototype.constructor = ReceiveHasNext;
  function close$default(cause, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      cause = null;
    return $handler == null ? this.iz(cause) : $handler(cause);
  }
  function offer(element) {
    var result = this.uz(element);
    if (_ChannelResult___get_isSuccess__impl__odq1z9(result))
      return true;
    var tmp0_elvis_lhs = ChannelResult__exceptionOrNull_impl_16ei30(result);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return false;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    throw recoverStackTrace_0(tmp);
  }
  function cancel$default_0(cause, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      cause = null;
    return $handler == null ? this.nl(cause) : $handler(cause);
  }
  AbstractChannel.prototype = Object.create(AbstractSendChannel.prototype);
  AbstractChannel.prototype.constructor = AbstractChannel;
  Send.prototype = Object.create(LinkedListNode.prototype);
  Send.prototype.constructor = Send;
  SendBuffered.prototype = Object.create(Send.prototype);
  SendBuffered.prototype.constructor = SendBuffered;
  Closed.prototype = Object.create(Send.prototype);
  Closed.prototype.constructor = Closed;
  SendElement.prototype = Object.create(Send.prototype);
  SendElement.prototype.constructor = SendElement;
  SendElementWithUndeliveredHandler.prototype = Object.create(SendElement.prototype);
  SendElementWithUndeliveredHandler.prototype.constructor = SendElementWithUndeliveredHandler;
  ArrayChannel.prototype = Object.create(AbstractChannel.prototype);
  ArrayChannel.prototype.constructor = ArrayChannel;
  BufferOverflow.prototype = Object.create(Enum.prototype);
  BufferOverflow.prototype.constructor = BufferOverflow;
  Closed_0.prototype = Object.create(Failed.prototype);
  Closed_0.prototype.constructor = Closed_0;
  ClosedReceiveChannelException.prototype = Object.create(NoSuchElementException.prototype);
  ClosedReceiveChannelException.prototype.constructor = ClosedReceiveChannelException;
  ClosedSendChannelException.prototype = Object.create(IllegalStateException.prototype);
  ClosedSendChannelException.prototype.constructor = ClosedSendChannelException;
  ChannelCoroutine.prototype = Object.create(AbstractCoroutine.prototype);
  ChannelCoroutine.prototype.constructor = ChannelCoroutine;
  ConflatedChannel.prototype = Object.create(AbstractChannel.prototype);
  ConflatedChannel.prototype.constructor = ConflatedChannel;
  LinkedListChannel.prototype = Object.create(AbstractChannel.prototype);
  LinkedListChannel.prototype.constructor = LinkedListChannel;
  ProducerCoroutine.prototype = Object.create(ChannelCoroutine.prototype);
  ProducerCoroutine.prototype.constructor = ProducerCoroutine;
  $awaitCloseCOROUTINE$5.prototype = Object.create(CoroutineImpl.prototype);
  $awaitCloseCOROUTINE$5.prototype.constructor = $awaitCloseCOROUTINE$5;
  RendezvousChannel.prototype = Object.create(AbstractChannel.prototype);
  RendezvousChannel.prototype.constructor = RendezvousChannel;
  $collectToCOROUTINE$6.prototype = Object.create(CoroutineImpl.prototype);
  $collectToCOROUTINE$6.prototype.constructor = $collectToCOROUTINE$6;
  ChannelFlowBuilder.prototype = Object.create(ChannelFlow.prototype);
  ChannelFlowBuilder.prototype.constructor = ChannelFlowBuilder;
  CallbackFlowBuilder.prototype = Object.create(ChannelFlowBuilder.prototype);
  CallbackFlowBuilder.prototype.constructor = CallbackFlowBuilder;
  $emitAllImplCOROUTINE$7.prototype = Object.create(CoroutineImpl.prototype);
  $emitAllImplCOROUTINE$7.prototype.constructor = $emitAllImplCOROUTINE$7;
  $collectCOROUTINE$9.prototype = Object.create(CoroutineImpl.prototype);
  $collectCOROUTINE$9.prototype.constructor = $collectCOROUTINE$9;
  StateFlowImpl.prototype = Object.create(AbstractSharedFlow.prototype);
  StateFlowImpl.prototype.constructor = StateFlowImpl;
  StateFlowSlot.prototype = Object.create(AbstractSharedFlowSlot.prototype);
  StateFlowSlot.prototype.constructor = StateFlowSlot;
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype = Object.create(CoroutineImpl.prototype);
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype.constructor = ChannelFlow$_get_collectToFun_$slambda_j53z2e;
  ChannelFlow$collect$slambda.prototype = Object.create(CoroutineImpl.prototype);
  ChannelFlow$collect$slambda.prototype.constructor = ChannelFlow$collect$slambda;
  $onSubscriptionCOROUTINE$11.prototype = Object.create(CoroutineImpl.prototype);
  $onSubscriptionCOROUTINE$11.prototype.constructor = $onSubscriptionCOROUTINE$11;
  DispatchedContinuation.prototype = Object.create(DispatchedTask.prototype);
  DispatchedContinuation.prototype.constructor = DispatchedContinuation;
  UndeliveredElementException.prototype = Object.create(RuntimeException.prototype);
  UndeliveredElementException.prototype.constructor = UndeliveredElementException;
  UndispatchedCoroutine.prototype = Object.create(ScopeCoroutine.prototype);
  UndispatchedCoroutine.prototype.constructor = UndispatchedCoroutine;
  JsMainDispatcher.prototype = Object.create(MainCoroutineDispatcher.prototype);
  JsMainDispatcher.prototype.constructor = JsMainDispatcher;
  UnconfinedEventLoop.prototype = Object.create(EventLoop.prototype);
  UnconfinedEventLoop.prototype.constructor = UnconfinedEventLoop;
  JobCancellationException.prototype = Object.create(CancellationException.prototype);
  JobCancellationException.prototype.constructor = JobCancellationException;
  SetTimeoutBasedDispatcher.prototype = Object.create(CoroutineDispatcher.prototype);
  SetTimeoutBasedDispatcher.prototype.constructor = SetTimeoutBasedDispatcher;
  NodeDispatcher.prototype = Object.create(SetTimeoutBasedDispatcher.prototype);
  NodeDispatcher.prototype.constructor = NodeDispatcher;
  SetTimeoutDispatcher.prototype = Object.create(SetTimeoutBasedDispatcher.prototype);
  SetTimeoutDispatcher.prototype.constructor = SetTimeoutDispatcher;
  MessageQueue.prototype = Object.create(ArrayQueue.prototype);
  MessageQueue.prototype.constructor = MessageQueue;
  ScheduledMessageQueue.prototype = Object.create(MessageQueue.prototype);
  ScheduledMessageQueue.prototype.constructor = ScheduledMessageQueue;
  ClearTimeout.prototype = Object.create(CancelHandler.prototype);
  ClearTimeout.prototype.constructor = ClearTimeout;
  WindowDispatcher.prototype = Object.create(CoroutineDispatcher.prototype);
  WindowDispatcher.prototype.constructor = WindowDispatcher;
  WindowMessageQueue.prototype = Object.create(MessageQueue.prototype);
  WindowMessageQueue.prototype.constructor = WindowMessageQueue;
  ArrayChannelState.prototype = Object.create(ArrayBufferState.prototype);
  ArrayChannelState.prototype.constructor = ArrayChannelState;
  //endregion
  function AbstractCoroutine(parentContext, initParentJob, active) {
    JobSupport.call(this, active);
    this.ek_1 = parentContext;
    this.fk_1 = this.ek_1.f5(this);
    var tmp;
    if (initParentJob) {
      var tmp$ret$0;
      {
        tmp$ret$0 = true;
      }
      tmp = tmp$ret$0;
    } else {
      tmp = false;
    }
    if (tmp)
      this.ik(this.ek_1.y4(Key_getInstance_3()));
  }
  AbstractCoroutine.prototype.jk = function () {
    return this.ek_1;
  };
  AbstractCoroutine.prototype.u4 = function () {
    return this.fk_1;
  };
  AbstractCoroutine.prototype.kk = function () {
    return this.fk_1;
  };
  AbstractCoroutine.prototype.lk = function () {
    return JobSupport.prototype.lk.call(this);
  };
  AbstractCoroutine.prototype.mk = function (value) {
  };
  AbstractCoroutine.prototype.nk = function (cause, handled) {
  };
  AbstractCoroutine.prototype.ok = function () {
    return get_classSimpleName(this) + ' was cancelled';
  };
  AbstractCoroutine.prototype.pk = function (state) {
    if (state instanceof CompletedExceptionally)
      this.nk(state.qk_1, state.sk());
    else {
      this.mk((state == null ? true : isObject(state)) ? state : THROW_CCE());
    }
  };
  AbstractCoroutine.prototype.v4 = function (result) {
    var state = this.tk(toState$default(result, null, 1, null));
    if (state === get_COMPLETING_WAITING_CHILDREN())
      return Unit_getInstance();
    this.uk(state);
  };
  AbstractCoroutine.prototype.uk = function (state) {
    return this.vk(state);
  };
  AbstractCoroutine.prototype.wk = function (exception) {
    handleCoroutineException(this.fk_1, exception);
  };
  AbstractCoroutine.prototype.xk = function () {
    var tmp0_elvis_lhs = get_coroutineName(this.fk_1);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return JobSupport.prototype.xk.call(this);
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var coroutineName = tmp;
    return '"' + coroutineName + '":' + JobSupport.prototype.xk.call(this);
  };
  AbstractCoroutine.prototype.yk = function (start, receiver, block) {
    {
      startCoroutineImpl(start, receiver, this, null, block);
    }
  };
  AbstractCoroutine.$metadata$ = classMeta('AbstractCoroutine', [Job, Continuation, CoroutineScope], undefined, undefined, undefined, JobSupport.prototype);
  function launch(_this__u8e3s4, context, start, block) {
    var newContext = newCoroutineContext(_this__u8e3s4, context);
    var coroutine = start.dm() ? new LazyStandaloneCoroutine(newContext, block) : new StandaloneCoroutine(newContext, true);
    coroutine.yk(start, coroutine, block);
    return coroutine;
  }
  function launch$default(_this__u8e3s4, context, start, block, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      context = EmptyCoroutineContext_getInstance();
    if (!(($mask0 & 2) === 0))
      start = CoroutineStart_DEFAULT_getInstance();
    return launch(_this__u8e3s4, context, start, block);
  }
  function async(_this__u8e3s4, context, start, block) {
    var newContext = newCoroutineContext(_this__u8e3s4, context);
    var coroutine = start.dm() ? new LazyDeferredCoroutine(newContext, block) : new DeferredCoroutine(newContext, true);
    coroutine.yk(start, coroutine, block);
    return coroutine;
  }
  function async$default(_this__u8e3s4, context, start, block, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      context = EmptyCoroutineContext_getInstance();
    if (!(($mask0 & 2) === 0))
      start = CoroutineStart_DEFAULT_getInstance();
    return async(_this__u8e3s4, context, start, block);
  }
  function withContext(context, block, $cont) {
    {
    }
    var tmp$ret$0;
    $l$block_0: {
      var tmp0__anonymous__q1qw7t = $cont;
      var oldContext = tmp0__anonymous__q1qw7t.u4();
      var newContext = oldContext.f5(context);
      ensureActive(newContext);
      if (newContext === oldContext) {
        var coroutine = new ScopeCoroutine(newContext, tmp0__anonymous__q1qw7t, true);
        tmp$ret$0 = startUndispatchedOrReturn(coroutine, coroutine, block);
        break $l$block_0;
      }
      if (equals(newContext.y4(Key_getInstance()), oldContext.y4(Key_getInstance()))) {
        var coroutine_0 = new UndispatchedCoroutine(newContext, tmp0__anonymous__q1qw7t);
        var tmp$ret$1;
        {
          tmp$ret$0 = startUndispatchedOrReturn(coroutine_0, coroutine_0, block);
          break $l$block_0;
        }
      }
      var coroutine_1 = new DispatchedCoroutine(newContext, tmp0__anonymous__q1qw7t);
      coroutine_1.yk(CoroutineStart_DEFAULT_getInstance(), coroutine_1, block);
      tmp$ret$0 = coroutine_1.km();
    }
    return tmp$ret$0;
  }
  function StandaloneCoroutine(parentContext, active) {
    AbstractCoroutine.call(this, parentContext, true, active);
  }
  StandaloneCoroutine.prototype.zl = function (exception) {
    handleCoroutineException(this.u4(), exception);
    return true;
  };
  StandaloneCoroutine.$metadata$ = classMeta('StandaloneCoroutine', undefined, undefined, undefined, undefined, AbstractCoroutine.prototype);
  function LazyStandaloneCoroutine(parentContext, block) {
    StandaloneCoroutine.call(this, parentContext, false);
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = createCoroutineUnintercepted(block, this, this);
    }
    tmp.tm_1 = tmp$ret$0;
  }
  LazyStandaloneCoroutine.prototype.el = function () {
    var tmp$ret$0;
    {
      var tmp0_startLazyCoroutine = this.tm_1;
      tmp$ret$0 = startCoroutineCancellable_0(isInterface(tmp0_startLazyCoroutine, Continuation) ? tmp0_startLazyCoroutine : THROW_CCE(), this);
    }
  };
  LazyStandaloneCoroutine.$metadata$ = classMeta('LazyStandaloneCoroutine', undefined, undefined, undefined, undefined, StandaloneCoroutine.prototype);
  function $awaitCOROUTINE$0(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.cn_1 = _this__u8e3s4;
  }
  $awaitCOROUTINE$0.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 2;
            this.ii_1 = 1;
            suspendResult = this.cn_1.dn(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return (suspendResult == null ? true : isObject(suspendResult)) ? suspendResult : THROW_CCE();
          case 2:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 2) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $awaitCOROUTINE$0.$metadata$ = classMeta('$awaitCOROUTINE$0', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function DeferredCoroutine(parentContext, active) {
    AbstractCoroutine.call(this, parentContext, true, active);
  }
  DeferredCoroutine.prototype.in = function ($cont) {
    var tmp = new $awaitCOROUTINE$0(this, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  DeferredCoroutine.$metadata$ = classMeta('DeferredCoroutine', [Deferred, SelectClause1], undefined, undefined, undefined, AbstractCoroutine.prototype);
  function LazyDeferredCoroutine(parentContext, block) {
    DeferredCoroutine.call(this, parentContext, false);
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = createCoroutineUnintercepted(block, this, this);
    }
    tmp.nn_1 = tmp$ret$0;
  }
  LazyDeferredCoroutine.prototype.el = function () {
    var tmp$ret$0;
    {
      var tmp0_startLazyCoroutine = this.nn_1;
      tmp$ret$0 = startCoroutineCancellable_0(isInterface(tmp0_startLazyCoroutine, Continuation) ? tmp0_startLazyCoroutine : THROW_CCE(), this);
    }
  };
  LazyDeferredCoroutine.$metadata$ = classMeta('LazyDeferredCoroutine', undefined, undefined, undefined, undefined, DeferredCoroutine.prototype);
  function trySuspend($this) {
    {
      var tmp0_loop = $this.jm_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.uj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          switch (tmp0_subject) {
            case 0:
              if ($this.jm_1.atomicfu$compareAndSet(0, 1))
                return true;
              break;
            case 2:
              return false;
            default:
              throw IllegalStateException_init_$Create$('Already suspended');
          }
        }
      }
    }
  }
  function tryResume($this) {
    {
      var tmp0_loop = $this.jm_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.uj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          switch (tmp0_subject) {
            case 0:
              if ($this.jm_1.atomicfu$compareAndSet(0, 2))
                return true;
              break;
            case 1:
              return false;
            default:
              throw IllegalStateException_init_$Create$('Already resumed');
          }
        }
      }
    }
  }
  function DispatchedCoroutine(context, uCont) {
    ScopeCoroutine.call(this, context, uCont, true);
    this.jm_1 = atomic$int$1(0);
  }
  DispatchedCoroutine.prototype.on = function () {
  };
  DispatchedCoroutine.prototype.vk = function (state) {
    this.uk(state);
  };
  DispatchedCoroutine.prototype.uk = function (state) {
    if (tryResume(this))
      return Unit_getInstance();
    {
      var tmp0_shareableInterceptedResumeCancellableWith = this.un();
      var tmp1_shareableInterceptedResumeCancellableWith = recoverResult(state, this.un());
      var tmp = intercepted(tmp0_shareableInterceptedResumeCancellableWith);
      resumeCancellableWith$default(tmp, tmp1_shareableInterceptedResumeCancellableWith, null, 2, null);
    }
  };
  DispatchedCoroutine.prototype.km = function () {
    if (trySuspend(this))
      return get_COROUTINE_SUSPENDED();
    {
    }
    var state = unboxState(this.bl());
    if (state instanceof CompletedExceptionally)
      throw state.qk_1;
    return (state == null ? true : isObject(state)) ? state : THROW_CCE();
  };
  DispatchedCoroutine.$metadata$ = classMeta('DispatchedCoroutine', undefined, undefined, undefined, undefined, ScopeCoroutine.prototype);
  function get_UNDECIDED() {
    return UNDECIDED;
  }
  var UNDECIDED;
  function get_SUSPENDED() {
    return SUSPENDED;
  }
  var SUSPENDED;
  function get_RESUMED() {
    return RESUMED;
  }
  var RESUMED;
  function startCoroutineImpl(start, receiver, completion, onCancellation, block) {
    var tmp0_subject = start;
    var tmp0 = tmp0_subject.lh();
    var tmp;
    switch (tmp0) {
      case 0:
        tmp = startCoroutineCancellable(block, receiver, completion, onCancellation);
        break;
      case 2:
        tmp = startCoroutine(block, receiver, completion);
        break;
      case 3:
        tmp = startCoroutineUndispatched(block, receiver, completion);
        break;
      case 1:
        tmp = Unit_getInstance();
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    return tmp;
  }
  function CancellableContinuation() {
  }
  CancellableContinuation.$metadata$ = interfaceMeta('CancellableContinuation', [Continuation]);
  function disposeOnCancellation(_this__u8e3s4, handle) {
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new DisposeOnCancel(handle);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return _this__u8e3s4.co(tmp$ret$1);
  }
  function DisposeOnCancel(handle) {
    CancelHandler.call(this);
    this.fo_1 = handle;
  }
  DisposeOnCancel.prototype.go = function (cause) {
    return this.fo_1.ho();
  };
  DisposeOnCancel.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  DisposeOnCancel.prototype.toString = function () {
    return 'DisposeOnCancel[' + this.fo_1 + ']';
  };
  DisposeOnCancel.$metadata$ = classMeta('DisposeOnCancel', undefined, undefined, undefined, undefined, CancelHandler.prototype);
  function removeOnCancellation(_this__u8e3s4, node) {
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new RemoveOnCancel(node);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return _this__u8e3s4.co(tmp$ret$1);
  }
  function getOrCreateCancellableContinuation(delegate) {
    var tmp;
    var tmp$ret$0;
    {
      tmp$ret$0 = true;
    }
    if (!tmp$ret$0) {
      tmp = true;
    } else {
      tmp = !(delegate instanceof DispatchedContinuation);
    }
    if (tmp) {
      var tmp$ret$1;
      {
        var tmp0_also = new CancellableContinuationImpl(delegate, get_MODE_CANCELLABLE());
        {
        }
        {
          if (delegate instanceof DispatchedContinuation)
            tmp0_also.oo();
        }
        tmp$ret$1 = tmp0_also;
      }
      return tmp$ret$1;
    }
    var tmp0_safe_receiver = delegate.vo();
    var tmp_0;
    if (tmp0_safe_receiver == null) {
      tmp_0 = null;
    } else {
      var tmp$ret$3;
      {
        {
        }
        var tmp_1;
        var tmp$ret$2;
        {
          tmp$ret$2 = tmp0_safe_receiver.wo();
        }
        if (tmp$ret$2) {
          tmp_1 = tmp0_safe_receiver;
        } else {
          tmp_1 = null;
        }
        tmp$ret$3 = tmp_1;
      }
      tmp_0 = tmp$ret$3;
    }
    var tmp1_elvis_lhs = tmp_0;
    var tmp_2;
    if (tmp1_elvis_lhs == null) {
      return new CancellableContinuationImpl(delegate, get_MODE_CANCELLABLE_REUSABLE());
    } else {
      tmp_2 = tmp1_elvis_lhs;
    }
    return tmp_2;
  }
  function RemoveOnCancel(node) {
    BeforeResumeCancelHandler.call(this);
    this.xo_1 = node;
  }
  RemoveOnCancel.prototype.go = function (cause) {
    this.xo_1.bp();
  };
  RemoveOnCancel.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  RemoveOnCancel.prototype.toString = function () {
    return 'RemoveOnCancel[' + this.xo_1 + ']';
  };
  RemoveOnCancel.$metadata$ = classMeta('RemoveOnCancel', undefined, undefined, undefined, undefined, BeforeResumeCancelHandler.prototype);
  function get_RESUME_TOKEN() {
    init_properties_CancellableContinuationImpl_kt_jcze1b();
    return RESUME_TOKEN;
  }
  var RESUME_TOKEN;
  function _set_parentHandle__bde57($this, value) {
    $this.no_1.tj_1 = value;
  }
  function _get_parentHandle__f8dcex($this) {
    return $this.no_1.tj_1;
  }
  function _get_stateDebugRepresentation__bf18u4($this) {
    var tmp0_subject = $this.bl();
    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;
    var tmp_0;
    var tmp$ret$0;
    {
      tmp$ret$0 = true;
    }
    if (tmp$ret$0) {
      tmp_0 = get_isReusableMode($this.dp());
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      var tmp_1 = $this.jo_1;
      tmp = (tmp_1 instanceof DispatchedContinuation ? tmp_1 : THROW_CCE()).ep();
    } else {
      tmp = false;
    }
    return tmp;
  }
  function cancelLater($this, cause) {
    if (!isReusable($this))
      return false;
    var tmp = $this.jo_1;
    var dispatched = tmp instanceof DispatchedContinuation ? tmp : THROW_CCE();
    return dispatched.fp(cause);
  }
  function callCancelHandler($this, handler, cause) {
    var tmp;
    try {
      tmp = invokeIt(handler, cause);
    } catch ($p) {
      var tmp_0;
      if ($p instanceof Error) {
        tmp_0 = handleCoroutineException($this.u4(), new CompletionHandlerException('Exception in invokeOnCancellation handler for ' + $this, $p));
      } else {
        throw $p;
      }
      tmp = tmp_0;
    }
    return tmp;
  }
  function trySuspend_0($this) {
    {
      var tmp0_loop = $this.lo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.uj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          switch (tmp0_subject) {
            case 0:
              if ($this.lo_1.atomicfu$compareAndSet(0, 1))
                return true;
              break;
            case 2:
              return false;
            default:
              throw IllegalStateException_init_$Create$('Already suspended');
          }
        }
      }
    }
  }
  function tryResume_0($this) {
    {
      var tmp0_loop = $this.lo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.uj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          switch (tmp0_subject) {
            case 0:
              if ($this.lo_1.atomicfu$compareAndSet(0, 2))
                return true;
              break;
            case 1:
              return false;
            default:
              throw IllegalStateException_init_$Create$('Already resumed');
          }
        }
      }
    }
  }
  function installParentHandle($this) {
    var tmp0_elvis_lhs = $this.u4().y4(Key_getInstance_3());
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return null;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var parent = tmp;
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new ChildContinuation($this);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    var handle = parent.kl(true, false, tmp$ret$1, 2, null);
    _set_parentHandle__bde57($this, handle);
    return handle;
  }
  function releaseClaimedReusableContinuation($this) {
    var tmp = $this.jo_1;
    var tmp0_safe_receiver = tmp instanceof DispatchedContinuation ? tmp : null;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.gp($this);
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      return Unit_getInstance();
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var cancellationCause = tmp_0;
    $this.hp();
    $this.ip(cancellationCause);
  }
  function multipleHandlersError($this, handler, state) {
    {
      var tmp0_error = "It's prohibited to register multiple handlers, tried to register " + handler + ', already has ' + toString(state);
      throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
    }
  }
  function makeCancelHandler($this, handler) {
    var tmp;
    if (handler instanceof CancelHandler) {
      tmp = handler;
    } else {
      tmp = new InvokeOnCancel(handler);
    }
    return tmp;
  }
  function dispatchResume($this, mode) {
    if (tryResume_0($this))
      return Unit_getInstance();
    dispatch($this, mode);
  }
  function resumedState($this, state, proposedUpdate, resumeMode, onCancellation, idempotent) {
    var tmp;
    if (proposedUpdate instanceof CompletedExceptionally) {
      {
      }
      {
      }
      tmp = proposedUpdate;
    } else {
      if (!get_isCancellableMode(resumeMode) ? idempotent == null : false) {
        tmp = proposedUpdate;
      } else {
        var tmp_0;
        var tmp_1;
        if (!(onCancellation == null)) {
          tmp_1 = true;
        } else {
          var tmp_2;
          if (state instanceof CancelHandler) {
            tmp_2 = !(state instanceof BeforeResumeCancelHandler);
          } else {
            tmp_2 = false;
          }
          tmp_1 = tmp_2;
        }
        if (tmp_1) {
          tmp_0 = true;
        } else {
          tmp_0 = !(idempotent == null);
        }
        if (tmp_0) {
          var tmp_3 = state instanceof CancelHandler ? state : null;
          tmp = CompletedContinuation_init_$Create$(proposedUpdate, tmp_3, onCancellation, idempotent, null, 16, null);
        } else {
          tmp = proposedUpdate;
        }
      }
    }
    return tmp;
  }
  function resumeImpl($this, proposedUpdate, resumeMode, onCancellation) {
    {
      var tmp0_loop = $this.mo_1;
      while (true) {
        var tmp$ret$0;
        $l$block: {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          if (!(tmp0_subject == null) ? isInterface(tmp0_subject, NotCompleted) : false) {
            var update = resumedState($this, tmp1__anonymous__uwfjfc, proposedUpdate, resumeMode, onCancellation, null);
            if (!$this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update)) {
              tmp$ret$0 = Unit_getInstance();
              break $l$block;
            }
            detachChildIfNonResuable($this);
            dispatchResume($this, resumeMode);
            return Unit_getInstance();
          } else {
            if (tmp0_subject instanceof CancelledContinuation) {
              if (tmp1__anonymous__uwfjfc.np()) {
                var tmp1_safe_receiver = onCancellation;
                if (tmp1_safe_receiver == null)
                  null;
                else {
                  var tmp$ret$1;
                  {
                    {
                    }
                    tmp$ret$1 = $this.jp(tmp1_safe_receiver, tmp1__anonymous__uwfjfc.p1());
                  }
                }
                return Unit_getInstance();
              }
            }
          }
          alreadyResumedError($this, proposedUpdate);
        }
      }
    }
  }
  function resumeImpl$default($this, proposedUpdate, resumeMode, onCancellation, $mask0, $handler) {
    if (!(($mask0 & 8) === 0))
      onCancellation = null;
    return resumeImpl($this, proposedUpdate, resumeMode, onCancellation);
  }
  function tryResumeImpl($this, proposedUpdate, idempotent, onCancellation) {
    {
      var tmp0_loop = $this.mo_1;
      while (true) {
        var tmp$ret$0;
        $l$block: {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          if (!(tmp0_subject == null) ? isInterface(tmp0_subject, NotCompleted) : false) {
            var update = resumedState($this, tmp1__anonymous__uwfjfc, proposedUpdate, $this.dp(), onCancellation, idempotent);
            if (!$this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update)) {
              tmp$ret$0 = Unit_getInstance();
              break $l$block;
            }
            detachChildIfNonResuable($this);
            return get_RESUME_TOKEN();
          } else {
            if (tmp0_subject instanceof CompletedContinuation) {
              var tmp;
              if (!(idempotent == null) ? tmp1__anonymous__uwfjfc.pp_1 === idempotent : false) {
                {
                }
                tmp = get_RESUME_TOKEN();
              } else {
                tmp = null;
              }
              return tmp;
            } else {
              return null;
            }
          }
        }
      }
    }
  }
  function alreadyResumedError($this, proposedUpdate) {
    {
      var tmp0_error = 'Already resumed, but proposed with update ' + toString(proposedUpdate);
      throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
    }
  }
  function detachChildIfNonResuable($this) {
    if (!isReusable($this))
      $this.hp();
  }
  function CancellableContinuationImpl(delegate, resumeMode) {
    DispatchedTask.call(this, resumeMode);
    {
    }
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = delegate;
    }
    tmp.jo_1 = tmp$ret$0;
    this.ko_1 = delegate.u4();
    this.lo_1 = atomic$int$1(0);
    this.mo_1 = atomic$ref$1(Active_getInstance());
    this.no_1 = atomic$ref$1(null);
  }
  CancellableContinuationImpl.prototype.tp = function () {
    return this.jo_1;
  };
  CancellableContinuationImpl.prototype.u4 = function () {
    return this.ko_1;
  };
  CancellableContinuationImpl.prototype.bl = function () {
    return this.mo_1.tj_1;
  };
  CancellableContinuationImpl.prototype.cl = function () {
    var tmp = this.bl();
    return !(!(tmp == null) ? isInterface(tmp, NotCompleted) : false);
  };
  CancellableContinuationImpl.prototype.wn = function () {
    var tmp = this.bl();
    return tmp instanceof CancelledContinuation;
  };
  CancellableContinuationImpl.prototype.oo = function () {
    var tmp0_elvis_lhs = installParentHandle(this);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return Unit_getInstance();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var handle = tmp;
    if (this.cl()) {
      handle.ho();
      _set_parentHandle__bde57(this, NonDisposableHandle_getInstance());
    }
  };
  CancellableContinuationImpl.prototype.wo = function () {
    {
    }
    {
    }
    var state = this.mo_1.tj_1;
    {
    }
    var tmp;
    if (state instanceof CompletedContinuation) {
      tmp = !(state.pp_1 == null);
    } else {
      tmp = false;
    }
    if (tmp) {
      this.hp();
      return false;
    }
    this.lo_1.uj_1 = 0;
    this.mo_1.tj_1 = Active_getInstance();
    return true;
  };
  CancellableContinuationImpl.prototype.up = function () {
    return this.bl();
  };
  CancellableContinuationImpl.prototype.vp = function (takenState, cause) {
    var tmp0_loop = this.mo_1;
    while (true) {
      {
        var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
        var tmp0_subject = tmp1__anonymous__uwfjfc;
        if (!(tmp0_subject == null) ? isInterface(tmp0_subject, NotCompleted) : false) {
          throw IllegalStateException_init_$Create$('Not completed');
        } else {
          if (tmp0_subject instanceof CompletedExceptionally)
            return Unit_getInstance();
          else {
            if (tmp0_subject instanceof CompletedContinuation) {
              {
                var tmp0_check = !tmp1__anonymous__uwfjfc.wp();
                {
                }
                if (!tmp0_check) {
                  var tmp$ret$0;
                  {
                    tmp$ret$0 = 'Must be called at most once';
                  }
                  var message = tmp$ret$0;
                  throw IllegalStateException_init_$Create$(toString_0(message));
                }
              }
              var update = tmp1__anonymous__uwfjfc.xp(null, null, null, null, cause, 15, null);
              if (this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update)) {
                tmp1__anonymous__uwfjfc.yp(this, cause);
                return Unit_getInstance();
              }
            } else {
              if (this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, CompletedContinuation_init_$Create$(tmp1__anonymous__uwfjfc, null, null, null, cause, 14, null))) {
                return Unit_getInstance();
              }
            }
          }
        }
      }
    }
    return Unit_getInstance();
  };
  CancellableContinuationImpl.prototype.ip = function (cause) {
    {
      var tmp0_loop = this.mo_1;
      while (true) {
        var tmp$ret$0;
        $l$block: {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (!(!(tmp1__anonymous__uwfjfc == null) ? isInterface(tmp1__anonymous__uwfjfc, NotCompleted) : false))
            return false;
          var update = new CancelledContinuation(this, cause, tmp1__anonymous__uwfjfc instanceof CancelHandler);
          if (!this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update)) {
            tmp$ret$0 = Unit_getInstance();
            break $l$block;
          }
          var tmp0_safe_receiver = tmp1__anonymous__uwfjfc instanceof CancelHandler ? tmp1__anonymous__uwfjfc : null;
          if (tmp0_safe_receiver == null)
            null;
          else {
            var tmp$ret$1;
            {
              {
              }
              tmp$ret$1 = this.zp(tmp0_safe_receiver, cause);
            }
          }
          detachChildIfNonResuable(this);
          dispatchResume(this, this.dp());
          return true;
        }
      }
    }
  };
  CancellableContinuationImpl.prototype.aq = function (parentJob) {
    var cause = this.bq(parentJob);
    if (cancelLater(this, cause))
      return Unit_getInstance();
    this.ip(cause);
    detachChildIfNonResuable(this);
  };
  CancellableContinuationImpl.prototype.zp = function (handler, cause) {
    var tmp;
    try {
      tmp = handler.invoke(cause);
    } catch ($p) {
      var tmp_0;
      if ($p instanceof Error) {
        tmp_0 = handleCoroutineException(this.u4(), new CompletionHandlerException('Exception in invokeOnCancellation handler for ' + this, $p));
      } else {
        throw $p;
      }
      tmp = tmp_0;
    }
    return tmp;
  };
  CancellableContinuationImpl.prototype.jp = function (onCancellation, cause) {
    try {
      onCancellation(cause);
    } catch ($p) {
      if ($p instanceof Error) {
        handleCoroutineException(this.u4(), new CompletionHandlerException('Exception in resume onCancellation handler for ' + this, $p));
      } else {
        throw $p;
      }
    }
  };
  CancellableContinuationImpl.prototype.bq = function (parent) {
    return parent.fl();
  };
  CancellableContinuationImpl.prototype.km = function () {
    var isReusable_0 = isReusable(this);
    if (trySuspend_0(this)) {
      if (_get_parentHandle__f8dcex(this) == null) {
        installParentHandle(this);
      }
      if (isReusable_0) {
        releaseClaimedReusableContinuation(this);
      }
      return get_COROUTINE_SUSPENDED();
    }
    {
    }
    if (isReusable_0) {
      releaseClaimedReusableContinuation(this);
    }
    var state = this.bl();
    if (state instanceof CompletedExceptionally)
      throw recoverStackTrace(state.qk_1, this);
    if (get_isCancellableMode(this.dp())) {
      var job = this.u4().y4(Key_getInstance_3());
      if (!(job == null) ? !job.lk() : false) {
        var cause = job.fl();
        this.vp(state, cause);
        throw recoverStackTrace(cause, this);
      }
    }
    return this.cq(state);
  };
  CancellableContinuationImpl.prototype.v4 = function (result) {
    var tmp = toState(result, this);
    var tmp_0 = this.dp();
    return resumeImpl$default(this, tmp, tmp_0, null, 8, null);
  };
  CancellableContinuationImpl.prototype.eo = function (value, onCancellation) {
    return resumeImpl(this, value, this.dp(), onCancellation);
  };
  CancellableContinuationImpl.prototype.co = function (handler) {
    var cancelHandler = makeCancelHandler(this, handler);
    {
      var tmp0_loop = this.mo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          if (tmp0_subject instanceof Active) {
            if (this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, cancelHandler))
              return Unit_getInstance();
          } else {
            if (tmp0_subject instanceof CancelHandler)
              multipleHandlersError(this, handler, tmp1__anonymous__uwfjfc);
            else {
              if (tmp0_subject instanceof CompletedExceptionally) {
                if (!tmp1__anonymous__uwfjfc.eq())
                  multipleHandlersError(this, handler, tmp1__anonymous__uwfjfc);
                if (tmp1__anonymous__uwfjfc instanceof CancelledContinuation) {
                  var tmp1_safe_receiver = tmp1__anonymous__uwfjfc instanceof CompletedExceptionally ? tmp1__anonymous__uwfjfc : null;
                  callCancelHandler(this, handler, tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qk_1);
                }
                return Unit_getInstance();
              } else {
                if (tmp0_subject instanceof CompletedContinuation) {
                  if (!(tmp1__anonymous__uwfjfc.dq() == null))
                    multipleHandlersError(this, handler, tmp1__anonymous__uwfjfc);
                  if (cancelHandler instanceof BeforeResumeCancelHandler)
                    return Unit_getInstance();
                  if (tmp1__anonymous__uwfjfc.wp()) {
                    callCancelHandler(this, handler, tmp1__anonymous__uwfjfc.qp_1);
                    return Unit_getInstance();
                  }
                  var update = tmp1__anonymous__uwfjfc.xp(null, cancelHandler, null, null, null, 29, null);
                  if (this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update))
                    return Unit_getInstance();
                } else {
                  if (cancelHandler instanceof BeforeResumeCancelHandler)
                    return Unit_getInstance();
                  var update_0 = CompletedContinuation_init_$Create$(tmp1__anonymous__uwfjfc, cancelHandler, null, null, null, 28, null);
                  if (this.mo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, update_0))
                    return Unit_getInstance();
                }
              }
            }
          }
        }
      }
    }
  };
  CancellableContinuationImpl.prototype.hp = function () {
    var tmp0_elvis_lhs = _get_parentHandle__f8dcex(this);
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return Unit_getInstance();
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var handle = tmp;
    handle.ho();
    _set_parentHandle__bde57(this, NonDisposableHandle_getInstance());
  };
  CancellableContinuationImpl.prototype.xn = function (value, idempotent) {
    return tryResumeImpl(this, value, idempotent, null);
  };
  CancellableContinuationImpl.prototype.zn = function (value, idempotent, onCancellation) {
    return tryResumeImpl(this, value, idempotent, onCancellation);
  };
  CancellableContinuationImpl.prototype.ao = function (exception) {
    return tryResumeImpl(this, CompletedExceptionally_init_$Create$(exception, false, 2, null), null, null);
  };
  CancellableContinuationImpl.prototype.bo = function (token) {
    {
    }
    dispatchResume(this, this.dp());
  };
  CancellableContinuationImpl.prototype.do = function (_this__u8e3s4, value) {
    var tmp = asLocalOrNullIfNotUsed(this.jo_1);
    var dc = tmp instanceof DispatchedContinuation ? tmp : null;
    var tmp_0;
    var tmp0_safe_receiver = dc;
    if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qo_1) === _this__u8e3s4) {
      tmp_0 = get_MODE_UNDISPATCHED();
    } else {
      tmp_0 = this.dp();
    }
    var tmp_1 = tmp_0;
    resumeImpl$default(this, value, tmp_1, null, 8, null);
  };
  CancellableContinuationImpl.prototype.cq = function (state) {
    var tmp0_subject = state;
    var tmp;
    if (tmp0_subject instanceof CompletedContinuation) {
      state.fq();
      var tmp_0 = state.op_1;
      tmp = (tmp_0 == null ? true : isObject(tmp_0)) ? tmp_0 : THROW_CCE();
    } else {
      tmp = (state == null ? true : isObject(state)) ? state : THROW_CCE();
    }
    return tmp;
  };
  CancellableContinuationImpl.prototype.gq = function (state) {
    var tmp0_safe_receiver = DispatchedTask.prototype.gq.call(this, state);
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp$ret$1;
      {
        {
        }
        var tmp$ret$0;
        {
          tmp$ret$0 = recoverStackTrace(tmp0_safe_receiver, this.jo_1);
        }
        tmp$ret$1 = tmp$ret$0;
      }
      tmp = tmp$ret$1;
    }
    return tmp;
  };
  CancellableContinuationImpl.prototype.toString = function () {
    return this.xk() + '(' + toDebugString(this.jo_1) + '){' + _get_stateDebugRepresentation__bf18u4(this) + '}@' + get_hexAddress(this);
  };
  CancellableContinuationImpl.prototype.xk = function () {
    return 'CancellableContinuation';
  };
  CancellableContinuationImpl.$metadata$ = classMeta('CancellableContinuationImpl', [CancellableContinuation, CoroutineStackFrame], undefined, undefined, undefined, DispatchedTask.prototype);
  function CancelHandler() {
    CancelHandlerBase.call(this);
  }
  CancelHandler.$metadata$ = classMeta('CancelHandler', [NotCompleted], undefined, undefined, undefined, CancelHandlerBase.prototype);
  function get_UNDECIDED_0() {
    return UNDECIDED_0;
  }
  var UNDECIDED_0;
  function Active() {
    Active_instance = this;
  }
  Active.prototype.toString = function () {
    return 'Active';
  };
  Active.$metadata$ = objectMeta('Active', [NotCompleted]);
  var Active_instance;
  function Active_getInstance() {
    if (Active_instance == null)
      new Active();
    return Active_instance;
  }
  function NotCompleted() {
  }
  NotCompleted.$metadata$ = interfaceMeta('NotCompleted');
  function CompletedContinuation_init_$Init$(result, cancelHandler, onCancellation, idempotentResume, cancelCause, $mask0, $marker, $this) {
    if (!(($mask0 & 2) === 0))
      cancelHandler = null;
    if (!(($mask0 & 4) === 0))
      onCancellation = null;
    if (!(($mask0 & 8) === 0))
      idempotentResume = null;
    if (!(($mask0 & 16) === 0))
      cancelCause = null;
    CompletedContinuation.call($this, result, cancelHandler, onCancellation, idempotentResume, cancelCause);
    return $this;
  }
  function CompletedContinuation_init_$Create$(result, cancelHandler, onCancellation, idempotentResume, cancelCause, $mask0, $marker) {
    return CompletedContinuation_init_$Init$(result, cancelHandler, onCancellation, idempotentResume, cancelCause, $mask0, $marker, Object.create(CompletedContinuation.prototype));
  }
  function CompletedContinuation(result, cancelHandler, onCancellation, idempotentResume, cancelCause) {
    this.op_1 = result;
    this.pp_1 = idempotentResume;
    this.qp_1 = cancelCause;
    this.rp_1 = atomic$ref$1(cancelHandler);
    this.sp_1 = atomic$ref$1(onCancellation);
  }
  CompletedContinuation.prototype.jq = function () {
    return this.pp_1;
  };
  CompletedContinuation.prototype.kq = function () {
    return this.qp_1;
  };
  CompletedContinuation.prototype.dq = function () {
    return this.rp_1.tj_1;
  };
  CompletedContinuation.prototype.lq = function () {
    return this.sp_1.tj_1;
  };
  CompletedContinuation.prototype.wp = function () {
    return !(this.qp_1 == null);
  };
  CompletedContinuation.prototype.fq = function () {
    this.rp_1.tj_1 = null;
    this.sp_1.tj_1 = null;
  };
  CompletedContinuation.prototype.yp = function (cont, cause) {
    var tmp0_safe_receiver = this.dq();
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$0;
      {
        {
        }
        tmp$ret$0 = cont.zp(tmp0_safe_receiver, cause);
      }
    }
    var tmp1_safe_receiver = this.lq();
    if (tmp1_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        tmp$ret$1 = cont.jp(tmp1_safe_receiver, cause);
      }
    }
    this.fq();
  };
  CompletedContinuation.prototype.mq = function (result, cancelHandler, onCancellation, idempotentResume, cancelCause) {
    return new CompletedContinuation(result, cancelHandler, onCancellation, idempotentResume, cancelCause);
  };
  CompletedContinuation.prototype.xp = function (result, cancelHandler, onCancellation, idempotentResume, cancelCause, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      result = this.op_1;
    if (!(($mask0 & 2) === 0))
      cancelHandler = this.dq();
    if (!(($mask0 & 4) === 0))
      onCancellation = this.lq();
    if (!(($mask0 & 8) === 0))
      idempotentResume = this.pp_1;
    if (!(($mask0 & 16) === 0))
      cancelCause = this.qp_1;
    return this.mq(result, cancelHandler, onCancellation, idempotentResume, cancelCause);
  };
  CompletedContinuation.$metadata$ = classMeta('CompletedContinuation');
  function get_SUSPENDED_0() {
    return SUSPENDED_0;
  }
  var SUSPENDED_0;
  function get_RESUMED_0() {
    return RESUMED_0;
  }
  var RESUMED_0;
  function BeforeResumeCancelHandler() {
    CancelHandler.call(this);
  }
  BeforeResumeCancelHandler.$metadata$ = classMeta('BeforeResumeCancelHandler', undefined, undefined, undefined, undefined, CancelHandler.prototype);
  function InvokeOnCancel(handler) {
    CancelHandler.call(this);
    this.nq_1 = handler;
  }
  InvokeOnCancel.prototype.go = function (cause) {
    this.nq_1(cause);
  };
  InvokeOnCancel.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  InvokeOnCancel.prototype.toString = function () {
    return 'InvokeOnCancel[' + get_classSimpleName(this.nq_1) + '@' + get_hexAddress(this) + ']';
  };
  InvokeOnCancel.$metadata$ = classMeta('InvokeOnCancel', undefined, undefined, undefined, undefined, CancelHandler.prototype);
  var properties_initialized_CancellableContinuationImpl_kt_xtzb03;
  function init_properties_CancellableContinuationImpl_kt_jcze1b() {
    if (properties_initialized_CancellableContinuationImpl_kt_xtzb03) {
    } else {
      properties_initialized_CancellableContinuationImpl_kt_xtzb03 = true;
      RESUME_TOKEN = new Symbol('RESUME_TOKEN');
    }
  }
  function CompletableDeferred() {
  }
  CompletableDeferred.$metadata$ = interfaceMeta('CompletableDeferred', [Deferred]);
  function CompletableDeferred_0(parent) {
    return new CompletableDeferredImpl(parent);
  }
  function CompletableDeferred$default(parent, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      parent = null;
    return CompletableDeferred_0(parent);
  }
  function $awaitCOROUTINE$1(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.yq_1 = _this__u8e3s4;
  }
  $awaitCOROUTINE$1.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 2;
            this.ii_1 = 1;
            suspendResult = this.yq_1.dn(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return (suspendResult == null ? true : isObject(suspendResult)) ? suspendResult : THROW_CCE();
          case 2:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 2) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $awaitCOROUTINE$1.$metadata$ = classMeta('$awaitCOROUTINE$1', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function CompletableDeferredImpl(parent) {
    JobSupport.call(this, true);
    this.ik(parent);
  }
  CompletableDeferredImpl.prototype.ml = function () {
    return true;
  };
  CompletableDeferredImpl.prototype.in = function ($cont) {
    var tmp = new $awaitCOROUTINE$1(this, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  CompletableDeferredImpl.prototype.oq = function (value) {
    return this.br(value);
  };
  CompletableDeferredImpl.prototype.pq = function (exception) {
    return this.br(CompletedExceptionally_init_$Create$(exception, false, 2, null));
  };
  CompletableDeferredImpl.$metadata$ = classMeta('CompletableDeferredImpl', [CompletableDeferred, SelectClause1], undefined, undefined, undefined, JobSupport.prototype);
  function CompletableJob() {
  }
  CompletableJob.$metadata$ = interfaceMeta('CompletableJob', [Job]);
  function CompletedExceptionally_init_$Init$(cause, handled, $mask0, $marker, $this) {
    if (!(($mask0 & 2) === 0))
      handled = false;
    CompletedExceptionally.call($this, cause, handled);
    return $this;
  }
  function CompletedExceptionally_init_$Create$(cause, handled, $mask0, $marker) {
    return CompletedExceptionally_init_$Init$(cause, handled, $mask0, $marker, Object.create(CompletedExceptionally.prototype));
  }
  function CompletedExceptionally(cause, handled) {
    this.qk_1 = cause;
    this.rk_1 = atomic$boolean$1(handled);
  }
  CompletedExceptionally.prototype.p1 = function () {
    return this.qk_1;
  };
  CompletedExceptionally.prototype.sk = function () {
    return this.rk_1.zj_1;
  };
  CompletedExceptionally.prototype.eq = function () {
    return this.rk_1.atomicfu$compareAndSet(false, true);
  };
  CompletedExceptionally.prototype.toString = function () {
    return get_classSimpleName(this) + '[' + this.qk_1 + ']';
  };
  CompletedExceptionally.$metadata$ = classMeta('CompletedExceptionally');
  function CancelledContinuation(continuation, cause, handled) {
    var tmp0_elvis_lhs = cause;
    CompletedExceptionally.call(this, tmp0_elvis_lhs == null ? CancellationException_init_$Create$('Continuation ' + continuation + ' was cancelled normally') : tmp0_elvis_lhs, handled);
    this.mp_1 = atomic$boolean$1(false);
  }
  CancelledContinuation.prototype.np = function () {
    return this.mp_1.atomicfu$compareAndSet(false, true);
  };
  CancelledContinuation.$metadata$ = classMeta('CancelledContinuation', undefined, undefined, undefined, undefined, CompletedExceptionally.prototype);
  function toState(_this__u8e3s4, caller) {
    var tmp$ret$2;
    {
      {
      }
      var exception = Result__exceptionOrNull_impl_p6xea9(_this__u8e3s4);
      var tmp;
      if (exception == null) {
        var tmp$ret$0;
        {
          var tmp_0 = _Result___get_value__impl__bjfvqg(_this__u8e3s4);
          var tmp0__anonymous__q1qw7t = (tmp_0 == null ? true : isObject(tmp_0)) ? tmp_0 : THROW_CCE();
          tmp$ret$0 = tmp0__anonymous__q1qw7t;
        }
        tmp = tmp$ret$0;
      } else {
        var tmp$ret$1;
        {
          var tmp_1 = recoverStackTrace(exception, caller);
          tmp$ret$1 = CompletedExceptionally_init_$Create$(tmp_1, false, 2, null);
        }
        tmp = tmp$ret$1;
      }
      tmp$ret$2 = tmp;
    }
    return tmp$ret$2;
  }
  function toState_0(_this__u8e3s4, onCancellation) {
    var tmp$ret$2;
    {
      {
      }
      var exception = Result__exceptionOrNull_impl_p6xea9(_this__u8e3s4);
      var tmp;
      if (exception == null) {
        var tmp$ret$0;
        {
          var tmp_0 = _Result___get_value__impl__bjfvqg(_this__u8e3s4);
          var tmp0__anonymous__q1qw7t = (tmp_0 == null ? true : isObject(tmp_0)) ? tmp_0 : THROW_CCE();
          tmp$ret$0 = !(onCancellation == null) ? new CompletedWithCancellation(tmp0__anonymous__q1qw7t, onCancellation) : tmp0__anonymous__q1qw7t;
        }
        tmp = tmp$ret$0;
      } else {
        var tmp$ret$1;
        {
          tmp$ret$1 = CompletedExceptionally_init_$Create$(exception, false, 2, null);
        }
        tmp = tmp$ret$1;
      }
      tmp$ret$2 = tmp;
    }
    return tmp$ret$2;
  }
  function toState$default(_this__u8e3s4, onCancellation, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      onCancellation = null;
    return toState_0(_this__u8e3s4, onCancellation);
  }
  function CompletedWithCancellation(result, onCancellation) {
    this.er_1 = result;
    this.fr_1 = onCancellation;
  }
  CompletedWithCancellation.prototype.toString = function () {
    return 'CompletedWithCancellation(result=' + toString(this.er_1) + ', onCancellation=' + this.fr_1 + ')';
  };
  CompletedWithCancellation.prototype.hashCode = function () {
    var result = this.er_1 == null ? 0 : hashCode(this.er_1);
    result = imul(result, 31) + hashCode(this.fr_1) | 0;
    return result;
  };
  CompletedWithCancellation.prototype.equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof CompletedWithCancellation))
      return false;
    var tmp0_other_with_cast = other instanceof CompletedWithCancellation ? other : THROW_CCE();
    if (!equals(this.er_1, tmp0_other_with_cast.er_1))
      return false;
    if (!equals(this.fr_1, tmp0_other_with_cast.fr_1))
      return false;
    return true;
  };
  CompletedWithCancellation.$metadata$ = classMeta('CompletedWithCancellation');
  function recoverResult(state, uCont) {
    var tmp;
    if (state instanceof CompletedExceptionally) {
      var tmp$ret$0;
      {
        var tmp0_failure = Companion_getInstance();
        var tmp1_failure = recoverStackTrace(state.qk_1, uCont);
        tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(tmp1_failure));
      }
      tmp = tmp$ret$0;
    } else {
      var tmp$ret$1;
      {
        var tmp2_success = Companion_getInstance();
        var tmp3_success = (state == null ? true : isObject(state)) ? state : THROW_CCE();
        tmp$ret$1 = _Result___init__impl__xyqfz8(tmp3_success);
      }
      tmp = tmp$ret$1;
    }
    return tmp;
  }
  function CoroutineDispatcher$Key$_init_$lambda_akl8b5() {
    return function (it) {
      return it instanceof CoroutineDispatcher ? it : null;
    };
  }
  function Key_0() {
    Key_instance = this;
    var tmp = Key_getInstance();
    AbstractCoroutineContextKey.call(this, tmp, CoroutineDispatcher$Key$_init_$lambda_akl8b5());
  }
  Key_0.$metadata$ = objectMeta('Key', undefined, undefined, undefined, undefined, AbstractCoroutineContextKey.prototype);
  var Key_instance;
  function Key_getInstance_0() {
    if (Key_instance == null)
      new Key_0();
    return Key_instance;
  }
  function CoroutineDispatcher() {
    Key_getInstance_0();
    AbstractCoroutineContextElement.call(this, Key_getInstance());
  }
  CoroutineDispatcher.prototype.hr = function (context) {
    return true;
  };
  CoroutineDispatcher.prototype.w4 = function (continuation) {
    return new DispatchedContinuation(this, continuation);
  };
  CoroutineDispatcher.prototype.x4 = function (continuation) {
    var dispatched = continuation instanceof DispatchedContinuation ? continuation : THROW_CCE();
    dispatched.jr();
  };
  CoroutineDispatcher.prototype.toString = function () {
    return get_classSimpleName(this) + '@' + get_hexAddress(this);
  };
  CoroutineDispatcher.$metadata$ = classMeta('CoroutineDispatcher', [ContinuationInterceptor], undefined, undefined, undefined, AbstractCoroutineContextElement.prototype);
  function handleCoroutineException(context, exception) {
    try {
      var tmp0_safe_receiver = context.y4(Key_getInstance_1());
      if (tmp0_safe_receiver == null)
        null;
      else {
        var tmp$ret$0;
        {
          {
          }
          tmp0_safe_receiver.kr(context, exception);
          return Unit_getInstance();
        }
      }
    } catch ($p) {
      if ($p instanceof Error) {
        handleCoroutineExceptionImpl(context, handlerException(exception, $p));
        return Unit_getInstance();
      } else {
        throw $p;
      }
    }
    handleCoroutineExceptionImpl(context, exception);
  }
  function Key_1() {
    Key_instance_0 = this;
  }
  Key_1.$metadata$ = objectMeta('Key', [Key]);
  var Key_instance_0;
  function Key_getInstance_1() {
    if (Key_instance_0 == null)
      new Key_1();
    return Key_instance_0;
  }
  function CoroutineExceptionHandler() {
  }
  CoroutineExceptionHandler.$metadata$ = interfaceMeta('CoroutineExceptionHandler', [Element]);
  function handlerException(originalException, thrownException) {
    if (originalException === thrownException)
      return originalException;
    var tmp$ret$0;
    {
      var tmp0_apply = RuntimeException_init_$Create$('Exception while trying to handle coroutine exception', thrownException);
      {
      }
      {
        {
        }
      }
      tmp$ret$0 = tmp0_apply;
    }
    return tmp$ret$0;
  }
  function CoroutineExceptionHandler_0(handler) {
    return new _no_name_provided__qut3iv(handler);
  }
  function _no_name_provided__qut3iv($handler) {
    this.mr_1 = $handler;
    AbstractCoroutineContextElement.call(this, Key_getInstance_1());
  }
  _no_name_provided__qut3iv.prototype.kr = function (context, exception) {
    return this.mr_1(context, exception);
  };
  _no_name_provided__qut3iv.$metadata$ = classMeta(undefined, [CoroutineExceptionHandler], undefined, undefined, undefined, AbstractCoroutineContextElement.prototype);
  function Key_2() {
    Key_instance_1 = this;
  }
  Key_2.$metadata$ = objectMeta('Key', [Key]);
  var Key_instance_1;
  function Key_getInstance_2() {
    if (Key_instance_1 == null)
      new Key_2();
    return Key_instance_1;
  }
  function CoroutineName(name) {
    Key_getInstance_2();
    AbstractCoroutineContextElement.call(this, Key_getInstance_2());
    this.or_1 = name;
  }
  CoroutineName.prototype.toString = function () {
    return 'CoroutineName(' + this.or_1 + ')';
  };
  CoroutineName.prototype.hashCode = function () {
    return getStringHashCode(this.or_1);
  };
  CoroutineName.prototype.equals = function (other) {
    if (this === other)
      return true;
    if (!(other instanceof CoroutineName))
      return false;
    var tmp0_other_with_cast = other instanceof CoroutineName ? other : THROW_CCE();
    if (!(this.or_1 === tmp0_other_with_cast.or_1))
      return false;
    return true;
  };
  CoroutineName.$metadata$ = classMeta('CoroutineName', undefined, undefined, undefined, undefined, AbstractCoroutineContextElement.prototype);
  function CoroutineScope() {
  }
  CoroutineScope.$metadata$ = interfaceMeta('CoroutineScope');
  function cancel(_this__u8e3s4, cause) {
    var tmp0_elvis_lhs = _this__u8e3s4.kk().y4(Key_getInstance_3());
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp0_error = 'Scope cannot be cancelled because it does not have a job: ' + _this__u8e3s4;
      throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var job = tmp;
    job.nl(cause);
  }
  function cancel$default_1(_this__u8e3s4, cause, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      cause = null;
    return cancel(_this__u8e3s4, cause);
  }
  function cancel_0(_this__u8e3s4, message, cause) {
    return cancel(_this__u8e3s4, CancellationException_init_$Create$_0(message, cause));
  }
  function GlobalScope() {
    GlobalScope_instance = this;
  }
  GlobalScope.prototype.kk = function () {
    return EmptyCoroutineContext_getInstance();
  };
  GlobalScope.$metadata$ = objectMeta('GlobalScope', [CoroutineScope]);
  var GlobalScope_instance;
  function GlobalScope_getInstance() {
    if (GlobalScope_instance == null)
      new GlobalScope();
    return GlobalScope_instance;
  }
  function CoroutineScope_0(context) {
    var tmp;
    if (!(context.y4(Key_getInstance_3()) == null)) {
      tmp = context;
    } else {
      tmp = context.f5(Job$default(null, 1, null));
    }
    return new ContextScope(tmp);
  }
  function get_isActive(_this__u8e3s4) {
    var tmp0_safe_receiver = _this__u8e3s4.kk().y4(Key_getInstance_3());
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.lk();
    return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs;
  }
  function coroutineScope(block, $cont) {
    {
    }
    var tmp$ret$0;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var coroutine = new ScopeCoroutine(tmp0__anonymous__q1qw7t.u4(), tmp0__anonymous__q1qw7t, true);
      tmp$ret$0 = startUndispatchedOrReturn(coroutine, coroutine, block);
    }
    return tmp$ret$0;
  }
  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_getInstance();
    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);
  }
  CoroutineStart.prototype.dm = function () {
    return this === CoroutineStart_LAZY_getInstance();
  };
  CoroutineStart.$metadata$ = classMeta('CoroutineStart', undefined, undefined, undefined, undefined, Enum.prototype);
  function CoroutineStart_DEFAULT_getInstance() {
    CoroutineStart_initEntries();
    return CoroutineStart_DEFAULT_instance;
  }
  function CoroutineStart_LAZY_getInstance() {
    CoroutineStart_initEntries();
    return CoroutineStart_LAZY_instance;
  }
  function CoroutineStart_ATOMIC_getInstance() {
    CoroutineStart_initEntries();
    return CoroutineStart_ATOMIC_instance;
  }
  function CopyableThrowable() {
  }
  CopyableThrowable.$metadata$ = interfaceMeta('CopyableThrowable');
  function Deferred() {
  }
  Deferred.$metadata$ = interfaceMeta('Deferred', [Job]);
  function Delay() {
  }
  Delay.$metadata$ = interfaceMeta('Delay');
  function delay(timeMillis, $cont) {
    if (timeMillis.g1(new Long(0, 0)) <= 0)
      return Unit_getInstance();
    var tmp$ret$0;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = new CancellableContinuationImpl(intercepted(tmp0__anonymous__q1qw7t), get_MODE_CANCELLABLE());
      cancellable.oo();
      {
        Companion_getInstance_0();
        if (timeMillis.g1(new Long(-1, 2147483647)) < 0) {
          get_delay(cancellable.u4()).pr(timeMillis, cancellable);
        }
      }
      tmp$ret$0 = cancellable.km();
    }
    return tmp$ret$0;
  }
  function get_delay(_this__u8e3s4) {
    var tmp = _this__u8e3s4.y4(Key_getInstance());
    var tmp0_elvis_lhs = (!(tmp == null) ? isInterface(tmp, Delay) : false) ? tmp : null;
    return tmp0_elvis_lhs == null ? get_DefaultDelay() : tmp0_elvis_lhs;
  }
  function delta($this, unconfined) {
    return unconfined ? new Long(0, 1) : new Long(1, 0);
  }
  function EventLoop() {
    CoroutineDispatcher.call(this);
    this.rr_1 = new Long(0, 0);
    this.sr_1 = false;
    this.tr_1 = null;
  }
  EventLoop.prototype.ur = function () {
    var tmp0_elvis_lhs = this.tr_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      return false;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var queue = tmp;
    var tmp1_elvis_lhs = queue.yr();
    var tmp_0;
    if (tmp1_elvis_lhs == null) {
      return false;
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var task = tmp_0;
    var tmp$ret$0;
    {
      tmp$ret$0 = task.hq();
    }
    return true;
  };
  EventLoop.prototype.zr = function (task) {
    var tmp0_elvis_lhs = this.tr_1;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$0;
      {
        var tmp0_also = new ArrayQueue();
        {
        }
        {
          this.tr_1 = tmp0_also;
        }
        tmp$ret$0 = tmp0_also;
      }
      tmp = tmp$ret$0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var queue = tmp;
    queue.as(task);
  };
  EventLoop.prototype.bs = function () {
    return this.rr_1.g1(delta(this, true)) >= 0;
  };
  EventLoop.prototype.cs = function () {
    var tmp0_safe_receiver = this.tr_1;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ds();
    return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs;
  };
  EventLoop.prototype.es = function (unconfined) {
    var tmp0_this = this;
    tmp0_this.rr_1 = tmp0_this.rr_1.r6(delta(this, unconfined));
    if (!unconfined)
      this.sr_1 = true;
  };
  EventLoop.prototype.fs = function (unconfined) {
    var tmp0_this = this;
    tmp0_this.rr_1 = tmp0_this.rr_1.s6(delta(this, unconfined));
    if (this.rr_1.g1(new Long(0, 0)) > 0)
      return Unit_getInstance();
    {
    }
    if (this.sr_1) {
      this.gs();
    }
  };
  EventLoop.prototype.gs = function () {
  };
  EventLoop.$metadata$ = classMeta('EventLoop', undefined, undefined, undefined, undefined, CoroutineDispatcher.prototype);
  function ThreadLocalEventLoop() {
    ThreadLocalEventLoop_instance = this;
    this.hs_1 = new CommonThreadLocal();
  }
  ThreadLocalEventLoop.prototype.is = function () {
    var tmp0_elvis_lhs = this.hs_1.ks();
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$0;
      {
        var tmp0_also = createEventLoop();
        {
        }
        {
          ThreadLocalEventLoop_getInstance().hs_1.ls(tmp0_also);
        }
        tmp$ret$0 = tmp0_also;
      }
      tmp = tmp$ret$0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  ThreadLocalEventLoop.$metadata$ = objectMeta('ThreadLocalEventLoop');
  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);
  }
  CompletionHandlerException.$metadata$ = classMeta('CompletionHandlerException', undefined, undefined, undefined, undefined, RuntimeException.prototype);
  function CoroutinesInternalError(message, cause) {
    Error_init_$Init$(message, cause, this);
    captureStack(this, CoroutinesInternalError);
  }
  CoroutinesInternalError.$metadata$ = classMeta('CoroutinesInternalError', undefined, undefined, undefined, undefined, Error_0.prototype);
  function DisposableHandle() {
  }
  DisposableHandle.$metadata$ = interfaceMeta('DisposableHandle');
  function Key_3() {
    Key_instance_2 = this;
    initializeDefaultExceptionHandlers();
  }
  Key_3.$metadata$ = objectMeta('Key', [Key]);
  var Key_instance_2;
  function Key_getInstance_3() {
    if (Key_instance_2 == null)
      new Key_3();
    return Key_instance_2;
  }
  function Job() {
  }
  Job.$metadata$ = interfaceMeta('Job', [Element]);
  function ChildJob() {
  }
  ChildJob.$metadata$ = interfaceMeta('ChildJob', [Job]);
  function ParentJob() {
  }
  ParentJob.$metadata$ = interfaceMeta('ParentJob', [Job]);
  function ChildHandle() {
  }
  ChildHandle.$metadata$ = interfaceMeta('ChildHandle', [DisposableHandle]);
  function NonDisposableHandle() {
    NonDisposableHandle_instance = this;
  }
  NonDisposableHandle.prototype.vn = function () {
    return null;
  };
  NonDisposableHandle.prototype.ho = function () {
  };
  NonDisposableHandle.prototype.rl = function (cause) {
    return false;
  };
  NonDisposableHandle.prototype.toString = function () {
    return 'NonDisposableHandle';
  };
  NonDisposableHandle.$metadata$ = objectMeta('NonDisposableHandle', [DisposableHandle, ChildHandle]);
  var NonDisposableHandle_instance;
  function NonDisposableHandle_getInstance() {
    if (NonDisposableHandle_instance == null)
      new NonDisposableHandle();
    return NonDisposableHandle_instance;
  }
  function ensureActive(_this__u8e3s4) {
    var tmp0_safe_receiver = _this__u8e3s4.y4(Key_getInstance_3());
    if (tmp0_safe_receiver == null)
      null;
    else {
      ensureActive_0(tmp0_safe_receiver);
    }
  }
  function ensureActive_0(_this__u8e3s4) {
    if (!_this__u8e3s4.lk())
      throw _this__u8e3s4.fl();
  }
  function Job_0(parent) {
    return new JobImpl(parent);
  }
  function Job$default(parent, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      parent = null;
    return Job_0(parent);
  }
  function cancel_1(_this__u8e3s4, message, cause) {
    return _this__u8e3s4.nl(CancellationException_init_$Create$_0(message, cause));
  }
  function cancel_2(_this__u8e3s4, cause) {
    var tmp0_safe_receiver = _this__u8e3s4.y4(Key_getInstance_3());
    if (tmp0_safe_receiver == null)
      null;
    else {
      tmp0_safe_receiver.nl(cause);
    }
  }
  function get_COMPLETING_ALREADY() {
    init_properties_JobSupport_kt_iaxwag();
    return COMPLETING_ALREADY;
  }
  var COMPLETING_ALREADY;
  function get_COMPLETING_WAITING_CHILDREN() {
    init_properties_JobSupport_kt_iaxwag();
    return COMPLETING_WAITING_CHILDREN;
  }
  var COMPLETING_WAITING_CHILDREN;
  function get_COMPLETING_RETRY() {
    init_properties_JobSupport_kt_iaxwag();
    return COMPLETING_RETRY;
  }
  var COMPLETING_RETRY;
  function get_TOO_LATE_TO_CANCEL() {
    init_properties_JobSupport_kt_iaxwag();
    return TOO_LATE_TO_CANCEL;
  }
  var TOO_LATE_TO_CANCEL;
  function get_SEALED() {
    init_properties_JobSupport_kt_iaxwag();
    return SEALED;
  }
  var SEALED;
  function get_EMPTY_NEW() {
    init_properties_JobSupport_kt_iaxwag();
    return EMPTY_NEW;
  }
  var EMPTY_NEW;
  function get_EMPTY_ACTIVE() {
    init_properties_JobSupport_kt_iaxwag();
    return EMPTY_ACTIVE;
  }
  var EMPTY_ACTIVE;
  function Empty(isActive) {
    this.ms_1 = isActive;
  }
  Empty.prototype.lk = function () {
    return this.ms_1;
  };
  Empty.prototype.ns = function () {
    return null;
  };
  Empty.prototype.toString = function () {
    return 'Empty{' + (this.ms_1 ? 'Active' : 'New') + '}';
  };
  Empty.$metadata$ = classMeta('Empty', [Incomplete]);
  function Incomplete() {
  }
  Incomplete.$metadata$ = interfaceMeta('Incomplete');
  function NodeList() {
    LinkedListHead.call(this);
  }
  NodeList.prototype.lk = function () {
    return true;
  };
  NodeList.prototype.ns = function () {
    return this;
  };
  NodeList.prototype.rs = function (state) {
    var tmp$ret$1;
    {
      {
      }
      var tmp$ret$0;
      {
        var tmp0_apply = StringBuilder_init_$Create$();
        {
        }
        {
          tmp0_apply.sg('List{');
          tmp0_apply.sg(state);
          tmp0_apply.sg('}[');
          var first = true;
          {
            var cur = this.ss();
            while (!equals(cur, this)) {
              if (cur instanceof JobNode) {
                var tmp0__anonymous__q1qw7t = cur;
                if (first)
                  first = false;
                else {
                  tmp0_apply.sg(', ');
                }
                tmp0_apply.rg(tmp0__anonymous__q1qw7t);
              }
              cur = cur.yo_1;
            }
          }
          tmp0_apply.sg(']');
        }
        tmp$ret$0 = tmp0_apply;
      }
      tmp$ret$1 = tmp$ret$0.toString();
    }
    return tmp$ret$1;
  };
  NodeList.prototype.toString = function () {
    return get_DEBUG() ? this.rs('Active') : anyToString(this);
  };
  NodeList.$metadata$ = classMeta('NodeList', [Incomplete], undefined, undefined, undefined, LinkedListHead.prototype);
  function JobNode() {
    CompletionHandlerBase.call(this);
  }
  JobNode.prototype.jt = function () {
    var tmp = this.it_1;
    if (!(tmp == null))
      return tmp;
    else {
      throwUninitializedPropertyAccessException('job');
    }
  };
  JobNode.prototype.lk = function () {
    return true;
  };
  JobNode.prototype.ns = function () {
    return null;
  };
  JobNode.prototype.ho = function () {
    return this.jt().ll(this);
  };
  JobNode.prototype.toString = function () {
    return get_classSimpleName(this) + '@' + get_hexAddress(this) + '[job@' + get_hexAddress(this.jt()) + ']';
  };
  JobNode.$metadata$ = classMeta('JobNode', [DisposableHandle, Incomplete], undefined, undefined, undefined, CompletionHandlerBase.prototype);
  function _set_exceptionsHolder__tqm22h($this, value) {
    $this.ot_1.tj_1 = value;
  }
  function _get_exceptionsHolder__nhszp($this) {
    return $this.ot_1.tj_1;
  }
  function allocateList($this) {
    return ArrayList_init_$Create$(4);
  }
  function finalizeFinishingState($this, state, proposedUpdate) {
    {
    }
    {
    }
    {
    }
    var tmp0_safe_receiver = proposedUpdate instanceof CompletedExceptionally ? proposedUpdate : null;
    var proposedException = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qk_1;
    var wasCancelling = false;
    var tmp$ret$1;
    {
      var tmp$ret$0;
      {
        wasCancelling = state.pt();
        var exceptions = state.qt(proposedException);
        var finalCause = getFinalRootCause($this, state, exceptions);
        if (!(finalCause == null))
          addSuppressedExceptions($this, finalCause, exceptions);
        tmp$ret$0 = finalCause;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    var finalException = tmp$ret$1;
    var tmp;
    if (finalException == null) {
      tmp = proposedUpdate;
    } else if (finalException === proposedException) {
      tmp = proposedUpdate;
    } else {
      tmp = CompletedExceptionally_init_$Create$(finalException, false, 2, null);
    }
    var finalState = tmp;
    if (!(finalException == null)) {
      var handled = cancelParent($this, finalException) ? true : $this.zl(finalException);
      if (handled) {
        (finalState instanceof CompletedExceptionally ? finalState : THROW_CCE()).eq();
      }
    }
    if (!wasCancelling)
      $this.wl(finalException);
    $this.pk(finalState);
    var casSuccess = $this.gk_1.atomicfu$compareAndSet(state, boxIncomplete(finalState));
    {
    }
    completeStateFinalization($this, state, finalState);
    {
    }
    return finalState;
  }
  function getFinalRootCause($this, state, exceptions) {
    if (exceptions.m()) {
      if (state.pt()) {
        var tmp$ret$0;
        {
          var tmp0_elvis_lhs = null;
          tmp$ret$0 = new JobCancellationException(tmp0_elvis_lhs == null ? $this.ok() : tmp0_elvis_lhs, null, $this);
        }
        return tmp$ret$0;
      }
      return null;
    }
    var tmp$ret$2;
    $l$block: {
      var tmp0_iterator = exceptions.g();
      while (tmp0_iterator.h()) {
        var element = tmp0_iterator.i();
        var tmp$ret$1;
        {
          tmp$ret$1 = !(element instanceof CancellationException);
        }
        if (tmp$ret$1) {
          tmp$ret$2 = element;
          break $l$block;
        }
      }
      tmp$ret$2 = null;
    }
    var firstNonCancellation = tmp$ret$2;
    if (!(firstNonCancellation == null))
      return firstNonCancellation;
    var first = exceptions.l(0);
    if (first instanceof TimeoutCancellationException) {
      var tmp$ret$4;
      $l$block_0: {
        var tmp0_iterator_0 = exceptions.g();
        while (tmp0_iterator_0.h()) {
          var element_0 = tmp0_iterator_0.i();
          var tmp$ret$3;
          {
            var tmp;
            if (!(element_0 === first)) {
              tmp = element_0 instanceof TimeoutCancellationException;
            } else {
              tmp = false;
            }
            tmp$ret$3 = tmp;
          }
          if (tmp$ret$3) {
            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.j() <= 1)
      return Unit_getInstance();
    var seenExceptions = identitySet(exceptions.j());
    var unwrappedCause = unwrap(rootCause);
    var tmp0_iterator = exceptions.g();
    while (tmp0_iterator.h()) {
      var exception = tmp0_iterator.i();
      var unwrapped = unwrap(exception);
      var tmp;
      var tmp_0;
      if (!(unwrapped === rootCause) ? !(unwrapped === unwrappedCause) : false) {
        tmp_0 = !(unwrapped instanceof CancellationException);
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        tmp = seenExceptions.a(unwrapped);
      } else {
        tmp = false;
      }
      if (tmp) {
        {
        }
      }
    }
  }
  function tryFinalizeSimpleState($this, state, update) {
    {
    }
    {
    }
    if (!$this.gk_1.atomicfu$compareAndSet(state, boxIncomplete(update)))
      return false;
    $this.wl(null);
    $this.pk(update);
    completeStateFinalization($this, state, update);
    {
    }
    return true;
  }
  function completeStateFinalization($this, state, update) {
    var tmp0_safe_receiver = $this.al();
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$0;
      {
        {
        }
        tmp0_safe_receiver.ho();
        tmp$ret$0 = $this.zk(NonDisposableHandle_getInstance());
      }
    }
    var tmp1_safe_receiver = update instanceof CompletedExceptionally ? update : null;
    var cause = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qk_1;
    if (state instanceof JobNode) {
      try {
        state.invoke(cause);
      } catch ($p) {
        if ($p instanceof Error) {
          $this.wk(new CompletionHandlerException('Exception in completion handler ' + state + ' for ' + $this, $p));
        } else {
          throw $p;
        }
      }
    } else {
      var tmp2_safe_receiver = state.ns();
      if (tmp2_safe_receiver == null)
        null;
      else {
        notifyCompletion(tmp2_safe_receiver, $this, cause);
      }
    }
  }
  function notifyCancelling($this, list, cause) {
    $this.wl(cause);
    {
      var exception = null;
      {
        var cur = list.ss();
        while (!equals(cur, list)) {
          if (cur instanceof JobCancellingNode) {
            var tmp0__anonymous__q1qw7t = cur;
            try {
              tmp0__anonymous__q1qw7t.invoke(cause);
            } catch ($p) {
              if ($p instanceof Error) {
                var tmp0_safe_receiver = exception;
                var tmp;
                if (tmp0_safe_receiver == null) {
                  tmp = null;
                } else {
                  var tmp$ret$0;
                  {
                    {
                    }
                    {
                      {
                      }
                    }
                    tmp$ret$0 = tmp0_safe_receiver;
                  }
                  tmp = tmp$ret$0;
                }
                var tmp1_elvis_lhs = tmp;
                if (tmp1_elvis_lhs == null) {
                  var tmp$ret$1;
                  {
                    {
                    }
                    exception = new CompletionHandlerException('Exception in completion handler ' + tmp0__anonymous__q1qw7t + ' for ' + $this, $p);
                    tmp$ret$1 = Unit_getInstance();
                  }
                } else
                  tmp1_elvis_lhs;
              } else {
                throw $p;
              }
            }
          }
          cur = cur.yo_1;
        }
      }
      var tmp0_safe_receiver_0 = exception;
      if (tmp0_safe_receiver_0 == null)
        null;
      else {
        var tmp$ret$2;
        {
          {
          }
          tmp$ret$2 = $this.wk(tmp0_safe_receiver_0);
        }
      }
    }
    cancelParent($this, cause);
  }
  function cancelParent($this, cause) {
    if ($this.xl())
      return true;
    var isCancellation = cause instanceof CancellationException;
    var parent = $this.al();
    if (parent === null ? true : parent === NonDisposableHandle_getInstance()) {
      return isCancellation;
    }
    return parent.rl(cause) ? true : isCancellation;
  }
  function notifyCompletion(_this__u8e3s4, $this, cause) {
    var exception = null;
    {
      var cur = _this__u8e3s4.ss();
      while (!equals(cur, _this__u8e3s4)) {
        if (cur instanceof JobNode) {
          var tmp0__anonymous__q1qw7t = cur;
          try {
            tmp0__anonymous__q1qw7t.invoke(cause);
          } catch ($p) {
            if ($p instanceof Error) {
              var tmp0_safe_receiver = exception;
              var tmp;
              if (tmp0_safe_receiver == null) {
                tmp = null;
              } else {
                var tmp$ret$0;
                {
                  {
                  }
                  {
                    {
                    }
                  }
                  tmp$ret$0 = tmp0_safe_receiver;
                }
                tmp = tmp$ret$0;
              }
              var tmp1_elvis_lhs = tmp;
              if (tmp1_elvis_lhs == null) {
                var tmp$ret$1;
                {
                  {
                  }
                  exception = new CompletionHandlerException('Exception in completion handler ' + tmp0__anonymous__q1qw7t + ' for ' + $this, $p);
                  tmp$ret$1 = Unit_getInstance();
                }
              } else
                tmp1_elvis_lhs;
            } else {
              throw $p;
            }
          }
        }
        cur = cur.yo_1;
      }
    }
    var tmp0_safe_receiver_0 = exception;
    if (tmp0_safe_receiver_0 == null)
      null;
    else {
      var tmp$ret$2;
      {
        {
        }
        tmp$ret$2 = $this.wk(tmp0_safe_receiver_0);
      }
    }
    return Unit_getInstance();
  }
  function startInternal($this, state) {
    var tmp0_subject = state;
    if (tmp0_subject instanceof Empty) {
      if (state.ms_1)
        return 0;
      if (!$this.gk_1.atomicfu$compareAndSet(state, get_EMPTY_ACTIVE()))
        return -1;
      $this.el();
      return 1;
    } else {
      if (tmp0_subject instanceof InactiveNodeList) {
        if (!$this.gk_1.atomicfu$compareAndSet(state, state.rt_1))
          return -1;
        $this.el();
        return 1;
      } else {
        return 0;
      }
    }
  }
  function makeNode($this, handler, onCancelling) {
    var tmp;
    if (onCancelling) {
      var tmp0_elvis_lhs = handler instanceof JobCancellingNode ? handler : null;
      tmp = tmp0_elvis_lhs == null ? new InvokeOnCancelling(handler) : tmp0_elvis_lhs;
    } else {
      var tmp1_safe_receiver = handler instanceof JobNode ? handler : null;
      var tmp_0;
      if (tmp1_safe_receiver == null) {
        tmp_0 = null;
      } else {
        var tmp$ret$0;
        {
          {
          }
          {
            {
            }
          }
          tmp$ret$0 = tmp1_safe_receiver;
        }
        tmp_0 = tmp$ret$0;
      }
      var tmp2_elvis_lhs = tmp_0;
      tmp = tmp2_elvis_lhs == null ? new InvokeOnCompletion(handler) : tmp2_elvis_lhs;
    }
    var node = tmp;
    node.it_1 = $this;
    return node;
  }
  function addLastAtomic($this, expect, list, node) {
    var tmp$ret$1;
    $l$block: {
      var tmp$ret$0;
      {
        tmp$ret$0 = $this.bl() === expect;
      }
      if (!tmp$ret$0) {
        tmp$ret$1 = false;
        break $l$block;
      }
      list.zs(node);
      tmp$ret$1 = true;
    }
    return tmp$ret$1;
  }
  function promoteEmptyToNodeList($this, state) {
    var list = new NodeList();
    var update = state.ms_1 ? list : new InactiveNodeList(list);
    if (!$this.gk_1.atomicfu$compareAndSet(state, update)) {
      {
      }
    }
  }
  function promoteSingleToNodeList($this, state) {
    state.kt(new NodeList());
    var tmp$ret$0;
    {
      tmp$ret$0 = state.yo_1;
    }
    var list = tmp$ret$0;
    $this.gk_1.atomicfu$compareAndSet(state, list);
  }
  function joinInternal($this) {
    {
      while (true) {
        {
          var tmp0__anonymous__q1qw7t = $this.bl();
          if (!(!(tmp0__anonymous__q1qw7t == null) ? isInterface(tmp0__anonymous__q1qw7t, Incomplete) : false))
            return false;
          if (startInternal($this, tmp0__anonymous__q1qw7t) >= 0)
            return true;
        }
      }
    }
  }
  function joinSuspend($this, $cont) {
    var tmp$ret$2;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = new CancellableContinuationImpl(intercepted(tmp0__anonymous__q1qw7t), get_MODE_CANCELLABLE());
      cancellable.oo();
      {
        var tmp$ret$1;
        {
          var tmp0__get_asHandler__gq3rkj = new ResumeOnCompletion(cancellable);
          var tmp$ret$0;
          {
            tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
          }
          tmp$ret$1 = tmp$ret$0;
        }
        disposeOnCancellation(cancellable, $this.il(tmp$ret$1));
      }
      tmp$ret$2 = cancellable.km();
    }
    return tmp$ret$2;
  }
  function cancelMakeCompleting($this, cause) {
    {
      while (true) {
        {
          var tmp0__anonymous__q1qw7t = $this.bl();
          var tmp;
          if (!(!(tmp0__anonymous__q1qw7t == null) ? isInterface(tmp0__anonymous__q1qw7t, Incomplete) : false)) {
            tmp = true;
          } else {
            var tmp_0;
            if (tmp0__anonymous__q1qw7t instanceof Finishing) {
              tmp_0 = tmp0__anonymous__q1qw7t.st();
            } else {
              tmp_0 = false;
            }
            tmp = tmp_0;
          }
          if (tmp) {
            return get_COMPLETING_ALREADY();
          }
          var tmp_1 = createCauseException($this, cause);
          var proposedUpdate = CompletedExceptionally_init_$Create$(tmp_1, false, 2, null);
          var finalState = tryMakeCompleting($this, tmp0__anonymous__q1qw7t, proposedUpdate);
          if (!(finalState === get_COMPLETING_RETRY()))
            return finalState;
        }
      }
    }
  }
  function createCauseException($this, cause) {
    var tmp0_subject = cause;
    var tmp;
    if (tmp0_subject == null ? true : tmp0_subject instanceof Error) {
      var tmp1_elvis_lhs = cause;
      var tmp_0;
      if (tmp1_elvis_lhs == null) {
        var tmp$ret$0;
        {
          var tmp0_elvis_lhs = null;
          tmp$ret$0 = new JobCancellationException(tmp0_elvis_lhs == null ? $this.ok() : tmp0_elvis_lhs, null, $this);
        }
        tmp_0 = tmp$ret$0;
      } else {
        tmp_0 = tmp1_elvis_lhs;
      }
      tmp = tmp_0;
    } else {
      tmp = ((!(cause == null) ? isInterface(cause, ParentJob) : false) ? cause : THROW_CCE()).ul();
    }
    return tmp;
  }
  function makeCancelling($this, cause) {
    var causeExceptionCache = null;
    {
      while (true) {
        var tmp$ret$7;
        $l$block: {
          var tmp0__anonymous__q1qw7t = $this.bl();
          var tmp0_subject = tmp0__anonymous__q1qw7t;
          if (tmp0_subject instanceof Finishing) {
            var tmp$ret$4;
            {
              var tmp$ret$3;
              {
                if (tmp0__anonymous__q1qw7t.tt())
                  return get_TOO_LATE_TO_CANCEL();
                var wasCancelling = tmp0__anonymous__q1qw7t.pt();
                if (!(cause == null) ? true : !wasCancelling) {
                  var tmp0_elvis_lhs = causeExceptionCache;
                  var tmp;
                  if (tmp0_elvis_lhs == null) {
                    var tmp$ret$0;
                    {
                      var tmp0_also = createCauseException($this, cause);
                      {
                      }
                      {
                        causeExceptionCache = tmp0_also;
                      }
                      tmp$ret$0 = tmp0_also;
                    }
                    tmp = tmp$ret$0;
                  } else {
                    tmp = tmp0_elvis_lhs;
                  }
                  var causeException = tmp;
                  tmp0__anonymous__q1qw7t.ut(causeException);
                }
                var tmp$ret$2;
                {
                  var tmp1_takeIf = tmp0__anonymous__q1qw7t.vt();
                  {
                  }
                  var tmp_0;
                  var tmp$ret$1;
                  {
                    tmp$ret$1 = !wasCancelling;
                  }
                  if (tmp$ret$1) {
                    tmp_0 = tmp1_takeIf;
                  } else {
                    tmp_0 = null;
                  }
                  tmp$ret$2 = tmp_0;
                }
                tmp$ret$3 = tmp$ret$2;
              }
              tmp$ret$4 = tmp$ret$3;
            }
            var notifyRootCause = tmp$ret$4;
            var tmp1_safe_receiver = notifyRootCause;
            if (tmp1_safe_receiver == null)
              null;
            else {
              var tmp$ret$5;
              {
                {
                }
                tmp$ret$5 = notifyCancelling($this, tmp0__anonymous__q1qw7t.lt_1, tmp1_safe_receiver);
              }
            }
            return get_COMPLETING_ALREADY();
          } else {
            if (!(tmp0_subject == null) ? isInterface(tmp0_subject, Incomplete) : false) {
              var tmp2_elvis_lhs = causeExceptionCache;
              var tmp_1;
              if (tmp2_elvis_lhs == null) {
                var tmp$ret$6;
                {
                  var tmp0_also_0 = createCauseException($this, cause);
                  {
                  }
                  {
                    causeExceptionCache = tmp0_also_0;
                  }
                  tmp$ret$6 = tmp0_also_0;
                }
                tmp_1 = tmp$ret$6;
              } else {
                tmp_1 = tmp2_elvis_lhs;
              }
              var causeException_0 = tmp_1;
              if (tmp0__anonymous__q1qw7t.lk()) {
                if (tryMakeCancelling($this, tmp0__anonymous__q1qw7t, causeException_0))
                  return get_COMPLETING_ALREADY();
              } else {
                var finalState = tryMakeCompleting($this, tmp0__anonymous__q1qw7t, CompletedExceptionally_init_$Create$(causeException_0, false, 2, null));
                if (finalState === get_COMPLETING_ALREADY()) {
                  var tmp1_error = 'Cannot happen in ' + toString(tmp0__anonymous__q1qw7t);
                  throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
                } else if (finalState === get_COMPLETING_RETRY()) {
                  tmp$ret$7 = Unit_getInstance();
                  break $l$block;
                } else
                  return finalState;
              }
            } else {
              return get_TOO_LATE_TO_CANCEL();
            }
          }
        }
      }
    }
  }
  function getOrPromoteCancellingList($this, state) {
    var tmp1_elvis_lhs = state.ns();
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var tmp0_subject = state;
      var tmp_0;
      if (tmp0_subject instanceof Empty) {
        tmp_0 = new NodeList();
      } else {
        if (tmp0_subject instanceof JobNode) {
          promoteSingleToNodeList($this, state);
          tmp_0 = null;
        } else {
          var tmp0_error = 'State should have list: ' + state;
          throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
        }
      }
      tmp = tmp_0;
    } else {
      tmp = tmp1_elvis_lhs;
    }
    return tmp;
  }
  function tryMakeCancelling($this, state, rootCause) {
    {
    }
    {
    }
    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.gk_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 = null;
    var tmp$ret$3;
    {
      if (finishing.st())
        return get_COMPLETING_ALREADY();
      finishing.wt(true);
      if (!(finishing === state)) {
        if (!$this.gk_1.atomicfu$compareAndSet(state, finishing)) {
          {
          }
          return get_COMPLETING_RETRY();
        }
      }
      {
      }
      var wasCancelling = finishing.pt();
      var tmp0_safe_receiver = proposedUpdate instanceof CompletedExceptionally ? proposedUpdate : null;
      if (tmp0_safe_receiver == null)
        null;
      else {
        var tmp$ret$0;
        {
          {
          }
          tmp$ret$0 = finishing.ut(tmp0_safe_receiver.qk_1);
        }
      }
      var tmp$ret$2;
      {
        var tmp0_takeIf = finishing.vt();
        {
        }
        var tmp_0;
        var tmp$ret$1;
        {
          tmp$ret$1 = !wasCancelling;
        }
        if (tmp$ret$1) {
          tmp_0 = tmp0_takeIf;
        } else {
          tmp_0 = null;
        }
        tmp$ret$2 = tmp_0;
      }
      notifyRootCause = tmp$ret$2;
      tmp$ret$3 = Unit_getInstance();
    }
    var tmp2_safe_receiver = notifyRootCause;
    if (tmp2_safe_receiver == null)
      null;
    else {
      var tmp$ret$4;
      {
        {
        }
        tmp$ret$4 = notifyCancelling($this, list, tmp2_safe_receiver);
      }
    }
    var child = firstChild($this, state);
    if (!(child == null) ? tryWaitForChild($this, finishing, child, proposedUpdate) : false)
      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.qk_1;
  }
  function firstChild($this, state) {
    var tmp1_elvis_lhs = state instanceof ChildHandleNode ? state : null;
    var tmp;
    if (tmp1_elvis_lhs == null) {
      var tmp0_safe_receiver = state.ns();
      tmp = tmp0_safe_receiver == null ? null : nextChild(tmp0_safe_receiver, $this);
    } else {
      tmp = tmp1_elvis_lhs;
    }
    return tmp;
  }
  function tryWaitForChild($this, state, child, proposedUpdate) {
    var $this_0 = $this;
    var state_0 = state;
    var child_0 = child;
    var proposedUpdate_0 = proposedUpdate;
    while (true) {
      var $this_1 = $this_0;
      var state_1 = state_0;
      var child_1 = child_0;
      var proposedUpdate_1 = proposedUpdate_0;
      var tmp$ret$1;
      {
        var tmp0__get_asHandler__gq3rkj = new ChildCompletion($this_1, state_1, child_1, proposedUpdate_1);
        var tmp$ret$0;
        {
          tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
        }
        tmp$ret$1 = tmp$ret$0;
      }
      var handle = child_1.bu_1.kl(false, false, tmp$ret$1, 1, null);
      if (!(handle === NonDisposableHandle_getInstance()))
        return true;
      var tmp0_elvis_lhs = nextChild(child_1, $this_1);
      var tmp;
      if (tmp0_elvis_lhs == null) {
        return false;
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var nextChild_0 = tmp;
      var tmp0 = $this_1;
      var tmp1 = state_1;
      var tmp2 = nextChild_0;
      var tmp3 = proposedUpdate_1;
      $this_0 = tmp0;
      state_0 = tmp1;
      child_0 = tmp2;
      proposedUpdate_0 = tmp3;
      continue;
    }
  }
  function continueCompleting($this, state, lastChild, proposedUpdate) {
    {
    }
    var waitChild = nextChild(lastChild, $this);
    if (!(waitChild == null) ? tryWaitForChild($this, state, waitChild, proposedUpdate) : false)
      return Unit_getInstance();
    var finalState = finalizeFinishingState($this, state, proposedUpdate);
    $this.vk(finalState);
  }
  function nextChild(_this__u8e3s4, $this) {
    var cur = _this__u8e3s4;
    $l$loop: while (true) {
      var tmp$ret$0;
      {
        var tmp0__get_isRemoved__hsfvgr = cur;
        tmp$ret$0 = tmp0__get_isRemoved__hsfvgr.ap_1;
      }
      if (!tmp$ret$0) {
        break $l$loop;
      }
      var tmp$ret$1;
      {
        var tmp1__get_prevNode__b1i0ed = cur;
        tmp$ret$1 = tmp1__get_prevNode__b1i0ed.zo_1;
      }
      cur = tmp$ret$1;
    }
    $l$loop_0: while (true) {
      var tmp$ret$2;
      {
        var tmp2__get_nextNode__ek7k4a = cur;
        tmp$ret$2 = tmp2__get_nextNode__ek7k4a.yo_1;
      }
      cur = tmp$ret$2;
      var tmp$ret$3;
      {
        var tmp3__get_isRemoved__lodk3s = cur;
        tmp$ret$3 = tmp3__get_isRemoved__lodk3s.ap_1;
      }
      if (tmp$ret$3)
        continue $l$loop_0;
      if (cur instanceof ChildHandleNode)
        return cur;
      if (cur instanceof NodeList)
        return null;
    }
  }
  function stateString($this, state) {
    var tmp0_subject = state;
    var tmp;
    if (tmp0_subject instanceof Finishing) {
      tmp = state.pt() ? 'Cancelling' : state.st() ? 'Completing' : 'Active';
    } else {
      if (!(tmp0_subject == null) ? isInterface(tmp0_subject, Incomplete) : false) {
        tmp = state.lk() ? 'Active' : 'New';
      } else {
        if (tmp0_subject instanceof CompletedExceptionally) {
          tmp = 'Cancelled';
        } else {
          tmp = 'Completed';
        }
      }
    }
    return tmp;
  }
  function Finishing(list, isCompleting, rootCause) {
    this.lt_1 = list;
    this.mt_1 = atomic$boolean$1(isCompleting);
    this.nt_1 = atomic$ref$1(rootCause);
    this.ot_1 = atomic$ref$1(null);
  }
  Finishing.prototype.ns = function () {
    return this.lt_1;
  };
  Finishing.prototype.wt = function (value) {
    this.mt_1.zj_1 = value;
  };
  Finishing.prototype.st = function () {
    return this.mt_1.zj_1;
  };
  Finishing.prototype.cu = function (value) {
    this.nt_1.tj_1 = value;
  };
  Finishing.prototype.vt = function () {
    return this.nt_1.tj_1;
  };
  Finishing.prototype.tt = function () {
    return _get_exceptionsHolder__nhszp(this) === get_SEALED();
  };
  Finishing.prototype.pt = function () {
    return !(this.vt() == null);
  };
  Finishing.prototype.lk = function () {
    return this.vt() == null;
  };
  Finishing.prototype.qt = function (proposedException) {
    var eh = _get_exceptionsHolder__nhszp(this);
    var tmp;
    if (eh == null) {
      tmp = allocateList(this);
    } else {
      if (eh instanceof Error) {
        var tmp$ret$0;
        {
          var tmp0_also = allocateList(this);
          {
          }
          {
            tmp0_also.a(eh);
          }
          tmp$ret$0 = tmp0_also;
        }
        tmp = tmp$ret$0;
      } else {
        if (eh instanceof ArrayList) {
          tmp = eh instanceof ArrayList ? eh : THROW_CCE();
        } else {
          var tmp1_error = 'State is ' + toString(eh);
          throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
        }
      }
    }
    var list = tmp;
    var rootCause = this.vt();
    var tmp0_safe_receiver = rootCause;
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        var tmp0_addOrUpdate = list;
        tmp$ret$1 = tmp0_addOrUpdate.e3(0, tmp0_safe_receiver);
      }
    }
    if (!(proposedException == null) ? !equals(proposedException, rootCause) : false) {
      {
        var tmp2_addOrUpdate = list;
        tmp2_addOrUpdate.a(proposedException);
      }
    }
    _set_exceptionsHolder__tqm22h(this, get_SEALED());
    return list;
  };
  Finishing.prototype.ut = function (exception) {
    var rootCause = this.vt();
    if (rootCause == null) {
      this.cu(exception);
      return Unit_getInstance();
    }
    if (exception === rootCause)
      return Unit_getInstance();
    var eh = _get_exceptionsHolder__nhszp(this);
    if (eh == null)
      _set_exceptionsHolder__tqm22h(this, exception);
    else {
      if (eh instanceof Error) {
        if (exception === eh)
          return Unit_getInstance();
        var tmp$ret$0;
        {
          var tmp0_apply = allocateList(this);
          {
          }
          {
            tmp0_apply.a(eh);
            tmp0_apply.a(exception);
          }
          tmp$ret$0 = tmp0_apply;
        }
        _set_exceptionsHolder__tqm22h(this, tmp$ret$0);
      } else {
        if (eh instanceof ArrayList) {
          var tmp1_addOrUpdate = eh instanceof ArrayList ? eh : THROW_CCE();
          tmp1_addOrUpdate.a(exception);
        } else {
          var tmp2_error = 'State is ' + toString(eh);
          throw IllegalStateException_init_$Create$(toString_0(tmp2_error));
        }
      }
    }
  };
  Finishing.prototype.toString = function () {
    return 'Finishing[cancelling=' + this.pt() + ', completing=' + this.st() + ', rootCause=' + this.vt() + ', exceptions=' + toString(_get_exceptionsHolder__nhszp(this)) + ', list=' + this.lt_1 + ']';
  };
  Finishing.$metadata$ = classMeta('Finishing', [Incomplete]);
  function ChildCompletion(parent, state, child, proposedUpdate) {
    JobNode.call(this);
    this.hu_1 = parent;
    this.iu_1 = state;
    this.ju_1 = child;
    this.ku_1 = proposedUpdate;
  }
  ChildCompletion.prototype.go = function (cause) {
    continueCompleting(this.hu_1, this.iu_1, this.ju_1, this.ku_1);
  };
  ChildCompletion.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ChildCompletion.$metadata$ = classMeta('ChildCompletion', undefined, undefined, undefined, undefined, JobNode.prototype);
  function AwaitContinuation(delegate, job) {
    CancellableContinuationImpl.call(this, delegate, get_MODE_CANCELLABLE());
    this.ru_1 = job;
  }
  AwaitContinuation.prototype.bq = function (parent) {
    var state = this.ru_1.bl();
    if (state instanceof Finishing) {
      var tmp0_safe_receiver = state.vt();
      if (tmp0_safe_receiver == null)
        null;
      else {
        var tmp$ret$0;
        {
          {
          }
          return tmp0_safe_receiver;
        }
      }
    }
    if (state instanceof CompletedExceptionally)
      return state.qk_1;
    return parent.fl();
  };
  AwaitContinuation.prototype.xk = function () {
    return 'AwaitContinuation';
  };
  AwaitContinuation.$metadata$ = classMeta('AwaitContinuation', undefined, undefined, undefined, undefined, CancellableContinuationImpl.prototype);
  function awaitSuspend($this, $cont) {
    var tmp$ret$2;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cont = new AwaitContinuation(intercepted(tmp0__anonymous__q1qw7t), $this);
      cont.oo();
      var tmp$ret$1;
      {
        var tmp0__get_asHandler__gq3rkj = new ResumeAwaitOnCompletion(cont);
        var tmp$ret$0;
        {
          tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
        }
        tmp$ret$1 = tmp$ret$0;
      }
      disposeOnCancellation(cont, $this.il(tmp$ret$1));
      tmp$ret$2 = cont.km();
    }
    return tmp$ret$2;
  }
  function JobSupport(active) {
    this.gk_1 = atomic$ref$1(active ? get_EMPTY_ACTIVE() : get_EMPTY_NEW());
    this.hk_1 = atomic$ref$1(null);
  }
  JobSupport.prototype.x = function () {
    return Key_getInstance_3();
  };
  JobSupport.prototype.zk = function (value) {
    this.hk_1.tj_1 = value;
  };
  JobSupport.prototype.al = function () {
    return this.hk_1.tj_1;
  };
  JobSupport.prototype.ik = function (parent) {
    {
    }
    if (parent == null) {
      this.zk(NonDisposableHandle_getInstance());
      return Unit_getInstance();
    }
    parent.dl();
    var handle = parent.vl(this);
    this.zk(handle);
    if (this.cl()) {
      handle.ho();
      this.zk(NonDisposableHandle_getInstance());
    }
  };
  JobSupport.prototype.bl = function () {
    {
      var tmp0_loop = this.gk_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (!(tmp1__anonymous__uwfjfc instanceof OpDescriptor))
            return tmp1__anonymous__uwfjfc;
          tmp1__anonymous__uwfjfc.su(this);
        }
      }
    }
  };
  JobSupport.prototype.lk = function () {
    var state = this.bl();
    var tmp;
    if (!(state == null) ? isInterface(state, Incomplete) : false) {
      tmp = state.lk();
    } else {
      tmp = false;
    }
    return tmp;
  };
  JobSupport.prototype.cl = function () {
    var tmp = this.bl();
    return !(!(tmp == null) ? isInterface(tmp, Incomplete) : false);
  };
  JobSupport.prototype.wn = function () {
    var state = this.bl();
    var tmp;
    if (state instanceof CompletedExceptionally) {
      tmp = true;
    } else {
      var tmp_0;
      if (state instanceof Finishing) {
        tmp_0 = state.pt();
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    }
    return tmp;
  };
  JobSupport.prototype.dl = function () {
    {
      while (true) {
        {
          var tmp0__anonymous__q1qw7t = this.bl();
          var tmp0_subject = startInternal(this, tmp0__anonymous__q1qw7t);
          if (tmp0_subject === 0)
            return false;
          else if (tmp0_subject === 1)
            return true;
        }
      }
    }
  };
  JobSupport.prototype.el = function () {
  };
  JobSupport.prototype.fl = function () {
    var state = this.bl();
    var tmp;
    if (state instanceof Finishing) {
      var tmp0_safe_receiver = state.vt();
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.gl(tmp0_safe_receiver, get_classSimpleName(this) + ' is cancelling');
      var tmp_0;
      if (tmp1_elvis_lhs == null) {
        var tmp0_error = 'Job is still new or active: ' + this;
        throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
      } else {
        tmp_0 = tmp1_elvis_lhs;
      }
      tmp = tmp_0;
    } else {
      if (!(state == null) ? isInterface(state, Incomplete) : false) {
        var tmp1_error = 'Job is still new or active: ' + this;
        throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
      } else {
        if (state instanceof CompletedExceptionally) {
          tmp = this.hl(state.qk_1, null, 1, null);
        } else {
          tmp = new JobCancellationException(get_classSimpleName(this) + ' has completed normally', null, this);
        }
      }
    }
    return tmp;
  };
  JobSupport.prototype.gl = function (_this__u8e3s4, message) {
    var tmp0_elvis_lhs = _this__u8e3s4 instanceof CancellationException ? _this__u8e3s4 : null;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$0;
      {
        var tmp0_elvis_lhs_0 = message;
        tmp$ret$0 = new JobCancellationException(tmp0_elvis_lhs_0 == null ? this.ok() : tmp0_elvis_lhs_0, _this__u8e3s4, this);
      }
      tmp = tmp$ret$0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  };
  JobSupport.prototype.hl = function (_this__u8e3s4, message, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      message = null;
    return this.gl(_this__u8e3s4, message);
  };
  JobSupport.prototype.il = function (handler) {
    return this.jl(false, true, handler);
  };
  JobSupport.prototype.jl = function (onCancelling, invokeImmediately, handler) {
    var node = makeNode(this, handler, onCancelling);
    {
      while (true) {
        var tmp$ret$1;
        $l$block: {
          var tmp0__anonymous__q1qw7t = this.bl();
          var tmp0_subject = tmp0__anonymous__q1qw7t;
          if (tmp0_subject instanceof Empty) {
            if (tmp0__anonymous__q1qw7t.ms_1) {
              if (this.gk_1.atomicfu$compareAndSet(tmp0__anonymous__q1qw7t, node))
                return node;
            } else
              promoteEmptyToNodeList(this, tmp0__anonymous__q1qw7t);
          } else {
            if (!(tmp0_subject == null) ? isInterface(tmp0_subject, Incomplete) : false) {
              var list = tmp0__anonymous__q1qw7t.ns();
              if (list == null) {
                promoteSingleToNodeList(this, tmp0__anonymous__q1qw7t instanceof JobNode ? tmp0__anonymous__q1qw7t : THROW_CCE());
              } else {
                var rootCause = null;
                var handle = NonDisposableHandle_getInstance();
                var tmp;
                if (onCancelling) {
                  tmp = tmp0__anonymous__q1qw7t instanceof Finishing;
                } else {
                  tmp = false;
                }
                if (tmp) {
                  var tmp$ret$2;
                  {
                    rootCause = tmp0__anonymous__q1qw7t.vt();
                    var tmp_0;
                    var tmp_1;
                    if (rootCause == null) {
                      tmp_1 = true;
                    } else {
                      var tmp_2;
                      var tmp$ret$0;
                      {
                        tmp$ret$0 = handler instanceof ChildHandleNode;
                      }
                      if (tmp$ret$0) {
                        tmp_2 = !tmp0__anonymous__q1qw7t.st();
                      } else {
                        tmp_2 = false;
                      }
                      tmp_1 = tmp_2;
                    }
                    if (tmp_1) {
                      if (!addLastAtomic(this, tmp0__anonymous__q1qw7t, list, node)) {
                        tmp$ret$1 = Unit_getInstance();
                        break $l$block;
                      }
                      if (rootCause == null)
                        return node;
                      handle = node;
                      tmp_0 = Unit_getInstance();
                    }
                    tmp$ret$2 = tmp_0;
                  }
                }
                if (!(rootCause == null)) {
                  if (invokeImmediately)
                    invokeIt(handler, rootCause);
                  return handle;
                } else {
                  if (addLastAtomic(this, tmp0__anonymous__q1qw7t, list, node))
                    return node;
                }
              }
            } else {
              {
              }
              if (invokeImmediately) {
                var tmp1_safe_receiver = tmp0__anonymous__q1qw7t instanceof CompletedExceptionally ? tmp0__anonymous__q1qw7t : null;
                invokeIt(handler, tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qk_1);
              }
              return NonDisposableHandle_getInstance();
            }
          }
        }
      }
    }
  };
  JobSupport.prototype.dr = function ($cont) {
    if (!joinInternal(this)) {
      var tmp$ret$0;
      {
        tmp$ret$0 = $cont.u4();
      }
      ensureActive(tmp$ret$0);
      return Unit_getInstance();
    }
    return joinSuspend(this, $cont);
  };
  JobSupport.prototype.ll = function (node) {
    {
      while (true) {
        {
          var tmp0__anonymous__q1qw7t = this.bl();
          var tmp0_subject = tmp0__anonymous__q1qw7t;
          if (tmp0_subject instanceof JobNode) {
            if (!(tmp0__anonymous__q1qw7t === node))
              return Unit_getInstance();
            if (this.gk_1.atomicfu$compareAndSet(tmp0__anonymous__q1qw7t, get_EMPTY_ACTIVE())) {
              {
              }
              return Unit_getInstance();
            }
          } else {
            if (!(tmp0_subject == null) ? isInterface(tmp0_subject, Incomplete) : false) {
              if (!(tmp0__anonymous__q1qw7t.ns() == null)) {
                node.bp();
              }
              return Unit_getInstance();
            } else {
              return Unit_getInstance();
            }
          }
        }
      }
    }
  };
  JobSupport.prototype.ml = function () {
    return false;
  };
  JobSupport.prototype.nl = function (cause) {
    var tmp0_elvis_lhs = cause;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$0;
      {
        var tmp0_elvis_lhs_0 = null;
        tmp$ret$0 = new JobCancellationException(tmp0_elvis_lhs_0 == null ? this.ok() : tmp0_elvis_lhs_0, null, this);
      }
      tmp = tmp$ret$0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    this.pl(tmp);
  };
  JobSupport.prototype.ok = function () {
    return 'Job was cancelled';
  };
  JobSupport.prototype.pl = function (cause) {
    this.sl(cause);
  };
  JobSupport.prototype.ql = function (parentJob) {
    this.sl(parentJob);
  };
  JobSupport.prototype.rl = function (cause) {
    if (cause instanceof CancellationException)
      return true;
    return this.sl(cause) ? this.yl() : false;
  };
  JobSupport.prototype.tu = function (cause) {
    return this.sl(cause);
  };
  JobSupport.prototype.sl = function (cause) {
    var finalState = get_COMPLETING_ALREADY();
    if (this.ml()) {
      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.vk(finalState);
      tmp = true;
    }
    return tmp;
  };
  JobSupport.prototype.tl = function (message, cause) {
    var tmp0_elvis_lhs = message;
    return new JobCancellationException(tmp0_elvis_lhs == null ? this.ok() : tmp0_elvis_lhs, cause, this);
  };
  JobSupport.prototype.ul = function () {
    var state = this.bl();
    var tmp0_subject = state;
    var tmp;
    if (tmp0_subject instanceof Finishing) {
      tmp = state.vt();
    } else {
      if (tmp0_subject instanceof CompletedExceptionally) {
        tmp = state.qk_1;
      } else {
        if (!(tmp0_subject == null) ? isInterface(tmp0_subject, Incomplete) : false) {
          var tmp0_error = 'Cannot be cancelling child in this state: ' + toString(state);
          throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
        } 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;
  };
  JobSupport.prototype.br = function (proposedUpdate) {
    {
      while (true) {
        var tmp$ret$0;
        $l$block: {
          var tmp0__anonymous__q1qw7t = this.bl();
          var finalState = tryMakeCompleting(this, tmp0__anonymous__q1qw7t, proposedUpdate);
          if (finalState === get_COMPLETING_ALREADY())
            return false;
          else if (finalState === get_COMPLETING_WAITING_CHILDREN())
            return true;
          else if (finalState === get_COMPLETING_RETRY()) {
            tmp$ret$0 = Unit_getInstance();
            break $l$block;
          } else {
            this.vk(finalState);
            return true;
          }
        }
      }
    }
  };
  JobSupport.prototype.tk = function (proposedUpdate) {
    {
      while (true) {
        var tmp$ret$0;
        $l$block: {
          var tmp0__anonymous__q1qw7t = this.bl();
          var finalState = tryMakeCompleting(this, tmp0__anonymous__q1qw7t, proposedUpdate);
          if (finalState === get_COMPLETING_ALREADY())
            throw IllegalStateException_init_$Create$_0('Job ' + this + ' is already complete or completing, ' + ('but is being completed with ' + toString(proposedUpdate)), _get_exceptionOrNull__b3j7js(proposedUpdate, this));
          else if (finalState === get_COMPLETING_RETRY()) {
            tmp$ret$0 = Unit_getInstance();
            break $l$block;
          } else
            return finalState;
        }
      }
    }
  };
  JobSupport.prototype.vl = function (child) {
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new ChildHandleNode(child);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    var tmp = this.kl(true, false, tmp$ret$1, 2, null);
    return isInterface(tmp, ChildHandle) ? tmp : THROW_CCE();
  };
  JobSupport.prototype.wk = function (exception) {
    throw exception;
  };
  JobSupport.prototype.wl = function (cause) {
  };
  JobSupport.prototype.xl = function () {
    return false;
  };
  JobSupport.prototype.yl = function () {
    return true;
  };
  JobSupport.prototype.zl = function (exception) {
    return false;
  };
  JobSupport.prototype.pk = function (state) {
  };
  JobSupport.prototype.vk = function (state) {
  };
  JobSupport.prototype.toString = function () {
    return this.am() + '@' + get_hexAddress(this);
  };
  JobSupport.prototype.am = function () {
    return this.xk() + '{' + stateString(this, this.bl()) + '}';
  };
  JobSupport.prototype.xk = function () {
    return get_classSimpleName(this);
  };
  JobSupport.prototype.dn = function ($cont) {
    $l$loop: while (true) {
      var state = this.bl();
      if (!(!(state == null) ? isInterface(state, Incomplete) : false)) {
        if (state instanceof CompletedExceptionally) {
          {
            var tmp0_recoverAndThrow = state.qk_1;
            throw tmp0_recoverAndThrow;
          }
        }
        return unboxState(state);
      }
      if (startInternal(this, state) >= 0)
        break $l$loop;
    }
    return awaitSuspend(this, $cont);
  };
  JobSupport.$metadata$ = classMeta('JobSupport', [Job, ChildJob, ParentJob, SelectClause0]);
  function boxIncomplete(_this__u8e3s4) {
    init_properties_JobSupport_kt_iaxwag();
    var tmp;
    if (!(_this__u8e3s4 == null) ? isInterface(_this__u8e3s4, Incomplete) : false) {
      tmp = new IncompleteStateBox(_this__u8e3s4);
    } else {
      tmp = _this__u8e3s4;
    }
    return tmp;
  }
  function JobCancellingNode() {
    JobNode.call(this);
  }
  JobCancellingNode.$metadata$ = classMeta('JobCancellingNode', undefined, undefined, undefined, undefined, JobNode.prototype);
  function get_FALSE() {
    return FALSE;
  }
  var FALSE;
  function get_TRUE() {
    return TRUE;
  }
  var TRUE;
  function InactiveNodeList(list) {
    this.rt_1 = list;
  }
  InactiveNodeList.prototype.ns = function () {
    return this.rt_1;
  };
  InactiveNodeList.prototype.lk = function () {
    return false;
  };
  InactiveNodeList.prototype.toString = function () {
    return get_DEBUG() ? this.rt_1.rs('New') : anyToString(this);
  };
  InactiveNodeList.$metadata$ = classMeta('InactiveNodeList', [Incomplete]);
  function ChildHandleNode(childJob) {
    JobCancellingNode.call(this);
    this.bu_1 = childJob;
  }
  ChildHandleNode.prototype.vn = function () {
    return this.jt();
  };
  ChildHandleNode.prototype.go = function (cause) {
    return this.bu_1.ql(this.jt());
  };
  ChildHandleNode.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ChildHandleNode.prototype.rl = function (cause) {
    return this.jt().rl(cause);
  };
  ChildHandleNode.$metadata$ = classMeta('ChildHandleNode', [ChildHandle], undefined, undefined, undefined, JobCancellingNode.prototype);
  function InvokeOnCancelling(handler) {
    JobCancellingNode.call(this);
    this.yu_1 = handler;
    this.zu_1 = atomic$int$1(0);
  }
  InvokeOnCancelling.prototype.go = function (cause) {
    if (this.zu_1.atomicfu$compareAndSet(0, 1))
      this.yu_1(cause);
  };
  InvokeOnCancelling.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  InvokeOnCancelling.$metadata$ = classMeta('InvokeOnCancelling', undefined, undefined, undefined, undefined, JobCancellingNode.prototype);
  function InvokeOnCompletion(handler) {
    JobNode.call(this);
    this.ev_1 = handler;
  }
  InvokeOnCompletion.prototype.go = function (cause) {
    return this.ev_1(cause);
  };
  InvokeOnCompletion.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  InvokeOnCompletion.$metadata$ = classMeta('InvokeOnCompletion', undefined, undefined, undefined, undefined, JobNode.prototype);
  function ResumeOnCompletion(continuation) {
    JobNode.call(this);
    this.jv_1 = continuation;
  }
  ResumeOnCompletion.prototype.go = function (cause) {
    var tmp$ret$1;
    {
      var tmp0_resume = this.jv_1;
      var tmp$ret$0;
      {
        var tmp0_success = Companion_getInstance();
        tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_getInstance());
      }
      tmp$ret$1 = tmp0_resume.v4(tmp$ret$0);
    }
    return tmp$ret$1;
  };
  ResumeOnCompletion.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ResumeOnCompletion.$metadata$ = classMeta('ResumeOnCompletion', undefined, undefined, undefined, undefined, JobNode.prototype);
  function unboxState(_this__u8e3s4) {
    init_properties_JobSupport_kt_iaxwag();
    var tmp0_safe_receiver = _this__u8e3s4 instanceof IncompleteStateBox ? _this__u8e3s4 : null;
    var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.kv_1;
    return tmp1_elvis_lhs == null ? _this__u8e3s4 : tmp1_elvis_lhs;
  }
  function ResumeAwaitOnCompletion(continuation) {
    JobNode.call(this);
    this.pv_1 = continuation;
  }
  ResumeAwaitOnCompletion.prototype.go = function (cause) {
    var state = this.jt().bl();
    {
    }
    if (state instanceof CompletedExceptionally) {
      var tmp$ret$1;
      {
        var tmp0_resumeWithException = this.pv_1;
        var tmp1_resumeWithException = state.qk_1;
        var tmp$ret$0;
        {
          var tmp0_failure = Companion_getInstance();
          tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(tmp1_resumeWithException));
        }
        tmp$ret$1 = tmp0_resumeWithException.v4(tmp$ret$0);
      }
    } else {
      var tmp$ret$3;
      {
        var tmp2_resume = this.pv_1;
        var tmp = unboxState(state);
        var tmp3_resume = (tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE();
        var tmp$ret$2;
        {
          var tmp0_success = Companion_getInstance();
          tmp$ret$2 = _Result___init__impl__xyqfz8(tmp3_resume);
        }
        tmp$ret$3 = tmp2_resume.v4(tmp$ret$2);
      }
    }
  };
  ResumeAwaitOnCompletion.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ResumeAwaitOnCompletion.$metadata$ = classMeta('ResumeAwaitOnCompletion', undefined, undefined, undefined, undefined, JobNode.prototype);
  function IncompleteStateBox(state) {
    this.kv_1 = state;
  }
  IncompleteStateBox.$metadata$ = classMeta('IncompleteStateBox');
  function ChildContinuation(child) {
    JobCancellingNode.call(this);
    this.uv_1 = child;
  }
  ChildContinuation.prototype.go = function (cause) {
    this.uv_1.aq(this.jt());
  };
  ChildContinuation.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ChildContinuation.$metadata$ = classMeta('ChildContinuation', undefined, undefined, undefined, undefined, JobCancellingNode.prototype);
  function handlesException($this, parent) {
    var $this_0 = $this;
    var parent_0 = parent;
    while (true) {
      var $this_1 = $this_0;
      var parent_1 = parent_0;
      var tmp0_elvis_lhs = parent_1 instanceof JobSupport ? parent_1 : null;
      var tmp;
      if (tmp0_elvis_lhs == null) {
        return false;
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var parentJob = tmp;
      if (parentJob.yl())
        return true;
      var tmp0 = $this_1;
      var tmp_0 = parentJob.al();
      var tmp1_safe_receiver = tmp_0 instanceof ChildHandleNode ? tmp_0 : null;
      var tmp1 = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.jt();
      $this_0 = tmp0;
      parent_0 = tmp1;
      continue;
    }
  }
  function JobImpl(parent) {
    JobSupport.call(this, true);
    this.xv_1 = handlesException(this, parent);
    this.ik(parent);
  }
  JobImpl.prototype.yl = function () {
    return this.xv_1;
  };
  JobImpl.prototype.ml = function () {
    return true;
  };
  JobImpl.prototype.cr = function () {
    return this.br(Unit_getInstance());
  };
  JobImpl.prototype.pq = function (exception) {
    return this.br(CompletedExceptionally_init_$Create$(exception, false, 2, null));
  };
  JobImpl.$metadata$ = classMeta('JobImpl', [CompletableJob], undefined, undefined, undefined, JobSupport.prototype);
  var properties_initialized_JobSupport_kt_5iq8a4;
  function init_properties_JobSupport_kt_iaxwag() {
    if (properties_initialized_JobSupport_kt_5iq8a4) {
    } else {
      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);
  }
  MainCoroutineDispatcher.prototype.toString = function () {
    var tmp0_elvis_lhs = this.aw();
    return tmp0_elvis_lhs == null ? get_classSimpleName(this) + '@' + get_hexAddress(this) : tmp0_elvis_lhs;
  };
  MainCoroutineDispatcher.prototype.aw = function () {
    var main = Dispatchers_getInstance().fw();
    if (this === main)
      return 'Dispatchers.Main';
    var tmp;
    try {
      tmp = main.zv();
    } catch ($p) {
      var tmp_0;
      if ($p instanceof UnsupportedOperationException) {
        tmp_0 = null;
      } else {
        throw $p;
      }
      tmp = tmp_0;
    }
    var immediate = tmp;
    if (this === immediate)
      return 'Dispatchers.Main.immediate';
    return null;
  };
  MainCoroutineDispatcher.$metadata$ = classMeta('MainCoroutineDispatcher', undefined, undefined, undefined, undefined, CoroutineDispatcher.prototype);
  function SupervisorJob(parent) {
    return new SupervisorJobImpl(parent);
  }
  function SupervisorJob$default(parent, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      parent = null;
    return SupervisorJob(parent);
  }
  function SupervisorJobImpl(parent) {
    JobImpl.call(this, parent);
  }
  SupervisorJobImpl.prototype.rl = function (cause) {
    return false;
  };
  SupervisorJobImpl.$metadata$ = classMeta('SupervisorJobImpl', undefined, undefined, undefined, undefined, JobImpl.prototype);
  function TimeoutCancellationException() {
  }
  TimeoutCancellationException.$metadata$ = classMeta('TimeoutCancellationException', [CopyableThrowable], undefined, undefined, undefined, CancellationException.prototype);
  function Unconfined() {
    Unconfined_instance = this;
    CoroutineDispatcher.call(this);
  }
  Unconfined.prototype.hr = function (context) {
    return false;
  };
  Unconfined.prototype.ir = function (context, block) {
    var yieldContext = context.y4(Key_getInstance_4());
    if (!(yieldContext == null)) {
      yieldContext.lw_1 = true;
      return Unit_getInstance();
    }
    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.');
  };
  Unconfined.prototype.toString = function () {
    return 'Dispatchers.Unconfined';
  };
  Unconfined.$metadata$ = objectMeta('Unconfined', undefined, undefined, undefined, undefined, CoroutineDispatcher.prototype);
  var Unconfined_instance;
  function Unconfined_getInstance() {
    if (Unconfined_instance == null)
      new Unconfined();
    return Unconfined_instance;
  }
  function Key_4() {
    Key_instance_3 = this;
  }
  Key_4.$metadata$ = objectMeta('Key', [Key]);
  var Key_instance_3;
  function Key_getInstance_4() {
    if (Key_instance_3 == null)
      new Key_4();
    return Key_instance_3;
  }
  function get_EMPTY() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return EMPTY;
  }
  var EMPTY;
  function get_OFFER_SUCCESS() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return OFFER_SUCCESS;
  }
  var OFFER_SUCCESS;
  function get_OFFER_FAILED() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return OFFER_FAILED;
  }
  var OFFER_FAILED;
  function get_POLL_FAILED() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return POLL_FAILED;
  }
  var POLL_FAILED;
  function get_ENQUEUE_FAILED() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return ENQUEUE_FAILED;
  }
  var ENQUEUE_FAILED;
  function get_HANDLER_INVOKED() {
    init_properties_AbstractChannel_kt_mjk5bh();
    return HANDLER_INVOKED;
  }
  var HANDLER_INVOKED;
  function hasNextResult($this, result) {
    if (result instanceof Closed) {
      if (!(result.pw_1 == null))
        throw recoverStackTrace_0(result.qw());
      return false;
    }
    return true;
  }
  function hasNextSuspend($this, $cont) {
    var tmp$ret$5;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = getOrCreateCancellableContinuation(intercepted(tmp0__anonymous__q1qw7t));
      var tmp$ret$0;
      $l$block_1: {
        var receive = new ReceiveHasNext($this, cancellable);
        while (true) {
          if (enqueueReceive($this.rw_1, receive)) {
            removeReceiveOnCancel($this.rw_1, cancellable, receive);
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
          var result = $this.rw_1.ww();
          $this.xw(result);
          if (result instanceof Closed) {
            if (result.pw_1 == null) {
              var tmp$ret$2;
              {
                var tmp$ret$1;
                {
                  var tmp0_success = Companion_getInstance();
                  tmp$ret$1 = _Result___init__impl__xyqfz8(false);
                }
                tmp$ret$2 = cancellable.v4(tmp$ret$1);
              }
            } else {
              var tmp$ret$4;
              {
                var tmp0_resumeWithException = result.qw();
                var tmp$ret$3;
                {
                  var tmp0_failure = Companion_getInstance();
                  tmp$ret$3 = _Result___init__impl__xyqfz8(createFailure(tmp0_resumeWithException));
                }
                tmp$ret$4 = cancellable.v4(tmp$ret$3);
              }
            }
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
          if (!(result === get_POLL_FAILED())) {
            var tmp0_safe_receiver = $this.rw_1.bx();
            var tmp;
            if (tmp0_safe_receiver == null) {
              tmp = null;
            } else {
              tmp = bindCancellationFun(tmp0_safe_receiver, (result == null ? true : isObject(result)) ? result : THROW_CCE(), cancellable.u4());
            }
            cancellable.eo(true, tmp);
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
        }
      }
      tmp$ret$5 = cancellable.km();
    }
    return tmp$ret$5;
  }
  function receiveSuspend($this, receiveMode, $cont) {
    var tmp$ret$1;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = getOrCreateCancellableContinuation(intercepted(tmp0__anonymous__q1qw7t));
      var tmp$ret$0;
      $l$block_1: {
        var tmp;
        if ($this.bx() == null) {
          tmp = new ReceiveElement(isInterface(cancellable, CancellableContinuation) ? cancellable : THROW_CCE(), receiveMode);
        } else {
          tmp = new ReceiveElementWithUndeliveredHandler(isInterface(cancellable, CancellableContinuation) ? cancellable : THROW_CCE(), receiveMode, $this.bx());
        }
        var receive = tmp;
        while (true) {
          if (enqueueReceive($this, receive)) {
            removeReceiveOnCancel($this, cancellable, receive);
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
          var result = $this.ww();
          if (result instanceof Closed) {
            receive.hx(result);
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
          if (!(result === get_POLL_FAILED())) {
            var tmp_0 = receive.ix((result == null ? true : isObject(result)) ? result : THROW_CCE());
            cancellable.eo(tmp_0, receive.mx((result == null ? true : isObject(result)) ? result : THROW_CCE()));
            tmp$ret$0 = Unit_getInstance();
            break $l$block_1;
          }
        }
      }
      tmp$ret$1 = cancellable.km();
    }
    return tmp$ret$1;
  }
  function enqueueReceive($this, receive) {
    var tmp$ret$0;
    {
      var tmp0_also = $this.nx(receive);
      {
      }
      {
        if (tmp0_also)
          $this.ox();
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  }
  function removeReceiveOnCancel($this, cont, receive) {
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new RemoveReceiveOnCancel($this, receive);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return cont.co(tmp$ret$1);
  }
  function RemoveReceiveOnCancel($outer, receive) {
    this.qx_1 = $outer;
    BeforeResumeCancelHandler.call(this);
    this.px_1 = receive;
  }
  RemoveReceiveOnCancel.prototype.go = function (cause) {
    if (this.px_1.bp())
      this.qx_1.rx();
  };
  RemoveReceiveOnCancel.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  RemoveReceiveOnCancel.prototype.toString = function () {
    return 'RemoveReceiveOnCancel[' + this.px_1 + ']';
  };
  RemoveReceiveOnCancel.$metadata$ = classMeta('RemoveReceiveOnCancel', undefined, undefined, undefined, undefined, BeforeResumeCancelHandler.prototype);
  function Itr(channel) {
    this.rw_1 = channel;
    this.sw_1 = atomic$ref$1(get_POLL_FAILED());
  }
  Itr.prototype.sx = function () {
    return this.rw_1;
  };
  Itr.prototype.xw = function (value) {
    this.sw_1.tj_1 = value;
  };
  Itr.prototype.tx = function () {
    return this.sw_1.tj_1;
  };
  Itr.prototype.ux = function ($cont) {
    if (!(this.tx() === get_POLL_FAILED()))
      return hasNextResult(this, this.tx());
    this.xw(this.rw_1.ww());
    if (!(this.tx() === get_POLL_FAILED()))
      return hasNextResult(this, this.tx());
    return hasNextSuspend(this, $cont);
  };
  Itr.prototype.i = function () {
    var result = this.tx();
    if (result instanceof Closed)
      throw recoverStackTrace_0(result.qw());
    if (!(result === get_POLL_FAILED())) {
      this.xw(get_POLL_FAILED());
      return (result == null ? true : isObject(result)) ? result : THROW_CCE();
    }
    throw IllegalStateException_init_$Create$("'hasNext' should be called prior to 'next' invocation");
  };
  Itr.$metadata$ = classMeta('Itr', [ChannelIterator]);
  function ReceiveElement(cont, receiveMode) {
    Receive.call(this);
    this.fx_1 = receiveMode;
    this.gx_1 = atomic$ref$1(cont);
  }
  ReceiveElement.prototype.ix = function (value) {
    var tmp0_subject = this.fx_1;
    return tmp0_subject === 1 ? new ChannelResult(Companion_getInstance_1().wx(value)) : value;
  };
  ReceiveElement.prototype.xx = function (value, otherOp) {
    var tmp1_safe_receiver = this.gx_1.tj_1;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp_0 = this.ix(value);
      var tmp0_safe_receiver = otherOp;
      tmp = tmp1_safe_receiver.zn(tmp_0, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.zx_1, this.mx(value));
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_1;
    if (tmp2_elvis_lhs == null) {
      return null;
    } else {
      tmp_1 = tmp2_elvis_lhs;
    }
    var token = tmp_1;
    {
    }
    var tmp3_safe_receiver = otherOp;
    if (tmp3_safe_receiver == null)
      null;
    else {
      tmp3_safe_receiver.by();
    }
    return get_RESUME_TOKEN();
  };
  ReceiveElement.prototype.cy = function (value) {
    ensureNotNull(this.gx_1.atomicfu$getAndSet(null)).bo(get_RESUME_TOKEN());
  };
  ReceiveElement.prototype.hx = function (closed) {
    var cont = ensureNotNull(this.gx_1.atomicfu$getAndSet(null));
    if (this.fx_1 === 1) {
      var tmp$ret$2;
      {
        var tmp$ret$0;
        {
          tmp$ret$0 = Companion_getInstance_1().dy(closed.pw_1);
        }
        var tmp0_resume = tmp$ret$0;
        var tmp$ret$1;
        {
          var tmp0_success = Companion_getInstance();
          tmp$ret$1 = _Result___init__impl__xyqfz8(new ChannelResult(tmp0_resume));
        }
        tmp$ret$2 = cont.v4(tmp$ret$1);
      }
    } else {
      var tmp$ret$4;
      {
        var tmp1_resumeWithException = closed.qw();
        var tmp$ret$3;
        {
          var tmp0_failure = Companion_getInstance();
          tmp$ret$3 = _Result___init__impl__xyqfz8(createFailure(tmp1_resumeWithException));
        }
        tmp$ret$4 = cont.v4(tmp$ret$3);
      }
    }
  };
  ReceiveElement.prototype.toString = function () {
    return 'ReceiveElement@' + get_hexAddress(this) + '[receiveMode=' + this.fx_1 + ']';
  };
  ReceiveElement.$metadata$ = classMeta('ReceiveElement', undefined, undefined, undefined, undefined, Receive.prototype);
  function ReceiveElementWithUndeliveredHandler(cont, receiveMode, onUndeliveredElement) {
    ReceiveElement.call(this, cont, receiveMode);
    this.ky_1 = onUndeliveredElement;
    this.ly_1 = cont.u4();
  }
  ReceiveElementWithUndeliveredHandler.prototype.mx = function (value) {
    return bindCancellationFun(this.ky_1, value, this.ly_1);
  };
  ReceiveElementWithUndeliveredHandler.$metadata$ = classMeta('ReceiveElementWithUndeliveredHandler', undefined, undefined, undefined, undefined, ReceiveElement.prototype);
  function ReceiveHasNext(iterator, cont) {
    Receive.call(this);
    this.py_1 = iterator;
    this.qy_1 = atomic$ref$1(cont);
    this.ry_1 = cont.u4();
  }
  ReceiveHasNext.prototype.xx = function (value, otherOp) {
    var tmp1_safe_receiver = this.qy_1.tj_1;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp0_safe_receiver = otherOp;
      tmp = tmp1_safe_receiver.zn(true, tmp0_safe_receiver == null ? null : tmp0_safe_receiver.zx_1, this.mx(value));
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_0;
    if (tmp2_elvis_lhs == null) {
      return null;
    } else {
      tmp_0 = tmp2_elvis_lhs;
    }
    var token = tmp_0;
    {
    }
    var tmp3_safe_receiver = otherOp;
    if (tmp3_safe_receiver == null)
      null;
    else {
      tmp3_safe_receiver.by();
    }
    return get_RESUME_TOKEN();
  };
  ReceiveHasNext.prototype.cy = function (value) {
    this.py_1.xw(value);
    ensureNotNull(this.qy_1.atomicfu$getAndSet(null)).bo(get_RESUME_TOKEN());
  };
  ReceiveHasNext.prototype.hx = function (closed) {
    var cont = ensureNotNull(this.qy_1.atomicfu$getAndSet(null));
    var tmp;
    if (closed.pw_1 == null) {
      tmp = cont.yn(false, null, 2, null);
    } else {
      tmp = cont.ao(closed.qw());
    }
    var token = tmp;
    if (!(token == null)) {
      this.py_1.xw(closed);
      cont.bo(token);
    }
  };
  ReceiveHasNext.prototype.mx = function (value) {
    var tmp0_safe_receiver = this.py_1.rw_1.bx();
    return tmp0_safe_receiver == null ? null : bindCancellationFun(tmp0_safe_receiver, value, this.ry_1);
  };
  ReceiveHasNext.prototype.toString = function () {
    return 'ReceiveHasNext@' + get_hexAddress(this);
  };
  ReceiveHasNext.$metadata$ = classMeta('ReceiveHasNext', undefined, undefined, undefined, undefined, Receive.prototype);
  function AbstractChannel(onUndeliveredElement) {
    AbstractSendChannel.call(this, onUndeliveredElement);
  }
  AbstractChannel.prototype.ww = function () {
    while (true) {
      var tmp0_elvis_lhs = this.uy();
      var tmp;
      if (tmp0_elvis_lhs == null) {
        return get_POLL_FAILED();
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var send = tmp;
      {
        {
        }
      }
      var token = send.yy(null);
      if (!(token == null)) {
        {
        }
        send.zy();
        return send.az();
      }
      send.bz();
    }
  };
  AbstractChannel.prototype.cz = function () {
    return !(this.dz() == null) ? this.ty() : false;
  };
  AbstractChannel.prototype.nx = function (receive) {
    var tmp;
    if (this.sy()) {
      var tmp$ret$1;
      $l$block: {
        var tmp0_addLastIfPrev = this.ez();
        var tmp$ret$0;
        {
          var tmp1__anonymous__uwfjfc = tmp0_addLastIfPrev.zo_1;
          tmp$ret$0 = !(tmp1__anonymous__uwfjfc instanceof Send);
        }
        if (!tmp$ret$0) {
          tmp$ret$1 = false;
          break $l$block;
        }
        tmp0_addLastIfPrev.zs(receive);
        tmp$ret$1 = true;
      }
      tmp = tmp$ret$1;
    } else {
      var tmp$ret$3;
      $l$block_1: {
        var tmp2_addLastIfPrevAndIf = this.ez();
        var tmp$ret$2;
        {
          var tmp3__anonymous__ufb84q = tmp2_addLastIfPrevAndIf.zo_1;
          tmp$ret$2 = !(tmp3__anonymous__ufb84q instanceof Send);
        }
        if (!tmp$ret$2) {
          tmp$ret$3 = false;
          break $l$block_1;
        }
        var tmp$ret$4;
        {
          tmp$ret$4 = this.ty();
        }
        if (!tmp$ret$4) {
          tmp$ret$3 = false;
          break $l$block_1;
        }
        tmp2_addLastIfPrevAndIf.zs(receive);
        tmp$ret$3 = true;
      }
      tmp = tmp$ret$3;
    }
    return tmp;
  };
  AbstractChannel.prototype.fz = function ($cont) {
    var result = this.ww();
    if (!(result === get_POLL_FAILED())) {
      var tmp$ret$0;
      {
        var tmp;
        if (result instanceof Closed) {
          tmp = Companion_getInstance_1().dy(result.pw_1);
        } else {
          var tmp_0 = Companion_getInstance_1();
          tmp = tmp_0.wx((result == null ? true : isObject(result)) ? result : THROW_CCE());
        }
        tmp$ret$0 = tmp;
      }
      return new ChannelResult(tmp$ret$0);
    }
    var tmp_1 = receiveSuspend(this, 1, $cont);
    if (tmp_1 === get_COROUTINE_SUSPENDED())
      return tmp_1;
    return new ChannelResult(tmp_1.gz_1);
  };
  AbstractChannel.prototype.nl = function (cause) {
    if (this.cz())
      return Unit_getInstance();
    var tmp0_elvis_lhs = cause;
    this.hz(tmp0_elvis_lhs == null ? CancellationException_init_$Create$(get_classSimpleName(this) + ' was cancelled') : tmp0_elvis_lhs);
  };
  AbstractChannel.prototype.hz = function (cause) {
    var tmp$ret$0;
    {
      var tmp0_also = this.iz(cause);
      {
      }
      {
        this.jz(tmp0_also);
        {
          {
          }
        }
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  };
  AbstractChannel.prototype.jz = function (wasClosed) {
    var tmp0_elvis_lhs = this.kz();
    var tmp;
    if (tmp0_elvis_lhs == null) {
      throw IllegalStateException_init_$Create$('Cannot happen');
    } else {
      tmp = tmp0_elvis_lhs;
    }
    var closed = tmp;
    var list = _InlineList___init__impl__z8n56_0(null, 1, null);
    $l$loop_0: while (true) {
      var tmp$ret$0;
      {
        tmp$ret$0 = closed.zo_1;
      }
      var previous = tmp$ret$0;
      var tmp_0;
      if (previous instanceof LinkedListHead) {
        tmp_0 = true;
      } else {
        tmp_0 = previous === closed;
      }
      if (tmp_0)
        break $l$loop_0;
      {
      }
      if (!previous.bp()) {
        previous.et();
        continue $l$loop_0;
      }
      var tmp_1 = list;
      list = InlineList__plus_impl_nuetvo(tmp_1, previous instanceof Send ? previous : THROW_CCE());
    }
    this.lz(list, closed);
  };
  AbstractChannel.prototype.lz = function (list, closed) {
    var tmp$ret$0;
    $l$block: {
      var tmp0_subject = _get_holder__f6h5pd(list);
      if (tmp0_subject == null) {
        tmp$ret$0 = Unit_getInstance();
        break $l$block;
      } else {
        if (!(tmp0_subject instanceof ArrayList)) {
          var tmp = _get_holder__f6h5pd(list);
          var tmp0__anonymous__q1qw7t = (tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE();
          tmp0__anonymous__q1qw7t.mz(closed);
        } else {
          var tmp_0 = _get_holder__f6h5pd(list);
          var list_0 = tmp_0 instanceof ArrayList ? tmp_0 : THROW_CCE();
          var inductionVariable = list_0.j() - 1 | 0;
          if (0 <= inductionVariable)
            do {
              var i = inductionVariable;
              inductionVariable = inductionVariable + -1 | 0;
              {
                var tmp1__anonymous__uwfjfc = list_0.l(i);
                tmp1__anonymous__uwfjfc.mz(closed);
              }
            }
             while (0 <= inductionVariable);
        }
      }
    }
  };
  AbstractChannel.prototype.g = function () {
    return new Itr(this);
  };
  AbstractChannel.prototype.nz = function () {
    var tmp$ret$0;
    {
      var tmp0_also = AbstractSendChannel.prototype.nz.call(this);
      {
      }
      {
        var tmp;
        if (!(tmp0_also == null)) {
          tmp = !(tmp0_also instanceof Closed);
        } else {
          tmp = false;
        }
        if (tmp)
          this.rx();
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  };
  AbstractChannel.prototype.ox = function () {
  };
  AbstractChannel.prototype.rx = function () {
  };
  AbstractChannel.$metadata$ = classMeta('AbstractChannel', [Channel], undefined, undefined, undefined, AbstractSendChannel.prototype);
  function _get_isFullImpl__v905xu($this) {
    var tmp;
    var tmp$ret$0;
    {
      var tmp0__get_nextNode__vg4li4 = $this.zw_1;
      tmp$ret$0 = tmp0__get_nextNode__vg4li4.yo_1;
    }
    var tmp_0 = tmp$ret$0;
    if (!isInterface(tmp_0, ReceiveOrClosed)) {
      tmp = $this.pz();
    } else {
      tmp = false;
    }
    return tmp;
  }
  function helpCloseAndGetSendException($this, closed) {
    helpClose($this, closed);
    return closed.b10();
  }
  function sendSuspend($this, element, $cont) {
    var tmp$ret$3;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = getOrCreateCancellableContinuation(intercepted(tmp0__anonymous__q1qw7t));
      var tmp$ret$0;
      $l$block_2: {
        loop: while (true) {
          if (_get_isFullImpl__v905xu($this)) {
            var send = $this.yw_1 == null ? new SendElement(element, cancellable) : new SendElementWithUndeliveredHandler(element, cancellable, $this.yw_1);
            var enqueueResult = $this.vz(send);
            if (enqueueResult == null) {
              removeOnCancellation(cancellable, send);
              tmp$ret$0 = Unit_getInstance();
              break $l$block_2;
            } else {
              if (enqueueResult instanceof Closed) {
                helpCloseAndResumeWithSendException(cancellable, $this, element, enqueueResult);
                tmp$ret$0 = Unit_getInstance();
                break $l$block_2;
              } else {
                if (enqueueResult === get_ENQUEUE_FAILED()) {
                } else {
                  if (enqueueResult instanceof Receive) {
                  } else {
                    var tmp0_error = 'enqueueSend returned ' + toString(enqueueResult);
                    throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
                  }
                }
              }
            }
          }
          var offerResult = $this.qz(element);
          if (offerResult === get_OFFER_SUCCESS()) {
            var tmp$ret$2;
            {
              var tmp$ret$1;
              {
                var tmp0_success = Companion_getInstance();
                tmp$ret$1 = _Result___init__impl__xyqfz8(Unit_getInstance());
              }
              tmp$ret$2 = cancellable.v4(tmp$ret$1);
            }
            tmp$ret$0 = Unit_getInstance();
            break $l$block_2;
          } else {
            if (offerResult === get_OFFER_FAILED())
              continue loop;
            else {
              if (offerResult instanceof Closed) {
                helpCloseAndResumeWithSendException(cancellable, $this, element, offerResult);
                tmp$ret$0 = Unit_getInstance();
                break $l$block_2;
              } else {
                var tmp1_error = 'offerInternal returned ' + toString_0(offerResult);
                throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
              }
            }
          }
        }
      }
      tmp$ret$3 = cancellable.km();
    }
    return tmp$ret$3;
  }
  function helpCloseAndResumeWithSendException(_this__u8e3s4, $this, element, closed) {
    helpClose($this, closed);
    var sendException = closed.b10();
    var tmp0_safe_receiver = $this.yw_1;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      tmp = callUndeliveredElementCatchingException$default(tmp0_safe_receiver, element, null, 2, null);
    }
    var tmp1_safe_receiver = tmp;
    if (tmp1_safe_receiver == null)
      null;
    else {
      var tmp$ret$2;
      {
        {
        }
        addSuppressed(tmp1_safe_receiver, sendException);
        var tmp$ret$1;
        {
          var tmp$ret$0;
          {
            var tmp0_failure = Companion_getInstance();
            tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(tmp1_safe_receiver));
          }
          tmp$ret$1 = _this__u8e3s4.v4(tmp$ret$0);
        }
        return Unit_getInstance();
      }
    }
    var tmp$ret$4;
    {
      var tmp$ret$3;
      {
        var tmp0_failure_0 = Companion_getInstance();
        tmp$ret$3 = _Result___init__impl__xyqfz8(createFailure(sendException));
      }
      tmp$ret$4 = _this__u8e3s4.v4(tmp$ret$3);
    }
  }
  function invokeOnCloseHandler($this, cause) {
    var handler = $this.ax_1.tj_1;
    if ((!(handler === null) ? !(handler === get_HANDLER_INVOKED()) : false) ? $this.ax_1.atomicfu$compareAndSet(handler, get_HANDLER_INVOKED()) : false) {
      ((!(handler == null) ? typeof handler === 'function' : false) ? handler : THROW_CCE())(cause);
    }
  }
  function helpClose($this, closed) {
    var closedList = _InlineList___init__impl__z8n56_0(null, 1, null);
    $l$loop_0: while (true) {
      var tmp$ret$0;
      {
        tmp$ret$0 = closed.zo_1;
      }
      var tmp = tmp$ret$0;
      var tmp0_elvis_lhs = tmp instanceof Receive ? tmp : null;
      var tmp_0;
      if (tmp0_elvis_lhs == null) {
        break $l$loop_0;
      } else {
        tmp_0 = tmp0_elvis_lhs;
      }
      var previous = tmp_0;
      if (!previous.bp()) {
        previous.et();
        continue $l$loop_0;
      }
      closedList = InlineList__plus_impl_nuetvo(closedList, previous);
    }
    var tmp$ret$1;
    $l$block: {
      var tmp0_forEachReversed = closedList;
      var tmp0_subject = _get_holder__f6h5pd(tmp0_forEachReversed);
      if (tmp0_subject == null) {
        tmp$ret$1 = Unit_getInstance();
        break $l$block;
      } else {
        if (!(tmp0_subject instanceof ArrayList)) {
          var tmp_1 = _get_holder__f6h5pd(tmp0_forEachReversed);
          var tmp1__anonymous__uwfjfc = (tmp_1 == null ? true : isObject(tmp_1)) ? tmp_1 : THROW_CCE();
          tmp1__anonymous__uwfjfc.hx(closed);
        } else {
          var tmp_2 = _get_holder__f6h5pd(tmp0_forEachReversed);
          var list = tmp_2 instanceof ArrayList ? tmp_2 : THROW_CCE();
          var inductionVariable = list.j() - 1 | 0;
          if (0 <= inductionVariable)
            do {
              var i = inductionVariable;
              inductionVariable = inductionVariable + -1 | 0;
              {
                var tmp2__anonymous__z9zvc9 = list.l(i);
                tmp2__anonymous__z9zvc9.hx(closed);
              }
            }
             while (0 <= inductionVariable);
        }
      }
    }
    $this.zz(closed);
    {
      {
      }
    }
  }
  function _get_queueDebugStateString__k7jj75($this) {
    var tmp$ret$0;
    {
      var tmp0__get_nextNode__vg4li4 = $this.zw_1;
      tmp$ret$0 = tmp0__get_nextNode__vg4li4.yo_1;
    }
    var head = tmp$ret$0;
    if (head === $this.zw_1)
      return 'EmptyQueue';
    var tmp0_subject = head;
    var tmp;
    if (tmp0_subject instanceof Closed) {
      tmp = toString_0(head);
    } else {
      if (tmp0_subject instanceof Receive) {
        tmp = 'ReceiveQueued';
      } else {
        if (tmp0_subject instanceof Send) {
          tmp = 'SendQueued';
        } else {
          tmp = 'UNEXPECTED:' + head;
        }
      }
    }
    var result = tmp;
    var tail = queueTail($this);
    if (!(tail === head)) {
      result = result + (',queueSize=' + countQueueSize($this));
      if (tail instanceof Closed)
        result = result + (',closedForSend=' + tail);
    }
    return result;
  }
  function queueTail($this) {
    var tmp$ret$0;
    {
      var tmp0__get_prevNode__2ljhpg = $this.zw_1;
      tmp$ret$0 = tmp0__get_prevNode__2ljhpg.zo_1;
    }
    var tail = tmp$ret$0;
    var tmp;
    if (tail === $this.zw_1) {
      var tmp$ret$1;
      {
        var tmp1__get_nextNode__n062t7 = $this.zw_1;
        tmp$ret$1 = tmp1__get_nextNode__n062t7.yo_1;
      }
      tmp = tmp$ret$1;
    } else {
      tmp = tail;
    }
    return tmp;
  }
  function countQueueSize($this) {
    var size = 0;
    {
      var tmp0_forEach = $this.zw_1;
      var cur = tmp0_forEach.ss();
      while (!equals(cur, tmp0_forEach)) {
        if (cur instanceof LinkedListNode) {
          var tmp1__anonymous__uwfjfc = cur;
          var tmp0 = size;
          size = tmp0 + 1 | 0;
        }
        cur = cur.yo_1;
      }
    }
    return size;
  }
  function SendBuffered(element) {
    Send.call(this);
    this.f10_1 = element;
  }
  SendBuffered.prototype.g10 = function () {
    return this.f10_1;
  };
  SendBuffered.prototype.az = function () {
    return this.f10_1;
  };
  SendBuffered.prototype.yy = function (otherOp) {
    var tmp$ret$0;
    {
      var tmp0_also = get_RESUME_TOKEN();
      {
      }
      {
        var tmp0_safe_receiver = otherOp;
        if (tmp0_safe_receiver == null)
          null;
        else {
          tmp0_safe_receiver.by();
        }
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  };
  SendBuffered.prototype.zy = function () {
  };
  SendBuffered.prototype.mz = function (closed) {
    {
    }
  };
  SendBuffered.prototype.toString = function () {
    return 'SendBuffered@' + get_hexAddress(this) + '(' + this.f10_1 + ')';
  };
  SendBuffered.$metadata$ = classMeta('SendBuffered', undefined, undefined, undefined, undefined, Send.prototype);
  function AbstractSendChannel(onUndeliveredElement) {
    this.yw_1 = onUndeliveredElement;
    this.zw_1 = new LinkedListHead();
    this.ax_1 = atomic$ref$1(null);
  }
  AbstractSendChannel.prototype.bx = function () {
    return this.yw_1;
  };
  AbstractSendChannel.prototype.ez = function () {
    return this.zw_1;
  };
  AbstractSendChannel.prototype.qz = function (element) {
    while (true) {
      var tmp0_elvis_lhs = this.nz();
      var tmp;
      if (tmp0_elvis_lhs == null) {
        return get_OFFER_FAILED();
      } else {
        tmp = tmp0_elvis_lhs;
      }
      var receive = tmp;
      var token = receive.xx(element, null);
      if (!(token == null)) {
        {
        }
        receive.cy(element);
        return receive.ey();
      }
    }
  };
  AbstractSendChannel.prototype.kz = function () {
    var tmp = queueTail(this);
    var tmp0_safe_receiver = tmp instanceof Closed ? tmp : null;
    var tmp_0;
    if (tmp0_safe_receiver == null) {
      tmp_0 = null;
    } else {
      var tmp$ret$0;
      {
        {
        }
        {
          helpClose(this, tmp0_safe_receiver);
        }
        tmp$ret$0 = tmp0_safe_receiver;
      }
      tmp_0 = tmp$ret$0;
    }
    return tmp_0;
  };
  AbstractSendChannel.prototype.dz = function () {
    var tmp$ret$0;
    {
      var tmp0__get_nextNode__vg4li4 = this.zw_1;
      tmp$ret$0 = tmp0__get_nextNode__vg4li4.yo_1;
    }
    var tmp = tmp$ret$0;
    var tmp0_safe_receiver = tmp instanceof Closed ? tmp : null;
    var tmp_0;
    if (tmp0_safe_receiver == null) {
      tmp_0 = null;
    } else {
      var tmp$ret$1;
      {
        {
        }
        {
          helpClose(this, tmp0_safe_receiver);
        }
        tmp$ret$1 = tmp0_safe_receiver;
      }
      tmp_0 = tmp$ret$1;
    }
    return tmp_0;
  };
  AbstractSendChannel.prototype.uy = function () {
    var tmp$ret$0;
    $l$block_1: {
      var tmp1_removeFirstIfIsInstanceOfOrPeekIf = this.zw_1;
      var next = tmp1_removeFirstIfIsInstanceOfOrPeekIf.yo_1;
      if (next === tmp1_removeFirstIfIsInstanceOfOrPeekIf) {
        tmp$ret$0 = null;
        break $l$block_1;
      }
      if (!(next instanceof Send)) {
        tmp$ret$0 = null;
        break $l$block_1;
      }
      var tmp$ret$1;
      {
        var tmp2__anonymous__z9zvc9 = next;
        tmp$ret$1 = tmp2__anonymous__z9zvc9 instanceof Closed;
      }
      if (tmp$ret$1) {
        tmp$ret$0 = next;
        break $l$block_1;
      }
      {
        var tmp0_check = next.at();
        {
        }
        if (!tmp0_check) {
          var tmp$ret$2;
          {
            tmp$ret$2 = 'Should remove';
          }
          var message = tmp$ret$2;
          throw IllegalStateException_init_$Create$(toString_0(message));
        }
      }
      tmp$ret$0 = next;
    }
    return tmp$ret$0;
  };
  AbstractSendChannel.prototype.h10 = function (element) {
    var tmp$ret$1;
    $l$block: {
      var tmp0_addLastIfPrev = this.zw_1;
      var tmp1_addLastIfPrev = new SendBuffered(element);
      var tmp$ret$0;
      {
        var tmp2__anonymous__z9zvc9 = tmp0_addLastIfPrev.zo_1;
        if (isInterface(tmp2__anonymous__z9zvc9, ReceiveOrClosed))
          return tmp2__anonymous__z9zvc9;
        tmp$ret$0 = true;
      }
      if (!tmp$ret$0) {
        tmp$ret$1 = false;
        break $l$block;
      }
      tmp0_addLastIfPrev.zs(tmp1_addLastIfPrev);
      tmp$ret$1 = true;
    }
    return null;
  };
  AbstractSendChannel.prototype.rz = function () {
    return !(this.kz() == null);
  };
  AbstractSendChannel.prototype.sz = function (element, $cont) {
    if (this.qz(element) === get_OFFER_SUCCESS())
      return Unit_getInstance();
    return sendSuspend(this, element, $cont);
  };
  AbstractSendChannel.prototype.tz = function (element) {
    try {
      return offer.call(this, element);
    } catch ($p) {
      if ($p instanceof Error) {
        var tmp0_safe_receiver = this.yw_1;
        var tmp;
        if (tmp0_safe_receiver == null) {
          tmp = null;
        } else {
          tmp = callUndeliveredElementCatchingException$default(tmp0_safe_receiver, element, null, 2, null);
        }
        var tmp1_safe_receiver = tmp;
        if (tmp1_safe_receiver == null)
          null;
        else {
          var tmp$ret$0;
          {
            {
            }
            addSuppressed(tmp1_safe_receiver, $p);
            throw tmp1_safe_receiver;
          }
        }
        throw $p;
      } else {
        throw $p;
      }
    }
  };
  AbstractSendChannel.prototype.uz = function (element) {
    var result = this.qz(element);
    var tmp;
    if (result === get_OFFER_SUCCESS()) {
      tmp = Companion_getInstance_1().wx(Unit_getInstance());
    } else {
      if (result === get_OFFER_FAILED()) {
        var tmp0_elvis_lhs = this.kz();
        var tmp_0;
        if (tmp0_elvis_lhs == null) {
          return Companion_getInstance_1().i10();
        } else {
          tmp_0 = tmp0_elvis_lhs;
        }
        var closedForSend = tmp_0;
        tmp = Companion_getInstance_1().dy(helpCloseAndGetSendException(this, closedForSend));
      } else {
        if (result instanceof Closed) {
          tmp = Companion_getInstance_1().dy(helpCloseAndGetSendException(this, result));
        } else {
          var tmp0_error = 'trySend returned ' + toString_0(result);
          throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
        }
      }
    }
    return tmp;
  };
  AbstractSendChannel.prototype.vz = function (send) {
    if (this.oz()) {
      var tmp$ret$1;
      $l$block: {
        var tmp0_addLastIfPrev = this.zw_1;
        var tmp$ret$0;
        {
          var tmp1__anonymous__uwfjfc = tmp0_addLastIfPrev.zo_1;
          if (isInterface(tmp1__anonymous__uwfjfc, ReceiveOrClosed))
            return tmp1__anonymous__uwfjfc;
          tmp$ret$0 = true;
        }
        if (!tmp$ret$0) {
          tmp$ret$1 = false;
          break $l$block;
        }
        tmp0_addLastIfPrev.zs(send);
        tmp$ret$1 = true;
      }
    } else {
      var tmp$ret$3;
      $l$block_1: {
        var tmp2_addLastIfPrevAndIf = this.zw_1;
        var tmp$ret$2;
        {
          var tmp3__anonymous__ufb84q = tmp2_addLastIfPrevAndIf.zo_1;
          if (isInterface(tmp3__anonymous__ufb84q, ReceiveOrClosed))
            return tmp3__anonymous__ufb84q;
          tmp$ret$2 = true;
        }
        if (!tmp$ret$2) {
          tmp$ret$3 = false;
          break $l$block_1;
        }
        var tmp$ret$4;
        {
          tmp$ret$4 = this.pz();
        }
        if (!tmp$ret$4) {
          tmp$ret$3 = false;
          break $l$block_1;
        }
        tmp2_addLastIfPrevAndIf.zs(send);
        tmp$ret$3 = true;
      }
      if (!tmp$ret$3)
        return get_ENQUEUE_FAILED();
    }
    return null;
  };
  AbstractSendChannel.prototype.iz = function (cause) {
    var closed = new Closed(cause);
    var tmp$ret$1;
    $l$block: {
      var tmp0_addLastIfPrev = this.zw_1;
      var tmp$ret$0;
      {
        var tmp1__anonymous__uwfjfc = tmp0_addLastIfPrev.zo_1;
        tmp$ret$0 = !(tmp1__anonymous__uwfjfc instanceof Closed);
      }
      if (!tmp$ret$0) {
        tmp$ret$1 = false;
        break $l$block;
      }
      tmp0_addLastIfPrev.zs(closed);
      tmp$ret$1 = true;
    }
    var closeAdded = tmp$ret$1;
    var tmp;
    if (closeAdded) {
      tmp = closed;
    } else {
      var tmp_0 = queueTail(this);
      tmp = tmp_0 instanceof Closed ? tmp_0 : THROW_CCE();
    }
    var actuallyClosed = tmp;
    {
    }
    helpClose(this, actuallyClosed);
    if (closeAdded)
      invokeOnCloseHandler(this, cause);
    return closeAdded;
  };
  AbstractSendChannel.prototype.xz = function (handler) {
    if (!this.ax_1.atomicfu$compareAndSet(null, handler)) {
      var value = this.ax_1.tj_1;
      if (value === get_HANDLER_INVOKED()) {
        throw IllegalStateException_init_$Create$('Another handler was already registered and successfully invoked');
      }
      throw IllegalStateException_init_$Create$('Another handler was already registered: ' + toString(value));
    } else {
      var closedToken = this.kz();
      if (!(closedToken == null) ? this.ax_1.atomicfu$compareAndSet(handler, get_HANDLER_INVOKED()) : false) {
        handler(closedToken.pw_1);
      }
    }
  };
  AbstractSendChannel.prototype.yz = function (closed) {
    {
    }
  };
  AbstractSendChannel.prototype.zz = function (closed) {
  };
  AbstractSendChannel.prototype.nz = function () {
    var tmp$ret$0;
    $l$block_1: {
      var tmp1_removeFirstIfIsInstanceOfOrPeekIf = this.zw_1;
      var next = tmp1_removeFirstIfIsInstanceOfOrPeekIf.yo_1;
      if (next === tmp1_removeFirstIfIsInstanceOfOrPeekIf) {
        tmp$ret$0 = null;
        break $l$block_1;
      }
      if (!isInterface(next, ReceiveOrClosed)) {
        tmp$ret$0 = null;
        break $l$block_1;
      }
      var tmp$ret$1;
      {
        var tmp2__anonymous__z9zvc9 = next;
        tmp$ret$1 = tmp2__anonymous__z9zvc9 instanceof Closed;
      }
      if (tmp$ret$1) {
        tmp$ret$0 = next;
        break $l$block_1;
      }
      {
        var tmp0_check = next.at();
        {
        }
        if (!tmp0_check) {
          var tmp$ret$2;
          {
            tmp$ret$2 = 'Should remove';
          }
          var message = tmp$ret$2;
          throw IllegalStateException_init_$Create$(toString_0(message));
        }
      }
      tmp$ret$0 = next;
    }
    return tmp$ret$0;
  };
  AbstractSendChannel.prototype.toString = function () {
    return get_classSimpleName(this) + '@' + get_hexAddress(this) + '{' + _get_queueDebugStateString__k7jj75(this) + '}' + this.a10();
  };
  AbstractSendChannel.prototype.a10 = function () {
    return '';
  };
  AbstractSendChannel.$metadata$ = classMeta('AbstractSendChannel', [SendChannel]);
  function Send() {
    LinkedListNode.call(this);
  }
  Send.prototype.bz = function () {
  };
  Send.$metadata$ = classMeta('Send', undefined, undefined, undefined, undefined, LinkedListNode.prototype);
  function Closed(closeCause) {
    Send.call(this);
    this.pw_1 = closeCause;
  }
  Closed.prototype.j10 = function () {
    return this.pw_1;
  };
  Closed.prototype.b10 = function () {
    var tmp0_elvis_lhs = this.pw_1;
    return tmp0_elvis_lhs == null ? new ClosedSendChannelException(get_DEFAULT_CLOSE_MESSAGE()) : tmp0_elvis_lhs;
  };
  Closed.prototype.qw = function () {
    var tmp0_elvis_lhs = this.pw_1;
    return tmp0_elvis_lhs == null ? new ClosedReceiveChannelException(get_DEFAULT_CLOSE_MESSAGE()) : tmp0_elvis_lhs;
  };
  Closed.prototype.ey = function () {
    return this;
  };
  Closed.prototype.az = function () {
    return this;
  };
  Closed.prototype.yy = function (otherOp) {
    var tmp$ret$0;
    {
      var tmp0_also = get_RESUME_TOKEN();
      {
      }
      {
        var tmp0_safe_receiver = otherOp;
        if (tmp0_safe_receiver == null)
          null;
        else {
          tmp0_safe_receiver.by();
        }
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  };
  Closed.prototype.zy = function () {
  };
  Closed.prototype.xx = function (value, otherOp) {
    var tmp$ret$0;
    {
      var tmp0_also = get_RESUME_TOKEN();
      {
      }
      {
        var tmp0_safe_receiver = otherOp;
        if (tmp0_safe_receiver == null)
          null;
        else {
          tmp0_safe_receiver.by();
        }
      }
      tmp$ret$0 = tmp0_also;
    }
    return tmp$ret$0;
  };
  Closed.prototype.cy = function (value) {
  };
  Closed.prototype.mz = function (closed) {
    return Unit_getInstance();
  };
  Closed.prototype.toString = function () {
    return 'Closed@' + get_hexAddress(this) + '[' + this.pw_1 + ']';
  };
  Closed.$metadata$ = classMeta('Closed', [ReceiveOrClosed], undefined, undefined, undefined, Send.prototype);
  function ReceiveOrClosed() {
  }
  ReceiveOrClosed.$metadata$ = interfaceMeta('ReceiveOrClosed');
  function Receive() {
    LinkedListNode.call(this);
  }
  Receive.prototype.ey = function () {
    return get_OFFER_SUCCESS();
  };
  Receive.prototype.mx = function (value) {
    return null;
  };
  Receive.$metadata$ = classMeta('Receive', [ReceiveOrClosed], undefined, undefined, undefined, LinkedListNode.prototype);
  function toResult(_this__u8e3s4) {
    init_properties_AbstractChannel_kt_mjk5bh();
    var tmp;
    if (_this__u8e3s4 instanceof Closed) {
      tmp = Companion_getInstance_1().dy(_this__u8e3s4.pw_1);
    } else {
      var tmp_0 = Companion_getInstance_1();
      tmp = tmp_0.wx((_this__u8e3s4 == null ? true : isObject(_this__u8e3s4)) ? _this__u8e3s4 : THROW_CCE());
    }
    return tmp;
  }
  function toResult_0(_this__u8e3s4) {
    init_properties_AbstractChannel_kt_mjk5bh();
    return Companion_getInstance_1().dy(_this__u8e3s4.pw_1);
  }
  function SendElement(pollResult, cont) {
    Send.call(this);
    this.n10_1 = pollResult;
    this.o10_1 = atomic$ref$1(cont);
  }
  SendElement.prototype.az = function () {
    return this.n10_1;
  };
  SendElement.prototype.yy = function (otherOp) {
    var tmp1_safe_receiver = this.o10_1.tj_1;
    var tmp;
    if (tmp1_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp0_safe_receiver = otherOp;
      tmp = tmp1_safe_receiver.xn(Unit_getInstance(), tmp0_safe_receiver == null ? null : tmp0_safe_receiver.zx_1);
    }
    var tmp2_elvis_lhs = tmp;
    var tmp_0;
    if (tmp2_elvis_lhs == null) {
      return null;
    } else {
      tmp_0 = tmp2_elvis_lhs;
    }
    var token = tmp_0;
    {
    }
    var tmp3_safe_receiver = otherOp;
    if (tmp3_safe_receiver == null)
      null;
    else {
      tmp3_safe_receiver.by();
    }
    return get_RESUME_TOKEN();
  };
  SendElement.prototype.zy = function () {
    ensureNotNull(this.o10_1.atomicfu$getAndSet(null)).bo(get_RESUME_TOKEN());
  };
  SendElement.prototype.mz = function (closed) {
    var tmp$ret$1;
    {
      var tmp0_resumeWithException = ensureNotNull(this.o10_1.atomicfu$getAndSet(null));
      var tmp1_resumeWithException = closed.b10();
      var tmp$ret$0;
      {
        var tmp0_failure = Companion_getInstance();
        tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(tmp1_resumeWithException));
      }
      tmp$ret$1 = tmp0_resumeWithException.v4(tmp$ret$0);
    }
  };
  SendElement.prototype.toString = function () {
    return 'SendElement@' + get_hexAddress(this) + '(' + toString(this.az()) + ')';
  };
  SendElement.$metadata$ = classMeta('SendElement', undefined, undefined, undefined, undefined, Send.prototype);
  function SendElementWithUndeliveredHandler(pollResult, cont, onUndeliveredElement) {
    SendElement.call(this, pollResult, cont);
    this.u10_1 = onUndeliveredElement;
    this.v10_1 = cont.u4();
  }
  SendElementWithUndeliveredHandler.prototype.bp = function () {
    if (!SendElement.prototype.bp.call(this))
      return false;
    this.bz();
    return true;
  };
  SendElementWithUndeliveredHandler.prototype.bz = function () {
    var tmp = this.az();
    callUndeliveredElement(this.u10_1, (tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE(), this.v10_1);
  };
  SendElementWithUndeliveredHandler.$metadata$ = classMeta('SendElementWithUndeliveredHandler', undefined, undefined, undefined, undefined, SendElement.prototype);
  var properties_initialized_AbstractChannel_kt_uwqnpt;
  function init_properties_AbstractChannel_kt_mjk5bh() {
    if (properties_initialized_AbstractChannel_kt_uwqnpt) {
    } else {
      properties_initialized_AbstractChannel_kt_uwqnpt = true;
      EMPTY = new Symbol('EMPTY');
      OFFER_SUCCESS = new Symbol('OFFER_SUCCESS');
      OFFER_FAILED = new Symbol('OFFER_FAILED');
      POLL_FAILED = new Symbol('POLL_FAILED');
      ENQUEUE_FAILED = new Symbol('ENQUEUE_FAILED');
      HANDLER_INVOKED = new Symbol('ON_CLOSE_HANDLER_INVOKED');
    }
  }
  function updateBufferSize($this, currentSize) {
    if (currentSize < $this.c11_1) {
      $this.e11_1.y10_1 = currentSize + 1 | 0;
      return null;
    }
    var tmp0_subject = $this.d11_1;
    var tmp0 = tmp0_subject.lh();
    var tmp;
    switch (tmp0) {
      case 0:
        tmp = get_OFFER_FAILED();
        break;
      case 2:
        tmp = get_OFFER_SUCCESS();
        break;
      case 1:
        tmp = null;
        break;
      default:
        noWhenBranchMatchedException();
        break;
    }
    return tmp;
  }
  function enqueueElement($this, currentSize, element) {
    if (currentSize < $this.c11_1) {
      $this.e11_1.i11(currentSize, $this.c11_1);
      $this.e11_1.h11(($this.e11_1.x10_1 + currentSize | 0) % $this.e11_1.g11() | 0, element);
    } else {
      {
      }
      $this.e11_1.h11($this.e11_1.x10_1 % $this.e11_1.g11() | 0, null);
      $this.e11_1.h11(($this.e11_1.x10_1 + currentSize | 0) % $this.e11_1.g11() | 0, element);
      $this.e11_1.x10_1 = ($this.e11_1.x10_1 + 1 | 0) % $this.e11_1.g11() | 0;
    }
  }
  function ArrayChannel(capacity, onBufferOverflow, onUndeliveredElement) {
    AbstractChannel.call(this, onUndeliveredElement);
    this.c11_1 = capacity;
    this.d11_1 = onBufferOverflow;
    {
      var tmp0_require = this.c11_1 >= 1;
      {
      }
      if (!tmp0_require) {
        var tmp$ret$0;
        {
          tmp$ret$0 = 'ArrayChannel capacity must be at least 1, but ' + this.c11_1 + ' was specified';
        }
        var message = tmp$ret$0;
        throw IllegalArgumentException_init_$Create$(toString_0(message));
      }
    }
    var tmp = this;
    var tmp$ret$1;
    {
      var tmp0_min = this.c11_1;
      tmp$ret$1 = Math.min(tmp0_min, 8);
    }
    tmp.e11_1 = new ArrayChannelState(tmp$ret$1);
  }
  ArrayChannel.prototype.sy = function () {
    return false;
  };
  ArrayChannel.prototype.ty = function () {
    return this.e11_1.y10_1 === 0;
  };
  ArrayChannel.prototype.oz = function () {
    return false;
  };
  ArrayChannel.prototype.pz = function () {
    return this.e11_1.y10_1 === this.c11_1;
  };
  ArrayChannel.prototype.cz = function () {
    var tmp$ret$1;
    {
      var tmp0_withLock = this.e11_1;
      var tmp$ret$0;
      {
        tmp$ret$0 = AbstractChannel.prototype.cz.call(this);
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return tmp$ret$1;
  };
  ArrayChannel.prototype.qz = function (element) {
    var receive = null;
    var tmp$ret$3;
    {
      var tmp0_withLock = this.e11_1;
      var tmp$ret$2;
      $l$block: {
        var size = this.e11_1.y10_1;
        var tmp0_safe_receiver = this.kz();
        if (tmp0_safe_receiver == null)
          null;
        else {
          var tmp$ret$0;
          {
            {
            }
            return tmp0_safe_receiver;
          }
        }
        var tmp1_safe_receiver = updateBufferSize(this, size);
        if (tmp1_safe_receiver == null)
          null;
        else {
          var tmp$ret$1;
          {
            {
            }
            return tmp1_safe_receiver;
          }
        }
        if (size === 0) {
          loop: while (true) {
            var tmp2_elvis_lhs = this.nz();
            var tmp;
            if (tmp2_elvis_lhs == null) {
              break loop;
            } else {
              tmp = tmp2_elvis_lhs;
            }
            receive = tmp;
            if (receive instanceof Closed) {
              this.e11_1.y10_1 = size;
              return ensureNotNull(receive);
            }
            var token = ensureNotNull(receive).xx(element, null);
            if (!(token == null)) {
              {
              }
              this.e11_1.y10_1 = size;
              tmp$ret$2 = Unit_getInstance();
              break $l$block;
            }
          }
        }
        enqueueElement(this, size, element);
        return get_OFFER_SUCCESS();
      }
      tmp$ret$3 = tmp$ret$2;
    }
    ensureNotNull(receive).cy(element);
    return ensureNotNull(receive).ey();
  };
  ArrayChannel.prototype.vz = function (send) {
    var tmp$ret$1;
    {
      var tmp0_withLock = this.e11_1;
      var tmp$ret$0;
      {
        tmp$ret$0 = AbstractChannel.prototype.vz.call(this, send);
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return tmp$ret$1;
  };
  ArrayChannel.prototype.ww = function () {
    var send = null;
    var resumed = false;
    var result = null;
    var tmp$ret$0;
    {
      var tmp0_withLock = this.e11_1;
      var size = this.e11_1.y10_1;
      if (size === 0) {
        var tmp0_elvis_lhs = this.kz();
        return tmp0_elvis_lhs == null ? get_POLL_FAILED() : tmp0_elvis_lhs;
      }
      result = this.e11_1.j11(this.e11_1.x10_1);
      this.e11_1.h11(this.e11_1.x10_1, null);
      this.e11_1.y10_1 = size - 1 | 0;
      var replacement = get_POLL_FAILED();
      if (size === this.c11_1) {
        loop: while (true) {
          var tmp1_elvis_lhs = this.uy();
          var tmp;
          if (tmp1_elvis_lhs == null) {
            break loop;
          } else {
            tmp = tmp1_elvis_lhs;
          }
          send = tmp;
          {
            {
            }
          }
          var token = ensureNotNull(send).yy(null);
          if (!(token == null)) {
            {
            }
            resumed = true;
            replacement = ensureNotNull(send).az();
            break loop;
          }
          ensureNotNull(send).bz();
        }
      }
      var tmp_0;
      if (!(replacement === get_POLL_FAILED())) {
        tmp_0 = !(replacement instanceof Closed);
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        this.e11_1.y10_1 = size;
        this.e11_1.h11((this.e11_1.x10_1 + size | 0) % this.e11_1.g11() | 0, replacement);
      }
      this.e11_1.x10_1 = (this.e11_1.x10_1 + 1 | 0) % this.e11_1.g11() | 0;
      tmp$ret$0 = Unit_getInstance();
    }
    if (resumed)
      ensureNotNull(send).zy();
    return result;
  };
  ArrayChannel.prototype.nx = function (receive) {
    var tmp$ret$1;
    {
      var tmp0_withLock = this.e11_1;
      var tmp$ret$0;
      {
        tmp$ret$0 = AbstractChannel.prototype.nx.call(this, receive);
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return tmp$ret$1;
  };
  ArrayChannel.prototype.jz = function (wasClosed) {
    var onUndeliveredElement = this.bx();
    var undeliveredElementException = null;
    var tmp$ret$0;
    {
      var tmp0_withLock = this.e11_1;
      {
        var tmp0_repeat = this.e11_1.y10_1;
        {
        }
        var inductionVariable = 0;
        if (inductionVariable < tmp0_repeat)
          do {
            var index = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            {
              var value = this.e11_1.j11(this.e11_1.x10_1);
              if (!(onUndeliveredElement == null) ? !(value === get_EMPTY()) : false) {
                undeliveredElementException = callUndeliveredElementCatchingException(onUndeliveredElement, (value == null ? true : isObject(value)) ? value : THROW_CCE(), undeliveredElementException);
              }
              this.e11_1.h11(this.e11_1.x10_1, null);
              this.e11_1.x10_1 = (this.e11_1.x10_1 + 1 | 0) % this.e11_1.g11() | 0;
            }
          }
           while (inductionVariable < tmp0_repeat);
      }
      this.e11_1.y10_1 = 0;
      tmp$ret$0 = Unit_getInstance();
    }
    AbstractChannel.prototype.jz.call(this, wasClosed);
    var tmp0_safe_receiver = undeliveredElementException;
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        throw tmp0_safe_receiver;
      }
    }
  };
  ArrayChannel.prototype.a10 = function () {
    var tmp$ret$1;
    {
      var tmp0_withLock = this.e11_1;
      var tmp$ret$0;
      {
        tmp$ret$0 = '(buffer:capacity=' + this.c11_1 + ',size=' + this.e11_1.y10_1 + ')';
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return tmp$ret$1;
  };
  ArrayChannel.$metadata$ = classMeta('ArrayChannel', undefined, undefined, undefined, undefined, AbstractChannel.prototype);
  var BufferOverflow_SUSPEND_instance;
  var BufferOverflow_DROP_OLDEST_instance;
  var BufferOverflow_DROP_LATEST_instance;
  var BufferOverflow_entriesInitialized;
  function BufferOverflow_initEntries() {
    if (BufferOverflow_entriesInitialized)
      return Unit_getInstance();
    BufferOverflow_entriesInitialized = true;
    BufferOverflow_SUSPEND_instance = new BufferOverflow('SUSPEND', 0);
    BufferOverflow_DROP_OLDEST_instance = new BufferOverflow('DROP_OLDEST', 1);
    BufferOverflow_DROP_LATEST_instance = new BufferOverflow('DROP_LATEST', 2);
  }
  function BufferOverflow(name, ordinal) {
    Enum.call(this, name, ordinal);
  }
  BufferOverflow.$metadata$ = classMeta('BufferOverflow', undefined, undefined, undefined, undefined, Enum.prototype);
  function BufferOverflow_SUSPEND_getInstance() {
    BufferOverflow_initEntries();
    return BufferOverflow_SUSPEND_instance;
  }
  function BufferOverflow_DROP_OLDEST_getInstance() {
    BufferOverflow_initEntries();
    return BufferOverflow_DROP_OLDEST_instance;
  }
  function SendChannel() {
  }
  SendChannel.$metadata$ = interfaceMeta('SendChannel');
  function _ChannelResult___init__impl__siwsuf(holder) {
    return holder;
  }
  function _ChannelResult___get_holder__impl__pm9gzw($this) {
    return $this;
  }
  function _ChannelResult___get_isSuccess__impl__odq1z9($this) {
    var tmp = _ChannelResult___get_holder__impl__pm9gzw($this);
    return !(tmp instanceof Failed);
  }
  function _ChannelResult___get_isClosed__impl__mg7kuu($this) {
    var tmp = _ChannelResult___get_holder__impl__pm9gzw($this);
    return tmp instanceof Closed_0;
  }
  function ChannelResult__getOrThrow_impl_od1axs($this) {
    var tmp = _ChannelResult___get_holder__impl__pm9gzw($this);
    if (!(tmp instanceof Failed)) {
      var tmp_0 = _ChannelResult___get_holder__impl__pm9gzw($this);
      return (tmp_0 == null ? true : isObject(tmp_0)) ? tmp_0 : THROW_CCE();
    }
    var tmp_1;
    var tmp_2 = _ChannelResult___get_holder__impl__pm9gzw($this);
    if (tmp_2 instanceof Closed_0) {
      tmp_1 = !(_ChannelResult___get_holder__impl__pm9gzw($this).k11_1 == null);
    } else {
      tmp_1 = false;
    }
    if (tmp_1)
      throw _ChannelResult___get_holder__impl__pm9gzw($this).k11_1;
    {
      var tmp0_error = "Trying to call 'getOrThrow' on a failed channel result: " + toString(_ChannelResult___get_holder__impl__pm9gzw($this));
      throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
    }
  }
  function ChannelResult__exceptionOrNull_impl_16ei30($this) {
    var tmp = _ChannelResult___get_holder__impl__pm9gzw($this);
    var tmp0_safe_receiver = tmp instanceof Closed_0 ? tmp : null;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.k11_1;
  }
  function Failed() {
  }
  Failed.prototype.toString = function () {
    return 'Failed';
  };
  Failed.$metadata$ = classMeta('Failed');
  function Closed_0(cause) {
    Failed.call(this);
    this.k11_1 = cause;
  }
  Closed_0.prototype.equals = function (other) {
    var tmp;
    if (other instanceof Closed_0) {
      tmp = equals(this.k11_1, other.k11_1);
    } else {
      tmp = false;
    }
    return tmp;
  };
  Closed_0.prototype.hashCode = function () {
    var tmp$ret$0;
    {
      var tmp0_hashCode = this.k11_1;
      var tmp0_safe_receiver = tmp0_hashCode;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver);
      tmp$ret$0 = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs;
    }
    return tmp$ret$0;
  };
  Closed_0.prototype.toString = function () {
    return 'Closed(' + this.k11_1 + ')';
  };
  Closed_0.$metadata$ = classMeta('Closed', undefined, undefined, undefined, undefined, Failed.prototype);
  function Companion() {
    Companion_instance = this;
    this.vx_1 = new Failed();
  }
  Companion.prototype.wx = function (value) {
    return _ChannelResult___init__impl__siwsuf(value);
  };
  Companion.prototype.i10 = function () {
    return _ChannelResult___init__impl__siwsuf(this.vx_1);
  };
  Companion.prototype.dy = function (cause) {
    return _ChannelResult___init__impl__siwsuf(new Closed_0(cause));
  };
  Companion.$metadata$ = objectMeta('Companion');
  var Companion_instance;
  function Companion_getInstance_1() {
    if (Companion_instance == null)
      new Companion();
    return Companion_instance;
  }
  function ChannelResult__toString_impl_rrcqu7($this) {
    var tmp0_subject = _ChannelResult___get_holder__impl__pm9gzw($this);
    var tmp;
    if (tmp0_subject instanceof Closed_0) {
      tmp = toString_0(_ChannelResult___get_holder__impl__pm9gzw($this));
    } else {
      tmp = 'Value(' + toString(_ChannelResult___get_holder__impl__pm9gzw($this)) + ')';
    }
    return tmp;
  }
  function ChannelResult__hashCode_impl_lilec2($this) {
    return $this == null ? 0 : hashCode($this);
  }
  function ChannelResult__equals_impl_f471ri($this, other) {
    if (!(other instanceof ChannelResult))
      return false;
    var tmp0_other_with_cast = other instanceof ChannelResult ? other.gz_1 : THROW_CCE();
    if (!equals($this, tmp0_other_with_cast))
      return false;
    return true;
  }
  function ChannelResult(holder) {
    Companion_getInstance_1();
    this.gz_1 = holder;
  }
  ChannelResult.prototype.toString = function () {
    return ChannelResult__toString_impl_rrcqu7(this.gz_1);
  };
  ChannelResult.prototype.hashCode = function () {
    return ChannelResult__hashCode_impl_lilec2(this.gz_1);
  };
  ChannelResult.prototype.equals = function (other) {
    return ChannelResult__equals_impl_f471ri(this.gz_1, other);
  };
  ChannelResult.$metadata$ = classMeta('ChannelResult');
  function Factory() {
    Factory_instance = this;
    this.l11_1 = 2147483647;
    this.m11_1 = 0;
    this.n11_1 = -1;
    this.o11_1 = -2;
    this.p11_1 = -3;
    this.q11_1 = 'kotlinx.coroutines.channels.defaultBuffer';
    this.r11_1 = systemProp('kotlinx.coroutines.channels.defaultBuffer', 64, 1, 2147483646);
  }
  Factory.$metadata$ = objectMeta('Factory');
  var Factory_instance;
  function Factory_getInstance() {
    if (Factory_instance == null)
      new Factory();
    return Factory_instance;
  }
  function Channel() {
  }
  Channel.$metadata$ = interfaceMeta('Channel', [SendChannel, ReceiveChannel]);
  function ReceiveChannel() {
  }
  ReceiveChannel.$metadata$ = interfaceMeta('ReceiveChannel');
  function ChannelIterator() {
  }
  ChannelIterator.$metadata$ = interfaceMeta('ChannelIterator');
  function ClosedReceiveChannelException(message) {
    NoSuchElementException_init_$Init$(message, this);
    captureStack(this, ClosedReceiveChannelException);
  }
  ClosedReceiveChannelException.$metadata$ = classMeta('ClosedReceiveChannelException', undefined, undefined, undefined, undefined, NoSuchElementException.prototype);
  function Channel_0(capacity, onBufferOverflow, onUndeliveredElement) {
    var tmp0_subject = capacity;
    var tmp;
    Factory_getInstance();
    if (tmp0_subject === 0) {
      tmp = onBufferOverflow.equals(BufferOverflow_SUSPEND_getInstance()) ? new RendezvousChannel(onUndeliveredElement) : new ArrayChannel(1, onBufferOverflow, onUndeliveredElement);
    } else {
      Factory_getInstance();
      if (tmp0_subject === -1) {
        {
          var tmp0_require = onBufferOverflow.equals(BufferOverflow_SUSPEND_getInstance());
          {
          }
          if (!tmp0_require) {
            var tmp$ret$0;
            {
              tmp$ret$0 = 'CONFLATED capacity cannot be used with non-default onBufferOverflow';
            }
            var message = tmp$ret$0;
            throw IllegalArgumentException_init_$Create$(toString_0(message));
          }
        }
        tmp = new ConflatedChannel(onUndeliveredElement);
      } else {
        Factory_getInstance();
        if (tmp0_subject === 2147483647) {
          tmp = new LinkedListChannel(onUndeliveredElement);
        } else {
          Factory_getInstance();
          if (tmp0_subject === -2) {
            tmp = new ArrayChannel(onBufferOverflow.equals(BufferOverflow_SUSPEND_getInstance()) ? Factory_getInstance().r11_1 : 1, onBufferOverflow, onUndeliveredElement);
          } else {
            tmp = (capacity === 1 ? onBufferOverflow.equals(BufferOverflow_DROP_OLDEST_getInstance()) : false) ? new ConflatedChannel(onUndeliveredElement) : new ArrayChannel(capacity, onBufferOverflow, onUndeliveredElement);
          }
        }
      }
    }
    return tmp;
  }
  function Channel$default(capacity, onBufferOverflow, onUndeliveredElement, $mask0, $handler) {
    if (!(($mask0 & 1) === 0)) {
      Factory_getInstance();
      capacity = 0;
    }
    if (!(($mask0 & 2) === 0))
      onBufferOverflow = BufferOverflow_SUSPEND_getInstance();
    if (!(($mask0 & 4) === 0))
      onUndeliveredElement = null;
    return Channel_0(capacity, onBufferOverflow, onUndeliveredElement);
  }
  function ClosedSendChannelException(message) {
    IllegalStateException_init_$Init$(message, this);
    captureStack(this, ClosedSendChannelException);
  }
  ClosedSendChannelException.$metadata$ = classMeta('ClosedSendChannelException', undefined, undefined, undefined, undefined, IllegalStateException.prototype);
  function ChannelCoroutine(parentContext, _channel, initParentJob, active) {
    AbstractCoroutine.call(this, parentContext, initParentJob, active);
    this.w11_1 = _channel;
  }
  ChannelCoroutine.prototype.x11 = function () {
    return this.w11_1;
  };
  ChannelCoroutine.prototype.rz = function () {
    return this.w11_1.rz();
  };
  ChannelCoroutine.prototype.iz = function (cause) {
    return this.w11_1.iz(cause);
  };
  ChannelCoroutine.prototype.xz = function (handler) {
    this.w11_1.xz(handler);
  };
  ChannelCoroutine.prototype.g = function () {
    return this.w11_1.g();
  };
  ChannelCoroutine.prototype.tz = function (element) {
    return this.w11_1.tz(element);
  };
  ChannelCoroutine.prototype.fz = function ($cont) {
    var tmp = this.w11_1.fz($cont);
    if (tmp === get_COROUTINE_SUSPENDED())
      return tmp;
    return new ChannelResult(tmp.gz_1);
  };
  ChannelCoroutine.prototype.sz = function (element, $cont) {
    return this.w11_1.sz(element, $cont);
  };
  ChannelCoroutine.prototype.uz = function (element) {
    return this.w11_1.uz(element);
  };
  ChannelCoroutine.prototype.sx = function () {
    return this;
  };
  ChannelCoroutine.prototype.nl = function (cause) {
    if (this.wn())
      return Unit_getInstance();
    var tmp0_elvis_lhs = cause;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$0;
      {
        var tmp0_elvis_lhs_0 = null;
        tmp$ret$0 = new JobCancellationException(tmp0_elvis_lhs_0 == null ? this.ok() : tmp0_elvis_lhs_0, null, this);
      }
      tmp = tmp$ret$0;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    this.pl(tmp);
  };
  ChannelCoroutine.prototype.pl = function (cause) {
    var exception = this.hl(cause, null, 1, null);
    this.w11_1.nl(exception);
    this.tu(exception);
  };
  ChannelCoroutine.$metadata$ = classMeta('ChannelCoroutine', [Channel], undefined, undefined, undefined, AbstractCoroutine.prototype);
  function get_DEFAULT_CLOSE_MESSAGE() {
    return DEFAULT_CLOSE_MESSAGE;
  }
  var DEFAULT_CLOSE_MESSAGE;
  function cancelConsumed(_this__u8e3s4, cause) {
    var tmp0_safe_receiver = cause;
    var tmp;
    if (tmp0_safe_receiver == null) {
      tmp = null;
    } else {
      var tmp$ret$1;
      {
        {
        }
        var tmp$ret$0;
        {
          var tmp0_elvis_lhs = tmp0_safe_receiver instanceof CancellationException ? tmp0_safe_receiver : null;
          tmp$ret$0 = tmp0_elvis_lhs == null ? CancellationException_init_$Create$_0('Channel was consumed, consumer had failed', tmp0_safe_receiver) : tmp0_elvis_lhs;
        }
        tmp$ret$1 = tmp$ret$0;
      }
      tmp = tmp$ret$1;
    }
    _this__u8e3s4.nl(tmp);
  }
  function updateValueLocked($this, element) {
    var old = $this.c12_1.y11_1;
    var tmp;
    if (old === get_EMPTY()) {
      tmp = null;
    } else {
      var tmp0_safe_receiver = $this.bx();
      var tmp_0;
      if (tmp0_safe_receiver == null) {
        tmp_0 = null;
      } else {
        var tmp_1 = (old == null ? true : isObject(old)) ? old : THROW_CCE();
        tmp_0 = callUndeliveredElementCatchingException$default(tmp0_safe_receiver, tmp_1, null, 2, null);
      }
      tmp = tmp_0;
    }
    var undeliveredElementException = tmp;
    $this.c12_1.y11_1 = element;
    return undeliveredElementException;
  }
  function ConflatedChannel(onUndeliveredElement) {
    AbstractChannel.call(this, onUndeliveredElement);
    this.c12_1 = new ConflatedChannelState();
  }
  ConflatedChannel.prototype.sy = function () {
    return false;
  };
  ConflatedChannel.prototype.ty = function () {
    return this.c12_1.y11_1 === get_EMPTY();
  };
  ConflatedChannel.prototype.oz = function () {
    return false;
  };
  ConflatedChannel.prototype.pz = function () {
    return false;
  };
  ConflatedChannel.prototype.qz = function (element) {
    var receive = null;
    var tmp$ret$3;
    {
      var tmp0_withLock = this.c12_1;
      var tmp$ret$1;
      $l$block: {
        var tmp0_safe_receiver = this.kz();
        if (tmp0_safe_receiver == null)
          null;
        else {
          var tmp$ret$0;
          {
            {
            }
            return tmp0_safe_receiver;
          }
        }
        if (this.c12_1.y11_1 === get_EMPTY()) {
          loop: while (true) {
            var tmp1_elvis_lhs = this.nz();
            var tmp;
            if (tmp1_elvis_lhs == null) {
              break loop;
            } else {
              tmp = tmp1_elvis_lhs;
            }
            receive = tmp;
            if (receive instanceof Closed) {
              return ensureNotNull(receive);
            }
            var token = ensureNotNull(receive).xx(element, null);
            if (!(token == null)) {
              {
              }
              tmp$ret$1 = Unit_getInstance();
              break $l$block;
            }
          }
        }
        var tmp2_safe_receiver = updateValueLocked(this, element);
        if (tmp2_safe_receiver == null)
          null;
        else {
          var tmp$ret$2;
          {
            {
            }
            throw tmp2_safe_receiver;
          }
        }
        return get_OFFER_SUCCESS();
      }
      tmp$ret$3 = tmp$ret$1;
    }
    ensureNotNull(receive).cy(element);
    return ensureNotNull(receive).ey();
  };
  ConflatedChannel.prototype.ww = function () {
    var result = null;
    var tmp$ret$0;
    {
      var tmp0_withLock = this.c12_1;
      if (this.c12_1.y11_1 === get_EMPTY()) {
        var tmp0_elvis_lhs = this.kz();
        return tmp0_elvis_lhs == null ? get_POLL_FAILED() : tmp0_elvis_lhs;
      }
      result = this.c12_1.y11_1;
      this.c12_1.y11_1 = get_EMPTY();
      tmp$ret$0 = Unit_getInstance();
    }
    return result;
  };
  ConflatedChannel.prototype.jz = function (wasClosed) {
    var undeliveredElementException = null;
    var tmp$ret$0;
    {
      var tmp0_withLock = this.c12_1;
      undeliveredElementException = updateValueLocked(this, get_EMPTY());
      tmp$ret$0 = Unit_getInstance();
    }
    AbstractChannel.prototype.jz.call(this, wasClosed);
    var tmp0_safe_receiver = undeliveredElementException;
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        throw tmp0_safe_receiver;
      }
    }
  };
  ConflatedChannel.prototype.nx = function (receive) {
    var tmp$ret$1;
    {
      var tmp0_withLock = this.c12_1;
      var tmp$ret$0;
      {
        tmp$ret$0 = AbstractChannel.prototype.nx.call(this, receive);
      }
      tmp$ret$1 = tmp$ret$0;
    }
    return tmp$ret$1;
  };
  ConflatedChannel.prototype.a10 = function () {
    return '(value=' + toString(this.c12_1.y11_1) + ')';
  };
  ConflatedChannel.$metadata$ = classMeta('ConflatedChannel', undefined, undefined, undefined, undefined, AbstractChannel.prototype);
  function LinkedListChannel(onUndeliveredElement) {
    AbstractChannel.call(this, onUndeliveredElement);
  }
  LinkedListChannel.prototype.sy = function () {
    return true;
  };
  LinkedListChannel.prototype.ty = function () {
    return true;
  };
  LinkedListChannel.prototype.oz = function () {
    return false;
  };
  LinkedListChannel.prototype.pz = function () {
    return false;
  };
  LinkedListChannel.prototype.qz = function (element) {
    while (true) {
      var result = AbstractChannel.prototype.qz.call(this, element);
      if (result === get_OFFER_SUCCESS())
        return get_OFFER_SUCCESS();
      else {
        if (result === get_OFFER_FAILED()) {
          var sendResult = this.h10(element);
          if (sendResult == null)
            return get_OFFER_SUCCESS();
          else {
            if (sendResult instanceof Closed)
              return sendResult;
          }
        } else {
          if (result instanceof Closed)
            return result;
          else {
            var tmp0_error = 'Invalid offerInternal result ' + toString_0(result);
            throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
          }
        }
      }
    }
  };
  LinkedListChannel.prototype.lz = function (list, closed) {
    var undeliveredElementException = null;
    var tmp$ret$0;
    $l$block: {
      var tmp0_subject = _get_holder__f6h5pd(list);
      if (tmp0_subject == null) {
        tmp$ret$0 = Unit_getInstance();
        break $l$block;
      } else {
        if (!(tmp0_subject instanceof ArrayList)) {
          var tmp = _get_holder__f6h5pd(list);
          var tmp0__anonymous__q1qw7t = (tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE();
          var tmp0_subject_0 = tmp0__anonymous__q1qw7t;
          if (tmp0_subject_0 instanceof SendBuffered) {
            var tmp1_safe_receiver = this.bx();
            var tmp_0;
            if (tmp1_safe_receiver == null) {
              tmp_0 = null;
            } else {
              var tmp_1 = tmp0__anonymous__q1qw7t.f10_1;
              tmp_0 = callUndeliveredElementCatchingException(tmp1_safe_receiver, (tmp_1 == null ? true : isObject(tmp_1)) ? tmp_1 : THROW_CCE(), undeliveredElementException);
            }
            undeliveredElementException = tmp_0;
          } else {
            tmp0__anonymous__q1qw7t.mz(closed);
          }
        } else {
          var tmp_2 = _get_holder__f6h5pd(list);
          var list_0 = tmp_2 instanceof ArrayList ? tmp_2 : THROW_CCE();
          var inductionVariable = list_0.j() - 1 | 0;
          if (0 <= inductionVariable)
            do {
              var i = inductionVariable;
              inductionVariable = inductionVariable + -1 | 0;
              {
                var tmp1__anonymous__uwfjfc = list_0.l(i);
                var tmp0_subject_1 = tmp1__anonymous__uwfjfc;
                if (tmp0_subject_1 instanceof SendBuffered) {
                  var tmp1_safe_receiver_0 = this.bx();
                  var tmp_3;
                  if (tmp1_safe_receiver_0 == null) {
                    tmp_3 = null;
                  } else {
                    var tmp_4 = tmp1__anonymous__uwfjfc.f10_1;
                    tmp_3 = callUndeliveredElementCatchingException(tmp1_safe_receiver_0, (tmp_4 == null ? true : isObject(tmp_4)) ? tmp_4 : THROW_CCE(), undeliveredElementException);
                  }
                  undeliveredElementException = tmp_3;
                } else {
                  tmp1__anonymous__uwfjfc.mz(closed);
                }
              }
            }
             while (0 <= inductionVariable);
        }
      }
    }
    var tmp0_safe_receiver = undeliveredElementException;
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        throw tmp0_safe_receiver;
      }
    }
  };
  LinkedListChannel.$metadata$ = classMeta('LinkedListChannel', undefined, undefined, undefined, undefined, AbstractChannel.prototype);
  function ProducerScope() {
  }
  ProducerScope.$metadata$ = interfaceMeta('ProducerScope', [CoroutineScope, SendChannel]);
  function awaitClose(_this__u8e3s4, block, $cont) {
    var tmp = new $awaitCloseCOROUTINE$5(_this__u8e3s4, block, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  }
  function produce(_this__u8e3s4, context, capacity, onBufferOverflow, start, onCompletion, block) {
    var channel = Channel$default(capacity, onBufferOverflow, null, 4, null);
    var newContext = newCoroutineContext(_this__u8e3s4, context);
    var coroutine = new ProducerCoroutine(newContext, channel);
    if (!(onCompletion == null)) {
      coroutine.il(onCompletion);
    }
    coroutine.yk(start, coroutine, block);
    return coroutine;
  }
  function produce$default(_this__u8e3s4, context, capacity, onBufferOverflow, start, onCompletion, block, $mask0, $handler) {
    if (!(($mask0 & 1) === 0))
      context = EmptyCoroutineContext_getInstance();
    if (!(($mask0 & 2) === 0))
      capacity = 0;
    if (!(($mask0 & 4) === 0))
      onBufferOverflow = BufferOverflow_SUSPEND_getInstance();
    if (!(($mask0 & 8) === 0))
      start = CoroutineStart_DEFAULT_getInstance();
    if (!(($mask0 & 16) === 0))
      onCompletion = null;
    return produce(_this__u8e3s4, context, capacity, onBufferOverflow, start, onCompletion, block);
  }
  function ProducerCoroutine(parentContext, channel) {
    ChannelCoroutine.call(this, parentContext, channel, true, true);
  }
  ProducerCoroutine.prototype.lk = function () {
    return ChannelCoroutine.prototype.lk.call(this);
  };
  ProducerCoroutine.prototype.z12 = function (value) {
    var tmp = this.x11();
    tmp.wz(null, 1, null);
  };
  ProducerCoroutine.prototype.mk = function (value) {
    return this.z12(value instanceof Unit ? value : THROW_CCE());
  };
  ProducerCoroutine.prototype.nk = function (cause, handled) {
    var processed = this.x11().iz(cause);
    if (!processed ? !handled : false)
      handleCoroutineException(this.u4(), cause);
  };
  ProducerCoroutine.$metadata$ = classMeta('ProducerCoroutine', [ProducerScope], undefined, undefined, undefined, ChannelCoroutine.prototype);
  function awaitClose$lambda($cancellable) {
    return function (it) {
      var tmp$ret$1;
      {
        var tmp$ret$0;
        {
          var tmp0_success = Companion_getInstance();
          tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_getInstance());
        }
        tmp$ret$1 = $cancellable.v4(tmp$ret$0);
      }
      return Unit_getInstance();
    };
  }
  function $awaitCloseCOROUTINE$5(_this__u8e3s4, block, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.o12_1 = _this__u8e3s4;
    this.p12_1 = block;
  }
  $awaitCloseCOROUTINE$5.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 5;
            var tmp_0 = this;
            tmp_0.q12_1 = this.u4().y4(Key_getInstance_3()) === this.o12_1;
            if (!this.q12_1) {
              var message = 'awaitClose() can only be invoked from the producer context';
              throw IllegalStateException_init_$Create$(toString_0(message));
            }

            this.ii_1 = 1;
            continue $sm;
          case 1:
            this.ji_1 = 4;
            this.ii_1 = 2;
            var tmp_1 = this;
            tmp_1.s12_1 = this;
            this.t12_1 = new CancellableContinuationImpl(intercepted(this.s12_1), get_MODE_CANCELLABLE());
            this.t12_1.oo();
            this.o12_1.xz(awaitClose$lambda(this.t12_1));
            suspendResult = returnIfSuspended(this.t12_1.km(), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.r12_1 = suspendResult;
            this.ji_1 = 5;
            this.ii_1 = 3;
            continue $sm;
          case 3:
            this.p12_1();
            return Unit_getInstance();
          case 4:
            this.ji_1 = 5;
            var t = this.li_1;
            this.p12_1();
            throw t;
          case 5:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 5) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $awaitCloseCOROUTINE$5.$metadata$ = classMeta('$awaitCloseCOROUTINE$5', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function RendezvousChannel(onUndeliveredElement) {
    AbstractChannel.call(this, onUndeliveredElement);
  }
  RendezvousChannel.prototype.sy = function () {
    return true;
  };
  RendezvousChannel.prototype.ty = function () {
    return true;
  };
  RendezvousChannel.prototype.oz = function () {
    return true;
  };
  RendezvousChannel.prototype.pz = function () {
    return true;
  };
  RendezvousChannel.$metadata$ = classMeta('RendezvousChannel', undefined, undefined, undefined, undefined, AbstractChannel.prototype);
  function callbackFlow(block) {
    return CallbackFlowBuilder_init_$Create$(block, null, 0, null, 14, null);
  }
  function CallbackFlowBuilder_init_$Init$(block, context, capacity, onBufferOverflow, $mask0, $marker, $this) {
    if (!(($mask0 & 2) === 0))
      context = EmptyCoroutineContext_getInstance();
    if (!(($mask0 & 4) === 0)) {
      Factory_getInstance();
      capacity = -2;
    }
    if (!(($mask0 & 8) === 0))
      onBufferOverflow = BufferOverflow_SUSPEND_getInstance();
    CallbackFlowBuilder.call($this, block, context, capacity, onBufferOverflow);
    return $this;
  }
  function CallbackFlowBuilder_init_$Create$(block, context, capacity, onBufferOverflow, $mask0, $marker) {
    return CallbackFlowBuilder_init_$Init$(block, context, capacity, onBufferOverflow, $mask0, $marker, Object.create(CallbackFlowBuilder.prototype));
  }
  function $collectToCOROUTINE$6(_this__u8e3s4, scope, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.l13_1 = _this__u8e3s4;
    this.m13_1 = scope;
  }
  $collectToCOROUTINE$6.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 2;
            this.ii_1 = 1;
            suspendResult = ChannelFlowBuilder.prototype.r13.call(this.l13_1, this.m13_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            if (!this.m13_1.rz()) {
              throw IllegalStateException_init_$Create$("'awaitClose { yourCallbackOrListener.cancel() }' should be used in the end of callbackFlow block.\nOtherwise, a callback/listener may leak in case of external cancellation.\nSee callbackFlow API documentation for the details.");
            }

            return Unit_getInstance();
          case 2:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 2) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $collectToCOROUTINE$6.$metadata$ = classMeta('$collectToCOROUTINE$6', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function CallbackFlowBuilder(block, context, capacity, onBufferOverflow) {
    ChannelFlowBuilder.call(this, block, context, capacity, onBufferOverflow);
    this.w13_1 = block;
  }
  CallbackFlowBuilder.prototype.r13 = function (scope, $cont) {
    var tmp = new $collectToCOROUTINE$6(this, scope, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  CallbackFlowBuilder.$metadata$ = classMeta('CallbackFlowBuilder', undefined, undefined, undefined, undefined, ChannelFlowBuilder.prototype);
  function ChannelFlowBuilder(block, context, capacity, onBufferOverflow) {
    ChannelFlow.call(this, context, capacity, onBufferOverflow);
    this.q13_1 = block;
  }
  ChannelFlowBuilder.prototype.r13 = function (scope, $cont) {
    return this.q13_1(scope, $cont);
  };
  ChannelFlowBuilder.prototype.toString = function () {
    return 'block[' + this.q13_1 + '] -> ' + ChannelFlow.prototype.toString.call(this);
  };
  ChannelFlowBuilder.$metadata$ = classMeta('ChannelFlowBuilder', undefined, undefined, undefined, undefined, ChannelFlow.prototype);
  function emitAll(_this__u8e3s4, channel, $cont) {
    return emitAllImpl(_this__u8e3s4, channel, true, $cont);
  }
  function emitAllImpl(_this__u8e3s4, channel, consume, $cont) {
    var tmp = new $emitAllImplCOROUTINE$7(_this__u8e3s4, channel, consume, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  }
  function $emitAllImplCOROUTINE$7(_this__u8e3s4, channel, consume, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.n14_1 = _this__u8e3s4;
    this.o14_1 = channel;
    this.p14_1 = consume;
  }
  $emitAllImplCOROUTINE$7.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 11;
            ensureActive_1(this.n14_1);
            this.q14_1 = null;
            this.ii_1 = 1;
            continue $sm;
          case 1:
            this.ji_1 = 9;
            this.ji_1 = 8;
            this.ii_1 = 2;
            continue $sm;
          case 2:
            if (false) {
              this.ii_1 = 7;
              continue $sm;
            }

            this.ii_1 = 3;
            suspendResult = this.o14_1.fz(this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            this.ii_1 = 4;
            continue $sm;
          case 3:
            this.s14_1 = suspendResult.gz_1;
            suspendResult = new ChannelResult(this.s14_1);
            this.ii_1 = 4;
            continue $sm;
          case 4:
            this.t14_1 = suspendResult.gz_1;
            if (_ChannelResult___get_isClosed__impl__mg7kuu(this.t14_1)) {
              var tmp0_safe_receiver = ChannelResult__exceptionOrNull_impl_16ei30(this.t14_1);
              if (tmp0_safe_receiver == null)
                null;
              else {
                throw tmp0_safe_receiver;
              }
              this.ii_1 = 7;
              continue $sm;
            } else {
              this.ii_1 = 5;
              continue $sm;
            }

            break;
          case 5:
            this.ii_1 = 6;
            suspendResult = this.n14_1.u14(ChannelResult__getOrThrow_impl_od1axs(this.t14_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 6:
            this.ii_1 = 2;
            continue $sm;
          case 7:
            this.r14_1 = Unit_getInstance();
            this.ji_1 = 11;
            this.ii_1 = 10;
            continue $sm;
          case 8:
            this.ji_1 = 9;
            var tmp_0 = this.li_1;
            if (tmp_0 instanceof Error) {
              var e = this.li_1;
              var tmp_1 = this;
              this.q14_1 = e;
              throw e;
            } else {
              throw this.li_1;
            }

            break;
          case 9:
            this.ji_1 = 11;
            var t = this.li_1;
            if (this.p14_1)
              cancelConsumed(this.o14_1, this.q14_1);
            throw t;
          case 10:
            if (this.p14_1)
              cancelConsumed(this.o14_1, this.q14_1);
            return Unit_getInstance();
          case 11:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 11) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $emitAllImplCOROUTINE$7.$metadata$ = classMeta('$emitAllImplCOROUTINE$7', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function Flow() {
  }
  Flow.$metadata$ = interfaceMeta('Flow');
  function FlowCollector() {
  }
  FlowCollector.$metadata$ = interfaceMeta('FlowCollector');
  function MutableSharedFlow() {
  }
  MutableSharedFlow.$metadata$ = interfaceMeta('MutableSharedFlow', [SharedFlow, FlowCollector]);
  function SharedFlow() {
  }
  SharedFlow.$metadata$ = interfaceMeta('SharedFlow', [Flow]);
  function _get_head__d7jo8b($this) {
    var tmp$ret$0;
    {
      var tmp0_minOf = $this.f15_1.v14_1;
      var tmp1_minOf = $this.e15_1.v14_1;
      tmp$ret$0 = tmp0_minOf.g1(tmp1_minOf) <= 0 ? tmp0_minOf : tmp1_minOf;
    }
    return tmp$ret$0;
  }
  function _get_replaySize__dxgnb1($this) {
    var tmp$ret$0;
    {
      var tmp0_plus = _get_head__d7jo8b($this);
      var tmp1_plus = $this.g15_1.uj_1;
      tmp$ret$0 = tmp0_plus.r6(toLong(tmp1_plus));
    }
    return tmp$ret$0.s6($this.e15_1.v14_1).m8();
  }
  function _get_totalSize__xhdb3o($this) {
    return $this.g15_1.uj_1 + $this.h15_1.uj_1 | 0;
  }
  function _get_bufferEndIndex__d2rk18($this) {
    var tmp$ret$0;
    {
      var tmp0_plus = _get_head__d7jo8b($this);
      var tmp1_plus = $this.g15_1.uj_1;
      tmp$ret$0 = tmp0_plus.r6(toLong(tmp1_plus));
    }
    return tmp$ret$0;
  }
  function _get_queueEndIndex__4m025l($this) {
    var tmp$ret$1;
    {
      var tmp$ret$0;
      {
        var tmp0_plus = _get_head__d7jo8b($this);
        var tmp1_plus = $this.g15_1.uj_1;
        tmp$ret$0 = tmp0_plus.r6(toLong(tmp1_plus));
      }
      var tmp2_plus = tmp$ret$0;
      var tmp3_plus = $this.h15_1.uj_1;
      tmp$ret$1 = tmp2_plus.r6(toLong(tmp3_plus));
    }
    return tmp$ret$1;
  }
  function tryEmitLocked($this, value) {
    if ($this.m15() === 0)
      return tryEmitNoCollectorsLocked($this, value);
    if ($this.g15_1.uj_1 >= $this.b15_1 ? $this.f15_1.v14_1.g1($this.e15_1.v14_1) <= 0 : false) {
      var tmp0_subject = $this.c15_1;
      var tmp0 = tmp0_subject.lh();
      switch (tmp0) {
        case 0:
          return false;
        case 2:
          return true;
        case 1:
          break;
      }
    }
    enqueueLocked($this, value);
    $this.g15_1.atomicfu$incrementAndGet();
    if ($this.g15_1.uj_1 > $this.b15_1)
      dropOldestLocked($this);
    if (_get_replaySize__dxgnb1($this) > $this.a15_1) {
      var tmp$ret$0;
      {
        var tmp0_plus = $this.e15_1.v14_1;
        tmp$ret$0 = tmp0_plus.r6(new Long(1, 0));
      }
      updateBufferLocked($this, tmp$ret$0, $this.f15_1.v14_1, _get_bufferEndIndex__d2rk18($this), _get_queueEndIndex__4m025l($this));
    }
    return true;
  }
  function tryEmitNoCollectorsLocked($this, value) {
    {
    }
    if ($this.a15_1 === 0)
      return true;
    enqueueLocked($this, value);
    $this.g15_1.atomicfu$incrementAndGet();
    if ($this.g15_1.uj_1 > $this.a15_1)
      dropOldestLocked($this);
    var newBufferSize = $this.g15_1.uj_1;
    var tmp = $this.f15_1;
    var tmp$ret$0;
    {
      var tmp0_plus = _get_head__d7jo8b($this);
      tmp$ret$0 = tmp0_plus.r6(toLong(newBufferSize));
    }
    tmp.v14_1 = tmp$ret$0;
    return true;
  }
  function dropOldestLocked($this) {
    ensureNotNull($this.d15_1.tj_1).p15(_get_head__d7jo8b($this), null);
    $this.g15_1.atomicfu$decrementAndGet();
    var tmp$ret$0;
    {
      var tmp0_plus = _get_head__d7jo8b($this);
      tmp$ret$0 = tmp0_plus.r6(new Long(1, 0));
    }
    var newHead = tmp$ret$0;
    if ($this.e15_1.v14_1.g1(newHead) < 0)
      $this.e15_1.v14_1 = newHead;
    if ($this.f15_1.v14_1.g1(newHead) < 0)
      correctCollectorIndexesOnDropOldest($this, newHead);
    {
    }
  }
  function correctCollectorIndexesOnDropOldest($this, newHead) {
    var tmp$ret$0;
    $l$block: {
      if ($this.j15_1.uj_1 === 0) {
        tmp$ret$0 = Unit_getInstance();
        break $l$block;
      }
      var _slots = $this.i15_1.tj_1;
      if (!(_slots == null)) {
        var inductionVariable = 0;
        var last = _slots.n15_1;
        if (inductionVariable < last)
          do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var slot = _slots.l(i);
            if (!(slot == null)) {
              if (slot.q15_1.v14_1.g1(new Long(0, 0)) >= 0 ? slot.q15_1.v14_1.g1(newHead) < 0 : false) {
                slot.q15_1.v14_1 = newHead;
              }
            }
          }
           while (inductionVariable < last);
      }
    }
    $this.f15_1.v14_1 = newHead;
  }
  function enqueueLocked($this, item) {
    var curSize = _get_totalSize__xhdb3o($this);
    var curBuffer = $this.d15_1.tj_1;
    var buffer = curBuffer == null ? growBuffer($this, null, 0, 2) : curSize >= curBuffer.n15_1 ? growBuffer($this, curBuffer, curSize, imul(curBuffer.n15_1, 2)) : curBuffer;
    var tmp$ret$0;
    {
      var tmp0_plus = _get_head__d7jo8b($this);
      tmp$ret$0 = tmp0_plus.r6(toLong(curSize));
    }
    buffer.p15(tmp$ret$0, item);
  }
  function growBuffer($this, curBuffer, curSize, newSize) {
    {
      var tmp0_check = newSize > 0;
      {
      }
      if (!tmp0_check) {
        var tmp$ret$0;
        {
          tmp$ret$0 = 'Buffer size overflow';
        }
        var message = tmp$ret$0;
        throw IllegalStateException_init_$Create$(toString_0(message));
      }
    }
    var tmp$ret$1;
    {
      var tmp1_also = new SharedFlowState(newSize);
      {
      }
      {
        $this.d15_1.tj_1 = tmp1_also;
      }
      tmp$ret$1 = tmp1_also;
    }
    var newBuffer = tmp$ret$1;
    if (curBuffer == null)
      return newBuffer;
    var head = _get_head__d7jo8b($this);
    var inductionVariable = 0;
    if (inductionVariable < curSize)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        var tmp$ret$2;
        {
          tmp$ret$2 = head.r6(toLong(i));
        }
        var tmp = tmp$ret$2;
        var tmp$ret$3;
        {
          tmp$ret$3 = head.r6(toLong(i));
        }
        newBuffer.p15(tmp, curBuffer.s15(tmp$ret$3));
      }
       while (inductionVariable < curSize);
    return newBuffer;
  }
  function updateBufferLocked($this, newReplayIndex, newMinCollectorIndex, newBufferEndIndex, newQueueEndIndex) {
    var tmp$ret$0;
    {
      tmp$ret$0 = newMinCollectorIndex.g1(newReplayIndex) <= 0 ? newMinCollectorIndex : newReplayIndex;
    }
    var newHead = tmp$ret$0;
    {
    }
    var inductionVariable = _get_head__d7jo8b($this);
    var step = new Long(1, 0);
    if (inductionVariable.g1(newHead) < 0)
      do {
        var index = inductionVariable;
        inductionVariable = inductionVariable.r6(step);
        ensureNotNull($this.d15_1.tj_1).p15(index, null);
      }
       while (inductionVariable.g1(newHead) < 0);
    $this.e15_1.v14_1 = newReplayIndex;
    $this.f15_1.v14_1 = newMinCollectorIndex;
    $this.g15_1.uj_1 = newBufferEndIndex.s6(newHead).m8();
    $this.h15_1.uj_1 = newQueueEndIndex.s6(newBufferEndIndex).m8();
    {
    }
    {
    }
    {
    }
  }
  function tryPeekLocked($this, slot) {
    var index = slot.q15_1.v14_1;
    if (index.g1(_get_bufferEndIndex__d2rk18($this)) < 0)
      return index;
    if ($this.b15_1 > 0)
      return new Long(-1, -1);
    if (index.g1(_get_head__d7jo8b($this)) > 0)
      return new Long(-1, -1);
    if ($this.h15_1.uj_1 === 0)
      return new Long(-1, -1);
    return index;
  }
  function findSlotsToResumeLocked($this, resumesIn) {
    var resumes = resumesIn;
    var resumeCount = resumesIn.length;
    var tmp$ret$0;
    $l$block: {
      if ($this.j15_1.uj_1 === 0) {
        tmp$ret$0 = Unit_getInstance();
        break $l$block;
      }
      var _slots = $this.i15_1.tj_1;
      if (!(_slots == null)) {
        var inductionVariable = 0;
        var last = _slots.n15_1;
        if (inductionVariable < last)
          do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var slot = _slots.l(i);
            if (!(slot == null)) {
              var tmp$ret$1;
              $l$block_1: {
                var tmp0_elvis_lhs = slot.r15_1.tj_1;
                var tmp;
                if (tmp0_elvis_lhs == null) {
                  tmp$ret$1 = Unit_getInstance();
                  break $l$block_1;
                } else {
                  tmp = tmp0_elvis_lhs;
                }
                var cont = tmp;
                if (tryPeekLocked($this, slot).g1(new Long(0, 0)) < 0) {
                  tmp$ret$1 = Unit_getInstance();
                  break $l$block_1;
                }
                if (resumeCount >= resumes.length) {
                  var tmp_0 = resumes;
                  var tmp$ret$2;
                  {
                    var tmp0_maxOf = imul(2, resumes.length);
                    tmp$ret$2 = Math.max(2, tmp0_maxOf);
                  }
                  resumes = copyOf(tmp_0, tmp$ret$2);
                }
                var tmp_1 = resumes;
                var tmp1 = resumeCount;
                resumeCount = tmp1 + 1 | 0;
                tmp_1[tmp1] = cont;
                slot.r15_1.tj_1 = null;
              }
            }
          }
           while (inductionVariable < last);
      }
    }
    return resumes;
  }
  function get_NONE() {
    init_properties_StateFlow_kt_6znnsl();
    return NONE;
  }
  var NONE;
  function get_PENDING() {
    init_properties_StateFlow_kt_6znnsl();
    return PENDING;
  }
  var PENDING;
  function MutableStateFlow() {
  }
  MutableStateFlow.$metadata$ = interfaceMeta('MutableStateFlow', [StateFlow, MutableSharedFlow]);
  function MutableStateFlow_0(value) {
    init_properties_StateFlow_kt_6znnsl();
    var tmp0_elvis_lhs = value;
    return new StateFlowImpl(tmp0_elvis_lhs == null ? get_NULL() : tmp0_elvis_lhs);
  }
  function StateFlow() {
  }
  StateFlow.$metadata$ = interfaceMeta('StateFlow', [SharedFlow]);
  function updateState($this, expectedState, newState) {
    var curSequence = 0;
    var curSlots = $this.x15();
    var tmp$ret$0;
    {
      var oldState = $this.c16_1.tj_1;
      if (!(expectedState == null) ? !equals(oldState, expectedState) : false)
        return false;
      if (equals(oldState, newState))
        return true;
      $this.c16_1.tj_1 = newState;
      curSequence = $this.d16_1.uj_1;
      if ((curSequence & 1) === 0) {
        var tmp0 = curSequence;
        curSequence = tmp0 + 1 | 0;
        $this.d16_1.uj_1 = curSequence;
      } else {
        $this.d16_1.uj_1 = curSequence + 2 | 0;
        return true;
      }
      curSlots = $this.x15();
      tmp$ret$0 = Unit_getInstance();
    }
    while (true) {
      var _cs = curSlots;
      if (!(_cs == null)) {
        var inductionVariable = 0;
        var last = _cs.n15_1;
        if (inductionVariable < last)
          do {
            var index = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            var tmp1_safe_receiver = _cs.l(index);
            if (tmp1_safe_receiver == null)
              null;
            else {
              tmp1_safe_receiver.f16();
            }
          }
           while (inductionVariable < last);
      }
      var tmp$ret$1;
      {
        if ($this.d16_1.uj_1 === curSequence) {
          $this.d16_1.uj_1 = curSequence + 1 | 0;
          return true;
        }
        curSequence = $this.d16_1.uj_1;
        curSlots = $this.x15();
        tmp$ret$1 = Unit_getInstance();
      }
    }
  }
  function $collectCOROUTINE$9(_this__u8e3s4, collector, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.o16_1 = _this__u8e3s4;
    this.p16_1 = collector;
  }
  $collectCOROUTINE$9.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 12;
            this.q16_1 = this.o16_1.w16();
            this.ii_1 = 1;
            continue $sm;
          case 1:
            this.ji_1 = 11;
            var tmp_0 = this.p16_1;
            if (tmp_0 instanceof SubscribedFlowCollector) {
              this.ii_1 = 2;
              suspendResult = this.p16_1.z16(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.ii_1 = 3;
              continue $sm;
            }

            break;
          case 2:
            this.ii_1 = 3;
            continue $sm;
          case 3:
            var tmp_1 = this;
            tmp_1.s16_1 = this.u4().y4(Key_getInstance_3());
            this.t16_1 = null;
            this.ii_1 = 4;
            continue $sm;
          case 4:
            if (false) {
              this.ii_1 = 9;
              continue $sm;
            }

            this.u16_1 = this.o16_1.c16_1.tj_1;
            var tmp0_safe_receiver = this.s16_1;
            if (tmp0_safe_receiver == null)
              null;
            else {
              ensureActive_0(tmp0_safe_receiver);
            }

            ;
            if (this.t16_1 == null ? true : !equals(this.t16_1, this.u16_1)) {
              this.ii_1 = 5;
              var tmp_2 = this;
              tmp_2.v16_1 = get_NULL();
              var tmp_3;
              if (this.u16_1 === this.v16_1) {
                tmp_3 = (null == null ? true : isObject(null)) ? null : THROW_CCE();
              } else {
                var tmp_4 = this.u16_1;
                tmp_3 = isObject(tmp_4) ? tmp_4 : THROW_CCE();
              }
              suspendResult = this.p16_1.u14(tmp_3, this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.ii_1 = 6;
              continue $sm;
            }

            break;
          case 5:
            this.t16_1 = this.u16_1;
            this.ii_1 = 6;
            continue $sm;
          case 6:
            if (!this.q16_1.b17()) {
              this.ii_1 = 7;
              suspendResult = this.q16_1.a17(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.ii_1 = 8;
              continue $sm;
            }

            break;
          case 7:
            this.ii_1 = 8;
            continue $sm;
          case 8:
            this.ii_1 = 4;
            continue $sm;
          case 9:
            this.r16_1 = Unit_getInstance();
            this.ji_1 = 12;
            this.ii_1 = 10;
            continue $sm;
          case 10:
            this.o16_1.c17(this.q16_1);
            return Unit_getInstance();
          case 11:
            this.ji_1 = 12;
            var t = this.li_1;
            this.o16_1.c17(this.q16_1);
            throw t;
          case 12:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 12) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $collectCOROUTINE$9.$metadata$ = classMeta('$collectCOROUTINE$9', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function StateFlowImpl(initialState) {
    AbstractSharedFlow.call(this);
    this.c16_1 = atomic$ref$1(initialState);
    this.d16_1 = atomic$int$1(0);
  }
  StateFlowImpl.prototype.t15 = function (value) {
    var tmp0_elvis_lhs = value;
    updateState(this, null, tmp0_elvis_lhs == null ? get_NULL() : tmp0_elvis_lhs);
  };
  StateFlowImpl.prototype.y = function () {
    var tmp$ret$0;
    {
      var tmp0_unbox = get_NULL();
      var tmp1_unbox = this.c16_1.tj_1;
      var tmp;
      if (tmp1_unbox === tmp0_unbox) {
        tmp = (null == null ? true : isObject(null)) ? null : THROW_CCE();
      } else {
        tmp = isObject(tmp1_unbox) ? tmp1_unbox : THROW_CCE();
      }
      tmp$ret$0 = tmp;
    }
    return tmp$ret$0;
  };
  StateFlowImpl.prototype.u15 = function (expect, update) {
    var tmp0_elvis_lhs = expect;
    var tmp = tmp0_elvis_lhs == null ? get_NULL() : tmp0_elvis_lhs;
    var tmp1_elvis_lhs = update;
    return updateState(this, tmp, tmp1_elvis_lhs == null ? get_NULL() : tmp1_elvis_lhs);
  };
  StateFlowImpl.prototype.w15 = function (value) {
    this.t15(value);
    return true;
  };
  StateFlowImpl.prototype.u14 = function (value, $cont) {
    this.t15(value);
    return Unit_getInstance();
  };
  StateFlowImpl.prototype.v15 = function (collector, $cont) {
    var tmp = new $collectCOROUTINE$9(this, collector, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  StateFlowImpl.prototype.d14 = function (collector, $cont) {
    return this.v15(collector, $cont);
  };
  StateFlowImpl.prototype.d17 = function () {
    return new StateFlowSlot();
  };
  StateFlowImpl.$metadata$ = classMeta('StateFlowImpl', [MutableStateFlow, CancellableFlow, FusibleFlow], undefined, undefined, undefined, AbstractSharedFlow.prototype);
  function StateFlowSlot() {
    AbstractSharedFlowSlot.call(this);
    this.e16_1 = atomic$ref$1(null);
  }
  StateFlowSlot.prototype.f17 = function (flow) {
    if (!(this.e16_1.tj_1 == null))
      return false;
    this.e16_1.tj_1 = get_NONE();
    return true;
  };
  StateFlowSlot.prototype.g17 = function (flow) {
    return this.f17(flow instanceof StateFlowImpl ? flow : THROW_CCE());
  };
  StateFlowSlot.prototype.h17 = function (flow) {
    this.e16_1.tj_1 = null;
    return get_EMPTY_RESUMES();
  };
  StateFlowSlot.prototype.i17 = function (flow) {
    return this.h17(flow instanceof StateFlowImpl ? flow : THROW_CCE());
  };
  StateFlowSlot.prototype.f16 = function () {
    {
      var tmp0_loop = this.e16_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (tmp1__anonymous__uwfjfc == null)
            return Unit_getInstance();
          else if (tmp1__anonymous__uwfjfc === get_PENDING())
            return Unit_getInstance();
          else if (tmp1__anonymous__uwfjfc === get_NONE()) {
            if (this.e16_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, get_PENDING()))
              return Unit_getInstance();
          } else {
            if (this.e16_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, get_NONE())) {
              var tmp$ret$1;
              {
                var tmp0_resume = tmp1__anonymous__uwfjfc instanceof CancellableContinuationImpl ? tmp1__anonymous__uwfjfc : THROW_CCE();
                var tmp$ret$0;
                {
                  var tmp0_success = Companion_getInstance();
                  tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_getInstance());
                }
                tmp$ret$1 = tmp0_resume.v4(tmp$ret$0);
              }
              return Unit_getInstance();
            }
          }
        }
      }
    }
  };
  StateFlowSlot.prototype.b17 = function () {
    var tmp$ret$0;
    {
      var tmp0_let = ensureNotNull(this.e16_1.atomicfu$getAndSet(get_NONE()));
      {
      }
      {
      }
      return tmp0_let === get_PENDING();
    }
    return tmp$ret$0;
  };
  StateFlowSlot.prototype.a17 = function ($cont) {
    var tmp$ret$3;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = new CancellableContinuationImpl(intercepted(tmp0__anonymous__q1qw7t), get_MODE_CANCELLABLE());
      cancellable.oo();
      var tmp$ret$0;
      $l$block: {
        {
        }
        if (this.e16_1.atomicfu$compareAndSet(get_NONE(), cancellable)) {
          tmp$ret$0 = Unit_getInstance();
          break $l$block;
        }
        {
        }
        var tmp$ret$2;
        {
          var tmp$ret$1;
          {
            var tmp0_success = Companion_getInstance();
            tmp$ret$1 = _Result___init__impl__xyqfz8(Unit_getInstance());
          }
          tmp$ret$2 = cancellable.v4(tmp$ret$1);
        }
      }
      tmp$ret$3 = cancellable.km();
    }
    return tmp$ret$3;
  };
  StateFlowSlot.$metadata$ = classMeta('StateFlowSlot', undefined, undefined, undefined, undefined, AbstractSharedFlowSlot.prototype);
  var properties_initialized_StateFlow_kt_nsqikx;
  function init_properties_StateFlow_kt_6znnsl() {
    if (properties_initialized_StateFlow_kt_nsqikx) {
    } else {
      properties_initialized_StateFlow_kt_nsqikx = true;
      NONE = new Symbol('NONE');
      PENDING = new Symbol('PENDING');
    }
  }
  function get_EMPTY_RESUMES() {
    init_properties_AbstractSharedFlow_kt_ejuukb();
    return EMPTY_RESUMES;
  }
  var EMPTY_RESUMES;
  function AbstractSharedFlow() {
    this.i15_1 = atomic$ref$1(null);
    this.j15_1 = atomic$int$1(0);
    this.k15_1 = atomic$int$1(0);
    this.l15_1 = atomic$ref$1(null);
  }
  AbstractSharedFlow.prototype.x15 = function () {
    return this.i15_1.tj_1;
  };
  AbstractSharedFlow.prototype.m15 = function () {
    return this.j15_1.uj_1;
  };
  AbstractSharedFlow.prototype.w16 = function () {
    var subscriptionCount = null;
    var tmp$ret$3;
    {
      var tmp$ret$2;
      {
        var curSlots = this.i15_1.tj_1;
        var tmp;
        if (curSlots == null) {
          var tmp$ret$0;
          {
            var tmp0_also = new SharedFlowState(2);
            {
            }
            {
              this.i15_1.tj_1 = tmp0_also;
            }
            tmp$ret$0 = tmp0_also;
          }
          tmp = tmp$ret$0;
        } else {
          var tmp_0;
          if (this.m15() >= curSlots.n15_1) {
            var newSlots = new SharedFlowState(imul(2, curSlots.n15_1));
            curSlots.j17(newSlots);
            this.i15_1.tj_1 = newSlots;
            tmp_0 = newSlots;
          } else {
            tmp_0 = curSlots;
          }
          tmp = tmp_0;
        }
        var slots = tmp;
        var index = this.k15_1.uj_1;
        var slot;
        $l$loop: while (true) {
          var tmp0_elvis_lhs = slots.l(index);
          var tmp_1;
          if (tmp0_elvis_lhs == null) {
            var tmp$ret$1;
            {
              var tmp1_also = this.d17();
              {
              }
              {
                slots.k17(index, tmp1_also);
              }
              tmp$ret$1 = tmp1_also;
            }
            tmp_1 = tmp$ret$1;
          } else {
            tmp_1 = tmp0_elvis_lhs;
          }
          slot = tmp_1;
          var tmp1 = index;
          index = tmp1 + 1 | 0;
          if (index >= slots.n15_1)
            index = 0;
          if ((slot instanceof AbstractSharedFlowSlot ? slot : THROW_CCE()).g17(this))
            break $l$loop;
        }
        this.k15_1.uj_1 = index;
        this.j15_1.atomicfu$incrementAndGet();
        subscriptionCount = this.l15_1.tj_1;
        tmp$ret$2 = slot;
      }
      tmp$ret$3 = tmp$ret$2;
    }
    var slot_0 = tmp$ret$3;
    var tmp0_safe_receiver = subscriptionCount;
    if (tmp0_safe_receiver == null)
      null;
    else
      tmp0_safe_receiver.x17(1);
    return slot_0;
  };
  AbstractSharedFlow.prototype.c17 = function (slot) {
    var subscriptionCount = null;
    var tmp$ret$1;
    {
      var tmp$ret$0;
      {
        this.j15_1.atomicfu$decrementAndGet();
        subscriptionCount = this.l15_1.tj_1;
        if (this.j15_1.uj_1 === 0)
          this.k15_1.uj_1 = 0;
        tmp$ret$0 = (slot instanceof AbstractSharedFlowSlot ? slot : THROW_CCE()).i17(this);
      }
      tmp$ret$1 = tmp$ret$0;
    }
    var resumes = tmp$ret$1;
    var indexedObject = resumes;
    var inductionVariable = 0;
    var last = indexedObject.length;
    while (inductionVariable < last) {
      var cont = indexedObject[inductionVariable];
      inductionVariable = inductionVariable + 1 | 0;
      var tmp1_safe_receiver = cont;
      if (tmp1_safe_receiver == null)
        null;
      else {
        var tmp$ret$3;
        {
          var tmp$ret$2;
          {
            var tmp0_success = Companion_getInstance();
            tmp$ret$2 = _Result___init__impl__xyqfz8(Unit_getInstance());
          }
          tmp$ret$3 = tmp1_safe_receiver.v4(tmp$ret$2);
        }
      }
    }
    var tmp2_safe_receiver = subscriptionCount;
    if (tmp2_safe_receiver == null)
      null;
    else
      tmp2_safe_receiver.x17(-1);
  };
  AbstractSharedFlow.prototype.e17 = function (block) {
    if (this.j15_1.uj_1 === 0)
      return Unit_getInstance();
    var _slots = this.i15_1.tj_1;
    if (!(_slots == null)) {
      var inductionVariable = 0;
      var last = _slots.n15_1;
      if (inductionVariable < last)
        do {
          var i = inductionVariable;
          inductionVariable = inductionVariable + 1 | 0;
          var slot = _slots.l(i);
          if (!(slot == null))
            block(slot);
        }
         while (inductionVariable < last);
    }
  };
  AbstractSharedFlow.$metadata$ = classMeta('AbstractSharedFlow');
  function SharedFlowState(size) {
    this.n15_1 = size;
    this.o15_1 = atomicfu$AtomicRefArray$ofNulls(this.n15_1);
  }
  SharedFlowState.prototype.j = function () {
    return this.n15_1;
  };
  SharedFlowState.prototype.k17 = function (index, value) {
    this.o15_1.atomicfu$get(index).tj_1 = value;
  };
  SharedFlowState.prototype.l = function (index) {
    return this.o15_1.atomicfu$get(index).tj_1;
  };
  SharedFlowState.prototype.s15 = function (index) {
    return this.l(index.m8() & (this.n15_1 - 1 | 0));
  };
  SharedFlowState.prototype.p15 = function (index, item) {
    this.o15_1.atomicfu$get(index.m8() & (this.n15_1 - 1 | 0)).tj_1 = item;
  };
  SharedFlowState.prototype.j17 = function (newSlots) {
    var inductionVariable = 0;
    var last = this.n15_1;
    if (inductionVariable < last)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        newSlots.o15_1.atomicfu$get(i).tj_1 = this.l(i);
      }
       while (inductionVariable < last);
  };
  SharedFlowState.$metadata$ = classMeta('SharedFlowState');
  function AbstractSharedFlowSlot() {
  }
  AbstractSharedFlowSlot.$metadata$ = classMeta('AbstractSharedFlowSlot');
  var properties_initialized_AbstractSharedFlow_kt_2mpafr;
  function init_properties_AbstractSharedFlow_kt_ejuukb() {
    if (properties_initialized_AbstractSharedFlow_kt_2mpafr) {
    } else {
      properties_initialized_AbstractSharedFlow_kt_2mpafr = true;
      var tmp$ret$0;
      {
        tmp$ret$0 = fillArrayVal(Array(0), null);
      }
      EMPTY_RESUMES = tmp$ret$0;
    }
  }
  function FusibleFlow() {
  }
  FusibleFlow.$metadata$ = interfaceMeta('FusibleFlow', [Flow]);
  function ChannelFlow$_get_collectToFun_$slambda_j53z2e(this$0, resultContinuation) {
    this.g18_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype.i18 = function (it, $cont) {
    var tmp = this.j18(it, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype.ui = function (p1, $cont) {
    return this.i18((!(p1 == null) ? isInterface(p1, ProducerScope) : false) ? p1 : THROW_CCE(), $cont);
  };
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 2;
            this.ii_1 = 1;
            suspendResult = this.g18_1.r13(this.h18_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_getInstance();
          case 2:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 2) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.prototype.j18 = function (it, completion) {
    var i = new ChannelFlow$_get_collectToFun_$slambda_j53z2e(this.g18_1, completion);
    i.h18_1 = it;
    return i;
  };
  ChannelFlow$_get_collectToFun_$slambda_j53z2e.$metadata$ = classMeta('ChannelFlow$<get-collectToFun>$slambda', undefined, undefined, undefined, [1], CoroutineImpl.prototype);
  function ChannelFlow$_get_collectToFun_$slambda_j53z2e_0(this$0, resultContinuation) {
    var i = new ChannelFlow$_get_collectToFun_$slambda_j53z2e(this$0, resultContinuation);
    var l = function (it, $cont) {
      return i.i18(it, $cont);
    };
    l.$arity = 1;
    return l;
  }
  function ChannelFlow$collect$slambda($collector, this$0, resultContinuation) {
    this.s18_1 = $collector;
    this.t18_1 = this$0;
    CoroutineImpl.call(this, resultContinuation);
  }
  ChannelFlow$collect$slambda.prototype.v18 = function ($this$coroutineScope, $cont) {
    var tmp = this.w18($this$coroutineScope, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  ChannelFlow$collect$slambda.prototype.ui = function (p1, $cont) {
    return this.v18((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $cont);
  };
  ChannelFlow$collect$slambda.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 2;
            this.ii_1 = 1;
            suspendResult = emitAll(this.s18_1, this.t18_1.c14(this.u18_1), this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 1:
            return Unit_getInstance();
          case 2:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 2) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  ChannelFlow$collect$slambda.prototype.w18 = function ($this$coroutineScope, completion) {
    var i = new ChannelFlow$collect$slambda(this.s18_1, this.t18_1, completion);
    i.u18_1 = $this$coroutineScope;
    return i;
  };
  ChannelFlow$collect$slambda.$metadata$ = classMeta('ChannelFlow$collect$slambda', undefined, undefined, undefined, [1], CoroutineImpl.prototype);
  function ChannelFlow$collect$slambda_0($collector, this$0, resultContinuation) {
    var i = new ChannelFlow$collect$slambda($collector, this$0, resultContinuation);
    var l = function ($this$coroutineScope, $cont) {
      return i.v18($this$coroutineScope, $cont);
    };
    l.$arity = 1;
    return l;
  }
  function ChannelFlow(context, capacity, onBufferOverflow) {
    this.x13_1 = context;
    this.y13_1 = capacity;
    this.z13_1 = onBufferOverflow;
    {
    }
  }
  ChannelFlow.prototype.a14 = function () {
    return ChannelFlow$_get_collectToFun_$slambda_j53z2e_0(this, null);
  };
  ChannelFlow.prototype.b14 = function () {
    var tmp;
    Factory_getInstance();
    if (this.y13_1 === -3) {
      Factory_getInstance();
      tmp = -2;
    } else {
      tmp = this.y13_1;
    }
    return tmp;
  };
  ChannelFlow.prototype.c14 = function (scope) {
    var tmp = this.b14();
    var tmp_0 = CoroutineStart_ATOMIC_getInstance();
    return produce$default(scope, this.x13_1, tmp, this.z13_1, tmp_0, null, this.a14(), 16, null);
  };
  ChannelFlow.prototype.d14 = function (collector, $cont) {
    return coroutineScope(ChannelFlow$collect$slambda_0(collector, this, null), $cont);
  };
  ChannelFlow.prototype.e14 = function () {
    return null;
  };
  ChannelFlow.prototype.toString = function () {
    var props = ArrayList_init_$Create$(4);
    var tmp0_safe_receiver = this.e14();
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$1;
      {
        {
        }
        var tmp$ret$0;
        {
          tmp$ret$0 = props.a(tmp0_safe_receiver);
        }
        tmp$ret$1 = tmp$ret$0;
      }
    }
    if (!(this.x13_1 === EmptyCoroutineContext_getInstance())) {
      props.a('context=' + this.x13_1);
    }
    Factory_getInstance();
    if (!(this.y13_1 === -3)) {
      props.a('capacity=' + this.y13_1);
    }
    if (!this.z13_1.equals(BufferOverflow_SUSPEND_getInstance())) {
      props.a('onBufferOverflow=' + this.z13_1);
    }
    var tmp = get_classSimpleName(this);
    return tmp + '[' + joinToString$default(props, ', ', null, null, 0, null, null, 62, null) + ']';
  };
  ChannelFlow.$metadata$ = classMeta('ChannelFlow', [FusibleFlow]);
  function get_NULL() {
    init_properties_NullSurrogate_kt_8d5lbx();
    return NULL;
  }
  var NULL;
  var UNINITIALIZED;
  var DONE;
  var properties_initialized_NullSurrogate_kt_39v8bl;
  function init_properties_NullSurrogate_kt_8d5lbx() {
    if (properties_initialized_NullSurrogate_kt_39v8bl) {
    } else {
      properties_initialized_NullSurrogate_kt_39v8bl = true;
      NULL = new Symbol('NULL');
      UNINITIALIZED = new Symbol('UNINITIALIZED');
      DONE = new Symbol('DONE');
    }
  }
  function checkContext(_this__u8e3s4, currentContext) {
    var result = currentContext.e5(0, checkContext$lambda(_this__u8e3s4));
    if (!(result === _this__u8e3s4.z18_1)) {
      {
        var tmp0_error = 'Flow invariant is violated:\n' + ('\t\tFlow was collected in ' + _this__u8e3s4.y18_1 + ',\n') + ('\t\tbut emission happened in ' + currentContext + '.\n') + "\t\tPlease refer to 'flow' documentation or use 'flowOn' instead";
        throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
      }
    }
  }
  function transitiveCoroutineParent(_this__u8e3s4, collectJob) {
    var $this = _this__u8e3s4;
    var collectJob_0 = collectJob;
    while (true) {
      var $this_0 = $this;
      var collectJob_1 = collectJob_0;
      if ($this_0 === null)
        return null;
      if ($this_0 === collectJob_1)
        return $this_0;
      if (!($this_0 instanceof ScopeCoroutine))
        return $this_0;
      var tmp0 = $this_0.vn();
      var tmp1 = collectJob_1;
      $this = tmp0;
      collectJob_0 = tmp1;
      continue;
    }
  }
  function checkContext$lambda($this_checkContext) {
    return function (count, element) {
      var key = element.x();
      var collectElement = $this_checkContext.y18_1.y4(key);
      var tmp;
      if (!(key === Key_getInstance_3())) {
        return !(element === collectElement) ? IntCompanionObject_getInstance().a1_1 : count + 1 | 0;
      }
      var collectJob = (collectElement == null ? true : isInterface(collectElement, Job)) ? collectElement : THROW_CCE();
      var emissionParentJob = transitiveCoroutineParent(isInterface(element, Job) ? element : THROW_CCE(), collectJob);
      var tmp_0;
      if (!(emissionParentJob === collectJob)) {
        var tmp0_error = 'Flow invariant is violated:\n\t\tEmission from another coroutine is detected.\n' + ('\t\tChild of ' + emissionParentJob + ', expected child of ' + collectJob + '.\n') + '\t\tFlowCollector is not thread-safe and concurrent emissions are prohibited.\n' + "\t\tTo mitigate this restriction please use 'channelFlow' builder instead of 'flow'";
        throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
      }
      return collectJob == null ? count : count + 1 | 0;
    };
  }
  function CancellableFlow() {
  }
  CancellableFlow.$metadata$ = interfaceMeta('CancellableFlow', [Flow]);
  function ensureActive_1(_this__u8e3s4) {
    if (_this__u8e3s4 instanceof ThrowingCollector)
      throw _this__u8e3s4.b19_1;
  }
  function ThrowingCollector() {
  }
  ThrowingCollector.$metadata$ = classMeta('ThrowingCollector', [FlowCollector]);
  function $onSubscriptionCOROUTINE$11(_this__u8e3s4, resultContinuation) {
    CoroutineImpl.call(this, resultContinuation);
    this.k19_1 = _this__u8e3s4;
  }
  $onSubscriptionCOROUTINE$11.prototype.si = function () {
    var suspendResult = this.ki_1;
    $sm: do
      try {
        var tmp = this.ii_1;
        switch (tmp) {
          case 0:
            this.ji_1 = 7;
            var tmp_0 = this;
            tmp_0.l19_1 = new SafeCollector(this.k19_1.x16_1, this.u4());
            this.ii_1 = 1;
            continue $sm;
          case 1:
            this.ji_1 = 6;
            this.ii_1 = 2;
            suspendResult = this.k19_1.y16_1(this.l19_1, this);
            if (suspendResult === get_COROUTINE_SUSPENDED()) {
              return suspendResult;
            }

            continue $sm;
          case 2:
            this.m19_1 = suspendResult;
            this.ji_1 = 7;
            this.ii_1 = 3;
            continue $sm;
          case 3:
            this.l19_1.n19();
            var tmp_1 = this.k19_1.x16_1;
            if (tmp_1 instanceof SubscribedFlowCollector) {
              this.ii_1 = 4;
              suspendResult = this.k19_1.x16_1.z16(this);
              if (suspendResult === get_COROUTINE_SUSPENDED()) {
                return suspendResult;
              }
              continue $sm;
            } else {
              this.ii_1 = 5;
              continue $sm;
            }

            break;
          case 4:
            this.ii_1 = 5;
            continue $sm;
          case 5:
            return Unit_getInstance();
          case 6:
            this.ji_1 = 7;
            var t = this.li_1;
            this.l19_1.n19();
            throw t;
          case 7:
            throw this.li_1;
        }
      } catch ($p) {
        if (this.ji_1 === 7) {
          throw $p;
        } else {
          this.ii_1 = this.ji_1;
          this.li_1 = $p;
        }
      }
     while (true);
  };
  $onSubscriptionCOROUTINE$11.$metadata$ = classMeta('$onSubscriptionCOROUTINE$11', undefined, undefined, undefined, undefined, CoroutineImpl.prototype);
  function SubscribedFlowCollector() {
  }
  SubscribedFlowCollector.prototype.z16 = function ($cont) {
    var tmp = new $onSubscriptionCOROUTINE$11(this, $cont);
    tmp.ki_1 = Unit_getInstance();
    tmp.li_1 = null;
    return tmp.si();
  };
  SubscribedFlowCollector.$metadata$ = classMeta('SubscribedFlowCollector', [FlowCollector]);
  function ensureCapacity($this) {
    var currentSize = $this.vr_1.length;
    var newCapacity = currentSize << 1;
    var tmp$ret$0;
    {
      tmp$ret$0 = fillArrayVal(Array(newCapacity), null);
    }
    var newElements = tmp$ret$0;
    var tmp$ret$1;
    {
      var tmp0_copyInto = $this.vr_1;
      var tmp1_copyInto = $this.wr_1;
      var tmp2_copyInto = tmp0_copyInto.length;
      arrayCopy(tmp0_copyInto, newElements, 0, tmp1_copyInto, tmp2_copyInto);
      tmp$ret$1 = newElements;
    }
    var tmp$ret$2;
    {
      var tmp3_copyInto = $this.vr_1;
      var tmp4_copyInto = $this.vr_1.length - $this.wr_1 | 0;
      var tmp5_copyInto = $this.wr_1;
      arrayCopy(tmp3_copyInto, newElements, tmp4_copyInto, 0, tmp5_copyInto);
      tmp$ret$2 = newElements;
    }
    $this.vr_1 = newElements;
    $this.wr_1 = 0;
    $this.xr_1 = currentSize;
  }
  function ArrayQueue() {
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = fillArrayVal(Array(16), null);
    }
    tmp.vr_1 = tmp$ret$0;
    this.wr_1 = 0;
    this.xr_1 = 0;
  }
  ArrayQueue.prototype.ds = function () {
    return this.wr_1 === this.xr_1;
  };
  ArrayQueue.prototype.as = function (element) {
    this.vr_1[this.xr_1] = element;
    this.xr_1 = (this.xr_1 + 1 | 0) & (this.vr_1.length - 1 | 0);
    if (this.xr_1 === this.wr_1)
      ensureCapacity(this);
  };
  ArrayQueue.prototype.yr = function () {
    if (this.wr_1 === this.xr_1)
      return null;
    var element = this.vr_1[this.wr_1];
    this.vr_1[this.wr_1] = null;
    this.wr_1 = (this.wr_1 + 1 | 0) & (this.vr_1.length - 1 | 0);
    return isObject(element) ? element : THROW_CCE();
  };
  ArrayQueue.$metadata$ = classMeta('ArrayQueue');
  function OpDescriptor() {
  }
  OpDescriptor.$metadata$ = classMeta('OpDescriptor');
  function get_UNDEFINED() {
    init_properties_DispatchedContinuation_kt_s7rtw6();
    return UNDEFINED;
  }
  var UNDEFINED;
  function get_REUSABLE_CLAIMED() {
    init_properties_DispatchedContinuation_kt_s7rtw6();
    return REUSABLE_CLAIMED;
  }
  var REUSABLE_CLAIMED;
  function resumeCancellableWith(_this__u8e3s4, result, onCancellation) {
    init_properties_DispatchedContinuation_kt_s7rtw6();
    var tmp0_subject = _this__u8e3s4;
    var tmp;
    if (tmp0_subject instanceof DispatchedContinuation) {
      var tmp1_resumeCancellableWith = _this__u8e3s4;
      var state = toState_0(result, onCancellation);
      var tmp_0;
      if (tmp1_resumeCancellableWith.qo_1.hr(tmp1_resumeCancellableWith.u4())) {
        tmp1_resumeCancellableWith.so_1 = state;
        tmp1_resumeCancellableWith.o19(get_MODE_CANCELLABLE());
        tmp_0 = tmp1_resumeCancellableWith.qo_1.ir(tmp1_resumeCancellableWith.u4(), tmp1_resumeCancellableWith);
      } else {
        var tmp$ret$0;
        $l$block: {
          var tmp0_executeUnconfined = get_MODE_CANCELLABLE();
          {
          }
          var eventLoop = ThreadLocalEventLoop_getInstance().is();
          if (false ? eventLoop.cs() : false) {
            tmp$ret$0 = false;
            break $l$block;
          }
          var tmp_1;
          if (eventLoop.bs()) {
            tmp1_resumeCancellableWith.so_1 = state;
            tmp1_resumeCancellableWith.o19(tmp0_executeUnconfined);
            eventLoop.zr(tmp1_resumeCancellableWith);
            tmp_1 = true;
          } else {
            {
              eventLoop.es(true);
              try {
                {
                  var tmp$ret$3;
                  $l$block_0: {
                    var job = tmp1_resumeCancellableWith.u4().y4(Key_getInstance_3());
                    if (!(job == null) ? !job.lk() : false) {
                      var cause = job.fl();
                      tmp1_resumeCancellableWith.vp(state, cause);
                      var tmp$ret$2;
                      {
                        var tmp$ret$1;
                        {
                          var tmp0_failure = Companion_getInstance();
                          tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure(cause));
                        }
                        tmp$ret$2 = tmp1_resumeCancellableWith.v4(tmp$ret$1);
                      }
                      tmp$ret$3 = true;
                      break $l$block_0;
                    }
                    tmp$ret$3 = false;
                  }
                  if (!tmp$ret$3) {
                    {
                      var tmp$ret$4;
                      {
                        var tmp0_withContinuationContext = tmp1_resumeCancellableWith.ro_1;
                        var tmp1_withContinuationContext = tmp1_resumeCancellableWith.to_1;
                        tmp$ret$4 = tmp1_resumeCancellableWith.ro_1.v4(result);
                      }
                    }
                  }
                }
                $l$loop: while (true) {
                  if (!eventLoop.ur())
                    break $l$loop;
                }
              } catch ($p) {
                if ($p instanceof Error) {
                  tmp1_resumeCancellableWith.iq($p, null);
                } else {
                  throw $p;
                }
              }
              finally {
                eventLoop.fs(true);
              }
            }
            tmp_1 = false;
          }
          tmp$ret$0 = tmp_1;
        }
        tmp_0 = Unit_getInstance();
      }
      tmp = tmp_0;
    } else {
      tmp = _this__u8e3s4.v4(result);
    }
    return tmp;
  }
  function resumeCancellableWith$default(_this__u8e3s4, result, onCancellation, $mask0, $handler) {
    if (!(($mask0 & 2) === 0))
      onCancellation = null;
    return resumeCancellableWith(_this__u8e3s4, result, onCancellation);
  }
  function _get_reusableCancellableContinuation__9qex09($this) {
    var tmp = $this.uo_1.tj_1;
    return tmp instanceof CancellableContinuationImpl ? tmp : null;
  }
  function DispatchedContinuation(dispatcher, continuation) {
    DispatchedTask.call(this, get_MODE_UNINITIALIZED());
    this.qo_1 = dispatcher;
    this.ro_1 = continuation;
    this.so_1 = get_UNDEFINED();
    this.to_1 = threadContextElements(this.u4());
    this.uo_1 = atomic$ref$1(null);
  }
  DispatchedContinuation.prototype.p19 = function () {
    return this.ro_1;
  };
  DispatchedContinuation.prototype.u4 = function () {
    return this.ro_1.u4();
  };
  DispatchedContinuation.prototype.q19 = function () {
    return this.to_1;
  };
  DispatchedContinuation.prototype.ep = function () {
    return !(this.uo_1.tj_1 == null);
  };
  DispatchedContinuation.prototype.r19 = function () {
    {
      var tmp0_loop = this.uo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (!(tmp1__anonymous__uwfjfc === get_REUSABLE_CLAIMED()))
            return Unit_getInstance();
        }
      }
    }
  };
  DispatchedContinuation.prototype.jr = function () {
    this.r19();
    var tmp0_safe_receiver = _get_reusableCancellableContinuation__9qex09(this);
    if (tmp0_safe_receiver == null)
      null;
    else {
      tmp0_safe_receiver.hp();
    }
  };
  DispatchedContinuation.prototype.vo = function () {
    {
      var tmp0_loop = this.uo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (tmp1__anonymous__uwfjfc === null) {
            this.uo_1.tj_1 = get_REUSABLE_CLAIMED();
            return null;
          } else {
            if (tmp1__anonymous__uwfjfc instanceof CancellableContinuationImpl) {
              if (this.uo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, get_REUSABLE_CLAIMED())) {
                return tmp1__anonymous__uwfjfc instanceof CancellableContinuationImpl ? tmp1__anonymous__uwfjfc : THROW_CCE();
              }
            } else {
              if (tmp1__anonymous__uwfjfc === get_REUSABLE_CLAIMED()) {
              } else {
                if (tmp1__anonymous__uwfjfc instanceof Error) {
                } else {
                  var tmp0_error = 'Inconsistent state ' + toString(tmp1__anonymous__uwfjfc);
                  throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
                }
              }
            }
          }
        }
      }
    }
  };
  DispatchedContinuation.prototype.gp = function (continuation) {
    {
      var tmp0_loop = this.uo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          if (tmp1__anonymous__uwfjfc === get_REUSABLE_CLAIMED()) {
            if (this.uo_1.atomicfu$compareAndSet(get_REUSABLE_CLAIMED(), continuation))
              return null;
          } else {
            if (tmp1__anonymous__uwfjfc instanceof Error) {
              {
                var tmp0_require = this.uo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, null);
                {
                }
                {
                  {
                  }
                  if (!tmp0_require) {
                    var tmp$ret$0;
                    {
                      tmp$ret$0 = 'Failed requirement.';
                    }
                    var message = tmp$ret$0;
                    throw IllegalArgumentException_init_$Create$(toString_0(message));
                  }
                }
              }
              return tmp1__anonymous__uwfjfc;
            } else {
              var tmp1_error = 'Inconsistent state ' + toString(tmp1__anonymous__uwfjfc);
              throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
            }
          }
        }
      }
    }
  };
  DispatchedContinuation.prototype.fp = function (cause) {
    {
      var tmp0_loop = this.uo_1;
      while (true) {
        {
          var tmp1__anonymous__uwfjfc = tmp0_loop.tj_1;
          var tmp0_subject = tmp1__anonymous__uwfjfc;
          if (equals(tmp0_subject, get_REUSABLE_CLAIMED())) {
            if (this.uo_1.atomicfu$compareAndSet(get_REUSABLE_CLAIMED(), cause))
              return true;
          } else {
            if (tmp0_subject instanceof Error)
              return true;
            else {
              if (this.uo_1.atomicfu$compareAndSet(tmp1__anonymous__uwfjfc, null))
                return false;
            }
          }
        }
      }
    }
  };
  DispatchedContinuation.prototype.up = function () {
    var state = this.so_1;
    {
    }
    this.so_1 = get_UNDEFINED();
    return state;
  };
  DispatchedContinuation.prototype.tp = function () {
    return this;
  };
  DispatchedContinuation.prototype.v4 = function (result) {
    var context = this.ro_1.u4();
    var state = toState$default(result, null, 1, null);
    if (this.qo_1.hr(context)) {
      this.so_1 = state;
      this.o19(get_MODE_ATOMIC());
      this.qo_1.ir(context, this);
    } else {
      var tmp$ret$0;
      $l$block: {
        var tmp0_executeUnconfined = get_MODE_ATOMIC();
        {
        }
        var eventLoop = ThreadLocalEventLoop_getInstance().is();
        if (false ? eventLoop.cs() : false) {
          tmp$ret$0 = false;
          break $l$block;
        }
        var tmp;
        if (eventLoop.bs()) {
          this.so_1 = state;
          this.o19(tmp0_executeUnconfined);
          eventLoop.zr(this);
          tmp = true;
        } else {
          {
            eventLoop.es(true);
            try {
              {
                var tmp$ret$1;
                {
                  var tmp0_withCoroutineContext = this.u4();
                  var tmp1_withCoroutineContext = this.to_1;
                  tmp$ret$1 = this.ro_1.v4(result);
                }
              }
              $l$loop: while (true) {
                if (!eventLoop.ur())
                  break $l$loop;
              }
            } catch ($p) {
              if ($p instanceof Error) {
                this.iq($p, null);
              } else {
                throw $p;
              }
            }
            finally {
              eventLoop.fs(true);
            }
          }
          tmp = false;
        }
        tmp$ret$0 = tmp;
      }
    }
  };
  DispatchedContinuation.prototype.vp = function (takenState, cause) {
    if (takenState instanceof CompletedWithCancellation) {
      takenState.fr_1(cause);
    }
  };
  DispatchedContinuation.prototype.s19 = function (state) {
    var job = this.u4().y4(Key_getInstance_3());
    if (!(job == null) ? !job.lk() : false) {
      var cause = job.fl();
      this.vp(state, cause);
      var tmp$ret$1;
      {
        var tmp$ret$0;
        {
          var tmp0_failure = Companion_getInstance();
          tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(cause));
        }
        tmp$ret$1 = this.v4(tmp$ret$0);
      }
      return true;
    }
    return false;
  };
  DispatchedContinuation.prototype.t19 = function (result) {
    var tmp$ret$0;
    {
      var tmp0_withContinuationContext = this.ro_1;
      var tmp1_withContinuationContext = this.to_1;
      tmp$ret$0 = this.ro_1.v4(result);
    }
  };
  DispatchedContinuation.prototype.toString = function () {
    return 'DispatchedContinuation[' + this.qo_1 + ', ' + toDebugString(this.ro_1) + ']';
  };
  DispatchedContinuation.$metadata$ = classMeta('DispatchedContinuation', [CoroutineStackFrame, Continuation], undefined, undefined, undefined, DispatchedTask.prototype);
  function executeUnconfined(_this__u8e3s4, contState, mode, doYield, block) {
    init_properties_DispatchedContinuation_kt_s7rtw6();
    {
    }
    var eventLoop = ThreadLocalEventLoop_getInstance().is();
    if (doYield ? eventLoop.cs() : false)
      return false;
    var tmp;
    if (eventLoop.bs()) {
      _this__u8e3s4.so_1 = contState;
      _this__u8e3s4.o19(mode);
      eventLoop.zr(_this__u8e3s4);
      tmp = true;
    } else {
      {
        eventLoop.es(true);
        try {
          block();
          $l$loop: while (true) {
            if (!eventLoop.ur())
              break $l$loop;
          }
        } catch ($p) {
          if ($p instanceof Error) {
            _this__u8e3s4.iq($p, null);
          } else {
            throw $p;
          }
        }
        finally {
          eventLoop.fs(true);
        }
      }
      tmp = false;
    }
    return tmp;
  }
  var properties_initialized_DispatchedContinuation_kt_2siadq;
  function init_properties_DispatchedContinuation_kt_s7rtw6() {
    if (properties_initialized_DispatchedContinuation_kt_2siadq) {
    } else {
      properties_initialized_DispatchedContinuation_kt_2siadq = true;
      UNDEFINED = new Symbol('UNDEFINED');
      REUSABLE_CLAIMED = new Symbol('REUSABLE_CLAIMED');
    }
  }
  function get_MODE_CANCELLABLE() {
    return MODE_CANCELLABLE;
  }
  var MODE_CANCELLABLE;
  function DispatchedTask(resumeMode) {
    SchedulerTask.call(this);
    this.cp_1 = resumeMode;
  }
  DispatchedTask.prototype.o19 = function (_set____db54di) {
    this.cp_1 = _set____db54di;
  };
  DispatchedTask.prototype.dp = function () {
    return this.cp_1;
  };
  DispatchedTask.prototype.vp = function (takenState, cause) {
  };
  DispatchedTask.prototype.cq = function (state) {
    return (state == null ? true : isObject(state)) ? state : THROW_CCE();
  };
  DispatchedTask.prototype.gq = function (state) {
    var tmp0_safe_receiver = state instanceof CompletedExceptionally ? state : null;
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.qk_1;
  };
  DispatchedTask.prototype.hq = function () {
    {
    }
    var taskContext = get_taskContext(this);
    var fatalException = null;
    try {
      var tmp$ret$0;
      {
        var tmp0_useLocal = this.tp();
        tmp$ret$0 = tmp0_useLocal;
      }
      var tmp = tmp$ret$0;
      var delegate = tmp instanceof DispatchedContinuation ? tmp : THROW_CCE();
      var continuation = delegate.ro_1;
      var tmp$ret$6;
      {
        var tmp1_withContinuationContext = delegate.to_1;
        var context = continuation.u4();
        var state = this.up();
        var exception = this.gq(state);
        var job = (exception == null ? get_isCancellableMode(this.cp_1) : false) ? context.y4(Key_getInstance_3()) : null;
        var tmp_0;
        if (!(job == null) ? !job.lk() : false) {
          var cause = job.fl();
          this.vp(state, cause);
          var tmp$ret$1;
          {
            var tmp0_failure = Companion_getInstance();
            var tmp1_failure = recoverStackTrace(cause, continuation);
            tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure(tmp1_failure));
          }
          tmp_0 = continuation.v4(tmp$ret$1);
        } else {
          var tmp_1;
          if (!(exception == null)) {
            var tmp$ret$3;
            {
              var tmp$ret$2;
              {
                var tmp0_failure_0 = Companion_getInstance();
                tmp$ret$2 = _Result___init__impl__xyqfz8(createFailure(exception));
              }
              tmp$ret$3 = continuation.v4(tmp$ret$2);
            }
            tmp_1 = tmp$ret$3;
          } else {
            var tmp$ret$5;
            {
              var tmp2_resume = this.cq(state);
              var tmp$ret$4;
              {
                var tmp0_success = Companion_getInstance();
                tmp$ret$4 = _Result___init__impl__xyqfz8(tmp2_resume);
              }
              tmp$ret$5 = continuation.v4(tmp$ret$4);
            }
            tmp_1 = tmp$ret$5;
          }
          tmp_0 = tmp_1;
        }
        tmp$ret$6 = tmp_0;
      }
    } catch ($p) {
      if ($p instanceof Error) {
        fatalException = $p;
      } else {
        throw $p;
      }
    }
    finally {
      var tmp$ret$9;
      {
        var tmp_2;
        try {
          var tmp$ret$7;
          {
            var tmp0_success_0 = Companion_getInstance();
            var tmp1_success = Unit_getInstance();
            tmp$ret$7 = _Result___init__impl__xyqfz8(Unit_getInstance());
          }
          tmp_2 = tmp$ret$7;
        } catch ($p) {
          var tmp_3;
          if ($p instanceof Error) {
            var tmp$ret$8;
            {
              var tmp2_failure = Companion_getInstance();
              tmp$ret$8 = _Result___init__impl__xyqfz8(createFailure($p));
            }
            tmp_3 = tmp$ret$8;
          } else {
            throw $p;
          }
          tmp_2 = tmp_3;
        }
        tmp$ret$9 = tmp_2;
      }
      var result = tmp$ret$9;
      this.iq(fatalException, Result__exceptionOrNull_impl_p6xea9(result));
    }
  };
  DispatchedTask.prototype.iq = function (exception, finallyException) {
    if (exception === null ? finallyException === null : false)
      return Unit_getInstance();
    if (!(exception === null) ? !(finallyException === null) : false) {
      {
      }
    }
    var tmp0_elvis_lhs = exception;
    var cause = tmp0_elvis_lhs == null ? finallyException : tmp0_elvis_lhs;
    var reason = new CoroutinesInternalError('Fatal exception in coroutines machinery for ' + this + '. ' + "Please read KDoc to 'handleFatalException' method and report this incident to maintainers", ensureNotNull(cause));
    handleCoroutineException(this.tp().u4(), reason);
  };
  DispatchedTask.$metadata$ = classMeta('DispatchedTask', undefined, undefined, undefined, undefined, SchedulerTask.prototype);
  function get_MODE_UNINITIALIZED() {
    return MODE_UNINITIALIZED;
  }
  var MODE_UNINITIALIZED;
  function get_isReusableMode(_this__u8e3s4) {
    return _this__u8e3s4 === 2;
  }
  function get_MODE_CANCELLABLE_REUSABLE() {
    return MODE_CANCELLABLE_REUSABLE;
  }
  var MODE_CANCELLABLE_REUSABLE;
  function get_isCancellableMode(_this__u8e3s4) {
    return _this__u8e3s4 === 1 ? true : _this__u8e3s4 === 2;
  }
  function dispatch(_this__u8e3s4, mode) {
    {
    }
    var delegate = _this__u8e3s4.jo_1;
    var tmp$ret$0;
    {
      tmp$ret$0 = delegate;
    }
    var local = tmp$ret$0;
    var undispatched = mode === 4;
    var tmp;
    var tmp_0;
    if (!undispatched) {
      tmp_0 = local instanceof DispatchedContinuation;
    } else {
      tmp_0 = false;
    }
    if (tmp_0) {
      tmp = get_isCancellableMode(mode) === get_isCancellableMode(_this__u8e3s4.dp());
    } else {
      tmp = false;
    }
    if (tmp) {
      var dispatcher = local.qo_1;
      var context = local.u4();
      if (dispatcher.hr(context)) {
        dispatcher.ir(context, _this__u8e3s4);
      } else {
        resumeUnconfined(_this__u8e3s4);
      }
    } else {
      var tmp$ret$1;
      {
        tmp$ret$1 = resume(_this__u8e3s4, delegate, undispatched);
      }
    }
  }
  function get_MODE_UNDISPATCHED() {
    return MODE_UNDISPATCHED;
  }
  var MODE_UNDISPATCHED;
  function get_MODE_ATOMIC() {
    return MODE_ATOMIC;
  }
  var MODE_ATOMIC;
  function runUnconfinedEventLoop(_this__u8e3s4, eventLoop, block) {
    eventLoop.es(true);
    try {
      block();
      $l$loop: while (true) {
        if (!eventLoop.ur())
          break $l$loop;
      }
    } catch ($p) {
      if ($p instanceof Error) {
        _this__u8e3s4.iq($p, null);
      } else {
        throw $p;
      }
    }
    finally {
      eventLoop.fs(true);
    }
  }
  function resumeUnconfined(_this__u8e3s4) {
    var eventLoop = ThreadLocalEventLoop_getInstance().is();
    if (eventLoop.bs()) {
      eventLoop.zr(_this__u8e3s4);
    } else {
      {
        eventLoop.es(true);
        try {
          {
            var tmp$ret$0;
            {
              var tmp0_useLocal = _this__u8e3s4.jo_1;
              tmp$ret$0 = tmp0_useLocal;
            }
            resume(_this__u8e3s4, tmp$ret$0, true);
          }
          $l$loop: while (true) {
            if (!eventLoop.ur())
              break $l$loop;
          }
        } catch ($p) {
          if ($p instanceof Error) {
            _this__u8e3s4.iq($p, null);
          } else {
            throw $p;
          }
        }
        finally {
          eventLoop.fs(true);
        }
      }
    }
  }
  function resume(_this__u8e3s4, delegate, undispatched) {
    var state = _this__u8e3s4.up();
    var exception = _this__u8e3s4.gq(state);
    var tmp;
    if (!(exception == null)) {
      var tmp$ret$0;
      {
        var tmp0_failure = Companion_getInstance();
        tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(exception));
      }
      tmp = tmp$ret$0;
    } else {
      var tmp$ret$1;
      {
        var tmp1_success = Companion_getInstance();
        var tmp2_success = _this__u8e3s4.cq(state);
        tmp$ret$1 = _Result___init__impl__xyqfz8(tmp2_success);
      }
      tmp = tmp$ret$1;
    }
    var result = tmp;
    if (undispatched) {
      var tmp3_resumeUndispatchedWith = delegate instanceof DispatchedContinuation ? delegate : THROW_CCE();
      var tmp$ret$2;
      {
        var tmp0_withContinuationContext = tmp3_resumeUndispatchedWith.ro_1;
        var tmp1_withContinuationContext = tmp3_resumeUndispatchedWith.to_1;
        tmp$ret$2 = tmp3_resumeUndispatchedWith.ro_1.v4(result);
      }
    } else
      delegate.v4(result);
  }
  function _InlineList___init__impl__z8n56(holder) {
    return holder;
  }
  function _InlineList___init__impl__z8n56_0(holder, $mask0, $marker) {
    if (!(($mask0 & 1) === 0))
      holder = null;
    var tmp = _InlineList___init__impl__z8n56(holder);
    return tmp;
  }
  function _get_holder__f6h5pd($this) {
    return $this;
  }
  function InlineList__plus_impl_nuetvo($this, element) {
    {
    }
    var tmp0_subject = _get_holder__f6h5pd($this);
    var tmp;
    if (tmp0_subject == null) {
      tmp = _InlineList___init__impl__z8n56(element);
    } else {
      if (tmp0_subject instanceof ArrayList) {
        var tmp_0 = _get_holder__f6h5pd($this);
        (tmp_0 instanceof ArrayList ? tmp_0 : THROW_CCE()).a(element);
        tmp = _InlineList___init__impl__z8n56(_get_holder__f6h5pd($this));
      } else {
        var list = ArrayList_init_$Create$(4);
        var tmp_1 = _get_holder__f6h5pd($this);
        list.a((tmp_1 == null ? true : isObject(tmp_1)) ? tmp_1 : THROW_CCE());
        list.a(element);
        tmp = _InlineList___init__impl__z8n56(list);
      }
    }
    return tmp;
  }
  function InlineList__forEachReversed_impl_jituug($this, action) {
    var tmp0_subject = _get_holder__f6h5pd($this);
    if (tmp0_subject == null)
      return Unit_getInstance();
    else {
      if (!(tmp0_subject instanceof ArrayList)) {
        var tmp = _get_holder__f6h5pd($this);
        action((tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE());
      } else {
        var tmp_0 = _get_holder__f6h5pd($this);
        var list = tmp_0 instanceof ArrayList ? tmp_0 : THROW_CCE();
        var inductionVariable = list.j() - 1 | 0;
        if (0 <= inductionVariable)
          do {
            var i = inductionVariable;
            inductionVariable = inductionVariable + -1 | 0;
            action(list.l(i));
          }
           while (0 <= inductionVariable);
      }
    }
  }
  function InlineList__toString_impl_1aej86($this) {
    return 'InlineList(holder=' + toString($this) + ')';
  }
  function InlineList__hashCode_impl_n1kg11($this) {
    return $this == null ? 0 : hashCode($this);
  }
  function InlineList__equals_impl_wwe0i1($this, other) {
    if (!(other instanceof InlineList))
      return false;
    var tmp0_other_with_cast = other instanceof InlineList ? other.u19_1 : THROW_CCE();
    if (!equals($this, tmp0_other_with_cast))
      return false;
    return true;
  }
  function InlineList(holder) {
    this.u19_1 = holder;
  }
  InlineList.prototype.toString = function () {
    return InlineList__toString_impl_1aej86(this.u19_1);
  };
  InlineList.prototype.hashCode = function () {
    return InlineList__hashCode_impl_n1kg11(this.u19_1);
  };
  InlineList.prototype.equals = function (other) {
    return InlineList__equals_impl_wwe0i1(this.u19_1, other);
  };
  InlineList.$metadata$ = classMeta('InlineList');
  function bindCancellationFun(_this__u8e3s4, element, context) {
    return bindCancellationFun$lambda(_this__u8e3s4, element, context);
  }
  function UndeliveredElementException(message, cause) {
    RuntimeException_init_$Init$(message, cause, this);
    captureStack(this, UndeliveredElementException);
  }
  UndeliveredElementException.$metadata$ = classMeta('UndeliveredElementException', undefined, undefined, undefined, undefined, RuntimeException.prototype);
  function callUndeliveredElementCatchingException(_this__u8e3s4, element, undeliveredElementException) {
    try {
      _this__u8e3s4(element);
    } catch ($p) {
      if ($p instanceof Error) {
        if (!(undeliveredElementException == null) ? !(undeliveredElementException.cause === $p) : false) {
          {
          }
        } else {
          return new UndeliveredElementException('Exception in undelivered element handler for ' + element, $p);
        }
      } else {
        throw $p;
      }
    }
    return undeliveredElementException;
  }
  function callUndeliveredElementCatchingException$default(_this__u8e3s4, element, undeliveredElementException, $mask0, $handler) {
    if (!(($mask0 & 2) === 0))
      undeliveredElementException = null;
    return callUndeliveredElementCatchingException(_this__u8e3s4, element, undeliveredElementException);
  }
  function callUndeliveredElement(_this__u8e3s4, element, context) {
    var tmp0_safe_receiver = callUndeliveredElementCatchingException(_this__u8e3s4, element, null);
    if (tmp0_safe_receiver == null)
      null;
    else {
      var tmp$ret$0;
      {
        {
        }
        tmp$ret$0 = handleCoroutineException(context, tmp0_safe_receiver);
      }
    }
  }
  function bindCancellationFun$lambda($this_bindCancellationFun, $element, $context) {
    return function (_anonymous_parameter_0__qggqh8) {
      callUndeliveredElement($this_bindCancellationFun, $element, $context);
      return Unit_getInstance();
    };
  }
  function ScopeCoroutine(context, uCont, useInitNativeKludge) {
    AbstractCoroutine.call(this, context, true, true);
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = uCont;
    }
    tmp.tn_1 = tmp$ret$0;
    var tmp_0;
    if (useInitNativeKludge) {
      var tmp$ret$1;
      {
        tmp$ret$1 = true;
      }
      tmp_0 = !tmp$ret$1;
    } else {
      tmp_0 = false;
    }
    if (tmp_0)
      this.on();
  }
  ScopeCoroutine.prototype.un = function () {
    return this.tn_1;
  };
  ScopeCoroutine.prototype.xl = function () {
    return true;
  };
  ScopeCoroutine.prototype.vn = function () {
    var tmp0_safe_receiver = this.al();
    return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.vn();
  };
  ScopeCoroutine.prototype.on = function () {
    this.ik(this.jk().y4(Key_getInstance_3()));
  };
  ScopeCoroutine.prototype.vk = function (state) {
    {
      var tmp0_shareableInterceptedResumeCancellableWith = this.tn_1;
      var tmp1_shareableInterceptedResumeCancellableWith = recoverResult(state, this.tn_1);
      var tmp = intercepted(tmp0_shareableInterceptedResumeCancellableWith);
      resumeCancellableWith$default(tmp, tmp1_shareableInterceptedResumeCancellableWith, null, 2, null);
    }
  };
  ScopeCoroutine.prototype.uk = function (state) {
    this.tn_1.v4(recoverResult(state, this.tn_1));
  };
  ScopeCoroutine.$metadata$ = classMeta('ScopeCoroutine', [CoroutineStackFrame], undefined, undefined, undefined, AbstractCoroutine.prototype);
  function ContextScope(context) {
    this.v19_1 = context;
  }
  ContextScope.prototype.kk = function () {
    return this.v19_1;
  };
  ContextScope.prototype.toString = function () {
    return 'CoroutineScope(coroutineContext=' + this.v19_1 + ')';
  };
  ContextScope.$metadata$ = classMeta('ContextScope', [CoroutineScope]);
  function Symbol(symbol) {
    this.w19_1 = symbol;
  }
  Symbol.prototype.toString = function () {
    return '<' + this.w19_1 + '>';
  };
  Symbol.prototype.x19 = function (value) {
    var tmp;
    if (value === this) {
      tmp = (null == null ? true : isObject(null)) ? null : THROW_CCE();
    } else {
      tmp = (value == null ? true : isObject(value)) ? value : THROW_CCE();
    }
    return tmp;
  };
  Symbol.$metadata$ = classMeta('Symbol');
  function systemProp(propertyName, defaultValue, minValue, maxValue) {
    return systemProp_0(propertyName, toLong(defaultValue), toLong(minValue), toLong(maxValue)).m8();
  }
  function systemProp_0(propertyName, defaultValue, minValue, 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 tmp0_error = "System property '" + propertyName + "' has unrecognized value '" + value + "'";
      throw IllegalStateException_init_$Create$(toString_0(tmp0_error));
    } else {
      tmp_0 = tmp1_elvis_lhs;
    }
    var parsed = tmp_0;
    if (!(minValue.g1(parsed) <= 0 ? parsed.g1(maxValue) <= 0 : false)) {
      {
        var tmp1_error = "System property '" + propertyName + "' should be in range " + toString_0(minValue) + '..' + toString_0(maxValue) + ", but is '" + toString_0(parsed) + "'";
        throw IllegalStateException_init_$Create$(toString_0(tmp1_error));
      }
    }
    return parsed;
  }
  function startCoroutineCancellable(_this__u8e3s4, receiver, completion, onCancellation) {
    var tmp;
    try {
      var tmp_0 = intercepted(createCoroutineUnintercepted(_this__u8e3s4, receiver, completion));
      var tmp$ret$0;
      {
        var tmp0_success = Companion_getInstance();
        tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_getInstance());
      }
      tmp = resumeCancellableWith(tmp_0, tmp$ret$0, onCancellation);
    } catch ($p) {
      var tmp_1;
      if ($p instanceof Error) {
        tmp_1 = dispatcherFailure$accessor$glj1hg(completion, $p);
      } else {
        throw $p;
      }
      tmp = tmp_1;
    }
    return tmp;
  }
  function dispatcherFailure(completion, e) {
    var tmp$ret$0;
    {
      var tmp0_failure = Companion_getInstance();
      tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(e));
    }
    completion.v4(tmp$ret$0);
    throw e;
  }
  function startCoroutineCancellable_0(_this__u8e3s4, fatalCompletion) {
    var tmp;
    try {
      var tmp_0 = intercepted(_this__u8e3s4);
      var tmp$ret$0;
      {
        var tmp0_success = Companion_getInstance();
        tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_getInstance());
      }
      var tmp_1 = tmp$ret$0;
      tmp = resumeCancellableWith$default(tmp_0, tmp_1, null, 2, null);
    } catch ($p) {
      var tmp_2;
      if ($p instanceof Error) {
        tmp_2 = dispatcherFailure$accessor$glj1hg(fatalCompletion, $p);
      } else {
        throw $p;
      }
      tmp = tmp_2;
    }
    return tmp;
  }
  function dispatcherFailure$accessor$glj1hg(completion, e) {
    return dispatcherFailure(completion, e);
  }
  function startDirect(completion, block) {
    var tmp$ret$0;
    {
      tmp$ret$0 = completion;
    }
    var actualCompletion = tmp$ret$0;
    var tmp;
    try {
      tmp = block(actualCompletion);
    } catch ($p) {
      var tmp_0;
      if ($p instanceof Error) {
        var tmp$ret$2;
        {
          var tmp$ret$1;
          {
            var tmp0_failure = Companion_getInstance();
            tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure($p));
          }
          tmp$ret$2 = actualCompletion.v4(tmp$ret$1);
        }
        return Unit_getInstance();
      } else {
        throw $p;
      }
      tmp = tmp_0;
    }
    var value = tmp;
    if (!(value === get_COROUTINE_SUSPENDED())) {
      var tmp$ret$4;
      {
        var tmp0_resume = (value == null ? true : isObject(value)) ? value : THROW_CCE();
        var tmp$ret$3;
        {
          var tmp0_success = Companion_getInstance();
          tmp$ret$3 = _Result___init__impl__xyqfz8(tmp0_resume);
        }
        tmp$ret$4 = actualCompletion.v4(tmp$ret$3);
      }
    }
  }
  function startUndispatchedOrReturn(_this__u8e3s4, receiver, block) {
    var tmp$ret$3;
    $l$block_0: {
      var tmp;
      try {
        var tmp$ret$2;
        {
          var tmp$ret$1;
          {
            var tmp$ret$0;
            {
              tmp$ret$0 = block;
            }
            var a = tmp$ret$0;
            tmp$ret$1 = typeof a === 'function' ? a(receiver, _this__u8e3s4) : block.ui(receiver, _this__u8e3s4);
          }
          tmp$ret$2 = tmp$ret$1;
        }
        tmp = tmp$ret$2;
      } catch ($p) {
        var tmp_0;
        if ($p instanceof Error) {
          tmp_0 = CompletedExceptionally_init_$Create$($p, false, 2, null);
        } else {
          throw $p;
        }
        tmp = tmp_0;
      }
      var result = tmp;
      if (result === get_COROUTINE_SUSPENDED()) {
        tmp$ret$3 = get_COROUTINE_SUSPENDED();
        break $l$block_0;
      }
      var state = _this__u8e3s4.tk(result);
      if (state === get_COMPLETING_WAITING_CHILDREN()) {
        tmp$ret$3 = get_COROUTINE_SUSPENDED();
        break $l$block_0;
      }
      {
      }
      var tmp_1;
      if (state instanceof CompletedExceptionally) {
        var tmp_2;
        var tmp$ret$4;
        {
          var tmp0__anonymous__q1qw7t = state.qk_1;
          tmp$ret$4 = true;
        }
        if (tmp$ret$4) {
          throw recoverStackTrace(state.qk_1, _this__u8e3s4.tn_1);
        } else {
          if (result instanceof CompletedExceptionally) {
            throw recoverStackTrace(result.qk_1, _this__u8e3s4.tn_1);
          } else {
            tmp_2 = result;
          }
        }
        tmp_1 = tmp_2;
      } else {
        tmp_1 = unboxState(state);
      }
      tmp$ret$3 = tmp_1;
    }
    return tmp$ret$3;
  }
  function undispatchedResult(_this__u8e3s4, shouldThrow, startBlock) {
    var tmp;
    try {
      tmp = startBlock();
    } catch ($p) {
      var tmp_0;
      if ($p instanceof Error) {
        tmp_0 = CompletedExceptionally_init_$Create$($p, false, 2, null);
      } else {
        throw $p;
      }
      tmp = tmp_0;
    }
    var result = tmp;
    if (result === get_COROUTINE_SUSPENDED())
      return get_COROUTINE_SUSPENDED();
    var state = _this__u8e3s4.tk(result);
    if (state === get_COMPLETING_WAITING_CHILDREN())
      return get_COROUTINE_SUSPENDED();
    {
    }
    var tmp_1;
    if (state instanceof CompletedExceptionally) {
      var tmp_2;
      if (shouldThrow(state.qk_1)) {
        throw recoverStackTrace(state.qk_1, _this__u8e3s4.tn_1);
      } else {
        if (result instanceof CompletedExceptionally) {
          throw recoverStackTrace(result.qk_1, _this__u8e3s4.tn_1);
        } else {
          tmp_2 = result;
        }
      }
      tmp_1 = tmp_2;
    } else {
      tmp_1 = unboxState(state);
    }
    return tmp_1;
  }
  function startCoroutineUndispatched(_this__u8e3s4, receiver, completion) {
    var tmp$ret$8;
    $l$block: {
      var tmp$ret$0;
      {
        tmp$ret$0 = completion;
      }
      var actualCompletion = tmp$ret$0;
      var tmp;
      try {
        var tmp$ret$5;
        {
          var tmp$ret$4;
          {
            var tmp0_withCoroutineContext = completion.u4();
            var tmp$ret$3;
            {
              var tmp$ret$2;
              {
                var tmp$ret$1;
                {
                  tmp$ret$1 = _this__u8e3s4;
                }
                var a = tmp$ret$1;
                tmp$ret$2 = typeof a === 'function' ? a(receiver, actualCompletion) : _this__u8e3s4.ui(receiver, actualCompletion);
              }
              tmp$ret$3 = tmp$ret$2;
            }
            tmp$ret$4 = tmp$ret$3;
          }
          tmp$ret$5 = tmp$ret$4;
        }
        tmp = tmp$ret$5;
      } catch ($p) {
        var tmp_0;
        if ($p instanceof Error) {
          var tmp$ret$7;
          {
            var tmp$ret$6;
            {
              var tmp0_failure = Companion_getInstance();
              tmp$ret$6 = _Result___init__impl__xyqfz8(createFailure($p));
            }
            tmp$ret$7 = actualCompletion.v4(tmp$ret$6);
          }
          tmp$ret$8 = Unit_getInstance();
          break $l$block;
        } else {
          throw $p;
        }
        tmp = tmp_0;
      }
      var value = tmp;
      if (!(value === get_COROUTINE_SUSPENDED())) {
        var tmp$ret$10;
        {
          var tmp0_resume = (value == null ? true : isObject(value)) ? value : THROW_CCE();
          var tmp$ret$9;
          {
            var tmp0_success = Companion_getInstance();
            tmp$ret$9 = _Result___init__impl__xyqfz8(tmp0_resume);
          }
          tmp$ret$10 = actualCompletion.v4(tmp$ret$9);
        }
      }
    }
  }
  function SelectClause0() {
  }
  SelectClause0.$metadata$ = interfaceMeta('SelectClause0');
  function SelectClause1() {
  }
  SelectClause1.$metadata$ = interfaceMeta('SelectClause1');
  function saveLazyCoroutine(coroutine, receiver, block) {
    return createCoroutineUnintercepted(block, receiver, coroutine);
  }
  function startLazyCoroutine(saved, coroutine, receiver) {
    return startCoroutineCancellable_0(isInterface(saved, Continuation) ? saved : THROW_CCE(), coroutine);
  }
  function startAbstractCoroutine(start, receiver, coroutine, block) {
    startCoroutineImpl(start, receiver, coroutine, null, block);
  }
  function CompletionHandlerBase() {
    LinkedListNode.call(this);
  }
  CompletionHandlerBase.$metadata$ = classMeta('CompletionHandlerBase', undefined, undefined, undefined, undefined, LinkedListNode.prototype);
  function invokeIt(_this__u8e3s4, cause) {
    var tmp0_subject = typeof _this__u8e3s4;
    if (tmp0_subject === 'function')
      _this__u8e3s4(cause);
    else {
      var tmp$ret$0;
      {
        tmp$ret$0 = _this__u8e3s4;
      }
      tmp$ret$0.invoke(cause);
    }
  }
  function get_asHandler(_this__u8e3s4) {
    var tmp$ret$0;
    {
      tmp$ret$0 = _this__u8e3s4;
    }
    return tmp$ret$0;
  }
  function get_asHandler_0(_this__u8e3s4) {
    var tmp$ret$0;
    {
      tmp$ret$0 = _this__u8e3s4;
    }
    return tmp$ret$0;
  }
  function CancelHandlerBase() {
  }
  CancelHandlerBase.$metadata$ = classMeta('CancelHandlerBase');
  function toDebugString(_this__u8e3s4) {
    return toString_0(_this__u8e3s4);
  }
  function withCoroutineContext(context, countOrElement, block) {
    return block();
  }
  function withContinuationContext(continuation, countOrElement, block) {
    return block();
  }
  function get_DefaultDelay() {
    var tmp = Dispatchers_getInstance().bw_1;
    return isInterface(tmp, Delay) ? tmp : THROW_CCE();
  }
  function createDefaultDispatcher() {
    var tmp;
    if (isJsdom()) {
      tmp = NodeDispatcher_getInstance();
    } else {
      var tmp_0;
      var tmp_1;
      if (!(typeof window === 'undefined')) {
        var tmp$ret$0;
        {
          var tmp0_asDynamic = window;
          tmp$ret$0 = tmp0_asDynamic;
        }
        tmp_1 = tmp$ret$0 != null;
      } else {
        tmp_1 = false;
      }
      if (tmp_1) {
        var tmp$ret$1;
        {
          var tmp1_asDynamic = window;
          tmp$ret$1 = tmp1_asDynamic;
        }
        tmp_0 = !(typeof tmp$ret$1.addEventListener === 'undefined');
      } else {
        tmp_0 = false;
      }
      if (tmp_0) {
        tmp = asCoroutineDispatcher(window);
      } else {
        if (typeof process === 'undefined' ? true : typeof process.nextTick === 'undefined') {
          tmp = SetTimeoutDispatcher_getInstance();
        } else {
          tmp = NodeDispatcher_getInstance();
        }
      }
    }
    return tmp;
  }
  function isJsdom() {
    return ((((!(typeof navigator === 'undefined') ? navigator != null : false) ? navigator.userAgent != null : false) ? !(typeof navigator.userAgent === 'undefined') : false) ? !(typeof navigator.userAgent.match === 'undefined') : false) ? navigator.userAgent.match('\\bjsdom\\b') : false;
  }
  function newCoroutineContext(_this__u8e3s4, context) {
    var combined = _this__u8e3s4.kk().f5(context);
    return (!(combined === Dispatchers_getInstance().bw_1) ? combined.y4(Key_getInstance()) == null : false) ? combined.f5(Dispatchers_getInstance().bw_1) : combined;
  }
  function UndispatchedCoroutine(context, uCont) {
    ScopeCoroutine.call(this, context, uCont, true);
  }
  UndispatchedCoroutine.prototype.uk = function (state) {
    return this.un().v4(recoverResult(state, this.un()));
  };
  UndispatchedCoroutine.$metadata$ = classMeta('UndispatchedCoroutine', undefined, undefined, undefined, undefined, ScopeCoroutine.prototype);
  function get_coroutineName(_this__u8e3s4) {
    return null;
  }
  function initializeDefaultExceptionHandlers() {
  }
  function handleCoroutineExceptionImpl(context, exception) {
    console.error(exception);
  }
  var counter;
  function get_DEBUG() {
    return DEBUG;
  }
  var DEBUG;
  function get_classSimpleName(_this__u8e3s4) {
    var tmp0_elvis_lhs = getKClassFromExpression(_this__u8e3s4).me();
    return tmp0_elvis_lhs == null ? 'Unknown' : tmp0_elvis_lhs;
  }
  function get_hexAddress(_this__u8e3s4) {
    var tmp$ret$0;
    {
      tmp$ret$0 = _this__u8e3s4;
    }
    var result = tmp$ret$0.__debug_counter;
    if (!(typeof result === 'number')) {
      counter = counter + 1 | 0;
      result = counter;
      var tmp$ret$1;
      {
        tmp$ret$1 = _this__u8e3s4;
      }
      tmp$ret$1.__debug_counter = result;
    }
    return ((!(result == null) ? typeof result === 'number' : false) ? result : THROW_CCE()).toString();
  }
  function assert(value) {
  }
  function Dispatchers() {
    Dispatchers_instance = this;
    this.bw_1 = createDefaultDispatcher();
    this.cw_1 = Unconfined_getInstance();
    this.dw_1 = new JsMainDispatcher(this.bw_1, false);
    this.ew_1 = null;
  }
  Dispatchers.prototype.fw = function () {
    var tmp0_elvis_lhs = this.ew_1;
    return tmp0_elvis_lhs == null ? this.dw_1 : tmp0_elvis_lhs;
  };
  Dispatchers.$metadata$ = objectMeta('Dispatchers');
  var Dispatchers_instance;
  function Dispatchers_getInstance() {
    if (Dispatchers_instance == null)
      new Dispatchers();
    return Dispatchers_instance;
  }
  function JsMainDispatcher(delegate, invokeImmediately) {
    MainCoroutineDispatcher.call(this);
    this.e1a_1 = delegate;
    this.f1a_1 = invokeImmediately;
    this.g1a_1 = this.f1a_1 ? this : new JsMainDispatcher(this.e1a_1, true);
  }
  JsMainDispatcher.prototype.zv = function () {
    return this.g1a_1;
  };
  JsMainDispatcher.prototype.hr = function (context) {
    return !this.f1a_1;
  };
  JsMainDispatcher.prototype.ir = function (context, block) {
    return this.e1a_1.ir(context, block);
  };
  JsMainDispatcher.prototype.toString = function () {
    var tmp0_elvis_lhs = this.aw();
    return tmp0_elvis_lhs == null ? this.e1a_1.toString() : tmp0_elvis_lhs;
  };
  JsMainDispatcher.$metadata$ = classMeta('JsMainDispatcher', undefined, undefined, undefined, undefined, MainCoroutineDispatcher.prototype);
  function platformAutoreleasePool(block) {
    return block();
  }
  function createEventLoop() {
    return new UnconfinedEventLoop();
  }
  function UnconfinedEventLoop() {
    EventLoop.call(this);
  }
  UnconfinedEventLoop.prototype.ir = function (context, block) {
    unsupported();
  };
  UnconfinedEventLoop.$metadata$ = classMeta('UnconfinedEventLoop', undefined, undefined, undefined, undefined, EventLoop.prototype);
  function unsupported() {
    throw UnsupportedOperationException_init_$Create$('runBlocking event loop is not supported');
  }
  function JobCancellationException(message, cause, job) {
    CancellationException_init_$Init$(message, cause, this);
    this.l1a_1 = job;
    captureStack(this, JobCancellationException);
  }
  JobCancellationException.prototype.toString = function () {
    return CancellationException.prototype.toString.call(this) + '; job=' + this.l1a_1;
  };
  JobCancellationException.prototype.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.l1a_1, this.l1a_1);
      } else {
        tmp_1 = false;
      }
      if (tmp_1) {
        tmp_0 = equals(other.cause, this.cause);
      } else {
        tmp_0 = false;
      }
      tmp = tmp_0;
    }
    return tmp;
  };
  JobCancellationException.prototype.hashCode = function () {
    var tmp = imul(getStringHashCode(ensureNotNull(this.message)), 31);
    var tmp$ret$0;
    {
      var tmp0_hashCode = this.l1a_1;
      var tmp0_safe_receiver = tmp0_hashCode;
      var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver);
      tmp$ret$0 = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs;
    }
    var tmp_0 = imul(tmp + tmp$ret$0 | 0, 31);
    var tmp0_safe_receiver_0 = this.cause;
    var tmp1_elvis_lhs_0 = tmp0_safe_receiver_0 == null ? null : hashCode(tmp0_safe_receiver_0);
    return tmp_0 + (tmp1_elvis_lhs_0 == null ? 0 : tmp1_elvis_lhs_0) | 0;
  };
  JobCancellationException.$metadata$ = classMeta('JobCancellationException', undefined, undefined, undefined, undefined, CancellationException.prototype);
  function addSuppressedThrowable(_this__u8e3s4, other) {
  }
  function NodeDispatcher() {
    NodeDispatcher_instance = this;
    SetTimeoutBasedDispatcher.call(this);
  }
  NodeDispatcher.prototype.o1a = function () {
    process.nextTick(this.y1a().u1a_1);
  };
  NodeDispatcher.$metadata$ = objectMeta('NodeDispatcher', undefined, undefined, undefined, undefined, SetTimeoutBasedDispatcher.prototype);
  var NodeDispatcher_instance;
  function NodeDispatcher_getInstance() {
    if (NodeDispatcher_instance == null)
      new NodeDispatcher();
    return NodeDispatcher_instance;
  }
  function SetTimeoutDispatcher() {
    SetTimeoutDispatcher_instance = this;
    SetTimeoutBasedDispatcher.call(this);
  }
  SetTimeoutDispatcher.prototype.o1a = function () {
    setTimeout(this.y1a().u1a_1, 0);
  };
  SetTimeoutDispatcher.$metadata$ = objectMeta('SetTimeoutDispatcher', undefined, undefined, undefined, undefined, SetTimeoutBasedDispatcher.prototype);
  var SetTimeoutDispatcher_instance;
  function SetTimeoutDispatcher_getInstance() {
    if (SetTimeoutDispatcher_instance == null)
      new SetTimeoutDispatcher();
    return SetTimeoutDispatcher_instance;
  }
  function SetTimeoutBasedDispatcher$ScheduledMessageQueue$processQueue$lambda(this$0) {
    return function () {
      this$0.g1b();
      return Unit_getInstance();
    };
  }
  function ScheduledMessageQueue($outer) {
    this.v1a_1 = $outer;
    MessageQueue.call(this);
    var tmp = this;
    tmp.u1a_1 = SetTimeoutBasedDispatcher$ScheduledMessageQueue$processQueue$lambda(this);
  }
  ScheduledMessageQueue.prototype.h1b = function () {
    this.v1a_1.o1a();
  };
  ScheduledMessageQueue.prototype.i1b = function () {
    setTimeout(this.u1a_1, 0);
  };
  ScheduledMessageQueue.$metadata$ = classMeta('ScheduledMessageQueue', undefined, undefined, undefined, undefined, MessageQueue.prototype);
  function SetTimeoutBasedDispatcher$scheduleResumeAfterDelay$lambda($continuation, this$0) {
    return function () {
      var tmp$ret$0;
      {
        {
        }
        tmp$ret$0 = $continuation.do(this$0, Unit_getInstance());
      }
      return Unit_getInstance();
    };
  }
  function SetTimeoutBasedDispatcher() {
    CoroutineDispatcher.call(this);
    this.x1a_1 = new ScheduledMessageQueue(this);
  }
  SetTimeoutBasedDispatcher.prototype.y1a = function () {
    return this.x1a_1;
  };
  SetTimeoutBasedDispatcher.prototype.ir = function (context, block) {
    this.x1a_1.j1b(block);
  };
  SetTimeoutBasedDispatcher.prototype.pr = function (timeMillis, continuation) {
    var handle = setTimeout(SetTimeoutBasedDispatcher$scheduleResumeAfterDelay$lambda(continuation, this), delayToInt(timeMillis));
    var tmp$ret$1;
    {
      var tmp0__get_asHandler__gq3rkj = new ClearTimeout(handle);
      var tmp$ret$0;
      {
        tmp$ret$0 = tmp0__get_asHandler__gq3rkj;
      }
      tmp$ret$1 = tmp$ret$0;
    }
    continuation.co(tmp$ret$1);
  };
  SetTimeoutBasedDispatcher.$metadata$ = classMeta('SetTimeoutBasedDispatcher', [Delay], undefined, undefined, undefined, CoroutineDispatcher.prototype);
  function MessageQueue() {
    ArrayQueue.call(this);
    this.e1b_1 = 16;
    this.f1b_1 = false;
  }
  MessageQueue.prototype.j1b = function (element) {
    this.as(element);
    if (!this.f1b_1) {
      this.f1b_1 = true;
      this.h1b();
    }
  };
  MessageQueue.prototype.g1b = function () {
    try {
      {
        var tmp0_repeat = this.e1b_1;
        {
        }
        var inductionVariable = 0;
        if (inductionVariable < tmp0_repeat)
          do {
            var index = inductionVariable;
            inductionVariable = inductionVariable + 1 | 0;
            {
              var tmp0_elvis_lhs = this.yr();
              var tmp;
              if (tmp0_elvis_lhs == null) {
                return Unit_getInstance();
              } else {
                tmp = tmp0_elvis_lhs;
              }
              var element = tmp;
              element.hq();
            }
          }
           while (inductionVariable < tmp0_repeat);
      }
    }finally {
      if (this.ds()) {
        this.f1b_1 = false;
      } else {
        this.i1b();
      }
    }
  };
  MessageQueue.$metadata$ = classMeta('MessageQueue', undefined, undefined, undefined, undefined, ArrayQueue.prototype);
  function delayToInt(timeMillis) {
    return coerceIn(timeMillis, new Long(0, 0), new Long(2147483647, 0)).m8();
  }
  function ClearTimeout(handle) {
    CancelHandler.call(this);
    this.k1b_1 = handle;
  }
  ClearTimeout.prototype.ho = function () {
    clearTimeout(this.k1b_1);
  };
  ClearTimeout.prototype.go = function (cause) {
    this.ho();
  };
  ClearTimeout.prototype.invoke = function (cause) {
    return this.go(cause);
  };
  ClearTimeout.prototype.toString = function () {
    return 'ClearTimeout[' + this.k1b_1 + ']';
  };
  ClearTimeout.$metadata$ = classMeta('ClearTimeout', [DisposableHandle], undefined, undefined, undefined, CancelHandler.prototype);
  function WindowDispatcher$scheduleResumeAfterDelay$lambda($continuation, this$0) {
    return function () {
      var tmp$ret$0;
      {
        {
        }
        tmp$ret$0 = $continuation.do(this$0, Unit_getInstance());
      }
      return Unit_getInstance();
    };
  }
  function WindowDispatcher(window_0) {
    CoroutineDispatcher.call(this);
    this.m1b_1 = window_0;
    this.n1b_1 = new WindowMessageQueue(this.m1b_1);
  }
  WindowDispatcher.prototype.ir = function (context, block) {
    return this.n1b_1.j1b(block);
  };
  WindowDispatcher.prototype.pr = function (timeMillis, continuation) {
    this.m1b_1.setTimeout(WindowDispatcher$scheduleResumeAfterDelay$lambda(continuation, this), delayToInt(timeMillis));
  };
  WindowDispatcher.$metadata$ = classMeta('WindowDispatcher', [Delay], undefined, undefined, undefined, CoroutineDispatcher.prototype);
  function WindowMessageQueue$lambda(this$0) {
    return function (event) {
      var tmp;
      if (event.source == this$0.t1b_1 ? event.data == this$0.u1b_1 : false) {
        event.stopPropagation();
        tmp = this$0.g1b();
      }
      return Unit_getInstance();
    };
  }
  function WindowMessageQueue$schedule$lambda(this$0) {
    return function (it) {
      this$0.g1b();
      return Unit_getInstance();
    };
  }
  function WindowMessageQueue(window_0) {
    MessageQueue.call(this);
    this.t1b_1 = window_0;
    this.u1b_1 = 'dispatchCoroutine';
    this.t1b_1.addEventListener('message', WindowMessageQueue$lambda(this), true);
  }
  WindowMessageQueue.prototype.h1b = function () {
    var tmp = Promise.resolve(Unit_getInstance());
    tmp.then(WindowMessageQueue$schedule$lambda(this));
  };
  WindowMessageQueue.prototype.i1b = function () {
    this.t1b_1.postMessage(this.u1b_1, '*');
  };
  WindowMessageQueue.$metadata$ = classMeta('WindowMessageQueue', undefined, undefined, undefined, undefined, MessageQueue.prototype);
  function await_0(_this__u8e3s4, $cont) {
    var tmp$ret$0;
    {
      var tmp0__anonymous__q1qw7t = $cont;
      var cancellable = new CancellableContinuationImpl(intercepted(tmp0__anonymous__q1qw7t), get_MODE_CANCELLABLE());
      cancellable.oo();
      {
        var tmp = await$lambda(cancellable);
        _this__u8e3s4.then(tmp, await$lambda_0(cancellable));
      }
      tmp$ret$0 = cancellable.km();
    }
    return tmp$ret$0;
  }
  function await$lambda($cancellable) {
    return function (it) {
      var tmp$ret$1;
      {
        var tmp$ret$0;
        {
          var tmp0_success = Companion_getInstance();
          tmp$ret$0 = _Result___init__impl__xyqfz8(it);
        }
        tmp$ret$1 = $cancellable.v4(tmp$ret$0);
      }
      return Unit_getInstance();
    };
  }
  function await$lambda_0($cancellable) {
    return function (it) {
      var tmp$ret$1;
      {
        var tmp$ret$0;
        {
          var tmp0_failure = Companion_getInstance();
          tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(it));
        }
        tmp$ret$1 = $cancellable.v4(tmp$ret$0);
      }
      return Unit_getInstance();
    };
  }
  function Runnable() {
  }
  Runnable.$metadata$ = interfaceMeta('Runnable');
  function SchedulerTask() {
  }
  SchedulerTask.$metadata$ = classMeta('SchedulerTask', [Runnable]);
  function get_taskContext(_this__u8e3s4) {
    return Unit_getInstance();
  }
  function asCoroutineDispatcher(_this__u8e3s4) {
    var tmp$ret$0;
    {
      tmp$ret$0 = _this__u8e3s4;
    }
    var tmp0_elvis_lhs = tmp$ret$0.coroutineDispatcher;
    var tmp;
    if (tmp0_elvis_lhs == null) {
      var tmp$ret$2;
      {
        var tmp0_also = new WindowDispatcher(_this__u8e3s4);
        {
        }
        {
          var tmp$ret$1;
          {
            tmp$ret$1 = _this__u8e3s4;
          }
          tmp$ret$1.coroutineDispatcher = tmp0_also;
        }
        tmp$ret$2 = tmp0_also;
      }
      tmp = tmp$ret$2;
    } else {
      tmp = tmp0_elvis_lhs;
    }
    return tmp;
  }
  function ArrayBufferState(initialBufferSize) {
    var tmp = this;
    var tmp$ret$0;
    {
      tmp$ret$0 = fillArrayVal(Array(initialBufferSize), null);
    }
    tmp.f11_1 = tmp$ret$0;
  }
  ArrayBufferState.prototype.v1b = function (_set____db54di) {
    this.f11_1 = _set____db54di;
  };
  ArrayBufferState.prototype.he = function () {
    return this.f11_1;
  };
  ArrayBufferState.prototype.g11 = function () {
    return this.f11_1.length;
  };
  ArrayBufferState.prototype.j11 = function (index) {
    return this.f11_1[index];
  };
  ArrayBufferState.prototype.h11 = function (index, value) {
    this.f11_1[index] = value;
  };
  ArrayBufferState.prototype.w1b = function (block) {
    return block();
  };
  ArrayBufferState.$metadata$ = classMeta('ArrayBufferState');
  function ArrayChannelState(initialBufferSize) {
    ArrayBufferState.call(this, initialBufferSize);
    this.x10_1 = 0;
    this.y10_1 = 0;
  }
  ArrayChannelState.prototype.x1b = function (_set____db54di) {
    this.x10_1 = _set____db54di;
  };
  ArrayChannelState.prototype.y1b = function () {
    return this.x10_1;
  };
  ArrayChannelState.prototype.z1b = function (_set____db54di) {
    this.y10_1 = _set____db54di;
  };
  ArrayChannelState.prototype.j = function () {
    return this.y10_1;
  };
  ArrayChannelState.prototype.i11 = function (currentSize, capacity) {
    if (currentSize < this.he().length)
      return Unit_getInstance();
    var tmp$ret$0;
    {
      var tmp0_min = imul(this.he().length, 2);
      tmp$ret$0 = Math.min(tmp0_min, capacity);
    }
    var newSize = tmp$ret$0;
    var tmp$ret$1;
    {
      tmp$ret$1 = fillArrayVal(Array(newSize), null);
    }
    var newBuffer = tmp$ret$1;
    var inductionVariable = 0;
    if (inductionVariable < currentSize)
      do {
        var i = inductionVariable;
        inductionVariable = inductionVariable + 1 | 0;
        newBuffer[i] = this.he()[(this.x10_1 + i | 0) % this.he().length | 0];
      }
       while (inductionVariable < currentSize);
    this.v1b(newBuffer);
    this.x10_1 = 0;
  };
  ArrayChannelState.$metadata$ = classMeta('ArrayChannelState', undefined, undefined, undefined, undefined, ArrayBufferState.prototype);
  function ConflatedChannelState() {
    this.y11_1 = get_EMPTY();
  }
  ConflatedChannelState.prototype.y = function () {
    return this.y11_1;
  };
  ConflatedChannelState.prototype.w1b = function (block) {
    return block();
  };
  ConflatedChannelState.$metadata$ = classMeta('ConflatedChannelState');
  function SafeCollector$collectContextSize$lambda() {
    return function (count, _anonymous_parameter_1__qggqgd) {
      return count + 1 | 0;
    };
  }
  function SafeCollector(collector, collectContext) {
    this.x18_1 = collector;
    this.y18_1 = collectContext;
    var tmp = this;
    tmp.z18_1 = this.y18_1.e5(0, SafeCollector$collectContextSize$lambda());
    this.a19_1 = null;
  }
  SafeCollector.prototype.u14 = function (value, $cont) {
    var tmp$ret$1;
    {
      var tmp$ret$0;
      {
        tmp$ret$0 = $cont.u4();
      }
      tmp$ret$1 = tmp$ret$0;
    }
    var currentContext = tmp$ret$1;
    ensureActive(currentContext);
    if (!(this.a19_1 === currentContext)) {
      checkContext(this, currentContext);
      this.a19_1 = currentContext;
    }
    return this.x18_1.u14(value, $cont);
  };
  SafeCollector.prototype.n19 = function () {
  };
  SafeCollector.$metadata$ = classMeta('SafeCollector', [FlowCollector]);
  function identitySet(expectedSize) {
    return HashSet_init_$Create$(expectedSize);
  }
  function LinkedListHead() {
    LinkedListNode.call(this);
  }
  LinkedListHead.prototype.bp = function () {
    throw UnsupportedOperationException_init_$Create$_0();
  };
  LinkedListHead.$metadata$ = classMeta('LinkedListHead', undefined, undefined, undefined, undefined, LinkedListNode.prototype);
  function LinkedListNode() {
    this.yo_1 = this;
    this.zo_1 = this;
    this.ap_1 = false;
  }
  LinkedListNode.prototype.ss = function () {
    return this.yo_1;
  };
  LinkedListNode.prototype.ws = function () {
    return this.yo_1;
  };
  LinkedListNode.prototype.xs = function () {
    return this.zo_1;
  };
  LinkedListNode.prototype.ys = function () {
    return this.ap_1;
  };
  LinkedListNode.prototype.zs = function (node) {
    var prev = this.zo_1;
    node.yo_1 = this;
    node.zo_1 = prev;
    prev.yo_1 = node;
    this.zo_1 = node;
  };
  LinkedListNode.prototype.bp = function () {
    return this.at();
  };
  LinkedListNode.prototype.at = function () {
    if (this.ap_1)
      return false;
    var prev = this.zo_1;
    var next = this.yo_1;
    prev.yo_1 = next;
    next.zo_1 = prev;
    this.ap_1 = true;
    return true;
  };
  LinkedListNode.prototype.kt = function (node) {
    if (!(this.yo_1 === this))
      return false;
    this.zs(node);
    return true;
  };
  LinkedListNode.prototype.bt = function (node, condition) {
    if (!condition())
      return false;
    this.zs(node);
    return true;
  };
  LinkedListNode.prototype.ct = function (node, predicate) {
    if (!predicate(this.zo_1))
      return false;
    this.zs(node);
    return true;
  };
  LinkedListNode.prototype.dt = function (node, predicate, condition) {
    if (!predicate(this.zo_1))
      return false;
    if (!condition())
      return false;
    this.zs(node);
    return true;
  };
  LinkedListNode.prototype.et = function () {
  };
  LinkedListNode.$metadata$ = classMeta('LinkedListNode');
  function disposeLockFreeLinkedList(list) {
  }
  function probeCoroutineCreated(completion) {
    return completion;
  }
  function addOrUpdate(_this__u8e3s4, element, update) {
    _this__u8e3s4.a(element);
  }
  function asShareable(_this__u8e3s4) {
    return _this__u8e3s4;
  }
  function isReuseSupportedInPlatform() {
    return true;
  }
  function disposeContinuation(cont) {
  }
  function asLocalOrNullIfNotUsed(_this__u8e3s4) {
    return _this__u8e3s4;
  }
  function useLocal(_this__u8e3s4) {
    return _this__u8e3s4;
  }
  function asLocalOrNull(_this__u8e3s4) {
    return _this__u8e3s4;
  }
  function shareableResume(_this__u8e3s4, delegate, undispatched) {
    return resume(_this__u8e3s4, delegate, undispatched);
  }
  function shareableInterceptedResumeCancellableWith(_this__u8e3s4, result) {
    var tmp = intercepted(_this__u8e3s4);
    resumeCancellableWith$default(tmp, result, null, 2, null);
  }
  function unwrap(exception) {
    return exception;
  }
  function CoroutineStackFrame() {
  }
  CoroutineStackFrame.$metadata$ = interfaceMeta('CoroutineStackFrame');
  function recoverStackTrace(exception, continuation) {
    return exception;
  }
  function recoverStackTrace_0(exception) {
    return exception;
  }
  function synchronized(lock, block) {
    return block();
  }
  function systemProp_1(propertyName) {
    return null;
  }
  function threadContextElements(context) {
    return 0;
  }
  function CommonThreadLocal() {
    this.js_1 = null;
  }
  CommonThreadLocal.prototype.ks = function () {
    var tmp = this.js_1;
    return (tmp == null ? true : isObject(tmp)) ? tmp : THROW_CCE();
  };
  CommonThreadLocal.prototype.ls = function (value) {
    this.js_1 = value;
  };
  CommonThreadLocal.$metadata$ = classMeta('CommonThreadLocal');
  //region block: post-declaration
  JobSupport.prototype.kl = invokeOnCompletion$default;
  JobSupport.prototype.ol = cancel$default;
  JobSupport.prototype.f5 = plus;
  JobSupport.prototype.y4 = get;
  JobSupport.prototype.e5 = fold;
  JobSupport.prototype.d5 = minusKey;
  AbstractCoroutine.prototype.kl = invokeOnCompletion$default;
  AbstractCoroutine.prototype.ol = cancel$default;
  AbstractCoroutine.prototype.f5 = plus;
  AbstractCoroutine.prototype.y4 = get;
  AbstractCoroutine.prototype.e5 = fold;
  AbstractCoroutine.prototype.d5 = minusKey;
  StandaloneCoroutine.prototype.kl = invokeOnCompletion$default;
  StandaloneCoroutine.prototype.ol = cancel$default;
  StandaloneCoroutine.prototype.f5 = plus;
  StandaloneCoroutine.prototype.y4 = get;
  StandaloneCoroutine.prototype.e5 = fold;
  StandaloneCoroutine.prototype.d5 = minusKey;
  LazyStandaloneCoroutine.prototype.kl = invokeOnCompletion$default;
  LazyStandaloneCoroutine.prototype.ol = cancel$default;
  LazyStandaloneCoroutine.prototype.f5 = plus;
  LazyStandaloneCoroutine.prototype.y4 = get;
  LazyStandaloneCoroutine.prototype.e5 = fold;
  LazyStandaloneCoroutine.prototype.d5 = minusKey;
  DeferredCoroutine.prototype.kl = invokeOnCompletion$default;
  DeferredCoroutine.prototype.ol = cancel$default;
  DeferredCoroutine.prototype.f5 = plus;
  DeferredCoroutine.prototype.y4 = get;
  DeferredCoroutine.prototype.e5 = fold;
  DeferredCoroutine.prototype.d5 = minusKey;
  LazyDeferredCoroutine.prototype.kl = invokeOnCompletion$default;
  LazyDeferredCoroutine.prototype.ol = cancel$default;
  LazyDeferredCoroutine.prototype.f5 = plus;
  LazyDeferredCoroutine.prototype.y4 = get;
  LazyDeferredCoroutine.prototype.e5 = fold;
  LazyDeferredCoroutine.prototype.d5 = minusKey;
  ScopeCoroutine.prototype.kl = invokeOnCompletion$default;
  ScopeCoroutine.prototype.ol = cancel$default;
  ScopeCoroutine.prototype.f5 = plus;
  ScopeCoroutine.prototype.y4 = get;
  ScopeCoroutine.prototype.e5 = fold;
  ScopeCoroutine.prototype.d5 = minusKey;
  DispatchedCoroutine.prototype.kl = invokeOnCompletion$default;
  DispatchedCoroutine.prototype.ol = cancel$default;
  DispatchedCoroutine.prototype.f5 = plus;
  DispatchedCoroutine.prototype.y4 = get;
  DispatchedCoroutine.prototype.e5 = fold;
  DispatchedCoroutine.prototype.d5 = minusKey;
  CancellableContinuationImpl.prototype.yn = tryResume$default;
  CompletableDeferredImpl.prototype.kl = invokeOnCompletion$default;
  CompletableDeferredImpl.prototype.ol = cancel$default;
  CompletableDeferredImpl.prototype.f5 = plus;
  CompletableDeferredImpl.prototype.y4 = get;
  CompletableDeferredImpl.prototype.e5 = fold;
  CompletableDeferredImpl.prototype.d5 = minusKey;
  CoroutineDispatcher.prototype.y4 = get_0;
  CoroutineDispatcher.prototype.e5 = fold;
  CoroutineDispatcher.prototype.d5 = minusKey_0;
  CoroutineDispatcher.prototype.f5 = plus;
  _no_name_provided__qut3iv.prototype.y4 = get;
  _no_name_provided__qut3iv.prototype.e5 = fold;
  _no_name_provided__qut3iv.prototype.d5 = minusKey;
  _no_name_provided__qut3iv.prototype.f5 = plus;
  CoroutineName.prototype.y4 = get;
  CoroutineName.prototype.e5 = fold;
  CoroutineName.prototype.d5 = minusKey;
  CoroutineName.prototype.f5 = plus;
  EventLoop.prototype.f5 = plus;
  EventLoop.prototype.y4 = get_0;
  EventLoop.prototype.e5 = fold;
  EventLoop.prototype.d5 = minusKey_0;
  AwaitContinuation.prototype.yn = tryResume$default;
  JobImpl.prototype.kl = invokeOnCompletion$default;
  JobImpl.prototype.ol = cancel$default;
  JobImpl.prototype.f5 = plus;
  JobImpl.prototype.y4 = get;
  JobImpl.prototype.e5 = fold;
  JobImpl.prototype.d5 = minusKey;
  MainCoroutineDispatcher.prototype.f5 = plus;
  MainCoroutineDispatcher.prototype.y4 = get_0;
  MainCoroutineDispatcher.prototype.e5 = fold;
  MainCoroutineDispatcher.prototype.d5 = minusKey_0;
  SupervisorJobImpl.prototype.kl = invokeOnCompletion$default;
  SupervisorJobImpl.prototype.ol = cancel$default;
  SupervisorJobImpl.prototype.f5 = plus;
  SupervisorJobImpl.prototype.y4 = get;
  SupervisorJobImpl.prototype.e5 = fold;
  SupervisorJobImpl.prototype.d5 = minusKey;
  Unconfined.prototype.f5 = plus;
  Unconfined.prototype.y4 = get_0;
  Unconfined.prototype.e5 = fold;
  Unconfined.prototype.d5 = minusKey_0;
  AbstractSendChannel.prototype.wz = close$default;
  AbstractChannel.prototype.ol = cancel$default_0;
  AbstractChannel.prototype.wz = close$default;
  ArrayChannel.prototype.ol = cancel$default_0;
  ArrayChannel.prototype.wz = close$default;
  ChannelCoroutine.prototype.wz = close$default;
  ChannelCoroutine.prototype.ol = cancel$default;
  ChannelCoroutine.prototype.kl = invokeOnCompletion$default;
  ChannelCoroutine.prototype.f5 = plus;
  ChannelCoroutine.prototype.y4 = get;
  ChannelCoroutine.prototype.e5 = fold;
  ChannelCoroutine.prototype.d5 = minusKey;
  ConflatedChannel.prototype.ol = cancel$default_0;
  ConflatedChannel.prototype.wz = close$default;
  LinkedListChannel.prototype.ol = cancel$default_0;
  LinkedListChannel.prototype.wz = close$default;
  ProducerCoroutine.prototype.wz = close$default;
  ProducerCoroutine.prototype.ol = cancel$default;
  ProducerCoroutine.prototype.kl = invokeOnCompletion$default;
  ProducerCoroutine.prototype.f5 = plus;
  ProducerCoroutine.prototype.y4 = get;
  ProducerCoroutine.prototype.e5 = fold;
  ProducerCoroutine.prototype.d5 = minusKey;
  RendezvousChannel.prototype.ol = cancel$default_0;
  RendezvousChannel.prototype.wz = close$default;
  UndispatchedCoroutine.prototype.kl = invokeOnCompletion$default;
  UndispatchedCoroutine.prototype.ol = cancel$default;
  UndispatchedCoroutine.prototype.f5 = plus;
  UndispatchedCoroutine.prototype.y4 = get;
  UndispatchedCoroutine.prototype.e5 = fold;
  UndispatchedCoroutine.prototype.d5 = minusKey;
  JsMainDispatcher.prototype.f5 = plus;
  JsMainDispatcher.prototype.y4 = get_0;
  JsMainDispatcher.prototype.e5 = fold;
  JsMainDispatcher.prototype.d5 = minusKey_0;
  UnconfinedEventLoop.prototype.f5 = plus;
  UnconfinedEventLoop.prototype.y4 = get_0;
  UnconfinedEventLoop.prototype.e5 = fold;
  UnconfinedEventLoop.prototype.d5 = minusKey_0;
  SetTimeoutBasedDispatcher.prototype.f5 = plus;
  SetTimeoutBasedDispatcher.prototype.y4 = get_0;
  SetTimeoutBasedDispatcher.prototype.e5 = fold;
  SetTimeoutBasedDispatcher.prototype.d5 = minusKey_0;
  NodeDispatcher.prototype.f5 = plus;
  NodeDispatcher.prototype.y4 = get_0;
  NodeDispatcher.prototype.e5 = fold;
  NodeDispatcher.prototype.d5 = minusKey_0;
  SetTimeoutDispatcher.prototype.f5 = plus;
  SetTimeoutDispatcher.prototype.y4 = get_0;
  SetTimeoutDispatcher.prototype.e5 = fold;
  SetTimeoutDispatcher.prototype.d5 = minusKey_0;
  WindowDispatcher.prototype.f5 = plus;
  WindowDispatcher.prototype.y4 = get_0;
  WindowDispatcher.prototype.e5 = fold;
  WindowDispatcher.prototype.d5 = minusKey_0;
  //endregion
  //region block: init
  UNDECIDED = 0;
  SUSPENDED = 1;
  RESUMED = 2;
  UNDECIDED_0 = 0;
  SUSPENDED_0 = 1;
  RESUMED_0 = 2;
  FALSE = 0;
  TRUE = 1;
  DEFAULT_CLOSE_MESSAGE = 'Channel was closed';
  MODE_CANCELLABLE = 1;
  MODE_UNINITIALIZED = -1;
  MODE_CANCELLABLE_REUSABLE = 2;
  MODE_UNDISPATCHED = 4;
  MODE_ATOMIC = 0;
  counter = 0;
  DEBUG = false;
  //endregion
  //region block: exports
  _.$_$ = _.$_$ || {};
  _.$_$.a = awaitClose;
  _.$_$.b = await_0;
  _.$_$.c = delay;
  _.$_$.d = withContext;
  _.$_$.e = Channel$default;
  _.$_$.f = CompletableDeferred$default;
  _.$_$.g = cancel$default;
  _.$_$.h = invokeOnCompletion$default;
  _.$_$.i = Job$default;
  _.$_$.j = SupervisorJob$default;
  _.$_$.k = async$default;
  _.$_$.l = cancel$default_1;
  _.$_$.m = launch$default;
  _.$_$.n = Factory_getInstance;
  _.$_$.o = Key_getInstance_0;
  _.$_$.p = Key_getInstance_1;
  _.$_$.q = Dispatchers_getInstance;
  _.$_$.r = GlobalScope_getInstance;
  _.$_$.s = Key_getInstance_3;
  _.$_$.t = ProducerScope;
  _.$_$.u = cancelConsumed;
  _.$_$.v = FlowCollector;
  _.$_$.w = MutableStateFlow_0;
  _.$_$.x = callbackFlow;
  _.$_$.y = recoverStackTrace;
  _.$_$.z = CancellableContinuationImpl;
  _.$_$.a1 = CompletableJob;
  _.$_$.b1 = CoroutineExceptionHandler;
  _.$_$.c1 = CoroutineName;
  _.$_$.d1 = CoroutineScope_0;
  _.$_$.e1 = CoroutineScope;
  _.$_$.f1 = DisposableHandle;
  _.$_$.g1 = Job_0;
  _.$_$.h1 = Job;
  _.$_$.i1 = get_MODE_CANCELLABLE;
  _.$_$.j1 = SupervisorJob;
  _.$_$.k1 = cancel;
  _.$_$.l1 = cancel_2;
  _.$_$.m1 = cancel_0;
  _.$_$.n1 = cancel_1;
  _.$_$.o1 = get_isActive;
  //endregion
  return _;
}));

//# sourceMappingURL=kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js.map