(function (root, factory) { if (typeof define === 'function' && define.amd) define(['exports', './kotlin-kotlin-stdlib.js', './kotlinx-coroutines-core.js', './kotlinx-coroutines-test.js'], factory); else if (typeof exports === 'object') factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./kotlinx-coroutines-test.js')); else { if (typeof this['kotlin-kotlin-stdlib'] === 'undefined') { throw new Error("Error loading module 'Turbine'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to 'Turbine'."); } if (typeof this['kotlinx-coroutines-core'] === 'undefined') { throw new Error("Error loading module 'Turbine'. Its dependency 'kotlinx-coroutines-core' was not found. Please, check whether 'kotlinx-coroutines-core' is loaded prior to 'Turbine'."); } if (typeof this['kotlinx-coroutines-test'] === 'undefined') { throw new Error("Error loading module 'Turbine'. Its dependency 'kotlinx-coroutines-test' was not found. Please, check whether 'kotlinx-coroutines-test' is loaded prior to 'Turbine'."); } root.Turbine = factory(typeof Turbine === 'undefined' ? {} : Turbine, this['kotlin-kotlin-stdlib'], this['kotlinx-coroutines-core'], this['kotlinx-coroutines-test']); } }(this, function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_test) { 'use strict'; //region block: imports var protoOf = kotlin_kotlin.$_$.lb; var objectMeta = kotlin_kotlin.$_$.kb; var setMetadataFor = kotlin_kotlin.$_$.mb; var VOID = kotlin_kotlin.$_$.e; var equals = kotlin_kotlin.$_$.ha; var hashCode = kotlin_kotlin.$_$.na; var getKClassFromExpression = kotlin_kotlin.$_$.c; var classMeta = kotlin_kotlin.$_$.ea; var interfaceMeta = kotlin_kotlin.$_$.oa; var Unit_getInstance = kotlin_kotlin.$_$.l5; var CoroutineImpl = kotlin_kotlin.$_$.o9; var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.z8; var ChannelResult = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h1; var THROW_CCE = kotlin_kotlin.$_$.rf; var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.k2; var isInterface = kotlin_kotlin.$_$.xa; var cancel$default = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n; var cancel$default_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o; var close$default = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.p; var Channel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j1; var Duration = kotlin_kotlin.$_$.ve; var cancelAndJoin = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f; var ArrayList_init_$Create$ = kotlin_kotlin.$_$.o; var Factory_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y; var Channel_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i1; var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2; var _ChannelResult___get_isSuccess__impl__odq1z9 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.x; var emptyList = kotlin_kotlin.$_$.a7; var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.i1; var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.v2; var stackTraceToString = kotlin_kotlin.$_$.rg; var CancellationException = kotlin_kotlin.$_$.y8; var SuspendFunction1 = kotlin_kotlin.$_$.q9; var SuspendFunction0 = kotlin_kotlin.$_$.p9; var AssertionError = kotlin_kotlin.$_$.ze; var AssertionError_init_$Init$ = kotlin_kotlin.$_$.j1; var captureStack = kotlin_kotlin.$_$.y9; var defineProp = kotlin_kotlin.$_$.ga; var ChannelResult__exceptionOrNull_impl_16ei30 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.t; var _ChannelResult___get_isClosed__impl__mg7kuu = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.v; var ChannelResult__getOrThrow_impl_od1axs = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.u; var _ChannelResult___get_isFailure__impl__nz6ehu = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.w; var AssertionError_init_$Create$ = kotlin_kotlin.$_$.k1; var toString = kotlin_kotlin.$_$.qb; var CancellationException_init_$Init$ = kotlin_kotlin.$_$.b1; var coroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g; var ensureNotNull = kotlin_kotlin.$_$.ig; var delay = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i; var CoroutineStart_UNDISPATCHED_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b; var async = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.w2; var GlobalScope_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d1; var Dispatchers_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1; var launch = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e3; var SelectImplementation = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b2; var TimeoutCancellationException = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.v2; var until = kotlin_kotlin.$_$.bc; var withTimeout = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l; var Key_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_test.$_$.a; var withContext = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j; var Key = kotlin_kotlin.$_$.m9; var get = kotlin_kotlin.$_$.j9; var fold = kotlin_kotlin.$_$.i9; var minusKey = kotlin_kotlin.$_$.k9; var plus = kotlin_kotlin.$_$.n9; var Element = kotlin_kotlin.$_$.l9; var Duration__isPositive_impl_tvkkt2 = kotlin_kotlin.$_$.s2; var Exception_init_$Create$ = kotlin_kotlin.$_$.o1; var contains = kotlin_kotlin.$_$.sc; var Companion_getInstance = kotlin_kotlin.$_$.d5; var DurationUnit_MILLISECONDS_getInstance = kotlin_kotlin.$_$.g; var toDuration = kotlin_kotlin.$_$.xe; var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.ug; var EmptyCoroutineContext_getInstance = kotlin_kotlin.$_$.s4; var plus_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f3; var get_job = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d3; var UnconfinedTestDispatcher = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_test.$_$.c; var isSuspendFunction = kotlin_kotlin.$_$.ab; var collectionSizeOrDefault = kotlin_kotlin.$_$.k6; var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.n; var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l1; var println = kotlin_kotlin.$_$.u9; //endregion //region block: pre-declaration function get_isTerminal() { var tmp; if (this instanceof Complete) { tmp = true; } else { tmp = this instanceof Error_0; } return tmp; } setMetadataFor(Event, 'Event', interfaceMeta); setMetadataFor(Complete, 'Complete', objectMeta, VOID, [Event]); setMetadataFor(Error_0, 'Error', classMeta, VOID, [Event]); setMetadataFor(Item, 'Item', classMeta, VOID, [Event]); setMetadataFor(ReceiveTurbine, 'ReceiveTurbine', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]); function close$default_0(cause, $super) { cause = cause === VOID ? null : cause; var tmp; if ($super === VOID) { this.close_2budci_k$(cause); tmp = Unit_getInstance(); } else { tmp = $super.close_2budci_k$.call(this, cause); } return tmp; } setMetadataFor(Turbine, 'Turbine', interfaceMeta, VOID, [ReceiveTurbine], VOID, VOID, VOID, [0, 1]); setMetadataFor($receiveCOROUTINE$4, '$receiveCOROUTINE$4', classMeta, CoroutineImpl); setMetadataFor($receiveCatchingCOROUTINE$5, '$receiveCatchingCOROUTINE$5', classMeta, CoroutineImpl); setMetadataFor(ChannelTurbine$withTurbineTimeout$slambda, 'ChannelTurbine$withTurbineTimeout$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(ChannelTurbine$channel$1, VOID, classMeta, VOID, [Channel], VOID, VOID, VOID, [0, 1]); setMetadataFor(ChannelTurbine$awaitEvent$slambda, 'ChannelTurbine$awaitEvent$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(ChannelTurbine$awaitItem$slambda, 'ChannelTurbine$awaitItem$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(ChannelTurbine$skipItems$slambda, 'ChannelTurbine$skipItems$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(ChannelTurbine$awaitComplete$slambda, 'ChannelTurbine$awaitComplete$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(ChannelTurbine$awaitError$slambda, 'ChannelTurbine$awaitError$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor($withTurbineTimeoutCOROUTINE$0, '$withTurbineTimeoutCOROUTINE$0', classMeta, CoroutineImpl); setMetadataFor($cancelCOROUTINE$1, '$cancelCOROUTINE$1', classMeta, CoroutineImpl); setMetadataFor($cancelAndIgnoreRemainingEventsCOROUTINE$2, '$cancelAndIgnoreRemainingEventsCOROUTINE$2', classMeta, CoroutineImpl); setMetadataFor($cancelAndConsumeRemainingEventsCOROUTINE$3, '$cancelAndConsumeRemainingEventsCOROUTINE$3', classMeta, CoroutineImpl); setMetadataFor(ChannelTurbine, 'ChannelTurbine', classMeta, VOID, [Turbine], VOID, VOID, VOID, [1, 0]); setMetadataFor(UnconsumedEventReport, 'UnconsumedEventReport', classMeta); setMetadataFor(TurbineAssertionError, 'TurbineAssertionError', classMeta, AssertionError); setMetadataFor(TurbineTimeoutCancellationException, 'TurbineTimeoutCancellationException', classMeta, CancellationException); setMetadataFor(awaitEvent$slambda, 'awaitEvent$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withWallclockTimeout$slambda$slambda, 'withWallclockTimeout$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withWallclockTimeout$slambda$slambda_1, 'withWallclockTimeout$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withWallclockTimeout$slambda$slambda_3, 'withWallclockTimeout$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(withWallclockTimeout$slambda, 'withWallclockTimeout$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($awaitEventCOROUTINE$6, '$awaitEventCOROUTINE$6', classMeta, CoroutineImpl); setMetadataFor($awaitItemCOROUTINE$7, '$awaitItemCOROUTINE$7', classMeta, CoroutineImpl); setMetadataFor($skipItemsCOROUTINE$8, '$skipItemsCOROUTINE$8', classMeta, CoroutineImpl); setMetadataFor($awaitCompleteCOROUTINE$9, '$awaitCompleteCOROUTINE$9', classMeta, CoroutineImpl); setMetadataFor($awaitErrorCOROUTINE$10, '$awaitErrorCOROUTINE$10', classMeta, CoroutineImpl); setMetadataFor($withAppropriateTimeoutCOROUTINE$11, '$withAppropriateTimeoutCOROUTINE$11', classMeta, CoroutineImpl); setMetadataFor(Key_0, 'Key', objectMeta, VOID, [Key]); setMetadataFor(TurbineTimeoutElement, 'TurbineTimeoutElement', classMeta, VOID, [Element]); setMetadataFor(Key_1, 'Key', objectMeta, VOID, [Key]); setMetadataFor(TurbineRegistryElement, 'TurbineRegistryElement', classMeta, VOID, [Element]); setMetadataFor(reportTurbines$slambda, 'reportTurbines$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($reportTurbinesCOROUTINE$12, '$reportTurbinesCOROUTINE$12', classMeta, CoroutineImpl); function testIn$default(_this__u8e3s4, scope, timeout, name, $super) { timeout = timeout === VOID ? null : timeout; name = name === VOID ? null : name; var tmp; if ($super === VOID) { tmp = this.testIn_lzrzlr_k$(_this__u8e3s4, scope, timeout, name); } else { var tmp_0 = $super.testIn_lzrzlr_k$; var tmp_1 = timeout; tmp = tmp_0.call(this, _this__u8e3s4, scope, tmp_1 == null ? null : new Duration(tmp_1), name); } return tmp; } setMetadataFor(TurbineContext, 'TurbineContext', interfaceMeta, VOID, [CoroutineScope]); setMetadataFor(TurbineTestContext, 'TurbineTestContext', interfaceMeta, VOID, [TurbineContext, ReceiveTurbine], VOID, VOID, VOID, [0, 1]); setMetadataFor(TurbineTestContextImpl, 'TurbineTestContextImpl', classMeta, VOID, [TurbineContext, ReceiveTurbine, TurbineTestContext], VOID, VOID, VOID, [0, 1]); setMetadataFor(TurbineContextImpl, 'TurbineContextImpl', classMeta, VOID, [TurbineContext, CoroutineScope]); setMetadataFor(test$slambda$slambda, 'test$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(test$slambda, 'test$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(turbineScope$slambda$slambda, 'turbineScope$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(turbineScope$slambda$slambda_1, 'turbineScope$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(turbineScope$slambda, 'turbineScope$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(collectTurbineIn$slambda, 'collectTurbineIn$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(sam$kotlinx_coroutines_flow_FlowCollector$0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', classMeta, VOID, [FlowCollector], VOID, VOID, VOID, [1]); setMetadataFor(collectIntoChannel$slambda$slambda, 'collectIntoChannel$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(collectIntoChannel$slambda, 'collectIntoChannel$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(collectIntoChannel$1, VOID, classMeta, VOID, [Channel], VOID, VOID, VOID, [0, 1]); //endregion function Complete() { Complete_instance = this; } protoOf(Complete).toString = function () { return 'Complete'; }; var Complete_instance; function Complete_getInstance() { if (Complete_instance == null) new Complete(); return Complete_instance; } function Error_0(throwable) { this.throwable_1 = throwable; } protoOf(Error_0).get_throwable_c93gq1_k$ = function () { return this.throwable_1; }; protoOf(Error_0).equals = function (other) { var tmp; if (other instanceof Error_0) { tmp = equals(this.throwable_1, other.throwable_1); } else { tmp = false; } return tmp; }; protoOf(Error_0).hashCode = function () { return hashCode(this.throwable_1); }; protoOf(Error_0).toString = function () { return 'Error(' + getKClassFromExpression(this.throwable_1).get_simpleName_r6f8py_k$() + ')'; }; function Item(value) { this.value_1 = value; } protoOf(Item).get_value_j01efc_k$ = function () { return this.value_1; }; protoOf(Item).equals = function (other) { var tmp; if (other instanceof Item) { tmp = equals(this.value_1, other.value_1); } else { tmp = false; } return tmp; }; protoOf(Item).hashCode = function () { // Inline function 'kotlin.hashCode' call var tmp0_safe_receiver = this.value_1; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : hashCode(tmp0_safe_receiver); return tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs; }; protoOf(Item).toString = function () { return 'Item(' + this.value_1 + ')'; }; function Event() { } function ReceiveTurbine() { } function Turbine() { } function $receiveCOROUTINE$4(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($receiveCOROUTINE$4).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.$channel_1.receive_awoumx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.TRY_RESULT0__1 = suspendResult; this.set_exceptionState_fex74n_k$(3); this.set_state_rjd8d0_k$(4); continue $sm; case 2: this.set_exceptionState_fex74n_k$(3); var tmp_0 = this.get_exception_x0n6w6_k$(); if (tmp_0 instanceof Error) { var e = this.get_exception_x0n6w6_k$(); var tmp_1 = this; this._this__u8e3s4__1.this$0__1.ignoreRemainingEvents_1 = true; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 3: throw this.get_exception_x0n6w6_k$(); case 4: this.set_exceptionState_fex74n_k$(3); return this.TRY_RESULT0__1; } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $receiveCatchingCOROUTINE$5(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($receiveCatchingCOROUTINE$5).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.$channel_1.receiveCatching_golgg7_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } this.set_state_rjd8d0_k$(2); continue $sm; case 1: var unboxed = suspendResult.holder_1; suspendResult = new ChannelResult(unboxed); this.set_state_rjd8d0_k$(2); continue $sm; case 2: var this_0 = suspendResult; var it = this_0.holder_1; var tmp0_safe_receiver = toEvent(it); if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_isTerminal_i7a6hb_k$()) === true) { this._this__u8e3s4__1.this$0__1.ignoreRemainingEvents_1 = true; } return this_0; case 3: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function _get_job__e6b14k($this) { return $this.job_1; } function _get_timeout__tg4wg($this) { return $this.timeout_1; } function _get_name__das4rk($this) { return $this.name_1; } function withTurbineTimeout($this, block, $completion) { var tmp = new $withTurbineTimeoutCOROUTINE$0($this, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function _get_channel__c6e3yq($this) { return $this.channel_1; } function _set_ignoreTerminalEvents__u1yjg0($this, _set____db54di) { $this.ignoreTerminalEvents_1 = _set____db54di; } function _get_ignoreTerminalEvents__r12uis($this) { return $this.ignoreTerminalEvents_1; } function _set_ignoreRemainingEvents__7enzag($this, _set____db54di) { $this.ignoreRemainingEvents_1 = _set____db54di; } function _get_ignoreRemainingEvents__191mus($this) { return $this.ignoreRemainingEvents_1; } function ChannelTurbine$withTurbineTimeout$slambda($block, resultContinuation) { this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$withTurbineTimeout$slambda).invoke_x2i4op_k$ = function ($this$withTurbineTimeout, $completion) { var tmp = this.create_rcuf4x_k$($this$withTurbineTimeout, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$withTurbineTimeout$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_x2i4op_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ChannelTurbine$withTurbineTimeout$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = this.$block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$withTurbineTimeout$slambda).create_rcuf4x_k$ = function ($this$withTurbineTimeout, completion) { var i = new ChannelTurbine$withTurbineTimeout$slambda(this.$block_1, completion); i.$this$withTurbineTimeout_1 = $this$withTurbineTimeout; return i; }; protoOf(ChannelTurbine$withTurbineTimeout$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function ChannelTurbine$withTurbineTimeout$slambda_0($block, resultContinuation) { var i = new ChannelTurbine$withTurbineTimeout$slambda($block, resultContinuation); var l = function ($this$withTurbineTimeout, $completion) { return i.invoke_x2i4op_k$($this$withTurbineTimeout, $completion); }; l.$arity = 1; return l; } function ChannelTurbine$channel$1($channel, this$0) { this.$channel_1 = $channel; this.this$0__1 = this$0; this.$$delegate_0__1 = $channel; } protoOf(ChannelTurbine$channel$1).get_isClosedForReceive_v0r77d_k$ = function () { return this.$$delegate_0__1.get_isClosedForReceive_v0r77d_k$(); }; protoOf(ChannelTurbine$channel$1).get_isClosedForSend_ajczci_k$ = function () { return this.$$delegate_0__1.get_isClosedForSend_ajczci_k$(); }; protoOf(ChannelTurbine$channel$1).get_isEmpty_zauvru_k$ = function () { return this.$$delegate_0__1.get_isEmpty_zauvru_k$(); }; protoOf(ChannelTurbine$channel$1).get_onReceive_mimw11_k$ = function () { return this.$$delegate_0__1.get_onReceive_mimw11_k$(); }; protoOf(ChannelTurbine$channel$1).get_onReceiveCatching_ajg9xa_k$ = function () { return this.$$delegate_0__1.get_onReceiveCatching_ajg9xa_k$(); }; protoOf(ChannelTurbine$channel$1).get_onReceiveOrNull_5u62it_k$ = function () { return this.$$delegate_0__1.get_onReceiveOrNull_5u62it_k$(); }; protoOf(ChannelTurbine$channel$1).get_onSend_hnoo40_k$ = function () { return this.$$delegate_0__1.get_onSend_hnoo40_k$(); }; protoOf(ChannelTurbine$channel$1).cancel_2l89ey_k$ = function () { this.$$delegate_0__1.cancel_2l89ey_k$(); }; protoOf(ChannelTurbine$channel$1).cancel_e74who_k$ = function (cause) { return this.$$delegate_0__1.cancel_e74who_k$(cause); }; protoOf(ChannelTurbine$channel$1).cancel_hkmm2i_k$ = function (cause) { this.$$delegate_0__1.cancel_hkmm2i_k$(cause); }; protoOf(ChannelTurbine$channel$1).close_ukldxa_k$ = function (cause) { return this.$$delegate_0__1.close_ukldxa_k$(cause); }; protoOf(ChannelTurbine$channel$1).invokeOnClose_xlde4o_k$ = function (handler) { this.$$delegate_0__1.invokeOnClose_xlde4o_k$(handler); }; protoOf(ChannelTurbine$channel$1).iterator_jk1svi_k$ = function () { return this.$$delegate_0__1.iterator_jk1svi_k$(); }; protoOf(ChannelTurbine$channel$1).offer_szb1l9_k$ = function (element) { return this.$$delegate_0__1.offer_uqgnr2_k$(element); }; protoOf(ChannelTurbine$channel$1).offer_uqgnr2_k$ = function (element) { return this.offer_szb1l9_k$((element == null ? true : !(element == null)) ? element : THROW_CCE()); }; protoOf(ChannelTurbine$channel$1).poll_21vi7_k$ = function () { return this.$$delegate_0__1.poll_21vi7_k$(); }; protoOf(ChannelTurbine$channel$1).receiveOrNull_981lul_k$ = function ($completion) { return this.$$delegate_0__1.receiveOrNull_7f8d4k_k$($completion); }; protoOf(ChannelTurbine$channel$1).receiveOrNull_7f8d4k_k$ = function ($completion) { return this.receiveOrNull_981lul_k$($completion); }; protoOf(ChannelTurbine$channel$1).send_7nf3lq_k$ = function (element, $completion) { return this.$$delegate_0__1.send_44jogj_k$(element, $completion); }; protoOf(ChannelTurbine$channel$1).send_44jogj_k$ = function (element, $completion) { return this.send_7nf3lq_k$((element == null ? true : !(element == null)) ? element : THROW_CCE(), $completion); }; protoOf(ChannelTurbine$channel$1).trySend_w1juo7_k$ = function (element) { return this.$$delegate_0__1.trySend_62dpg8_k$(element); }; protoOf(ChannelTurbine$channel$1).trySend_62dpg8_k$ = function (element) { return this.trySend_w1juo7_k$((element == null ? true : !(element == null)) ? element : THROW_CCE()); }; protoOf(ChannelTurbine$channel$1).tryReceive_y3ovsz_k$ = function () { var result = this.$channel_1.tryReceive_y3ovg2_k$(); var event = toEvent(result); var tmp; if (event instanceof Error_0) { tmp = true; } else { tmp = event instanceof Complete; } if (tmp) this.this$0__1.ignoreRemainingEvents_1 = true; return result; }; protoOf(ChannelTurbine$channel$1).tryReceive_y3ovg2_k$ = function () { return this.tryReceive_y3ovsz_k$(); }; protoOf(ChannelTurbine$channel$1).receive_cnugsq_k$ = function ($completion) { var tmp = new $receiveCOROUTINE$4(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$channel$1).receive_awoumx_k$ = function ($completion) { return this.receive_cnugsq_k$($completion); }; protoOf(ChannelTurbine$channel$1).receiveCatching_xbvffc_k$ = function ($completion) { var tmp = new $receiveCatchingCOROUTINE$5(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); var tmp_0 = tmp.doResume_5yljmg_k$(); if (tmp_0 === get_COROUTINE_SUSPENDED()) return tmp_0; return tmp_0; }; protoOf(ChannelTurbine$channel$1).receiveCatching_golgg7_k$ = function ($completion) { return this.receiveCatching_xbvffc_k$($completion); }; function ChannelTurbine$awaitEvent$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$awaitEvent$slambda).invoke_ge5uex_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$awaitEvent$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_ge5uex_k$($completion); }; protoOf(ChannelTurbine$awaitEvent$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitEvent(this.this$0__1.channel_1, this.this$0__1.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$awaitEvent$slambda).create_d196fn_k$ = function (completion) { return new ChannelTurbine$awaitEvent$slambda(this.this$0__1, completion); }; function ChannelTurbine$awaitEvent$slambda_0(this$0, resultContinuation) { var i = new ChannelTurbine$awaitEvent$slambda(this$0, resultContinuation); var l = function ($completion) { return i.invoke_ge5uex_k$($completion); }; l.$arity = 0; return l; } function ChannelTurbine$awaitItem$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$awaitItem$slambda).invoke_8lqry9_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$awaitItem$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_8lqry9_k$($completion); }; protoOf(ChannelTurbine$awaitItem$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitItem(this.this$0__1.channel_1, this.this$0__1.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$awaitItem$slambda).create_d196fn_k$ = function (completion) { return new ChannelTurbine$awaitItem$slambda(this.this$0__1, completion); }; function ChannelTurbine$awaitItem$slambda_0(this$0, resultContinuation) { var i = new ChannelTurbine$awaitItem$slambda(this$0, resultContinuation); var l = function ($completion) { return i.invoke_8lqry9_k$($completion); }; l.$arity = 0; return l; } function ChannelTurbine$skipItems$slambda(this$0, $count, resultContinuation) { this.this$0__1 = this$0; this.$count_1 = $count; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$skipItems$slambda).invoke_h7udsx_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$skipItems$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_h7udsx_k$($completion); }; protoOf(ChannelTurbine$skipItems$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = skipItems(this.this$0__1.channel_1, this.$count_1, this.this$0__1.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$skipItems$slambda).create_d196fn_k$ = function (completion) { return new ChannelTurbine$skipItems$slambda(this.this$0__1, this.$count_1, completion); }; function ChannelTurbine$skipItems$slambda_0(this$0, $count, resultContinuation) { var i = new ChannelTurbine$skipItems$slambda(this$0, $count, resultContinuation); var l = function ($completion) { return i.invoke_h7udsx_k$($completion); }; l.$arity = 0; return l; } function ChannelTurbine$awaitComplete$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$awaitComplete$slambda).invoke_h7udsx_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$awaitComplete$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_h7udsx_k$($completion); }; protoOf(ChannelTurbine$awaitComplete$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitComplete(this.this$0__1.channel_1, this.this$0__1.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$awaitComplete$slambda).create_d196fn_k$ = function (completion) { return new ChannelTurbine$awaitComplete$slambda(this.this$0__1, completion); }; function ChannelTurbine$awaitComplete$slambda_0(this$0, resultContinuation) { var i = new ChannelTurbine$awaitComplete$slambda(this$0, resultContinuation); var l = function ($completion) { return i.invoke_h7udsx_k$($completion); }; l.$arity = 0; return l; } function ChannelTurbine$awaitError$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(ChannelTurbine$awaitError$slambda).invoke_6a0o8g_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine$awaitError$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_6a0o8g_k$($completion); }; protoOf(ChannelTurbine$awaitError$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitError(this.this$0__1.channel_1, this.this$0__1.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(ChannelTurbine$awaitError$slambda).create_d196fn_k$ = function (completion) { return new ChannelTurbine$awaitError$slambda(this.this$0__1, completion); }; function ChannelTurbine$awaitError$slambda_0(this$0, resultContinuation) { var i = new ChannelTurbine$awaitError$slambda(this$0, resultContinuation); var l = function ($completion) { return i.invoke_6a0o8g_k$($completion); }; l.$arity = 0; return l; } function $withTurbineTimeoutCOROUTINE$0(_this__u8e3s4, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.block_1 = block; } protoOf($withTurbineTimeoutCOROUTINE$0).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(4); var tmp_0 = this._this__u8e3s4__1.timeout_1; if (!((tmp_0 == null ? null : new Duration(tmp_0)) == null)) { this.set_state_rjd8d0_k$(2); suspendResult = withTurbineTimeout_0(this._this__u8e3s4__1.timeout_1, ChannelTurbine$withTurbineTimeout$slambda_0(this.block_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = this.block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 2: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 3: return this.WHEN_RESULT0__1; case 4: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $cancelCOROUTINE$1(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($cancelCOROUTINE$1).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); if (!this._this__u8e3s4__1.channel_1.get_isClosedForSend_ajczci_k$()) this._this__u8e3s4__1.ignoreTerminalEvents_1 = true; this._this__u8e3s4__1.channel_1.cancel$default_880p35_k$(); this.tmp0_safe_receiver0__1 = this._this__u8e3s4__1.job_1; if (this.tmp0_safe_receiver0__1 == null) { this.WHEN_RESULT1__1 = null; this.set_state_rjd8d0_k$(2); continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = cancelAndJoin(this.tmp0_safe_receiver0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: var tmp_0 = this; tmp_0.WHEN_RESULT1__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: return Unit_getInstance(); case 3: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $cancelAndIgnoreRemainingEventsCOROUTINE$2(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($cancelAndIgnoreRemainingEventsCOROUTINE$2).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.cancel_7jv2vx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this._this__u8e3s4__1.ignoreRemainingEvents_1 = true; return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $cancelAndConsumeRemainingEventsCOROUTINE$3(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($cancelAndConsumeRemainingEventsCOROUTINE$3).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); var tmp_0 = this; var this_0 = ArrayList_init_$Create$(); $l$loop_0: while (true) { var tmp0_elvis_lhs = takeEventUnsafe(this._this__u8e3s4__1.channel_1); var tmp_1; if (tmp0_elvis_lhs == null) { break $l$loop_0; } else { tmp_1 = tmp0_elvis_lhs; } var event = tmp_1; this_0.add_utx5q5_k$(event); var tmp_2; if (event instanceof Error_0) { tmp_2 = true; } else { tmp_2 = event instanceof Complete; } if (tmp_2) break $l$loop_0; } tmp_0.events0__1 = this_0.build_1k0s4u_k$(); this._this__u8e3s4__1.ignoreRemainingEvents_1 = true; this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.cancel_7jv2vx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return this.events0__1; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function ChannelTurbine(channel, job, timeout, name) { channel = channel === VOID ? Channel_0(Factory_getInstance().get_UNLIMITED_eshsm0_k$()) : channel; job = job === VOID ? null : job; this.job_1 = job; this.timeout_1 = timeout; this.name_1 = name; var tmp = this; tmp.channel_1 = new ChannelTurbine$channel$1(channel, this); this.ignoreTerminalEvents_1 = false; this.ignoreRemainingEvents_1 = false; } protoOf(ChannelTurbine).asChannel_sobm29_k$ = function () { return this.channel_1; }; protoOf(ChannelTurbine).add_jcyd1a_k$ = function (item) { if (!_ChannelResult___get_isSuccess__impl__odq1z9(this.channel_1.trySend_w1juo7_k$(item))) throw IllegalStateException_init_$Create$('Added when closed'); }; protoOf(ChannelTurbine).cancel_7jv2vx_k$ = function ($completion) { var tmp = new $cancelCOROUTINE$1(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine).close_2budci_k$ = function (cause) { if (!this.channel_1.get_isClosedForSend_ajczci_k$()) this.ignoreTerminalEvents_1 = true; this.channel_1.close_ukldxa_k$(cause); var tmp0_safe_receiver = this.job_1; if (tmp0_safe_receiver == null) null; else { tmp0_safe_receiver.cancel$default_8haxne_k$(); } }; protoOf(ChannelTurbine).takeEvent_oe88cz_k$ = function () { return takeEvent(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).takeItem_ao1cxy_k$ = function () { return takeItem(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).takeComplete_1v6s5s_k$ = function () { return takeComplete(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).takeError_oe5y2p_k$ = function () { return takeError(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).cancelAndIgnoreRemainingEvents_lga9av_k$ = function ($completion) { var tmp = new $cancelAndIgnoreRemainingEventsCOROUTINE$2(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine).cancelAndConsumeRemainingEvents_rwa0b5_k$ = function ($completion) { var tmp = new $cancelAndConsumeRemainingEventsCOROUTINE$3(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ChannelTurbine).expectNoEvents_7s6h3x_k$ = function () { expectNoEvents(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).expectMostRecentItem_rgynqi_k$ = function () { return expectMostRecentItem(this.channel_1, this.name_1); }; protoOf(ChannelTurbine).awaitEvent_t3tqe3_k$ = function ($completion) { return withTurbineTimeout(this, ChannelTurbine$awaitEvent$slambda_0(this, null), $completion); }; protoOf(ChannelTurbine).awaitItem_3hu73k_k$ = function ($completion) { return withTurbineTimeout(this, ChannelTurbine$awaitItem$slambda_0(this, null), $completion); }; protoOf(ChannelTurbine).skipItems_gabyww_k$ = function (count, $completion) { return withTurbineTimeout(this, ChannelTurbine$skipItems$slambda_0(this, count, null), $completion); }; protoOf(ChannelTurbine).awaitComplete_k5594o_k$ = function ($completion) { return withTurbineTimeout(this, ChannelTurbine$awaitComplete$slambda_0(this, null), $completion); }; protoOf(ChannelTurbine).awaitError_ct6zfa_k$ = function ($completion) { return withTurbineTimeout(this, ChannelTurbine$awaitError$slambda_0(this, null), $completion); }; protoOf(ChannelTurbine).reportUnconsumedEvents_avswxe_k$ = function () { if (this.ignoreRemainingEvents_1) return new UnconsumedEventReport(emptyList()); // Inline function 'kotlin.collections.mutableListOf' call var unconsumed = ArrayList_init_$Create$(); var cause = null; $l$loop_1: while (true) { var tmp0_elvis_lhs = takeEventUnsafe(this.channel_1); var tmp; if (tmp0_elvis_lhs == null) { break $l$loop_1; } else { tmp = tmp0_elvis_lhs; } var event = tmp; if (!(this.ignoreTerminalEvents_1 ? event.get_isTerminal_i7a6hb_k$() : false)) { // Inline function 'kotlin.collections.plusAssign' call unconsumed.add_utx5q5_k$(event); } if (event instanceof Error_0) { cause = event.get_throwable_c93gq1_k$(); break $l$loop_1; } else { if (event instanceof Complete) { break $l$loop_1; } } } var tmp1_name = this.name_1; var tmp2_cause = cause; return new UnconsumedEventReport(unconsumed, tmp1_name, tmp2_cause); }; protoOf(ChannelTurbine).ensureAllEventsConsumed_1osua4_k$ = function () { var report = this.reportUnconsumedEvents_avswxe_k$(); // Inline function 'kotlin.collections.isNotEmpty' call if (!report.unconsumed_1.isEmpty_y1axqb_k$()) { // Inline function 'kotlin.text.buildString' call // Inline function 'kotlin.contracts.contract' call // Inline function 'kotlin.apply' call var this_0 = StringBuilder_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'app.cash.turbine.ChannelTurbine.ensureAllEventsConsumed.' call report.describe_x817xh_k$(this_0); var tmp$ret$2 = this_0.toString(); throw new TurbineAssertionError(tmp$ret$2, report.cause_1); } }; function UnconsumedEventReport(unconsumed, name, cause) { name = name === VOID ? null : name; cause = cause === VOID ? null : cause; this.unconsumed_1 = unconsumed; this.name_1 = name; this.cause_1 = cause; } protoOf(UnconsumedEventReport).get_unconsumed_4blzhy_k$ = function () { return this.unconsumed_1; }; protoOf(UnconsumedEventReport).get_name_woqyms_k$ = function () { return this.name_1; }; protoOf(UnconsumedEventReport).get_cause_iplhs0_k$ = function () { return this.cause_1; }; protoOf(UnconsumedEventReport).describe_x817xh_k$ = function (builder) { // Inline function 'kotlin.with' call // Inline function 'kotlin.contracts.contract' call builder.append_22ad7x_k$(qualifiedBy('Unconsumed events found', this.name_1)); builder.append_22ad7x_k$(':'); var tmp0_iterator = this.unconsumed_1.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var event = tmp0_iterator.next_20eer_k$(); builder.append_22ad7x_k$('\n - ' + event); } }; protoOf(UnconsumedEventReport).describeException_ors88u_k$ = function (builder) { // Inline function 'kotlin.with' call // Inline function 'kotlin.contracts.contract' call // Inline function 'app.cash.turbine.UnconsumedEventReport.describeException.' call var tmp0_safe_receiver = this.cause_1; var tmp; if (tmp0_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call // Inline function 'app.cash.turbine.UnconsumedEventReport.describeException..' call builder.append_22ad7x_k$(qualifiedBy('Unconsumed exception found', this.name_1)); builder.append_22ad7x_k$(':'); // Inline function 'kotlin.text.appendLine' call var value = '\n\nStack trace:'; // Inline function 'kotlin.text.appendLine' call builder.append_22ad7x_k$(value).append_am5a4z_k$(_Char___init__impl__6a9atx(10)); builder.append_22ad7x_k$(stackTraceToString(tmp0_safe_receiver)); // Inline function 'kotlin.text.appendLine' call tmp = builder.append_am5a4z_k$(_Char___init__impl__6a9atx(10)); } }; protoOf(UnconsumedEventReport).stripCancellations_4znu6w_k$ = function () { // Inline function 'kotlin.collections.filter' call // Inline function 'kotlin.collections.filterTo' call var this_0 = this.unconsumed_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_0.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'app.cash.turbine.UnconsumedEventReport.stripCancellations.' call var tmp0_safe_receiver = element instanceof Error_0 ? element : null; var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_throwable_c93gq1_k$(); if (!(tmp instanceof CancellationException)) { destination.add_utx5q5_k$(element); } } var tmp_0 = destination; var tmp0_safe_receiver_0 = this.cause_1; var tmp_1; if (tmp0_safe_receiver_0 == null) { tmp_1 = null; } else { // Inline function 'kotlin.takeUnless' call // Inline function 'kotlin.contracts.contract' call var tmp_2; // Inline function 'app.cash.turbine.UnconsumedEventReport.stripCancellations.' call if (!(tmp0_safe_receiver_0 instanceof CancellationException)) { tmp_2 = tmp0_safe_receiver_0; } else { tmp_2 = null; } tmp_1 = tmp_2; } return new UnconsumedEventReport(tmp_0, this.name_1, tmp_1); }; function get_debug() { return debug; } var debug; function TurbineAssertionError(message, cause) { AssertionError_init_$Init$(message, this); captureStack(this, TurbineAssertionError); this.cause_1 = cause; } protoOf(TurbineAssertionError).get_cause_iplhs0_k$ = function () { return this.cause_1; }; function toEvent(_this__u8e3s4) { var cause = ChannelResult__exceptionOrNull_impl_16ei30(_this__u8e3s4); return _ChannelResult___get_isSuccess__impl__odq1z9(_this__u8e3s4) ? new Item(ChannelResult__getOrThrow_impl_od1axs(_this__u8e3s4)) : !(cause == null) ? new Error_0(cause) : _ChannelResult___get_isClosed__impl__mg7kuu(_this__u8e3s4) ? Complete_getInstance() : null; } function takeEvent(_this__u8e3s4, name) { name = name === VOID ? null : name; assertCallingContextIsNotSuspended(); var tmp0_elvis_lhs = takeEventUnsafe(_this__u8e3s4); var tmp; if (tmp0_elvis_lhs == null) { unexpectedEvent(name, null, 'an event'); } else { tmp = tmp0_elvis_lhs; } return tmp; } function takeItem(_this__u8e3s4, name) { name = name === VOID ? null : name; var event = takeEvent(_this__u8e3s4); var tmp; if (event instanceof Item) { tmp = event.get_value_j01efc_k$(); } else { unexpectedEvent(name, event, 'item'); } return tmp; } function takeComplete(_this__u8e3s4, name) { name = name === VOID ? null : name; var event = takeEvent(_this__u8e3s4); if (!(event instanceof Complete)) { unexpectedEvent(name, event, 'complete'); } } function takeError(_this__u8e3s4, name) { name = name === VOID ? null : name; var event = takeEvent(_this__u8e3s4); var tmp0_safe_receiver = event instanceof Error_0 ? event : null; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_throwable_c93gq1_k$(); var tmp; if (tmp1_elvis_lhs == null) { unexpectedEvent(name, event, 'error'); } else { tmp = tmp1_elvis_lhs; } return tmp; } function takeEventUnsafe(_this__u8e3s4) { return toEvent(_this__u8e3s4.tryReceive_y3ovg2_k$()); } function expectNoEvents(_this__u8e3s4, name) { name = name === VOID ? null : name; var tmp0_safe_receiver = toEvent(_this__u8e3s4.tryReceive_y3ovg2_k$()); if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call // Inline function 'app.cash.turbine.expectNoEvents.' call unexpectedEvent(name, tmp0_safe_receiver, 'no events'); } } function expectMostRecentItem(_this__u8e3s4, name) { name = name === VOID ? null : name; var previous = null; $l$loop: while (true) { var current = _this__u8e3s4.tryReceive_y3ovg2_k$(); var tmp0_safe_receiver = ChannelResult__exceptionOrNull_impl_16ei30(current); if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call throw tmp0_safe_receiver; } if (_ChannelResult___get_isFailure__impl__nz6ehu(current)) { break $l$loop; } previous = new ChannelResult(current); } var tmp1_safe_receiver = previous; if ((tmp1_safe_receiver == null ? null : _ChannelResult___get_isSuccess__impl__odq1z9(tmp1_safe_receiver.holder_1)) === true) return ChannelResult__getOrThrow_impl_od1axs(previous.holder_1); throw AssertionError_init_$Create$(qualifiedBy('No item was found', name)); } function awaitEvent(_this__u8e3s4, name, $completion) { name = name === VOID ? null : name; var tmp = new $awaitEventCOROUTINE$6(_this__u8e3s4, name, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function awaitItem(_this__u8e3s4, name, $completion) { name = name === VOID ? null : name; var tmp = new $awaitItemCOROUTINE$7(_this__u8e3s4, name, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function skipItems(_this__u8e3s4, count, name, $completion) { name = name === VOID ? null : name; var tmp = new $skipItemsCOROUTINE$8(_this__u8e3s4, count, name, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function awaitComplete(_this__u8e3s4, name, $completion) { name = name === VOID ? null : name; var tmp = new $awaitCompleteCOROUTINE$9(_this__u8e3s4, name, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function awaitError(_this__u8e3s4, name, $completion) { name = name === VOID ? null : name; var tmp = new $awaitErrorCOROUTINE$10(_this__u8e3s4, name, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function qualifiedBy(_this__u8e3s4, name) { var tmp; if (name == null) { tmp = _this__u8e3s4; } else { tmp = _this__u8e3s4 + ' for ' + name; } return tmp; } function unexpectedEvent(name, event, expected) { var tmp0_safe_receiver = event instanceof Error_0 ? event : null; var cause = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_throwable_c93gq1_k$(); var tmp2_elvis_lhs = event == null ? null : toString(event); var eventAsString = tmp2_elvis_lhs == null ? 'no items' : tmp2_elvis_lhs; throw new TurbineAssertionError('Expected ' + qualifiedBy(expected, name) + ' but found ' + eventAsString, cause); } function withAppropriateTimeout(timeout, block, $completion) { var tmp = new $withAppropriateTimeoutCOROUTINE$11(timeout, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function TurbineTimeoutCancellationException(message) { CancellationException_init_$Init$(message, this); captureStack(this, TurbineTimeoutCancellationException); } function withWallclockTimeout(timeout, block, $completion) { return coroutineScope(withWallclockTimeout$slambda_0(block, timeout, null), $completion); } function awaitEvent$slambda($this_awaitEvent, resultContinuation) { this.$this_awaitEvent_1 = $this_awaitEvent; CoroutineImpl.call(this, resultContinuation); } protoOf(awaitEvent$slambda).invoke_jpsqyb_k$ = function ($this$withAppropriateTimeout, $completion) { var tmp = this.create_rcuf4x_k$($this$withAppropriateTimeout, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(awaitEvent$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_jpsqyb_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(awaitEvent$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); this.set_state_rjd8d0_k$(1); suspendResult = this.$this_awaitEvent_1.receiveCatching_golgg7_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } this.set_state_rjd8d0_k$(2); continue $sm; case 1: var unboxed = suspendResult.holder_1; suspendResult = new ChannelResult(unboxed); this.set_state_rjd8d0_k$(2); continue $sm; case 2: var ARGUMENT = suspendResult.holder_1; var ARGUMENT_0 = toEvent(ARGUMENT); return ensureNotNull(ARGUMENT_0); case 3: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(awaitEvent$slambda).create_rcuf4x_k$ = function ($this$withAppropriateTimeout, completion) { var i = new awaitEvent$slambda(this.$this_awaitEvent_1, completion); i.$this$withAppropriateTimeout_1 = $this$withAppropriateTimeout; return i; }; protoOf(awaitEvent$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function awaitEvent$slambda_0($this_awaitEvent, resultContinuation) { var i = new awaitEvent$slambda($this_awaitEvent, resultContinuation); var l = function ($this$withAppropriateTimeout, $completion) { return i.invoke_jpsqyb_k$($this$withAppropriateTimeout, $completion); }; l.$arity = 1; return l; } function withWallclockTimeout$slambda$slambda($timeout, resultContinuation) { this.$timeout_1 = $timeout; CoroutineImpl.call(this, resultContinuation); } protoOf(withWallclockTimeout$slambda$slambda).invoke_d9fzmj_k$ = function ($this$launch, $completion) { var tmp = this.create_rcuf4x_k$($this$launch, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withWallclockTimeout$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withWallclockTimeout$slambda$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = delay(this.$timeout_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(withWallclockTimeout$slambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new withWallclockTimeout$slambda$slambda(this.$timeout_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(withWallclockTimeout$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function withWallclockTimeout$slambda$slambda_0($timeout, resultContinuation) { var i = new withWallclockTimeout$slambda$slambda($timeout, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function withWallclockTimeout$slambda$slambda_1($timeoutJob, resultContinuation) { this.$timeoutJob_1 = $timeoutJob; CoroutineImpl.call(this, resultContinuation); } protoOf(withWallclockTimeout$slambda$slambda_1).invoke_ea8vn4_k$ = function (result, $completion) { var tmp = this.create_zam77m_k$(result, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withWallclockTimeout$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_ea8vn4_k$((p1 == null ? true : !(p1 == null)) ? p1 : THROW_CCE(), $completion); }; protoOf(withWallclockTimeout$slambda$slambda_1).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); if (tmp === 0) { this.set_exceptionState_fex74n_k$(1); this.$timeoutJob_1.cancel$default_8haxne_k$(); return this.result_2; } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(withWallclockTimeout$slambda$slambda_1).create_zam77m_k$ = function (result, completion) { var i = new withWallclockTimeout$slambda$slambda_1(this.$timeoutJob_1, completion); i.result_2 = result; return i; }; protoOf(withWallclockTimeout$slambda$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_zam77m_k$((value == null ? true : !(value == null)) ? value : THROW_CCE(), completion); }; function withWallclockTimeout$slambda$slambda_2($timeoutJob, resultContinuation) { var i = new withWallclockTimeout$slambda$slambda_1($timeoutJob, resultContinuation); var l = function (result, $completion) { return i.invoke_ea8vn4_k$(result, $completion); }; l.$arity = 1; return l; } function withWallclockTimeout$slambda$slambda_3($blockDeferred, $timeout, resultContinuation) { this.$blockDeferred_1 = $blockDeferred; this.$timeout_1 = $timeout; CoroutineImpl.call(this, resultContinuation); } protoOf(withWallclockTimeout$slambda$slambda_3).invoke_8lqry9_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withWallclockTimeout$slambda$slambda_3).invoke_ib42db_k$ = function ($completion) { return this.invoke_8lqry9_k$($completion); }; protoOf(withWallclockTimeout$slambda$slambda_3).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); if (tmp === 0) { this.set_exceptionState_fex74n_k$(1); this.$blockDeferred_1.cancel$default_8haxne_k$(); throw new TurbineTimeoutCancellationException('Timed out waiting for ' + new Duration(this.$timeout_1)); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(withWallclockTimeout$slambda$slambda_3).create_d196fn_k$ = function (completion) { return new withWallclockTimeout$slambda$slambda_3(this.$blockDeferred_1, this.$timeout_1, completion); }; function withWallclockTimeout$slambda$slambda_4($blockDeferred, $timeout, resultContinuation) { var i = new withWallclockTimeout$slambda$slambda_3($blockDeferred, $timeout, resultContinuation); var l = function ($completion) { return i.invoke_8lqry9_k$($completion); }; l.$arity = 0; return l; } function withWallclockTimeout$slambda($block, $timeout, resultContinuation) { this.$block_1 = $block; this.$timeout_1 = $timeout; CoroutineImpl.call(this, resultContinuation); } protoOf(withWallclockTimeout$slambda).invoke_x2i4op_k$ = function ($this$coroutineScope, $completion) { var tmp = this.create_rcuf4x_k$($this$coroutineScope, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withWallclockTimeout$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_x2i4op_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withWallclockTimeout$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.blockDeferred0__1 = async(this.$this$coroutineScope_1, VOID, CoroutineStart_UNDISPATCHED_getInstance(), this.$block_1); var tmp_0 = this; var tmp_1 = GlobalScope_getInstance(); var tmp_2 = Dispatchers_getInstance().get_Default_goqax4_k$(); tmp_0.timeoutJob1__1 = launch(tmp_1, tmp_2, VOID, withWallclockTimeout$slambda$slambda_0(this.$timeout_1, null)); var tmp_3 = this; tmp_3.this2__1 = new SelectImplementation(this.get_context_h02k06_k$()); var tmp_4 = this; tmp_4.$this$run3__1 = this.this2__1; var $this$select = this.$this$run3__1; var tmp_5 = this.blockDeferred0__1.get_onAwait_l48qpe_k$(); $this$select.invoke_8p69io_k$(tmp_5, withWallclockTimeout$slambda$slambda_2(this.timeoutJob1__1, null)); var tmp_6 = this.timeoutJob1__1.get_onJoin_hnj4j6_k$(); $this$select.invoke_43nm97_k$(tmp_6, withWallclockTimeout$slambda$slambda_4(this.blockDeferred0__1, this.$timeout_1, null)); this.set_state_rjd8d0_k$(1); suspendResult = this.$this$run3__1.doSelect_2tssk0_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(withWallclockTimeout$slambda).create_rcuf4x_k$ = function ($this$coroutineScope, completion) { var i = new withWallclockTimeout$slambda(this.$block_1, this.$timeout_1, completion); i.$this$coroutineScope_1 = $this$coroutineScope; return i; }; protoOf(withWallclockTimeout$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function withWallclockTimeout$slambda_0($block, $timeout, resultContinuation) { var i = new withWallclockTimeout$slambda($block, $timeout, resultContinuation); var l = function ($this$coroutineScope, $completion) { return i.invoke_x2i4op_k$($this$coroutineScope, $completion); }; l.$arity = 1; return l; } function $awaitEventCOROUTINE$6(_this__u8e3s4, name, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.name_1 = name; } protoOf($awaitEventCOROUTINE$6).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(6); this.set_state_rjd8d0_k$(1); suspendResult = contextTimeout(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } this.set_state_rjd8d0_k$(2); continue $sm; case 1: this.unboxed0__1 = suspendResult.rawValue_1; suspendResult = new Duration(this.unboxed0__1); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.timeout1__1 = suspendResult.rawValue_1; this.set_exceptionState_fex74n_k$(4); this.set_state_rjd8d0_k$(3); suspendResult = withAppropriateTimeout(this.timeout1__1, awaitEvent$slambda_0(this._this__u8e3s4__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.TRY_RESULT2__1 = suspendResult; this.set_exceptionState_fex74n_k$(6); this.set_state_rjd8d0_k$(5); continue $sm; case 4: this.set_exceptionState_fex74n_k$(6); var tmp_0 = this.get_exception_x0n6w6_k$(); if (tmp_0 instanceof TimeoutCancellationException) { var e = this.get_exception_x0n6w6_k$(); var tmp_1 = this; throw new TurbineAssertionError('No ' + qualifiedBy('value produced', this.name_1) + ' in ' + new Duration(this.timeout1__1), e); } else { var tmp_2 = this.get_exception_x0n6w6_k$(); if (tmp_2 instanceof TurbineTimeoutCancellationException) { var e_0 = this.get_exception_x0n6w6_k$(); var tmp_3 = this; throw new TurbineAssertionError('No ' + qualifiedBy('value produced', this.name_1) + ' in ' + new Duration(this.timeout1__1), e_0); } else { throw this.get_exception_x0n6w6_k$(); } } case 5: this.set_exceptionState_fex74n_k$(6); return this.TRY_RESULT2__1; case 6: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_1 = $p; if (this.get_exceptionState_wflpxn_k$() === 6) { throw e_1; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_1); } } while (true); }; function $awaitItemCOROUTINE$7(_this__u8e3s4, name, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.name_1 = name; } protoOf($awaitItemCOROUTINE$7).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitEvent(this._this__u8e3s4__1, this.name_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; var tmp_0; if (result instanceof Item) { tmp_0 = result.get_value_j01efc_k$(); } else { unexpectedEvent(this.name_1, result, 'item'); } return tmp_0; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $skipItemsCOROUTINE$8(_this__u8e3s4, count, name, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.count_1 = count; this.name_1 = name; } protoOf($skipItemsCOROUTINE$8).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(4); var tmp_0 = this; tmp_0.times0__1 = this.count_1; this.tmp0_iterator1__1 = until(0, this.times0__1).iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(1); continue $sm; case 1: if (!this.tmp0_iterator1__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(3); continue $sm; } this.index2__1 = this.tmp0_iterator1__1.next_20eer_k$(); var tmp_1 = this; tmp_1.index3__1 = this.index2__1; this.set_state_rjd8d0_k$(2); suspendResult = awaitEvent(this._this__u8e3s4__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: var event = suspendResult; var tmp_2; if (equals(event, Complete_getInstance())) { tmp_2 = true; } else { tmp_2 = event instanceof Error_0; } if (tmp_2) { var tmp0_safe_receiver = event instanceof Error_0 ? event : null; var cause = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_throwable_c93gq1_k$(); throw new TurbineAssertionError('Expected ' + this.count_1 + ' ' + qualifiedBy('items', this.name_1) + ' but got ' + this.index3__1 + ' items and ' + event, cause); } else { event instanceof Item; } this.set_state_rjd8d0_k$(1); continue $sm; case 3: return Unit_getInstance(); case 4: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $awaitCompleteCOROUTINE$9(_this__u8e3s4, name, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.name_1 = name; } protoOf($awaitCompleteCOROUTINE$9).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitEvent(this._this__u8e3s4__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var event = suspendResult; if (!equals(event, Complete_getInstance())) { unexpectedEvent(this.name_1, event, 'complete'); } return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $awaitErrorCOROUTINE$10(_this__u8e3s4, name, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.name_1 = name; } protoOf($awaitErrorCOROUTINE$10).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = awaitEvent(this._this__u8e3s4__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var event = suspendResult; var tmp0_safe_receiver = event instanceof Error_0 ? event : null; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_throwable_c93gq1_k$(); var tmp_0; if (tmp1_elvis_lhs == null) { unexpectedEvent(this.name_1, event, 'error'); } else { tmp_0 = tmp1_elvis_lhs; } return tmp_0; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $withAppropriateTimeoutCOROUTINE$11(timeout, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.timeout_1 = timeout; this.block_1 = block; } protoOf($withAppropriateTimeoutCOROUTINE$11).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(4); if (!(this.get_context_h02k06_k$().get_y2st91_k$(Key_getInstance()) == null)) { this.set_state_rjd8d0_k$(2); suspendResult = withWallclockTimeout(this.timeout_1, this.block_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = withTimeout(this.timeout_1, this.block_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 2: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 3: return this.WHEN_RESULT0__1; case 4: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function get_DEFAULT_TIMEOUT() { _init_properties_coroutines_kt__5sxput(); return DEFAULT_TIMEOUT; } var DEFAULT_TIMEOUT; function withTurbineTimeout_0(timeout, block, $completion) { checkTimeout(timeout); return withContext(new TurbineTimeoutElement(timeout), block, $completion); } function reportTurbines(registry, block, $completion) { var tmp = new $reportTurbinesCOROUTINE$12(registry, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function reportTurbine(_this__u8e3s4, turbine) { _init_properties_coroutines_kt__5sxput(); var tmp0_safe_receiver = _this__u8e3s4.get_coroutineContext_115oqo_k$().get_y2st91_k$(Key_getInstance_1()); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.registry_1; return tmp1_safe_receiver == null ? null : tmp1_safe_receiver.add_utx5q5_k$(turbine); } function Key_0() { Key_instance = this; } var Key_instance; function Key_getInstance_0() { if (Key_instance == null) new Key_0(); return Key_instance; } function TurbineTimeoutElement(timeout) { Key_getInstance_0(); this.timeout_1 = timeout; this.key_1 = Key_getInstance_0(); } protoOf(TurbineTimeoutElement).get_timeout_dpbavi_k$ = function () { return this.timeout_1; }; protoOf(TurbineTimeoutElement).get_key_18j28a_k$ = function () { return this.key_1; }; function Key_1() { Key_instance_0 = this; } var Key_instance_0; function Key_getInstance_1() { if (Key_instance_0 == null) new Key_1(); return Key_instance_0; } function TurbineRegistryElement(registry) { Key_getInstance_1(); this.registry_1 = registry; this.key_1 = Key_getInstance_1(); } protoOf(TurbineRegistryElement).get_registry_rt8npi_k$ = function () { return this.registry_1; }; protoOf(TurbineRegistryElement).get_key_18j28a_k$ = function () { return this.key_1; }; function checkTimeout(timeout) { _init_properties_coroutines_kt__5sxput(); // Inline function 'kotlin.check' call // Inline function 'kotlin.contracts.contract' call if (!Duration__isPositive_impl_tvkkt2(timeout)) { // Inline function 'app.cash.turbine.checkTimeout.' call var message = 'Turbine timeout must be greater than 0: ' + new Duration(timeout); throw IllegalStateException_init_$Create$(toString(message)); } } function assertCallingContextIsNotSuspended() { _init_properties_coroutines_kt__5sxput(); var stackTrace = stackTraceToString(Exception_init_$Create$()); if (contains(stackTrace, 'invokeSuspend')) { // Inline function 'kotlin.error' call var message = 'Calling context is suspending; use a suspending method instead'; throw IllegalStateException_init_$Create$(toString(message)); } } function contextTimeout($completion) { // Inline function 'kotlinx.coroutines.currentCoroutineContext' call // Inline function 'kotlin.js.getCoroutineContext' call var tmp0_safe_receiver = $completion.get_context_h02k06_k$().get_y2st91_k$(Key_getInstance_0()); var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.timeout_1; var tmp; var tmp_0 = tmp1_elvis_lhs; if ((tmp_0 == null ? null : new Duration(tmp_0)) == null) { tmp = get_DEFAULT_TIMEOUT(); } else { tmp = tmp1_elvis_lhs; } return new Duration(tmp); } function reportTurbines$slambda($block, resultContinuation) { this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(reportTurbines$slambda).invoke_x2i4op_k$ = function ($this$withContext, $completion) { var tmp = this.create_rcuf4x_k$($this$withContext, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(reportTurbines$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_x2i4op_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(reportTurbines$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = this.$block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(reportTurbines$slambda).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new reportTurbines$slambda(this.$block_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(reportTurbines$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function reportTurbines$slambda_0($block, resultContinuation) { var i = new reportTurbines$slambda($block, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_x2i4op_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function $reportTurbinesCOROUTINE$12(registry, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.registry_1 = registry; this.block_1 = block; } protoOf($reportTurbinesCOROUTINE$12).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(4); var tmp_0 = this; tmp_0.enclosingRegistryElement0__1 = this.get_context_h02k06_k$().get_y2st91_k$(Key_getInstance_1()); if (!(this.enclosingRegistryElement0__1 == null)) { this.set_state_rjd8d0_k$(2); suspendResult = this.block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); var tmp_1 = new TurbineRegistryElement(this.registry_1); suspendResult = withContext(tmp_1, reportTurbines$slambda_0(this.block_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.WHEN_RESULT1__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 2: this.WHEN_RESULT1__1 = suspendResult; this.set_state_rjd8d0_k$(3); continue $sm; case 3: return this.WHEN_RESULT1__1; case 4: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; var properties_initialized_coroutines_kt_v4klel; function _init_properties_coroutines_kt__5sxput() { if (!properties_initialized_coroutines_kt_v4klel) { properties_initialized_coroutines_kt_v4klel = true; // Inline function 'kotlin.time.Companion.milliseconds' call Companion_getInstance(); DEFAULT_TIMEOUT = toDuration(3000, DurationUnit_MILLISECONDS_getInstance()); } } function test(_this__u8e3s4, timeout, name, validate, $completion) { timeout = timeout === VOID ? null : timeout; name = name === VOID ? null : name; return turbineScope(VOID, test$slambda_0(_this__u8e3s4, name, timeout, validate, null), $completion); } function TurbineTestContext() { } function turbineScope(timeout, validate, $completion) { timeout = timeout === VOID ? null : timeout; // Inline function 'kotlin.collections.mutableListOf' call var turbineRegistry = ArrayList_init_$Create$(); return reportTurbines(turbineRegistry, turbineScope$slambda_0(timeout, validate, turbineRegistry, null), $completion); } function TurbineContext() { } function TurbineTestContextImpl(turbine, turbineContext) { this.$$delegate_0__1 = new TurbineContextImpl(turbineContext); this.$$delegate_1__1 = turbine; } protoOf(TurbineTestContextImpl).get_coroutineContext_115oqo_k$ = function () { return this.$$delegate_0__1.coroutineContext_1; }; protoOf(TurbineTestContextImpl).testIn_lzrzlr_k$ = function (_this__u8e3s4, scope, timeout, name) { return this.$$delegate_0__1.testIn_lzrzlr_k$(_this__u8e3s4, scope, timeout, name); }; protoOf(TurbineTestContextImpl).asChannel_sobm29_k$ = function () { return this.$$delegate_1__1.asChannel_sobm29_k$(); }; protoOf(TurbineTestContextImpl).awaitComplete_k5594o_k$ = function ($completion) { return this.$$delegate_1__1.awaitComplete_k5594o_k$($completion); }; protoOf(TurbineTestContextImpl).awaitError_ct6zfa_k$ = function ($completion) { return this.$$delegate_1__1.awaitError_ct6zfa_k$($completion); }; protoOf(TurbineTestContextImpl).awaitEvent_t3tqe3_k$ = function ($completion) { return this.$$delegate_1__1.awaitEvent_t3tqe3_k$($completion); }; protoOf(TurbineTestContextImpl).awaitItem_3hu73k_k$ = function ($completion) { return this.$$delegate_1__1.awaitItem_3hu73k_k$($completion); }; protoOf(TurbineTestContextImpl).cancel_7jv2vx_k$ = function ($completion) { return this.$$delegate_1__1.cancel_7jv2vx_k$($completion); }; protoOf(TurbineTestContextImpl).cancelAndConsumeRemainingEvents_rwa0b5_k$ = function ($completion) { return this.$$delegate_1__1.cancelAndConsumeRemainingEvents_rwa0b5_k$($completion); }; protoOf(TurbineTestContextImpl).cancelAndIgnoreRemainingEvents_lga9av_k$ = function ($completion) { return this.$$delegate_1__1.cancelAndIgnoreRemainingEvents_lga9av_k$($completion); }; protoOf(TurbineTestContextImpl).ensureAllEventsConsumed_1osua4_k$ = function () { this.$$delegate_1__1.ensureAllEventsConsumed_1osua4_k$(); }; protoOf(TurbineTestContextImpl).expectMostRecentItem_rgynqi_k$ = function () { return this.$$delegate_1__1.expectMostRecentItem_rgynqi_k$(); }; protoOf(TurbineTestContextImpl).expectNoEvents_7s6h3x_k$ = function () { this.$$delegate_1__1.expectNoEvents_7s6h3x_k$(); }; protoOf(TurbineTestContextImpl).skipItems_gabyww_k$ = function (count, $completion) { return this.$$delegate_1__1.skipItems_gabyww_k$(count, $completion); }; function collectTurbineIn(_this__u8e3s4, scope, timeout, name) { var channel = {_v: null}; var tmp0_safe_receiver = scope.get_coroutineContext_115oqo_k$().get_y2st91_k$(Key_getInstance()); var tmp; if (tmp0_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call tmp = collectTurbineIn$UnconfinedTestDispatcher(tmp0_safe_receiver); } var tmp1_elvis_lhs = tmp; var unconfined = tmp1_elvis_lhs == null ? Dispatchers_getInstance().get_Unconfined_sfvx0q_k$() : tmp1_elvis_lhs; var tmp_0 = CoroutineStart_UNDISPATCHED_getInstance(); var job = launch(scope, unconfined, tmp_0, collectTurbineIn$slambda_0(channel, _this__u8e3s4, null)); // Inline function 'kotlin.also' call var tmp_1; if (channel._v == null) { throwUninitializedPropertyAccessException('channel'); } else { tmp_1 = channel._v; } var this_0 = new ChannelTurbine(tmp_1, job, timeout, name); // Inline function 'kotlin.contracts.contract' call // Inline function 'app.cash.turbine.collectTurbineIn.' call reportTurbine(scope, this_0); return this_0; } function _get_turbineElements__qr0jrp($this) { return $this.turbineElements_1; } function TurbineContextImpl(turbineContext) { this.coroutineContext_1 = turbineContext; var tmp = this; var tmp1_elvis_lhs = turbineContext.get_y2st91_k$(Key_getInstance_1()); var tmp_0 = tmp1_elvis_lhs == null ? EmptyCoroutineContext_getInstance() : tmp1_elvis_lhs; var tmp0_elvis_lhs = turbineContext.get_y2st91_k$(Key_getInstance_0()); tmp.turbineElements_1 = tmp_0.plus_s13ygv_k$(tmp0_elvis_lhs == null ? EmptyCoroutineContext_getInstance() : tmp0_elvis_lhs); } protoOf(TurbineContextImpl).get_coroutineContext_115oqo_k$ = function () { return this.coroutineContext_1; }; protoOf(TurbineContextImpl).testIn_lzrzlr_k$ = function (_this__u8e3s4, scope, timeout, name) { var tmp0_scope = plus_0(scope, this.turbineElements_1); return testInInternal(_this__u8e3s4, timeout, tmp0_scope, name); }; function collectIntoChannel(_this__u8e3s4, scope) { var output = Channel_0(Factory_getInstance().get_UNLIMITED_eshsm0_k$()); var tmp = CoroutineStart_UNDISPATCHED_getInstance(); var job = launch(scope, VOID, tmp, collectIntoChannel$slambda_0(_this__u8e3s4, output, null)); return new collectIntoChannel$1(output, job); } function testInInternal(flow, timeout, scope, name) { var tmp = timeout; if (!((tmp == null ? null : new Duration(tmp)) == null)) { checkTimeout(timeout); } if (scope.get_coroutineContext_115oqo_k$().get_y2st91_k$(Key_getInstance_1()) == null) { throw AssertionError_init_$Create$('Turbine can only collect flows within a TurbineContext. Wrap with turbineScope { .. }'); } var turbine = collectTurbineIn(flow, scope, timeout, name); var tmp_0 = get_job(scope.get_coroutineContext_115oqo_k$()); tmp_0.invokeOnCompletion_n6cffu_k$(testInInternal$lambda(turbine)); return turbine; } function collectTurbineIn$UnconfinedTestDispatcher(p0) { return UnconfinedTestDispatcher(p0); } function test$slambda$slambda($validate, $testContext, resultContinuation) { this.$validate_1 = $validate; this.$testContext_1 = $testContext; CoroutineImpl.call(this, resultContinuation); } protoOf(test$slambda$slambda).invoke_d9fzmj_k$ = function ($this$withTurbineTimeout, $completion) { var tmp = this.create_rcuf4x_k$($this$withTurbineTimeout, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(test$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(test$slambda$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); suspendResult = this.$validate_1(this.$testContext_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(test$slambda$slambda).create_rcuf4x_k$ = function ($this$withTurbineTimeout, completion) { var i = new test$slambda$slambda(this.$validate_1, this.$testContext_1, completion); i.$this$withTurbineTimeout_1 = $this$withTurbineTimeout; return i; }; protoOf(test$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function test$slambda$slambda_0($validate, $testContext, resultContinuation) { var i = new test$slambda$slambda($validate, $testContext, resultContinuation); var l = function ($this$withTurbineTimeout, $completion) { return i.invoke_d9fzmj_k$($this$withTurbineTimeout, $completion); }; l.$arity = 1; return l; } function test$slambda($this_test, $name, $timeout, $validate, resultContinuation) { this.$this_test_1 = $this_test; this.$name_1 = $name; this.$timeout_1 = $timeout; this.$validate_1 = $validate; CoroutineImpl.call(this, resultContinuation); } protoOf(test$slambda).invoke_3e8it8_k$ = function ($this$turbineScope, $completion) { var tmp = this.create_5dnnao_k$($this$turbineScope, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(test$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_3e8it8_k$((!(p1 == null) ? isInterface(p1, TurbineContext) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(test$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(5); var tmp_0 = this; tmp_0.this0__1 = collectTurbineIn(this.$this_test_1, this.$this$turbineScope_1, null, this.$name_1); var tmp_1 = this; tmp_1.$this$apply1__1 = this.this0__1; var tmp_2 = this; tmp_2.testContext2__1 = new TurbineTestContextImpl(this.$this$apply1__1, this.get_context_h02k06_k$()); var tmp_3 = this.$timeout_1; if (!((tmp_3 == null ? null : new Duration(tmp_3)) == null)) { this.set_state_rjd8d0_k$(2); suspendResult = withTurbineTimeout_0(this.$timeout_1, test$slambda$slambda_0(this.$validate_1, this.testContext2__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = this.$validate_1(this.testContext2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.set_state_rjd8d0_k$(3); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_state_rjd8d0_k$(4); suspendResult = this.$this$apply1__1.cancel_7jv2vx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.$this$apply1__1.ensureAllEventsConsumed_1osua4_k$(); return Unit_getInstance(); case 5: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 5) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(test$slambda).create_5dnnao_k$ = function ($this$turbineScope, completion) { var i = new test$slambda(this.$this_test_1, this.$name_1, this.$timeout_1, this.$validate_1, completion); i.$this$turbineScope_1 = $this$turbineScope; return i; }; protoOf(test$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_5dnnao_k$((!(value == null) ? isInterface(value, TurbineContext) : false) ? value : THROW_CCE(), completion); }; function test$slambda_0($this_test, $name, $timeout, $validate, resultContinuation) { var i = new test$slambda($this_test, $name, $timeout, $validate, resultContinuation); var l = function ($this$turbineScope, $completion) { return i.invoke_3e8it8_k$($this$turbineScope, $completion); }; l.$arity = 1; return l; } function turbineScope$slambda$slambda($timeout, resultContinuation) { this.$timeout_1 = $timeout; CoroutineImpl.call(this, resultContinuation); } protoOf(turbineScope$slambda$slambda).invoke_i27y3i_k$ = function (block, $completion) { var tmp = this.create_skjin2_k$(block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(turbineScope$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_i27y3i_k$((!(p1 == null) ? isSuspendFunction(p1, 1) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(turbineScope$slambda$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(4); var tmp_0 = this.$timeout_1; if ((tmp_0 == null ? null : new Duration(tmp_0)) == null) { this.set_state_rjd8d0_k$(2); suspendResult = coroutineScope(this.block_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = withTurbineTimeout_0(this.$timeout_1, this.block_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.set_state_rjd8d0_k$(3); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: return Unit_getInstance(); case 4: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(turbineScope$slambda$slambda).create_skjin2_k$ = function (block, completion) { var i = new turbineScope$slambda$slambda(this.$timeout_1, completion); i.block_1 = block; return i; }; protoOf(turbineScope$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_skjin2_k$((!(value == null) ? isSuspendFunction(value, 1) : false) ? value : THROW_CCE(), completion); }; function turbineScope$slambda$slambda_0($timeout, resultContinuation) { var i = new turbineScope$slambda$slambda($timeout, resultContinuation); var l = function (block, $completion) { return i.invoke_i27y3i_k$(block, $completion); }; l.$arity = 1; return l; } function turbineScope$slambda$slambda_1($validate, $turbineRegistry, resultContinuation) { this.$validate_1 = $validate; this.$turbineRegistry_1 = $turbineRegistry; CoroutineImpl.call(this, resultContinuation); } protoOf(turbineScope$slambda$slambda_1).invoke_d9fzmj_k$ = function ($this$invoke, $completion) { var tmp = this.create_rcuf4x_k$($this$invoke, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(turbineScope$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(turbineScope$slambda$slambda_1).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); this.set_exceptionState_fex74n_k$(2); var tmp_0 = this; tmp_0.testContext0__1 = new TurbineContextImpl(this.get_context_h02k06_k$()); this.set_state_rjd8d0_k$(1); suspendResult = this.$validate_1(this.testContext0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_exceptionState_fex74n_k$(3); this.set_state_rjd8d0_k$(4); continue $sm; case 2: this.set_exceptionState_fex74n_k$(3); var tmp_1 = this.get_exception_x0n6w6_k$(); if (tmp_1 instanceof Error) { var e = this.get_exception_x0n6w6_k$(); var this_0 = this.$turbineRegistry_1; var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator = this_0.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); destination.add_utx5q5_k$(item.reportUnconsumedEvents_avswxe_k$().stripCancellations_4znu6w_k$()); } var destination_0 = ArrayList_init_$Create$(); var tmp0_iterator_0 = destination.iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var element = tmp0_iterator_0.next_20eer_k$(); if (!(element.get_cause_iplhs0_k$() == null)) { destination_0.add_utx5q5_k$(element); } } var reportsWithExceptions = destination_0; if (reportsWithExceptions.isEmpty_y1axqb_k$()) { throw e; } else { var this_1 = StringBuilder_init_$Create$(); var tmp0_iterator_1 = reportsWithExceptions.iterator_jk1svi_k$(); while (tmp0_iterator_1.hasNext_bitz1p_k$()) { var element_0 = tmp0_iterator_1.next_20eer_k$(); element_0.describeException_ors88u_k$(this_1); } throw new TurbineAssertionError(this_1.toString(), e); } } else { throw this.get_exception_x0n6w6_k$(); } case 3: throw this.get_exception_x0n6w6_k$(); case 4: this.set_exceptionState_fex74n_k$(3); return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(turbineScope$slambda$slambda_1).create_rcuf4x_k$ = function ($this$invoke, completion) { var i = new turbineScope$slambda$slambda_1(this.$validate_1, this.$turbineRegistry_1, completion); i.$this$invoke_1 = $this$invoke; return i; }; protoOf(turbineScope$slambda$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function turbineScope$slambda$slambda_2($validate, $turbineRegistry, resultContinuation) { var i = new turbineScope$slambda$slambda_1($validate, $turbineRegistry, resultContinuation); var l = function ($this$invoke, $completion) { return i.invoke_d9fzmj_k$($this$invoke, $completion); }; l.$arity = 1; return l; } function turbineScope$slambda($timeout, $validate, $turbineRegistry, resultContinuation) { this.$timeout_1 = $timeout; this.$validate_1 = $validate; this.$turbineRegistry_1 = $turbineRegistry; CoroutineImpl.call(this, resultContinuation); } protoOf(turbineScope$slambda).invoke_h7udsx_k$ = function ($completion) { var tmp = this.create_d196fn_k$($completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(turbineScope$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_h7udsx_k$($completion); }; protoOf(turbineScope$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(2); var tmp_0 = this; tmp_0.scopeFn0__1 = turbineScope$slambda$slambda_0(this.$timeout_1, null); this.set_state_rjd8d0_k$(1); suspendResult = this.scopeFn0__1(turbineScope$slambda$slambda_2(this.$validate_1, this.$turbineRegistry_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_getInstance(); case 2: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 2) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(turbineScope$slambda).create_d196fn_k$ = function (completion) { return new turbineScope$slambda(this.$timeout_1, this.$validate_1, this.$turbineRegistry_1, completion); }; function turbineScope$slambda_0($timeout, $validate, $turbineRegistry, resultContinuation) { var i = new turbineScope$slambda($timeout, $validate, $turbineRegistry, resultContinuation); var l = function ($completion) { return i.invoke_h7udsx_k$($completion); }; l.$arity = 0; return l; } function collectTurbineIn$slambda($channel, $this_collectTurbineIn, resultContinuation) { this.$channel_1 = $channel; this.$this_collectTurbineIn_1 = $this_collectTurbineIn; CoroutineImpl.call(this, resultContinuation); } protoOf(collectTurbineIn$slambda).invoke_d9fzmj_k$ = function ($this$launch, $completion) { var tmp = this.create_rcuf4x_k$($this$launch, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(collectTurbineIn$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(collectTurbineIn$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); if (tmp === 0) { this.set_exceptionState_fex74n_k$(1); this.$channel_1._v = collectIntoChannel(this.$this_collectTurbineIn_1, this.$this$launch_1); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(collectTurbineIn$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new collectTurbineIn$slambda(this.$channel_1, this.$this_collectTurbineIn_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(collectTurbineIn$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function collectTurbineIn$slambda_0($channel, $this_collectTurbineIn, resultContinuation) { var i = new collectTurbineIn$slambda($channel, $this_collectTurbineIn, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function sam$kotlinx_coroutines_flow_FlowCollector$0(function_0) { this.function_1 = function_0; } protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).emit_t92u1f_k$ = function (value, $completion) { return this.function_1(value, $completion); }; function collectIntoChannel$slambda$slambda($output, resultContinuation) { this.$output_1 = $output; CoroutineImpl.call(this, resultContinuation); } protoOf(collectIntoChannel$slambda$slambda).invoke_oz8tte_k$ = function (it, $completion) { var tmp = this.create_zam77m_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(collectIntoChannel$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_oz8tte_k$((p1 == null ? true : !(p1 == null)) ? p1 : THROW_CCE(), $completion); }; protoOf(collectIntoChannel$slambda$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); if (tmp === 0) { this.set_exceptionState_fex74n_k$(1); this.$output_1.trySend_62dpg8_k$(this.it_1); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(collectIntoChannel$slambda$slambda).create_zam77m_k$ = function (it, completion) { var i = new collectIntoChannel$slambda$slambda(this.$output_1, completion); i.it_1 = it; return i; }; protoOf(collectIntoChannel$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_zam77m_k$((value == null ? true : !(value == null)) ? value : THROW_CCE(), completion); }; function collectIntoChannel$slambda$slambda_0($output, resultContinuation) { var i = new collectIntoChannel$slambda$slambda($output, resultContinuation); var l = function (it, $completion) { return i.invoke_oz8tte_k$(it, $completion); }; l.$arity = 1; return l; } function collectIntoChannel$slambda($this_collectIntoChannel, $output, resultContinuation) { this.$this_collectIntoChannel_1 = $this_collectIntoChannel; this.$output_1 = $output; CoroutineImpl.call(this, resultContinuation); } protoOf(collectIntoChannel$slambda).invoke_d9fzmj_k$ = function ($this$launch, $completion) { var tmp = this.create_rcuf4x_k$($this$launch, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(collectIntoChannel$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(collectIntoChannel$slambda).doResume_5yljmg_k$ = function () { var suspendResult = this.get_result_iyg5d2_k$(); $sm: do try { var tmp = this.get_state_iypx7s_k$(); switch (tmp) { case 0: this.set_exceptionState_fex74n_k$(3); this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); var tmp_0 = collectIntoChannel$slambda$slambda_0(this.$output_1, null); suspendResult = this.$this_collectIntoChannel_1.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_0), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.$output_1.close$default_kcbl7u_k$(); this.set_exceptionState_fex74n_k$(3); this.set_state_rjd8d0_k$(4); continue $sm; case 2: this.set_exceptionState_fex74n_k$(3); var tmp_1 = this.get_exception_x0n6w6_k$(); if (tmp_1 instanceof Error) { var e = this.get_exception_x0n6w6_k$(); this.$output_1.close_ukldxa_k$(e); this.set_state_rjd8d0_k$(4); continue $sm; } else { throw this.get_exception_x0n6w6_k$(); } case 3: throw this.get_exception_x0n6w6_k$(); case 4: this.set_exceptionState_fex74n_k$(3); return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(collectIntoChannel$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new collectIntoChannel$slambda(this.$this_collectIntoChannel_1, this.$output_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(collectIntoChannel$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function collectIntoChannel$slambda_0($this_collectIntoChannel, $output, resultContinuation) { var i = new collectIntoChannel$slambda($this_collectIntoChannel, $output, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function collectIntoChannel$1($output, $job) { this.$output_1 = $output; this.$job_1 = $job; this.$$delegate_0__1 = $output; } protoOf(collectIntoChannel$1).get_isClosedForReceive_v0r77d_k$ = function () { return this.$$delegate_0__1.get_isClosedForReceive_v0r77d_k$(); }; protoOf(collectIntoChannel$1).get_isClosedForSend_ajczci_k$ = function () { return this.$$delegate_0__1.get_isClosedForSend_ajczci_k$(); }; protoOf(collectIntoChannel$1).get_isEmpty_zauvru_k$ = function () { return this.$$delegate_0__1.get_isEmpty_zauvru_k$(); }; protoOf(collectIntoChannel$1).get_onReceive_mimw11_k$ = function () { return this.$$delegate_0__1.get_onReceive_mimw11_k$(); }; protoOf(collectIntoChannel$1).get_onReceiveCatching_ajg9xa_k$ = function () { return this.$$delegate_0__1.get_onReceiveCatching_ajg9xa_k$(); }; protoOf(collectIntoChannel$1).get_onReceiveOrNull_5u62it_k$ = function () { return this.$$delegate_0__1.get_onReceiveOrNull_5u62it_k$(); }; protoOf(collectIntoChannel$1).get_onSend_hnoo40_k$ = function () { return this.$$delegate_0__1.get_onSend_hnoo40_k$(); }; protoOf(collectIntoChannel$1).cancel_2l89ey_k$ = function () { this.$$delegate_0__1.cancel_2l89ey_k$(); }; protoOf(collectIntoChannel$1).cancel_e74who_k$ = function (cause) { return this.$$delegate_0__1.cancel_e74who_k$(cause); }; protoOf(collectIntoChannel$1).invokeOnClose_xlde4o_k$ = function (handler) { this.$$delegate_0__1.invokeOnClose_xlde4o_k$(handler); }; protoOf(collectIntoChannel$1).iterator_jk1svi_k$ = function () { return this.$$delegate_0__1.iterator_jk1svi_k$(); }; protoOf(collectIntoChannel$1).offer_szb1l9_k$ = function (element) { return this.$$delegate_0__1.offer_uqgnr2_k$(element); }; protoOf(collectIntoChannel$1).offer_uqgnr2_k$ = function (element) { return this.offer_szb1l9_k$((element == null ? true : !(element == null)) ? element : THROW_CCE()); }; protoOf(collectIntoChannel$1).poll_21vi7_k$ = function () { return this.$$delegate_0__1.poll_21vi7_k$(); }; protoOf(collectIntoChannel$1).receive_cnugsq_k$ = function ($completion) { return this.$$delegate_0__1.receive_awoumx_k$($completion); }; protoOf(collectIntoChannel$1).receive_awoumx_k$ = function ($completion) { return this.receive_cnugsq_k$($completion); }; protoOf(collectIntoChannel$1).receiveCatching_xbvffc_k$ = function ($completion) { var tmp = this.$$delegate_0__1.receiveCatching_golgg7_k$($completion); if (tmp === get_COROUTINE_SUSPENDED()) return tmp; return tmp; }; protoOf(collectIntoChannel$1).receiveCatching_golgg7_k$ = function ($completion) { return this.receiveCatching_xbvffc_k$($completion); }; protoOf(collectIntoChannel$1).receiveOrNull_981lul_k$ = function ($completion) { return this.$$delegate_0__1.receiveOrNull_7f8d4k_k$($completion); }; protoOf(collectIntoChannel$1).receiveOrNull_7f8d4k_k$ = function ($completion) { return this.receiveOrNull_981lul_k$($completion); }; protoOf(collectIntoChannel$1).send_7nf3lq_k$ = function (element, $completion) { return this.$$delegate_0__1.send_44jogj_k$(element, $completion); }; protoOf(collectIntoChannel$1).send_44jogj_k$ = function (element, $completion) { return this.send_7nf3lq_k$((element == null ? true : !(element == null)) ? element : THROW_CCE(), $completion); }; protoOf(collectIntoChannel$1).tryReceive_y3ovsz_k$ = function () { return this.$$delegate_0__1.tryReceive_y3ovg2_k$(); }; protoOf(collectIntoChannel$1).tryReceive_y3ovg2_k$ = function () { return this.tryReceive_y3ovsz_k$(); }; protoOf(collectIntoChannel$1).trySend_w1juo7_k$ = function (element) { return this.$$delegate_0__1.trySend_62dpg8_k$(element); }; protoOf(collectIntoChannel$1).trySend_62dpg8_k$ = function (element) { return this.trySend_w1juo7_k$((element == null ? true : !(element == null)) ? element : THROW_CCE()); }; protoOf(collectIntoChannel$1).cancel_hkmm2i_k$ = function (cause) { this.$job_1.cancel$default_8haxne_k$(); this.$output_1.close_ukldxa_k$(cause); }; protoOf(collectIntoChannel$1).close_ukldxa_k$ = function (cause) { this.$job_1.cancel$default_8haxne_k$(); return this.$output_1.close_ukldxa_k$(cause); }; function testInInternal$lambda($turbine) { return function (exception) { var tmp; if (get_debug()) { println('Scope ending ' + toString(exception == null ? '' : exception)); tmp = Unit_getInstance(); } var tmp_0; if (exception == null) { $turbine.ensureAllEventsConsumed_1osua4_k$(); tmp_0 = Unit_getInstance(); } return Unit_getInstance(); }; } //region block: post-declaration protoOf(Complete).get_isTerminal_i7a6hb_k$ = get_isTerminal; protoOf(Error_0).get_isTerminal_i7a6hb_k$ = get_isTerminal; protoOf(Item).get_isTerminal_i7a6hb_k$ = get_isTerminal; protoOf(ChannelTurbine$channel$1).cancel$default_2ouzfv_k$ = cancel$default; protoOf(ChannelTurbine$channel$1).cancel$default_880p35_k$ = cancel$default_0; protoOf(ChannelTurbine$channel$1).close$default_kcbl7u_k$ = close$default; protoOf(ChannelTurbine).close$default_v5a3vb_k$ = close$default_0; defineProp(protoOf(TurbineAssertionError), 'cause', function () { return this.get_cause_iplhs0_k$(); }); protoOf(TurbineTimeoutElement).get_y2st91_k$ = get; protoOf(TurbineTimeoutElement).fold_j2vaxd_k$ = fold; protoOf(TurbineTimeoutElement).minusKey_9i5ggf_k$ = minusKey; protoOf(TurbineTimeoutElement).plus_s13ygv_k$ = plus; protoOf(TurbineRegistryElement).get_y2st91_k$ = get; protoOf(TurbineRegistryElement).fold_j2vaxd_k$ = fold; protoOf(TurbineRegistryElement).minusKey_9i5ggf_k$ = minusKey; protoOf(TurbineRegistryElement).plus_s13ygv_k$ = plus; protoOf(TurbineTestContextImpl).testIn$default_ab2yr6_k$ = testIn$default; protoOf(TurbineContextImpl).testIn$default_ab2yr6_k$ = testIn$default; protoOf(collectIntoChannel$1).cancel$default_2ouzfv_k$ = cancel$default; protoOf(collectIntoChannel$1).cancel$default_880p35_k$ = cancel$default_0; protoOf(collectIntoChannel$1).close$default_kcbl7u_k$ = close$default; //endregion //region block: init debug = false; //endregion //region block: exports _.$_$ = _.$_$ || {}; _.$_$.a = TurbineTestContext; _.$_$.b = test; //endregion return _; })); //# sourceMappingURL=Turbine.js.map