UNPKG

@kform/core

Version:

JavaScript bindings for KForm.

1,671 lines (1,670 loc) 351 kB
import { Unit_instance1fbcbse1fwigr as Unit_instance, THROW_CCE2g6jy02ryeudk as THROW_CCE, Continuation1aa2oekvx7jm7 as Continuation, initMetadataForClassbxx6q50dy2s7 as initMetadataForClass, VOID3gxj6tk5isa35 as VOID, EmptyCoroutineContext_getInstance31fow51ayy30t as EmptyCoroutineContext_getInstance, createCoroutineUnintercepted3gya308dmbbtg as createCoroutineUnintercepted, Key_instance17k9ki7fvysxq as Key_instance, equals2au1ep9vhcato as equals, IllegalStateExceptionkoljg5n0nrlr as IllegalStateException, toString1pkumu07cwy4m as toString, intercepted2ogpsikxxj4u0 as intercepted, get_COROUTINE_SUSPENDED3ujt3p13qm4iy as get_COROUTINE_SUSPENDED, initMetadataForInterface1egvbzx539z91 as initMetadataForInterface, UnsupportedOperationException2tkumpmhredt3 as UnsupportedOperationException, isInterface3d6p8outrmvmk as isInterface, toString30pk9tzaqopn as toString_0, initMetadataForObject1cxne3s9w65el as initMetadataForObject, hashCodeq5arwsb9dgti as hashCode, CoroutineImpl2sn3kjnwmfr10 as CoroutineImpl, initMetadataForCoroutine1i7lbatuf5bnt as initMetadataForCoroutine, CancellationException3b36o9qz53rgr as CancellationException, Result__exceptionOrNull_impl_p6xea9ty3elzpd9eo3 as Result__exceptionOrNull_impl_p6xea9, _Result___get_value__impl__bjfvqg2ei4op8d4d2m as _Result___get_value__impl__bjfvqg, Companion_instance2oawqq9qiaris as Companion_instance, _Result___init__impl__xyqfz83hut4nr3dfvi3 as _Result___init__impl__xyqfz8, createFailure8paxfkfa5dc7 as createFailure, AbstractCoroutineContextKey9xr9r6wlj5bm as AbstractCoroutineContextKey, AbstractCoroutineContextElement2rpehg0hv5szw as AbstractCoroutineContextElement, getxe4seun860fg as get, protoOf180f3jzyo7rfj as protoOf, minusKey2uxs00uz5ceqp as minusKey, ContinuationInterceptor2624y0vaqwxwf as ContinuationInterceptor, RuntimeException1r3t0zl97011n as RuntimeException, addSuppressedu5jwjfvsc039 as addSuppressed, getStringHashCode26igk1bx568vk as getStringHashCode, Enum3alwj03lh1n41 as Enum, startCoroutine327fwvtqvedik as startCoroutine, noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException, Long2qws0ah9gnpki as Long, ArrayDeque2dzc9uld4xi7n as ArrayDeque, captureStack1fzi4aczwc4hg as captureStack, Error3ofk6owajcepa as Error_0, Element2gr7ezmxqaln7 as Element, StringBuildermazzzhj6kkai as StringBuilder, throwUninitializedPropertyAccessExceptionyynx7gkm73wd as throwUninitializedPropertyAccessException, ArrayList3it5z8td81qkl as ArrayList, plusolev77jfy5r9 as plus, get6d5x931vk0s as get_0, fold36i9psb7d5v48 as fold, minusKeyyqanvso9aovh as minusKey_0, anyToString3ho3k49fc56mj as anyToString, ensureNotNull1e947j3ixpazm as ensureNotNull, toLongw1zpgk99d84b as toLong, IllegalArgumentException2asla15b5jaob as IllegalArgumentException, listOf1jh22dvmctj1r as listOf, NoSuchElementException679xzhnp5bpj as NoSuchElementException, compareTo3ankvs086tmwq as compareTo, last2n4gf5az1lkn4 as last, _Char___init__impl__6a9atx2js6krycynjoo as _Char___init__impl__6a9atx, initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion, getKClass1s3j9wy1cofik as getKClass, copyOf2ng0t8oizk6it as copyOf, FunctionAdapter3lcrrz3moet5b as FunctionAdapter, initMetadataForLambda3af3he42mmnh as initMetadataForLambda, throwKotlinNothingValueException2lxmvl03dor6f as throwKotlinNothingValueException, Exceptiondt2hlxn7j7vw as Exception, toLongOrNullutqivezb0wx1 as toLongOrNull, startCoroutineUninterceptedOrReturnNonGeneratorVersionyfrrvzbtl8bf as startCoroutineUninterceptedOrReturnNonGeneratorVersion, plus20p0vtfmu0596 as plus_0, KtList3hktaavzmj137 as KtList, listOfvhqybd2zx248 as listOf_0, Unitkvevlwgzwiuc as Unit, getKClassFromExpression3vpejubogshaw as getKClassFromExpression, removeFirstOrNull15yg2tczrh8a7 as removeFirstOrNull, MutableIterablez3x4ksk1fmrm as MutableIterable, Collection1k04j3hzsbod0 as Collection, HashSet2dzve9y63nf0v as HashSet, LinkedHashSet2tkztfx86kyx2 as LinkedHashSet, } from './kotlin-kotlin-stdlib.mjs'; import { atomic$int$11d5swdyn6j0pu as atomic$int$1, atomic$ref$130aurmcwdfdf1 as atomic$ref$1, atomic$boolean$1iggki4z65a2h as atomic$boolean$1, atomicfu$AtomicRefArray$ofNulls2kz3j9ehigwa3 as atomicfu$AtomicRefArray$ofNulls, atomic$long$129k9zwo6n9ogd as atomic$long$1, } from './kotlinx-atomicfu.mjs'; //region block: imports var imul = Math.imul; //endregion //region block: pre-declaration class Job {} function cancel$default(cause, $super) { cause = cause === VOID ? null : cause; var tmp; if ($super === VOID) { this.n14(cause); tmp = Unit_instance; } else { tmp = $super.n14.call(this, cause); } return tmp; } class ParentJob {} class JobSupport { constructor(active) { this.y12_1 = atomic$ref$1(active ? get_EMPTY_ACTIVE() : get_EMPTY_NEW()); this.z12_1 = atomic$ref$1(null); } x2() { return Key_instance_3; } w13(value) { this.z12_1.kotlinx$atomicfu$value = value; } x13() { return this.z12_1.kotlinx$atomicfu$value; } y13() { var tmp0_safe_receiver = this.x13(); return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.y13(); } a13(parent) { // Inline function 'kotlinx.coroutines.assert' call if (parent == null) { this.w13(NonDisposableHandle_instance); return Unit_instance; } parent.c14(); var handle = parent.v14(this); this.w13(handle); if (this.a14()) { handle.q16(); this.w13(NonDisposableHandle_instance); } } z13() { return this.y12_1.kotlinx$atomicfu$value; } f13() { var state = this.z13(); var tmp; if (!(state == null) ? isInterface(state, Incomplete) : false) { tmp = state.f13(); } else { tmp = false; } return tmp; } a14() { var tmp = this.z13(); return !(!(tmp == null) ? isInterface(tmp, Incomplete) : false); } b14() { var state = this.z13(); var tmp; if (state instanceof CompletedExceptionally) { tmp = true; } else { var tmp_0; if (state instanceof Finishing) { tmp_0 = state.o1b(); } else { tmp_0 = false; } tmp = tmp_0; } return tmp; } c14() { // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var state = this.z13(); var tmp0_subject = startInternal(this, state); if (tmp0_subject === 0) return false; else if (tmp0_subject === 1) return true; } } d14() { } e14() { var state = this.z13(); var tmp; if (state instanceof Finishing) { var tmp0_safe_receiver = state.b1c(); var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.f14(tmp0_safe_receiver, get_classSimpleName(this) + ' is cancelling'); var tmp_0; if (tmp1_elvis_lhs == null) { var message = 'Job is still new or active: ' + this.toString(); throw IllegalStateException.a6(toString(message)); } else { tmp_0 = tmp1_elvis_lhs; } tmp = tmp_0; } else { if (!(state == null) ? isInterface(state, Incomplete) : false) { var message_0 = 'Job is still new or active: ' + this.toString(); throw IllegalStateException.a6(toString(message_0)); } else { if (state instanceof CompletedExceptionally) { tmp = this.g14(state.k13_1); } else { tmp = JobCancellationException.w1b(get_classSimpleName(this) + ' has completed normally', null, this); } } } return tmp; } f14(_this__u8e3s4, message) { var tmp0_elvis_lhs = _this__u8e3s4 instanceof CancellationException ? _this__u8e3s4 : null; var tmp; if (tmp0_elvis_lhs == null) { // Inline function 'kotlinx.coroutines.JobSupport.defaultCancellationException' call tmp = JobCancellationException.w1b(message == null ? this.i13() : message, _this__u8e3s4, this); } else { tmp = tmp0_elvis_lhs; } return tmp; } g14(_this__u8e3s4, message, $super) { message = message === VOID ? null : message; return $super === VOID ? this.f14(_this__u8e3s4, message) : $super.f14.call(this, _this__u8e3s4, message); } h14(handler) { return this.j14(true, new InvokeOnCompletion(handler)); } i14(onCancelling, invokeImmediately, handler) { var tmp; if (onCancelling) { tmp = new InvokeOnCancelling(handler); } else { tmp = new InvokeOnCompletion(handler); } return this.j14(invokeImmediately, tmp); } j14(invokeImmediately, node) { node.d19_1 = this; var tmp$ret$0; $l$block_1: { // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList' call // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var state = this.z13(); if (state instanceof Empty) { if (state.e1b_1) { if (this.y12_1.atomicfu$compareAndSet(state, node)) { tmp$ret$0 = true; break $l$block_1; } } else { promoteEmptyToNodeList(this, state); } } else { if (!(state == null) ? isInterface(state, Incomplete) : false) { var list = state.f19(); if (list == null) { promoteSingleToNodeList(this, state instanceof JobNode ? state : THROW_CCE()); } else { var tmp; if (node.z18()) { var tmp0_safe_receiver = state instanceof Finishing ? state : null; var rootCause = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.b1c(); var tmp_0; if (rootCause == null) { tmp_0 = list.j19(node, 5); } else { if (invokeImmediately) { node.p16(rootCause); } return NonDisposableHandle_instance; } tmp = tmp_0; } else { tmp = list.j19(node, 1); } if (tmp) { tmp$ret$0 = true; break $l$block_1; } } } else { tmp$ret$0 = false; break $l$block_1; } } } } var added = tmp$ret$0; if (added) return node; else if (invokeImmediately) { var tmp_1 = this.z13(); var tmp0_safe_receiver_0 = tmp_1 instanceof CompletedExceptionally ? tmp_1 : null; node.p16(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.k13_1); } return NonDisposableHandle_instance; } k14($completion) { if (!joinInternal(this)) { // Inline function 'kotlin.js.getCoroutineContext' call var tmp$ret$0 = $completion.zd(); ensureActive(tmp$ret$0); return Unit_instance; } return joinSuspend(this, $completion); } l14(node) { // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var state = this.z13(); if (state instanceof JobNode) { if (!(state === node)) return Unit_instance; if (this.y12_1.atomicfu$compareAndSet(state, get_EMPTY_ACTIVE())) return Unit_instance; } else { if (!(state == null) ? isInterface(state, Incomplete) : false) { if (!(state.f19() == null)) { node.k19(); } return Unit_instance; } else { return Unit_instance; } } } } m14() { return false; } n14(cause) { var tmp; if (cause == null) { // Inline function 'kotlinx.coroutines.JobSupport.defaultCancellationException' call tmp = JobCancellationException.w1b(null == null ? this.i13() : null, null, this); } else { tmp = cause; } this.p14(tmp); } i13() { return 'Job was cancelled'; } p14(cause) { this.s14(cause); } q14(parentJob) { this.s14(parentJob); } r14(cause) { if (cause instanceof CancellationException) return true; return this.s14(cause) && this.y14(); } s14(cause) { var finalState = get_COMPLETING_ALREADY(); if (this.m14()) { 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.p13(finalState); tmp = true; } return tmp; } t14() { var state = this.z13(); var tmp; if (state instanceof Finishing) { tmp = state.b1c(); } else { if (state instanceof CompletedExceptionally) { tmp = state.k13_1; } else { if (!(state == null) ? isInterface(state, Incomplete) : false) { var message = 'Cannot be cancelling child in this state: ' + toString(state); throw IllegalStateException.a6(toString(message)); } else { tmp = null; } } } var rootCause = tmp; var tmp1_elvis_lhs = rootCause instanceof CancellationException ? rootCause : null; return tmp1_elvis_lhs == null ? JobCancellationException.w1b('Parent job is ' + stateString(this, state), rootCause, this) : tmp1_elvis_lhs; } u14(proposedUpdate) { // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var tmp0 = this.z13(); $l$block: { var finalState = tryMakeCompleting(this, tmp0, proposedUpdate); if (finalState === get_COMPLETING_ALREADY()) return false; else if (finalState === get_COMPLETING_WAITING_CHILDREN()) return true; else if (finalState === get_COMPLETING_RETRY()) { break $l$block; } else { this.p13(finalState); return true; } } } } n13(proposedUpdate) { // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var tmp0 = this.z13(); $l$block: { var finalState = tryMakeCompleting(this, tmp0, proposedUpdate); if (finalState === get_COMPLETING_ALREADY()) throw IllegalStateException.re('Job ' + this.toString() + ' is already complete or completing, ' + ('but is being completed with ' + toString_0(proposedUpdate)), _get_exceptionOrNull__b3j7js(this, proposedUpdate)); else if (finalState === get_COMPLETING_RETRY()) { break $l$block; } else return finalState; } } } v14(child) { // Inline function 'kotlin.also' call var this_0 = new ChildHandleNode(child); this_0.d19_1 = this; var node = this_0; var tmp$ret$2; $l$block_1: { // Inline function 'kotlinx.coroutines.JobSupport.tryPutNodeIntoList' call // Inline function 'kotlinx.coroutines.JobSupport.loopOnState' call while (true) { var state = this.z13(); if (state instanceof Empty) { if (state.e1b_1) { if (this.y12_1.atomicfu$compareAndSet(state, node)) { tmp$ret$2 = true; break $l$block_1; } } else { promoteEmptyToNodeList(this, state); } } else { if (!(state == null) ? isInterface(state, Incomplete) : false) { var list = state.f19(); if (list == null) { promoteSingleToNodeList(this, state instanceof JobNode ? state : THROW_CCE()); } else { var addedBeforeCancellation = list.j19(node, 7); var tmp; if (addedBeforeCancellation) { tmp = true; } else { var addedBeforeCompletion = list.j19(node, 3); var latestState = this.z13(); var tmp_0; if (latestState instanceof Finishing) { tmp_0 = latestState.b1c(); } else { // Inline function 'kotlinx.coroutines.assert' call var tmp0_safe_receiver = latestState instanceof CompletedExceptionally ? latestState : null; tmp_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.k13_1; } var rootCause = tmp_0; node.p16(rootCause); var tmp_1; if (addedBeforeCompletion) { // Inline function 'kotlinx.coroutines.assert' call tmp_1 = true; } else { return NonDisposableHandle_instance; } tmp = tmp_1; } if (tmp) { tmp$ret$2 = true; break $l$block_1; } } } else { tmp$ret$2 = false; break $l$block_1; } } } } var added = tmp$ret$2; if (added) return node; var tmp_2 = this.z13(); var tmp0_safe_receiver_0 = tmp_2 instanceof CompletedExceptionally ? tmp_2 : null; node.p16(tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.k13_1); return NonDisposableHandle_instance; } q13(exception) { throw exception; } w14(cause) { } x14() { return false; } y14() { return true; } z14(exception) { return false; } j13(state) { } p13(state) { } toString() { return this.a15() + '@' + get_hexAddress(this); } a15() { return this.r13() + '{' + stateString(this, this.z13()) + '}'; } r13() { return get_classSimpleName(this); } b15() { var state = this.z13(); // Inline function 'kotlin.check' call if (!!(!(state == null) ? isInterface(state, Incomplete) : false)) { var message = 'This job has not completed yet'; throw IllegalStateException.a6(toString(message)); } return _get_exceptionOrNull__b3j7js(this, state); } c15() { var state = this.z13(); // Inline function 'kotlin.check' call if (!!(!(state == null) ? isInterface(state, Incomplete) : false)) { var message = 'This job has not completed yet'; throw IllegalStateException.a6(toString(message)); } if (state instanceof CompletedExceptionally) throw state.k13_1; return unboxState(state); } v19($completion) { $l$loop: while (true) { var state = this.z13(); if (!(!(state == null) ? isInterface(state, Incomplete) : false)) { if (state instanceof CompletedExceptionally) { // Inline function 'kotlinx.coroutines.internal.recoverAndThrow' call throw state.k13_1; } return unboxState(state); } if (startInternal(this, state) >= 0) break $l$loop; } return awaitSuspend(this, $completion); } } class CoroutineScope {} class AbstractCoroutine extends JobSupport { constructor(parentContext, initParentJob, active) { super(active); if (initParentJob) { this.a13(parentContext.ge(Key_instance_3)); } this.d13_1 = parentContext.wn(this); } zd() { return this.d13_1; } e13() { return this.d13_1; } f13() { return super.f13(); } g13(value) { } h13(cause, handled) { } i13() { return get_classSimpleName(this) + ' was cancelled'; } j13(state) { if (state instanceof CompletedExceptionally) { this.h13(state.k13_1, state.m13()); } else { this.g13((state == null ? true : !(state == null)) ? state : THROW_CCE()); } } ee(result) { var state = this.n13(toState_0(result)); if (state === get_COMPLETING_WAITING_CHILDREN()) return Unit_instance; this.o13(state); } o13(state) { return this.p13(state); } q13(exception) { handleCoroutineException(this.d13_1, exception); } r13() { var tmp0_elvis_lhs = get_coroutineName(this.d13_1); var tmp; if (tmp0_elvis_lhs == null) { return super.r13(); } else { tmp = tmp0_elvis_lhs; } var coroutineName = tmp; return '"' + coroutineName + '":' + super.r13(); } s13(start, receiver, block) { start.v13(block, receiver, this); } } class StandaloneCoroutine extends AbstractCoroutine { constructor(parentContext, active) { super(parentContext, true, active); } z14(exception) { handleCoroutineException(this.d13_1, exception); return true; } } class LazyStandaloneCoroutine extends StandaloneCoroutine { constructor(parentContext, block) { super(parentContext, false); this.k15_1 = createCoroutineUnintercepted(block, this, this); } d14() { startCoroutineCancellable(this.k15_1, this); } } class Deferred {} class DeferredCoroutine extends AbstractCoroutine { constructor(parentContext, active) { super(parentContext, true, active); } o15() { var tmp = this.c15(); return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE(); } } class LazyDeferredCoroutine extends DeferredCoroutine { constructor(parentContext, block) { super(parentContext, false); this.s15_1 = createCoroutineUnintercepted(block, this, this); } d14() { startCoroutineCancellable(this.s15_1, this); } } class ScopeCoroutine extends AbstractCoroutine { constructor(context, uCont) { super(context, true, true); this.c16_1 = uCont; } x14() { return true; } p13(state) { resumeCancellableWith(intercepted(this.c16_1), recoverResult(state, this.c16_1)); } d16() { } o13(state) { this.c16_1.ee(recoverResult(state, this.c16_1)); } } class DispatchedCoroutine extends ScopeCoroutine { constructor(context, uCont) { super(context, uCont); this.x15_1 = atomic$int$1(0); } p13(state) { this.o13(state); } o13(state) { if (tryResume(this)) return Unit_instance; resumeCancellableWith(intercepted(this.c16_1), recoverResult(state, this.c16_1)); } y15() { if (trySuspend(this)) return get_COROUTINE_SUSPENDED(); var state = unboxState(this.z13()); if (state instanceof CompletedExceptionally) throw state.k13_1; return (state == null ? true : !(state == null)) ? state : THROW_CCE(); } } class CancellableContinuation {} class NotCompleted {} class CancelHandler {} class DisposeOnCancel { constructor(handle) { this.o16_1 = handle; } p16(cause) { return this.o16_1.q16(); } toString() { return 'DisposeOnCancel[' + toString(this.o16_1) + ']'; } } class Runnable {} class SchedulerTask {} class DispatchedTask extends SchedulerTask { constructor(resumeMode) { super(); this.a17_1 = resumeMode; } y17(takenState, cause) { } f18(state) { return (state == null ? true : !(state == null)) ? state : THROW_CCE(); } p18(state) { var tmp0_safe_receiver = state instanceof CompletedExceptionally ? state : null; return tmp0_safe_receiver == null ? null : tmp0_safe_receiver.k13_1; } r18() { // Inline function 'kotlinx.coroutines.assert' call try { var tmp = this.v17(); var delegate = tmp instanceof DispatchedContinuation ? tmp : THROW_CCE(); var continuation = delegate.t16_1; // Inline function 'kotlinx.coroutines.withContinuationContext' call delegate.v16_1; var context = continuation.zd(); var state = this.x17(); var exception = this.p18(state); var job = exception == null && get_isCancellableMode(this.a17_1) ? context.ge(Key_instance_3) : null; if (!(job == null) && !job.f13()) { var cause = job.e14(); this.y17(state, cause); // Inline function 'kotlinx.coroutines.resumeWithStackTrace' call // Inline function 'kotlin.Companion.failure' call var exception_0 = recoverStackTrace(cause, continuation); var tmp$ret$1 = _Result___init__impl__xyqfz8(createFailure(exception_0)); continuation.ee(tmp$ret$1); } else { if (!(exception == null)) { // Inline function 'kotlin.coroutines.resumeWithException' call // Inline function 'kotlin.Companion.failure' call var tmp$ret$3 = _Result___init__impl__xyqfz8(createFailure(exception)); continuation.ee(tmp$ret$3); } else { // Inline function 'kotlin.coroutines.resume' call // Inline function 'kotlin.Companion.success' call var value = this.f18(state); var tmp$ret$5 = _Result___init__impl__xyqfz8(value); continuation.ee(tmp$ret$5); } } } catch ($p) { if ($p instanceof DispatchException) { var e = $p; handleCoroutineException(this.v17().zd(), e.g1a_1); } else { if ($p instanceof Error) { var e_0 = $p; this.s18(e_0); } else { throw $p; } } } } s18(exception) { var reason = CoroutinesInternalError.d1b('Fatal exception in coroutines machinery for ' + toString(this) + '. ' + "Please read KDoc to 'handleFatalException' method and report this incident to maintainers", exception); handleCoroutineException(this.v17().zd(), reason); } } class Waiter {} class CancellableContinuationImpl extends DispatchedTask { constructor(delegate, resumeMode) { super(resumeMode); this.i16_1 = delegate; // Inline function 'kotlinx.coroutines.assert' call this.j16_1 = this.i16_1.zd(); var tmp = this; // Inline function 'kotlinx.coroutines.decisionAndIndex' call var tmp$ret$1 = (0 << 29) + 536870911 | 0; tmp.k16_1 = atomic$int$1(tmp$ret$1); this.l16_1 = atomic$ref$1(Active_instance); this.m16_1 = atomic$ref$1(null); } v17() { return this.i16_1; } zd() { return this.j16_1; } z13() { return this.l16_1.kotlinx$atomicfu$value; } a14() { var tmp = this.z13(); return !(!(tmp == null) ? isInterface(tmp, NotCompleted) : false); } w17() { var tmp0_elvis_lhs = installParentHandle(this); var tmp; if (tmp0_elvis_lhs == null) { return Unit_instance; } else { tmp = tmp0_elvis_lhs; } var handle = tmp; if (this.a14()) { handle.q16(); this.m16_1.kotlinx$atomicfu$value = NonDisposableHandle_instance; } } y16() { // Inline function 'kotlinx.coroutines.assert' call // Inline function 'kotlinx.coroutines.assert' call var state = this.l16_1.kotlinx$atomicfu$value; // Inline function 'kotlinx.coroutines.assert' call var tmp; if (state instanceof CompletedContinuation) { tmp = !(state.o17_1 == null); } else { tmp = false; } if (tmp) { this.u17(); return false; } var tmp_0 = this.k16_1; // Inline function 'kotlinx.coroutines.decisionAndIndex' call tmp_0.kotlinx$atomicfu$value = (0 << 29) + 536870911 | 0; this.l16_1.kotlinx$atomicfu$value = Active_instance; return true; } x17() { return this.z13(); } y17(takenState, cause) { var this_0 = this.l16_1; while (true) { var state = this_0.kotlinx$atomicfu$value; if (!(state == null) ? isInterface(state, NotCompleted) : false) { // Inline function 'kotlin.error' call var message = 'Not completed'; throw IllegalStateException.a6(toString(message)); } else { if (state instanceof CompletedExceptionally) return Unit_instance; else { if (state instanceof CompletedContinuation) { // Inline function 'kotlin.check' call if (!!state.r17()) { var message_0 = 'Must be called at most once'; throw IllegalStateException.a6(toString(message_0)); } var update = state.s17(VOID, VOID, VOID, VOID, cause); if (this.l16_1.atomicfu$compareAndSet(state, update)) { state.z17(this, cause); return Unit_instance; } } else { if (this.l16_1.atomicfu$compareAndSet(state, new CompletedContinuation(state, VOID, VOID, VOID, cause))) { return Unit_instance; } } } } } return Unit_instance; } a18(cause) { // Inline function 'kotlinx.atomicfu.loop' call var this_0 = this.l16_1; while (true) { var tmp0 = this_0.kotlinx$atomicfu$value; $l$block: { if (!(!(tmp0 == null) ? isInterface(tmp0, NotCompleted) : false)) return false; var tmp; if (isInterface(tmp0, CancelHandler)) { tmp = true; } else { tmp = tmp0 instanceof Segment; } var update = new CancelledContinuation(this, cause, tmp); if (!this.l16_1.atomicfu$compareAndSet(tmp0, update)) { break $l$block; } if (isInterface(tmp0, CancelHandler)) { this.q17(tmp0, cause); } else { if (tmp0 instanceof Segment) { callSegmentOnCancellation(this, tmp0, cause); } } detachChildIfNonReusable(this); dispatchResume(this, this.a17_1); return true; } } } b18(cause) { if (cancelLater(this, cause)) return Unit_instance; this.a18(cause); detachChildIfNonReusable(this); } q17(handler, cause) { // Inline function 'kotlinx.coroutines.CancellableContinuationImpl.callCancelHandlerSafely' call try { handler.p16(cause); } catch ($p) { if ($p instanceof Error) { var ex = $p; handleCoroutineException(this.zd(), CompletionHandlerException.k17('Exception in invokeOnCancellation handler for ' + this.toString(), ex)); } else { throw $p; } } return Unit_instance; } c18(onCancellation, cause, value) { try { onCancellation(cause, value, this.zd()); } catch ($p) { if ($p instanceof Error) { var ex = $p; handleCoroutineException(this.zd(), CompletionHandlerException.k17('Exception in resume onCancellation handler for ' + this.toString(), ex)); } else { throw $p; } } } d18(parent) { return parent.e14(); } y15() { var isReusable_0 = isReusable(this); if (trySuspend_0(this)) { if (_get_parentHandle__f8dcex(this) == null) { installParentHandle(this); } if (isReusable_0) { this.e18(); } return get_COROUTINE_SUSPENDED(); } if (isReusable_0) { this.e18(); } var state = this.z13(); if (state instanceof CompletedExceptionally) throw recoverStackTrace(state.k13_1, this); if (get_isCancellableMode(this.a17_1)) { var job = this.zd().ge(Key_instance_3); if (!(job == null) && !job.f13()) { var cause = job.e14(); this.y17(state, cause); throw recoverStackTrace(cause, this); } } return this.f18(state); } e18() { var tmp = this.i16_1; var tmp0_safe_receiver = tmp instanceof DispatchedContinuation ? tmp : null; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.g18(this); var tmp_0; if (tmp1_elvis_lhs == null) { return Unit_instance; } else { tmp_0 = tmp1_elvis_lhs; } var cancellationCause = tmp_0; this.u17(); this.a18(cancellationCause); } ee(result) { return this.h18(toState(result, this), this.a17_1); } i18(value, onCancellation) { var tmp = this.a17_1; var tmp_0; if (onCancellation == null) { tmp_0 = null; } else { // Inline function 'kotlin.let' call tmp_0 = CancellableContinuationImpl$resume$lambda(onCancellation); } return this.j18(value, tmp, tmp_0); } g16(value, onCancellation) { return this.j18(value, this.a17_1, onCancellation); } k18(segment, index) { var tmp0 = this.k16_1; $l$block: { // Inline function 'kotlinx.atomicfu.update' call while (true) { var cur = tmp0.kotlinx$atomicfu$value; // Inline function 'kotlinx.coroutines.index' call // Inline function 'kotlin.check' call if (!((cur & 536870911) === 536870911)) { var message = 'invokeOnCancellation should be called at most once'; throw IllegalStateException.a6(toString(message)); } // Inline function 'kotlinx.coroutines.decision' call // Inline function 'kotlinx.coroutines.decisionAndIndex' call var upd = (cur >> 29 << 29) + index | 0; if (tmp0.atomicfu$compareAndSet(cur, upd)) { break $l$block; } } } invokeOnCancellationImpl(this, segment); } n16(handler) { return invokeOnCancellationImpl(this, handler); } j18(proposedUpdate, resumeMode, onCancellation) { // Inline function 'kotlinx.atomicfu.loop' call var this_0 = this.l16_1; while (true) { var tmp0 = this_0.kotlinx$atomicfu$value; $l$block: { if (!(tmp0 == null) ? isInterface(tmp0, NotCompleted) : false) { var update = resumedState(this, tmp0, proposedUpdate, resumeMode, onCancellation, null); if (!this.l16_1.atomicfu$compareAndSet(tmp0, update)) { break $l$block; } detachChildIfNonReusable(this); dispatchResume(this, resumeMode); return Unit_instance; } else { if (tmp0 instanceof CancelledContinuation) { if (tmp0.o18()) { if (onCancellation == null) null; else { // Inline function 'kotlin.let' call this.c18(onCancellation, tmp0.k13_1, proposedUpdate); } return Unit_instance; } } } alreadyResumedError(this, proposedUpdate); } } } h18(proposedUpdate, resumeMode, onCancellation, $super) { onCancellation = onCancellation === VOID ? null : onCancellation; var tmp; if ($super === VOID) { this.j18(proposedUpdate, resumeMode, onCancellation); tmp = Unit_instance; } else { tmp = $super.j18.call(this, proposedUpdate, resumeMode, onCancellation); } return tmp; } u17() { var tmp0_elvis_lhs = _get_parentHandle__f8dcex(this); var tmp; if (tmp0_elvis_lhs == null) { return Unit_instance; } else { tmp = tmp0_elvis_lhs; } var handle = tmp; handle.q16(); this.m16_1.kotlinx$atomicfu$value = NonDisposableHandle_instance; } e16(value, idempotent, onCancellation) { return tryResumeImpl(this, value, idempotent, onCancellation); } f16(token) { // Inline function 'kotlinx.coroutines.assert' call dispatchResume(this, this.a17_1); } f18(state) { var tmp; if (state instanceof CompletedContinuation) { var tmp_0 = state.l17_1; tmp = (tmp_0 == null ? true : !(tmp_0 == null)) ? tmp_0 : THROW_CCE(); } else { tmp = (state == null ? true : !(state == null)) ? state : THROW_CCE(); } return tmp; } p18(state) { var tmp0_safe_receiver = super.p18(state); var tmp; if (tmp0_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.let' call tmp = recoverStackTrace(tmp0_safe_receiver, this.i16_1); } return tmp; } toString() { return this.q18() + '(' + toDebugString(this.i16_1) + '){' + _get_stateDebugRepresentation__bf18u4(this) + '}@' + get_hexAddress(this); } q18() { return 'CancellableContinuation'; } } class Active { toString() { return 'Active'; } } class CompletedContinuation { constructor(result, cancelHandler, onCancellation, idempotentResume, cancelCause) { cancelHandler = cancelHandler === VOID ? null : cancelHandler; onCancellation = onCancellation === VOID ? null : onCancellation; idempotentResume = idempotentResume === VOID ? null : idempotentResume; cancelCause = cancelCause === VOID ? null : cancelCause; this.l17_1 = result; this.m17_1 = cancelHandler; this.n17_1 = onCancellation; this.o17_1 = idempotentResume; this.p17_1 = cancelCause; } r17() { return !(this.p17_1 == null); } z17(cont, cause) { var tmp0_safe_receiver = this.m17_1; if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.let' call cont.q17(tmp0_safe_receiver, cause); } var tmp1_safe_receiver = this.n17_1; if (tmp1_safe_receiver == null) null; else { // Inline function 'kotlin.let' call cont.c18(tmp1_safe_receiver, cause, this.l17_1); } } t18(result, cancelHandler, onCancellation, idempotentResume, cancelCause) { return new CompletedContinuation(result, cancelHandler, onCancellation, idempotentResume, cancelCause); } s17(result, cancelHandler, onCancellation, idempotentResume, cancelCause, $super) { result = result === VOID ? this.l17_1 : result; cancelHandler = cancelHandler === VOID ? this.m17_1 : cancelHandler; onCancellation = onCancellation === VOID ? this.n17_1 : onCancellation; idempotentResume = idempotentResume === VOID ? this.o17_1 : idempotentResume; cancelCause = cancelCause === VOID ? this.p17_1 : cancelCause; return $super === VOID ? this.t18(result, cancelHandler, onCancellation, idempotentResume, cancelCause) : $super.t18.call(this, result, cancelHandler, onCancellation, idempotentResume, cancelCause); } toString() { return 'CompletedContinuation(result=' + toString_0(this.l17_1) + ', cancelHandler=' + toString_0(this.m17_1) + ', onCancellation=' + toString_0(this.n17_1) + ', idempotentResume=' + toString_0(this.o17_1) + ', cancelCause=' + toString_0(this.p17_1) + ')'; } hashCode() { var result = this.l17_1 == null ? 0 : hashCode(this.l17_1); result = imul(result, 31) + (this.m17_1 == null ? 0 : hashCode(this.m17_1)) | 0; result = imul(result, 31) + (this.n17_1 == null ? 0 : hashCode(this.n17_1)) | 0; result = imul(result, 31) + (this.o17_1 == null ? 0 : hashCode(this.o17_1)) | 0; result = imul(result, 31) + (this.p17_1 == null ? 0 : hashCode(this.p17_1)) | 0; return result; } equals(other) { if (this === other) return true; if (!(other instanceof CompletedContinuation)) return false; var tmp0_other_with_cast = other instanceof CompletedContinuation ? other : THROW_CCE(); if (!equals(this.l17_1, tmp0_other_with_cast.l17_1)) return false; if (!equals(this.m17_1, tmp0_other_with_cast.m17_1)) return false; if (!equals(this.n17_1, tmp0_other_with_cast.n17_1)) return false; if (!equals(this.o17_1, tmp0_other_with_cast.o17_1)) return false; if (!equals(this.p17_1, tmp0_other_with_cast.p17_1)) return false; return true; } } class LockFreeLinkedListNode { constructor() { this.g19_1 = this; this.h19_1 = this; this.i19_1 = false; } j19(node, permissionsBitmask) { var prev = this.h19_1; var tmp; if (prev instanceof ListClosed) { tmp = ((prev.r20_1 & permissionsBitmask) === 0 && prev.j19(node, permissionsBitmask)); } else { node.g19_1 = this; node.h19_1 = prev; prev.g19_1 = node; this.h19_1 = node; tmp = true; } return tmp; } j1b(forbiddenElementsBit) { this.j19(new ListClosed(forbiddenElementsBit), forbiddenElementsBit); } k19() { if (this.i19_1) return false; var prev = this.h19_1; var next = this.g19_1; prev.g19_1 = next; next.h19_1 = prev; this.i19_1 = true; return true; } l19(node) { if (!(this.g19_1 === this)) return false; this.j19(node, -2147483648); return true; } } class Incomplete {} class JobNode extends LockFreeLinkedListNode { e19() { var tmp = this.d19_1; if (!(tmp == null)) return tmp; else { throwUninitializedPropertyAccessException('job'); } } f13() { return true; } f19() { return null; } q16() { return this.e19().l14(this); } toString() { return get_classSimpleName(this) + '@' + get_hexAddress(this) + '[job@' + get_hexAddress(this.e19()) + ']'; } } class ChildContinuation extends JobNode { constructor(child) { super(); this.y18_1 = child; } z18() { return true; } p16(cause) { this.y18_1.b18(this.y18_1.d18(this.e19())); } } class $awaitCOROUTINE$ extends CoroutineImpl { constructor(_this__u8e3s4, resultContinuation) { super(resultContinuation); this.u19_1 = _this__u8e3s4; } be() { var suspendResult = this.vd_1; $sm: do try { var tmp = this.td_1; switch (tmp) { case 0: this.ud_1 = 2; this.td_1 = 1; suspendResult = this.u19_1.v19(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return (suspendResult == null ? true : !(suspendResult == null)) ? suspendResult : THROW_CCE(); case 2: throw this.wd_1; } } catch ($p) { var e = $p; if (this.ud_1 === 2) { throw e; } else { this.td_1 = this.ud_1; this.wd_1 = e; } } while (true); } } class CompletableDeferredImpl extends JobSupport { constructor(parent) { super(true); this.a13(parent); } m14() { return true; } o15() { var tmp = this.c15(); return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE(); } y19($completion) { var tmp = new $awaitCOROUTINE$(this, $completion); tmp.vd_1 = Unit_instance; tmp.wd_1 = null; return tmp.be(); } z19(value) { return this.u14(value); } a1a(exception) { return this.u14(new CompletedExceptionally(exception)); } } class CompletedExceptionally { constructor(cause, handled) { handled = handled === VOID ? false : handled; this.k13_1 = cause; this.l13_1 = atomic$boolean$1(handled); } m13() { return this.l13_1.kotlinx$atomicfu$value; } t17() { return this.l13_1.atomicfu$compareAndSet(false, true); } toString() { return get_classSimpleName(this) + '[' + this.k13_1.toString() + ']'; } } class CancelledContinuation extends CompletedExceptionally { constructor(continuation, cause, handled) { super(cause == null ? CancellationException.pe('Continuation ' + toString(continuation) + ' was cancelled normally') : cause, handled); this.n18_1 = atomic$boolean$1(false); } o18() { return this.n18_1.atomicfu$compareAndSet(false, true); } } class Key extends AbstractCoroutineContextKey { constructor() { Key_instance_0 = null; var tmp = Key_instance; super(tmp, CoroutineDispatcher$Key$_init_$lambda_akl8b5); Key_instance_0 = this; } } class CoroutineDispatcher extends AbstractCoroutineContextElement { constructor() { Key_getInstance(); super(Key_instance); } c1a(context) { return true; } he(continuation) { return new DispatchedContinuation(this, continuation); } ie(continuation) { var dispatched = continuation instanceof DispatchedContinuation ? continuation : THROW_CCE(); dispatched.e1a(); } toString() { return get_classSimpleName(this) + '@' + get_hexAddress(this); } } class Key_0 {} class Key_1 {} class CoroutineName extends AbstractCoroutineContextElement { constructor(name) { super(Key_instance_2); this.k1a_1 = name; } toString() { return 'CoroutineName(' + this.k1a_1 + ')'; } hashCode() { return getStringHashCode(this.k1a_1); } equals(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.k1a_1 === tmp0_other_with_cast.k1a_1)) return false; return true; } } class GlobalScope { e13() { return EmptyCoroutineContext_getInstance(); } } class CoroutineStart extends Enum { v13(block, receiver, completion) { var tmp; switch (this.g3_1) { case 0: startCoroutineCancellable_0(block, receiver, completion); tmp = Unit_instance; break; case 2: startCoroutine(block, receiver, completion); tmp = Unit_instance; break; case 3: startCoroutineUndispatched(block, receiver, completion); tmp = Unit_instance; break; case 1: tmp = Unit_instance; break; default: noWhenBranchMatchedException(); break; } return tmp; } d15() { return this === CoroutineStart_LAZY_getInstance(); } } class EventLoop extends CoroutineDispatcher { constructor() { super(); this.m1a_1 = new Long(0, 0); this.n1a_1 = false; this.o1a_1 = null; } p1a() { var tmp0_elvis_lhs = this.o1a_1; var tmp; if (tmp0_elvis_lhs == null) { return false; } else { tmp = tmp0_elvis_lhs; } var queue = tmp; var tmp1_elvis_lhs = queue.zl(); var tmp_0; if (tmp1_elvis_lhs == null) { return false; } else { tmp_0 = tmp1_elvis_lhs; } var task = tmp_0; task.r18(); return true; } q1a(task) { var tmp0_elvis_lhs = this.o1a_1; var tmp; if (tmp0_elvis_lhs == null) { // Inline function 'kotlin.also' call var this_0 = ArrayDeque.vl(); this.o1a_1 = this_0; tmp = this_0; } else { tmp = tmp0_elvis_lhs; } var queue = tmp; queue.xl(task); } r1a() { return this.m1a_1.w1(delta(this, true)) >= 0; } s1a() { var tmp0_safe_receiver = this.o1a_1; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.g1(); return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs; } t1a(unconfined) { this.m1a_1 = this.m1a_1.o3(delta(this, unconfined)); if (!unconfined) this.n1a_1 = true; } u1a(unconfined) { this.m1a_1 = this.m1a_1.p3(delta(this, unconfined)); if (this.m1a_1.w1(new Long(0, 0)) > 0) return Unit_instance; // Inline function 'kotlinx.coroutines.assert' call if (this.n1a_1) { this.v1a(); } } v1a() { } } class ThreadLocalEventLoop { constructor() { ThreadLocalEventLoop_instance = this; this.w1a_1 = commonThreadLocal(new Symbol('ThreadLocalEventLoop')); } x1a() { var tmp0_elvis_lhs = this.w1a_1.z1a(); var tmp; if (tmp0_elvis_lhs == null) { // Inline function 'kotlin.also' call var this_0 = createEventLoop(); ThreadLocalEventLoop_getInstance().w1a_1.a1b(this_0); tmp = this_0; } else { tmp = tmp0_elvis_lhs; } return tmp; } } class CompletionHandlerException extends RuntimeException { static k17(message, cause) { var $this = this.tf(message, cause); captureStack($this, $this.j17_1); return $this; } } class CoroutinesInternalError extends Error_0 { static d1b(message, cause) { var $this = this.xf(message, cause); captureStack($this, $this.c1b_1); return $this; } } class Key_2 {} class NonDisposableHandle { y13() { return null; } q16() { } r14(cause) { return false; } toString() { return 'NonDisposableHandle'; } } class Empty { constructor(isActive) { this.e1b_1 = isActive; } f13() { return this.e1b_1; } f19() { return null; } toString() { return 'Empty{' + (this.e1b_1 ? 'Active' : 'New') + '}'; } } class LockFreeLinkedListHead extends LockFreeLinkedListNode {} class NodeList extends LockFreeLinkedListHead { f13() { return true; } f19() { return this; } i1b(state) { // Inline function 'kotlin.text.buildString' call // Inline function 'kotlin.apply' call var this_0 = StringBuilder.u(); this_0.xc('List{'); this_0.xc(state); this_0.xc('}['); var first = true; // Inline function 'kotlinx.coroutines.internal.LockFreeLinkedListHead.forEach' call var cur = this.g19_1; while (!equals(cur, this)) { var node = cur; if (node instanceof JobNode) { if (first) { first = false; } else this_0.xc(', '); this_0.wc(node); } cur = cur.g19_1; } this_0.xc(']'); return this_0.toString(); } toString() { return get_DEBUG() ? this.i1b('Active') : super.toString(); } } class SynchronizedObject {} class Finishing extends SynchronizedObject { constructor(list, isCompleting, rootCause) { super(); this.k1b_1 = list; this.l1b_1 = atomic$boolean$1(isCompleting); this.m1b_1 = atomic$ref$1(rootCause); this.n1b_1 = atomic$ref$1(null); } f19() { return this.k1b_1; } c1c(value) { this.l1b_1.kotlinx$atomicfu$value = value; } y1b() { return this.l1b_1.kotlinx$atomicfu$value; } i1c(value) { this.m1b_1.kotlinx$atomicfu$value = value; } b1c() { return this.m1b_1.kotlinx$atomicfu$value; } z1b() { return _get_exceptionsHolder__nhszp(this) === get_SEALED(); } o1b() { return !(this.b1c() == null); } f13() { return this.b1c() == null; } p1b(proposedException) { var eh = _get_exceptionsHolder__nhszp(this); var tmp; if (eh == null) { tmp = allocateList(this); } else { if (eh instanceof Error) { // Inline function 'kotlin.also' call var this_0 = allocateList(this); this_0.s(eh); tmp = this_0; } else { if (eh instanceof ArrayList) { tmp = eh instanceof ArrayList ? eh : THROW_CCE(); } else { var message = 'State is ' + toString_0(eh); throw IllegalStateException.a6(toString(message)); } } } var list = tmp; var rootCause = this.b1c(); if (rootCause == null) null; else { // Inline function 'kotlin.let' call list.