(function (_, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_kotlin) { 'use strict'; //region block: imports var SupervisorJob = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.x2; var Dispatchers_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d1; var protoOf = kotlin_kotlin.$_$.bg; var cancel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a3; var AutoCloseable = kotlin_kotlin.$_$.rl; var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n2; var classMeta = kotlin_kotlin.$_$.me; var setMetadataFor = kotlin_kotlin.$_$.cg; var VOID = kotlin_kotlin.$_$.g; var objectCreate = kotlin_kotlin.$_$.zf; var addAll = kotlin_kotlin.$_$.n7; var isInterface = kotlin_kotlin.$_$.lf; var Unit_getInstance = kotlin_kotlin.$_$.i6; var THROW_CCE = kotlin_kotlin.$_$.nm; var HashMap_init_$Create$ = kotlin_kotlin.$_$.t; var LinkedHashSet_init_$Create$ = kotlin_kotlin.$_$.d1; //endregion //region block: pre-declaration setMetadataFor(CloseableCoroutineScope, 'CloseableCoroutineScope', classMeta, VOID, [AutoCloseable, CoroutineScope]); setMetadataFor(ViewModel, 'ViewModel', classMeta, VOID, [AutoCloseable]); //endregion function get_viewModelScope(_this__u8e3s4) { var scope = _this__u8e3s4.getTag_p4pgse_k$('moe.tlaster.precompose.viewmodel.ViewModelCoroutineScope.JOB_KEY'); if (!(scope == null)) { return scope; } return _this__u8e3s4.setTagIfAbsent_6z92bd_k$('moe.tlaster.precompose.viewmodel.ViewModelCoroutineScope.JOB_KEY', new CloseableCoroutineScope(SupervisorJob().plus_s13ygv_k$(Dispatchers_getInstance().get_Main_wo5vz6_k$().get_immediate_r3y8eg_k$()))); } function get_JOB_KEY() { return JOB_KEY; } var JOB_KEY; function CloseableCoroutineScope(context) { this.coroutineContext_1 = context; } protoOf(CloseableCoroutineScope).get_coroutineContext_115oqo_k$ = function () { return this.coroutineContext_1; }; protoOf(CloseableCoroutineScope).close_yn9xrc_k$ = function () { cancel(this.coroutineContext_1); }; function _set_disposed__tklm7i($this, _set____db54di) { $this.disposed_1 = _set____db54di; } function _get_disposed__snm4au($this) { return $this.disposed_1; } function _get_bagOfTags__evduvt($this) { return $this.bagOfTags_1; } function _get_closeables__lzfg6u($this) { return $this.closeables_1; } function ViewModel_init_$Init$($this) { ViewModel.call($this); return $this; } function ViewModel_init_$Create$() { return ViewModel_init_$Init$(objectCreate(protoOf(ViewModel))); } function ViewModel_init_$Init$_0(closeables, $this) { ViewModel.call($this); addAll($this.closeables_1, closeables); return $this; } function ViewModel_init_$Create$_0(closeables) { return ViewModel_init_$Init$_0(closeables, objectCreate(protoOf(ViewModel))); } function disposeWithRuntimeException($this, obj) { if (isInterface(obj, AutoCloseable)) { obj.close_yn9xrc_k$(); } } function get_$stableprop() { return 8; } protoOf(ViewModel).addCloseable_68h1o0_k$ = function (closeable) { this.closeables_1.add_utx5q5_k$(closeable); }; protoOf(ViewModel).onCleared_hwiuwz_k$ = function () { }; protoOf(ViewModel).clear_j9egeb_k$ = function () { this.disposed_1 = true; // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call var tmp0_iterator = this.bagOfTags_1.get_values_ksazhn_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var value = tmp0_iterator.next_20eer_k$(); disposeWithRuntimeException(this, value); } this.bagOfTags_1.clear_j9egeb_k$(); // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call var tmp0_iterator_0 = this.closeables_1.iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var value_0 = tmp0_iterator_0.next_20eer_k$(); disposeWithRuntimeException(this, value_0); } this.closeables_1.clear_j9egeb_k$(); this.onCleared_hwiuwz_k$(); }; protoOf(ViewModel).setTagIfAbsent_6z92bd_k$ = function (key, newValue) { // Inline function 'kotlin.also' call // Inline function 'kotlin.collections.getOrPut' call var this_0 = this.bagOfTags_1; var value = this_0.get_wei43m_k$(key); var tmp; if (value == null) { // Inline function 'moe.tlaster.precompose.viewmodel.ViewModel.setTagIfAbsent.' call var answer = !(newValue == null) ? newValue : THROW_CCE(); this_0.put_4fpzoq_k$(key, answer); tmp = answer; } else { tmp = value; } var this_1 = tmp; // Inline function 'kotlin.contracts.contract' call // Inline function 'moe.tlaster.precompose.viewmodel.ViewModel.setTagIfAbsent.' call if (this.disposed_1) { disposeWithRuntimeException(this, this_1); } var tmp_0 = this_1; return !(tmp_0 == null) ? tmp_0 : THROW_CCE(); }; protoOf(ViewModel).getTag_p4pgse_k$ = function (key) { var tmp = this.bagOfTags_1.get_wei43m_k$(key); return (tmp == null ? true : !(tmp == null)) ? tmp : THROW_CCE(); }; protoOf(ViewModel).close_yn9xrc_k$ = function () { this.clear_j9egeb_k$(); }; function ViewModel() { this.disposed_1 = false; var tmp = this; // Inline function 'kotlin.collections.hashMapOf' call tmp.bagOfTags_1 = HashMap_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.linkedSetOf' call tmp_0.closeables_1 = LinkedHashSet_init_$Create$(); this.$stable_1 = 8; } //region block: init JOB_KEY = 'moe.tlaster.precompose.viewmodel.ViewModelCoroutineScope.JOB_KEY'; //endregion //region block: exports _.$_$ = _.$_$ || {}; _.$_$.a = ViewModel_init_$Init$; _.$_$.b = ViewModel; _.$_$.c = get_viewModelScope; //endregion return _; }(module.exports, require('./kotlinx-coroutines-core.js'), require('./kotlin-kotlin-stdlib.js'))); //# sourceMappingURL=precompose-precompose-viewmodel.js.map