(function (_, kotlin_kotlin, kotlin_io_github_aakira_napier, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_org_jetbrains_kotlinx_atomicfu, kotlin_app_cash_paging_paging_common, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core, kotlin_io_ktor_ktor_http, kotlin_io_ktor_ktor_utils, kotlin_io_ktor_ktor_client_core, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json, kotlin_io_ktor_ktor_io) { 'use strict'; //region block: imports var imul = Math.imul; var protoOf = kotlin_kotlin.$_$.cg; var interfaceMeta = kotlin_kotlin.$_$.df; var setMetadataFor = kotlin_kotlin.$_$.dg; var Exception = kotlin_kotlin.$_$.em; var Unit_getInstance = kotlin_kotlin.$_$.i6; var classMeta = kotlin_kotlin.$_$.ne; var VOID = kotlin_kotlin.$_$.g; var THROW_CCE = kotlin_kotlin.$_$.qm; var isInterface = kotlin_kotlin.$_$.mf; var Long = kotlin_kotlin.$_$.im; var CoroutineImpl = kotlin_kotlin.$_$.td; var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ed; var ArrayList_init_$Create$ = kotlin_kotlin.$_$.q; var toList = kotlin_kotlin.$_$.oc; var SuspendFunction1 = kotlin_kotlin.$_$.vd; var indexOf = kotlin_kotlin.$_$.bj; var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.m1; var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.o3; var objectMeta = kotlin_kotlin.$_$.bg; var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.a1; var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.m2; var getKClass = kotlin_kotlin.$_$.e; var to = kotlin_kotlin.$_$.io; var PrimitiveClasses_getInstance = kotlin_kotlin.$_$.x5; var mapOf = kotlin_kotlin.$_$.wa; var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.g2; var getKClassFromExpression = kotlin_kotlin.$_$.d; var Map = kotlin_kotlin.$_$.d7; var NotImplementedError = kotlin_kotlin.$_$.km; var arrayIterator = kotlin_kotlin.$_$.fe; var List = kotlin_kotlin.$_$.b7; var isArray = kotlin_kotlin.$_$.ef; var first = kotlin_kotlin.$_$.t9; var first_0 = kotlin_kotlin.$_$.r9; var copyToArray = kotlin_kotlin.$_$.b9; var Napier_getInstance = kotlin_io_github_aakira_napier.$_$.g; var CancellationException = kotlin_kotlin.$_$.dd; var asList = kotlin_kotlin.$_$.r7; var Collection = kotlin_kotlin.$_$.r6; var isByteArray = kotlin_kotlin.$_$.gf; var isShortArray = kotlin_kotlin.$_$.of; var isIntArray = kotlin_kotlin.$_$.lf; var isLongArray = kotlin_kotlin.$_$.nf; var isFloatArray = kotlin_kotlin.$_$.kf; var isDoubleArray = kotlin_kotlin.$_$.jf; var fillArrayVal = kotlin_kotlin.$_$.te; var callbackFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.s1; var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n2; var ProducerScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j1; var BufferOverflow_DROP_OLDEST_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a; var Channel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i1; var launch = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g3; var awaitClose = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c; var joinToString = kotlin_kotlin.$_$.ea; var atomic$boolean$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.c; var LoadResult = kotlin_app_cash_paging_paging_common.$_$.h; var PagingSource = kotlin_app_cash_paging_paging_common.$_$.i; var atomic$int$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.f; var Dispatchers_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e1; var withContext = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r; var SuspendFunction2 = kotlin_kotlin.$_$.wd; var removeAll = kotlin_kotlin.$_$.nb; var listOf = kotlin_kotlin.$_$.sa; var collectionSizeOrDefault = kotlin_kotlin.$_$.b8; var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.p; var checkIndexOverflow = kotlin_kotlin.$_$.z7; var listOf_0 = kotlin_kotlin.$_$.ta; var plus = kotlin_kotlin.$_$.jb; var flatten = kotlin_kotlin.$_$.u9; var toList_0 = kotlin_kotlin.$_$.pc; var get = kotlin_kotlin.$_$.od; var fold = kotlin_kotlin.$_$.nd; var minusKey = kotlin_kotlin.$_$.pd; var plus_0 = kotlin_kotlin.$_$.sd; var Element = kotlin_kotlin.$_$.qd; var Key = kotlin_kotlin.$_$.rd; var toSet = kotlin_kotlin.$_$.vc; var toLong = kotlin_kotlin.$_$.fg; var withTimeout = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.t; var NonCancellable_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h1; var Mutex = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f2; var Job = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r2; var CoroutineScope_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m2; var cancel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b3; var toMap = kotlin_kotlin.$_$.rc; var IntCompanionObject_getInstance = kotlin_kotlin.$_$.t5; var numberToLong = kotlin_kotlin.$_$.zf; var delay = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.p; var atomic$long$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d; var numberToInt = kotlin_kotlin.$_$.yf; var LazyThreadSafetyMode_NONE_getInstance = kotlin_kotlin.$_$.l; var lazy = kotlin_kotlin.$_$.sn; var ensureNotNull = kotlin_kotlin.$_$.ln; var KProperty1 = kotlin_kotlin.$_$.mh; var getPropertyCallableRef = kotlin_kotlin.$_$.ze; var RuntimeException = kotlin_kotlin.$_$.pm; var RuntimeException_init_$Init$ = kotlin_kotlin.$_$.b3; var captureStack = kotlin_kotlin.$_$.he; var getStringHashCode = kotlin_kotlin.$_$.af; var getBooleanHashCode = kotlin_kotlin.$_$.ve; var println = kotlin_kotlin.$_$.de; var cancel_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z2; var PluginGeneratedSerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.z2; var LongSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.w; var UnknownFieldException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.g; var typeParametersSerializers = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t2; var GeneratedSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.u2; var throwMissingFieldException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.e3; var objectCreate = kotlin_kotlin.$_$.ag; var emptyList = kotlin_kotlin.$_$.f9; var Annotation = kotlin_kotlin.$_$.sl; var THROW_IAE = kotlin_kotlin.$_$.rm; var enumEntries = kotlin_kotlin.$_$.be; var Enum = kotlin_kotlin.$_$.cm; var contentEquals = kotlin_kotlin.$_$.h8; var hashCode = kotlin_kotlin.$_$.bf; var toString = kotlin_kotlin.$_$.hg; var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.t2; var Application_getInstance = kotlin_io_ktor_ktor_http.$_$.c; var TextContent = kotlin_io_ktor_ktor_http.$_$.u; var JsType_getInstance = kotlin_io_ktor_ktor_utils.$_$.b; var arrayOf = kotlin_kotlin.$_$.fn; var createKType = kotlin_kotlin.$_$.b; var typeInfoImpl = kotlin_io_ktor_ktor_utils.$_$.k; var OutgoingContent = kotlin_io_ktor_ktor_http.$_$.t; var NullBody_getInstance = kotlin_io_ktor_ktor_http.$_$.b; var header = kotlin_io_ktor_ktor_client_core.$_$.m; var parameter = kotlin_io_ktor_ktor_client_core.$_$.n; var Refresh = kotlin_app_cash_paging_paging_common.$_$.c; var Prepend = kotlin_app_cash_paging_paging_common.$_$.b; var Append = kotlin_app_cash_paging_paging_common.$_$.a; var takeFrom = kotlin_io_ktor_ktor_http.$_$.r1; var get_encodedPath = kotlin_io_ktor_ktor_http.$_$.k1; var set_encodedPath = kotlin_io_ktor_ktor_http.$_$.l1; var equals = kotlin_kotlin.$_$.re; var get_jsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.x; var JsonNull = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.k; var get_boolean = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.r; var get_double = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.s; var get_float = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.t; var get_long = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.y; var get_int = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.u; var toShort = kotlin_kotlin.$_$.gg; var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.n; var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.o; var JsonNull_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.d; var mapCapacity = kotlin_kotlin.$_$.ua; var coerceAtLeast = kotlin_kotlin.$_$.ug; var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.z; var JsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.l; var JsonPrimitive_1 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.m; var Regex_init_$Create$ = kotlin_kotlin.$_$.k1; var KProperty0 = kotlin_kotlin.$_$.lh; var RegexOption_IGNORE_CASE_getInstance = kotlin_kotlin.$_$.h; var Regex_init_$Create$_0 = kotlin_kotlin.$_$.l1; var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l1; var MutableStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o1; var onStart = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1; var NullPointerException_init_$Create$ = kotlin_kotlin.$_$.v2; var LogLevel_VERBOSE_getInstance = kotlin_io_github_aakira_napier.$_$.e; var LogLevel_DEBUG_getInstance = kotlin_io_github_aakira_napier.$_$.b; var LogLevel_INFO_getInstance = kotlin_io_github_aakira_napier.$_$.d; var LogLevel_WARNING_getInstance = kotlin_io_github_aakira_napier.$_$.f; var LogLevel_ERROR_getInstance = kotlin_io_github_aakira_napier.$_$.c; var LogLevel_ASSERT_getInstance = kotlin_io_github_aakira_napier.$_$.a; var noWhenBranchMatchedException = kotlin_kotlin.$_$.un; var ArrayListSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.r2; var IntSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.v; var MutableSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n1; var asSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q1; var toLong_0 = kotlin_kotlin.$_$.bl; var Comparator = kotlin_kotlin.$_$.zl; var compareValues = kotlin_kotlin.$_$.ad; var plus_1 = kotlin_kotlin.$_$.kb; var minus = kotlin_kotlin.$_$.xa; var asStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r1; var sortedWith = kotlin_kotlin.$_$.ec; var Page = kotlin_app_cash_paging_paging_common.$_$.g; var Invalid = kotlin_app_cash_paging_paging_common.$_$.f; var toBoolean = kotlin_kotlin.$_$.rk; var abs = kotlin_kotlin.$_$.kg; var until = kotlin_kotlin.$_$.hh; var firstOrNull = kotlin_kotlin.$_$.n9; var get_request = kotlin_io_ktor_ktor_client_core.$_$.s; var Companion_getInstance = kotlin_io_ktor_ktor_http.$_$.m; var bodyAsText = kotlin_io_ktor_ktor_client_core.$_$.a; var JsonObjectSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.f; var toString_0 = kotlin_kotlin.$_$.ho; var get_isActive = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e3; var HttpRequestBuilder = kotlin_io_ktor_ktor_client_core.$_$.k; var Companion_getInstance_0 = kotlin_io_ktor_ktor_http.$_$.k; var HttpStatement = kotlin_io_ktor_ktor_client_core.$_$.r; var contentType = kotlin_io_ktor_ktor_http.$_$.i1; var Default_getInstance = kotlin_kotlin.$_$.w5; var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h2; var numberRangeToNumber = kotlin_kotlin.$_$.uf; var trimIndent = kotlin_kotlin.$_$.kl; var Flow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m1; var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.e; var charArrayOf = kotlin_kotlin.$_$.ie; var split = kotlin_kotlin.$_$.ak; var joinToString_0 = kotlin_kotlin.$_$.fa; var ChannelResult__getOrThrow_impl_od1axs = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y; var _ChannelResult___get_isSuccess__impl__odq1z9 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z; var Factory_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a1; var GlobalScope_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f1; var startsWith = kotlin_kotlin.$_$.ck; var substringAfter = kotlin_kotlin.$_$.hk; var get_js = kotlin_kotlin.$_$.qf; var compareTo = kotlin_kotlin.$_$.oe; var addAll = kotlin_kotlin.$_$.n7; var substringAfterLast = kotlin_kotlin.$_$.fk; var Json = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.p; var plus_2 = kotlin_kotlin.$_$.eb; var putAll = kotlin_kotlin.$_$.lb; var Exception_init_$Init$ = kotlin_kotlin.$_$.a2; var newThrowable = kotlin_kotlin.$_$.tf; var Exception_init_$Create$ = kotlin_kotlin.$_$.z1; var Companion_getInstance_1 = kotlin_kotlin.$_$.z5; var json = kotlin_kotlin.$_$.rf; var toInt = kotlin_kotlin.$_$.yk; var SuspendFunction0 = kotlin_kotlin.$_$.ud; var ClosedRange = kotlin_kotlin.$_$.rg; var contains = kotlin_kotlin.$_$.ch; var indexOf_0 = kotlin_kotlin.$_$.y9; var toByte = kotlin_kotlin.$_$.sk; var toShort_0 = kotlin_kotlin.$_$.cl; var toDouble = kotlin_kotlin.$_$.vk; var Charsets_getInstance = kotlin_io_ktor_ktor_io.$_$.g; var encodeToByteArray = kotlin_kotlin.$_$.si; var encodeToByteArray_0 = kotlin_io_ktor_ktor_io.$_$.k; //endregion //region block: pre-declaration setMetadataFor(DoorQuery, 'DoorQuery', interfaceMeta); setMetadataFor(DoorSqlDatabase, 'DoorSqlDatabase', interfaceMeta); setMetadataFor(DoorSqlDatabaseConnectionImpl, 'DoorSqlDatabaseConnectionImpl', classMeta, VOID, [DoorSqlDatabase]); setMetadataFor(EntityInsertionAdapter$insertAsync$slambda, 'EntityInsertionAdapter$insertAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter$insertAndReturnIdAsync$slambda, 'EntityInsertionAdapter$insertAndReturnIdAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda, 'EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter$insertListAsync$slambda, 'EntityInsertionAdapter$insertListAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($insertListAndReturnIdsAsyncCOROUTINE$0, '$insertListAndReturnIdsAsyncCOROUTINE$0', classMeta, CoroutineImpl); setMetadataFor(EntityInsertionAdapter, 'EntityInsertionAdapter', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(Companion, 'Companion', objectMeta); setMetadataFor(Statement, 'Statement', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(PreparedStatement, 'PreparedStatement', interfaceMeta, VOID, [Statement], VOID, VOID, VOID, [0, 1]); setMetadataFor(PreparedStatementArrayProxyCommon, 'PreparedStatementArrayProxyCommon', classMeta, VOID, [PreparedStatement], VOID, VOID, VOID, [0, 1]); setMetadataFor(ResultSet, 'ResultSet', interfaceMeta); setMetadataFor(PreparedStatementResultSetWrapper, 'PreparedStatementResultSetWrapper', classMeta, VOID, [ResultSet]); setMetadataFor(Companion_0, 'Companion', objectMeta); setMetadataFor(SimpleDoorQuery, 'SimpleDoorQuery', classMeta, VOID, [DoorQuery]); setMetadataFor(prepareAndUseStatementAsync$slambda, 'prepareAndUseStatementAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($prepareAndUseStatementAsyncCOROUTINE$1, '$prepareAndUseStatementAsyncCOROUTINE$1', classMeta, CoroutineImpl); setMetadataFor(InvalidationTrackerObserver, 'InvalidationTrackerObserver', classMeta); setMetadataFor(doorFlow$1$invalidationTrackerObserver$1, VOID, classMeta, InvalidationTrackerObserver); setMetadataFor(doorFlow$slambda$slambda, 'doorFlow$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(doorFlow$slambda, 'doorFlow$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($onBeforeTransactionAsyncCOROUTINE$2, '$onBeforeTransactionAsyncCOROUTINE$2', classMeta, CoroutineImpl); setMetadataFor($onAfterTransactionAsyncCOROUTINE$3, '$onAfterTransactionAsyncCOROUTINE$3', classMeta, CoroutineImpl); setMetadataFor($onTransactionCommittedAsyncCOROUTINE$4, '$onTransactionCommittedAsyncCOROUTINE$4', classMeta, CoroutineImpl); setMetadataFor(Listener, 'Listener', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [3]); setMetadataFor(NodeEventJdbcImplListenerSqlite, 'NodeEventJdbcImplListenerSqlite', classMeta, VOID, [Listener], VOID, VOID, VOID, [3]); setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [2]); setMetadataFor(InvalidationTracker, 'InvalidationTracker', classMeta, InvalidationTrackerObserver); setMetadataFor(DoorLimitOffsetPagingSource$load$slambda, 'DoorLimitOffsetPagingSource$load$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorLimitOffsetPagingSource$nonInitialLoad$slambda, 'DoorLimitOffsetPagingSource$nonInitialLoad$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [2]); setMetadataFor($nonInitialLoadCOROUTINE$5, '$nonInitialLoadCOROUTINE$5', classMeta, CoroutineImpl); setMetadataFor(DoorLimitOffsetPagingSource, 'DoorLimitOffsetPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [2, 0, 1]); setMetadataFor(Companion_1, 'Companion', objectMeta); setMetadataFor($setupSqliteTriggersAsyncCOROUTINE$6, '$setupSqliteTriggersAsyncCOROUTINE$6', classMeta, CoroutineImpl); setMetadataFor($findChangedTablesOnConnectionAsyncCOROUTINE$7, '$findChangedTablesOnConnectionAsyncCOROUTINE$7', classMeta, CoroutineImpl); setMetadataFor(InvalidationTracker_0, 'InvalidationTracker', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(TransactionElement, 'TransactionElement', classMeta, VOID, [Element]); setMetadataFor(Key_0, 'Key', objectMeta, VOID, [Key]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($useNewConnectionAsyncInternalCOROUTINE$8, '$useNewConnectionAsyncInternalCOROUTINE$8', classMeta, CoroutineImpl); setMetadataFor(RoomDatabaseJdbcImplHelperCommon, 'RoomDatabaseJdbcImplHelperCommon', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 2, 1]); setMetadataFor(RoomJdbcImpl, 'RoomJdbcImpl', interfaceMeta); setMetadataFor($dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9, '$dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9', classMeta, CoroutineImpl); setMetadataFor($getSqliteDoorTriggerNamesCOROUTINE$10, '$getSqliteDoorTriggerNamesCOROUTINE$10', classMeta, CoroutineImpl); setMetadataFor($getSqliteDoorReceiveViewNamesCOROUTINE$11, '$getSqliteDoorReceiveViewNamesCOROUTINE$11', classMeta, CoroutineImpl); setMetadataFor(DoorConstants, 'DoorConstants', objectMeta); setMetadataFor(DoorDatabaseCallback, 'DoorDatabaseCallback', interfaceMeta); setMetadataFor(DoorDatabaseCallbackStatementList, 'DoorDatabaseCallbackStatementList', interfaceMeta, VOID, [DoorDatabaseCallback]); setMetadataFor(DoorDatabaseCallbackSync, 'DoorDatabaseCallbackSync', interfaceMeta, VOID, [DoorDatabaseCallback]); setMetadataFor(DoorDatabaseJdbc, 'DoorDatabaseJdbc', interfaceMeta); setMetadataFor(DoorDatabaseRepository, 'DoorDatabaseRepository', interfaceMeta); setMetadataFor(Companion_2, 'Companion', objectMeta); setMetadataFor(DoorDatabaseWrapper, 'DoorDatabaseWrapper', interfaceMeta); setMetadataFor(Companion_3, 'Companion', objectMeta); setMetadataFor(DoorDbType, 'DoorDbType', classMeta, VOID, VOID, DoorDbType); setMetadataFor($nextIdAsyncCOROUTINE$12, '$nextIdAsyncCOROUTINE$12', classMeta, CoroutineImpl); setMetadataFor(TablePrimaryKeyManager, 'TablePrimaryKeyManager', classMeta, VOID, VOID, VOID, VOID, VOID, [0]); setMetadataFor(Companion_4, 'Companion', objectMeta); setMetadataFor(DoorPrimaryKeyManager, 'DoorPrimaryKeyManager', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(Array_0, 'Array', interfaceMeta); setMetadataFor(JdbcArrayProxyCommon, 'JdbcArrayProxyCommon', classMeta, VOID, [Array_0]); setMetadataFor(NotSupportedException, 'NotSupportedException', classMeta, RuntimeException, VOID, NotSupportedException); setMetadataFor(Companion_5, 'Companion', objectMeta); setMetadataFor(PreparedStatementConfig, 'PreparedStatementConfig', classMeta); setMetadataFor(RepositoryConnectivityListener, 'RepositoryConnectivityListener', interfaceMeta); setMetadataFor(RepositoryHelper, 'RepositoryHelper', classMeta); setMetadataFor(Companion_6, 'Companion', objectMeta); setMetadataFor($serializer, '$serializer', objectMeta, VOID, [GeneratedSerializer]); setMetadataFor(SyncNode, 'SyncNode', classMeta, VOID, VOID, SyncNode, VOID, {0: $serializer_getInstance}); setMetadataFor(SyncNodeIdCallback, 'SyncNodeIdCallback', classMeta, VOID, [DoorDatabaseCallbackStatementList]); setMetadataFor(AttachmentMd5, 'AttachmentMd5', classMeta, VOID, [Annotation]); setMetadataFor(AttachmentSize, 'AttachmentSize', classMeta, VOID, [Annotation]); setMetadataFor(AttachmentUri, 'AttachmentUri', classMeta, VOID, [Annotation]); setMetadataFor(EntityWithAttachment, 'EntityWithAttachment', classMeta, VOID, [Annotation]); setMetadataFor(LastChangedBy, 'LastChangedBy', classMeta, VOID, [Annotation]); setMetadataFor(LocalChangeSeqNum, 'LocalChangeSeqNum', classMeta, VOID, [Annotation]); setMetadataFor(MasterChangeSeqNum, 'MasterChangeSeqNum', classMeta, VOID, [Annotation]); setMetadataFor(RemoteInsertStrategy, 'RemoteInsertStrategy', classMeta, Enum); setMetadataFor(ReplicateEntity, 'ReplicateEntity', classMeta, VOID, [Annotation]); setMetadataFor(ReplicateEtag, 'ReplicateEtag', classMeta, VOID, [Annotation]); setMetadataFor(ReplicateLastModified, 'ReplicateLastModified', classMeta, VOID, [Annotation]); setMetadataFor(Event, 'Event', classMeta, Enum); setMetadataFor(Order, 'Order', classMeta, Enum); setMetadataFor(On, 'On', classMeta, Enum); setMetadataFor(Companion_7, 'Companion', objectMeta); setMetadataFor(Trigger, 'Trigger', classMeta, VOID, [Annotation]); setMetadataFor(Triggers, 'Triggers', classMeta, VOID, [Annotation]); setMetadataFor(Companion_8, 'Companion', objectMeta); setMetadataFor(DoorNode, 'DoorNode', classMeta, VOID, VOID, DoorNode); setMetadataFor(NodeIdAndAuth, 'NodeIdAndAuth', classMeta); setMetadataFor(OutgoingReplication, 'OutgoingReplication', classMeta, VOID, VOID, OutgoingReplication); setMetadataFor(Companion_9, 'Companion', objectMeta); setMetadataFor(DoorDatabaseMetadata, 'DoorDatabaseMetadata', classMeta); setMetadataFor(Companion_10, 'Companion', objectMeta); setMetadataFor(DoorTag, 'DoorTag', classMeta, VOID, VOID, DoorTag); setMetadataFor(Companion_11, 'Companion', objectMeta); setMetadataFor(LoadParamType, 'LoadParamType', classMeta, Enum); setMetadataFor(Status, 'Status', classMeta, Enum); setMetadataFor(FlowLoadingState, 'FlowLoadingState', classMeta, VOID, VOID, FlowLoadingState); setMetadataFor(RepoDaoFlowHelper$asRepoFlow$slambda$slambda, 'RepoDaoFlowHelper$asRepoFlow$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RepoDaoFlowHelper$asRepoFlow$slambda, 'RepoDaoFlowHelper$asRepoFlow$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(RepoDaoFlowHelper, 'RepoDaoFlowHelper', classMeta); setMetadataFor(RepositoryDaoWithFlowHelper, 'RepositoryDaoWithFlowHelper', interfaceMeta); setMetadataFor(ConnectionAsync, 'ConnectionAsync', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1, 0]); setMetadataFor(StatementConstantsKmp, 'StatementConstantsKmp', objectMeta); setMetadataFor(TypesKmp, 'TypesKmp', objectMeta); setMetadataFor($useStatementAsyncCOROUTINE$13, '$useStatementAsyncCOROUTINE$13', classMeta, CoroutineImpl); setMetadataFor(DoorLogLevel, 'DoorLogLevel', classMeta, Enum); function log$default(level, message, throwable, $super) { throwable = throwable === VOID ? null : throwable; var tmp; if ($super === VOID) { this.log_kks8iu_k$(level, message, throwable); tmp = Unit_getInstance(); } else { tmp = $super.log_kks8iu_k$.call(this, level, message, throwable); } return tmp; } function log$default_0(level, throwable, message, $super) { throwable = throwable === VOID ? null : throwable; var tmp; if ($super === VOID) { this.log_vpti5k_k$(level, throwable, message); tmp = Unit_getInstance(); } else { tmp = $super.log_vpti5k_k$.call(this, level, throwable, message); } return tmp; } setMetadataFor(DoorLogger, 'DoorLogger', interfaceMeta); setMetadataFor(NapierDoorLogger, 'NapierDoorLogger', classMeta, VOID, [DoorLogger], NapierDoorLogger); setMetadataFor(DoorMessageCallback, 'DoorMessageCallback', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(DefaultDoorMessageCallback, 'DefaultDoorMessageCallback', classMeta, VOID, [DoorMessageCallback], DefaultDoorMessageCallback, VOID, VOID, [2]); setMetadataFor(Companion_12, 'Companion', objectMeta); setMetadataFor($serializer_0, '$serializer', objectMeta, VOID, [GeneratedSerializer]); setMetadataFor(DoorMessage, 'DoorMessage', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_0}); setMetadataFor(DoorMigration, 'DoorMigration', classMeta); setMetadataFor(DoorMigrationAsync, 'DoorMigrationAsync', classMeta, DoorMigration); setMetadataFor(DoorMigrationStatementList, 'DoorMigrationStatementList', classMeta, DoorMigration); setMetadataFor(DoorMigrationSync, 'DoorMigrationSync', classMeta, DoorMigration); setMetadataFor(NodeEvent, 'NodeEvent', classMeta); setMetadataFor($createNodeEventTableAndTriggerCOROUTINE$14, '$createNodeEventTableAndTriggerCOROUTINE$14', classMeta, CoroutineImpl); setMetadataFor(NodeEventConstants, 'NodeEventConstants', objectMeta); setMetadataFor(NodeEventManager, 'NodeEventManager', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(NodeEventManagerCommon$onIncomingMessageReceived$slambda, 'NodeEventManagerCommon$onIncomingMessageReceived$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($onIncomingMessageReceivedCOROUTINE$15, '$onIncomingMessageReceivedCOROUTINE$15', classMeta, CoroutineImpl); setMetadataFor(NodeEventManagerCommon, 'NodeEventManagerCommon', classMeta, VOID, [NodeEventManager], VOID, VOID, VOID, [1]); setMetadataFor(NodeEventSseClient$onMessage$slambda, 'NodeEventSseClient$onMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorEventListener, 'DoorEventListener', interfaceMeta); setMetadataFor(NodeEventSseClient, 'NodeEventSseClient', classMeta, VOID, [DoorEventListener]); setMetadataFor(DelegatedInvalidationPagingSource, 'DelegatedInvalidationPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [1]); setMetadataFor(OnRemoteLoad, 'OnRemoteLoad', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(OffsetLimitRange, 'OffsetLimitRange', classMeta); setMetadataFor(OffsetLimitMediatorState, 'OffsetLimitMediatorState', classMeta, VOID, VOID, OffsetLimitMediatorState); setMetadataFor(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', classMeta, VOID, [Comparator]); setMetadataFor(DoorOffsetLimitRemoteMediator$onLoad$slambda, 'DoorOffsetLimitRemoteMediator$onLoad$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorOffsetLimitRemoteMediator, 'DoorOffsetLimitRemoteMediator', classMeta); setMetadataFor($queryDatabaseCOROUTINE$16, '$queryDatabaseCOROUTINE$16', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryPagingSource, 'DoorRepositoryPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [1]); setMetadataFor(Companion_13, 'Companion', objectMeta); setMetadataFor(PagingSourceWithHttpLoader, 'PagingSourceWithHttpLoader', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicatePullPagingSource, 'DoorRepositoryReplicatePullPagingSource', classMeta, DoorRepositoryPagingSource, [DoorRepositoryPagingSource, PagingSourceWithHttpLoader], VOID, VOID, VOID, [1]); setMetadataFor(FilterPagingSource, 'FilterPagingSource', classMeta, DelegatedInvalidationPagingSource, VOID, VOID, VOID, VOID, [1]); setMetadataFor(PagingSourceInterceptor, 'PagingSourceInterceptor', classMeta, FilterPagingSource, VOID, VOID, VOID, VOID, [1]); setMetadataFor(PagingRequest, 'PagingRequest', classMeta); setMetadataFor(PagingSourceLoadState, 'PagingSourceLoadState', classMeta, VOID, VOID, PagingSourceLoadState); setMetadataFor(ReplicateEntityPrimaryKeys, 'ReplicateEntityPrimaryKeys', classMeta); setMetadataFor(acknowledgeReceivedReplications$slambda, 'acknowledgeReceivedReplications$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(selectPendingOutgoingReplicationsByDestNodeId$slambda, 'selectPendingOutgoingReplicationsByDestNodeId$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda_1, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda_3, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(getDoorNodeAuth$slambda, 'getDoorNodeAuth$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(insertNewDoorNode$slambda, 'insertNewDoorNode$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda, 'selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_1, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_3, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_5, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda, 'withRepoChangeMonitorAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17, '$selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17', classMeta, CoroutineImpl); setMetadataFor($insertEntitiesFromMessageCOROUTINE$18, '$insertEntitiesFromMessageCOROUTINE$18', classMeta, CoroutineImpl); setMetadataFor($insertNewDoorNodeCOROUTINE$19, '$insertNewDoorNodeCOROUTINE$19', classMeta, CoroutineImpl); setMetadataFor($onClientRepoDoorMessageHttpResponseCOROUTINE$20, '$onClientRepoDoorMessageHttpResponseCOROUTINE$20', classMeta, CoroutineImpl); setMetadataFor(Companion_14, 'Companion', objectMeta); setMetadataFor($serializer_1, '$serializer', objectMeta, VOID, [GeneratedSerializer]); setMetadataFor(DoorReplicationEntity, 'DoorReplicationEntity', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_1}); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($invokeCOROUTINE$21, '$invokeCOROUTINE$21', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($invokeCOROUTINE$22, '$invokeCOROUTINE$22', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(ClientState, 'ClientState', classMeta, VOID, VOID, ClientState); setMetadataFor(OnMarkAcknowledgedAndGetNextOutgoingReplications, 'OnMarkAcknowledgedAndGetNextOutgoingReplications', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [3]); setMetadataFor(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications, 'DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications', classMeta, VOID, [OnMarkAcknowledgedAndGetNextOutgoingReplications], VOID, VOID, VOID, [3]); setMetadataFor(OnStartPendingSession, 'OnStartPendingSession', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(DefaultOnStartPendingSession, 'DefaultOnStartPendingSession', classMeta, VOID, [OnStartPendingSession], VOID, VOID, VOID, [2]); setMetadataFor(OnPendingSessionResolved, 'OnPendingSessionResolved', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(DefaultOnPendingSessionResolved, 'DefaultOnPendingSessionResolved', classMeta, VOID, [OnPendingSessionResolved], VOID, VOID, VOID, [2]); setMetadataFor(Companion_15, 'Companion', objectMeta); setMetadataFor(sam$kotlinx_coroutines_flow_FlowCollector$0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', classMeta, VOID, [FlowCollector], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_1, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_3, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_5, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($runSendLoopCOROUTINE$23, '$runSendLoopCOROUTINE$23', classMeta, CoroutineImpl); setMetadataFor($runFetchLoopCOROUTINE$24, '$runFetchLoopCOROUTINE$24', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryReplicationClient, 'DoorRepositoryReplicationClient', classMeta, VOID, VOID, VOID, VOID, VOID, [0]); setMetadataFor(JsonDbFieldInfo, 'JsonDbFieldInfo', interfaceMeta); setMetadataFor(ReplicationConstants, 'ReplicationConstants', objectMeta); setMetadataFor(ReplicationEntityMetaData, 'ReplicationEntityMetaData', classMeta); setMetadataFor(ReplicationFieldMetaData, 'ReplicationFieldMetaData', classMeta, VOID, [JsonDbFieldInfo]); setMetadataFor(Companion_16, 'Companion', objectMeta); setMetadataFor($serializer_2, '$serializer', objectMeta, VOID, [GeneratedSerializer]); setMetadataFor(ReplicationReceivedAck, 'ReplicationReceivedAck', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_2}); setMetadataFor(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda, 'ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($collectCOROUTINE$25, '$collectCOROUTINE$25', classMeta, CoroutineImpl); setMetadataFor(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1, 'ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($collectCOROUTINE$26, '$collectCOROUTINE$26', classMeta, CoroutineImpl); setMetadataFor(_no_name_provided__qut3iv, VOID, classMeta, VOID, [Flow], VOID, VOID, VOID, [1]); setMetadataFor(_no_name_provided__qut3iv_0, VOID, classMeta, VOID, [Flow], VOID, VOID, VOID, [1]); setMetadataFor(ServerSentEventsReplicationClient$onMessage$slambda$slambda, 'ServerSentEventsReplicationClient$onMessage$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(Companion_17, 'Companion', objectMeta); setMetadataFor(sam$kotlinx_coroutines_flow_FlowCollector$0_0, 'sam$kotlinx_coroutines_flow_FlowCollector$0', classMeta, VOID, [FlowCollector], VOID, VOID, VOID, [1]); setMetadataFor(ServerSentEventsReplicationClient$onMessage$slambda, 'ServerSentEventsReplicationClient$onMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(ServerSentEventsReplicationClient$onMessage$slambda_1, 'ServerSentEventsReplicationClient$onMessage$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(ServerSentEventsReplicationClient, 'ServerSentEventsReplicationClient', classMeta, VOID, [DoorEventListener]); setMetadataFor(Companion_18, 'Companion', objectMeta); setMetadataFor(DoorServerSentEvent, 'DoorServerSentEvent', classMeta); setMetadataFor(TriggerConstants, 'TriggerConstants', objectMeta); setMetadataFor(DoorEventCollator$receiveEvent$slambda$slambda, 'DoorEventCollator$receiveEvent$slambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorEventCollator$receiveEvent$slambda, 'DoorEventCollator$receiveEvent$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(DoorEventCollator, 'DoorEventCollator', classMeta); setMetadataFor(IWeakMap, 'IWeakMap', interfaceMeta); setMetadataFor(IWeakRef, 'IWeakRef', interfaceMeta); setMetadataFor(OnNewDoorNode, 'OnNewDoorNode', interfaceMeta); setMetadataFor($verifyCOROUTINE$27, '$verifyCOROUTINE$27', classMeta, CoroutineImpl); setMetadataFor(NodeIdAuthCache, 'NodeIdAuthCache', classMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(TransactionMode, 'TransactionMode', classMeta, Enum); setMetadataFor(Companion_19, 'Companion', objectMeta); setMetadataFor($buildCOROUTINE$28, '$buildCOROUTINE$28', classMeta, CoroutineImpl); setMetadataFor($build$execSqlAsyncCOROUTINE$29, '$build$execSqlAsyncCOROUTINE$29', classMeta, CoroutineImpl); setMetadataFor(DatabaseBuilder, 'DatabaseBuilder', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]); setMetadataFor(DatabaseBuilderOptions, 'DatabaseBuilderOptions', classMeta); setMetadataFor(DoorUriProps, 'DoorUriProps', classMeta); setMetadataFor(Companion_20, 'Companion', objectMeta); setMetadataFor(DoorUri, 'DoorUri', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(JdbcArrayProxy, 'JdbcArrayProxy', classMeta, JdbcArrayProxyCommon); setMetadataFor(PreparedStatementArrayProxy, 'PreparedStatementArrayProxy', classMeta, PreparedStatementArrayProxyCommon, VOID, VOID, VOID, VOID, [0, 1]); setMetadataFor(Builder, 'Builder', classMeta); setMetadataFor(Companion_21, 'Companion', objectMeta); setMetadataFor(RepositoryConfig, 'RepositoryConfig', classMeta); setMetadataFor(SaveToIndexedDbChangeListener$eventCollator$slambda, 'SaveToIndexedDbChangeListener$eventCollator$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(SaveToIndexedDbChangeListener$1, VOID, classMeta, InvalidationTrackerObserver); setMetadataFor(SaveToIndexedDbChangeListener, 'SaveToIndexedDbChangeListener', classMeta); setMetadataFor(withDoorTransactionAsync$slambda, 'withDoorTransactionAsync$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor(Connection, 'Connection', interfaceMeta); setMetadataFor(DataSource, 'DataSource', interfaceMeta); setMetadataFor(DatabaseMetadata, 'DatabaseMetadata', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [4]); setMetadataFor(ResultSetMetaData, 'ResultSetMetaData', interfaceMeta); setMetadataFor(SQLException, 'SQLException', classMeta, Exception); setMetadataFor(NodeEventManagerJs, 'NodeEventManagerJs', classMeta, NodeEventManagerCommon, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabase$execSQLBatchAsyncJs$slambda, 'RoomDatabase$execSQLBatchAsyncJs$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($execSQLBatchAsyncJsCOROUTINE$30, '$execSQLBatchAsyncJsCOROUTINE$30', classMeta, CoroutineImpl); setMetadataFor(RoomDatabase, 'RoomDatabase', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]); setMetadataFor(RoomDatabaseJdbcImplHelper, 'RoomDatabaseJdbcImplHelper', classMeta, RoomDatabaseJdbcImplHelperCommon, VOID, VOID, VOID, VOID, [0, 2, 1]); setMetadataFor($storeBlobCOROUTINE$31, '$storeBlobCOROUTINE$31', classMeta, CoroutineImpl); setMetadataFor(IndexedDb, 'IndexedDb', objectMeta, VOID, VOID, VOID, VOID, VOID, [1, 4, 3]); setMetadataFor(Companion_22, 'Companion', objectMeta); setMetadataFor($setAutoCommitAsyncCOROUTINE$32, '$setAutoCommitAsyncCOROUTINE$32', classMeta, CoroutineImpl); setMetadataFor($commitAsyncCOROUTINE$33, '$commitAsyncCOROUTINE$33', classMeta, CoroutineImpl); setMetadataFor($rollbackAsyncCOROUTINE$34, '$rollbackAsyncCOROUTINE$34', classMeta, CoroutineImpl); setMetadataFor(SQLiteConnectionJs, 'SQLiteConnectionJs', classMeta, VOID, [Connection, ConnectionAsync], VOID, VOID, VOID, [1, 0]); setMetadataFor($getTablesAsyncCOROUTINE$35, '$getTablesAsyncCOROUTINE$35', classMeta, CoroutineImpl); setMetadataFor(SQLiteDatabaseMetadataJs, 'SQLiteDatabaseMetadataJs', classMeta, VOID, [DatabaseMetadata], VOID, VOID, VOID, [4]); setMetadataFor(Companion_23, 'Companion', objectMeta); setMetadataFor(SQLiteDatasourceJs$sendQuery$slambda, 'SQLiteDatasourceJs$sendQuery$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(SQLiteDatasourceJs$sendUpdate$slambda, 'SQLiteDatasourceJs$sendUpdate$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [0]); setMetadataFor(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda, 'SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda', classMeta, CoroutineImpl, [CoroutineImpl], VOID, VOID, VOID, [1]); setMetadataFor($sendMessageCOROUTINE$36, '$sendMessageCOROUTINE$36', classMeta, CoroutineImpl); setMetadataFor($withTransactionLockCOROUTINE$37, '$withTransactionLockCOROUTINE$37', classMeta, CoroutineImpl); setMetadataFor($exportDatabaseToFileCOROUTINE$38, '$exportDatabaseToFileCOROUTINE$38', classMeta, CoroutineImpl); setMetadataFor($saveDatabaseToIndexedDbCOROUTINE$39, '$saveDatabaseToIndexedDbCOROUTINE$39', classMeta, CoroutineImpl); setMetadataFor(SQLiteDatasourceJs, 'SQLiteDatasourceJs', classMeta, VOID, [DataSource], VOID, VOID, VOID, [1, 2, 3, 4, 0]); setMetadataFor($executeUpdateAsyncCOROUTINE$40, '$executeUpdateAsyncCOROUTINE$40', classMeta, CoroutineImpl); setMetadataFor(SQLiteStatementJs, 'SQLiteStatementJs', classMeta, VOID, [Statement], VOID, VOID, VOID, [1]); setMetadataFor(SQLitePreparedStatementJs, 'SQLitePreparedStatementJs', classMeta, SQLiteStatementJs, [SQLiteStatementJs, PreparedStatement], VOID, VOID, VOID, [0, 1]); setMetadataFor(MetaData, 'MetaData', classMeta, VOID, [ResultSetMetaData]); setMetadataFor(SQLiteResultSet, 'SQLiteResultSet', classMeta, VOID, [ResultSet]); setMetadataFor($executeUpdateAsyncJsCOROUTINE$41, '$executeUpdateAsyncJsCOROUTINE$41', classMeta, CoroutineImpl); setMetadataFor(UpdateResult, 'UpdateResult', classMeta); setMetadataFor(WorkerResult, 'WorkerResult', classMeta); setMetadataFor(DoorEventSource, 'DoorEventSource', classMeta); setMetadataFor(DoorJsImplClasses, 'DoorJsImplClasses', classMeta); setMetadataFor(KmpUuid, 'KmpUuid', classMeta); setMetadataFor(WeakMapJs, 'WeakMapJs', classMeta, VOID, [IWeakMap], WeakMapJs); setMetadataFor(WeakRefJs, 'WeakRefJs', classMeta, VOID, [IWeakRef]); //endregion function DoorQuery() { } function DoorSqlDatabase() { } function DoorSqlDatabaseConnectionImpl(connection, dbTypeInt) { this.connection_1 = connection; this.dbTypeInt_1 = dbTypeInt; } protoOf(DoorSqlDatabaseConnectionImpl).get_connection_x01z89_k$ = function () { return this.connection_1; }; protoOf(DoorSqlDatabaseConnectionImpl).get_dbTypeInt_k2nxu_k$ = function () { return this.dbTypeInt_1; }; protoOf(DoorSqlDatabaseConnectionImpl).execSQL_4zzrpp_k$ = function (sql) { $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = this.connection_1.createStatement_cbd7tf_k$(); try { // Inline function 'com.ustadmobile.door.DoorSqlDatabaseConnectionImpl.execSQL.' call this_0.executeUpdate_k6x04k_k$(sql); break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } } }; protoOf(DoorSqlDatabaseConnectionImpl).execSQLBatch_23yw79_k$ = function (statements) { $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = this.connection_1.createStatement_cbd7tf_k$(); try { this.connection_1.setAutoCommit_yh8u8d_k$(false); // Inline function 'kotlin.collections.forEach' call var inductionVariable = 0; var last = statements.length; while (inductionVariable < last) { var element = statements[inductionVariable]; inductionVariable = inductionVariable + 1 | 0; // Inline function 'com.ustadmobile.door.DoorSqlDatabaseConnectionImpl.execSQLBatch..' call this_0.executeUpdate_k6x04k_k$(element); } this.connection_1.commit_vpt10n_k$(); break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } } }; function getGeneratedKey($this, stmt) { var generatedKeyRs = (null == null ? true : isInterface(null, ResultSet)) ? null : THROW_CCE(); var generatedKey = new Long(0, 0); try { generatedKeyRs = stmt.getGeneratedKeys_aewui5_k$(); if (generatedKeyRs.next_20eer_k$()) generatedKey = generatedKeyRs.getLong_rneply_k$(1); }finally { var tmp0_safe_receiver = generatedKeyRs; if (tmp0_safe_receiver == null) null; else { tmp0_safe_receiver.close_yn9xrc_k$(); } } return generatedKey; } function EntityInsertionAdapter$insert$lambda(this$0, $entity) { return function (stmt) { this$0.bindPreparedStmtToEntity_ne2rsb_k$(stmt, $entity); return stmt.executeUpdate_fapcbi_k$(); }; } function EntityInsertionAdapter$insertAsync$slambda(this$0, $entity, resultContinuation) { this.this$0__1 = this$0; this.$entity_1 = $entity; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertAsync$slambda).invoke_e5ovyj_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(EntityInsertionAdapter$insertAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e5ovyj_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertAsync$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.this$0__1.bindPreparedStmtToEntity_ne2rsb_k$(this.stmt_1, this.$entity_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(EntityInsertionAdapter$insertAsync$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new EntityInsertionAdapter$insertAsync$slambda(this.this$0__1, this.$entity_1, completion); i.stmt_1 = stmt; return i; }; protoOf(EntityInsertionAdapter$insertAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function EntityInsertionAdapter$insertAsync$slambda_0(this$0, $entity, resultContinuation) { var i = new EntityInsertionAdapter$insertAsync$slambda(this$0, $entity, resultContinuation); var l = function (stmt, $completion) { return i.invoke_e5ovyj_k$(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter$insertAndReturnId$lambda(this$0, $entity) { return function (stmt) { this$0.bindPreparedStmtToEntity_ne2rsb_k$(stmt, $entity); stmt.executeUpdate_fapcbi_k$(); return getGeneratedKey(this$0, stmt); }; } function EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this$0, $entity, resultContinuation) { this.this$0__1 = this$0; this.$entity_1 = $entity; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).invoke_5pfha5_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_5pfha5_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$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.this$0__1.bindPreparedStmtToEntity_ne2rsb_k$(this.stmt_1, this.$entity_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return getGeneratedKey(this.this$0__1, this.stmt_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); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this.this$0__1, this.$entity_1, completion); i.stmt_1 = stmt; return i; }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function EntityInsertionAdapter$insertAndReturnIdAsync$slambda_0(this$0, $entity, resultContinuation) { var i = new EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this$0, $entity, resultContinuation); var l = function (stmt, $completion) { return i.invoke_5pfha5_k$(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter$insertListAndReturnIds$lambda($entities, this$0, $generatedKeys) { return function (stmt) { stmt.getConnection_hr2oto_k$().setAutoCommit_yh8u8d_k$(false); var tmp0_iterator = $entities.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.EntityInsertionAdapter.insertListAndReturnIds..' call this$0.bindPreparedStmtToEntity_ne2rsb_k$(stmt, element); stmt.executeUpdate_fapcbi_k$(); // Inline function 'kotlin.collections.plusAssign' call var this_0 = $generatedKeys; var element_0 = getGeneratedKey(this$0, stmt); this_0.add_utx5q5_k$(element_0); } stmt.getConnection_hr2oto_k$().commit_vpt10n_k$(); return Unit_getInstance(); }; } function EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda($entities, this$0, $generatedKeys, resultContinuation) { this.$entities_1 = $entities; this.this$0__1 = this$0; this.$generatedKeys_1 = $generatedKeys; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda).invoke_e5ovyj_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e5ovyj_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertListAndReturnIdsAsync$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); this.stmt_1.getConnection_hr2oto_k$().setAutoCommit_yh8u8d_k$(false); var tmp_0 = this; tmp_0.this0__1 = this.$entities_1; this.tmp0_iterator1__1 = this.this0__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.element2__1 = this.tmp0_iterator1__1.next_20eer_k$(); var tmp_1 = this; tmp_1.it3__1 = this.element2__1; this.this$0__1.bindPreparedStmtToEntity_ne2rsb_k$(this.stmt_1, this.it3__1); this.set_state_rjd8d0_k$(2); suspendResult = executeUpdateAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: var this_0 = this.$generatedKeys_1; var element = getGeneratedKey(this.this$0__1, this.stmt_1); this_0.add_utx5q5_k$(element); this.set_state_rjd8d0_k$(1); continue $sm; case 3: this.stmt_1.getConnection_hr2oto_k$().commit_vpt10n_k$(); 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(EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda(this.$entities_1, this.this$0__1, this.$generatedKeys_1, completion); i.stmt_1 = stmt; return i; }; protoOf(EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda_0($entities, this$0, $generatedKeys, resultContinuation) { var i = new EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda($entities, this$0, $generatedKeys, resultContinuation); var l = function (stmt, $completion) { return i.invoke_e5ovyj_k$(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter$insertList$lambda($entities, this$0) { return function (stmt) { stmt.getConnection_hr2oto_k$().setAutoCommit_yh8u8d_k$(false); var tmp0_iterator = $entities.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.EntityInsertionAdapter.insertList..' call this$0.bindPreparedStmtToEntity_ne2rsb_k$(stmt, element); stmt.executeUpdate_fapcbi_k$(); } stmt.getConnection_hr2oto_k$().commit_vpt10n_k$(); return Unit_getInstance(); }; } function EntityInsertionAdapter$insertListAsync$slambda($entities, this$0, resultContinuation) { this.$entities_1 = $entities; this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertListAsync$slambda).invoke_e5ovyj_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(EntityInsertionAdapter$insertListAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e5ovyj_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertListAsync$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); this.stmt_1.getConnection_hr2oto_k$().setAutoCommit_yh8u8d_k$(false); var tmp_0 = this; tmp_0.this0__1 = this.$entities_1; this.tmp0_iterator1__1 = this.this0__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.element2__1 = this.tmp0_iterator1__1.next_20eer_k$(); var tmp_1 = this; tmp_1.it3__1 = this.element2__1; this.this$0__1.bindPreparedStmtToEntity_ne2rsb_k$(this.stmt_1, this.it3__1); this.set_state_rjd8d0_k$(2); suspendResult = executeUpdateAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.set_state_rjd8d0_k$(1); continue $sm; case 3: this.stmt_1.getConnection_hr2oto_k$().commit_vpt10n_k$(); 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(EntityInsertionAdapter$insertListAsync$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new EntityInsertionAdapter$insertListAsync$slambda(this.$entities_1, this.this$0__1, completion); i.stmt_1 = stmt; return i; }; protoOf(EntityInsertionAdapter$insertListAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function EntityInsertionAdapter$insertListAsync$slambda_0($entities, this$0, resultContinuation) { var i = new EntityInsertionAdapter$insertListAsync$slambda($entities, this$0, resultContinuation); var l = function (stmt, $completion) { return i.invoke_e5ovyj_k$(stmt, $completion); }; l.$arity = 1; return l; } function $insertListAndReturnIdsAsyncCOROUTINE$0(_this__u8e3s4, entities, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.entities_1 = entities; } protoOf($insertListAndReturnIdsAsyncCOROUTINE$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$(2); this.stmtConfig0__1 = new PreparedStatementConfig(this._this__u8e3s4__1.makeSql_c10guz_k$(true), VOID, StatementConstantsKmp_getInstance().get_RETURN_GENERATED_KEYS_s33sei_k$()); var tmp_0 = this; tmp_0.generatedKeys1__1 = ArrayList_init_$Create$(); this.set_state_rjd8d0_k$(1); suspendResult = prepareAndUseStatementAsync(this._this__u8e3s4__1.db_1, this.stmtConfig0__1, EntityInsertionAdapter$insertListAndReturnIdsAsync$slambda_0(this.entities_1, this._this__u8e3s4__1, this.generatedKeys1__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return toList(this.generatedKeys1__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 EntityInsertionAdapter(db) { this.db_1 = db; this.dbType_1 = dbType_1(this.db_1); } protoOf(EntityInsertionAdapter).get_db_knto1l_k$ = function () { return this.db_1; }; protoOf(EntityInsertionAdapter).get_dbType_c9mcip_k$ = function () { return this.dbType_1; }; protoOf(EntityInsertionAdapter).insert_fs66hy_k$ = function (entity) { var tmp = this.makeSql_c10guz_k$(false); prepareAndUseStatement_0(this.db_1, tmp, false, EntityInsertionAdapter$insert$lambda(this, entity)); }; protoOf(EntityInsertionAdapter).insertAsync_kic9b7_k$ = function (entity, $completion) { var tmp = this.makeSql_c10guz_k$(false); return prepareAndUseStatementAsync_0(this.db_1, tmp, VOID, EntityInsertionAdapter$insertAsync$slambda_0(this, entity, null), $completion); }; protoOf(EntityInsertionAdapter).insertAndReturnId_1ek0wq_k$ = function (entity) { var stmtConfig = new PreparedStatementConfig(this.makeSql_c10guz_k$(true), VOID, StatementConstantsKmp_getInstance().get_RETURN_GENERATED_KEYS_s33sei_k$()); return prepareAndUseStatement(this.db_1, stmtConfig, EntityInsertionAdapter$insertAndReturnId$lambda(this, entity)); }; protoOf(EntityInsertionAdapter).insertAndReturnIdAsync_jrwaz_k$ = function (entity, $completion) { var stmtConfig = new PreparedStatementConfig(this.makeSql_c10guz_k$(true), VOID, StatementConstantsKmp_getInstance().get_RETURN_GENERATED_KEYS_s33sei_k$()); return prepareAndUseStatementAsync(this.db_1, stmtConfig, EntityInsertionAdapter$insertAndReturnIdAsync$slambda_0(this, entity, null), $completion); }; protoOf(EntityInsertionAdapter).insertListAndReturnIds_rpj91g_k$ = function (entities) { var stmtConfig = new PreparedStatementConfig(this.makeSql_c10guz_k$(true), VOID, StatementConstantsKmp_getInstance().get_RETURN_GENERATED_KEYS_s33sei_k$()); // Inline function 'kotlin.collections.mutableListOf' call var generatedKeys = ArrayList_init_$Create$(); prepareAndUseStatement(this.db_1, stmtConfig, EntityInsertionAdapter$insertListAndReturnIds$lambda(entities, this, generatedKeys)); return toList(generatedKeys); }; protoOf(EntityInsertionAdapter).insertListAndReturnIdsAsync_v61ih5_k$ = function (entities, $completion) { var tmp = new $insertListAndReturnIdsAsyncCOROUTINE$0(this, entities, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(EntityInsertionAdapter).insertList_bfvuij_k$ = function (entities) { var tmp = this.makeSql_c10guz_k$(false); prepareAndUseStatement_0(this.db_1, tmp, false, EntityInsertionAdapter$insertList$lambda(entities, this)); }; protoOf(EntityInsertionAdapter).insertListAsync_it2cbm_k$ = function (entities, $completion) { var tmp = this.makeSql_c10guz_k$(false); return prepareAndUseStatementAsync_0(this.db_1, tmp, VOID, EntityInsertionAdapter$insertListAsync$slambda_0(entities, this, null), $completion); }; function _get_queryParams__wxa6n1($this) { return $this.queryParams_1; } function _get_queryTypes__jj0avu($this) { return $this.queryTypes_1; } function _get_nullSqlTypes__pfbh47($this) { return $this.nullSqlTypes_1; } function getNthIndexOf(_this__u8e3s4, $this, char, n) { var foundCount = 0; var pos = 0; $l$loop: while (true) { var tmp; var tmp0 = foundCount; foundCount = tmp0 + 1 | 0; if (tmp0 < n) { tmp = !(pos === -1); } else { tmp = false; } if (!tmp) { break $l$loop; } pos = indexOf(_this__u8e3s4, char, pos + 1 | 0); } return pos; } function makeArrayPlaceholders($this, numPlaceholders) { // Inline function 'kotlin.math.max' call var b = imul(2, numPlaceholders) - 1 | 0; var tmp$ret$0 = Math.max(0, b); var sb = StringBuilder_init_$Create$(tmp$ret$0); var inductionVariable = 0; if (inductionVariable < numPlaceholders) do { var i = inductionVariable; inductionVariable = inductionVariable + 1 | 0; if (!(i === 0)) { sb.append_am5a4z_k$(_Char___init__impl__6a9atx(44)); } sb.append_am5a4z_k$(_Char___init__impl__6a9atx(63)); } while (inductionVariable < numPlaceholders); return sb.toString(); } function Companion() { Companion_instance = this; this.ARR_PROXY_SET_OBJECT_1 = -5000; this.PROXY_SET_NULL_1 = -5001; } protoOf(Companion).get_ARR_PROXY_SET_OBJECT_dwlfxw_k$ = function () { return this.ARR_PROXY_SET_OBJECT_1; }; protoOf(Companion).get_PROXY_SET_NULL_xr3lfi_k$ = function () { return this.PROXY_SET_NULL_1; }; var Companion_instance; function Companion_getInstance_2() { if (Companion_instance == null) new Companion(); return Companion_instance; } function PreparedStatementArrayProxyCommon(query, connectionInternal) { Companion_getInstance_2(); this.query_1 = query; this.connectionInternal_1 = connectionInternal; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.queryParams_1 = LinkedHashMap_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_0.queryTypes_1 = LinkedHashMap_init_$Create$(); var tmp_1 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_1.nullSqlTypes_1 = LinkedHashMap_init_$Create$(); this.stmtQueryTimeout_1 = -1; } protoOf(PreparedStatementArrayProxyCommon).get_query_ixn1y7_k$ = function () { return this.query_1; }; protoOf(PreparedStatementArrayProxyCommon).get_connectionInternal_tlp70c_k$ = function () { return this.connectionInternal_1; }; protoOf(PreparedStatementArrayProxyCommon).set_stmtQueryTimeout_y4bkfe_k$ = function (_set____db54di) { this.stmtQueryTimeout_1 = _set____db54di; }; protoOf(PreparedStatementArrayProxyCommon).get_stmtQueryTimeout_l5p7fa_k$ = function () { return this.stmtQueryTimeout_1; }; protoOf(PreparedStatementArrayProxyCommon).setBoolean_pzdm1v_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setByte_o65f22_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_SMALLINT_sw3een_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setShort_mhpatm_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_SMALLINT_sw3een_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setInt_c72a8z_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_INTEGER_pibe8b_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setLong_j1sybo_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_BIGINT_47wyyw_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setFloat_dia6lm_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_FLOAT_i998gj_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setDouble_gsfx69_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_DOUBLE_36a61y_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setString_2gt7ua_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value_0 = TypesKmp_getInstance().get_VARCHAR_h1w92s_k$(); this_0.put_4fpzoq_k$(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).setArray_61y2p9_k$ = function (index, array) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, array); // Inline function 'kotlin.collections.set' call var this_0 = this.queryTypes_1; var value = TypesKmp_getInstance().get_ARRAY_i6m5n4_k$(); this_0.put_4fpzoq_k$(index, value); }; protoOf(PreparedStatementArrayProxyCommon).setBigDecimal_lq0top_k$ = function (index, value) { throw new SQLException('PreparedStatementArrayProxy unsupported type: BigDecimal', (null == null ? true : null instanceof Error) ? null : THROW_CCE()); }; protoOf(PreparedStatementArrayProxyCommon).setBytes_hpy65b_k$ = function (index, value) { throw new SQLException('PreparedStatementArrayProxy unsupported type: Bytes', (null == null ? true : null instanceof Error) ? null : THROW_CCE()); }; protoOf(PreparedStatementArrayProxyCommon).setDate_ytyjt6_k$ = function (index, value) { throw new SQLException('PreparedStatementArrayProxy unsupported type: Date', (null == null ? true : null instanceof Error) ? null : THROW_CCE()); }; protoOf(PreparedStatementArrayProxyCommon).setTime_3vnst7_k$ = function (index, value) { }; protoOf(PreparedStatementArrayProxyCommon).setObject_9i2mag_k$ = function (index, value) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(index, value); // Inline function 'kotlin.collections.set' call this.queryTypes_1.put_4fpzoq_k$(index, -5000); }; protoOf(PreparedStatementArrayProxyCommon).setNull_24rkav_k$ = function (parameterIndex, sqlType) { // Inline function 'kotlin.collections.set' call this.queryParams_1.put_4fpzoq_k$(parameterIndex, null); // Inline function 'kotlin.collections.set' call this.queryTypes_1.put_4fpzoq_k$(parameterIndex, -5001); // Inline function 'kotlin.collections.set' call this.nullSqlTypes_1.put_4fpzoq_k$(parameterIndex, sqlType); }; protoOf(PreparedStatementArrayProxyCommon).setQueryTimeout_qepe4z_k$ = function (seconds) { this.stmtQueryTimeout_1 = seconds; }; protoOf(PreparedStatementArrayProxyCommon).prepareStatement_ieuhug_k$ = function () { var arrayOffset = 0; // Inline function 'kotlin.collections.mutableMapOf' call var paramValues = LinkedHashMap_init_$Create$(); // Inline function 'kotlin.collections.mutableMapOf' call var paramTypes = LinkedHashMap_init_$Create$(); var adjustedQuery = this.query_1; var tmp0_iterator = this.queryParams_1.get_keys_wop4xp_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var paramIndex = tmp0_iterator.next_20eer_k$(); var value = this.queryParams_1.get_wei43m_k$(paramIndex); if (!(value == null) ? isInterface(value, Array_0) : false) { var arrayProxy = value instanceof JdbcArrayProxy ? value : THROW_CCE(); var objects = arrayProxy.get_objects_q6k34l_k$(); var arrayParamPos = getNthIndexOf(adjustedQuery, this, _Char___init__impl__6a9atx(63), paramIndex + arrayOffset | 0); // Inline function 'kotlin.text.substring' call // Inline function 'kotlin.js.asDynamic' call var tmp = adjustedQuery.substring(0, arrayParamPos) + makeArrayPlaceholders(this, objects.length); // Inline function 'kotlin.text.substring' call var this_0 = adjustedQuery; var startIndex = arrayParamPos + 1 | 0; // Inline function 'kotlin.js.asDynamic' call adjustedQuery = tmp + this_0.substring(startIndex); var inductionVariable = 0; var last = objects.length - 1 | 0; if (inductionVariable <= last) do { var i = inductionVariable; inductionVariable = inductionVariable + 1 | 0; var paramPos = (paramIndex + arrayOffset | 0) + i | 0; // Inline function 'kotlin.collections.set' call var value_0 = objects[i]; paramValues.put_4fpzoq_k$(paramPos, value_0); // Inline function 'kotlin.collections.set' call var value_1 = arrayProxy.getBaseType_5w77s1_k$(); paramTypes.put_4fpzoq_k$(paramPos, value_1); } while (inductionVariable <= last); arrayOffset = arrayOffset + (objects.length - 1 | 0) | 0; } else { // Inline function 'kotlin.collections.set' call var key = paramIndex + arrayOffset | 0; paramValues.put_4fpzoq_k$(key, value); // Inline function 'kotlin.collections.set' call var key_0 = paramIndex + arrayOffset | 0; var tmp2_elvis_lhs = this.queryTypes_1.get_wei43m_k$(paramIndex); var tmp_0; if (tmp2_elvis_lhs == null) { throw IllegalStateException_init_$Create$('PreparedStatementArrayProxy: Cannot find query param type at index ' + paramIndex); } else { tmp_0 = tmp2_elvis_lhs; } var value_2 = tmp_0; paramTypes.put_4fpzoq_k$(key_0, value_2); } } var stmt = null; try { stmt = this.connectionInternal_1.prepareStatement_f6j8eq_k$(adjustedQuery); // Inline function 'kotlin.takeIf' call var this_1 = stmt; // Inline function 'kotlin.contracts.contract' call var tmp_1; // Inline function 'com.ustadmobile.door.PreparedStatementArrayProxyCommon.prepareStatement.' call if (this.stmtQueryTimeout_1 > 0) { tmp_1 = this_1; } else { tmp_1 = null; } var tmp3_safe_receiver = tmp_1; if (tmp3_safe_receiver == null) null; else { tmp3_safe_receiver.setQueryTimeout_qepe4z_k$(this.stmtQueryTimeout_1); } var tmp4_iterator = paramValues.get_keys_wop4xp_k$().iterator_jk1svi_k$(); while (tmp4_iterator.hasNext_bitz1p_k$()) { var paramIndex_0 = tmp4_iterator.next_20eer_k$(); var value_3 = paramValues.get_wei43m_k$(paramIndex_0); var tmp5_elvis_lhs = paramTypes.get_wei43m_k$(paramIndex_0); var paramType = tmp5_elvis_lhs == null ? 0 : tmp5_elvis_lhs; if (paramType === -5001) { var tmp_2 = stmt; var tmp7_elvis_lhs = this.nullSqlTypes_1.get_wei43m_k$(paramIndex_0); tmp_2.setNull_24rkav_k$(paramIndex_0, tmp7_elvis_lhs == null ? 0 : tmp7_elvis_lhs); } else if (paramType === TypesKmp_getInstance().get_INTEGER_pibe8b_k$()) { var tmp_3 = stmt; tmp_3.setInt_c72a8z_k$(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$()) { var tmp_4 = stmt; tmp_4.setBoolean_pzdm1v_k$(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'boolean' : false) ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_getInstance().get_VARCHAR_h1w92s_k$() ? true : paramType === TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$()) { var tmp_5 = stmt; tmp_5.setString_2gt7ua_k$(paramIndex_0, (value_3 == null ? true : typeof value_3 === 'string') ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_getInstance().get_BIGINT_47wyyw_k$()) { var tmp_6 = stmt; tmp_6.setLong_j1sybo_k$(paramIndex_0, value_3 instanceof Long ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_getInstance().get_FLOAT_i998gj_k$()) { var tmp_7 = stmt; tmp_7.setFloat_dia6lm_k$(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE()); } else if (paramType === -5000) { stmt.setObject_9i2mag_k$(paramIndex_0, value_3); } } } catch ($p) { if ($p instanceof SQLException) { var e = $p; var tmp8_safe_receiver = stmt; if (tmp8_safe_receiver == null) null; else { tmp8_safe_receiver.close_yn9xrc_k$(); } throw e; } else { throw $p; } } return stmt; }; protoOf(PreparedStatementArrayProxyCommon).executeQuery_mh7xd9_k$ = function () { var stmt = this.prepareStatement_ieuhug_k$(); var resultSet = stmt.executeQuery_mh7xd9_k$(); return new PreparedStatementResultSetWrapper(resultSet, stmt); }; protoOf(PreparedStatementArrayProxyCommon).executeUpdate_fapcbi_k$ = function () { var tmp$ret$1; $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = this.prepareStatement_ieuhug_k$(); try { // Inline function 'com.ustadmobile.door.PreparedStatementArrayProxyCommon.executeUpdate.' call tmp$ret$1 = this_0.executeUpdate_fapcbi_k$(); break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } } return tmp$ret$1; }; function _get_resultSet__v33ndg($this) { return $this.resultSet_1; } function _get_stmt__ddv8ub($this) { return $this.stmt_1; } function PreparedStatementResultSetWrapper(resultSet, stmt) { this.resultSet_1 = resultSet; this.stmt_1 = stmt; } protoOf(PreparedStatementResultSetWrapper).getBigDecimal_vg28s3_k$ = function (columnName) { return this.resultSet_1.getBigDecimal_vg28s3_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getBoolean_oe92jq_k$ = function (columnIndex) { return this.resultSet_1.getBoolean_oe92jq_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getBoolean_xz3hoo_k$ = function (columnName) { return this.resultSet_1.getBoolean_xz3hoo_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getByte_8098nu_k$ = function (columnIndex) { return this.resultSet_1.getByte_8098nu_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getByte_blta6c_k$ = function (columnName) { return this.resultSet_1.getByte_blta6c_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getBytes_hu5f8b_k$ = function (columnName) { return this.resultSet_1.getBytes_hu5f8b_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getDate_jtyvo6_k$ = function (columnName) { return this.resultSet_1.getDate_jtyvo6_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getDouble_5me5vz_k$ = function (columnIndex) { return this.resultSet_1.getDouble_5me5vz_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getDouble_v37ict_k$ = function (columnName) { return this.resultSet_1.getDouble_v37ict_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getFloat_m7y41e_k$ = function (columnIndex) { return this.resultSet_1.getFloat_m7y41e_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getFloat_1jlp7w_k$ = function (columnName) { return this.resultSet_1.getFloat_1jlp7w_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getInt_s8uc8x_k$ = function (columnIndex) { return this.resultSet_1.getInt_s8uc8x_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getInt_npc9pd_k$ = function (columnName) { return this.resultSet_1.getInt_npc9pd_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getLong_rneply_k$ = function (columnIndex) { return this.resultSet_1.getLong_rneply_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getLong_3wgf2g_k$ = function (columnName) { return this.resultSet_1.getLong_3wgf2g_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getMetaData_qwn0zp_k$ = function () { return this.resultSet_1.getMetaData_qwn0zp_k$(); }; protoOf(PreparedStatementResultSetWrapper).getObject_m2jtdv_k$ = function (columnIndex) { return this.resultSet_1.getObject_m2jtdv_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getObject_63qtd1_k$ = function (columnName) { return this.resultSet_1.getObject_63qtd1_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getShort_agwca6_k$ = function (columnIndex) { return this.resultSet_1.getShort_agwca6_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getShort_4zegvo_k$ = function (columnName) { return this.resultSet_1.getShort_4zegvo_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getString_5demq7_k$ = function (columnIndex) { return this.resultSet_1.getString_5demq7_k$(columnIndex); }; protoOf(PreparedStatementResultSetWrapper).getString_gb1pt9_k$ = function (columnName) { return this.resultSet_1.getString_gb1pt9_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getTime_of3q21_k$ = function (columnName) { return this.resultSet_1.getTime_of3q21_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).getTimestamp_78pst6_k$ = function (columnName) { return this.resultSet_1.getTimestamp_78pst6_k$(columnName); }; protoOf(PreparedStatementResultSetWrapper).isClosed_baxhhm_k$ = function () { return this.resultSet_1.isClosed_baxhhm_k$(); }; protoOf(PreparedStatementResultSetWrapper).next_20eer_k$ = function () { return this.resultSet_1.next_20eer_k$(); }; protoOf(PreparedStatementResultSetWrapper).wasNull_ilge1c_k$ = function () { return this.resultSet_1.wasNull_ilge1c_k$(); }; protoOf(PreparedStatementResultSetWrapper).close_yn9xrc_k$ = function () { try { if (!this.resultSet_1.isClosed_baxhhm_k$()) { this.resultSet_1.close_yn9xrc_k$(); } } catch ($p) { if ($p instanceof SQLException) { var e = $p; throw e; } else { throw $p; } } finally { if (!this.stmt_1.getConnection_hr2oto_k$().isClosed_baxhhm_k$() ? !this.stmt_1.isClosed_baxhhm_k$() : false) { this.stmt_1.close_yn9xrc_k$(); } } }; function _get_SQL_COMPONENT_TYPE_MAP__vrhum9($this) { return $this.SQL_COMPONENT_TYPE_MAP_1; } function Companion_0() { Companion_instance_0 = this; this.SQL_COMPONENT_TYPE_MAP_1 = mapOf([to(getKClass(Long), 'BIGINT'), to(PrimitiveClasses_getInstance().get_intClass_mw4y9a_k$(), 'INTEGER'), to(PrimitiveClasses_getInstance().get_shortClass_5ajsv9_k$(), 'SMALLINT'), to(PrimitiveClasses_getInstance().get_booleanClass_d285fr_k$(), 'BOOLEAN'), to(PrimitiveClasses_getInstance().get_floatClass_xlwq2t_k$(), 'FLOAT'), to(PrimitiveClasses_getInstance().get_doubleClass_dahzcy_k$(), 'DOUBLE'), to(PrimitiveClasses_getInstance().get_stringClass_bik2gy_k$(), 'TEXT')]); } protoOf(Companion_0).requireSqlType_q5floc_k$ = function (any) { var tmp; if (any == null) { throw IllegalArgumentException_init_$Create$('requireSqlType null'); } else { tmp = any; } var anyObj = tmp; // Inline function 'kotlin.collections.get' call var this_0 = this.SQL_COMPONENT_TYPE_MAP_1; var key = getKClassFromExpression(anyObj); var tmp1_elvis_lhs = (isInterface(this_0, Map) ? this_0 : THROW_CCE()).get_wei43m_k$(key); var tmp_0; if (tmp1_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('Unsupported: ' + getKClassFromExpression(any)); } else { tmp_0 = tmp1_elvis_lhs; } return tmp_0; }; var Companion_instance_0; function Companion_getInstance_3() { if (Companion_instance_0 == null) new Companion_0(); return Companion_instance_0; } function SimpleDoorQuery(sql, values) { Companion_getInstance_3(); this.sql_1 = sql; this.values_1 = values; } protoOf(SimpleDoorQuery).get_sql_18iw0r_k$ = function () { return this.sql_1; }; protoOf(SimpleDoorQuery).get_values_ksazhn_k$ = function () { return this.values_1; }; protoOf(SimpleDoorQuery).get_argCount_c69sma_k$ = function () { var reason = 'Not yet implemented'; throw new NotImplementedError('An operation is not implemented: ' + reason); }; protoOf(SimpleDoorQuery).bindToPreparedStmt_le67fq_k$ = function (stmt, db) { var paramsToBind = this.values_1; var connection = stmt.getConnection_hr2oto_k$(); if (!(paramsToBind == null)) { var paramIndex = 1; var tmp0_iterator = arrayIterator(paramsToBind); while (tmp0_iterator.hasNext_bitz1p_k$()) { var param = tmp0_iterator.next_20eer_k$(); var tmp; if (!(param == null) ? isInterface(param, List) : false) { tmp = true; } else { tmp = (param == null ? null : isArray_0(param)) === true; } if (tmp) { var tmp_0; var tmp_1; if (!(param == null) ? isInterface(param, List) : false) { // Inline function 'kotlin.collections.isNotEmpty' call tmp_1 = !param.isEmpty_y1axqb_k$(); } else { tmp_1 = false; } if (tmp_1) { tmp_0 = Companion_getInstance_3().requireSqlType_q5floc_k$(first_0(param)); } else { var tmp_2; if (!(param == null) ? isArray(param) : false) { // Inline function 'kotlin.collections.isNotEmpty' call // Inline function 'kotlin.collections.isEmpty' call tmp_2 = !(param.length === 0); } else { tmp_2 = false; } if (tmp_2) { tmp_0 = Companion_getInstance_3().requireSqlType_q5floc_k$(first(param)); } else { tmp_0 = 'TEXT'; } } var paramType = tmp_0; var tmp_3; if (!(param == null) ? isInterface(param, List) : false) { // Inline function 'kotlin.collections.toTypedArray' call tmp_3 = copyToArray(param); } else { if (!(param == null) ? isArray(param) : false) { tmp_3 = param; } else { throw IllegalArgumentException_init_$Create$('Array param is not a list or array'); } } var valuesArr = tmp_3; var tmp_4; if (get_arraySupported(db)) { tmp_4 = connection.createArrayOf_8kbkpw_k$(paramType, valuesArr); } else { tmp_4 = new JdbcArrayProxy(paramType, valuesArr); } var tmp_5 = tmp_4; var arrayParam = isInterface(tmp_5, Array_0) ? tmp_5 : THROW_CCE(); var tmp2 = paramIndex; paramIndex = tmp2 + 1 | 0; stmt.setArray_61y2p9_k$(tmp2, arrayParam); } else { var tmp3 = paramIndex; paramIndex = tmp3 + 1 | 0; stmt.setObject_9i2mag_k$(tmp3, param); } } } }; function createArrayOrProxyArrayOf(_this__u8e3s4, arrayType, objects) { var tmp; if (dbType(_this__u8e3s4) === Companion_getInstance_6().get_POSTGRES_6bxnsu_k$()) { tmp = _this__u8e3s4.createArrayOf_8kbkpw_k$(arrayType, objects); } else { tmp = new JdbcArrayProxy(arrayType, objects); } return tmp; } function dbType(_this__u8e3s4) { return Companion_getInstance_6().typeIntFromProductName_o9ohnl_k$(_this__u8e3s4.getMetaData_qwn0zp_k$().getDatabaseProductName_re6tex_k$()); } function get_doorPrimaryKeyManager(_this__u8e3s4) { var tmp = get_rootDatabase(_this__u8e3s4); return (isInterface(tmp, DoorDatabaseJdbc) ? tmp : THROW_CCE()).get_realPrimaryKeyManager_s5zvav_k$(); } function get_sourceDatabase(_this__u8e3s4) { var tmp; if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) { tmp = null; } else { if (isInterface(_this__u8e3s4, DoorDatabaseRepository)) { tmp = _this__u8e3s4.get_db_knto1l_k$(); } else { if (isInterface(_this__u8e3s4, DoorDatabaseWrapper)) { tmp = _this__u8e3s4.get_realDatabase_fu4k1q_k$(); } else { throw IllegalStateException_init_$Create$('SourceDatabase : Not a recognized implementation: ' + getKClassFromExpression(_this__u8e3s4)); } } } return tmp; } function prepareAndUseStatementAsync(_this__u8e3s4, stmtConfig, block, $completion) { var tmp = new $prepareAndUseStatementAsyncCOROUTINE$1(_this__u8e3s4, stmtConfig, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function get_nodeIdAuthCache(_this__u8e3s4) { var tmp; if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) { tmp = _this__u8e3s4.get_realNodeIdAuthCache_ojie7e_k$(); } else { tmp = get_nodeIdAuthCache(get_rootDatabase(_this__u8e3s4)); } return tmp; } function prepareAndUseStatement(_this__u8e3s4, stmtConfig, block) { try { var tmp = get_rootDatabase(_this__u8e3s4); var tmp_0 = (isInterface(tmp, RoomJdbcImpl) ? tmp : THROW_CCE()).get_jdbcImplHelper_iauze6_k$(); var tmp_1 = stmtConfig.get_readOnly_ovku97_k$(); return tmp_0.useConnection_u6tku8_k$(tmp_1, prepareAndUseStatement$lambda(_this__u8e3s4, stmtConfig, block)); } catch ($p) { if ($p instanceof Exception) { var e = $p; Napier_getInstance().e_o3f1y_k$("prepareAndUseStatement: Exception running SQL: '" + stmtConfig.sqlToUse_pxgz0m_k$(dbType_1(_this__u8e3s4)) + "' on DB " + _this__u8e3s4, e, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); throw e; } else { throw $p; } } } function prepareAndUseStatementAsync$slambda$lambda($jdbcImpl, $stmtConfig) { return function () { return '[prepareAndUseStatementAsync - ' + $jdbcImpl.get_jdbcImplHelper_iauze6_k$().get_dbName_c9i0qa_k$() + '] - prepare "' + $stmtConfig.get_sql_18iw0r_k$() + '"'; }; } function prepareAndUseStatementAsync$slambda($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation) { this.$logger_1 = $logger; this.$this_prepareAndUseStatementAsync_1 = $this_prepareAndUseStatementAsync; this.$stmtConfig_1 = $stmtConfig; this.$block_1 = $block; this.$jdbcImpl_1 = $jdbcImpl; CoroutineImpl.call(this, resultContinuation); } protoOf(prepareAndUseStatementAsync$slambda).invoke_8ggh1u_k$ = function (connection, $completion) { var tmp = this.create_1rn91a_k$(connection, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(prepareAndUseStatementAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_8ggh1u_k$((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(prepareAndUseStatementAsync$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$(12); v(this.$logger_1, VOID, prepareAndUseStatementAsync$slambda$lambda(this.$jdbcImpl_1, this.$stmtConfig_1)); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = prepareStatement(this.connection_1, this.$this_prepareAndUseStatementAsync_1, this.$stmtConfig_1); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_state_rjd8d0_k$(4); continue $sm; case 4: this.set_exceptionState_fex74n_k$(9); this.set_exceptionState_fex74n_k$(8); var tmp_1 = this; tmp_1.stmt5__1 = this.this1__1; var tmp_2 = get_rootDatabase(this.$this_prepareAndUseStatementAsync_1); this.stmt5__1.setQueryTimeout_qepe4z_k$((isInterface(tmp_2, DoorDatabaseJdbc) ? tmp_2 : THROW_CCE()).get_jdbcQueryTimeout_rk5wkj_k$()); this.blockStartTime6__1 = systemTimeInMillis(); this.set_state_rjd8d0_k$(5); suspendResult = this.$block_1(this.stmt5__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: var this_0 = suspendResult; var blockTime = systemTimeInMillis().minus_mfbszm_k$(this.blockStartTime6__1); if (blockTime.compareTo_9jj042_k$(new Long(1000, 0)) > 0) { w_0(this.$logger_1, '[prepareAndUseStatementAsync - ' + this.$jdbcImpl_1.get_jdbcImplHelper_iauze6_k$().get_dbName_c9i0qa_k$() + '] query ' + this.$stmtConfig_1.get_sql_18iw0r_k$() + ' took ' + blockTime.toString() + 'ms'); } this.tmp$ret$04__1 = this_0; this.set_exceptionState_fex74n_k$(12); this.set_state_rjd8d0_k$(6); var tmp_3 = this; continue $sm; case 6: var tmp_4 = this.tmp$ret$04__1; this.set_exceptionState_fex74n_k$(12); this.this1__1.close_yn9xrc_k$(); return tmp_4; case 7: this.set_exceptionState_fex74n_k$(12); var tmp_5 = this; this.this1__1.close_yn9xrc_k$(); tmp_5.tmp$ret$60__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(11); continue $sm; case 8: this.set_exceptionState_fex74n_k$(9); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_7 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 9: this.set_exceptionState_fex74n_k$(12); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 10: this.set_exceptionState_fex74n_k$(12); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(11); continue $sm; case 11: return this.tmp$ret$60__1; case 12: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 12) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(prepareAndUseStatementAsync$slambda).create_1rn91a_k$ = function (connection, completion) { var i = new prepareAndUseStatementAsync$slambda(this.$logger_1, this.$this_prepareAndUseStatementAsync_1, this.$stmtConfig_1, this.$block_1, this.$jdbcImpl_1, completion); i.connection_1 = connection; return i; }; protoOf(prepareAndUseStatementAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_1rn91a_k$((!(value == null) ? isInterface(value, Connection) : false) ? value : THROW_CCE(), completion); }; function prepareAndUseStatementAsync$slambda_0($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation) { var i = new prepareAndUseStatementAsync$slambda($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation); var l = function (connection, $completion) { return i.invoke_8ggh1u_k$(connection, $completion); }; l.$arity = 1; return l; } function prepareAndUseStatement$lambda($this_prepareAndUseStatement, $stmtConfig, $block) { return function (connection) { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = prepareStatement(connection, $this_prepareAndUseStatement, $stmtConfig); try { var tmp = get_rootDatabase($this_prepareAndUseStatement); this_0.setQueryTimeout_qepe4z_k$((isInterface(tmp, DoorDatabaseJdbc) ? tmp : THROW_CCE()).get_jdbcQueryTimeout_rk5wkj_k$()); var blockStartTime = systemTimeInMillis(); // Inline function 'kotlin.also' call var this_1 = $block(this_0); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.ext.prepareAndUseStatement...' call var blockTime = systemTimeInMillis().minus_mfbszm_k$(blockStartTime); if (blockTime.compareTo_9jj042_k$(new Long(1000, 0)) > 0) { Napier_getInstance().w$default_p42du4_k$('WARNING ' + $this_prepareAndUseStatement + ' query ' + $stmtConfig.get_sql_18iw0r_k$() + ' took ' + blockTime.toString() + 'ms'); } return this_1; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } }; } function $prepareAndUseStatementAsyncCOROUTINE$1(_this__u8e3s4, stmtConfig, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.stmtConfig_1 = stmtConfig; this.block_1 = block; } protoOf($prepareAndUseStatementAsyncCOROUTINE$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); var tmp_0 = this; var tmp_1 = get_rootDatabase(this._this__u8e3s4__1); tmp_0.jdbcImpl0__1 = isInterface(tmp_1, RoomJdbcImpl) ? tmp_1 : THROW_CCE(); this.logger1__1 = this.jdbcImpl0__1.get_jdbcImplHelper_iauze6_k$().get_logger_g9gejd_k$(); this.set_exceptionState_fex74n_k$(2); this.set_state_rjd8d0_k$(1); var tmp_2 = this.jdbcImpl0__1.get_jdbcImplHelper_iauze6_k$(); var tmp_3 = this.stmtConfig_1.get_readOnly_ovku97_k$(); suspendResult = tmp_2.useConnectionAsync_98htgj_k$(tmp_3, prepareAndUseStatementAsync$slambda_0(this.logger1__1, this._this__u8e3s4__1, this.stmtConfig_1, this.block_1, this.jdbcImpl0__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: this.set_exceptionState_fex74n_k$(3); var tmp_4 = this.get_exception_x0n6w6_k$(); if (tmp_4 instanceof Exception) { var e_0 = this.get_exception_x0n6w6_k$(); if (!(e_0 instanceof CancellationException)) { e(this.logger1__1, '[prepareAndUseStatementAsync - ' + this.jdbcImpl0__1.get_jdbcImplHelper_iauze6_k$().get_dbName_c9i0qa_k$() + '] - Exception running ' + this.stmtConfig_1.get_sql_18iw0r_k$(), e_0); } throw e_0; } 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_1 = $p; if (this.get_exceptionState_wflpxn_k$() === 3) { throw e_1; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_1); } } while (true); }; function hasListOrArrayParams(_this__u8e3s4) { var tmp0_safe_receiver = _this__u8e3s4.get_values_ksazhn_k$(); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : asList(tmp0_safe_receiver); var tmp; if (tmp1_safe_receiver == null) { tmp = null; } else { var tmp$ret$0; $l$block_0: { // Inline function 'kotlin.collections.any' call var tmp_0; if (isInterface(tmp1_safe_receiver, Collection)) { tmp_0 = tmp1_safe_receiver.isEmpty_y1axqb_k$(); } else { tmp_0 = false; } if (tmp_0) { tmp$ret$0 = false; break $l$block_0; } var tmp0_iterator = tmp1_safe_receiver.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.ext.hasListOrArrayParams.' call var tmp_1; if (!(element == null) ? isInterface(element, List) : false) { tmp_1 = true; } else { var tmp1_elvis_lhs = element == null ? null : isArray_0(element); tmp_1 = tmp1_elvis_lhs == null ? false : tmp1_elvis_lhs; } if (tmp_1) { tmp$ret$0 = true; break $l$block_0; } } tmp$ret$0 = false; } tmp = tmp$ret$0; } var tmp2_elvis_lhs = tmp; return tmp2_elvis_lhs == null ? false : tmp2_elvis_lhs; } function isArray_0(_this__u8e3s4) { var tmp; var tmp_0; var tmp_1; var tmp_2; var tmp_3; var tmp_4; if (isArray(_this__u8e3s4)) { tmp_4 = true; } else { tmp_4 = isByteArray(_this__u8e3s4); } if (tmp_4) { tmp_3 = true; } else { tmp_3 = isShortArray(_this__u8e3s4); } if (tmp_3) { tmp_2 = true; } else { tmp_2 = isIntArray(_this__u8e3s4); } if (tmp_2) { tmp_1 = true; } else { tmp_1 = isLongArray(_this__u8e3s4); } if (tmp_1) { tmp_0 = true; } else { tmp_0 = isFloatArray(_this__u8e3s4); } if (tmp_0) { tmp = true; } else { tmp = isDoubleArray(_this__u8e3s4); } return tmp; } function copyWithExtraParams(_this__u8e3s4, sql, extraParams) { sql = sql === VOID ? _this__u8e3s4.get_sql_18iw0r_k$() : sql; var tmp; if (extraParams === VOID) { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp = []; } else { tmp = extraParams; } extraParams = tmp; var tmp0_safe_receiver = _this__u8e3s4 instanceof SimpleDoorQuery ? _this__u8e3s4 : null; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_values_ksazhn_k$(); var tmp_0; if (tmp1_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('copyWithExtraParmas: must be simpledoorquery'); } else { tmp_0 = tmp1_elvis_lhs; } var existingParams = tmp_0; var tmp_1 = 0; var tmp_2 = existingParams.length + extraParams.length | 0; // Inline function 'kotlin.arrayOfNulls' call var tmp_3 = fillArrayVal(Array(tmp_2), null); while (tmp_1 < tmp_2) { var tmp_4 = tmp_1; tmp_3[tmp_4] = tmp_4 < existingParams.length ? existingParams[tmp_4] : extraParams[tmp_4 - existingParams.length | 0]; tmp_1 = tmp_1 + 1 | 0; } var allParams = tmp_3; return new SimpleDoorQuery(sql, allParams); } function copy(_this__u8e3s4, sql) { var tmp0_safe_receiver = _this__u8e3s4 instanceof SimpleDoorQuery ? _this__u8e3s4 : null; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_values_ksazhn_k$(); var tmp; if (tmp1_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('copyWithExtraParmas: must be simpledoorquery'); } else { tmp = tmp1_elvis_lhs; } var existingParams = tmp; return new SimpleDoorQuery(sql, existingParams); } function doorFlow(_this__u8e3s4, tables, block) { return callbackFlow(doorFlow$slambda_0(_this__u8e3s4, tables, block, null)); } function doorFlow$1$invalidationTrackerObserver$1($tables, $invalidationEventChannel) { this.$invalidationEventChannel_1 = $invalidationEventChannel; InvalidationTrackerObserver.call(this, $tables); } protoOf(doorFlow$1$invalidationTrackerObserver$1).onInvalidated_v59v8q_k$ = function (tables) { this.$invalidationEventChannel_1.trySend_62dpg8_k$(true); }; function doorFlow$slambda$slambda($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation) { this.$this_callbackFlow_1 = $this_callbackFlow; this.$block_1 = $block; this.$invalidationEventChannel_1 = $invalidationEventChannel; CoroutineImpl.call(this, resultContinuation); } protoOf(doorFlow$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(doorFlow$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(doorFlow$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$(6); this.set_state_rjd8d0_k$(1); suspendResult = this.$block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ARGUMENT0__1 = suspendResult; this.$this_callbackFlow_1.trySend_62dpg8_k$(this.ARGUMENT0__1); this.tmp0_iterator1__1 = this.$invalidationEventChannel_1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); suspendResult = this.tmp0_iterator1__1.hasNext_nhy1w3_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: if (!suspendResult) { this.set_state_rjd8d0_k$(5); continue $sm; } this.evt2__1 = this.tmp0_iterator1__1.next_20eer_k$(); this.set_state_rjd8d0_k$(4); suspendResult = this.$block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; this.$this_callbackFlow_1.trySend_62dpg8_k$(ARGUMENT); this.set_state_rjd8d0_k$(2); continue $sm; case 5: return Unit_getInstance(); case 6: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 6) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(doorFlow$slambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new doorFlow$slambda$slambda(this.$this_callbackFlow_1, this.$block_1, this.$invalidationEventChannel_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(doorFlow$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function doorFlow$slambda$slambda_0($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation) { var i = new doorFlow$slambda$slambda($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function doorFlow$slambda$lambda($invalidationEventChannel, $this_doorFlow, $invalidationTrackerObserver) { return function () { $invalidationEventChannel.close$default_kcbl7u_k$(); $this_doorFlow.get_invalidationTracker_tp0k9d_k$().removeObserver_i1cen1_k$($invalidationTrackerObserver); return Unit_getInstance(); }; } function doorFlow$slambda($this_doorFlow, $tables, $block, resultContinuation) { this.$this_doorFlow_1 = $this_doorFlow; this.$tables_1 = $tables; this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(doorFlow$slambda).invoke_c55cnc_k$ = function ($this$callbackFlow, $completion) { var tmp = this.create_8tn3fw_k$($this$callbackFlow, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(doorFlow$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_c55cnc_k$((!(p1 == null) ? isInterface(p1, ProducerScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(doorFlow$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.invalidationEventChannel0__1 = Channel(1, BufferOverflow_DROP_OLDEST_getInstance()); var tmp_0 = this; tmp_0.invalidationTrackerObserver1__1 = new doorFlow$1$invalidationTrackerObserver$1(this.$tables_1, this.invalidationEventChannel0__1); this.$this_doorFlow_1.get_invalidationTracker_tp0k9d_k$().addObserver_wpl76o_k$(this.invalidationTrackerObserver1__1); launch(this.$this$callbackFlow_1, VOID, VOID, doorFlow$slambda$slambda_0(this.$this$callbackFlow_1, this.$block_1, this.invalidationEventChannel0__1, null)); this.set_state_rjd8d0_k$(1); suspendResult = awaitClose(this.$this$callbackFlow_1, doorFlow$slambda$lambda(this.invalidationEventChannel0__1, this.$this_doorFlow_1, this.invalidationTrackerObserver1__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(doorFlow$slambda).create_8tn3fw_k$ = function ($this$callbackFlow, completion) { var i = new doorFlow$slambda(this.$this_doorFlow_1, this.$tables_1, this.$block_1, completion); i.$this$callbackFlow_1 = $this$callbackFlow; return i; }; protoOf(doorFlow$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_8tn3fw_k$((!(value == null) ? isInterface(value, ProducerScope) : false) ? value : THROW_CCE(), completion); }; function doorFlow$slambda_0($this_doorFlow, $tables, $block, resultContinuation) { var i = new doorFlow$slambda($this_doorFlow, $tables, $block, resultContinuation); var l = function ($this$callbackFlow, $completion) { return i.invoke_c55cnc_k$($this$callbackFlow, $completion); }; l.$arity = 1; return l; } function _get_hasOutgoingReplicationTable__q0gavr($this) { return $this.hasOutgoingReplicationTable_1; } function _get_outgoingEvents__xz7myu($this) { return $this.outgoingEvents_1; } function _get_createTmpEvtTableAndTriggerOnBeforeTransaction__3384su($this) { return $this.createTmpEvtTableAndTriggerOnBeforeTransaction_1; } function _get_logger__rkp4sl($this) { return $this.logger_1; } function _get_dbName__9h2wvy($this) { return $this.dbName_1; } function _get_logPrefix__aovpcr($this) { return $this.logPrefix_1; } function _get_pendingEvents__jf9gzl($this) { return $this.pendingEvents_1; } function NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' creating SQLite triggers'; }; } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda(results) { return mapRows(results, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda$lambda); } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda$lambda(it) { return new NodeEvent(it.getInt_npc9pd_k$('what'), it.getLong_3wgf2g_k$('toNode'), it.getInt_npc9pd_k$('tableId'), it.getLong_3wgf2g_k$('key1'), it.getLong_3wgf2g_k$('key2'), it.getLong_3wgf2g_k$('key3'), it.getLong_3wgf2g_k$('key4')); } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this$0, $events) { return function () { return this$0.logPrefix_1 + ' found ' + $events.get_size_woubt6_k$() + ' new events = ' + joinToString($events); }; } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this$0, $events) { return function () { return this$0.logPrefix_1 + ' emitting ' + $events.get_size_woubt6_k$() + ' events ' + joinToString($events) + ' '; }; } function $onBeforeTransactionAsyncCOROUTINE$2(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.readOnly_1 = readOnly; this.connection_1 = connection; this.transactionId_1 = transactionId; } protoOf($onBeforeTransactionAsyncCOROUTINE$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$(3); if (this.readOnly_1) return Unit_getInstance(); if (this._this__u8e3s4__1.createTmpEvtTableAndTriggerOnBeforeTransaction_1) { v(this._this__u8e3s4__1.logger_1, VOID, NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this._this__u8e3s4__1)); this.set_state_rjd8d0_k$(1); suspendResult = createNodeEventTableAndTrigger(this.connection_1, this._this__u8e3s4__1.hasOutgoingReplicationTable_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(2); continue $sm; } case 1: 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 $onAfterTransactionAsyncCOROUTINE$3(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.readOnly_1 = readOnly; this.connection_1 = connection; this.transactionId_1 = transactionId; } protoOf($onAfterTransactionAsyncCOROUTINE$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$(19); if (this.readOnly_1) return Unit_getInstance(); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this.connection_1.prepareStatement_f6j8eq_k$(NodeEventConstants_getInstance().get_SELECT_EVENT_FROM_TMP_TABLE_iqhehc_k$()); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.stmt4__1 = this.this1__1; this.set_state_rjd8d0_k$(4); suspendResult = executeQueryAsyncKmp(this.stmt4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.ARGUMENT5__1 = suspendResult; var tmp_2 = this; tmp_2.tmp$ret$03__1 = useResults(this.ARGUMENT5__1, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda); this.set_exceptionState_fex74n_k$(19); this.set_state_rjd8d0_k$(5); var tmp_3 = this; continue $sm; case 5: this.tmp6__1 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(19); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = this.tmp6__1; this.set_state_rjd8d0_k$(9); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_4 = this.get_exception_x0n6w6_k$(); if (tmp_4 instanceof Exception) { this.e7__1 = this.get_exception_x0n6w6_k$(); var tmp_5 = this; throw this.e7__1; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(19); this.t8__1 = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw this.t8__1; case 8: this.set_exceptionState_fex74n_k$(19); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(9); continue $sm; case 9: this.events9__1 = this.tmp$ret$40__1; v(this._this__u8e3s4__1.logger_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this._this__u8e3s4__1, this.events9__1)); this.set_state_rjd8d0_k$(10); continue $sm; case 10: var tmp_6 = this; tmp_6.this11__1 = this.connection_1.prepareStatement_f6j8eq_k$(NodeEventConstants_getInstance().get_CLEAR_EVENTS_TMP_TABLE_cs4qzf_k$()); this.set_state_rjd8d0_k$(11); continue $sm; case 11: this.set_state_rjd8d0_k$(12); continue $sm; case 12: this.set_exceptionState_fex74n_k$(16); this.set_exceptionState_fex74n_k$(15); var tmp_7 = this; tmp_7.stmt14__1 = this.this11__1; this.set_state_rjd8d0_k$(13); suspendResult = executeUpdateAsyncKmp(this.stmt14__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.tmp$ret$613__1 = suspendResult; this.set_exceptionState_fex74n_k$(19); this.set_state_rjd8d0_k$(14); var tmp_8 = this; continue $sm; case 14: var tmp_9 = this.tmp$ret$613__1; this.set_exceptionState_fex74n_k$(19); this.this11__1.close_yn9xrc_k$(); this.tmp$ret$1010__1 = tmp_9; this.set_state_rjd8d0_k$(18); continue $sm; case 15: this.set_exceptionState_fex74n_k$(16); var tmp_10 = this.get_exception_x0n6w6_k$(); if (tmp_10 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_11 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 16: this.set_exceptionState_fex74n_k$(19); var t = this.get_exception_x0n6w6_k$(); this.this11__1.close_yn9xrc_k$(); throw t; case 17: this.set_exceptionState_fex74n_k$(19); this.this11__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(10); continue $sm; } this.set_state_rjd8d0_k$(18); continue $sm; case 18: if (!this.events9__1.isEmpty_y1axqb_k$()) { d_0(this._this__u8e3s4__1.logger_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this._this__u8e3s4__1, this.events9__1)); var this_0 = this._this__u8e3s4__1.pendingEvents_1; var key = this.transactionId_1; var value = this.events9__1; this_0.put_4fpzoq_k$(key, value); } return Unit_getInstance(); case 19: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 19) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $onTransactionCommittedAsyncCOROUTINE$4(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.readOnly_1 = readOnly; this.connection_1 = connection; this.transactionId_1 = transactionId; } protoOf($onTransactionCommittedAsyncCOROUTINE$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); if (this.readOnly_1) return Unit_getInstance(); this.tmp0_safe_receiver0__1 = this._this__u8e3s4__1.pendingEvents_1.remove_gppy8k_k$(this.transactionId_1); if (this.tmp0_safe_receiver0__1 == null) { this.WHEN_RESULT1__1 = null; this.set_state_rjd8d0_k$(2); continue $sm; } else { var tmp_0 = this; tmp_0.this2__1 = this.tmp0_safe_receiver0__1; var tmp_1 = this; tmp_1.it3__1 = this.this2__1; this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.outgoingEvents_1.emit_t92u1f_k$(this.it3__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.WHEN_RESULT1__1 = this.this2__1; 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 NodeEventJdbcImplListenerSqlite(hasOutgoingReplicationTable, outgoingEvents, createTmpEvtTableAndTriggerOnBeforeTransaction, logger, dbName) { createTmpEvtTableAndTriggerOnBeforeTransaction = createTmpEvtTableAndTriggerOnBeforeTransaction === VOID ? true : createTmpEvtTableAndTriggerOnBeforeTransaction; this.hasOutgoingReplicationTable_1 = hasOutgoingReplicationTable; this.outgoingEvents_1 = outgoingEvents; this.createTmpEvtTableAndTriggerOnBeforeTransaction_1 = createTmpEvtTableAndTriggerOnBeforeTransaction; this.logger_1 = logger; this.dbName_1 = dbName; this.logPrefix_1 = '[NodeEventJdbcImplListenerSqlite - ' + this.dbName_1 + ']'; this.pendingEvents_1 = concurrentSafeMapOf([]); } protoOf(NodeEventJdbcImplListenerSqlite).onBeforeTransactionAsync_mscshz_k$ = function (readOnly, connection, transactionId, $completion) { var tmp = new $onBeforeTransactionAsyncCOROUTINE$2(this, readOnly, connection, transactionId, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeEventJdbcImplListenerSqlite).onAfterTransactionAsync_hxd2oq_k$ = function (readOnly, connection, transactionId, $completion) { var tmp = new $onAfterTransactionAsyncCOROUTINE$3(this, readOnly, connection, transactionId, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeEventJdbcImplListenerSqlite).onTransactionCommittedAsync_g9ntmy_k$ = function (readOnly, connection, transactionId, $completion) { var tmp = new $onTransactionCommittedAsyncCOROUTINE$4(this, readOnly, connection, transactionId, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeEventJdbcImplListenerSqlite).onBeforeTransaction_dc1qtq_k$ = function (readOnly, connection, transactionId) { }; protoOf(NodeEventJdbcImplListenerSqlite).onAfterTransaction_wlhpxv_k$ = function (readOnly, connection, transactionId) { }; function _get_registered__4jyert($this) { return $this.registered_1; } function DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).invoke_j09www_k$ = function (limit, offset, $completion) { var tmp = this.create_felr1p_k$(limit, offset, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).invoke_4tzzq6_k$ = function (p1, p2, $completion) { var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE(); return this.invoke_j09www_k$(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$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.this$0__1.loadRows_5yyyd5_k$(this.limit_1, this.offset_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(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).create_felr1p_k$ = function (limit, offset, completion) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this.this$0__1, completion); i.limit_1 = limit; i.offset_1 = offset; return i; }; function DoorLimitOffsetPagingSource$initialLoad$slambda$slambda_0(this$0, resultContinuation) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this$0, resultContinuation); var l = function (limit, offset, $completion) { return i.invoke_j09www_k$(limit, offset, $completion); }; l.$arity = 2; return l; } function _get_db__ndbzd9($this) { return $this.db_1; } function _get_tableNames__thvz2n($this) { return $this.tableNames_1; } function _get_itemCount__3sw00l($this) { return $this.itemCount_1; } function _get_invalidated__yx9o7s($this) { return $this.invalidated_1; } function InvalidationTracker($outer) { this.$this_1 = $outer; InvalidationTrackerObserver.call(this, $outer.tableNames_1); this.registered_1 = atomic$boolean$1(false); } protoOf(InvalidationTracker).registerIfNeeded_r64dej_k$ = function () { if (!this.registered_1.atomicfu$getAndSet(true)) { this.$this_1.db_1.get_invalidationTracker_tp0k9d_k$().addWeakObserver_o9vq7s_k$(this); } }; protoOf(InvalidationTracker).onInvalidated_v59v8q_k$ = function (tables) { if (!this.$this_1.invalidated_1.atomicfu$getAndSet(true)) { Napier_getInstance().d$default_a5agxr_k$('DoorLimitOffsetPagingSource: invalidated tables=' + joinToString(tables)); this.$this_1.invalidate_p4aufp_k$(); } }; function _get_invalidationTracker__y5z00n($this) { return $this.invalidationTracker_1; } function initialLoad($this, params, $completion) { var tmp = TransactionMode_READ_ONLY_getInstance(); return withDoorTransactionAsync($this.db_1, tmp, DoorLimitOffsetPagingSource$initialLoad$slambda_0($this, params, null), $completion); } function nonInitialLoad($this, params, tempCount, $completion) { var tmp = new $nonInitialLoadCOROUTINE$5($this, params, tempCount, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function DoorLimitOffsetPagingSource$load$slambda(this$0, $params, resultContinuation) { this.this$0__1 = this$0; this.$params_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$load$slambda).invoke_w2kae3_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(DoorLimitOffsetPagingSource$load$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_w2kae3_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$load$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); this.this$0__1.invalidationTracker_1.registerIfNeeded_r64dej_k$(); this.tmpCount0__1 = this.this$0__1.itemCount_1.get_kotlinx$atomicfu$value_vi2am5_k$(); if (this.tmpCount0__1 === get_INITIAL_ITEM_COUNT()) { this.set_state_rjd8d0_k$(2); suspendResult = initialLoad(this.this$0__1, this.$params_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = nonInitialLoad(this.this$0__1, this.$params_1, this.tmpCount0__1, 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); }; protoOf(DoorLimitOffsetPagingSource$load$slambda).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new DoorLimitOffsetPagingSource$load$slambda(this.this$0__1, this.$params_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(DoorLimitOffsetPagingSource$load$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorLimitOffsetPagingSource$load$slambda_0(this$0, $params, resultContinuation) { var i = new DoorLimitOffsetPagingSource$load$slambda(this$0, $params, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_w2kae3_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function DoorLimitOffsetPagingSource$initialLoad$slambda(this$0, $params, resultContinuation) { this.this$0__1 = this$0; this.$params_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).invoke_hfd4s_k$ = function (it, $completion) { var tmp = this.create_3kxuey_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_hfd4s_k$(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$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$0__1.countRows_kb9fe9_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.tempCount0__1 = suspendResult; this.this$0__1.itemCount_1.set_kotlinx$atomicfu$value_nm6d3_k$(this.tempCount0__1); this.set_state_rjd8d0_k$(2); suspendResult = queryDatabase(this.$params_1, DoorLimitOffsetPagingSource$initialLoad$slambda$slambda_0(this.this$0__1, null), this.tempCount0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: return suspendResult; 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(DoorLimitOffsetPagingSource$initialLoad$slambda).create_3kxuey_k$ = function (it, completion) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda(this.this$0__1, this.$params_1, completion); i.it_1 = it; return i; }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_3kxuey_k$(value instanceof RoomDatabase ? value : THROW_CCE(), completion); }; function DoorLimitOffsetPagingSource$initialLoad$slambda_0(this$0, $params, resultContinuation) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda(this$0, $params, resultContinuation); var l = function (it, $completion) { return i.invoke_hfd4s_k$(it, $completion); }; l.$arity = 1; return l; } function DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).invoke_j09www_k$ = function (limit, offset, $completion) { var tmp = this.create_felr1p_k$(limit, offset, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).invoke_4tzzq6_k$ = function (p1, p2, $completion) { var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE(); return this.invoke_j09www_k$(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$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.this$0__1.loadRows_5yyyd5_k$(this.limit_1, this.offset_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(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).create_felr1p_k$ = function (limit, offset, completion) { var i = new DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this.this$0__1, completion); i.limit_1 = limit; i.offset_1 = offset; return i; }; function DoorLimitOffsetPagingSource$nonInitialLoad$slambda_0(this$0, resultContinuation) { var i = new DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this$0, resultContinuation); var l = function (limit, offset, $completion) { return i.invoke_j09www_k$(limit, offset, $completion); }; l.$arity = 2; return l; } function $nonInitialLoadCOROUTINE$5(_this__u8e3s4, params, tempCount, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.params_1 = params; this.tempCount_1 = tempCount; } protoOf($nonInitialLoadCOROUTINE$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); if (this._this__u8e3s4__1.invalidated_1.get_kotlinx$atomicfu$value_vi2am5_k$()) { var tmp_0 = this; var tmp_1 = get_INVALID(); tmp_0.WHEN_RESULT0__1 = tmp_1 instanceof LoadResult ? tmp_1 : THROW_CCE(); this.set_state_rjd8d0_k$(2); continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = queryDatabase(this.params_1, DoorLimitOffsetPagingSource$nonInitialLoad$slambda_0(this._this__u8e3s4__1, null), this.tempCount_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(2); continue $sm; case 2: return this.WHEN_RESULT0__1; 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 DoorLimitOffsetPagingSource(db, tableNames) { PagingSource.call(this); this.db_1 = db; this.tableNames_1 = tableNames; this.itemCount_1 = atomic$int$1(get_INITIAL_ITEM_COUNT()); this.invalidated_1 = atomic$boolean$1(false); this.invalidationTracker_1 = new InvalidationTracker(this); } protoOf(DoorLimitOffsetPagingSource).load_61715_k$ = function (params, $completion) { var tmp = Dispatchers_getInstance().get_Default_goqax4_k$(); return withContext(tmp, DoorLimitOffsetPagingSource$load$slambda_0(this, params, null), $completion); }; protoOf(DoorLimitOffsetPagingSource).load_tstxu5_k$ = function (params, $completion) { return this.load_61715_k$(params, $completion); }; protoOf(DoorLimitOffsetPagingSource).getRefreshKey_ew6rph_k$ = function (state) { return getClippedRefreshKey(state); }; protoOf(DoorLimitOffsetPagingSource).getRefreshKey_3flma8_k$ = function (state) { return this.getRefreshKey_ew6rph_k$(state); }; function _get_tableNames__thvz2n_0($this) { return $this.tableNames_1; } function _get_observers__lk71bg($this) { return $this.observers_1; } function _get_weakObservers__c6vcd0($this) { return $this.weakObservers_1; } function fireChanges($this, listToFire) { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.v$default_i2q2w7_k$(VOID, tmp_0, InvalidationTracker$fireChanges$lambda(listToFire)); // Inline function 'kotlin.collections.filter' call // Inline function 'kotlin.collections.filterTo' call var this_0 = $this.observers_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 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.any' call var indexedObject = element.get_tables_ju165q_k$(); var inductionVariable = 0; var last = indexedObject.length; while (inductionVariable < last) { var element_0 = indexedObject[inductionVariable]; inductionVariable = inductionVariable + 1 | 0; // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges..' call if (listToFire.contains_aljjnj_k$(element_0)) { tmp$ret$1 = true; break $l$block; } } tmp$ret$1 = false; } if (tmp$ret$1) { destination.add_utx5q5_k$(element); } } var affectedObservers = destination; // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_0 = affectedObservers.iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var element_1 = tmp0_iterator_0.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call element_1.onInvalidated_v59v8q_k$(listToFire); } // Inline function 'kotlin.collections.mapNotNull' call // Inline function 'kotlin.collections.mapNotNullTo' call var this_1 = $this.weakObservers_1; var destination_0 = ArrayList_init_$Create$(); // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_1 = this_1.iterator_jk1svi_k$(); while (tmp0_iterator_1.hasNext_bitz1p_k$()) { var element_2 = tmp0_iterator_1.next_20eer_k$(); // Inline function 'kotlin.collections.mapNotNullTo.' call // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call var observer = element_2.get_26vq_k$(); var tmp_1; var tmp_2; if (!(observer == null)) { var tmp$ret$6; $l$block_0: { // Inline function 'kotlin.collections.any' call var indexedObject_0 = observer.get_tables_ju165q_k$(); var inductionVariable_0 = 0; var last_0 = indexedObject_0.length; while (inductionVariable_0 < last_0) { var element_3 = indexedObject_0[inductionVariable_0]; inductionVariable_0 = inductionVariable_0 + 1 | 0; // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges..' call if (listToFire.contains_aljjnj_k$(element_3)) { tmp$ret$6 = true; break $l$block_0; } } tmp$ret$6 = false; } tmp_2 = tmp$ret$6; } else { tmp_2 = false; } if (tmp_2) { tmp_1 = observer; } else { tmp_1 = null; } var tmp0_safe_receiver = tmp_1; if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call destination_0.add_utx5q5_k$(tmp0_safe_receiver); } } var affectedWeakObservers = destination_0; // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_2 = affectedWeakObservers.iterator_jk1svi_k$(); while (tmp0_iterator_2.hasNext_bitz1p_k$()) { var element_4 = tmp0_iterator_2.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call element_4.onInvalidated_v59v8q_k$(listToFire); } removeAll($this.weakObservers_1, InvalidationTracker$fireChanges$lambda_0); } function Companion_1() { Companion_instance_1 = this; this.UPDATE_TABLE_NAME_1 = 'door_update_mods'; this.TABLE_ID_COLNAME_1 = 'tableId'; this.TABLE_INVALIDATED_COLNAME_1 = 'invalidated'; this.CREATE_TEMP_TABLE_SQL_1 = 'CREATE TEMP TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)'; this.CREATE_TABLE_SQL_1 = 'CREATE TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)'; this.FIND_CHANGED_TABLES_SQL_1 = 'SELECT tableId FROM door_update_mods WHERE invalidated = 1'; this.RESET_CHANGED_TABLES_SQL_1 = '\n UPDATE door_update_mods \n SET invalidated = 0 \n WHERE invalidated = 1\n '; } protoOf(Companion_1).generateCreateTriggersSql_julqud_k$ = function (tableNames, temporary) { var tempStr = temporary ? 'TEMP' : ''; var createTableSql = temporary ? 'CREATE TEMP TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)' : 'CREATE TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)'; var tmp = listOf(createTableSql); // Inline function 'kotlin.collections.mapIndexed' call // Inline function 'kotlin.collections.mapIndexedTo' call var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(tableNames, 10)); var index = 0; var tmp0_iterator = tableNames.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.Companion.generateCreateTriggersSql.' call var tmp1 = index; index = tmp1 + 1 | 0; var tableId = checkIndexOverflow(tmp1); var tmp_0 = listOf('INSERT OR IGNORE INTO door_update_mods (tableId, invalidated) ' + ('VALUES (' + tableId + ', 0)')); // Inline function 'kotlin.collections.map' call var this_0 = listOf_0(['UPDATE', 'INSERT', 'DELETE']); // Inline function 'kotlin.collections.mapTo' call var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator_0 = this_0.iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var item_0 = tmp0_iterator_0.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.Companion.generateCreateTriggersSql..' call var tmp$ret$0 = 'CREATE ' + tempStr + ' TRIGGER IF NOT EXISTS door_mod_trigger_' + item + '_' + item_0 + ' \n AFTER ' + item_0 + '\n ON ' + item + ' \n BEGIN \n UPDATE door_update_mods\n SET invalidated = 1 \n WHERE tableId = ' + tableId + '\n AND invalidated = 0;\n END \n '; destination_0.add_utx5q5_k$(tmp$ret$0); } var tmp$ret$3 = plus(tmp_0, destination_0); destination.add_utx5q5_k$(tmp$ret$3); } return plus(tmp, flatten(destination)); }; protoOf(Companion_1).generateCreateTriggersSql$default_bxjzhb_k$ = function (tableNames, temporary, $super) { temporary = temporary === VOID ? true : temporary; return $super === VOID ? this.generateCreateTriggersSql_julqud_k$(tableNames, temporary) : $super.generateCreateTriggersSql_julqud_k$.call(this, tableNames, temporary); }; protoOf(Companion_1).get_UPDATE_TABLE_NAME_vd737t_k$ = function () { return this.UPDATE_TABLE_NAME_1; }; protoOf(Companion_1).get_TABLE_ID_COLNAME_y553y7_k$ = function () { return this.TABLE_ID_COLNAME_1; }; protoOf(Companion_1).get_TABLE_INVALIDATED_COLNAME_rkwfh7_k$ = function () { return this.TABLE_INVALIDATED_COLNAME_1; }; protoOf(Companion_1).get_CREATE_TEMP_TABLE_SQL_mxkmfo_k$ = function () { return this.CREATE_TEMP_TABLE_SQL_1; }; protoOf(Companion_1).get_CREATE_TABLE_SQL_6ltxib_k$ = function () { return this.CREATE_TABLE_SQL_1; }; protoOf(Companion_1).get_FIND_CHANGED_TABLES_SQL_mlda64_k$ = function () { return this.FIND_CHANGED_TABLES_SQL_1; }; protoOf(Companion_1).get_RESET_CHANGED_TABLES_SQL_g6wri0_k$ = function () { return this.RESET_CHANGED_TABLES_SQL_1; }; var Companion_instance_1; function Companion_getInstance_4() { if (Companion_instance_1 == null) new Companion_1(); return Companion_instance_1; } function InvalidationTracker$fireChanges$lambda($listToFire) { return function () { return '' + ('InvalidationTracker: tables invalidated: ' + joinToString($listToFire)); }; } function InvalidationTracker$fireChanges$lambda_0(it) { return it.get_26vq_k$() == null; } function InvalidationTracker$findChangedTablesOnConnection$lambda$lambda(this$0) { return function (it) { return this$0.tableNames_1.get_c1px32_k$(it.getInt_s8uc8x_k$(1)); }; } function InvalidationTracker$findChangedTablesOnConnection$lambda(this$0) { return function (results) { return mapRows(results, InvalidationTracker$findChangedTablesOnConnection$lambda$lambda(this$0)); }; } function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0) { return function (it) { return this$0.tableNames_1.get_c1px32_k$(it.getInt_s8uc8x_k$(1)); }; } function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this$0) { return function (results) { return mapRows(results, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0)); }; } function $setupSqliteTriggersAsyncCOROUTINE$6(_this__u8e3s4, connection, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.connection_1 = connection; } protoOf($setupSqliteTriggersAsyncCOROUTINE$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$(10); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this.connection_1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(9); this.set_exceptionState_fex74n_k$(8); var tmp_1 = this; tmp_1.stmt4__1 = this.this1__1; var tmp_2 = this; tmp_2.this5__1 = Companion_getInstance_4().generateCreateTriggersSql$default_bxjzhb_k$(this._this__u8e3s4__1.tableNames_1); this.tmp0_iterator6__1 = this.this5__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(4); continue $sm; case 4: if (!this.tmp0_iterator6__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(6); continue $sm; } this.element7__1 = this.tmp0_iterator6__1.next_20eer_k$(); var tmp_3 = this; tmp_3.sql8__1 = this.element7__1; this.set_state_rjd8d0_k$(5); suspendResult = executeUpdateAsync(this.stmt4__1, this.sql8__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: this.set_state_rjd8d0_k$(4); continue $sm; case 6: this.tmp$ret$03__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(10); this.set_state_rjd8d0_k$(7); var tmp_4 = this; continue $sm; case 7: this.set_exceptionState_fex74n_k$(10); var tmp_5 = this; this.this1__1.close_yn9xrc_k$(); tmp_5.tmp$ret$40__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(12); continue $sm; case 8: this.set_exceptionState_fex74n_k$(9); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_7 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 9: this.set_exceptionState_fex74n_k$(10); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 10: throw this.get_exception_x0n6w6_k$(); case 11: this.set_exceptionState_fex74n_k$(10); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(12); continue $sm; case 12: return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 10) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $findChangedTablesOnConnectionAsyncCOROUTINE$7(_this__u8e3s4, connection, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.connection_1 = connection; } protoOf($findChangedTablesOnConnectionAsyncCOROUTINE$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$(17); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this.connection_1.prepareStatement_f6j8eq_k$('SELECT tableId FROM door_update_mods WHERE invalidated = 1'); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.stmt4__1 = this.this1__1; this.set_state_rjd8d0_k$(4); suspendResult = executeQueryAsyncKmp(this.stmt4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.ARGUMENT5__1 = suspendResult; var tmp_2 = this; tmp_2.tmp$ret$03__1 = useResults(this.ARGUMENT5__1, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this._this__u8e3s4__1)); this.set_exceptionState_fex74n_k$(17); this.set_state_rjd8d0_k$(5); var tmp_3 = this; continue $sm; case 5: this.tmp6__1 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(17); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = this.tmp6__1; this.set_state_rjd8d0_k$(9); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_4 = this.get_exception_x0n6w6_k$(); if (tmp_4 instanceof Exception) { this.e7__1 = this.get_exception_x0n6w6_k$(); var tmp_5 = this; throw this.e7__1; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(17); this.t8__1 = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw this.t8__1; case 8: this.set_exceptionState_fex74n_k$(17); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(9); continue $sm; case 9: this.changedTables9__1 = this.tmp$ret$40__1; this.set_state_rjd8d0_k$(10); continue $sm; case 10: var tmp_6 = this; tmp_6.this11__1 = this.connection_1.prepareStatement_f6j8eq_k$('\n UPDATE door_update_mods \n SET invalidated = 0 \n WHERE invalidated = 1\n '); this.set_state_rjd8d0_k$(11); continue $sm; case 11: this.set_state_rjd8d0_k$(12); continue $sm; case 12: this.set_exceptionState_fex74n_k$(16); this.set_exceptionState_fex74n_k$(15); var tmp_7 = this; tmp_7.stmt14__1 = this.this11__1; this.set_state_rjd8d0_k$(13); suspendResult = executeUpdateAsyncKmp(this.stmt14__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.tmp$ret$613__1 = suspendResult; this.set_exceptionState_fex74n_k$(17); this.set_state_rjd8d0_k$(14); var tmp_8 = this; continue $sm; case 14: var tmp_9 = this.tmp$ret$613__1; this.set_exceptionState_fex74n_k$(17); this.this11__1.close_yn9xrc_k$(); this.tmp$ret$1010__1 = tmp_9; this.set_state_rjd8d0_k$(19); continue $sm; case 15: this.set_exceptionState_fex74n_k$(16); var tmp_10 = this.get_exception_x0n6w6_k$(); if (tmp_10 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_11 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 16: this.set_exceptionState_fex74n_k$(17); var t = this.get_exception_x0n6w6_k$(); this.this11__1.close_yn9xrc_k$(); throw t; case 17: throw this.get_exception_x0n6w6_k$(); case 18: this.set_exceptionState_fex74n_k$(17); this.this11__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(10); continue $sm; } this.set_state_rjd8d0_k$(19); continue $sm; case 19: return this.changedTables9__1; } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 17) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function InvalidationTracker_0(tables) { Companion_getInstance_4(); this.tableNames_1 = toList_0(tables); this.observers_1 = concurrentSafeListOf([]); this.weakObservers_1 = concurrentSafeListOf([]); } protoOf(InvalidationTracker_0).addObserver_wpl76o_k$ = function (observer) { // Inline function 'kotlin.collections.plusAssign' call this.observers_1.add_utx5q5_k$(observer); }; protoOf(InvalidationTracker_0).removeObserver_i1cen1_k$ = function (observer) { // Inline function 'kotlin.collections.minusAssign' call this.observers_1.remove_cedx0m_k$(observer); }; protoOf(InvalidationTracker_0).addWeakObserver_o9vq7s_k$ = function (observer) { // Inline function 'kotlin.collections.plusAssign' call var this_0 = this.weakObservers_1; var element = weakRefOf(observer); this_0.add_utx5q5_k$(element); }; protoOf(InvalidationTracker_0).onTablesInvalidated_lvy657_k$ = function (tableNames) { fireChanges(this, tableNames); }; protoOf(InvalidationTracker_0).setupSqliteTriggers_z7aq6z_k$ = function (connection) { $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = connection.createStatement_cbd7tf_k$(); try { var tmp0_iterator = Companion_getInstance_4().generateCreateTriggersSql$default_bxjzhb_k$(this.tableNames_1).iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.setupSqliteTriggers..' call this_0.executeUpdate_k6x04k_k$(element); } break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } } }; protoOf(InvalidationTracker_0).setupSqliteTriggersAsync_6tji8i_k$ = function (connection, $completion) { var tmp = new $setupSqliteTriggersAsyncCOROUTINE$6(this, connection, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(InvalidationTracker_0).findChangedTablesOnConnection_e292jy_k$ = function (connection) { var tmp$ret$1; $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = connection.prepareStatement_f6j8eq_k$('SELECT tableId FROM door_update_mods WHERE invalidated = 1'); try { // Inline function 'com.ustadmobile.door.room.InvalidationTracker.findChangedTablesOnConnection.' call var tmp = this_0.executeQuery_mh7xd9_k$(); tmp$ret$1 = useResults(tmp, InvalidationTracker$findChangedTablesOnConnection$lambda(this)); break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.close_yn9xrc_k$(); } } var changedTables = tmp$ret$1; $l$block_0: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_1 = connection.prepareStatement_f6j8eq_k$('\n UPDATE door_update_mods \n SET invalidated = 0 \n WHERE invalidated = 1\n '); try { // Inline function 'com.ustadmobile.door.room.InvalidationTracker.findChangedTablesOnConnection.' call this_1.executeUpdate_fapcbi_k$(); break $l$block_0; } catch ($p) { if ($p instanceof Exception) { var e_0 = $p; throw e_0; } else { throw $p; } } finally { this_1.close_yn9xrc_k$(); } } return changedTables; }; protoOf(InvalidationTracker_0).findChangedTablesOnConnectionAsync_sc896d_k$ = function (connection, $completion) { var tmp = new $findChangedTablesOnConnectionAsyncCOROUTINE$7(this, connection, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; function InvalidationTrackerObserver(tables) { this.tables_1 = tables; } protoOf(InvalidationTrackerObserver).get_tables_ju165q_k$ = function () { return this.tables_1; }; function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda($connectionLogPrefix, $t, $transactionStartTime) { return function () { return $connectionLogPrefix + ' : cancelled ' + $t.message + ' after ' + systemTimeInMillis().minus_mfbszm_k$($transactionStartTime).toString() + 'ms'; }; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda($block, $transactionContext, resultContinuation) { this.$block_1 = $block; this.$transactionContext_1 = $transactionContext; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).invoke_nd4u9n_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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_nd4u9n_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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.$block_1(this.$transactionContext_1.connection_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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda(this.$block_1, this.$transactionContext_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_0($block, $transactionContext, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda($block, $transactionContext, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_nd4u9n_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this$0, $readOnly, $block, resultContinuation) { this.this$0__1 = this$0; this.$readOnly_1 = $readOnly; this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).invoke_nd4u9n_k$ = function ($this$withTimeout, $completion) { var tmp = this.create_rcuf4x_k$($this$withTimeout, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_nd4u9n_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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$(6); var tmp_0 = this; tmp_0.this0__1 = this.this$0__1.sqliteMutex_1; var tmp_1 = this; tmp_1.owner1__1 = null; this.set_state_rjd8d0_k$(1); suspendResult = this.this0__1.lock_ugrcvf_k$(this.owner1__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(3); suspendResult = useNewConnectionAsyncInternal(this.this$0__1, this.$readOnly_1, this.$block_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.tmp$ret$02__1 = suspendResult; this.set_exceptionState_fex74n_k$(6); this.set_state_rjd8d0_k$(4); continue $sm; case 4: var tmp_2 = this.tmp$ret$02__1; this.set_exceptionState_fex74n_k$(6); this.this0__1.unlock_ulcrcl_k$(this.owner1__1); return tmp_2; case 5: this.set_exceptionState_fex74n_k$(6); var t = this.get_exception_x0n6w6_k$(); this.this0__1.unlock_ulcrcl_k$(this.owner1__1); throw t; case 6: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 6) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).create_rcuf4x_k$ = function ($this$withTimeout, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this.this$0__1, this.$readOnly_1, this.$block_1, completion); i.$this$withTimeout_1 = $this$withTimeout; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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 RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_2(this$0, $readOnly, $block, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this$0, $readOnly, $block, resultContinuation); var l = function ($this$withTimeout, $completion) { return i.invoke_nd4u9n_k$($this$withTimeout, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this$0, $readOnly, $block, resultContinuation) { this.this$0__1 = this$0; this.$readOnly_1 = $readOnly; this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).invoke_nd4u9n_k$ = function ($this$withTimeout, $completion) { var tmp = this.create_rcuf4x_k$($this$withTimeout, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_nd4u9n_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_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); this.set_state_rjd8d0_k$(1); suspendResult = useNewConnectionAsyncInternal(this.this$0__1, this.$readOnly_1, 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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).create_rcuf4x_k$ = function ($this$withTimeout, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this.this$0__1, this.$readOnly_1, this.$block_1, completion); i.$this$withTimeout_1 = $this$withTimeout; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_4(this$0, $readOnly, $block, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this$0, $readOnly, $block, resultContinuation); var l = function ($this$withTimeout, $completion) { return i.invoke_nd4u9n_k$($this$withTimeout, $completion); }; l.$arity = 1; return l; } function _get_tableNames__thvz2n_1($this) { return $this.tableNames_1; } function _get_transactionIdAtomic__5082jx($this) { return $this.transactionIdAtomic_1; } function _get_openTransactions__d41e5o($this) { return $this.openTransactions_1; } function _get_listeners__760gzy($this) { return $this.listeners_1; } function _set_closed__kdb0et($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1($this) { return $this.closed_1; } function Listener() { } function TransactionElement(key, connection, transactionId, readOnly) { transactionId = transactionId === VOID ? 0 : transactionId; this.key_1 = key; this.connection_1 = connection; this.transactionId_1 = transactionId; this.readOnly_1 = readOnly; } protoOf(TransactionElement).get_key_18j28a_k$ = function () { return this.key_1; }; protoOf(TransactionElement).get_connection_x01z89_k$ = function () { return this.connection_1; }; protoOf(TransactionElement).get_transactionId_674h9s_k$ = function () { return this.transactionId_1; }; protoOf(TransactionElement).get_readOnly_ovku97_k$ = function () { return this.readOnly_1; }; function useNewConnectionAsyncInternal($this, readOnly, block, $completion) { var tmp = new $useNewConnectionAsyncInternalCOROUTINE$8($this, readOnly, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function Key_0() { Key_instance = this; } var Key_instance; function Key_getInstance() { if (Key_instance == null) new Key_0(); return Key_instance; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda($connectionLogPrefix, $readOnly) { return function () { return $connectionLogPrefix + ' - start readOnly=' + $readOnly; }; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_0($connectionLogPrefix) { return function () { return $connectionLogPrefix + ': creating SQLite change triggers '; }; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda($block, $transactionElement, resultContinuation) { this.$block_1 = $block; this.$transactionElement_1 = $transactionElement; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).invoke_nd4u9n_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(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_nd4u9n_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$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.$transactionElement_1.connection_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(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda(this.$block_1, this.$transactionElement_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_0($block, $transactionElement, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda($block, $transactionElement, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_nd4u9n_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_1($connectionLogPrefix, $changes) { return function () { return $connectionLogPrefix + ': SQLite Change Tracker: Changed tables=[' + joinToString($changes) + ']'; }; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_2($connectionLogPrefix) { return function () { return $connectionLogPrefix + ' committed changes'; }; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this$0, $changedTables, resultContinuation) { this.this$0__1 = this$0; this.$changedTables_1 = $changedTables; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).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(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$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.this$0__1.invalidationTracker_1.onTablesInvalidated_lvy657_k$(toSet(this.$changedTables_1)); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this.this$0__1, this.$changedTables_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_2(this$0, $changedTables, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this$0, $changedTables, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation) { this.$t_1 = $t; this.this$0__1 = this$0; this.$connectionLogPrefix_1 = $connectionLogPrefix; this.$connection_1 = $connection; this.$readOnly_1 = $readOnly; this.$connectionId_1 = $connectionId; this.$transactionStartTime_1 = $transactionStartTime; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).invoke_d9fzmj_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(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_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$(4); var tmp_0 = this.$t_1; if (tmp_0 instanceof CancellationException) { v(this.this$0__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda(this.$connectionLogPrefix_1, this.$t_1, this.$transactionStartTime_1)); } else { e(this.this$0__1.logger_1, this.$connectionLogPrefix_1 + ' exception ', this.$t_1); } if (!this.$connection_1.isClosed_baxhhm_k$() ? !this.$readOnly_1 : false) { i(this.this$0__1.logger_1, this.$connectionLogPrefix_1 + ' Attempting to rollback transaction #' + this.$connectionId_1); var tmp_1 = this.$connection_1; if (isInterface(tmp_1, ConnectionAsync)) { this.set_state_rjd8d0_k$(1); suspendResult = this.$connection_1.rollbackAsync_usrhnj_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.$connection_1.rollback_r7r9ck_k$(); this.set_state_rjd8d0_k$(2); continue $sm; } } else { this.set_state_rjd8d0_k$(3); continue $sm; } case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: i(this.this$0__1.logger_1, this.$connectionLogPrefix_1 + ' Rolled back changes'); 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_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 4) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3(this.$t_1, this.this$0__1, this.$connectionLogPrefix_1, this.$connection_1, this.$readOnly_1, this.$connectionId_1, this.$transactionStartTime_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_4($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_d9fzmj_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3($connectionLogPrefix, $connectionId) { return function () { return $connectionLogPrefix + ': end transaction #' + $connectionId; }; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this$0, $readOnly, $block, resultContinuation) { this.this$0__1 = this$0; this.$readOnly_1 = $readOnly; this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).invoke_nd4u9n_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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_nd4u9n_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$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); this.transactionContext0__1 = this.$this$withContext_1.get_coroutineContext_115oqo_k$().get_y2st91_k$(Key_getInstance()); var tmp_0 = this; var tmp_1 = get_rootDatabase(this.this$0__1.db_1); tmp_0.dbQueryTimeoutMs1__1 = toLong(imul((isInterface(tmp_1, DoorDatabaseJdbc) ? tmp_1 : THROW_CCE()).get_jdbcQueryTimeout_rk5wkj_k$(), 1000)); if (!(this.transactionContext0__1 == null)) { if (this.transactionContext0__1.readOnly_1 ? !this.$readOnly_1 : false) { throw IllegalStateException_init_$Create$('Current transaction context is read-only'); } this.set_state_rjd8d0_k$(3); suspendResult = withContext(this.transactionContext0__1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_0(this.$block_1, this.transactionContext0__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { if (this.this$0__1.dbType_1 === Companion_getInstance_6().get_SQLITE_3yc5jp_k$()) { this.set_state_rjd8d0_k$(2); suspendResult = withTimeout(this.dbQueryTimeoutMs1__1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_2(this.this$0__1, this.$readOnly_1, this.$block_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(1); suspendResult = withTimeout(this.dbQueryTimeoutMs1__1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_4(this.this$0__1, this.$readOnly_1, this.$block_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } } case 1: this.WHEN_RESULT2__1 = suspendResult; this.set_state_rjd8d0_k$(4); continue $sm; case 2: this.WHEN_RESULT2__1 = suspendResult; this.set_state_rjd8d0_k$(4); continue $sm; case 3: this.WHEN_RESULT2__1 = suspendResult; this.set_state_rjd8d0_k$(4); continue $sm; case 4: return this.WHEN_RESULT2__1; 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(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).create_rcuf4x_k$ = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this.this$0__1, this.$readOnly_1, this.$block_1, completion); i.$this$withContext_1 = $this$withContext; return i; }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda_0(this$0, $readOnly, $block, resultContinuation) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this$0, $readOnly, $block, resultContinuation); var l = function ($this$withContext, $completion) { return i.invoke_nd4u9n_k$($this$withContext, $completion); }; l.$arity = 1; return l; } function $useNewConnectionAsyncInternalCOROUTINE$8(_this__u8e3s4, readOnly, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.readOnly_1 = readOnly; this.block_1 = block; } protoOf($useNewConnectionAsyncInternalCOROUTINE$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$(28); this._this__u8e3s4__1.assertNotClosed_modxnt_k$(); this.connection0__1 = this._this__u8e3s4__1.dataSource_1.getConnection_hr2oto_k$(); this.connectionId1__1 = this._this__u8e3s4__1.transactionIdAtomic_1.atomicfu$incrementAndGet(); this.connectionLogPrefix2__1 = this._this__u8e3s4__1.logPrefix_1 + ' - useNewConnectionAsyncInternal connection #' + this.connectionId1__1 + ' '; v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda(this.connectionLogPrefix2__1, this.readOnly_1)); if (!this.readOnly_1) { var tmp_0 = this.connection0__1; if (isInterface(tmp_0, ConnectionAsync)) { this.set_state_rjd8d0_k$(1); suspendResult = this.connection0__1.setAutoCommitAsync_dpyye2_k$(false, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.connection0__1.setAutoCommit_yh8u8d_k$(false); this.set_state_rjd8d0_k$(2); continue $sm; } } else { this.set_state_rjd8d0_k$(3); continue $sm; } case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.transactionStartTime3__1 = systemTimeInMillis(); this.changedTables4__1 = mutableLinkedListOf_0([]); this.set_state_rjd8d0_k$(4); continue $sm; case 4: this.set_state_rjd8d0_k$(5); continue $sm; case 5: this.set_exceptionState_fex74n_k$(27); this.set_exceptionState_fex74n_k$(24); if (!this.readOnly_1 ? this._this__u8e3s4__1.dbType_1 === Companion_getInstance_6().get_SQLITE_3yc5jp_k$() : false) { v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_0(this.connectionLogPrefix2__1)); this.set_state_rjd8d0_k$(6); suspendResult = this._this__u8e3s4__1.setupSqliteTriggersAsync_ncp3ds_k$(this.connection0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(7); continue $sm; } case 6: this.set_state_rjd8d0_k$(7); continue $sm; case 7: this.transactionElement7__1 = new TransactionElement(Key_getInstance(), this.connection0__1, this.connectionId1__1, this.readOnly_1); var this_0 = this._this__u8e3s4__1.openTransactions_1; var key = this.connectionId1__1; var value = this.transactionElement7__1; this_0.put_4fpzoq_k$(key, value); var tmp_1 = this; tmp_1.this8__1 = this._this__u8e3s4__1.listeners_1; this.tmp0_iterator9__1 = this.this8__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(8); continue $sm; case 8: if (!this.tmp0_iterator9__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(10); continue $sm; } this.element10__1 = this.tmp0_iterator9__1.next_20eer_k$(); var tmp_2 = this; tmp_2.it11__1 = this.element10__1; this.set_state_rjd8d0_k$(9); suspendResult = this.it11__1.onBeforeTransactionAsync_mscshz_k$(this.readOnly_1, this.connection0__1, this.connectionId1__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 9: this.set_state_rjd8d0_k$(8); continue $sm; case 10: this.set_state_rjd8d0_k$(11); suspendResult = withContext(this.transactionElement7__1, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_0(this.block_1, this.transactionElement7__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 11: this.result12__1 = suspendResult; if (!this.readOnly_1 ? this._this__u8e3s4__1.dbType_1 === Companion_getInstance_6().get_SQLITE_3yc5jp_k$() : false) { this.set_state_rjd8d0_k$(12); suspendResult = this._this__u8e3s4__1.invalidationTracker_1.findChangedTablesOnConnectionAsync_sc896d_k$(this.connection0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(13); continue $sm; } case 12: this.changes13__1 = suspendResult; d_0(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_1(this.connectionLogPrefix2__1, this.changes13__1)); this.changedTables4__1.addAll_4lagoh_k$(this.changes13__1); this.set_state_rjd8d0_k$(13); continue $sm; case 13: var tmp_3 = this; tmp_3.this14__1 = this._this__u8e3s4__1.listeners_1; this.tmp0_iterator15__1 = this.this14__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(14); continue $sm; case 14: if (!this.tmp0_iterator15__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(16); continue $sm; } this.element16__1 = this.tmp0_iterator15__1.next_20eer_k$(); var tmp_4 = this; tmp_4.it17__1 = this.element16__1; this.set_state_rjd8d0_k$(15); suspendResult = this.it17__1.onAfterTransactionAsync_hxd2oq_k$(this.readOnly_1, this.connection0__1, this.connectionId1__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 15: this.set_state_rjd8d0_k$(14); continue $sm; case 16: if (!this.readOnly_1) { var tmp_5 = this.connection0__1; if (isInterface(tmp_5, ConnectionAsync)) { this.set_state_rjd8d0_k$(17); suspendResult = this.connection0__1.commitAsync_wepez2_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.connection0__1.commit_vpt10n_k$(); this.set_state_rjd8d0_k$(18); continue $sm; } } else { this.set_state_rjd8d0_k$(19); continue $sm; } case 17: this.set_state_rjd8d0_k$(18); continue $sm; case 18: v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_2(this.connectionLogPrefix2__1)); this.set_state_rjd8d0_k$(19); continue $sm; case 19: var tmp_6 = this; tmp_6.this18__1 = this._this__u8e3s4__1.listeners_1; this.tmp0_iterator19__1 = this.this18__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(20); continue $sm; case 20: if (!this.tmp0_iterator19__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(22); continue $sm; } this.element20__1 = this.tmp0_iterator19__1.next_20eer_k$(); var tmp_7 = this; tmp_7.it21__1 = this.element20__1; this.set_state_rjd8d0_k$(21); suspendResult = this.it21__1.onTransactionCommittedAsync_g9ntmy_k$(this.readOnly_1, this.connection0__1, this.connectionId1__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 21: this.set_state_rjd8d0_k$(20); continue $sm; case 22: var this_1 = this._this__u8e3s4__1.scope_1; var tmp_8; if (!this.changedTables4__1.isEmpty_y1axqb_k$()) { tmp_8 = this_1; } else { tmp_8 = null; } var tmp0_safe_receiver = tmp_8; if (tmp0_safe_receiver == null) null; else { launch(tmp0_safe_receiver, VOID, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_2(this._this__u8e3s4__1, this.changedTables4__1, null)); } this.tmp$ret$06__1 = this.result12__1; this.set_exceptionState_fex74n_k$(28); this.set_state_rjd8d0_k$(23); var tmp_9 = this; continue $sm; case 23: this.tmp22__1 = this.tmp$ret$06__1; this.set_exceptionState_fex74n_k$(28); this.connection0__1.close_yn9xrc_k$(); this._this__u8e3s4__1.openTransactions_1.remove_gppy8k_k$(this.connectionId1__1); v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.connectionLogPrefix2__1, this.connectionId1__1)); if (!this._this__u8e3s4__1.openTransactions_1.isEmpty_y1axqb_k$()) { w_0(this._this__u8e3s4__1.logger_1, 'useConnectionAsync: close transaction ' + this.connectionId1__1 + ' (took ' + systemTimeInMillis().minus_mfbszm_k$(this.transactionStartTime3__1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this._this__u8e3s4__1.openTransactions_1.get_keys_wop4xp_k$()) + '] pending async transactions still open.')); } return this.tmp22__1; case 24: this.set_exceptionState_fex74n_k$(27); var tmp_10 = this.get_exception_x0n6w6_k$(); if (tmp_10 instanceof Error) { this.t23__1 = this.get_exception_x0n6w6_k$(); this.set_state_rjd8d0_k$(25); var tmp_11 = NonCancellable_getInstance(); suspendResult = withContext(tmp_11, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_4(this.t23__1, this._this__u8e3s4__1, this.connectionLogPrefix2__1, this.connection0__1, this.readOnly_1, this.connectionId1__1, this.transactionStartTime3__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw this.get_exception_x0n6w6_k$(); } case 25: var tmp_12 = this; throw this.t23__1; case 26: this.set_exceptionState_fex74n_k$(28); this.connection0__1.close_yn9xrc_k$(); this._this__u8e3s4__1.openTransactions_1.remove_gppy8k_k$(this.connectionId1__1); v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.connectionLogPrefix2__1, this.connectionId1__1)); if (!this._this__u8e3s4__1.openTransactions_1.isEmpty_y1axqb_k$()) { w_0(this._this__u8e3s4__1.logger_1, 'useConnectionAsync: close transaction ' + this.connectionId1__1 + ' (took ' + systemTimeInMillis().minus_mfbszm_k$(this.transactionStartTime3__1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this._this__u8e3s4__1.openTransactions_1.get_keys_wop4xp_k$()) + '] pending async transactions still open.')); } return Unit_getInstance(); case 27: this.set_exceptionState_fex74n_k$(28); var t = this.get_exception_x0n6w6_k$(); this.connection0__1.close_yn9xrc_k$(); this._this__u8e3s4__1.openTransactions_1.remove_gppy8k_k$(this.connectionId1__1); v(this._this__u8e3s4__1.logger_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.connectionLogPrefix2__1, this.connectionId1__1)); if (!this._this__u8e3s4__1.openTransactions_1.isEmpty_y1axqb_k$()) { w_0(this._this__u8e3s4__1.logger_1, 'useConnectionAsync: close transaction ' + this.connectionId1__1 + ' (took ' + systemTimeInMillis().minus_mfbszm_k$(this.transactionStartTime3__1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this._this__u8e3s4__1.openTransactions_1.get_keys_wop4xp_k$()) + '] pending async transactions still open.')); } throw t; case 28: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 28) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function RoomDatabaseJdbcImplHelperCommon(dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType, dispatcher) { Key_getInstance(); dbType = dbType === VOID ? Companion_getInstance_6().get_SQLITE_3yc5jp_k$() : dbType; dispatcher = dispatcher === VOID ? Dispatchers_getInstance().get_Default_goqax4_k$() : dispatcher; this.dataSource_1 = dataSource; this.db_1 = db; this.dbName_1 = dbName; this.logger_1 = logger; this.tableNames_1 = tableNames; this.invalidationTracker_1 = invalidationTracker; this.dbType_1 = dbType; this.transactionIdAtomic_1 = atomic$int$1(0); this.openTransactions_1 = concurrentSafeMapOf([]); this.sqliteMutex_1 = Mutex(); this.listeners_1 = concurrentSafeListOf([]); this.closed_1 = atomic$boolean$1(false); this.logPrefix_1 = '[RoomJdbcImplHelper - ' + this.dbName_1 + ']'; this.scope_1 = CoroutineScope_0(dispatcher.plus_s13ygv_k$(Job())); } protoOf(RoomDatabaseJdbcImplHelperCommon).get_dataSource_vce0e_k$ = function () { return this.dataSource_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_db_knto1l_k$ = function () { return this.db_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_dbName_c9i0qa_k$ = function () { return this.dbName_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_logger_g9gejd_k$ = function () { return this.logger_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_invalidationTracker_tp0k9d_k$ = function () { return this.invalidationTracker_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_dbType_c9mcip_k$ = function () { return this.dbType_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_sqliteMutex_j9dq52_k$ = function () { return this.sqliteMutex_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_logPrefix_vopxo3_k$ = function () { return this.logPrefix_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).get_scope_iyfcq3_k$ = function () { return this.scope_1; }; protoOf(RoomDatabaseJdbcImplHelperCommon).assertNotClosed_modxnt_k$ = function () { if (this.closed_1.get_kotlinx$atomicfu$value_vi2am5_k$()) throw IllegalStateException_init_$Create$('' + this + ' is closed!'); }; protoOf(RoomDatabaseJdbcImplHelperCommon).useConnectionAsync_98htgj_k$ = function (readOnly, block, $completion) { var tmp = this.scope_1.get_coroutineContext_115oqo_k$(); return withContext(tmp, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda_0(this, readOnly, block, null), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon).useConnectionAsync_y1du5w_k$ = function (block, $completion) { return this.useConnectionAsync_98htgj_k$(false, block, $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon).addListener_xad3hi_k$ = function (listener) { // Inline function 'kotlin.collections.plusAssign' call this.listeners_1.add_utx5q5_k$(listener); }; protoOf(RoomDatabaseJdbcImplHelperCommon).removeListener_iok9nb_k$ = function (listener) { // Inline function 'kotlin.collections.minusAssign' call this.listeners_1.remove_cedx0m_k$(listener); }; protoOf(RoomDatabaseJdbcImplHelperCommon).onStartChangeTracking_lhwimy_k$ = function () { }; protoOf(RoomDatabaseJdbcImplHelperCommon).close_yn9xrc_k$ = function () { if (!this.closed_1.atomicfu$getAndSet(true)) { // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.iterator' call var tmp0_iterator = this.openTransactions_1.get_entries_p20ztl_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.room.RoomDatabaseJdbcImplHelperCommon.close.' call try { element.get_value_j01efc_k$().connection_1.close_yn9xrc_k$(); } catch ($p) { if ($p instanceof Exception) { var e = $p; w_0(this.logger_1, this.logPrefix_1 + ' : exception closing connection for transaction #' + element.get_key_18j28a_k$()); } else { throw $p; } } } this.openTransactions_1.clear_j9egeb_k$(); this.onClose_84idtj_k$(); cancel(this.scope_1, 'Database closed'); } }; protoOf(RoomDatabaseJdbcImplHelperCommon).onClose_84idtj_k$ = function () { }; function RoomJdbcImpl() { } function dropDoorTriggersAndReceiveViewsSqlite(_this__u8e3s4, $completion) { var tmp = new $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function getSqliteDoorTriggerNames(_this__u8e3s4, $completion) { var tmp = new $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function getSqliteDoorReceiveViewNames(_this__u8e3s4, $completion) { var tmp = new $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function getSqliteDoorTriggerNames$lambda(results) { return mapRows(results, getSqliteDoorTriggerNames$lambda$lambda); } function getSqliteDoorTriggerNames$lambda$lambda(resultSet) { return resultSet.getString_5demq7_k$(1); } function getSqliteDoorReceiveViewNames$lambda(results) { return mapRows(results, getSqliteDoorReceiveViewNames$lambda$lambda); } function getSqliteDoorReceiveViewNames$lambda$lambda(resultSet) { return resultSet.getString_5demq7_k$(1); } function $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$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$(25); this.set_state_rjd8d0_k$(1); suspendResult = getSqliteDoorTriggerNames(this._this__u8e3s4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.triggerNames0__1 = suspendResult; this.set_state_rjd8d0_k$(2); continue $sm; case 2: var tmp_0 = this; tmp_0.this2__1 = this._this__u8e3s4__1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_state_rjd8d0_k$(4); continue $sm; case 4: this.set_exceptionState_fex74n_k$(10); this.set_exceptionState_fex74n_k$(9); var tmp_1 = this; tmp_1.stmt5__1 = this.this2__1; var tmp_2 = this; tmp_2.this6__1 = this.triggerNames0__1; this.tmp0_iterator7__1 = this.this6__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(5); continue $sm; case 5: if (!this.tmp0_iterator7__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(7); continue $sm; } this.element8__1 = this.tmp0_iterator7__1.next_20eer_k$(); var tmp_3 = this; tmp_3.triggerName9__1 = this.element8__1; this.set_state_rjd8d0_k$(6); suspendResult = executeUpdateAsync(this.stmt5__1, 'DROP TRIGGER ' + this.triggerName9__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 6: this.set_state_rjd8d0_k$(5); continue $sm; case 7: this.tmp$ret$04__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(25); this.set_state_rjd8d0_k$(8); var tmp_4 = this; continue $sm; case 8: this.set_exceptionState_fex74n_k$(25); var tmp_5 = this; this.this2__1.close_yn9xrc_k$(); tmp_5.tmp$ret$41__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(12); continue $sm; case 9: this.set_exceptionState_fex74n_k$(10); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { this.e10__1 = this.get_exception_x0n6w6_k$(); var tmp_7 = this; throw this.e10__1; } else { throw this.get_exception_x0n6w6_k$(); } case 10: this.set_exceptionState_fex74n_k$(25); this.t11__1 = this.get_exception_x0n6w6_k$(); this.this2__1.close_yn9xrc_k$(); throw this.t11__1; case 11: this.set_exceptionState_fex74n_k$(25); this.this2__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(2); continue $sm; } this.set_state_rjd8d0_k$(12); continue $sm; case 12: this.set_state_rjd8d0_k$(13); suspendResult = getSqliteDoorReceiveViewNames(this._this__u8e3s4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.receiveViewNames12__1 = suspendResult; this.set_state_rjd8d0_k$(14); continue $sm; case 14: var tmp_8 = this; tmp_8.this14__1 = this._this__u8e3s4__1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(15); continue $sm; case 15: this.set_state_rjd8d0_k$(16); continue $sm; case 16: this.set_exceptionState_fex74n_k$(22); this.set_exceptionState_fex74n_k$(21); var tmp_9 = this; tmp_9.it17__1 = this.this14__1; var tmp_10 = this; tmp_10.this18__1 = this.receiveViewNames12__1; this.tmp0_iterator19__1 = this.this18__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(17); continue $sm; case 17: if (!this.tmp0_iterator19__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(19); continue $sm; } this.element20__1 = this.tmp0_iterator19__1.next_20eer_k$(); var tmp_11 = this; tmp_11.receiveViewName21__1 = this.element20__1; this.set_state_rjd8d0_k$(18); suspendResult = executeUpdateAsync(this.it17__1, 'DROP VIEW ' + this.receiveViewName21__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 18: this.set_state_rjd8d0_k$(17); continue $sm; case 19: this.tmp$ret$616__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(25); this.set_state_rjd8d0_k$(20); var tmp_12 = this; continue $sm; case 20: this.set_exceptionState_fex74n_k$(25); var tmp_13 = this; this.this14__1.close_yn9xrc_k$(); tmp_13.tmp$ret$1013__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(24); continue $sm; case 21: this.set_exceptionState_fex74n_k$(22); var tmp_14 = this.get_exception_x0n6w6_k$(); if (tmp_14 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_15 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 22: this.set_exceptionState_fex74n_k$(25); var t = this.get_exception_x0n6w6_k$(); this.this14__1.close_yn9xrc_k$(); throw t; case 23: this.set_exceptionState_fex74n_k$(25); this.this14__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(14); continue $sm; } this.set_state_rjd8d0_k$(24); continue $sm; case 24: return Unit_getInstance(); case 25: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 25) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($getSqliteDoorTriggerNamesCOROUTINE$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$(8); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.prepareStatement_f6j8eq_k$(TriggerConstants_getInstance().get_SQLITE_SELECT_TRIGGER_NAMES_4rc9qw_k$()); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.preparedStmt4__1 = this.this1__1; this.preparedStmt4__1.setString_2gt7ua_k$(1, Companion_getInstance_10().get_NAME_PREFIX_pvog9p_k$() + '%'); this.set_state_rjd8d0_k$(4); suspendResult = executeQueryAsyncKmp(this.preparedStmt4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; var tmp_2 = this; tmp_2.tmp$ret$03__1 = useResults(ARGUMENT, getSqliteDoorTriggerNames$lambda); this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(5); var tmp_3 = this; continue $sm; case 5: var tmp_4 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = tmp_4; this.set_state_rjd8d0_k$(10); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_5 = this.get_exception_x0n6w6_k$(); if (tmp_5 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_6 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 8: throw this.get_exception_x0n6w6_k$(); case 9: this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(10); continue $sm; case 10: var this_0 = this.tmp$ret$40__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$(); if (element == null) null; else { destination.add_utx5q5_k$(element); } } return destination; } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($getSqliteDoorReceiveViewNamesCOROUTINE$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$(8); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.prepareStatement_f6j8eq_k$(TriggerConstants_getInstance().get_SQLITE_SELECT_VIEW_NAMES_bt69on_k$()); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.preparedStatement4__1 = this.this1__1; this.preparedStatement4__1.setString_2gt7ua_k$(1, '%' + DoorConstants_getInstance().get_RECEIVE_VIEW_SUFFIX_agehja_k$()); this.set_state_rjd8d0_k$(4); suspendResult = executeQueryAsyncKmp(this.preparedStatement4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; var tmp_2 = this; tmp_2.tmp$ret$03__1 = useResults(ARGUMENT, getSqliteDoorReceiveViewNames$lambda); this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(5); var tmp_3 = this; continue $sm; case 5: var tmp_4 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = tmp_4; this.set_state_rjd8d0_k$(10); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_5 = this.get_exception_x0n6w6_k$(); if (tmp_5 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_6 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 8: throw this.get_exception_x0n6w6_k$(); case 9: this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(10); continue $sm; case 10: var this_0 = this.tmp$ret$40__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$(); if (element == null) null; else { destination.add_utx5q5_k$(element); } } return destination; } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function DoorConstants() { DoorConstants_instance = this; this.MIME_TYPE_PLAIN_1 = 'text/plain'; this.MIME_TYPE_JSON_1 = 'application/json'; this.HEADER_DBVERSION_1 = 'door-dbversion'; this.HEADER_NODE_AND_AUTH_1 = 'door-node'; this.HEADER_NODE_ID_1 = 'door-node-id'; this.DBINFO_TABLENAME_1 = '_doorwayinfo'; this.PGSECTION_COMMENT_PREFIX_1 = '/*psql'; this.NOTPGSECTION_COMMENT_PREFIX_1 = '--notpsql'; this.NOTPGSECTION_END_COMMENT_PREFIX_1 = '--endnotpsql'; this.RECEIVE_VIEW_SUFFIX_1 = '_ReceiveView'; this.HEADER_PAGING_END_REACHED_1 = 'door-paging-end-reached'; } protoOf(DoorConstants).get_MIME_TYPE_PLAIN_9lccbr_k$ = function () { return this.MIME_TYPE_PLAIN_1; }; protoOf(DoorConstants).get_MIME_TYPE_JSON_kxfbez_k$ = function () { return this.MIME_TYPE_JSON_1; }; protoOf(DoorConstants).get_HEADER_DBVERSION_wpdj3j_k$ = function () { return this.HEADER_DBVERSION_1; }; protoOf(DoorConstants).get_HEADER_NODE_AND_AUTH_2mchyc_k$ = function () { return this.HEADER_NODE_AND_AUTH_1; }; protoOf(DoorConstants).get_HEADER_NODE_ID_n9vw0f_k$ = function () { return this.HEADER_NODE_ID_1; }; protoOf(DoorConstants).get_DBINFO_TABLENAME_s0l67j_k$ = function () { return this.DBINFO_TABLENAME_1; }; protoOf(DoorConstants).get_PGSECTION_COMMENT_PREFIX_2p1ohg_k$ = function () { return this.PGSECTION_COMMENT_PREFIX_1; }; protoOf(DoorConstants).get_NOTPGSECTION_COMMENT_PREFIX_ilkn8z_k$ = function () { return this.NOTPGSECTION_COMMENT_PREFIX_1; }; protoOf(DoorConstants).get_NOTPGSECTION_END_COMMENT_PREFIX_4igrhr_k$ = function () { return this.NOTPGSECTION_END_COMMENT_PREFIX_1; }; protoOf(DoorConstants).get_RECEIVE_VIEW_SUFFIX_agehja_k$ = function () { return this.RECEIVE_VIEW_SUFFIX_1; }; protoOf(DoorConstants).get_HEADER_PAGING_END_REACHED_l3srwc_k$ = function () { return this.HEADER_PAGING_END_REACHED_1; }; var DoorConstants_instance; function DoorConstants_getInstance() { if (DoorConstants_instance == null) new DoorConstants(); return DoorConstants_instance; } function DoorDatabaseCallback() { } function DoorDatabaseCallbackStatementList() { } function DoorDatabaseCallbackSync() { } function DoorDatabaseJdbc() { } function DoorDatabaseRepository() { } function Companion_2() { Companion_instance_2 = this; this.SUFFIX_1 = '_DoorWrapper'; } protoOf(Companion_2).get_SUFFIX_40ffiy_k$ = function () { return this.SUFFIX_1; }; var Companion_instance_2; function Companion_getInstance_5() { if (Companion_instance_2 == null) new Companion_2(); return Companion_instance_2; } function DoorDatabaseWrapper() { } function Companion_3() { Companion_instance_3 = this; this.SQLITE_1 = 1; this.POSTGRES_1 = 2; this.SUPPORTED_TYPES_1 = listOf_0([1, 2]); this.PRODUCT_NAME_MAP_1 = mapOf([to('PostgreSQL', 2), to('SQLite', 1)]); var tmp = this; // Inline function 'kotlin.collections.map' call var this_0 = this.PRODUCT_NAME_MAP_1.get_keys_wop4xp_k$(); // Inline function 'kotlin.collections.mapTo' call 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$(); // Inline function 'com.ustadmobile.door.Companion.PRODUCT_INT_TO_NAME_MAP.' call var tmp$ret$0 = to(Companion_getInstance_6().PRODUCT_NAME_MAP_1.get_wei43m_k$(item), item); destination.add_utx5q5_k$(tmp$ret$0); } tmp.PRODUCT_INT_TO_NAME_MAP_1 = toMap(destination); } protoOf(Companion_3).get_SQLITE_3yc5jp_k$ = function () { return this.SQLITE_1; }; protoOf(Companion_3).get_POSTGRES_6bxnsu_k$ = function () { return this.POSTGRES_1; }; protoOf(Companion_3).get_SUPPORTED_TYPES_ceyf0f_k$ = function () { return this.SUPPORTED_TYPES_1; }; protoOf(Companion_3).get_PRODUCT_NAME_MAP_1ag7cv_k$ = function () { return this.PRODUCT_NAME_MAP_1; }; protoOf(Companion_3).get_PRODUCT_INT_TO_NAME_MAP_gswr2b_k$ = function () { return this.PRODUCT_INT_TO_NAME_MAP_1; }; protoOf(Companion_3).typeIntFromProductName_o9ohnl_k$ = function (productName) { var tmp0_elvis_lhs = this.PRODUCT_NAME_MAP_1.get_wei43m_k$(productName); return tmp0_elvis_lhs == null ? -1 : tmp0_elvis_lhs; }; protoOf(Companion_3).productNameForDbType_o9war5_k$ = function (dbProductType) { switch (dbProductType) { case 1: return 'SQLite'; case 2: return 'Postgres'; default: return 'UNKNOWN'; } }; var Companion_instance_3; function Companion_getInstance_6() { if (Companion_instance_3 == null) new Companion_3(); return Companion_instance_3; } function DoorDbType() { Companion_getInstance_6(); } function _get_atomicWrapper__u29p93($this) { return $this.atomicWrapper_1; } function nextWrappedTimeAndSeqNum(_this__u8e3s4, $this) { var tmp$ret$5; $l$block: { // Inline function 'kotlinx.atomicfu.updateAndGet' call while (true) { var cur = _this__u8e3s4.get_kotlinx$atomicfu$value_vi2am5_k$(); // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum.' call var lastTimestamp = cur.shr_9fl3wl_k$(32); var lastSeq = cur.and_4spn93_k$(toLong(IntCompanionObject_getInstance().get_MAX_VALUE_54a9lf_k$())); // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.timestamp' call $this.$this_1; // Inline function 'kotlin.Long.minus' call // Inline function 'kotlin.Long.div' call var this_0 = systemTimeInMillis().div_jun7gj_k$(toLong(1000)); var other = 1577836800; var newTimestamp = this_0.minus_mfbszm_k$(toLong(other)); var tmp; if (newTimestamp.compareTo_9jj042_k$(lastTimestamp) > 0) { tmp = new Long(0, 0); } else { // Inline function 'kotlin.Long.plus' call tmp = lastSeq.plus_r93sks_k$(toLong(1)); } var newSeq = tmp; var upd = newTimestamp.shl_bg8if3_k$(32).or_v7fvkl_k$(newSeq); if (_this__u8e3s4.atomicfu$compareAndSet(cur, upd)) { tmp$ret$5 = upd; break $l$block; } } } return tmp$ret$5; } function unwrapTime(_this__u8e3s4, $this) { return _this__u8e3s4.shr_9fl3wl_k$(32); } function unwrapSeqNum(_this__u8e3s4, $this) { return _this__u8e3s4.and_4spn93_k$(toLong(IntCompanionObject_getInstance().get_MAX_VALUE_54a9lf_k$())); } function generateId($this, currentTimestamp, nodeId, seqNum) { return currentTimestamp.shl_bg8if3_k$(32).or_v7fvkl_k$(nodeId.shl_bg8if3_k$(12)).or_v7fvkl_k$(seqNum); } function $nextIdAsyncCOROUTINE$12(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($nextIdAsyncCOROUTINE$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$(3); var tmp_0 = this; this._this__u8e3s4__1.$this_1; var this_0 = this._this__u8e3s4__1.atomicWrapper_1; var tmp$ret$0; l$ret$1: do { while (true) { var cur = this_0.get_kotlinx$atomicfu$value_vi2am5_k$(); var lastTimestamp = cur.shr_9fl3wl_k$(32); var lastSeq = cur.and_4spn93_k$(toLong(IntCompanionObject_getInstance().get_MAX_VALUE_54a9lf_k$())); var this_1 = systemTimeInMillis().div_jun7gj_k$(toLong(1000)); var other = 1577836800; var newTimestamp = this_1.minus_mfbszm_k$(toLong(other)); var tmp_1; if (newTimestamp.compareTo_9jj042_k$(lastTimestamp) > 0) { tmp_1 = new Long(0, 0); } else { tmp_1 = lastSeq.plus_r93sks_k$(toLong(1)); } var newSeq = tmp_1; var upd = newTimestamp.shl_bg8if3_k$(32).or_v7fvkl_k$(newSeq); if (this_0.atomicfu$compareAndSet(cur, upd)) { tmp$ret$0 = upd; break l$ret$1; } } } while (false); tmp_0.nextWrappedId0__1 = tmp$ret$0; this.seqNum1__1 = unwrapSeqNum(this.nextWrappedId0__1, this._this__u8e3s4__1); if (this.seqNum1__1.compareTo_9jj042_k$(toLong(Companion_getInstance_7().MAX_SEQUENCE_1)) < 0) { return generateId(this._this__u8e3s4__1, unwrapTime(this.nextWrappedId0__1, this._this__u8e3s4__1), toLong(this._this__u8e3s4__1.$this_1.get_nodeId_h7ho7a_k$()), this.seqNum1__1); } else { this.set_state_rjd8d0_k$(1); var this_2 = systemTimeInMillis(); suspendResult = delay(numberToLong(1001).minus_mfbszm_k$(this_2.rem_bsnl9o_k$(toLong(1000))), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: return this._this__u8e3s4__1.nextId_hcfceq_k$(); 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 _get_tableKeyManagers__p1qkqc($this) { return $this.tableKeyManagers_1; } function _get_timestamp__6mtu63($this) { // Inline function 'kotlin.Long.minus' call // Inline function 'kotlin.Long.div' call var this_0 = systemTimeInMillis().div_jun7gj_k$(toLong(1000)); var other = 1577836800; return this_0.minus_mfbszm_k$(toLong(other)); } function TablePrimaryKeyManager($outer) { this.$this_1 = $outer; this.atomicWrapper_1 = atomic$long$1(new Long(0, 0)); } protoOf(TablePrimaryKeyManager).nextId_hcfceq_k$ = function () { // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum' call this.$this_1; var this_0 = this.atomicWrapper_1; var tmp$ret$5; $l$block: { // Inline function 'kotlinx.atomicfu.updateAndGet' call while (true) { var cur = this_0.get_kotlinx$atomicfu$value_vi2am5_k$(); // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum.' call var lastTimestamp = cur.shr_9fl3wl_k$(32); var lastSeq = cur.and_4spn93_k$(toLong(IntCompanionObject_getInstance().get_MAX_VALUE_54a9lf_k$())); // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.timestamp' call // Inline function 'kotlin.Long.minus' call // Inline function 'kotlin.Long.div' call var this_1 = systemTimeInMillis().div_jun7gj_k$(toLong(1000)); var other = 1577836800; var newTimestamp = this_1.minus_mfbszm_k$(toLong(other)); var tmp; if (newTimestamp.compareTo_9jj042_k$(lastTimestamp) > 0) { tmp = new Long(0, 0); } else { // Inline function 'kotlin.Long.plus' call tmp = lastSeq.plus_r93sks_k$(toLong(1)); } var newSeq = tmp; var upd = newTimestamp.shl_bg8if3_k$(32).or_v7fvkl_k$(newSeq); if (this_0.atomicfu$compareAndSet(cur, upd)) { tmp$ret$5 = upd; break $l$block; } } } var nextWrappedId = tmp$ret$5; var seqNum = unwrapSeqNum(nextWrappedId, this); if (seqNum.compareTo_9jj042_k$(toLong(Companion_getInstance_7().MAX_SEQUENCE_1)) < 0) { return generateId(this, unwrapTime(nextWrappedId, this), toLong(this.$this_1.get_nodeId_h7ho7a_k$()), seqNum); } else { // Inline function 'kotlin.Long.rem' call var tmp$ret$7 = systemTimeInMillis().rem_bsnl9o_k$(toLong(1000)); waitBlocking(numberToLong(1001).minus_mfbszm_k$(tmp$ret$7)); return this.nextId_hcfceq_k$(); } }; protoOf(TablePrimaryKeyManager).nextIdAsync_lm2pgf_k$ = function ($completion) { var tmp = new $nextIdAsyncCOROUTINE$12(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; function Companion_4() { Companion_instance_4 = this; this.UNUSED_BITS_1 = 1; this.EPOCH_BITS_1 = 31; this.NODE_ID_BITS_1 = 20; this.SEQUENCE_BITS_1 = 12; var tmp = this; // Inline function 'kotlin.math.pow' call var tmp$ret$0 = Math.pow(2.0, 20); tmp.MAX_NODE_ID_1 = numberToInt(tmp$ret$0); var tmp_0 = this; // Inline function 'kotlin.math.pow' call var tmp$ret$1 = Math.pow(2.0, 12); tmp_0.MAX_SEQUENCE_1 = numberToInt(tmp$ret$1); this.CUSTOM_EPOCH_1 = 1577836800; } protoOf(Companion_4).get_UNUSED_BITS_kxk0pm_k$ = function () { return this.UNUSED_BITS_1; }; protoOf(Companion_4).get_EPOCH_BITS_kxgeqt_k$ = function () { return this.EPOCH_BITS_1; }; protoOf(Companion_4).get_NODE_ID_BITS_mde8c6_k$ = function () { return this.NODE_ID_BITS_1; }; protoOf(Companion_4).get_SEQUENCE_BITS_w5d7xh_k$ = function () { return this.SEQUENCE_BITS_1; }; protoOf(Companion_4).get_MAX_NODE_ID_cvq7tg_k$ = function () { return this.MAX_NODE_ID_1; }; protoOf(Companion_4).get_MAX_SEQUENCE_n50rq3_k$ = function () { return this.MAX_SEQUENCE_1; }; protoOf(Companion_4).get_CUSTOM_EPOCH_15c1i4_k$ = function () { return this.CUSTOM_EPOCH_1; }; var Companion_instance_4; function Companion_getInstance_7() { if (Companion_instance_4 == null) new Companion_4(); return Companion_instance_4; } function DoorPrimaryKeyManager$nodeId$delegate$lambda() { return generateDoorNodeId(Companion_getInstance_7().MAX_NODE_ID_1); } function DoorPrimaryKeyManager(tableIdList) { Companion_getInstance_7(); this.tableKeyManagers_1 = threadSafeMapOf([]); var tmp = this; var tmp_0 = LazyThreadSafetyMode_NONE_getInstance(); tmp.nodeId$delegate_1 = lazy(tmp_0, DoorPrimaryKeyManager$nodeId$delegate$lambda); // Inline function 'kotlin.collections.forEach' call var tmp0_iterator = tableIdList.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.' call // Inline function 'kotlin.collections.set' call var this_0 = this.tableKeyManagers_1; var value = new TablePrimaryKeyManager(this); this_0.put_4fpzoq_k$(element, value); } } protoOf(DoorPrimaryKeyManager).get_nodeId_h7ho7a_k$ = function () { // Inline function 'kotlin.getValue' call var this_0 = this.nodeId$delegate_1; nodeId$factory(); return this_0.get_value_j01efc_k$(); }; protoOf(DoorPrimaryKeyManager).nextId_8yjjmy_k$ = function (tableId) { return ensureNotNull(this.tableKeyManagers_1.get_wei43m_k$(tableId)).nextId_hcfceq_k$(); }; protoOf(DoorPrimaryKeyManager).nextIdAsync_kh60wr_k$ = function (tableId, $completion) { return ensureNotNull(this.tableKeyManagers_1.get_wei43m_k$(tableId)).nextIdAsync_lm2pgf_k$($completion); }; function nodeId$factory() { return getPropertyCallableRef('nodeId', 1, KProperty1, function (receiver) { return receiver.get_nodeId_h7ho7a_k$(); }, null); } function _get__baseType__5fda49($this) { return $this._baseType_1; } function JdbcArrayProxyCommon(typeName, objects) { this.typeName_1 = typeName; this.objects_1 = objects; switch (this.typeName_1) { case 'INTEGER': this._baseType_1 = TypesKmp_getInstance().get_INTEGER_pibe8b_k$(); break; case 'VARCHAR': this._baseType_1 = TypesKmp_getInstance().get_VARCHAR_h1w92s_k$(); break; case 'BIGINT': this._baseType_1 = TypesKmp_getInstance().get_BIGINT_47wyyw_k$(); break; case 'SHORT': this._baseType_1 = TypesKmp_getInstance().get_SMALLINT_sw3een_k$(); break; case 'BOOLEAN': this._baseType_1 = TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$(); break; case 'TEXT': this._baseType_1 = TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$(); break; default: throw IllegalStateException_init_$Create$('JdbcArrayProxyCommon: Unsupported type: ' + this.typeName_1); } } protoOf(JdbcArrayProxyCommon).get_typeName_s1eeum_k$ = function () { return this.typeName_1; }; protoOf(JdbcArrayProxyCommon).get_objects_q6k34l_k$ = function () { return this.objects_1; }; protoOf(JdbcArrayProxyCommon).getBaseTypeName_bw8aes_k$ = function () { return this.typeName_1; }; protoOf(JdbcArrayProxyCommon).getBaseType_5w77s1_k$ = function () { return this._baseType_1; }; protoOf(JdbcArrayProxyCommon).getArray_w8c143_k$ = function () { return this; }; function NotSupportedException(message, cause) { message = message === VOID ? null : message; cause = cause === VOID ? null : cause; RuntimeException_init_$Init$(message, cause, this); captureStack(this, NotSupportedException); } function Companion_5() { Companion_instance_5 = this; this.STATEMENT_DEFAULT_TIMEOUT_SECS_1 = 10; } protoOf(Companion_5).get_STATEMENT_DEFAULT_TIMEOUT_SECS_3kojx3_k$ = function () { return this.STATEMENT_DEFAULT_TIMEOUT_SECS_1; }; var Companion_instance_5; function Companion_getInstance_8() { if (Companion_instance_5 == null) new Companion_5(); return Companion_instance_5; } function PreparedStatementConfig(sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly) { Companion_getInstance_8(); hasListParams = hasListParams === VOID ? false : hasListParams; generatedKeys = generatedKeys === VOID ? StatementConstantsKmp_getInstance().get_NO_GENERATED_KEYS_h4ycm1_k$() : generatedKeys; timeoutSeconds = timeoutSeconds === VOID ? 10 : timeoutSeconds; postgreSql = postgreSql === VOID ? null : postgreSql; readOnly = readOnly === VOID ? false : readOnly; this.sql_1 = sql; this.hasListParams_1 = hasListParams; this.generatedKeys_1 = generatedKeys; this.timeoutSeconds_1 = timeoutSeconds; this.postgreSql_1 = postgreSql; this.readOnly_1 = readOnly; } protoOf(PreparedStatementConfig).get_sql_18iw0r_k$ = function () { return this.sql_1; }; protoOf(PreparedStatementConfig).get_hasListParams_eih2hh_k$ = function () { return this.hasListParams_1; }; protoOf(PreparedStatementConfig).get_generatedKeys_rooagq_k$ = function () { return this.generatedKeys_1; }; protoOf(PreparedStatementConfig).get_timeoutSeconds_immndz_k$ = function () { return this.timeoutSeconds_1; }; protoOf(PreparedStatementConfig).get_postgreSql_g1ajst_k$ = function () { return this.postgreSql_1; }; protoOf(PreparedStatementConfig).get_readOnly_ovku97_k$ = function () { return this.readOnly_1; }; protoOf(PreparedStatementConfig).sqlToUse_pxgz0m_k$ = function (dbType) { var tmp; if (dbType === Companion_getInstance_6().get_SQLITE_3yc5jp_k$()) { tmp = this.sql_1; } else { var tmp0_elvis_lhs = this.postgreSql_1; tmp = tmp0_elvis_lhs == null ? this.sql_1 : tmp0_elvis_lhs; } return tmp; }; protoOf(PreparedStatementConfig).component1_7eebsc_k$ = function () { return this.sql_1; }; protoOf(PreparedStatementConfig).component2_7eebsb_k$ = function () { return this.hasListParams_1; }; protoOf(PreparedStatementConfig).component3_7eebsa_k$ = function () { return this.generatedKeys_1; }; protoOf(PreparedStatementConfig).component4_7eebs9_k$ = function () { return this.timeoutSeconds_1; }; protoOf(PreparedStatementConfig).component5_7eebs8_k$ = function () { return this.postgreSql_1; }; protoOf(PreparedStatementConfig).component6_7eebs7_k$ = function () { return this.readOnly_1; }; protoOf(PreparedStatementConfig).copy_15qzo4_k$ = function (sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly) { return new PreparedStatementConfig(sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly); }; protoOf(PreparedStatementConfig).copy$default_wakw15_k$ = function (sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly, $super) { sql = sql === VOID ? this.sql_1 : sql; hasListParams = hasListParams === VOID ? this.hasListParams_1 : hasListParams; generatedKeys = generatedKeys === VOID ? this.generatedKeys_1 : generatedKeys; timeoutSeconds = timeoutSeconds === VOID ? this.timeoutSeconds_1 : timeoutSeconds; postgreSql = postgreSql === VOID ? this.postgreSql_1 : postgreSql; readOnly = readOnly === VOID ? this.readOnly_1 : readOnly; return $super === VOID ? this.copy_15qzo4_k$(sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly) : $super.copy_15qzo4_k$.call(this, sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly); }; protoOf(PreparedStatementConfig).toString = function () { return 'PreparedStatementConfig(sql=' + this.sql_1 + ', hasListParams=' + this.hasListParams_1 + ', generatedKeys=' + this.generatedKeys_1 + ', timeoutSeconds=' + this.timeoutSeconds_1 + ', postgreSql=' + this.postgreSql_1 + ', readOnly=' + this.readOnly_1 + ')'; }; protoOf(PreparedStatementConfig).hashCode = function () { var result = getStringHashCode(this.sql_1); result = imul(result, 31) + getBooleanHashCode(this.hasListParams_1) | 0; result = imul(result, 31) + this.generatedKeys_1 | 0; result = imul(result, 31) + this.timeoutSeconds_1 | 0; result = imul(result, 31) + (this.postgreSql_1 == null ? 0 : getStringHashCode(this.postgreSql_1)) | 0; result = imul(result, 31) + getBooleanHashCode(this.readOnly_1) | 0; return result; }; protoOf(PreparedStatementConfig).equals = function (other) { if (this === other) return true; if (!(other instanceof PreparedStatementConfig)) return false; var tmp0_other_with_cast = other instanceof PreparedStatementConfig ? other : THROW_CCE(); if (!(this.sql_1 === tmp0_other_with_cast.sql_1)) return false; if (!(this.hasListParams_1 === tmp0_other_with_cast.hasListParams_1)) return false; if (!(this.generatedKeys_1 === tmp0_other_with_cast.generatedKeys_1)) return false; if (!(this.timeoutSeconds_1 === tmp0_other_with_cast.timeoutSeconds_1)) return false; if (!(this.postgreSql_1 == tmp0_other_with_cast.postgreSql_1)) return false; if (!(this.readOnly_1 === tmp0_other_with_cast.readOnly_1)) return false; return true; }; function RepositoryConnectivityListener() { } function _get_db__ndbzd9_0($this) { return $this.db_1; } function _get_repoConfig__gylidl($this) { return $this.repoConfig_1; } function _get_connectivityStatusAtomic__jkobhz($this) { return $this.connectivityStatusAtomic_1; } function _get_connectivityListeners__g8so09($this) { return $this.connectivityListeners_1; } function _get_nodeEventManager__cjqgt2($this) { return $this.nodeEventManager_1; } function _get_client__j03y3k($this) { return $this.client_1; } function _get_eventClient__ef4uz8($this) { return $this.eventClient_1; } function RepositoryHelper(db, repoConfig) { this.db_1 = db; this.repoConfig_1 = repoConfig; this.connectivityStatusAtomic_1 = atomic$int$1(0); this.connectivityListeners_1 = concurrentSafeListOf([]); this.scope_1 = CoroutineScope_0(Dispatchers_getInstance().get_Default_goqax4_k$().plus_s13ygv_k$(Job())); this.nodeEventManager_1 = get_doorWrapper(this.db_1).get_nodeEventManager_3ccda_k$(); this.client_1 = DoorRepositoryReplicationClient_init_$Create$(this.db_1, this.repoConfig_1, this.scope_1, this.nodeEventManager_1, 1000); this.eventClient_1 = new NodeEventSseClient(this.repoConfig_1, this.nodeEventManager_1, this.scope_1); } protoOf(RepositoryHelper).get_scope_iyfcq3_k$ = function () { return this.scope_1; }; protoOf(RepositoryHelper).get_clientState_au6u59_k$ = function () { return this.client_1.get_state_iypx7s_k$(); }; protoOf(RepositoryHelper).set_connectivityStatus_pfu8g2_k$ = function (newValue) { this.connectivityStatusAtomic_1.set_kotlinx$atomicfu$value_nm6d3_k$(newValue); // Inline function 'kotlin.collections.forEach' call var tmp0_iterator = this.connectivityListeners_1.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.RepositoryHelper..' call try { element.onConnectivityStatusChanged_t023b0_k$(newValue); } catch ($p) { if ($p instanceof Exception) { var e = $p; println('Exception with weakConnectivityListener ' + e); } else { throw $p; } } } }; protoOf(RepositoryHelper).get_connectivityStatus_93ttym_k$ = function () { return this.connectivityStatusAtomic_1.get_kotlinx$atomicfu$value_vi2am5_k$(); }; protoOf(RepositoryHelper).remoteNodeIdOrNull_xiaqh9_k$ = function () { return this.client_1.remoteNodeIdOrNull_xiaqh9_k$(); }; protoOf(RepositoryHelper).remoteNodeIdOrFake_xi57q3_k$ = function () { return this.client_1.remoteNodeIdOrFake_xi57q3_k$(); }; protoOf(RepositoryHelper).close_yn9xrc_k$ = function () { this.client_1.close_yn9xrc_k$(); this.eventClient_1.close_yn9xrc_k$(); cancel_0(this.scope_1); }; function Companion_6() { Companion_instance_6 = this; this.SELECT_LOCAL_NODE_ID_SQL_1 = '\n (SELECT COALESCE(\n (SELECT nodeClientId \n FROM SyncNode \n LIMIT 1), 0))\n '; } protoOf(Companion_6).get_SELECT_LOCAL_NODE_ID_SQL_bp9wef_k$ = function () { return this.SELECT_LOCAL_NODE_ID_SQL_1; }; protoOf(Companion_6).serializer_9w0wvi_k$ = function () { return $serializer_getInstance(); }; var Companion_instance_6; function Companion_getInstance_9() { if (Companion_instance_6 == null) new Companion_6(); return Companion_instance_6; } function $serializer() { $serializer_instance = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.SyncNode', this, 1); tmp0_serialDesc.addElement_5pzumi_k$('nodeClientId', true); this.descriptor_1 = tmp0_serialDesc; } protoOf($serializer).get_descriptor_wjt6a0_k$ = function () { return this.descriptor_1; }; protoOf($serializer).childSerializers_5ghqw5_k$ = function () { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [LongSerializer_getInstance()]; }; protoOf($serializer).deserialize_sy6x50_k$ = function (decoder) { var tmp0_desc = this.descriptor_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = new Long(0, 0); var tmp5_input = decoder.beginStructure_yljocp_k$(tmp0_desc); if (tmp5_input.decodeSequentially_xlblqy_k$()) { tmp4_local0 = tmp5_input.decodeLongElement_994anb_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; } else while (tmp1_flag) { tmp2_index = tmp5_input.decodeElementIndex_bstkhp_k$(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp5_input.decodeLongElement_994anb_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp5_input.endStructure_1xqz0n_k$(tmp0_desc); return SyncNode_init_$Create$(tmp3_bitMask0, tmp4_local0, null); }; protoOf($serializer).serialize_su696f_k$ = function (encoder, value) { var tmp0_desc = this.descriptor_1; var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc); if (tmp1_output.shouldEncodeElementDefault_x8eyid_k$(tmp0_desc, 0) ? true : !value.nodeClientId_1.equals(new Long(0, 0))) { tmp1_output.encodeLongElement_cega27_k$(tmp0_desc, 0, value.nodeClientId_1); } tmp1_output.endStructure_1xqz0n_k$(tmp0_desc); }; protoOf($serializer).serialize_5ase3y_k$ = function (encoder, value) { return this.serialize_su696f_k$(encoder, value instanceof SyncNode ? value : THROW_CCE()); }; var $serializer_instance; function $serializer_getInstance() { if ($serializer_instance == null) new $serializer(); return $serializer_instance; } function SyncNode_init_$Init$(seen1, nodeClientId, serializationConstructorMarker, $this) { if (!(0 === (0 & seen1))) { throwMissingFieldException(seen1, 0, $serializer_getInstance().descriptor_1); } if (0 === (seen1 & 1)) $this.nodeClientId_1 = new Long(0, 0); else $this.nodeClientId_1 = nodeClientId; return $this; } function SyncNode_init_$Create$(seen1, nodeClientId, serializationConstructorMarker) { return SyncNode_init_$Init$(seen1, nodeClientId, serializationConstructorMarker, objectCreate(protoOf(SyncNode))); } function SyncNode(nodeClientId) { Companion_getInstance_9(); nodeClientId = nodeClientId === VOID ? new Long(0, 0) : nodeClientId; this.nodeClientId_1 = nodeClientId; } protoOf(SyncNode).set_nodeClientId_wfl6e1_k$ = function (_set____db54di) { this.nodeClientId_1 = _set____db54di; }; protoOf(SyncNode).get_nodeClientId_5fbwkx_k$ = function () { return this.nodeClientId_1; }; protoOf(SyncNode).component1_7eebsc_k$ = function () { return this.nodeClientId_1; }; protoOf(SyncNode).copy_dtzw2h_k$ = function (nodeClientId) { return new SyncNode(nodeClientId); }; protoOf(SyncNode).copy$default_9zrndo_k$ = function (nodeClientId, $super) { nodeClientId = nodeClientId === VOID ? this.nodeClientId_1 : nodeClientId; return $super === VOID ? this.copy_dtzw2h_k$(nodeClientId) : $super.copy_dtzw2h_k$.call(this, nodeClientId); }; protoOf(SyncNode).toString = function () { return 'SyncNode(nodeClientId=' + this.nodeClientId_1.toString() + ')'; }; protoOf(SyncNode).hashCode = function () { return this.nodeClientId_1.hashCode(); }; protoOf(SyncNode).equals = function (other) { if (this === other) return true; if (!(other instanceof SyncNode)) return false; var tmp0_other_with_cast = other instanceof SyncNode ? other : THROW_CCE(); if (!this.nodeClientId_1.equals(tmp0_other_with_cast.nodeClientId_1)) return false; return true; }; function generateSetSyncNodeSql($this) { return listOf_0(['DELETE FROM SyncNode', '\n INSERT INTO SyncNode(nodeClientId)\n VALUES (' + $this.nodeId_1.toString() + ') \n ']); } function SyncNodeIdCallback(nodeId) { this.nodeId_1 = nodeId; } protoOf(SyncNodeIdCallback).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(SyncNodeIdCallback).initSyncNodeSync_tckqr_k$ = function (forceReset) { if (forceReset) return generateSetSyncNodeSql(this); else { // Inline function 'kotlin.collections.listOf' call return emptyList(); } }; protoOf(SyncNodeIdCallback).onCreate_greuoz_k$ = function (db) { return generateSetSyncNodeSql(this); }; protoOf(SyncNodeIdCallback).onOpen_58e9dd_k$ = function (db) { // Inline function 'kotlin.collections.listOf' call return emptyList(); }; function AttachmentMd5() { } protoOf(AttachmentMd5).equals = function (other) { if (!(other instanceof AttachmentMd5)) return false; other instanceof AttachmentMd5 || THROW_CCE(); return true; }; protoOf(AttachmentMd5).hashCode = function () { return 0; }; protoOf(AttachmentMd5).toString = function () { return '@com.ustadmobile.door.annotation.AttachmentMd5()'; }; function AttachmentSize() { } protoOf(AttachmentSize).equals = function (other) { if (!(other instanceof AttachmentSize)) return false; other instanceof AttachmentSize || THROW_CCE(); return true; }; protoOf(AttachmentSize).hashCode = function () { return 0; }; protoOf(AttachmentSize).toString = function () { return '@com.ustadmobile.door.annotation.AttachmentSize()'; }; function AttachmentUri() { } protoOf(AttachmentUri).equals = function (other) { if (!(other instanceof AttachmentUri)) return false; other instanceof AttachmentUri || THROW_CCE(); return true; }; protoOf(AttachmentUri).hashCode = function () { return 0; }; protoOf(AttachmentUri).toString = function () { return '@com.ustadmobile.door.annotation.AttachmentUri()'; }; function EntityWithAttachment() { } protoOf(EntityWithAttachment).equals = function (other) { if (!(other instanceof EntityWithAttachment)) return false; other instanceof EntityWithAttachment || THROW_CCE(); return true; }; protoOf(EntityWithAttachment).hashCode = function () { return 0; }; protoOf(EntityWithAttachment).toString = function () { return '@com.ustadmobile.door.annotation.EntityWithAttachment()'; }; function LastChangedBy() { } protoOf(LastChangedBy).equals = function (other) { if (!(other instanceof LastChangedBy)) return false; other instanceof LastChangedBy || THROW_CCE(); return true; }; protoOf(LastChangedBy).hashCode = function () { return 0; }; protoOf(LastChangedBy).toString = function () { return '@com.ustadmobile.door.annotation.LastChangedBy()'; }; function LocalChangeSeqNum() { } protoOf(LocalChangeSeqNum).equals = function (other) { if (!(other instanceof LocalChangeSeqNum)) return false; other instanceof LocalChangeSeqNum || THROW_CCE(); return true; }; protoOf(LocalChangeSeqNum).hashCode = function () { return 0; }; protoOf(LocalChangeSeqNum).toString = function () { return '@com.ustadmobile.door.annotation.LocalChangeSeqNum()'; }; function MasterChangeSeqNum() { } protoOf(MasterChangeSeqNum).equals = function (other) { if (!(other instanceof MasterChangeSeqNum)) return false; other instanceof MasterChangeSeqNum || THROW_CCE(); return true; }; protoOf(MasterChangeSeqNum).hashCode = function () { return 0; }; protoOf(MasterChangeSeqNum).toString = function () { return '@com.ustadmobile.door.annotation.MasterChangeSeqNum()'; }; var RemoteInsertStrategy_CALLBACK_instance; var RemoteInsertStrategy_INSERT_instance; var RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance; function values() { return [RemoteInsertStrategy_CALLBACK_getInstance(), RemoteInsertStrategy_INSERT_getInstance(), RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance()]; } function valueOf(value) { switch (value) { case 'CALLBACK': return RemoteInsertStrategy_CALLBACK_getInstance(); case 'INSERT': return RemoteInsertStrategy_INSERT_getInstance(); case 'INSERT_INTO_RECEIVE_VIEW': return RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance(); default: RemoteInsertStrategy_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries() { if ($ENTRIES == null) $ENTRIES = enumEntries(values()); return $ENTRIES; } var RemoteInsertStrategy_entriesInitialized; function RemoteInsertStrategy_initEntries() { if (RemoteInsertStrategy_entriesInitialized) return Unit_getInstance(); RemoteInsertStrategy_entriesInitialized = true; RemoteInsertStrategy_CALLBACK_instance = new RemoteInsertStrategy('CALLBACK', 0); RemoteInsertStrategy_INSERT_instance = new RemoteInsertStrategy('INSERT', 1); RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance = new RemoteInsertStrategy('INSERT_INTO_RECEIVE_VIEW', 2); } var $ENTRIES; function RemoteInsertStrategy(name, ordinal) { Enum.call(this, name, ordinal); } function RemoteInsertStrategy_CALLBACK_getInstance() { RemoteInsertStrategy_initEntries(); return RemoteInsertStrategy_CALLBACK_instance; } function RemoteInsertStrategy_INSERT_getInstance() { RemoteInsertStrategy_initEntries(); return RemoteInsertStrategy_INSERT_instance; } function RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance() { RemoteInsertStrategy_initEntries(); return RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance; } function ReplicateEntity(tableId, batchSize, remoteInsertStrategy) { batchSize = batchSize === VOID ? 1000 : batchSize; remoteInsertStrategy = remoteInsertStrategy === VOID ? RemoteInsertStrategy_CALLBACK_getInstance() : remoteInsertStrategy; this.tableId_1 = tableId; this.batchSize_1 = batchSize; this.remoteInsertStrategy_1 = remoteInsertStrategy; } protoOf(ReplicateEntity).get_tableId_of07s0_k$ = function () { return this.tableId_1; }; protoOf(ReplicateEntity).get_batchSize_7o99am_k$ = function () { return this.batchSize_1; }; protoOf(ReplicateEntity).get_remoteInsertStrategy_t4k5ff_k$ = function () { return this.remoteInsertStrategy_1; }; protoOf(ReplicateEntity).equals = function (other) { if (!(other instanceof ReplicateEntity)) return false; var tmp0_other_with_cast = other instanceof ReplicateEntity ? other : THROW_CCE(); if (!(this.tableId_1 === tmp0_other_with_cast.tableId_1)) return false; if (!(this.batchSize_1 === tmp0_other_with_cast.batchSize_1)) return false; if (!this.remoteInsertStrategy_1.equals(tmp0_other_with_cast.remoteInsertStrategy_1)) return false; return true; }; protoOf(ReplicateEntity).hashCode = function () { var result = imul(getStringHashCode('tableId'), 127) ^ this.tableId_1; result = result + (imul(getStringHashCode('batchSize'), 127) ^ this.batchSize_1) | 0; result = result + (imul(getStringHashCode('remoteInsertStrategy'), 127) ^ this.remoteInsertStrategy_1.hashCode()) | 0; return result; }; protoOf(ReplicateEntity).toString = function () { return '@com.ustadmobile.door.annotation.ReplicateEntity(tableId=' + this.tableId_1 + ', batchSize=' + this.batchSize_1 + ', remoteInsertStrategy=' + this.remoteInsertStrategy_1 + ')'; }; function ReplicateEtag() { } protoOf(ReplicateEtag).equals = function (other) { if (!(other instanceof ReplicateEtag)) return false; other instanceof ReplicateEtag || THROW_CCE(); return true; }; protoOf(ReplicateEtag).hashCode = function () { return 0; }; protoOf(ReplicateEtag).toString = function () { return '@com.ustadmobile.door.annotation.ReplicateEtag()'; }; function ReplicateLastModified(autoSet) { autoSet = autoSet === VOID ? true : autoSet; this.autoSet_1 = autoSet; } protoOf(ReplicateLastModified).get_autoSet_9f9392_k$ = function () { return this.autoSet_1; }; protoOf(ReplicateLastModified).equals = function (other) { if (!(other instanceof ReplicateLastModified)) return false; var tmp0_other_with_cast = other instanceof ReplicateLastModified ? other : THROW_CCE(); if (!(this.autoSet_1 === tmp0_other_with_cast.autoSet_1)) return false; return true; }; protoOf(ReplicateLastModified).hashCode = function () { return imul(getStringHashCode('autoSet'), 127) ^ getBooleanHashCode(this.autoSet_1); }; protoOf(ReplicateLastModified).toString = function () { return '@com.ustadmobile.door.annotation.ReplicateLastModified(autoSet=' + this.autoSet_1 + ')'; }; var Event_INSERT_instance; var Event_UPDATE_instance; var Event_DELETE_instance; function values_0() { return [Event_INSERT_getInstance(), Event_UPDATE_getInstance(), Event_DELETE_getInstance()]; } function valueOf_0(value) { switch (value) { case 'INSERT': return Event_INSERT_getInstance(); case 'UPDATE': return Event_UPDATE_getInstance(); case 'DELETE': return Event_DELETE_getInstance(); default: Event_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_0() { if ($ENTRIES_0 == null) $ENTRIES_0 = enumEntries(values_0()); return $ENTRIES_0; } var Event_entriesInitialized; function Event_initEntries() { if (Event_entriesInitialized) return Unit_getInstance(); Event_entriesInitialized = true; Event_INSERT_instance = new Event('INSERT', 0, 'INSERT'); Event_UPDATE_instance = new Event('UPDATE', 1, 'UPDATE'); Event_DELETE_instance = new Event('DELETE', 2, 'DELETE'); } var $ENTRIES_0; var Order_AFTER_instance; var Order_BEFORE_instance; var Order_INSTEAD_OF_instance; function values_1() { return [Order_AFTER_getInstance(), Order_BEFORE_getInstance(), Order_INSTEAD_OF_getInstance()]; } function valueOf_1(value) { switch (value) { case 'AFTER': return Order_AFTER_getInstance(); case 'BEFORE': return Order_BEFORE_getInstance(); case 'INSTEAD_OF': return Order_INSTEAD_OF_getInstance(); default: Order_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_1() { if ($ENTRIES_1 == null) $ENTRIES_1 = enumEntries(values_1()); return $ENTRIES_1; } var Order_entriesInitialized; function Order_initEntries() { if (Order_entriesInitialized) return Unit_getInstance(); Order_entriesInitialized = true; Order_AFTER_instance = new Order('AFTER', 0, 'AFTER'); Order_BEFORE_instance = new Order('BEFORE', 1, 'BEFORE'); Order_INSTEAD_OF_instance = new Order('INSTEAD_OF', 2, 'INSTEAD OF'); } var $ENTRIES_1; var On_ENTITY_instance; var On_RECEIVEVIEW_instance; function values_2() { return [On_ENTITY_getInstance(), On_RECEIVEVIEW_getInstance()]; } function valueOf_2(value) { switch (value) { case 'ENTITY': return On_ENTITY_getInstance(); case 'RECEIVEVIEW': return On_RECEIVEVIEW_getInstance(); default: On_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_2() { if ($ENTRIES_2 == null) $ENTRIES_2 = enumEntries(values_2()); return $ENTRIES_2; } var On_entriesInitialized; function On_initEntries() { if (On_entriesInitialized) return Unit_getInstance(); On_entriesInitialized = true; On_ENTITY_instance = new On('ENTITY', 0); On_RECEIVEVIEW_instance = new On('RECEIVEVIEW', 1); } var $ENTRIES_2; function Event(name, ordinal, sqlKeyWord) { Enum.call(this, name, ordinal); this.sqlKeyWord_1 = sqlKeyWord; } protoOf(Event).get_sqlKeyWord_5ioqos_k$ = function () { return this.sqlKeyWord_1; }; function Order(name, ordinal, sqlStr) { Enum.call(this, name, ordinal); this.sqlStr_1 = sqlStr; } protoOf(Order).get_sqlStr_jly4y4_k$ = function () { return this.sqlStr_1; }; function On(name, ordinal) { Enum.call(this, name, ordinal); } function Companion_7() { Companion_instance_7 = this; this.NAME_PREFIX_1 = '_d'; } protoOf(Companion_7).get_NAME_PREFIX_pvog9p_k$ = function () { return this.NAME_PREFIX_1; }; var Companion_instance_7; function Companion_getInstance_10() { if (Companion_instance_7 == null) new Companion_7(); return Companion_instance_7; } function Event_INSERT_getInstance() { Event_initEntries(); return Event_INSERT_instance; } function Event_UPDATE_getInstance() { Event_initEntries(); return Event_UPDATE_instance; } function Event_DELETE_getInstance() { Event_initEntries(); return Event_DELETE_instance; } function Order_AFTER_getInstance() { Order_initEntries(); return Order_AFTER_instance; } function Order_BEFORE_getInstance() { Order_initEntries(); return Order_BEFORE_instance; } function Order_INSTEAD_OF_getInstance() { Order_initEntries(); return Order_INSTEAD_OF_instance; } function On_ENTITY_getInstance() { On_initEntries(); return On_ENTITY_instance; } function On_RECEIVEVIEW_getInstance() { On_initEntries(); return On_RECEIVEVIEW_instance; } function Trigger(name, order, events, on, sqlStatements, postgreSqlStatements, conditionSql, conditionSqlPostgres) { Companion_getInstance_10(); on = on === VOID ? On_ENTITY_getInstance() : on; postgreSqlStatements = postgreSqlStatements === VOID ? [] : postgreSqlStatements; conditionSql = conditionSql === VOID ? '' : conditionSql; conditionSqlPostgres = conditionSqlPostgres === VOID ? '' : conditionSqlPostgres; this.name_1 = name; this.order_1 = order; this.events_1 = events; this.on_1 = on; this.sqlStatements_1 = sqlStatements; this.postgreSqlStatements_1 = postgreSqlStatements; this.conditionSql_1 = conditionSql; this.conditionSqlPostgres_1 = conditionSqlPostgres; } protoOf(Trigger).get_name_woqyms_k$ = function () { return this.name_1; }; protoOf(Trigger).get_order_iwhiqt_k$ = function () { return this.order_1; }; protoOf(Trigger).get_events_d1yhia_k$ = function () { return this.events_1; }; protoOf(Trigger).get_on_kntnrs_k$ = function () { return this.on_1; }; protoOf(Trigger).get_sqlStatements_hnj4d3_k$ = function () { return this.sqlStatements_1; }; protoOf(Trigger).get_postgreSqlStatements_zif4ov_k$ = function () { return this.postgreSqlStatements_1; }; protoOf(Trigger).get_conditionSql_fcgp38_k$ = function () { return this.conditionSql_1; }; protoOf(Trigger).get_conditionSqlPostgres_wz9qc5_k$ = function () { return this.conditionSqlPostgres_1; }; protoOf(Trigger).equals = function (other) { if (!(other instanceof Trigger)) return false; var tmp0_other_with_cast = other instanceof Trigger ? other : THROW_CCE(); if (!(this.name_1 === tmp0_other_with_cast.name_1)) return false; if (!this.order_1.equals(tmp0_other_with_cast.order_1)) return false; if (!contentEquals(this.events_1, tmp0_other_with_cast.events_1)) return false; if (!this.on_1.equals(tmp0_other_with_cast.on_1)) return false; if (!contentEquals(this.sqlStatements_1, tmp0_other_with_cast.sqlStatements_1)) return false; if (!contentEquals(this.postgreSqlStatements_1, tmp0_other_with_cast.postgreSqlStatements_1)) return false; if (!(this.conditionSql_1 === tmp0_other_with_cast.conditionSql_1)) return false; if (!(this.conditionSqlPostgres_1 === tmp0_other_with_cast.conditionSqlPostgres_1)) return false; return true; }; protoOf(Trigger).hashCode = function () { var result = imul(getStringHashCode('name'), 127) ^ getStringHashCode(this.name_1); result = result + (imul(getStringHashCode('order'), 127) ^ this.order_1.hashCode()) | 0; result = result + (imul(getStringHashCode('events'), 127) ^ hashCode(this.events_1)) | 0; result = result + (imul(getStringHashCode('on'), 127) ^ this.on_1.hashCode()) | 0; result = result + (imul(getStringHashCode('sqlStatements'), 127) ^ hashCode(this.sqlStatements_1)) | 0; result = result + (imul(getStringHashCode('postgreSqlStatements'), 127) ^ hashCode(this.postgreSqlStatements_1)) | 0; result = result + (imul(getStringHashCode('conditionSql'), 127) ^ getStringHashCode(this.conditionSql_1)) | 0; result = result + (imul(getStringHashCode('conditionSqlPostgres'), 127) ^ getStringHashCode(this.conditionSqlPostgres_1)) | 0; return result; }; protoOf(Trigger).toString = function () { return '@com.ustadmobile.door.annotation.Trigger(name=' + this.name_1 + ', order=' + this.order_1 + ', events=' + toString(this.events_1) + ', on=' + this.on_1 + ', sqlStatements=' + toString(this.sqlStatements_1) + ', postgreSqlStatements=' + toString(this.postgreSqlStatements_1) + ', conditionSql=' + this.conditionSql_1 + ', conditionSqlPostgres=' + this.conditionSqlPostgres_1 + ')'; }; function Triggers(value) { value = value === VOID ? [] : value; this.value_1 = value; } protoOf(Triggers).get_value_j01efc_k$ = function () { return this.value_1; }; protoOf(Triggers).equals = function (other) { if (!(other instanceof Triggers)) return false; var tmp0_other_with_cast = other instanceof Triggers ? other : THROW_CCE(); if (!contentEquals(this.value_1, tmp0_other_with_cast.value_1)) return false; return true; }; protoOf(Triggers).hashCode = function () { return imul(getStringHashCode('value'), 127) ^ hashCode(this.value_1); }; protoOf(Triggers).toString = function () { return '@com.ustadmobile.door.annotation.Triggers(value=' + toString(this.value_1) + ')'; }; function Companion_8() { Companion_instance_8 = this; this.SUBSCRIBED_TO_1 = 1; this.SERVER_FOR_1 = 2; } protoOf(Companion_8).get_SUBSCRIBED_TO_5aqmon_k$ = function () { return this.SUBSCRIBED_TO_1; }; protoOf(Companion_8).get_SERVER_FOR_spbpdi_k$ = function () { return this.SERVER_FOR_1; }; var Companion_instance_8; function Companion_getInstance_11() { if (Companion_instance_8 == null) new Companion_8(); return Companion_instance_8; } function DoorNode() { Companion_getInstance_11(); this.nodeId_1 = new Long(0, 0); this.auth_1 = null; this.rel_1 = 1; } protoOf(DoorNode).set_nodeId_xy4u70_k$ = function (_set____db54di) { this.nodeId_1 = _set____db54di; }; protoOf(DoorNode).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(DoorNode).set_auth_b8k972_k$ = function (_set____db54di) { this.auth_1 = _set____db54di; }; protoOf(DoorNode).get_auth_woj2sx_k$ = function () { return this.auth_1; }; protoOf(DoorNode).set_rel_w9cafg_k$ = function (_set____db54di) { this.rel_1 = _set____db54di; }; protoOf(DoorNode).get_rel_18ix1s_k$ = function () { return this.rel_1; }; function NodeIdAndAuth(nodeId, auth) { this.nodeId_1 = nodeId; this.auth_1 = auth; } protoOf(NodeIdAndAuth).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(NodeIdAndAuth).get_auth_woj2sx_k$ = function () { return this.auth_1; }; protoOf(NodeIdAndAuth).component1_7eebsc_k$ = function () { return this.nodeId_1; }; protoOf(NodeIdAndAuth).component2_7eebsb_k$ = function () { return this.auth_1; }; protoOf(NodeIdAndAuth).copy_pjtdc1_k$ = function (nodeId, auth) { return new NodeIdAndAuth(nodeId, auth); }; protoOf(NodeIdAndAuth).copy$default_8t40sg_k$ = function (nodeId, auth, $super) { nodeId = nodeId === VOID ? this.nodeId_1 : nodeId; auth = auth === VOID ? this.auth_1 : auth; return $super === VOID ? this.copy_pjtdc1_k$(nodeId, auth) : $super.copy_pjtdc1_k$.call(this, nodeId, auth); }; protoOf(NodeIdAndAuth).toString = function () { return 'NodeIdAndAuth(nodeId=' + this.nodeId_1.toString() + ', auth=' + this.auth_1 + ')'; }; protoOf(NodeIdAndAuth).hashCode = function () { var result = this.nodeId_1.hashCode(); result = imul(result, 31) + getStringHashCode(this.auth_1) | 0; return result; }; protoOf(NodeIdAndAuth).equals = function (other) { if (this === other) return true; if (!(other instanceof NodeIdAndAuth)) return false; var tmp0_other_with_cast = other instanceof NodeIdAndAuth ? other : THROW_CCE(); if (!this.nodeId_1.equals(tmp0_other_with_cast.nodeId_1)) return false; if (!(this.auth_1 === tmp0_other_with_cast.auth_1)) return false; return true; }; function OutgoingReplication(orUid, destNodeId, orTableId, orPk1, orPk2, orPk3, orPk4) { orUid = orUid === VOID ? new Long(0, 0) : orUid; destNodeId = destNodeId === VOID ? new Long(0, 0) : destNodeId; orTableId = orTableId === VOID ? 0 : orTableId; orPk1 = orPk1 === VOID ? new Long(0, 0) : orPk1; orPk2 = orPk2 === VOID ? new Long(0, 0) : orPk2; orPk3 = orPk3 === VOID ? new Long(0, 0) : orPk3; orPk4 = orPk4 === VOID ? new Long(0, 0) : orPk4; this.orUid_1 = orUid; this.destNodeId_1 = destNodeId; this.orTableId_1 = orTableId; this.orPk1__1 = orPk1; this.orPk2__1 = orPk2; this.orPk3__1 = orPk3; this.orPk4__1 = orPk4; } protoOf(OutgoingReplication).set_orUid_avnb5e_k$ = function (_set____db54di) { this.orUid_1 = _set____db54di; }; protoOf(OutgoingReplication).get_orUid_iwh7pg_k$ = function () { return this.orUid_1; }; protoOf(OutgoingReplication).set_destNodeId_n0qmci_k$ = function (_set____db54di) { this.destNodeId_1 = _set____db54di; }; protoOf(OutgoingReplication).get_destNodeId_d2y4xk_k$ = function () { return this.destNodeId_1; }; protoOf(OutgoingReplication).set_orTableId_ytziu9_k$ = function (_set____db54di) { this.orTableId_1 = _set____db54di; }; protoOf(OutgoingReplication).get_orTableId_lu6glf_k$ = function () { return this.orTableId_1; }; protoOf(OutgoingReplication).set_orPk1_lv6n5k_k$ = function (_set____db54di) { this.orPk1__1 = _set____db54di; }; protoOf(OutgoingReplication).get_orPk1_iwh40a_k$ = function () { return this.orPk1__1; }; protoOf(OutgoingReplication).set_orPk2_ej2ie1_k$ = function (_set____db54di) { this.orPk2__1 = _set____db54di; }; protoOf(OutgoingReplication).get_orPk2_iwh40b_k$ = function () { return this.orPk2__1; }; protoOf(OutgoingReplication).set_orPk3_76ydmi_k$ = function (_set____db54di) { this.orPk3__1 = _set____db54di; }; protoOf(OutgoingReplication).get_orPk3_iwh40c_k$ = function () { return this.orPk3__1; }; protoOf(OutgoingReplication).set_orPk4_55r51_k$ = function (_set____db54di) { this.orPk4__1 = _set____db54di; }; protoOf(OutgoingReplication).get_orPk4_iwh40d_k$ = function () { return this.orPk4__1; }; function get_rootDatabase(_this__u8e3s4) { var db = _this__u8e3s4; $l$loop: while (true) { var tmp0_elvis_lhs = get_sourceDatabase(db); var tmp; if (tmp0_elvis_lhs == null) { break $l$loop; } else { tmp = tmp0_elvis_lhs; } db = tmp; } return db; } function prepareAndUseStatementAsync_0(_this__u8e3s4, sql, readOnly, block, $completion) { readOnly = readOnly === VOID ? false : readOnly; return prepareAndUseStatementAsync(_this__u8e3s4, new PreparedStatementConfig(sql, VOID, VOID, VOID, VOID, readOnly), block, $completion); } function prepareAndUseStatement_0(_this__u8e3s4, sql, readOnly, block) { readOnly = readOnly === VOID ? false : readOnly; return prepareAndUseStatement(_this__u8e3s4, new PreparedStatementConfig(sql, VOID, VOID, VOID, VOID, readOnly), block); } function get_arraySupported(_this__u8e3s4) { return dbType_1(_this__u8e3s4) === Companion_getInstance_6().get_POSTGRES_6bxnsu_k$(); } function Companion_9() { Companion_instance_9 = this; this.SUFFIX_DOOR_METADATA_1 = '_DoorMetadata'; } protoOf(Companion_9).get_SUFFIX_DOOR_METADATA_wonret_k$ = function () { return this.SUFFIX_DOOR_METADATA_1; }; var Companion_instance_9; function Companion_getInstance_12() { if (Companion_instance_9 == null) new Companion_9(); return Companion_instance_9; } function DoorDatabaseMetadata() { Companion_getInstance_12(); } protoOf(DoorDatabaseMetadata).get_replicateTableNames_6uibay_k$ = function () { // Inline function 'kotlin.collections.map' call var this_0 = this.get_replicateEntities_2w1n4x_k$().get_values_ksazhn_k$(); // Inline function 'kotlin.collections.mapTo' call 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$(); // Inline function 'com.ustadmobile.door.ext.DoorDatabaseMetadata..' call var tmp$ret$0 = item.get_entityTableName_g8x9t9_k$(); destination.add_utx5q5_k$(tmp$ret$0); } return destination; }; protoOf(DoorDatabaseMetadata).requireReplicateEntityMetaData_9swzku_k$ = function (tableId) { var tmp0_elvis_lhs = this.get_replicateEntities_2w1n4x_k$().get_wei43m_k$(tableId); var tmp; if (tmp0_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('No metadata for table id ' + tableId); } else { tmp = tmp0_elvis_lhs; } return tmp; }; protoOf(DoorDatabaseMetadata).getTableId_77qvrb_k$ = function (tableName) { var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.first' call var tmp0_iterator = this.get_replicateEntities_2w1n4x_k$().get_values_ksazhn_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.ext.DoorDatabaseMetadata.getTableId.' call if (element.get_entityTableName_g8x9t9_k$() === tableName) { tmp$ret$1 = element; break $l$block; } } throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.'); } return tmp$ret$1.get_tableId_of07s0_k$(); }; function Companion_10() { Companion_instance_10 = this; this.TAG_DB_1 = 1; this.TAG_REPO_1 = 2; this.TAG_ATTACHMENT_DIR_1 = 4; this.LOG_TAG_1 = 'DoorLog'; } protoOf(Companion_10).get_TAG_DB_46ibfw_k$ = function () { return this.TAG_DB_1; }; protoOf(Companion_10).get_TAG_REPO_v06nfk_k$ = function () { return this.TAG_REPO_1; }; protoOf(Companion_10).get_TAG_ATTACHMENT_DIR_8rm7cx_k$ = function () { return this.TAG_ATTACHMENT_DIR_1; }; protoOf(Companion_10).get_LOG_TAG_it8mba_k$ = function () { return this.LOG_TAG_1; }; var Companion_instance_10; function Companion_getInstance_13() { if (Companion_instance_10 == null) new Companion_10(); return Companion_instance_10; } function DoorTag() { Companion_getInstance_13(); } function setBodyJson(_this__u8e3s4, json, serializer, value, contentType) { contentType = contentType === VOID ? Application_getInstance().get_Json_wo4ci9_k$() : contentType; // Inline function 'io.ktor.client.request.setBody' call var body = new TextContent(json.encodeToString_k0apqx_k$(serializer, value), contentType); if (body == null) { _this__u8e3s4.set_body_slfhxt_k$(NullBody_getInstance()); // Inline function 'io.ktor.util.reflect.typeInfo' call var tmp = JsType_getInstance(); var tmp_0 = getKClass(TextContent); // Inline function 'io.ktor.util.reflect.tryGetType' call var tmp_1; try { tmp_1 = createKType(getKClass(TextContent), arrayOf([]), false); } catch ($p) { var tmp_2; if ($p instanceof Error) { var cause = $p; tmp_2 = null; } else { throw $p; } tmp_1 = tmp_2; } var tmp$ret$0 = tmp_1; var tmp$ret$1 = typeInfoImpl(tmp, tmp_0, tmp$ret$0); _this__u8e3s4.set_bodyType_8pgqkl_k$(tmp$ret$1); } else { if (body instanceof OutgoingContent) { _this__u8e3s4.set_body_slfhxt_k$(body); _this__u8e3s4.set_bodyType_8pgqkl_k$(null); } else { _this__u8e3s4.set_body_slfhxt_k$(body); // Inline function 'io.ktor.util.reflect.typeInfo' call var tmp_3 = JsType_getInstance(); var tmp_4 = getKClass(TextContent); // Inline function 'io.ktor.util.reflect.tryGetType' call var tmp_5; try { tmp_5 = createKType(getKClass(TextContent), arrayOf([]), false); } catch ($p) { var tmp_6; if ($p instanceof Error) { var cause_0 = $p; tmp_6 = null; } else { throw $p; } tmp_5 = tmp_6; } var tmp$ret$2 = tmp_5; var tmp$ret$3 = typeInfoImpl(tmp_3, tmp_4, tmp$ret$2); _this__u8e3s4.set_bodyType_8pgqkl_k$(tmp$ret$3); } } } function doorNodeIdHeader(_this__u8e3s4, repo) { header(_this__u8e3s4, DoorConstants_getInstance().get_HEADER_NODE_AND_AUTH_2mchyc_k$(), repo.get_config_c0698r_k$().get_nodeId_h7ho7a_k$().toString() + '/' + repo.get_config_c0698r_k$().get_auth_woj2sx_k$()); } function doorNodeIdHeader_0(_this__u8e3s4, nodeId, auth) { header(_this__u8e3s4, DoorConstants_getInstance().get_HEADER_NODE_AND_AUTH_2mchyc_k$(), nodeId.toString() + '/' + auth); } function setRepoUrl(_this__u8e3s4, repoEndpoint, repoPath) { _this__u8e3s4.url_gkqa8r_k$(setRepoUrl$lambda(repoEndpoint, repoPath)); } function setRepoUrl_0(_this__u8e3s4, repositoryConfig, repoPath) { return setRepoUrl(_this__u8e3s4, repositoryConfig.get_endpoint_30bvdu_k$(), repoPath); } function pagingSourceLoadParameters(_this__u8e3s4, json, keySerializer, loadParams) { var loadParamType = Companion_getInstance_14().paramTypeFor_76jl1s_k$(getKClassFromExpression(loadParams)); parameter(_this__u8e3s4, Companion_getInstance_16().get_PARAM_LOAD_PARAM_TYPE_86ea4q_k$(), loadParamType.get_name_woqyms_k$()); parameter(_this__u8e3s4, Companion_getInstance_16().get_PARAM_KEY_fwkfyc_k$(), json.encodeToString_k0apqx_k$(keySerializer, loadParams.get_key_18j28a_k$())); parameter(_this__u8e3s4, Companion_getInstance_16().get_PARAM_BATCHSIZE_e5jwtc_k$(), loadParams.get_loadSize_1a4pbk_k$()); } function doorNodeAndVersionHeaders(_this__u8e3s4, repo) { dbVersionHeader(_this__u8e3s4, repo.get_db_knto1l_k$()); doorNodeIdHeader(_this__u8e3s4, repo); } var LoadParamType_REFRESH_instance; var LoadParamType_PREPEND_instance; var LoadParamType_APPEND_instance; function Companion_11() { Companion_instance_11 = this; } protoOf(Companion_11).paramTypeFor_76jl1s_k$ = function (paramClass) { var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.first' call var tmp0_iterator = get_entries_3().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.ext.Companion.paramTypeFor.' call if (element.paramClass_1.equals(paramClass)) { tmp$ret$1 = element; break $l$block; } } throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.'); } return tmp$ret$1; }; var Companion_instance_11; function Companion_getInstance_14() { LoadParamType_initEntries(); if (Companion_instance_11 == null) new Companion_11(); return Companion_instance_11; } function values_3() { return [LoadParamType_REFRESH_getInstance(), LoadParamType_PREPEND_getInstance(), LoadParamType_APPEND_getInstance()]; } function valueOf_3(value) { switch (value) { case 'REFRESH': return LoadParamType_REFRESH_getInstance(); case 'PREPEND': return LoadParamType_PREPEND_getInstance(); case 'APPEND': return LoadParamType_APPEND_getInstance(); default: LoadParamType_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_3() { if ($ENTRIES_3 == null) $ENTRIES_3 = enumEntries(values_3()); return $ENTRIES_3; } var LoadParamType_entriesInitialized; function LoadParamType_initEntries() { if (LoadParamType_entriesInitialized) return Unit_getInstance(); LoadParamType_entriesInitialized = true; LoadParamType_REFRESH_instance = new LoadParamType('REFRESH', 0, getKClass(Refresh)); LoadParamType_PREPEND_instance = new LoadParamType('PREPEND', 1, getKClass(Prepend)); LoadParamType_APPEND_instance = new LoadParamType('APPEND', 2, getKClass(Append)); Companion_getInstance_14(); } var $ENTRIES_3; function LoadParamType(name, ordinal, paramClass) { Enum.call(this, name, ordinal); this.paramClass_1 = paramClass; } protoOf(LoadParamType).get_paramClass_d3yyks_k$ = function () { return this.paramClass_1; }; function dbVersionHeader(_this__u8e3s4, db) { header(_this__u8e3s4, DoorConstants_getInstance().get_HEADER_DBVERSION_wpdj3j_k$(), dbSchemaVersion(db)); } function setRepoUrl$lambda($repoEndpoint, $repoPath) { return function ($this$url, it) { takeFrom($this$url, $repoEndpoint); set_encodedPath($this$url, get_encodedPath($this$url) + $repoPath); return Unit_getInstance(); }; } function LoadParamType_REFRESH_getInstance() { LoadParamType_initEntries(); return LoadParamType_REFRESH_instance; } function LoadParamType_PREPEND_getInstance() { LoadParamType_initEntries(); return LoadParamType_PREPEND_instance; } function LoadParamType_APPEND_getInstance() { LoadParamType_initEntries(); return LoadParamType_APPEND_instance; } function runningSplitBy(_this__u8e3s4, key) { var result = mutableLinkedListOf([]); var lastItemKey = null; var lastList = null; var tmp0_iterator = _this__u8e3s4.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); var itemKey = key(item); if ((!(lastItemKey == null) ? !(lastList == null) : false) ? equals(itemKey, lastItemKey) : false) { lastList.add_utx5q5_k$(item); } else { var newList = mutableLinkedListOf([item]); result.add_utx5q5_k$(newList); lastList = newList; } lastItemKey = itemKey; } return toList(result); } function toUrlQueryString(_this__u8e3s4) { // Inline function 'kotlin.collections.map' call var this_0 = _this__u8e3s4.get_entries_p20ztl_k$(); // Inline function 'kotlin.collections.mapTo' call 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$(); // Inline function 'com.ustadmobile.door.ext.toUrlQueryString.' call var tmp$ret$0 = urlEncode(item.get_key_18j28a_k$()) + '=' + urlEncode(item.get_value_j01efc_k$()); destination.add_utx5q5_k$(tmp$ret$0); } return joinToString(destination, '&'); } function setAllFromJsonObject(_this__u8e3s4, jsonObject, entityFieldsMetaData, startIndex) { startIndex = startIndex === VOID ? 1 : startIndex; // Inline function 'kotlin.collections.forEachIndexed' call var index = 0; var tmp0_iterator = entityFieldsMetaData.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject.' call var tmp1 = index; index = tmp1 + 1 | 0; var index_0 = checkIndexOverflow(tmp1); var fieldType = item.get_dbFieldType_pz3j77_k$(); var tmp = index_0 + startIndex | 0; var tmp_0 = item.get_dbFieldType_pz3j77_k$(); // Inline function 'kotlin.collections.getOrElse' call var key = item.get_fieldName_tfocn0_k$(); var tmp0_elvis_lhs = jsonObject.get_wei43m_k$(key); var tmp_1; if (tmp0_elvis_lhs == null) { // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject..' call tmp_1 = defaultJsonPrimitive(fieldType, item.get_nullable_7petka_k$()); } else { tmp_1 = tmp0_elvis_lhs; } var tmp$ret$1 = tmp_1; setJsonPrimitive(_this__u8e3s4, tmp, tmp_0, get_jsonPrimitive(tmp$ret$1)); } } function setJsonPrimitive(_this__u8e3s4, index, type, jsonPrimitive) { if (jsonPrimitive instanceof JsonNull) { _this__u8e3s4.setObject_9i2mag_k$(index, null); return Unit_getInstance(); } if (type === TypesKmp_getInstance().get_INTEGER_pibe8b_k$()) { _this__u8e3s4.setInt_c72a8z_k$(index, get_int(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_SMALLINT_sw3een_k$()) { _this__u8e3s4.setShort_mhpatm_k$(index, toShort(get_int(jsonPrimitive))); } else if (type === TypesKmp_getInstance().get_BIGINT_47wyyw_k$()) { _this__u8e3s4.setLong_j1sybo_k$(index, get_long(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_FLOAT_i998gj_k$()) { _this__u8e3s4.setFloat_dia6lm_k$(index, get_float(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_REAL_wo8h5z_k$()) { _this__u8e3s4.setFloat_dia6lm_k$(index, get_float(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_DOUBLE_36a61y_k$()) { _this__u8e3s4.setDouble_gsfx69_k$(index, get_double(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$()) { _this__u8e3s4.setBoolean_pzdm1v_k$(index, get_boolean(jsonPrimitive)); } else if (type === TypesKmp_getInstance().get_VARCHAR_h1w92s_k$()) { _this__u8e3s4.setString_2gt7ua_k$(index, jsonPrimitive.get_content_h02jrk_k$()); } else if (type === TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$()) { _this__u8e3s4.setString_2gt7ua_k$(index, jsonPrimitive.get_content_h02jrk_k$()); } } function defaultJsonPrimitive(type, nullable) { return nullable ? JsonNull_getInstance() : (type === TypesKmp_getInstance().get_VARCHAR_h1w92s_k$() ? true : type === TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$()) ? JsonNull_getInstance() : type === TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$() ? JsonPrimitive_0(false) : JsonPrimitive(0); } function rowToJsonObject(_this__u8e3s4, columns) { // Inline function 'kotlin.collections.associate' call var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(columns, 10)), 16); // Inline function 'kotlin.collections.associateTo' call var destination = LinkedHashMap_init_$Create$_0(capacity); var tmp0_iterator = columns.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'kotlin.collections.plusAssign' call // Inline function 'com.ustadmobile.door.ext.rowToJsonObject.' call var pair = to(element.get_fieldName_tfocn0_k$(), getJsonPrimitive(_this__u8e3s4, element)); destination.put_4fpzoq_k$(pair.get_first_irdx8n_k$(), pair.get_second_jf7fjx_k$()); } return new JsonObject(destination); } function getJsonPrimitive(_this__u8e3s4, fieldInfo) { var colName = fieldInfo.get_fieldName_tfocn0_k$(); var tmp; if (fieldInfo.get_nullable_7petka_k$()) { var tmp0_subject = fieldInfo.get_dbFieldType_pz3j77_k$(); var tmp_0; if (tmp0_subject === TypesKmp_getInstance().get_SMALLINT_sw3een_k$()) { tmp_0 = JsonPrimitive(getShortNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_INTEGER_pibe8b_k$()) { tmp_0 = JsonPrimitive(getIntNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_BIGINT_47wyyw_k$()) { tmp_0 = JsonPrimitive(getLongNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_REAL_wo8h5z_k$()) { tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_FLOAT_i998gj_k$()) { tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_DOUBLE_36a61y_k$()) { tmp_0 = JsonPrimitive(getDoubleNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_VARCHAR_h1w92s_k$()) { tmp_0 = JsonPrimitive_1(_this__u8e3s4.getString_gb1pt9_k$(colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$()) { tmp_0 = JsonPrimitive_1(_this__u8e3s4.getString_gb1pt9_k$(colName)); } else if (tmp0_subject === TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$()) { tmp_0 = JsonPrimitive_0(getBooleanNullable(_this__u8e3s4, colName)); } else { throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.get_dbFieldType_pz3j77_k$()); } tmp = tmp_0; } else { var tmp1_subject = fieldInfo.get_dbFieldType_pz3j77_k$(); var tmp_1; if (tmp1_subject === TypesKmp_getInstance().get_SMALLINT_sw3een_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getShort_4zegvo_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_INTEGER_pibe8b_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getInt_npc9pd_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_BIGINT_47wyyw_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getLong_3wgf2g_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_REAL_wo8h5z_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getFloat_1jlp7w_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_FLOAT_i998gj_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getFloat_1jlp7w_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_DOUBLE_36a61y_k$()) { tmp_1 = JsonPrimitive(_this__u8e3s4.getDouble_v37ict_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_VARCHAR_h1w92s_k$()) { tmp_1 = JsonPrimitive_1(_this__u8e3s4.getString_gb1pt9_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_LONGVARCHAR_lmf0o_k$()) { tmp_1 = JsonPrimitive_1(_this__u8e3s4.getString_gb1pt9_k$(colName)); } else if (tmp1_subject === TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$()) { tmp_1 = JsonPrimitive_0(_this__u8e3s4.getBoolean_xz3hoo_k$(colName)); } else { throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.get_dbFieldType_pz3j77_k$()); } tmp = tmp_1; } return tmp; } function get_doorWrapperNodeId(_this__u8e3s4) { return get_doorWrapper(_this__u8e3s4).get_nodeId_h7ho7a_k$(); } function get_doorWrapper(_this__u8e3s4) { var tmp; if (isInterface(_this__u8e3s4, DoorDatabaseWrapper)) { tmp = isInterface(_this__u8e3s4, DoorDatabaseWrapper) ? _this__u8e3s4 : THROW_CCE(); } else { if (isInterface(_this__u8e3s4, DoorDatabaseRepository)) { var tmp_0 = _this__u8e3s4.get_db_knto1l_k$(); tmp = isInterface(tmp_0, DoorDatabaseWrapper) ? tmp_0 : THROW_CCE(); } else { throw IllegalArgumentException_init_$Create$('Cannot get doorWrapper for ' + _this__u8e3s4 + ' : it is not a wrapper or repository'); } } return tmp; } function get_STR_REGEX() { _init_properties_StringExt_kt__eg42u6(); // Inline function 'kotlin.getValue' call var this_0 = STR_REGEX$delegate; STR_REGEX$factory(); return this_0.get_value_j01efc_k$(); } var STR_REGEX$delegate; function get_sanitizeRegex() { _init_properties_StringExt_kt__eg42u6(); // Inline function 'kotlin.getValue' call var this_0 = sanitizeRegex$delegate; sanitizeRegex$factory(); return this_0.get_value_j01efc_k$(); } var sanitizeRegex$delegate; function get_POSTGRES_SELECT_IN_PATTERN() { _init_properties_StringExt_kt__eg42u6(); return POSTGRES_SELECT_IN_PATTERN; } var POSTGRES_SELECT_IN_PATTERN; function STR_REGEX$delegate$lambda() { _init_properties_StringExt_kt__eg42u6(); return Regex_init_$Create$('\\s\\s+'); } function sanitizeRegex$delegate$lambda() { _init_properties_StringExt_kt__eg42u6(); return Regex_init_$Create$('\\W'); } function STR_REGEX$factory() { return getPropertyCallableRef('STR_REGEX', 0, KProperty0, function () { return get_STR_REGEX(); }, null); } function sanitizeRegex$factory() { return getPropertyCallableRef('sanitizeRegex', 0, KProperty0, function () { return get_sanitizeRegex(); }, null); } var properties_initialized_StringExt_kt_sd962o; function _init_properties_StringExt_kt__eg42u6() { if (!properties_initialized_StringExt_kt_sd962o) { properties_initialized_StringExt_kt_sd962o = true; var tmp = LazyThreadSafetyMode_NONE_getInstance(); STR_REGEX$delegate = lazy(tmp, STR_REGEX$delegate$lambda); var tmp_0 = LazyThreadSafetyMode_NONE_getInstance(); sanitizeRegex$delegate = lazy(tmp_0, sanitizeRegex$delegate$lambda); POSTGRES_SELECT_IN_PATTERN = Regex_init_$Create$_0('IN(\\s*)\\((\\s*)\\?(\\s*)\\)', RegexOption_IGNORE_CASE_getInstance()); } } var Status_INACTIVE_instance; var Status_LOADING_instance; var Status_DONE_instance; var Status_FAILED_instance; function values_4() { return [Status_INACTIVE_getInstance(), Status_LOADING_getInstance(), Status_DONE_getInstance(), Status_FAILED_getInstance()]; } function valueOf_4(value) { switch (value) { case 'INACTIVE': return Status_INACTIVE_getInstance(); case 'LOADING': return Status_LOADING_getInstance(); case 'DONE': return Status_DONE_getInstance(); case 'FAILED': return Status_FAILED_getInstance(); default: Status_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_4() { if ($ENTRIES_4 == null) $ENTRIES_4 = enumEntries(values_4()); return $ENTRIES_4; } var Status_entriesInitialized; function Status_initEntries() { if (Status_entriesInitialized) return Unit_getInstance(); Status_entriesInitialized = true; Status_INACTIVE_instance = new Status('INACTIVE', 0); Status_LOADING_instance = new Status('LOADING', 1); Status_DONE_instance = new Status('DONE', 2); Status_FAILED_instance = new Status('FAILED', 3); } var $ENTRIES_4; function Status(name, ordinal) { Enum.call(this, name, ordinal); } function Status_INACTIVE_getInstance() { Status_initEntries(); return Status_INACTIVE_instance; } function Status_LOADING_getInstance() { Status_initEntries(); return Status_LOADING_instance; } function Status_DONE_getInstance() { Status_initEntries(); return Status_DONE_instance; } function Status_FAILED_getInstance() { Status_initEntries(); return Status_FAILED_instance; } function FlowLoadingState(status) { status = status === VOID ? Status_INACTIVE_getInstance() : status; this.status_1 = status; } protoOf(FlowLoadingState).get_status_jnf6d7_k$ = function () { return this.status_1; }; protoOf(FlowLoadingState).component1_7eebsc_k$ = function () { return this.status_1; }; protoOf(FlowLoadingState).copy_rtp42l_k$ = function (status) { return new FlowLoadingState(status); }; protoOf(FlowLoadingState).copy$default_u0acun_k$ = function (status, $super) { status = status === VOID ? this.status_1 : status; return $super === VOID ? this.copy_rtp42l_k$(status) : $super.copy_rtp42l_k$.call(this, status); }; protoOf(FlowLoadingState).toString = function () { return 'FlowLoadingState(status=' + this.status_1 + ')'; }; protoOf(FlowLoadingState).hashCode = function () { return this.status_1.hashCode(); }; protoOf(FlowLoadingState).equals = function (other) { if (this === other) return true; if (!(other instanceof FlowLoadingState)) return false; var tmp0_other_with_cast = other instanceof FlowLoadingState ? other : THROW_CCE(); if (!this.status_1.equals(tmp0_other_with_cast.status_1)) return false; return true; }; function RepoDaoFlowHelper$asRepoFlow$slambda$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) { this.$statusFlow_1 = $statusFlow; this.$onMakeHttpRequest_1 = $onMakeHttpRequest; CoroutineImpl.call(this, resultContinuation); } protoOf(RepoDaoFlowHelper$asRepoFlow$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(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RepoDaoFlowHelper$asRepoFlow$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$(3); this.set_exceptionState_fex74n_k$(2); l$ret$1: do { var this_0 = this.$statusFlow_1; while (true) { var prevValue = this_0.get_value_j01efc_k$(); var nextValue = prevValue.copy_rtp42l_k$(Status_LOADING_getInstance()); if (this_0.compareAndSet_l3595a_k$(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.set_state_rjd8d0_k$(1); suspendResult = this.$onMakeHttpRequest_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: l$ret$3: do { var this_1 = this.$statusFlow_1; while (true) { var prevValue_0 = this_1.get_value_j01efc_k$(); var nextValue_0 = prevValue_0.copy_rtp42l_k$(Status_DONE_getInstance()); if (this_1.compareAndSet_l3595a_k$(prevValue_0, nextValue_0)) { break l$ret$3; } } } while (false); 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 Exception) { var e = this.get_exception_x0n6w6_k$(); l$ret$5: do { var this_2 = this.$statusFlow_1; while (true) { var prevValue_1 = this_2.get_value_j01efc_k$(); var nextValue_1 = prevValue_1.copy_rtp42l_k$(Status_FAILED_getInstance()); if (this_2.compareAndSet_l3595a_k$(prevValue_1, nextValue_1)) { break l$ret$5; } } } while (false); 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(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda$slambda(this.$statusFlow_1, this.$onMakeHttpRequest_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function RepoDaoFlowHelper$asRepoFlow$slambda$slambda_0($statusFlow, $onMakeHttpRequest, resultContinuation) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda$slambda($statusFlow, $onMakeHttpRequest, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function _get_repo__dd1xjt($this) { return $this.repo_1; } function _get_flowToStatusMap__ivruds($this) { return $this.flowToStatusMap_1; } function RepoDaoFlowHelper$asRepoFlow$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) { this.$statusFlow_1 = $statusFlow; this.$onMakeHttpRequest_1 = $onMakeHttpRequest; CoroutineImpl.call(this, resultContinuation); } protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).invoke_ilgcjr_k$ = function ($this$onStart, $completion) { var tmp = this.create_xc9ltn_k$($this$onStart, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_ilgcjr_k$((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RepoDaoFlowHelper$asRepoFlow$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); var requestScope = CoroutineScope_0(this.get_context_h02k06_k$().plus_s13ygv_k$(Job())); launch(requestScope, VOID, VOID, RepoDaoFlowHelper$asRepoFlow$slambda$slambda_0(this.$statusFlow_1, this.$onMakeHttpRequest_1, null)); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).create_xc9ltn_k$ = function ($this$onStart, completion) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda(this.$statusFlow_1, this.$onMakeHttpRequest_1, completion); i.$this$onStart_1 = $this$onStart; return i; }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_xc9ltn_k$((!(value == null) ? isInterface(value, FlowCollector) : false) ? value : THROW_CCE(), completion); }; function RepoDaoFlowHelper$asRepoFlow$slambda_0($statusFlow, $onMakeHttpRequest, resultContinuation) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda($statusFlow, $onMakeHttpRequest, resultContinuation); var l = function ($this$onStart, $completion) { return i.invoke_ilgcjr_k$($this$onStart, $completion); }; l.$arity = 1; return l; } function RepoDaoFlowHelper(repo) { this.repo_1 = repo; this.flowToStatusMap_1 = weakMapOf(); } protoOf(RepoDaoFlowHelper).asRepoFlow_dk2js1_k$ = function (dbFlow, onMakeHttpRequest) { var statusFlow = MutableStateFlow(new FlowLoadingState()); var wrappedFlow = onStart(dbFlow, RepoDaoFlowHelper$asRepoFlow$slambda_0(statusFlow, onMakeHttpRequest, null)); this.flowToStatusMap_1.set_c2d6a0_k$(wrappedFlow, statusFlow); return wrappedFlow; }; protoOf(RepoDaoFlowHelper).httpStatusOf_jwmjhw_k$ = function (flow) { return this.flowToStatusMap_1.get_h31hzz_k$(flow); }; function repoHttpRequest(_this__u8e3s4, repoPath, block) { var tmp; try { tmp = block(); } catch ($p) { var tmp_0; if ($p instanceof Exception) { var e = $p; var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.w_a4gdqk_k$(e, tmp1_tag, repoHttpRequest$lambda(_this__u8e3s4, repoPath)); throw e; } else { throw $p; } } return tmp; } function replicateHttpRequestCatchAndLog(_this__u8e3s4, repoPath, block) { try { block(); } catch ($p) { if ($p instanceof Exception) { var e = $p; var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.v_q0zci3_k$(e, tmp1_tag, replicateHttpRequestCatchAndLog$lambda(_this__u8e3s4, repoPath)); } else { throw $p; } } } function replicateHttpRequestOrThrow(_this__u8e3s4, repoPath, block) { try { return block(); } catch ($p) { if ($p instanceof Exception) { var e = $p; var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.v_q0zci3_k$(e, tmp1_tag, replicateHttpRequestOrThrow$lambda(_this__u8e3s4, repoPath)); throw e; } else { throw $p; } } } function repoHttpRequestWithFallback(_this__u8e3s4, repoPath, http, fallback) { var tmp; try { tmp = http(); } catch ($p) { var tmp_0; if ($p instanceof Exception) { var e = $p; var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.v_q0zci3_k$(e, tmp1_tag, repoHttpRequestWithFallback$lambda(_this__u8e3s4, repoPath)); tmp_0 = fallback(); } else { throw $p; } tmp = tmp_0; } return tmp; } function repoHttpRequest$lambda($this_repoHttpRequest, $repoPath) { return function () { return '' + $this_repoHttpRequest + ': repoHttpRequest: exception for ' + $repoPath; }; } function replicateHttpRequestCatchAndLog$lambda($this_replicateHttpRequestCatchAndLog, $repoPath) { return function () { return '' + $this_replicateHttpRequestCatchAndLog + ': repoHttpRequestWithFallback: exception for ' + $repoPath; }; } function replicateHttpRequestOrThrow$lambda($this_replicateHttpRequestOrThrow, $repoPath) { return function () { return '' + $this_replicateHttpRequestOrThrow + ': repoHttpRequestWithFallback: exception for ' + $repoPath; }; } function repoHttpRequestWithFallback$lambda($this_repoHttpRequestWithFallback, $repoPath) { return function () { return '' + $this_repoHttpRequestWithFallback + ': repoHttpRequestWithFallback: exception for ' + $repoPath; }; } function RepositoryDaoWithFlowHelper() { } function ConnectionAsync() { } function StatementConstantsKmp() { StatementConstantsKmp_instance = this; this.RETURN_GENERATED_KEYS_1 = 1; this.NO_GENERATED_KEYS_1 = 2; } protoOf(StatementConstantsKmp).get_RETURN_GENERATED_KEYS_s33sei_k$ = function () { return this.RETURN_GENERATED_KEYS_1; }; protoOf(StatementConstantsKmp).set_NO_GENERATED_KEYS_8zcrr1_k$ = function (_set____db54di) { this.NO_GENERATED_KEYS_1 = _set____db54di; }; protoOf(StatementConstantsKmp).get_NO_GENERATED_KEYS_h4ycm1_k$ = function () { return this.NO_GENERATED_KEYS_1; }; var StatementConstantsKmp_instance; function StatementConstantsKmp_getInstance() { if (StatementConstantsKmp_instance == null) new StatementConstantsKmp(); return StatementConstantsKmp_instance; } function TypesKmp() { TypesKmp_instance = this; this.INTEGER_1 = 4; this.BOOLEAN_1 = 16; this.VARCHAR_1 = 12; this.BIGINT_1 = -5; this.FLOAT_1 = 6; this.REAL_1 = 7; this.DOUBLE_1 = 8; this.SMALLINT_1 = 5; this.LONGVARCHAR_1 = -1; this.ARRAY_1 = 2003; } protoOf(TypesKmp).get_INTEGER_pibe8b_k$ = function () { return this.INTEGER_1; }; protoOf(TypesKmp).get_BOOLEAN_e7jswv_k$ = function () { return this.BOOLEAN_1; }; protoOf(TypesKmp).get_VARCHAR_h1w92s_k$ = function () { return this.VARCHAR_1; }; protoOf(TypesKmp).get_BIGINT_47wyyw_k$ = function () { return this.BIGINT_1; }; protoOf(TypesKmp).get_FLOAT_i998gj_k$ = function () { return this.FLOAT_1; }; protoOf(TypesKmp).get_REAL_wo8h5z_k$ = function () { return this.REAL_1; }; protoOf(TypesKmp).get_DOUBLE_36a61y_k$ = function () { return this.DOUBLE_1; }; protoOf(TypesKmp).get_SMALLINT_sw3een_k$ = function () { return this.SMALLINT_1; }; protoOf(TypesKmp).get_LONGVARCHAR_lmf0o_k$ = function () { return this.LONGVARCHAR_1; }; protoOf(TypesKmp).get_ARRAY_i6m5n4_k$ = function () { return this.ARRAY_1; }; var TypesKmp_instance; function TypesKmp_getInstance() { if (TypesKmp_instance == null) new TypesKmp(); return TypesKmp_instance; } function useConnection(_this__u8e3s4, block) { try { return block(_this__u8e3s4); }finally { _this__u8e3s4.close_yn9xrc_k$(); } } function setFloatNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_getInstance().get_FLOAT_i998gj_k$(); var tmp; if (!(value == null)) { _this__u8e3s4.setFloat_dia6lm_k$(index, value); tmp = Unit_getInstance(); } else { _this__u8e3s4.setNull_24rkav_k$(index, sqlType); tmp = Unit_getInstance(); } return tmp; } function setBooleanNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_getInstance().get_BOOLEAN_e7jswv_k$(); var tmp; if (!(value == null)) { _this__u8e3s4.setBoolean_pzdm1v_k$(index, value); tmp = Unit_getInstance(); } else { _this__u8e3s4.setNull_24rkav_k$(index, sqlType); tmp = Unit_getInstance(); } return tmp; } function setLongNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_getInstance().get_BIGINT_47wyyw_k$(); var tmp; if (!(value == null)) { _this__u8e3s4.setLong_j1sybo_k$(index, value); tmp = Unit_getInstance(); } else { _this__u8e3s4.setNull_24rkav_k$(index, sqlType); tmp = Unit_getInstance(); } return tmp; } function setIntNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_getInstance().get_INTEGER_pibe8b_k$(); var tmp; if (!(value == null)) { _this__u8e3s4.setInt_c72a8z_k$(index, value); tmp = Unit_getInstance(); } else { _this__u8e3s4.setNull_24rkav_k$(index, sqlType); tmp = Unit_getInstance(); } return tmp; } function setNullableParam(_this__u8e3s4, index, value, sqlType, setter) { if (!(value == null)) setter(index, value); else { _this__u8e3s4.setNull_24rkav_k$(index, sqlType); } } function useResults(_this__u8e3s4, block) { try { return block(_this__u8e3s4); }finally { _this__u8e3s4.close_yn9xrc_k$(); } } function mapRows(_this__u8e3s4, block) { var mappedResults = mutableLinkedListOf_0([]); while (_this__u8e3s4.next_20eer_k$()) { // Inline function 'kotlin.collections.plusAssign' call var element = block(_this__u8e3s4); mappedResults.add_utx5q5_k$(element); } return mappedResults; } function mapNextRow(_this__u8e3s4, defaultVal, block) { return _this__u8e3s4.next_20eer_k$() ? block(_this__u8e3s4) : defaultVal; } function getShortNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getShortNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getShort_4zegvo_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getIntNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getIntNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getInt_npc9pd_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getLongNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getLongNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getLong_3wgf2g_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getFloatNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getFloatNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getFloat_1jlp7w_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getDoubleNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getDoubleNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getDouble_v37ict_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getBooleanNullable(_this__u8e3s4, columnName) { // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull' call // Inline function 'kotlin.let' call // Inline function 'com.ustadmobile.door.jdbc.ext.getBooleanNullable.' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = _this__u8e3s4.getBoolean_xz3hoo_k$(columnName); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function getOrNull(_this__u8e3s4, block) { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.jdbc.ext.getOrNull.' call var it = block(_this__u8e3s4); return _this__u8e3s4.wasNull_ilge1c_k$() ? null : it; } function mapNextRow_0(_this__u8e3s4, block) { var tmp; if (_this__u8e3s4.next_20eer_k$()) { tmp = block(_this__u8e3s4); } else { throw NullPointerException_init_$Create$('mapNextRow: no row and no default value provided'); } return tmp; } function getStringNonNull(_this__u8e3s4, columnName) { var tmp0_elvis_lhs = _this__u8e3s4.getString_gb1pt9_k$(columnName); var tmp; if (tmp0_elvis_lhs == null) { throw IllegalStateException_init_$Create$('Column ' + columnName + ' was supposed to be non-null, got null'); } else { tmp = tmp0_elvis_lhs; } return tmp; } function useStatementAsync(_this__u8e3s4, block, $completion) { var tmp = new $useStatementAsyncCOROUTINE$13(_this__u8e3s4, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function useStatement(_this__u8e3s4, block) { try { return block(_this__u8e3s4); } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { _this__u8e3s4.close_yn9xrc_k$(); } } function $useStatementAsyncCOROUTINE$13(_this__u8e3s4, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.block_1 = block; } protoOf($useStatementAsyncCOROUTINE$13).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$(7); this.set_state_rjd8d0_k$(1); continue $sm; case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(6); this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(3); suspendResult = this.block_1(this._this__u8e3s4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.tmp$ret$01__1 = suspendResult; this.set_exceptionState_fex74n_k$(7); this.set_state_rjd8d0_k$(4); var tmp_0 = this; continue $sm; case 4: var tmp_1 = this.tmp$ret$01__1; this.set_exceptionState_fex74n_k$(7); this._this__u8e3s4__1.close_yn9xrc_k$(); return tmp_1; case 5: this.set_exceptionState_fex74n_k$(6); var tmp_2 = this.get_exception_x0n6w6_k$(); if (tmp_2 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_3 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 6: this.set_exceptionState_fex74n_k$(7); var t = this.get_exception_x0n6w6_k$(); this._this__u8e3s4__1.close_yn9xrc_k$(); throw t; case 7: throw this.get_exception_x0n6w6_k$(); case 8: this.set_exceptionState_fex74n_k$(7); this._this__u8e3s4__1.close_yn9xrc_k$(); return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 7) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; var DoorLogLevel_VERBOSE_instance; var DoorLogLevel_DEBUG_instance; var DoorLogLevel_INFO_instance; var DoorLogLevel_WARNING_instance; var DoorLogLevel_ERROR_instance; var DoorLogLevel_ASSERT_instance; function values_5() { return [DoorLogLevel_VERBOSE_getInstance(), DoorLogLevel_DEBUG_getInstance(), DoorLogLevel_INFO_getInstance(), DoorLogLevel_WARNING_getInstance(), DoorLogLevel_ERROR_getInstance(), DoorLogLevel_ASSERT_getInstance()]; } function valueOf_5(value) { switch (value) { case 'VERBOSE': return DoorLogLevel_VERBOSE_getInstance(); case 'DEBUG': return DoorLogLevel_DEBUG_getInstance(); case 'INFO': return DoorLogLevel_INFO_getInstance(); case 'WARNING': return DoorLogLevel_WARNING_getInstance(); case 'ERROR': return DoorLogLevel_ERROR_getInstance(); case 'ASSERT': return DoorLogLevel_ASSERT_getInstance(); default: DoorLogLevel_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_5() { if ($ENTRIES_5 == null) $ENTRIES_5 = enumEntries(values_5()); return $ENTRIES_5; } var DoorLogLevel_entriesInitialized; function DoorLogLevel_initEntries() { if (DoorLogLevel_entriesInitialized) return Unit_getInstance(); DoorLogLevel_entriesInitialized = true; DoorLogLevel_VERBOSE_instance = new DoorLogLevel('VERBOSE', 0); DoorLogLevel_DEBUG_instance = new DoorLogLevel('DEBUG', 1); DoorLogLevel_INFO_instance = new DoorLogLevel('INFO', 2); DoorLogLevel_WARNING_instance = new DoorLogLevel('WARNING', 3); DoorLogLevel_ERROR_instance = new DoorLogLevel('ERROR', 4); DoorLogLevel_ASSERT_instance = new DoorLogLevel('ASSERT', 5); } var $ENTRIES_5; function DoorLogLevel(name, ordinal) { Enum.call(this, name, ordinal); } function DoorLogLevel_VERBOSE_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_VERBOSE_instance; } function DoorLogLevel_DEBUG_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_DEBUG_instance; } function DoorLogLevel_INFO_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_INFO_instance; } function DoorLogLevel_WARNING_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_WARNING_instance; } function DoorLogLevel_ERROR_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_ERROR_instance; } function DoorLogLevel_ASSERT_getInstance() { DoorLogLevel_initEntries(); return DoorLogLevel_ASSERT_instance; } function DoorLogger() { } function d(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_kks8iu_k$(DoorLogLevel_DEBUG_getInstance(), message, throwable); } function v(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_vpti5k_k$(DoorLogLevel_VERBOSE_getInstance(), throwable, message); } function w(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_vpti5k_k$(DoorLogLevel_WARNING_getInstance(), throwable, message); } function d_0(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_vpti5k_k$(DoorLogLevel_DEBUG_getInstance(), throwable, message); } function i(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_kks8iu_k$(DoorLogLevel_INFO_getInstance(), message, throwable); } function e(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_kks8iu_k$(DoorLogLevel_ERROR_getInstance(), message, throwable); } function w_0(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_kks8iu_k$(DoorLogLevel_WARNING_getInstance(), message, throwable); } function e_0(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.log_vpti5k_k$(DoorLogLevel_ERROR_getInstance(), throwable, message); } function _get_tag__e6h4qf($this) { return $this.tag_1; } function toNapierLogLevel(_this__u8e3s4, $this) { var tmp; switch (_this__u8e3s4.get_ordinal_ip24qg_k$()) { case 0: tmp = LogLevel_VERBOSE_getInstance(); break; case 1: tmp = LogLevel_DEBUG_getInstance(); break; case 2: tmp = LogLevel_INFO_getInstance(); break; case 3: tmp = LogLevel_WARNING_getInstance(); break; case 4: tmp = LogLevel_ERROR_getInstance(); break; case 5: tmp = LogLevel_ASSERT_getInstance(); break; default: noWhenBranchMatchedException(); break; } return tmp; } function NapierDoorLogger(tag) { tag = tag === VOID ? Companion_getInstance_13().get_LOG_TAG_it8mba_k$() : tag; this.tag_1 = tag; } protoOf(NapierDoorLogger).log_kks8iu_k$ = function (level, message, throwable) { Napier_getInstance().log_lmdivf_k$(toNapierLogLevel(level, this), this.tag_1, throwable, message); }; protoOf(NapierDoorLogger).log_vpti5k_k$ = function (level, throwable, message) { var logLevel = toNapierLogLevel(level, this); if (Napier_getInstance().isEnable_3u442w_k$(logLevel, this.tag_1)) { Napier_getInstance().log_lmdivf_k$(logLevel, this.tag_1, throwable, message()); } }; function DefaultDoorMessageCallback() { } protoOf(DefaultDoorMessageCallback).onIncomingMessageReceived_pehqv4_k$ = function (db, eventMessage, $completion) { return eventMessage; }; protoOf(DefaultDoorMessageCallback).onIncomingMessageProcessed_12bofr_k$ = function (db, eventMessage, $completion) { return Unit_getInstance(); }; protoOf(DefaultDoorMessageCallback).onBeforeOutgoingMessageSend_yxed9a_k$ = function (db, eventMessage, $completion) { return eventMessage; }; protoOf(DefaultDoorMessageCallback).onOutgoingMessageSent_6kws8v_k$ = function (db, eventMessage, $completion) { return Unit_getInstance(); }; function _get_$childSerializers__r2zwns($this) { return $this.$childSerializers_1; } function Companion_12() { Companion_instance_12 = this; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.$childSerializers_1 = [null, null, null, new ArrayListSerializer($serializer_getInstance_1())]; this.WHAT_REPLICATION_PUSH_1 = 1; this.WHAT_REPLICATION_PULL_1 = 2; } protoOf(Companion_12).get_WHAT_REPLICATION_PUSH_tr3xkv_k$ = function () { return this.WHAT_REPLICATION_PUSH_1; }; protoOf(Companion_12).get_WHAT_REPLICATION_PULL_tr3xey_k$ = function () { return this.WHAT_REPLICATION_PULL_1; }; protoOf(Companion_12).serializer_9w0wvi_k$ = function () { return $serializer_getInstance_0(); }; var Companion_instance_12; function Companion_getInstance_15() { if (Companion_instance_12 == null) new Companion_12(); return Companion_instance_12; } function $serializer_0() { $serializer_instance_0 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.message.DoorMessage', this, 4); tmp0_serialDesc.addElement_5pzumi_k$('what', false); tmp0_serialDesc.addElement_5pzumi_k$('fromNode', false); tmp0_serialDesc.addElement_5pzumi_k$('toNode', false); tmp0_serialDesc.addElement_5pzumi_k$('replications', false); this.descriptor_1 = tmp0_serialDesc; } protoOf($serializer_0).get_descriptor_wjt6a0_k$ = function () { return this.descriptor_1; }; protoOf($serializer_0).childSerializers_5ghqw5_k$ = function () { var tmp0_cached = Companion_getInstance_15().$childSerializers_1; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [IntSerializer_getInstance(), LongSerializer_getInstance(), LongSerializer_getInstance(), tmp0_cached[3]]; }; protoOf($serializer_0).deserialize_sy6x50_k$ = function (decoder) { var tmp0_desc = this.descriptor_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = 0; var tmp5_local1 = new Long(0, 0); var tmp6_local2 = new Long(0, 0); var tmp7_local3 = null; var tmp8_input = decoder.beginStructure_yljocp_k$(tmp0_desc); var tmp9_cached = Companion_getInstance_15().$childSerializers_1; if (tmp8_input.decodeSequentially_xlblqy_k$()) { tmp4_local0 = tmp8_input.decodeIntElement_941u6a_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; tmp5_local1 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; tmp6_local2 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 2); tmp3_bitMask0 = tmp3_bitMask0 | 4; tmp7_local3 = tmp8_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 3, tmp9_cached[3], tmp7_local3); tmp3_bitMask0 = tmp3_bitMask0 | 8; } else while (tmp1_flag) { tmp2_index = tmp8_input.decodeElementIndex_bstkhp_k$(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp8_input.decodeIntElement_941u6a_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; case 1: tmp5_local1 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; break; case 2: tmp6_local2 = tmp8_input.decodeLongElement_994anb_k$(tmp0_desc, 2); tmp3_bitMask0 = tmp3_bitMask0 | 4; break; case 3: tmp7_local3 = tmp8_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 3, tmp9_cached[3], tmp7_local3); tmp3_bitMask0 = tmp3_bitMask0 | 8; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp8_input.endStructure_1xqz0n_k$(tmp0_desc); return DoorMessage_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, null); }; protoOf($serializer_0).serialize_odwvld_k$ = function (encoder, value) { var tmp0_desc = this.descriptor_1; var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc); var tmp2_cached = Companion_getInstance_15().$childSerializers_1; tmp1_output.encodeIntElement_krhhce_k$(tmp0_desc, 0, value.what_1); tmp1_output.encodeLongElement_cega27_k$(tmp0_desc, 1, value.fromNode_1); tmp1_output.encodeLongElement_cega27_k$(tmp0_desc, 2, value.toNode_1); tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 3, tmp2_cached[3], value.replications_1); tmp1_output.endStructure_1xqz0n_k$(tmp0_desc); }; protoOf($serializer_0).serialize_5ase3y_k$ = function (encoder, value) { return this.serialize_odwvld_k$(encoder, value instanceof DoorMessage ? value : THROW_CCE()); }; var $serializer_instance_0; function $serializer_getInstance_0() { if ($serializer_instance_0 == null) new $serializer_0(); return $serializer_instance_0; } function DoorMessage_init_$Init$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker, $this) { if (!(15 === (15 & seen1))) { throwMissingFieldException(seen1, 15, $serializer_getInstance_0().descriptor_1); } $this.what_1 = what; $this.fromNode_1 = fromNode; $this.toNode_1 = toNode; $this.replications_1 = replications; return $this; } function DoorMessage_init_$Create$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker) { return DoorMessage_init_$Init$(seen1, what, fromNode, toNode, replications, serializationConstructorMarker, objectCreate(protoOf(DoorMessage))); } function DoorMessage(what, fromNode, toNode, replications) { Companion_getInstance_15(); this.what_1 = what; this.fromNode_1 = fromNode; this.toNode_1 = toNode; this.replications_1 = replications; } protoOf(DoorMessage).get_what_wowufh_k$ = function () { return this.what_1; }; protoOf(DoorMessage).get_fromNode_in16s5_k$ = function () { return this.fromNode_1; }; protoOf(DoorMessage).get_toNode_k1dkx2_k$ = function () { return this.toNode_1; }; protoOf(DoorMessage).get_replications_s2xb3k_k$ = function () { return this.replications_1; }; protoOf(DoorMessage).component1_7eebsc_k$ = function () { return this.what_1; }; protoOf(DoorMessage).component2_7eebsb_k$ = function () { return this.fromNode_1; }; protoOf(DoorMessage).component3_7eebsa_k$ = function () { return this.toNode_1; }; protoOf(DoorMessage).component4_7eebs9_k$ = function () { return this.replications_1; }; protoOf(DoorMessage).copy_o3k2ca_k$ = function (what, fromNode, toNode, replications) { return new DoorMessage(what, fromNode, toNode, replications); }; protoOf(DoorMessage).copy$default_j96d3w_k$ = function (what, fromNode, toNode, replications, $super) { what = what === VOID ? this.what_1 : what; fromNode = fromNode === VOID ? this.fromNode_1 : fromNode; toNode = toNode === VOID ? this.toNode_1 : toNode; replications = replications === VOID ? this.replications_1 : replications; return $super === VOID ? this.copy_o3k2ca_k$(what, fromNode, toNode, replications) : $super.copy_o3k2ca_k$.call(this, what, fromNode, toNode, replications); }; protoOf(DoorMessage).toString = function () { return 'DoorMessage(what=' + this.what_1 + ', fromNode=' + this.fromNode_1.toString() + ', toNode=' + this.toNode_1.toString() + ', replications=' + this.replications_1 + ')'; }; protoOf(DoorMessage).hashCode = function () { var result = this.what_1; result = imul(result, 31) + this.fromNode_1.hashCode() | 0; result = imul(result, 31) + this.toNode_1.hashCode() | 0; result = imul(result, 31) + hashCode(this.replications_1) | 0; return result; }; protoOf(DoorMessage).equals = function (other) { if (this === other) return true; if (!(other instanceof DoorMessage)) return false; var tmp0_other_with_cast = other instanceof DoorMessage ? other : THROW_CCE(); if (!(this.what_1 === tmp0_other_with_cast.what_1)) return false; if (!this.fromNode_1.equals(tmp0_other_with_cast.fromNode_1)) return false; if (!this.toNode_1.equals(tmp0_other_with_cast.toNode_1)) return false; if (!equals(this.replications_1, tmp0_other_with_cast.replications_1)) return false; return true; }; function DoorMessageCallback() { } function DoorMigration() { } function DoorMigrationAsync(startVersion, endVersion, migrateFn) { DoorMigration.call(this); this.startVersion_1 = startVersion; this.endVersion_1 = endVersion; this.migrateFn_1 = migrateFn; } protoOf(DoorMigrationAsync).get_startVersion_84uten_k$ = function () { return this.startVersion_1; }; protoOf(DoorMigrationAsync).get_endVersion_algoai_k$ = function () { return this.endVersion_1; }; protoOf(DoorMigrationAsync).get_migrateFn_5ksgd2_k$ = function () { return this.migrateFn_1; }; function DoorMigrationStatementList(startVersion, endVersion, migrateStmts) { DoorMigration.call(this); this.startVersion_1 = startVersion; this.endVersion_1 = endVersion; this.migrateStmts_1 = migrateStmts; } protoOf(DoorMigrationStatementList).get_startVersion_84uten_k$ = function () { return this.startVersion_1; }; protoOf(DoorMigrationStatementList).get_endVersion_algoai_k$ = function () { return this.endVersion_1; }; protoOf(DoorMigrationStatementList).get_migrateStmts_i54q9j_k$ = function () { return this.migrateStmts_1; }; function DoorMigrationSync(startVersion, endVersion, migrateFn) { DoorMigration.call(this); this.startVersion_1 = startVersion; this.endVersion_1 = endVersion; this.migrateFn_1 = migrateFn; } protoOf(DoorMigrationSync).get_startVersion_84uten_k$ = function () { return this.startVersion_1; }; protoOf(DoorMigrationSync).get_endVersion_algoai_k$ = function () { return this.endVersion_1; }; protoOf(DoorMigrationSync).get_migrateFn_5ksgd2_k$ = function () { return this.migrateFn_1; }; function NodeEvent(what, toNode, tableId, key1, key2, key3, key4) { this.what_1 = what; this.toNode_1 = toNode; this.tableId_1 = tableId; this.key1__1 = key1; this.key2__1 = key2; this.key3__1 = key3; this.key4__1 = key4; } protoOf(NodeEvent).get_what_wowufh_k$ = function () { return this.what_1; }; protoOf(NodeEvent).get_toNode_k1dkx2_k$ = function () { return this.toNode_1; }; protoOf(NodeEvent).get_tableId_of07s0_k$ = function () { return this.tableId_1; }; protoOf(NodeEvent).get_key1_wop4vv_k$ = function () { return this.key1__1; }; protoOf(NodeEvent).get_key2_wop4vw_k$ = function () { return this.key2__1; }; protoOf(NodeEvent).get_key3_wop4vx_k$ = function () { return this.key3__1; }; protoOf(NodeEvent).get_key4_wop4vy_k$ = function () { return this.key4__1; }; function createNodeEventTableAndTrigger(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion) { temporary = temporary === VOID ? true : temporary; var tmp = new $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.hasOutgoingReplicationTable_1 = hasOutgoingReplicationTable; this.temporary_1 = temporary; } protoOf($createNodeEventTableAndTriggerCOROUTINE$14).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$(10); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(9); this.set_exceptionState_fex74n_k$(8); var tmp_1 = this; tmp_1.stmt4__1 = this.this1__1; this.set_state_rjd8d0_k$(4); var tmp_2; if (this.temporary_1) { tmp_2 = NodeEventConstants_getInstance().get_CREATE_NODE_EVENT_TMP_TABLE_SQL_nmsya5_k$(); } else { tmp_2 = NodeEventConstants_getInstance().get_CREATE_NODE_EVENT_TABLE_SQL_qrhtqt_k$(); } suspendResult = executeUpdateAsync(this.stmt4__1, tmp_2, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var tmp_3 = this; var this_0 = this.stmt4__1; var tmp_4; if (this.hasOutgoingReplicationTable_1) { tmp_4 = this_0; } else { tmp_4 = null; } tmp_3.tmp0_safe_receiver5__1 = tmp_4; if (this.tmp0_safe_receiver5__1 == null) { this.WHEN_RESULT6__1 = null; this.set_state_rjd8d0_k$(6); continue $sm; } else { this.set_state_rjd8d0_k$(5); var tmp_5; if (this.temporary_1) { tmp_5 = NodeEventConstants_getInstance().get_CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_TMP_ga6zuu_k$(); } else { tmp_5 = NodeEventConstants_getInstance().get_CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_7q214u_k$(); } suspendResult = executeUpdateAsync(this.tmp0_safe_receiver5__1, tmp_5, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 5: this.WHEN_RESULT6__1 = suspendResult; this.set_state_rjd8d0_k$(6); continue $sm; case 6: this.tmp$ret$03__1 = this.WHEN_RESULT6__1; this.set_exceptionState_fex74n_k$(10); this.set_state_rjd8d0_k$(7); var tmp_6 = this; continue $sm; case 7: var tmp_7 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(10); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = tmp_7; this.set_state_rjd8d0_k$(12); continue $sm; case 8: this.set_exceptionState_fex74n_k$(9); var tmp_8 = this.get_exception_x0n6w6_k$(); if (tmp_8 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_9 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 9: this.set_exceptionState_fex74n_k$(10); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 10: throw this.get_exception_x0n6w6_k$(); case 11: this.set_exceptionState_fex74n_k$(10); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(12); continue $sm; case 12: return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 10) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function _get_NODE_EVENT_TABLE_SQL__i1e7dc($this) { return $this.NODE_EVENT_TABLE_SQL_1; } function _get_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER__np985x($this) { return $this.OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_1; } function NodeEventConstants() { NodeEventConstants_instance = this; this.OUTGOING_REPLICATION_TABLE_NAME_1 = 'OutgoingReplication'; this.NODE_EVENT_TABLE_SQL_1 = '\n TABLE IF NOT EXISTS NodeEvent (\n eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n what INTEGER NOT NULL, \n toNode BIGINT NOT NULL,\n tableId INTEGER NOT NULL,\n key1 BIGINT NOT NULL,\n key2 BIGINT NOT NULL,\n key3 BIGINT NOT NULL,\n key4 BIGINT NOT NULL\n )\n '; this.CREATE_NODE_EVENT_TMP_TABLE_SQL_1 = '\n CREATE TEMP \n TABLE IF NOT EXISTS NodeEvent (\n eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n what INTEGER NOT NULL, \n toNode BIGINT NOT NULL,\n tableId INTEGER NOT NULL,\n key1 BIGINT NOT NULL,\n key2 BIGINT NOT NULL,\n key3 BIGINT NOT NULL,\n key4 BIGINT NOT NULL\n )\n \n '; this.CREATE_NODE_EVENT_TABLE_SQL_1 = '\n CREATE \n TABLE IF NOT EXISTS NodeEvent (\n eventId INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n what INTEGER NOT NULL, \n toNode BIGINT NOT NULL,\n tableId INTEGER NOT NULL,\n key1 BIGINT NOT NULL,\n key2 BIGINT NOT NULL,\n key3 BIGINT NOT NULL,\n key4 BIGINT NOT NULL\n )\n \n '; this.OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_1 = '\n TRIGGER IF NOT EXISTS _door_event_trig\n AFTER INSERT\n ON OutgoingReplication\n BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n VALUES (1, \n NEW.destNodeId, \n NEW.orTableId,\n NEW.orPk1,\n NEW.orPk2,\n NEW.orPK3,\n NEW.orPk4\n );\n END \n '; this.CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_TMP_1 = '\n CREATE TEMP \n TRIGGER IF NOT EXISTS _door_event_trig\n AFTER INSERT\n ON OutgoingReplication\n BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n VALUES (1, \n NEW.destNodeId, \n NEW.orTableId,\n NEW.orPk1,\n NEW.orPk2,\n NEW.orPK3,\n NEW.orPk4\n );\n END \n \n '; this.CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_1 = '\n CREATE \n TRIGGER IF NOT EXISTS _door_event_trig\n AFTER INSERT\n ON OutgoingReplication\n BEGIN INSERT INTO NodeEvent(what, toNode, tableId, key1, key2, key3, key4)\n VALUES (1, \n NEW.destNodeId, \n NEW.orTableId,\n NEW.orPk1,\n NEW.orPk2,\n NEW.orPK3,\n NEW.orPk4\n );\n END \n \n '; this.SELECT_EVENT_FROM_TMP_TABLE_1 = '\n SELECT NodeEvent.what AS what,\n NodeEvent.toNode AS toNode,\n NodeEvent.tableId AS tableId,\n NodeEvent.key1 AS key1,\n NodeEvent.key2 AS key2,\n NodeEvent.key3 AS key3,\n NodeEvent.key4 AS key4\n FROM NodeEvent\n '; this.CLEAR_EVENTS_TMP_TABLE_1 = '\n DELETE FROM NodeEvent\n '; } protoOf(NodeEventConstants).get_OUTGOING_REPLICATION_TABLE_NAME_fm288p_k$ = function () { return this.OUTGOING_REPLICATION_TABLE_NAME_1; }; protoOf(NodeEventConstants).get_CREATE_NODE_EVENT_TMP_TABLE_SQL_nmsya5_k$ = function () { return this.CREATE_NODE_EVENT_TMP_TABLE_SQL_1; }; protoOf(NodeEventConstants).get_CREATE_NODE_EVENT_TABLE_SQL_qrhtqt_k$ = function () { return this.CREATE_NODE_EVENT_TABLE_SQL_1; }; protoOf(NodeEventConstants).get_CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_TMP_ga6zuu_k$ = function () { return this.CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_TMP_1; }; protoOf(NodeEventConstants).get_CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_7q214u_k$ = function () { return this.CREATE_OUTGOING_REPLICATION_NODE_EVENT_TRIGGER_1; }; protoOf(NodeEventConstants).get_SELECT_EVENT_FROM_TMP_TABLE_iqhehc_k$ = function () { return this.SELECT_EVENT_FROM_TMP_TABLE_1; }; protoOf(NodeEventConstants).get_CLEAR_EVENTS_TMP_TABLE_cs4qzf_k$ = function () { return this.CLEAR_EVENTS_TMP_TABLE_1; }; var NodeEventConstants_instance; function NodeEventConstants_getInstance() { if (NodeEventConstants_instance == null) new NodeEventConstants(); return NodeEventConstants_instance; } function NodeEventManager() { } function _get__incomingMessages__o1h4sg($this) { return $this._incomingMessages_1; } function NodeEventManagerCommon$onIncomingMessageReceived$lambda(this$0, $message) { return function () { return this$0.logPrefix_1 + ' receiveMessage with ' + $message.get_replications_s2xb3k_k$().get_size_woubt6_k$() + ' replications: run inserts'; }; } function NodeEventManagerCommon$onIncomingMessageReceived$slambda(this$0, $message, resultContinuation) { this.this$0__1 = this$0; this.$message_1 = $message; CoroutineImpl.call(this, resultContinuation); } protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).invoke_dkhsnf_k$ = function (it, $completion) { var tmp = this.create_vzhb75_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_dkhsnf_k$(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$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); this.set_state_rjd8d0_k$(1); suspendResult = this.this$0__1.messageCallback_1.onIncomingMessageReceived_pehqv4_k$(this.this$0__1.db_1, this.$message_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.messageToProcess0__1 = suspendResult; this.set_state_rjd8d0_k$(2); suspendResult = insertEntitiesFromMessage(this.this$0__1.db_1, this.messageToProcess0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.set_state_rjd8d0_k$(3); suspendResult = this.this$0__1.messageCallback_1.onIncomingMessageProcessed_12bofr_k$(this.this$0__1.db_1, this.messageToProcess0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } 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(NodeEventManagerCommon$onIncomingMessageReceived$slambda).create_vzhb75_k$ = function (it, completion) { var i = new NodeEventManagerCommon$onIncomingMessageReceived$slambda(this.this$0__1, this.$message_1, completion); i.it_1 = it; return i; }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_vzhb75_k$(value instanceof RoomDatabase ? value : THROW_CCE(), completion); }; function NodeEventManagerCommon$onIncomingMessageReceived$slambda_0(this$0, $message, resultContinuation) { var i = new NodeEventManagerCommon$onIncomingMessageReceived$slambda(this$0, $message, resultContinuation); var l = function (it, $completion) { return i.invoke_dkhsnf_k$(it, $completion); }; l.$arity = 1; return l; } function NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this$0, $message) { return function () { return this$0.logPrefix_1 + ' receiveMessage with ' + $message.get_replications_s2xb3k_k$().get_size_woubt6_k$() + ' replications: inserts done/transaction finished'; }; } function $onIncomingMessageReceivedCOROUTINE$15(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.message_1 = message; } protoOf($onIncomingMessageReceivedCOROUTINE$15).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); this._this__u8e3s4__1.assertNotClosed_modxnt_k$(); this.set_exceptionState_fex74n_k$(3); var tmp_0 = this._this__u8e3s4__1.get_logger_g9gejd_k$(); v(tmp_0, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda(this._this__u8e3s4__1, this.message_1)); this.set_state_rjd8d0_k$(1); suspendResult = withDoorTransactionAsync(this._this__u8e3s4__1.db_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$slambda_0(this._this__u8e3s4__1, this.message_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var tmp_1 = this._this__u8e3s4__1.get_logger_g9gejd_k$(); d_0(tmp_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this._this__u8e3s4__1, this.message_1)); this.set_state_rjd8d0_k$(2); suspendResult = this._this__u8e3s4__1._incomingMessages_1.emit_t92u1f_k$(this.message_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(4); continue $sm; case 3: this.set_exceptionState_fex74n_k$(5); var tmp_2 = this.get_exception_x0n6w6_k$(); if (tmp_2 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 4: this.set_exceptionState_fex74n_k$(5); return Unit_getInstance(); case 5: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 5) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function NodeEventManagerCommon(db, messageCallback, logger, dbName, dispatcher) { dispatcher = dispatcher === VOID ? Dispatchers_getInstance().get_Default_goqax4_k$() : dispatcher; this.db_1 = db; this.messageCallback_1 = messageCallback; this.logger_1 = logger; this.dbName_1 = dbName; this.dispatcher_1 = dispatcher; this.logPrefix_1 = '[NodeEventManager - ' + this.dbName_1 + ']'; this.hasOutgoingReplicationTable_1 = doorDatabaseMetadata(getKClassFromExpression(this.db_1)).get_allTables_1jy9x9_k$().contains_aljjnj_k$('OutgoingReplication'); this._outgoingEvents_1 = MutableSharedFlow(); this.outgoingEvents_1 = asSharedFlow(this._outgoingEvents_1); this._incomingMessages_1 = MutableSharedFlow(); this.incomingMessages_1 = asSharedFlow(this._incomingMessages_1); this.closed_1 = atomic$boolean$1(false); } protoOf(NodeEventManagerCommon).get_db_knto1l_k$ = function () { return this.db_1; }; protoOf(NodeEventManagerCommon).get_messageCallback_kxaem5_k$ = function () { return this.messageCallback_1; }; protoOf(NodeEventManagerCommon).get_logger_g9gejd_k$ = function () { return this.logger_1; }; protoOf(NodeEventManagerCommon).get_dbName_c9i0qa_k$ = function () { return this.dbName_1; }; protoOf(NodeEventManagerCommon).get_dispatcher_usy1bk_k$ = function () { return this.dispatcher_1; }; protoOf(NodeEventManagerCommon).get_logPrefix_vopxo3_k$ = function () { return this.logPrefix_1; }; protoOf(NodeEventManagerCommon).get_hasOutgoingReplicationTable_wjzuwv_k$ = function () { return this.hasOutgoingReplicationTable_1; }; protoOf(NodeEventManagerCommon).get__outgoingEvents_qw2ml7_k$ = function () { return this._outgoingEvents_1; }; protoOf(NodeEventManagerCommon).get_outgoingEvents_40o3ma_k$ = function () { return this.outgoingEvents_1; }; protoOf(NodeEventManagerCommon).get_incomingMessages_7rqqu3_k$ = function () { return this.incomingMessages_1; }; protoOf(NodeEventManagerCommon).get_closed_byjrzp_k$ = function () { return this.closed_1; }; protoOf(NodeEventManagerCommon).assertNotClosed_modxnt_k$ = function () { if (this.closed_1.get_kotlinx$atomicfu$value_vi2am5_k$()) throw IllegalStateException_init_$Create$('NodeEventManager is closed!'); }; protoOf(NodeEventManagerCommon).onIncomingMessageReceived_3v60w2_k$ = function (message, $completion) { var tmp = new $onIncomingMessageReceivedCOROUTINE$15(this, message, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeEventManagerCommon).close_yn9xrc_k$ = function () { this.closed_1.set_kotlinx$atomicfu$value_tm3k58_k$(true); }; function _get_repoConfig__gylidl_0($this) { return $this.repoConfig_1; } function _get_nodeEventManager__cjqgt2_0($this) { return $this.nodeEventManager_1; } function _get_scope__bi2zur($this) { return $this.scope_1; } function _get_eventSource__8xtza4($this) { return $this.eventSource_1; } function _get_url__e6i4g2($this) { return $this.url_1; } function _get_logPrefix__aovpcr_0($this) { return $this.logPrefix_1; } function _set_remoteNodeId__nn4etw($this, _set____db54di) { $this.remoteNodeId_1 = _set____db54di; } function _get_remoteNodeId__vu8wl4($this) { return $this.remoteNodeId_1; } function _set_isClosed__sz8o0v($this, _set____db54di) { $this.isClosed_1 = _set____db54di; } function _get_isClosed__t8z2hh($this) { return $this.isClosed_1; } function NodeEventSseClient$onOpen$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : open'; }; } function NodeEventSseClient$onMessage$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : onMessage : INIT: remoteNodeId = ' + this$0.remoteNodeId_1.toString(); }; } function NodeEventSseClient$onMessage$lambda_0(this$0) { return function () { return this$0.logPrefix_1 + ' : onMessage : pending replication'; }; } function NodeEventSseClient$onMessage$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(NodeEventSseClient$onMessage$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(NodeEventSseClient$onMessage$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(NodeEventSseClient$onMessage$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.this$0__1.nodeEventManager_1.onIncomingMessageReceived_3v60w2_k$(new DoorMessage(Companion_getInstance_15().get_WHAT_REPLICATION_PUSH_tr3xkv_k$(), this.this$0__1.remoteNodeId_1, this.this$0__1.repoConfig_1.get_nodeId_h7ho7a_k$(), emptyList()), 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(NodeEventSseClient$onMessage$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new NodeEventSseClient$onMessage$slambda(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(NodeEventSseClient$onMessage$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function NodeEventSseClient$onMessage$slambda_0(this$0, resultContinuation) { var i = new NodeEventSseClient$onMessage$slambda(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function NodeEventSseClient$onError$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : onError'; }; } function NodeEventSseClient$close$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : close'; }; } function NodeEventSseClient$close$lambda_0(this$0) { return function () { return this$0.logPrefix_1 + ' : exception closing'; }; } function NodeEventSseClient(repoConfig, nodeEventManager, scope) { this.repoConfig_1 = repoConfig; this.nodeEventManager_1 = nodeEventManager; this.scope_1 = scope; this.url_1 = this.repoConfig_1.get_endpoint_30bvdu_k$() + 'replication/sse?' + DoorConstants_getInstance().get_HEADER_NODE_AND_AUTH_2mchyc_k$() + '=' + urlEncode(this.repoConfig_1.get_nodeId_h7ho7a_k$().toString() + '/' + this.repoConfig_1.get_auth_woj2sx_k$()); this.logPrefix_1 = '[NodeEventSseClient localNodeId=' + this.repoConfig_1.get_nodeId_h7ho7a_k$().toString() + ' remoteEndpoint=' + this.repoConfig_1.get_endpoint_30bvdu_k$() + ']'; this.remoteNodeId_1 = new Long(0, 0); this.isClosed_1 = false; this.eventSource_1 = new DoorEventSource(this.repoConfig_1, this.url_1, this); } protoOf(NodeEventSseClient).onOpen_hhqt5_k$ = function () { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.v$default_i2q2w7_k$(VOID, tmp_0, NodeEventSseClient$onOpen$lambda(this)); }; protoOf(NodeEventSseClient).onMessage_f8yelo_k$ = function (message) { var tmp0_subject = message.get_event_ir25pt_k$(); if (tmp0_subject === Companion_getInstance_20().get_EVT_INIT_6wk5yj_k$()) { this.remoteNodeId_1 = toLong_0(message.get_data_wokkxf_k$()); var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.v$default_i2q2w7_k$(VOID, tmp_0, NodeEventSseClient$onMessage$lambda(this)); } else if (tmp0_subject === Companion_getInstance_20().get_EVT_PENDING_REPLICATION_4rhb41_k$()) { var tmp_1 = Napier_getInstance(); var tmp_2 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp_1.v$default_i2q2w7_k$(VOID, tmp_2, NodeEventSseClient$onMessage$lambda_0(this)); launch(this.scope_1, VOID, VOID, NodeEventSseClient$onMessage$slambda_0(this, null)); } }; protoOf(NodeEventSseClient).onError_rgw5qo_k$ = function (e) { if (!this.isClosed_1) { var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.w_a4gdqk_k$(e, tmp1_tag, NodeEventSseClient$onError$lambda(this)); } }; protoOf(NodeEventSseClient).close_yn9xrc_k$ = function () { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.v$default_i2q2w7_k$(VOID, tmp_0, NodeEventSseClient$close$lambda(this)); try { this.isClosed_1 = true; this.eventSource_1.close_yn9xrc_k$(); } catch ($p) { if ($p instanceof Exception) { var e = $p; var tmp0_$this = Napier_getInstance(); var tmp1_tag = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp0_$this.w_a4gdqk_k$(e, tmp1_tag, NodeEventSseClient$close$lambda_0(this)); } else { throw $p; } } }; function _get_invalidationDelegate__oj54rc($this) { return $this.invalidationDelegate_1; } function _get_srcInvalidateCallbackRegistered__72hoxh($this) { return $this.srcInvalidateCallbackRegistered_1; } function _get_invalidated__yx9o7s_0($this) { return $this.invalidated_1; } function _get_srcInvalidatedCallback__qnsba7($this) { return $this.srcInvalidatedCallback_1; } function onSrcInvalidated($this) { $this.invalidationDelegate_1.unregisterInvalidatedCallback_3xxsu2_k$($this.srcInvalidatedCallback_1); if (!$this.invalidated_1.atomicfu$getAndSet(true)) { $this.invalidate_p4aufp_k$(); } } function DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this$0) { return function () { onSrcInvalidated(this$0); return Unit_getInstance(); }; } function DelegatedInvalidationPagingSource(invalidationDelegate) { PagingSource.call(this); this.invalidationDelegate_1 = invalidationDelegate; this.srcInvalidateCallbackRegistered_1 = atomic$boolean$1(false); this.invalidated_1 = atomic$boolean$1(false); var tmp = this; tmp.srcInvalidatedCallback_1 = DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this); } protoOf(DelegatedInvalidationPagingSource).registerInvalidationCallbackIfNeeded_8aur2g_k$ = function () { if (!this.srcInvalidateCallbackRegistered_1.atomicfu$getAndSet(true)) { this.invalidationDelegate_1.registerInvalidatedCallback_m09l7x_k$(this.srcInvalidatedCallback_1); } }; function _get_prefetchDistance__98le4h($this) { return $this.prefetchDistance_1; } function _get_prefetchThreshold__j6rd7h($this) { return $this.prefetchThreshold_1; } function _get_onRemoteLoad__uvqvvk($this) { return $this.onRemoteLoad_1; } function _get_scope__bi2zur_0($this) { return $this.scope_1; } function OnRemoteLoad() { } function OffsetLimitRange(offset, limit, time) { this.offset_1 = offset; this.limit_1 = limit; this.time_1 = time; } protoOf(OffsetLimitRange).get_offset_hjmqak_k$ = function () { return this.offset_1; }; protoOf(OffsetLimitRange).get_limit_iuokuq_k$ = function () { return this.limit_1; }; protoOf(OffsetLimitRange).get_time_wouyhi_k$ = function () { return this.time_1; }; protoOf(OffsetLimitRange).component1_7eebsc_k$ = function () { return this.offset_1; }; protoOf(OffsetLimitRange).component2_7eebsb_k$ = function () { return this.limit_1; }; protoOf(OffsetLimitRange).component3_7eebsa_k$ = function () { return this.time_1; }; protoOf(OffsetLimitRange).copy_fmdtt3_k$ = function (offset, limit, time) { return new OffsetLimitRange(offset, limit, time); }; protoOf(OffsetLimitRange).copy$default_ip3wrq_k$ = function (offset, limit, time, $super) { offset = offset === VOID ? this.offset_1 : offset; limit = limit === VOID ? this.limit_1 : limit; time = time === VOID ? this.time_1 : time; return $super === VOID ? this.copy_fmdtt3_k$(offset, limit, time) : $super.copy_fmdtt3_k$.call(this, offset, limit, time); }; protoOf(OffsetLimitRange).toString = function () { return 'OffsetLimitRange(offset=' + this.offset_1 + ', limit=' + this.limit_1 + ', time=' + this.time_1.toString() + ')'; }; protoOf(OffsetLimitRange).hashCode = function () { var result = this.offset_1; result = imul(result, 31) + this.limit_1 | 0; result = imul(result, 31) + this.time_1.hashCode() | 0; return result; }; protoOf(OffsetLimitRange).equals = function (other) { if (this === other) return true; if (!(other instanceof OffsetLimitRange)) return false; var tmp0_other_with_cast = other instanceof OffsetLimitRange ? other : THROW_CCE(); if (!(this.offset_1 === tmp0_other_with_cast.offset_1)) return false; if (!(this.limit_1 === tmp0_other_with_cast.limit_1)) return false; if (!this.time_1.equals(tmp0_other_with_cast.time_1)) return false; return true; }; function OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted) { loadingRangesInProgress = loadingRangesInProgress === VOID ? emptyList() : loadingRangesInProgress; loadingStarted = loadingStarted === VOID ? false : loadingStarted; this.loadingRangesInProgress_1 = loadingRangesInProgress; this.loadingStarted_1 = loadingStarted; } protoOf(OffsetLimitMediatorState).get_loadingRangesInProgress_hqsc6d_k$ = function () { return this.loadingRangesInProgress_1; }; protoOf(OffsetLimitMediatorState).get_loadingStarted_7cgytu_k$ = function () { return this.loadingStarted_1; }; protoOf(OffsetLimitMediatorState).component1_7eebsc_k$ = function () { return this.loadingRangesInProgress_1; }; protoOf(OffsetLimitMediatorState).component2_7eebsb_k$ = function () { return this.loadingStarted_1; }; protoOf(OffsetLimitMediatorState).copy_p2yq3o_k$ = function (loadingRangesInProgress, loadingStarted) { return new OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted); }; protoOf(OffsetLimitMediatorState).copy$default_mdbf6d_k$ = function (loadingRangesInProgress, loadingStarted, $super) { loadingRangesInProgress = loadingRangesInProgress === VOID ? this.loadingRangesInProgress_1 : loadingRangesInProgress; loadingStarted = loadingStarted === VOID ? this.loadingStarted_1 : loadingStarted; return $super === VOID ? this.copy_p2yq3o_k$(loadingRangesInProgress, loadingStarted) : $super.copy_p2yq3o_k$.call(this, loadingRangesInProgress, loadingStarted); }; protoOf(OffsetLimitMediatorState).toString = function () { return 'OffsetLimitMediatorState(loadingRangesInProgress=' + this.loadingRangesInProgress_1 + ', loadingStarted=' + this.loadingStarted_1 + ')'; }; protoOf(OffsetLimitMediatorState).hashCode = function () { var result = hashCode(this.loadingRangesInProgress_1); result = imul(result, 31) + getBooleanHashCode(this.loadingStarted_1) | 0; return result; }; protoOf(OffsetLimitMediatorState).equals = function (other) { if (this === other) return true; if (!(other instanceof OffsetLimitMediatorState)) return false; var tmp0_other_with_cast = other instanceof OffsetLimitMediatorState ? other : THROW_CCE(); if (!equals(this.loadingRangesInProgress_1, tmp0_other_with_cast.loadingRangesInProgress_1)) return false; if (!(this.loadingStarted_1 === tmp0_other_with_cast.loadingStarted_1)) return false; return true; }; function _get_loadedRanges__uevrzk($this) { return $this.loadedRanges_1; } function _get__state__37adl3($this) { return $this._state_1; } function sam$kotlin_Comparator$0(function_0) { this.function_1 = function_0; } protoOf(sam$kotlin_Comparator$0).compare_bczr_k$ = function (a, b) { return this.function_1(a, b); }; protoOf(sam$kotlin_Comparator$0).compare = function (a, b) { return this.compare_bczr_k$(a, b); }; function DoorOffsetLimitRemoteMediator$onLoad$lambda(a, b) { // Inline function 'kotlin.comparisons.compareValuesBy' call // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp = a.offset_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = b.offset_1; return compareValues(tmp, tmp$ret$1); } function DoorOffsetLimitRemoteMediator$onLoad$lambda_0() { return 'DoorOffsetLimitRemoteMediator: already loaded everything required.'; } function DoorOffsetLimitRemoteMediator$onLoad$lambda_1(a, b) { // Inline function 'kotlin.comparisons.compareValuesBy' call // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp = b.offset_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = a.offset_1; return compareValues(tmp, tmp$ret$1); } function DoorOffsetLimitRemoteMediator$onLoad$lambda_2(a, b) { // Inline function 'kotlin.comparisons.compareValuesBy' call // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp = b.offset_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = a.offset_1; return compareValues(tmp, tmp$ret$1); } function DoorOffsetLimitRemoteMediator$onLoad$lambda_3(a, b) { // Inline function 'kotlin.comparisons.compareValuesBy' call // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp = a.offset_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = b.offset_1; return compareValues(tmp, tmp$ret$1); } function DoorOffsetLimitRemoteMediator$onLoad$slambda($loadOffset, $loadLimit, this$0, resultContinuation) { this.$loadOffset_1 = $loadOffset; this.$loadLimit_1 = $loadLimit; this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorOffsetLimitRemoteMediator$onLoad$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(DoorOffsetLimitRemoteMediator$onLoad$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$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); this.range0__1 = new OffsetLimitRange(this.$loadOffset_1._v, this.$loadLimit_1, systemTimeInMillis()); this.set_state_rjd8d0_k$(1); continue $sm; case 1: this.set_exceptionState_fex74n_k$(4); this.set_exceptionState_fex74n_k$(3); l$ret$1: do { var this_0 = this.this$0__1._state_1; while (true) { var prevValue = this_0.get_value_j01efc_k$(); var nextValue = prevValue.copy_p2yq3o_k$(plus_1(prevValue.loadingRangesInProgress_1, this.range0__1), true); if (this_0.compareAndSet_l3595a_k$(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.set_state_rjd8d0_k$(2); suspendResult = this.this$0__1.onRemoteLoad_1.invoke_vgc6e9_k$(this.$loadOffset_1._v, this.$loadLimit_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: var tmp_0 = this; this.this$0__1.loadedRanges_1.add_utx5q5_k$(this.range0__1.copy$default_ip3wrq_k$(VOID, VOID, systemTimeInMillis())); tmp_0.tmp$ret$21__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(6); continue $sm; case 3: this.set_exceptionState_fex74n_k$(4); var tmp_1 = this.get_exception_x0n6w6_k$(); if (tmp_1 instanceof Error) { var e = this.get_exception_x0n6w6_k$(); var tmp_2 = this; Napier_getInstance().w$default_p42du4_k$('Attempted to load from offset=' + this.$loadOffset_1._v + ' limit=' + this.$loadLimit_1 + ' faled ', e); tmp_2.tmp$ret$21__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(6); continue $sm; } else { throw this.get_exception_x0n6w6_k$(); } case 4: this.set_exceptionState_fex74n_k$(5); var t = this.get_exception_x0n6w6_k$(); l$ret$5: do { var this_1 = this.this$0__1._state_1; while (true) { var prevValue_0 = this_1.get_value_j01efc_k$(); var nextValue_0 = prevValue_0.copy$default_mdbf6d_k$(minus(prevValue_0.loadingRangesInProgress_1, this.range0__1)); if (this_1.compareAndSet_l3595a_k$(prevValue_0, nextValue_0)) { break l$ret$5; } } } while (false); throw t; case 5: throw this.get_exception_x0n6w6_k$(); case 6: this.set_exceptionState_fex74n_k$(5); l$ret$7: do { var this_2 = this.this$0__1._state_1; while (true) { var prevValue_1 = this_2.get_value_j01efc_k$(); var nextValue_1 = prevValue_1.copy$default_mdbf6d_k$(minus(prevValue_1.loadingRangesInProgress_1, this.range0__1)); if (this_2.compareAndSet_l3595a_k$(prevValue_1, nextValue_1)) { break l$ret$7; } } } while (false); return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 5) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorOffsetLimitRemoteMediator$onLoad$slambda(this.$loadOffset_1, this.$loadLimit_1, this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorOffsetLimitRemoteMediator$onLoad$slambda_0($loadOffset, $loadLimit, this$0, resultContinuation) { var i = new DoorOffsetLimitRemoteMediator$onLoad$slambda($loadOffset, $loadLimit, this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorOffsetLimitRemoteMediator(prefetchDistance, prefetchThreshold, onRemoteLoad) { prefetchDistance = prefetchDistance === VOID ? 100 : prefetchDistance; prefetchThreshold = prefetchThreshold === VOID ? prefetchDistance / 2 | 0 : prefetchThreshold; this.prefetchDistance_1 = prefetchDistance; this.prefetchThreshold_1 = prefetchThreshold; this.onRemoteLoad_1 = onRemoteLoad; this.scope_1 = CoroutineScope_0(Dispatchers_getInstance().get_Default_goqax4_k$().plus_s13ygv_k$(Job())); this.loadedRanges_1 = concurrentSafeListOf([]); this._state_1 = MutableStateFlow(new OffsetLimitMediatorState()); this.state_1 = asStateFlow(this._state_1); } protoOf(DoorOffsetLimitRemoteMediator).get_state_iypx7s_k$ = function () { return this.state_1; }; protoOf(DoorOffsetLimitRemoteMediator).onLoad_ekqtzd_k$ = function (params) { var tmp0_elvis_lhs = params.get_key_18j28a_k$(); var pagingOffset = getOffset(params, tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs, IntCompanionObject_getInstance().get_MAX_VALUE_54a9lf_k$()); var tmp1_elvis_lhs = params.get_key_18j28a_k$(); var pagingLimit = getLimit(params, tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs); // Inline function 'kotlin.comparisons.maxOf' call var b = pagingOffset - this.prefetchDistance_1 | 0; var rangeOffset = Math.max(0, b); var rangeLimit = (pagingLimit + (pagingOffset - rangeOffset | 0) | 0) + this.prefetchDistance_1 | 0; var loadOffset = {_v: rangeOffset}; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedBy' call var this_0 = this.loadedRanges_1; // Inline function 'kotlin.comparisons.compareBy' call var tmp = DoorOffsetLimitRemoteMediator$onLoad$lambda; var tmp$ret$1 = new sam$kotlin_Comparator$0(tmp); var tmp0_iterator = sortedWith(this_0, tmp$ret$1).iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element.offset_1 <= rangeOffset ? (element.offset_1 + element.limit_1 | 0) > loadOffset._v : false) { loadOffset._v = element.offset_1 + element.limit_1 | 0; } } if (loadOffset._v >= (rangeOffset + rangeLimit | 0)) { var tmp_0 = Napier_getInstance(); tmp_0.d$default_iccotn_k$(VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$lambda_0); return Unit_getInstance(); } var loadEnd = rangeOffset + rangeLimit | 0; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedByDescending' call var this_1 = this.loadedRanges_1; // Inline function 'kotlin.comparisons.compareByDescending' call var tmp_1 = DoorOffsetLimitRemoteMediator$onLoad$lambda_1; var tmp$ret$3 = new sam$kotlin_Comparator$0(tmp_1); var tmp0_iterator_0 = sortedWith(this_1, tmp$ret$3).iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var element_0 = tmp0_iterator_0.next_20eer_k$(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_0.offset_1 < loadEnd ? (element_0.offset_1 + element_0.limit_1 | 0) > loadEnd : false) loadEnd = element_0.offset_1; } var loadLimit = loadEnd - loadOffset._v | 0; // Inline function 'kotlin.comparisons.minOf' call var a = pagingOffset + pagingLimit | 0; var b_0 = loadOffset._v + loadLimit | 0; var tmp_2 = Math.min(a, b_0); // Inline function 'kotlin.comparisons.maxOf' call var b_1 = loadOffset._v; var loadPagingOverlap = tmp_2 - Math.max(pagingOffset, b_1) | 0; var tmp_3; if (loadPagingOverlap > 0) { tmp_3 = -1; } else { var alreadyLoadedStart = pagingOffset; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedByDescending' call var this_2 = this.loadedRanges_1; // Inline function 'kotlin.comparisons.compareByDescending' call var tmp_4 = DoorOffsetLimitRemoteMediator$onLoad$lambda_2; var tmp$ret$7 = new sam$kotlin_Comparator$0(tmp_4); var tmp0_iterator_1 = sortedWith(this_2, tmp$ret$7).iterator_jk1svi_k$(); while (tmp0_iterator_1.hasNext_bitz1p_k$()) { var element_1 = tmp0_iterator_1.next_20eer_k$(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_1.offset_1 < alreadyLoadedStart ? (element_1.offset_1 + element_1.limit_1 | 0) >= alreadyLoadedStart : false) alreadyLoadedStart = element_1.offset_1; } var alreadyLoadedEnd = pagingOffset + pagingLimit | 0; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedBy' call var this_3 = this.loadedRanges_1; // Inline function 'kotlin.comparisons.compareBy' call var tmp_5 = DoorOffsetLimitRemoteMediator$onLoad$lambda_3; var tmp$ret$9 = new sam$kotlin_Comparator$0(tmp_5); var tmp0_iterator_2 = sortedWith(this_3, tmp$ret$9).iterator_jk1svi_k$(); while (tmp0_iterator_2.hasNext_bitz1p_k$()) { var element_2 = tmp0_iterator_2.next_20eer_k$(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_2.offset_1 <= alreadyLoadedEnd ? (element_2.offset_1 + element_2.limit_1 | 0) > alreadyLoadedEnd : false) { alreadyLoadedEnd = element_2.offset_1 + element_2.limit_1 | 0; } } tmp_3 = (rangeOffset - alreadyLoadedStart | 0) + ((rangeOffset + rangeLimit | 0) - alreadyLoadedEnd | 0) | 0; } var prefetchSize = tmp_3; if (loadPagingOverlap > 0 ? true : prefetchSize > this.prefetchThreshold_1) { launch(this.scope_1, VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$slambda_0(loadOffset, loadLimit, this, null)); } }; protoOf(DoorOffsetLimitRemoteMediator).invalidate_p4aufp_k$ = function () { this.loadedRanges_1.clear_j9egeb_k$(); }; protoOf(DoorOffsetLimitRemoteMediator).cancel_2l89ey_k$ = function () { cancel_0(this.scope_1); }; function get_INVALID() { _init_properties_DoorPagingUtil_kt__xv2bfg(); return INVALID; } var INVALID; function getOffset(params, key, itemCount) { _init_properties_DoorPagingUtil_kt__xv2bfg(); var tmp; if (params instanceof Prepend) { var tmp_0; if (key < params.get_loadSize_1a4pbk_k$()) { tmp_0 = 0; } else { tmp_0 = key - params.get_loadSize_1a4pbk_k$() | 0; } tmp = tmp_0; } else { if (params instanceof Append) { tmp = key; } else { if (params instanceof Refresh) { var tmp_1; if (key >= itemCount) { // Inline function 'kotlin.comparisons.maxOf' call var b = itemCount - params.get_loadSize_1a4pbk_k$() | 0; tmp_1 = Math.max(0, b); } else { tmp_1 = key; } tmp = tmp_1; } else { throw IllegalStateException_init_$Create$('Not really possible - Just here because compiler does not fully understand expect/actual'); } } } return tmp; } function getLimit(params, key) { _init_properties_DoorPagingUtil_kt__xv2bfg(); var tmp; if (params instanceof Prepend) { var tmp_0; if (key < params.get_loadSize_1a4pbk_k$()) { tmp_0 = key; } else { tmp_0 = params.get_loadSize_1a4pbk_k$(); } tmp = tmp_0; } else { tmp = params.get_loadSize_1a4pbk_k$(); } return tmp; } function get_INITIAL_ITEM_COUNT() { return INITIAL_ITEM_COUNT; } var INITIAL_ITEM_COUNT; function queryDatabase(params, loadRows, itemCount, $completion) { var tmp = new $queryDatabaseCOROUTINE$16(params, loadRows, itemCount, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function getClippedRefreshKey(_this__u8e3s4) { _init_properties_DoorPagingUtil_kt__xv2bfg(); var anchorPosition = _this__u8e3s4.get_anchorPosition_9otczr_k$(); var tmp; if (anchorPosition == null) { tmp = null; } else { // Inline function 'kotlin.comparisons.maxOf' call var b = anchorPosition - (_this__u8e3s4.get_config_c0698r_k$().get_initialLoadSize_svsqyq_k$() / 2 | 0) | 0; tmp = Math.max(0, b); } return tmp; } function $queryDatabaseCOROUTINE$16(params, loadRows, itemCount, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.params_1 = params; this.loadRows_1 = loadRows; this.itemCount_1 = itemCount; } protoOf($queryDatabaseCOROUTINE$16).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 tmp0_elvis_lhs = this.params_1.get_key_18j28a_k$(); tmp_0.key0__1 = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs; this.limit1__1 = getLimit(this.params_1, this.key0__1); this.offset2__1 = getOffset(this.params_1, this.key0__1, this.itemCount_1); this.set_state_rjd8d0_k$(1); suspendResult = this.loadRows_1(this.limit1__1, this.offset2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var data = suspendResult; var nextPosToLoad = this.offset2__1 + data.get_size_woubt6_k$() | 0; var tmp_1; if ((data.isEmpty_y1axqb_k$() ? true : data.get_size_woubt6_k$() < this.limit1__1) ? true : nextPosToLoad >= this.itemCount_1) { tmp_1 = null; } else { tmp_1 = nextPosToLoad; } var nextKey = tmp_1; var prevKey = (this.offset2__1 <= 0 ? true : data.isEmpty_y1axqb_k$()) ? null : this.offset2__1; var b = this.itemCount_1 - nextPosToLoad | 0; var tmp_2 = new Page(data, prevKey, nextKey, this.offset2__1, Math.max(0, b)); return tmp_2 instanceof LoadResult ? tmp_2 : THROW_CCE(); 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); }; var properties_initialized_DoorPagingUtil_kt_2vglj6; function _init_properties_DoorPagingUtil_kt__xv2bfg() { if (!properties_initialized_DoorPagingUtil_kt_2vglj6) { properties_initialized_DoorPagingUtil_kt_2vglj6 = true; INVALID = new Invalid(); } } function DoorRepositoryPagingSource() { PagingSource.call(this); this._loadState_1 = MutableStateFlow(new PagingSourceLoadState()); this.loadState_1 = asStateFlow(this._loadState_1); } protoOf(DoorRepositoryPagingSource).get__loadState_lzzp9n_k$ = function () { return this._loadState_1; }; protoOf(DoorRepositoryPagingSource).get_loadState_vb8rs2_k$ = function () { return this.loadState_1; }; function _get_repoPath__i4v2t0($this) { return $this.repoPath_1; } function _get_dbPagingSource__nepz5y($this) { return $this.dbPagingSource_1; } function _get_onLoadHttp__92p8wy($this) { return $this.onLoadHttp_1; } function _get_dbInvalidateCallbackRegistered__z27x05($this) { return $this.dbInvalidateCallbackRegistered_1; } function _get_invalidated__yx9o7s_1($this) { return $this.invalidated_1; } function _set_lastLoadParams__prhhij($this, _set____db54di) { $this.lastLoadParams_1 = _set____db54di; } function _get_lastLoadParams__8e1h3($this) { return $this.lastLoadParams_1; } function _get_onDbInvalidatedCallback__3yfdc0($this) { return $this.onDbInvalidatedCallback_1; } function onDbInvalidated($this) { Napier_getInstance().v$default_9ddbot_k$('DoorRepositoryReplicatePullPagingSource: onDbInvalidated'); $this.dbPagingSource_1.unregisterInvalidatedCallback_3xxsu2_k$($this.onDbInvalidatedCallback_1); if (!$this.invalidated_1.atomicfu$getAndSet(true)) { Napier_getInstance().v$default_9ddbot_k$('DoorRepositoryReplicatePullPagingSource: call invalidate'); $this.invalidate_p4aufp_k$(); } } function Companion_13() { Companion_instance_13 = this; this.PARAM_BATCHSIZE_1 = 'pagingBatchSize'; this.PARAM_KEY_1 = 'pagingKey'; this.PARAM_LOAD_PARAM_TYPE_1 = 'pagingLoadParamType'; } protoOf(Companion_13).get_PARAM_BATCHSIZE_e5jwtc_k$ = function () { return this.PARAM_BATCHSIZE_1; }; protoOf(Companion_13).get_PARAM_KEY_fwkfyc_k$ = function () { return this.PARAM_KEY_1; }; protoOf(Companion_13).get_PARAM_LOAD_PARAM_TYPE_86ea4q_k$ = function () { return this.PARAM_LOAD_PARAM_TYPE_1; }; var Companion_instance_13; function Companion_getInstance_16() { if (Companion_instance_13 == null) new Companion_13(); return Companion_instance_13; } function DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this$0) { return function () { onDbInvalidated(this$0); return Unit_getInstance(); }; } function DoorRepositoryReplicatePullPagingSource(repo, repoPath, dbPagingSource, onLoadHttp) { Companion_getInstance_16(); DoorRepositoryPagingSource.call(this); this.repo_1 = repo; this.repoPath_1 = repoPath; this.dbPagingSource_1 = dbPagingSource; this.onLoadHttp_1 = onLoadHttp; this.dbInvalidateCallbackRegistered_1 = atomic$boolean$1(false); this.invalidated_1 = atomic$boolean$1(false); this.lastLoadParams_1 = null; var tmp = this; tmp.onDbInvalidatedCallback_1 = DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this); } protoOf(DoorRepositoryReplicatePullPagingSource).get_repo_wotlmj_k$ = function () { return this.repo_1; }; protoOf(DoorRepositoryReplicatePullPagingSource).getRefreshKey_ew6rph_k$ = function (state) { // Inline function 'kotlin.also' call var this_0 = this.dbPagingSource_1.getRefreshKey_3flma8_k$(state); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.paging.DoorRepositoryReplicatePullPagingSource.getRefreshKey.' call this.repo_1.get_config_c0698r_k$().get_logger_g9gejd_k$().log$default_fb1f4z_k$(DoorLogLevel_VERBOSE_getInstance(), 'DoorRepositoryReplicatePullPagingSource: getRefreshKey: ' + this_0); return this_0; }; protoOf(DoorRepositoryReplicatePullPagingSource).getRefreshKey_3flma8_k$ = function (state) { return this.getRefreshKey_ew6rph_k$(state); }; protoOf(DoorRepositoryReplicatePullPagingSource).load_61715_k$ = function (params, $completion) { Napier_getInstance().v$default_9ddbot_k$('DoorRepositoryReplicatePullPagingSource: load key=' + params.get_key_18j28a_k$()); this.lastLoadParams_1 = params; if (!this.dbInvalidateCallbackRegistered_1.atomicfu$getAndSet(true)) { Napier_getInstance().v$default_9ddbot_k$('DoorRepositoryReplicatePullPagingSource: register db invalidate callback'); this.dbPagingSource_1.registerInvalidatedCallback_m09l7x_k$(this.onDbInvalidatedCallback_1); } return this.dbPagingSource_1.load_tstxu5_k$(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).load_tstxu5_k$ = function (params, $completion) { return this.load_61715_k$(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).loadHttp_2m23i6_k$ = function (params, $completion) { return this.onLoadHttp_1(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).loadHttp_c9kyrx_k$ = function (params, $completion) { return this.loadHttp_2m23i6_k$(params, $completion); }; function _get_src__e6gu99($this) { return $this.src_1; } function FilterPagingSource(src) { DelegatedInvalidationPagingSource.call(this, src); this.src_1 = src; } protoOf(FilterPagingSource).get_jumpingSupported_exxy3n_k$ = function () { return this.src_1.get_jumpingSupported_exxy3n_k$(); }; protoOf(FilterPagingSource).get_keyReuseSupported_wzjygg_k$ = function () { return this.src_1.get_keyReuseSupported_wzjygg_k$(); }; protoOf(FilterPagingSource).getRefreshKey_3flma8_k$ = function (state) { return this.src_1.getRefreshKey_3flma8_k$(state); }; protoOf(FilterPagingSource).load_tstxu5_k$ = function (params, $completion) { this.registerInvalidationCallbackIfNeeded_8aur2g_k$(); return this.src_1.load_tstxu5_k$(params, $completion); }; function endOfPaginationReached(_this__u8e3s4) { var tmp0_safe_receiver = _this__u8e3s4.get_headers_ef25jx_k$().get_6bo4tg_k$(DoorConstants_getInstance().get_HEADER_PAGING_END_REACHED_l3srwc_k$()); var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toBoolean(tmp0_safe_receiver); return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs; } function _get_onLoad__fkqo1y($this) { return $this.onLoad_1; } function PagingSourceInterceptor(src, onLoad) { FilterPagingSource.call(this, src); this.onLoad_1 = onLoad; } protoOf(PagingSourceInterceptor).load_tstxu5_k$ = function (params, $completion) { this.onLoad_1(params); return protoOf(FilterPagingSource).load_tstxu5_k$.call(this, params, $completion); }; function PagingRequest(key) { this.key_1 = key; } protoOf(PagingRequest).get_key_18j28a_k$ = function () { return this.key_1; }; protoOf(PagingRequest).component1_7eebsc_k$ = function () { return this.key_1; }; protoOf(PagingRequest).copy_6f666x_k$ = function (key) { return new PagingRequest(key); }; protoOf(PagingRequest).copy$default_tvxb6w_k$ = function (key, $super) { key = key === VOID ? this.key_1 : key; return $super === VOID ? this.copy_6f666x_k$(key) : $super.copy_6f666x_k$.call(this, key); }; protoOf(PagingRequest).toString = function () { return 'PagingRequest(key=' + this.key_1 + ')'; }; protoOf(PagingRequest).hashCode = function () { return this.key_1 == null ? 0 : hashCode(this.key_1); }; protoOf(PagingRequest).equals = function (other) { if (this === other) return true; if (!(other instanceof PagingRequest)) return false; var tmp0_other_with_cast = other instanceof PagingRequest ? other : THROW_CCE(); if (!equals(this.key_1, tmp0_other_with_cast.key_1)) return false; return true; }; function PagingSourceLoadState(activeRequests, failedRequests, completedRequests) { activeRequests = activeRequests === VOID ? emptyList() : activeRequests; failedRequests = failedRequests === VOID ? emptyList() : failedRequests; completedRequests = completedRequests === VOID ? emptyList() : completedRequests; this.activeRequests_1 = activeRequests; this.failedRequests_1 = failedRequests; this.completedRequests_1 = completedRequests; } protoOf(PagingSourceLoadState).get_activeRequests_9klfrh_k$ = function () { return this.activeRequests_1; }; protoOf(PagingSourceLoadState).get_failedRequests_1v1o2y_k$ = function () { return this.failedRequests_1; }; protoOf(PagingSourceLoadState).get_completedRequests_wc70m_k$ = function () { return this.completedRequests_1; }; protoOf(PagingSourceLoadState).copyWithNewRequest_45kc8_k$ = function (request) { return this.copy$default_1c0q13_k$(plus(this.activeRequests_1, listOf(request))); }; protoOf(PagingSourceLoadState).copyWhenRequestFailed_f9zk4l_k$ = function (request) { // Inline function 'kotlin.collections.filter' call // Inline function 'kotlin.collections.filterTo' call var this_0 = this.activeRequests_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 'com.ustadmobile.door.paging.PagingSourceLoadState.copyWhenRequestFailed.' call if (!element.equals(request)) { destination.add_utx5q5_k$(element); } } return this.copy$default_1c0q13_k$(destination, plus(this.failedRequests_1, listOf(request))); }; protoOf(PagingSourceLoadState).copyWhenRequestCompleted_sped07_k$ = function (request) { // Inline function 'kotlin.collections.filter' call // Inline function 'kotlin.collections.filterTo' call var this_0 = this.activeRequests_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 'com.ustadmobile.door.paging.PagingSourceLoadState.copyWhenRequestCompleted.' call if (!element.equals(request)) { destination.add_utx5q5_k$(element); } } return this.copy$default_1c0q13_k$(destination, VOID, plus(this.activeRequests_1, listOf(request))); }; protoOf(PagingSourceLoadState).component1_7eebsc_k$ = function () { return this.activeRequests_1; }; protoOf(PagingSourceLoadState).component2_7eebsb_k$ = function () { return this.failedRequests_1; }; protoOf(PagingSourceLoadState).component3_7eebsa_k$ = function () { return this.completedRequests_1; }; protoOf(PagingSourceLoadState).copy_cc2gcl_k$ = function (activeRequests, failedRequests, completedRequests) { return new PagingSourceLoadState(activeRequests, failedRequests, completedRequests); }; protoOf(PagingSourceLoadState).copy$default_1c0q13_k$ = function (activeRequests, failedRequests, completedRequests, $super) { activeRequests = activeRequests === VOID ? this.activeRequests_1 : activeRequests; failedRequests = failedRequests === VOID ? this.failedRequests_1 : failedRequests; completedRequests = completedRequests === VOID ? this.completedRequests_1 : completedRequests; return $super === VOID ? this.copy_cc2gcl_k$(activeRequests, failedRequests, completedRequests) : $super.copy_cc2gcl_k$.call(this, activeRequests, failedRequests, completedRequests); }; protoOf(PagingSourceLoadState).toString = function () { return 'PagingSourceLoadState(activeRequests=' + this.activeRequests_1 + ', failedRequests=' + this.failedRequests_1 + ', completedRequests=' + this.completedRequests_1 + ')'; }; protoOf(PagingSourceLoadState).hashCode = function () { var result = hashCode(this.activeRequests_1); result = imul(result, 31) + hashCode(this.failedRequests_1) | 0; result = imul(result, 31) + hashCode(this.completedRequests_1) | 0; return result; }; protoOf(PagingSourceLoadState).equals = function (other) { if (this === other) return true; if (!(other instanceof PagingSourceLoadState)) return false; var tmp0_other_with_cast = other instanceof PagingSourceLoadState ? other : THROW_CCE(); if (!equals(this.activeRequests_1, tmp0_other_with_cast.activeRequests_1)) return false; if (!equals(this.failedRequests_1, tmp0_other_with_cast.failedRequests_1)) return false; if (!equals(this.completedRequests_1, tmp0_other_with_cast.completedRequests_1)) return false; return true; }; function PagingSourceWithHttpLoader() { } function acknowledgeReceivedReplications(_this__u8e3s4, nodeId, receivedUids, $completion) { return prepareAndUseStatementAsync_0(_this__u8e3s4, '\n DELETE FROM OutgoingReplication\n WHERE orUid = ?\n AND destNodeId = ?\n ', false, acknowledgeReceivedReplications$slambda_0(receivedUids, nodeId, null), $completion); } function selectPendingOutgoingReplicationsByDestNodeId(_this__u8e3s4, nodeId, limit, $completion) { limit = limit === VOID ? 1000 : limit; var tmp = new $selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17(_this__u8e3s4, nodeId, limit, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function insertEntitiesFromMessage(_this__u8e3s4, message, $completion) { var tmp = new $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function getDoorNodeAuth(_this__u8e3s4, nodeId, $completion) { return prepareAndUseStatementAsync_0(_this__u8e3s4, 'SELECT auth\n FROM DoorNode\n WHERE nodeId = ?\n ', true, getDoorNodeAuth$slambda_0(nodeId, null), $completion); } function insertNewDoorNode(_this__u8e3s4, node, $completion) { var tmp = new $insertNewDoorNodeCOROUTINE$19(_this__u8e3s4, node, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(_this__u8e3s4, tableId, primaryKeysList, $completion) { var entityMetaData = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4)).requireReplicateEntityMetaData_9swzku_k$(tableId); var tmp = entityMetaData.get_selectEntityByPrimaryKeysSql_y6bvk9_k$(); return prepareAndUseStatementAsync_0(_this__u8e3s4, tmp, true, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0(primaryKeysList, entityMetaData, tableId, null), $completion); } function ReplicateEntityPrimaryKeys(pk1, pk2, pk3, pk4, orUid) { this.pk1__1 = pk1; this.pk2__1 = pk2; this.pk3__1 = pk3; this.pk4__1 = pk4; this.orUid_1 = orUid; } protoOf(ReplicateEntityPrimaryKeys).get_pk1_18iyfn_k$ = function () { return this.pk1__1; }; protoOf(ReplicateEntityPrimaryKeys).get_pk2_18iyfm_k$ = function () { return this.pk2__1; }; protoOf(ReplicateEntityPrimaryKeys).set_pk3_p03ewz_k$ = function (_set____db54di) { this.pk3__1 = _set____db54di; }; protoOf(ReplicateEntityPrimaryKeys).get_pk3_18iyfl_k$ = function () { return this.pk3__1; }; protoOf(ReplicateEntityPrimaryKeys).set_pk4_wc7joi_k$ = function (_set____db54di) { this.pk4__1 = _set____db54di; }; protoOf(ReplicateEntityPrimaryKeys).get_pk4_18iyfk_k$ = function () { return this.pk4__1; }; protoOf(ReplicateEntityPrimaryKeys).get_orUid_iwh7pg_k$ = function () { return this.orUid_1; }; protoOf(ReplicateEntityPrimaryKeys).component1_7eebsc_k$ = function () { return this.pk1__1; }; protoOf(ReplicateEntityPrimaryKeys).component2_7eebsb_k$ = function () { return this.pk2__1; }; protoOf(ReplicateEntityPrimaryKeys).component3_7eebsa_k$ = function () { return this.pk3__1; }; protoOf(ReplicateEntityPrimaryKeys).component4_7eebs9_k$ = function () { return this.pk4__1; }; protoOf(ReplicateEntityPrimaryKeys).component5_7eebs8_k$ = function () { return this.orUid_1; }; protoOf(ReplicateEntityPrimaryKeys).copy_167ief_k$ = function (pk1, pk2, pk3, pk4, orUid) { return new ReplicateEntityPrimaryKeys(pk1, pk2, pk3, pk4, orUid); }; protoOf(ReplicateEntityPrimaryKeys).copy$default_3r9jfs_k$ = function (pk1, pk2, pk3, pk4, orUid, $super) { pk1 = pk1 === VOID ? this.pk1__1 : pk1; pk2 = pk2 === VOID ? this.pk2__1 : pk2; pk3 = pk3 === VOID ? this.pk3__1 : pk3; pk4 = pk4 === VOID ? this.pk4__1 : pk4; orUid = orUid === VOID ? this.orUid_1 : orUid; return $super === VOID ? this.copy_167ief_k$(pk1, pk2, pk3, pk4, orUid) : $super.copy_167ief_k$.call(this, pk1, pk2, pk3, pk4, orUid); }; protoOf(ReplicateEntityPrimaryKeys).toString = function () { return 'ReplicateEntityPrimaryKeys(pk1=' + this.pk1__1.toString() + ', pk2=' + this.pk2__1.toString() + ', pk3=' + this.pk3__1.toString() + ', pk4=' + this.pk4__1.toString() + ', orUid=' + this.orUid_1.toString() + ')'; }; protoOf(ReplicateEntityPrimaryKeys).hashCode = function () { var result = this.pk1__1.hashCode(); result = imul(result, 31) + this.pk2__1.hashCode() | 0; result = imul(result, 31) + this.pk3__1.hashCode() | 0; result = imul(result, 31) + this.pk4__1.hashCode() | 0; result = imul(result, 31) + this.orUid_1.hashCode() | 0; return result; }; protoOf(ReplicateEntityPrimaryKeys).equals = function (other) { if (this === other) return true; if (!(other instanceof ReplicateEntityPrimaryKeys)) return false; var tmp0_other_with_cast = other instanceof ReplicateEntityPrimaryKeys ? other : THROW_CCE(); if (!this.pk1__1.equals(tmp0_other_with_cast.pk1__1)) return false; if (!this.pk2__1.equals(tmp0_other_with_cast.pk2__1)) return false; if (!this.pk3__1.equals(tmp0_other_with_cast.pk3__1)) return false; if (!this.pk4__1.equals(tmp0_other_with_cast.pk4__1)) return false; if (!this.orUid_1.equals(tmp0_other_with_cast.orUid_1)) return false; return true; }; function withRepoChangeMonitorAsync(_this__u8e3s4, tableName, block, $completion) { var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.firstOrNull' call var tmp0_iterator = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4.get_db_knto1l_k$())).get_replicateEntities_2w1n4x_k$().get_values_ksazhn_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.replication.withRepoChangeMonitorAsync.' call if (element.get_entityTableName_g8x9t9_k$() === tableName) { tmp$ret$1 = element; break $l$block; } } tmp$ret$1 = null; } var tmp0_elvis_lhs = tmp$ret$1; var tmp; if (tmp0_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('Could not find replication metadata for table: ' + tableName); } else { tmp = tmp0_elvis_lhs; } var entityMetaData = tmp; var remoteNodeId = _this__u8e3s4.remoteNodeIdOrFake_xi57q3_k$(); var tmp_0 = _this__u8e3s4.get_db_knto1l_k$(); var tmp_1 = TransactionMode_READ_WRITE_getInstance(); return withDoorTransactionAsync(tmp_0, tmp_1, withRepoChangeMonitorAsync$slambda_0(_this__u8e3s4, entityMetaData, remoteNodeId, block, null), $completion); } function withRepoChangeMonitor(_this__u8e3s4, tableName, block) { var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.first' call var tmp0_iterator = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4.get_db_knto1l_k$())).get_replicateEntities_2w1n4x_k$().get_values_ksazhn_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.replication.withRepoChangeMonitor.' call if (element.get_entityTableName_g8x9t9_k$() === tableName) { tmp$ret$1 = element; break $l$block; } } throw NoSuchElementException_init_$Create$('Collection contains no element matching the predicate.'); } var entityMetaData = tmp$ret$1; var remoteNodeId = _this__u8e3s4.remoteNodeIdOrFake_xi57q3_k$(); var tmp = _this__u8e3s4.get_db_knto1l_k$(); var tmp_0 = TransactionMode_READ_WRITE_getInstance(); return withDoorTransaction(tmp, tmp_0, withRepoChangeMonitor$lambda(_this__u8e3s4, entityMetaData, remoteNodeId, block)); } function onClientRepoDoorMessageHttpResponse(_this__u8e3s4, httpResponse, json, $completion) { var tmp = new $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function createChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) { var tmp = entityMetaData.get_tableId_of07s0_k$(); // Inline function 'kotlin.math.absoluteValue' call var tmp_0 = '_d_ch_monitor_' + tmp + '_' + abs(remoteNodeId).toString(); // Inline function 'kotlin.text.lowercase' call // Inline function 'kotlin.text.substring' call // Inline function 'kotlin.js.asDynamic' call // Inline function 'kotlin.js.asDynamic' call var triggerName = tmp_0 + ('_' + operation.substring(0, 2).toLowerCase()); // Inline function 'kotlin.collections.map' call var this_0 = until(0, 4); // Inline function 'kotlin.collections.mapTo' call 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$(); // Inline function 'com.ustadmobile.door.replication.createChangeMonitorTriggerSql.' call var tmp_1; if (entityMetaData.get_entityPrimaryKeyFieldNames_5y8huf_k$().get_size_woubt6_k$() > item) { tmp_1 = 'NEW.' + entityMetaData.get_entityPrimaryKeyFieldNames_5y8huf_k$().get_c1px32_k$(item); } else { tmp_1 = '0'; } var tmp$ret$5 = tmp_1; destination.add_utx5q5_k$(tmp$ret$5); } var primaryKeys = destination; return '\n CREATE TEMP TRIGGER IF NOT EXISTS ' + triggerName + ' \n AFTER ' + operation + ' ON ' + entityMetaData.get_entityTableName_g8x9t9_k$() + '\n FOR EACH ROW\n BEGIN\n INSERT INTO OutgoingReplication(destNodeId, orTableId, orPk1, orPk2, orPk3, orPk4)\n VALUES (' + remoteNodeId.toString() + ', ' + entityMetaData.get_tableId_of07s0_k$() + ', ' + joinToString(primaryKeys) + ');\n END\n '; } function dropChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) { var tmp = entityMetaData.get_tableId_of07s0_k$(); // Inline function 'kotlin.math.absoluteValue' call var tmp_0 = '_d_ch_monitor_' + tmp + '_' + abs(remoteNodeId).toString(); // Inline function 'kotlin.text.lowercase' call // Inline function 'kotlin.text.substring' call // Inline function 'kotlin.js.asDynamic' call // Inline function 'kotlin.js.asDynamic' call var triggerName = tmp_0 + ('_' + operation.substring(0, 2).toLowerCase()); return 'DROP TRIGGER IF EXISTS ' + triggerName; } function acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation) { this.$receivedUids_1 = $receivedUids; this.$nodeId_1 = $nodeId; CoroutineImpl.call(this, resultContinuation); } protoOf(acknowledgeReceivedReplications$slambda).invoke_e5ovyj_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(acknowledgeReceivedReplications$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e5ovyj_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(acknowledgeReceivedReplications$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; tmp_0.this0__1 = this.$receivedUids_1; this.tmp0_iterator1__1 = this.this0__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.element2__1 = this.tmp0_iterator1__1.next_20eer_k$(); var tmp_1 = this; tmp_1.uid3__1 = this.element2__1; this.stmt_1.setLong_j1sybo_k$(1, this.uid3__1); this.stmt_1.setLong_j1sybo_k$(2, this.$nodeId_1); this.set_state_rjd8d0_k$(2); suspendResult = executeUpdateAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: 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); }; protoOf(acknowledgeReceivedReplications$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new acknowledgeReceivedReplications$slambda(this.$receivedUids_1, this.$nodeId_1, completion); i.stmt_1 = stmt; return i; }; protoOf(acknowledgeReceivedReplications$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function acknowledgeReceivedReplications$slambda_0($receivedUids, $nodeId, resultContinuation) { var i = new acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation); var l = function (stmt, $completion) { return i.invoke_e5ovyj_k$(stmt, $completion); }; l.$arity = 1; return l; } function selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda(results) { return mapRows(results, selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda$lambda); } function selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda$lambda(result) { return new OutgoingReplication(result.getLong_3wgf2g_k$('orUid'), result.getLong_3wgf2g_k$('destNodeId'), result.getInt_npc9pd_k$('orTableId'), result.getLong_3wgf2g_k$('orPk1'), result.getLong_3wgf2g_k$('orPk2')); } function selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation) { this.$nodeId_1 = $nodeId; this.$limit_1 = $limit; CoroutineImpl.call(this, resultContinuation); } protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).invoke_hjnl1o_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_hjnl1o_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$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.stmt_1.setLong_j1sybo_k$(1, this.$nodeId_1); this.stmt_1.setInt_c72a8z_k$(2, this.$limit_1); this.set_state_rjd8d0_k$(1); suspendResult = executeQueryAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; return useResults(ARGUMENT, selectPendingOutgoingReplicationsByDestNodeId$slambda$lambda); 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(selectPendingOutgoingReplicationsByDestNodeId$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda(this.$nodeId_1, this.$limit_1, completion); i.stmt_1 = stmt; return i; }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function selectPendingOutgoingReplicationsByDestNodeId$slambda_0($nodeId, $limit, resultContinuation) { var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation); var l = function (stmt, $completion) { return i.invoke_hjnl1o_k$(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation) { this.$message_1 = $message; this.$tableId_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(insertEntitiesFromMessage$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$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.stmt_1.setLong_j1sybo_k$(1, this.$message_1.get_fromNode_in16s5_k$()); this.stmt_1.setInt_c72a8z_k$(2, this.$tableId_1); this.stmt_1.setInt_c72a8z_k$(3, 0); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(insertEntitiesFromMessage$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda(this.$message_1, this.$tableId_1, completion); i.stmt_1 = stmt; return i; }; protoOf(insertEntitiesFromMessage$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function insertEntitiesFromMessage$slambda_0($message, $tableId, resultContinuation) { var i = new insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda_1($tableEntities, $entityMetaData, $message, resultContinuation) { this.$tableEntities_1 = $tableEntities; this.$entityMetaData_1 = $entityMetaData; this.$message_1 = $message; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda_1).invoke_e5ovyj_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(insertEntitiesFromMessage$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e5ovyj_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$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$(4); var tmp_0 = this; tmp_0.this0__1 = this.$tableEntities_1; this.tmp0_iterator1__1 = this.this0__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.element2__1 = this.tmp0_iterator1__1.next_20eer_k$(); var tmp_1 = this; tmp_1.entity3__1 = this.element2__1; setAllFromJsonObject(this.stmt_1, this.entity3__1.get_entity_cxtlv0_k$(), this.$entityMetaData_1.get_entityFields_ad1dc5_k$()); this.stmt_1.setLong_j1sybo_k$(this.$entityMetaData_1.get_entityFields_ad1dc5_k$().get_size_woubt6_k$() + 1 | 0, this.$message_1.get_fromNode_in16s5_k$()); this.set_state_rjd8d0_k$(2); suspendResult = executeUpdateAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: 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); }; protoOf(insertEntitiesFromMessage$slambda_1).create_hxh3pd_k$ = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda_1(this.$tableEntities_1, this.$entityMetaData_1, this.$message_1, completion); i.stmt_1 = stmt; return i; }; protoOf(insertEntitiesFromMessage$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function insertEntitiesFromMessage$slambda_2($tableEntities, $entityMetaData, $message, resultContinuation) { var i = new insertEntitiesFromMessage$slambda_1($tableEntities, $entityMetaData, $message, resultContinuation); var l = function (stmt, $completion) { return i.invoke_e5ovyj_k$(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation) { this.$message_1 = $message; this.$tableId_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda_3).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(insertEntitiesFromMessage$slambda_3).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$slambda_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); this.stmt_1.setLong_j1sybo_k$(1, this.$message_1.get_fromNode_in16s5_k$()); this.stmt_1.setInt_c72a8z_k$(2, this.$tableId_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(insertEntitiesFromMessage$slambda_3).create_hxh3pd_k$ = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda_3(this.$message_1, this.$tableId_1, completion); i.stmt_1 = stmt; return i; }; protoOf(insertEntitiesFromMessage$slambda_3).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function insertEntitiesFromMessage$slambda_4($message, $tableId, resultContinuation) { var i = new insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function getDoorNodeAuth$slambda$lambda(results) { return firstOrNull(mapRows(results, getDoorNodeAuth$slambda$lambda$lambda)); } function getDoorNodeAuth$slambda$lambda$lambda(it) { return it.getString_5demq7_k$(1); } function getDoorNodeAuth$slambda($nodeId, resultContinuation) { this.$nodeId_1 = $nodeId; CoroutineImpl.call(this, resultContinuation); } protoOf(getDoorNodeAuth$slambda).invoke_j35ylu_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(getDoorNodeAuth$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_j35ylu_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(getDoorNodeAuth$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.stmt_1.setLong_j1sybo_k$(1, this.$nodeId_1); this.set_state_rjd8d0_k$(1); suspendResult = executeQueryAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; return useResults(ARGUMENT, getDoorNodeAuth$slambda$lambda); 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(getDoorNodeAuth$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new getDoorNodeAuth$slambda(this.$nodeId_1, completion); i.stmt_1 = stmt; return i; }; protoOf(getDoorNodeAuth$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function getDoorNodeAuth$slambda_0($nodeId, resultContinuation) { var i = new getDoorNodeAuth$slambda($nodeId, resultContinuation); var l = function (stmt, $completion) { return i.invoke_j35ylu_k$(stmt, $completion); }; l.$arity = 1; return l; } function insertNewDoorNode$slambda($node, resultContinuation) { this.$node_1 = $node; CoroutineImpl.call(this, resultContinuation); } protoOf(insertNewDoorNode$slambda).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(insertNewDoorNode$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertNewDoorNode$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.stmt_1.setLong_j1sybo_k$(1, this.$node_1.get_nodeId_h7ho7a_k$()); this.stmt_1.setString_2gt7ua_k$(2, this.$node_1.get_auth_woj2sx_k$()); this.stmt_1.setInt_c72a8z_k$(3, this.$node_1.get_rel_18ix1s_k$()); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(insertNewDoorNode$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new insertNewDoorNode$slambda(this.$node_1, completion); i.stmt_1 = stmt; return i; }; protoOf(insertNewDoorNode$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function insertNewDoorNode$slambda_0($node, resultContinuation) { var i = new insertNewDoorNode$slambda($node, resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda$lambda($tableId, $primaryKeys, $entityMetaData) { return function (mapResult) { return new DoorReplicationEntity($tableId, $primaryKeys.orUid_1, rowToJsonObject(mapResult, $entityMetaData.get_entityFields_ad1dc5_k$())); }; } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda($tableId, $primaryKeys, $entityMetaData) { return function (result) { return mapNextRow(result, null, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda$lambda($tableId, $primaryKeys, $entityMetaData)); }; } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda($primaryKeysList, $entityMetaData, $tableId, resultContinuation) { this.$primaryKeysList_1 = $primaryKeysList; this.$entityMetaData_1 = $entityMetaData; this.$tableId_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).invoke_u0nirm_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_u0nirm_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$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; tmp_0.this0__1 = this.$primaryKeysList_1; var tmp_1 = this; tmp_1.this1__1 = this.this0__1; var tmp_2 = this; tmp_2.destination2__1 = ArrayList_init_$Create$(); var tmp_3 = this; tmp_3.this3__1 = this.this1__1; this.tmp0_iterator4__1 = this.this3__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(1); continue $sm; case 1: if (!this.tmp0_iterator4__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(3); continue $sm; } this.element5__1 = this.tmp0_iterator4__1.next_20eer_k$(); var tmp_4 = this; tmp_4.element6__1 = this.element5__1; var tmp_5 = this; tmp_5.primaryKeys7__1 = this.element6__1; this.stmt_1.setLong_j1sybo_k$(1, this.primaryKeys7__1.pk1__1); if (this.$entityMetaData_1.get_entityPrimaryKeyFieldNames_5y8huf_k$().get_size_woubt6_k$() >= 2) { this.stmt_1.setLong_j1sybo_k$(2, this.primaryKeys7__1.pk2__1); } if (this.$entityMetaData_1.get_entityPrimaryKeyFieldNames_5y8huf_k$().get_size_woubt6_k$() >= 3) { this.stmt_1.setLong_j1sybo_k$(3, this.primaryKeys7__1.pk3__1); } if (this.$entityMetaData_1.get_entityPrimaryKeyFieldNames_5y8huf_k$().get_size_woubt6_k$() >= 4) { this.stmt_1.setLong_j1sybo_k$(3, this.primaryKeys7__1.pk4__1); } this.set_state_rjd8d0_k$(2); suspendResult = executeQueryAsyncKmp(this.stmt_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: var ARGUMENT = suspendResult; var tmp0_safe_receiver = useResults(ARGUMENT, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda(this.$tableId_1, this.primaryKeys7__1, this.$entityMetaData_1)); if (tmp0_safe_receiver == null) null; else { this.destination2__1.add_utx5q5_k$(tmp0_safe_receiver); } this.set_state_rjd8d0_k$(1); continue $sm; case 3: return this.destination2__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); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda(this.$primaryKeysList_1, this.$entityMetaData_1, this.$tableId_1, completion); i.stmt_1 = stmt; return i; }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0($primaryKeysList, $entityMetaData, $tableId, resultContinuation) { var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda($primaryKeysList, $entityMetaData, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.invoke_u0nirm_k$(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$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 = executeUpdateAsyncKmp(this.stmt_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(withRepoChangeMonitorAsync$slambda$slambda).create_hxh3pd_k$ = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda(completion); i.stmt_1 = stmt; return i; }; protoOf(withRepoChangeMonitorAsync$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function withRepoChangeMonitorAsync$slambda$slambda_0(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda(resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$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$(2); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(withRepoChangeMonitorAsync$slambda$slambda_1).create_hxh3pd_k$ = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_1(completion); i.stmt_1 = stmt; return i; }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function withRepoChangeMonitorAsync$slambda$slambda_2(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_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); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(withRepoChangeMonitorAsync$slambda$slambda_3).create_hxh3pd_k$ = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_3(completion); i.stmt_1 = stmt; return i; }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function withRepoChangeMonitorAsync$slambda$slambda_4(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).invoke_n3u1ar_k$ = function (stmt, $completion) { var tmp = this.create_hxh3pd_k$(stmt, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_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$(2); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.stmt_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(withRepoChangeMonitorAsync$slambda$slambda_5).create_hxh3pd_k$ = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_5(completion); i.stmt_1 = stmt; return i; }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function withRepoChangeMonitorAsync$slambda$slambda_6(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation); var l = function (stmt, $completion) { return i.invoke_n3u1ar_k$(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation) { this.$this_withRepoChangeMonitorAsync_1 = $this_withRepoChangeMonitorAsync; this.$entityMetaData_1 = $entityMetaData; this.$remoteNodeId_1 = $remoteNodeId; this.$block_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda).invoke_ftrq8q_k$ = function (it, $completion) { var tmp = this.create_3kxuey_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withRepoChangeMonitorAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_ftrq8q_k$(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$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$(6); this.set_state_rjd8d0_k$(1); var tmp_0 = this.$this_withRepoChangeMonitorAsync_1.get_db_knto1l_k$(); var tmp_1 = createChangeMonitorTriggerSql(this.$entityMetaData_1, this.$remoteNodeId_1, 'INSERT'); suspendResult = prepareAndUseStatementAsync_0(tmp_0, tmp_1, VOID, withRepoChangeMonitorAsync$slambda$slambda_0(null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); var tmp_2 = this.$this_withRepoChangeMonitorAsync_1.get_db_knto1l_k$(); var tmp_3 = createChangeMonitorTriggerSql(this.$entityMetaData_1, this.$remoteNodeId_1, 'UPDATE'); suspendResult = prepareAndUseStatementAsync_0(tmp_2, tmp_3, VOID, withRepoChangeMonitorAsync$slambda$slambda_2(null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.set_state_rjd8d0_k$(3); suspendResult = this.$block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.result0__1 = suspendResult; this.set_state_rjd8d0_k$(4); var tmp_4 = this.$this_withRepoChangeMonitorAsync_1.get_db_knto1l_k$(); var tmp_5 = dropChangeMonitorTriggerSql(this.$entityMetaData_1, this.$remoteNodeId_1, 'INSERT'); suspendResult = prepareAndUseStatementAsync_0(tmp_4, tmp_5, VOID, withRepoChangeMonitorAsync$slambda$slambda_4(null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.set_state_rjd8d0_k$(5); var tmp_6 = this.$this_withRepoChangeMonitorAsync_1.get_db_knto1l_k$(); var tmp_7 = dropChangeMonitorTriggerSql(this.$entityMetaData_1, this.$remoteNodeId_1, 'UPDATE'); suspendResult = prepareAndUseStatementAsync_0(tmp_6, tmp_7, VOID, withRepoChangeMonitorAsync$slambda$slambda_6(null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: return this.result0__1; case 6: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 6) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda).create_3kxuey_k$ = function (it, completion) { var i = new withRepoChangeMonitorAsync$slambda(this.$this_withRepoChangeMonitorAsync_1, this.$entityMetaData_1, this.$remoteNodeId_1, this.$block_1, completion); i.it_1 = it; return i; }; protoOf(withRepoChangeMonitorAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_3kxuey_k$(value instanceof RoomDatabase ? value : THROW_CCE(), completion); }; function withRepoChangeMonitorAsync$slambda_0($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation); var l = function (it, $completion) { return i.invoke_ftrq8q_k$(it, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitor$lambda$lambda(stmt) { return stmt.executeUpdate_fapcbi_k$(); } function withRepoChangeMonitor$lambda$lambda_0(stmt) { return stmt.executeUpdate_fapcbi_k$(); } function withRepoChangeMonitor$lambda$lambda_1(stmt) { return stmt.executeUpdate_fapcbi_k$(); } function withRepoChangeMonitor$lambda$lambda_2(stmt) { return stmt.executeUpdate_fapcbi_k$(); } function withRepoChangeMonitor$lambda($this_withRepoChangeMonitor, $entityMetaData, $remoteNodeId, $block) { return function (it) { var tmp = $this_withRepoChangeMonitor.get_db_knto1l_k$(); var tmp_0 = createChangeMonitorTriggerSql($entityMetaData, $remoteNodeId, 'INSERT'); prepareAndUseStatement_0(tmp, tmp_0, VOID, withRepoChangeMonitor$lambda$lambda); var tmp_1 = $this_withRepoChangeMonitor.get_db_knto1l_k$(); var tmp_2 = createChangeMonitorTriggerSql($entityMetaData, $remoteNodeId, 'UPDATE'); prepareAndUseStatement_0(tmp_1, tmp_2, VOID, withRepoChangeMonitor$lambda$lambda_0); var result = $block(); var tmp_3 = $this_withRepoChangeMonitor.get_db_knto1l_k$(); var tmp_4 = dropChangeMonitorTriggerSql($entityMetaData, $remoteNodeId, 'INSERT'); prepareAndUseStatement_0(tmp_3, tmp_4, VOID, withRepoChangeMonitor$lambda$lambda_1); var tmp_5 = $this_withRepoChangeMonitor.get_db_knto1l_k$(); var tmp_6 = dropChangeMonitorTriggerSql($entityMetaData, $remoteNodeId, 'UPDATE'); prepareAndUseStatement_0(tmp_5, tmp_6, VOID, withRepoChangeMonitor$lambda$lambda_2); return result; }; } function onClientRepoDoorMessageHttpResponse$lambda($nodeEventManager, $httpResponse, $message) { return function () { return '[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.get_dbName_c9i0qa_k$() + '] - ' + get_request($httpResponse).get_url_18iuii_k$() + ' - ' + ('handle message with ' + $message.get_replications_s2xb3k_k$().get_size_woubt6_k$() + ' replications'); }; } function onClientRepoDoorMessageHttpResponse$lambda_0($nodeEventManager, $httpResponse) { return function () { return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.get_dbName_c9i0qa_k$() + '] - ' + get_request($httpResponse).get_url_18iuii_k$() + ' -' + ' http response was not modified or no content, no need to do anything'; }; } function onClientRepoDoorMessageHttpResponse$lambda_1($nodeEventManager, $httpResponse) { return function () { return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.get_dbName_c9i0qa_k$() + '] - ' + get_request($httpResponse).get_url_18iuii_k$() + ' -' + (' unexpected response status = ' + $httpResponse.get_status_jnf6d7_k$()); }; } function $selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17(_this__u8e3s4, nodeId, limit, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.nodeId_1 = nodeId; this.limit_1 = limit; } protoOf($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17).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); this.set_state_rjd8d0_k$(1); suspendResult = prepareAndUseStatementAsync_0(this._this__u8e3s4__1, '\n SELECT OutgoingReplication.*\n FROM OutgoingReplication\n WHERE OutgoingReplication.destNodeId = ?\n ORDER BY OutgoingReplication.orUid ASC\n LIMIT ?\n ', true, selectPendingOutgoingReplicationsByDestNodeId$slambda_0(this.nodeId_1, this.limit_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.pendingReplications0__1 = suspendResult; if (this.pendingReplications0__1.isEmpty_y1axqb_k$()) return emptyList(); var tmp_0 = this; var this_0 = this.pendingReplications0__1; var result = mutableLinkedListOf([]); var lastItemKey = null; var lastList = null; var tmp0_iterator = this_0.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); var itemKey = item.get_orTableId_lu6glf_k$(); if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) { lastList.add_utx5q5_k$(item); } else { var newList = mutableLinkedListOf([item]); result.add_utx5q5_k$(newList); lastList = newList; } lastItemKey = itemKey; } tmp_0.this1__1 = toList(result); var tmp_1 = this; tmp_1.this2__1 = this.this1__1; var tmp_2 = this; tmp_2.destination3__1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this.this1__1, 10)); this.tmp0_iterator4__1 = this.this2__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: if (!this.tmp0_iterator4__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(4); continue $sm; } this.item5__1 = this.tmp0_iterator4__1.next_20eer_k$(); var tmp_3 = this; tmp_3.tableIdPendingList6__1 = this.item5__1; this.tableId7__1 = first_0(this.tableIdPendingList6__1).get_orTableId_lu6glf_k$(); this.set_state_rjd8d0_k$(3); var this_1 = this.pendingReplications0__1; var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10)); var tmp0_iterator_0 = this_1.iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var item_0 = tmp0_iterator_0.next_20eer_k$(); destination.add_utx5q5_k$(new ReplicateEntityPrimaryKeys(item_0.get_orPk1_iwh40a_k$(), item_0.get_orPk2_iwh40b_k$(), item_0.get_orPk3_iwh40c_k$(), item_0.get_orPk4_iwh40d_k$(), item_0.get_orUid_iwh7pg_k$())); } suspendResult = selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(this._this__u8e3s4__1, this.tableId7__1, destination, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: var ARGUMENT = suspendResult; this.destination3__1.add_utx5q5_k$(ARGUMENT); this.set_state_rjd8d0_k$(2); continue $sm; case 4: var ARGUMENT_0 = this.destination3__1; return flatten(ARGUMENT_0); 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); }; function $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.message_1 = message; } protoOf($insertEntitiesFromMessageCOROUTINE$18).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$(9); this.dbMetadata0__1 = doorDatabaseMetadata(getKClassFromExpression(this._this__u8e3s4__1)); this.hasReplicationOpTable1__1 = this.dbMetadata0__1.get_allTables_1jy9x9_k$().contains_aljjnj_k$('ReplicationOperation'); var tmp_0 = this; var this_0 = this.message_1.get_replications_s2xb3k_k$(); var result = mutableLinkedListOf([]); var lastItemKey = null; var lastList = null; var tmp0_iterator = this_0.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); var itemKey = item.get_tableId_of07s0_k$(); if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) { lastList.add_utx5q5_k$(item); } else { var newList = mutableLinkedListOf([item]); result.add_utx5q5_k$(newList); lastList = newList; } lastItemKey = itemKey; } tmp_0.this2__1 = toList(result); this.tmp0_iterator3__1 = this.this2__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(1); continue $sm; case 1: if (!this.tmp0_iterator3__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(8); continue $sm; } this.element4__1 = this.tmp0_iterator3__1.next_20eer_k$(); var tmp_1 = this; tmp_1.tableEntities5__1 = this.element4__1; this.tableId6__1 = first_0(this.tableEntities5__1).get_tableId_of07s0_k$(); this.entityMetaData7__1 = this.dbMetadata0__1.requireReplicateEntityMetaData_9swzku_k$(this.tableId6__1); if (this.hasReplicationOpTable1__1) { this.set_state_rjd8d0_k$(2); suspendResult = prepareAndUseStatementAsync_0(this._this__u8e3s4__1, '\n INSERT INTO ReplicationOperation(repOpRemoteNodeId, repOpTableId, repOpStatus)\n VALUES(?, ?, ?)\n ', false, insertEntitiesFromMessage$slambda_0(this.message_1, this.tableId6__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(3); continue $sm; } case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: if (this.entityMetaData7__1.get_remoteInsertStrategy_t4k5ff_k$().equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) { this.set_state_rjd8d0_k$(4); var tmp_2 = this.entityMetaData7__1.get_insertIntoReceiveViewSql_vqtvfs_k$(); suspendResult = prepareAndUseStatementAsync_0(this._this__u8e3s4__1, tmp_2, false, insertEntitiesFromMessage$slambda_2(this.tableEntities5__1, this.entityMetaData7__1, this.message_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(5); continue $sm; } case 4: this.set_state_rjd8d0_k$(5); continue $sm; case 5: if (this.hasReplicationOpTable1__1) { this.set_state_rjd8d0_k$(6); suspendResult = prepareAndUseStatementAsync_0(this._this__u8e3s4__1, '\n DELETE FROM ReplicationOperation\n WHERE repOpRemoteNodeId = ?\n AND repOpTableId = ?\n ', false, insertEntitiesFromMessage$slambda_4(this.message_1, this.tableId6__1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(7); continue $sm; } case 6: this.set_state_rjd8d0_k$(7); continue $sm; case 7: this.set_state_rjd8d0_k$(1); continue $sm; case 8: return Unit_getInstance(); case 9: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 9) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $insertNewDoorNodeCOROUTINE$19(_this__u8e3s4, node, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.node_1 = node; } protoOf($insertNewDoorNodeCOROUTINE$19).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 = prepareAndUseStatementAsync_0(this._this__u8e3s4__1, 'INSERT INTO DoorNode(nodeId, auth, rel) VALUES(?, ?, ?)', VOID, insertNewDoorNode$slambda_0(this.node_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); }; function $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.httpResponse_1 = httpResponse; this.json_1 = json; } protoOf($onClientRepoDoorMessageHttpResponseCOROUTINE$20).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); this.nodeEventManager0__1 = get_doorWrapper(this._this__u8e3s4__1).get_nodeEventManager_3ccda_k$(); this.logger1__1 = this.nodeEventManager0__1.get_logger_g9gejd_k$(); this.tmp0_subject2__1 = this.httpResponse_1.get_status_jnf6d7_k$(); if (this.tmp0_subject2__1.equals(Companion_getInstance().get_OK_kntokb_k$())) { this.ARGUMENT3__1 = Companion_getInstance_15().serializer_9w0wvi_k$(); this.set_state_rjd8d0_k$(1); suspendResult = bodyAsText(this.httpResponse_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { if (this.tmp0_subject2__1.equals(Companion_getInstance().get_NotModified_wswedp_k$()) ? true : this.tmp0_subject2__1.equals(Companion_getInstance().get_NoContent_3ur3v5_k$())) { v(this.logger1__1, VOID, onClientRepoDoorMessageHttpResponse$lambda_0(this.nodeEventManager0__1, this.httpResponse_1)); this.set_state_rjd8d0_k$(3); continue $sm; } else { e_0(this.logger1__1, VOID, onClientRepoDoorMessageHttpResponse$lambda_1(this.nodeEventManager0__1, this.httpResponse_1)); throw IllegalStateException_init_$Create$('' + this._this__u8e3s4__1 + ' - unexpected response status - ' + this.httpResponse_1.get_status_jnf6d7_k$()); } } case 1: this.ARGUMENT4__1 = suspendResult; this.message5__1 = this.json_1.decodeFromString_jwu9sq_k$(this.ARGUMENT3__1, this.ARGUMENT4__1); v(this.logger1__1, VOID, onClientRepoDoorMessageHttpResponse$lambda(this.nodeEventManager0__1, this.httpResponse_1, this.message5__1)); this.set_state_rjd8d0_k$(2); suspendResult = this.nodeEventManager0__1.onIncomingMessageReceived_3v60w2_k$(this.message5__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } 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); }; function Companion_14() { Companion_instance_14 = this; } protoOf(Companion_14).serializer_9w0wvi_k$ = function () { return $serializer_getInstance_1(); }; var Companion_instance_14; function Companion_getInstance_17() { if (Companion_instance_14 == null) new Companion_14(); return Companion_instance_14; } function $serializer_1() { $serializer_instance_1 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.DoorReplicationEntity', this, 3); tmp0_serialDesc.addElement_5pzumi_k$('tableId', false); tmp0_serialDesc.addElement_5pzumi_k$('orUid', false); tmp0_serialDesc.addElement_5pzumi_k$('entity', false); this.descriptor_1 = tmp0_serialDesc; } protoOf($serializer_1).get_descriptor_wjt6a0_k$ = function () { return this.descriptor_1; }; protoOf($serializer_1).childSerializers_5ghqw5_k$ = function () { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [IntSerializer_getInstance(), LongSerializer_getInstance(), JsonObjectSerializer_getInstance()]; }; protoOf($serializer_1).deserialize_sy6x50_k$ = function (decoder) { var tmp0_desc = this.descriptor_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = 0; var tmp5_local1 = new Long(0, 0); var tmp6_local2 = null; var tmp7_input = decoder.beginStructure_yljocp_k$(tmp0_desc); if (tmp7_input.decodeSequentially_xlblqy_k$()) { tmp4_local0 = tmp7_input.decodeIntElement_941u6a_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; tmp5_local1 = tmp7_input.decodeLongElement_994anb_k$(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; tmp6_local2 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2); tmp3_bitMask0 = tmp3_bitMask0 | 4; } else while (tmp1_flag) { tmp2_index = tmp7_input.decodeElementIndex_bstkhp_k$(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp7_input.decodeIntElement_941u6a_k$(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; case 1: tmp5_local1 = tmp7_input.decodeLongElement_994anb_k$(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; break; case 2: tmp6_local2 = tmp7_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2); tmp3_bitMask0 = tmp3_bitMask0 | 4; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp7_input.endStructure_1xqz0n_k$(tmp0_desc); return DoorReplicationEntity_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, null); }; protoOf($serializer_1).serialize_cqtu5e_k$ = function (encoder, value) { var tmp0_desc = this.descriptor_1; var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc); tmp1_output.encodeIntElement_krhhce_k$(tmp0_desc, 0, value.tableId_1); tmp1_output.encodeLongElement_cega27_k$(tmp0_desc, 1, value.orUid_1); tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 2, JsonObjectSerializer_getInstance(), value.entity_1); tmp1_output.endStructure_1xqz0n_k$(tmp0_desc); }; protoOf($serializer_1).serialize_5ase3y_k$ = function (encoder, value) { return this.serialize_cqtu5e_k$(encoder, value instanceof DoorReplicationEntity ? value : THROW_CCE()); }; var $serializer_instance_1; function $serializer_getInstance_1() { if ($serializer_instance_1 == null) new $serializer_1(); return $serializer_instance_1; } function DoorReplicationEntity_init_$Init$(seen1, tableId, orUid, entity, serializationConstructorMarker, $this) { if (!(7 === (7 & seen1))) { throwMissingFieldException(seen1, 7, $serializer_getInstance_1().descriptor_1); } $this.tableId_1 = tableId; $this.orUid_1 = orUid; $this.entity_1 = entity; return $this; } function DoorReplicationEntity_init_$Create$(seen1, tableId, orUid, entity, serializationConstructorMarker) { return DoorReplicationEntity_init_$Init$(seen1, tableId, orUid, entity, serializationConstructorMarker, objectCreate(protoOf(DoorReplicationEntity))); } function DoorReplicationEntity(tableId, orUid, entity) { Companion_getInstance_17(); this.tableId_1 = tableId; this.orUid_1 = orUid; this.entity_1 = entity; } protoOf(DoorReplicationEntity).get_tableId_of07s0_k$ = function () { return this.tableId_1; }; protoOf(DoorReplicationEntity).get_orUid_iwh7pg_k$ = function () { return this.orUid_1; }; protoOf(DoorReplicationEntity).get_entity_cxtlv0_k$ = function () { return this.entity_1; }; protoOf(DoorReplicationEntity).component1_7eebsc_k$ = function () { return this.tableId_1; }; protoOf(DoorReplicationEntity).component2_7eebsb_k$ = function () { return this.orUid_1; }; protoOf(DoorReplicationEntity).component3_7eebsa_k$ = function () { return this.entity_1; }; protoOf(DoorReplicationEntity).copy_c4k5st_k$ = function (tableId, orUid, entity) { return new DoorReplicationEntity(tableId, orUid, entity); }; protoOf(DoorReplicationEntity).copy$default_3geszp_k$ = function (tableId, orUid, entity, $super) { tableId = tableId === VOID ? this.tableId_1 : tableId; orUid = orUid === VOID ? this.orUid_1 : orUid; entity = entity === VOID ? this.entity_1 : entity; return $super === VOID ? this.copy_c4k5st_k$(tableId, orUid, entity) : $super.copy_c4k5st_k$.call(this, tableId, orUid, entity); }; protoOf(DoorReplicationEntity).toString = function () { return 'DoorReplicationEntity(tableId=' + this.tableId_1 + ', orUid=' + this.orUid_1.toString() + ', entity=' + this.entity_1 + ')'; }; protoOf(DoorReplicationEntity).hashCode = function () { var result = this.tableId_1; result = imul(result, 31) + this.orUid_1.hashCode() | 0; result = imul(result, 31) + this.entity_1.hashCode() | 0; return result; }; protoOf(DoorReplicationEntity).equals = function (other) { if (this === other) return true; if (!(other instanceof DoorReplicationEntity)) return false; var tmp0_other_with_cast = other instanceof DoorReplicationEntity ? other : THROW_CCE(); if (!(this.tableId_1 === tmp0_other_with_cast.tableId_1)) return false; if (!this.orUid_1.equals(tmp0_other_with_cast.orUid_1)) return false; if (!this.entity_1.equals(tmp0_other_with_cast.entity_1)) return false; return true; }; function _get_db__ndbzd9_1($this) { return $this.db_1; } function DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda($receivedAck, this$0, $nodeId, $batchSize, resultContinuation) { this.$receivedAck_1 = $receivedAck; this.this$0__1 = this$0; this.$nodeId_1 = $nodeId; this.$batchSize_1 = $batchSize; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).invoke_yaliv1_k$ = function (it, $completion) { var tmp = this.create_3kxuey_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_yaliv1_k$(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$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); if (!this.$receivedAck_1.get_replicationUids_xbjn4q_k$().isEmpty_y1axqb_k$()) { this.set_state_rjd8d0_k$(1); suspendResult = acknowledgeReceivedReplications(this.this$0__1.db_1, this.$nodeId_1, this.$receivedAck_1.get_replicationUids_xbjn4q_k$(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(2); continue $sm; } case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); suspendResult = selectPendingOutgoingReplicationsByDestNodeId(this.this$0__1.db_1, this.$nodeId_1, this.$batchSize_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: return suspendResult; 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(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).create_3kxuey_k$ = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda(this.$receivedAck_1, this.this$0__1, this.$nodeId_1, this.$batchSize_1, completion); i.it_1 = it; return i; }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_3kxuey_k$(value instanceof RoomDatabase ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda_0($receivedAck, this$0, $nodeId, $batchSize, resultContinuation) { var i = new DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda($receivedAck, this$0, $nodeId, $batchSize, resultContinuation); var l = function (it, $completion) { return i.invoke_yaliv1_k$(it, $completion); }; l.$arity = 1; return l; } function _get_db__ndbzd9_2($this) { return $this.db_1; } function DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda($fakeRemoteNodeId, $endpointUrl, resultContinuation) { this.$fakeRemoteNodeId_1 = $fakeRemoteNodeId; this.$endpointUrl_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).invoke_n3u1ar_k$ = function (it, $completion) { var tmp = this.create_hxh3pd_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$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.it_1.setLong_j1sybo_k$(1, this.$fakeRemoteNodeId_1); this.it_1.setString_2gt7ua_k$(2, this.$endpointUrl_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.it_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(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).create_hxh3pd_k$ = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda(this.$fakeRemoteNodeId_1, this.$endpointUrl_1, completion); i.it_1 = it; return i; }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda_0($fakeRemoteNodeId, $endpointUrl, resultContinuation) { var i = new DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda($fakeRemoteNodeId, $endpointUrl, resultContinuation); var l = function (it, $completion) { return i.invoke_n3u1ar_k$(it, $completion); }; l.$arity = 1; return l; } function $invokeCOROUTINE$21(_this__u8e3s4, fakeRemoteNodeId, endpointUrl, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.fakeRemoteNodeId_1 = fakeRemoteNodeId; this.endpointUrl_1 = endpointUrl; } protoOf($invokeCOROUTINE$21).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 = prepareAndUseStatementAsync_0(this._this__u8e3s4__1.db_1, '\n INSERT INTO PendingRepositorySession(remoteNodeId, endpointUrl)\n VALUES(?, ?)\n ', VOID, DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda_0(this.fakeRemoteNodeId_1, this.endpointUrl_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); }; function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda($remoteNodeId, $endpointUrl, resultContinuation) { this.$remoteNodeId_1 = $remoteNodeId; this.$endpointUrl_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).invoke_n3u1ar_k$ = function (it, $completion) { var tmp = this.create_hxh3pd_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$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.it_1.setLong_j1sybo_k$(1, this.$remoteNodeId_1); this.it_1.setString_2gt7ua_k$(2, this.$endpointUrl_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.it_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(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).create_hxh3pd_k$ = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda(this.$remoteNodeId_1, this.$endpointUrl_1, completion); i.it_1 = it; return i; }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_0($remoteNodeId, $endpointUrl, resultContinuation) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda($remoteNodeId, $endpointUrl, resultContinuation); var l = function (it, $completion) { return i.invoke_n3u1ar_k$(it, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1($endpointUrl, resultContinuation) { this.$endpointUrl_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).invoke_n3u1ar_k$ = function (it, $completion) { var tmp = this.create_hxh3pd_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_n3u1ar_k$((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$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$(2); this.it_1.setString_2gt7ua_k$(1, this.$endpointUrl_1); this.set_state_rjd8d0_k$(1); suspendResult = executeUpdateAsyncKmp(this.it_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(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).create_hxh3pd_k$ = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1(this.$endpointUrl_1, completion); i.it_1 = it; return i; }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_hxh3pd_k$((!(value == null) ? isInterface(value, PreparedStatement) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_2($endpointUrl, resultContinuation) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1($endpointUrl, resultContinuation); var l = function (it, $completion) { return i.invoke_n3u1ar_k$(it, $completion); }; l.$arity = 1; return l; } function _get_db__ndbzd9_3($this) { return $this.db_1; } function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this$0, $remoteNodeId, $endpointUrl, resultContinuation) { this.this$0__1 = this$0; this.$remoteNodeId_1 = $remoteNodeId; this.$endpointUrl_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).invoke_e0mr08_k$ = function (it, $completion) { var tmp = this.create_3kxuey_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_e0mr08_k$(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$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 = prepareAndUseStatementAsync_0(this.this$0__1.db_1, '\n UPDATE OutgoingReplication\n SET destNodeId = ?\n WHERE destNodeId IN\n (SELECT PendingRepositorySession.remoteNodeId\n FROM PendingRepositorySession\n WHERE endpointUrl = ?) \n ', false, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_0(this.$remoteNodeId_1, this.$endpointUrl_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); suspendResult = prepareAndUseStatementAsync_0(this.this$0__1.db_1, '\n DELETE \n FROM PendingRepositorySession\n WHERE PendingRepositorySession.endpointUrl = ?\n ', false, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_2(this.$endpointUrl_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: return suspendResult; 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(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).create_3kxuey_k$ = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this.this$0__1, this.$remoteNodeId_1, this.$endpointUrl_1, completion); i.it_1 = it; return i; }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_3kxuey_k$(value instanceof RoomDatabase ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda_0(this$0, $remoteNodeId, $endpointUrl, resultContinuation) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this$0, $remoteNodeId, $endpointUrl, resultContinuation); var l = function (it, $completion) { return i.invoke_e0mr08_k$(it, $completion); }; l.$arity = 1; return l; } function $invokeCOROUTINE$22(_this__u8e3s4, remoteNodeId, endpointUrl, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.remoteNodeId_1 = remoteNodeId; this.endpointUrl_1 = endpointUrl; } protoOf($invokeCOROUTINE$22).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 = withDoorTransactionAsync(this._this__u8e3s4__1.db_1, VOID, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda_0(this._this__u8e3s4__1, this.remoteNodeId_1, this.endpointUrl_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); }; function DoorRepositoryReplicationClient$slambda$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' getRemoteNodeId : requesting node id of server'; }; } function DoorRepositoryReplicationClient$slambda$lambda_0(this$0, $remoteNodeIdResponse, $nodeIdHeaderVal) { return function () { return this$0.logPrefix_1 + ' getRemoteNodeId : got server node id: status=' + $remoteNodeIdResponse.get_status_jnf6d7_k$() + ' ' + toString_0($nodeIdHeaderVal); }; } function DoorRepositoryReplicationClient$slambda$lambda_1(this$0) { return function () { return this$0.logPrefix_1 + ' getRemoteNodeId : exception getting remote node id'; }; } function DoorRepositoryReplicationClient$slambda$slambda$slambda($remoteNodeIdVal, this$0, resultContinuation) { this.$remoteNodeIdVal_1 = $remoteNodeIdVal; this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).invoke_l1b4fx_k$ = function (events, $completion) { var tmp = this.create_2c4j9d_k$(events, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_l1b4fx_k$((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$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); var tmp$ret$0; l$ret$1: do { var this_0 = this.events_1; var tmp_0; if (isInterface(this_0, Collection)) { tmp_0 = this_0.isEmpty_y1axqb_k$(); } else { tmp_0 = false; } if (tmp_0) { tmp$ret$0 = false; break l$ret$1; } var tmp0_iterator = this_0.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); if (element.get_toNode_k1dkx2_k$().equals(this.$remoteNodeIdVal_1) ? element.get_what_wowufh_k$() === Companion_getInstance_15().get_WHAT_REPLICATION_PUSH_tr3xkv_k$() : false) { tmp$ret$0 = true; break l$ret$1; } } tmp$ret$0 = false; } while (false); if (tmp$ret$0) { this.this$0__1.sendNotifyChannel_1.trySend_62dpg8_k$(Unit_getInstance()); } return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).create_2c4j9d_k$ = function (events, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda(this.$remoteNodeIdVal_1, this.this$0__1, completion); i.events_1 = events; return i; }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_2c4j9d_k$((!(value == null) ? isInterface(value, List) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda$slambda$slambda_0($remoteNodeIdVal, this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda($remoteNodeIdVal, this$0, resultContinuation); var l = function (events, $completion) { return i.invoke_l1b4fx_k$(events, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda$slambda_1($remoteNodeIdVal, this$0, resultContinuation) { this.$remoteNodeIdVal_1 = $remoteNodeIdVal; this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).invoke_1inq8d_k$ = function (message, $completion) { var tmp = this.create_g8ln41_k$(message, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_1inq8d_k$(p1 instanceof DoorMessage ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$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); if (this.message_1.get_fromNode_in16s5_k$().equals(this.$remoteNodeIdVal_1) ? this.message_1.get_what_wowufh_k$() === Companion_getInstance_15().get_WHAT_REPLICATION_PUSH_tr3xkv_k$() : false) { this.this$0__1.fetchNotifyChannel_1.trySend_62dpg8_k$(Unit_getInstance()); } return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).create_g8ln41_k$ = function (message, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda_1(this.$remoteNodeIdVal_1, this.this$0__1, completion); i.message_1 = message; return i; }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_g8ln41_k$(value instanceof DoorMessage ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda$slambda$slambda_2($remoteNodeIdVal, this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda_1($remoteNodeIdVal, this$0, resultContinuation); var l = function (message, $completion) { return i.invoke_1inq8d_k$(message, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda(this$0, $remoteNodeIdVal, resultContinuation) { this.this$0__1 = this$0; this.$remoteNodeIdVal_1 = $remoteNodeIdVal; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$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(DoorRepositoryReplicationClient$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$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); var tmp_0 = this.this$0__1.nodeEventManager_1.get_outgoingEvents_40o3ma_k$(); var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_0(this.$remoteNodeIdVal_1, this.this$0__1, null); suspendResult = tmp_0.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_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(DoorRepositoryReplicationClient$slambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda(this.this$0__1, this.$remoteNodeIdVal_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda$slambda_0(this$0, $remoteNodeIdVal, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda$slambda(this$0, $remoteNodeIdVal, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda_1(this$0, $remoteNodeIdVal, resultContinuation) { this.this$0__1 = this$0; this.$remoteNodeIdVal_1 = $remoteNodeIdVal; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).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(DoorRepositoryReplicationClient$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(DoorRepositoryReplicationClient$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$(2); this.set_state_rjd8d0_k$(1); var tmp_0 = this.this$0__1.nodeEventManager_1.get_incomingMessages_7rqqu3_k$(); var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_2(this.$remoteNodeIdVal_1, this.this$0__1, null); suspendResult = tmp_0.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_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(DoorRepositoryReplicationClient$slambda$slambda_1).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda_1(this.this$0__1, this.$remoteNodeIdVal_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$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 DoorRepositoryReplicationClient$slambda$slambda_2(this$0, $remoteNodeIdVal, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda$slambda_1(this$0, $remoteNodeIdVal, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function _get_localNodeId__wdvgqf($this) { return $this.localNodeId_1; } function _get_localNodeAuth__axnzdw($this) { return $this.localNodeAuth_1; } function _get_httpClient__2ty1zc($this) { return $this.httpClient_1; } function _get_json__d8whur($this) { return $this.json_1; } function _get_repoEndpointUrl__yiipiv($this) { return $this.repoEndpointUrl_1; } function _get_nodeEventManager__cjqgt2_1($this) { return $this.nodeEventManager_1; } function _get_onMarkAcknowledgedAndGetNextOutgoingReplications__qnv76($this) { return $this.onMarkAcknowledgedAndGetNextOutgoingReplications_1; } function _get_onStartPendingSession__5e0hox($this) { return $this.onStartPendingSession_1; } function _get_onPendingSessionResolved__pnhor($this) { return $this.onPendingSessionResolved_1; } function _get_logger__rkp4sl_0($this) { return $this.logger_1; } function _get_dbName__9h2wvy_0($this) { return $this.dbName_1; } function _get_retryInterval__pgfiu4($this) { return $this.retryInterval_1; } function ClientState(initialized) { initialized = initialized === VOID ? false : initialized; this.initialized_1 = initialized; } protoOf(ClientState).get_initialized_yawktn_k$ = function () { return this.initialized_1; }; protoOf(ClientState).component1_7eebsc_k$ = function () { return this.initialized_1; }; protoOf(ClientState).copy_o18wmo_k$ = function (initialized) { return new ClientState(initialized); }; protoOf(ClientState).copy$default_inuduc_k$ = function (initialized, $super) { initialized = initialized === VOID ? this.initialized_1 : initialized; return $super === VOID ? this.copy_o18wmo_k$(initialized) : $super.copy_o18wmo_k$.call(this, initialized); }; protoOf(ClientState).toString = function () { return 'ClientState(initialized=' + this.initialized_1 + ')'; }; protoOf(ClientState).hashCode = function () { return getBooleanHashCode(this.initialized_1); }; protoOf(ClientState).equals = function (other) { if (this === other) return true; if (!(other instanceof ClientState)) return false; var tmp0_other_with_cast = other instanceof ClientState ? other : THROW_CCE(); if (!(this.initialized_1 === tmp0_other_with_cast.initialized_1)) return false; return true; }; function DoorRepositoryReplicationClient_init_$Init$(db, repositoryConfig, scope, nodeEventManager, retryInterval, $this) { DoorRepositoryReplicationClient.call($this, get_doorWrapperNodeId(db), repositoryConfig.get_auth_woj2sx_k$(), repositoryConfig.get_httpClient_cdum84_k$(), repositoryConfig.get_json_woos35_k$(), repositoryConfig.get_endpoint_30bvdu_k$(), scope, nodeEventManager, new DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db), new DefaultOnStartPendingSession(db), new DefaultOnPendingSessionResolved(db), repositoryConfig.get_logger_g9gejd_k$(), repositoryConfig.get_dbName_c9i0qa_k$(), retryInterval); return $this; } function DoorRepositoryReplicationClient_init_$Create$(db, repositoryConfig, scope, nodeEventManager, retryInterval) { return DoorRepositoryReplicationClient_init_$Init$(db, repositoryConfig, scope, nodeEventManager, retryInterval, objectCreate(protoOf(DoorRepositoryReplicationClient))); } function _get_logPrefix__aovpcr_1($this) { return $this.logPrefix_1; } function _get__state__37adl3_0($this) { return $this._state_1; } function _get_fakeRemoteNodeId__du958t($this) { return $this.fakeRemoteNodeId_1; } function OnMarkAcknowledgedAndGetNextOutgoingReplications() { } function DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db) { this.db_1 = db; } protoOf(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications).invoke_1uc1uk_k$ = function (nodeId, receivedAck, batchSize, $completion) { return withDoorTransactionAsync(this.db_1, VOID, DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda_0(receivedAck, this, nodeId, batchSize, null), $completion); }; function OnStartPendingSession() { } function DefaultOnStartPendingSession(db) { this.db_1 = db; } protoOf(DefaultOnStartPendingSession).invoke_j6nxkd_k$ = function (fakeRemoteNodeId, endpointUrl, $completion) { var tmp = new $invokeCOROUTINE$21(this, fakeRemoteNodeId, endpointUrl, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; function OnPendingSessionResolved() { } function DefaultOnPendingSessionResolved(db) { this.db_1 = db; } protoOf(DefaultOnPendingSessionResolved).invoke_j6nxkd_k$ = function (remoteNodeId, endpointUrl, $completion) { var tmp = new $invokeCOROUTINE$22(this, remoteNodeId, endpointUrl, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; function _get_fetchPendingReplicationsJob__pcnbh4($this) { return $this.fetchPendingReplicationsJob_1; } function _get_sendPendingReplicationsJob__k1i0fw($this) { return $this.sendPendingReplicationsJob_1; } function _get_collectEventsJob__bpge29($this) { return $this.collectEventsJob_1; } function _get_fetchNotifyChannel__hnx7x1($this) { return $this.fetchNotifyChannel_1; } function _get_sendNotifyChannel__l8h8sf($this) { return $this.sendNotifyChannel_1; } function _get_batchSize__q8zwru($this) { return $this.batchSize_1; } function _get_remoteNodeId__vu8wl4_0($this) { return $this.remoteNodeId_1; } function runSendLoop(_this__u8e3s4, $this, $completion) { var tmp = new $runSendLoopCOROUTINE$23($this, _this__u8e3s4, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function runFetchLoop(_this__u8e3s4, $this, $completion) { var tmp = new $runFetchLoopCOROUTINE$24($this, _this__u8e3s4, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function Companion_15() { Companion_instance_15 = this; this.REPLICATION_PATH_1 = 'replication'; } protoOf(Companion_15).get_REPLICATION_PATH_xbptnj_k$ = function () { return this.REPLICATION_PATH_1; }; var Companion_instance_15; function Companion_getInstance_18() { if (Companion_instance_15 == null) new Companion_15(); return Companion_instance_15; } 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 DoorRepositoryReplicationClient$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$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(DoorRepositoryReplicationClient$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$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$(10); this.set_state_rjd8d0_k$(1); continue $sm; case 1: if (!(get_isActive(this.$this$launch_1) ? !this.this$0__1.remoteNodeId_1.get_isCompleted_a6j6c8_k$() : false)) { this.set_state_rjd8d0_k$(11); continue $sm; } this.set_exceptionState_fex74n_k$(6); this.set_state_rjd8d0_k$(2); suspendResult = this.this$0__1.onStartPendingSession_1.invoke_j6nxkd_k$(this.this$0__1.fakeRemoteNodeId_1, this.this$0__1.repoEndpointUrl_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: v(this.this$0__1.logger_1, VOID, DoorRepositoryReplicationClient$slambda$lambda(this.this$0__1)); var tmp_0 = this; tmp_0.this0__1 = this.this$0__1.httpClient_1; var tmp_1 = this; tmp_1.this1__1 = this.this0__1; var tmp_2 = this; var this_0 = new HttpRequestBuilder(); doorNodeIdHeader_0(this_0, this.this$0__1.localNodeId_1, this.this$0__1.localNodeAuth_1); setRepoUrl(this_0, this.this$0__1.repoEndpointUrl_1, 'replication/nodeId'); tmp_2.builder2__1 = this_0; this.builder2__1.set_method_hoo95u_k$(Companion_getInstance_0().get_Get_18jsxf_k$()); var tmp_3 = this; tmp_3.this3__1 = this.this1__1; var tmp_4 = this; tmp_4.builder4__1 = this.builder2__1; this.set_state_rjd8d0_k$(3); suspendResult = (new HttpStatement(this.builder4__1, this.this3__1)).execute_rsj18j_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.remoteNodeIdResponse5__1 = suspendResult; var tmp_5 = this; var tmp0_safe_receiver = this.remoteNodeIdResponse5__1.get_headers_ef25jx_k$().get_6bo4tg_k$(DoorConstants_getInstance().get_HEADER_NODE_ID_n9vw0f_k$()); tmp_5.nodeIdHeaderVal6__1 = tmp0_safe_receiver == null ? null : toLong_0(tmp0_safe_receiver); v(this.this$0__1.logger_1, VOID, DoorRepositoryReplicationClient$slambda$lambda_0(this.this$0__1, this.remoteNodeIdResponse5__1, this.nodeIdHeaderVal6__1)); if (!(this.nodeIdHeaderVal6__1 == null)) { this.this$0__1.remoteNodeId_1.complete_ixf84q_k$(this.nodeIdHeaderVal6__1); this.set_state_rjd8d0_k$(4); suspendResult = this.this$0__1.onPendingSessionResolved_1.invoke_j6nxkd_k$(this.nodeIdHeaderVal6__1, this.this$0__1.repoEndpointUrl_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw IllegalStateException_init_$Create$(this.this$0__1.logPrefix_1 + ' getRemoteNodeId : server did not provide node id'); } case 4: l$ret$1: do { var this_1 = this.this$0__1._state_1; while (true) { var prevValue = this_1.get_value_j01efc_k$(); var nextValue = prevValue.copy_o18wmo_k$(true); if (this_1.compareAndSet_l3595a_k$(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.set_state_rjd8d0_k$(5); continue $sm; case 5: this.set_exceptionState_fex74n_k$(10); this.set_state_rjd8d0_k$(9); continue $sm; case 6: this.set_exceptionState_fex74n_k$(10); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { this.e7__1 = this.get_exception_x0n6w6_k$(); var tmp_7 = this.e7__1; if (!(tmp_7 instanceof CancellationException)) { w(this.this$0__1.logger_1, this.e7__1, DoorRepositoryReplicationClient$slambda$lambda_1(this.this$0__1)); this.set_state_rjd8d0_k$(7); suspendResult = delay(toLong(this.this$0__1.retryInterval_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(8); continue $sm; } } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_state_rjd8d0_k$(8); continue $sm; case 8: this.set_state_rjd8d0_k$(9); continue $sm; case 9: this.set_exceptionState_fex74n_k$(10); this.set_state_rjd8d0_k$(1); continue $sm; case 10: throw this.get_exception_x0n6w6_k$(); case 11: return Unit_getInstance(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 10) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda_0(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_1).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(DoorRepositoryReplicationClient$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$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$(2); this.set_state_rjd8d0_k$(1); suspendResult = runFetchLoop(this.$this$launch_1, this.this$0__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(DoorRepositoryReplicationClient$slambda_1).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_1(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda_2(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_3).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(DoorRepositoryReplicationClient$slambda_3).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda_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); this.set_state_rjd8d0_k$(1); suspendResult = runSendLoop(this.$this$launch_1, this.this$0__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(DoorRepositoryReplicationClient$slambda_3).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_3(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$slambda_3).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda_4(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_5).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(DoorRepositoryReplicationClient$slambda_5).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda_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$(2); this.set_state_rjd8d0_k$(1); suspendResult = this.this$0__1.remoteNodeId_1.await_4rdzbx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var remoteNodeIdVal = suspendResult; launch(this.$this$launch_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_0(this.this$0__1, remoteNodeIdVal, null)); launch(this.$this$launch_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_2(this.this$0__1, remoteNodeIdVal, null)); 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(DoorRepositoryReplicationClient$slambda_5).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_5(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorRepositoryReplicationClient$slambda_5).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorRepositoryReplicationClient$slambda_6(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$runSendLoop$lambda(this$0, $outgoingReplicationsToAck) { return function () { return this$0.logPrefix_1 + ' : runSendLoop : querying db to mark ' + $outgoingReplicationsToAck.get_size_woubt6_k$() + ' entities as ' + 'acknowledged by server and get next batch of replications to send'; }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_0(this$0, $outgoingReplications) { return function () { return this$0.logPrefix_1 + ' : runSendLoop : found ' + $outgoingReplications.get_size_woubt6_k$() + ' pending outgoing replications ' + 'to send'; }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_1(this$0, $outgoingReplications) { return function () { return this$0.logPrefix_1 + ' : runSendLoop : sending ' + $outgoingReplications.get_size_woubt6_k$() + ' to server '; }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_2(this$0, $replicationResponse, $replicationReceivedAck) { return function () { return this$0.logPrefix_1 + ' : runSendLoop : received reply from server status= ' + $replicationResponse.get_status_jnf6d7_k$() + ' ' + (' acknowledges ' + $replicationReceivedAck.get_replicationUids_xbjn4q_k$().get_size_woubt6_k$() + ' entities'); }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_3(this$0) { return function () { return this$0.logPrefix_1 + ' exception sending outgoing replications'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda(this$0, $acknowledgementsToSend) { return function () { return this$0.logPrefix_1 + ' : runFetchLoop: acknowledging ' + $acknowledgementsToSend.get_size_woubt6_k$() + ' entities received and ' + 'request next batch of pending replications'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this$0, $entitiesReceivedResponse) { return function () { return this$0.logPrefix_1 + ' : runFetchLoop: received response status = ' + $entitiesReceivedResponse.get_status_jnf6d7_k$(); }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this$0, $entitiesReceivedMessage) { return function () { return this$0.logPrefix_1 + ' : runFetchLoop: received ' + $entitiesReceivedMessage.get_replications_s2xb3k_k$().get_size_woubt6_k$() + ' replications incoming'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this$0, $entitiesReceivedMessage) { return function () { return this$0.logPrefix_1 + ' : runFetchLoop: delivered ' + $entitiesReceivedMessage.get_replications_s2xb3k_k$().get_size_woubt6_k$() + ' replications to node event manager'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_3($e) { return function () { return 'DoorRepositoryReplicationClient: : runFetchLoop: exception (probably offline): ' + $e; }; } function $runSendLoopCOROUTINE$23(_this__u8e3s4, _this__u8e3s4_0, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this._this__u8e3s4__2 = _this__u8e3s4_0; } protoOf($runSendLoopCOROUTINE$23).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$(14); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.remoteNodeId_1.await_4rdzbx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.remoteNodeIdVal0__1 = suspendResult; var tmp_0 = this; tmp_0.outgoingReplicationsToAck1__1 = ArrayList_init_$Create$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: if (!get_isActive(this._this__u8e3s4__2)) { this.set_state_rjd8d0_k$(13); continue $sm; } this.set_exceptionState_fex74n_k$(9); if (this.outgoingReplicationsToAck1__1.isEmpty_y1axqb_k$()) { this.set_state_rjd8d0_k$(3); suspendResult = this._this__u8e3s4__1.sendNotifyChannel_1.receive_awoumx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(4); continue $sm; } case 3: this.set_state_rjd8d0_k$(4); continue $sm; case 4: v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda(this._this__u8e3s4__1, this.outgoingReplicationsToAck1__1)); this.set_state_rjd8d0_k$(5); suspendResult = this._this__u8e3s4__1.onMarkAcknowledgedAndGetNextOutgoingReplications_1.invoke_1uc1uk_k$(this.remoteNodeIdVal0__1, new ReplicationReceivedAck(this.outgoingReplicationsToAck1__1), this._this__u8e3s4__1.batchSize_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: this.outgoingReplications2__1 = suspendResult; v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_0(this._this__u8e3s4__1, this.outgoingReplications2__1)); this.outgoingReplicationsToAck1__1.clear_j9egeb_k$(); if (!this.outgoingReplications2__1.isEmpty_y1axqb_k$()) { v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_1(this._this__u8e3s4__1, this.outgoingReplications2__1)); var tmp_1 = this; tmp_1.this3__1 = this._this__u8e3s4__1.httpClient_1; var tmp_2 = this; tmp_2.this4__1 = this.this3__1; var tmp_3 = this; var this_0 = new HttpRequestBuilder(); setRepoUrl(this_0, this._this__u8e3s4__1.repoEndpointUrl_1, 'replication/message'); doorNodeIdHeader_0(this_0, this._this__u8e3s4__1.localNodeId_1, this._this__u8e3s4__1.localNodeAuth_1); contentType(this_0, Application_getInstance().get_Json_wo4ci9_k$()); setBodyJson(this_0, this._this__u8e3s4__1.json_1, Companion_getInstance_15().serializer_9w0wvi_k$(), new DoorMessage(Companion_getInstance_15().get_WHAT_REPLICATION_PUSH_tr3xkv_k$(), this._this__u8e3s4__1.localNodeId_1, this.remoteNodeIdVal0__1, this.outgoingReplications2__1)); tmp_3.builder5__1 = this_0; this.builder5__1.set_method_hoo95u_k$(Companion_getInstance_0().get_Post_wo83k9_k$()); var tmp_4 = this; tmp_4.this6__1 = this.this4__1; var tmp_5 = this; tmp_5.builder7__1 = this.builder5__1; this.set_state_rjd8d0_k$(6); suspendResult = (new HttpStatement(this.builder7__1, this.this6__1)).execute_rsj18j_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(8); continue $sm; } case 6: this.replicationResponse8__1 = suspendResult; this.ARGUMENT9__1 = this._this__u8e3s4__1.json_1; this.ARGUMENT10__1 = Companion_getInstance_19().serializer_9w0wvi_k$(); this.set_state_rjd8d0_k$(7); suspendResult = bodyAsText(this.replicationResponse8__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 7: this.ARGUMENT11__1 = suspendResult; this.replicationReceivedAck12__1 = this.ARGUMENT9__1.decodeFromString_jwu9sq_k$(this.ARGUMENT10__1, this.ARGUMENT11__1); v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_2(this._this__u8e3s4__1, this.replicationResponse8__1, this.replicationReceivedAck12__1)); this.outgoingReplicationsToAck1__1.addAll_4lagoh_k$(this.replicationReceivedAck12__1.get_replicationUids_xbjn4q_k$()); this.set_state_rjd8d0_k$(8); continue $sm; case 8: this.set_exceptionState_fex74n_k$(14); this.set_state_rjd8d0_k$(12); continue $sm; case 9: this.set_exceptionState_fex74n_k$(14); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { this.e13__1 = this.get_exception_x0n6w6_k$(); var tmp_7 = this.e13__1; if (!(tmp_7 instanceof CancellationException)) { d_0(this._this__u8e3s4__1.logger_1, this.e13__1, DoorRepositoryReplicationClient$runSendLoop$lambda_3(this._this__u8e3s4__1)); this.set_state_rjd8d0_k$(10); suspendResult = delay(toLong(this._this__u8e3s4__1.retryInterval_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(11); continue $sm; } } else { throw this.get_exception_x0n6w6_k$(); } case 10: this.set_state_rjd8d0_k$(11); continue $sm; case 11: this.set_state_rjd8d0_k$(12); continue $sm; case 12: this.set_exceptionState_fex74n_k$(14); this.set_state_rjd8d0_k$(2); continue $sm; case 13: return Unit_getInstance(); case 14: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 14) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $runFetchLoopCOROUTINE$24(_this__u8e3s4, _this__u8e3s4_0, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this._this__u8e3s4__2 = _this__u8e3s4_0; } protoOf($runFetchLoopCOROUTINE$24).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$(13); var tmp_0 = this; tmp_0.acknowledgementsToSend0__1 = ArrayList_init_$Create$(); this.set_state_rjd8d0_k$(1); continue $sm; case 1: if (!get_isActive(this._this__u8e3s4__2)) { this.set_state_rjd8d0_k$(12); continue $sm; } this.set_exceptionState_fex74n_k$(8); if (this.acknowledgementsToSend0__1.isEmpty_y1axqb_k$()) { this.set_state_rjd8d0_k$(2); suspendResult = this._this__u8e3s4__1.fetchNotifyChannel_1.receive_awoumx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(3); continue $sm; } case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda(this._this__u8e3s4__1, this.acknowledgementsToSend0__1)); var tmp_1 = this; tmp_1.this1__1 = this._this__u8e3s4__1.httpClient_1; var tmp_2 = this; tmp_2.this2__1 = this.this1__1; var tmp_3 = this; var this_0 = new HttpRequestBuilder(); doorNodeIdHeader_0(this_0, this._this__u8e3s4__1.localNodeId_1, this._this__u8e3s4__1.localNodeAuth_1); setRepoUrl(this_0, this._this__u8e3s4__1.repoEndpointUrl_1, 'replication/ackAndGetPendingReplications'); contentType(this_0, Application_getInstance().get_Json_wo4ci9_k$()); setBodyJson(this_0, this._this__u8e3s4__1.json_1, Companion_getInstance_19().serializer_9w0wvi_k$(), new ReplicationReceivedAck(this.acknowledgementsToSend0__1)); tmp_3.builder3__1 = this_0; this.builder3__1.set_method_hoo95u_k$(Companion_getInstance_0().get_Post_wo83k9_k$()); var tmp_4 = this; tmp_4.this4__1 = this.this2__1; var tmp_5 = this; tmp_5.builder5__1 = this.builder3__1; this.set_state_rjd8d0_k$(4); suspendResult = (new HttpStatement(this.builder5__1, this.this4__1)).execute_rsj18j_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.entitiesReceivedResponse6__1 = suspendResult; v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this._this__u8e3s4__1, this.entitiesReceivedResponse6__1)); this.acknowledgementsToSend0__1.clear_j9egeb_k$(); if (this.entitiesReceivedResponse6__1.get_status_jnf6d7_k$().equals(Companion_getInstance().get_OK_kntokb_k$())) { this.ARGUMENT7__1 = this._this__u8e3s4__1.json_1; this.ARGUMENT8__1 = Companion_getInstance_15().serializer_9w0wvi_k$(); this.set_state_rjd8d0_k$(5); suspendResult = bodyAsText(this.entitiesReceivedResponse6__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(7); continue $sm; } case 5: this.ARGUMENT9__1 = suspendResult; this.entitiesReceivedMessage10__1 = this.ARGUMENT7__1.decodeFromString_jwu9sq_k$(this.ARGUMENT8__1, this.ARGUMENT9__1); v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this._this__u8e3s4__1, this.entitiesReceivedMessage10__1)); this.set_state_rjd8d0_k$(6); suspendResult = this._this__u8e3s4__1.nodeEventManager_1.onIncomingMessageReceived_3v60w2_k$(this.entitiesReceivedMessage10__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 6: var this_1 = this.entitiesReceivedMessage10__1.get_replications_s2xb3k_k$(); var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10)); var tmp0_iterator = this_1.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var item = tmp0_iterator.next_20eer_k$(); destination.add_utx5q5_k$(item.get_orUid_iwh7pg_k$()); } this.acknowledgementsToSend0__1.addAll_4lagoh_k$(destination); v(this._this__u8e3s4__1.logger_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this._this__u8e3s4__1, this.entitiesReceivedMessage10__1)); this.set_state_rjd8d0_k$(7); continue $sm; case 7: if (this.entitiesReceivedResponse6__1.get_status_jnf6d7_k$().equals(Companion_getInstance().get_NoContent_3ur3v5_k$())) { this._this__u8e3s4__1.lastReceiveCompleteTime_1 = this.entitiesReceivedResponse6__1.get_responseTime_scfvg7_k$().get_timestamp_9fccx9_k$(); } this.set_exceptionState_fex74n_k$(13); this.set_state_rjd8d0_k$(11); continue $sm; case 8: this.set_exceptionState_fex74n_k$(13); var tmp_6 = this.get_exception_x0n6w6_k$(); if (tmp_6 instanceof Exception) { this.e11__1 = this.get_exception_x0n6w6_k$(); var tmp_7 = this.e11__1; if (!(tmp_7 instanceof CancellationException)) { v(this._this__u8e3s4__1.logger_1, this.e11__1, DoorRepositoryReplicationClient$runFetchLoop$lambda_3(this.e11__1)); this.set_state_rjd8d0_k$(9); suspendResult = delay(toLong(this._this__u8e3s4__1.retryInterval_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(10); continue $sm; } } else { throw this.get_exception_x0n6w6_k$(); } case 9: this.set_state_rjd8d0_k$(10); continue $sm; case 10: this.set_state_rjd8d0_k$(11); continue $sm; case 11: this.set_exceptionState_fex74n_k$(13); this.set_state_rjd8d0_k$(1); continue $sm; case 12: return Unit_getInstance(); case 13: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 13) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function DoorRepositoryReplicationClient(localNodeId, localNodeAuth, httpClient, json, repoEndpointUrl, scope, nodeEventManager, onMarkAcknowledgedAndGetNextOutgoingReplications, onStartPendingSession, onPendingSessionResolved, logger, dbName, retryInterval) { Companion_getInstance_18(); retryInterval = retryInterval === VOID ? 10000 : retryInterval; this.localNodeId_1 = localNodeId; this.localNodeAuth_1 = localNodeAuth; this.httpClient_1 = httpClient; this.json_1 = json; this.repoEndpointUrl_1 = repoEndpointUrl; this.nodeEventManager_1 = nodeEventManager; this.onMarkAcknowledgedAndGetNextOutgoingReplications_1 = onMarkAcknowledgedAndGetNextOutgoingReplications; this.onStartPendingSession_1 = onStartPendingSession; this.onPendingSessionResolved_1 = onPendingSessionResolved; this.logger_1 = logger; this.dbName_1 = dbName; this.retryInterval_1 = retryInterval; this.logPrefix_1 = '[DoorRepositoryReplicationClient - ' + this.dbName_1 + ' - endpoint=' + this.repoEndpointUrl_1 + ']'; this._state_1 = MutableStateFlow(new ClientState()); this.state_1 = asStateFlow(this._state_1); this.fakeRemoteNodeId_1 = Default_getInstance().nextLong_m0lbld_k$(new Long(-10000, -1), new Long(-1, -1)); d(this.logger_1, this.logPrefix_1 + ' init'); this.lastReceiveCompleteTime_1 = new Long(0, 0); this.fetchNotifyChannel_1 = Channel(1); this.sendNotifyChannel_1 = Channel(1); this.batchSize_1 = 1000; this.remoteNodeId_1 = CompletableDeferred(); launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_0(this, null)); var tmp = this; tmp.fetchPendingReplicationsJob_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_2(this, null)); var tmp_0 = this; tmp_0.sendPendingReplicationsJob_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_4(this, null)); var tmp_1 = this; tmp_1.collectEventsJob_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_6(this, null)); this.fetchNotifyChannel_1.trySend_62dpg8_k$(Unit_getInstance()); this.sendNotifyChannel_1.trySend_62dpg8_k$(Unit_getInstance()); } protoOf(DoorRepositoryReplicationClient).get_state_iypx7s_k$ = function () { return this.state_1; }; protoOf(DoorRepositoryReplicationClient).set_lastReceiveCompleteTime_kbjhfs_k$ = function (_set____db54di) { this.lastReceiveCompleteTime_1 = _set____db54di; }; protoOf(DoorRepositoryReplicationClient).get_lastReceiveCompleteTime_jo4vue_k$ = function () { return this.lastReceiveCompleteTime_1; }; protoOf(DoorRepositoryReplicationClient).remoteNodeIdOrNull_xiaqh9_k$ = function () { return this.remoteNodeId_1.get_isCompleted_a6j6c8_k$() ? this.remoteNodeId_1.getCompleted_nczk2z_k$() : null; }; protoOf(DoorRepositoryReplicationClient).remoteNodeIdOrFake_xi57q3_k$ = function () { var tmp; if (this.remoteNodeId_1.get_isCompleted_a6j6c8_k$()) { tmp = this.remoteNodeId_1.getCompleted_nczk2z_k$(); } else { tmp = this.fakeRemoteNodeId_1; } return tmp; }; protoOf(DoorRepositoryReplicationClient).close_yn9xrc_k$ = function () { this.sendNotifyChannel_1.cancel$default_880p35_k$(); this.fetchPendingReplicationsJob_1.cancel$default_8haxne_k$(); this.collectEventsJob_1.cancel$default_8haxne_k$(); this.fetchNotifyChannel_1.close$default_kcbl7u_k$(); this.sendNotifyChannel_1.close$default_kcbl7u_k$(); this.remoteNodeId_1.cancel$default_8haxne_k$(); }; function JsonDbFieldInfo() { } function ReplicationConstants() { ReplicationConstants_instance = this; this.RECEIVE_VIEW_FROM_NODE_ID_FIELDNAME_1 = 'fromNodeId'; } protoOf(ReplicationConstants).get_RECEIVE_VIEW_FROM_NODE_ID_FIELDNAME_wp94aq_k$ = function () { return this.RECEIVE_VIEW_FROM_NODE_ID_FIELDNAME_1; }; var ReplicationConstants_instance; function ReplicationConstants_getInstance() { if (ReplicationConstants_instance == null) new ReplicationConstants(); return ReplicationConstants_instance; } function ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w(it) { return it + ' = ?'; } function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda(it) { return it.get_fieldName_tfocn0_k$(); } function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this$0) { return function () { var tmp = joinToString(this$0.entityFields_1, VOID, VOID, VOID, VOID, VOID, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda); var tmp_0 = ReplicationConstants_getInstance().get_RECEIVE_VIEW_FROM_NODE_ID_FIELDNAME_wp94aq_k$(); // Inline function 'kotlin.collections.map' call var this_0 = numberRangeToNumber(0, this$0.entityFields_1.get_size_woubt6_k$()); // Inline function 'kotlin.collections.mapTo' call 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$(); // Inline function 'com.ustadmobile.door.replication.ReplicationEntityMetaData.insertIntoReceiveViewSql$delegate..' call destination.add_utx5q5_k$('?'); } return '\n INSERT INTO ' + this$0.receiveViewName_1 + ' (' + tmp + ', ' + tmp_0 + ')\n VALUES (' + joinToString(destination) + ')\n '; }; } function ReplicationEntityMetaData(tableId, entityTableName, receiveViewName, entityPrimaryKeyFieldNames, entityVersionIdFieldName, entityFields, batchSize, remoteInsertStrategy, triggers) { batchSize = batchSize === VOID ? 1000 : batchSize; this.tableId_1 = tableId; this.entityTableName_1 = entityTableName; this.receiveViewName_1 = receiveViewName; this.entityPrimaryKeyFieldNames_1 = entityPrimaryKeyFieldNames; this.entityVersionIdFieldName_1 = entityVersionIdFieldName; this.entityFields_1 = entityFields; this.batchSize_1 = batchSize; this.remoteInsertStrategy_1 = remoteInsertStrategy; this.triggers_1 = triggers; var tmp = this; var tmp_0 = LazyThreadSafetyMode_NONE_getInstance(); tmp.insertIntoReceiveViewSql$delegate_1 = lazy(tmp_0, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this)); } protoOf(ReplicationEntityMetaData).get_tableId_of07s0_k$ = function () { return this.tableId_1; }; protoOf(ReplicationEntityMetaData).get_entityTableName_g8x9t9_k$ = function () { return this.entityTableName_1; }; protoOf(ReplicationEntityMetaData).get_receiveViewName_toacx6_k$ = function () { return this.receiveViewName_1; }; protoOf(ReplicationEntityMetaData).get_entityPrimaryKeyFieldNames_5y8huf_k$ = function () { return this.entityPrimaryKeyFieldNames_1; }; protoOf(ReplicationEntityMetaData).get_entityVersionIdFieldName_naw5k2_k$ = function () { return this.entityVersionIdFieldName_1; }; protoOf(ReplicationEntityMetaData).get_entityFields_ad1dc5_k$ = function () { return this.entityFields_1; }; protoOf(ReplicationEntityMetaData).get_batchSize_7o99am_k$ = function () { return this.batchSize_1; }; protoOf(ReplicationEntityMetaData).get_remoteInsertStrategy_t4k5ff_k$ = function () { return this.remoteInsertStrategy_1; }; protoOf(ReplicationEntityMetaData).get_triggers_6y18jg_k$ = function () { return this.triggers_1; }; protoOf(ReplicationEntityMetaData).get_selectEntityByPrimaryKeysSql_y6bvk9_k$ = function () { return trimIndent('\n SELECT ' + this.entityTableName_1 + '.* \n FROM ' + this.entityTableName_1 + '\n WHERE ' + joinToString(this.entityPrimaryKeyFieldNames_1, ' AND ', VOID, VOID, VOID, VOID, ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w) + '\n '); }; protoOf(ReplicationEntityMetaData).get_insertIntoReceiveViewSql_vqtvfs_k$ = function () { // Inline function 'kotlin.getValue' call var this_0 = this.insertIntoReceiveViewSql$delegate_1; insertIntoReceiveViewSql$factory(); return this_0.get_value_j01efc_k$(); }; protoOf(ReplicationEntityMetaData).get_createReceiveViewSql_tpcdt7_k$ = function () { return '\n CREATE VIEW ' + this.receiveViewName_1 + ' AS \n SELECT ' + this.entityTableName_1 + '.*, \n CAST(0 AS BIGINT) AS fromNodeId\n FROM ' + this.entityTableName_1 + '\n '; }; function insertIntoReceiveViewSql$factory() { return getPropertyCallableRef('insertIntoReceiveViewSql', 1, KProperty1, function (receiver) { return receiver.get_insertIntoReceiveViewSql_vqtvfs_k$(); }, null); } function ReplicationFieldMetaData(fieldName, dbFieldType, nullable) { this.fieldName_1 = fieldName; this.dbFieldType_1 = dbFieldType; this.nullable_1 = nullable; } protoOf(ReplicationFieldMetaData).get_fieldName_tfocn0_k$ = function () { return this.fieldName_1; }; protoOf(ReplicationFieldMetaData).get_dbFieldType_pz3j77_k$ = function () { return this.dbFieldType_1; }; protoOf(ReplicationFieldMetaData).get_nullable_7petka_k$ = function () { return this.nullable_1; }; protoOf(ReplicationFieldMetaData).component1_7eebsc_k$ = function () { return this.fieldName_1; }; protoOf(ReplicationFieldMetaData).component2_7eebsb_k$ = function () { return this.dbFieldType_1; }; protoOf(ReplicationFieldMetaData).component3_7eebsa_k$ = function () { return this.nullable_1; }; protoOf(ReplicationFieldMetaData).copy_1mfbjm_k$ = function (fieldName, dbFieldType, nullable) { return new ReplicationFieldMetaData(fieldName, dbFieldType, nullable); }; protoOf(ReplicationFieldMetaData).copy$default_jkd5r7_k$ = function (fieldName, dbFieldType, nullable, $super) { fieldName = fieldName === VOID ? this.fieldName_1 : fieldName; dbFieldType = dbFieldType === VOID ? this.dbFieldType_1 : dbFieldType; nullable = nullable === VOID ? this.nullable_1 : nullable; return $super === VOID ? this.copy_1mfbjm_k$(fieldName, dbFieldType, nullable) : $super.copy_1mfbjm_k$.call(this, fieldName, dbFieldType, nullable); }; protoOf(ReplicationFieldMetaData).toString = function () { return 'ReplicationFieldMetaData(fieldName=' + this.fieldName_1 + ', dbFieldType=' + this.dbFieldType_1 + ', nullable=' + this.nullable_1 + ')'; }; protoOf(ReplicationFieldMetaData).hashCode = function () { var result = getStringHashCode(this.fieldName_1); result = imul(result, 31) + this.dbFieldType_1 | 0; result = imul(result, 31) + getBooleanHashCode(this.nullable_1) | 0; return result; }; protoOf(ReplicationFieldMetaData).equals = function (other) { if (this === other) return true; if (!(other instanceof ReplicationFieldMetaData)) return false; var tmp0_other_with_cast = other instanceof ReplicationFieldMetaData ? other : THROW_CCE(); if (!(this.fieldName_1 === tmp0_other_with_cast.fieldName_1)) return false; if (!(this.dbFieldType_1 === tmp0_other_with_cast.dbFieldType_1)) return false; if (!(this.nullable_1 === tmp0_other_with_cast.nullable_1)) return false; return true; }; function _get_$childSerializers__r2zwns_0($this) { return $this.$childSerializers_1; } function Companion_16() { Companion_instance_16 = this; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.$childSerializers_1 = [new ArrayListSerializer(LongSerializer_getInstance())]; } protoOf(Companion_16).serializer_9w0wvi_k$ = function () { return $serializer_getInstance_2(); }; var Companion_instance_16; function Companion_getInstance_19() { if (Companion_instance_16 == null) new Companion_16(); return Companion_instance_16; } function $serializer_2() { $serializer_instance_2 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.ReplicationReceivedAck', this, 1); tmp0_serialDesc.addElement_5pzumi_k$('replicationUids', false); this.descriptor_1 = tmp0_serialDesc; } protoOf($serializer_2).get_descriptor_wjt6a0_k$ = function () { return this.descriptor_1; }; protoOf($serializer_2).childSerializers_5ghqw5_k$ = function () { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [Companion_getInstance_19().$childSerializers_1[0]]; }; protoOf($serializer_2).deserialize_sy6x50_k$ = function (decoder) { var tmp0_desc = this.descriptor_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = null; var tmp5_input = decoder.beginStructure_yljocp_k$(tmp0_desc); var tmp6_cached = Companion_getInstance_19().$childSerializers_1; if (tmp5_input.decodeSequentially_xlblqy_k$()) { tmp4_local0 = tmp5_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, tmp6_cached[0], tmp4_local0); tmp3_bitMask0 = tmp3_bitMask0 | 1; } else while (tmp1_flag) { tmp2_index = tmp5_input.decodeElementIndex_bstkhp_k$(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp5_input.decodeSerializableElement_uahnnv_k$(tmp0_desc, 0, tmp6_cached[0], tmp4_local0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp5_input.endStructure_1xqz0n_k$(tmp0_desc); return ReplicationReceivedAck_init_$Create$(tmp3_bitMask0, tmp4_local0, null); }; protoOf($serializer_2).serialize_5ks207_k$ = function (encoder, value) { var tmp0_desc = this.descriptor_1; var tmp1_output = encoder.beginStructure_yljocp_k$(tmp0_desc); var tmp2_cached = Companion_getInstance_19().$childSerializers_1; tmp1_output.encodeSerializableElement_isqxcl_k$(tmp0_desc, 0, tmp2_cached[0], value.replicationUids_1); tmp1_output.endStructure_1xqz0n_k$(tmp0_desc); }; protoOf($serializer_2).serialize_5ase3y_k$ = function (encoder, value) { return this.serialize_5ks207_k$(encoder, value instanceof ReplicationReceivedAck ? value : THROW_CCE()); }; var $serializer_instance_2; function $serializer_getInstance_2() { if ($serializer_instance_2 == null) new $serializer_2(); return $serializer_instance_2; } function ReplicationReceivedAck_init_$Init$(seen1, replicationUids, serializationConstructorMarker, $this) { if (!(1 === (1 & seen1))) { throwMissingFieldException(seen1, 1, $serializer_getInstance_2().descriptor_1); } $this.replicationUids_1 = replicationUids; return $this; } function ReplicationReceivedAck_init_$Create$(seen1, replicationUids, serializationConstructorMarker) { return ReplicationReceivedAck_init_$Init$(seen1, replicationUids, serializationConstructorMarker, objectCreate(protoOf(ReplicationReceivedAck))); } function ReplicationReceivedAck(replicationUids) { Companion_getInstance_19(); this.replicationUids_1 = replicationUids; } protoOf(ReplicationReceivedAck).get_replicationUids_xbjn4q_k$ = function () { return this.replicationUids_1; }; protoOf(ReplicationReceivedAck).component1_7eebsc_k$ = function () { return this.replicationUids_1; }; protoOf(ReplicationReceivedAck).copy_vqu7_k$ = function (replicationUids) { return new ReplicationReceivedAck(replicationUids); }; protoOf(ReplicationReceivedAck).copy$default_io3oh2_k$ = function (replicationUids, $super) { replicationUids = replicationUids === VOID ? this.replicationUids_1 : replicationUids; return $super === VOID ? this.copy_vqu7_k$(replicationUids) : $super.copy_vqu7_k$.call(this, replicationUids); }; protoOf(ReplicationReceivedAck).toString = function () { return 'ReplicationReceivedAck(replicationUids=' + this.replicationUids_1 + ')'; }; protoOf(ReplicationReceivedAck).hashCode = function () { return hashCode(this.replicationUids_1); }; protoOf(ReplicationReceivedAck).equals = function (other) { if (this === other) return true; if (!(other instanceof ReplicationReceivedAck)) return false; var tmp0_other_with_cast = other instanceof ReplicationReceivedAck ? other : THROW_CCE(); if (!equals(this.replicationUids_1, tmp0_other_with_cast.replicationUids_1)) return false; return true; }; function ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda($$this$unsafeFlow, $nodeId, resultContinuation) { this.$$this$unsafeFlow_1 = $$this$unsafeFlow; this.$nodeId_1 = $nodeId; CoroutineImpl.call(this, resultContinuation); } protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda).invoke_l1b4fx_k$ = function (value, $completion) { var tmp = this.create_2c4j9d_k$(value, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_l1b4fx_k$((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$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.$this$unsafeTransform0__1 = this.$$this$unsafeFlow_1; var tmp_1 = this; tmp_1.value1__1 = this.value_1; this.set_state_rjd8d0_k$(1); var this_0 = this.value1__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$(); if (element.get_toNode_k1dkx2_k$().equals(this.$nodeId_1)) { destination.add_utx5q5_k$(element); } } suspendResult = this.$this$unsafeTransform0__1.emit_t92u1f_k$(destination, 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(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda).create_2c4j9d_k$ = function (value, completion) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda(this.$$this$unsafeFlow_1, this.$nodeId_1, completion); i.value_1 = value; return i; }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_2c4j9d_k$((!(value == null) ? isInterface(value, List) : false) ? value : THROW_CCE(), completion); }; function ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_0($$this$unsafeFlow, $nodeId, resultContinuation) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda($$this$unsafeFlow, $nodeId, resultContinuation); var l = function (value, $completion) { return i.invoke_l1b4fx_k$(value, $completion); }; l.$arity = 1; return l; } function $collectCOROUTINE$25(_this__u8e3s4, collector, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.collector_1 = collector; } protoOf($collectCOROUTINE$25).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.$this$unsafeFlow0__1 = this.collector_1; this.set_state_rjd8d0_k$(1); var tmp_1 = ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_0(this.$this$unsafeFlow0__1, this._this__u8e3s4__1.$nodeId_1, null); suspendResult = this._this__u8e3s4__1.$this_1.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0_0(tmp_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); }; function ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1($$this$unsafeFlow, resultContinuation) { this.$$this$unsafeFlow_1 = $$this$unsafeFlow; CoroutineImpl.call(this, resultContinuation); } protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1).invoke_l1b4fx_k$ = function (value, $completion) { var tmp = this.create_2c4j9d_k$(value, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_l1b4fx_k$((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$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$(5); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.$this$unsafeTransform1__1 = this.$$this$unsafeFlow_1; var tmp_1 = this; tmp_1.value2__1 = this.value_1; if (!this.value2__1.isEmpty_y1axqb_k$()) { this.set_state_rjd8d0_k$(3); suspendResult = this.$this$unsafeTransform1__1.emit_t92u1f_k$(this.value2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(2); continue $sm; } case 2: if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(4); continue $sm; case 3: this.tmp$ret$00__1 = suspendResult; this.set_state_rjd8d0_k$(4); continue $sm; case 4: 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(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1).create_2c4j9d_k$ = function (value, completion) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1(this.$$this$unsafeFlow_1, completion); i.value_1 = value; return i; }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_2c4j9d_k$((!(value == null) ? isInterface(value, List) : false) ? value : THROW_CCE(), completion); }; function ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_2($$this$unsafeFlow, resultContinuation) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_1($$this$unsafeFlow, resultContinuation); var l = function (value, $completion) { return i.invoke_l1b4fx_k$(value, $completion); }; l.$arity = 1; return l; } function $collectCOROUTINE$26(_this__u8e3s4, collector, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.collector_1 = collector; } protoOf($collectCOROUTINE$26).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.$this$unsafeFlow0__1 = this.collector_1; this.set_state_rjd8d0_k$(1); var tmp_1 = ServerSentEventsReplicationClient$onMessage$slambda$o$collect$slambda_2(this.$this$unsafeFlow0__1, null); suspendResult = this._this__u8e3s4__1.$this_1.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0_0(tmp_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); }; function _no_name_provided__qut3iv($this, $nodeId) { this.$this_1 = $this; this.$nodeId_1 = $nodeId; } protoOf(_no_name_provided__qut3iv).collect_cl4skj_k$ = function (collector, $completion) { var tmp = new $collectCOROUTINE$25(this, collector, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(_no_name_provided__qut3iv).collect_aksokr_k$ = function (collector, $completion) { return this.collect_cl4skj_k$(collector, $completion); }; function _no_name_provided__qut3iv_0($this) { this.$this_1 = $this; } protoOf(_no_name_provided__qut3iv_0).collect_cl4skj_k$ = function (collector, $completion) { var tmp = new $collectCOROUTINE$26(this, collector, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(_no_name_provided__qut3iv_0).collect_aksokr_k$ = function (collector, $completion) { return this.collect_cl4skj_k$(collector, $completion); }; function ServerSentEventsReplicationClient$onMessage$slambda$slambda(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(ServerSentEventsReplicationClient$onMessage$slambda$slambda).invoke_l1b4fx_k$ = function (it, $completion) { var tmp = this.create_2c4j9d_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_l1b4fx_k$((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ServerSentEventsReplicationClient$onMessage$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); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$slambda).create_2c4j9d_k$ = function (it, completion) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$slambda(completion); i.it_1 = it; return i; }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_2c4j9d_k$((!(value == null) ? isInterface(value, List) : false) ? value : THROW_CCE(), completion); }; function ServerSentEventsReplicationClient$onMessage$slambda$slambda_0(resultContinuation) { var i = new ServerSentEventsReplicationClient$onMessage$slambda$slambda(resultContinuation); var l = function (it, $completion) { return i.invoke_l1b4fx_k$(it, $completion); }; l.$arity = 1; return l; } function _get_doorWrappedDb__jfixd0($this) { return $this.doorWrappedDb_1; } function _get_replicationScope__mdd3vn($this) { return $this.replicationScope_1; } function _get_remoteNodeId__vu8wl4_1($this) { return $this.remoteNodeId_1; } function _get_eventSource__8xtza4_0($this) { return $this.eventSource_1; } function Companion_17() { Companion_instance_17 = this; this.EVT_INIT_1 = 'init'; this.EVT_PENDING_REPLICATION_1 = 'pending-replication'; } protoOf(Companion_17).get_EVT_INIT_6wk5yj_k$ = function () { return this.EVT_INIT_1; }; protoOf(Companion_17).get_EVT_PENDING_REPLICATION_4rhb41_k$ = function () { return this.EVT_PENDING_REPLICATION_1; }; var Companion_instance_17; function Companion_getInstance_20() { if (Companion_instance_17 == null) new Companion_17(); return Companion_instance_17; } function sam$kotlinx_coroutines_flow_FlowCollector$0_0(function_0) { this.function_1 = function_0; } protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0_0).emit_t92u1f_k$ = function (value, $completion) { return this.function_1(value, $completion); }; function ServerSentEventsReplicationClient$onMessage$slambda(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(ServerSentEventsReplicationClient$onMessage$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(ServerSentEventsReplicationClient$onMessage$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ServerSentEventsReplicationClient$onMessage$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); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new ServerSentEventsReplicationClient$onMessage$slambda(completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function ServerSentEventsReplicationClient$onMessage$slambda_0(resultContinuation) { var i = new ServerSentEventsReplicationClient$onMessage$slambda(resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function ServerSentEventsReplicationClient$onMessage$slambda_1(this$0, $nodeId, resultContinuation) { this.this$0__1 = this$0; this.$nodeId_1 = $nodeId; CoroutineImpl.call(this, resultContinuation); } protoOf(ServerSentEventsReplicationClient$onMessage$slambda_1).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(ServerSentEventsReplicationClient$onMessage$slambda_1).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(ServerSentEventsReplicationClient$onMessage$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$(2); this.set_state_rjd8d0_k$(1); var tmp_0 = this.this$0__1.doorWrappedDb_1; var this_0 = (isInterface(tmp_0, DoorDatabaseWrapper) ? tmp_0 : THROW_CCE()).get_nodeEventManager_3ccda_k$().get_outgoingEvents_40o3ma_k$(); var this_1 = new _no_name_provided__qut3iv(this_0, this.$nodeId_1); var tmp_1 = new _no_name_provided__qut3iv_0(this_1); var tmp_2 = ServerSentEventsReplicationClient$onMessage$slambda$slambda_0(null); suspendResult = tmp_1.collect_aksokr_k$(new sam$kotlinx_coroutines_flow_FlowCollector$0_0(tmp_2), 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(ServerSentEventsReplicationClient$onMessage$slambda_1).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new ServerSentEventsReplicationClient$onMessage$slambda_1(this.this$0__1, this.$nodeId_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(ServerSentEventsReplicationClient$onMessage$slambda_1).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function ServerSentEventsReplicationClient$onMessage$slambda_2(this$0, $nodeId, resultContinuation) { var i = new ServerSentEventsReplicationClient$onMessage$slambda_1(this$0, $nodeId, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function ServerSentEventsReplicationClient(repositoryConfig, doorWrappedDb, scope) { Companion_getInstance_20(); scope = scope === VOID ? null : scope; this.doorWrappedDb_1 = doorWrappedDb; var tmp = this; tmp.replicationScope_1 = scope == null ? CoroutineScope_0(Dispatchers_getInstance().get_Default_goqax4_k$().plus_s13ygv_k$(Job())) : scope; this.remoteNodeId_1 = atomic$long$1(new Long(0, 0)); this.eventSource_1 = atomic$ref$1(null); var evtSource = new DoorEventSource(repositoryConfig, repositoryConfig.get_endpoint_30bvdu_k$() + 'replication/sse', this); this.eventSource_1.set_kotlinx$atomicfu$value_508e3y_k$(evtSource); } protoOf(ServerSentEventsReplicationClient).onOpen_hhqt5_k$ = function () { }; protoOf(ServerSentEventsReplicationClient).onMessage_f8yelo_k$ = function (message) { if (message.get_event_ir25pt_k$() === 'init') { var nodeId = toLong_0(message.get_data_wokkxf_k$()); this.remoteNodeId_1.set_kotlinx$atomicfu$value_22wj1v_k$(nodeId); launch(this.replicationScope_1, VOID, VOID, ServerSentEventsReplicationClient$onMessage$slambda_0(null)); launch(this.replicationScope_1, VOID, VOID, ServerSentEventsReplicationClient$onMessage$slambda_2(this, nodeId, null)); } }; protoOf(ServerSentEventsReplicationClient).onError_rgw5qo_k$ = function (e) { }; protoOf(ServerSentEventsReplicationClient).close_yn9xrc_k$ = function () { }; function DoorEventListener() { } function Companion_18() { Companion_instance_18 = this; } protoOf(Companion_18).parse_pc1q8p_k$ = function (str) { var parts = split(str, charArrayOf([_Char___init__impl__6a9atx(59)]), VOID, 3); if (!(parts.get_size_woubt6_k$() === 3)) throw IllegalArgumentException_init_$Create$('DoorServerSentEvent parse: must have three parts - id;event;data'); return new DoorServerSentEvent(parts.get_c1px32_k$(0), parts.get_c1px32_k$(1), parts.get_c1px32_k$(2)); }; var Companion_instance_18; function Companion_getInstance_21() { if (Companion_instance_18 == null) new Companion_18(); return Companion_instance_18; } function DoorServerSentEvent(id, event, data) { Companion_getInstance_21(); this.id_1 = id; this.event_1 = event; this.data_1 = data; } protoOf(DoorServerSentEvent).get_id_kntnx8_k$ = function () { return this.id_1; }; protoOf(DoorServerSentEvent).get_event_ir25pt_k$ = function () { return this.event_1; }; protoOf(DoorServerSentEvent).get_data_wokkxf_k$ = function () { return this.data_1; }; protoOf(DoorServerSentEvent).toString = function () { return "DoorServerSentEvent id='" + this.id_1 + "' event='" + this.event_1 + "' data='" + this.data_1 + "'"; }; protoOf(DoorServerSentEvent).stringify_34or05_k$ = function () { return this.id_1 + ';' + this.event_1 + ';' + this.data_1; }; function TriggerConstants() { TriggerConstants_instance = this; this.SQLITE_SELECT_TRIGGER_NAMES_1 = "\n SELECT name\n FROM sqlite_master\n WHERE type = 'trigger'\n AND name LIKE ?\n "; this.SQLITE_SELECT_VIEW_NAMES_1 = "\n SELECT name\n FROM sqlite_master\n WHERE type = 'view'\n AND name LIKE ?\n "; } protoOf(TriggerConstants).get_SQLITE_SELECT_TRIGGER_NAMES_4rc9qw_k$ = function () { return this.SQLITE_SELECT_TRIGGER_NAMES_1; }; protoOf(TriggerConstants).get_SQLITE_SELECT_VIEW_NAMES_bt69on_k$ = function () { return this.SQLITE_SELECT_VIEW_NAMES_1; }; var TriggerConstants_instance; function TriggerConstants_getInstance() { if (TriggerConstants_instance == null) new TriggerConstants(); return TriggerConstants_instance; } function createSqliteTriggerAndReceiveViewSetupStatementList(_this__u8e3s4) { // Inline function 'kotlin.collections.buildList' call // Inline function 'kotlin.contracts.contract' call // Inline function 'kotlin.collections.buildListInternal' call // Inline function 'kotlin.apply' call var this_0 = ArrayList_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList.' call // Inline function 'kotlin.collections.forEach' call var tmp0_iterator = _this__u8e3s4.get_replicateEntities_2w1n4x_k$().get_values_ksazhn_k$().iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList..' call if (element.get_remoteInsertStrategy_t4k5ff_k$().equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) { this_0.add_utx5q5_k$(element.get_createReceiveViewSql_tpcdt7_k$()); } // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_0 = element.get_triggers_6y18jg_k$().iterator_jk1svi_k$(); while (tmp0_iterator_0.hasNext_bitz1p_k$()) { var element_0 = tmp0_iterator_0.next_20eer_k$(); // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList...' call var tmp; if (element_0.get_on_kntnrs_k$().equals(On_ENTITY_getInstance())) { tmp = element.get_entityTableName_g8x9t9_k$(); } else { tmp = element.get_receiveViewName_toacx6_k$(); } var tableOrViewName = tmp; // Inline function 'kotlin.collections.forEach' call var indexedObject = element_0.get_events_d1yhia_k$(); var inductionVariable = 0; var last = indexedObject.length; while (inductionVariable < last) { var element_1 = indexedObject[inductionVariable]; inductionVariable = inductionVariable + 1 | 0; // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList....' call // Inline function 'kotlin.text.substring' call // Inline function 'kotlin.text.lowercase' call // Inline function 'kotlin.js.asDynamic' call // Inline function 'kotlin.js.asDynamic' call var postfix = element_1.get_sqlKeyWord_5ioqos_k$().toLowerCase().substring(0, 3); this_0.add_utx5q5_k$(trimIndent('\n CREATE TRIGGER ' + Companion_getInstance_10().get_NAME_PREFIX_pvog9p_k$() + element_0.get_name_woqyms_k$() + '_' + postfix + ' \n ' + element_0.get_order_iwhiqt_k$().get_sqlStr_jly4y4_k$() + ' ' + element_1 + ' ON ' + tableOrViewName + '\n FOR EACH ROW ' + (!(element_0.get_conditionSql_fcgp38_k$() === '') ? ' WHEN (' + element_0.get_conditionSql_fcgp38_k$() + ') ' : '') + '\n BEGIN\n ' + joinToString_0(element_0.get_sqlStatements_hnj4d3_k$(), ';') + ';\n END\n ')); } } } return this_0.build_1k0s4u_k$(); } function DoorEventCollator$receiveEvent$slambda$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorEventCollator$receiveEvent$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(DoorEventCollator$receiveEvent$slambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorEventCollator$receiveEvent$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$(3); this.set_state_rjd8d0_k$(1); suspendResult = delay(this.this$0__1.maxWaitTime_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.this$0__1.dispatchJob_1.set_kotlinx$atomicfu$value_508e3y_k$(null); this.set_state_rjd8d0_k$(2); suspendResult = this.this$0__1.onCollate_1(tryReceiveAll(this.this$0__1.channel_1, this.this$0__1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } 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); }; protoOf(DoorEventCollator$receiveEvent$slambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorEventCollator$receiveEvent$slambda$slambda(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorEventCollator$receiveEvent$slambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorEventCollator$receiveEvent$slambda$slambda_0(this$0, resultContinuation) { var i = new DoorEventCollator$receiveEvent$slambda$slambda(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function _get_maxWaitTime__cgml91($this) { return $this.maxWaitTime_1; } function _get_coroutineScope__o75s5t($this) { return $this.coroutineScope_1; } function _get_dispatchJob__5lfkzy($this) { return $this.dispatchJob_1; } function _get_channel__c6e3yq($this) { return $this.channel_1; } function tryReceiveAll(_this__u8e3s4, $this) { var resultList = mutableLinkedListOf([]); while (true) { var result = _this__u8e3s4.tryReceive_y3ovg2_k$(); if (_ChannelResult___get_isSuccess__impl__odq1z9(result)) { // Inline function 'kotlin.collections.plusAssign' call var element = ChannelResult__getOrThrow_impl_od1axs(result); resultList.add_utx5q5_k$(element); } else return resultList; } } function DoorEventCollator$receiveEvent$slambda(this$0, resultContinuation) { this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorEventCollator$receiveEvent$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(DoorEventCollator$receiveEvent$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorEventCollator$receiveEvent$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.this$0__1.dispatchJob_1.set_kotlinx$atomicfu$value_508e3y_k$(launch(this.this$0__1.coroutineScope_1, VOID, VOID, DoorEventCollator$receiveEvent$slambda$slambda_0(this.this$0__1, null))); return Unit_getInstance(); } else if (tmp === 1) { throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorEventCollator$receiveEvent$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new DoorEventCollator$receiveEvent$slambda(this.this$0__1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(DoorEventCollator$receiveEvent$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function DoorEventCollator$receiveEvent$slambda_0(this$0, resultContinuation) { var i = new DoorEventCollator$receiveEvent$slambda(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function DoorEventCollator(maxWaitTime, coroutineScope, onCollate) { this.maxWaitTime_1 = maxWaitTime; this.coroutineScope_1 = coroutineScope; this.onCollate_1 = onCollate; this.dispatchJob_1 = atomic$ref$1(null); this.channel_1 = Channel(Factory_getInstance().get_UNLIMITED_eshsm0_k$()); } protoOf(DoorEventCollator).get_onCollate_opqb8i_k$ = function () { return this.onCollate_1; }; protoOf(DoorEventCollator).receiveEvent_cmiqeg_k$ = function (event) { this.channel_1.trySend_62dpg8_k$(event); if (this.dispatchJob_1.get_kotlinx$atomicfu$value_vi2am5_k$() == null) { var tmp = GlobalScope_getInstance(); launch(tmp, VOID, VOID, DoorEventCollator$receiveEvent$slambda_0(this, null)); } }; function IWeakMap() { } function IWeakRef() { } function _get_db__ndbzd9_4($this) { return $this.db_1; } function OnNewDoorNode() { } function _get_newNodeListeners__dut0ky($this) { return $this.newNodeListeners_1; } function _get_cachedAuth__eox4bj($this) { return $this.cachedAuth_1; } function _get_mutex__e2dgb2($this) { return $this.mutex_1; } function $verifyCOROUTINE$27(_this__u8e3s4, nodeId, auth, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.nodeId_1 = nodeId; this.auth_1 = auth; } protoOf($verifyCOROUTINE$27).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$(8); this.cachedAuthResult0__1 = this._this__u8e3s4__1.cachedAuth_1.get_wei43m_k$(this.nodeId_1); if (!(this.cachedAuthResult0__1 == null)) return this.cachedAuthResult0__1 === this.auth_1; var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.mutex_1; var tmp_1 = this; tmp_1.owner2__1 = null; this.set_state_rjd8d0_k$(1); suspendResult = this.this1__1.lock_ugrcvf_k$(this.owner2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(7); this.set_state_rjd8d0_k$(3); suspendResult = getDoorNodeAuth(this._this__u8e3s4__1.db_1, this.nodeId_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.dbAuthResult4__1 = suspendResult; if (!(this.dbAuthResult4__1 == null)) { var tmp_2 = this; var this_0 = this._this__u8e3s4__1.cachedAuth_1; var key = this.nodeId_1; var value = this.dbAuthResult4__1; this_0.put_4fpzoq_k$(key, value); tmp_2.WHEN_RESULT5__1 = this.dbAuthResult4__1 === this.auth_1; this.set_state_rjd8d0_k$(5); continue $sm; } else { Napier_getInstance().d$default_a5agxr_k$('NodeIdAndAuthCache: New Node connected: ' + this.nodeId_1.toString() + ' ', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(4); var this_1 = new DoorNode(); this_1.set_auth_b8k972_k$(this.auth_1); this_1.set_nodeId_xy4u70_k$(this.nodeId_1); this_1.set_rel_w9cafg_k$(Companion_getInstance_11().get_SERVER_FOR_spbpdi_k$()); suspendResult = insertNewDoorNode(this._this__u8e3s4__1.db_1, this_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 4: var this_2 = this._this__u8e3s4__1.cachedAuth_1; var key_0 = this.nodeId_1; var value_0 = this.auth_1; this_2.put_4fpzoq_k$(key_0, value_0); Napier_getInstance().d$default_a5agxr_k$('NodeIdAndAuthCache: Fire new node event to ' + this._this__u8e3s4__1.newNodeListeners_1.get_size_woubt6_k$() + ' listeners'); var tmp0_iterator = this._this__u8e3s4__1.newNodeListeners_1.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); element.onNewDoorNode_sj4mgd_k$(this.nodeId_1, this.auth_1); } this.WHEN_RESULT5__1 = true; this.set_state_rjd8d0_k$(5); continue $sm; case 5: this.tmp$ret$03__1 = this.WHEN_RESULT5__1; this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(6); continue $sm; case 6: var tmp_3 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); return tmp_3; case 7: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); throw t; case 8: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function NodeIdAuthCache(db) { this.db_1 = db; this.newNodeListeners_1 = concurrentSafeListOf([]); this.cachedAuth_1 = concurrentSafeMapOf([]); this.mutex_1 = Mutex(); } protoOf(NodeIdAuthCache).verify_l4pfjv_k$ = function (nodeId, auth, $completion) { var tmp = new $verifyCOROUTINE$27(this, nodeId, auth, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(NodeIdAuthCache).addNewNodeListener_d3nzd7_k$ = function (newNodeListener) { // Inline function 'kotlin.collections.plusAssign' call this.newNodeListeners_1.add_utx5q5_k$(newNodeListener); }; protoOf(NodeIdAuthCache).removeNewNodeListener_yyy57y_k$ = function (newNodeListener) { // Inline function 'kotlin.collections.minusAssign' call this.newNodeListeners_1.remove_cedx0m_k$(newNodeListener); }; var TransactionMode_READ_WRITE_instance; var TransactionMode_READ_ONLY_instance; function values_6() { return [TransactionMode_READ_WRITE_getInstance(), TransactionMode_READ_ONLY_getInstance()]; } function valueOf_6(value) { switch (value) { case 'READ_WRITE': return TransactionMode_READ_WRITE_getInstance(); case 'READ_ONLY': return TransactionMode_READ_ONLY_getInstance(); default: TransactionMode_initEntries(); THROW_IAE('No enum constant value.'); break; } } function get_entries_6() { if ($ENTRIES_6 == null) $ENTRIES_6 = enumEntries(values_6()); return $ENTRIES_6; } var TransactionMode_entriesInitialized; function TransactionMode_initEntries() { if (TransactionMode_entriesInitialized) return Unit_getInstance(); TransactionMode_entriesInitialized = true; TransactionMode_READ_WRITE_instance = new TransactionMode('READ_WRITE', 0); TransactionMode_READ_ONLY_instance = new TransactionMode('READ_ONLY', 1); } var $ENTRIES_6; function TransactionMode(name, ordinal) { Enum.call(this, name, ordinal); } function TransactionMode_READ_WRITE_getInstance() { TransactionMode_initEntries(); return TransactionMode_READ_WRITE_instance; } function TransactionMode_READ_ONLY_getInstance() { TransactionMode_initEntries(); return TransactionMode_READ_ONLY_instance; } function _get_implementationMap__h2mibr($this) { return $this.implementationMap_1; } function _get_builderOptions__3s2dbc($this) { return $this.builderOptions_1; } function _get_callbacks__bg494z($this) { return $this.callbacks_1; } function _get_migrationList__vdnnej($this) { return $this.migrationList_1; } function Companion_19() { Companion_instance_19 = this; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.implementationMap_1 = LinkedHashMap_init_$Create$(); } protoOf(Companion_19).databaseBuilder_hr8t2y_k$ = function (builderOptions) { return new DatabaseBuilder(builderOptions); }; protoOf(Companion_19).lookupImplementations_qvwvxm_k$ = function (dbKClass) { var tmp = this.implementationMap_1.get_wei43m_k$(dbKClass); var tmp0_elvis_lhs = tmp instanceof DoorJsImplClasses ? tmp : null; var tmp_0; if (tmp0_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('' + dbKClass.get_simpleName_r6f8py_k$() + ' is not registered through DatabaseBuilder.register'); } else { tmp_0 = tmp0_elvis_lhs; } return tmp_0; }; protoOf(Companion_19).register_5pbmmw_k$ = function (implClasses) { // Inline function 'kotlin.collections.set' call var this_0 = this.implementationMap_1; var key = implClasses.get_dbKClass_7eayj0_k$(); this_0.put_4fpzoq_k$(key, implClasses); // Inline function 'kotlin.collections.set' call var this_1 = this.implementationMap_1; var key_0 = implClasses.get_dbImplKClass_9ooj90_k$(); this_1.put_4fpzoq_k$(key_0, implClasses); var tmp0_safe_receiver = implClasses.get_repositoryImplClass_s9eqw5_k$(); if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.also' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.Companion.register.' call // Inline function 'kotlin.collections.set' call Companion_getInstance_22().implementationMap_1.put_4fpzoq_k$(tmp0_safe_receiver, implClasses); } var tmp1_safe_receiver = implClasses.get_replicateWrapperImplClass_h5k6md_k$(); if (tmp1_safe_receiver == null) null; else { // Inline function 'kotlin.also' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.Companion.register.' call // Inline function 'kotlin.collections.set' call Companion_getInstance_22().implementationMap_1.put_4fpzoq_k$(tmp1_safe_receiver, implClasses); } }; var Companion_instance_19; function Companion_getInstance_22() { if (Companion_instance_19 == null) new Companion_19(); return Companion_instance_19; } function build$execSqlAsync(_this__u8e3s4, sqlStmts, $completion) { var tmp = new $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function $buildCOROUTINE$28(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($buildCOROUTINE$28).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$(33); if (!startsWith(this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$(), Companion_getInstance_26().get_PROTOCOL_SQLITE_PREFIX_pl3y1_k$())) throw IllegalArgumentException_init_$Create$('Door/JS: Only SQLite is supported on JS! dbUrl must be in the form of sqlite::memory: OR sqlite:indexeddb_name'); Companion_getInstance_22().register_5pbmmw_k$(this._this__u8e3s4__1.builderOptions_1.get_dbImplClasses_b09lsx_k$()); this.storageLocation0__1 = substringAfter(this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$(), Companion_getInstance_26().get_PROTOCOL_SQLITE_PREFIX_pl3y1_k$()); this.dbMetaData1__1 = Companion_getInstance_22().lookupImplementations_qvwvxm_k$(this._this__u8e3s4__1.builderOptions_1.get_dbClass_ov3elt_k$()).get_metadata_vs95vc_k$(); this.dataSource2__1 = new SQLiteDatasourceJs(this.storageLocation0__1, new Worker(this._this__u8e3s4__1.builderOptions_1.get_webWorkerPath_ilxjim_k$()), this._this__u8e3s4__1.builderOptions_1.get_logger_g9gejd_k$(), this._this__u8e3s4__1.builderOptions_1.get_logWorkerMessages_j9kuor_k$()); Companion_getInstance_22().register_5pbmmw_k$(this._this__u8e3s4__1.builderOptions_1.get_dbImplClasses_b09lsx_k$()); var tmp_0 = this; var tmp_1 = createInstance(get_js(this._this__u8e3s4__1.builderOptions_1.get_dbImplClasses_b09lsx_k$().get_dbImplKClass_9ooj90_k$()), [null, this.dataSource2__1, this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$(), this._this__u8e3s4__1.builderOptions_1.get_dbName_c9i0qa_k$(), this._this__u8e3s4__1.builderOptions_1.get_jdbcQueryTimeout_rk5wkj_k$(), Companion_getInstance_6().get_SQLITE_3yc5jp_k$(), this._this__u8e3s4__1.builderOptions_1.get_logger_g9gejd_k$()]); tmp_0.dbImpl3__1 = tmp_1 instanceof RoomDatabase ? tmp_1 : THROW_CCE(); if (!(this.storageLocation0__1 === Companion_getInstance_26().get_LOCATION_MEMORY_rxk7vm_k$())) { this.set_state_rjd8d0_k$(1); suspendResult = IndexedDb_getInstance().checkIfExists_v2er53_k$(this.storageLocation0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.WHEN_RESULT4__1 = false; this.set_state_rjd8d0_k$(2); continue $sm; } case 1: this.WHEN_RESULT4__1 = suspendResult; this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.loadFromIndexedDb5__1 = this.WHEN_RESULT4__1; this.connection6__1 = this.dataSource2__1.getConnection_hr2oto_k$(); this.sqlDatabase7__1 = new DoorSqlDatabaseConnectionImpl(this.connection6__1, Companion_getInstance_6().get_SQLITE_3yc5jp_k$()); if (this.loadFromIndexedDb5__1) { Napier_getInstance().i$default_htnpp6_k$('DatabaseBuilderJs: database ' + this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$() + ' exists... loading\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(9); suspendResult = this.dataSource2__1.loadDbFromIndexedDb_tcxnl_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { Napier_getInstance().i$default_htnpp6_k$('DatabaseBuilderJs: Creating database ' + this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$() + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(3); var this_0 = this.dbImpl3__1.createAllTables_v6vepi_k$(); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_0).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 3: Napier_getInstance().i$default_htnpp6_k$('DatabaseBuilderJs: creating door triggers and receive views ' + this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$() + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(4); var this_1 = createSqliteTriggerAndReceiveViewSetupStatementList(this.dbMetaData1__1); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_1).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Running onCreate callbacks...\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); var tmp_2 = this; tmp_2.this8__1 = this._this__u8e3s4__1.callbacks_1; this.tmp0_iterator9__1 = this.this8__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(5); continue $sm; case 5: if (!this.tmp0_iterator9__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(8); continue $sm; } this.element10__1 = this.tmp0_iterator9__1.next_20eer_k$(); var tmp_3 = this; tmp_3.it11__1 = this.element10__1; this.tmp0_subject12__1 = this.it11__1; var tmp_4 = this.tmp0_subject12__1; if (isInterface(tmp_4, DoorDatabaseCallbackSync)) { throw new NotSupportedException('Cannot use sync callback on JS'); } else { var tmp_5 = this.tmp0_subject12__1; if (isInterface(tmp_5, DoorDatabaseCallbackStatementList)) { Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Running onCreate callback: ' + getKClassFromExpression(this.it11__1).get_simpleName_r6f8py_k$(), VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(6); var this_2 = this.it11__1.onCreate_greuoz_k$(this.sqlDatabase7__1); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_2).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.set_state_rjd8d0_k$(7); continue $sm; } } case 6: this.set_state_rjd8d0_k$(7); continue $sm; case 7: this.set_state_rjd8d0_k$(5); continue $sm; case 8: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: table creation finished\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(26); continue $sm; case 9: var tmp_6 = this; tmp_6.sqlCon13__1 = (null == null ? true : null instanceof SQLiteConnectionJs) ? null : THROW_CCE(); var tmp_7 = this; tmp_7.stmt14__1 = (null == null ? true : null instanceof SQLitePreparedStatementJs) ? null : THROW_CCE(); var tmp_8 = this; tmp_8.resultSet15__1 = (null == null ? true : null instanceof SQLiteResultSet) ? null : THROW_CCE(); this.currentDbVersion16__1 = -1; this.set_state_rjd8d0_k$(10); continue $sm; case 10: this.set_exceptionState_fex74n_k$(13); this.set_exceptionState_fex74n_k$(12); var tmp_9 = this; var tmp_10 = this.dataSource2__1.getConnection_hr2oto_k$(); tmp_9.sqlCon13__1 = tmp_10 instanceof SQLiteConnectionJs ? tmp_10 : THROW_CCE(); this.stmt14__1 = new SQLitePreparedStatementJs(this.sqlCon13__1, 'SELECT dbVersion FROM _doorwayinfo'); this.set_state_rjd8d0_k$(11); suspendResult = this.stmt14__1.executeQueryAsyncInt_j35d75_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 11: var tmp_11 = this; tmp_11.resultSet15__1 = suspendResult instanceof SQLiteResultSet ? suspendResult : THROW_CCE(); var tmp_12 = this; var tmp_13; if (this.resultSet15__1.next_20eer_k$()) { this.currentDbVersion16__1 = this.resultSet15__1.getInt_s8uc8x_k$(1); tmp_13 = Unit_getInstance(); } tmp_12.tmp$ret$017__1 = tmp_13; this.set_exceptionState_fex74n_k$(33); this.set_state_rjd8d0_k$(14); continue $sm; case 12: this.set_exceptionState_fex74n_k$(13); var tmp_14 = this.get_exception_x0n6w6_k$(); if (tmp_14 instanceof SQLException) { this.exception18__1 = this.get_exception_x0n6w6_k$(); var tmp_15 = this; throw this.exception18__1; } else { throw this.get_exception_x0n6w6_k$(); } case 13: this.set_exceptionState_fex74n_k$(33); this.t19__1 = this.get_exception_x0n6w6_k$(); var tmp0_safe_receiver = this.resultSet15__1; if (tmp0_safe_receiver == null) null; else { tmp0_safe_receiver.close_yn9xrc_k$(); } var tmp1_safe_receiver = this.stmt14__1; if (tmp1_safe_receiver == null) null; else { tmp1_safe_receiver.close_yn9xrc_k$(); } var tmp2_safe_receiver = this.sqlCon13__1; if (tmp2_safe_receiver == null) null; else { tmp2_safe_receiver.close_yn9xrc_k$(); } throw this.t19__1; case 14: this.set_exceptionState_fex74n_k$(33); var tmp0_safe_receiver_0 = this.resultSet15__1; if (tmp0_safe_receiver_0 == null) null; else { tmp0_safe_receiver_0.close_yn9xrc_k$(); } var tmp1_safe_receiver_0 = this.stmt14__1; if (tmp1_safe_receiver_0 == null) null; else { tmp1_safe_receiver_0.close_yn9xrc_k$(); } var tmp2_safe_receiver_0 = this.sqlCon13__1; if (tmp2_safe_receiver_0 == null) null; else { tmp2_safe_receiver_0.close_yn9xrc_k$(); } Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Found current db version = ' + this.currentDbVersion16__1 + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.dbWillBeMigrated20__1 = this.currentDbVersion16__1 < this.dbImpl3__1.get_dbVersion_jd6ndd_k$(); var tmp_16 = this; var tmp3_safe_receiver = this.sqlCon13__1; var tmp_17; if (tmp3_safe_receiver == null) { tmp_17 = null; } else { var tmp_18; if (this.dbWillBeMigrated20__1) { tmp_18 = tmp3_safe_receiver; } else { tmp_18 = null; } tmp_17 = tmp_18; } tmp_16.tmp4_safe_receiver21__1 = tmp_17; if (this.tmp4_safe_receiver21__1 == null) { this.WHEN_RESULT22__1 = null; this.set_state_rjd8d0_k$(16); continue $sm; } else { this.set_state_rjd8d0_k$(15); suspendResult = dropDoorTriggersAndReceiveViewsSqlite(this.tmp4_safe_receiver21__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 15: var tmp_19 = this; tmp_19.WHEN_RESULT22__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(16); continue $sm; case 16: this.set_state_rjd8d0_k$(17); continue $sm; case 17: if (!(this.currentDbVersion16__1 < this.dbImpl3__1.get_dbVersion_jd6ndd_k$())) { this.set_state_rjd8d0_k$(23); continue $sm; } var tmp_20 = this; var tmp$ret$2; l$ret$3: do { var this_3 = this._this__u8e3s4__1.migrationList_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_3.iterator_jk1svi_k$(); while (tmp0_iterator.hasNext_bitz1p_k$()) { var element = tmp0_iterator.next_20eer_k$(); var tmp_21; if (element.get_startVersion_84uten_k$() === this.currentDbVersion16__1) { tmp_21 = !(element instanceof DoorMigrationSync); } else { tmp_21 = false; } if (tmp_21) { destination.add_utx5q5_k$(element); } } var iterator = destination.iterator_jk1svi_k$(); if (!iterator.hasNext_bitz1p_k$()) { tmp$ret$2 = null; break l$ret$3; } var maxElem = iterator.next_20eer_k$(); if (!iterator.hasNext_bitz1p_k$()) { tmp$ret$2 = maxElem; break l$ret$3; } var maxValue = maxElem.get_endVersion_algoai_k$(); do { var e = iterator.next_20eer_k$(); var v = e.get_endVersion_algoai_k$(); if (compareTo(maxValue, v) < 0) { maxElem = e; maxValue = v; } } while (iterator.hasNext_bitz1p_k$()); tmp$ret$2 = maxElem; } while (false); tmp_20.nextMigration23__1 = tmp$ret$2; if (!(this.nextMigration23__1 == null)) { Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Attempting to upgrade from ' + this.nextMigration23__1.get_startVersion_84uten_k$() + ' to ' + ('' + this.nextMigration23__1.get_endVersion_algoai_k$() + '\n'), VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.tmp5_subject24__1 = this.nextMigration23__1; var tmp_22 = this.tmp5_subject24__1; if (tmp_22 instanceof DoorMigrationAsync) { this.set_state_rjd8d0_k$(19); suspendResult = this.nextMigration23__1.get_migrateFn_5ksgd2_k$()(this.sqlDatabase7__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_23 = this.tmp5_subject24__1; if (tmp_23 instanceof DoorMigrationStatementList) { this.set_state_rjd8d0_k$(18); var this_4 = this.nextMigration23__1.get_migrateStmts_i54q9j_k$()(this.sqlDatabase7__1); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_4).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw IllegalArgumentException_init_$Create$('Cannot use DataMigrationSync on JS'); } } } else { throw IllegalStateException_init_$Create$('Need to migrate to version ' + ('' + this.dbImpl3__1.get_dbVersion_jd6ndd_k$() + ' from ' + this.currentDbVersion16__1 + ' - could not find next migration')); } case 18: this.set_state_rjd8d0_k$(20); continue $sm; case 19: this.set_state_rjd8d0_k$(20); continue $sm; case 20: this.currentDbVersion16__1 = this.nextMigration23__1.get_endVersion_algoai_k$(); this.set_state_rjd8d0_k$(21); suspendResult = build$execSqlAsync(this.connection6__1, ['UPDATE _doorwayinfo SET dbVersion = ' + this.currentDbVersion16__1], this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 21: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: migrated up to ' + this.currentDbVersion16__1, VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(22); continue $sm; case 22: this.set_state_rjd8d0_k$(17); continue $sm; case 23: var tmp_24 = this; var this_5 = this.connection6__1; var tmp_25; if (this.dbWillBeMigrated20__1) { tmp_25 = this_5; } else { tmp_25 = null; } tmp_24.tmp6_safe_receiver25__1 = tmp_25; if (this.tmp6_safe_receiver25__1 == null) { this.WHEN_RESULT26__1 = null; this.set_state_rjd8d0_k$(25); continue $sm; } else { this.set_state_rjd8d0_k$(24); var this_6 = createSqliteTriggerAndReceiveViewSetupStatementList(this.dbMetaData1__1); suspendResult = build$execSqlAsync(this.tmp6_safe_receiver25__1, copyToArray(this_6).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 24: var tmp_26 = this; tmp_26.WHEN_RESULT26__1 = Unit_getInstance(); this.set_state_rjd8d0_k$(25); continue $sm; case 25: this.set_state_rjd8d0_k$(26); continue $sm; case 26: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Running onOpen callbacks...\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); var tmp_27 = this; tmp_27.this27__1 = this._this__u8e3s4__1.callbacks_1; this.tmp0_iterator28__1 = this.this27__1.iterator_jk1svi_k$(); this.set_state_rjd8d0_k$(27); continue $sm; case 27: if (!this.tmp0_iterator28__1.hasNext_bitz1p_k$()) { this.set_state_rjd8d0_k$(30); continue $sm; } this.element29__1 = this.tmp0_iterator28__1.next_20eer_k$(); var tmp_28 = this; tmp_28.it30__1 = this.element29__1; this.tmp0_subject31__1 = this.it30__1; var tmp_29 = this.tmp0_subject31__1; if (isInterface(tmp_29, DoorDatabaseCallbackStatementList)) { this.set_state_rjd8d0_k$(28); var this_7 = this.it30__1.onOpen_58e9dd_k$(this.sqlDatabase7__1); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_7).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw IllegalArgumentException_init_$Create$('Cannot use sync callback on JS'); } case 28: this.set_state_rjd8d0_k$(29); continue $sm; case 29: this.set_state_rjd8d0_k$(27); continue $sm; case 30: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Setting up InvalidationTracker trigger SQL\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(31); var this_8 = Companion_getInstance_4().generateCreateTriggersSql_julqud_k$(this.dbMetaData1__1.get_allTables_1jy9x9_k$(), false); suspendResult = build$execSqlAsync(this.connection6__1, copyToArray(this_8).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 31: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Setting up NodeEvent table and trigger SQL\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(32); suspendResult = createNodeEventTableAndTrigger(this.connection6__1, this.dbMetaData1__1.get_allTables_1jy9x9_k$().contains_aljjnj_k$(NodeEventConstants_getInstance().get_OUTGOING_REPLICATION_TABLE_NAME_fm288p_k$()), false, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 32: Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Setting up change listener\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); if (!(this.storageLocation0__1 === Companion_getInstance_26().get_LOCATION_MEMORY_rxk7vm_k$())) { new SaveToIndexedDbChangeListener(this.dbImpl3__1, this.dataSource2__1, this.dbMetaData1__1.get_replicateTableNames_6uibay_k$(), this._this__u8e3s4__1.builderOptions_1.get_saveToIndexedDbDelayTime_vryaqm_k$()); } this.connection6__1.close_yn9xrc_k$(); var tmp7_safe_receiver = this._this__u8e3s4__1.builderOptions_1.get_dbImplClasses_b09lsx_k$().get_replicateWrapperImplClass_h5k6md_k$(); var tmp8_safe_receiver = tmp7_safe_receiver == null ? null : get_js(tmp7_safe_receiver); var tmp_30 = tmp8_safe_receiver == null ? null : createInstance(tmp8_safe_receiver, [this.dbImpl3__1, this._this__u8e3s4__1.builderOptions_1.get_nodeId_h7ho7a_k$(), this._this__u8e3s4__1.builderOptions_1.get_messageCallback_kxaem5_k$(), this._this__u8e3s4__1.builderOptions_1.get_logger_g9gejd_k$(), this._this__u8e3s4__1.builderOptions_1.get_dbName_c9i0qa_k$()]); var wrapperClass = (tmp_30 == null ? true : tmp_30 instanceof RoomDatabase) ? tmp_30 : THROW_CCE(); Napier_getInstance().i$default_htnpp6_k$('Built database for: ' + this._this__u8e3s4__1.builderOptions_1.get_dbUrl_iq59m0_k$() + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); return wrapperClass == null ? this.dbImpl3__1 : wrapperClass; case 33: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 33) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.sqlStmts_1 = sqlStmts; } protoOf($build$execSqlAsyncCOROUTINE$29).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$(8); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.stmt4__1 = this.this1__1; this.set_state_rjd8d0_k$(4); suspendResult = this.stmt4__1.executeUpdateAsyncJs_btupiy_k$(joinToString_0(this.sqlStmts_1, ';'), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.tmp$ret$03__1 = suspendResult; this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(5); var tmp_2 = this; continue $sm; case 5: var tmp_3 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = tmp_3; this.set_state_rjd8d0_k$(10); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_4 = this.get_exception_x0n6w6_k$(); if (tmp_4 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_5 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 8: throw this.get_exception_x0n6w6_k$(); case 9: this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(10); continue $sm; case 10: return Unit_getInstance(); } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; function DatabaseBuilder(builderOptions) { Companion_getInstance_22(); this.builderOptions_1 = builderOptions; var tmp = this; // Inline function 'kotlin.collections.mutableListOf' call tmp.callbacks_1 = ArrayList_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableListOf' call tmp_0.migrationList_1 = ArrayList_init_$Create$(); } protoOf(DatabaseBuilder).build_xhukzv_k$ = function ($completion) { var tmp = new $buildCOROUTINE$28(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(DatabaseBuilder).addMigrations_a2y08e_k$ = function (migrations) { addAll(this.migrationList_1, migrations); return this; }; protoOf(DatabaseBuilder).addCallback_kclapb_k$ = function (callback) { Napier_getInstance().d$default_a5agxr_k$('DatabaseBuilderJs: Add Callback: ' + getKClassFromExpression(callback).get_simpleName_r6f8py_k$(), VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.callbacks_1.add_utx5q5_k$(callback); return this; }; protoOf(DatabaseBuilder).queryTimeout_6wf75b_k$ = function (seconds) { this.builderOptions_1.set_jdbcQueryTimeout_vcgkx5_k$(seconds); }; function DatabaseBuilderOptions(dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages) { dbUrl = dbUrl === VOID ? 'indexeddb:' + ensureNotNull(dbClass.get_simpleName_r6f8py_k$()) : dbUrl; saveToIndexedDbDelayTime = saveToIndexedDbDelayTime === VOID ? new Long(200, 0) : saveToIndexedDbDelayTime; messageCallback = messageCallback === VOID ? new DefaultDoorMessageCallback() : messageCallback; jdbcQueryTimeout = jdbcQueryTimeout === VOID ? 10 : jdbcQueryTimeout; dbName = dbName === VOID ? dbUrl : dbName; logger = logger === VOID ? new NapierDoorLogger() : logger; logWorkerMessages = logWorkerMessages === VOID ? false : logWorkerMessages; this.dbClass_1 = dbClass; this.dbImplClasses_1 = dbImplClasses; this.nodeId_1 = nodeId; this.dbUrl_1 = dbUrl; this.webWorkerPath_1 = webWorkerPath; this.saveToIndexedDbDelayTime_1 = saveToIndexedDbDelayTime; this.messageCallback_1 = messageCallback; this.jdbcQueryTimeout_1 = jdbcQueryTimeout; this.dbName_1 = dbName; this.logger_1 = logger; this.logWorkerMessages_1 = logWorkerMessages; } protoOf(DatabaseBuilderOptions).set_dbClass_qpzdln_k$ = function (_set____db54di) { this.dbClass_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_dbClass_ov3elt_k$ = function () { return this.dbClass_1; }; protoOf(DatabaseBuilderOptions).set_dbImplClasses_ynpo62_k$ = function (_set____db54di) { this.dbImplClasses_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_dbImplClasses_b09lsx_k$ = function () { return this.dbImplClasses_1; }; protoOf(DatabaseBuilderOptions).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(DatabaseBuilderOptions).set_dbUrl_c4zumi_k$ = function (_set____db54di) { this.dbUrl_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_dbUrl_iq59m0_k$ = function () { return this.dbUrl_1; }; protoOf(DatabaseBuilderOptions).set_webWorkerPath_sos6kw_k$ = function (_set____db54di) { this.webWorkerPath_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_webWorkerPath_ilxjim_k$ = function () { return this.webWorkerPath_1; }; protoOf(DatabaseBuilderOptions).get_saveToIndexedDbDelayTime_vryaqm_k$ = function () { return this.saveToIndexedDbDelayTime_1; }; protoOf(DatabaseBuilderOptions).get_messageCallback_kxaem5_k$ = function () { return this.messageCallback_1; }; protoOf(DatabaseBuilderOptions).set_jdbcQueryTimeout_vcgkx5_k$ = function (_set____db54di) { this.jdbcQueryTimeout_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_jdbcQueryTimeout_rk5wkj_k$ = function () { return this.jdbcQueryTimeout_1; }; protoOf(DatabaseBuilderOptions).set_dbName_5mqzek_k$ = function (_set____db54di) { this.dbName_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_dbName_c9i0qa_k$ = function () { return this.dbName_1; }; protoOf(DatabaseBuilderOptions).set_logger_i89g1p_k$ = function (_set____db54di) { this.logger_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_logger_g9gejd_k$ = function () { return this.logger_1; }; protoOf(DatabaseBuilderOptions).set_logWorkerMessages_s20uv8_k$ = function (_set____db54di) { this.logWorkerMessages_1 = _set____db54di; }; protoOf(DatabaseBuilderOptions).get_logWorkerMessages_j9kuor_k$ = function () { return this.logWorkerMessages_1; }; protoOf(DatabaseBuilderOptions).component1_7eebsc_k$ = function () { return this.dbClass_1; }; protoOf(DatabaseBuilderOptions).component2_7eebsb_k$ = function () { return this.dbImplClasses_1; }; protoOf(DatabaseBuilderOptions).component3_7eebsa_k$ = function () { return this.nodeId_1; }; protoOf(DatabaseBuilderOptions).component4_7eebs9_k$ = function () { return this.dbUrl_1; }; protoOf(DatabaseBuilderOptions).component5_7eebs8_k$ = function () { return this.webWorkerPath_1; }; protoOf(DatabaseBuilderOptions).component6_7eebs7_k$ = function () { return this.saveToIndexedDbDelayTime_1; }; protoOf(DatabaseBuilderOptions).component7_7eebs6_k$ = function () { return this.messageCallback_1; }; protoOf(DatabaseBuilderOptions).component8_7eebs5_k$ = function () { return this.jdbcQueryTimeout_1; }; protoOf(DatabaseBuilderOptions).component9_7eebs4_k$ = function () { return this.dbName_1; }; protoOf(DatabaseBuilderOptions).component10_gazzfo_k$ = function () { return this.logger_1; }; protoOf(DatabaseBuilderOptions).component11_gazzfn_k$ = function () { return this.logWorkerMessages_1; }; protoOf(DatabaseBuilderOptions).copy_goicjw_k$ = function (dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages) { return new DatabaseBuilderOptions(dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages); }; protoOf(DatabaseBuilderOptions).copy$default_t51wy8_k$ = function (dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages, $super) { dbClass = dbClass === VOID ? this.dbClass_1 : dbClass; dbImplClasses = dbImplClasses === VOID ? this.dbImplClasses_1 : dbImplClasses; nodeId = nodeId === VOID ? this.nodeId_1 : nodeId; dbUrl = dbUrl === VOID ? this.dbUrl_1 : dbUrl; webWorkerPath = webWorkerPath === VOID ? this.webWorkerPath_1 : webWorkerPath; saveToIndexedDbDelayTime = saveToIndexedDbDelayTime === VOID ? this.saveToIndexedDbDelayTime_1 : saveToIndexedDbDelayTime; messageCallback = messageCallback === VOID ? this.messageCallback_1 : messageCallback; jdbcQueryTimeout = jdbcQueryTimeout === VOID ? this.jdbcQueryTimeout_1 : jdbcQueryTimeout; dbName = dbName === VOID ? this.dbName_1 : dbName; logger = logger === VOID ? this.logger_1 : logger; logWorkerMessages = logWorkerMessages === VOID ? this.logWorkerMessages_1 : logWorkerMessages; return $super === VOID ? this.copy_goicjw_k$(dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages) : $super.copy_goicjw_k$.call(this, dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages); }; protoOf(DatabaseBuilderOptions).toString = function () { return 'DatabaseBuilderOptions(dbClass=' + this.dbClass_1 + ', dbImplClasses=' + this.dbImplClasses_1 + ', nodeId=' + this.nodeId_1.toString() + ', dbUrl=' + this.dbUrl_1 + ', webWorkerPath=' + this.webWorkerPath_1 + ', saveToIndexedDbDelayTime=' + this.saveToIndexedDbDelayTime_1.toString() + ', messageCallback=' + this.messageCallback_1 + ', jdbcQueryTimeout=' + this.jdbcQueryTimeout_1 + ', dbName=' + this.dbName_1 + ', logger=' + this.logger_1 + ', logWorkerMessages=' + this.logWorkerMessages_1 + ')'; }; protoOf(DatabaseBuilderOptions).hashCode = function () { var result = this.dbClass_1.hashCode(); result = imul(result, 31) + hashCode(this.dbImplClasses_1) | 0; result = imul(result, 31) + this.nodeId_1.hashCode() | 0; result = imul(result, 31) + getStringHashCode(this.dbUrl_1) | 0; result = imul(result, 31) + getStringHashCode(this.webWorkerPath_1) | 0; result = imul(result, 31) + this.saveToIndexedDbDelayTime_1.hashCode() | 0; result = imul(result, 31) + hashCode(this.messageCallback_1) | 0; result = imul(result, 31) + this.jdbcQueryTimeout_1 | 0; result = imul(result, 31) + getStringHashCode(this.dbName_1) | 0; result = imul(result, 31) + hashCode(this.logger_1) | 0; result = imul(result, 31) + getBooleanHashCode(this.logWorkerMessages_1) | 0; return result; }; protoOf(DatabaseBuilderOptions).equals = function (other) { if (this === other) return true; if (!(other instanceof DatabaseBuilderOptions)) return false; var tmp0_other_with_cast = other instanceof DatabaseBuilderOptions ? other : THROW_CCE(); if (!this.dbClass_1.equals(tmp0_other_with_cast.dbClass_1)) return false; if (!equals(this.dbImplClasses_1, tmp0_other_with_cast.dbImplClasses_1)) return false; if (!this.nodeId_1.equals(tmp0_other_with_cast.nodeId_1)) return false; if (!(this.dbUrl_1 === tmp0_other_with_cast.dbUrl_1)) return false; if (!(this.webWorkerPath_1 === tmp0_other_with_cast.webWorkerPath_1)) return false; if (!this.saveToIndexedDbDelayTime_1.equals(tmp0_other_with_cast.saveToIndexedDbDelayTime_1)) return false; if (!equals(this.messageCallback_1, tmp0_other_with_cast.messageCallback_1)) return false; if (!(this.jdbcQueryTimeout_1 === tmp0_other_with_cast.jdbcQueryTimeout_1)) return false; if (!(this.dbName_1 === tmp0_other_with_cast.dbName_1)) return false; if (!equals(this.logger_1, tmp0_other_with_cast.logger_1)) return false; if (!(this.logWorkerMessages_1 === tmp0_other_with_cast.logWorkerMessages_1)) return false; return true; }; function _get_doorUriInfo__o3gwwr($this) { return $this.doorUriInfo_1; } function DoorUriProps(uri, fileName, mimeType) { this.uri_1 = uri; this.fileName_1 = fileName; this.mimeType_1 = mimeType; } protoOf(DoorUriProps).get_uri_18iuil_k$ = function () { return this.uri_1; }; protoOf(DoorUriProps).get_fileName_r258mo_k$ = function () { return this.fileName_1; }; protoOf(DoorUriProps).get_mimeType_g7ccbb_k$ = function () { return this.mimeType_1; }; protoOf(DoorUriProps).component1_7eebsc_k$ = function () { return this.uri_1; }; protoOf(DoorUriProps).component2_7eebsb_k$ = function () { return this.fileName_1; }; protoOf(DoorUriProps).component3_7eebsa_k$ = function () { return this.mimeType_1; }; protoOf(DoorUriProps).copy_37sg9j_k$ = function (uri, fileName, mimeType) { return new DoorUriProps(uri, fileName, mimeType); }; protoOf(DoorUriProps).copy$default_pis2v1_k$ = function (uri, fileName, mimeType, $super) { uri = uri === VOID ? this.uri_1 : uri; fileName = fileName === VOID ? this.fileName_1 : fileName; mimeType = mimeType === VOID ? this.mimeType_1 : mimeType; return $super === VOID ? this.copy_37sg9j_k$(uri, fileName, mimeType) : $super.copy_37sg9j_k$.call(this, uri, fileName, mimeType); }; protoOf(DoorUriProps).toString = function () { return 'DoorUriProps(uri=' + this.uri_1 + ', fileName=' + this.fileName_1 + ', mimeType=' + this.mimeType_1 + ')'; }; protoOf(DoorUriProps).hashCode = function () { var result = getStringHashCode(this.uri_1); result = imul(result, 31) + (this.fileName_1 == null ? 0 : getStringHashCode(this.fileName_1)) | 0; result = imul(result, 31) + (this.mimeType_1 == null ? 0 : getStringHashCode(this.mimeType_1)) | 0; return result; }; protoOf(DoorUriProps).equals = function (other) { if (this === other) return true; if (!(other instanceof DoorUriProps)) return false; var tmp0_other_with_cast = other instanceof DoorUriProps ? other : THROW_CCE(); if (!(this.uri_1 === tmp0_other_with_cast.uri_1)) return false; if (!(this.fileName_1 == tmp0_other_with_cast.fileName_1)) return false; if (!(this.mimeType_1 == tmp0_other_with_cast.mimeType_1)) return false; return true; }; function Companion_20() { Companion_instance_20 = this; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.doorUriInfo_1 = LinkedHashMap_init_$Create$(); } protoOf(Companion_20).parse_pc1q8p_k$ = function (uriString) { return new DoorUri(new URL(uriString)); }; protoOf(Companion_20).createLocalUri_7qzolo_k$ = function (blob, filename, mimeType) { var localUrl = URL.createObjectURL(blob); // Inline function 'kotlin.collections.set' call var this_0 = this.doorUriInfo_1; var value = new DoorUriProps(localUrl, filename, mimeType); this_0.put_4fpzoq_k$(localUrl, value); return new DoorUri(new URL(localUrl)); }; protoOf(Companion_20).createLocalUri$default_zarwb6_k$ = function (blob, filename, mimeType, $super) { mimeType = mimeType === VOID ? null : mimeType; return $super === VOID ? this.createLocalUri_7qzolo_k$(blob, filename, mimeType) : $super.createLocalUri_7qzolo_k$.call(this, blob, filename, mimeType); }; protoOf(Companion_20).getDoorUriProps_xza1bi_k$ = function (uri) { return this.doorUriInfo_1.get_wei43m_k$(uri); }; protoOf(Companion_20).revokeLocalUri_s7frvo_k$ = function (localUri) { URL.revokeObjectURL(localUri.toString()); this.doorUriInfo_1.remove_gppy8k_k$(localUri.toString()); }; var Companion_instance_20; function Companion_getInstance_23() { if (Companion_instance_20 == null) new Companion_20(); return Companion_instance_20; } function DoorUri(uri) { Companion_getInstance_23(); this.uri_1 = uri; } protoOf(DoorUri).get_uri_18iuil_k$ = function () { return this.uri_1; }; protoOf(DoorUri).getFileName_yox9a6_k$ = function (context, $completion) { var tmp0_safe_receiver = Companion_getInstance_23().doorUriInfo_1.get_wei43m_k$(toString(this.uri_1)); var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.fileName_1; return tmp1_elvis_lhs == null ? substringAfterLast(this.uri_1.pathname, '/') : tmp1_elvis_lhs; }; protoOf(DoorUri).toString = function () { return toString(this.uri_1); }; protoOf(DoorUri).equals = function (other) { var tmp0_safe_receiver = other instanceof DoorUri ? other : null; return equals(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.uri_1, this.uri_1); }; protoOf(DoorUri).hashCode = function () { return getStringHashCode(toString(this.uri_1)); }; function JdbcArrayProxy(typeName, objects) { JdbcArrayProxyCommon.call(this, typeName, objects); } protoOf(JdbcArrayProxy).free_au51lw_k$ = function () { }; function _set_closed__kdb0et_0($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1_0($this) { return $this.closed_1; } function PreparedStatementArrayProxy(query, connection) { PreparedStatementArrayProxyCommon.call(this, query, connection); this.closed_1 = false; } protoOf(PreparedStatementArrayProxy).executeUpdate_k6x04k_k$ = function (sql) { return this.prepareStatement_ieuhug_k$().executeUpdate_fapcbi_k$(); }; protoOf(PreparedStatementArrayProxy).executeUpdateAsync_1e6m2t_k$ = function ($completion) { return this.prepareStatement_ieuhug_k$().executeUpdateAsync_1e6m2t_k$($completion); }; protoOf(PreparedStatementArrayProxy).executeUpdateAsyncJs_btupiy_k$ = function (sql, $completion) { return this.prepareStatement_ieuhug_k$().executeUpdateAsyncJs_btupiy_k$(sql, $completion); }; protoOf(PreparedStatementArrayProxy).executeQueryAsyncInt_j35d75_k$ = function ($completion) { return this.prepareStatement_ieuhug_k$().executeQueryAsyncInt_j35d75_k$($completion); }; protoOf(PreparedStatementArrayProxy).getGeneratedKeys_aewui5_k$ = function () { throw new SQLException('PreparedStatementArrayProxy does not support getting generated keys', null); }; protoOf(PreparedStatementArrayProxy).close_yn9xrc_k$ = function () { this.closed_1 = true; }; protoOf(PreparedStatementArrayProxy).isClosed_baxhhm_k$ = function () { return this.closed_1; }; protoOf(PreparedStatementArrayProxy).getConnection_hr2oto_k$ = function () { return this.get_connectionInternal_tlp70c_k$(); }; function Builder(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) { this.context_1 = context; this.endpoint_1 = endpoint; this.auth_1 = auth; this.nodeId_1 = nodeId; this.httpClient_1 = httpClient; this.json_1 = json; this.logger_1 = logger; this.dbName_1 = dbName; } protoOf(Builder).get_context_h02k06_k$ = function () { return this.context_1; }; protoOf(Builder).get_endpoint_30bvdu_k$ = function () { return this.endpoint_1; }; protoOf(Builder).get_auth_woj2sx_k$ = function () { return this.auth_1; }; protoOf(Builder).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(Builder).get_httpClient_cdum84_k$ = function () { return this.httpClient_1; }; protoOf(Builder).get_json_woos35_k$ = function () { return this.json_1; }; protoOf(Builder).get_logger_g9gejd_k$ = function () { return this.logger_1; }; protoOf(Builder).get_dbName_c9i0qa_k$ = function () { return this.dbName_1; }; protoOf(Builder).build_1k0s4u_k$ = function () { return new RepositoryConfig(this.context_1, this.endpoint_1, this.auth_1, this.nodeId_1, this.httpClient_1, this.json_1, this.logger_1, this.dbName_1); }; function RepositoryConfig$Companion$repositoryConfig$lambda($this$Json) { $this$Json.set_encodeDefaults_c5evsg_k$(true); return Unit_getInstance(); } function RepositoryConfig$Companion$repositoryConfig$lambda_0($this$null) { return Unit_getInstance(); } function Companion_21() { Companion_instance_21 = this; } protoOf(Companion_21).repositoryConfig_yi0yu_k$ = function (context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block) { var builder = new Builder(context, endpoint, auth, nodeId, httpClient, json, logger, dbName); block(builder); return builder.build_1k0s4u_k$(); }; protoOf(Companion_21).repositoryConfig$default_5l7wp9_k$ = function (context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block, $super) { logger = logger === VOID ? new NapierDoorLogger() : logger; dbName = dbName === VOID ? endpoint : dbName; var tmp; if (json === VOID) { tmp = Json(VOID, RepositoryConfig$Companion$repositoryConfig$lambda); } else { tmp = json; } json = tmp; var tmp_0; if (block === VOID) { tmp_0 = RepositoryConfig$Companion$repositoryConfig$lambda_0; } else { tmp_0 = block; } block = tmp_0; return $super === VOID ? this.repositoryConfig_yi0yu_k$(context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block) : $super.repositoryConfig_yi0yu_k$.call(this, context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block); }; var Companion_instance_21; function Companion_getInstance_24() { if (Companion_instance_21 == null) new Companion_21(); return Companion_instance_21; } function RepositoryConfig(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) { Companion_getInstance_24(); this.context_1 = context; this.endpoint_1 = endpoint; this.auth_1 = auth; this.nodeId_1 = nodeId; this.httpClient_1 = httpClient; this.json_1 = json; this.logger_1 = logger; this.dbName_1 = dbName; } protoOf(RepositoryConfig).get_context_h02k06_k$ = function () { return this.context_1; }; protoOf(RepositoryConfig).get_endpoint_30bvdu_k$ = function () { return this.endpoint_1; }; protoOf(RepositoryConfig).get_auth_woj2sx_k$ = function () { return this.auth_1; }; protoOf(RepositoryConfig).get_nodeId_h7ho7a_k$ = function () { return this.nodeId_1; }; protoOf(RepositoryConfig).get_httpClient_cdum84_k$ = function () { return this.httpClient_1; }; protoOf(RepositoryConfig).get_json_woos35_k$ = function () { return this.json_1; }; protoOf(RepositoryConfig).get_logger_g9gejd_k$ = function () { return this.logger_1; }; protoOf(RepositoryConfig).get_dbName_c9i0qa_k$ = function () { return this.dbName_1; }; function _get_datasource__pefkrq($this) { return $this.datasource_1; } function _get_changeListenerRequest__wc2pja($this) { return $this.changeListenerRequest_1; } function _get_eventCollator__ffqyzv($this) { return $this.eventCollator_1; } function SaveToIndexedDbChangeListener$eventCollator$slambda($database, this$0, resultContinuation) { this.$database_1 = $database; this.this$0__1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).invoke_zhr0un_k$ = function (it, $completion) { var tmp = this.create_5ir2kr_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_zhr0un_k$((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(SaveToIndexedDbChangeListener$eventCollator$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); Napier_getInstance().d$default_a5agxr_k$('Save database ' + this.$database_1 + ' to indexedDb', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(1); suspendResult = this.this$0__1.datasource_1.saveDatabaseToIndexedDb_xd3smc_k$(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(SaveToIndexedDbChangeListener$eventCollator$slambda).create_5ir2kr_k$ = function (it, completion) { var i = new SaveToIndexedDbChangeListener$eventCollator$slambda(this.$database_1, this.this$0__1, completion); i.it_1 = it; return i; }; protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_5ir2kr_k$((!(value == null) ? isInterface(value, List) : false) ? value : THROW_CCE(), completion); }; function SaveToIndexedDbChangeListener$eventCollator$slambda_0($database, this$0, resultContinuation) { var i = new SaveToIndexedDbChangeListener$eventCollator$slambda($database, this$0, resultContinuation); var l = function (it, $completion) { return i.invoke_zhr0un_k$(it, $completion); }; l.$arity = 1; return l; } function SaveToIndexedDbChangeListener$1($tablesToListen, this$0) { this.this$0__1 = this$0; // Inline function 'kotlin.collections.toTypedArray' call var tmp$ret$0 = copyToArray($tablesToListen); InvalidationTrackerObserver.call(this, tmp$ret$0); } protoOf(SaveToIndexedDbChangeListener$1).onInvalidated_v59v8q_k$ = function (tables) { this.this$0__1.eventCollator_1.receiveEvent_cmiqeg_k$(toList(tables)); }; function SaveToIndexedDbChangeListener(database, datasource, tablesToListen, maxWaitTime) { this.datasource_1 = datasource; var tmp = this; var tmp_0 = GlobalScope_getInstance(); tmp.eventCollator_1 = new DoorEventCollator(maxWaitTime, tmp_0, SaveToIndexedDbChangeListener$eventCollator$slambda_0(database, this, null)); var tmp_1 = this; tmp_1.changeListenerRequest_1 = new SaveToIndexedDbChangeListener$1(tablesToListen, this); database.get_invalidationTracker_tp0k9d_k$().addObserver_wpl76o_k$(this.changeListenerRequest_1); } function prepareStatement(_this__u8e3s4, db, stmtConfig) { var tmp; if (stmtConfig.get_hasListParams_eih2hh_k$()) { tmp = new PreparedStatementArrayProxy(stmtConfig.get_sql_18iw0r_k$(), _this__u8e3s4); } else { tmp = _this__u8e3s4.prepareStatement_w7z552_k$(stmtConfig.get_sql_18iw0r_k$(), stmtConfig.get_generatedKeys_rooagq_k$()); } return tmp; } function dbType_0(_this__u8e3s4) { return Companion_getInstance_6().get_SQLITE_3yc5jp_k$(); } function withDoorTransactionAsync(_this__u8e3s4, transactionMode, block, $completion) { transactionMode = transactionMode === VOID ? TransactionMode_READ_WRITE_getInstance() : transactionMode; var tmp = get_rootDatabase(_this__u8e3s4); var tmp_0 = (isInterface(tmp, RoomJdbcImpl) ? tmp : THROW_CCE()).get_jdbcImplHelper_iauze6_k$(); var tmp_1 = transactionMode.equals(TransactionMode_READ_ONLY_getInstance()); return tmp_0.useConnectionAsync_98htgj_k$(tmp_1, withDoorTransactionAsync$slambda_0(block, _this__u8e3s4, null), $completion); } function unwrap(_this__u8e3s4, dbClass) { var tmp0_safe_receiver = isInterface(_this__u8e3s4, DoorDatabaseWrapper) ? _this__u8e3s4 : null; var tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.get_realDatabase_fu4k1q_k$(); var tmp1_elvis_lhs = tmp instanceof RoomDatabase ? tmp : null; var tmp_0; if (tmp1_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('' + _this__u8e3s4 + ' is not a replicate wrapper!'); } else { tmp_0 = tmp1_elvis_lhs; } return tmp_0; } function doorDatabaseMetadata(_this__u8e3s4) { return Companion_getInstance_22().lookupImplementations_qvwvxm_k$(_this__u8e3s4).get_metadata_vs95vc_k$(); } function dbType_1(_this__u8e3s4) { return Companion_getInstance_6().get_SQLITE_3yc5jp_k$(); } function withDoorTransaction(_this__u8e3s4, transactionMode, block) { transactionMode = transactionMode === VOID ? TransactionMode_READ_WRITE_getInstance() : transactionMode; throw new SQLException('withDoorTransaction non-async not support on Javascript!', null); } function dbSchemaVersion(_this__u8e3s4) { return _this__u8e3s4.get_dbVersion_jd6ndd_k$(); } function withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation) { this.$block_1 = $block; this.$this_withDoorTransactionAsync_1 = $this_withDoorTransactionAsync; CoroutineImpl.call(this, resultContinuation); } protoOf(withDoorTransactionAsync$slambda).invoke_8ggh1u_k$ = function (it, $completion) { var tmp = this.create_1rn91a_k$(it, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(withDoorTransactionAsync$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_8ggh1u_k$((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withDoorTransactionAsync$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.$this_withDoorTransactionAsync_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(withDoorTransactionAsync$slambda).create_1rn91a_k$ = function (it, completion) { var i = new withDoorTransactionAsync$slambda(this.$block_1, this.$this_withDoorTransactionAsync_1, completion); i.it_1 = it; return i; }; protoOf(withDoorTransactionAsync$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_1rn91a_k$((!(value == null) ? isInterface(value, Connection) : false) ? value : THROW_CCE(), completion); }; function withDoorTransactionAsync$slambda_0($block, $this_withDoorTransactionAsync, resultContinuation) { var i = new withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation); var l = function (it, $completion) { return i.invoke_8ggh1u_k$(it, $completion); }; l.$arity = 1; return l; } function createInstance(_this__u8e3s4, args) { var ctor = _this__u8e3s4; // Inline function 'kotlin.collections.toTypedArray' call var this_0 = plus_2(listOf(null), args); var argsArray = copyToArray(this_0); return new (Function.prototype.bind.apply(ctor, argsArray))(); } function mutableLinkedListOf(items) { // Inline function 'kotlin.also' call // Inline function 'kotlin.collections.mutableListOf' call var this_0 = ArrayList_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.ext.mutableLinkedListOf.' call addAll(this_0, items); return this_0; } function concurrentSafeListOf(items) { // Inline function 'kotlin.also' call // Inline function 'kotlin.collections.mutableListOf' call var this_0 = ArrayList_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.ext.concurrentSafeListOf.' call addAll(this_0, items); return this_0; } function concurrentSafeMapOf(items) { // Inline function 'kotlin.also' call // Inline function 'kotlin.collections.mutableMapOf' call var this_0 = LinkedHashMap_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.ext.concurrentSafeMapOf.' call putAll(this_0, items); return this_0; } function weakMapOf() { return new WeakMapJs(); } function urlEncode(_this__u8e3s4) { return encodeURIComponent(_this__u8e3s4); } function Array_0() { } function Connection() { } function DataSource() { } function DatabaseMetadata() { } function PreparedStatement() { } function ResultSet() { } function ResultSetMetaData() { } function SQLException(message, cause) { Exception_init_$Init$(message, cause, this); captureStack(this, SQLException); } function Statement() { } function mutableLinkedListOf_0(items) { // Inline function 'kotlin.collections.mutableListOf' call return ArrayList_init_$Create$(); } function executeUpdateAsyncKmp(_this__u8e3s4, $completion) { return _this__u8e3s4.executeUpdateAsync_1e6m2t_k$($completion); } function executeUpdateAsync(_this__u8e3s4, sql, $completion) { return _this__u8e3s4.executeUpdateAsyncJs_btupiy_k$(sql, $completion); } function executeQueryAsyncKmp(_this__u8e3s4, $completion) { return _this__u8e3s4.executeQueryAsyncInt_j35d75_k$($completion); } function _get_sqliteJdbcListener__w4lxcg($this) { return $this.sqliteJdbcListener_1; } function NodeEventManagerJs(db, messageCallback, logger, dbName, dispatcher) { dispatcher = dispatcher === VOID ? Dispatchers_getInstance().get_Default_goqax4_k$() : dispatcher; NodeEventManagerCommon.call(this, db, messageCallback, logger, dbName, dispatcher); this.sqliteJdbcListener_1 = new NodeEventJdbcImplListenerSqlite(this.get_hasOutgoingReplicationTable_wjzuwv_k$(), this.get__outgoingEvents_qw2ml7_k$(), false, logger, dbName); (isInterface(db, RoomJdbcImpl) ? db : THROW_CCE()).get_jdbcImplHelper_iauze6_k$().addListener_xad3hi_k$(this.sqliteJdbcListener_1); } protoOf(NodeEventManagerJs).close_yn9xrc_k$ = function () { var tmp = this.get_db_knto1l_k$(); (isInterface(tmp, RoomJdbcImpl) ? tmp : THROW_CCE()).get_jdbcImplHelper_iauze6_k$().removeListener_iok9nb_k$(this.sqliteJdbcListener_1); protoOf(NodeEventManagerCommon).close_yn9xrc_k$.call(this); }; function RoomDatabase$execSQLBatchAsyncJs$slambda($sqlStatements, resultContinuation) { this.$sqlStatements_1 = $sqlStatements; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabase$execSQLBatchAsyncJs$slambda).invoke_tjufio_k$ = function (connection, $completion) { var tmp = this.create_1rn91a_k$(connection, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(RoomDatabase$execSQLBatchAsyncJs$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_tjufio_k$((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabase$execSQLBatchAsyncJs$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$(8); this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_0 = this; tmp_0.this1__1 = this.connection_1.createStatement_cbd7tf_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(7); this.set_exceptionState_fex74n_k$(6); var tmp_1 = this; tmp_1.statement4__1 = this.this1__1; this.set_state_rjd8d0_k$(4); suspendResult = this.statement4__1.executeUpdateAsyncJs_btupiy_k$(joinToString_0(this.$sqlStatements_1, ';'), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.tmp$ret$03__1 = suspendResult; this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(5); var tmp_2 = this; continue $sm; case 5: var tmp_3 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); this.tmp$ret$40__1 = tmp_3; this.set_state_rjd8d0_k$(10); continue $sm; case 6: this.set_exceptionState_fex74n_k$(7); var tmp_4 = this.get_exception_x0n6w6_k$(); if (tmp_4 instanceof Exception) { var e = this.get_exception_x0n6w6_k$(); var tmp_5 = this; throw e; } else { throw this.get_exception_x0n6w6_k$(); } case 7: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.close_yn9xrc_k$(); throw t; case 8: throw this.get_exception_x0n6w6_k$(); case 9: this.set_exceptionState_fex74n_k$(8); this.this1__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(10); continue $sm; case 10: return this.tmp$ret$40__1; } } catch ($p) { var e_0 = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e_0; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e_0); } } while (true); }; protoOf(RoomDatabase$execSQLBatchAsyncJs$slambda).create_1rn91a_k$ = function (connection, completion) { var i = new RoomDatabase$execSQLBatchAsyncJs$slambda(this.$sqlStatements_1, completion); i.connection_1 = connection; return i; }; protoOf(RoomDatabase$execSQLBatchAsyncJs$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_1rn91a_k$((!(value == null) ? isInterface(value, Connection) : false) ? value : THROW_CCE(), completion); }; function RoomDatabase$execSQLBatchAsyncJs$slambda_0($sqlStatements, resultContinuation) { var i = new RoomDatabase$execSQLBatchAsyncJs$slambda($sqlStatements, resultContinuation); var l = function (connection, $completion) { return i.invoke_tjufio_k$(connection, $completion); }; l.$arity = 1; return l; } function $execSQLBatchAsyncJsCOROUTINE$30(_this__u8e3s4, sqlStatements, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.sqlStatements_1 = sqlStatements; } protoOf($execSQLBatchAsyncJsCOROUTINE$30).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); var tmp_0 = this._this__u8e3s4__1; var tmp_1 = (isInterface(tmp_0, RoomJdbcImpl) ? tmp_0 : THROW_CCE()).get_jdbcImplHelper_iauze6_k$(); suspendResult = tmp_1.useConnectionAsync_y1du5w_k$(RoomDatabase$execSQLBatchAsyncJs$slambda_0(this.sqlStatements_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); }; function RoomDatabase() { } protoOf(RoomDatabase).get_invalidationTracker_tp0k9d_k$ = function () { var reason = 'getInvalidationTracker: maybe override this in the generated version'; throw new NotImplementedError('An operation is not implemented: ' + reason); }; protoOf(RoomDatabase).runInTransaction_4l5j4b_k$ = function (runnable) { runnable.run_mvkpxh_k$(); }; protoOf(RoomDatabase).execSQLBatchAsyncJs_63mnbz_k$ = function (sqlStatements, $completion) { var tmp = new $execSQLBatchAsyncJsCOROUTINE$30(this, sqlStatements, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(RoomDatabase).close_yn9xrc_k$ = function () { }; function RoomDatabaseJdbcImplHelper$onClose$lambda() { return 'SQLite/JS Datasource: closing\n'; } function RoomDatabaseJdbcImplHelper$onClose$lambda_0() { return 'SQLite/JS Datasource: closed\n'; } function RoomDatabaseJdbcImplHelper(dataSource, db, dbUrl, dbName, logger, tableNames, invalidationTracker, dbType) { RoomDatabaseJdbcImplHelperCommon.call(this, dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType); } protoOf(RoomDatabaseJdbcImplHelper).setupSqliteTriggersAsync_ncp3ds_k$ = function (_this__u8e3s4, $completion) { return Unit_getInstance(); }; protoOf(RoomDatabaseJdbcImplHelper).useConnection_u6tku8_k$ = function (readOnly, block) { throw IllegalStateException_init_$Create$('useConnection synchronous not supported on JS'); }; protoOf(RoomDatabaseJdbcImplHelper).useConnection_u29dkd_k$ = function (block) { throw IllegalStateException_init_$Create$('useConnection synchronous not supported on JS'); }; protoOf(RoomDatabaseJdbcImplHelper).exportToFile_8am0r0_k$ = function ($completion) { var tmp = this.get_dataSource_vce0e_k$(); return (tmp instanceof SQLiteDatasourceJs ? tmp : THROW_CCE()).exportDatabaseToFile_frmrgx_k$($completion); }; protoOf(RoomDatabaseJdbcImplHelper).onClose_84idtj_k$ = function () { protoOf(RoomDatabaseJdbcImplHelperCommon).onClose_84idtj_k$.call(this); var tmp = this.get_dataSource_vce0e_k$(); if (tmp instanceof SQLiteDatasourceJs) { var tmp_0 = Napier_getInstance(); var tmp_1 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp_0.i$default_3m0r7e_k$(VOID, tmp_1, RoomDatabaseJdbcImplHelper$onClose$lambda); this.get_dataSource_vce0e_k$().close_yn9xrc_k$(); var tmp_2 = Napier_getInstance(); var tmp_3 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp_2.i$default_3m0r7e_k$(VOID, tmp_3, RoomDatabaseJdbcImplHelper$onClose$lambda_0); } }; function onUpgradeNeededThenCreateStores($this, request) { request.onupgradeneeded = IndexedDb$onUpgradeNeededThenCreateStores$lambda; } function IndexedDb$onUpgradeNeededThenCreateStores$lambda(event) { var db = event.target.result; if (!db.objectStoreNames.contains('um_db_store')) { db.createObjectStore('um_db_store'); } if (!db.objectStoreNames.contains('door_attachments')) { db.createObjectStore('door_attachments'); } return Unit_getInstance(); } function IndexedDb$checkIfExists$lambda($checkCompletable) { return function () { return $checkCompletable.completeExceptionally_xyzekf_k$(newThrowable('Error when opening database')); }; } function IndexedDb$checkIfExists$lambda$lambda($checkCompletable) { return function (data) { return $checkCompletable.complete_ixf84q_k$(data.target.result != null); }; } function IndexedDb$checkIfExists$lambda$lambda_0($checkCompletable) { return function () { return $checkCompletable.completeExceptionally_xyzekf_k$(newThrowable('Error when querying for database from um_db_store')); }; } function IndexedDb$checkIfExists$lambda_0($checkCompletable) { return function (event) { var db = event.target.result; var store = db.transaction('um_db_store', 'readwrite').objectStore('um_db_store').get('um_db_key'); store.onsuccess = IndexedDb$checkIfExists$lambda$lambda($checkCompletable); store.onerror = IndexedDb$checkIfExists$lambda$lambda_0($checkCompletable); return Unit_getInstance(); }; } function IndexedDb$storeBlob$lambda$lambda$lambda() { return 'Saved blob to db'; } function IndexedDb$storeBlob$lambda$lambda($completeable) { return function () { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.d$default_iccotn_k$(VOID, tmp_0, IndexedDb$storeBlob$lambda$lambda$lambda); return $completeable.complete_ixf84q_k$(true); }; } function IndexedDb$storeBlob$lambda$lambda$lambda_0() { return 'Failed to save blob'; } function IndexedDb$storeBlob$lambda$lambda_0($completeable) { return function () { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.e$default_s5p7m2_k$(VOID, tmp_0, IndexedDb$storeBlob$lambda$lambda$lambda_0); return $completeable.completeExceptionally_xyzekf_k$(Exception_init_$Create$('storeAttachment exception')); }; } function IndexedDb$storeBlob$lambda($storeName, $blob, $key, $completeable) { return function (event) { var db = event.target.result; var transaction = db.transaction($storeName, 'readwrite'); transaction.oncomplete = IndexedDb$storeBlob$lambda$lambda($completeable); transaction.onerror = IndexedDb$storeBlob$lambda$lambda_0($completeable); var store = transaction.objectStore($storeName); return store.put($blob, $key); }; } function IndexedDb$retrieveBlob$lambda$lambda($completableDeferred) { return function (data) { // Inline function 'kotlin.js.unsafeCast' call var tmp$ret$0 = data.target.result; return $completableDeferred.complete_ixf84q_k$(tmp$ret$0); }; } function IndexedDb$retrieveBlob$lambda$lambda_0($dbName, $storeName, $key, $completableDeferred) { return function () { var errMsg = 'Exception attempting to retrieve blob: db=' + $dbName + '/store=' + $storeName + '/key=' + $key; Napier_getInstance().e$default_pvzj32_k$(errMsg, VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); return $completableDeferred.completeExceptionally_xyzekf_k$(Exception_init_$Create$(errMsg)); }; } function IndexedDb$retrieveBlob$lambda($storeName, $key, $completableDeferred, $dbName) { return function (event) { var db = event.target.result; var store = db.transaction($storeName, 'readwrite').objectStore($storeName).get($key); store.onsuccess = IndexedDb$retrieveBlob$lambda$lambda($completableDeferred); store.onerror = IndexedDb$retrieveBlob$lambda$lambda_0($dbName, $storeName, $key, $completableDeferred); return Unit_getInstance(); }; } function $storeBlobCOROUTINE$31(_this__u8e3s4, dbName, storeName, key, blob, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.dbName_1 = dbName; this.storeName_1 = storeName; this.key_1 = key; this.blob_1 = blob; } protoOf($storeBlobCOROUTINE$31).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.request0__1 = this._this__u8e3s4__1.indexedDb_1.open(this.dbName_1, 2); this.completeable1__1 = CompletableDeferred(); onUpgradeNeededThenCreateStores(this._this__u8e3s4__1, this.request0__1); this.request0__1.onsuccess = IndexedDb$storeBlob$lambda(this.storeName_1, this.blob_1, this.key_1, this.completeable1__1); this.set_state_rjd8d0_k$(1); suspendResult = this.completeable1__1.await_4rdzbx_k$(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); }; function IndexedDb() { IndexedDb_instance = this; this.indexedDb_1 = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; this.DB_STORE_NAME_1 = 'um_db_store'; this.ATTACHMENT_STORE_NAME_1 = 'door_attachments'; this.DB_STORE_KEY_1 = 'um_db_key'; this.DATABASE_VERSION_1 = 2; } protoOf(IndexedDb).checkIfExists_v2er53_k$ = function (dbName, $completion) { var checkCompletable = CompletableDeferred(); var request = this.indexedDb_1.open(dbName, 2); onUpgradeNeededThenCreateStores(this, request); request.onerror = IndexedDb$checkIfExists$lambda(checkCompletable); request.onsuccess = IndexedDb$checkIfExists$lambda_0(checkCompletable); return checkCompletable.await_4rdzbx_k$($completion); }; protoOf(IndexedDb).storeBlob_mz5v13_k$ = function (dbName, storeName, key, blob, $completion) { var tmp = new $storeBlobCOROUTINE$31(this, dbName, storeName, key, blob, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(IndexedDb).retrieveBlob_gcy6ua_k$ = function (dbName, storeName, key, $completion) { var completableDeferred = CompletableDeferred(); var request = this.indexedDb_1.open(dbName, 2); onUpgradeNeededThenCreateStores(this, request); request.onsuccess = IndexedDb$retrieveBlob$lambda(storeName, key, completableDeferred, dbName); return completableDeferred.await_4rdzbx_k$($completion); }; protoOf(IndexedDb).get_indexedDb_4tyfkq_k$ = function () { return this.indexedDb_1; }; protoOf(IndexedDb).get_DB_STORE_NAME_6go0an_k$ = function () { return this.DB_STORE_NAME_1; }; protoOf(IndexedDb).get_ATTACHMENT_STORE_NAME_u2vyc_k$ = function () { return this.ATTACHMENT_STORE_NAME_1; }; protoOf(IndexedDb).get_DB_STORE_KEY_djf1qh_k$ = function () { return this.DB_STORE_KEY_1; }; protoOf(IndexedDb).get_DATABASE_VERSION_zcoczh_k$ = function () { return this.DATABASE_VERSION_1; }; var IndexedDb_instance; function IndexedDb_getInstance() { if (IndexedDb_instance == null) new IndexedDb(); return IndexedDb_instance; } function _set_connectionIdCounter__h29e82($this, _set____db54di) { $this.connectionIdCounter_1 = _set____db54di; } function _get_connectionIdCounter__uczn4e($this) { return $this.connectionIdCounter_1; } function _set_closed__kdb0et_1($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1_1($this) { return $this.closed_1; } function _set_mAutoCommit__y2fg6m($this, _set____db54di) { $this.mAutoCommit_1 = _set____db54di; } function _get_mAutoCommit__3s19uq($this) { return $this.mAutoCommit_1; } function _get_logPrefix__aovpcr_2($this) { return $this.logPrefix_1; } function Companion_22() { Companion_instance_22 = this; this.connectionIdCounter_1 = 1; } var Companion_instance_22; function Companion_getInstance_25() { if (Companion_instance_22 == null) new Companion_22(); return Companion_instance_22; } function SQLiteConnectionJs$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : open'; }; } function SQLiteConnectionJs$close$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' : close'; }; } function $setAutoCommitAsyncCOROUTINE$32(_this__u8e3s4, autoCommit, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.autoCommit_1 = autoCommit; } protoOf($setAutoCommitAsyncCOROUTINE$32).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.autoCommit_1 ? this._this__u8e3s4__1.mAutoCommit_1 : false) { this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.datasource_1.acquireTransactionLock_ufxryl_k$(this._this__u8e3s4__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { if (this.autoCommit_1 ? !this.autoCommit_1 : false) { this._this__u8e3s4__1.datasource_1.releaseTransactionLock_m282pp_k$(this._this__u8e3s4__1); this._this__u8e3s4__1.mAutoCommit_1 = false; this.set_state_rjd8d0_k$(3); continue $sm; } else { this.set_state_rjd8d0_k$(3); continue $sm; } } case 1: this._this__u8e3s4__1.mAutoCommit_1 = false; this.set_state_rjd8d0_k$(2); suspendResult = this._this__u8e3s4__1.datasource_1.sendUpdate$default_3nckq3_k$(this._this__u8e3s4__1, 'BEGIN TRANSACTION', [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } 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); }; function $commitAsyncCOROUTINE$33(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($commitAsyncCOROUTINE$33).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); if (this._this__u8e3s4__1.mAutoCommit_1) throw IllegalStateException_init_$Create$('commitAsync: not in transaction (autoCommit=true) - cannot commit'); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.datasource_1.sendUpdate$default_3nckq3_k$(this._this__u8e3s4__1, 'COMMIT', [], VOID, 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); }; function $rollbackAsyncCOROUTINE$34(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($rollbackAsyncCOROUTINE$34).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.datasource_1.sendUpdate$default_3nckq3_k$(this._this__u8e3s4__1, 'ROLLBACK', [], VOID, 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); }; function SQLiteConnectionJs(datasource) { Companion_getInstance_25(); this.datasource_1 = datasource; this.closed_1 = false; this.mAutoCommit_1 = true; var tmp = this; var tmp0_this = Companion_getInstance_25(); var tmp1 = tmp0_this.connectionIdCounter_1; tmp0_this.connectionIdCounter_1 = tmp1 + 1 | 0; tmp.connectionId_1 = tmp1; this.logPrefix_1 = '[SQLiteConnectionJS #' + this.connectionId_1 + ']'; var tmp_0 = Napier_getInstance(); var tmp_1 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp_0.v$default_i2q2w7_k$(VOID, tmp_1, SQLiteConnectionJs$lambda(this)); } protoOf(SQLiteConnectionJs).get_datasource_g0samm_k$ = function () { return this.datasource_1; }; protoOf(SQLiteConnectionJs).get_connectionId_yokwf2_k$ = function () { return this.connectionId_1; }; protoOf(SQLiteConnectionJs).setAutoCommit_yh8u8d_k$ = function (commit) { }; protoOf(SQLiteConnectionJs).getAutoCommit_iwnrr8_k$ = function () { return this.mAutoCommit_1; }; protoOf(SQLiteConnectionJs).setAutoCommitAsync_dpyye2_k$ = function (autoCommit, $completion) { var tmp = new $setAutoCommitAsyncCOROUTINE$32(this, autoCommit, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteConnectionJs).commitAsync_wepez2_k$ = function ($completion) { var tmp = new $commitAsyncCOROUTINE$33(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteConnectionJs).rollbackAsync_usrhnj_k$ = function ($completion) { var tmp = new $rollbackAsyncCOROUTINE$34(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteConnectionJs).prepareStatement_f6j8eq_k$ = function (sql) { return new SQLitePreparedStatementJs(this, sql); }; protoOf(SQLiteConnectionJs).prepareStatement_w7z552_k$ = function (sql, autoGeneratedKeys) { return new SQLitePreparedStatementJs(this, sql, autoGeneratedKeys); }; protoOf(SQLiteConnectionJs).createStatement_cbd7tf_k$ = function () { return new SQLiteStatementJs(this); }; protoOf(SQLiteConnectionJs).commit_vpt10n_k$ = function () { }; protoOf(SQLiteConnectionJs).rollback_r7r9ck_k$ = function () { }; protoOf(SQLiteConnectionJs).close_yn9xrc_k$ = function () { var tmp = Napier_getInstance(); var tmp_0 = Companion_getInstance_13().get_LOG_TAG_it8mba_k$(); tmp.v$default_i2q2w7_k$(VOID, tmp_0, SQLiteConnectionJs$close$lambda(this)); if (!this.mAutoCommit_1) { this.datasource_1.releaseTransactionLock_m282pp_k$(this); } this.closed_1 = true; }; protoOf(SQLiteConnectionJs).isClosed_baxhhm_k$ = function () { return this.closed_1; }; protoOf(SQLiteConnectionJs).createArrayOf_8kbkpw_k$ = function (arrayType, objects) { throw new SQLException('Array not supported on SQLite', null); }; protoOf(SQLiteConnectionJs).getMetaData_qwn0zp_k$ = function () { return new SQLiteDatabaseMetadataJs(this.datasource_1); }; function $getTablesAsyncCOROUTINE$35(_this__u8e3s4, catalog, schemaPattern, tableNamePattern, types, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.catalog_1 = catalog; this.schemaPattern_1 = schemaPattern; this.tableNamePattern_1 = tableNamePattern; this.types_1 = types; } protoOf($getTablesAsyncCOROUTINE$35).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$(9); this.tblNamePattern0__1 = (this.tableNamePattern_1 == null ? true : '' === this.tableNamePattern_1) ? '%' : Companion_getInstance_1().escape_984trb_k$(this.tableNamePattern_1); this.sql1__1 = trimIndent("\n SELECT NULL AS TABLE_CAT,\n NULL AS TABLE_SCHEM,\n NAME AS TABLE_NAME,\n TYPE AS TABLE_TYPE,\n NULL AS REMARKS,\n NULL AS TYPE_CAT,\n NULL AS TYPE_SCHEM,\n NULL AS TYPE_NAME,\n NULL AS SELF_REFERENCING_COL_NAME,\n NULL AS REF_GENERATION \n FROM \n (SELECT NAME,\n UPPER(TYPE) AS TYPE \n FROM sqlite_master\n WHERE NAME NOT LIKE 'sqlite\\_%' ESCAPE '\\'\n AND UPPER(TYPE) IN ('TABLE', 'VIEW') \n UNION ALL\n SELECT NAME, 'GLOBAL TEMPORARY' AS TYPE\n FROM sqlite_temp_master\n UNION ALL \n SELECT NAME,'SYSTEM TABLE' AS TYPE\n FROM sqlite_master\n WHERE NAME LIKE 'sqlite\\_%' ESCAPE '\\') \n WHERE TABLE_NAME LIKE '" + this.tblNamePattern0__1 + "' AND TABLE_TYPE IN (\n "); if (this.types_1.length === 0) { this.sql1__1 = this.sql1__1 + "'TABLE','VIEW'"; } else { var tmp_0 = this; var tmp_1 = this.sql1__1; tmp_0.sql1__1 = tmp_1 + ("'" + this.types_1[0].toUpperCase() + "'"); var inductionVariable = 1; var last = this.types_1.length; if (inductionVariable < last) do { var i = inductionVariable; inductionVariable = inductionVariable + 1 | 0; var tmp_2 = this; var tmp_3 = this.sql1__1; tmp_2.sql1__1 = tmp_3 + (",'" + this.types_1[i].toUpperCase() + "'"); } while (inductionVariable < last); } this.sql1__1 = this.sql1__1 + ') ORDER BY TABLE_TYPE, TABLE_NAME'; this.set_state_rjd8d0_k$(1); continue $sm; case 1: var tmp_4 = this; tmp_4.this3__1 = this._this__u8e3s4__1.datasource_1.getConnection_hr2oto_k$(); this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_state_rjd8d0_k$(3); continue $sm; case 3: this.set_exceptionState_fex74n_k$(8); var tmp_5 = this; tmp_5.it6__1 = this.this3__1; this.set_state_rjd8d0_k$(4); suspendResult = this._this__u8e3s4__1.datasource_1.sendQuery$default_czcv91_k$(this.it6__1, this.sql1__1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.tmp$ret$05__1 = suspendResult; this.set_exceptionState_fex74n_k$(9); this.set_state_rjd8d0_k$(5); var tmp_6 = this; continue $sm; case 5: var tmp_7 = this.tmp$ret$05__1; this.set_exceptionState_fex74n_k$(9); this.this3__1.close_yn9xrc_k$(); this.tmp$ret$42__1 = tmp_7; this.set_state_rjd8d0_k$(7); continue $sm; case 6: this.set_exceptionState_fex74n_k$(9); this.this3__1.close_yn9xrc_k$(); if (false) { this.set_state_rjd8d0_k$(1); continue $sm; } this.set_state_rjd8d0_k$(7); continue $sm; case 7: return this.tmp$ret$42__1; case 8: this.set_exceptionState_fex74n_k$(9); var t = this.get_exception_x0n6w6_k$(); this.this3__1.close_yn9xrc_k$(); throw t; case 9: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 9) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function SQLiteDatabaseMetadataJs(datasource) { this.datasource_1 = datasource; } protoOf(SQLiteDatabaseMetadataJs).get_datasource_g0samm_k$ = function () { return this.datasource_1; }; protoOf(SQLiteDatabaseMetadataJs).getTables_eub13u_k$ = function (catalog, schemaPattern, tableNamePattern, types) { throw Exception_init_$Create$('getTables: This can not be used on JS, only for JVM. Call getTablesAsync instead'); }; protoOf(SQLiteDatabaseMetadataJs).getDatabaseProductName_re6tex_k$ = function () { return 'SQLite'; }; protoOf(SQLiteDatabaseMetadataJs).getTablesAsync_5l8i8x_k$ = function (catalog, schemaPattern, tableNamePattern, types, $completion) { var tmp = new $getTablesAsyncCOROUTINE$35(this, catalog, schemaPattern, tableNamePattern, types, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; function SQLiteDatasourceJs$sendQuery$slambda$lambda(this$0, $sql, $params) { return function () { var tmp0_safe_receiver = $params; return this$0.logPrefix_1 + ' sending query: ' + $sql + ' params=' + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver)); }; } function SQLiteDatasourceJs$sendQuery$slambda$lambda_0(this$0, $sql, $params, $sqliteResultSet) { return function () { var tmp0_safe_receiver = $params; return this$0.logPrefix_1 + " Got result: Ran: '" + $sql + "' params=" + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver)) + ' result = ' + $sqliteResultSet + '\n'; }; } function SQLiteDatasourceJs$sendUpdate$slambda$lambda(this$0, $sql, $params) { return function () { var tmp0_safe_receiver = $params; return this$0.logPrefix_1 + " sending update: '" + $sql + "', params=" + (tmp0_safe_receiver == null ? null : joinToString_0(tmp0_safe_receiver)) + '\n'; }; } function SQLiteDatasourceJs$sendUpdate$slambda$lambda_0(this$0, $sql) { return function () { return this$0.logPrefix_1 + " update done: '" + $sql + "'"; }; } function _get_dbName__9h2wvy_1($this) { return $this.dbName_1; } function _get_worker__80fttf($this) { return $this.worker_1; } function _get_logger__rkp4sl_1($this) { return $this.logger_1; } function _get_logWorkerMessages__dd7y9p($this) { return $this.logWorkerMessages_1; } function _get_pendingMessages__vzrhim($this) { return $this.pendingMessages_1; } function _get_executedSqlQueries__ngh8os($this) { return $this.executedSqlQueries_1; } function _get_transactionMutex__k4c6ui($this) { return $this.transactionMutex_1; } function _get_logPrefix__aovpcr_3($this) { return $this.logPrefix_1; } function _set_closed__kdb0et_2($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1_2($this) { return $this.closed_1; } function _get_scope__bi2zur_1($this) { return $this.scope_1; } function assertNotClosed($this) { if ($this.closed_1) throw IllegalStateException_init_$Create$('SQLiteDataSourceJs is closed!'); } function sendMessage($this, message, $completion) { var tmp = new $sendMessageCOROUTINE$36($this, message, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function makeMessage($this, sql, params) { return json([to('action', 'exec'), to('sql', sql), to('params', params), to('config', json([to('useBigInt', true)]))]); } function makeMessage$default($this, sql, params, $super) { var tmp; if (params === VOID) { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp = []; } else { tmp = params; } params = tmp; return makeMessage($this, sql, params); } function withTransactionLock($this, connection, block, $completion) { var tmp = new $withTransactionLockCOROUTINE$37($this, connection, block, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); } function Companion_23() { Companion_instance_23 = this; this.idCounter_1 = 0; this.PROTOCOL_SQLITE_PREFIX_1 = 'sqlite:'; this.LOCATION_MEMORY_1 = ':memory:'; } protoOf(Companion_23).set_idCounter_3tyq84_k$ = function (_set____db54di) { this.idCounter_1 = _set____db54di; }; protoOf(Companion_23).get_idCounter_8lwzw8_k$ = function () { return this.idCounter_1; }; protoOf(Companion_23).get_PROTOCOL_SQLITE_PREFIX_pl3y1_k$ = function () { return this.PROTOCOL_SQLITE_PREFIX_1; }; protoOf(Companion_23).get_LOCATION_MEMORY_rxk7vm_k$ = function () { return this.LOCATION_MEMORY_1; }; var Companion_instance_23; function Companion_getInstance_26() { if (Companion_instance_23 == null) new Companion_23(); return Companion_instance_23; } function SQLiteDatasourceJs$lambda(this$0) { return function (dbEvent) { var actionId = toInt(toString(dbEvent.data['id'])); var executedQuery = this$0.executedSqlQueries_1.remove_gppy8k_k$(actionId); var pendingCompletable = this$0.pendingMessages_1.remove_gppy8k_k$(actionId); var tmp; if (!(pendingCompletable == null)) { if (dbEvent.data['error'] != undefined) { var exception = new SQLException(toString(dbEvent.data['error']), Exception_init_$Create$('Error occurred when executing ' + executedQuery)); pendingCompletable.completeExceptionally_xyzekf_k$(exception); } var executedSuccessfully = dbEvent.data['ready'] == (undefined && dbEvent.data['results'] != undefined) ? true : dbEvent.data['ready']; var tmp_0; if (dbEvent.data['results'] != undefined) { tmp_0 = dbEvent.data['results']; } else { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp_0 = []; } var results = tmp_0; var buffer = dbEvent.data['buffer'] != undefined ? dbEvent.data['buffer'] : null; pendingCompletable.complete_ixf84q_k$(new WorkerResult(dbEvent.data['id'], results, executedSuccessfully, buffer)); tmp = Unit_getInstance(); } return Unit_getInstance(); }; } function SQLiteDatasourceJs$sendMessage$lambda(this$0, $actionId, $message) { return function () { return this$0.logPrefix_1 + ' sendMessage #' + $actionId + ' - sending action=' + toString_0($message['action']) + ' \n'; }; } function SQLiteDatasourceJs$sendMessage$lambda_0(this$0, $actionId) { return function () { return this$0.logPrefix_1 + ' sendMessage #' + $actionId + ' - got result \n'; }; } function SQLiteDatasourceJs$sendQuery$slambda(this$0, $sql, $params, resultContinuation) { this.this$0__1 = this$0; this.$sql_1 = $sql; this.$params_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$sendQuery$slambda).invoke_56nrne_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(SQLiteDatasourceJs$sendQuery$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_56nrne_k$($completion); }; protoOf(SQLiteDatasourceJs$sendQuery$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 this_0 = this.this$0__1.logger_1; var tmp_0; if (this.this$0__1.logWorkerMessages_1) { tmp_0 = this_0; } else { tmp_0 = null; } var tmp0_safe_receiver = tmp_0; if (tmp0_safe_receiver == null) null; else { v(tmp0_safe_receiver, VOID, SQLiteDatasourceJs$sendQuery$slambda$lambda(this.this$0__1, this.$sql_1, this.$params_1)); } this.set_state_rjd8d0_k$(1); suspendResult = sendMessage(this.this$0__1, makeMessage(this.this$0__1, this.$sql_1, this.$params_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; var results = ARGUMENT.get_results_jf06j1_k$(); var tmp_1; if (results == null) { tmp_1 = null; } else { tmp_1 = new SQLiteResultSet(results); } var tmp2_elvis_lhs = tmp_1; var tmp_2; if (tmp2_elvis_lhs == null) { var this_1 = []; tmp_2 = new SQLiteResultSet(this_1); } else { tmp_2 = tmp2_elvis_lhs; } var sqliteResultSet = tmp_2; var this_2 = this.this$0__1.logger_1; var tmp_3; if (this.this$0__1.logWorkerMessages_1) { tmp_3 = this_2; } else { tmp_3 = null; } var tmp3_safe_receiver = tmp_3; if (tmp3_safe_receiver == null) null; else { v(tmp3_safe_receiver, VOID, SQLiteDatasourceJs$sendQuery$slambda$lambda_0(this.this$0__1, this.$sql_1, this.$params_1, sqliteResultSet)); } return sqliteResultSet; 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(SQLiteDatasourceJs$sendQuery$slambda).create_d196fn_k$ = function (completion) { return new SQLiteDatasourceJs$sendQuery$slambda(this.this$0__1, this.$sql_1, this.$params_1, completion); }; function SQLiteDatasourceJs$sendQuery$slambda_0(this$0, $sql, $params, resultContinuation) { var i = new SQLiteDatasourceJs$sendQuery$slambda(this$0, $sql, $params, resultContinuation); var l = function ($completion) { return i.invoke_56nrne_k$($completion); }; l.$arity = 0; return l; } function SQLiteDatasourceJs$sendUpdate$slambda(this$0, $sql, $params, $returnGeneratedKey, resultContinuation) { this.this$0__1 = this$0; this.$sql_1 = $sql; this.$params_1 = $params; this.$returnGeneratedKey_1 = $returnGeneratedKey; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$sendUpdate$slambda).invoke_z6umen_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(SQLiteDatasourceJs$sendUpdate$slambda).invoke_ib42db_k$ = function ($completion) { return this.invoke_z6umen_k$($completion); }; protoOf(SQLiteDatasourceJs$sendUpdate$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 this_0 = this.this$0__1.logger_1; var tmp_0; if (this.this$0__1.logWorkerMessages_1) { tmp_0 = this_0; } else { tmp_0 = null; } var tmp0_safe_receiver = tmp_0; if (tmp0_safe_receiver == null) null; else { v(tmp0_safe_receiver, VOID, SQLiteDatasourceJs$sendUpdate$slambda$lambda(this.this$0__1, this.$sql_1, this.$params_1)); } this.set_state_rjd8d0_k$(1); suspendResult = sendMessage(this.this$0__1, makeMessage(this.this$0__1, this.$sql_1, this.$params_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: if (this.$returnGeneratedKey_1) { this.set_state_rjd8d0_k$(2); suspendResult = sendMessage(this.this$0__1, makeMessage$default(this.this$0__1, 'SELECT last_insert_rowid()'), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_1 = this; tmp_1.WHEN_RESULT0__1 = null; this.set_state_rjd8d0_k$(3); continue $sm; } case 2: var ARGUMENT = suspendResult; var tmp1_safe_receiver = ARGUMENT.get_results_jf06j1_k$(); var tmp_2 = this; var tmp_3; if (tmp1_safe_receiver == null) { tmp_3 = null; } else { tmp_3 = new SQLiteResultSet(tmp1_safe_receiver); } tmp_2.WHEN_RESULT0__1 = tmp_3; this.set_state_rjd8d0_k$(3); continue $sm; case 3: var generatedKey = this.WHEN_RESULT0__1; var this_1 = this.this$0__1.logger_1; var tmp_4; if (this.this$0__1.logWorkerMessages_1) { tmp_4 = this_1; } else { tmp_4 = null; } var tmp2_safe_receiver = tmp_4; if (tmp2_safe_receiver == null) null; else { v(tmp2_safe_receiver, VOID, SQLiteDatasourceJs$sendUpdate$slambda$lambda_0(this.this$0__1, this.$sql_1)); } return new UpdateResult(1, generatedKey); 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(SQLiteDatasourceJs$sendUpdate$slambda).create_d196fn_k$ = function (completion) { return new SQLiteDatasourceJs$sendUpdate$slambda(this.this$0__1, this.$sql_1, this.$params_1, this.$returnGeneratedKey_1, completion); }; function SQLiteDatasourceJs$sendUpdate$slambda_0(this$0, $sql, $params, $returnGeneratedKey, resultContinuation) { var i = new SQLiteDatasourceJs$sendUpdate$slambda(this$0, $sql, $params, $returnGeneratedKey, resultContinuation); var l = function ($completion) { return i.invoke_z6umen_k$($completion); }; l.$arity = 0; return l; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this$0, $data, $exportCompletable, resultContinuation) { this.this$0__1 = this$0; this.$data_1 = $data; this.$exportCompletable_1 = $exportCompletable; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$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(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).invoke_qns8j1_k$ = function (p1, $completion) { return this.invoke_d9fzmj_k$((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$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 = sendMessage(this.this$0__1, json([to('action', 'open'), to('buffer', this.$data_1.target.result)]), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; this.$exportCompletable_1.complete_ixf84q_k$(result.get_ready_ixwjga_k$()); 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(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).create_rcuf4x_k$ = function ($this$launch, completion) { var i = new SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this.this$0__1, this.$data_1, this.$exportCompletable_1, completion); i.$this$launch_1 = $this$launch; return i; }; protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).create_wyq9v6_k$ = function (value, completion) { return this.create_rcuf4x_k$((!(value == null) ? isInterface(value, CoroutineScope) : false) ? value : THROW_CCE(), completion); }; function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda_0(this$0, $data, $exportCompletable, resultContinuation) { var i = new SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this$0, $data, $exportCompletable, resultContinuation); var l = function ($this$launch, $completion) { return i.invoke_d9fzmj_k$($this$launch, $completion); }; l.$arity = 1; return l; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable) { return function (data) { var tmp = GlobalScope_getInstance(); return launch(tmp, VOID, VOID, SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda_0(this$0, data, $exportCompletable, null)); }; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda_0($exportCompletable) { return function () { return $exportCompletable.completeExceptionally_xyzekf_k$(newThrowable('Error when executing store data fetch')); }; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this$0, $exportCompletable) { return function (event) { var db = event.target.result; var store = db.transaction(IndexedDb_getInstance().get_DB_STORE_NAME_6go0an_k$(), 'readwrite').objectStore(IndexedDb_getInstance().get_DB_STORE_NAME_6go0an_k$()).get(IndexedDb_getInstance().get_DB_STORE_KEY_djf1qh_k$()); store.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable); store.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda_0($exportCompletable); return Unit_getInstance(); }; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0($exportCompletable) { return function () { return $exportCompletable.completeExceptionally_xyzekf_k$(newThrowable('Error when importing database from IndexedDb to SQLite DB')); }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this$0) { return function () { return this$0.logPrefix_1 + ' SQLiteDataSource/JS: saving to indexed db'; }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable) { return function () { i(this$0.logger_1, this$0.logPrefix_1 + ' Saved to IndexedDb: ' + this$0.dbName_1); return $exportCompletable.complete_ixf84q_k$(true); }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable) { return function () { return $exportCompletable.completeExceptionally_xyzekf_k$(newThrowable('Error when importing SQLJs database to IndexedDb')); }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda_0($result, this$0, $exportCompletable) { return function (event) { var db = event.target.result; var transaction = db.transaction(IndexedDb_getInstance().get_DB_STORE_NAME_6go0an_k$(), 'readwrite'); transaction.oncomplete = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable); transaction.onerror = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable); var store = transaction.objectStore(IndexedDb_getInstance().get_DB_STORE_NAME_6go0an_k$()); return store.put($result.get_buffer_bmaafd_k$(), IndexedDb_getInstance().get_DB_STORE_KEY_djf1qh_k$()); }; } function $sendMessageCOROUTINE$36(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.message_1 = message; } protoOf($sendMessageCOROUTINE$36).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); assertNotClosed(this._this__u8e3s4__1); this.completable0__1 = CompletableDeferred(); var tmp_0 = this; var tmp0_this = Companion_getInstance_26(); tmp0_this.idCounter_1 = tmp0_this.idCounter_1 + 1 | 0; tmp_0.actionId1__1 = tmp0_this.idCounter_1; var this_0 = this._this__u8e3s4__1.logger_1; var tmp_1; if (this._this__u8e3s4__1.logWorkerMessages_1) { tmp_1 = this_0; } else { tmp_1 = null; } var tmp1_safe_receiver = tmp_1; if (tmp1_safe_receiver == null) null; else { v(tmp1_safe_receiver, VOID, SQLiteDatasourceJs$sendMessage$lambda(this._this__u8e3s4__1, this.actionId1__1, this.message_1)); } var this_1 = this._this__u8e3s4__1.pendingMessages_1; var key = this.actionId1__1; var value = this.completable0__1; this_1.put_4fpzoq_k$(key, value); var this_2 = this._this__u8e3s4__1.executedSqlQueries_1; var key_0 = this.actionId1__1; var value_0 = toString_0(this.message_1['sql']); this_2.put_4fpzoq_k$(key_0, value_0); this.message_1['id'] = this.actionId1__1; this._this__u8e3s4__1.worker_1.postMessage(this.message_1); this.set_state_rjd8d0_k$(1); suspendResult = this.completable0__1.await_4rdzbx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; var this_3 = this._this__u8e3s4__1.logger_1; var tmp_2; if (this._this__u8e3s4__1.logWorkerMessages_1) { tmp_2 = this_3; } else { tmp_2 = null; } var tmp2_safe_receiver = tmp_2; if (tmp2_safe_receiver == null) null; else { v(tmp2_safe_receiver, VOID, SQLiteDatasourceJs$sendMessage$lambda_0(this._this__u8e3s4__1, this.actionId1__1)); } return result; 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 $withTransactionLockCOROUTINE$37(_this__u8e3s4, connection, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.connection_1 = connection; this.block_1 = block; } protoOf($withTransactionLockCOROUTINE$37).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$(8); if (this._this__u8e3s4__1.transactionMutex_1.holdsLock_9pqa81_k$(this.connection_1)) { this.set_state_rjd8d0_k$(6); suspendResult = this.block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.transactionMutex_1; var tmp_1 = this; tmp_1.owner2__1 = this.connection_1; this.set_state_rjd8d0_k$(1); suspendResult = this.this1__1.lock_ugrcvf_k$(this.owner2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(3); suspendResult = this.block_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.tmp$ret$03__1 = suspendResult; this.set_exceptionState_fex74n_k$(8); this.set_state_rjd8d0_k$(4); continue $sm; case 4: var tmp_2 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(8); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); this.WHEN_RESULT0__1 = tmp_2; this.set_state_rjd8d0_k$(7); continue $sm; case 5: this.set_exceptionState_fex74n_k$(8); var t = this.get_exception_x0n6w6_k$(); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); throw t; case 6: this.WHEN_RESULT0__1 = suspendResult; this.set_state_rjd8d0_k$(7); continue $sm; case 7: return this.WHEN_RESULT0__1; case 8: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 8) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $exportDatabaseToFileCOROUTINE$38(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($exportDatabaseToFileCOROUTINE$38).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); var tmp_0 = this; tmp_0.this0__1 = this._this__u8e3s4__1.transactionMutex_1; var tmp_1 = this; tmp_1.owner1__1 = null; this.set_state_rjd8d0_k$(1); suspendResult = this.this0__1.lock_ugrcvf_k$(this.owner1__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(5); this.set_state_rjd8d0_k$(3); suspendResult = sendMessage(this._this__u8e3s4__1, json([to('action', 'export')]), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: var result = suspendResult; var tmp0_elvis_lhs = result.get_buffer_bmaafd_k$(); var tmp_2; if (tmp0_elvis_lhs == null) { throw IllegalStateException_init_$Create$('no result buffer'); } else { tmp_2 = tmp0_elvis_lhs; } var typedArray = tmp_2; var this_0 = [typedArray.buffer]; var blob = new Blob(this_0); var tmp_3 = document.createElement('a'); var link = tmp_3 instanceof HTMLAnchorElement ? tmp_3 : THROW_CCE(); var tmp1_safe_receiver = document.body; if (tmp1_safe_receiver == null) null; else tmp1_safe_receiver.appendChild(link); link.href = URL.createObjectURL(blob); link.download = this._this__u8e3s4__1.dbName_1 + '.db'; var tmp_4 = this; link.click(); tmp_4.tmp$ret$02__1 = Unit_getInstance(); this.set_exceptionState_fex74n_k$(6); this.set_state_rjd8d0_k$(4); continue $sm; case 4: this.set_exceptionState_fex74n_k$(6); this.this0__1.unlock_ulcrcl_k$(this.owner1__1); return Unit_getInstance(); case 5: this.set_exceptionState_fex74n_k$(6); var t = this.get_exception_x0n6w6_k$(); this.this0__1.unlock_ulcrcl_k$(this.owner1__1); throw t; case 6: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 6) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function $saveDatabaseToIndexedDbCOROUTINE$39(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($saveDatabaseToIndexedDbCOROUTINE$39).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$(7); this.exportCompletable0__1 = CompletableDeferred(); var tmp_0 = this; tmp_0.this1__1 = this._this__u8e3s4__1.transactionMutex_1; var tmp_1 = this; tmp_1.owner2__1 = this._this__u8e3s4__1; this.set_state_rjd8d0_k$(1); suspendResult = this.this1__1.lock_ugrcvf_k$(this.owner2__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.set_state_rjd8d0_k$(2); continue $sm; case 2: this.set_exceptionState_fex74n_k$(6); d_0(this._this__u8e3s4__1.logger_1, VOID, SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this._this__u8e3s4__1)); this.set_state_rjd8d0_k$(3); suspendResult = sendMessage(this._this__u8e3s4__1, json([to('action', 'export')]), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.result4__1 = suspendResult; this.request5__1 = IndexedDb_getInstance().get_indexedDb_4tyfkq_k$().open(this._this__u8e3s4__1.dbName_1, IndexedDb_getInstance().get_DATABASE_VERSION_zcoczh_k$()); this.request5__1.onsuccess = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda_0(this.result4__1, this._this__u8e3s4__1, this.exportCompletable0__1); this.set_state_rjd8d0_k$(4); suspendResult = this.exportCompletable0__1.await_4rdzbx_k$(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var this_0 = suspendResult; d(this._this__u8e3s4__1.logger_1, this._this__u8e3s4__1.logPrefix_1 + ' SQLiteDataSource/JS: saving to indexed db complete'); this.tmp$ret$03__1 = this_0; this.set_exceptionState_fex74n_k$(7); this.set_state_rjd8d0_k$(5); continue $sm; case 5: var tmp_2 = this.tmp$ret$03__1; this.set_exceptionState_fex74n_k$(7); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); return tmp_2; case 6: this.set_exceptionState_fex74n_k$(7); var t = this.get_exception_x0n6w6_k$(); this.this1__1.unlock_ulcrcl_k$(this.owner2__1); throw t; case 7: throw this.get_exception_x0n6w6_k$(); } } catch ($p) { var e = $p; if (this.get_exceptionState_wflpxn_k$() === 7) { throw e; } else { this.set_state_rjd8d0_k$(this.get_exceptionState_wflpxn_k$()); this.set_exception_px07aa_k$(e); } } while (true); }; function SQLiteDatasourceJs(dbName, worker, logger, logWorkerMessages) { Companion_getInstance_26(); logWorkerMessages = logWorkerMessages === VOID ? false : logWorkerMessages; this.dbName_1 = dbName; this.worker_1 = worker; this.logger_1 = logger; this.logWorkerMessages_1 = logWorkerMessages; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.pendingMessages_1 = LinkedHashMap_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_0.executedSqlQueries_1 = LinkedHashMap_init_$Create$(); this.transactionMutex_1 = Mutex(); this.logPrefix_1 = '[SQLiteDataSourceJs - ' + this.dbName_1 + ']'; this.closed_1 = false; this.scope_1 = CoroutineScope_0(Dispatchers_getInstance().get_Default_goqax4_k$().plus_s13ygv_k$(Job())); this.worker_1.onmessage = SQLiteDatasourceJs$lambda(this); } protoOf(SQLiteDatasourceJs).acquireTransactionLock_ufxryl_k$ = function (connection, $completion) { return this.transactionMutex_1.lock_ugrcvf_k$(connection, $completion); }; protoOf(SQLiteDatasourceJs).releaseTransactionLock_m282pp_k$ = function (connection) { this.transactionMutex_1.unlock_ulcrcl_k$(connection); }; protoOf(SQLiteDatasourceJs).sendQuery_yu5wbz_k$ = function (connection, sql, params, $completion) { return withTransactionLock(this, connection, SQLiteDatasourceJs$sendQuery$slambda_0(this, sql, params, null), $completion); }; protoOf(SQLiteDatasourceJs).sendQuery$default_czcv91_k$ = function (connection, sql, params, $completion, $super) { params = params === VOID ? null : params; return $super === VOID ? this.sendQuery_yu5wbz_k$(connection, sql, params, $completion) : $super.sendQuery_yu5wbz_k$.call(this, connection, sql, params, $completion); }; protoOf(SQLiteDatasourceJs).sendUpdate_kjt5mx_k$ = function (connection, sql, params, returnGeneratedKey, $completion) { return withTransactionLock(this, connection, SQLiteDatasourceJs$sendUpdate$slambda_0(this, sql, params, returnGeneratedKey, null), $completion); }; protoOf(SQLiteDatasourceJs).sendUpdate$default_3nckq3_k$ = function (connection, sql, params, returnGeneratedKey, $completion, $super) { returnGeneratedKey = returnGeneratedKey === VOID ? false : returnGeneratedKey; return $super === VOID ? this.sendUpdate_kjt5mx_k$(connection, sql, params, returnGeneratedKey, $completion) : $super.sendUpdate_kjt5mx_k$.call(this, connection, sql, params, returnGeneratedKey, $completion); }; protoOf(SQLiteDatasourceJs).loadDbFromIndexedDb_tcxnl_k$ = function ($completion) { var exportCompletable = CompletableDeferred(); var request = IndexedDb_getInstance().get_indexedDb_4tyfkq_k$().open(this.dbName_1, IndexedDb_getInstance().get_DATABASE_VERSION_zcoczh_k$()); request.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this, exportCompletable); request.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0(exportCompletable); return exportCompletable.await_4rdzbx_k$($completion); }; protoOf(SQLiteDatasourceJs).exportDatabaseToFile_frmrgx_k$ = function ($completion) { var tmp = new $exportDatabaseToFileCOROUTINE$38(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteDatasourceJs).saveDatabaseToIndexedDb_xd3smc_k$ = function ($completion) { var tmp = new $saveDatabaseToIndexedDbCOROUTINE$39(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteDatasourceJs).getConnection_hr2oto_k$ = function () { assertNotClosed(this); return new SQLiteConnectionJs(this); }; protoOf(SQLiteDatasourceJs).close_yn9xrc_k$ = function () { d(this.logger_1, this.logPrefix_1 + ' close - terminating worker\n'); this.worker_1.terminate(); cancel_0(this.scope_1); this.closed_1 = true; i(this.logger_1, this.logPrefix_1 + ' close - worker terminated, closed\n'); }; function _get_sql__e6gtqb($this) { return $this.sql_1; } function _get_params__oo7d51($this) { return $this.params_1; } function $executeUpdateAsyncCOROUTINE$40(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; } protoOf($executeUpdateAsyncCOROUTINE$40).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.generateKeys0__1 = this._this__u8e3s4__1.get_autoGeneratedKeys_yzw64r_k$() === StatementConstantsKmp_getInstance().get_RETURN_GENERATED_KEYS_s33sei_k$(); this.set_state_rjd8d0_k$(1); suspendResult = this._this__u8e3s4__1.get_connection_x01z89_k$().get_datasource_g0samm_k$().sendUpdate_kjt5mx_k$(this._this__u8e3s4__1.get_connection_x01z89_k$(), this._this__u8e3s4__1.sql_1, this._this__u8e3s4__1.params_1, this.generateKeys0__1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; this._this__u8e3s4__1.set_lastGeneratedKey_qi9x5k_k$(result.get_autoGeneratedKey_5pm7ag_k$()); return 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 SQLitePreparedStatementJs(connection, sql, autoGeneratedKeys) { autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_getInstance().get_NO_GENERATED_KEYS_h4ycm1_k$() : autoGeneratedKeys; SQLiteStatementJs.call(this, connection, autoGeneratedKeys); this.sql_1 = sql; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.params_1 = []; } protoOf(SQLitePreparedStatementJs).executeQueryAsyncInt_j35d75_k$ = function ($completion) { return this.get_connection_x01z89_k$().get_datasource_g0samm_k$().sendQuery_yu5wbz_k$(this.get_connection_x01z89_k$(), this.sql_1, this.params_1, $completion); }; protoOf(SQLitePreparedStatementJs).setBoolean_pzdm1v_k$ = function (index, value) { this.params_1[index - 1 | 0] = value ? 1 : 0; }; protoOf(SQLitePreparedStatementJs).setByte_o65f22_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setShort_mhpatm_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setString_2gt7ua_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setBytes_hpy65b_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setDate_ytyjt6_k$ = function (index, value) { throw new SQLException('This is currently not supported', null); }; protoOf(SQLitePreparedStatementJs).setTime_3vnst7_k$ = function (index, value) { throw new SQLException('This is currently not supported', null); }; protoOf(SQLitePreparedStatementJs).setObject_9i2mag_k$ = function (index, value) { if (value == null) { this.params_1[index - 1 | 0] = null; } else { if (!(value == null) ? typeof value === 'boolean' : false) { this.setBoolean_pzdm1v_k$(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.setByte_o65f22_k$(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.setShort_mhpatm_k$(index, value); } else { if (!(value == null) ? typeof value === 'string' : false) { this.setString_2gt7ua_k$(index, value); } else { if (!(value == null) ? isByteArray(value) : false) { this.setBytes_hpy65b_k$(index, value); } else { if (value instanceof Long) { this.setLong_j1sybo_k$(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.setInt_c72a8z_k$(index, value); } } } } } } } } }; protoOf(SQLitePreparedStatementJs).setNull_24rkav_k$ = function (parameterIndex, sqlType) { this.params_1[parameterIndex - 1 | 0] = null; }; protoOf(SQLitePreparedStatementJs).setArray_61y2p9_k$ = function (index, array) { throw new SQLException('SQLite does not support arrays', null); }; protoOf(SQLitePreparedStatementJs).setInt_c72a8z_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setLong_j1sybo_k$ = function (index, value) { var tmp = index - 1 | 0; var tmp_0; // Inline function 'kotlin.ranges.contains' call var this_0 = numberRangeToNumber(0, 1); if (contains(isInterface(this_0, ClosedRange) ? this_0 : THROW_CCE(), value)) { tmp_0 = eval('Number(' + value.toString() + ')'); } else { tmp_0 = eval(value.toString() + 'n'); } this.params_1[tmp] = tmp_0; }; protoOf(SQLitePreparedStatementJs).setFloat_dia6lm_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setDouble_gsfx69_k$ = function (index, value) { this.params_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).setBigDecimal_lq0top_k$ = function (index, value) { throw new SQLException('This is currently not supported', null); }; protoOf(SQLitePreparedStatementJs).executeUpdate_fapcbi_k$ = function () { throw Exception_init_$Create$('executeUpdate: (not-async) This can not be used on JS, only for JVM'); }; protoOf(SQLitePreparedStatementJs).executeUpdateAsync_1e6m2t_k$ = function ($completion) { var tmp = new $executeUpdateAsyncCOROUTINE$40(this, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLitePreparedStatementJs).executeQuery_mh7xd9_k$ = function () { throw Exception_init_$Create$('executeQuery (non-async): This can not be used on JS, only for JVM'); }; protoOf(SQLitePreparedStatementJs).close_yn9xrc_k$ = function () { }; function _get_results__tlunyz($this) { return $this.results_1; } function MetaData($outer) { this.$this_1 = $outer; } protoOf(MetaData).getColumnCount_otnr31_k$ = function () { var tmp0_safe_receiver = this.$this_1.columns_1; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.length; return tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs; }; protoOf(MetaData).getColumnLabel_619i9c_k$ = function (column) { var index = column - 1 | 0; var tmp0_safe_receiver = this.$this_1.columns_1; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver[index]; var tmp; if (tmp1_elvis_lhs == null) { throw IllegalStateException_init_$Create$('Could not get column index: ' + index); } else { tmp = tmp1_elvis_lhs; } return tmp; }; function _set_closed__kdb0et_3($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1_3($this) { return $this.closed_1; } function _set_lastWasNull__n5n0wl($this, _set____db54di) { $this.lastWasNull_1 = _set____db54di; } function _get_lastWasNull__74r5fb($this) { return $this.lastWasNull_1; } function getValue($this, columnName) { // Inline function 'kotlin.also' call var tmp0_safe_receiver = $this.columns_1; var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : indexOf_0(tmp0_safe_receiver, columnName); var tmp; if (tmp1_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.' call var tmp0_safe_receiver_0 = $this.currentRow_1; tmp = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0[tmp1_safe_receiver]; } var this_0 = tmp; // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.' call $this.lastWasNull_1 = this_0 == null; return this_0; } function getValue_0($this, columnIndex) { // Inline function 'kotlin.also' call var tmp0_safe_receiver = $this.currentRow_1; var this_0 = tmp0_safe_receiver == null ? null : tmp0_safe_receiver[columnIndex - 1 | 0]; // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.sqljsjdbc.SQLiteResultSet.getValue.' call $this.lastWasNull_1 = this_0 == null; return this_0; } function SQLiteResultSet(results) { this.results_1 = results; this.currentIndex_1 = -1; this.currentRow_1 = null; this.columns_1 = null; this.closed_1 = false; this.lastWasNull_1 = true; var tmp = this; var tmp_0; // Inline function 'kotlin.collections.isNotEmpty' call // Inline function 'kotlin.collections.isEmpty' call if (!(this.results_1.length === 0)) { // Inline function 'kotlin.js.asDynamic' call tmp_0 = first(this.results_1).columns; } else { tmp_0 = null; } tmp.columns_1 = tmp_0; } protoOf(SQLiteResultSet).set_currentIndex_yhm4em_k$ = function (_set____db54di) { this.currentIndex_1 = _set____db54di; }; protoOf(SQLiteResultSet).get_currentIndex_shwroi_k$ = function () { return this.currentIndex_1; }; protoOf(SQLiteResultSet).set_currentRow_gtvni6_k$ = function (_set____db54di) { this.currentRow_1 = _set____db54di; }; protoOf(SQLiteResultSet).get_currentRow_wui8mi_k$ = function () { return this.currentRow_1; }; protoOf(SQLiteResultSet).set_columns_dgv1pn_k$ = function (_set____db54di) { this.columns_1 = _set____db54di; }; protoOf(SQLiteResultSet).get_columns_gyzrhw_k$ = function () { return this.columns_1; }; protoOf(SQLiteResultSet).next_20eer_k$ = function () { var tmp; // Inline function 'kotlin.collections.isNotEmpty' call // Inline function 'kotlin.collections.isEmpty' call if (!(this.results_1.length === 0)) { this.currentIndex_1 = this.currentIndex_1 + 1 | 0; // Inline function 'kotlin.js.asDynamic' call var data = first(this.results_1).values; var tmp_0 = this.currentIndex_1; var tmp_1 = data.length; var hasNext = tmp_0 < ((!(tmp_1 == null) ? typeof tmp_1 === 'number' : false) ? tmp_1 : THROW_CCE()); this.currentRow_1 = hasNext ? data[this.currentIndex_1] : null; if (this.currentRow_1 == null) { this.currentIndex_1 = this.currentIndex_1 - 1 | 0; } return !(this.currentRow_1 == null); } else { tmp = false; } return tmp; }; protoOf(SQLiteResultSet).getString_gb1pt9_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); }; protoOf(SQLiteResultSet).getString_5demq7_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); }; protoOf(SQLiteResultSet).getBoolean_xz3hoo_k$ = function (columnName) { var value = getValue(this, columnName); return Boolean(value); }; protoOf(SQLiteResultSet).getBoolean_oe92jq_k$ = function (columnIndex) { var value = getValue_0(this, columnIndex); return Boolean(value); }; protoOf(SQLiteResultSet).getByte_blta6c_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toByte(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getByte_8098nu_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toByte(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getShort_4zegvo_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toShort_0(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getShort_agwca6_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toShort_0(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getInt_npc9pd_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toInt(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getInt_s8uc8x_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toInt(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getFloat_1jlp7w_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp; if (tmp1_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.text.toFloat' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp = toDouble(tmp1_safe_receiver); } var tmp2_elvis_lhs = tmp; return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getFloat_m7y41e_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp; if (tmp1_safe_receiver == null) { tmp = null; } else { // Inline function 'kotlin.text.toFloat' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp = toDouble(tmp1_safe_receiver); } var tmp2_elvis_lhs = tmp; return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getLong_3wgf2g_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toLong_0(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? new Long(0, 0) : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getLong_rneply_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toLong_0(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? new Long(0, 0) : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getDouble_v37ict_k$ = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toDouble(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getDouble_5me5vz_k$ = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : toDouble(tmp1_safe_receiver); return tmp2_elvis_lhs == null ? 0.0 : tmp2_elvis_lhs; }; protoOf(SQLiteResultSet).getBigDecimal_vg28s3_k$ = function (columnName) { return getValue(this, columnName); }; protoOf(SQLiteResultSet).getBytes_hu5f8b_k$ = function (columnName) { var value = getValue(this, columnName); if (!(value == null)) { var tmp$ret$0; $l$block: { // Inline function 'io.ktor.utils.io.core.toByteArray' call var this_0 = toString(value); var charset = Charsets_getInstance().get_UTF_8_ihn39z_k$(); if (charset.equals(Charsets_getInstance().get_UTF_8_ihn39z_k$())) { tmp$ret$0 = encodeToByteArray(this_0); break $l$block; } tmp$ret$0 = encodeToByteArray_0(charset.newEncoder_gqwcdg_k$(), this_0, 0, this_0.length); } return tmp$ret$0; } return null; }; protoOf(SQLiteResultSet).getDate_jtyvo6_k$ = function (columnName) { var value = getValue(this, columnName); if (!(value == null)) { return new Date(toString(value)); } return null; }; protoOf(SQLiteResultSet).getTime_of3q21_k$ = function (columnName) { return getValue(this, columnName); }; protoOf(SQLiteResultSet).getTimestamp_78pst6_k$ = function (columnName) { return getValue(this, columnName); }; protoOf(SQLiteResultSet).getObject_63qtd1_k$ = function (columnName) { return getValue(this, columnName); }; protoOf(SQLiteResultSet).getObject_m2jtdv_k$ = function (columnIndex) { return getValue_0(this, columnIndex); }; protoOf(SQLiteResultSet).wasNull_ilge1c_k$ = function () { return this.lastWasNull_1; }; protoOf(SQLiteResultSet).getMetaData_qwn0zp_k$ = function () { return new MetaData(this); }; protoOf(SQLiteResultSet).close_yn9xrc_k$ = function () { this.currentRow_1 = null; this.columns_1 = null; this.currentIndex_1 = -1; this.closed_1 = true; }; protoOf(SQLiteResultSet).isClosed_baxhhm_k$ = function () { return this.closed_1; }; protoOf(SQLiteResultSet).toString = function () { var str = '[SQLiteResultSet] Columns=' + this.columns_1; // Inline function 'kotlin.collections.isEmpty' call if (this.results_1.length === 0) { str = str + ' - no rows'; return str; } return str; }; function _set_closed__kdb0et_4($this, _set____db54di) { $this.closed_1 = _set____db54di; } function _get_closed__iwkfs1_4($this) { return $this.closed_1; } function $executeUpdateAsyncJsCOROUTINE$41(_this__u8e3s4, sql, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this._this__u8e3s4__1 = _this__u8e3s4; this.sql_1 = sql; } protoOf($executeUpdateAsyncJsCOROUTINE$41).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); Napier_getInstance().v$default_9ddbot_k$('SqliteJs: updateAsyncJs: ' + this.sql_1 + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.set_state_rjd8d0_k$(1); var tmp_0 = this._this__u8e3s4__1.connection_1.get_datasource_g0samm_k$(); suspendResult = tmp_0.sendUpdate$default_3nckq3_k$(this._this__u8e3s4__1.connection_1, this.sql_1, [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; return ARGUMENT.get_numRowsChanged_uyxfwi_k$(); 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 SQLiteStatementJs(connection, autoGeneratedKeys) { autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_getInstance().get_NO_GENERATED_KEYS_h4ycm1_k$() : autoGeneratedKeys; this.connection_1 = connection; this.autoGeneratedKeys_1 = autoGeneratedKeys; this.closed_1 = false; this.lastGeneratedKey_1 = null; this.queryTimeoutSecs_1 = 0; } protoOf(SQLiteStatementJs).get_connection_x01z89_k$ = function () { return this.connection_1; }; protoOf(SQLiteStatementJs).get_autoGeneratedKeys_yzw64r_k$ = function () { return this.autoGeneratedKeys_1; }; protoOf(SQLiteStatementJs).set_lastGeneratedKey_qi9x5k_k$ = function (_set____db54di) { this.lastGeneratedKey_1 = _set____db54di; }; protoOf(SQLiteStatementJs).get_lastGeneratedKey_xglrg1_k$ = function () { return this.lastGeneratedKey_1; }; protoOf(SQLiteStatementJs).set_queryTimeoutSecs_omfp5c_k$ = function (_set____db54di) { this.queryTimeoutSecs_1 = _set____db54di; }; protoOf(SQLiteStatementJs).get_queryTimeoutSecs_b2eh98_k$ = function () { return this.queryTimeoutSecs_1; }; protoOf(SQLiteStatementJs).executeUpdate_k6x04k_k$ = function (sql) { throw new SQLException('Synchronous SQL not supported!', null); }; protoOf(SQLiteStatementJs).executeUpdateAsyncJs_btupiy_k$ = function (sql, $completion) { var tmp = new $executeUpdateAsyncJsCOROUTINE$41(this, sql, $completion); tmp.set_result_xj64lm_k$(Unit_getInstance()); tmp.set_exception_px07aa_k$(null); return tmp.doResume_5yljmg_k$(); }; protoOf(SQLiteStatementJs).close_yn9xrc_k$ = function () { this.closed_1 = true; }; protoOf(SQLiteStatementJs).isClosed_baxhhm_k$ = function () { return this.closed_1; }; protoOf(SQLiteStatementJs).getConnection_hr2oto_k$ = function () { return this.connection_1; }; protoOf(SQLiteStatementJs).getGeneratedKeys_aewui5_k$ = function () { var tmp0_elvis_lhs = this.lastGeneratedKey_1; var tmp; if (tmp0_elvis_lhs == null) { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call var tmp$ret$2 = []; tmp = new SQLiteResultSet(tmp$ret$2); } else { tmp = tmp0_elvis_lhs; } return tmp; }; protoOf(SQLiteStatementJs).setQueryTimeout_qepe4z_k$ = function (seconds) { this.queryTimeoutSecs_1 = seconds; }; function UpdateResult(numRowsChanged, autoGeneratedKey) { this.numRowsChanged_1 = numRowsChanged; this.autoGeneratedKey_1 = autoGeneratedKey; } protoOf(UpdateResult).get_numRowsChanged_uyxfwi_k$ = function () { return this.numRowsChanged_1; }; protoOf(UpdateResult).get_autoGeneratedKey_5pm7ag_k$ = function () { return this.autoGeneratedKey_1; }; protoOf(UpdateResult).component1_7eebsc_k$ = function () { return this.numRowsChanged_1; }; protoOf(UpdateResult).component2_7eebsb_k$ = function () { return this.autoGeneratedKey_1; }; protoOf(UpdateResult).copy_48hpoo_k$ = function (numRowsChanged, autoGeneratedKey) { return new UpdateResult(numRowsChanged, autoGeneratedKey); }; protoOf(UpdateResult).copy$default_y0rb7c_k$ = function (numRowsChanged, autoGeneratedKey, $super) { numRowsChanged = numRowsChanged === VOID ? this.numRowsChanged_1 : numRowsChanged; autoGeneratedKey = autoGeneratedKey === VOID ? this.autoGeneratedKey_1 : autoGeneratedKey; return $super === VOID ? this.copy_48hpoo_k$(numRowsChanged, autoGeneratedKey) : $super.copy_48hpoo_k$.call(this, numRowsChanged, autoGeneratedKey); }; protoOf(UpdateResult).toString = function () { return 'UpdateResult(numRowsChanged=' + this.numRowsChanged_1 + ', autoGeneratedKey=' + this.autoGeneratedKey_1 + ')'; }; protoOf(UpdateResult).hashCode = function () { var result = this.numRowsChanged_1; result = imul(result, 31) + (this.autoGeneratedKey_1 == null ? 0 : hashCode(this.autoGeneratedKey_1)) | 0; return result; }; protoOf(UpdateResult).equals = function (other) { if (this === other) return true; if (!(other instanceof UpdateResult)) return false; var tmp0_other_with_cast = other instanceof UpdateResult ? other : THROW_CCE(); if (!(this.numRowsChanged_1 === tmp0_other_with_cast.numRowsChanged_1)) return false; if (!equals(this.autoGeneratedKey_1, tmp0_other_with_cast.autoGeneratedKey_1)) return false; return true; }; function WorkerResult(id, results, ready, buffer) { this.id_1 = id; this.results_1 = results; this.ready_1 = ready; this.buffer_1 = buffer; } protoOf(WorkerResult).set_id_kpjn9s_k$ = function (_set____db54di) { this.id_1 = _set____db54di; }; protoOf(WorkerResult).get_id_kntnx8_k$ = function () { return this.id_1; }; protoOf(WorkerResult).set_results_cgh3qb_k$ = function (_set____db54di) { this.results_1 = _set____db54di; }; protoOf(WorkerResult).get_results_jf06j1_k$ = function () { return this.results_1; }; protoOf(WorkerResult).set_ready_2pre9d_k$ = function (_set____db54di) { this.ready_1 = _set____db54di; }; protoOf(WorkerResult).get_ready_ixwjga_k$ = function () { return this.ready_1; }; protoOf(WorkerResult).set_buffer_dp5jk6_k$ = function (_set____db54di) { this.buffer_1 = _set____db54di; }; protoOf(WorkerResult).get_buffer_bmaafd_k$ = function () { return this.buffer_1; }; protoOf(WorkerResult).component1_7eebsc_k$ = function () { return this.id_1; }; protoOf(WorkerResult).component2_7eebsb_k$ = function () { return this.results_1; }; protoOf(WorkerResult).component3_7eebsa_k$ = function () { return this.ready_1; }; protoOf(WorkerResult).component4_7eebs9_k$ = function () { return this.buffer_1; }; protoOf(WorkerResult).copy_esdbor_k$ = function (id, results, ready, buffer) { return new WorkerResult(id, results, ready, buffer); }; protoOf(WorkerResult).copy$default_ip702s_k$ = function (id, results, ready, buffer, $super) { id = id === VOID ? this.id_1 : id; results = results === VOID ? this.results_1 : results; ready = ready === VOID ? this.ready_1 : ready; buffer = buffer === VOID ? this.buffer_1 : buffer; return $super === VOID ? this.copy_esdbor_k$(id, results, ready, buffer) : $super.copy_esdbor_k$.call(this, id, results, ready, buffer); }; protoOf(WorkerResult).toString = function () { return 'WorkerResult(id=' + this.id_1 + ', results=' + toString(this.results_1) + ', ready=' + this.ready_1 + ', buffer=' + this.buffer_1 + ')'; }; protoOf(WorkerResult).hashCode = function () { var result = this.id_1; result = imul(result, 31) + (this.results_1 == null ? 0 : hashCode(this.results_1)) | 0; result = imul(result, 31) + getBooleanHashCode(this.ready_1) | 0; result = imul(result, 31) + (this.buffer_1 == null ? 0 : hashCode(this.buffer_1)) | 0; return result; }; protoOf(WorkerResult).equals = function (other) { if (this === other) return true; if (!(other instanceof WorkerResult)) return false; var tmp0_other_with_cast = other instanceof WorkerResult ? other : THROW_CCE(); if (!(this.id_1 === tmp0_other_with_cast.id_1)) return false; if (!equals(this.results_1, tmp0_other_with_cast.results_1)) return false; if (!(this.ready_1 === tmp0_other_with_cast.ready_1)) return false; if (!equals(this.buffer_1, tmp0_other_with_cast.buffer_1)) return false; return true; }; function _get_logPrefix__aovpcr_4($this) { return '[DoorEventSourceJS - ' + $this.url_1 + ']'; } function _get_eventSource__8xtza4_1($this) { return $this.eventSource_1; } function DoorEventSource$lambda(this$0) { return function (event) { Napier_getInstance().d$default_a5agxr_k$(_get_logPrefix__aovpcr_4(this$0) + ' message received ' + event.lastEventId + ' ' + event.origin + ('- ' + toString_0(event.data))); this$0.listener_1.onMessage_f8yelo_k$(Companion_getInstance_21().parse_pc1q8p_k$(toString_0(event.data))); return Unit_getInstance(); }; } function DoorEventSource$lambda_0(this$0) { return function (it) { Napier_getInstance().e$default_pvzj32_k$(_get_logPrefix__aovpcr_4(this$0) + ' error occured: ' + it + '\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this$0.listener_1.onError_rgw5qo_k$(Exception_init_$Create$('Error occurred on ' + toString_0(it.target))); return Unit_getInstance(); }; } function DoorEventSource$lambda_1(this$0) { return function (it) { Napier_getInstance().i$default_htnpp6_k$(_get_logPrefix__aovpcr_4(this$0) + ' open'); this$0.listener_1.onOpen_hhqt5_k$(); return Unit_getInstance(); }; } function DoorEventSource(repoConfig, url, listener, retry) { retry = retry === VOID ? 2000 : retry; this.repoConfig_1 = repoConfig; this.url_1 = url; this.listener_1 = listener; this.eventSource_1 = new EventSource(this.url_1); Napier_getInstance().d$default_a5agxr_k$(_get_logPrefix__aovpcr_4(this) + ' connecting\n', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); this.eventSource_1.onmessage = DoorEventSource$lambda(this); this.eventSource_1.onerror = DoorEventSource$lambda_0(this); this.eventSource_1.onopen = DoorEventSource$lambda_1(this); } protoOf(DoorEventSource).get_repoConfig_ajrrc3_k$ = function () { return this.repoConfig_1; }; protoOf(DoorEventSource).set_url_caxf3c_k$ = function (_set____db54di) { this.url_1 = _set____db54di; }; protoOf(DoorEventSource).get_url_18iuii_k$ = function () { return this.url_1; }; protoOf(DoorEventSource).set_listener_2s1rce_k$ = function (_set____db54di) { this.listener_1 = _set____db54di; }; protoOf(DoorEventSource).get_listener_9jgv43_k$ = function () { return this.listener_1; }; protoOf(DoorEventSource).close_yn9xrc_k$ = function () { this.eventSource_1.close(); Napier_getInstance().d$default_a5agxr_k$(_get_logPrefix__aovpcr_4(this) + ' close', VOID, Companion_getInstance_13().get_LOG_TAG_it8mba_k$()); }; function DoorJsImplClasses() { } function KmpUuid(mostSigBits, leastSigBits) { } protoOf(KmpUuid).toString = function () { var timeStamp = (new Date()).getTime(); var tmp = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (mChar) { var mRandom = (timeStamp + Math.random() * 16) % 16 | 0; timeStamp = Math.floor(timeStamp / 16); return (mChar == 'x' ? mRandom : mRandom & 3 | 8).toString(16); }); return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE(); }; function randomUuid() { return new KmpUuid(new Long(0, 0), new Long(0, 0)); } function generateDoorNodeId(maxNodeId) { var nodeIdRef = 'nodeId_ref'; // Inline function 'org.w3c.dom.get' call // Inline function 'kotlin.js.asDynamic' call var tmp0_safe_receiver = localStorage[nodeIdRef]; var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toInt(tmp0_safe_receiver); var foundNodeId = tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs; if (foundNodeId === 0) { // Inline function 'kotlin.math.floor' call var x = Default_getInstance().nextDouble_s2xvfg_k$() * maxNodeId; var tmp$ret$2 = Math.floor(x); foundNodeId = numberToInt(tmp$ret$2); localStorage.setItem(nodeIdRef, foundNodeId.toString()); } return foundNodeId; } function systemTimeInMillis() { return numberToLong((new Date()).getTime()); } function threadSafeMapOf(items) { // Inline function 'kotlin.also' call // Inline function 'kotlin.collections.mutableMapOf' call var this_0 = LinkedHashMap_init_$Create$(); // Inline function 'kotlin.contracts.contract' call // Inline function 'com.ustadmobile.door.util.threadSafeMapOf.' call putAll(this_0, items); return this_0; } function waitBlocking(delayInMs) { var delayFor = numberToLong((new Date()).getTime()).plus_r93sks_k$(delayInMs); while ((new Date()).getTime() <= delayFor.toDouble_ygsx0s_k$()) { } } function _get_mWeakMap__mkuc5w($this) { return $this.mWeakMap_1; } function WeakMapJs() { var tmp = this; // Inline function 'kotlin.emptyArray' call var tmp$ret$0 = []; tmp.mWeakMap_1 = new WeakMap(tmp$ret$0); } protoOf(WeakMapJs).get_h31hzz_k$ = function (key) { return this.mWeakMap_1.get(key); }; protoOf(WeakMapJs).set_c2d6a0_k$ = function (key, value) { this.mWeakMap_1.set(key, value); }; protoOf(WeakMapJs).remove_1r2rzn_k$ = function (key) { var prevVal = this.get_h31hzz_k$(key); this.mWeakMap_1.delete(key); return prevVal; }; protoOf(WeakMapJs).containsKey_wfh6rb_k$ = function (key) { return this.mWeakMap_1.has(key); }; function _get_weakRef__myyv7a($this) { return $this.weakRef_1; } function WeakRefJs(target) { this.weakRef_1 = new WeakRef(target); } protoOf(WeakRefJs).get_26vq_k$ = function () { return this.weakRef_1.deref(); }; function weakRefOf(target) { return new WeakRefJs(target); } //region block: post-declaration protoOf(TransactionElement).get_y2st91_k$ = get; protoOf(TransactionElement).fold_j2vaxd_k$ = fold; protoOf(TransactionElement).minusKey_9i5ggf_k$ = minusKey; protoOf(TransactionElement).plus_s13ygv_k$ = plus_0; protoOf($serializer).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers; protoOf(NapierDoorLogger).log$default_fb1f4z_k$ = log$default; protoOf(NapierDoorLogger).log$default_6v36wb_k$ = log$default_0; protoOf($serializer_0).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers; protoOf($serializer_1).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers; protoOf($serializer_2).typeParametersSerializers_fr94fx_k$ = typeParametersSerializers; //endregion //region block: init INITIAL_ITEM_COUNT = -1; //endregion //region block: exports _.$_$ = _.$_$ || {}; _.$_$.a = Trigger; _.$_$.b = NodeIdAndAuth; _.$_$.c = OutgoingReplication; _.$_$.d = DoorDatabaseMetadata; _.$_$.e = copyWithExtraParams; _.$_$.f = copy; _.$_$.g = createArrayOrProxyArrayOf; _.$_$.h = createInstance; _.$_$.i = dbType_0; _.$_$.j = doorDatabaseMetadata; _.$_$.k = doorNodeAndVersionHeaders; _.$_$.l = doorNodeIdHeader; _.$_$.m = get_doorPrimaryKeyManager; _.$_$.n = get_doorWrapperNodeId; _.$_$.o = hasListOrArrayParams; _.$_$.p = mutableLinkedListOf; _.$_$.q = get_nodeIdAuthCache; _.$_$.r = pagingSourceLoadParameters; _.$_$.s = prepareAndUseStatement_0; _.$_$.t = prepareAndUseStatement; _.$_$.u = get_rootDatabase; _.$_$.v = setBodyJson; _.$_$.w = setRepoUrl_0; _.$_$.x = toUrlQueryString; _.$_$.y = unwrap; _.$_$.z = doorFlow; _.$_$.a1 = RepoDaoFlowHelper; _.$_$.b1 = RepositoryDaoWithFlowHelper; _.$_$.c1 = getBooleanNullable; _.$_$.d1 = getFloatNullable; _.$_$.e1 = getIntNullable; _.$_$.f1 = getLongNullable; _.$_$.g1 = getStringNonNull; _.$_$.h1 = mapNextRow_0; _.$_$.i1 = mapNextRow; _.$_$.j1 = mapRows; _.$_$.k1 = setBooleanNullable; _.$_$.l1 = setFloatNullable; _.$_$.m1 = setIntNullable; _.$_$.n1 = setLongNullable; _.$_$.o1 = useResults; _.$_$.p1 = PreparedStatement; _.$_$.q1 = DoorMigrationStatementList; _.$_$.r1 = NodeEventManagerJs; _.$_$.s1 = DelegatedInvalidationPagingSource; _.$_$.t1 = DoorLimitOffsetPagingSource; _.$_$.u1 = OffsetLimitMediatorState; _.$_$.v1 = OnRemoteLoad; _.$_$.w1 = DoorOffsetLimitRemoteMediator; _.$_$.x1 = DoorRepositoryReplicatePullPagingSource; _.$_$.y1 = PagingSourceInterceptor; _.$_$.z1 = PagingSourceWithHttpLoader; _.$_$.a2 = endOfPaginationReached; _.$_$.b2 = ReplicationEntityMetaData; _.$_$.c2 = ReplicationFieldMetaData; _.$_$.d2 = withRepoChangeMonitor; _.$_$.e2 = InvalidationTracker_0; _.$_$.f2 = RoomDatabaseJdbcImplHelper; _.$_$.g2 = RoomDatabase; _.$_$.h2 = RoomJdbcImpl; _.$_$.i2 = DoorJsImplClasses; _.$_$.j2 = NodeIdAuthCache; _.$_$.k2 = randomUuid; _.$_$.l2 = systemTimeInMillis; _.$_$.m2 = DatabaseBuilderOptions; _.$_$.n2 = DoorDatabaseJdbc; _.$_$.o2 = DoorDatabaseRepository; _.$_$.p2 = DoorDatabaseWrapper; _.$_$.q2 = DoorPrimaryKeyManager; _.$_$.r2 = EntityInsertionAdapter; _.$_$.s2 = PreparedStatementConfig; _.$_$.t2 = RepositoryHelper; _.$_$.u2 = SyncNodeIdCallback; _.$_$.v2 = SyncNode; _.$_$.w2 = RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance; _.$_$.x2 = Event_INSERT_getInstance; _.$_$.y2 = On_ENTITY_getInstance; _.$_$.z2 = On_RECEIVEVIEW_getInstance; _.$_$.a3 = Order_AFTER_getInstance; _.$_$.b3 = Order_INSTEAD_OF_getInstance; _.$_$.c3 = prepareAndUseStatementAsync; _.$_$.d3 = prepareAndUseStatementAsync_0; _.$_$.e3 = withDoorTransactionAsync; _.$_$.f3 = executeQueryAsyncKmp; _.$_$.g3 = executeUpdateAsyncKmp; _.$_$.h3 = onClientRepoDoorMessageHttpResponse; _.$_$.i3 = withRepoChangeMonitorAsync; _.$_$.j3 = Companion_getInstance_13; _.$_$.k3 = Companion_getInstance_22; _.$_$.l3 = Companion_getInstance_6; _.$_$.m3 = Companion_getInstance_23; _.$_$.n3 = Companion_getInstance_24; //endregion return _; }(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./Napier-napier-js-ir.js'), require('./kotlinx-coroutines-core.js'), require('./kotlinx-atomicfu.js'), require('./multiplatform-paging-root-paging-common.js'), require('./kotlinx-serialization-kotlinx-serialization-core.js'), require('./ktor-ktor-http.js'), require('./ktor-ktor-utils.js'), require('./ktor-ktor-client-core.js'), require('./kotlinx-serialization-kotlinx-serialization-json.js'), require('./ktor-ktor-io.js'))); //# sourceMappingURL=door-door-runtime.js.map