(function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_org_jetbrains_kotlinx_atomicfu, kotlin_io_github_aakira_napier, 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) { 'use strict'; //region block: imports var imul = Math.imul; var protoOf = kotlin_kotlin.$_$.ed; var interfaceMeta = kotlin_kotlin.$_$.dc; var setMetadataFor = kotlin_kotlin.$_$.fd; var classMeta = kotlin_kotlin.$_$.qb; var VOID = kotlin_kotlin.$_$.f; var THROW_CCE = kotlin_kotlin.$_$.si; var isInterface = kotlin_kotlin.$_$.mc; var Long = kotlin_kotlin.$_$.li; var Unit_instance = kotlin_kotlin.$_$.m5; var CoroutineImpl = kotlin_kotlin.$_$.ab; var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.ma; var indexOf = kotlin_kotlin.$_$.nf; var StringBuilder_init_$Create$ = kotlin_kotlin.$_$.e1; var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.u2; var objectMeta = kotlin_kotlin.$_$.dd; var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v; var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.a2; var Exception = kotlin_kotlin.$_$.hi; var getKClassFromExpression = kotlin_kotlin.$_$.d; var CancellationException = kotlin_kotlin.$_$.la; var callbackFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.i1; var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a2; var ProducerScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a1; var BufferOverflow_DROP_OLDEST_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.a; var Channel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z; var launch = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.n2; var awaitClose = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b; var joinToString = kotlin_kotlin.$_$.e8; var atomic$boolean$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.c; var Napier_getInstance = kotlin_io_github_aakira_napier.$_$.g; 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.$_$.v; var withContext = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l; var ArrayList_init_$Create$ = kotlin_kotlin.$_$.m; var removeAll = kotlin_kotlin.$_$.h9; var listOf = kotlin_kotlin.$_$.o8; var collectionSizeOrDefault = kotlin_kotlin.$_$.p6; var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l; var checkIndexOverflow = kotlin_kotlin.$_$.n6; var listOf_0 = kotlin_kotlin.$_$.p8; var plus = kotlin_kotlin.$_$.e9; var flatten = kotlin_kotlin.$_$.w7; var toList = kotlin_kotlin.$_$.z9; var get = kotlin_kotlin.$_$.wa; var fold = kotlin_kotlin.$_$.va; var minusKey = kotlin_kotlin.$_$.xa; var plus_0 = kotlin_kotlin.$_$.za; var Element = kotlin_kotlin.$_$.ya; var toSet = kotlin_kotlin.$_$.fa; var toLong = kotlin_kotlin.$_$.hd; var withTimeout = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.m; var NonCancellable_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.y; var Mutex = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.t1; var Job = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b2; var CoroutineScope_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.z1; var to = kotlin_kotlin.$_$.yj; var mapOf = kotlin_kotlin.$_$.s8; var toMap = kotlin_kotlin.$_$.ba; var IntCompanionObject_instance = kotlin_kotlin.$_$.y4; var numberToLong = kotlin_kotlin.$_$.ad; var delay = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.k; var atomic$long$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d; var numberToInt = kotlin_kotlin.$_$.zc; var LazyThreadSafetyMode_NONE_getInstance = kotlin_kotlin.$_$.h; var lazy = kotlin_kotlin.$_$.pj; var ensureNotNull = kotlin_kotlin.$_$.kj; var KProperty1 = kotlin_kotlin.$_$.fe; var getPropertyCallableRef = kotlin_kotlin.$_$.ac; var RuntimeException = kotlin_kotlin.$_$.ri; var RuntimeException_init_$Init$ = kotlin_kotlin.$_$.n2; var captureStack = kotlin_kotlin.$_$.kb; var getStringHashCode = kotlin_kotlin.$_$.bc; var getBooleanHashCode = kotlin_kotlin.$_$.xb; var PluginGeneratedSerialDescriptor = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x2; var LongSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.x; var UnknownFieldException_init_$Create$ = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.g; var typeParametersSerializers = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.s2; var GeneratedSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.t2; var throwMissingFieldException = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.c3; var objectCreate = kotlin_kotlin.$_$.cd; var emptyList = kotlin_kotlin.$_$.n7; var Enum = kotlin_kotlin.$_$.fi; var contentEquals = kotlin_kotlin.$_$.s6; var hashCode = kotlin_kotlin.$_$.cc; var toString = kotlin_kotlin.$_$.jd; var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.u1; var Application_getInstance = kotlin_io_ktor_ktor_http.$_$.b; var TextContent = kotlin_io_ktor_ktor_http.$_$.q; var JsType_instance = kotlin_io_ktor_ktor_utils.$_$.b; var getKClass = kotlin_kotlin.$_$.e; var arrayOf = kotlin_kotlin.$_$.hj; var createKType = kotlin_kotlin.$_$.b; var typeInfoImpl = kotlin_io_ktor_ktor_utils.$_$.k; var OutgoingContent = kotlin_io_ktor_ktor_http.$_$.p; var NullBody_instance = kotlin_io_ktor_ktor_http.$_$.a; var header = kotlin_io_ktor_ktor_client_core.$_$.l; var parameter = kotlin_io_ktor_ktor_client_core.$_$.m; var NoSuchElementException_init_$Create$ = kotlin_kotlin.$_$.h2; var enumEntries = kotlin_kotlin.$_$.eb; 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.$_$.l1; var get_encodedPath = kotlin_io_ktor_ktor_http.$_$.e1; var set_encodedPath = kotlin_io_ktor_ktor_http.$_$.f1; var get_jsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.y; var JsonNull = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j; 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.$_$.u; var get_long = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.z; var get_int = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.v; var toShort = kotlin_kotlin.$_$.id; var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.m; var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.n; var JsonNull_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.d; var mapCapacity = kotlin_kotlin.$_$.q8; var coerceAtLeast = kotlin_kotlin.$_$.rd; var LinkedHashMap_init_$Create$_0 = kotlin_kotlin.$_$.u; var JsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.k; var JsonPrimitive_1 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.l; var FlowCollector = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.c1; var MutableStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e1; var onStart = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.p1; var NullPointerException_init_$Create$ = kotlin_kotlin.$_$.i2; 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.$_$.rj; var ArrayListSerializer = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.q2; var IntSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_core.$_$.w; var equals = kotlin_kotlin.$_$.ub; var MutableSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.d1; var asSharedFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g1; var toLong_0 = kotlin_kotlin.$_$.ih; var Comparator = kotlin_kotlin.$_$.ci; var compareValues = kotlin_kotlin.$_$.ka; var plus_1 = kotlin_kotlin.$_$.f9; var minus = kotlin_kotlin.$_$.u8; var asStateFlow = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h1; var sortedWith = kotlin_kotlin.$_$.t9; var cancel = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.h2; var Page = kotlin_app_cash_paging_paging_common.$_$.g; var Invalid = kotlin_app_cash_paging_paging_common.$_$.f; var toBoolean = kotlin_kotlin.$_$.yg; var abs = kotlin_kotlin.$_$.ld; var until = kotlin_kotlin.$_$.ae; var get_request = kotlin_io_ktor_ktor_client_core.$_$.r; var toList_0 = kotlin_kotlin.$_$.y9; var first = kotlin_kotlin.$_$.u7; var Companion_getInstance = kotlin_io_ktor_ktor_http.$_$.i; var bodyAsText = kotlin_io_ktor_ktor_client_core.$_$.a; var JsonObjectSerializer_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.e; var toString_0 = kotlin_kotlin.$_$.xj; var List = kotlin_kotlin.$_$.x5; var Collection = kotlin_kotlin.$_$.p5; var get_isActive = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.l2; var HttpRequestBuilder = kotlin_io_ktor_ktor_client_core.$_$.j; var Companion_getInstance_0 = kotlin_io_ktor_ktor_http.$_$.g; var HttpStatement = kotlin_io_ktor_ktor_client_core.$_$.q; var contentType = kotlin_io_ktor_ktor_http.$_$.c1; var Default_getInstance = kotlin_kotlin.$_$.b5; var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.v1; var numberRangeToNumber = kotlin_kotlin.$_$.vc; var trimIndent = kotlin_kotlin.$_$.rh; var charArrayOf = kotlin_kotlin.$_$.lb; var split = kotlin_kotlin.$_$.jg; var joinToString_0 = kotlin_kotlin.$_$.f8; var ChannelResult__getOrThrow_impl_od1axs = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.p; var _ChannelResult___get_isSuccess__impl__odq1z9 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q; var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.e; var Factory_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r; var GlobalScope_instance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.w; var startsWith = kotlin_kotlin.$_$.lg; var substringAfter = kotlin_kotlin.$_$.qg; var get_js = kotlin_kotlin.$_$.rc; var copyToArray = kotlin_kotlin.$_$.i7; var compareTo = kotlin_kotlin.$_$.rb; var addAll = kotlin_kotlin.$_$.e6; var Json = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.p; var plus_2 = kotlin_kotlin.$_$.z8; var putAll = kotlin_kotlin.$_$.g9; var Exception_init_$Init$ = kotlin_kotlin.$_$.o1; var NotImplementedError = kotlin_kotlin.$_$.ni; var newThrowable = kotlin_kotlin.$_$.uc; var json = kotlin_kotlin.$_$.sc; var toInt = kotlin_kotlin.$_$.fh; var Exception_init_$Create$ = kotlin_kotlin.$_$.n1; var isByteArray = kotlin_kotlin.$_$.gc; var ClosedRange = kotlin_kotlin.$_$.od; var contains = kotlin_kotlin.$_$.vd; var indexOf_0 = kotlin_kotlin.$_$.z7; var first_0 = kotlin_kotlin.$_$.v7; var toShort_0 = kotlin_kotlin.$_$.jh; var toDouble = kotlin_kotlin.$_$.ch; //endregion //region block: pre-declaration setMetadataFor(DoorSqlDatabase, 'DoorSqlDatabase', interfaceMeta); setMetadataFor(DoorSqlDatabaseConnectionImpl, 'DoorSqlDatabaseConnectionImpl', classMeta, VOID, [DoorSqlDatabase]); setMetadataFor(EntityInsertionAdapter$insertAsync$slambda, 'EntityInsertionAdapter$insertAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter$insertAndReturnIdAsync$slambda, 'EntityInsertionAdapter$insertAndReturnIdAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter$insertListAsync$slambda, 'EntityInsertionAdapter$insertListAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(EntityInsertionAdapter, 'EntityInsertionAdapter', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(Companion, 'Companion', objectMeta); setMetadataFor(PreparedStatement, 'PreparedStatement', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]); setMetadataFor(PreparedStatementArrayProxyCommon, 'PreparedStatementArrayProxyCommon', classMeta, VOID, [PreparedStatement], VOID, VOID, VOID, [0, 1]); setMetadataFor(prepareAndUseStatementAsync$slambda, 'prepareAndUseStatementAsync$slambda', classMeta, CoroutineImpl, VOID, 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, VOID, VOID, VOID, VOID, [1]); setMetadataFor(doorFlow$slambda, 'doorFlow$slambda', classMeta, CoroutineImpl, VOID, 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(NodeEventJdbcImplListenerSqlite, 'NodeEventJdbcImplListenerSqlite', classMeta, VOID, VOID, VOID, VOID, VOID, [3]); setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [2]); setMetadataFor(InvalidationTracker, 'InvalidationTracker', classMeta, InvalidationTrackerObserver); setMetadataFor(DoorLimitOffsetPagingSource$load$slambda, 'DoorLimitOffsetPagingSource$load$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorLimitOffsetPagingSource$initialLoad$slambda, 'DoorLimitOffsetPagingSource$initialLoad$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorLimitOffsetPagingSource$nonInitialLoad$slambda, 'DoorLimitOffsetPagingSource$nonInitialLoad$slambda', classMeta, CoroutineImpl, VOID, 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_0, 'Companion', objectMeta); 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, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(TransactionElement, 'TransactionElement', classMeta, VOID, [Element]); setMetadataFor(Key, 'Key', objectMeta); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3, 'RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda, 'RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda', classMeta, CoroutineImpl, VOID, 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(DoorDatabaseCallbackStatementList, 'DoorDatabaseCallbackStatementList', interfaceMeta); setMetadataFor(DoorDatabaseCallbackSync, 'DoorDatabaseCallbackSync', interfaceMeta); setMetadataFor(DoorDatabaseJdbc, 'DoorDatabaseJdbc', interfaceMeta); setMetadataFor(DoorDatabaseRepository, 'DoorDatabaseRepository', interfaceMeta); setMetadataFor(DoorDatabaseWrapper, 'DoorDatabaseWrapper', interfaceMeta); setMetadataFor(Companion_1, 'Companion', objectMeta); setMetadataFor($nextIdAsyncCOROUTINE$12, '$nextIdAsyncCOROUTINE$12', classMeta, CoroutineImpl); setMetadataFor(TablePrimaryKeyManager, 'TablePrimaryKeyManager', classMeta, VOID, VOID, VOID, VOID, VOID, [0]); setMetadataFor(Companion_2, '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_3, 'Companion', objectMeta); setMetadataFor(PreparedStatementConfig, 'PreparedStatementConfig', classMeta); setMetadataFor(RepositoryHelper, 'RepositoryHelper', classMeta); setMetadataFor(Companion_4, '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(RemoteInsertStrategy, 'RemoteInsertStrategy', classMeta, Enum); setMetadataFor(Event, 'Event', classMeta, Enum); setMetadataFor(Order, 'Order', classMeta, Enum); setMetadataFor(On, 'On', classMeta, Enum); setMetadataFor(Companion_5, 'Companion', objectMeta); setMetadataFor(Trigger, 'Trigger', classMeta); setMetadataFor(NodeIdAndAuth, 'NodeIdAndAuth', classMeta); setMetadataFor(OutgoingReplication, 'OutgoingReplication', classMeta, VOID, VOID, OutgoingReplication); setMetadataFor(Companion_6, 'Companion', objectMeta); setMetadataFor(DoorDatabaseMetadata, 'DoorDatabaseMetadata', classMeta); setMetadataFor(Companion_7, 'Companion', objectMeta); setMetadataFor(Companion_8, '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, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RepoDaoFlowHelper$asRepoFlow$slambda, 'RepoDaoFlowHelper$asRepoFlow$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RepoDaoFlowHelper, 'RepoDaoFlowHelper', classMeta); setMetadataFor(ConnectionAsync, 'ConnectionAsync', interfaceMeta, VOID, VOID, VOID, VOID, VOID, [1, 0]); setMetadataFor(StatementConstantsKmp, 'StatementConstantsKmp', objectMeta); setMetadataFor(TypesKmp, 'TypesKmp', objectMeta); setMetadataFor(DoorLogLevel, 'DoorLogLevel', classMeta, Enum); setMetadataFor(NapierDoorLogger, 'NapierDoorLogger', classMeta, VOID, VOID, NapierDoorLogger); setMetadataFor(DefaultDoorMessageCallback, 'DefaultDoorMessageCallback', classMeta, VOID, VOID, DefaultDoorMessageCallback, VOID, VOID, [2]); setMetadataFor(Companion_9, '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(NodeEventManagerCommon$onIncomingMessageReceived$slambda, 'NodeEventManagerCommon$onIncomingMessageReceived$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor($onIncomingMessageReceivedCOROUTINE$15, '$onIncomingMessageReceivedCOROUTINE$15', classMeta, CoroutineImpl); setMetadataFor(NodeEventManagerCommon, 'NodeEventManagerCommon', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(NodeEventSseClient$onMessage$slambda, 'NodeEventSseClient$onMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(NodeEventSseClient, 'NodeEventSseClient', classMeta); setMetadataFor(DelegatedInvalidationPagingSource, 'DelegatedInvalidationPagingSource', classMeta, PagingSource, VOID, VOID, VOID, VOID, [1]); 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, VOID, 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_10, '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(PagingSourceLoadState, 'PagingSourceLoadState', classMeta, VOID, VOID, PagingSourceLoadState); setMetadataFor(ReplicateEntityPrimaryKeys, 'ReplicateEntityPrimaryKeys', classMeta); setMetadataFor(acknowledgeReceivedReplications$slambda, 'acknowledgeReceivedReplications$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(selectPendingOutgoingReplicationsByDestNodeId$slambda, 'selectPendingOutgoingReplicationsByDestNodeId$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda_1, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(insertEntitiesFromMessage$slambda_3, 'insertEntitiesFromMessage$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda, 'selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_1, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_3, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda$slambda_5, 'withRepoChangeMonitorAsync$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(withRepoChangeMonitorAsync$slambda, 'withRepoChangeMonitorAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17, '$selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17', classMeta, CoroutineImpl); setMetadataFor($insertEntitiesFromMessageCOROUTINE$18, '$insertEntitiesFromMessageCOROUTINE$18', classMeta, CoroutineImpl); setMetadataFor($onClientRepoDoorMessageHttpResponseCOROUTINE$20, '$onClientRepoDoorMessageHttpResponseCOROUTINE$20', classMeta, CoroutineImpl); setMetadataFor(Companion_11, '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, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor($invokeCOROUTINE$21, '$invokeCOROUTINE$21', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda, 'DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor($invokeCOROUTINE$22, '$invokeCOROUTINE$22', classMeta, CoroutineImpl); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda$slambda_1, 'DoorRepositoryReplicationClient$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(ClientState, 'ClientState', classMeta, VOID, VOID, ClientState); setMetadataFor(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications, 'DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications', classMeta, VOID, VOID, VOID, VOID, VOID, [3]); setMetadataFor(DefaultOnStartPendingSession, 'DefaultOnStartPendingSession', classMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(DefaultOnPendingSessionResolved, 'DefaultOnPendingSessionResolved', classMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(Companion_12, '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, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_1, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_3, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorRepositoryReplicationClient$slambda_5, 'DoorRepositoryReplicationClient$slambda', classMeta, CoroutineImpl, VOID, 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(ReplicationConstants, 'ReplicationConstants', objectMeta); setMetadataFor(ReplicationEntityMetaData, 'ReplicationEntityMetaData', classMeta); setMetadataFor(ReplicationFieldMetaData, 'ReplicationFieldMetaData', classMeta); setMetadataFor(Companion_13, 'Companion', objectMeta); setMetadataFor($serializer_2, '$serializer', objectMeta, VOID, [GeneratedSerializer]); setMetadataFor(ReplicationReceivedAck, 'ReplicationReceivedAck', classMeta, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_2}); setMetadataFor(Companion_14, 'Companion', objectMeta); setMetadataFor(Companion_15, 'Companion', objectMeta); setMetadataFor(DoorServerSentEvent, 'DoorServerSentEvent', classMeta); setMetadataFor(TriggerConstants, 'TriggerConstants', objectMeta); setMetadataFor(DoorEventCollator$receiveEvent$slambda$slambda, 'DoorEventCollator$receiveEvent$slambda$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorEventCollator$receiveEvent$slambda, 'DoorEventCollator$receiveEvent$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(DoorEventCollator, 'DoorEventCollator', classMeta); setMetadataFor(NodeIdAuthCache, 'NodeIdAuthCache', classMeta, VOID, VOID, VOID, VOID, VOID, [2]); setMetadataFor(TransactionMode, 'TransactionMode', classMeta, Enum); setMetadataFor(Companion_16, '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(Companion_17, '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_18, 'Companion', objectMeta); setMetadataFor(RepositoryConfig, 'RepositoryConfig', classMeta); setMetadataFor(SaveToIndexedDbChangeListener$eventCollator$slambda, 'SaveToIndexedDbChangeListener$eventCollator$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(SaveToIndexedDbChangeListener$1, VOID, classMeta, InvalidationTrackerObserver); setMetadataFor(SaveToIndexedDbChangeListener, 'SaveToIndexedDbChangeListener', classMeta); setMetadataFor(withDoorTransactionAsync$slambda, 'withDoorTransactionAsync$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [1]); setMetadataFor(Connection, 'Connection', interfaceMeta); setMetadataFor(ResultSet, 'ResultSet', interfaceMeta); setMetadataFor(SQLException, 'SQLException', classMeta, Exception); setMetadataFor(NodeEventManagerJs, 'NodeEventManagerJs', classMeta, NodeEventManagerCommon, VOID, VOID, VOID, VOID, [1]); setMetadataFor(RoomDatabase, 'RoomDatabase', classMeta, VOID, VOID, VOID, VOID, VOID, [0, 1]); setMetadataFor(RoomDatabaseJdbcImplHelper, 'RoomDatabaseJdbcImplHelper', classMeta, RoomDatabaseJdbcImplHelperCommon, VOID, VOID, VOID, VOID, [0, 2, 1]); setMetadataFor(IndexedDb, 'IndexedDb', objectMeta, VOID, VOID, VOID, VOID, VOID, [1, 4, 3]); setMetadataFor(Companion_19, '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(SQLiteDatabaseMetadataJs, 'SQLiteDatabaseMetadataJs', classMeta, VOID, VOID, VOID, VOID, VOID, [4]); setMetadataFor(Companion_20, 'Companion', objectMeta); setMetadataFor(SQLiteDatasourceJs$sendQuery$slambda, 'SQLiteDatasourceJs$sendQuery$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [0]); setMetadataFor(SQLiteDatasourceJs$sendUpdate$slambda, 'SQLiteDatasourceJs$sendUpdate$slambda', classMeta, CoroutineImpl, VOID, VOID, VOID, VOID, [0]); setMetadataFor(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda, 'SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda', classMeta, CoroutineImpl, VOID, 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, VOID, VOID, VOID, VOID, [1, 2, 3, 4, 0]); setMetadataFor($executeUpdateAsyncCOROUTINE$40, '$executeUpdateAsyncCOROUTINE$40', classMeta, CoroutineImpl); setMetadataFor(SQLiteStatementJs, 'SQLiteStatementJs', classMeta, VOID, VOID, VOID, VOID, VOID, [1]); setMetadataFor(SQLitePreparedStatementJs, 'SQLitePreparedStatementJs', classMeta, SQLiteStatementJs, [SQLiteStatementJs, PreparedStatement], VOID, VOID, VOID, [0, 1]); 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, VOID, WeakMapJs); setMetadataFor(WeakRefJs, 'WeakRefJs', classMeta); //endregion function DoorSqlDatabase() { } function DoorSqlDatabaseConnectionImpl(connection, dbTypeInt) { this.y5f_1 = connection; this.z5f_1 = dbTypeInt; } protoOf(DoorSqlDatabaseConnectionImpl).x5f = function () { return this.y5f_1; }; function getGeneratedKey($this, stmt) { var generatedKeyRs = (null == null ? true : isInterface(null, ResultSet)) ? null : THROW_CCE(); var generatedKey = new Long(0, 0); try { generatedKeyRs = stmt.a5g(); if (generatedKeyRs.e()) generatedKey = generatedKeyRs.b5g(1); }finally { var tmp0_safe_receiver = generatedKeyRs; if (tmp0_safe_receiver == null) null; else { tmp0_safe_receiver.n(); } } return generatedKey; } function EntityInsertionAdapter$insertAsync$slambda(this$0, $entity, resultContinuation) { this.k5g_1 = this$0; this.l5g_1 = $entity; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertAsync$slambda).n5g = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(EntityInsertionAdapter$insertAsync$slambda).le = function (p1, $completion) { return this.n5g((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.k5g_1.r5g(this.m5g_1, this.l5g_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.m5g_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(EntityInsertionAdapter$insertAsync$slambda).o5g = function (stmt, completion) { var i = new EntityInsertionAdapter$insertAsync$slambda(this.k5g_1, this.l5g_1, completion); i.m5g_1 = stmt; return i; }; 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.n5g(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this$0, $entity, resultContinuation) { this.a5h_1 = this$0; this.b5h_1 = $entity; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).d5h = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).le = function (p1, $completion) { return this.d5h((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.a5h_1.r5g(this.c5h_1, this.b5h_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.c5h_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return getGeneratedKey(this.a5h_1, this.c5h_1); case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(EntityInsertionAdapter$insertAndReturnIdAsync$slambda).o5g = function (stmt, completion) { var i = new EntityInsertionAdapter$insertAndReturnIdAsync$slambda(this.a5h_1, this.b5h_1, completion); i.c5h_1 = stmt; return i; }; 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.d5h(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter$insertListAsync$slambda($entities, this$0, resultContinuation) { this.m5h_1 = $entities; this.n5h_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(EntityInsertionAdapter$insertListAsync$slambda).n5g = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(EntityInsertionAdapter$insertListAsync$slambda).le = function (p1, $completion) { return this.n5g((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(EntityInsertionAdapter$insertListAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; this.o5h_1.t5h().u5h(false); var tmp_0 = this; tmp_0.p5h_1 = this.m5h_1; this.q5h_1 = this.p5h_1.w(); this.ld_1 = 1; continue $sm; case 1: if (!this.q5h_1.f()) { this.ld_1 = 3; continue $sm; } this.r5h_1 = this.q5h_1.e(); var tmp_1 = this; tmp_1.s5h_1 = this.r5h_1; this.n5h_1.r5g(this.o5h_1, this.s5h_1); this.ld_1 = 2; suspendResult = executeUpdateAsyncKmp(this.o5h_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 1; continue $sm; case 3: this.o5h_1.t5h().v5h(); return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(EntityInsertionAdapter$insertListAsync$slambda).o5g = function (stmt, completion) { var i = new EntityInsertionAdapter$insertListAsync$slambda(this.m5h_1, this.n5h_1, completion); i.o5h_1 = stmt; return i; }; 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.n5g(stmt, $completion); }; l.$arity = 1; return l; } function EntityInsertionAdapter(db) { this.p5g_1 = db; this.q5g_1 = dbType_1(this.p5g_1); } protoOf(EntityInsertionAdapter).x5h = function (entity, $completion) { var tmp = this.w5h(false); return prepareAndUseStatementAsync_0(this.p5g_1, tmp, VOID, EntityInsertionAdapter$insertAsync$slambda_0(this, entity, null), $completion); }; protoOf(EntityInsertionAdapter).y5h = function (entity, $completion) { var stmtConfig = new PreparedStatementConfig(this.w5h(true), VOID, StatementConstantsKmp_instance.z5h_1); return prepareAndUseStatementAsync(this.p5g_1, stmtConfig, EntityInsertionAdapter$insertAndReturnIdAsync$slambda_0(this, entity, null), $completion); }; protoOf(EntityInsertionAdapter).b5i = function (entities, $completion) { var tmp = this.w5h(false); return prepareAndUseStatementAsync_0(this.p5g_1, tmp, VOID, EntityInsertionAdapter$insertListAsync$slambda_0(entities, this, null), $completion); }; 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.z5(_Char___init__impl__6a9atx(44)); } sb.z5(_Char___init__impl__6a9atx(63)); } while (inductionVariable < numPlaceholders); return sb.toString(); } function Companion() { this.c5i_1 = -5000; this.d5i_1 = -5001; } var Companion_instance; function Companion_getInstance_1() { return Companion_instance; } function PreparedStatementArrayProxyCommon(query, connectionInternal) { this.e5i_1 = query; this.f5i_1 = connectionInternal; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.g5i_1 = LinkedHashMap_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_0.h5i_1 = LinkedHashMap_init_$Create$(); var tmp_1 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_1.i5i_1 = LinkedHashMap_init_$Create$(); this.j5i_1 = -1; } protoOf(PreparedStatementArrayProxyCommon).k5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.m5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).v5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.s5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).w5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.l5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).x5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.o5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).y5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.p5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).z5i = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.r5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).a5j = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value_0 = TypesKmp_instance.n5i_1; this_0.s(index, value_0); }; protoOf(PreparedStatementArrayProxyCommon).b5j = function (index, array) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, array); // Inline function 'kotlin.collections.set' call var this_0 = this.h5i_1; var value = TypesKmp_instance.u5i_1; this_0.s(index, value); }; protoOf(PreparedStatementArrayProxyCommon).c5j = function (index, value) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(index, value); // Inline function 'kotlin.collections.set' call this.h5i_1.s(index, -5000); }; protoOf(PreparedStatementArrayProxyCommon).d5j = function (parameterIndex, sqlType) { // Inline function 'kotlin.collections.set' call this.g5i_1.s(parameterIndex, null); // Inline function 'kotlin.collections.set' call this.h5i_1.s(parameterIndex, -5001); // Inline function 'kotlin.collections.set' call this.i5i_1.s(parameterIndex, sqlType); }; protoOf(PreparedStatementArrayProxyCommon).e5j = function (seconds) { this.j5i_1 = seconds; }; protoOf(PreparedStatementArrayProxyCommon).f5j = 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.e5i_1; var tmp0_iterator = this.g5i_1.o2().w(); while (tmp0_iterator.f()) { var paramIndex = tmp0_iterator.e(); var value = this.g5i_1.q(paramIndex); if (!(value == null) ? isInterface(value, Array_0) : false) { var arrayProxy = value instanceof JdbcArrayProxy ? value : THROW_CCE(); var objects = arrayProxy.h5j_1; 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.s(paramPos, value_0); // Inline function 'kotlin.collections.set' call var value_1 = arrayProxy.j5j(); paramTypes.s(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.s(key, value); // Inline function 'kotlin.collections.set' call var key_0 = paramIndex + arrayOffset | 0; var tmp2_elvis_lhs = this.h5i_1.q(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.s(key_0, value_2); } } var stmt = null; try { stmt = this.f5i_1.k5j(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.j5i_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.e5j(this.j5i_1); } var tmp4_iterator = paramValues.o2().w(); while (tmp4_iterator.f()) { var paramIndex_0 = tmp4_iterator.e(); var value_3 = paramValues.q(paramIndex_0); var tmp5_elvis_lhs = paramTypes.q(paramIndex_0); var paramType = tmp5_elvis_lhs == null ? 0 : tmp5_elvis_lhs; if (paramType === -5001) { var tmp_2 = stmt; var tmp7_elvis_lhs = this.i5i_1.q(paramIndex_0); tmp_2.d5j(paramIndex_0, tmp7_elvis_lhs == null ? 0 : tmp7_elvis_lhs); } else if (paramType === TypesKmp_instance.l5i_1) { var tmp_3 = stmt; tmp_3.w5i(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_instance.m5i_1) { var tmp_4 = stmt; tmp_4.k5i(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'boolean' : false) ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_instance.n5i_1 ? true : paramType === TypesKmp_instance.t5i_1) { var tmp_5 = stmt; tmp_5.a5j(paramIndex_0, (value_3 == null ? true : typeof value_3 === 'string') ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_instance.o5i_1) { var tmp_6 = stmt; tmp_6.x5i(paramIndex_0, value_3 instanceof Long ? value_3 : THROW_CCE()); } else if (paramType === TypesKmp_instance.p5i_1) { var tmp_7 = stmt; tmp_7.y5i(paramIndex_0, (!(value_3 == null) ? typeof value_3 === 'number' : false) ? value_3 : THROW_CCE()); } else if (paramType === -5000) { stmt.c5j(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.n(); } throw e; } else { throw $p; } } return stmt; }; protoOf(PreparedStatementArrayProxyCommon).l5j = function () { var tmp$ret$1; $l$block: { // Inline function 'com.ustadmobile.door.jdbc.ext.useStatement' call var this_0 = this.f5j(); try { // Inline function 'com.ustadmobile.door.PreparedStatementArrayProxyCommon.executeUpdate.' call tmp$ret$1 = this_0.l5j(); break $l$block; } catch ($p) { if ($p instanceof Exception) { var e = $p; throw e; } else { throw $p; } } finally { this_0.n(); } } return tmp$ret$1; }; function createArrayOrProxyArrayOf(_this__u8e3s4, arrayType, objects) { var tmp; var tmp_0 = dbType(_this__u8e3s4); Companion_getInstance_3(); if (tmp_0 === 2) { tmp = _this__u8e3s4.p5j(arrayType, objects); } else { tmp = new JdbcArrayProxy(arrayType, objects); } return tmp; } function dbType(_this__u8e3s4) { return Companion_getInstance_3().x5j(_this__u8e3s4.q5j().r5j()); } function get_doorPrimaryKeyManager(_this__u8e3s4) { var tmp = get_rootDatabase(_this__u8e3s4); return (isInterface(tmp, DoorDatabaseJdbc) ? tmp : THROW_CCE()).y5j(); } function get_sourceDatabase(_this__u8e3s4) { var tmp; if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) { tmp = null; } else { if (isInterface(_this__u8e3s4, DoorDatabaseRepository)) { tmp = _this__u8e3s4.a5k(); } else { if (isInterface(_this__u8e3s4, DoorDatabaseWrapper)) { tmp = _this__u8e3s4.z5j(); } 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.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function get_nodeIdAuthCache(_this__u8e3s4) { var tmp; if (isInterface(_this__u8e3s4, DoorDatabaseJdbc)) { tmp = _this__u8e3s4.o5k(); } else { tmp = get_nodeIdAuthCache(get_rootDatabase(_this__u8e3s4)); } return tmp; } function prepareAndUseStatementAsync$slambda$lambda($jdbcImpl, $stmtConfig) { return function () { return '[prepareAndUseStatementAsync - ' + $jdbcImpl.d5l().r5k_1 + '] - prepare "' + $stmtConfig.e5l_1 + '"'; }; } function prepareAndUseStatementAsync$slambda($logger, $this_prepareAndUseStatementAsync, $stmtConfig, $block, $jdbcImpl, resultContinuation) { this.s5l_1 = $logger; this.t5l_1 = $this_prepareAndUseStatementAsync; this.u5l_1 = $stmtConfig; this.v5l_1 = $block; this.w5l_1 = $jdbcImpl; CoroutineImpl.call(this, resultContinuation); } protoOf(prepareAndUseStatementAsync$slambda).d5m = function (connection, $completion) { var tmp = this.e5m(connection, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(prepareAndUseStatementAsync$slambda).le = function (p1, $completion) { return this.d5m((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(prepareAndUseStatementAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 12; v(this.s5l_1, VOID, prepareAndUseStatementAsync$slambda$lambda(this.w5l_1, this.u5l_1)); this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.z5l_1 = prepareStatement(this.x5l_1, this.t5l_1, this.u5l_1); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.ld_1 = 4; continue $sm; case 4: this.md_1 = 9; this.md_1 = 8; var tmp_1 = this; tmp_1.b5m_1 = this.z5l_1; var tmp_2 = get_rootDatabase(this.t5l_1); this.b5m_1.e5j((isInterface(tmp_2, DoorDatabaseJdbc) ? tmp_2 : THROW_CCE()).f5m()); this.c5m_1 = systemTimeInMillis(); this.ld_1 = 5; suspendResult = this.v5l_1(this.b5m_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: var this_0 = suspendResult; var blockTime = systemTimeInMillis().qc(this.c5m_1); if (blockTime.c7(new Long(1000, 0)) > 0) { w_0(this.s5l_1, '[prepareAndUseStatementAsync - ' + this.w5l_1.d5l().r5k_1 + '] query ' + this.u5l_1.e5l_1 + ' took ' + blockTime.toString() + 'ms'); } this.a5m_1 = this_0; this.md_1 = 12; this.ld_1 = 6; var tmp_3 = this; continue $sm; case 6: var tmp_4 = this.a5m_1; this.md_1 = 12; this.z5l_1.n(); return tmp_4; case 7: this.md_1 = 12; var tmp_5 = this; this.z5l_1.n(); tmp_5.y5l_1 = Unit_instance; this.ld_1 = 11; continue $sm; case 8: this.md_1 = 9; var tmp_6 = this.od_1; if (tmp_6 instanceof Exception) { var e = this.od_1; var tmp_7 = this; throw e; } else { throw this.od_1; } case 9: this.md_1 = 12; var t = this.od_1; this.z5l_1.n(); throw t; case 10: this.md_1 = 12; this.z5l_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 11; continue $sm; case 11: return this.y5l_1; case 12: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 12) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; protoOf(prepareAndUseStatementAsync$slambda).e5m = function (connection, completion) { var i = new prepareAndUseStatementAsync$slambda(this.s5l_1, this.t5l_1, this.u5l_1, this.v5l_1, this.w5l_1, completion); i.x5l_1 = connection; return i; }; 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.d5m(connection, $completion); }; l.$arity = 1; return l; } function $prepareAndUseStatementAsyncCOROUTINE$1(_this__u8e3s4, stmtConfig, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.j5k_1 = _this__u8e3s4; this.k5k_1 = stmtConfig; this.l5k_1 = block; } protoOf($prepareAndUseStatementAsyncCOROUTINE$1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; var tmp_0 = this; var tmp_1 = get_rootDatabase(this.j5k_1); tmp_0.m5k_1 = isInterface(tmp_1, RoomJdbcImpl) ? tmp_1 : THROW_CCE(); this.n5k_1 = this.m5k_1.d5l().s5k_1; this.md_1 = 2; this.ld_1 = 1; var tmp_2 = this.m5k_1.d5l(); suspendResult = tmp_2.g5m(this.k5k_1.j5l_1, prepareAndUseStatementAsync$slambda_0(this.n5k_1, this.j5k_1, this.k5k_1, this.l5k_1, this.m5k_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: this.md_1 = 3; var tmp_3 = this.od_1; if (tmp_3 instanceof Exception) { var e_0 = this.od_1; if (!(e_0 instanceof CancellationException)) { e(this.n5k_1, '[prepareAndUseStatementAsync - ' + this.m5k_1.d5l().r5k_1 + '] - Exception running ' + this.k5k_1.e5l_1, e_0); } throw e_0; } else { throw this.od_1; } case 3: throw this.od_1; case 4: this.md_1 = 3; return Unit_instance; } } catch ($p) { var e_1 = $p; if (this.md_1 === 3) { throw e_1; } else { this.ld_1 = this.md_1; this.od_1 = e_1; } } while (true); }; function doorFlow(_this__u8e3s4, tables, block) { return callbackFlow(doorFlow$slambda_0(_this__u8e3s4, tables, block, null)); } function doorFlow$1$invalidationTrackerObserver$1($tables, $invalidationEventChannel) { this.i5m_1 = $invalidationEventChannel; InvalidationTrackerObserver.call(this, $tables); } protoOf(doorFlow$1$invalidationTrackerObserver$1).j5m = function (tables) { this.i5m_1.g1a(true); }; function doorFlow$slambda$slambda($this_callbackFlow, $block, $invalidationEventChannel, resultContinuation) { this.s5m_1 = $this_callbackFlow; this.t5m_1 = $block; this.u5m_1 = $invalidationEventChannel; CoroutineImpl.call(this, resultContinuation); } protoOf(doorFlow$slambda$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(doorFlow$slambda$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(doorFlow$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 6; this.ld_1 = 1; suspendResult = this.t5m_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.w5m_1 = suspendResult; this.s5m_1.g1a(this.w5m_1); this.x5m_1 = this.u5m_1.w(); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; suspendResult = this.x5m_1.d17(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: if (!suspendResult) { this.ld_1 = 5; continue $sm; } this.y5m_1 = this.x5m_1.e(); this.ld_1 = 4; suspendResult = this.t5m_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; this.s5m_1.g1a(ARGUMENT); this.ld_1 = 2; continue $sm; case 5: return Unit_instance; case 6: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 6) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(doorFlow$slambda$slambda).f1n = function ($this$launch, completion) { var i = new doorFlow$slambda$slambda(this.s5m_1, this.t5m_1, this.u5m_1, completion); i.v5m_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function doorFlow$slambda$lambda($invalidationEventChannel, $this_doorFlow, $invalidationTrackerObserver) { return function () { $invalidationEventChannel.o1a(); $this_doorFlow.z5m().d5n($invalidationTrackerObserver); return Unit_instance; }; } function doorFlow$slambda($this_doorFlow, $tables, $block, resultContinuation) { this.m5n_1 = $this_doorFlow; this.n5n_1 = $tables; this.o5n_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(doorFlow$slambda).r1m = function ($this$callbackFlow, $completion) { var tmp = this.s1m($this$callbackFlow, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(doorFlow$slambda).le = function (p1, $completion) { return this.r1m((!(p1 == null) ? isInterface(p1, ProducerScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(doorFlow$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.q5n_1 = Channel(1, BufferOverflow_DROP_OLDEST_getInstance()); var tmp_0 = this; tmp_0.r5n_1 = new doorFlow$1$invalidationTrackerObserver$1(this.n5n_1, this.q5n_1); this.m5n_1.z5m().s5n(this.r5n_1); launch(this.p5n_1, VOID, VOID, doorFlow$slambda$slambda_0(this.p5n_1, this.o5n_1, this.q5n_1, null)); this.ld_1 = 1; suspendResult = awaitClose(this.p5n_1, doorFlow$slambda$lambda(this.q5n_1, this.m5n_1, this.r5n_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(doorFlow$slambda).s1m = function ($this$callbackFlow, completion) { var i = new doorFlow$slambda(this.m5n_1, this.n5n_1, this.o5n_1, completion); i.p5n_1 = $this$callbackFlow; return i; }; 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.r1m($this$callbackFlow, $completion); }; l.$arity = 1; return l; } function NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this$0) { return function () { return this$0.y5n_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.a5o('what'), it.b5o('toNode'), it.a5o('tableId'), it.b5o('key1'), it.b5o('key2'), it.b5o('key3'), it.b5o('key4')); } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this$0, $events) { return function () { return this$0.y5n_1 + ' found ' + $events.u() + ' new events = ' + joinToString($events); }; } function NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this$0, $events) { return function () { return this$0.y5n_1 + ' emitting ' + $events.u() + ' events ' + joinToString($events) + ' '; }; } function $onBeforeTransactionAsyncCOROUTINE$2(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.k5o_1 = _this__u8e3s4; this.l5o_1 = readOnly; this.m5o_1 = connection; this.n5o_1 = transactionId; } protoOf($onBeforeTransactionAsyncCOROUTINE$2).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; if (this.l5o_1) return Unit_instance; if (this.k5o_1.v5n_1) { v(this.k5o_1.w5n_1, VOID, NodeEventJdbcImplListenerSqlite$onBeforeTransactionAsync$lambda(this.k5o_1)); this.ld_1 = 1; suspendResult = createNodeEventTableAndTrigger(this.m5o_1, this.k5o_1.t5n_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 2; continue $sm; } case 1: this.ld_1 = 2; continue $sm; case 2: return Unit_instance; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $onAfterTransactionAsyncCOROUTINE$3(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.w5o_1 = _this__u8e3s4; this.x5o_1 = readOnly; this.y5o_1 = connection; this.z5o_1 = transactionId; } protoOf($onAfterTransactionAsyncCOROUTINE$3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 19; if (this.x5o_1) return Unit_instance; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.b5p_1 = this.y5o_1.k5j('\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.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 7; this.md_1 = 6; var tmp_1 = this; tmp_1.d5p_1 = this.b5p_1; this.ld_1 = 4; suspendResult = executeQueryAsyncKmp(this.d5p_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.e5p_1 = suspendResult; var tmp_2 = this; tmp_2.c5p_1 = useResults(this.e5p_1, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda); this.md_1 = 19; this.ld_1 = 5; var tmp_3 = this; continue $sm; case 5: this.f5p_1 = this.c5p_1; this.md_1 = 19; this.b5p_1.n(); this.a5p_1 = this.f5p_1; this.ld_1 = 9; continue $sm; case 6: this.md_1 = 7; var tmp_4 = this.od_1; if (tmp_4 instanceof Exception) { this.g5p_1 = this.od_1; var tmp_5 = this; throw this.g5p_1; } else { throw this.od_1; } case 7: this.md_1 = 19; this.h5p_1 = this.od_1; this.b5p_1.n(); throw this.h5p_1; case 8: this.md_1 = 19; this.b5p_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 9; continue $sm; case 9: this.i5p_1 = this.a5p_1; v(this.w5o_1.w5n_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_0(this.w5o_1, this.i5p_1)); this.ld_1 = 10; continue $sm; case 10: var tmp_6 = this; tmp_6.k5p_1 = this.y5o_1.k5j('\n DELETE FROM NodeEvent\n '); this.ld_1 = 11; continue $sm; case 11: this.ld_1 = 12; continue $sm; case 12: this.md_1 = 16; this.md_1 = 15; var tmp_7 = this; tmp_7.m5p_1 = this.k5p_1; this.ld_1 = 13; suspendResult = executeUpdateAsyncKmp(this.m5p_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.l5p_1 = suspendResult; this.md_1 = 19; this.ld_1 = 14; var tmp_8 = this; continue $sm; case 14: var tmp_9 = this.l5p_1; this.md_1 = 19; this.k5p_1.n(); this.j5p_1 = tmp_9; this.ld_1 = 18; continue $sm; case 15: this.md_1 = 16; var tmp_10 = this.od_1; if (tmp_10 instanceof Exception) { var e = this.od_1; var tmp_11 = this; throw e; } else { throw this.od_1; } case 16: this.md_1 = 19; var t = this.od_1; this.k5p_1.n(); throw t; case 17: this.md_1 = 19; this.k5p_1.n(); if (false) { this.ld_1 = 10; continue $sm; } this.ld_1 = 18; continue $sm; case 18: if (!this.i5p_1.d1()) { d_0(this.w5o_1.w5n_1, VOID, NodeEventJdbcImplListenerSqlite$onAfterTransactionAsync$lambda_1(this.w5o_1, this.i5p_1)); var this_0 = this.w5o_1.z5n_1; var key = this.z5o_1; var value = this.i5p_1; this_0.s(key, value); } return Unit_instance; case 19: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 19) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function $onTransactionCommittedAsyncCOROUTINE$4(_this__u8e3s4, readOnly, connection, transactionId, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.v5p_1 = _this__u8e3s4; this.w5p_1 = readOnly; this.x5p_1 = connection; this.y5p_1 = transactionId; } protoOf($onTransactionCommittedAsyncCOROUTINE$4).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; if (this.w5p_1) return Unit_instance; this.z5p_1 = this.v5p_1.z5n_1.u2(this.y5p_1); if (this.z5p_1 == null) { this.a5q_1 = null; this.ld_1 = 2; continue $sm; } else { var tmp_0 = this; tmp_0.b5q_1 = this.z5p_1; var tmp_1 = this; tmp_1.c5q_1 = this.b5q_1; this.ld_1 = 1; suspendResult = this.v5p_1.u5n_1.d1e(this.c5q_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.a5q_1 = this.b5q_1; this.ld_1 = 2; continue $sm; case 2: return Unit_instance; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function NodeEventJdbcImplListenerSqlite(hasOutgoingReplicationTable, outgoingEvents, createTmpEvtTableAndTriggerOnBeforeTransaction, logger, dbName) { createTmpEvtTableAndTriggerOnBeforeTransaction = createTmpEvtTableAndTriggerOnBeforeTransaction === VOID ? true : createTmpEvtTableAndTriggerOnBeforeTransaction; this.t5n_1 = hasOutgoingReplicationTable; this.u5n_1 = outgoingEvents; this.v5n_1 = createTmpEvtTableAndTriggerOnBeforeTransaction; this.w5n_1 = logger; this.x5n_1 = dbName; this.y5n_1 = '[NodeEventJdbcImplListenerSqlite - ' + this.x5n_1 + ']'; this.z5n_1 = concurrentSafeMapOf([]); } protoOf(NodeEventJdbcImplListenerSqlite).d5q = function (readOnly, connection, transactionId, $completion) { var tmp = new $onBeforeTransactionAsyncCOROUTINE$2(this, readOnly, connection, transactionId, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(NodeEventJdbcImplListenerSqlite).e5q = function (readOnly, connection, transactionId, $completion) { var tmp = new $onAfterTransactionAsyncCOROUTINE$3(this, readOnly, connection, transactionId, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(NodeEventJdbcImplListenerSqlite).f5q = function (readOnly, connection, transactionId, $completion) { var tmp = new $onTransactionCommittedAsyncCOROUTINE$4(this, readOnly, connection, transactionId, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this$0, resultContinuation) { this.o5q_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).r5q = function (limit, offset, $completion) { var tmp = this.s5q(limit, offset, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).en = function (p1, p2, $completion) { var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE(); return this.r5q(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.o5q_1.z5q(this.p5q_1, this.q5q_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda$slambda).s5q = function (limit, offset, completion) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda$slambda(this.o5q_1, completion); i.p5q_1 = limit; i.q5q_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.r5q(limit, offset, $completion); }; l.$arity = 2; return l; } function InvalidationTracker($outer) { this.c5r_1 = $outer; InvalidationTrackerObserver.call(this, $outer.v5q_1); this.b5r_1 = atomic$boolean$1(false); } protoOf(InvalidationTracker).d5r = function () { if (!this.b5r_1.atomicfu$getAndSet(true)) { this.c5r_1.u5q_1.z5m().e5r(this); } }; protoOf(InvalidationTracker).j5m = function (tables) { if (!this.c5r_1.x5q_1.atomicfu$getAndSet(true)) { Napier_getInstance().j5f('DoorLimitOffsetPagingSource: invalidated tables=' + joinToString(tables)); this.c5r_1.l55(); } }; function initialLoad($this, params, $completion) { var tmp = TransactionMode_READ_ONLY_getInstance(); return withDoorTransactionAsync($this.u5q_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.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function DoorLimitOffsetPagingSource$load$slambda(this$0, $params, resultContinuation) { this.z5r_1 = this$0; this.a5s_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$load$slambda).e5s = function ($this$withContext, $completion) { var tmp = this.f1n($this$withContext, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorLimitOffsetPagingSource$load$slambda).le = function (p1, $completion) { return this.e5s((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$load$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; this.z5r_1.y5q_1.d5r(); this.c5s_1 = this.z5r_1.w5q_1.kotlinx$atomicfu$value; if (this.c5s_1 === get_INITIAL_ITEM_COUNT()) { this.ld_1 = 2; suspendResult = initialLoad(this.z5r_1, this.a5s_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 1; suspendResult = nonInitialLoad(this.z5r_1, this.a5s_1, this.c5s_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.d5s_1 = suspendResult; this.ld_1 = 3; continue $sm; case 2: this.d5s_1 = suspendResult; this.ld_1 = 3; continue $sm; case 3: return this.d5s_1; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorLimitOffsetPagingSource$load$slambda).f1n = function ($this$withContext, completion) { var i = new DoorLimitOffsetPagingSource$load$slambda(this.z5r_1, this.a5s_1, completion); i.b5s_1 = $this$withContext; return i; }; 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.e5s($this$withContext, $completion); }; l.$arity = 1; return l; } function DoorLimitOffsetPagingSource$initialLoad$slambda(this$0, $params, resultContinuation) { this.n5s_1 = this$0; this.o5s_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).r5s = function (it, $completion) { var tmp = this.s5s(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).le = function (p1, $completion) { return this.r5s(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; this.ld_1 = 1; suspendResult = this.n5s_1.t5s(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.q5s_1 = suspendResult; this.n5s_1.w5q_1.kotlinx$atomicfu$value = this.q5s_1; this.ld_1 = 2; suspendResult = queryDatabase(this.o5s_1, DoorLimitOffsetPagingSource$initialLoad$slambda$slambda_0(this.n5s_1, null), this.q5s_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: return suspendResult; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorLimitOffsetPagingSource$initialLoad$slambda).s5s = function (it, completion) { var i = new DoorLimitOffsetPagingSource$initialLoad$slambda(this.n5s_1, this.o5s_1, completion); i.p5s_1 = it; return i; }; 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.r5s(it, $completion); }; l.$arity = 1; return l; } function DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this$0, resultContinuation) { this.c5t_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).r5q = function (limit, offset, $completion) { var tmp = this.s5q(limit, offset, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).en = function (p1, p2, $completion) { var tmp = (!(p1 == null) ? typeof p1 === 'number' : false) ? p1 : THROW_CCE(); return this.r5q(tmp, (!(p2 == null) ? typeof p2 === 'number' : false) ? p2 : THROW_CCE(), $completion); }; protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.c5t_1.z5q(this.d5t_1, this.e5t_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorLimitOffsetPagingSource$nonInitialLoad$slambda).s5q = function (limit, offset, completion) { var i = new DoorLimitOffsetPagingSource$nonInitialLoad$slambda(this.c5t_1, completion); i.d5t_1 = limit; i.e5t_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.r5q(limit, offset, $completion); }; l.$arity = 2; return l; } function $nonInitialLoadCOROUTINE$5(_this__u8e3s4, params, tempCount, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.n5r_1 = _this__u8e3s4; this.o5r_1 = params; this.p5r_1 = tempCount; } protoOf($nonInitialLoadCOROUTINE$5).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; if (this.n5r_1.x5q_1.kotlinx$atomicfu$value) { var tmp_0 = this; var tmp_1 = get_INVALID(); tmp_0.q5r_1 = tmp_1 instanceof LoadResult ? tmp_1 : THROW_CCE(); this.ld_1 = 2; continue $sm; } else { this.ld_1 = 1; suspendResult = queryDatabase(this.o5r_1, DoorLimitOffsetPagingSource$nonInitialLoad$slambda_0(this.n5r_1, null), this.p5r_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.q5r_1 = suspendResult; this.ld_1 = 2; continue $sm; case 2: return this.q5r_1; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function DoorLimitOffsetPagingSource(db, tableNames) { PagingSource.call(this); this.u5q_1 = db; this.v5q_1 = tableNames; this.w5q_1 = atomic$int$1(get_INITIAL_ITEM_COUNT()); this.x5q_1 = atomic$boolean$1(false); this.y5q_1 = new InvalidationTracker(this); } protoOf(DoorLimitOffsetPagingSource).f5t = function (params, $completion) { var tmp = Dispatchers_getInstance().z12_1; return withContext(tmp, DoorLimitOffsetPagingSource$load$slambda_0(this, params, null), $completion); }; protoOf(DoorLimitOffsetPagingSource).q55 = function (params, $completion) { return this.f5t(params, $completion); }; function fireChanges($this, listToFire) { var tmp = Napier_getInstance(); tmp.f5f(VOID, 'DoorLog', InvalidationTracker$fireChanges$lambda(listToFire)); // Inline function 'kotlin.collections.filter' call // Inline function 'kotlin.collections.filterTo' call var this_0 = $this.b5n_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.any' call var indexedObject = element.g5t_1; 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.b1(element_0)) { tmp$ret$1 = true; break $l$block; } } tmp$ret$1 = false; } if (tmp$ret$1) { destination.j1(element); } } var affectedObservers = destination; // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_0 = affectedObservers.w(); while (tmp0_iterator_0.f()) { var element_1 = tmp0_iterator_0.e(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call element_1.j5m(listToFire); } // Inline function 'kotlin.collections.mapNotNull' call // Inline function 'kotlin.collections.mapNotNullTo' call var this_1 = $this.c5n_1; var destination_0 = ArrayList_init_$Create$(); // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_1 = this_1.w(); while (tmp0_iterator_1.f()) { var element_2 = tmp0_iterator_1.e(); // Inline function 'kotlin.collections.mapNotNullTo.' call // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call var observer = element_2.vz(); var tmp_0; var tmp_1; if (!(observer == null)) { var tmp$ret$6; $l$block_0: { // Inline function 'kotlin.collections.any' call var indexedObject_0 = observer.g5t_1; 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.b1(element_3)) { tmp$ret$6 = true; break $l$block_0; } } tmp$ret$6 = false; } tmp_1 = tmp$ret$6; } else { tmp_1 = false; } if (tmp_1) { tmp_0 = observer; } else { tmp_0 = null; } var tmp0_safe_receiver = tmp_0; if (tmp0_safe_receiver == null) null; else { // Inline function 'kotlin.let' call // Inline function 'kotlin.contracts.contract' call destination_0.j1(tmp0_safe_receiver); } } var affectedWeakObservers = destination_0; // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_2 = affectedWeakObservers.w(); while (tmp0_iterator_2.f()) { var element_4 = tmp0_iterator_2.e(); // Inline function 'com.ustadmobile.door.room.InvalidationTracker.fireChanges.' call element_4.j5m(listToFire); } removeAll($this.c5n_1, InvalidationTracker$fireChanges$lambda_0); } function Companion_0() { this.h5t_1 = 'door_update_mods'; this.i5t_1 = 'tableId'; this.j5t_1 = 'invalidated'; this.k5t_1 = 'CREATE TEMP TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)'; this.l5t_1 = 'CREATE TABLE IF NOT EXISTS door_update_mods (tableId INTEGER PRIMARY KEY, invalidated INTEGER NOT NULL DEFAULT 0)'; this.m5t_1 = 'SELECT tableId FROM door_update_mods WHERE invalidated = 1'; this.n5t_1 = '\n UPDATE door_update_mods \n SET invalidated = 0 \n WHERE invalidated = 1\n '; } protoOf(Companion_0).o5t = 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.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // 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.w(); while (tmp0_iterator_0.f()) { var item_0 = tmp0_iterator_0.e(); // 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.j1(tmp$ret$0); } var tmp$ret$3 = plus(tmp_0, destination_0); destination.j1(tmp$ret$3); } return plus(tmp, flatten(destination)); }; var Companion_instance_0; function Companion_getInstance_2() { return Companion_instance_0; } function InvalidationTracker$fireChanges$lambda($listToFire) { return function () { return '' + ('InvalidationTracker: tables invalidated: ' + joinToString($listToFire)); }; } function InvalidationTracker$fireChanges$lambda_0(it) { return it.vz() == null; } function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0) { return function (it) { return this$0.a5n_1.v(it.p5t(1)); }; } function InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this$0) { return function (results) { return mapRows(results, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda$lambda(this$0)); }; } function $findChangedTablesOnConnectionAsyncCOROUTINE$7(_this__u8e3s4, connection, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.y5t_1 = _this__u8e3s4; this.z5t_1 = connection; } protoOf($findChangedTablesOnConnectionAsyncCOROUTINE$7).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 17; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.b5u_1 = this.z5t_1.k5j('SELECT tableId FROM door_update_mods WHERE invalidated = 1'); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 7; this.md_1 = 6; var tmp_1 = this; tmp_1.d5u_1 = this.b5u_1; this.ld_1 = 4; suspendResult = executeQueryAsyncKmp(this.d5u_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.e5u_1 = suspendResult; var tmp_2 = this; tmp_2.c5u_1 = useResults(this.e5u_1, InvalidationTracker$findChangedTablesOnConnectionAsync$lambda(this.y5t_1)); this.md_1 = 17; this.ld_1 = 5; var tmp_3 = this; continue $sm; case 5: this.f5u_1 = this.c5u_1; this.md_1 = 17; this.b5u_1.n(); this.a5u_1 = this.f5u_1; this.ld_1 = 9; continue $sm; case 6: this.md_1 = 7; var tmp_4 = this.od_1; if (tmp_4 instanceof Exception) { this.g5u_1 = this.od_1; var tmp_5 = this; throw this.g5u_1; } else { throw this.od_1; } case 7: this.md_1 = 17; this.h5u_1 = this.od_1; this.b5u_1.n(); throw this.h5u_1; case 8: this.md_1 = 17; this.b5u_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 9; continue $sm; case 9: this.i5u_1 = this.a5u_1; this.ld_1 = 10; continue $sm; case 10: var tmp_6 = this; tmp_6.k5u_1 = this.z5t_1.k5j('\n UPDATE door_update_mods \n SET invalidated = 0 \n WHERE invalidated = 1\n '); this.ld_1 = 11; continue $sm; case 11: this.ld_1 = 12; continue $sm; case 12: this.md_1 = 16; this.md_1 = 15; var tmp_7 = this; tmp_7.m5u_1 = this.k5u_1; this.ld_1 = 13; suspendResult = executeUpdateAsyncKmp(this.m5u_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.l5u_1 = suspendResult; this.md_1 = 17; this.ld_1 = 14; var tmp_8 = this; continue $sm; case 14: var tmp_9 = this.l5u_1; this.md_1 = 17; this.k5u_1.n(); this.j5u_1 = tmp_9; this.ld_1 = 19; continue $sm; case 15: this.md_1 = 16; var tmp_10 = this.od_1; if (tmp_10 instanceof Exception) { var e = this.od_1; var tmp_11 = this; throw e; } else { throw this.od_1; } case 16: this.md_1 = 17; var t = this.od_1; this.k5u_1.n(); throw t; case 17: throw this.od_1; case 18: this.md_1 = 17; this.k5u_1.n(); if (false) { this.ld_1 = 10; continue $sm; } this.ld_1 = 19; continue $sm; case 19: return this.i5u_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 17) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function InvalidationTracker_0(tables) { this.a5n_1 = toList(tables); this.b5n_1 = concurrentSafeListOf([]); this.c5n_1 = concurrentSafeListOf([]); } protoOf(InvalidationTracker_0).s5n = function (observer) { // Inline function 'kotlin.collections.plusAssign' call this.b5n_1.j1(observer); }; protoOf(InvalidationTracker_0).d5n = function (observer) { // Inline function 'kotlin.collections.minusAssign' call this.b5n_1.k1(observer); }; protoOf(InvalidationTracker_0).e5r = function (observer) { // Inline function 'kotlin.collections.plusAssign' call var this_0 = this.c5n_1; var element = weakRefOf(observer); this_0.j1(element); }; protoOf(InvalidationTracker_0).n5u = function (tableNames) { fireChanges(this, tableNames); }; protoOf(InvalidationTracker_0).o5u = function (connection, $completion) { var tmp = new $findChangedTablesOnConnectionAsyncCOROUTINE$7(this, connection, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function InvalidationTrackerObserver(tables) { this.g5t_1 = tables; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda($connectionLogPrefix, $t, $transactionStartTime) { return function () { return $connectionLogPrefix + ' : cancelled ' + $t.message + ' after ' + systemTimeInMillis().qc($transactionStartTime).toString() + 'ms'; }; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda($block, $transactionContext, resultContinuation) { this.x5u_1 = $block; this.y5u_1 = $transactionContext; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).a5v = function ($this$withContext, $completion) { var tmp = this.f1n($this$withContext, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).le = function (p1, $completion) { return this.a5v((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.x5u_1(this.y5u_1.c5v_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda).f1n = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda(this.x5u_1, this.y5u_1, completion); i.z5u_1 = $this$withContext; return i; }; 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.a5v($this$withContext, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this$0, $readOnly, $block, resultContinuation) { this.n5v_1 = this$0; this.o5v_1 = $readOnly; this.p5v_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).a5v = function ($this$withTimeout, $completion) { var tmp = this.f1n($this$withTimeout, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).le = function (p1, $completion) { return this.a5v((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 6; var tmp_0 = this; tmp_0.r5v_1 = this.n5v_1.y5k_1; var tmp_1 = this; tmp_1.s5v_1 = null; this.ld_1 = 1; suspendResult = this.r5v_1.k24(this.s5v_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ld_1 = 2; continue $sm; case 2: this.md_1 = 5; this.ld_1 = 3; suspendResult = useNewConnectionAsyncInternal(this.n5v_1, this.o5v_1, this.p5v_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.t5v_1 = suspendResult; this.md_1 = 6; this.ld_1 = 4; continue $sm; case 4: var tmp_2 = this.t5v_1; this.md_1 = 6; this.r5v_1.v23(this.s5v_1); return tmp_2; case 5: this.md_1 = 6; var t = this.od_1; this.r5v_1.v23(this.s5v_1); throw t; case 6: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 6) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1).f1n = function ($this$withTimeout, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_1(this.n5v_1, this.o5v_1, this.p5v_1, completion); i.q5v_1 = $this$withTimeout; return i; }; 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.a5v($this$withTimeout, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this$0, $readOnly, $block, resultContinuation) { this.c5w_1 = this$0; this.d5w_1 = $readOnly; this.e5w_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).a5v = function ($this$withTimeout, $completion) { var tmp = this.f1n($this$withTimeout, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).le = function (p1, $completion) { return this.a5v((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = useNewConnectionAsyncInternal(this.c5w_1, this.d5w_1, this.e5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3).f1n = function ($this$withTimeout, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_3(this.c5w_1, this.d5w_1, this.e5w_1, completion); i.f5w_1 = $this$withTimeout; return i; }; 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.a5v($this$withTimeout, $completion); }; l.$arity = 1; return l; } function TransactionElement(key, connection, transactionId, readOnly) { transactionId = transactionId === VOID ? 0 : transactionId; this.b5v_1 = key; this.c5v_1 = connection; this.d5v_1 = transactionId; this.e5v_1 = readOnly; } protoOf(TransactionElement).s2 = function () { return this.b5v_1; }; function useNewConnectionAsyncInternal($this, readOnly, block, $completion) { var tmp = new $useNewConnectionAsyncInternalCOROUTINE$8($this, readOnly, block, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function Key() { } var Key_instance; function Key_getInstance() { 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.w5x_1 = $block; this.x5x_1 = $transactionElement; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).a5v = function ($this$withContext, $completion) { var tmp = this.f1n($this$withContext, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).le = function (p1, $completion) { return this.a5v((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.w5x_1(this.x5x_1.c5v_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda).f1n = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda(this.w5x_1, this.x5x_1, completion); i.y5x_1 = $this$withContext; return i; }; 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.a5v($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.h5y_1 = this$0; this.i5y_1 = $changedTables; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; if (tmp === 0) { this.md_1 = 1; this.h5y_1.u5k_1.n5u(toSet(this.i5y_1)); return Unit_instance; } else if (tmp === 1) { throw this.od_1; } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1).f1n = function ($this$launch, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_1(this.h5y_1, this.i5y_1, completion); i.j5y_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3($t, this$0, $connectionLogPrefix, $connection, $readOnly, $connectionId, $transactionStartTime, resultContinuation) { this.s5y_1 = $t; this.t5y_1 = this$0; this.u5y_1 = $connectionLogPrefix; this.v5y_1 = $connection; this.w5y_1 = $readOnly; this.x5y_1 = $connectionId; this.y5y_1 = $transactionStartTime; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).e1n = function ($this$withContext, $completion) { var tmp = this.f1n($this$withContext, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; var tmp_0 = this.s5y_1; if (tmp_0 instanceof CancellationException) { v(this.t5y_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda$lambda(this.u5y_1, this.s5y_1, this.y5y_1)); } else { e(this.t5y_1.s5k_1, this.u5y_1 + ' exception ', this.s5y_1); } if (!this.v5y_1.c5z() ? !this.w5y_1 : false) { i(this.t5y_1.s5k_1, this.u5y_1 + ' Attempting to rollback transaction #' + this.x5y_1); var tmp_1 = this.v5y_1; if (isInterface(tmp_1, ConnectionAsync)) { this.ld_1 = 1; suspendResult = this.v5y_1.b5z(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.v5y_1.a5z(); this.ld_1 = 2; continue $sm; } } else { this.ld_1 = 3; continue $sm; } case 1: this.ld_1 = 2; continue $sm; case 2: i(this.t5y_1.s5k_1, this.u5y_1 + ' Rolled back changes'); this.ld_1 = 3; continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 4) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3).f1n = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_3(this.s5y_1, this.t5y_1, this.u5y_1, this.v5y_1, this.w5y_1, this.x5y_1, this.y5y_1, completion); i.z5y_1 = $this$withContext; return i; }; 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.e1n($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.l5z_1 = this$0; this.m5z_1 = $readOnly; this.n5z_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).a5v = function ($this$withContext, $completion) { var tmp = this.f1n($this$withContext, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).le = function (p1, $completion) { return this.a5v((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 5; this.p5z_1 = this.o5z_1.mq().td(Key_instance); var tmp_0 = this; var tmp_1 = get_rootDatabase(this.l5z_1.q5k_1); tmp_0.q5z_1 = toLong(imul((isInterface(tmp_1, DoorDatabaseJdbc) ? tmp_1 : THROW_CCE()).f5m(), 1000)); if (!(this.p5z_1 == null)) { if (this.p5z_1.e5v_1 ? !this.m5z_1 : false) { throw IllegalStateException_init_$Create$('Current transaction context is read-only'); } this.ld_1 = 3; suspendResult = withContext(this.p5z_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_0(this.n5z_1, this.p5z_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { Companion_getInstance_3(); if (this.l5z_1.v5k_1 === 1) { this.ld_1 = 2; suspendResult = withTimeout(this.q5z_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_2(this.l5z_1, this.m5z_1, this.n5z_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 1; suspendResult = withTimeout(this.q5z_1, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda$slambda_4(this.l5z_1, this.m5z_1, this.n5z_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } } case 1: this.r5z_1 = suspendResult; this.ld_1 = 4; continue $sm; case 2: this.r5z_1 = suspendResult; this.ld_1 = 4; continue $sm; case 3: this.r5z_1 = suspendResult; this.ld_1 = 4; continue $sm; case 4: return this.r5z_1; case 5: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 5) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda).f1n = function ($this$withContext, completion) { var i = new RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda(this.l5z_1, this.m5z_1, this.n5z_1, completion); i.o5z_1 = $this$withContext; return i; }; 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.a5v($this$withContext, $completion); }; l.$arity = 1; return l; } function $useNewConnectionAsyncInternalCOROUTINE$8(_this__u8e3s4, readOnly, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.o5w_1 = _this__u8e3s4; this.p5w_1 = readOnly; this.q5w_1 = block; } protoOf($useNewConnectionAsyncInternalCOROUTINE$8).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 28; this.o5w_1.s5z(); this.r5w_1 = this.o5w_1.p5k_1.t5h(); this.s5w_1 = this.o5w_1.w5k_1.atomicfu$incrementAndGet(); this.t5w_1 = this.o5w_1.b5l_1 + ' - useNewConnectionAsyncInternal connection #' + this.s5w_1 + ' '; v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda(this.t5w_1, this.p5w_1)); if (!this.p5w_1) { var tmp_0 = this.r5w_1; if (isInterface(tmp_0, ConnectionAsync)) { this.ld_1 = 1; suspendResult = this.r5w_1.t5z(false, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.r5w_1.u5h(false); this.ld_1 = 2; continue $sm; } } else { this.ld_1 = 3; continue $sm; } case 1: this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.u5w_1 = systemTimeInMillis(); this.v5w_1 = mutableLinkedListOf_0([]); this.ld_1 = 4; continue $sm; case 4: this.ld_1 = 5; continue $sm; case 5: this.md_1 = 27; this.md_1 = 24; var tmp_1; if (!this.p5w_1) { Companion_getInstance_3(); tmp_1 = this.o5w_1.v5k_1 === 1; } else { tmp_1 = false; } if (tmp_1) { v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_0(this.t5w_1)); this.ld_1 = 6; suspendResult = this.o5w_1.u5z(this.r5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 7; continue $sm; } case 6: this.ld_1 = 7; continue $sm; case 7: this.x5w_1 = new TransactionElement(Key_instance, this.r5w_1, this.s5w_1, this.p5w_1); var this_0 = this.o5w_1.x5k_1; var key = this.s5w_1; var value = this.x5w_1; this_0.s(key, value); var tmp_2 = this; tmp_2.y5w_1 = this.o5w_1.z5k_1; this.z5w_1 = this.y5w_1.w(); this.ld_1 = 8; continue $sm; case 8: if (!this.z5w_1.f()) { this.ld_1 = 10; continue $sm; } this.a5x_1 = this.z5w_1.e(); var tmp_3 = this; tmp_3.b5x_1 = this.a5x_1; this.ld_1 = 9; suspendResult = this.b5x_1.d5q(this.p5w_1, this.r5w_1, this.s5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 9: this.ld_1 = 8; continue $sm; case 10: this.ld_1 = 11; suspendResult = withContext(this.x5w_1, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_0(this.q5w_1, this.x5w_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 11: this.c5x_1 = suspendResult; var tmp_4; if (!this.p5w_1) { Companion_getInstance_3(); tmp_4 = this.o5w_1.v5k_1 === 1; } else { tmp_4 = false; } if (tmp_4) { this.ld_1 = 12; suspendResult = this.o5w_1.u5k_1.o5u(this.r5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 13; continue $sm; } case 12: this.d5x_1 = suspendResult; d_0(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_1(this.t5w_1, this.d5x_1)); this.v5w_1.n1(this.d5x_1); this.ld_1 = 13; continue $sm; case 13: var tmp_5 = this; tmp_5.e5x_1 = this.o5w_1.z5k_1; this.f5x_1 = this.e5x_1.w(); this.ld_1 = 14; continue $sm; case 14: if (!this.f5x_1.f()) { this.ld_1 = 16; continue $sm; } this.g5x_1 = this.f5x_1.e(); var tmp_6 = this; tmp_6.h5x_1 = this.g5x_1; this.ld_1 = 15; suspendResult = this.h5x_1.e5q(this.p5w_1, this.r5w_1, this.s5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 15: this.ld_1 = 14; continue $sm; case 16: if (!this.p5w_1) { var tmp_7 = this.r5w_1; if (isInterface(tmp_7, ConnectionAsync)) { this.ld_1 = 17; suspendResult = this.r5w_1.v5z(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.r5w_1.v5h(); this.ld_1 = 18; continue $sm; } } else { this.ld_1 = 19; continue $sm; } case 17: this.ld_1 = 18; continue $sm; case 18: v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_2(this.t5w_1)); this.ld_1 = 19; continue $sm; case 19: var tmp_8 = this; tmp_8.i5x_1 = this.o5w_1.z5k_1; this.j5x_1 = this.i5x_1.w(); this.ld_1 = 20; continue $sm; case 20: if (!this.j5x_1.f()) { this.ld_1 = 22; continue $sm; } this.k5x_1 = this.j5x_1.e(); var tmp_9 = this; tmp_9.l5x_1 = this.k5x_1; this.ld_1 = 21; suspendResult = this.l5x_1.f5q(this.p5w_1, this.r5w_1, this.s5w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 21: this.ld_1 = 20; continue $sm; case 22: var this_1 = this.o5w_1.c5l_1; var tmp_10; if (!this.v5w_1.d1()) { tmp_10 = this_1; } else { tmp_10 = null; } var tmp0_safe_receiver = tmp_10; if (tmp0_safe_receiver == null) null; else { launch(tmp0_safe_receiver, VOID, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_2(this.o5w_1, this.v5w_1, null)); } this.w5w_1 = this.c5x_1; this.md_1 = 28; this.ld_1 = 23; var tmp_11 = this; continue $sm; case 23: this.m5x_1 = this.w5w_1; this.md_1 = 28; this.r5w_1.n(); this.o5w_1.x5k_1.u2(this.s5w_1); v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.t5w_1, this.s5w_1)); if (!this.o5w_1.x5k_1.d1()) { w_0(this.o5w_1.s5k_1, 'useConnectionAsync: close transaction ' + this.s5w_1 + ' (took ' + systemTimeInMillis().qc(this.u5w_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.o5w_1.x5k_1.o2()) + '] pending async transactions still open.')); } return this.m5x_1; case 24: this.md_1 = 27; var tmp_12 = this.od_1; if (tmp_12 instanceof Error) { this.n5x_1 = this.od_1; this.ld_1 = 25; var tmp_13 = NonCancellable_getInstance(); suspendResult = withContext(tmp_13, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$slambda_4(this.n5x_1, this.o5w_1, this.t5w_1, this.r5w_1, this.p5w_1, this.s5w_1, this.u5w_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw this.od_1; } case 25: var tmp_14 = this; throw this.n5x_1; case 26: this.md_1 = 28; this.r5w_1.n(); this.o5w_1.x5k_1.u2(this.s5w_1); v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.t5w_1, this.s5w_1)); if (!this.o5w_1.x5k_1.d1()) { w_0(this.o5w_1.s5k_1, 'useConnectionAsync: close transaction ' + this.s5w_1 + ' (took ' + systemTimeInMillis().qc(this.u5w_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.o5w_1.x5k_1.o2()) + '] pending async transactions still open.')); } return Unit_instance; case 27: this.md_1 = 28; var t = this.od_1; this.r5w_1.n(); this.o5w_1.x5k_1.u2(this.s5w_1); v(this.o5w_1.s5k_1, VOID, RoomDatabaseJdbcImplHelperCommon$useNewConnectionAsyncInternal$lambda_3(this.t5w_1, this.s5w_1)); if (!this.o5w_1.x5k_1.d1()) { w_0(this.o5w_1.s5k_1, 'useConnectionAsync: close transaction ' + this.s5w_1 + ' (took ' + systemTimeInMillis().qc(this.u5w_1).toString() + 'ms).' + ('There are Transactions [' + joinToString(this.o5w_1.x5k_1.o2()) + '] pending async transactions still open.')); } throw t; case 28: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 28) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function RoomDatabaseJdbcImplHelperCommon(dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType, dispatcher) { var tmp; if (dbType === VOID) { Companion_getInstance_3(); tmp = 1; } else { tmp = dbType; } dbType = tmp; dispatcher = dispatcher === VOID ? Dispatchers_getInstance().z12_1 : dispatcher; this.p5k_1 = dataSource; this.q5k_1 = db; this.r5k_1 = dbName; this.s5k_1 = logger; this.t5k_1 = tableNames; this.u5k_1 = invalidationTracker; this.v5k_1 = dbType; this.w5k_1 = atomic$int$1(0); this.x5k_1 = concurrentSafeMapOf([]); this.y5k_1 = Mutex(); this.z5k_1 = concurrentSafeListOf([]); this.a5l_1 = atomic$boolean$1(false); this.b5l_1 = '[RoomJdbcImplHelper - ' + this.r5k_1 + ']'; this.c5l_1 = CoroutineScope_0(dispatcher.rj(Job())); } protoOf(RoomDatabaseJdbcImplHelperCommon).s5z = function () { if (this.a5l_1.kotlinx$atomicfu$value) throw IllegalStateException_init_$Create$('' + this + ' is closed!'); }; protoOf(RoomDatabaseJdbcImplHelperCommon).g5m = function (readOnly, block, $completion) { var tmp = this.c5l_1.mq(); return withContext(tmp, RoomDatabaseJdbcImplHelperCommon$useConnectionAsync$slambda_0(this, readOnly, block, null), $completion); }; protoOf(RoomDatabaseJdbcImplHelperCommon).w5z = function (listener) { // Inline function 'kotlin.collections.plusAssign' call this.z5k_1.j1(listener); }; function RoomJdbcImpl() { } function dropDoorTriggersAndReceiveViewsSqlite(_this__u8e3s4, $completion) { var tmp = new $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function getSqliteDoorTriggerNames(_this__u8e3s4, $completion) { var tmp = new $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function getSqliteDoorReceiveViewNames(_this__u8e3s4, $completion) { var tmp = new $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function getSqliteDoorTriggerNames$lambda(results) { return mapRows(results, getSqliteDoorTriggerNames$lambda$lambda); } function getSqliteDoorTriggerNames$lambda$lambda(resultSet) { return resultSet.a62(1); } function getSqliteDoorReceiveViewNames$lambda(results) { return mapRows(results, getSqliteDoorReceiveViewNames$lambda$lambda); } function getSqliteDoorReceiveViewNames$lambda$lambda(resultSet) { return resultSet.a62(1); } function $dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.f60_1 = _this__u8e3s4; } protoOf($dropDoorTriggersAndReceiveViewsSqliteCOROUTINE$9).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 25; this.ld_1 = 1; suspendResult = getSqliteDoorTriggerNames(this.f60_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.g60_1 = suspendResult; this.ld_1 = 2; continue $sm; case 2: var tmp_0 = this; tmp_0.i60_1 = this.f60_1.b62(); this.ld_1 = 3; continue $sm; case 3: this.ld_1 = 4; continue $sm; case 4: this.md_1 = 10; this.md_1 = 9; var tmp_1 = this; tmp_1.k60_1 = this.i60_1; var tmp_2 = this; tmp_2.l60_1 = this.g60_1; this.m60_1 = this.l60_1.w(); this.ld_1 = 5; continue $sm; case 5: if (!this.m60_1.f()) { this.ld_1 = 7; continue $sm; } this.n60_1 = this.m60_1.e(); var tmp_3 = this; tmp_3.o60_1 = this.n60_1; this.ld_1 = 6; suspendResult = executeUpdateAsync(this.k60_1, 'DROP TRIGGER ' + this.o60_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 6: this.ld_1 = 5; continue $sm; case 7: this.j60_1 = Unit_instance; this.md_1 = 25; this.ld_1 = 8; var tmp_4 = this; continue $sm; case 8: this.md_1 = 25; var tmp_5 = this; this.i60_1.n(); tmp_5.h60_1 = Unit_instance; this.ld_1 = 12; continue $sm; case 9: this.md_1 = 10; var tmp_6 = this.od_1; if (tmp_6 instanceof Exception) { this.p60_1 = this.od_1; var tmp_7 = this; throw this.p60_1; } else { throw this.od_1; } case 10: this.md_1 = 25; this.q60_1 = this.od_1; this.i60_1.n(); throw this.q60_1; case 11: this.md_1 = 25; this.i60_1.n(); if (false) { this.ld_1 = 2; continue $sm; } this.ld_1 = 12; continue $sm; case 12: this.ld_1 = 13; suspendResult = getSqliteDoorReceiveViewNames(this.f60_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 13: this.r60_1 = suspendResult; this.ld_1 = 14; continue $sm; case 14: var tmp_8 = this; tmp_8.t60_1 = this.f60_1.b62(); this.ld_1 = 15; continue $sm; case 15: this.ld_1 = 16; continue $sm; case 16: this.md_1 = 22; this.md_1 = 21; var tmp_9 = this; tmp_9.v60_1 = this.t60_1; var tmp_10 = this; tmp_10.w60_1 = this.r60_1; this.x60_1 = this.w60_1.w(); this.ld_1 = 17; continue $sm; case 17: if (!this.x60_1.f()) { this.ld_1 = 19; continue $sm; } this.y60_1 = this.x60_1.e(); var tmp_11 = this; tmp_11.z60_1 = this.y60_1; this.ld_1 = 18; suspendResult = executeUpdateAsync(this.v60_1, 'DROP VIEW ' + this.z60_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 18: this.ld_1 = 17; continue $sm; case 19: this.u60_1 = Unit_instance; this.md_1 = 25; this.ld_1 = 20; var tmp_12 = this; continue $sm; case 20: this.md_1 = 25; var tmp_13 = this; this.t60_1.n(); tmp_13.s60_1 = Unit_instance; this.ld_1 = 24; continue $sm; case 21: this.md_1 = 22; var tmp_14 = this.od_1; if (tmp_14 instanceof Exception) { var e = this.od_1; var tmp_15 = this; throw e; } else { throw this.od_1; } case 22: this.md_1 = 25; var t = this.od_1; this.t60_1.n(); throw t; case 23: this.md_1 = 25; this.t60_1.n(); if (false) { this.ld_1 = 14; continue $sm; } this.ld_1 = 24; continue $sm; case 24: return Unit_instance; case 25: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 25) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function $getSqliteDoorTriggerNamesCOROUTINE$10(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.i61_1 = _this__u8e3s4; } protoOf($getSqliteDoorTriggerNamesCOROUTINE$10).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 8; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.k61_1 = this.i61_1.k5j("\n SELECT name\n FROM sqlite_master\n WHERE type = 'trigger'\n AND name LIKE ?\n "); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 7; this.md_1 = 6; var tmp_1 = this; tmp_1.m61_1 = this.k61_1; this.m61_1.a5j(1, '_d' + '%'); this.ld_1 = 4; suspendResult = executeQueryAsyncKmp(this.m61_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; var tmp_2 = this; tmp_2.l61_1 = useResults(ARGUMENT, getSqliteDoorTriggerNames$lambda); this.md_1 = 8; this.ld_1 = 5; var tmp_3 = this; continue $sm; case 5: var tmp_4 = this.l61_1; this.md_1 = 8; this.k61_1.n(); this.j61_1 = tmp_4; this.ld_1 = 10; continue $sm; case 6: this.md_1 = 7; var tmp_5 = this.od_1; if (tmp_5 instanceof Exception) { var e = this.od_1; var tmp_6 = this; throw e; } else { throw this.od_1; } case 7: this.md_1 = 8; var t = this.od_1; this.k61_1.n(); throw t; case 8: throw this.od_1; case 9: this.md_1 = 8; this.k61_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 10; continue $sm; case 10: var this_0 = this.j61_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); if (element == null) null; else { destination.j1(element); } } return destination; } } catch ($p) { var e_0 = $p; if (this.md_1 === 8) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function $getSqliteDoorReceiveViewNamesCOROUTINE$11(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.v61_1 = _this__u8e3s4; } protoOf($getSqliteDoorReceiveViewNamesCOROUTINE$11).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 8; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.x61_1 = this.v61_1.k5j("\n SELECT name\n FROM sqlite_master\n WHERE type = 'view'\n AND name LIKE ?\n "); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 7; this.md_1 = 6; var tmp_1 = this; tmp_1.z61_1 = this.x61_1; this.z61_1.a5j(1, '%' + '_ReceiveView'); this.ld_1 = 4; suspendResult = executeQueryAsyncKmp(this.z61_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var ARGUMENT = suspendResult; var tmp_2 = this; tmp_2.y61_1 = useResults(ARGUMENT, getSqliteDoorReceiveViewNames$lambda); this.md_1 = 8; this.ld_1 = 5; var tmp_3 = this; continue $sm; case 5: var tmp_4 = this.y61_1; this.md_1 = 8; this.x61_1.n(); this.w61_1 = tmp_4; this.ld_1 = 10; continue $sm; case 6: this.md_1 = 7; var tmp_5 = this.od_1; if (tmp_5 instanceof Exception) { var e = this.od_1; var tmp_6 = this; throw e; } else { throw this.od_1; } case 7: this.md_1 = 8; var t = this.od_1; this.x61_1.n(); throw t; case 8: throw this.od_1; case 9: this.md_1 = 8; this.x61_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 10; continue $sm; case 10: var this_0 = this.w61_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); if (element == null) null; else { destination.j1(element); } } return destination; } } catch ($p) { var e_0 = $p; if (this.md_1 === 8) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function DoorConstants() { this.c62_1 = 'text/plain'; this.d62_1 = 'application/json'; this.e62_1 = 'door-dbversion'; this.f62_1 = 'door-node'; this.g62_1 = 'door-node-id'; this.h62_1 = '_doorwayinfo'; this.i62_1 = '/*psql'; this.j62_1 = '--notpsql'; this.k62_1 = '--endnotpsql'; this.l62_1 = '_ReceiveView'; this.m62_1 = 'door-paging-end-reached'; } var DoorConstants_instance; function DoorConstants_getInstance() { return DoorConstants_instance; } function DoorDatabaseCallbackStatementList() { } function DoorDatabaseCallbackSync() { } function DoorDatabaseJdbc() { } function DoorDatabaseRepository() { } function DoorDatabaseWrapper() { } function Companion_1() { Companion_instance_1 = this; this.s5j_1 = 1; this.t5j_1 = 2; this.u5j_1 = listOf_0([1, 2]); this.v5j_1 = mapOf([to('PostgreSQL', 2), to('SQLite', 1)]); var tmp = this; // Inline function 'kotlin.collections.map' call var this_0 = this.v5j_1.o2(); // Inline function 'kotlin.collections.mapTo' call var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.Companion.PRODUCT_INT_TO_NAME_MAP.' call var tmp$ret$0 = to(Companion_getInstance_3().v5j_1.q(item), item); destination.j1(tmp$ret$0); } tmp.w5j_1 = toMap(destination); } protoOf(Companion_1).x5j = function (productName) { var tmp0_elvis_lhs = this.v5j_1.q(productName); return tmp0_elvis_lhs == null ? -1 : tmp0_elvis_lhs; }; var Companion_instance_1; function Companion_getInstance_3() { if (Companion_instance_1 == null) new Companion_1(); return Companion_instance_1; } function unwrapTime(_this__u8e3s4, $this) { return _this__u8e3s4.wc(32); } function unwrapSeqNum(_this__u8e3s4, $this) { return _this__u8e3s4.yc(toLong(IntCompanionObject_instance.MAX_VALUE)); } function generateId($this, currentTimestamp, nodeId, seqNum) { return currentTimestamp.vc(32).zc(nodeId.vc(12)).zc(seqNum); } function $nextIdAsyncCOROUTINE$12(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.a63_1 = _this__u8e3s4; } protoOf($nextIdAsyncCOROUTINE$12).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; var tmp_0 = this; this.a63_1.e63_1; var this_0 = this.a63_1.d63_1; var tmp$ret$0; l$ret$1: do { while (true) { var cur = this_0.kotlinx$atomicfu$value; var lastTimestamp = cur.wc(32); var lastSeq = cur.yc(toLong(IntCompanionObject_instance.MAX_VALUE)); var this_1 = systemTimeInMillis().cb(toLong(1000)); var other = 1577836800; var newTimestamp = this_1.qc(toLong(other)); var tmp_1; if (newTimestamp.c7(lastTimestamp) > 0) { tmp_1 = new Long(0, 0); } else { tmp_1 = lastSeq.pc(toLong(1)); } var newSeq = tmp_1; var upd = newTimestamp.vc(32).zc(newSeq); if (this_0.atomicfu$compareAndSet(cur, upd)) { tmp$ret$0 = upd; break l$ret$1; } } } while (false); tmp_0.b63_1 = tmp$ret$0; this.c63_1 = unwrapSeqNum(this.b63_1, this.a63_1); if (this.c63_1.c7(toLong(Companion_getInstance_4().m63_1)) < 0) { return generateId(this.a63_1, unwrapTime(this.b63_1, this.a63_1), toLong(this.a63_1.e63_1.r62()), this.c63_1); } else { this.ld_1 = 1; var this_2 = systemTimeInMillis(); suspendResult = delay(numberToLong(1001).qc(this_2.rc(toLong(1000))), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: return this.a63_1.o63(); case 2: return Unit_instance; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function TablePrimaryKeyManager($outer) { this.e63_1 = $outer; this.d63_1 = atomic$long$1(new Long(0, 0)); } protoOf(TablePrimaryKeyManager).o63 = function () { // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum' call this.e63_1; var this_0 = this.d63_1; var tmp$ret$5; $l$block: { // Inline function 'kotlinx.atomicfu.updateAndGet' call while (true) { var cur = this_0.kotlinx$atomicfu$value; // Inline function 'com.ustadmobile.door.TablePrimaryKeyManager.nextWrappedTimeAndSeqNum.' call var lastTimestamp = cur.wc(32); var lastSeq = cur.yc(toLong(IntCompanionObject_instance.MAX_VALUE)); // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.timestamp' call // Inline function 'kotlin.Long.minus' call // Inline function 'kotlin.Long.div' call var this_1 = systemTimeInMillis().cb(toLong(1000)); var other = 1577836800; var newTimestamp = this_1.qc(toLong(other)); var tmp; if (newTimestamp.c7(lastTimestamp) > 0) { tmp = new Long(0, 0); } else { // Inline function 'kotlin.Long.plus' call tmp = lastSeq.pc(toLong(1)); } var newSeq = tmp; var upd = newTimestamp.vc(32).zc(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.c7(toLong(Companion_getInstance_4().m63_1)) < 0) { return generateId(this, unwrapTime(nextWrappedId, this), toLong(this.e63_1.r62()), seqNum); } else { // Inline function 'kotlin.Long.rem' call var tmp$ret$7 = systemTimeInMillis().rc(toLong(1000)); waitBlocking(numberToLong(1001).qc(tmp$ret$7)); return this.o63(); } }; protoOf(TablePrimaryKeyManager).p63 = function ($completion) { var tmp = new $nextIdAsyncCOROUTINE$12(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function Companion_2() { Companion_instance_2 = this; this.h63_1 = 1; this.i63_1 = 31; this.j63_1 = 20; this.k63_1 = 12; var tmp = this; // Inline function 'kotlin.math.pow' call var tmp$ret$0 = Math.pow(2.0, 20); tmp.l63_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.m63_1 = numberToInt(tmp$ret$1); this.n63_1 = 1577836800; } var Companion_instance_2; function Companion_getInstance_4() { if (Companion_instance_2 == null) new Companion_2(); return Companion_instance_2; } function DoorPrimaryKeyManager$nodeId$delegate$lambda() { return generateDoorNodeId(Companion_getInstance_4().l63_1); } function DoorPrimaryKeyManager(tableIdList) { Companion_getInstance_4(); this.f63_1 = threadSafeMapOf([]); var tmp = this; var tmp_0 = LazyThreadSafetyMode_NONE_getInstance(); tmp.g63_1 = lazy(tmp_0, DoorPrimaryKeyManager$nodeId$delegate$lambda); // Inline function 'kotlin.collections.forEach' call var tmp0_iterator = tableIdList.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.DoorPrimaryKeyManager.' call // Inline function 'kotlin.collections.set' call var this_0 = this.f63_1; var value = new TablePrimaryKeyManager(this); this_0.s(element, value); } } protoOf(DoorPrimaryKeyManager).r62 = function () { // Inline function 'kotlin.getValue' call var this_0 = this.g63_1; nodeId$factory(); return this_0.t2(); }; protoOf(DoorPrimaryKeyManager).q63 = function (tableId) { return ensureNotNull(this.f63_1.q(tableId)).o63(); }; protoOf(DoorPrimaryKeyManager).r63 = function (tableId, $completion) { return ensureNotNull(this.f63_1.q(tableId)).p63($completion); }; function nodeId$factory() { return getPropertyCallableRef('nodeId', 1, KProperty1, function (receiver) { return receiver.r62(); }, null); } function JdbcArrayProxyCommon(typeName, objects) { this.g5j_1 = typeName; this.h5j_1 = objects; switch (this.g5j_1) { case 'INTEGER': this.i5j_1 = TypesKmp_instance.l5i_1; break; case 'VARCHAR': this.i5j_1 = TypesKmp_instance.n5i_1; break; case 'BIGINT': this.i5j_1 = TypesKmp_instance.o5i_1; break; case 'SHORT': this.i5j_1 = TypesKmp_instance.s5i_1; break; case 'BOOLEAN': this.i5j_1 = TypesKmp_instance.m5i_1; break; case 'TEXT': this.i5j_1 = TypesKmp_instance.t5i_1; break; default: throw IllegalStateException_init_$Create$('JdbcArrayProxyCommon: Unsupported type: ' + this.g5j_1); } } protoOf(JdbcArrayProxyCommon).j5j = function () { return this.i5j_1; }; 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_3() { this.s63_1 = 10; } var Companion_instance_3; function Companion_getInstance_5() { return Companion_instance_3; } function PreparedStatementConfig(sql, hasListParams, generatedKeys, timeoutSeconds, postgreSql, readOnly) { hasListParams = hasListParams === VOID ? false : hasListParams; generatedKeys = generatedKeys === VOID ? StatementConstantsKmp_instance.a5i_1 : generatedKeys; timeoutSeconds = timeoutSeconds === VOID ? 10 : timeoutSeconds; postgreSql = postgreSql === VOID ? null : postgreSql; readOnly = readOnly === VOID ? false : readOnly; this.e5l_1 = sql; this.f5l_1 = hasListParams; this.g5l_1 = generatedKeys; this.h5l_1 = timeoutSeconds; this.i5l_1 = postgreSql; this.j5l_1 = readOnly; } protoOf(PreparedStatementConfig).toString = function () { return 'PreparedStatementConfig(sql=' + this.e5l_1 + ', hasListParams=' + this.f5l_1 + ', generatedKeys=' + this.g5l_1 + ', timeoutSeconds=' + this.h5l_1 + ', postgreSql=' + this.i5l_1 + ', readOnly=' + this.j5l_1 + ')'; }; protoOf(PreparedStatementConfig).hashCode = function () { var result = getStringHashCode(this.e5l_1); result = imul(result, 31) + getBooleanHashCode(this.f5l_1) | 0; result = imul(result, 31) + this.g5l_1 | 0; result = imul(result, 31) + this.h5l_1 | 0; result = imul(result, 31) + (this.i5l_1 == null ? 0 : getStringHashCode(this.i5l_1)) | 0; result = imul(result, 31) + getBooleanHashCode(this.j5l_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.e5l_1 === tmp0_other_with_cast.e5l_1)) return false; if (!(this.f5l_1 === tmp0_other_with_cast.f5l_1)) return false; if (!(this.g5l_1 === tmp0_other_with_cast.g5l_1)) return false; if (!(this.h5l_1 === tmp0_other_with_cast.h5l_1)) return false; if (!(this.i5l_1 == tmp0_other_with_cast.i5l_1)) return false; if (!(this.j5l_1 === tmp0_other_with_cast.j5l_1)) return false; return true; }; function RepositoryHelper(db, repoConfig) { this.t63_1 = db; this.u63_1 = repoConfig; this.v63_1 = atomic$int$1(0); this.w63_1 = concurrentSafeListOf([]); this.x63_1 = CoroutineScope_0(Dispatchers_getInstance().z12_1.rj(Job())); this.y63_1 = get_doorWrapper(this.t63_1).q62(); this.z63_1 = DoorRepositoryReplicationClient_init_$Create$(this.t63_1, this.u63_1, this.x63_1, this.y63_1, 1000); this.a64_1 = new NodeEventSseClient(this.u63_1, this.y63_1, this.x63_1); } protoOf(RepositoryHelper).p62 = function () { return this.z63_1.p62(); }; function Companion_4() { this.z64_1 = '\n (SELECT COALESCE(\n (SELECT nodeClientId \n FROM SyncNode \n LIMIT 1), 0))\n '; } var Companion_instance_4; function Companion_getInstance_6() { return Companion_instance_4; } function $serializer() { $serializer_instance = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.SyncNode', this, 1); tmp0_serialDesc.d4g('nodeClientId', true); this.a65_1 = tmp0_serialDesc; } protoOf($serializer).a45 = function () { return this.a65_1; }; protoOf($serializer).u4g = function () { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [LongSerializer_getInstance()]; }; protoOf($serializer).c45 = function (decoder) { var tmp0_desc = this.a65_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = new Long(0, 0); var tmp5_input = decoder.s48(tmp0_desc); if (tmp5_input.h49()) { tmp4_local0 = tmp5_input.y48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; } else while (tmp1_flag) { tmp2_index = tmp5_input.i49(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp5_input.y48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp5_input.t48(tmp0_desc); return SyncNode_init_$Create$(tmp3_bitMask0, tmp4_local0, null); }; protoOf($serializer).b65 = function (encoder, value) { var tmp0_desc = this.a65_1; var tmp1_output = encoder.s48(tmp0_desc); if (tmp1_output.o4a(tmp0_desc, 0) ? true : !value.c65_1.equals(new Long(0, 0))) { tmp1_output.c4a(tmp0_desc, 0, value.c65_1); } tmp1_output.t48(tmp0_desc); }; protoOf($serializer).b45 = function (encoder, value) { return this.b65(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().a65_1); } if (0 === (seen1 & 1)) $this.c65_1 = new Long(0, 0); else $this.c65_1 = nodeClientId; return $this; } function SyncNode_init_$Create$(seen1, nodeClientId, serializationConstructorMarker) { return SyncNode_init_$Init$(seen1, nodeClientId, serializationConstructorMarker, objectCreate(protoOf(SyncNode))); } function SyncNode(nodeClientId) { nodeClientId = nodeClientId === VOID ? new Long(0, 0) : nodeClientId; this.c65_1 = nodeClientId; } protoOf(SyncNode).toString = function () { return 'SyncNode(nodeClientId=' + this.c65_1.toString() + ')'; }; protoOf(SyncNode).hashCode = function () { return this.c65_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.c65_1.equals(tmp0_other_with_cast.c65_1)) return false; return true; }; function generateSetSyncNodeSql($this) { return listOf_0(['DELETE FROM SyncNode', '\n INSERT INTO SyncNode(nodeClientId)\n VALUES (' + $this.d65_1.toString() + ') \n ']); } function SyncNodeIdCallback(nodeId) { this.d65_1 = nodeId; } protoOf(SyncNodeIdCallback).n62 = function (db) { return generateSetSyncNodeSql(this); }; protoOf(SyncNodeIdCallback).o62 = function (db) { // Inline function 'kotlin.collections.listOf' call return emptyList(); }; var RemoteInsertStrategy_CALLBACK_instance; var RemoteInsertStrategy_INSERT_instance; var RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance; var RemoteInsertStrategy_entriesInitialized; function RemoteInsertStrategy_initEntries() { if (RemoteInsertStrategy_entriesInitialized) return Unit_instance; 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); } function RemoteInsertStrategy(name, ordinal) { Enum.call(this, name, ordinal); } function RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance() { RemoteInsertStrategy_initEntries(); return RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_instance; } var Event_INSERT_instance; var Event_UPDATE_instance; var Event_DELETE_instance; var Event_entriesInitialized; function Event_initEntries() { if (Event_entriesInitialized) return Unit_instance; 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 Order_AFTER_instance; var Order_BEFORE_instance; var Order_INSTEAD_OF_instance; var Order_entriesInitialized; function Order_initEntries() { if (Order_entriesInitialized) return Unit_instance; 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 On_ENTITY_instance; var On_RECEIVEVIEW_instance; var On_entriesInitialized; function On_initEntries() { if (On_entriesInitialized) return Unit_instance; On_entriesInitialized = true; On_ENTITY_instance = new On('ENTITY', 0); On_RECEIVEVIEW_instance = new On('RECEIVEVIEW', 1); } function Event(name, ordinal, sqlKeyWord) { Enum.call(this, name, ordinal); this.g65_1 = sqlKeyWord; } function Order(name, ordinal, sqlStr) { Enum.call(this, name, ordinal); this.j65_1 = sqlStr; } function On(name, ordinal) { Enum.call(this, name, ordinal); } function Companion_5() { this.k65_1 = '_d'; } var Companion_instance_5; function Companion_getInstance_7() { return Companion_instance_5; } function Event_INSERT_getInstance() { Event_initEntries(); return Event_INSERT_instance; } function Order_AFTER_getInstance() { Order_initEntries(); return Order_AFTER_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) { on = on === VOID ? On_ENTITY_getInstance() : on; postgreSqlStatements = postgreSqlStatements === VOID ? [] : postgreSqlStatements; conditionSql = conditionSql === VOID ? '' : conditionSql; conditionSqlPostgres = conditionSqlPostgres === VOID ? '' : conditionSqlPostgres; this.l65_1 = name; this.m65_1 = order; this.n65_1 = events; this.o65_1 = on; this.p65_1 = sqlStatements; this.q65_1 = postgreSqlStatements; this.r65_1 = conditionSql; this.s65_1 = conditionSqlPostgres; } protoOf(Trigger).equals = function (other) { if (!(other instanceof Trigger)) return false; var tmp0_other_with_cast = other instanceof Trigger ? other : THROW_CCE(); if (!(this.l65_1 === tmp0_other_with_cast.l65_1)) return false; if (!this.m65_1.equals(tmp0_other_with_cast.m65_1)) return false; if (!contentEquals(this.n65_1, tmp0_other_with_cast.n65_1)) return false; if (!this.o65_1.equals(tmp0_other_with_cast.o65_1)) return false; if (!contentEquals(this.p65_1, tmp0_other_with_cast.p65_1)) return false; if (!contentEquals(this.q65_1, tmp0_other_with_cast.q65_1)) return false; if (!(this.r65_1 === tmp0_other_with_cast.r65_1)) return false; if (!(this.s65_1 === tmp0_other_with_cast.s65_1)) return false; return true; }; protoOf(Trigger).hashCode = function () { var result = imul(getStringHashCode('name'), 127) ^ getStringHashCode(this.l65_1); result = result + (imul(getStringHashCode('order'), 127) ^ this.m65_1.hashCode()) | 0; result = result + (imul(getStringHashCode('events'), 127) ^ hashCode(this.n65_1)) | 0; result = result + (imul(getStringHashCode('on'), 127) ^ this.o65_1.hashCode()) | 0; result = result + (imul(getStringHashCode('sqlStatements'), 127) ^ hashCode(this.p65_1)) | 0; result = result + (imul(getStringHashCode('postgreSqlStatements'), 127) ^ hashCode(this.q65_1)) | 0; result = result + (imul(getStringHashCode('conditionSql'), 127) ^ getStringHashCode(this.r65_1)) | 0; result = result + (imul(getStringHashCode('conditionSqlPostgres'), 127) ^ getStringHashCode(this.s65_1)) | 0; return result; }; protoOf(Trigger).toString = function () { return '@com.ustadmobile.door.annotation.Trigger(name=' + this.l65_1 + ', order=' + this.m65_1 + ', events=' + toString(this.n65_1) + ', on=' + this.o65_1 + ', sqlStatements=' + toString(this.p65_1) + ', postgreSqlStatements=' + toString(this.q65_1) + ', conditionSql=' + this.r65_1 + ', conditionSqlPostgres=' + this.s65_1 + ')'; }; function NodeIdAndAuth(nodeId, auth) { this.t65_1 = nodeId; this.u65_1 = auth; } protoOf(NodeIdAndAuth).toString = function () { return 'NodeIdAndAuth(nodeId=' + this.t65_1.toString() + ', auth=' + this.u65_1 + ')'; }; protoOf(NodeIdAndAuth).hashCode = function () { var result = this.t65_1.hashCode(); result = imul(result, 31) + getStringHashCode(this.u65_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.t65_1.equals(tmp0_other_with_cast.t65_1)) return false; if (!(this.u65_1 === tmp0_other_with_cast.u65_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.v65_1 = orUid; this.w65_1 = destNodeId; this.x65_1 = orTableId; this.y65_1 = orPk1; this.z65_1 = orPk2; this.a66_1 = orPk3; this.b66_1 = orPk4; } 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 Companion_6() { this.c66_1 = '_DoorMetadata'; } var Companion_instance_6; function Companion_getInstance_8() { return Companion_instance_6; } function DoorDatabaseMetadata() { } protoOf(DoorDatabaseMetadata).e66 = function () { // Inline function 'kotlin.collections.map' call var this_0 = this.d66().p2(); // Inline function 'kotlin.collections.mapTo' call var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.ext.DoorDatabaseMetadata..' call var tmp$ret$0 = item.g66_1; destination.j1(tmp$ret$0); } return destination; }; protoOf(DoorDatabaseMetadata).p66 = function (tableId) { var tmp0_elvis_lhs = this.d66().q(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; }; function Companion_7() { this.r66_1 = 1; this.s66_1 = 2; this.t66_1 = 4; this.u66_1 = 'DoorLog'; } var Companion_instance_7; function Companion_getInstance_9() { return Companion_instance_7; } function setBodyJson(_this__u8e3s4, json, serializer, value, contentType) { contentType = contentType === VOID ? Application_getInstance().f2s_1 : contentType; // Inline function 'io.ktor.client.request.setBody' call var body = new TextContent(json.b46(serializer, value), contentType); if (body == null) { _this__u8e3s4.i39_1 = NullBody_instance; // Inline function 'io.ktor.util.reflect.typeInfo' call var tmp = JsType_instance; 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.f3f(tmp$ret$1); } else { if (body instanceof OutgoingContent) { _this__u8e3s4.i39_1 = body; _this__u8e3s4.f3f(null); } else { _this__u8e3s4.i39_1 = body; // Inline function 'io.ktor.util.reflect.typeInfo' call var tmp_3 = JsType_instance; 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.f3f(tmp$ret$3); } } } function doorNodeIdHeader(_this__u8e3s4, repo) { header(_this__u8e3s4, 'door-node', repo.t39().y66_1.toString() + '/' + repo.t39().x66_1); } function doorNodeIdHeader_0(_this__u8e3s4, nodeId, auth) { header(_this__u8e3s4, 'door-node', nodeId.toString() + '/' + auth); } function setRepoUrl(_this__u8e3s4, repoEndpoint, repoPath) { _this__u8e3s4.l3v(setRepoUrl$lambda(repoEndpoint, repoPath)); } function setRepoUrl_0(_this__u8e3s4, repositoryConfig, repoPath) { return setRepoUrl(_this__u8e3s4, repositoryConfig.w66_1, repoPath); } function pagingSourceLoadParameters(_this__u8e3s4, json, keySerializer, loadParams) { var loadParamType = Companion_instance_8.d67(getKClassFromExpression(loadParams)); parameter(_this__u8e3s4, 'pagingLoadParamType', loadParamType.za_1); parameter(_this__u8e3s4, 'pagingKey', json.b46(keySerializer, loadParams.s2())); parameter(_this__u8e3s4, 'pagingBatchSize', loadParams.i55_1); } function doorNodeAndVersionHeaders(_this__u8e3s4, repo) { dbVersionHeader(_this__u8e3s4, repo.a5k()); doorNodeIdHeader(_this__u8e3s4, repo); } var LoadParamType_REFRESH_instance; var LoadParamType_PREPEND_instance; var LoadParamType_APPEND_instance; function Companion_8() { } protoOf(Companion_8).d67 = function (paramClass) { var tmp$ret$1; $l$block: { // Inline function 'kotlin.collections.first' call var tmp0_iterator = get_entries().w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.ext.Companion.paramTypeFor.' call if (element.g67_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_8; function Companion_getInstance_10() { return Companion_instance_8; } function values() { return [LoadParamType_REFRESH_getInstance(), LoadParamType_PREPEND_getInstance(), LoadParamType_APPEND_getInstance()]; } function get_entries() { if ($ENTRIES == null) $ENTRIES = enumEntries(values()); return $ENTRIES; } var LoadParamType_entriesInitialized; function LoadParamType_initEntries() { if (LoadParamType_entriesInitialized) return Unit_instance; 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)); } var $ENTRIES; function LoadParamType(name, ordinal, paramClass) { Enum.call(this, name, ordinal); this.g67_1 = paramClass; } function dbVersionHeader(_this__u8e3s4, db) { header(_this__u8e3s4, 'door-dbversion', 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_instance; }; } 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 toUrlQueryString(_this__u8e3s4) { // Inline function 'kotlin.collections.map' call var this_0 = _this__u8e3s4.q2(); // Inline function 'kotlin.collections.mapTo' call var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.ext.toUrlQueryString.' call var tmp$ret$0 = urlEncode(item.s2()) + '=' + urlEncode(item.t2()); destination.j1(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.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject.' call var tmp1 = index; index = tmp1 + 1 | 0; var index_0 = checkIndexOverflow(tmp1); var fieldType = item.i67_1; var tmp = index_0 + startIndex | 0; // Inline function 'kotlin.collections.getOrElse' call var key = item.h67_1; var tmp0_elvis_lhs = jsonObject.q(key); var tmp_0; if (tmp0_elvis_lhs == null) { // Inline function 'com.ustadmobile.door.ext.setAllFromJsonObject..' call tmp_0 = defaultJsonPrimitive(fieldType, item.j67_1); } else { tmp_0 = tmp0_elvis_lhs; } var tmp$ret$1 = tmp_0; setJsonPrimitive(_this__u8e3s4, tmp, item.i67_1, get_jsonPrimitive(tmp$ret$1)); } } function setJsonPrimitive(_this__u8e3s4, index, type, jsonPrimitive) { if (jsonPrimitive instanceof JsonNull) { _this__u8e3s4.c5j(index, null); return Unit_instance; } if (type === TypesKmp_instance.l5i_1) { _this__u8e3s4.w5i(index, get_int(jsonPrimitive)); } else if (type === TypesKmp_instance.s5i_1) { _this__u8e3s4.v5i(index, toShort(get_int(jsonPrimitive))); } else if (type === TypesKmp_instance.o5i_1) { _this__u8e3s4.x5i(index, get_long(jsonPrimitive)); } else if (type === TypesKmp_instance.p5i_1) { _this__u8e3s4.y5i(index, get_float(jsonPrimitive)); } else if (type === TypesKmp_instance.q5i_1) { _this__u8e3s4.y5i(index, get_float(jsonPrimitive)); } else if (type === TypesKmp_instance.r5i_1) { _this__u8e3s4.z5i(index, get_double(jsonPrimitive)); } else if (type === TypesKmp_instance.m5i_1) { _this__u8e3s4.k5i(index, get_boolean(jsonPrimitive)); } else if (type === TypesKmp_instance.n5i_1) { _this__u8e3s4.a5j(index, jsonPrimitive.q3b()); } else if (type === TypesKmp_instance.t5i_1) { _this__u8e3s4.a5j(index, jsonPrimitive.q3b()); } } function defaultJsonPrimitive(type, nullable) { return nullable ? JsonNull_getInstance() : (type === TypesKmp_instance.n5i_1 ? true : type === TypesKmp_instance.t5i_1) ? JsonNull_getInstance() : type === TypesKmp_instance.m5i_1 ? 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.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'kotlin.collections.plusAssign' call // Inline function 'com.ustadmobile.door.ext.rowToJsonObject.' call var pair = to(element.k67(), getJsonPrimitive(_this__u8e3s4, element)); destination.s(pair.w6_1, pair.x6_1); } return new JsonObject(destination); } function getJsonPrimitive(_this__u8e3s4, fieldInfo) { var colName = fieldInfo.k67(); var tmp; if (fieldInfo.q67()) { var tmp0_subject = fieldInfo.l67(); var tmp_0; if (tmp0_subject === TypesKmp_instance.s5i_1) { tmp_0 = JsonPrimitive(getShortNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.l5i_1) { tmp_0 = JsonPrimitive(getIntNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.o5i_1) { tmp_0 = JsonPrimitive(getLongNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.q5i_1) { tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.p5i_1) { tmp_0 = JsonPrimitive(getFloatNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.r5i_1) { tmp_0 = JsonPrimitive(getDoubleNullable(_this__u8e3s4, colName)); } else if (tmp0_subject === TypesKmp_instance.n5i_1) { tmp_0 = JsonPrimitive_1(_this__u8e3s4.b10(colName)); } else if (tmp0_subject === TypesKmp_instance.t5i_1) { tmp_0 = JsonPrimitive_1(_this__u8e3s4.b10(colName)); } else if (tmp0_subject === TypesKmp_instance.m5i_1) { tmp_0 = JsonPrimitive_0(getBooleanNullable(_this__u8e3s4, colName)); } else { throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.l67()); } tmp = tmp_0; } else { var tmp1_subject = fieldInfo.l67(); var tmp_1; if (tmp1_subject === TypesKmp_instance.s5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.p67(colName)); } else if (tmp1_subject === TypesKmp_instance.l5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.a5o(colName)); } else if (tmp1_subject === TypesKmp_instance.o5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.b5o(colName)); } else if (tmp1_subject === TypesKmp_instance.q5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.o67(colName)); } else if (tmp1_subject === TypesKmp_instance.p5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.o67(colName)); } else if (tmp1_subject === TypesKmp_instance.r5i_1) { tmp_1 = JsonPrimitive(_this__u8e3s4.n67(colName)); } else if (tmp1_subject === TypesKmp_instance.n5i_1) { tmp_1 = JsonPrimitive_1(_this__u8e3s4.b10(colName)); } else if (tmp1_subject === TypesKmp_instance.t5i_1) { tmp_1 = JsonPrimitive_1(_this__u8e3s4.b10(colName)); } else if (tmp1_subject === TypesKmp_instance.m5i_1) { tmp_1 = JsonPrimitive_0(_this__u8e3s4.m67(colName)); } else { throw IllegalArgumentException_init_$Create$('Unsupported type: ' + fieldInfo.l67()); } tmp = tmp_1; } return tmp; } function get_doorWrapperNodeId(_this__u8e3s4) { return get_doorWrapper(_this__u8e3s4).r62(); } 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.a5k(); 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; } var Status_INACTIVE_instance; var Status_LOADING_instance; var Status_DONE_instance; var Status_FAILED_instance; var Status_entriesInitialized; function Status_initEntries() { if (Status_entriesInitialized) return Unit_instance; 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); } 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.r67_1 = status; } protoOf(FlowLoadingState).s67 = function (status) { return new FlowLoadingState(status); }; protoOf(FlowLoadingState).toString = function () { return 'FlowLoadingState(status=' + this.r67_1 + ')'; }; protoOf(FlowLoadingState).hashCode = function () { return this.r67_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.r67_1.equals(tmp0_other_with_cast.r67_1)) return false; return true; }; function RepoDaoFlowHelper$asRepoFlow$slambda$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) { this.b68_1 = $statusFlow; this.c68_1 = $onMakeHttpRequest; CoroutineImpl.call(this, resultContinuation); } protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; this.md_1 = 2; l$ret$1: do { var this_0 = this.b68_1; while (true) { var prevValue = this_0.t2(); var nextValue = prevValue.s67(Status_LOADING_getInstance()); if (this_0.i1l(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.ld_1 = 1; suspendResult = this.c68_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: l$ret$3: do { var this_1 = this.b68_1; while (true) { var prevValue_0 = this_1.t2(); var nextValue_0 = prevValue_0.s67(Status_DONE_getInstance()); if (this_1.i1l(prevValue_0, nextValue_0)) { break l$ret$3; } } } while (false); this.md_1 = 3; this.ld_1 = 4; continue $sm; case 2: this.md_1 = 3; var tmp_0 = this.od_1; if (tmp_0 instanceof Exception) { var e = this.od_1; l$ret$5: do { var this_2 = this.b68_1; while (true) { var prevValue_1 = this_2.t2(); var nextValue_1 = prevValue_1.s67(Status_FAILED_getInstance()); if (this_2.i1l(prevValue_1, nextValue_1)) { break l$ret$5; } } } while (false); this.ld_1 = 4; continue $sm; } else { throw this.od_1; } case 3: throw this.od_1; case 4: this.md_1 = 3; return Unit_instance; } } catch ($p) { var e_0 = $p; if (this.md_1 === 3) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda$slambda).f1n = function ($this$launch, completion) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda$slambda(this.b68_1, this.c68_1, completion); i.d68_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function RepoDaoFlowHelper$asRepoFlow$slambda($statusFlow, $onMakeHttpRequest, resultContinuation) { this.m68_1 = $statusFlow; this.n68_1 = $onMakeHttpRequest; CoroutineImpl.call(this, resultContinuation); } protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).q1n = function ($this$onStart, $completion) { var tmp = this.r1n($this$onStart, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).le = function (p1, $completion) { return this.q1n((!(p1 == null) ? isInterface(p1, FlowCollector) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; if (tmp === 0) { this.md_1 = 1; var requestScope = CoroutineScope_0(this.sd().rj(Job())); launch(requestScope, VOID, VOID, RepoDaoFlowHelper$asRepoFlow$slambda$slambda_0(this.m68_1, this.n68_1, null)); return Unit_instance; } else if (tmp === 1) { throw this.od_1; } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(RepoDaoFlowHelper$asRepoFlow$slambda).r1n = function ($this$onStart, completion) { var i = new RepoDaoFlowHelper$asRepoFlow$slambda(this.m68_1, this.n68_1, completion); i.o68_1 = $this$onStart; return i; }; 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.q1n($this$onStart, $completion); }; l.$arity = 1; return l; } function RepoDaoFlowHelper(repo) { this.p68_1 = repo; this.q68_1 = weakMapOf(); } protoOf(RepoDaoFlowHelper).r68 = function (dbFlow, onMakeHttpRequest) { var statusFlow = MutableStateFlow(new FlowLoadingState()); var wrappedFlow = onStart(dbFlow, RepoDaoFlowHelper$asRepoFlow$slambda_0(statusFlow, onMakeHttpRequest, null)); this.q68_1.s68(wrappedFlow, statusFlow); return wrappedFlow; }; function ConnectionAsync() { } function StatementConstantsKmp() { this.z5h_1 = 1; this.a5i_1 = 2; } var StatementConstantsKmp_instance; function StatementConstantsKmp_getInstance() { return StatementConstantsKmp_instance; } function TypesKmp() { this.l5i_1 = 4; this.m5i_1 = 16; this.n5i_1 = 12; this.o5i_1 = -5; this.p5i_1 = 6; this.q5i_1 = 7; this.r5i_1 = 8; this.s5i_1 = 5; this.t5i_1 = -1; this.u5i_1 = 2003; } var TypesKmp_instance; function TypesKmp_getInstance() { return TypesKmp_instance; } function setFloatNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_instance.p5i_1; var tmp; if (!(value == null)) { _this__u8e3s4.y5i(index, value); tmp = Unit_instance; } else { _this__u8e3s4.d5j(index, sqlType); tmp = Unit_instance; } return tmp; } function setBooleanNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_instance.m5i_1; var tmp; if (!(value == null)) { _this__u8e3s4.k5i(index, value); tmp = Unit_instance; } else { _this__u8e3s4.d5j(index, sqlType); tmp = Unit_instance; } return tmp; } function setLongNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_instance.o5i_1; var tmp; if (!(value == null)) { _this__u8e3s4.x5i(index, value); tmp = Unit_instance; } else { _this__u8e3s4.d5j(index, sqlType); tmp = Unit_instance; } return tmp; } function setIntNullable(_this__u8e3s4, index, value) { var sqlType = TypesKmp_instance.l5i_1; var tmp; if (!(value == null)) { _this__u8e3s4.w5i(index, value); tmp = Unit_instance; } else { _this__u8e3s4.d5j(index, sqlType); tmp = Unit_instance; } return tmp; } function useResults(_this__u8e3s4, block) { try { return block(_this__u8e3s4); }finally { _this__u8e3s4.n(); } } function mapRows(_this__u8e3s4, block) { var mappedResults = mutableLinkedListOf_0([]); while (_this__u8e3s4.e()) { // Inline function 'kotlin.collections.plusAssign' call var element = block(_this__u8e3s4); mappedResults.j1(element); } return mappedResults; } function mapNextRow(_this__u8e3s4, defaultVal, block) { return _this__u8e3s4.e() ? 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.p67(columnName); return _this__u8e3s4.t68() ? 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.a5o(columnName); return _this__u8e3s4.t68() ? 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.b5o(columnName); return _this__u8e3s4.t68() ? 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.o67(columnName); return _this__u8e3s4.t68() ? 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.n67(columnName); return _this__u8e3s4.t68() ? 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.m67(columnName); return _this__u8e3s4.t68() ? null : it; } function getStringNonNull(_this__u8e3s4, columnName) { var tmp0_elvis_lhs = _this__u8e3s4.b10(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 mapNextRow_0(_this__u8e3s4, block) { var tmp; if (_this__u8e3s4.e()) { tmp = block(_this__u8e3s4); } else { throw NullPointerException_init_$Create$('mapNextRow: no row and no default value provided'); } return tmp; } var DoorLogLevel_VERBOSE_instance; var DoorLogLevel_DEBUG_instance; var DoorLogLevel_INFO_instance; var DoorLogLevel_WARNING_instance; var DoorLogLevel_ERROR_instance; var DoorLogLevel_ASSERT_instance; var DoorLogLevel_entriesInitialized; function DoorLogLevel_initEntries() { if (DoorLogLevel_entriesInitialized) return Unit_instance; 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); } 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 d(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.u68(DoorLogLevel_DEBUG_getInstance(), message, throwable); } function v(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.v68(DoorLogLevel_VERBOSE_getInstance(), throwable, message); } function w(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.v68(DoorLogLevel_WARNING_getInstance(), throwable, message); } function d_0(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.v68(DoorLogLevel_DEBUG_getInstance(), throwable, message); } function i(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.u68(DoorLogLevel_INFO_getInstance(), message, throwable); } function e(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.u68(DoorLogLevel_ERROR_getInstance(), message, throwable); } function w_0(_this__u8e3s4, message, throwable) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.u68(DoorLogLevel_WARNING_getInstance(), message, throwable); } function e_0(_this__u8e3s4, throwable, message) { throwable = throwable === VOID ? null : throwable; _this__u8e3s4.v68(DoorLogLevel_ERROR_getInstance(), throwable, message); } function toNapierLogLevel(_this__u8e3s4, $this) { var tmp; switch (_this__u8e3s4.ab_1) { 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) { var tmp; if (tag === VOID) { tmp = 'DoorLog'; } else { tmp = tag; } tag = tmp; this.w68_1 = tag; } protoOf(NapierDoorLogger).u68 = function (level, message, throwable) { Napier_getInstance().c5f(toNapierLogLevel(level, this), this.w68_1, throwable, message); }; protoOf(NapierDoorLogger).v68 = function (level, throwable, message) { var logLevel = toNapierLogLevel(level, this); if (Napier_getInstance().u5e(logLevel, this.w68_1)) { Napier_getInstance().c5f(logLevel, this.w68_1, throwable, message()); } }; function DefaultDoorMessageCallback() { } protoOf(DefaultDoorMessageCallback).x68 = function (db, eventMessage, $completion) { return eventMessage; }; protoOf(DefaultDoorMessageCallback).y68 = function (db, eventMessage, $completion) { return Unit_instance; }; function Companion_9() { Companion_instance_9 = this; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.z68_1 = [null, null, null, new ArrayListSerializer($serializer_getInstance_1())]; this.a69_1 = 1; this.b69_1 = 2; } protoOf(Companion_9).x4r = function () { return $serializer_getInstance_0(); }; var Companion_instance_9; function Companion_getInstance_11() { if (Companion_instance_9 == null) new Companion_9(); return Companion_instance_9; } function $serializer_0() { $serializer_instance_0 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.message.DoorMessage', this, 4); tmp0_serialDesc.d4g('what', false); tmp0_serialDesc.d4g('fromNode', false); tmp0_serialDesc.d4g('toNode', false); tmp0_serialDesc.d4g('replications', false); this.c69_1 = tmp0_serialDesc; } protoOf($serializer_0).a45 = function () { return this.c69_1; }; protoOf($serializer_0).u4g = function () { var tmp0_cached = Companion_getInstance_11().z68_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).c45 = function (decoder) { var tmp0_desc = this.c69_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.s48(tmp0_desc); var tmp9_cached = Companion_getInstance_11().z68_1; if (tmp8_input.h49()) { tmp4_local0 = tmp8_input.x48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; tmp5_local1 = tmp8_input.y48(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; tmp6_local2 = tmp8_input.y48(tmp0_desc, 2); tmp3_bitMask0 = tmp3_bitMask0 | 4; tmp7_local3 = tmp8_input.e49(tmp0_desc, 3, tmp9_cached[3], tmp7_local3); tmp3_bitMask0 = tmp3_bitMask0 | 8; } else while (tmp1_flag) { tmp2_index = tmp8_input.i49(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp8_input.x48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; case 1: tmp5_local1 = tmp8_input.y48(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; break; case 2: tmp6_local2 = tmp8_input.y48(tmp0_desc, 2); tmp3_bitMask0 = tmp3_bitMask0 | 4; break; case 3: tmp7_local3 = tmp8_input.e49(tmp0_desc, 3, tmp9_cached[3], tmp7_local3); tmp3_bitMask0 = tmp3_bitMask0 | 8; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp8_input.t48(tmp0_desc); return DoorMessage_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, null); }; protoOf($serializer_0).d69 = function (encoder, value) { var tmp0_desc = this.c69_1; var tmp1_output = encoder.s48(tmp0_desc); var tmp2_cached = Companion_getInstance_11().z68_1; tmp1_output.b4a(tmp0_desc, 0, value.e69_1); tmp1_output.c4a(tmp0_desc, 1, value.f69_1); tmp1_output.c4a(tmp0_desc, 2, value.g69_1); tmp1_output.i4a(tmp0_desc, 3, tmp2_cached[3], value.h69_1); tmp1_output.t48(tmp0_desc); }; protoOf($serializer_0).b45 = function (encoder, value) { return this.d69(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().c69_1); } $this.e69_1 = what; $this.f69_1 = fromNode; $this.g69_1 = toNode; $this.h69_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_11(); this.e69_1 = what; this.f69_1 = fromNode; this.g69_1 = toNode; this.h69_1 = replications; } protoOf(DoorMessage).toString = function () { return 'DoorMessage(what=' + this.e69_1 + ', fromNode=' + this.f69_1.toString() + ', toNode=' + this.g69_1.toString() + ', replications=' + this.h69_1 + ')'; }; protoOf(DoorMessage).hashCode = function () { var result = this.e69_1; result = imul(result, 31) + this.f69_1.hashCode() | 0; result = imul(result, 31) + this.g69_1.hashCode() | 0; result = imul(result, 31) + hashCode(this.h69_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.e69_1 === tmp0_other_with_cast.e69_1)) return false; if (!this.f69_1.equals(tmp0_other_with_cast.f69_1)) return false; if (!this.g69_1.equals(tmp0_other_with_cast.g69_1)) return false; if (!equals(this.h69_1, tmp0_other_with_cast.h69_1)) return false; return true; }; function DoorMigration() { } function DoorMigrationAsync(startVersion, endVersion, migrateFn) { DoorMigration.call(this); this.k69_1 = startVersion; this.l69_1 = endVersion; this.m69_1 = migrateFn; } protoOf(DoorMigrationAsync).i69 = function () { return this.k69_1; }; protoOf(DoorMigrationAsync).j69 = function () { return this.l69_1; }; function DoorMigrationStatementList(startVersion, endVersion, migrateStmts) { DoorMigration.call(this); this.n69_1 = startVersion; this.o69_1 = endVersion; this.p69_1 = migrateStmts; } protoOf(DoorMigrationStatementList).i69 = function () { return this.n69_1; }; protoOf(DoorMigrationStatementList).j69 = function () { return this.o69_1; }; function DoorMigrationSync() { } function NodeEvent(what, toNode, tableId, key1, key2, key3, key4) { this.q69_1 = what; this.r69_1 = toNode; this.s69_1 = tableId; this.t69_1 = key1; this.u69_1 = key2; this.v69_1 = key3; this.w69_1 = key4; } function createNodeEventTableAndTrigger(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion) { temporary = temporary === VOID ? true : temporary; var tmp = new $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function $createNodeEventTableAndTriggerCOROUTINE$14(_this__u8e3s4, hasOutgoingReplicationTable, temporary, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.f6a_1 = _this__u8e3s4; this.g6a_1 = hasOutgoingReplicationTable; this.h6a_1 = temporary; } protoOf($createNodeEventTableAndTriggerCOROUTINE$14).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 10; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.j6a_1 = this.f6a_1.b62(); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 9; this.md_1 = 8; var tmp_1 = this; tmp_1.l6a_1 = this.j6a_1; this.ld_1 = 4; var tmp_2; if (this.h6a_1) { tmp_2 = '\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 '; } else { tmp_2 = '\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 '; } suspendResult = executeUpdateAsync(this.l6a_1, tmp_2, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var tmp_3 = this; var this_0 = this.l6a_1; var tmp_4; if (this.g6a_1) { tmp_4 = this_0; } else { tmp_4 = null; } tmp_3.m6a_1 = tmp_4; if (this.m6a_1 == null) { this.n6a_1 = null; this.ld_1 = 6; continue $sm; } else { this.ld_1 = 5; var tmp_5; if (this.h6a_1) { tmp_5 = '\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 '; } else { tmp_5 = '\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 '; } suspendResult = executeUpdateAsync(this.m6a_1, tmp_5, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 5: this.n6a_1 = suspendResult; this.ld_1 = 6; continue $sm; case 6: this.k6a_1 = this.n6a_1; this.md_1 = 10; this.ld_1 = 7; var tmp_6 = this; continue $sm; case 7: var tmp_7 = this.k6a_1; this.md_1 = 10; this.j6a_1.n(); this.i6a_1 = tmp_7; this.ld_1 = 12; continue $sm; case 8: this.md_1 = 9; var tmp_8 = this.od_1; if (tmp_8 instanceof Exception) { var e = this.od_1; var tmp_9 = this; throw e; } else { throw this.od_1; } case 9: this.md_1 = 10; var t = this.od_1; this.j6a_1.n(); throw t; case 10: throw this.od_1; case 11: this.md_1 = 10; this.j6a_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 12; continue $sm; case 12: return Unit_instance; } } catch ($p) { var e_0 = $p; if (this.md_1 === 10) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function NodeEventConstants() { this.o6a_1 = 'OutgoingReplication'; this.p6a_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.q6a_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.r6a_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.s6a_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.t6a_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.u6a_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.v6a_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.w6a_1 = '\n DELETE FROM NodeEvent\n '; } var NodeEventConstants_instance; function NodeEventConstants_getInstance() { return NodeEventConstants_instance; } function NodeEventManagerCommon$onIncomingMessageReceived$lambda(this$0, $message) { return function () { return this$0.c6b_1 + ' receiveMessage with ' + $message.h69_1.u() + ' replications: run inserts'; }; } function NodeEventManagerCommon$onIncomingMessageReceived$slambda(this$0, $message, resultContinuation) { this.r6b_1 = this$0; this.s6b_1 = $message; CoroutineImpl.call(this, resultContinuation); } protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).v6b = function (it, $completion) { var tmp = this.w6b(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).le = function (p1, $completion) { return this.v6b(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; this.ld_1 = 1; suspendResult = this.r6b_1.y6a_1.x68(this.r6b_1.x6a_1, this.s6b_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.u6b_1 = suspendResult; this.ld_1 = 2; suspendResult = insertEntitiesFromMessage(this.r6b_1.x6a_1, this.u6b_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 3; suspendResult = this.r6b_1.y6a_1.y68(this.r6b_1.x6a_1, this.u6b_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(NodeEventManagerCommon$onIncomingMessageReceived$slambda).w6b = function (it, completion) { var i = new NodeEventManagerCommon$onIncomingMessageReceived$slambda(this.r6b_1, this.s6b_1, completion); i.t6b_1 = it; return i; }; 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.v6b(it, $completion); }; l.$arity = 1; return l; } function NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this$0, $message) { return function () { return this$0.c6b_1 + ' receiveMessage with ' + $message.h69_1.u() + ' replications: inserts done/transaction finished'; }; } function $onIncomingMessageReceivedCOROUTINE$15(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.f6c_1 = _this__u8e3s4; this.g6c_1 = message; } protoOf($onIncomingMessageReceivedCOROUTINE$15).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 5; this.f6c_1.s5z(); this.md_1 = 3; var tmp_0 = this.f6c_1.h6c(); v(tmp_0, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda(this.f6c_1, this.g6c_1)); this.ld_1 = 1; suspendResult = withDoorTransactionAsync(this.f6c_1.x6a_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$slambda_0(this.f6c_1, this.g6c_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var tmp_1 = this.f6c_1.h6c(); d_0(tmp_1, VOID, NodeEventManagerCommon$onIncomingMessageReceived$lambda_0(this.f6c_1, this.g6c_1)); this.ld_1 = 2; suspendResult = this.f6c_1.g6b_1.d1e(this.g6c_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.md_1 = 5; this.ld_1 = 4; continue $sm; case 3: this.md_1 = 5; var tmp_2 = this.od_1; if (tmp_2 instanceof Exception) { var e = this.od_1; throw e; } else { throw this.od_1; } case 4: this.md_1 = 5; return Unit_instance; case 5: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 5) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function NodeEventManagerCommon(db, messageCallback, logger, dbName, dispatcher) { dispatcher = dispatcher === VOID ? Dispatchers_getInstance().z12_1 : dispatcher; this.x6a_1 = db; this.y6a_1 = messageCallback; this.z6a_1 = logger; this.a6b_1 = dbName; this.b6b_1 = dispatcher; this.c6b_1 = '[NodeEventManager - ' + this.a6b_1 + ']'; this.d6b_1 = doorDatabaseMetadata(getKClassFromExpression(this.x6a_1)).q66().b1('OutgoingReplication'); this.e6b_1 = MutableSharedFlow(); this.f6b_1 = asSharedFlow(this.e6b_1); this.g6b_1 = MutableSharedFlow(); this.h6b_1 = asSharedFlow(this.g6b_1); this.i6b_1 = atomic$boolean$1(false); } protoOf(NodeEventManagerCommon).h6c = function () { return this.z6a_1; }; protoOf(NodeEventManagerCommon).i6c = function () { return this.a6b_1; }; protoOf(NodeEventManagerCommon).j6c = function () { return this.f6b_1; }; protoOf(NodeEventManagerCommon).k6c = function () { return this.h6b_1; }; protoOf(NodeEventManagerCommon).s5z = function () { if (this.i6b_1.kotlinx$atomicfu$value) throw IllegalStateException_init_$Create$('NodeEventManager is closed!'); }; protoOf(NodeEventManagerCommon).l6c = function (message, $completion) { var tmp = new $onIncomingMessageReceivedCOROUTINE$15(this, message, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function NodeEventSseClient$onOpen$lambda(this$0) { return function () { return this$0.r6c_1 + ' : open'; }; } function NodeEventSseClient$onMessage$lambda(this$0) { return function () { return this$0.r6c_1 + ' : onMessage : INIT: remoteNodeId = ' + this$0.s6c_1.toString(); }; } function NodeEventSseClient$onMessage$lambda_0(this$0) { return function () { return this$0.r6c_1 + ' : onMessage : pending replication'; }; } function NodeEventSseClient$onMessage$slambda(this$0, resultContinuation) { this.c6d_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(NodeEventSseClient$onMessage$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(NodeEventSseClient$onMessage$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(NodeEventSseClient$onMessage$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; Companion_getInstance_11(); suspendResult = this.c6d_1.n6c_1.l6c(new DoorMessage(1, this.c6d_1.s6c_1, this.c6d_1.m6c_1.y66_1, emptyList()), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(NodeEventSseClient$onMessage$slambda).f1n = function ($this$launch, completion) { var i = new NodeEventSseClient$onMessage$slambda(this.c6d_1, completion); i.d6d_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function NodeEventSseClient$onError$lambda(this$0) { return function () { return this$0.r6c_1 + ' : onError'; }; } function NodeEventSseClient(repoConfig, nodeEventManager, scope) { this.m6c_1 = repoConfig; this.n6c_1 = nodeEventManager; this.o6c_1 = scope; var tmp = this; tmp.q6c_1 = this.m6c_1.w66_1 + 'replication/sse?' + 'door-node' + '=' + urlEncode(this.m6c_1.y66_1.toString() + '/' + this.m6c_1.x66_1); this.r6c_1 = '[NodeEventSseClient localNodeId=' + this.m6c_1.y66_1.toString() + ' remoteEndpoint=' + this.m6c_1.w66_1 + ']'; this.s6c_1 = new Long(0, 0); this.t6c_1 = false; this.p6c_1 = new DoorEventSource(this.m6c_1, this.q6c_1, this); } protoOf(NodeEventSseClient).e6d = function () { var tmp = Napier_getInstance(); tmp.f5f(VOID, 'DoorLog', NodeEventSseClient$onOpen$lambda(this)); }; protoOf(NodeEventSseClient).f6d = function (message) { var tmp0_subject = message.h6d_1; if (tmp0_subject === 'init') { this.s6c_1 = toLong_0(message.i6d_1); var tmp = Napier_getInstance(); tmp.f5f(VOID, 'DoorLog', NodeEventSseClient$onMessage$lambda(this)); } else { if (tmp0_subject === 'pending-replication') { var tmp_0 = Napier_getInstance(); tmp_0.f5f(VOID, 'DoorLog', NodeEventSseClient$onMessage$lambda_0(this)); launch(this.o6c_1, VOID, VOID, NodeEventSseClient$onMessage$slambda_0(this, null)); } } }; protoOf(NodeEventSseClient).j6d = function (e) { if (!this.t6c_1) { Napier_getInstance().o5f(e, 'DoorLog', NodeEventSseClient$onError$lambda(this)); } }; function onSrcInvalidated($this) { $this.l6d_1.p55($this.o6d_1); if (!$this.n6d_1.atomicfu$getAndSet(true)) { $this.l55(); } } function DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this$0) { return function () { onSrcInvalidated(this$0); return Unit_instance; }; } function DelegatedInvalidationPagingSource(invalidationDelegate) { PagingSource.call(this); this.l6d_1 = invalidationDelegate; this.m6d_1 = atomic$boolean$1(false); this.n6d_1 = atomic$boolean$1(false); var tmp = this; tmp.o6d_1 = DelegatedInvalidationPagingSource$srcInvalidatedCallback$lambda(this); } protoOf(DelegatedInvalidationPagingSource).p6d = function () { if (!this.m6d_1.atomicfu$getAndSet(true)) { this.l6d_1.o55(this.o6d_1); } }; function OffsetLimitRange(offset, limit, time) { this.q6d_1 = offset; this.r6d_1 = limit; this.s6d_1 = time; } protoOf(OffsetLimitRange).t6d = function (offset, limit, time) { return new OffsetLimitRange(offset, limit, time); }; protoOf(OffsetLimitRange).u6d = function (offset, limit, time, $super) { offset = offset === VOID ? this.q6d_1 : offset; limit = limit === VOID ? this.r6d_1 : limit; time = time === VOID ? this.s6d_1 : time; return $super === VOID ? this.t6d(offset, limit, time) : $super.t6d.call(this, offset, limit, time); }; protoOf(OffsetLimitRange).toString = function () { return 'OffsetLimitRange(offset=' + this.q6d_1 + ', limit=' + this.r6d_1 + ', time=' + this.s6d_1.toString() + ')'; }; protoOf(OffsetLimitRange).hashCode = function () { var result = this.q6d_1; result = imul(result, 31) + this.r6d_1 | 0; result = imul(result, 31) + this.s6d_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.q6d_1 === tmp0_other_with_cast.q6d_1)) return false; if (!(this.r6d_1 === tmp0_other_with_cast.r6d_1)) return false; if (!this.s6d_1.equals(tmp0_other_with_cast.s6d_1)) return false; return true; }; function OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted) { loadingRangesInProgress = loadingRangesInProgress === VOID ? emptyList() : loadingRangesInProgress; loadingStarted = loadingStarted === VOID ? false : loadingStarted; this.v6d_1 = loadingRangesInProgress; this.w6d_1 = loadingStarted; } protoOf(OffsetLimitMediatorState).x6d = function (loadingRangesInProgress, loadingStarted) { return new OffsetLimitMediatorState(loadingRangesInProgress, loadingStarted); }; protoOf(OffsetLimitMediatorState).y6d = function (loadingRangesInProgress, loadingStarted, $super) { loadingRangesInProgress = loadingRangesInProgress === VOID ? this.v6d_1 : loadingRangesInProgress; loadingStarted = loadingStarted === VOID ? this.w6d_1 : loadingStarted; return $super === VOID ? this.x6d(loadingRangesInProgress, loadingStarted) : $super.x6d.call(this, loadingRangesInProgress, loadingStarted); }; protoOf(OffsetLimitMediatorState).toString = function () { return 'OffsetLimitMediatorState(loadingRangesInProgress=' + this.v6d_1 + ', loadingStarted=' + this.w6d_1 + ')'; }; protoOf(OffsetLimitMediatorState).hashCode = function () { var result = hashCode(this.v6d_1); result = imul(result, 31) + getBooleanHashCode(this.w6d_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.v6d_1, tmp0_other_with_cast.v6d_1)) return false; if (!(this.w6d_1 === tmp0_other_with_cast.w6d_1)) return false; return true; }; function sam$kotlin_Comparator$0(function_0) { this.z6d_1 = function_0; } protoOf(sam$kotlin_Comparator$0).qa = function (a, b) { return this.z6d_1(a, b); }; protoOf(sam$kotlin_Comparator$0).compare = function (a, b) { return this.qa(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.q6d_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = b.q6d_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.q6d_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = a.q6d_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.q6d_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = a.q6d_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.q6d_1; // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call var tmp$ret$1 = b.q6d_1; return compareValues(tmp, tmp$ret$1); } function DoorOffsetLimitRemoteMediator$onLoad$slambda($loadOffset, $loadLimit, this$0, resultContinuation) { this.i6e_1 = $loadOffset; this.j6e_1 = $loadLimit; this.k6e_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 5; this.m6e_1 = new OffsetLimitRange(this.i6e_1._v, this.j6e_1, systemTimeInMillis()); this.ld_1 = 1; continue $sm; case 1: this.md_1 = 4; this.md_1 = 3; l$ret$1: do { var this_0 = this.k6e_1.t6e_1; while (true) { var prevValue = this_0.t2(); var nextValue = prevValue.x6d(plus_1(prevValue.v6d_1, this.m6e_1), true); if (this_0.i1l(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.ld_1 = 2; suspendResult = this.k6e_1.q6e_1.v6e(this.i6e_1._v, this.j6e_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: var tmp_0 = this; this.k6e_1.s6e_1.j1(this.m6e_1.u6d(VOID, VOID, systemTimeInMillis())); tmp_0.n6e_1 = Unit_instance; this.md_1 = 5; this.ld_1 = 6; continue $sm; case 3: this.md_1 = 4; var tmp_1 = this.od_1; if (tmp_1 instanceof Error) { var e = this.od_1; var tmp_2 = this; Napier_getInstance().n5f('Attempted to load from offset=' + this.i6e_1._v + ' limit=' + this.j6e_1 + ' faled ', e); tmp_2.n6e_1 = Unit_instance; this.md_1 = 5; this.ld_1 = 6; continue $sm; } else { throw this.od_1; } case 4: this.md_1 = 5; var t = this.od_1; l$ret$5: do { var this_1 = this.k6e_1.t6e_1; while (true) { var prevValue_0 = this_1.t2(); var nextValue_0 = prevValue_0.y6d(minus(prevValue_0.v6d_1, this.m6e_1)); if (this_1.i1l(prevValue_0, nextValue_0)) { break l$ret$5; } } } while (false); throw t; case 5: throw this.od_1; case 6: this.md_1 = 5; l$ret$7: do { var this_2 = this.k6e_1.t6e_1; while (true) { var prevValue_1 = this_2.t2(); var nextValue_1 = prevValue_1.y6d(minus(prevValue_1.v6d_1, this.m6e_1)); if (this_2.i1l(prevValue_1, nextValue_1)) { break l$ret$7; } } } while (false); return Unit_instance; } } catch ($p) { var e_0 = $p; if (this.md_1 === 5) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; protoOf(DoorOffsetLimitRemoteMediator$onLoad$slambda).f1n = function ($this$launch, completion) { var i = new DoorOffsetLimitRemoteMediator$onLoad$slambda(this.i6e_1, this.j6e_1, this.k6e_1, completion); i.l6e_1 = $this$launch; return i; }; 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.e1n($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.o6e_1 = prefetchDistance; this.p6e_1 = prefetchThreshold; this.q6e_1 = onRemoteLoad; this.r6e_1 = CoroutineScope_0(Dispatchers_getInstance().z12_1.rj(Job())); this.s6e_1 = concurrentSafeListOf([]); this.t6e_1 = MutableStateFlow(new OffsetLimitMediatorState()); this.u6e_1 = asStateFlow(this.t6e_1); } protoOf(DoorOffsetLimitRemoteMediator).w6e = function (params) { var tmp0_elvis_lhs = params.s2(); var pagingOffset = getOffset(params, tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs, IntCompanionObject_instance.MAX_VALUE); var tmp1_elvis_lhs = params.s2(); var pagingLimit = getLimit(params, tmp1_elvis_lhs == null ? 0 : tmp1_elvis_lhs); // Inline function 'kotlin.comparisons.maxOf' call var b = pagingOffset - this.o6e_1 | 0; var rangeOffset = Math.max(0, b); var rangeLimit = (pagingLimit + (pagingOffset - rangeOffset | 0) | 0) + this.o6e_1 | 0; var loadOffset = {_v: rangeOffset}; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedBy' call var this_0 = this.s6e_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).w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element.q6d_1 <= rangeOffset ? (element.q6d_1 + element.r6d_1 | 0) > loadOffset._v : false) { loadOffset._v = element.q6d_1 + element.r6d_1 | 0; } } if (loadOffset._v >= (rangeOffset + rangeLimit | 0)) { var tmp_0 = Napier_getInstance(); tmp_0.l5f(VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$lambda_0); return Unit_instance; } var loadEnd = rangeOffset + rangeLimit | 0; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedByDescending' call var this_1 = this.s6e_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).w(); while (tmp0_iterator_0.f()) { var element_0 = tmp0_iterator_0.e(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_0.q6d_1 < loadEnd ? (element_0.q6d_1 + element_0.r6d_1 | 0) > loadEnd : false) loadEnd = element_0.q6d_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.s6e_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).w(); while (tmp0_iterator_1.f()) { var element_1 = tmp0_iterator_1.e(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_1.q6d_1 < alreadyLoadedStart ? (element_1.q6d_1 + element_1.r6d_1 | 0) >= alreadyLoadedStart : false) alreadyLoadedStart = element_1.q6d_1; } var alreadyLoadedEnd = pagingOffset + pagingLimit | 0; // Inline function 'kotlin.collections.forEach' call // Inline function 'kotlin.collections.sortedBy' call var this_3 = this.s6e_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).w(); while (tmp0_iterator_2.f()) { var element_2 = tmp0_iterator_2.e(); // Inline function 'com.ustadmobile.door.paging.DoorOffsetLimitRemoteMediator.onLoad.' call if (element_2.q6d_1 <= alreadyLoadedEnd ? (element_2.q6d_1 + element_2.r6d_1 | 0) > alreadyLoadedEnd : false) { alreadyLoadedEnd = element_2.q6d_1 + element_2.r6d_1 | 0; } } tmp_3 = (rangeOffset - alreadyLoadedStart | 0) + ((rangeOffset + rangeLimit | 0) - alreadyLoadedEnd | 0) | 0; } var prefetchSize = tmp_3; if (loadPagingOverlap > 0 ? true : prefetchSize > this.p6e_1) { launch(this.r6e_1, VOID, VOID, DoorOffsetLimitRemoteMediator$onLoad$slambda_0(loadOffset, loadLimit, this, null)); } }; protoOf(DoorOffsetLimitRemoteMediator).l55 = function () { this.s6e_1.o1(); }; protoOf(DoorOffsetLimitRemoteMediator).x6e = function () { cancel(this.r6e_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.i55_1) { tmp_0 = 0; } else { tmp_0 = key - params.i55_1 | 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.i55_1 | 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.i55_1) { tmp_0 = key; } else { tmp_0 = params.i55_1; } tmp = tmp_0; } else { tmp = params.i55_1; } 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.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function $queryDatabaseCOROUTINE$16(params, loadRows, itemCount, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.g6f_1 = params; this.h6f_1 = loadRows; this.i6f_1 = itemCount; } protoOf($queryDatabaseCOROUTINE$16).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; var tmp_0 = this; var tmp0_elvis_lhs = this.g6f_1.s2(); tmp_0.j6f_1 = tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs; this.k6f_1 = getLimit(this.g6f_1, this.j6f_1); this.l6f_1 = getOffset(this.g6f_1, this.j6f_1, this.i6f_1); this.ld_1 = 1; suspendResult = this.h6f_1(this.k6f_1, this.l6f_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var data = suspendResult; var nextPosToLoad = this.l6f_1 + data.u() | 0; var tmp_1; if ((data.d1() ? true : data.u() < this.k6f_1) ? true : nextPosToLoad >= this.i6f_1) { tmp_1 = null; } else { tmp_1 = nextPosToLoad; } var nextKey = tmp_1; var prevKey = (this.l6f_1 <= 0 ? true : data.d1()) ? null : this.l6f_1; var b = this.i6f_1 - nextPosToLoad | 0; var tmp_2 = new Page(data, prevKey, nextKey, this.l6f_1, Math.max(0, b)); return tmp_2 instanceof LoadResult ? tmp_2 : THROW_CCE(); case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = 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.n6f_1 = MutableStateFlow(new PagingSourceLoadState()); this.o6f_1 = asStateFlow(this.n6f_1); } function onDbInvalidated($this) { Napier_getInstance().d5f('DoorRepositoryReplicatePullPagingSource: onDbInvalidated'); $this.u6f_1.p55($this.z6f_1); if (!$this.x6f_1.atomicfu$getAndSet(true)) { Napier_getInstance().d5f('DoorRepositoryReplicatePullPagingSource: call invalidate'); $this.l55(); } } function Companion_10() { this.a6g_1 = 'pagingBatchSize'; this.b6g_1 = 'pagingKey'; this.c6g_1 = 'pagingLoadParamType'; } var Companion_instance_10; function Companion_getInstance_12() { return Companion_instance_10; } function DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this$0) { return function () { onDbInvalidated(this$0); return Unit_instance; }; } function DoorRepositoryReplicatePullPagingSource(repo, repoPath, dbPagingSource, onLoadHttp) { DoorRepositoryPagingSource.call(this); this.s6f_1 = repo; this.t6f_1 = repoPath; this.u6f_1 = dbPagingSource; this.v6f_1 = onLoadHttp; this.w6f_1 = atomic$boolean$1(false); this.x6f_1 = atomic$boolean$1(false); this.y6f_1 = null; var tmp = this; tmp.z6f_1 = DoorRepositoryReplicatePullPagingSource$onDbInvalidatedCallback$lambda(this); } protoOf(DoorRepositoryReplicatePullPagingSource).f5t = function (params, $completion) { Napier_getInstance().d5f('DoorRepositoryReplicatePullPagingSource: load key=' + params.s2()); this.y6f_1 = params; if (!this.w6f_1.atomicfu$getAndSet(true)) { Napier_getInstance().d5f('DoorRepositoryReplicatePullPagingSource: register db invalidate callback'); this.u6f_1.o55(this.z6f_1); } return this.u6f_1.q55(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).q55 = function (params, $completion) { return this.f5t(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).d6g = function (params, $completion) { return this.v6f_1(params, $completion); }; protoOf(DoorRepositoryReplicatePullPagingSource).e6g = function (params, $completion) { return this.d6g(params, $completion); }; function FilterPagingSource(src) { DelegatedInvalidationPagingSource.call(this, src); this.k6g_1 = src; } protoOf(FilterPagingSource).q55 = function (params, $completion) { this.p6d(); return this.k6g_1.q55(params, $completion); }; function endOfPaginationReached(_this__u8e3s4) { var tmp = _this__u8e3s4.u2x(); var tmp0_safe_receiver = tmp.ca('door-paging-end-reached'); var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toBoolean(tmp0_safe_receiver); return tmp1_elvis_lhs == null ? true : tmp1_elvis_lhs; } function PagingSourceInterceptor(src, onLoad) { FilterPagingSource.call(this, src); this.r6g_1 = onLoad; } protoOf(PagingSourceInterceptor).q55 = function (params, $completion) { this.r6g_1(params); return protoOf(FilterPagingSource).q55.call(this, params, $completion); }; function PagingSourceLoadState(activeRequests, failedRequests, completedRequests) { activeRequests = activeRequests === VOID ? emptyList() : activeRequests; failedRequests = failedRequests === VOID ? emptyList() : failedRequests; completedRequests = completedRequests === VOID ? emptyList() : completedRequests; this.s6g_1 = activeRequests; this.t6g_1 = failedRequests; this.u6g_1 = completedRequests; } protoOf(PagingSourceLoadState).toString = function () { return 'PagingSourceLoadState(activeRequests=' + this.s6g_1 + ', failedRequests=' + this.t6g_1 + ', completedRequests=' + this.u6g_1 + ')'; }; protoOf(PagingSourceLoadState).hashCode = function () { var result = hashCode(this.s6g_1); result = imul(result, 31) + hashCode(this.t6g_1) | 0; result = imul(result, 31) + hashCode(this.u6g_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.s6g_1, tmp0_other_with_cast.s6g_1)) return false; if (!equals(this.t6g_1, tmp0_other_with_cast.t6g_1)) return false; if (!equals(this.u6g_1, tmp0_other_with_cast.u6g_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.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function insertEntitiesFromMessage(_this__u8e3s4, message, $completion) { var tmp = new $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(_this__u8e3s4, tableId, primaryKeysList, $completion) { var entityMetaData = doorDatabaseMetadata(getKClassFromExpression(_this__u8e3s4)).p66(tableId); var tmp = entityMetaData.g6i(); return prepareAndUseStatementAsync_0(_this__u8e3s4, tmp, true, selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0(primaryKeysList, entityMetaData, tableId, null), $completion); } function ReplicateEntityPrimaryKeys(pk1, pk2, pk3, pk4, orUid) { this.h6i_1 = pk1; this.i6i_1 = pk2; this.j6i_1 = pk3; this.k6i_1 = pk4; this.l6i_1 = orUid; } protoOf(ReplicateEntityPrimaryKeys).toString = function () { return 'ReplicateEntityPrimaryKeys(pk1=' + this.h6i_1.toString() + ', pk2=' + this.i6i_1.toString() + ', pk3=' + this.j6i_1.toString() + ', pk4=' + this.k6i_1.toString() + ', orUid=' + this.l6i_1.toString() + ')'; }; protoOf(ReplicateEntityPrimaryKeys).hashCode = function () { var result = this.h6i_1.hashCode(); result = imul(result, 31) + this.i6i_1.hashCode() | 0; result = imul(result, 31) + this.j6i_1.hashCode() | 0; result = imul(result, 31) + this.k6i_1.hashCode() | 0; result = imul(result, 31) + this.l6i_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.h6i_1.equals(tmp0_other_with_cast.h6i_1)) return false; if (!this.i6i_1.equals(tmp0_other_with_cast.i6i_1)) return false; if (!this.j6i_1.equals(tmp0_other_with_cast.j6i_1)) return false; if (!this.k6i_1.equals(tmp0_other_with_cast.k6i_1)) return false; if (!this.l6i_1.equals(tmp0_other_with_cast.l6i_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.a5k())).d66().p2().w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.replication.withRepoChangeMonitorAsync.' call if (element.g66_1 === 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.p62(); var tmp_0 = _this__u8e3s4.a5k(); var tmp_1 = TransactionMode_READ_WRITE_getInstance(); return withDoorTransactionAsync(tmp_0, tmp_1, withRepoChangeMonitorAsync$slambda_0(_this__u8e3s4, entityMetaData, remoteNodeId, block, null), $completion); } function onClientRepoDoorMessageHttpResponse(_this__u8e3s4, httpResponse, json, $completion) { var tmp = new $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function createChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) { // Inline function 'kotlin.math.absoluteValue' call var tmp$ret$0 = abs(remoteNodeId); var tmp = '_d_ch_monitor_' + entityMetaData.f66_1 + '_' + tmp$ret$0.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 + ('_' + 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.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.replication.createChangeMonitorTriggerSql.' call var tmp_0; if (entityMetaData.i66_1.u() > item) { tmp_0 = 'NEW.' + entityMetaData.i66_1.v(item); } else { tmp_0 = '0'; } var tmp$ret$5 = tmp_0; destination.j1(tmp$ret$5); } var primaryKeys = destination; return '\n CREATE TEMP TRIGGER IF NOT EXISTS ' + triggerName + ' \n AFTER ' + operation + ' ON ' + entityMetaData.g66_1 + '\n FOR EACH ROW\n BEGIN\n INSERT INTO OutgoingReplication(destNodeId, orTableId, orPk1, orPk2, orPk3, orPk4)\n VALUES (' + remoteNodeId.toString() + ', ' + entityMetaData.f66_1 + ', ' + joinToString(primaryKeys) + ');\n END\n '; } function dropChangeMonitorTriggerSql(entityMetaData, remoteNodeId, operation) { // Inline function 'kotlin.math.absoluteValue' call var tmp$ret$0 = abs(remoteNodeId); var tmp = '_d_ch_monitor_' + entityMetaData.f66_1 + '_' + tmp$ret$0.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 + ('_' + operation.substring(0, 2).toLowerCase()); return 'DROP TRIGGER IF EXISTS ' + triggerName; } function acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation) { this.l6j_1 = $receivedUids; this.m6j_1 = $nodeId; CoroutineImpl.call(this, resultContinuation); } protoOf(acknowledgeReceivedReplications$slambda).n5g = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(acknowledgeReceivedReplications$slambda).le = function (p1, $completion) { return this.n5g((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(acknowledgeReceivedReplications$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; var tmp_0 = this; tmp_0.o6j_1 = this.l6j_1; this.p6j_1 = this.o6j_1.w(); this.ld_1 = 1; continue $sm; case 1: if (!this.p6j_1.f()) { this.ld_1 = 3; continue $sm; } this.q6j_1 = this.p6j_1.e(); var tmp_1 = this; tmp_1.r6j_1 = this.q6j_1; this.n6j_1.x5i(1, this.r6j_1); this.n6j_1.x5i(2, this.m6j_1); this.ld_1 = 2; suspendResult = executeUpdateAsyncKmp(this.n6j_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 1; continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(acknowledgeReceivedReplications$slambda).o5g = function (stmt, completion) { var i = new acknowledgeReceivedReplications$slambda(this.l6j_1, this.m6j_1, completion); i.n6j_1 = stmt; return i; }; function acknowledgeReceivedReplications$slambda_0($receivedUids, $nodeId, resultContinuation) { var i = new acknowledgeReceivedReplications$slambda($receivedUids, $nodeId, resultContinuation); var l = function (stmt, $completion) { return i.n5g(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.b5o('orUid'), result.b5o('destNodeId'), result.a5o('orTableId'), result.b5o('orPk1'), result.b5o('orPk2')); } function selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation) { this.a6k_1 = $nodeId; this.b6k_1 = $limit; CoroutineImpl.call(this, resultContinuation); } protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).d6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).le = function (p1, $completion) { return this.d6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.c6k_1.x5i(1, this.a6k_1); this.c6k_1.w5i(2, this.b6k_1); this.ld_1 = 1; suspendResult = executeQueryAsyncKmp(this.c6k_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.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(selectPendingOutgoingReplicationsByDestNodeId$slambda).o5g = function (stmt, completion) { var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda(this.a6k_1, this.b6k_1, completion); i.c6k_1 = stmt; return i; }; function selectPendingOutgoingReplicationsByDestNodeId$slambda_0($nodeId, $limit, resultContinuation) { var i = new selectPendingOutgoingReplicationsByDestNodeId$slambda($nodeId, $limit, resultContinuation); var l = function (stmt, $completion) { return i.d6k(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation) { this.m6k_1 = $message; this.n6k_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(insertEntitiesFromMessage$slambda).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.o6k_1.x5i(1, this.m6k_1.f69_1); this.o6k_1.w5i(2, this.n6k_1); this.o6k_1.w5i(3, 0); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.o6k_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(insertEntitiesFromMessage$slambda).o5g = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda(this.m6k_1, this.n6k_1, completion); i.o6k_1 = stmt; return i; }; function insertEntitiesFromMessage$slambda_0($message, $tableId, resultContinuation) { var i = new insertEntitiesFromMessage$slambda($message, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda_1($tableEntities, $entityMetaData, $message, resultContinuation) { this.y6k_1 = $tableEntities; this.z6k_1 = $entityMetaData; this.a6l_1 = $message; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda_1).n5g = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(insertEntitiesFromMessage$slambda_1).le = function (p1, $completion) { return this.n5g((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; var tmp_0 = this; tmp_0.c6l_1 = this.y6k_1; this.d6l_1 = this.c6l_1.w(); this.ld_1 = 1; continue $sm; case 1: if (!this.d6l_1.f()) { this.ld_1 = 3; continue $sm; } this.e6l_1 = this.d6l_1.e(); var tmp_1 = this; tmp_1.f6l_1 = this.e6l_1; setAllFromJsonObject(this.b6l_1, this.f6l_1.i6l_1, this.z6k_1.k66_1); this.b6l_1.x5i(this.z6k_1.k66_1.u() + 1 | 0, this.a6l_1.f69_1); this.ld_1 = 2; suspendResult = executeUpdateAsyncKmp(this.b6l_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 1; continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(insertEntitiesFromMessage$slambda_1).o5g = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda_1(this.y6k_1, this.z6k_1, this.a6l_1, completion); i.b6l_1 = stmt; return i; }; 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.n5g(stmt, $completion); }; l.$arity = 1; return l; } function insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation) { this.r6l_1 = $message; this.s6l_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(insertEntitiesFromMessage$slambda_3).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(insertEntitiesFromMessage$slambda_3).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(insertEntitiesFromMessage$slambda_3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.t6l_1.x5i(1, this.r6l_1.f69_1); this.t6l_1.w5i(2, this.s6l_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.t6l_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(insertEntitiesFromMessage$slambda_3).o5g = function (stmt, completion) { var i = new insertEntitiesFromMessage$slambda_3(this.r6l_1, this.s6l_1, completion); i.t6l_1 = stmt; return i; }; function insertEntitiesFromMessage$slambda_4($message, $tableId, resultContinuation) { var i = new insertEntitiesFromMessage$slambda_3($message, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda$lambda$lambda($tableId, $primaryKeys, $entityMetaData) { return function (mapResult) { return new DoorReplicationEntity($tableId, $primaryKeys.l6i_1, rowToJsonObject(mapResult, $entityMetaData.k66_1)); }; } 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.c6m_1 = $primaryKeysList; this.d6m_1 = $entityMetaData; this.e6m_1 = $tableId; CoroutineImpl.call(this, resultContinuation); } protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).o6m = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).le = function (p1, $completion) { return this.o6m((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; var tmp_0 = this; tmp_0.g6m_1 = this.c6m_1; var tmp_1 = this; tmp_1.h6m_1 = this.g6m_1; var tmp_2 = this; tmp_2.i6m_1 = ArrayList_init_$Create$(); var tmp_3 = this; tmp_3.j6m_1 = this.h6m_1; this.k6m_1 = this.j6m_1.w(); this.ld_1 = 1; continue $sm; case 1: if (!this.k6m_1.f()) { this.ld_1 = 3; continue $sm; } this.l6m_1 = this.k6m_1.e(); var tmp_4 = this; tmp_4.m6m_1 = this.l6m_1; var tmp_5 = this; tmp_5.n6m_1 = this.m6m_1; this.f6m_1.x5i(1, this.n6m_1.h6i_1); if (this.d6m_1.i66_1.u() >= 2) { this.f6m_1.x5i(2, this.n6m_1.i6i_1); } if (this.d6m_1.i66_1.u() >= 3) { this.f6m_1.x5i(3, this.n6m_1.j6i_1); } if (this.d6m_1.i66_1.u() >= 4) { this.f6m_1.x5i(3, this.n6m_1.k6i_1); } this.ld_1 = 2; suspendResult = executeQueryAsyncKmp(this.f6m_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.e6m_1, this.n6m_1, this.d6m_1)); if (tmp0_safe_receiver == null) null; else { this.i6m_1.j1(tmp0_safe_receiver); } this.ld_1 = 1; continue $sm; case 3: return this.i6m_1; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda).o5g = function (stmt, completion) { var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda(this.c6m_1, this.d6m_1, this.e6m_1, completion); i.f6m_1 = stmt; return i; }; function selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda_0($primaryKeysList, $entityMetaData, $tableId, resultContinuation) { var i = new selectDoorReplicateEntitiesByTableIdAndPrimaryKeys$slambda($primaryKeysList, $entityMetaData, $tableId, resultContinuation); var l = function (stmt, $completion) { return i.o6m(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.x6m_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda).o5g = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda(completion); i.x6m_1 = stmt; return i; }; function withRepoChangeMonitorAsync$slambda$slambda_0(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda(resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.g6n_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_1).o5g = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_1(completion); i.g6n_1 = stmt; return i; }; function withRepoChangeMonitorAsync$slambda$slambda_2(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_1(resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.p6n_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_3).o5g = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_3(completion); i.p6n_1 = stmt; return i; }; function withRepoChangeMonitorAsync$slambda$slambda_4(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_3(resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation) { CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).p6k = function (stmt, $completion) { var tmp = this.o5g(stmt, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.y6n_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda$slambda_5).o5g = function (stmt, completion) { var i = new withRepoChangeMonitorAsync$slambda$slambda_5(completion); i.y6n_1 = stmt; return i; }; function withRepoChangeMonitorAsync$slambda$slambda_6(resultContinuation) { var i = new withRepoChangeMonitorAsync$slambda$slambda_5(resultContinuation); var l = function (stmt, $completion) { return i.p6k(stmt, $completion); }; l.$arity = 1; return l; } function withRepoChangeMonitorAsync$slambda($this_withRepoChangeMonitorAsync, $entityMetaData, $remoteNodeId, $block, resultContinuation) { this.h6o_1 = $this_withRepoChangeMonitorAsync; this.i6o_1 = $entityMetaData; this.j6o_1 = $remoteNodeId; this.k6o_1 = $block; CoroutineImpl.call(this, resultContinuation); } protoOf(withRepoChangeMonitorAsync$slambda).n6o = function (it, $completion) { var tmp = this.s5s(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withRepoChangeMonitorAsync$slambda).le = function (p1, $completion) { return this.n6o(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(withRepoChangeMonitorAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 6; this.ld_1 = 1; var tmp_0 = this.h6o_1.a5k(); var tmp_1 = createChangeMonitorTriggerSql(this.i6o_1, this.j6o_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.ld_1 = 2; var tmp_2 = this.h6o_1.a5k(); var tmp_3 = createChangeMonitorTriggerSql(this.i6o_1, this.j6o_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.ld_1 = 3; suspendResult = this.k6o_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.m6o_1 = suspendResult; this.ld_1 = 4; var tmp_4 = this.h6o_1.a5k(); var tmp_5 = dropChangeMonitorTriggerSql(this.i6o_1, this.j6o_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.ld_1 = 5; var tmp_6 = this.h6o_1.a5k(); var tmp_7 = dropChangeMonitorTriggerSql(this.i6o_1, this.j6o_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.m6o_1; case 6: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 6) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withRepoChangeMonitorAsync$slambda).s5s = function (it, completion) { var i = new withRepoChangeMonitorAsync$slambda(this.h6o_1, this.i6o_1, this.j6o_1, this.k6o_1, completion); i.l6o_1 = it; return i; }; 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.n6o(it, $completion); }; l.$arity = 1; return l; } function onClientRepoDoorMessageHttpResponse$lambda($nodeEventManager, $httpResponse, $message) { return function () { return '[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.i6c() + '] - ' + get_request($httpResponse).s3b() + ' - ' + ('handle message with ' + $message.h69_1.u() + ' replications'); }; } function onClientRepoDoorMessageHttpResponse$lambda_0($nodeEventManager, $httpResponse) { return function () { return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.i6c() + '] - ' + get_request($httpResponse).s3b() + ' -' + ' http response was not modified or no content, no need to do anything'; }; } function onClientRepoDoorMessageHttpResponse$lambda_1($nodeEventManager, $httpResponse) { return function () { return '$[onClientRepoDoorMessageHttpResponse - ' + $nodeEventManager.i6c() + '] - ' + get_request($httpResponse).s3b() + ' -' + (' unexpected response status = ' + $httpResponse.t3b()); }; } function $selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17(_this__u8e3s4, nodeId, limit, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.d6h_1 = _this__u8e3s4; this.e6h_1 = nodeId; this.f6h_1 = limit; } protoOf($selectPendingOutgoingReplicationsByDestNodeIdCOROUTINE$17).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 5; this.ld_1 = 1; suspendResult = prepareAndUseStatementAsync_0(this.d6h_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.e6h_1, this.f6h_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.g6h_1 = suspendResult; if (this.g6h_1.d1()) return emptyList(); var tmp_0 = this; var this_0 = this.g6h_1; var result = mutableLinkedListOf([]); var lastItemKey = null; var lastList = null; var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); var itemKey = item.x65_1; if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) { lastList.j1(item); } else { var newList = mutableLinkedListOf([item]); result.j1(newList); lastList = newList; } lastItemKey = itemKey; } tmp_0.h6h_1 = toList_0(result); var tmp_1 = this; tmp_1.i6h_1 = this.h6h_1; var tmp_2 = this; tmp_2.j6h_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this.h6h_1, 10)); this.k6h_1 = this.i6h_1.w(); this.ld_1 = 2; continue $sm; case 2: if (!this.k6h_1.f()) { this.ld_1 = 4; continue $sm; } this.l6h_1 = this.k6h_1.e(); var tmp_3 = this; tmp_3.m6h_1 = this.l6h_1; this.n6h_1 = first(this.m6h_1).x65_1; this.ld_1 = 3; var this_1 = this.g6h_1; var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10)); var tmp0_iterator_0 = this_1.w(); while (tmp0_iterator_0.f()) { var item_0 = tmp0_iterator_0.e(); destination.j1(new ReplicateEntityPrimaryKeys(item_0.y65_1, item_0.z65_1, item_0.a66_1, item_0.b66_1, item_0.v65_1)); } suspendResult = selectDoorReplicateEntitiesByTableIdAndPrimaryKeys(this.d6h_1, this.n6h_1, destination, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: var ARGUMENT = suspendResult; this.j6h_1.j1(ARGUMENT); this.ld_1 = 2; continue $sm; case 4: var ARGUMENT_0 = this.j6h_1; return flatten(ARGUMENT_0); case 5: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 5) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $insertEntitiesFromMessageCOROUTINE$18(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.w6h_1 = _this__u8e3s4; this.x6h_1 = message; } protoOf($insertEntitiesFromMessageCOROUTINE$18).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 9; this.y6h_1 = doorDatabaseMetadata(getKClassFromExpression(this.w6h_1)); this.z6h_1 = this.y6h_1.q66().b1('ReplicationOperation'); var tmp_0 = this; var this_0 = this.x6h_1.h69_1; var result = mutableLinkedListOf([]); var lastItemKey = null; var lastList = null; var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); var itemKey = item.g6l_1; if ((!(lastItemKey == null) ? !(lastList == null) : false) ? itemKey === lastItemKey : false) { lastList.j1(item); } else { var newList = mutableLinkedListOf([item]); result.j1(newList); lastList = newList; } lastItemKey = itemKey; } tmp_0.a6i_1 = toList_0(result); this.b6i_1 = this.a6i_1.w(); this.ld_1 = 1; continue $sm; case 1: if (!this.b6i_1.f()) { this.ld_1 = 8; continue $sm; } this.c6i_1 = this.b6i_1.e(); var tmp_1 = this; tmp_1.d6i_1 = this.c6i_1; this.e6i_1 = first(this.d6i_1).g6l_1; this.f6i_1 = this.y6h_1.p66(this.e6i_1); if (this.z6h_1) { this.ld_1 = 2; suspendResult = prepareAndUseStatementAsync_0(this.w6h_1, '\n INSERT INTO ReplicationOperation(repOpRemoteNodeId, repOpTableId, repOpStatus)\n VALUES(?, ?, ?)\n ', false, insertEntitiesFromMessage$slambda_0(this.x6h_1, this.e6i_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 3; continue $sm; } case 2: this.ld_1 = 3; continue $sm; case 3: if (this.f6i_1.m66_1.equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) { this.ld_1 = 4; var tmp_2 = this.f6i_1.o6o(); suspendResult = prepareAndUseStatementAsync_0(this.w6h_1, tmp_2, false, insertEntitiesFromMessage$slambda_2(this.d6i_1, this.f6i_1, this.x6h_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 5; continue $sm; } case 4: this.ld_1 = 5; continue $sm; case 5: if (this.z6h_1) { this.ld_1 = 6; suspendResult = prepareAndUseStatementAsync_0(this.w6h_1, '\n DELETE FROM ReplicationOperation\n WHERE repOpRemoteNodeId = ?\n AND repOpTableId = ?\n ', false, insertEntitiesFromMessage$slambda_4(this.x6h_1, this.e6i_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 7; continue $sm; } case 6: this.ld_1 = 7; continue $sm; case 7: this.ld_1 = 1; continue $sm; case 8: return Unit_instance; case 9: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 9) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $onClientRepoDoorMessageHttpResponseCOROUTINE$20(_this__u8e3s4, httpResponse, json, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.u6i_1 = _this__u8e3s4; this.v6i_1 = httpResponse; this.w6i_1 = json; } protoOf($onClientRepoDoorMessageHttpResponseCOROUTINE$20).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; this.x6i_1 = get_doorWrapper(this.u6i_1).q62(); this.y6i_1 = this.x6i_1.h6c(); this.z6i_1 = this.v6i_1.t3b(); if (this.z6i_1.equals(Companion_getInstance().p2y_1)) { this.a6j_1 = Companion_getInstance_11().x4r(); this.ld_1 = 1; suspendResult = bodyAsText(this.v6i_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { if (this.z6i_1.equals(Companion_getInstance().b2z_1) ? true : this.z6i_1.equals(Companion_getInstance().t2y_1)) { v(this.y6i_1, VOID, onClientRepoDoorMessageHttpResponse$lambda_0(this.x6i_1, this.v6i_1)); this.ld_1 = 3; continue $sm; } else { e_0(this.y6i_1, VOID, onClientRepoDoorMessageHttpResponse$lambda_1(this.x6i_1, this.v6i_1)); throw IllegalStateException_init_$Create$('' + this.u6i_1 + ' - unexpected response status - ' + this.v6i_1.t3b()); } } case 1: this.b6j_1 = suspendResult; this.c6j_1 = this.w6i_1.c46(this.a6j_1, this.b6j_1); v(this.y6i_1, VOID, onClientRepoDoorMessageHttpResponse$lambda(this.x6i_1, this.v6i_1, this.c6j_1)); this.ld_1 = 2; suspendResult = this.x6i_1.l6c(this.c6j_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function Companion_11() { } var Companion_instance_11; function Companion_getInstance_13() { return Companion_instance_11; } function $serializer_1() { $serializer_instance_1 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.DoorReplicationEntity', this, 3); tmp0_serialDesc.d4g('tableId', false); tmp0_serialDesc.d4g('orUid', false); tmp0_serialDesc.d4g('entity', false); this.p6o_1 = tmp0_serialDesc; } protoOf($serializer_1).a45 = function () { return this.p6o_1; }; protoOf($serializer_1).u4g = 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).c45 = function (decoder) { var tmp0_desc = this.p6o_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.s48(tmp0_desc); if (tmp7_input.h49()) { tmp4_local0 = tmp7_input.x48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; tmp5_local1 = tmp7_input.y48(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; tmp6_local2 = tmp7_input.e49(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2); tmp3_bitMask0 = tmp3_bitMask0 | 4; } else while (tmp1_flag) { tmp2_index = tmp7_input.i49(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp7_input.x48(tmp0_desc, 0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; case 1: tmp5_local1 = tmp7_input.y48(tmp0_desc, 1); tmp3_bitMask0 = tmp3_bitMask0 | 2; break; case 2: tmp6_local2 = tmp7_input.e49(tmp0_desc, 2, JsonObjectSerializer_getInstance(), tmp6_local2); tmp3_bitMask0 = tmp3_bitMask0 | 4; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp7_input.t48(tmp0_desc); return DoorReplicationEntity_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, null); }; protoOf($serializer_1).q6o = function (encoder, value) { var tmp0_desc = this.p6o_1; var tmp1_output = encoder.s48(tmp0_desc); tmp1_output.b4a(tmp0_desc, 0, value.g6l_1); tmp1_output.c4a(tmp0_desc, 1, value.h6l_1); tmp1_output.i4a(tmp0_desc, 2, JsonObjectSerializer_getInstance(), value.i6l_1); tmp1_output.t48(tmp0_desc); }; protoOf($serializer_1).b45 = function (encoder, value) { return this.q6o(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().p6o_1); } $this.g6l_1 = tableId; $this.h6l_1 = orUid; $this.i6l_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) { this.g6l_1 = tableId; this.h6l_1 = orUid; this.i6l_1 = entity; } protoOf(DoorReplicationEntity).toString = function () { return 'DoorReplicationEntity(tableId=' + this.g6l_1 + ', orUid=' + this.h6l_1.toString() + ', entity=' + this.i6l_1 + ')'; }; protoOf(DoorReplicationEntity).hashCode = function () { var result = this.g6l_1; result = imul(result, 31) + this.h6l_1.hashCode() | 0; result = imul(result, 31) + this.i6l_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.g6l_1 === tmp0_other_with_cast.g6l_1)) return false; if (!this.h6l_1.equals(tmp0_other_with_cast.h6l_1)) return false; if (!this.i6l_1.equals(tmp0_other_with_cast.i6l_1)) return false; return true; }; function DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda($receivedAck, this$0, $nodeId, $batchSize, resultContinuation) { this.z6o_1 = $receivedAck; this.a6p_1 = this$0; this.b6p_1 = $nodeId; this.c6p_1 = $batchSize; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).e6p = function (it, $completion) { var tmp = this.s5s(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).le = function (p1, $completion) { return this.e6p(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; if (!this.z6o_1.f6p_1.d1()) { this.ld_1 = 1; suspendResult = acknowledgeReceivedReplications(this.a6p_1.g6p_1, this.b6p_1, this.z6o_1.f6p_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 2; continue $sm; } case 1: this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; suspendResult = selectPendingOutgoingReplicationsByDestNodeId(this.a6p_1.g6p_1, this.b6p_1, this.c6p_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: return suspendResult; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda).s5s = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda(this.z6o_1, this.a6p_1, this.b6p_1, this.c6p_1, completion); i.d6p_1 = it; return i; }; 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.e6p(it, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda($fakeRemoteNodeId, $endpointUrl, resultContinuation) { this.p6p_1 = $fakeRemoteNodeId; this.q6p_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).p6k = function (it, $completion) { var tmp = this.o5g(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.r6p_1.x5i(1, this.p6p_1); this.r6p_1.a5j(2, this.q6p_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.r6p_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda).o5g = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda(this.p6p_1, this.q6p_1, completion); i.r6p_1 = it; return i; }; 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.p6k(it, $completion); }; l.$arity = 1; return l; } function $invokeCOROUTINE$21(_this__u8e3s4, fakeRemoteNodeId, endpointUrl, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.a6q_1 = _this__u8e3s4; this.b6q_1 = fakeRemoteNodeId; this.c6q_1 = endpointUrl; } protoOf($invokeCOROUTINE$21).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = prepareAndUseStatementAsync_0(this.a6q_1.d6q_1, '\n INSERT INTO PendingRepositorySession(remoteNodeId, endpointUrl)\n VALUES(?, ?)\n ', VOID, DoorRepositoryReplicationClient$DefaultOnStartPendingSession$invoke$slambda_0(this.b6q_1, this.c6q_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda($remoteNodeId, $endpointUrl, resultContinuation) { this.m6q_1 = $remoteNodeId; this.n6q_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).p6k = function (it, $completion) { var tmp = this.o5g(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.o6q_1.x5i(1, this.m6q_1); this.o6q_1.a5j(2, this.n6q_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.o6q_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda).o5g = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda(this.m6q_1, this.n6q_1, completion); i.o6q_1 = it; return i; }; 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.p6k(it, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1($endpointUrl, resultContinuation) { this.x6q_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).p6k = function (it, $completion) { var tmp = this.o5g(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).le = function (p1, $completion) { return this.p6k((!(p1 == null) ? isInterface(p1, PreparedStatement) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.y6q_1.a5j(1, this.x6q_1); this.ld_1 = 1; suspendResult = executeUpdateAsyncKmp(this.y6q_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1).o5g = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_1(this.x6q_1, completion); i.y6q_1 = it; return i; }; 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.p6k(it, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this$0, $remoteNodeId, $endpointUrl, resultContinuation) { this.h6r_1 = this$0; this.i6r_1 = $remoteNodeId; this.j6r_1 = $endpointUrl; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).l6r = function (it, $completion) { var tmp = this.s5s(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).le = function (p1, $completion) { return this.l6r(p1 instanceof RoomDatabase ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; this.ld_1 = 1; suspendResult = prepareAndUseStatementAsync_0(this.h6r_1.m6r_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.i6r_1, this.j6r_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ld_1 = 2; suspendResult = prepareAndUseStatementAsync_0(this.h6r_1.m6r_1, '\n DELETE \n FROM PendingRepositorySession\n WHERE PendingRepositorySession.endpointUrl = ?\n ', false, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda$slambda_2(this.j6r_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: return suspendResult; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda).s5s = function (it, completion) { var i = new DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda(this.h6r_1, this.i6r_1, this.j6r_1, completion); i.k6r_1 = it; return i; }; 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.l6r(it, $completion); }; l.$arity = 1; return l; } function $invokeCOROUTINE$22(_this__u8e3s4, remoteNodeId, endpointUrl, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.v6r_1 = _this__u8e3s4; this.w6r_1 = remoteNodeId; this.x6r_1 = endpointUrl; } protoOf($invokeCOROUTINE$22).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = withDoorTransactionAsync(this.v6r_1.m6r_1, VOID, DoorRepositoryReplicationClient$DefaultOnPendingSessionResolved$invoke$slambda_0(this.v6r_1, this.w6r_1, this.x6r_1, null), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function DoorRepositoryReplicationClient$slambda$lambda(this$0) { return function () { return this$0.n64_1 + ' getRemoteNodeId : requesting node id of server'; }; } function DoorRepositoryReplicationClient$slambda$lambda_0(this$0, $remoteNodeIdResponse, $nodeIdHeaderVal) { return function () { return this$0.n64_1 + ' getRemoteNodeId : got server node id: status=' + $remoteNodeIdResponse.t3b() + ' ' + toString_0($nodeIdHeaderVal); }; } function DoorRepositoryReplicationClient$slambda$lambda_1(this$0) { return function () { return this$0.n64_1 + ' getRemoteNodeId : exception getting remote node id'; }; } function DoorRepositoryReplicationClient$slambda$slambda$slambda($remoteNodeIdVal, this$0, resultContinuation) { this.g6s_1 = $remoteNodeIdVal; this.h6s_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).j6s = function (events, $completion) { var tmp = this.k6s(events, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).le = function (p1, $completion) { return this.j6s((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; if (tmp === 0) { this.md_1 = 1; var tmp$ret$0; l$ret$1: do { var this_0 = this.i6s_1; var tmp_0; if (isInterface(this_0, Collection)) { tmp_0 = this_0.d1(); } else { tmp_0 = false; } if (tmp_0) { tmp$ret$0 = false; break l$ret$1; } var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); var tmp_1; if (element.r69_1.equals(this.g6s_1)) { Companion_getInstance_11(); tmp_1 = element.q69_1 === 1; } else { tmp_1 = false; } if (tmp_1) { tmp$ret$0 = true; break l$ret$1; } } tmp$ret$0 = false; } while (false); if (tmp$ret$0) { this.h6s_1.w64_1.g1a(Unit_instance); } return Unit_instance; } else if (tmp === 1) { throw this.od_1; } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda).k6s = function (events, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda(this.g6s_1, this.h6s_1, completion); i.i6s_1 = events; return i; }; 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.j6s(events, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda$slambda_1($remoteNodeIdVal, this$0, resultContinuation) { this.t6s_1 = $remoteNodeIdVal; this.u6s_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).w6s = function (message, $completion) { var tmp = this.x6s(message, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).le = function (p1, $completion) { return this.w6s(p1 instanceof DoorMessage ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; if (tmp === 0) { this.md_1 = 1; var tmp_0; if (this.v6s_1.f69_1.equals(this.t6s_1)) { Companion_getInstance_11(); tmp_0 = this.v6s_1.e69_1 === 1; } else { tmp_0 = false; } if (tmp_0) { this.u6s_1.v64_1.g1a(Unit_instance); } return Unit_instance; } else if (tmp === 1) { throw this.od_1; } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda$slambda_1).x6s = function (message, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda$slambda_1(this.t6s_1, this.u6s_1, completion); i.v6s_1 = message; return i; }; 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.w6s(message, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda(this$0, $remoteNodeIdVal, resultContinuation) { this.g6t_1 = this$0; this.h6t_1 = $remoteNodeIdVal; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; var tmp_0 = this.g6t_1.g64_1.j6c(); var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_0(this.h6t_1, this.g6t_1, null); suspendResult = tmp_0.k1c(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda(this.g6t_1, this.h6t_1, completion); i.i6t_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda$slambda_1(this$0, $remoteNodeIdVal, resultContinuation) { this.r6t_1 = this$0; this.s6t_1 = $remoteNodeIdVal; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; var tmp_0 = this.r6t_1.g64_1.k6c(); var tmp_1 = DoorRepositoryReplicationClient$slambda$slambda$slambda_2(this.s6t_1, this.r6t_1, null); suspendResult = tmp_0.k1c(new sam$kotlinx_coroutines_flow_FlowCollector$0(tmp_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda$slambda_1).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda$slambda_1(this.r6t_1, this.s6t_1, completion); i.t6t_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function ClientState(initialized) { initialized = initialized === VOID ? false : initialized; this.u6t_1 = initialized; } protoOf(ClientState).v6t = function (initialized) { return new ClientState(initialized); }; protoOf(ClientState).toString = function () { return 'ClientState(initialized=' + this.u6t_1 + ')'; }; protoOf(ClientState).hashCode = function () { return getBooleanHashCode(this.u6t_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.u6t_1 === tmp0_other_with_cast.u6t_1)) return false; return true; }; function DoorRepositoryReplicationClient_init_$Init$(db, repositoryConfig, scope, nodeEventManager, retryInterval, $this) { DoorRepositoryReplicationClient.call($this, get_doorWrapperNodeId(db), repositoryConfig.x66_1, repositoryConfig.z66_1, repositoryConfig.a67_1, repositoryConfig.w66_1, scope, nodeEventManager, new DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db), new DefaultOnStartPendingSession(db), new DefaultOnPendingSessionResolved(db), repositoryConfig.b67_1, repositoryConfig.c67_1, 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 DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications(db) { this.g6p_1 = db; } protoOf(DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications).w6t = function (nodeId, receivedAck, batchSize, $completion) { return withDoorTransactionAsync(this.g6p_1, VOID, DoorRepositoryReplicationClient$DefaultOnMarkAcknowledgedAndGetNextOutgoingReplications$invoke$slambda_0(receivedAck, this, nodeId, batchSize, null), $completion); }; function DefaultOnStartPendingSession(db) { this.d6q_1 = db; } protoOf(DefaultOnStartPendingSession).x6t = function (fakeRemoteNodeId, endpointUrl, $completion) { var tmp = new $invokeCOROUTINE$21(this, fakeRemoteNodeId, endpointUrl, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function DefaultOnPendingSessionResolved(db) { this.m6r_1 = db; } protoOf(DefaultOnPendingSessionResolved).x6t = function (remoteNodeId, endpointUrl, $completion) { var tmp = new $invokeCOROUTINE$22(this, remoteNodeId, endpointUrl, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; function runSendLoop(_this__u8e3s4, $this, $completion) { var tmp = new $runSendLoopCOROUTINE$23($this, _this__u8e3s4, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function runFetchLoop(_this__u8e3s4, $this, $completion) { var tmp = new $runFetchLoopCOROUTINE$24($this, _this__u8e3s4, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function Companion_12() { this.s6v_1 = 'replication'; } var Companion_instance_12; function Companion_getInstance_14() { return Companion_instance_12; } function sam$kotlinx_coroutines_flow_FlowCollector$0(function_0) { this.t6v_1 = function_0; } protoOf(sam$kotlinx_coroutines_flow_FlowCollector$0).d1e = function (value, $completion) { return this.t6v_1(value, $completion); }; function DoorRepositoryReplicationClient$slambda(this$0, resultContinuation) { this.c6w_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 10; this.ld_1 = 1; continue $sm; case 1: if (!(get_isActive(this.d6w_1) ? !this.c6w_1.y64_1.ir() : false)) { this.ld_1 = 11; continue $sm; } this.md_1 = 6; this.ld_1 = 2; suspendResult = this.c6w_1.i64_1.x6t(this.c6w_1.q64_1, this.c6w_1.f64_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: v(this.c6w_1.k64_1, VOID, DoorRepositoryReplicationClient$slambda$lambda(this.c6w_1)); var tmp_0 = this; tmp_0.e6w_1 = this.c6w_1.d64_1; var tmp_1 = this; tmp_1.f6w_1 = this.e6w_1; var tmp_2 = this; var this_0 = new HttpRequestBuilder(); doorNodeIdHeader_0(this_0, this.c6w_1.b64_1, this.c6w_1.c64_1); setRepoUrl(this_0, this.c6w_1.f64_1, 'replication/nodeId'); tmp_2.g6w_1 = this_0; this.g6w_1.g39_1 = Companion_getInstance_0().v2x_1; var tmp_3 = this; tmp_3.h6w_1 = this.f6w_1; var tmp_4 = this; tmp_4.i6w_1 = this.g6w_1; this.ld_1 = 3; suspendResult = (new HttpStatement(this.i6w_1, this.h6w_1)).r3z(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.j6w_1 = suspendResult; var tmp_5 = this; var tmp_6 = this.j6w_1.u2x(); var tmp0_safe_receiver = tmp_6.ca('door-node-id'); tmp_5.k6w_1 = tmp0_safe_receiver == null ? null : toLong_0(tmp0_safe_receiver); v(this.c6w_1.k64_1, VOID, DoorRepositoryReplicationClient$slambda$lambda_0(this.c6w_1, this.j6w_1, this.k6w_1)); if (!(this.k6w_1 == null)) { this.c6w_1.y64_1.qy(this.k6w_1); this.ld_1 = 4; suspendResult = this.c6w_1.j64_1.x6t(this.k6w_1, this.c6w_1.f64_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { throw IllegalStateException_init_$Create$(this.c6w_1.n64_1 + ' getRemoteNodeId : server did not provide node id'); } case 4: l$ret$1: do { var this_1 = this.c6w_1.o64_1; while (true) { var prevValue = this_1.t2(); var nextValue = prevValue.v6t(true); if (this_1.i1l(prevValue, nextValue)) { break l$ret$1; } } } while (false); this.ld_1 = 5; continue $sm; case 5: this.md_1 = 10; this.ld_1 = 9; continue $sm; case 6: this.md_1 = 10; var tmp_7 = this.od_1; if (tmp_7 instanceof Exception) { this.l6w_1 = this.od_1; var tmp_8 = this.l6w_1; if (!(tmp_8 instanceof CancellationException)) { w(this.c6w_1.k64_1, this.l6w_1, DoorRepositoryReplicationClient$slambda$lambda_1(this.c6w_1)); this.ld_1 = 7; suspendResult = delay(toLong(this.c6w_1.m64_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 8; continue $sm; } } else { throw this.od_1; } case 7: this.ld_1 = 8; continue $sm; case 8: this.ld_1 = 9; continue $sm; case 9: this.md_1 = 10; this.ld_1 = 1; continue $sm; case 10: throw this.od_1; case 11: return Unit_instance; } } catch ($p) { var e = $p; if (this.md_1 === 10) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda(this.c6w_1, completion); i.d6w_1 = $this$launch; return i; }; function DoorRepositoryReplicationClient$slambda_0(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation) { this.u6w_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_1).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda_1).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda_1).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = runFetchLoop(this.v6w_1, this.u6w_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda_1).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_1(this.u6w_1, completion); i.v6w_1 = $this$launch; return i; }; function DoorRepositoryReplicationClient$slambda_2(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_1(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation) { this.e6x_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_3).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda_3).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda_3).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = runSendLoop(this.f6x_1, this.e6x_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda_3).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_3(this.e6x_1, completion); i.f6x_1 = $this$launch; return i; }; function DoorRepositoryReplicationClient$slambda_4(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_3(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation) { this.o6x_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorRepositoryReplicationClient$slambda_5).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorRepositoryReplicationClient$slambda_5).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorRepositoryReplicationClient$slambda_5).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.o6x_1.y64_1.xv(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var remoteNodeIdVal = suspendResult; launch(this.p6x_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_0(this.o6x_1, remoteNodeIdVal, null)); launch(this.p6x_1, VOID, VOID, DoorRepositoryReplicationClient$slambda$slambda_2(this.o6x_1, remoteNodeIdVal, null)); return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorRepositoryReplicationClient$slambda_5).f1n = function ($this$launch, completion) { var i = new DoorRepositoryReplicationClient$slambda_5(this.o6x_1, completion); i.p6x_1 = $this$launch; return i; }; function DoorRepositoryReplicationClient$slambda_6(this$0, resultContinuation) { var i = new DoorRepositoryReplicationClient$slambda_5(this$0, resultContinuation); var l = function ($this$launch, $completion) { return i.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorRepositoryReplicationClient$runSendLoop$lambda(this$0, $outgoingReplicationsToAck) { return function () { return this$0.n64_1 + ' : runSendLoop : querying db to mark ' + $outgoingReplicationsToAck.u() + ' 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.n64_1 + ' : runSendLoop : found ' + $outgoingReplications.u() + ' pending outgoing replications ' + 'to send'; }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_1(this$0, $outgoingReplications) { return function () { return this$0.n64_1 + ' : runSendLoop : sending ' + $outgoingReplications.u() + ' to server '; }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_2(this$0, $replicationResponse, $replicationReceivedAck) { return function () { return this$0.n64_1 + ' : runSendLoop : received reply from server status= ' + $replicationResponse.t3b() + ' ' + (' acknowledges ' + $replicationReceivedAck.f6p_1.u() + ' entities'); }; } function DoorRepositoryReplicationClient$runSendLoop$lambda_3(this$0) { return function () { return this$0.n64_1 + ' exception sending outgoing replications'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda(this$0, $acknowledgementsToSend) { return function () { return this$0.n64_1 + ' : runFetchLoop: acknowledging ' + $acknowledgementsToSend.u() + ' entities received and ' + 'request next batch of pending replications'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this$0, $entitiesReceivedResponse) { return function () { return this$0.n64_1 + ' : runFetchLoop: received response status = ' + $entitiesReceivedResponse.t3b(); }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this$0, $entitiesReceivedMessage) { return function () { return this$0.n64_1 + ' : runFetchLoop: received ' + $entitiesReceivedMessage.h69_1.u() + ' replications incoming'; }; } function DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this$0, $entitiesReceivedMessage) { return function () { return this$0.n64_1 + ' : runFetchLoop: delivered ' + $entitiesReceivedMessage.h69_1.u() + ' 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.g6u_1 = _this__u8e3s4; this.h6u_1 = _this__u8e3s4_0; } protoOf($runSendLoopCOROUTINE$23).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 14; this.ld_1 = 1; suspendResult = this.g6u_1.y64_1.xv(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.i6u_1 = suspendResult; var tmp_0 = this; tmp_0.j6u_1 = ArrayList_init_$Create$(); this.ld_1 = 2; continue $sm; case 2: if (!get_isActive(this.h6u_1)) { this.ld_1 = 13; continue $sm; } this.md_1 = 9; if (this.j6u_1.d1()) { this.ld_1 = 3; suspendResult = this.g6u_1.w64_1.i1a(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 4; continue $sm; } case 3: this.ld_1 = 4; continue $sm; case 4: v(this.g6u_1.k64_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda(this.g6u_1, this.j6u_1)); this.ld_1 = 5; suspendResult = this.g6u_1.h64_1.w6t(this.i6u_1, new ReplicationReceivedAck(this.j6u_1), this.g6u_1.x64_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 5: this.k6u_1 = suspendResult; v(this.g6u_1.k64_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_0(this.g6u_1, this.k6u_1)); this.j6u_1.o1(); if (!this.k6u_1.d1()) { v(this.g6u_1.k64_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_1(this.g6u_1, this.k6u_1)); var tmp_1 = this; tmp_1.l6u_1 = this.g6u_1.d64_1; var tmp_2 = this; tmp_2.m6u_1 = this.l6u_1; var tmp_3 = this; var this_0 = new HttpRequestBuilder(); setRepoUrl(this_0, this.g6u_1.f64_1, 'replication/message'); doorNodeIdHeader_0(this_0, this.g6u_1.b64_1, this.g6u_1.c64_1); contentType(this_0, Application_getInstance().f2s_1); var tmp_4 = Companion_getInstance_11().x4r(); Companion_getInstance_11(); setBodyJson(this_0, this.g6u_1.e64_1, tmp_4, new DoorMessage(1, this.g6u_1.b64_1, this.i6u_1, this.k6u_1)); tmp_3.n6u_1 = this_0; this.n6u_1.g39_1 = Companion_getInstance_0().w2x_1; var tmp_5 = this; tmp_5.o6u_1 = this.m6u_1; var tmp_6 = this; tmp_6.p6u_1 = this.n6u_1; this.ld_1 = 6; suspendResult = (new HttpStatement(this.p6u_1, this.o6u_1)).r3z(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 8; continue $sm; } case 6: this.q6u_1 = suspendResult; this.r6u_1 = this.g6u_1.e64_1; this.s6u_1 = Companion_getInstance_15().x4r(); this.ld_1 = 7; suspendResult = bodyAsText(this.q6u_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 7: this.t6u_1 = suspendResult; this.u6u_1 = this.r6u_1.c46(this.s6u_1, this.t6u_1); v(this.g6u_1.k64_1, VOID, DoorRepositoryReplicationClient$runSendLoop$lambda_2(this.g6u_1, this.q6u_1, this.u6u_1)); this.j6u_1.n1(this.u6u_1.f6p_1); this.ld_1 = 8; continue $sm; case 8: this.md_1 = 14; this.ld_1 = 12; continue $sm; case 9: this.md_1 = 14; var tmp_7 = this.od_1; if (tmp_7 instanceof Exception) { this.v6u_1 = this.od_1; var tmp_8 = this.v6u_1; if (!(tmp_8 instanceof CancellationException)) { d_0(this.g6u_1.k64_1, this.v6u_1, DoorRepositoryReplicationClient$runSendLoop$lambda_3(this.g6u_1)); this.ld_1 = 10; suspendResult = delay(toLong(this.g6u_1.m64_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 11; continue $sm; } } else { throw this.od_1; } case 10: this.ld_1 = 11; continue $sm; case 11: this.ld_1 = 12; continue $sm; case 12: this.md_1 = 14; this.ld_1 = 2; continue $sm; case 13: return Unit_instance; case 14: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 14) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $runFetchLoopCOROUTINE$24(_this__u8e3s4, _this__u8e3s4_0, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.e6v_1 = _this__u8e3s4; this.f6v_1 = _this__u8e3s4_0; } protoOf($runFetchLoopCOROUTINE$24).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 13; var tmp_0 = this; tmp_0.g6v_1 = ArrayList_init_$Create$(); this.ld_1 = 1; continue $sm; case 1: if (!get_isActive(this.f6v_1)) { this.ld_1 = 12; continue $sm; } this.md_1 = 8; if (this.g6v_1.d1()) { this.ld_1 = 2; suspendResult = this.e6v_1.v64_1.i1a(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 3; continue $sm; } case 2: this.ld_1 = 3; continue $sm; case 3: v(this.e6v_1.k64_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda(this.e6v_1, this.g6v_1)); var tmp_1 = this; tmp_1.h6v_1 = this.e6v_1.d64_1; var tmp_2 = this; tmp_2.i6v_1 = this.h6v_1; var tmp_3 = this; var this_0 = new HttpRequestBuilder(); doorNodeIdHeader_0(this_0, this.e6v_1.b64_1, this.e6v_1.c64_1); setRepoUrl(this_0, this.e6v_1.f64_1, 'replication/ackAndGetPendingReplications'); contentType(this_0, Application_getInstance().f2s_1); setBodyJson(this_0, this.e6v_1.e64_1, Companion_getInstance_15().x4r(), new ReplicationReceivedAck(this.g6v_1)); tmp_3.j6v_1 = this_0; this.j6v_1.g39_1 = Companion_getInstance_0().w2x_1; var tmp_4 = this; tmp_4.k6v_1 = this.i6v_1; var tmp_5 = this; tmp_5.l6v_1 = this.j6v_1; this.ld_1 = 4; suspendResult = (new HttpStatement(this.l6v_1, this.k6v_1)).r3z(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.m6v_1 = suspendResult; v(this.e6v_1.k64_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_0(this.e6v_1, this.m6v_1)); this.g6v_1.o1(); if (this.m6v_1.t3b().equals(Companion_getInstance().p2y_1)) { this.n6v_1 = this.e6v_1.e64_1; this.o6v_1 = Companion_getInstance_11().x4r(); this.ld_1 = 5; suspendResult = bodyAsText(this.m6v_1, VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 7; continue $sm; } case 5: this.p6v_1 = suspendResult; this.q6v_1 = this.n6v_1.c46(this.o6v_1, this.p6v_1); v(this.e6v_1.k64_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_1(this.e6v_1, this.q6v_1)); this.ld_1 = 6; suspendResult = this.e6v_1.g64_1.l6c(this.q6v_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 6: var this_1 = this.q6v_1.h69_1; var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10)); var tmp0_iterator = this_1.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); destination.j1(item.h6l_1); } this.g6v_1.n1(destination); v(this.e6v_1.k64_1, VOID, DoorRepositoryReplicationClient$runFetchLoop$lambda_2(this.e6v_1, this.q6v_1)); this.ld_1 = 7; continue $sm; case 7: if (this.m6v_1.t3b().equals(Companion_getInstance().t2y_1)) { this.e6v_1.r64_1 = this.m6v_1.b3d().y2o_1; } this.md_1 = 13; this.ld_1 = 11; continue $sm; case 8: this.md_1 = 13; var tmp_6 = this.od_1; if (tmp_6 instanceof Exception) { this.r6v_1 = this.od_1; var tmp_7 = this.r6v_1; if (!(tmp_7 instanceof CancellationException)) { v(this.e6v_1.k64_1, this.r6v_1, DoorRepositoryReplicationClient$runFetchLoop$lambda_3(this.r6v_1)); this.ld_1 = 9; suspendResult = delay(toLong(this.e6v_1.m64_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 10; continue $sm; } } else { throw this.od_1; } case 9: this.ld_1 = 10; continue $sm; case 10: this.ld_1 = 11; continue $sm; case 11: this.md_1 = 13; this.ld_1 = 1; continue $sm; case 12: return Unit_instance; case 13: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 13) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function DoorRepositoryReplicationClient(localNodeId, localNodeAuth, httpClient, json, repoEndpointUrl, scope, nodeEventManager, onMarkAcknowledgedAndGetNextOutgoingReplications, onStartPendingSession, onPendingSessionResolved, logger, dbName, retryInterval) { retryInterval = retryInterval === VOID ? 10000 : retryInterval; this.b64_1 = localNodeId; this.c64_1 = localNodeAuth; this.d64_1 = httpClient; this.e64_1 = json; this.f64_1 = repoEndpointUrl; this.g64_1 = nodeEventManager; this.h64_1 = onMarkAcknowledgedAndGetNextOutgoingReplications; this.i64_1 = onStartPendingSession; this.j64_1 = onPendingSessionResolved; this.k64_1 = logger; this.l64_1 = dbName; this.m64_1 = retryInterval; this.n64_1 = '[DoorRepositoryReplicationClient - ' + this.l64_1 + ' - endpoint=' + this.f64_1 + ']'; this.o64_1 = MutableStateFlow(new ClientState()); this.p64_1 = asStateFlow(this.o64_1); this.q64_1 = Default_getInstance().dk(new Long(-10000, -1), new Long(-1, -1)); d(this.k64_1, this.n64_1 + ' init'); this.r64_1 = new Long(0, 0); this.v64_1 = Channel(1); this.w64_1 = Channel(1); this.x64_1 = 1000; this.y64_1 = CompletableDeferred(); launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_0(this, null)); var tmp = this; tmp.s64_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_2(this, null)); var tmp_0 = this; tmp_0.t64_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_4(this, null)); var tmp_1 = this; tmp_1.u64_1 = launch(scope, VOID, VOID, DoorRepositoryReplicationClient$slambda_6(this, null)); this.v64_1.g1a(Unit_instance); this.w64_1.g1a(Unit_instance); } protoOf(DoorRepositoryReplicationClient).p62 = function () { var tmp; if (this.y64_1.ir()) { tmp = this.y64_1.ot(); } else { tmp = this.q64_1; } return tmp; }; function ReplicationConstants() { this.r6x_1 = 'fromNodeId'; } var ReplicationConstants_instance; function ReplicationConstants_getInstance() { return ReplicationConstants_instance; } function ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w(it) { return it + ' = ?'; } function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda(it) { return it.h67_1; } function ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this$0) { return function () { var tmp = joinToString(this$0.k66_1, VOID, VOID, VOID, VOID, VOID, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda$lambda); // Inline function 'kotlin.collections.map' call var this_0 = numberRangeToNumber(0, this$0.k66_1.u()); // Inline function 'kotlin.collections.mapTo' call var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10)); var tmp0_iterator = this_0.w(); while (tmp0_iterator.f()) { var item = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.replication.ReplicationEntityMetaData.insertIntoReceiveViewSql$delegate..' call destination.j1('?'); } return '\n INSERT INTO ' + this$0.h66_1 + ' (' + tmp + ', ' + 'fromNodeId' + ')\n VALUES (' + joinToString(destination) + ')\n '; }; } function ReplicationEntityMetaData(tableId, entityTableName, receiveViewName, entityPrimaryKeyFieldNames, entityVersionIdFieldName, entityFields, batchSize, remoteInsertStrategy, triggers) { batchSize = batchSize === VOID ? 1000 : batchSize; this.f66_1 = tableId; this.g66_1 = entityTableName; this.h66_1 = receiveViewName; this.i66_1 = entityPrimaryKeyFieldNames; this.j66_1 = entityVersionIdFieldName; this.k66_1 = entityFields; this.l66_1 = batchSize; this.m66_1 = remoteInsertStrategy; this.n66_1 = triggers; var tmp = this; var tmp_0 = LazyThreadSafetyMode_NONE_getInstance(); tmp.o66_1 = lazy(tmp_0, ReplicationEntityMetaData$insertIntoReceiveViewSql$delegate$lambda(this)); } protoOf(ReplicationEntityMetaData).g6i = function () { return trimIndent('\n SELECT ' + this.g66_1 + '.* \n FROM ' + this.g66_1 + '\n WHERE ' + joinToString(this.i66_1, ' AND ', VOID, VOID, VOID, VOID, ReplicationEntityMetaData$_get_selectEntityByPrimaryKeysSql_$lambda_c8e82w) + '\n '); }; protoOf(ReplicationEntityMetaData).o6o = function () { // Inline function 'kotlin.getValue' call var this_0 = this.o66_1; insertIntoReceiveViewSql$factory(); return this_0.t2(); }; protoOf(ReplicationEntityMetaData).s6x = function () { return '\n CREATE VIEW ' + this.h66_1 + ' AS \n SELECT ' + this.g66_1 + '.*, \n CAST(0 AS BIGINT) AS fromNodeId\n FROM ' + this.g66_1 + '\n '; }; function insertIntoReceiveViewSql$factory() { return getPropertyCallableRef('insertIntoReceiveViewSql', 1, KProperty1, function (receiver) { return receiver.o6o(); }, null); } function ReplicationFieldMetaData(fieldName, dbFieldType, nullable) { this.h67_1 = fieldName; this.i67_1 = dbFieldType; this.j67_1 = nullable; } protoOf(ReplicationFieldMetaData).k67 = function () { return this.h67_1; }; protoOf(ReplicationFieldMetaData).l67 = function () { return this.i67_1; }; protoOf(ReplicationFieldMetaData).q67 = function () { return this.j67_1; }; protoOf(ReplicationFieldMetaData).toString = function () { return 'ReplicationFieldMetaData(fieldName=' + this.h67_1 + ', dbFieldType=' + this.i67_1 + ', nullable=' + this.j67_1 + ')'; }; protoOf(ReplicationFieldMetaData).hashCode = function () { var result = getStringHashCode(this.h67_1); result = imul(result, 31) + this.i67_1 | 0; result = imul(result, 31) + getBooleanHashCode(this.j67_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.h67_1 === tmp0_other_with_cast.h67_1)) return false; if (!(this.i67_1 === tmp0_other_with_cast.i67_1)) return false; if (!(this.j67_1 === tmp0_other_with_cast.j67_1)) return false; return true; }; function Companion_13() { Companion_instance_13 = this; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.q6x_1 = [new ArrayListSerializer(LongSerializer_getInstance())]; } protoOf(Companion_13).x4r = function () { return $serializer_getInstance_2(); }; var Companion_instance_13; function Companion_getInstance_15() { if (Companion_instance_13 == null) new Companion_13(); return Companion_instance_13; } function $serializer_2() { $serializer_instance_2 = this; var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.ustadmobile.door.replication.ReplicationReceivedAck', this, 1); tmp0_serialDesc.d4g('replicationUids', false); this.t6x_1 = tmp0_serialDesc; } protoOf($serializer_2).a45 = function () { return this.t6x_1; }; protoOf($serializer_2).u4g = function () { // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call return [Companion_getInstance_15().q6x_1[0]]; }; protoOf($serializer_2).c45 = function (decoder) { var tmp0_desc = this.t6x_1; var tmp1_flag = true; var tmp2_index = 0; var tmp3_bitMask0 = 0; var tmp4_local0 = null; var tmp5_input = decoder.s48(tmp0_desc); var tmp6_cached = Companion_getInstance_15().q6x_1; if (tmp5_input.h49()) { tmp4_local0 = tmp5_input.e49(tmp0_desc, 0, tmp6_cached[0], tmp4_local0); tmp3_bitMask0 = tmp3_bitMask0 | 1; } else while (tmp1_flag) { tmp2_index = tmp5_input.i49(tmp0_desc); switch (tmp2_index) { case -1: tmp1_flag = false; break; case 0: tmp4_local0 = tmp5_input.e49(tmp0_desc, 0, tmp6_cached[0], tmp4_local0); tmp3_bitMask0 = tmp3_bitMask0 | 1; break; default: throw UnknownFieldException_init_$Create$(tmp2_index); } } tmp5_input.t48(tmp0_desc); return ReplicationReceivedAck_init_$Create$(tmp3_bitMask0, tmp4_local0, null); }; protoOf($serializer_2).u6x = function (encoder, value) { var tmp0_desc = this.t6x_1; var tmp1_output = encoder.s48(tmp0_desc); var tmp2_cached = Companion_getInstance_15().q6x_1; tmp1_output.i4a(tmp0_desc, 0, tmp2_cached[0], value.f6p_1); tmp1_output.t48(tmp0_desc); }; protoOf($serializer_2).b45 = function (encoder, value) { return this.u6x(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().t6x_1); } $this.f6p_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_15(); this.f6p_1 = replicationUids; } protoOf(ReplicationReceivedAck).toString = function () { return 'ReplicationReceivedAck(replicationUids=' + this.f6p_1 + ')'; }; protoOf(ReplicationReceivedAck).hashCode = function () { return hashCode(this.f6p_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.f6p_1, tmp0_other_with_cast.f6p_1)) return false; return true; }; function Companion_14() { this.v6x_1 = 'init'; this.w6x_1 = 'pending-replication'; } var Companion_instance_14; function Companion_getInstance_16() { return Companion_instance_14; } function Companion_15() { } protoOf(Companion_15).y2r = function (str) { var parts = split(str, charArrayOf([_Char___init__impl__6a9atx(59)]), VOID, 3); if (!(parts.u() === 3)) throw IllegalArgumentException_init_$Create$('DoorServerSentEvent parse: must have three parts - id;event;data'); return new DoorServerSentEvent(parts.v(0), parts.v(1), parts.v(2)); }; var Companion_instance_15; function Companion_getInstance_17() { return Companion_instance_15; } function DoorServerSentEvent(id, event, data) { this.g6d_1 = id; this.h6d_1 = event; this.i6d_1 = data; } protoOf(DoorServerSentEvent).toString = function () { return "DoorServerSentEvent id='" + this.g6d_1 + "' event='" + this.h6d_1 + "' data='" + this.i6d_1 + "'"; }; function TriggerConstants() { this.x6x_1 = "\n SELECT name\n FROM sqlite_master\n WHERE type = 'trigger'\n AND name LIKE ?\n "; this.y6x_1 = "\n SELECT name\n FROM sqlite_master\n WHERE type = 'view'\n AND name LIKE ?\n "; } var TriggerConstants_instance; function TriggerConstants_getInstance() { 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.d66().p2().w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList..' call if (element.m66_1.equals(RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance())) { this_0.j1(element.s6x()); } // Inline function 'kotlin.collections.forEach' call var tmp0_iterator_0 = element.n66_1.w(); while (tmp0_iterator_0.f()) { var element_0 = tmp0_iterator_0.e(); // Inline function 'com.ustadmobile.door.triggers.createSqliteTriggerAndReceiveViewSetupStatementList...' call var tmp; if (element_0.o65_1.equals(On_ENTITY_getInstance())) { tmp = element.g66_1; } else { tmp = element.h66_1; } var tableOrViewName = tmp; // Inline function 'kotlin.collections.forEach' call var indexedObject = element_0.n65_1; 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.g65_1.toLowerCase().substring(0, 3); this_0.j1(trimIndent('\n CREATE TRIGGER ' + '_d' + element_0.l65_1 + '_' + postfix + ' \n ' + element_0.m65_1.j65_1 + ' ' + element_1 + ' ON ' + tableOrViewName + '\n FOR EACH ROW ' + (!(element_0.r65_1 === '') ? ' WHEN (' + element_0.r65_1 + ') ' : '') + '\n BEGIN\n ' + joinToString_0(element_0.p65_1, ';') + ';\n END\n ')); } } } return this_0.f3(); } function DoorEventCollator$receiveEvent$slambda$slambda(this$0, resultContinuation) { this.h6y_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorEventCollator$receiveEvent$slambda$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorEventCollator$receiveEvent$slambda$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorEventCollator$receiveEvent$slambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 3; this.ld_1 = 1; suspendResult = delay(this.h6y_1.j6y_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.h6y_1.m6y_1.kotlinx$atomicfu$value = null; this.ld_1 = 2; suspendResult = this.h6y_1.l6y_1(tryReceiveAll(this.h6y_1.n6y_1, this.h6y_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: return Unit_instance; case 3: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 3) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(DoorEventCollator$receiveEvent$slambda$slambda).f1n = function ($this$launch, completion) { var i = new DoorEventCollator$receiveEvent$slambda$slambda(this.h6y_1, completion); i.i6y_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function tryReceiveAll(_this__u8e3s4, $this) { var resultList = mutableLinkedListOf([]); while (true) { var result = _this__u8e3s4.k1a(); if (_ChannelResult___get_isSuccess__impl__odq1z9(result)) { // Inline function 'kotlin.collections.plusAssign' call var element = ChannelResult__getOrThrow_impl_od1axs(result); resultList.j1(element); } else return resultList; } } function DoorEventCollator$receiveEvent$slambda(this$0, resultContinuation) { this.w6y_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(DoorEventCollator$receiveEvent$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DoorEventCollator$receiveEvent$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(DoorEventCollator$receiveEvent$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; if (tmp === 0) { this.md_1 = 1; var tmp_0 = this.w6y_1.m6y_1; tmp_0.kotlinx$atomicfu$value = launch(this.w6y_1.k6y_1, VOID, VOID, DoorEventCollator$receiveEvent$slambda$slambda_0(this.w6y_1, null)); return Unit_instance; } else if (tmp === 1) { throw this.od_1; } } catch ($p) { var e = $p; throw e; } while (true); }; protoOf(DoorEventCollator$receiveEvent$slambda).f1n = function ($this$launch, completion) { var i = new DoorEventCollator$receiveEvent$slambda(this.w6y_1, completion); i.x6y_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function DoorEventCollator(maxWaitTime, coroutineScope, onCollate) { this.j6y_1 = maxWaitTime; this.k6y_1 = coroutineScope; this.l6y_1 = onCollate; this.m6y_1 = atomic$ref$1(null); var tmp = this; Factory_getInstance(); tmp.n6y_1 = Channel(2147483647); } protoOf(DoorEventCollator).y6y = function (event) { this.n6y_1.g1a(event); if (this.m6y_1.kotlinx$atomicfu$value == null) { var tmp = GlobalScope_instance; launch(tmp, VOID, VOID, DoorEventCollator$receiveEvent$slambda_0(this, null)); } }; function NodeIdAuthCache(db) { this.z6y_1 = db; this.a6z_1 = concurrentSafeListOf([]); this.b6z_1 = concurrentSafeMapOf([]); this.c6z_1 = Mutex(); } var TransactionMode_READ_WRITE_instance; var TransactionMode_READ_ONLY_instance; var TransactionMode_entriesInitialized; function TransactionMode_initEntries() { if (TransactionMode_entriesInitialized) return Unit_instance; TransactionMode_entriesInitialized = true; TransactionMode_READ_WRITE_instance = new TransactionMode('READ_WRITE', 0); TransactionMode_READ_ONLY_instance = new TransactionMode('READ_ONLY', 1); } 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 Companion_16() { Companion_instance_16 = this; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.d6z_1 = LinkedHashMap_init_$Create$(); } protoOf(Companion_16).e6z = function (builderOptions) { return new DatabaseBuilder(builderOptions); }; protoOf(Companion_16).f6z = function (dbKClass) { var tmp = this.d6z_1.q(dbKClass); var tmp0_elvis_lhs = tmp instanceof DoorJsImplClasses ? tmp : null; var tmp_0; if (tmp0_elvis_lhs == null) { throw IllegalArgumentException_init_$Create$('' + dbKClass.f7() + ' is not registered through DatabaseBuilder.register'); } else { tmp_0 = tmp0_elvis_lhs; } return tmp_0; }; protoOf(Companion_16).g6z = function (implClasses) { // Inline function 'kotlin.collections.set' call var this_0 = this.d6z_1; var key = implClasses.h6z(); this_0.s(key, implClasses); // Inline function 'kotlin.collections.set' call var this_1 = this.d6z_1; var key_0 = implClasses.i6z(); this_1.s(key_0, implClasses); var tmp0_safe_receiver = implClasses.j6z(); 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_18().d6z_1.s(tmp0_safe_receiver, implClasses); } var tmp1_safe_receiver = implClasses.k6z(); 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_18().d6z_1.s(tmp1_safe_receiver, implClasses); } }; var Companion_instance_16; function Companion_getInstance_18() { if (Companion_instance_16 == null) new Companion_16(); return Companion_instance_16; } function build$execSqlAsync(_this__u8e3s4, sqlStmts, $completion) { var tmp = new $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function $buildCOROUTINE$28(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.h70_1 = _this__u8e3s4; } protoOf($buildCOROUTINE$28).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 33; if (!startsWith(this.h70_1.z71_1.r71_1, Companion_instance_20.d72_1)) 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_18().g6z(this.h70_1.z71_1.p71_1); this.i70_1 = substringAfter(this.h70_1.z71_1.r71_1, Companion_instance_20.d72_1); this.j70_1 = Companion_getInstance_18().f6z(this.h70_1.z71_1.o71_1).f72(); this.k70_1 = new SQLiteDatasourceJs(this.i70_1, new Worker(this.h70_1.z71_1.s71_1), this.h70_1.z71_1.x71_1, this.h70_1.z71_1.y71_1); Companion_getInstance_18().g6z(this.h70_1.z71_1.p71_1); var tmp_0 = this; var tmp_1 = get_js(this.h70_1.z71_1.p71_1.i6z()); var tmp_2 = this.h70_1.z71_1.r71_1; var tmp_3 = this.h70_1.z71_1.w71_1; var tmp_4 = this.h70_1.z71_1.v71_1; Companion_getInstance_3(); var tmp_5 = createInstance(tmp_1, [null, this.k70_1, tmp_2, tmp_3, tmp_4, 1, this.h70_1.z71_1.x71_1]); tmp_0.l70_1 = tmp_5 instanceof RoomDatabase ? tmp_5 : THROW_CCE(); if (!(this.i70_1 === ':memory:')) { this.ld_1 = 1; suspendResult = IndexedDb_getInstance().l72(this.i70_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.m70_1 = false; this.ld_1 = 2; continue $sm; } case 1: this.m70_1 = suspendResult; this.ld_1 = 2; continue $sm; case 2: this.n70_1 = this.m70_1; this.o70_1 = this.k70_1.t5h(); var tmp_6 = this; Companion_getInstance_3(); tmp_6.p70_1 = new DoorSqlDatabaseConnectionImpl(this.o70_1, 1); if (this.n70_1) { var tmp_7 = Napier_getInstance(); var tmp_8 = 'DatabaseBuilderJs: database ' + this.h70_1.z71_1.r71_1 + ' exists... loading\n'; tmp_7.h5f(tmp_8, VOID, 'DoorLog'); this.ld_1 = 9; suspendResult = this.k70_1.x72(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_9 = Napier_getInstance(); var tmp_10 = 'DatabaseBuilderJs: Creating database ' + this.h70_1.z71_1.r71_1 + '\n'; tmp_9.h5f(tmp_10, VOID, 'DoorLog'); this.ld_1 = 3; var this_0 = this.l70_1.w72(); suspendResult = build$execSqlAsync(this.o70_1, copyToArray(this_0).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 3: var tmp_11 = Napier_getInstance(); var tmp_12 = 'DatabaseBuilderJs: creating door triggers and receive views ' + this.h70_1.z71_1.r71_1 + '\n'; tmp_11.h5f(tmp_12, VOID, 'DoorLog'); this.ld_1 = 4; var this_1 = createSqliteTriggerAndReceiveViewSetupStatementList(this.j70_1); suspendResult = build$execSqlAsync(this.o70_1, copyToArray(this_1).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var tmp_13 = Napier_getInstance(); tmp_13.j5f('DatabaseBuilderJs: Running onCreate callbacks...\n', VOID, 'DoorLog'); var tmp_14 = this; tmp_14.q70_1 = this.h70_1.a72_1; this.r70_1 = this.q70_1.w(); this.ld_1 = 5; continue $sm; case 5: if (!this.r70_1.f()) { this.ld_1 = 8; continue $sm; } this.s70_1 = this.r70_1.e(); var tmp_15 = this; tmp_15.t70_1 = this.s70_1; this.u70_1 = this.t70_1; var tmp_16 = this.u70_1; if (isInterface(tmp_16, DoorDatabaseCallbackSync)) { throw new NotSupportedException('Cannot use sync callback on JS'); } else { var tmp_17 = this.u70_1; if (isInterface(tmp_17, DoorDatabaseCallbackStatementList)) { var tmp_18 = Napier_getInstance(); var tmp_19 = 'DatabaseBuilderJs: Running onCreate callback: ' + getKClassFromExpression(this.t70_1).f7(); tmp_18.j5f(tmp_19, VOID, 'DoorLog'); this.ld_1 = 6; var this_2 = this.t70_1.n62(this.p70_1); suspendResult = build$execSqlAsync(this.o70_1, copyToArray(this_2).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { this.ld_1 = 7; continue $sm; } } case 6: this.ld_1 = 7; continue $sm; case 7: this.ld_1 = 5; continue $sm; case 8: var tmp_20 = Napier_getInstance(); tmp_20.j5f('DatabaseBuilderJs: table creation finished\n', VOID, 'DoorLog'); this.ld_1 = 26; continue $sm; case 9: var tmp_21 = this; tmp_21.v70_1 = (null == null ? true : null instanceof SQLiteConnectionJs) ? null : THROW_CCE(); var tmp_22 = this; tmp_22.w70_1 = (null == null ? true : null instanceof SQLitePreparedStatementJs) ? null : THROW_CCE(); var tmp_23 = this; tmp_23.x70_1 = (null == null ? true : null instanceof SQLiteResultSet) ? null : THROW_CCE(); this.y70_1 = -1; this.ld_1 = 10; continue $sm; case 10: this.md_1 = 13; this.md_1 = 12; var tmp_24 = this; var tmp_25 = this.k70_1.t5h(); tmp_24.v70_1 = tmp_25 instanceof SQLiteConnectionJs ? tmp_25 : THROW_CCE(); this.w70_1 = new SQLitePreparedStatementJs(this.v70_1, 'SELECT dbVersion FROM _doorwayinfo'); this.ld_1 = 11; suspendResult = this.w70_1.n5j(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 11: var tmp_26 = this; tmp_26.x70_1 = suspendResult instanceof SQLiteResultSet ? suspendResult : THROW_CCE(); var tmp_27 = this; var tmp_28; if (this.x70_1.e()) { this.y70_1 = this.x70_1.p5t(1); tmp_28 = Unit_instance; } tmp_27.z70_1 = tmp_28; this.md_1 = 33; this.ld_1 = 14; continue $sm; case 12: this.md_1 = 13; var tmp_29 = this.od_1; if (tmp_29 instanceof SQLException) { this.a71_1 = this.od_1; var tmp_30 = this; throw this.a71_1; } else { throw this.od_1; } case 13: this.md_1 = 33; this.b71_1 = this.od_1; var tmp0_safe_receiver = this.x70_1; if (tmp0_safe_receiver == null) null; else { tmp0_safe_receiver.n(); } var tmp1_safe_receiver = this.w70_1; if (tmp1_safe_receiver == null) null; else { tmp1_safe_receiver.n(); } var tmp2_safe_receiver = this.v70_1; if (tmp2_safe_receiver == null) null; else { tmp2_safe_receiver.n(); } throw this.b71_1; case 14: this.md_1 = 33; var tmp0_safe_receiver_0 = this.x70_1; if (tmp0_safe_receiver_0 == null) null; else { tmp0_safe_receiver_0.n(); } var tmp1_safe_receiver_0 = this.w70_1; if (tmp1_safe_receiver_0 == null) null; else { tmp1_safe_receiver_0.n(); } var tmp2_safe_receiver_0 = this.v70_1; if (tmp2_safe_receiver_0 == null) null; else { tmp2_safe_receiver_0.n(); } var tmp_31 = Napier_getInstance(); var tmp_32 = 'DatabaseBuilderJs: Found current db version = ' + this.y70_1 + '\n'; tmp_31.j5f(tmp_32, VOID, 'DoorLog'); this.c71_1 = this.y70_1 < this.l70_1.q73(); var tmp_33 = this; var tmp3_safe_receiver = this.v70_1; var tmp_34; if (tmp3_safe_receiver == null) { tmp_34 = null; } else { var tmp_35; if (this.c71_1) { tmp_35 = tmp3_safe_receiver; } else { tmp_35 = null; } tmp_34 = tmp_35; } tmp_33.d71_1 = tmp_34; if (this.d71_1 == null) { this.e71_1 = null; this.ld_1 = 16; continue $sm; } else { this.ld_1 = 15; suspendResult = dropDoorTriggersAndReceiveViewsSqlite(this.d71_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 15: var tmp_36 = this; tmp_36.e71_1 = Unit_instance; this.ld_1 = 16; continue $sm; case 16: this.ld_1 = 17; continue $sm; case 17: if (!(this.y70_1 < this.l70_1.q73())) { this.ld_1 = 23; continue $sm; } var tmp_37 = this; var tmp$ret$2; l$ret$3: do { var this_3 = this.h70_1.b72_1; var destination = ArrayList_init_$Create$(); var tmp0_iterator = this_3.w(); while (tmp0_iterator.f()) { var element = tmp0_iterator.e(); var tmp_38; if (element.i69() === this.y70_1) { tmp_38 = !(element instanceof DoorMigrationSync); } else { tmp_38 = false; } if (tmp_38) { destination.j1(element); } } var iterator = destination.w(); if (!iterator.f()) { tmp$ret$2 = null; break l$ret$3; } var maxElem = iterator.e(); if (!iterator.f()) { tmp$ret$2 = maxElem; break l$ret$3; } var maxValue = maxElem.j69(); do { var e = iterator.e(); var v = e.j69(); if (compareTo(maxValue, v) < 0) { maxElem = e; maxValue = v; } } while (iterator.f()); tmp$ret$2 = maxElem; } while (false); tmp_37.f71_1 = tmp$ret$2; if (!(this.f71_1 == null)) { var tmp_39 = Napier_getInstance(); var tmp_40 = 'DatabaseBuilderJs: Attempting to upgrade from ' + this.f71_1.i69() + ' to ' + ('' + this.f71_1.j69() + '\n'); tmp_39.j5f(tmp_40, VOID, 'DoorLog'); this.g71_1 = this.f71_1; var tmp_41 = this.g71_1; if (tmp_41 instanceof DoorMigrationAsync) { this.ld_1 = 19; suspendResult = this.f71_1.m69_1(this.p70_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_42 = this.g71_1; if (tmp_42 instanceof DoorMigrationStatementList) { this.ld_1 = 18; var this_4 = this.f71_1.p69_1(this.p70_1); suspendResult = build$execSqlAsync(this.o70_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.l70_1.q73() + ' from ' + this.y70_1 + ' - could not find next migration')); } case 18: this.ld_1 = 20; continue $sm; case 19: this.ld_1 = 20; continue $sm; case 20: this.y70_1 = this.f71_1.j69(); this.ld_1 = 21; suspendResult = build$execSqlAsync(this.o70_1, ['UPDATE _doorwayinfo SET dbVersion = ' + this.y70_1], this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 21: var tmp_43 = Napier_getInstance(); var tmp_44 = 'DatabaseBuilderJs: migrated up to ' + this.y70_1; tmp_43.j5f(tmp_44, VOID, 'DoorLog'); this.ld_1 = 22; continue $sm; case 22: this.ld_1 = 17; continue $sm; case 23: var tmp_45 = this; var this_5 = this.o70_1; var tmp_46; if (this.c71_1) { tmp_46 = this_5; } else { tmp_46 = null; } tmp_45.h71_1 = tmp_46; if (this.h71_1 == null) { this.i71_1 = null; this.ld_1 = 25; continue $sm; } else { this.ld_1 = 24; var this_6 = createSqliteTriggerAndReceiveViewSetupStatementList(this.j70_1); suspendResult = build$execSqlAsync(this.h71_1, copyToArray(this_6).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 24: var tmp_47 = this; tmp_47.i71_1 = Unit_instance; this.ld_1 = 25; continue $sm; case 25: this.ld_1 = 26; continue $sm; case 26: var tmp_48 = Napier_getInstance(); tmp_48.j5f('DatabaseBuilderJs: Running onOpen callbacks...\n', VOID, 'DoorLog'); var tmp_49 = this; tmp_49.j71_1 = this.h70_1.a72_1; this.k71_1 = this.j71_1.w(); this.ld_1 = 27; continue $sm; case 27: if (!this.k71_1.f()) { this.ld_1 = 30; continue $sm; } this.l71_1 = this.k71_1.e(); var tmp_50 = this; tmp_50.m71_1 = this.l71_1; this.n71_1 = this.m71_1; var tmp_51 = this.n71_1; if (isInterface(tmp_51, DoorDatabaseCallbackStatementList)) { this.ld_1 = 28; var this_7 = this.m71_1.o62(this.p70_1); suspendResult = build$execSqlAsync(this.o70_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.ld_1 = 29; continue $sm; case 29: this.ld_1 = 27; continue $sm; case 30: var tmp_52 = Napier_getInstance(); tmp_52.j5f('DatabaseBuilderJs: Setting up InvalidationTracker trigger SQL\n', VOID, 'DoorLog'); this.ld_1 = 31; var this_8 = Companion_instance_0.o5t(this.j70_1.q66(), false); suspendResult = build$execSqlAsync(this.o70_1, copyToArray(this_8).slice(), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 31: var tmp_53 = Napier_getInstance(); tmp_53.j5f('DatabaseBuilderJs: Setting up NodeEvent table and trigger SQL\n', VOID, 'DoorLog'); this.ld_1 = 32; var tmp_54 = this.j70_1.q66(); suspendResult = createNodeEventTableAndTrigger(this.o70_1, tmp_54.b1('OutgoingReplication'), false, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 32: var tmp_55 = Napier_getInstance(); tmp_55.j5f('DatabaseBuilderJs: Setting up change listener\n', VOID, 'DoorLog'); if (!(this.i70_1 === ':memory:')) { new SaveToIndexedDbChangeListener(this.l70_1, this.k70_1, this.j70_1.e66(), this.h70_1.z71_1.t71_1); } this.o70_1.n(); var tmp7_safe_receiver = this.h70_1.z71_1.p71_1.k6z(); var tmp8_safe_receiver = tmp7_safe_receiver == null ? null : get_js(tmp7_safe_receiver); var tmp_56 = tmp8_safe_receiver == null ? null : createInstance(tmp8_safe_receiver, [this.l70_1, this.h70_1.z71_1.q71_1, this.h70_1.z71_1.u71_1, this.h70_1.z71_1.x71_1, this.h70_1.z71_1.w71_1]); var wrapperClass = (tmp_56 == null ? true : tmp_56 instanceof RoomDatabase) ? tmp_56 : THROW_CCE(); var tmp_57 = Napier_getInstance(); var tmp_58 = 'Built database for: ' + this.h70_1.z71_1.r71_1 + '\n'; tmp_57.h5f(tmp_58, VOID, 'DoorLog'); return wrapperClass == null ? this.l70_1 : wrapperClass; case 33: throw this.od_1; } } catch ($p) { var e_0 = $p; if (this.md_1 === 33) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function $build$execSqlAsyncCOROUTINE$29(_this__u8e3s4, sqlStmts, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.t6z_1 = _this__u8e3s4; this.u6z_1 = sqlStmts; } protoOf($build$execSqlAsyncCOROUTINE$29).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 8; this.ld_1 = 1; continue $sm; case 1: var tmp_0 = this; tmp_0.w6z_1 = this.t6z_1.b62(); this.ld_1 = 2; continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: this.md_1 = 7; this.md_1 = 6; var tmp_1 = this; tmp_1.y6z_1 = this.w6z_1; this.ld_1 = 4; suspendResult = this.y6z_1.o5j(joinToString_0(this.u6z_1, ';'), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: this.x6z_1 = suspendResult; this.md_1 = 8; this.ld_1 = 5; var tmp_2 = this; continue $sm; case 5: var tmp_3 = this.x6z_1; this.md_1 = 8; this.w6z_1.n(); this.v6z_1 = tmp_3; this.ld_1 = 10; continue $sm; case 6: this.md_1 = 7; var tmp_4 = this.od_1; if (tmp_4 instanceof Exception) { var e = this.od_1; var tmp_5 = this; throw e; } else { throw this.od_1; } case 7: this.md_1 = 8; var t = this.od_1; this.w6z_1.n(); throw t; case 8: throw this.od_1; case 9: this.md_1 = 8; this.w6z_1.n(); if (false) { this.ld_1 = 1; continue $sm; } this.ld_1 = 10; continue $sm; case 10: return Unit_instance; } } catch ($p) { var e_0 = $p; if (this.md_1 === 8) { throw e_0; } else { this.ld_1 = this.md_1; this.od_1 = e_0; } } while (true); }; function DatabaseBuilder(builderOptions) { Companion_getInstance_18(); this.z71_1 = builderOptions; var tmp = this; // Inline function 'kotlin.collections.mutableListOf' call tmp.a72_1 = ArrayList_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableListOf' call tmp_0.b72_1 = ArrayList_init_$Create$(); } protoOf(DatabaseBuilder).r73 = function ($completion) { var tmp = new $buildCOROUTINE$28(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(DatabaseBuilder).s73 = function (migrations) { addAll(this.b72_1, migrations); return this; }; protoOf(DatabaseBuilder).t73 = function (callback) { var tmp = Napier_getInstance(); var tmp_0 = 'DatabaseBuilderJs: Add Callback: ' + getKClassFromExpression(callback).f7(); tmp.j5f(tmp_0, VOID, 'DoorLog'); this.a72_1.j1(callback); return this; }; function DatabaseBuilderOptions(dbClass, dbImplClasses, nodeId, dbUrl, webWorkerPath, saveToIndexedDbDelayTime, messageCallback, jdbcQueryTimeout, dbName, logger, logWorkerMessages) { dbUrl = dbUrl === VOID ? 'indexeddb:' + ensureNotNull(dbClass.f7()) : 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.o71_1 = dbClass; this.p71_1 = dbImplClasses; this.q71_1 = nodeId; this.r71_1 = dbUrl; this.s71_1 = webWorkerPath; this.t71_1 = saveToIndexedDbDelayTime; this.u71_1 = messageCallback; this.v71_1 = jdbcQueryTimeout; this.w71_1 = dbName; this.x71_1 = logger; this.y71_1 = logWorkerMessages; } protoOf(DatabaseBuilderOptions).toString = function () { return 'DatabaseBuilderOptions(dbClass=' + this.o71_1 + ', dbImplClasses=' + this.p71_1 + ', nodeId=' + this.q71_1.toString() + ', dbUrl=' + this.r71_1 + ', webWorkerPath=' + this.s71_1 + ', saveToIndexedDbDelayTime=' + this.t71_1.toString() + ', messageCallback=' + this.u71_1 + ', jdbcQueryTimeout=' + this.v71_1 + ', dbName=' + this.w71_1 + ', logger=' + this.x71_1 + ', logWorkerMessages=' + this.y71_1 + ')'; }; protoOf(DatabaseBuilderOptions).hashCode = function () { var result = this.o71_1.hashCode(); result = imul(result, 31) + hashCode(this.p71_1) | 0; result = imul(result, 31) + this.q71_1.hashCode() | 0; result = imul(result, 31) + getStringHashCode(this.r71_1) | 0; result = imul(result, 31) + getStringHashCode(this.s71_1) | 0; result = imul(result, 31) + this.t71_1.hashCode() | 0; result = imul(result, 31) + hashCode(this.u71_1) | 0; result = imul(result, 31) + this.v71_1 | 0; result = imul(result, 31) + getStringHashCode(this.w71_1) | 0; result = imul(result, 31) + hashCode(this.x71_1) | 0; result = imul(result, 31) + getBooleanHashCode(this.y71_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.o71_1.equals(tmp0_other_with_cast.o71_1)) return false; if (!equals(this.p71_1, tmp0_other_with_cast.p71_1)) return false; if (!this.q71_1.equals(tmp0_other_with_cast.q71_1)) return false; if (!(this.r71_1 === tmp0_other_with_cast.r71_1)) return false; if (!(this.s71_1 === tmp0_other_with_cast.s71_1)) return false; if (!this.t71_1.equals(tmp0_other_with_cast.t71_1)) return false; if (!equals(this.u71_1, tmp0_other_with_cast.u71_1)) return false; if (!(this.v71_1 === tmp0_other_with_cast.v71_1)) return false; if (!(this.w71_1 === tmp0_other_with_cast.w71_1)) return false; if (!equals(this.x71_1, tmp0_other_with_cast.x71_1)) return false; if (!(this.y71_1 === tmp0_other_with_cast.y71_1)) return false; return true; }; function Companion_17() { Companion_instance_17 = this; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.u73_1 = LinkedHashMap_init_$Create$(); } protoOf(Companion_17).y2r = function (uriString) { return new DoorUri(new URL(uriString)); }; var Companion_instance_17; function Companion_getInstance_19() { if (Companion_instance_17 == null) new Companion_17(); return Companion_instance_17; } function DoorUri(uri) { Companion_getInstance_19(); this.v73_1 = uri; } protoOf(DoorUri).toString = function () { return toString(this.v73_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.v73_1, this.v73_1); }; protoOf(DoorUri).hashCode = function () { return getStringHashCode(toString(this.v73_1)); }; function JdbcArrayProxy(typeName, objects) { JdbcArrayProxyCommon.call(this, typeName, objects); } function PreparedStatementArrayProxy(query, connection) { PreparedStatementArrayProxyCommon.call(this, query, connection); this.c74_1 = false; } protoOf(PreparedStatementArrayProxy).m5j = function ($completion) { return this.f5j().m5j($completion); }; protoOf(PreparedStatementArrayProxy).o5j = function (sql, $completion) { return this.f5j().o5j(sql, $completion); }; protoOf(PreparedStatementArrayProxy).n5j = function ($completion) { return this.f5j().n5j($completion); }; protoOf(PreparedStatementArrayProxy).a5g = function () { throw new SQLException('PreparedStatementArrayProxy does not support getting generated keys', null); }; protoOf(PreparedStatementArrayProxy).n = function () { this.c74_1 = true; }; protoOf(PreparedStatementArrayProxy).t5h = function () { return this.f5i_1; }; function Builder(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) { this.d74_1 = context; this.e74_1 = endpoint; this.f74_1 = auth; this.g74_1 = nodeId; this.h74_1 = httpClient; this.i74_1 = json; this.j74_1 = logger; this.k74_1 = dbName; } protoOf(Builder).f3 = function () { return new RepositoryConfig(this.d74_1, this.e74_1, this.f74_1, this.g74_1, this.h74_1, this.i74_1, this.j74_1, this.k74_1); }; function RepositoryConfig$Companion$repositoryConfig$lambda($this$Json) { $this$Json.n4q_1 = true; return Unit_instance; } function RepositoryConfig$Companion$repositoryConfig$lambda_0($this$null) { return Unit_instance; } function Companion_18() { } protoOf(Companion_18).l74 = 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.f3(); }; protoOf(Companion_18).m74 = 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.l74(context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block) : $super.l74.call(this, context, endpoint, auth, nodeId, httpClient, logger, dbName, json, block); }; var Companion_instance_18; function Companion_getInstance_20() { return Companion_instance_18; } function RepositoryConfig(context, endpoint, auth, nodeId, httpClient, json, logger, dbName) { this.v66_1 = context; this.w66_1 = endpoint; this.x66_1 = auth; this.y66_1 = nodeId; this.z66_1 = httpClient; this.a67_1 = json; this.b67_1 = logger; this.c67_1 = dbName; } function SaveToIndexedDbChangeListener$eventCollator$slambda($database, this$0, resultContinuation) { this.v74_1 = $database; this.w74_1 = this$0; CoroutineImpl.call(this, resultContinuation); } protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).y74 = function (it, $completion) { var tmp = this.z74(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).le = function (p1, $completion) { return this.y74((!(p1 == null) ? isInterface(p1, List) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; var tmp_0 = Napier_getInstance(); var tmp_1 = 'Save database ' + this.v74_1 + ' to indexedDb'; tmp_0.j5f(tmp_1, VOID, 'DoorLog'); this.ld_1 = 1; suspendResult = this.w74_1.a75_1.d75(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(SaveToIndexedDbChangeListener$eventCollator$slambda).z74 = function (it, completion) { var i = new SaveToIndexedDbChangeListener$eventCollator$slambda(this.v74_1, this.w74_1, completion); i.x74_1 = it; return i; }; 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.y74(it, $completion); }; l.$arity = 1; return l; } function SaveToIndexedDbChangeListener$1($tablesToListen, this$0) { this.f75_1 = this$0; // Inline function 'kotlin.collections.toTypedArray' call var tmp$ret$0 = copyToArray($tablesToListen); InvalidationTrackerObserver.call(this, tmp$ret$0); } protoOf(SaveToIndexedDbChangeListener$1).j5m = function (tables) { this.f75_1.c75_1.y6y(toList_0(tables)); }; function SaveToIndexedDbChangeListener(database, datasource, tablesToListen, maxWaitTime) { this.a75_1 = datasource; var tmp = this; var tmp_0 = GlobalScope_instance; tmp.c75_1 = new DoorEventCollator(maxWaitTime, tmp_0, SaveToIndexedDbChangeListener$eventCollator$slambda_0(database, this, null)); var tmp_1 = this; tmp_1.b75_1 = new SaveToIndexedDbChangeListener$1(tablesToListen, this); database.z5m().s5n(this.b75_1); } function prepareStatement(_this__u8e3s4, db, stmtConfig) { var tmp; if (stmtConfig.f5l_1) { tmp = new PreparedStatementArrayProxy(stmtConfig.e5l_1, _this__u8e3s4); } else { tmp = _this__u8e3s4.g75(stmtConfig.e5l_1, stmtConfig.g5l_1); } return tmp; } function dbType_0(_this__u8e3s4) { Companion_getInstance_3(); return 1; } 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()).d5l(); var tmp_1 = transactionMode.equals(TransactionMode_READ_ONLY_getInstance()); return tmp_0.g5m(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.z5j(); 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_18().f6z(_this__u8e3s4).f72(); } function dbType_1(_this__u8e3s4) { Companion_getInstance_3(); return 1; } function dbSchemaVersion(_this__u8e3s4) { return _this__u8e3s4.q73(); } function withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation) { this.p75_1 = $block; this.q75_1 = $this_withDoorTransactionAsync; CoroutineImpl.call(this, resultContinuation); } protoOf(withDoorTransactionAsync$slambda).d5m = function (it, $completion) { var tmp = this.e5m(it, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(withDoorTransactionAsync$slambda).le = function (p1, $completion) { return this.d5m((!(p1 == null) ? isInterface(p1, Connection) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(withDoorTransactionAsync$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.p75_1(this.q75_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return suspendResult; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(withDoorTransactionAsync$slambda).e5m = function (it, completion) { var i = new withDoorTransactionAsync$slambda(this.p75_1, this.q75_1, completion); i.r75_1 = it; return i; }; function withDoorTransactionAsync$slambda_0($block, $this_withDoorTransactionAsync, resultContinuation) { var i = new withDoorTransactionAsync$slambda($block, $this_withDoorTransactionAsync, resultContinuation); var l = function (it, $completion) { return i.d5m(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 PreparedStatement() { } function ResultSet() { } function SQLException(message, cause) { Exception_init_$Init$(message, cause, this); captureStack(this, SQLException); } function mutableLinkedListOf_0(items) { // Inline function 'kotlin.collections.mutableListOf' call return ArrayList_init_$Create$(); } function executeUpdateAsyncKmp(_this__u8e3s4, $completion) { return _this__u8e3s4.m5j($completion); } function executeUpdateAsync(_this__u8e3s4, sql, $completion) { return _this__u8e3s4.o5j(sql, $completion); } function executeQueryAsyncKmp(_this__u8e3s4, $completion) { return _this__u8e3s4.n5j($completion); } function NodeEventManagerJs(db, messageCallback, logger, dbName, dispatcher) { dispatcher = dispatcher === VOID ? Dispatchers_getInstance().z12_1 : dispatcher; NodeEventManagerCommon.call(this, db, messageCallback, logger, dbName, dispatcher); this.f76_1 = new NodeEventJdbcImplListenerSqlite(this.d6b_1, this.e6b_1, false, logger, dbName); (isInterface(db, RoomJdbcImpl) ? db : THROW_CCE()).d5l().w5z(this.f76_1); } function RoomDatabase() { } protoOf(RoomDatabase).z5m = function () { var reason = 'getInvalidationTracker: maybe override this in the generated version'; throw new NotImplementedError('An operation is not implemented: ' + reason); }; function RoomDatabaseJdbcImplHelper(dataSource, db, dbUrl, dbName, logger, tableNames, invalidationTracker, dbType) { RoomDatabaseJdbcImplHelperCommon.call(this, dataSource, db, dbName, logger, tableNames, invalidationTracker, dbType); } protoOf(RoomDatabaseJdbcImplHelper).u5z = function (_this__u8e3s4, $completion) { return Unit_instance; }; protoOf(RoomDatabaseJdbcImplHelper).u76 = function ($completion) { var tmp = this.p5k_1; return (tmp instanceof SQLiteDatasourceJs ? tmp : THROW_CCE()).v76($completion); }; 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_instance; } function IndexedDb$checkIfExists$lambda($checkCompletable) { return function () { return $checkCompletable.sy(newThrowable('Error when opening database')); }; } function IndexedDb$checkIfExists$lambda$lambda($checkCompletable) { return function (data) { return $checkCompletable.qy(data.target.result != null); }; } function IndexedDb$checkIfExists$lambda$lambda_0($checkCompletable) { return function () { return $checkCompletable.sy(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_instance; }; } function IndexedDb() { IndexedDb_instance = this; this.g72_1 = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; this.h72_1 = 'um_db_store'; this.i72_1 = 'door_attachments'; this.j72_1 = 'um_db_key'; this.k72_1 = 2; } protoOf(IndexedDb).l72 = function (dbName, $completion) { var checkCompletable = CompletableDeferred(); var request = this.g72_1.open(dbName, 2); onUpgradeNeededThenCreateStores(this, request); request.onerror = IndexedDb$checkIfExists$lambda(checkCompletable); request.onsuccess = IndexedDb$checkIfExists$lambda_0(checkCompletable); return checkCompletable.xv($completion); }; var IndexedDb_instance; function IndexedDb_getInstance() { if (IndexedDb_instance == null) new IndexedDb(); return IndexedDb_instance; } function Companion_19() { this.w76_1 = 1; } var Companion_instance_19; function Companion_getInstance_21() { return Companion_instance_19; } function SQLiteConnectionJs$lambda(this$0) { return function () { return this$0.p73_1 + ' : open'; }; } function SQLiteConnectionJs$close$lambda(this$0) { return function () { return this$0.p73_1 + ' : close'; }; } function $setAutoCommitAsyncCOROUTINE$32(_this__u8e3s4, autoCommit, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.f77_1 = _this__u8e3s4; this.g77_1 = autoCommit; } protoOf($setAutoCommitAsyncCOROUTINE$32).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; if (!this.g77_1 ? this.f77_1.n73_1 : false) { this.ld_1 = 1; suspendResult = this.f77_1.l73_1.i77(this.f77_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { if (this.g77_1 ? !this.g77_1 : false) { this.f77_1.l73_1.h77(this.f77_1); this.f77_1.n73_1 = false; this.ld_1 = 3; continue $sm; } else { this.ld_1 = 3; continue $sm; } } case 1: this.f77_1.n73_1 = false; this.ld_1 = 2; suspendResult = this.f77_1.l73_1.j77(this.f77_1, 'BEGIN TRANSACTION', [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 2: this.ld_1 = 3; continue $sm; case 3: return Unit_instance; case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $commitAsyncCOROUTINE$33(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.s77_1 = _this__u8e3s4; } protoOf($commitAsyncCOROUTINE$33).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; if (this.s77_1.n73_1) throw IllegalStateException_init_$Create$('commitAsync: not in transaction (autoCommit=true) - cannot commit'); this.ld_1 = 1; suspendResult = this.s77_1.l73_1.j77(this.s77_1, 'COMMIT', [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $rollbackAsyncCOROUTINE$34(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.b78_1 = _this__u8e3s4; } protoOf($rollbackAsyncCOROUTINE$34).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = this.b78_1.l73_1.j77(this.b78_1, 'ROLLBACK', [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function SQLiteConnectionJs(datasource) { this.l73_1 = datasource; this.m73_1 = false; this.n73_1 = true; var tmp = this; var tmp1 = Companion_instance_19.w76_1; Companion_instance_19.w76_1 = tmp1 + 1 | 0; tmp.o73_1 = tmp1; this.p73_1 = '[SQLiteConnectionJS #' + this.o73_1 + ']'; var tmp_0 = Napier_getInstance(); tmp_0.f5f(VOID, 'DoorLog', SQLiteConnectionJs$lambda(this)); } protoOf(SQLiteConnectionJs).u5h = function (commit) { }; protoOf(SQLiteConnectionJs).t5z = function (autoCommit, $completion) { var tmp = new $setAutoCommitAsyncCOROUTINE$32(this, autoCommit, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteConnectionJs).v5z = function ($completion) { var tmp = new $commitAsyncCOROUTINE$33(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteConnectionJs).b5z = function ($completion) { var tmp = new $rollbackAsyncCOROUTINE$34(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteConnectionJs).k5j = function (sql) { return new SQLitePreparedStatementJs(this, sql); }; protoOf(SQLiteConnectionJs).g75 = function (sql, autoGeneratedKeys) { return new SQLitePreparedStatementJs(this, sql, autoGeneratedKeys); }; protoOf(SQLiteConnectionJs).b62 = function () { return new SQLiteStatementJs(this); }; protoOf(SQLiteConnectionJs).v5h = function () { }; protoOf(SQLiteConnectionJs).a5z = function () { }; protoOf(SQLiteConnectionJs).n = function () { var tmp = Napier_getInstance(); tmp.f5f(VOID, 'DoorLog', SQLiteConnectionJs$close$lambda(this)); if (!this.n73_1) { this.l73_1.h77(this); } this.m73_1 = true; }; protoOf(SQLiteConnectionJs).c5z = function () { return this.m73_1; }; protoOf(SQLiteConnectionJs).p5j = function (arrayType, objects) { throw new SQLException('Array not supported on SQLite', null); }; protoOf(SQLiteConnectionJs).q5j = function () { return new SQLiteDatabaseMetadataJs(this.l73_1); }; function SQLiteDatabaseMetadataJs(datasource) { this.c78_1 = datasource; } protoOf(SQLiteDatabaseMetadataJs).r5j = function () { return 'SQLite'; }; function SQLiteDatasourceJs$sendQuery$slambda$lambda(this$0, $sql, $params) { return function () { var tmp0_safe_receiver = $params; return this$0.t72_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.t72_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.t72_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.t72_1 + " update done: '" + $sql + "'"; }; } function assertNotClosed($this) { if ($this.u72_1) throw IllegalStateException_init_$Create$('SQLiteDataSourceJs is closed!'); } function sendMessage($this, message, $completion) { var tmp = new $sendMessageCOROUTINE$36($this, message, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } 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.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); } function Companion_20() { this.c72_1 = 0; this.d72_1 = 'sqlite:'; this.e72_1 = ':memory:'; } var Companion_instance_20; function Companion_getInstance_22() { return Companion_instance_20; } function SQLiteDatasourceJs$lambda(this$0) { return function (dbEvent) { var actionId = toInt(toString(dbEvent.data['id'])); var executedQuery = this$0.r72_1.u2(actionId); var pendingCompletable = this$0.q72_1.u2(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.sy(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.qy(new WorkerResult(dbEvent.data['id'], results, executedSuccessfully, buffer)); tmp = Unit_instance; } return Unit_instance; }; } function SQLiteDatasourceJs$sendMessage$lambda(this$0, $actionId, $message) { return function () { return this$0.t72_1 + ' sendMessage #' + $actionId + ' - sending action=' + toString_0($message['action']) + ' \n'; }; } function SQLiteDatasourceJs$sendMessage$lambda_0(this$0, $actionId) { return function () { return this$0.t72_1 + ' sendMessage #' + $actionId + ' - got result \n'; }; } function SQLiteDatasourceJs$sendQuery$slambda(this$0, $sql, $params, resultContinuation) { this.m79_1 = this$0; this.n79_1 = $sql; this.o79_1 = $params; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$sendQuery$slambda).p79 = function ($completion) { var tmp = this.q79($completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteDatasourceJs$sendQuery$slambda).r79 = function ($completion) { return this.p79($completion); }; protoOf(SQLiteDatasourceJs$sendQuery$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; var this_0 = this.m79_1.o72_1; var tmp_0; if (this.m79_1.p72_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.m79_1, this.n79_1, this.o79_1)); } this.ld_1 = 1; suspendResult = sendMessage(this.m79_1, makeMessage(this.m79_1, this.n79_1, this.o79_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; var results = ARGUMENT.t79_1; 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.m79_1.o72_1; var tmp_3; if (this.m79_1.p72_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.m79_1, this.n79_1, this.o79_1, sqliteResultSet)); } return sqliteResultSet; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(SQLiteDatasourceJs$sendQuery$slambda).q79 = function (completion) { return new SQLiteDatasourceJs$sendQuery$slambda(this.m79_1, this.n79_1, this.o79_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.p79($completion); }; l.$arity = 0; return l; } function SQLiteDatasourceJs$sendUpdate$slambda(this$0, $sql, $params, $returnGeneratedKey, resultContinuation) { this.e7a_1 = this$0; this.f7a_1 = $sql; this.g7a_1 = $params; this.h7a_1 = $returnGeneratedKey; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$sendUpdate$slambda).j7a = function ($completion) { var tmp = this.q79($completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteDatasourceJs$sendUpdate$slambda).r79 = function ($completion) { return this.j7a($completion); }; protoOf(SQLiteDatasourceJs$sendUpdate$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 4; var this_0 = this.e7a_1.o72_1; var tmp_0; if (this.e7a_1.p72_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.e7a_1, this.f7a_1, this.g7a_1)); } this.ld_1 = 1; suspendResult = sendMessage(this.e7a_1, makeMessage(this.e7a_1, this.f7a_1, this.g7a_1), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: if (this.h7a_1) { this.ld_1 = 2; suspendResult = sendMessage(this.e7a_1, makeMessage$default(this.e7a_1, 'SELECT last_insert_rowid()'), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_1 = this; tmp_1.i7a_1 = null; this.ld_1 = 3; continue $sm; } case 2: var ARGUMENT = suspendResult; var tmp1_safe_receiver = ARGUMENT.t79_1; 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.i7a_1 = tmp_3; this.ld_1 = 3; continue $sm; case 3: var generatedKey = this.i7a_1; var this_1 = this.e7a_1.o72_1; var tmp_4; if (this.e7a_1.p72_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.e7a_1, this.f7a_1)); } return new UpdateResult(1, generatedKey); case 4: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 4) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(SQLiteDatasourceJs$sendUpdate$slambda).q79 = function (completion) { return new SQLiteDatasourceJs$sendUpdate$slambda(this.e7a_1, this.f7a_1, this.g7a_1, this.h7a_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.j7a($completion); }; l.$arity = 0; return l; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this$0, $data, $exportCompletable, resultContinuation) { this.s7a_1 = this$0; this.t7a_1 = $data; this.u7a_1 = $exportCompletable; CoroutineImpl.call(this, resultContinuation); } protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).e1n = function ($this$launch, $completion) { var tmp = this.f1n($this$launch, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).le = function (p1, $completion) { return this.e1n((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion); }; protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.ld_1 = 1; suspendResult = sendMessage(this.s7a_1, json([to('action', 'open'), to('buffer', this.t7a_1.target.result)]), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; this.u7a_1.qy(result.u79_1); return Unit_instance; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; protoOf(SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda).f1n = function ($this$launch, completion) { var i = new SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda$slambda(this.s7a_1, this.t7a_1, this.u7a_1, completion); i.v7a_1 = $this$launch; return i; }; 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.e1n($this$launch, $completion); }; l.$arity = 1; return l; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable) { return function (data) { var tmp = GlobalScope_instance; 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.sy(newThrowable('Error when executing store data fetch')); }; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this$0, $exportCompletable) { return function (event) { var db = event.target.result; IndexedDb_getInstance(); IndexedDb_getInstance(); IndexedDb_getInstance(); var store = db.transaction('um_db_store', 'readwrite').objectStore('um_db_store').get('um_db_key'); store.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda(this$0, $exportCompletable); store.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda$lambda_0($exportCompletable); return Unit_instance; }; } function SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0($exportCompletable) { return function () { return $exportCompletable.sy(newThrowable('Error when importing database from IndexedDb to SQLite DB')); }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this$0) { return function () { return this$0.t72_1 + ' SQLiteDataSource/JS: saving to indexed db'; }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable) { return function () { i(this$0.o72_1, this$0.t72_1 + ' Saved to IndexedDb: ' + this$0.m72_1); return $exportCompletable.qy(true); }; } function SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable) { return function () { return $exportCompletable.sy(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; IndexedDb_getInstance(); var transaction = db.transaction('um_db_store', 'readwrite'); transaction.oncomplete = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda(this$0, $exportCompletable); transaction.onerror = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda$lambda_0($exportCompletable); IndexedDb_getInstance(); var store = transaction.objectStore('um_db_store'); var tmp = $result.v79_1; IndexedDb_getInstance(); return store.put(tmp, 'um_db_key'); }; } function $sendMessageCOROUTINE$36(_this__u8e3s4, message, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.l78_1 = _this__u8e3s4; this.m78_1 = message; } protoOf($sendMessageCOROUTINE$36).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; assertNotClosed(this.l78_1); this.n78_1 = CompletableDeferred(); var tmp_0 = this; Companion_instance_20.c72_1 = Companion_instance_20.c72_1 + 1 | 0; tmp_0.o78_1 = Companion_instance_20.c72_1; var this_0 = this.l78_1.o72_1; var tmp_1; if (this.l78_1.p72_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.l78_1, this.o78_1, this.m78_1)); } var this_1 = this.l78_1.q72_1; var key = this.o78_1; var value = this.n78_1; this_1.s(key, value); var this_2 = this.l78_1.r72_1; var key_0 = this.o78_1; var value_0 = toString_0(this.m78_1['sql']); this_2.s(key_0, value_0); this.m78_1['id'] = this.o78_1; this.l78_1.n72_1.postMessage(this.m78_1); this.ld_1 = 1; suspendResult = this.n78_1.xv(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; var this_3 = this.l78_1.o72_1; var tmp_2; if (this.l78_1.p72_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.l78_1, this.o78_1)); } return result; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $withTransactionLockCOROUTINE$37(_this__u8e3s4, connection, block, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.x78_1 = _this__u8e3s4; this.y78_1 = connection; this.z78_1 = block; } protoOf($withTransactionLockCOROUTINE$37).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 8; if (this.x78_1.s72_1.j24(this.y78_1)) { this.ld_1 = 6; suspendResult = this.z78_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } else { var tmp_0 = this; tmp_0.b79_1 = this.x78_1.s72_1; var tmp_1 = this; tmp_1.c79_1 = this.y78_1; this.ld_1 = 1; suspendResult = this.b79_1.k24(this.c79_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; } case 1: this.ld_1 = 2; continue $sm; case 2: this.md_1 = 5; this.ld_1 = 3; suspendResult = this.z78_1(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.d79_1 = suspendResult; this.md_1 = 8; this.ld_1 = 4; continue $sm; case 4: var tmp_2 = this.d79_1; this.md_1 = 8; this.b79_1.v23(this.c79_1); this.a79_1 = tmp_2; this.ld_1 = 7; continue $sm; case 5: this.md_1 = 8; var t = this.od_1; this.b79_1.v23(this.c79_1); throw t; case 6: this.a79_1 = suspendResult; this.ld_1 = 7; continue $sm; case 7: return this.a79_1; case 8: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 8) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $exportDatabaseToFileCOROUTINE$38(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.e7b_1 = _this__u8e3s4; } protoOf($exportDatabaseToFileCOROUTINE$38).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 6; var tmp_0 = this; tmp_0.f7b_1 = this.e7b_1.s72_1; var tmp_1 = this; tmp_1.g7b_1 = null; this.ld_1 = 1; suspendResult = this.f7b_1.k24(this.g7b_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ld_1 = 2; continue $sm; case 2: this.md_1 = 5; this.ld_1 = 3; suspendResult = sendMessage(this.e7b_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.v79_1; 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.e7b_1.m72_1 + '.db'; var tmp_4 = this; link.click(); tmp_4.h7b_1 = Unit_instance; this.md_1 = 6; this.ld_1 = 4; continue $sm; case 4: this.md_1 = 6; this.f7b_1.v23(this.g7b_1); return Unit_instance; case 5: this.md_1 = 6; var t = this.od_1; this.f7b_1.v23(this.g7b_1); throw t; case 6: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 6) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function $saveDatabaseToIndexedDbCOROUTINE$39(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.q7b_1 = _this__u8e3s4; } protoOf($saveDatabaseToIndexedDbCOROUTINE$39).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 7; this.r7b_1 = CompletableDeferred(); var tmp_0 = this; tmp_0.s7b_1 = this.q7b_1.s72_1; var tmp_1 = this; tmp_1.t7b_1 = this.q7b_1; this.ld_1 = 1; suspendResult = this.s7b_1.k24(this.t7b_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: this.ld_1 = 2; continue $sm; case 2: this.md_1 = 6; d_0(this.q7b_1.o72_1, VOID, SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda(this.q7b_1)); this.ld_1 = 3; suspendResult = sendMessage(this.q7b_1, json([to('action', 'export')]), this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 3: this.v7b_1 = suspendResult; var tmp_2 = this; IndexedDb_getInstance(); tmp_2.w7b_1 = IndexedDb_getInstance().g72_1.open(this.q7b_1.m72_1, 2); this.w7b_1.onsuccess = SQLiteDatasourceJs$saveDatabaseToIndexedDb$lambda_0(this.v7b_1, this.q7b_1, this.r7b_1); this.ld_1 = 4; suspendResult = this.r7b_1.xv(this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 4: var this_0 = suspendResult; d(this.q7b_1.o72_1, this.q7b_1.t72_1 + ' SQLiteDataSource/JS: saving to indexed db complete'); this.u7b_1 = this_0; this.md_1 = 7; this.ld_1 = 5; continue $sm; case 5: var tmp_3 = this.u7b_1; this.md_1 = 7; this.s7b_1.v23(this.t7b_1); return tmp_3; case 6: this.md_1 = 7; var t = this.od_1; this.s7b_1.v23(this.t7b_1); throw t; case 7: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 7) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function SQLiteDatasourceJs(dbName, worker, logger, logWorkerMessages) { logWorkerMessages = logWorkerMessages === VOID ? false : logWorkerMessages; this.m72_1 = dbName; this.n72_1 = worker; this.o72_1 = logger; this.p72_1 = logWorkerMessages; var tmp = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp.q72_1 = LinkedHashMap_init_$Create$(); var tmp_0 = this; // Inline function 'kotlin.collections.mutableMapOf' call tmp_0.r72_1 = LinkedHashMap_init_$Create$(); this.s72_1 = Mutex(); this.t72_1 = '[SQLiteDataSourceJs - ' + this.m72_1 + ']'; this.u72_1 = false; this.v72_1 = CoroutineScope_0(Dispatchers_getInstance().z12_1.rj(Job())); this.n72_1.onmessage = SQLiteDatasourceJs$lambda(this); } protoOf(SQLiteDatasourceJs).i77 = function (connection, $completion) { return this.s72_1.k24(connection, $completion); }; protoOf(SQLiteDatasourceJs).h77 = function (connection) { this.s72_1.v23(connection); }; protoOf(SQLiteDatasourceJs).x7b = function (connection, sql, params, $completion) { return withTransactionLock(this, connection, SQLiteDatasourceJs$sendQuery$slambda_0(this, sql, params, null), $completion); }; protoOf(SQLiteDatasourceJs).y7b = function (connection, sql, params, returnGeneratedKey, $completion) { return withTransactionLock(this, connection, SQLiteDatasourceJs$sendUpdate$slambda_0(this, sql, params, returnGeneratedKey, null), $completion); }; protoOf(SQLiteDatasourceJs).j77 = function (connection, sql, params, returnGeneratedKey, $completion, $super) { returnGeneratedKey = returnGeneratedKey === VOID ? false : returnGeneratedKey; return $super === VOID ? this.y7b(connection, sql, params, returnGeneratedKey, $completion) : $super.y7b.call(this, connection, sql, params, returnGeneratedKey, $completion); }; protoOf(SQLiteDatasourceJs).x72 = function ($completion) { var exportCompletable = CompletableDeferred(); IndexedDb_getInstance(); var request = IndexedDb_getInstance().g72_1.open(this.m72_1, 2); request.onsuccess = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda(this, exportCompletable); request.onerror = SQLiteDatasourceJs$loadDbFromIndexedDb$lambda_0(exportCompletable); return exportCompletable.xv($completion); }; protoOf(SQLiteDatasourceJs).v76 = function ($completion) { var tmp = new $exportDatabaseToFileCOROUTINE$38(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteDatasourceJs).d75 = function ($completion) { var tmp = new $saveDatabaseToIndexedDbCOROUTINE$39(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteDatasourceJs).t5h = function () { assertNotClosed(this); return new SQLiteConnectionJs(this); }; function $executeUpdateAsyncCOROUTINE$40(_this__u8e3s4, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.h7c_1 = _this__u8e3s4; } protoOf($executeUpdateAsyncCOROUTINE$40).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; this.i7c_1 = this.h7c_1.k7c_1 === StatementConstantsKmp_instance.z5h_1; this.ld_1 = 1; suspendResult = this.h7c_1.j7c_1.l73_1.y7b(this.h7c_1.j7c_1, this.h7c_1.d73_1, this.h7c_1.e73_1, this.i7c_1, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var result = suspendResult; this.h7c_1.m7c_1 = result.p7c_1; return 1; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function SQLitePreparedStatementJs(connection, sql, autoGeneratedKeys) { autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_instance.a5i_1 : autoGeneratedKeys; SQLiteStatementJs.call(this, connection, autoGeneratedKeys); this.d73_1 = sql; var tmp = this; // Inline function 'kotlin.arrayOf' call // Inline function 'kotlin.js.unsafeCast' call // Inline function 'kotlin.js.asDynamic' call tmp.e73_1 = []; } protoOf(SQLitePreparedStatementJs).n5j = function ($completion) { return this.j7c_1.l73_1.x7b(this.j7c_1, this.d73_1, this.e73_1, $completion); }; protoOf(SQLitePreparedStatementJs).k5i = function (index, value) { this.e73_1[index - 1 | 0] = value ? 1 : 0; }; protoOf(SQLitePreparedStatementJs).q7c = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).v5i = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).a5j = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).r7c = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).c5j = function (index, value) { if (value == null) { this.e73_1[index - 1 | 0] = null; } else { if (!(value == null) ? typeof value === 'boolean' : false) { this.k5i(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.q7c(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.v5i(index, value); } else { if (!(value == null) ? typeof value === 'string' : false) { this.a5j(index, value); } else { if (!(value == null) ? isByteArray(value) : false) { this.r7c(index, value); } else { if (value instanceof Long) { this.x5i(index, value); } else { if (!(value == null) ? typeof value === 'number' : false) { this.w5i(index, value); } } } } } } } } }; protoOf(SQLitePreparedStatementJs).d5j = function (parameterIndex, sqlType) { this.e73_1[parameterIndex - 1 | 0] = null; }; protoOf(SQLitePreparedStatementJs).b5j = function (index, array) { throw new SQLException('SQLite does not support arrays', null); }; protoOf(SQLitePreparedStatementJs).w5i = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).x5i = 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.e73_1[tmp] = tmp_0; }; protoOf(SQLitePreparedStatementJs).y5i = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).z5i = function (index, value) { this.e73_1[index - 1 | 0] = value; }; protoOf(SQLitePreparedStatementJs).l5j = function () { throw Exception_init_$Create$('executeUpdate: (not-async) This can not be used on JS, only for JVM'); }; protoOf(SQLitePreparedStatementJs).m5j = function ($completion) { var tmp = new $executeUpdateAsyncCOROUTINE$40(this, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLitePreparedStatementJs).n = function () { }; function getValue($this, columnName) { // Inline function 'kotlin.also' call var tmp0_safe_receiver = $this.i73_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.h73_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.k73_1 = this_0 == null; return this_0; } function getValue_0($this, columnIndex) { // Inline function 'kotlin.also' call var tmp0_safe_receiver = $this.h73_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.k73_1 = this_0 == null; return this_0; } function SQLiteResultSet(results) { this.f73_1 = results; this.g73_1 = -1; this.h73_1 = null; this.i73_1 = null; this.j73_1 = false; this.k73_1 = true; var tmp = this; var tmp_0; // Inline function 'kotlin.collections.isNotEmpty' call // Inline function 'kotlin.collections.isEmpty' call if (!(this.f73_1.length === 0)) { // Inline function 'kotlin.js.asDynamic' call tmp_0 = first_0(this.f73_1).columns; } else { tmp_0 = null; } tmp.i73_1 = tmp_0; } protoOf(SQLiteResultSet).e = function () { var tmp; // Inline function 'kotlin.collections.isNotEmpty' call // Inline function 'kotlin.collections.isEmpty' call if (!(this.f73_1.length === 0)) { this.g73_1 = this.g73_1 + 1 | 0; // Inline function 'kotlin.js.asDynamic' call var data = first_0(this.f73_1).values; var tmp_0 = this.g73_1; var tmp_1 = data.length; var hasNext = tmp_0 < ((!(tmp_1 == null) ? typeof tmp_1 === 'number' : false) ? tmp_1 : THROW_CCE()); this.h73_1 = hasNext ? data[this.g73_1] : null; if (this.h73_1 == null) { this.g73_1 = this.g73_1 - 1 | 0; } return !(this.h73_1 == null); } else { tmp = false; } return tmp; }; protoOf(SQLiteResultSet).b10 = function (columnName) { var tmp0_safe_receiver = getValue(this, columnName); return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); }; protoOf(SQLiteResultSet).a62 = function (columnIndex) { var tmp0_safe_receiver = getValue_0(this, columnIndex); return tmp0_safe_receiver == null ? null : toString(tmp0_safe_receiver); }; protoOf(SQLiteResultSet).m67 = function (columnName) { var value = getValue(this, columnName); return Boolean(value); }; protoOf(SQLiteResultSet).s75 = function (columnIndex) { var value = getValue_0(this, columnIndex); return Boolean(value); }; protoOf(SQLiteResultSet).p67 = 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).a5o = 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).p5t = 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).o67 = 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).b5o = 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).b5g = 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).n67 = 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).t68 = function () { return this.k73_1; }; protoOf(SQLiteResultSet).n = function () { this.h73_1 = null; this.i73_1 = null; this.g73_1 = -1; this.j73_1 = true; }; protoOf(SQLiteResultSet).toString = function () { var str = '[SQLiteResultSet] Columns=' + this.i73_1; // Inline function 'kotlin.collections.isEmpty' call if (this.f73_1.length === 0) { str = str + ' - no rows'; return str; } return str; }; function $executeUpdateAsyncJsCOROUTINE$41(_this__u8e3s4, sql, resultContinuation) { CoroutineImpl.call(this, resultContinuation); this.a7d_1 = _this__u8e3s4; this.b7d_1 = sql; } protoOf($executeUpdateAsyncJsCOROUTINE$41).yd = function () { var suspendResult = this.nd_1; $sm: do try { var tmp = this.ld_1; switch (tmp) { case 0: this.md_1 = 2; var tmp_0 = Napier_getInstance(); var tmp_1 = 'SqliteJs: updateAsyncJs: ' + this.b7d_1 + '\n'; tmp_0.d5f(tmp_1, VOID, 'DoorLog'); this.ld_1 = 1; suspendResult = this.a7d_1.j7c_1.l73_1.j77(this.a7d_1.j7c_1, this.b7d_1, [], VOID, this); if (suspendResult === get_COROUTINE_SUSPENDED()) { return suspendResult; } continue $sm; case 1: var ARGUMENT = suspendResult; return ARGUMENT.o7c_1; case 2: throw this.od_1; } } catch ($p) { var e = $p; if (this.md_1 === 2) { throw e; } else { this.ld_1 = this.md_1; this.od_1 = e; } } while (true); }; function SQLiteStatementJs(connection, autoGeneratedKeys) { autoGeneratedKeys = autoGeneratedKeys === VOID ? StatementConstantsKmp_instance.a5i_1 : autoGeneratedKeys; this.j7c_1 = connection; this.k7c_1 = autoGeneratedKeys; this.l7c_1 = false; this.m7c_1 = null; this.n7c_1 = 0; } protoOf(SQLiteStatementJs).o5j = function (sql, $completion) { var tmp = new $executeUpdateAsyncJsCOROUTINE$41(this, sql, $completion); tmp.nd_1 = Unit_instance; tmp.od_1 = null; return tmp.yd(); }; protoOf(SQLiteStatementJs).n = function () { this.l7c_1 = true; }; protoOf(SQLiteStatementJs).t5h = function () { return this.j7c_1; }; protoOf(SQLiteStatementJs).a5g = function () { var tmp0_elvis_lhs = this.m7c_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).e5j = function (seconds) { this.n7c_1 = seconds; }; function UpdateResult(numRowsChanged, autoGeneratedKey) { this.o7c_1 = numRowsChanged; this.p7c_1 = autoGeneratedKey; } protoOf(UpdateResult).toString = function () { return 'UpdateResult(numRowsChanged=' + this.o7c_1 + ', autoGeneratedKey=' + this.p7c_1 + ')'; }; protoOf(UpdateResult).hashCode = function () { var result = this.o7c_1; result = imul(result, 31) + (this.p7c_1 == null ? 0 : hashCode(this.p7c_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.o7c_1 === tmp0_other_with_cast.o7c_1)) return false; if (!equals(this.p7c_1, tmp0_other_with_cast.p7c_1)) return false; return true; }; function WorkerResult(id, results, ready, buffer) { this.s79_1 = id; this.t79_1 = results; this.u79_1 = ready; this.v79_1 = buffer; } protoOf(WorkerResult).toString = function () { return 'WorkerResult(id=' + this.s79_1 + ', results=' + toString(this.t79_1) + ', ready=' + this.u79_1 + ', buffer=' + this.v79_1 + ')'; }; protoOf(WorkerResult).hashCode = function () { var result = this.s79_1; result = imul(result, 31) + (this.t79_1 == null ? 0 : hashCode(this.t79_1)) | 0; result = imul(result, 31) + getBooleanHashCode(this.u79_1) | 0; result = imul(result, 31) + (this.v79_1 == null ? 0 : hashCode(this.v79_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.s79_1 === tmp0_other_with_cast.s79_1)) return false; if (!equals(this.t79_1, tmp0_other_with_cast.t79_1)) return false; if (!(this.u79_1 === tmp0_other_with_cast.u79_1)) return false; if (!equals(this.v79_1, tmp0_other_with_cast.v79_1)) return false; return true; }; function _get_logPrefix__aovpcr($this) { return '[DoorEventSourceJS - ' + $this.d7d_1 + ']'; } function DoorEventSource$lambda(this$0) { return function (event) { Napier_getInstance().j5f(_get_logPrefix__aovpcr(this$0) + ' message received ' + event.lastEventId + ' ' + event.origin + ('- ' + toString_0(event.data))); this$0.e7d_1.f6d(Companion_instance_15.y2r(toString_0(event.data))); return Unit_instance; }; } function DoorEventSource$lambda_0(this$0) { return function (it) { var tmp = Napier_getInstance(); var tmp_0 = _get_logPrefix__aovpcr(this$0) + ' error occured: ' + it + '\n'; tmp.r5f(tmp_0, VOID, 'DoorLog'); this$0.e7d_1.j6d(Exception_init_$Create$('Error occurred on ' + toString_0(it.target))); return Unit_instance; }; } function DoorEventSource$lambda_1(this$0) { return function (it) { Napier_getInstance().h5f(_get_logPrefix__aovpcr(this$0) + ' open'); this$0.e7d_1.e6d(); return Unit_instance; }; } function DoorEventSource(repoConfig, url, listener, retry) { retry = retry === VOID ? 2000 : retry; this.c7d_1 = repoConfig; this.d7d_1 = url; this.e7d_1 = listener; this.f7d_1 = new EventSource(this.d7d_1); var tmp = Napier_getInstance(); var tmp_0 = _get_logPrefix__aovpcr(this) + ' connecting\n'; tmp.j5f(tmp_0, VOID, 'DoorLog'); this.f7d_1.onmessage = DoorEventSource$lambda(this); this.f7d_1.onerror = DoorEventSource$lambda_0(this); this.f7d_1.onopen = DoorEventSource$lambda_1(this); } 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().kc() * 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()).pc(delayInMs); while ((new Date()).getTime() <= delayFor.a7()) { } } function WeakMapJs() { var tmp = this; // Inline function 'kotlin.emptyArray' call var tmp$ret$0 = []; tmp.g7d_1 = new WeakMap(tmp$ret$0); } protoOf(WeakMapJs).s68 = function (key, value) { this.g7d_1.set(key, value); }; function WeakRefJs(target) { this.h7d_1 = new WeakRef(target); } protoOf(WeakRefJs).vz = function () { return this.h7d_1.deref(); }; function weakRefOf(target) { return new WeakRefJs(target); } //region block: post-declaration protoOf(TransactionElement).td = get; protoOf(TransactionElement).qj = fold; protoOf(TransactionElement).pj = minusKey; protoOf(TransactionElement).rj = plus_0; protoOf($serializer).v4g = typeParametersSerializers; protoOf($serializer_0).v4g = typeParametersSerializers; protoOf($serializer_1).v4g = typeParametersSerializers; protoOf($serializer_2).v4g = typeParametersSerializers; //endregion //region block: init Companion_instance = new Companion(); Companion_instance_0 = new Companion_0(); Key_instance = new Key(); DoorConstants_instance = new DoorConstants(); Companion_instance_3 = new Companion_3(); Companion_instance_4 = new Companion_4(); Companion_instance_5 = new Companion_5(); Companion_instance_6 = new Companion_6(); Companion_instance_7 = new Companion_7(); Companion_instance_8 = new Companion_8(); StatementConstantsKmp_instance = new StatementConstantsKmp(); TypesKmp_instance = new TypesKmp(); NodeEventConstants_instance = new NodeEventConstants(); INITIAL_ITEM_COUNT = -1; Companion_instance_10 = new Companion_10(); Companion_instance_11 = new Companion_11(); Companion_instance_12 = new Companion_12(); ReplicationConstants_instance = new ReplicationConstants(); Companion_instance_14 = new Companion_14(); Companion_instance_15 = new Companion_15(); TriggerConstants_instance = new TriggerConstants(); Companion_instance_18 = new Companion_18(); Companion_instance_19 = new Companion_19(); Companion_instance_20 = new Companion_20(); //endregion //region block: exports _.$_$ = _.$_$ || {}; _.$_$.a = Trigger; _.$_$.b = NodeIdAndAuth; _.$_$.c = OutgoingReplication; _.$_$.d = DoorDatabaseMetadata; _.$_$.e = createArrayOrProxyArrayOf; _.$_$.f = createInstance; _.$_$.g = dbType_0; _.$_$.h = doorDatabaseMetadata; _.$_$.i = doorNodeAndVersionHeaders; _.$_$.j = doorNodeIdHeader; _.$_$.k = doorNodeIdHeader_0; _.$_$.l = get_doorPrimaryKeyManager; _.$_$.m = get_doorWrapperNodeId; _.$_$.n = mutableLinkedListOf; _.$_$.o = get_nodeIdAuthCache; _.$_$.p = pagingSourceLoadParameters; _.$_$.q = get_rootDatabase; _.$_$.r = setBodyJson; _.$_$.s = setRepoUrl_0; _.$_$.t = toUrlQueryString; _.$_$.u = unwrap; _.$_$.v = doorFlow; _.$_$.w = RepoDaoFlowHelper; _.$_$.x = getBooleanNullable; _.$_$.y = getFloatNullable; _.$_$.z = getIntNullable; _.$_$.a1 = getLongNullable; _.$_$.b1 = getStringNonNull; _.$_$.c1 = mapNextRow_0; _.$_$.d1 = mapNextRow; _.$_$.e1 = mapRows; _.$_$.f1 = setBooleanNullable; _.$_$.g1 = setFloatNullable; _.$_$.h1 = setIntNullable; _.$_$.i1 = setLongNullable; _.$_$.j1 = useResults; _.$_$.k1 = PreparedStatement; _.$_$.l1 = DoorMigrationAsync; _.$_$.m1 = DoorMigrationStatementList; _.$_$.n1 = NodeEventManagerJs; _.$_$.o1 = DelegatedInvalidationPagingSource; _.$_$.p1 = DoorLimitOffsetPagingSource; _.$_$.q1 = OffsetLimitMediatorState; _.$_$.r1 = DoorOffsetLimitRemoteMediator; _.$_$.s1 = DoorRepositoryReplicatePullPagingSource; _.$_$.t1 = PagingSourceInterceptor; _.$_$.u1 = PagingSourceWithHttpLoader; _.$_$.v1 = endOfPaginationReached; _.$_$.w1 = ReplicationEntityMetaData; _.$_$.x1 = ReplicationFieldMetaData; _.$_$.y1 = InvalidationTracker_0; _.$_$.z1 = RoomDatabaseJdbcImplHelper; _.$_$.a2 = RoomDatabase; _.$_$.b2 = RoomJdbcImpl; _.$_$.c2 = DoorJsImplClasses; _.$_$.d2 = NodeIdAuthCache; _.$_$.e2 = randomUuid; _.$_$.f2 = systemTimeInMillis; _.$_$.g2 = DatabaseBuilderOptions; _.$_$.h2 = DoorDatabaseJdbc; _.$_$.i2 = DoorDatabaseRepository; _.$_$.j2 = DoorDatabaseWrapper; _.$_$.k2 = DoorPrimaryKeyManager; _.$_$.l2 = DoorSqlDatabase; _.$_$.m2 = EntityInsertionAdapter; _.$_$.n2 = PreparedStatementConfig; _.$_$.o2 = RepositoryHelper; _.$_$.p2 = SyncNodeIdCallback; _.$_$.q2 = SyncNode; _.$_$.r2 = RemoteInsertStrategy_INSERT_INTO_RECEIVE_VIEW_getInstance; _.$_$.s2 = Event_INSERT_getInstance; _.$_$.t2 = On_ENTITY_getInstance; _.$_$.u2 = On_RECEIVEVIEW_getInstance; _.$_$.v2 = Order_AFTER_getInstance; _.$_$.w2 = Order_INSTEAD_OF_getInstance; _.$_$.x2 = prepareAndUseStatementAsync; _.$_$.y2 = prepareAndUseStatementAsync_0; _.$_$.z2 = withDoorTransactionAsync; _.$_$.a3 = executeQueryAsyncKmp; _.$_$.b3 = executeUpdateAsyncKmp; _.$_$.c3 = executeUpdateAsync; _.$_$.d3 = onClientRepoDoorMessageHttpResponse; _.$_$.e3 = withRepoChangeMonitorAsync; _.$_$.f3 = Companion_instance_7; _.$_$.g3 = Companion_getInstance_18; _.$_$.h3 = Companion_getInstance_3; _.$_$.i3 = Companion_getInstance_19; _.$_$.j3 = Companion_instance_18; //endregion return _; }(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-coroutines-core.js'), require('./kotlinx-atomicfu.js'), require('./Napier-napier-js-ir.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'))); //# sourceMappingURL=door-door-runtime.js.map