{"version":3,"sources":["src/app/service/dashboard.service.ts","src/app/service/connection.service.ts","src/app/database/repositories/base-repository.ts","node_modules/dexie/dist/modern/dexie.mjs","src/app/database/config/database-config-token.ts","src/app/database/entities/asset-entity.ts","src/app/database/entities/candidate-question-entity.ts","src/app/database/entities/exam-log-entity.ts","src/app/database/entities/key-value-entity.ts","src/app/database/entities/question-answer-entity.ts","src/app/database/entities/question-section-entity.ts","src/app/database/entities/timed-block-entity.ts","src/app/database/app.database.ts","src/app/database/repositories/candidate-question-repository.service.ts","src/app/database/repositories/question-section-repository.service.ts","src/app/database/repositories/key-value-repository.service.ts","src/app/database/services/question-section-data.service.ts","src/app/database/services/key-value-data.service.ts","src/app/service/autosave.service.ts","src/app/model/exam/log/exam-log-dto.ts","src/app/model/exam/log/exam-log-type.enum.ts","src/app/service/lockout.service.ts","src/app/model/answer/answer-type-enum.ts","src/app/model/answer/form/form-answer-dto.ts","src/app/model/answer/calculator/calculator-answer-dto.ts","src/app/model/answer/chart/chart-answer-dto.ts","src/app/model/answer/open-response/open-response-group-answer-dto.ts","src/app/model/answer/reorder/reorder-answer-dto.ts","src/app/model/answer/scale/scale-answer-dto.ts","src/app/model/answer/table/table-answer-dto.ts","src/app/model/answer/3d-shape/3d-shape-answer-dto.ts","src/app/model/answer/multi-choice/multi-choice-group-answer-dto.ts","src/app/model/answer/document-upload/document-upload-answer-dto.ts","src/app/database/services/answer-factory.service.ts","src/app/database/repositories/question-answer-repository.service.ts","src/app/service/request/request.service.ts","src/app/model/exam/save-question-answers-dto.ts","src/app/service/request/candidate-request.service.ts","src/app/service/exam.service.ts","src/app/database/repositories/exam-log-repository.service.ts","src/app/database/services/exam-log-data.service.ts","src/app/service/synchronise.service.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from \"@angular/common/http\";\r\nimport { Inject, Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { APIResponse } from \"../model/request/APIResponse\";\r\nimport { AuthorisationService } from \"./authorisation/authorisation.service\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class DashboardService {\r\n constructor(private authorisationService: AuthorisationService,\r\n private http: HttpClient,\r\n @Inject('servicesBaseUrl') private servicesBaseUrl: string) { }\r\n\r\n public sendOnlineNotification(): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.post>(`${this.servicesBaseUrl}/api/notification/online`, null, { headers: authHeader });\r\n }\r\n\r\n public sendLockedNotification(): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.post>(`${this.servicesBaseUrl}/api/notification/locked`, null, { headers: authHeader });\r\n }\r\n\r\n\tpublic sendUnlockedNotification(reason: string): Observable> {\r\n\t\tconst authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n\t\treturn this.http.post>(`${this.servicesBaseUrl}/api/notification/unlocked/${reason}`, null, { headers: authHeader });\r\n }\r\n\r\n public sendQuestionsAnsweredNotification(questionsAnswered: number): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.post>(`${this.servicesBaseUrl}/api/notification/answered/${questionsAnswered}`, null, { headers: authHeader });\r\n }\r\n}\r\n","import { HttpClient } from '@angular/common/http';\r\nimport { Inject, Injectable } from '@angular/core';\r\nimport { interval, Observable, of } from 'rxjs';\r\nimport { Subject } from 'rxjs/internal/Subject';\r\nimport { catchError, mergeMap, takeWhile } from 'rxjs/operators';\r\nimport { APIResponse } from '../model/request/APIResponse';\r\nimport { DashboardService } from './dashboard.service';\r\n\r\nexport enum ConnectionState {\r\n Online,\r\n Offline\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ConnectionService {\r\n private connectionState: ConnectionState = ConnectionState.Online;\r\n\r\n private connectionStateSource: Subject = new Subject();\r\n\tpublic connectionStateChange$ = this.connectionStateSource.asObservable();\r\n\r\n constructor(private http: HttpClient,\r\n @Inject('servicesBaseUrl') private servicesBaseUrl: string,\r\n private dashboardService: DashboardService) { }\r\n\r\n public goOnline(): void {\r\n this.connectionState = ConnectionState.Online;\r\n this.connectionStateSource.next(this.connectionState);\r\n this.dashboardService.sendOnlineNotification();\r\n }\r\n\r\n public isOnline(): boolean {\r\n return this.connectionState === ConnectionState.Online;\r\n }\r\n\r\n public goOffline(): void {\r\n this.connectionState = ConnectionState.Offline;\r\n this.connectionStateSource.next(this.connectionState);\r\n this.beginOfflinePolling();\r\n }\r\n\r\n public isOffline(): boolean {\r\n return this.connectionState === ConnectionState.Offline;\r\n }\r\n\r\n public canContactServer(): Observable> {\r\n return this.connectionTest();\r\n }\r\n\r\n private beginOfflinePolling(): void {\r\n interval(10000)\r\n .pipe(takeWhile(() => this.isOffline()))\r\n .pipe(mergeMap(() => this.connectionTest()))\r\n .subscribe((response) => {\r\n if (response) {\r\n this.goOnline();\r\n }\r\n });\r\n }\r\n\r\n public connectionTest(): Observable> {\r\n return this.http.get>(`${this.servicesBaseUrl}/api/connection`).pipe(catchError(() => of()));\r\n }\r\n}\r\n","import { IRepository } from './repository.interface';\r\nimport { AppDatabase } from '../app.database';\r\nimport Dexie from 'dexie';\r\nimport { from, Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\ntype Params = {\r\n\t[key: string]: any\r\n}\r\n\r\nexport abstract class BaseRepository implements IRepository {\r\n\r\n\tconstructor(protected db: AppDatabase, private collectionName: string) { }\r\n\r\n\tpublic add(value: TEntity): Observable {\r\n\t\treturn from(this.db.transaction('rw', this.db[this.collectionName], async () => {\r\n\t\t\tawait (this.db[this.collectionName] as Dexie.Table).put(value);\r\n\t\t}));\r\n\t}\r\n\r\n\tpublic bulkAdd(values: TEntity[], key: string) {\r\n\t\treturn from(this.db.transaction('rw', this.db[this.collectionName], async () => {\r\n\t\t\tawait (this.db[this.collectionName] as Dexie.Table).bulkAdd(values, [key]);\r\n\t\t}));\r\n\t}\r\n\r\n\tpublic update(value: TEntity, key: TKey): Observable {\r\n\t\treturn from(this.db.transaction('rw', this.db[this.collectionName], async () => {\r\n\t\t\tawait (this.db[this.collectionName] as Dexie.Table).update(key, {value});\r\n\t\t}));\r\n\t}\r\n\r\n\tpublic put(value: TEntity, key?: TKey): Observable {\r\n\t\treturn from(this.db.transaction('rw', this.db[this.collectionName], async () => {\r\n\t\t\tawait (this.db[this.collectionName] as Dexie.Table).put(value, key);\r\n\t\t}));\r\n\t}\r\n\r\n\tpublic bulkPut(values: TEntity[], key: string) {\r\n\t\treturn from(this.db.transaction('rw', this.db[this.collectionName], async () => {\r\n\t\t\tawait (this.db[this.collectionName] as Dexie.Table).bulkAdd(values, [key]);\r\n\t\t}));\r\n\t}\r\n\r\n\tpublic clear(): Observable {\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).clear());\r\n\t}\r\n\r\n\tpublic count(): Observable {\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).count());\r\n\t}\r\n\r\n\tpublic isEmpty(): Observable {\r\n\t\treturn from(this.count()).pipe(map(count => count > 0));\r\n\t}\r\n\r\n\t\r\n\r\n\tpublic get(key: string, value: any): Observable {\r\n\t\tconst param: Params = {};\r\n\t\tparam[key] = value;\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).where(param).first()) as Observable;\r\n\t}\r\n\r\n\tpublic getMultiple(key: string, value: any): Observable {\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).where(key).equals(value).toArray());\r\n\t}\r\n\r\n\tpublic getAll(): Observable {\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).toArray());\r\n\t}\r\n\r\n\tpublic getWhere(key: string, values: any[]): Observable {\r\n\t\treturn from((this.db[this.collectionName] as Dexie.Table).where(key).anyOf(values).toArray())\r\n\t}\r\n\r\n\tpublic abstract convertDto(entity: TEntity): TDto;\r\n\tpublic abstract convertEntity(dto: TDto): TEntity;\r\n}\r\n","/*\n * Dexie.js - a minimalistic wrapper for IndexedDB\n * ===============================================\n *\n * By David Fahlander, david.fahlander@gmail.com\n *\n * Version 3.2.6, Tue Feb 13 2024\n *\n * https://dexie.org\n *\n * Apache License Version 2.0, January 2004, http://www.apache.org/licenses/\n */\n\nconst _global = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;\nconst keys = Object.keys;\nconst isArray = Array.isArray;\nif (typeof Promise !== 'undefined' && !_global.Promise) {\n _global.Promise = Promise;\n}\nfunction extend(obj, extension) {\n if (typeof extension !== 'object') return obj;\n keys(extension).forEach(function (key) {\n obj[key] = extension[key];\n });\n return obj;\n}\nconst getProto = Object.getPrototypeOf;\nconst _hasOwn = {}.hasOwnProperty;\nfunction hasOwn(obj, prop) {\n return _hasOwn.call(obj, prop);\n}\nfunction props(proto, extension) {\n if (typeof extension === 'function') extension = extension(getProto(proto));\n (typeof Reflect === \"undefined\" ? keys : Reflect.ownKeys)(extension).forEach(key => {\n setProp(proto, key, extension[key]);\n });\n}\nconst defineProperty = Object.defineProperty;\nfunction setProp(obj, prop, functionOrGetSet, options) {\n defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, \"get\") && typeof functionOrGetSet.get === 'function' ? {\n get: functionOrGetSet.get,\n set: functionOrGetSet.set,\n configurable: true\n } : {\n value: functionOrGetSet,\n configurable: true,\n writable: true\n }, options));\n}\nfunction derive(Child) {\n return {\n from: function (Parent) {\n Child.prototype = Object.create(Parent.prototype);\n setProp(Child.prototype, \"constructor\", Child);\n return {\n extend: props.bind(null, Child.prototype)\n };\n }\n };\n}\nconst getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nfunction getPropertyDescriptor(obj, prop) {\n const pd = getOwnPropertyDescriptor(obj, prop);\n let proto;\n return pd || (proto = getProto(obj)) && getPropertyDescriptor(proto, prop);\n}\nconst _slice = [].slice;\nfunction slice(args, start, end) {\n return _slice.call(args, start, end);\n}\nfunction override(origFunc, overridedFactory) {\n return overridedFactory(origFunc);\n}\nfunction assert(b) {\n if (!b) throw new Error(\"Assertion Failed\");\n}\nfunction asap$1(fn) {\n if (_global.setImmediate) setImmediate(fn);else setTimeout(fn, 0);\n}\nfunction arrayToObject(array, extractor) {\n return array.reduce((result, item, i) => {\n var nameAndValue = extractor(item, i);\n if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];\n return result;\n }, {});\n}\nfunction tryCatch(fn, onerror, args) {\n try {\n fn.apply(null, args);\n } catch (ex) {\n onerror && onerror(ex);\n }\n}\nfunction getByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string' && hasOwn(obj, keyPath)) return obj[keyPath];\n if (!keyPath) return obj;\n if (typeof keyPath !== 'string') {\n var rv = [];\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n var val = getByKeyPath(obj, keyPath[i]);\n rv.push(val);\n }\n return rv;\n }\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var innerObj = obj[keyPath.substr(0, period)];\n return innerObj == null ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));\n }\n return undefined;\n}\nfunction setByKeyPath(obj, keyPath, value) {\n if (!obj || keyPath === undefined) return;\n if ('isFrozen' in Object && Object.isFrozen(obj)) return;\n if (typeof keyPath !== 'string' && 'length' in keyPath) {\n assert(typeof value !== 'string' && 'length' in value);\n for (var i = 0, l = keyPath.length; i < l; ++i) {\n setByKeyPath(obj, keyPath[i], value[i]);\n }\n } else {\n var period = keyPath.indexOf('.');\n if (period !== -1) {\n var currentKeyPath = keyPath.substr(0, period);\n var remainingKeyPath = keyPath.substr(period + 1);\n if (remainingKeyPath === \"\") {\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(currentKeyPath))) obj.splice(currentKeyPath, 1);else delete obj[currentKeyPath];\n } else obj[currentKeyPath] = value;\n } else {\n var innerObj = obj[currentKeyPath];\n if (!innerObj || !hasOwn(obj, currentKeyPath)) innerObj = obj[currentKeyPath] = {};\n setByKeyPath(innerObj, remainingKeyPath, value);\n }\n } else {\n if (value === undefined) {\n if (isArray(obj) && !isNaN(parseInt(keyPath))) obj.splice(keyPath, 1);else delete obj[keyPath];\n } else obj[keyPath] = value;\n }\n }\n}\nfunction delByKeyPath(obj, keyPath) {\n if (typeof keyPath === 'string') setByKeyPath(obj, keyPath, undefined);else if ('length' in keyPath) [].map.call(keyPath, function (kp) {\n setByKeyPath(obj, kp, undefined);\n });\n}\nfunction shallowClone(obj) {\n var rv = {};\n for (var m in obj) {\n if (hasOwn(obj, m)) rv[m] = obj[m];\n }\n return rv;\n}\nconst concat = [].concat;\nfunction flatten(a) {\n return concat.apply([], a);\n}\nconst intrinsicTypeNames = \"BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey\".split(',').concat(flatten([8, 16, 32, 64].map(num => [\"Int\", \"Uint\", \"Float\"].map(t => t + num + \"Array\")))).filter(t => _global[t]);\nconst intrinsicTypes = intrinsicTypeNames.map(t => _global[t]);\narrayToObject(intrinsicTypeNames, x => [x, true]);\nlet circularRefs = null;\nfunction deepClone(any) {\n circularRefs = typeof WeakMap !== 'undefined' && new WeakMap();\n const rv = innerDeepClone(any);\n circularRefs = null;\n return rv;\n}\nfunction innerDeepClone(any) {\n if (!any || typeof any !== 'object') return any;\n let rv = circularRefs && circularRefs.get(any);\n if (rv) return rv;\n if (isArray(any)) {\n rv = [];\n circularRefs && circularRefs.set(any, rv);\n for (var i = 0, l = any.length; i < l; ++i) {\n rv.push(innerDeepClone(any[i]));\n }\n } else if (intrinsicTypes.indexOf(any.constructor) >= 0) {\n rv = any;\n } else {\n const proto = getProto(any);\n rv = proto === Object.prototype ? {} : Object.create(proto);\n circularRefs && circularRefs.set(any, rv);\n for (var prop in any) {\n if (hasOwn(any, prop)) {\n rv[prop] = innerDeepClone(any[prop]);\n }\n }\n }\n return rv;\n}\nconst {\n toString\n} = {};\nfunction toStringTag(o) {\n return toString.call(o).slice(8, -1);\n}\nconst iteratorSymbol = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';\nconst getIteratorOf = typeof iteratorSymbol === \"symbol\" ? function (x) {\n var i;\n return x != null && (i = x[iteratorSymbol]) && i.apply(x);\n} : function () {\n return null;\n};\nconst NO_CHAR_ARRAY = {};\nfunction getArrayOf(arrayLike) {\n var i, a, x, it;\n if (arguments.length === 1) {\n if (isArray(arrayLike)) return arrayLike.slice();\n if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string') return [arrayLike];\n if (it = getIteratorOf(arrayLike)) {\n a = [];\n while (x = it.next(), !x.done) a.push(x.value);\n return a;\n }\n if (arrayLike == null) return [arrayLike];\n i = arrayLike.length;\n if (typeof i === 'number') {\n a = new Array(i);\n while (i--) a[i] = arrayLike[i];\n return a;\n }\n return [arrayLike];\n }\n i = arguments.length;\n a = new Array(i);\n while (i--) a[i] = arguments[i];\n return a;\n}\nconst isAsyncFunction = typeof Symbol !== 'undefined' ? fn => fn[Symbol.toStringTag] === 'AsyncFunction' : () => false;\nvar debug = typeof location !== 'undefined' && /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\nfunction setDebug(value, filter) {\n debug = value;\n libraryFilter = filter;\n}\nvar libraryFilter = () => true;\nconst NEEDS_THROW_FOR_STACK = !new Error(\"\").stack;\nfunction getErrorWithStack() {\n if (NEEDS_THROW_FOR_STACK) try {\n getErrorWithStack.arguments;\n throw new Error();\n } catch (e) {\n return e;\n }\n return new Error();\n}\nfunction prettyStack(exception, numIgnoredFrames) {\n var stack = exception.stack;\n if (!stack) return \"\";\n numIgnoredFrames = numIgnoredFrames || 0;\n if (stack.indexOf(exception.name) === 0) numIgnoredFrames += (exception.name + exception.message).split('\\n').length;\n return stack.split('\\n').slice(numIgnoredFrames).filter(libraryFilter).map(frame => \"\\n\" + frame).join('');\n}\nvar dexieErrorNames = ['Modify', 'Bulk', 'OpenFailed', 'VersionChange', 'Schema', 'Upgrade', 'InvalidTable', 'MissingAPI', 'NoSuchDatabase', 'InvalidArgument', 'SubTransaction', 'Unsupported', 'Internal', 'DatabaseClosed', 'PrematureCommit', 'ForeignAwait'];\nvar idbDomErrorNames = ['Unknown', 'Constraint', 'Data', 'TransactionInactive', 'ReadOnly', 'Version', 'NotFound', 'InvalidState', 'InvalidAccess', 'Abort', 'Timeout', 'QuotaExceeded', 'Syntax', 'DataClone'];\nvar errorList = dexieErrorNames.concat(idbDomErrorNames);\nvar defaultTexts = {\n VersionChanged: \"Database version changed by other database connection\",\n DatabaseClosed: \"Database has been closed\",\n Abort: \"Transaction aborted\",\n TransactionInactive: \"Transaction has already completed or failed\",\n MissingAPI: \"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb\"\n};\nfunction DexieError(name, msg) {\n this._e = getErrorWithStack();\n this.name = name;\n this.message = msg;\n}\nderive(DexieError).from(Error).extend({\n stack: {\n get: function () {\n return this._stack || (this._stack = this.name + \": \" + this.message + prettyStack(this._e, 2));\n }\n },\n toString: function () {\n return this.name + \": \" + this.message;\n }\n});\nfunction getMultiErrorMessage(msg, failures) {\n return msg + \". Errors: \" + Object.keys(failures).map(key => failures[key].toString()).filter((v, i, s) => s.indexOf(v) === i).join('\\n');\n}\nfunction ModifyError(msg, failures, successCount, failedKeys) {\n this._e = getErrorWithStack();\n this.failures = failures;\n this.failedKeys = failedKeys;\n this.successCount = successCount;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(ModifyError).from(DexieError);\nfunction BulkError(msg, failures) {\n this._e = getErrorWithStack();\n this.name = \"BulkError\";\n this.failures = Object.keys(failures).map(pos => failures[pos]);\n this.failuresByPos = failures;\n this.message = getMultiErrorMessage(msg, failures);\n}\nderive(BulkError).from(DexieError);\nvar errnames = errorList.reduce((obj, name) => (obj[name] = name + \"Error\", obj), {});\nconst BaseException = DexieError;\nvar exceptions = errorList.reduce((obj, name) => {\n var fullName = name + \"Error\";\n function DexieError(msgOrInner, inner) {\n this._e = getErrorWithStack();\n this.name = fullName;\n if (!msgOrInner) {\n this.message = defaultTexts[name] || fullName;\n this.inner = null;\n } else if (typeof msgOrInner === 'string') {\n this.message = `${msgOrInner}${!inner ? '' : '\\n ' + inner}`;\n this.inner = inner || null;\n } else if (typeof msgOrInner === 'object') {\n this.message = `${msgOrInner.name} ${msgOrInner.message}`;\n this.inner = msgOrInner;\n }\n }\n derive(DexieError).from(BaseException);\n obj[name] = DexieError;\n return obj;\n}, {});\nexceptions.Syntax = SyntaxError;\nexceptions.Type = TypeError;\nexceptions.Range = RangeError;\nvar exceptionMap = idbDomErrorNames.reduce((obj, name) => {\n obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\nfunction mapError(domError, message) {\n if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name]) return domError;\n var rv = new exceptionMap[domError.name](message || domError.message, domError);\n if (\"stack\" in domError) {\n setProp(rv, \"stack\", {\n get: function () {\n return this.inner.stack;\n }\n });\n }\n return rv;\n}\nvar fullNameExceptions = errorList.reduce((obj, name) => {\n if ([\"Syntax\", \"Type\", \"Range\"].indexOf(name) === -1) obj[name + \"Error\"] = exceptions[name];\n return obj;\n}, {});\nfullNameExceptions.ModifyError = ModifyError;\nfullNameExceptions.DexieError = DexieError;\nfullNameExceptions.BulkError = BulkError;\nfunction nop() {}\nfunction mirror(val) {\n return val;\n}\nfunction pureFunctionChain(f1, f2) {\n if (f1 == null || f1 === mirror) return f2;\n return function (val) {\n return f2(f1(val));\n };\n}\nfunction callBoth(on1, on2) {\n return function () {\n on1.apply(this, arguments);\n on2.apply(this, arguments);\n };\n}\nfunction hookCreatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res !== undefined) arguments[0] = res;\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res2 !== undefined ? res2 : res;\n };\n}\nfunction hookDeletingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n f1.apply(this, arguments);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = this.onerror = null;\n f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n };\n}\nfunction hookUpdatingChain(f1, f2) {\n if (f1 === nop) return f2;\n return function (modifications) {\n var res = f1.apply(this, arguments);\n extend(modifications, res);\n var onsuccess = this.onsuccess,\n onerror = this.onerror;\n this.onsuccess = null;\n this.onerror = null;\n var res2 = f2.apply(this, arguments);\n if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;\n if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;\n return res === undefined ? res2 === undefined ? undefined : res2 : extend(res, res2);\n };\n}\nfunction reverseStoppableEventChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n if (f2.apply(this, arguments) === false) return false;\n return f1.apply(this, arguments);\n };\n}\nfunction promisableChain(f1, f2) {\n if (f1 === nop) return f2;\n return function () {\n var res = f1.apply(this, arguments);\n if (res && typeof res.then === 'function') {\n var thiz = this,\n i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n return res.then(function () {\n return f2.apply(thiz, args);\n });\n }\n return f2.apply(this, arguments);\n };\n}\nvar INTERNAL = {};\nconst LONG_STACKS_CLIP_LIMIT = 100,\n MAX_LONG_STACKS = 20,\n ZONE_ECHO_LIMIT = 100,\n [resolvedNativePromise, nativePromiseProto, resolvedGlobalPromise] = typeof Promise === 'undefined' ? [] : (() => {\n let globalP = Promise.resolve();\n if (typeof crypto === 'undefined' || !crypto.subtle) return [globalP, getProto(globalP), globalP];\n const nativeP = crypto.subtle.digest(\"SHA-512\", new Uint8Array([0]));\n return [nativeP, getProto(nativeP), globalP];\n })(),\n nativePromiseThen = nativePromiseProto && nativePromiseProto.then;\nconst NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;\nconst patchGlobalPromise = !!resolvedGlobalPromise;\nvar stack_being_generated = false;\nvar schedulePhysicalTick = resolvedGlobalPromise ? () => {\n resolvedGlobalPromise.then(physicalTick);\n} : _global.setImmediate ? setImmediate.bind(null, physicalTick) : _global.MutationObserver ? () => {\n var hiddenDiv = document.createElement(\"div\");\n new MutationObserver(() => {\n physicalTick();\n hiddenDiv = null;\n }).observe(hiddenDiv, {\n attributes: true\n });\n hiddenDiv.setAttribute('i', '1');\n} : () => {\n setTimeout(physicalTick, 0);\n};\nvar asap = function (callback, args) {\n microtickQueue.push([callback, args]);\n if (needsNewPhysicalTick) {\n schedulePhysicalTick();\n needsNewPhysicalTick = false;\n }\n};\nvar isOutsideMicroTick = true,\n needsNewPhysicalTick = true,\n unhandledErrors = [],\n rejectingErrors = [],\n currentFulfiller = null,\n rejectionMapper = mirror;\nvar globalPSD = {\n id: 'global',\n global: true,\n ref: 0,\n unhandleds: [],\n onunhandled: globalError,\n pgp: false,\n env: {},\n finalize: function () {\n this.unhandleds.forEach(uh => {\n try {\n globalError(uh[0], uh[1]);\n } catch (e) {}\n });\n }\n};\nvar PSD = globalPSD;\nvar microtickQueue = [];\nvar numScheduledCalls = 0;\nvar tickFinalizers = [];\nfunction DexiePromise(fn) {\n if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');\n this._listeners = [];\n this.onuncatched = nop;\n this._lib = false;\n var psd = this._PSD = PSD;\n if (debug) {\n this._stackHolder = getErrorWithStack();\n this._prev = null;\n this._numPrev = 0;\n }\n if (typeof fn !== 'function') {\n if (fn !== INTERNAL) throw new TypeError('Not a function');\n this._state = arguments[1];\n this._value = arguments[2];\n if (this._state === false) handleRejection(this, this._value);\n return;\n }\n this._state = null;\n this._value = null;\n ++psd.ref;\n executePromiseTask(this, fn);\n}\nconst thenProp = {\n get: function () {\n var psd = PSD,\n microTaskId = totalEchoes;\n function then(onFulfilled, onRejected) {\n var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);\n const cleanup = possibleAwait && !decrementExpectedAwaits();\n var rv = new DexiePromise((resolve, reject) => {\n propagateToListener(this, new Listener(nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait, cleanup), nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait, cleanup), resolve, reject, psd));\n });\n debug && linkToPreviousPromise(rv, this);\n return rv;\n }\n then.prototype = INTERNAL;\n return then;\n },\n set: function (value) {\n setProp(this, 'then', value && value.prototype === INTERNAL ? thenProp : {\n get: function () {\n return value;\n },\n set: thenProp.set\n });\n }\n};\nprops(DexiePromise.prototype, {\n then: thenProp,\n _then: function (onFulfilled, onRejected) {\n propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD));\n },\n catch: function (onRejected) {\n if (arguments.length === 1) return this.then(null, onRejected);\n var type = arguments[0],\n handler = arguments[1];\n return typeof type === 'function' ? this.then(null, err => err instanceof type ? handler(err) : PromiseReject(err)) : this.then(null, err => err && err.name === type ? handler(err) : PromiseReject(err));\n },\n finally: function (onFinally) {\n return this.then(value => {\n onFinally();\n return value;\n }, err => {\n onFinally();\n return PromiseReject(err);\n });\n },\n stack: {\n get: function () {\n if (this._stack) return this._stack;\n try {\n stack_being_generated = true;\n var stacks = getStack(this, [], MAX_LONG_STACKS);\n var stack = stacks.join(\"\\nFrom previous: \");\n if (this._state !== null) this._stack = stack;\n return stack;\n } finally {\n stack_being_generated = false;\n }\n }\n },\n timeout: function (ms, msg) {\n return ms < Infinity ? new DexiePromise((resolve, reject) => {\n var handle = setTimeout(() => reject(new exceptions.Timeout(msg)), ms);\n this.then(resolve, reject).finally(clearTimeout.bind(null, handle));\n }) : this;\n }\n});\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) setProp(DexiePromise.prototype, Symbol.toStringTag, 'Dexie.Promise');\nglobalPSD.env = snapShot();\nfunction Listener(onFulfilled, onRejected, resolve, reject, zone) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.resolve = resolve;\n this.reject = reject;\n this.psd = zone;\n}\nprops(DexiePromise, {\n all: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(function (resolve, reject) {\n if (values.length === 0) resolve([]);\n var remaining = values.length;\n values.forEach((a, i) => DexiePromise.resolve(a).then(x => {\n values[i] = x;\n if (! --remaining) resolve(values);\n }, reject));\n });\n },\n resolve: value => {\n if (value instanceof DexiePromise) return value;\n if (value && typeof value.then === 'function') return new DexiePromise((resolve, reject) => {\n value.then(resolve, reject);\n });\n var rv = new DexiePromise(INTERNAL, true, value);\n linkToPreviousPromise(rv, currentFulfiller);\n return rv;\n },\n reject: PromiseReject,\n race: function () {\n var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise((resolve, reject) => {\n values.map(value => DexiePromise.resolve(value).then(resolve, reject));\n });\n },\n PSD: {\n get: () => PSD,\n set: value => PSD = value\n },\n totalEchoes: {\n get: () => totalEchoes\n },\n newPSD: newScope,\n usePSD: usePSD,\n scheduler: {\n get: () => asap,\n set: value => {\n asap = value;\n }\n },\n rejectionMapper: {\n get: () => rejectionMapper,\n set: value => {\n rejectionMapper = value;\n }\n },\n follow: (fn, zoneProps) => {\n return new DexiePromise((resolve, reject) => {\n return newScope((resolve, reject) => {\n var psd = PSD;\n psd.unhandleds = [];\n psd.onunhandled = reject;\n psd.finalize = callBoth(function () {\n run_at_end_of_this_or_next_physical_tick(() => {\n this.unhandleds.length === 0 ? resolve() : reject(this.unhandleds[0]);\n });\n }, psd.finalize);\n fn();\n }, zoneProps, resolve, reject);\n });\n }\n});\nif (NativePromise) {\n if (NativePromise.allSettled) setProp(DexiePromise, \"allSettled\", function () {\n const possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise(resolve => {\n if (possiblePromises.length === 0) resolve([]);\n let remaining = possiblePromises.length;\n const results = new Array(remaining);\n possiblePromises.forEach((p, i) => DexiePromise.resolve(p).then(value => results[i] = {\n status: \"fulfilled\",\n value\n }, reason => results[i] = {\n status: \"rejected\",\n reason\n }).then(() => --remaining || resolve(results)));\n });\n });\n if (NativePromise.any && typeof AggregateError !== 'undefined') setProp(DexiePromise, \"any\", function () {\n const possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);\n return new DexiePromise((resolve, reject) => {\n if (possiblePromises.length === 0) reject(new AggregateError([]));\n let remaining = possiblePromises.length;\n const failures = new Array(remaining);\n possiblePromises.forEach((p, i) => DexiePromise.resolve(p).then(value => resolve(value), failure => {\n failures[i] = failure;\n if (! --remaining) reject(new AggregateError(failures));\n }));\n });\n });\n}\nfunction executePromiseTask(promise, fn) {\n try {\n fn(value => {\n if (promise._state !== null) return;\n if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n if (value && typeof value.then === 'function') {\n executePromiseTask(promise, (resolve, reject) => {\n value instanceof DexiePromise ? value._then(resolve, reject) : value.then(resolve, reject);\n });\n } else {\n promise._state = true;\n promise._value = value;\n propagateAllListeners(promise);\n }\n if (shouldExecuteTick) endMicroTickScope();\n }, handleRejection.bind(null, promise));\n } catch (ex) {\n handleRejection(promise, ex);\n }\n}\nfunction handleRejection(promise, reason) {\n rejectingErrors.push(reason);\n if (promise._state !== null) return;\n var shouldExecuteTick = promise._lib && beginMicroTickScope();\n reason = rejectionMapper(reason);\n promise._state = false;\n promise._value = reason;\n debug && reason !== null && typeof reason === 'object' && !reason._promise && tryCatch(() => {\n var origProp = getPropertyDescriptor(reason, \"stack\");\n reason._promise = promise;\n setProp(reason, \"stack\", {\n get: () => stack_being_generated ? origProp && (origProp.get ? origProp.get.apply(reason) : origProp.value) : promise.stack\n });\n });\n addPossiblyUnhandledError(promise);\n propagateAllListeners(promise);\n if (shouldExecuteTick) endMicroTickScope();\n}\nfunction propagateAllListeners(promise) {\n var listeners = promise._listeners;\n promise._listeners = [];\n for (var i = 0, len = listeners.length; i < len; ++i) {\n propagateToListener(promise, listeners[i]);\n }\n var psd = promise._PSD;\n --psd.ref || psd.finalize();\n if (numScheduledCalls === 0) {\n ++numScheduledCalls;\n asap(() => {\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n }\n}\nfunction propagateToListener(promise, listener) {\n if (promise._state === null) {\n promise._listeners.push(listener);\n return;\n }\n var cb = promise._state ? listener.onFulfilled : listener.onRejected;\n if (cb === null) {\n return (promise._state ? listener.resolve : listener.reject)(promise._value);\n }\n ++listener.psd.ref;\n ++numScheduledCalls;\n asap(callListener, [cb, promise, listener]);\n}\nfunction callListener(cb, promise, listener) {\n try {\n currentFulfiller = promise;\n var ret,\n value = promise._value;\n if (promise._state) {\n ret = cb(value);\n } else {\n if (rejectingErrors.length) rejectingErrors = [];\n ret = cb(value);\n if (rejectingErrors.indexOf(value) === -1) markErrorAsHandled(promise);\n }\n listener.resolve(ret);\n } catch (e) {\n listener.reject(e);\n } finally {\n currentFulfiller = null;\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n --listener.psd.ref || listener.psd.finalize();\n }\n}\nfunction getStack(promise, stacks, limit) {\n if (stacks.length === limit) return stacks;\n var stack = \"\";\n if (promise._state === false) {\n var failure = promise._value,\n errorName,\n message;\n if (failure != null) {\n errorName = failure.name || \"Error\";\n message = failure.message || failure;\n stack = prettyStack(failure, 0);\n } else {\n errorName = failure;\n message = \"\";\n }\n stacks.push(errorName + (message ? \": \" + message : \"\") + stack);\n }\n if (debug) {\n stack = prettyStack(promise._stackHolder, 2);\n if (stack && stacks.indexOf(stack) === -1) stacks.push(stack);\n if (promise._prev) getStack(promise._prev, stacks, limit);\n }\n return stacks;\n}\nfunction linkToPreviousPromise(promise, prev) {\n var numPrev = prev ? prev._numPrev + 1 : 0;\n if (numPrev < LONG_STACKS_CLIP_LIMIT) {\n promise._prev = prev;\n promise._numPrev = numPrev;\n }\n}\nfunction physicalTick() {\n beginMicroTickScope() && endMicroTickScope();\n}\nfunction beginMicroTickScope() {\n var wasRootExec = isOutsideMicroTick;\n isOutsideMicroTick = false;\n needsNewPhysicalTick = false;\n return wasRootExec;\n}\nfunction endMicroTickScope() {\n var callbacks, i, l;\n do {\n while (microtickQueue.length > 0) {\n callbacks = microtickQueue;\n microtickQueue = [];\n l = callbacks.length;\n for (i = 0; i < l; ++i) {\n var item = callbacks[i];\n item[0].apply(null, item[1]);\n }\n }\n } while (microtickQueue.length > 0);\n isOutsideMicroTick = true;\n needsNewPhysicalTick = true;\n}\nfunction finalizePhysicalTick() {\n var unhandledErrs = unhandledErrors;\n unhandledErrors = [];\n unhandledErrs.forEach(p => {\n p._PSD.onunhandled.call(null, p._value, p);\n });\n var finalizers = tickFinalizers.slice(0);\n var i = finalizers.length;\n while (i) finalizers[--i]();\n}\nfunction run_at_end_of_this_or_next_physical_tick(fn) {\n function finalizer() {\n fn();\n tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);\n }\n tickFinalizers.push(finalizer);\n ++numScheduledCalls;\n asap(() => {\n if (--numScheduledCalls === 0) finalizePhysicalTick();\n }, []);\n}\nfunction addPossiblyUnhandledError(promise) {\n if (!unhandledErrors.some(p => p._value === promise._value)) unhandledErrors.push(promise);\n}\nfunction markErrorAsHandled(promise) {\n var i = unhandledErrors.length;\n while (i) if (unhandledErrors[--i]._value === promise._value) {\n unhandledErrors.splice(i, 1);\n return;\n }\n}\nfunction PromiseReject(reason) {\n return new DexiePromise(INTERNAL, false, reason);\n}\nfunction wrap(fn, errorCatcher) {\n var psd = PSD;\n return function () {\n var wasRootExec = beginMicroTickScope(),\n outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn.apply(this, arguments);\n } catch (e) {\n errorCatcher && errorCatcher(e);\n } finally {\n switchToZone(outerScope, false);\n if (wasRootExec) endMicroTickScope();\n }\n };\n}\nconst task = {\n awaits: 0,\n echoes: 0,\n id: 0\n};\nvar taskCounter = 0;\nvar zoneStack = [];\nvar zoneEchoes = 0;\nvar totalEchoes = 0;\nvar zone_id_counter = 0;\nfunction newScope(fn, props, a1, a2) {\n var parent = PSD,\n psd = Object.create(parent);\n psd.parent = parent;\n psd.ref = 0;\n psd.global = false;\n psd.id = ++zone_id_counter;\n var globalEnv = globalPSD.env;\n psd.env = patchGlobalPromise ? {\n Promise: DexiePromise,\n PromiseProp: {\n value: DexiePromise,\n configurable: true,\n writable: true\n },\n all: DexiePromise.all,\n race: DexiePromise.race,\n allSettled: DexiePromise.allSettled,\n any: DexiePromise.any,\n resolve: DexiePromise.resolve,\n reject: DexiePromise.reject,\n nthen: getPatchedPromiseThen(globalEnv.nthen, psd),\n gthen: getPatchedPromiseThen(globalEnv.gthen, psd)\n } : {};\n if (props) extend(psd, props);\n ++parent.ref;\n psd.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n };\n var rv = usePSD(psd, fn, a1, a2);\n if (psd.ref === 0) psd.finalize();\n return rv;\n}\nfunction incrementExpectedAwaits() {\n if (!task.id) task.id = ++taskCounter;\n ++task.awaits;\n task.echoes += ZONE_ECHO_LIMIT;\n return task.id;\n}\nfunction decrementExpectedAwaits() {\n if (!task.awaits) return false;\n if (--task.awaits === 0) task.id = 0;\n task.echoes = task.awaits * ZONE_ECHO_LIMIT;\n return true;\n}\nif (('' + nativePromiseThen).indexOf('[native code]') === -1) {\n incrementExpectedAwaits = decrementExpectedAwaits = nop;\n}\nfunction onPossibleParallellAsync(possiblePromise) {\n if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {\n incrementExpectedAwaits();\n return possiblePromise.then(x => {\n decrementExpectedAwaits();\n return x;\n }, e => {\n decrementExpectedAwaits();\n return rejection(e);\n });\n }\n return possiblePromise;\n}\nfunction zoneEnterEcho(targetZone) {\n ++totalEchoes;\n if (!task.echoes || --task.echoes === 0) {\n task.echoes = task.id = 0;\n }\n zoneStack.push(PSD);\n switchToZone(targetZone, true);\n}\nfunction zoneLeaveEcho() {\n var zone = zoneStack[zoneStack.length - 1];\n zoneStack.pop();\n switchToZone(zone, false);\n}\nfunction switchToZone(targetZone, bEnteringZone) {\n var currentZone = PSD;\n if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (! --zoneEchoes || targetZone !== PSD)) {\n enqueueNativeMicroTask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);\n }\n if (targetZone === PSD) return;\n PSD = targetZone;\n if (currentZone === globalPSD) globalPSD.env = snapShot();\n if (patchGlobalPromise) {\n var GlobalPromise = globalPSD.env.Promise;\n var targetEnv = targetZone.env;\n nativePromiseProto.then = targetEnv.nthen;\n GlobalPromise.prototype.then = targetEnv.gthen;\n if (currentZone.global || targetZone.global) {\n Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);\n GlobalPromise.all = targetEnv.all;\n GlobalPromise.race = targetEnv.race;\n GlobalPromise.resolve = targetEnv.resolve;\n GlobalPromise.reject = targetEnv.reject;\n if (targetEnv.allSettled) GlobalPromise.allSettled = targetEnv.allSettled;\n if (targetEnv.any) GlobalPromise.any = targetEnv.any;\n }\n }\n}\nfunction snapShot() {\n var GlobalPromise = _global.Promise;\n return patchGlobalPromise ? {\n Promise: GlobalPromise,\n PromiseProp: Object.getOwnPropertyDescriptor(_global, \"Promise\"),\n all: GlobalPromise.all,\n race: GlobalPromise.race,\n allSettled: GlobalPromise.allSettled,\n any: GlobalPromise.any,\n resolve: GlobalPromise.resolve,\n reject: GlobalPromise.reject,\n nthen: nativePromiseProto.then,\n gthen: GlobalPromise.prototype.then\n } : {};\n}\nfunction usePSD(psd, fn, a1, a2, a3) {\n var outerScope = PSD;\n try {\n switchToZone(psd, true);\n return fn(a1, a2, a3);\n } finally {\n switchToZone(outerScope, false);\n }\n}\nfunction enqueueNativeMicroTask(job) {\n nativePromiseThen.call(resolvedNativePromise, job);\n}\nfunction nativeAwaitCompatibleWrap(fn, zone, possibleAwait, cleanup) {\n return typeof fn !== 'function' ? fn : function () {\n var outerZone = PSD;\n if (possibleAwait) incrementExpectedAwaits();\n switchToZone(zone, true);\n try {\n return fn.apply(this, arguments);\n } finally {\n switchToZone(outerZone, false);\n if (cleanup) enqueueNativeMicroTask(decrementExpectedAwaits);\n }\n };\n}\nfunction getPatchedPromiseThen(origThen, zone) {\n return function (onResolved, onRejected) {\n return origThen.call(this, nativeAwaitCompatibleWrap(onResolved, zone), nativeAwaitCompatibleWrap(onRejected, zone));\n };\n}\nconst UNHANDLEDREJECTION = \"unhandledrejection\";\nfunction globalError(err, promise) {\n var rv;\n try {\n rv = promise.onuncatched(err);\n } catch (e) {}\n if (rv !== false) try {\n var event,\n eventData = {\n promise: promise,\n reason: err\n };\n if (_global.document && document.createEvent) {\n event = document.createEvent('Event');\n event.initEvent(UNHANDLEDREJECTION, true, true);\n extend(event, eventData);\n } else if (_global.CustomEvent) {\n event = new CustomEvent(UNHANDLEDREJECTION, {\n detail: eventData\n });\n extend(event, eventData);\n }\n if (event && _global.dispatchEvent) {\n dispatchEvent(event);\n if (!_global.PromiseRejectionEvent && _global.onunhandledrejection) try {\n _global.onunhandledrejection(event);\n } catch (_) {}\n }\n if (debug && event && !event.defaultPrevented) {\n console.warn(`Unhandled rejection: ${err.stack || err}`);\n }\n } catch (e) {}\n}\nvar rejection = DexiePromise.reject;\nfunction tempTransaction(db, mode, storeNames, fn) {\n if (!db.idbdb || !db._state.openComplete && !PSD.letThrough && !db._vip) {\n if (db._state.openComplete) {\n return rejection(new exceptions.DatabaseClosed(db._state.dbOpenError));\n }\n if (!db._state.isBeingOpened) {\n if (!db._options.autoOpen) return rejection(new exceptions.DatabaseClosed());\n db.open().catch(nop);\n }\n return db._state.dbReadyPromise.then(() => tempTransaction(db, mode, storeNames, fn));\n } else {\n var trans = db._createTransaction(mode, storeNames, db._dbSchema);\n try {\n trans.create();\n db._state.PR1398_maxLoop = 3;\n } catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db._close();\n return db.open().then(() => tempTransaction(db, mode, storeNames, fn));\n }\n return rejection(ex);\n }\n return trans._promise(mode, (resolve, reject) => {\n return newScope(() => {\n PSD.trans = trans;\n return fn(resolve, reject, trans);\n });\n }).then(result => {\n return trans._completion.then(() => result);\n });\n }\n}\nconst DEXIE_VERSION = '3.2.6';\nconst maxString = String.fromCharCode(65535);\nconst minKey = -Infinity;\nconst INVALID_KEY_ARGUMENT = \"Invalid key provided. Keys must be of type string, number, Date or Array.\";\nconst STRING_EXPECTED = \"String expected.\";\nconst connections = [];\nconst isIEOrEdge = typeof navigator !== 'undefined' && /(MSIE|Trident|Edge)/.test(navigator.userAgent);\nconst hasIEDeleteObjectStoreBug = isIEOrEdge;\nconst hangsOnDeleteLargeKeyRange = isIEOrEdge;\nconst dexieStackFrameFilter = frame => !/(dexie\\.js|dexie\\.min\\.js)/.test(frame);\nconst DBNAMES_DB = '__dbnames';\nconst READONLY = 'readonly';\nconst READWRITE = 'readwrite';\nfunction combine(filter1, filter2) {\n return filter1 ? filter2 ? function () {\n return filter1.apply(this, arguments) && filter2.apply(this, arguments);\n } : filter1 : filter2;\n}\nconst AnyRange = {\n type: 3,\n lower: -Infinity,\n lowerOpen: false,\n upper: [[]],\n upperOpen: false\n};\nfunction workaroundForUndefinedPrimKey(keyPath) {\n return typeof keyPath === \"string\" && !/\\./.test(keyPath) ? obj => {\n if (obj[keyPath] === undefined && keyPath in obj) {\n obj = deepClone(obj);\n delete obj[keyPath];\n }\n return obj;\n } : obj => obj;\n}\nclass Table {\n _trans(mode, fn, writeLocked) {\n const trans = this._tx || PSD.trans;\n const tableName = this.name;\n function checkTableInTransaction(resolve, reject, trans) {\n if (!trans.schema[tableName]) throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n return fn(trans.idbtrans, trans);\n }\n const wasRootExec = beginMicroTickScope();\n try {\n return trans && trans.db === this.db ? trans === PSD.trans ? trans._promise(mode, checkTableInTransaction, writeLocked) : newScope(() => trans._promise(mode, checkTableInTransaction, writeLocked), {\n trans: trans,\n transless: PSD.transless || PSD\n }) : tempTransaction(this.db, mode, [this.name], checkTableInTransaction);\n } finally {\n if (wasRootExec) endMicroTickScope();\n }\n }\n get(keyOrCrit, cb) {\n if (keyOrCrit && keyOrCrit.constructor === Object) return this.where(keyOrCrit).first(cb);\n return this._trans('readonly', trans => {\n return this.core.get({\n trans,\n key: keyOrCrit\n }).then(res => this.hook.reading.fire(res));\n }).then(cb);\n }\n where(indexOrCrit) {\n if (typeof indexOrCrit === 'string') return new this.db.WhereClause(this, indexOrCrit);\n if (isArray(indexOrCrit)) return new this.db.WhereClause(this, `[${indexOrCrit.join('+')}]`);\n const keyPaths = keys(indexOrCrit);\n if (keyPaths.length === 1) return this.where(keyPaths[0]).equals(indexOrCrit[keyPaths[0]]);\n const compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(ix => {\n if (ix.compound && keyPaths.every(keyPath => ix.keyPath.indexOf(keyPath) >= 0)) {\n for (let i = 0; i < keyPaths.length; ++i) {\n if (keyPaths.indexOf(ix.keyPath[i]) === -1) return false;\n }\n return true;\n }\n return false;\n }).sort((a, b) => a.keyPath.length - b.keyPath.length)[0];\n if (compoundIndex && this.db._maxKey !== maxString) {\n const keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);\n return this.where(keyPathsInValidOrder).equals(keyPathsInValidOrder.map(kp => indexOrCrit[kp]));\n }\n if (!compoundIndex && debug) console.warn(`The query ${JSON.stringify(indexOrCrit)} on ${this.name} would benefit of a ` + `compound index [${keyPaths.join('+')}]`);\n const {\n idxByName\n } = this.schema;\n const idb = this.db._deps.indexedDB;\n function equals(a, b) {\n try {\n return idb.cmp(a, b) === 0;\n } catch (e) {\n return false;\n }\n }\n const [idx, filterFunction] = keyPaths.reduce(([prevIndex, prevFilterFn], keyPath) => {\n const index = idxByName[keyPath];\n const value = indexOrCrit[keyPath];\n return [prevIndex || index, prevIndex || !index ? combine(prevFilterFn, index && index.multi ? x => {\n const prop = getByKeyPath(x, keyPath);\n return isArray(prop) && prop.some(item => equals(value, item));\n } : x => equals(value, getByKeyPath(x, keyPath))) : prevFilterFn];\n }, [null, null]);\n return idx ? this.where(idx.name).equals(indexOrCrit[idx.keyPath]).filter(filterFunction) : compoundIndex ? this.filter(filterFunction) : this.where(keyPaths).equals('');\n }\n filter(filterFunction) {\n return this.toCollection().and(filterFunction);\n }\n count(thenShortcut) {\n return this.toCollection().count(thenShortcut);\n }\n offset(offset) {\n return this.toCollection().offset(offset);\n }\n limit(numRows) {\n return this.toCollection().limit(numRows);\n }\n each(callback) {\n return this.toCollection().each(callback);\n }\n toArray(thenShortcut) {\n return this.toCollection().toArray(thenShortcut);\n }\n toCollection() {\n return new this.db.Collection(new this.db.WhereClause(this));\n }\n orderBy(index) {\n return new this.db.Collection(new this.db.WhereClause(this, isArray(index) ? `[${index.join('+')}]` : index));\n }\n reverse() {\n return this.toCollection().reverse();\n }\n mapToClass(constructor) {\n this.schema.mappedClass = constructor;\n const readHook = obj => {\n if (!obj) return obj;\n const res = Object.create(constructor.prototype);\n for (var m in obj) if (hasOwn(obj, m)) try {\n res[m] = obj[m];\n } catch (_) {}\n return res;\n };\n if (this.schema.readHook) {\n this.hook.reading.unsubscribe(this.schema.readHook);\n }\n this.schema.readHook = readHook;\n this.hook(\"reading\", readHook);\n return constructor;\n }\n defineClass() {\n function Class(content) {\n extend(this, content);\n }\n return this.mapToClass(Class);\n }\n add(obj, key) {\n const {\n auto,\n keyPath\n } = this.schema.primKey;\n let objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', trans => {\n return this.core.mutate({\n trans,\n type: 'add',\n keys: key != null ? [key] : null,\n values: [objToAdd]\n });\n }).then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult).then(lastResult => {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n } catch (_) {}\n }\n return lastResult;\n });\n }\n update(keyOrObject, modifications) {\n if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {\n const key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);\n if (key === undefined) return rejection(new exceptions.InvalidArgument(\"Given object does not contain its primary key\"));\n try {\n if (typeof modifications !== \"function\") {\n keys(modifications).forEach(keyPath => {\n setByKeyPath(keyOrObject, keyPath, modifications[keyPath]);\n });\n } else {\n modifications(keyOrObject, {\n value: keyOrObject,\n primKey: key\n });\n }\n } catch (_a) {}\n return this.where(\":id\").equals(key).modify(modifications);\n } else {\n return this.where(\":id\").equals(keyOrObject).modify(modifications);\n }\n }\n put(obj, key) {\n const {\n auto,\n keyPath\n } = this.schema.primKey;\n let objToAdd = obj;\n if (keyPath && auto) {\n objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);\n }\n return this._trans('readwrite', trans => this.core.mutate({\n trans,\n type: 'put',\n values: [objToAdd],\n keys: key != null ? [key] : null\n })).then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult).then(lastResult => {\n if (keyPath) {\n try {\n setByKeyPath(obj, keyPath, lastResult);\n } catch (_) {}\n }\n return lastResult;\n });\n }\n delete(key) {\n return this._trans('readwrite', trans => this.core.mutate({\n trans,\n type: 'delete',\n keys: [key]\n })).then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined);\n }\n clear() {\n return this._trans('readwrite', trans => this.core.mutate({\n trans,\n type: 'deleteRange',\n range: AnyRange\n })).then(res => res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined);\n }\n bulkGet(keys) {\n return this._trans('readonly', trans => {\n return this.core.getMany({\n keys,\n trans\n }).then(result => result.map(res => this.hook.reading.fire(res)));\n });\n }\n bulkAdd(objects, keysOrOptions, options) {\n const keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n const wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', trans => {\n const {\n auto,\n keyPath\n } = this.schema.primKey;\n if (keyPath && keys) throw new exceptions.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const numObjects = objects.length;\n let objectsToAdd = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;\n return this.core.mutate({\n trans,\n type: 'add',\n keys: keys,\n values: objectsToAdd,\n wantResults\n }).then(({\n numFailures,\n results,\n lastResult,\n failures\n }) => {\n const result = wantResults ? results : lastResult;\n if (numFailures === 0) return result;\n throw new BulkError(`${this.name}.bulkAdd(): ${numFailures} of ${numObjects} operations failed`, failures);\n });\n });\n }\n bulkPut(objects, keysOrOptions, options) {\n const keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;\n options = options || (keys ? undefined : keysOrOptions);\n const wantResults = options ? options.allKeys : undefined;\n return this._trans('readwrite', trans => {\n const {\n auto,\n keyPath\n } = this.schema.primKey;\n if (keyPath && keys) throw new exceptions.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const numObjects = objects.length;\n let objectsToPut = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;\n return this.core.mutate({\n trans,\n type: 'put',\n keys: keys,\n values: objectsToPut,\n wantResults\n }).then(({\n numFailures,\n results,\n lastResult,\n failures\n }) => {\n const result = wantResults ? results : lastResult;\n if (numFailures === 0) return result;\n throw new BulkError(`${this.name}.bulkPut(): ${numFailures} of ${numObjects} operations failed`, failures);\n });\n });\n }\n bulkDelete(keys) {\n const numKeys = keys.length;\n return this._trans('readwrite', trans => {\n return this.core.mutate({\n trans,\n type: 'delete',\n keys: keys\n });\n }).then(({\n numFailures,\n lastResult,\n failures\n }) => {\n if (numFailures === 0) return lastResult;\n throw new BulkError(`${this.name}.bulkDelete(): ${numFailures} of ${numKeys} operations failed`, failures);\n });\n }\n}\nfunction Events(ctx) {\n var evs = {};\n var rv = function (eventName, subscriber) {\n if (subscriber) {\n var i = arguments.length,\n args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n evs[eventName].subscribe.apply(null, args);\n return ctx;\n } else if (typeof eventName === 'string') {\n return evs[eventName];\n }\n };\n rv.addEventType = add;\n for (var i = 1, l = arguments.length; i < l; ++i) {\n add(arguments[i]);\n }\n return rv;\n function add(eventName, chainFunction, defaultFunction) {\n if (typeof eventName === 'object') return addConfiguredEvents(eventName);\n if (!chainFunction) chainFunction = reverseStoppableEventChain;\n if (!defaultFunction) defaultFunction = nop;\n var context = {\n subscribers: [],\n fire: defaultFunction,\n subscribe: function (cb) {\n if (context.subscribers.indexOf(cb) === -1) {\n context.subscribers.push(cb);\n context.fire = chainFunction(context.fire, cb);\n }\n },\n unsubscribe: function (cb) {\n context.subscribers = context.subscribers.filter(function (fn) {\n return fn !== cb;\n });\n context.fire = context.subscribers.reduce(chainFunction, defaultFunction);\n }\n };\n evs[eventName] = rv[eventName] = context;\n return context;\n }\n function addConfiguredEvents(cfg) {\n keys(cfg).forEach(function (eventName) {\n var args = cfg[eventName];\n if (isArray(args)) {\n add(eventName, cfg[eventName][0], cfg[eventName][1]);\n } else if (args === 'asap') {\n var context = add(eventName, mirror, function fire() {\n var i = arguments.length,\n args = new Array(i);\n while (i--) args[i] = arguments[i];\n context.subscribers.forEach(function (fn) {\n asap$1(function fireEvent() {\n fn.apply(null, args);\n });\n });\n });\n } else throw new exceptions.InvalidArgument(\"Invalid event config\");\n });\n }\n}\nfunction makeClassConstructor(prototype, constructor) {\n derive(constructor).from({\n prototype\n });\n return constructor;\n}\nfunction createTableConstructor(db) {\n return makeClassConstructor(Table.prototype, function Table(name, tableSchema, trans) {\n this.db = db;\n this._tx = trans;\n this.name = name;\n this.schema = tableSchema;\n this.hook = db._allTables[name] ? db._allTables[name].hook : Events(null, {\n \"creating\": [hookCreatingChain, nop],\n \"reading\": [pureFunctionChain, mirror],\n \"updating\": [hookUpdatingChain, nop],\n \"deleting\": [hookDeletingChain, nop]\n });\n });\n}\nfunction isPlainKeyRange(ctx, ignoreLimitFilter) {\n return !(ctx.filter || ctx.algorithm || ctx.or) && (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);\n}\nfunction addFilter(ctx, fn) {\n ctx.filter = combine(ctx.filter, fn);\n}\nfunction addReplayFilter(ctx, factory, isLimitFilter) {\n var curr = ctx.replayFilter;\n ctx.replayFilter = curr ? () => combine(curr(), factory()) : factory;\n ctx.justLimit = isLimitFilter && !curr;\n}\nfunction addMatchFilter(ctx, fn) {\n ctx.isMatch = combine(ctx.isMatch, fn);\n}\nfunction getIndexOrStore(ctx, coreSchema) {\n if (ctx.isPrimKey) return coreSchema.primaryKey;\n const index = coreSchema.getIndexByKeyPath(ctx.index);\n if (!index) throw new exceptions.Schema(\"KeyPath \" + ctx.index + \" on object store \" + coreSchema.name + \" is not indexed\");\n return index;\n}\nfunction openCursor(ctx, coreTable, trans) {\n const index = getIndexOrStore(ctx, coreTable.schema);\n return coreTable.openCursor({\n trans,\n values: !ctx.keysOnly,\n reverse: ctx.dir === 'prev',\n unique: !!ctx.unique,\n query: {\n index,\n range: ctx.range\n }\n });\n}\nfunction iter(ctx, fn, coreTrans, coreTable) {\n const filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;\n if (!ctx.or) {\n return iterate(openCursor(ctx, coreTable, coreTrans), combine(ctx.algorithm, filter), fn, !ctx.keysOnly && ctx.valueMapper);\n } else {\n const set = {};\n const union = (item, cursor, advance) => {\n if (!filter || filter(cursor, advance, result => cursor.stop(result), err => cursor.fail(err))) {\n var primaryKey = cursor.primaryKey;\n var key = '' + primaryKey;\n if (key === '[object ArrayBuffer]') key = '' + new Uint8Array(primaryKey);\n if (!hasOwn(set, key)) {\n set[key] = true;\n fn(item, cursor, advance);\n }\n }\n };\n return Promise.all([ctx.or._iterate(union, coreTrans), iterate(openCursor(ctx, coreTable, coreTrans), ctx.algorithm, union, !ctx.keysOnly && ctx.valueMapper)]);\n }\n}\nfunction iterate(cursorPromise, filter, fn, valueMapper) {\n var mappedFn = valueMapper ? (x, c, a) => fn(valueMapper(x), c, a) : fn;\n var wrappedFn = wrap(mappedFn);\n return cursorPromise.then(cursor => {\n if (cursor) {\n return cursor.start(() => {\n var c = () => cursor.continue();\n if (!filter || filter(cursor, advancer => c = advancer, val => {\n cursor.stop(val);\n c = nop;\n }, e => {\n cursor.fail(e);\n c = nop;\n })) wrappedFn(cursor.value, cursor, advancer => c = advancer);\n c();\n });\n }\n });\n}\nfunction cmp(a, b) {\n try {\n const ta = type(a);\n const tb = type(b);\n if (ta !== tb) {\n if (ta === 'Array') return 1;\n if (tb === 'Array') return -1;\n if (ta === 'binary') return 1;\n if (tb === 'binary') return -1;\n if (ta === 'string') return 1;\n if (tb === 'string') return -1;\n if (ta === 'Date') return 1;\n if (tb !== 'Date') return NaN;\n return -1;\n }\n switch (ta) {\n case 'number':\n case 'Date':\n case 'string':\n return a > b ? 1 : a < b ? -1 : 0;\n case 'binary':\n {\n return compareUint8Arrays(getUint8Array(a), getUint8Array(b));\n }\n case 'Array':\n return compareArrays(a, b);\n }\n } catch (_a) {}\n return NaN;\n}\nfunction compareArrays(a, b) {\n const al = a.length;\n const bl = b.length;\n const l = al < bl ? al : bl;\n for (let i = 0; i < l; ++i) {\n const res = cmp(a[i], b[i]);\n if (res !== 0) return res;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n}\nfunction compareUint8Arrays(a, b) {\n const al = a.length;\n const bl = b.length;\n const l = al < bl ? al : bl;\n for (let i = 0; i < l; ++i) {\n if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;\n }\n return al === bl ? 0 : al < bl ? -1 : 1;\n}\nfunction type(x) {\n const t = typeof x;\n if (t !== 'object') return t;\n if (ArrayBuffer.isView(x)) return 'binary';\n const tsTag = toStringTag(x);\n return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;\n}\nfunction getUint8Array(a) {\n if (a instanceof Uint8Array) return a;\n if (ArrayBuffer.isView(a)) return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n return new Uint8Array(a);\n}\nclass Collection {\n _read(fn, cb) {\n var ctx = this._ctx;\n return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readonly', fn).then(cb);\n }\n _write(fn) {\n var ctx = this._ctx;\n return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readwrite', fn, \"locked\");\n }\n _addAlgorithm(fn) {\n var ctx = this._ctx;\n ctx.algorithm = combine(ctx.algorithm, fn);\n }\n _iterate(fn, coreTrans) {\n return iter(this._ctx, fn, coreTrans, this._ctx.table.core);\n }\n clone(props) {\n var rv = Object.create(this.constructor.prototype),\n ctx = Object.create(this._ctx);\n if (props) extend(ctx, props);\n rv._ctx = ctx;\n return rv;\n }\n raw() {\n this._ctx.valueMapper = null;\n return this;\n }\n each(fn) {\n var ctx = this._ctx;\n return this._read(trans => iter(ctx, fn, trans, ctx.table.core));\n }\n count(cb) {\n return this._read(trans => {\n const ctx = this._ctx;\n const coreTable = ctx.table.core;\n if (isPlainKeyRange(ctx, true)) {\n return coreTable.count({\n trans,\n query: {\n index: getIndexOrStore(ctx, coreTable.schema),\n range: ctx.range\n }\n }).then(count => Math.min(count, ctx.limit));\n } else {\n var count = 0;\n return iter(ctx, () => {\n ++count;\n return false;\n }, trans, coreTable).then(() => count);\n }\n }).then(cb);\n }\n sortBy(keyPath, cb) {\n const parts = keyPath.split('.').reverse(),\n lastPart = parts[0],\n lastIndex = parts.length - 1;\n function getval(obj, i) {\n if (i) return getval(obj[parts[i]], i - 1);\n return obj[lastPart];\n }\n var order = this._ctx.dir === \"next\" ? 1 : -1;\n function sorter(a, b) {\n var aVal = getval(a, lastIndex),\n bVal = getval(b, lastIndex);\n return aVal < bVal ? -order : aVal > bVal ? order : 0;\n }\n return this.toArray(function (a) {\n return a.sort(sorter);\n }).then(cb);\n }\n toArray(cb) {\n return this._read(trans => {\n var ctx = this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n const {\n valueMapper\n } = ctx;\n const index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans,\n limit: ctx.limit,\n values: true,\n query: {\n index,\n range: ctx.range\n }\n }).then(({\n result\n }) => valueMapper ? result.map(valueMapper) : result);\n } else {\n const a = [];\n return iter(ctx, item => a.push(item), trans, ctx.table.core).then(() => a);\n }\n }, cb);\n }\n offset(offset) {\n var ctx = this._ctx;\n if (offset <= 0) return this;\n ctx.offset += offset;\n if (isPlainKeyRange(ctx)) {\n addReplayFilter(ctx, () => {\n var offsetLeft = offset;\n return (cursor, advance) => {\n if (offsetLeft === 0) return true;\n if (offsetLeft === 1) {\n --offsetLeft;\n return false;\n }\n advance(() => {\n cursor.advance(offsetLeft);\n offsetLeft = 0;\n });\n return false;\n };\n });\n } else {\n addReplayFilter(ctx, () => {\n var offsetLeft = offset;\n return () => --offsetLeft < 0;\n });\n }\n return this;\n }\n limit(numRows) {\n this._ctx.limit = Math.min(this._ctx.limit, numRows);\n addReplayFilter(this._ctx, () => {\n var rowsLeft = numRows;\n return function (cursor, advance, resolve) {\n if (--rowsLeft <= 0) advance(resolve);\n return rowsLeft >= 0;\n };\n }, true);\n return this;\n }\n until(filterFunction, bIncludeStopEntry) {\n addFilter(this._ctx, function (cursor, advance, resolve) {\n if (filterFunction(cursor.value)) {\n advance(resolve);\n return bIncludeStopEntry;\n } else {\n return true;\n }\n });\n return this;\n }\n first(cb) {\n return this.limit(1).toArray(function (a) {\n return a[0];\n }).then(cb);\n }\n last(cb) {\n return this.reverse().first(cb);\n }\n filter(filterFunction) {\n addFilter(this._ctx, function (cursor) {\n return filterFunction(cursor.value);\n });\n addMatchFilter(this._ctx, filterFunction);\n return this;\n }\n and(filter) {\n return this.filter(filter);\n }\n or(indexName) {\n return new this.db.WhereClause(this._ctx.table, indexName, this);\n }\n reverse() {\n this._ctx.dir = this._ctx.dir === \"prev\" ? \"next\" : \"prev\";\n if (this._ondirectionchange) this._ondirectionchange(this._ctx.dir);\n return this;\n }\n desc() {\n return this.reverse();\n }\n eachKey(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) {\n cb(cursor.key, cursor);\n });\n }\n eachUniqueKey(cb) {\n this._ctx.unique = \"unique\";\n return this.eachKey(cb);\n }\n eachPrimaryKey(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n return this.each(function (val, cursor) {\n cb(cursor.primaryKey, cursor);\n });\n }\n keys(cb) {\n var ctx = this._ctx;\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.key);\n }).then(function () {\n return a;\n }).then(cb);\n }\n primaryKeys(cb) {\n var ctx = this._ctx;\n if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {\n return this._read(trans => {\n var index = getIndexOrStore(ctx, ctx.table.core.schema);\n return ctx.table.core.query({\n trans,\n values: false,\n limit: ctx.limit,\n query: {\n index,\n range: ctx.range\n }\n });\n }).then(({\n result\n }) => result).then(cb);\n }\n ctx.keysOnly = !ctx.isMatch;\n var a = [];\n return this.each(function (item, cursor) {\n a.push(cursor.primaryKey);\n }).then(function () {\n return a;\n }).then(cb);\n }\n uniqueKeys(cb) {\n this._ctx.unique = \"unique\";\n return this.keys(cb);\n }\n firstKey(cb) {\n return this.limit(1).keys(function (a) {\n return a[0];\n }).then(cb);\n }\n lastKey(cb) {\n return this.reverse().firstKey(cb);\n }\n distinct() {\n var ctx = this._ctx,\n idx = ctx.index && ctx.table.schema.idxByName[ctx.index];\n if (!idx || !idx.multi) return this;\n var set = {};\n addFilter(this._ctx, function (cursor) {\n var strKey = cursor.primaryKey.toString();\n var found = hasOwn(set, strKey);\n set[strKey] = true;\n return !found;\n });\n return this;\n }\n modify(changes) {\n var ctx = this._ctx;\n return this._write(trans => {\n var modifyer;\n if (typeof changes === 'function') {\n modifyer = changes;\n } else {\n var keyPaths = keys(changes);\n var numKeys = keyPaths.length;\n modifyer = function (item) {\n var anythingModified = false;\n for (var i = 0; i < numKeys; ++i) {\n var keyPath = keyPaths[i],\n val = changes[keyPath];\n if (getByKeyPath(item, keyPath) !== val) {\n setByKeyPath(item, keyPath, val);\n anythingModified = true;\n }\n }\n return anythingModified;\n };\n }\n const coreTable = ctx.table.core;\n const {\n outbound,\n extractKey\n } = coreTable.schema.primaryKey;\n const limit = this.db._options.modifyChunkSize || 200;\n const totalFailures = [];\n let successCount = 0;\n const failedKeys = [];\n const applyMutateResult = (expectedCount, res) => {\n const {\n failures,\n numFailures\n } = res;\n successCount += expectedCount - numFailures;\n for (let pos of keys(failures)) {\n totalFailures.push(failures[pos]);\n }\n };\n return this.clone().primaryKeys().then(keys => {\n const nextChunk = offset => {\n const count = Math.min(limit, keys.length - offset);\n return coreTable.getMany({\n trans,\n keys: keys.slice(offset, offset + count),\n cache: \"immutable\"\n }).then(values => {\n const addValues = [];\n const putValues = [];\n const putKeys = outbound ? [] : null;\n const deleteKeys = [];\n for (let i = 0; i < count; ++i) {\n const origValue = values[i];\n const ctx = {\n value: deepClone(origValue),\n primKey: keys[offset + i]\n };\n if (modifyer.call(ctx, ctx.value, ctx) !== false) {\n if (ctx.value == null) {\n deleteKeys.push(keys[offset + i]);\n } else if (!outbound && cmp(extractKey(origValue), extractKey(ctx.value)) !== 0) {\n deleteKeys.push(keys[offset + i]);\n addValues.push(ctx.value);\n } else {\n putValues.push(ctx.value);\n if (outbound) putKeys.push(keys[offset + i]);\n }\n }\n }\n const criteria = isPlainKeyRange(ctx) && ctx.limit === Infinity && (typeof changes !== 'function' || changes === deleteCallback) && {\n index: ctx.index,\n range: ctx.range\n };\n return Promise.resolve(addValues.length > 0 && coreTable.mutate({\n trans,\n type: 'add',\n values: addValues\n }).then(res => {\n for (let pos in res.failures) {\n deleteKeys.splice(parseInt(pos), 1);\n }\n applyMutateResult(addValues.length, res);\n })).then(() => (putValues.length > 0 || criteria && typeof changes === 'object') && coreTable.mutate({\n trans,\n type: 'put',\n keys: putKeys,\n values: putValues,\n criteria,\n changeSpec: typeof changes !== 'function' && changes\n }).then(res => applyMutateResult(putValues.length, res))).then(() => (deleteKeys.length > 0 || criteria && changes === deleteCallback) && coreTable.mutate({\n trans,\n type: 'delete',\n keys: deleteKeys,\n criteria\n }).then(res => applyMutateResult(deleteKeys.length, res))).then(() => {\n return keys.length > offset + count && nextChunk(offset + limit);\n });\n });\n };\n return nextChunk(0).then(() => {\n if (totalFailures.length > 0) throw new ModifyError(\"Error modifying one or more objects\", totalFailures, successCount, failedKeys);\n return keys.length;\n });\n });\n });\n }\n delete() {\n var ctx = this._ctx,\n range = ctx.range;\n if (isPlainKeyRange(ctx) && (ctx.isPrimKey && !hangsOnDeleteLargeKeyRange || range.type === 3)) {\n return this._write(trans => {\n const {\n primaryKey\n } = ctx.table.core.schema;\n const coreRange = range;\n return ctx.table.core.count({\n trans,\n query: {\n index: primaryKey,\n range: coreRange\n }\n }).then(count => {\n return ctx.table.core.mutate({\n trans,\n type: 'deleteRange',\n range: coreRange\n }).then(({\n failures,\n lastResult,\n results,\n numFailures\n }) => {\n if (numFailures) throw new ModifyError(\"Could not delete some values\", Object.keys(failures).map(pos => failures[pos]), count - numFailures);\n return count - numFailures;\n });\n });\n });\n }\n return this.modify(deleteCallback);\n }\n}\nconst deleteCallback = (value, ctx) => ctx.value = null;\nfunction createCollectionConstructor(db) {\n return makeClassConstructor(Collection.prototype, function Collection(whereClause, keyRangeGenerator) {\n this.db = db;\n let keyRange = AnyRange,\n error = null;\n if (keyRangeGenerator) try {\n keyRange = keyRangeGenerator();\n } catch (ex) {\n error = ex;\n }\n const whereCtx = whereClause._ctx;\n const table = whereCtx.table;\n const readingHook = table.hook.reading.fire;\n this._ctx = {\n table: table,\n index: whereCtx.index,\n isPrimKey: !whereCtx.index || table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name,\n range: keyRange,\n keysOnly: false,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: true,\n isMatch: null,\n offset: 0,\n limit: Infinity,\n error: error,\n or: whereCtx.or,\n valueMapper: readingHook !== mirror ? readingHook : null\n };\n });\n}\nfunction simpleCompare(a, b) {\n return a < b ? -1 : a === b ? 0 : 1;\n}\nfunction simpleCompareReverse(a, b) {\n return a > b ? -1 : a === b ? 0 : 1;\n}\nfunction fail(collectionOrWhereClause, err, T) {\n var collection = collectionOrWhereClause instanceof WhereClause ? new collectionOrWhereClause.Collection(collectionOrWhereClause) : collectionOrWhereClause;\n collection._ctx.error = T ? new T(err) : new TypeError(err);\n return collection;\n}\nfunction emptyCollection(whereClause) {\n return new whereClause.Collection(whereClause, () => rangeEqual(\"\")).limit(0);\n}\nfunction upperFactory(dir) {\n return dir === \"next\" ? s => s.toUpperCase() : s => s.toLowerCase();\n}\nfunction lowerFactory(dir) {\n return dir === \"next\" ? s => s.toLowerCase() : s => s.toUpperCase();\n}\nfunction nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {\n var length = Math.min(key.length, lowerNeedle.length);\n var llp = -1;\n for (var i = 0; i < length; ++i) {\n var lwrKeyChar = lowerKey[i];\n if (lwrKeyChar !== lowerNeedle[i]) {\n if (cmp(key[i], upperNeedle[i]) < 0) return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);\n if (cmp(key[i], lowerNeedle[i]) < 0) return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);\n if (llp >= 0) return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);\n return null;\n }\n if (cmp(key[i], lwrKeyChar) < 0) llp = i;\n }\n if (length < lowerNeedle.length && dir === \"next\") return key + upperNeedle.substr(key.length);\n if (length < key.length && dir === \"prev\") return key.substr(0, upperNeedle.length);\n return llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1);\n}\nfunction addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {\n var upper,\n lower,\n compare,\n upperNeedles,\n lowerNeedles,\n direction,\n nextKeySuffix,\n needlesLen = needles.length;\n if (!needles.every(s => typeof s === 'string')) {\n return fail(whereClause, STRING_EXPECTED);\n }\n function initDirection(dir) {\n upper = upperFactory(dir);\n lower = lowerFactory(dir);\n compare = dir === \"next\" ? simpleCompare : simpleCompareReverse;\n var needleBounds = needles.map(function (needle) {\n return {\n lower: lower(needle),\n upper: upper(needle)\n };\n }).sort(function (a, b) {\n return compare(a.lower, b.lower);\n });\n upperNeedles = needleBounds.map(function (nb) {\n return nb.upper;\n });\n lowerNeedles = needleBounds.map(function (nb) {\n return nb.lower;\n });\n direction = dir;\n nextKeySuffix = dir === \"next\" ? \"\" : suffix;\n }\n initDirection(\"next\");\n var c = new whereClause.Collection(whereClause, () => createRange(upperNeedles[0], lowerNeedles[needlesLen - 1] + suffix));\n c._ondirectionchange = function (direction) {\n initDirection(direction);\n };\n var firstPossibleNeedle = 0;\n c._addAlgorithm(function (cursor, advance, resolve) {\n var key = cursor.key;\n if (typeof key !== 'string') return false;\n var lowerKey = lower(key);\n if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {\n return true;\n } else {\n var lowestPossibleCasing = null;\n for (var i = firstPossibleNeedle; i < needlesLen; ++i) {\n var casing = nextCasing(key, lowerKey, upperNeedles[i], lowerNeedles[i], compare, direction);\n if (casing === null && lowestPossibleCasing === null) firstPossibleNeedle = i + 1;else if (lowestPossibleCasing === null || compare(lowestPossibleCasing, casing) > 0) {\n lowestPossibleCasing = casing;\n }\n }\n if (lowestPossibleCasing !== null) {\n advance(function () {\n cursor.continue(lowestPossibleCasing + nextKeySuffix);\n });\n } else {\n advance(resolve);\n }\n return false;\n }\n });\n return c;\n}\nfunction createRange(lower, upper, lowerOpen, upperOpen) {\n return {\n type: 2,\n lower,\n upper,\n lowerOpen,\n upperOpen\n };\n}\nfunction rangeEqual(value) {\n return {\n type: 1,\n lower: value,\n upper: value\n };\n}\nclass WhereClause {\n get Collection() {\n return this._ctx.table.db.Collection;\n }\n between(lower, upper, includeLower, includeUpper) {\n includeLower = includeLower !== false;\n includeUpper = includeUpper === true;\n try {\n if (this._cmp(lower, upper) > 0 || this._cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)) return emptyCollection(this);\n return new this.Collection(this, () => createRange(lower, upper, !includeLower, !includeUpper));\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n }\n equals(value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => rangeEqual(value));\n }\n above(value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(value, undefined, true));\n }\n aboveOrEqual(value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(value, undefined, false));\n }\n below(value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(undefined, value, false, true));\n }\n belowOrEqual(value) {\n if (value == null) return fail(this, INVALID_KEY_ARGUMENT);\n return new this.Collection(this, () => createRange(undefined, value));\n }\n startsWith(str) {\n if (typeof str !== 'string') return fail(this, STRING_EXPECTED);\n return this.between(str, str + maxString, true, true);\n }\n startsWithIgnoreCase(str) {\n if (str === \"\") return this.startsWith(str);\n return addIgnoreCaseAlgorithm(this, (x, a) => x.indexOf(a[0]) === 0, [str], maxString);\n }\n equalsIgnoreCase(str) {\n return addIgnoreCaseAlgorithm(this, (x, a) => x === a[0], [str], \"\");\n }\n anyOfIgnoreCase() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, (x, a) => a.indexOf(x) !== -1, set, \"\");\n }\n startsWithAnyOfIgnoreCase() {\n var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return emptyCollection(this);\n return addIgnoreCaseAlgorithm(this, (x, a) => a.some(n => x.indexOf(n) === 0), set, maxString);\n }\n anyOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n let compare = this._cmp;\n try {\n set.sort(compare);\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n if (set.length === 0) return emptyCollection(this);\n const c = new this.Collection(this, () => createRange(set[0], set[set.length - 1]));\n c._ondirectionchange = direction => {\n compare = direction === \"next\" ? this._ascending : this._descending;\n set.sort(compare);\n };\n let i = 0;\n c._addAlgorithm((cursor, advance, resolve) => {\n const key = cursor.key;\n while (compare(key, set[i]) > 0) {\n ++i;\n if (i === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (compare(key, set[i]) === 0) {\n return true;\n } else {\n advance(() => {\n cursor.continue(set[i]);\n });\n return false;\n }\n });\n return c;\n }\n notEqual(value) {\n return this.inAnyRange([[minKey, value], [value, this.db._maxKey]], {\n includeLowers: false,\n includeUppers: false\n });\n }\n noneOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (set.length === 0) return new this.Collection(this);\n try {\n set.sort(this._ascending);\n } catch (e) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n const ranges = set.reduce((res, val) => res ? res.concat([[res[res.length - 1][1], val]]) : [[minKey, val]], null);\n ranges.push([set[set.length - 1], this.db._maxKey]);\n return this.inAnyRange(ranges, {\n includeLowers: false,\n includeUppers: false\n });\n }\n inAnyRange(ranges, options) {\n const cmp = this._cmp,\n ascending = this._ascending,\n descending = this._descending,\n min = this._min,\n max = this._max;\n if (ranges.length === 0) return emptyCollection(this);\n if (!ranges.every(range => range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0)) {\n return fail(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", exceptions.InvalidArgument);\n }\n const includeLowers = !options || options.includeLowers !== false;\n const includeUppers = options && options.includeUppers === true;\n function addRange(ranges, newRange) {\n let i = 0,\n l = ranges.length;\n for (; i < l; ++i) {\n const range = ranges[i];\n if (cmp(newRange[0], range[1]) < 0 && cmp(newRange[1], range[0]) > 0) {\n range[0] = min(range[0], newRange[0]);\n range[1] = max(range[1], newRange[1]);\n break;\n }\n }\n if (i === l) ranges.push(newRange);\n return ranges;\n }\n let sortDirection = ascending;\n function rangeSorter(a, b) {\n return sortDirection(a[0], b[0]);\n }\n let set;\n try {\n set = ranges.reduce(addRange, []);\n set.sort(rangeSorter);\n } catch (ex) {\n return fail(this, INVALID_KEY_ARGUMENT);\n }\n let rangePos = 0;\n const keyIsBeyondCurrentEntry = includeUppers ? key => ascending(key, set[rangePos][1]) > 0 : key => ascending(key, set[rangePos][1]) >= 0;\n const keyIsBeforeCurrentEntry = includeLowers ? key => descending(key, set[rangePos][0]) > 0 : key => descending(key, set[rangePos][0]) >= 0;\n function keyWithinCurrentRange(key) {\n return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);\n }\n let checkKey = keyIsBeyondCurrentEntry;\n const c = new this.Collection(this, () => createRange(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers));\n c._ondirectionchange = direction => {\n if (direction === \"next\") {\n checkKey = keyIsBeyondCurrentEntry;\n sortDirection = ascending;\n } else {\n checkKey = keyIsBeforeCurrentEntry;\n sortDirection = descending;\n }\n set.sort(rangeSorter);\n };\n c._addAlgorithm((cursor, advance, resolve) => {\n var key = cursor.key;\n while (checkKey(key)) {\n ++rangePos;\n if (rangePos === set.length) {\n advance(resolve);\n return false;\n }\n }\n if (keyWithinCurrentRange(key)) {\n return true;\n } else if (this._cmp(key, set[rangePos][1]) === 0 || this._cmp(key, set[rangePos][0]) === 0) {\n return false;\n } else {\n advance(() => {\n if (sortDirection === ascending) cursor.continue(set[rangePos][0]);else cursor.continue(set[rangePos][1]);\n });\n return false;\n }\n });\n return c;\n }\n startsWithAnyOf() {\n const set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);\n if (!set.every(s => typeof s === 'string')) {\n return fail(this, \"startsWithAnyOf() only works with strings\");\n }\n if (set.length === 0) return emptyCollection(this);\n return this.inAnyRange(set.map(str => [str, str + maxString]));\n }\n}\nfunction createWhereClauseConstructor(db) {\n return makeClassConstructor(WhereClause.prototype, function WhereClause(table, index, orCollection) {\n this.db = db;\n this._ctx = {\n table: table,\n index: index === \":id\" ? null : index,\n or: orCollection\n };\n const indexedDB = db._deps.indexedDB;\n if (!indexedDB) throw new exceptions.MissingAPI();\n this._cmp = this._ascending = indexedDB.cmp.bind(indexedDB);\n this._descending = (a, b) => indexedDB.cmp(b, a);\n this._max = (a, b) => indexedDB.cmp(a, b) > 0 ? a : b;\n this._min = (a, b) => indexedDB.cmp(a, b) < 0 ? a : b;\n this._IDBKeyRange = db._deps.IDBKeyRange;\n });\n}\nfunction eventRejectHandler(reject) {\n return wrap(function (event) {\n preventDefault(event);\n reject(event.target.error);\n return false;\n });\n}\nfunction preventDefault(event) {\n if (event.stopPropagation) event.stopPropagation();\n if (event.preventDefault) event.preventDefault();\n}\nconst DEXIE_STORAGE_MUTATED_EVENT_NAME = 'storagemutated';\nconst STORAGE_MUTATED_DOM_EVENT_NAME = 'x-storagemutated-1';\nconst globalEvents = Events(null, DEXIE_STORAGE_MUTATED_EVENT_NAME);\nclass Transaction {\n _lock() {\n assert(!PSD.global);\n ++this._reculock;\n if (this._reculock === 1 && !PSD.global) PSD.lockOwnerFor = this;\n return this;\n }\n _unlock() {\n assert(!PSD.global);\n if (--this._reculock === 0) {\n if (!PSD.global) PSD.lockOwnerFor = null;\n while (this._blockedFuncs.length > 0 && !this._locked()) {\n var fnAndPSD = this._blockedFuncs.shift();\n try {\n usePSD(fnAndPSD[1], fnAndPSD[0]);\n } catch (e) {}\n }\n }\n return this;\n }\n _locked() {\n return this._reculock && PSD.lockOwnerFor !== this;\n }\n create(idbtrans) {\n if (!this.mode) return this;\n const idbdb = this.db.idbdb;\n const dbOpenError = this.db._state.dbOpenError;\n assert(!this.idbtrans);\n if (!idbtrans && !idbdb) {\n switch (dbOpenError && dbOpenError.name) {\n case \"DatabaseClosedError\":\n throw new exceptions.DatabaseClosed(dbOpenError);\n case \"MissingAPIError\":\n throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);\n default:\n throw new exceptions.OpenFailed(dbOpenError);\n }\n }\n if (!this.active) throw new exceptions.TransactionInactive();\n assert(this._completion._state === null);\n idbtrans = this.idbtrans = idbtrans || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }) : idbdb.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }));\n idbtrans.onerror = wrap(ev => {\n preventDefault(ev);\n this._reject(idbtrans.error);\n });\n idbtrans.onabort = wrap(ev => {\n preventDefault(ev);\n this.active && this._reject(new exceptions.Abort(idbtrans.error));\n this.active = false;\n this.on(\"abort\").fire(ev);\n });\n idbtrans.oncomplete = wrap(() => {\n this.active = false;\n this._resolve();\n if ('mutatedParts' in idbtrans) {\n globalEvents.storagemutated.fire(idbtrans[\"mutatedParts\"]);\n }\n });\n return this;\n }\n _promise(mode, fn, bWriteLock) {\n if (mode === 'readwrite' && this.mode !== 'readwrite') return rejection(new exceptions.ReadOnly(\"Transaction is readonly\"));\n if (!this.active) return rejection(new exceptions.TransactionInactive());\n if (this._locked()) {\n return new DexiePromise((resolve, reject) => {\n this._blockedFuncs.push([() => {\n this._promise(mode, fn, bWriteLock).then(resolve, reject);\n }, PSD]);\n });\n } else if (bWriteLock) {\n return newScope(() => {\n var p = new DexiePromise((resolve, reject) => {\n this._lock();\n const rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p.finally(() => this._unlock());\n p._lib = true;\n return p;\n });\n } else {\n var p = new DexiePromise((resolve, reject) => {\n var rv = fn(resolve, reject, this);\n if (rv && rv.then) rv.then(resolve, reject);\n });\n p._lib = true;\n return p;\n }\n }\n _root() {\n return this.parent ? this.parent._root() : this;\n }\n waitFor(promiseLike) {\n var root = this._root();\n const promise = DexiePromise.resolve(promiseLike);\n if (root._waitingFor) {\n root._waitingFor = root._waitingFor.then(() => promise);\n } else {\n root._waitingFor = promise;\n root._waitingQueue = [];\n var store = root.idbtrans.objectStore(root.storeNames[0]);\n (function spin() {\n ++root._spinCount;\n while (root._waitingQueue.length) root._waitingQueue.shift()();\n if (root._waitingFor) store.get(-Infinity).onsuccess = spin;\n })();\n }\n var currentWaitPromise = root._waitingFor;\n return new DexiePromise((resolve, reject) => {\n promise.then(res => root._waitingQueue.push(wrap(resolve.bind(null, res))), err => root._waitingQueue.push(wrap(reject.bind(null, err)))).finally(() => {\n if (root._waitingFor === currentWaitPromise) {\n root._waitingFor = null;\n }\n });\n });\n }\n abort() {\n if (this.active) {\n this.active = false;\n if (this.idbtrans) this.idbtrans.abort();\n this._reject(new exceptions.Abort());\n }\n }\n table(tableName) {\n const memoizedTables = this._memoizedTables || (this._memoizedTables = {});\n if (hasOwn(memoizedTables, tableName)) return memoizedTables[tableName];\n const tableSchema = this.schema[tableName];\n if (!tableSchema) {\n throw new exceptions.NotFound(\"Table \" + tableName + \" not part of transaction\");\n }\n const transactionBoundTable = new this.db.Table(tableName, tableSchema, this);\n transactionBoundTable.core = this.db.core.table(tableName);\n memoizedTables[tableName] = transactionBoundTable;\n return transactionBoundTable;\n }\n}\nfunction createTransactionConstructor(db) {\n return makeClassConstructor(Transaction.prototype, function Transaction(mode, storeNames, dbschema, chromeTransactionDurability, parent) {\n this.db = db;\n this.mode = mode;\n this.storeNames = storeNames;\n this.schema = dbschema;\n this.chromeTransactionDurability = chromeTransactionDurability;\n this.idbtrans = null;\n this.on = Events(this, \"complete\", \"error\", \"abort\");\n this.parent = parent || null;\n this.active = true;\n this._reculock = 0;\n this._blockedFuncs = [];\n this._resolve = null;\n this._reject = null;\n this._waitingFor = null;\n this._waitingQueue = null;\n this._spinCount = 0;\n this._completion = new DexiePromise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n this._completion.then(() => {\n this.active = false;\n this.on.complete.fire();\n }, e => {\n var wasActive = this.active;\n this.active = false;\n this.on.error.fire(e);\n this.parent ? this.parent._reject(e) : wasActive && this.idbtrans && this.idbtrans.abort();\n return rejection(e);\n });\n });\n}\nfunction createIndexSpec(name, keyPath, unique, multi, auto, compound, isPrimKey) {\n return {\n name,\n keyPath,\n unique,\n multi,\n auto,\n compound,\n src: (unique && !isPrimKey ? '&' : '') + (multi ? '*' : '') + (auto ? \"++\" : \"\") + nameFromKeyPath(keyPath)\n };\n}\nfunction nameFromKeyPath(keyPath) {\n return typeof keyPath === 'string' ? keyPath : keyPath ? '[' + [].join.call(keyPath, '+') + ']' : \"\";\n}\nfunction createTableSchema(name, primKey, indexes) {\n return {\n name,\n primKey,\n indexes,\n mappedClass: null,\n idxByName: arrayToObject(indexes, index => [index.name, index])\n };\n}\nfunction safariMultiStoreFix(storeNames) {\n return storeNames.length === 1 ? storeNames[0] : storeNames;\n}\nlet getMaxKey = IdbKeyRange => {\n try {\n IdbKeyRange.only([[]]);\n getMaxKey = () => [[]];\n return [[]];\n } catch (e) {\n getMaxKey = () => maxString;\n return maxString;\n }\n};\nfunction getKeyExtractor(keyPath) {\n if (keyPath == null) {\n return () => undefined;\n } else if (typeof keyPath === 'string') {\n return getSinglePathKeyExtractor(keyPath);\n } else {\n return obj => getByKeyPath(obj, keyPath);\n }\n}\nfunction getSinglePathKeyExtractor(keyPath) {\n const split = keyPath.split('.');\n if (split.length === 1) {\n return obj => obj[keyPath];\n } else {\n return obj => getByKeyPath(obj, keyPath);\n }\n}\nfunction arrayify(arrayLike) {\n return [].slice.call(arrayLike);\n}\nlet _id_counter = 0;\nfunction getKeyPathAlias(keyPath) {\n return keyPath == null ? \":id\" : typeof keyPath === 'string' ? keyPath : `[${keyPath.join('+')}]`;\n}\nfunction createDBCore(db, IdbKeyRange, tmpTrans) {\n function extractSchema(db, trans) {\n const tables = arrayify(db.objectStoreNames);\n return {\n schema: {\n name: db.name,\n tables: tables.map(table => trans.objectStore(table)).map(store => {\n const {\n keyPath,\n autoIncrement\n } = store;\n const compound = isArray(keyPath);\n const outbound = keyPath == null;\n const indexByKeyPath = {};\n const result = {\n name: store.name,\n primaryKey: {\n name: null,\n isPrimaryKey: true,\n outbound,\n compound,\n keyPath,\n autoIncrement,\n unique: true,\n extractKey: getKeyExtractor(keyPath)\n },\n indexes: arrayify(store.indexNames).map(indexName => store.index(indexName)).map(index => {\n const {\n name,\n unique,\n multiEntry,\n keyPath\n } = index;\n const compound = isArray(keyPath);\n const result = {\n name,\n compound,\n keyPath,\n unique,\n multiEntry,\n extractKey: getKeyExtractor(keyPath)\n };\n indexByKeyPath[getKeyPathAlias(keyPath)] = result;\n return result;\n }),\n getIndexByKeyPath: keyPath => indexByKeyPath[getKeyPathAlias(keyPath)]\n };\n indexByKeyPath[\":id\"] = result.primaryKey;\n if (keyPath != null) {\n indexByKeyPath[getKeyPathAlias(keyPath)] = result.primaryKey;\n }\n return result;\n })\n },\n hasGetAll: tables.length > 0 && 'getAll' in trans.objectStore(tables[0]) && !(typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n };\n }\n function makeIDBKeyRange(range) {\n if (range.type === 3) return null;\n if (range.type === 4) throw new Error(\"Cannot convert never type to IDBKeyRange\");\n const {\n lower,\n upper,\n lowerOpen,\n upperOpen\n } = range;\n const idbRange = lower === undefined ? upper === undefined ? null : IdbKeyRange.upperBound(upper, !!upperOpen) : upper === undefined ? IdbKeyRange.lowerBound(lower, !!lowerOpen) : IdbKeyRange.bound(lower, upper, !!lowerOpen, !!upperOpen);\n return idbRange;\n }\n function createDbCoreTable(tableSchema) {\n const tableName = tableSchema.name;\n function mutate({\n trans,\n type,\n keys,\n values,\n range\n }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const outbound = store.keyPath == null;\n const isAddOrPut = type === \"put\" || type === \"add\";\n if (!isAddOrPut && type !== 'delete' && type !== 'deleteRange') throw new Error(\"Invalid operation type: \" + type);\n const {\n length\n } = keys || values || {\n length: 1\n };\n if (keys && values && keys.length !== values.length) {\n throw new Error(\"Given keys array must have same length as given values array.\");\n }\n if (length === 0) return resolve({\n numFailures: 0,\n failures: {},\n results: [],\n lastResult: undefined\n });\n let req;\n const reqs = [];\n const failures = [];\n let numFailures = 0;\n const errorHandler = event => {\n ++numFailures;\n preventDefault(event);\n };\n if (type === 'deleteRange') {\n if (range.type === 4) return resolve({\n numFailures,\n failures,\n results: [],\n lastResult: undefined\n });\n if (range.type === 3) reqs.push(req = store.clear());else reqs.push(req = store.delete(makeIDBKeyRange(range)));\n } else {\n const [args1, args2] = isAddOrPut ? outbound ? [values, keys] : [values, null] : [keys, null];\n if (isAddOrPut) {\n for (let i = 0; i < length; ++i) {\n reqs.push(req = args2 && args2[i] !== undefined ? store[type](args1[i], args2[i]) : store[type](args1[i]));\n req.onerror = errorHandler;\n }\n } else {\n for (let i = 0; i < length; ++i) {\n reqs.push(req = store[type](args1[i]));\n req.onerror = errorHandler;\n }\n }\n }\n const done = event => {\n const lastResult = event.target.result;\n reqs.forEach((req, i) => req.error != null && (failures[i] = req.error));\n resolve({\n numFailures,\n failures,\n results: type === \"delete\" ? keys : reqs.map(req => req.result),\n lastResult\n });\n };\n req.onerror = event => {\n errorHandler(event);\n done(event);\n };\n req.onsuccess = done;\n });\n }\n function openCursor({\n trans,\n values,\n query,\n reverse,\n unique\n }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const {\n index,\n range\n } = query;\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ? store : store.index(index.name);\n const direction = reverse ? unique ? \"prevunique\" : \"prev\" : unique ? \"nextunique\" : \"next\";\n const req = values || !('openKeyCursor' in source) ? source.openCursor(makeIDBKeyRange(range), direction) : source.openKeyCursor(makeIDBKeyRange(range), direction);\n req.onerror = eventRejectHandler(reject);\n req.onsuccess = wrap(ev => {\n const cursor = req.result;\n if (!cursor) {\n resolve(null);\n return;\n }\n cursor.___id = ++_id_counter;\n cursor.done = false;\n const _cursorContinue = cursor.continue.bind(cursor);\n let _cursorContinuePrimaryKey = cursor.continuePrimaryKey;\n if (_cursorContinuePrimaryKey) _cursorContinuePrimaryKey = _cursorContinuePrimaryKey.bind(cursor);\n const _cursorAdvance = cursor.advance.bind(cursor);\n const doThrowCursorIsNotStarted = () => {\n throw new Error(\"Cursor not started\");\n };\n const doThrowCursorIsStopped = () => {\n throw new Error(\"Cursor not stopped\");\n };\n cursor.trans = trans;\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsNotStarted;\n cursor.fail = wrap(reject);\n cursor.next = function () {\n let gotOne = 1;\n return this.start(() => gotOne-- ? this.continue() : this.stop()).then(() => this);\n };\n cursor.start = callback => {\n const iterationPromise = new Promise((resolveIteration, rejectIteration) => {\n resolveIteration = wrap(resolveIteration);\n req.onerror = eventRejectHandler(rejectIteration);\n cursor.fail = rejectIteration;\n cursor.stop = value => {\n cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsStopped;\n resolveIteration(value);\n };\n });\n const guardedCallback = () => {\n if (req.result) {\n try {\n callback();\n } catch (err) {\n cursor.fail(err);\n }\n } else {\n cursor.done = true;\n cursor.start = () => {\n throw new Error(\"Cursor behind last entry\");\n };\n cursor.stop();\n }\n };\n req.onsuccess = wrap(ev => {\n req.onsuccess = guardedCallback;\n guardedCallback();\n });\n cursor.continue = _cursorContinue;\n cursor.continuePrimaryKey = _cursorContinuePrimaryKey;\n cursor.advance = _cursorAdvance;\n guardedCallback();\n return iterationPromise;\n };\n resolve(cursor);\n }, reject);\n });\n }\n function query(hasGetAll) {\n return request => {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const {\n trans,\n values,\n limit,\n query\n } = request;\n const nonInfinitLimit = limit === Infinity ? undefined : limit;\n const {\n index,\n range\n } = query;\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ? store : store.index(index.name);\n const idbKeyRange = makeIDBKeyRange(range);\n if (limit === 0) return resolve({\n result: []\n });\n if (hasGetAll) {\n const req = values ? source.getAll(idbKeyRange, nonInfinitLimit) : source.getAllKeys(idbKeyRange, nonInfinitLimit);\n req.onsuccess = event => resolve({\n result: event.target.result\n });\n req.onerror = eventRejectHandler(reject);\n } else {\n let count = 0;\n const req = values || !('openKeyCursor' in source) ? source.openCursor(idbKeyRange) : source.openKeyCursor(idbKeyRange);\n const result = [];\n req.onsuccess = event => {\n const cursor = req.result;\n if (!cursor) return resolve({\n result\n });\n result.push(values ? cursor.value : cursor.primaryKey);\n if (++count === limit) return resolve({\n result\n });\n cursor.continue();\n };\n req.onerror = eventRejectHandler(reject);\n }\n });\n };\n }\n return {\n name: tableName,\n schema: tableSchema,\n mutate,\n getMany({\n trans,\n keys\n }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const length = keys.length;\n const result = new Array(length);\n let keyCount = 0;\n let callbackCount = 0;\n let req;\n const successHandler = event => {\n const req = event.target;\n if ((result[req._pos] = req.result) != null) ;\n if (++callbackCount === keyCount) resolve(result);\n };\n const errorHandler = eventRejectHandler(reject);\n for (let i = 0; i < length; ++i) {\n const key = keys[i];\n if (key != null) {\n req = store.get(keys[i]);\n req._pos = i;\n req.onsuccess = successHandler;\n req.onerror = errorHandler;\n ++keyCount;\n }\n }\n if (keyCount === 0) resolve(result);\n });\n },\n get({\n trans,\n key\n }) {\n return new Promise((resolve, reject) => {\n resolve = wrap(resolve);\n const store = trans.objectStore(tableName);\n const req = store.get(key);\n req.onsuccess = event => resolve(event.target.result);\n req.onerror = eventRejectHandler(reject);\n });\n },\n query: query(hasGetAll),\n openCursor,\n count({\n query,\n trans\n }) {\n const {\n index,\n range\n } = query;\n return new Promise((resolve, reject) => {\n const store = trans.objectStore(tableName);\n const source = index.isPrimaryKey ? store : store.index(index.name);\n const idbKeyRange = makeIDBKeyRange(range);\n const req = idbKeyRange ? source.count(idbKeyRange) : source.count();\n req.onsuccess = wrap(ev => resolve(ev.target.result));\n req.onerror = eventRejectHandler(reject);\n });\n }\n };\n }\n const {\n schema,\n hasGetAll\n } = extractSchema(db, tmpTrans);\n const tables = schema.tables.map(tableSchema => createDbCoreTable(tableSchema));\n const tableMap = {};\n tables.forEach(table => tableMap[table.name] = table);\n return {\n stack: \"dbcore\",\n transaction: db.transaction.bind(db),\n table(name) {\n const result = tableMap[name];\n if (!result) throw new Error(`Table '${name}' not found`);\n return tableMap[name];\n },\n MIN_KEY: -Infinity,\n MAX_KEY: getMaxKey(IdbKeyRange),\n schema\n };\n}\nfunction createMiddlewareStack(stackImpl, middlewares) {\n return middlewares.reduce((down, {\n create\n }) => ({\n ...down,\n ...create(down)\n }), stackImpl);\n}\nfunction createMiddlewareStacks(middlewares, idbdb, {\n IDBKeyRange,\n indexedDB\n}, tmpTrans) {\n const dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);\n return {\n dbcore\n };\n}\nfunction generateMiddlewareStacks({\n _novip: db\n}, tmpTrans) {\n const idbdb = tmpTrans.db;\n const stacks = createMiddlewareStacks(db._middlewares, idbdb, db._deps, tmpTrans);\n db.core = stacks.dbcore;\n db.tables.forEach(table => {\n const tableName = table.name;\n if (db.core.schema.tables.some(tbl => tbl.name === tableName)) {\n table.core = db.core.table(tableName);\n if (db[tableName] instanceof db.Table) {\n db[tableName].core = table.core;\n }\n }\n });\n}\nfunction setApiOnPlace({\n _novip: db\n}, objs, tableNames, dbschema) {\n tableNames.forEach(tableName => {\n const schema = dbschema[tableName];\n objs.forEach(obj => {\n const propDesc = getPropertyDescriptor(obj, tableName);\n if (!propDesc || \"value\" in propDesc && propDesc.value === undefined) {\n if (obj === db.Transaction.prototype || obj instanceof db.Transaction) {\n setProp(obj, tableName, {\n get() {\n return this.table(tableName);\n },\n set(value) {\n defineProperty(this, tableName, {\n value,\n writable: true,\n configurable: true,\n enumerable: true\n });\n }\n });\n } else {\n obj[tableName] = new db.Table(tableName, schema);\n }\n }\n });\n });\n}\nfunction removeTablesApi({\n _novip: db\n}, objs) {\n objs.forEach(obj => {\n for (let key in obj) {\n if (obj[key] instanceof db.Table) delete obj[key];\n }\n });\n}\nfunction lowerVersionFirst(a, b) {\n return a._cfg.version - b._cfg.version;\n}\nfunction runUpgraders(db, oldVersion, idbUpgradeTrans, reject) {\n const globalSchema = db._dbSchema;\n const trans = db._createTransaction('readwrite', db._storeNames, globalSchema);\n trans.create(idbUpgradeTrans);\n trans._completion.catch(reject);\n const rejectTransaction = trans._reject.bind(trans);\n const transless = PSD.transless || PSD;\n newScope(() => {\n PSD.trans = trans;\n PSD.transless = transless;\n if (oldVersion === 0) {\n keys(globalSchema).forEach(tableName => {\n createTable(idbUpgradeTrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);\n });\n generateMiddlewareStacks(db, idbUpgradeTrans);\n DexiePromise.follow(() => db.on.populate.fire(trans)).catch(rejectTransaction);\n } else updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans).catch(rejectTransaction);\n });\n}\nfunction updateTablesAndIndexes({\n _novip: db\n}, oldVersion, trans, idbUpgradeTrans) {\n const queue = [];\n const versions = db._versions;\n let globalSchema = db._dbSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);\n let anyContentUpgraderHasRun = false;\n const versToRun = versions.filter(v => v._cfg.version >= oldVersion);\n versToRun.forEach(version => {\n queue.push(() => {\n const oldSchema = globalSchema;\n const newSchema = version._cfg.dbschema;\n adjustToExistingIndexNames(db, oldSchema, idbUpgradeTrans);\n adjustToExistingIndexNames(db, newSchema, idbUpgradeTrans);\n globalSchema = db._dbSchema = newSchema;\n const diff = getSchemaDiff(oldSchema, newSchema);\n diff.add.forEach(tuple => {\n createTable(idbUpgradeTrans, tuple[0], tuple[1].primKey, tuple[1].indexes);\n });\n diff.change.forEach(change => {\n if (change.recreate) {\n throw new exceptions.Upgrade(\"Not yet support for changing primary key\");\n } else {\n const store = idbUpgradeTrans.objectStore(change.name);\n change.add.forEach(idx => addIndex(store, idx));\n change.change.forEach(idx => {\n store.deleteIndex(idx.name);\n addIndex(store, idx);\n });\n change.del.forEach(idxName => store.deleteIndex(idxName));\n }\n });\n const contentUpgrade = version._cfg.contentUpgrade;\n if (contentUpgrade && version._cfg.version > oldVersion) {\n generateMiddlewareStacks(db, idbUpgradeTrans);\n trans._memoizedTables = {};\n anyContentUpgraderHasRun = true;\n let upgradeSchema = shallowClone(newSchema);\n diff.del.forEach(table => {\n upgradeSchema[table] = oldSchema[table];\n });\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], keys(upgradeSchema), upgradeSchema);\n trans.schema = upgradeSchema;\n const contentUpgradeIsAsync = isAsyncFunction(contentUpgrade);\n if (contentUpgradeIsAsync) {\n incrementExpectedAwaits();\n }\n let returnValue;\n const promiseFollowed = DexiePromise.follow(() => {\n returnValue = contentUpgrade(trans);\n if (returnValue) {\n if (contentUpgradeIsAsync) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n }\n }\n });\n return returnValue && typeof returnValue.then === 'function' ? DexiePromise.resolve(returnValue) : promiseFollowed.then(() => returnValue);\n }\n });\n queue.push(idbtrans => {\n if (!anyContentUpgraderHasRun || !hasIEDeleteObjectStoreBug) {\n const newSchema = version._cfg.dbschema;\n deleteRemovedTables(newSchema, idbtrans);\n }\n removeTablesApi(db, [db.Transaction.prototype]);\n setApiOnPlace(db, [db.Transaction.prototype], db._storeNames, db._dbSchema);\n trans.schema = db._dbSchema;\n });\n });\n function runQueue() {\n return queue.length ? DexiePromise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) : DexiePromise.resolve();\n }\n return runQueue().then(() => {\n createMissingTables(globalSchema, idbUpgradeTrans);\n });\n}\nfunction getSchemaDiff(oldSchema, newSchema) {\n const diff = {\n del: [],\n add: [],\n change: []\n };\n let table;\n for (table in oldSchema) {\n if (!newSchema[table]) diff.del.push(table);\n }\n for (table in newSchema) {\n const oldDef = oldSchema[table],\n newDef = newSchema[table];\n if (!oldDef) {\n diff.add.push([table, newDef]);\n } else {\n const change = {\n name: table,\n def: newDef,\n recreate: false,\n del: [],\n add: [],\n change: []\n };\n if ('' + (oldDef.primKey.keyPath || '') !== '' + (newDef.primKey.keyPath || '') || oldDef.primKey.auto !== newDef.primKey.auto && !isIEOrEdge) {\n change.recreate = true;\n diff.change.push(change);\n } else {\n const oldIndexes = oldDef.idxByName;\n const newIndexes = newDef.idxByName;\n let idxName;\n for (idxName in oldIndexes) {\n if (!newIndexes[idxName]) change.del.push(idxName);\n }\n for (idxName in newIndexes) {\n const oldIdx = oldIndexes[idxName],\n newIdx = newIndexes[idxName];\n if (!oldIdx) change.add.push(newIdx);else if (oldIdx.src !== newIdx.src) change.change.push(newIdx);\n }\n if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {\n diff.change.push(change);\n }\n }\n }\n }\n return diff;\n}\nfunction createTable(idbtrans, tableName, primKey, indexes) {\n const store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? {\n keyPath: primKey.keyPath,\n autoIncrement: primKey.auto\n } : {\n autoIncrement: primKey.auto\n });\n indexes.forEach(idx => addIndex(store, idx));\n return store;\n}\nfunction createMissingTables(newSchema, idbtrans) {\n keys(newSchema).forEach(tableName => {\n if (!idbtrans.db.objectStoreNames.contains(tableName)) {\n createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);\n }\n });\n}\nfunction deleteRemovedTables(newSchema, idbtrans) {\n [].slice.call(idbtrans.db.objectStoreNames).forEach(storeName => newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName));\n}\nfunction addIndex(store, idx) {\n store.createIndex(idx.name, idx.keyPath, {\n unique: idx.unique,\n multiEntry: idx.multi\n });\n}\nfunction buildGlobalSchema(db, idbdb, tmpTrans) {\n const globalSchema = {};\n const dbStoreNames = slice(idbdb.objectStoreNames, 0);\n dbStoreNames.forEach(storeName => {\n const store = tmpTrans.objectStore(storeName);\n let keyPath = store.keyPath;\n const primKey = createIndexSpec(nameFromKeyPath(keyPath), keyPath || \"\", false, false, !!store.autoIncrement, keyPath && typeof keyPath !== \"string\", true);\n const indexes = [];\n for (let j = 0; j < store.indexNames.length; ++j) {\n const idbindex = store.index(store.indexNames[j]);\n keyPath = idbindex.keyPath;\n var index = createIndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== \"string\", false);\n indexes.push(index);\n }\n globalSchema[storeName] = createTableSchema(storeName, primKey, indexes);\n });\n return globalSchema;\n}\nfunction readGlobalSchema({\n _novip: db\n}, idbdb, tmpTrans) {\n db.verno = idbdb.version / 10;\n const globalSchema = db._dbSchema = buildGlobalSchema(db, idbdb, tmpTrans);\n db._storeNames = slice(idbdb.objectStoreNames, 0);\n setApiOnPlace(db, [db._allTables], keys(globalSchema), globalSchema);\n}\nfunction verifyInstalledSchema(db, tmpTrans) {\n const installedSchema = buildGlobalSchema(db, db.idbdb, tmpTrans);\n const diff = getSchemaDiff(installedSchema, db._dbSchema);\n return !(diff.add.length || diff.change.some(ch => ch.add.length || ch.change.length));\n}\nfunction adjustToExistingIndexNames({\n _novip: db\n}, schema, idbtrans) {\n const storeNames = idbtrans.db.objectStoreNames;\n for (let i = 0; i < storeNames.length; ++i) {\n const storeName = storeNames[i];\n const store = idbtrans.objectStore(storeName);\n db._hasGetAll = 'getAll' in store;\n for (let j = 0; j < store.indexNames.length; ++j) {\n const indexName = store.indexNames[j];\n const keyPath = store.index(indexName).keyPath;\n const dexieName = typeof keyPath === 'string' ? keyPath : \"[\" + slice(keyPath).join('+') + \"]\";\n if (schema[storeName]) {\n const indexSpec = schema[storeName].idxByName[dexieName];\n if (indexSpec) {\n indexSpec.name = indexName;\n delete schema[storeName].idxByName[dexieName];\n schema[storeName].idxByName[indexName] = indexSpec;\n }\n }\n }\n }\n if (typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604) {\n db._hasGetAll = false;\n }\n}\nfunction parseIndexSyntax(primKeyAndIndexes) {\n return primKeyAndIndexes.split(',').map((index, indexNum) => {\n index = index.trim();\n const name = index.replace(/([&*]|\\+\\+)/g, \"\");\n const keyPath = /^\\[/.test(name) ? name.match(/^\\[(.*)\\]$/)[1].split('+') : name;\n return createIndexSpec(name, keyPath || null, /\\&/.test(index), /\\*/.test(index), /\\+\\+/.test(index), isArray(keyPath), indexNum === 0);\n });\n}\nclass Version {\n _parseStoresSpec(stores, outSchema) {\n keys(stores).forEach(tableName => {\n if (stores[tableName] !== null) {\n var indexes = parseIndexSyntax(stores[tableName]);\n var primKey = indexes.shift();\n if (primKey.multi) throw new exceptions.Schema(\"Primary key cannot be multi-valued\");\n indexes.forEach(idx => {\n if (idx.auto) throw new exceptions.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!idx.keyPath) throw new exceptions.Schema(\"Index must have a name and cannot be an empty string\");\n });\n outSchema[tableName] = createTableSchema(tableName, primKey, indexes);\n }\n });\n }\n stores(stores) {\n const db = this.db;\n this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;\n const versions = db._versions;\n const storesSpec = {};\n let dbschema = {};\n versions.forEach(version => {\n extend(storesSpec, version._cfg.storesSource);\n dbschema = version._cfg.dbschema = {};\n version._parseStoresSpec(storesSpec, dbschema);\n });\n db._dbSchema = dbschema;\n removeTablesApi(db, [db._allTables, db, db.Transaction.prototype]);\n setApiOnPlace(db, [db._allTables, db, db.Transaction.prototype, this._cfg.tables], keys(dbschema), dbschema);\n db._storeNames = keys(dbschema);\n return this;\n }\n upgrade(upgradeFunction) {\n this._cfg.contentUpgrade = promisableChain(this._cfg.contentUpgrade || nop, upgradeFunction);\n return this;\n }\n}\nfunction createVersionConstructor(db) {\n return makeClassConstructor(Version.prototype, function Version(versionNumber) {\n this.db = db;\n this._cfg = {\n version: versionNumber,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n });\n}\nfunction getDbNamesTable(indexedDB, IDBKeyRange) {\n let dbNamesDB = indexedDB[\"_dbNamesDB\"];\n if (!dbNamesDB) {\n dbNamesDB = indexedDB[\"_dbNamesDB\"] = new Dexie$1(DBNAMES_DB, {\n addons: [],\n indexedDB,\n IDBKeyRange\n });\n dbNamesDB.version(1).stores({\n dbnames: \"name\"\n });\n }\n return dbNamesDB.table(\"dbnames\");\n}\nfunction hasDatabasesNative(indexedDB) {\n return indexedDB && typeof indexedDB.databases === \"function\";\n}\nfunction getDatabaseNames({\n indexedDB,\n IDBKeyRange\n}) {\n return hasDatabasesNative(indexedDB) ? Promise.resolve(indexedDB.databases()).then(infos => infos.map(info => info.name).filter(name => name !== DBNAMES_DB)) : getDbNamesTable(indexedDB, IDBKeyRange).toCollection().primaryKeys();\n}\nfunction _onDatabaseCreated({\n indexedDB,\n IDBKeyRange\n}, name) {\n !hasDatabasesNative(indexedDB) && name !== DBNAMES_DB && getDbNamesTable(indexedDB, IDBKeyRange).put({\n name\n }).catch(nop);\n}\nfunction _onDatabaseDeleted({\n indexedDB,\n IDBKeyRange\n}, name) {\n !hasDatabasesNative(indexedDB) && name !== DBNAMES_DB && getDbNamesTable(indexedDB, IDBKeyRange).delete(name).catch(nop);\n}\nfunction vip(fn) {\n return newScope(function () {\n PSD.letThrough = true;\n return fn();\n });\n}\nfunction idbReady() {\n var isSafari = !navigator.userAgentData && /Safari\\//.test(navigator.userAgent) && !/Chrom(e|ium)\\//.test(navigator.userAgent);\n if (!isSafari || !indexedDB.databases) return Promise.resolve();\n var intervalId;\n return new Promise(function (resolve) {\n var tryIdb = function () {\n return indexedDB.databases().finally(resolve);\n };\n intervalId = setInterval(tryIdb, 100);\n tryIdb();\n }).finally(function () {\n return clearInterval(intervalId);\n });\n}\nfunction dexieOpen(db) {\n const state = db._state;\n const {\n indexedDB\n } = db._deps;\n if (state.isBeingOpened || db.idbdb) return state.dbReadyPromise.then(() => state.dbOpenError ? rejection(state.dbOpenError) : db);\n debug && (state.openCanceller._stackHolder = getErrorWithStack());\n state.isBeingOpened = true;\n state.dbOpenError = null;\n state.openComplete = false;\n const openCanceller = state.openCanceller;\n function throwIfCancelled() {\n if (state.openCanceller !== openCanceller) throw new exceptions.DatabaseClosed('db.open() was cancelled');\n }\n let resolveDbReady = state.dbReadyResolve,\n upgradeTransaction = null,\n wasCreated = false;\n const tryOpenDB = () => new DexiePromise((resolve, reject) => {\n throwIfCancelled();\n if (!indexedDB) throw new exceptions.MissingAPI();\n const dbName = db.name;\n const req = state.autoSchema ? indexedDB.open(dbName) : indexedDB.open(dbName, Math.round(db.verno * 10));\n if (!req) throw new exceptions.MissingAPI();\n req.onerror = eventRejectHandler(reject);\n req.onblocked = wrap(db._fireOnBlocked);\n req.onupgradeneeded = wrap(e => {\n upgradeTransaction = req.transaction;\n if (state.autoSchema && !db._options.allowEmptyDB) {\n req.onerror = preventDefault;\n upgradeTransaction.abort();\n req.result.close();\n const delreq = indexedDB.deleteDatabase(dbName);\n delreq.onsuccess = delreq.onerror = wrap(() => {\n reject(new exceptions.NoSuchDatabase(`Database ${dbName} doesnt exist`));\n });\n } else {\n upgradeTransaction.onerror = eventRejectHandler(reject);\n var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;\n wasCreated = oldVer < 1;\n db._novip.idbdb = req.result;\n runUpgraders(db, oldVer / 10, upgradeTransaction, reject);\n }\n }, reject);\n req.onsuccess = wrap(() => {\n upgradeTransaction = null;\n const idbdb = db._novip.idbdb = req.result;\n const objectStoreNames = slice(idbdb.objectStoreNames);\n if (objectStoreNames.length > 0) try {\n const tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');\n if (state.autoSchema) readGlobalSchema(db, idbdb, tmpTrans);else {\n adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);\n if (!verifyInstalledSchema(db, tmpTrans)) {\n console.warn(`Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.`);\n }\n }\n generateMiddlewareStacks(db, tmpTrans);\n } catch (e) {}\n connections.push(db);\n idbdb.onversionchange = wrap(ev => {\n state.vcFired = true;\n db.on(\"versionchange\").fire(ev);\n });\n idbdb.onclose = wrap(ev => {\n db.on(\"close\").fire(ev);\n });\n if (wasCreated) _onDatabaseCreated(db._deps, dbName);\n resolve();\n }, reject);\n }).catch(err => {\n if (err && err.name === 'UnknownError' && state.PR1398_maxLoop > 0) {\n state.PR1398_maxLoop--;\n console.warn('Dexie: Workaround for Chrome UnknownError on open()');\n return tryOpenDB();\n } else {\n return DexiePromise.reject(err);\n }\n });\n return DexiePromise.race([openCanceller, (typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)]).then(() => {\n throwIfCancelled();\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(() => db.on.ready.fire(db.vip))).then(function fireRemainders() {\n if (state.onReadyBeingFired.length > 0) {\n let remainders = state.onReadyBeingFired.reduce(promisableChain, nop);\n state.onReadyBeingFired = [];\n return DexiePromise.resolve(vip(() => remainders(db.vip))).then(fireRemainders);\n }\n });\n }).finally(() => {\n state.onReadyBeingFired = null;\n state.isBeingOpened = false;\n }).then(() => {\n return db;\n }).catch(err => {\n state.dbOpenError = err;\n try {\n upgradeTransaction && upgradeTransaction.abort();\n } catch (_a) {}\n if (openCanceller === state.openCanceller) {\n db._close();\n }\n return rejection(err);\n }).finally(() => {\n state.openComplete = true;\n resolveDbReady();\n });\n}\nfunction awaitIterator(iterator) {\n var callNext = result => iterator.next(result),\n doThrow = error => iterator.throw(error),\n onSuccess = step(callNext),\n onError = step(doThrow);\n function step(getNext) {\n return val => {\n var next = getNext(val),\n value = next.value;\n return next.done ? value : !value || typeof value.then !== 'function' ? isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) : value.then(onSuccess, onError);\n };\n }\n return step(callNext)();\n}\nfunction extractTransactionArgs(mode, _tableArgs_, scopeFunc) {\n var i = arguments.length;\n if (i < 2) throw new exceptions.InvalidArgument(\"Too few arguments\");\n var args = new Array(i - 1);\n while (--i) args[i - 1] = arguments[i];\n scopeFunc = args.pop();\n var tables = flatten(args);\n return [mode, tables, scopeFunc];\n}\nfunction enterTransactionScope(db, mode, storeNames, parentTransaction, scopeFunc) {\n return DexiePromise.resolve().then(() => {\n const transless = PSD.transless || PSD;\n const trans = db._createTransaction(mode, storeNames, db._dbSchema, parentTransaction);\n const zoneProps = {\n trans: trans,\n transless: transless\n };\n if (parentTransaction) {\n trans.idbtrans = parentTransaction.idbtrans;\n } else {\n try {\n trans.create();\n db._state.PR1398_maxLoop = 3;\n } catch (ex) {\n if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {\n console.warn('Dexie: Need to reopen db');\n db._close();\n return db.open().then(() => enterTransactionScope(db, mode, storeNames, null, scopeFunc));\n }\n return rejection(ex);\n }\n }\n const scopeFuncIsAsync = isAsyncFunction(scopeFunc);\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n let returnValue;\n const promiseFollowed = DexiePromise.follow(() => {\n returnValue = scopeFunc.call(trans, trans);\n if (returnValue) {\n if (scopeFuncIsAsync) {\n var decrementor = decrementExpectedAwaits.bind(null, null);\n returnValue.then(decrementor, decrementor);\n } else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {\n returnValue = awaitIterator(returnValue);\n }\n }\n }, zoneProps);\n return (returnValue && typeof returnValue.then === 'function' ? DexiePromise.resolve(returnValue).then(x => trans.active ? x : rejection(new exceptions.PrematureCommit(\"Transaction committed too early. See http://bit.ly/2kdckMn\"))) : promiseFollowed.then(() => returnValue)).then(x => {\n if (parentTransaction) trans._resolve();\n return trans._completion.then(() => x);\n }).catch(e => {\n trans._reject(e);\n return rejection(e);\n });\n });\n}\nfunction pad(a, value, count) {\n const result = isArray(a) ? a.slice() : [a];\n for (let i = 0; i < count; ++i) result.push(value);\n return result;\n}\nfunction createVirtualIndexMiddleware(down) {\n return {\n ...down,\n table(tableName) {\n const table = down.table(tableName);\n const {\n schema\n } = table;\n const indexLookup = {};\n const allVirtualIndexes = [];\n function addVirtualIndexes(keyPath, keyTail, lowLevelIndex) {\n const keyPathAlias = getKeyPathAlias(keyPath);\n const indexList = indexLookup[keyPathAlias] = indexLookup[keyPathAlias] || [];\n const keyLength = keyPath == null ? 0 : typeof keyPath === 'string' ? 1 : keyPath.length;\n const isVirtual = keyTail > 0;\n const virtualIndex = {\n ...lowLevelIndex,\n isVirtual,\n keyTail,\n keyLength,\n extractKey: getKeyExtractor(keyPath),\n unique: !isVirtual && lowLevelIndex.unique\n };\n indexList.push(virtualIndex);\n if (!virtualIndex.isPrimaryKey) {\n allVirtualIndexes.push(virtualIndex);\n }\n if (keyLength > 1) {\n const virtualKeyPath = keyLength === 2 ? keyPath[0] : keyPath.slice(0, keyLength - 1);\n addVirtualIndexes(virtualKeyPath, keyTail + 1, lowLevelIndex);\n }\n indexList.sort((a, b) => a.keyTail - b.keyTail);\n return virtualIndex;\n }\n const primaryKey = addVirtualIndexes(schema.primaryKey.keyPath, 0, schema.primaryKey);\n indexLookup[\":id\"] = [primaryKey];\n for (const index of schema.indexes) {\n addVirtualIndexes(index.keyPath, 0, index);\n }\n function findBestIndex(keyPath) {\n const result = indexLookup[getKeyPathAlias(keyPath)];\n return result && result[0];\n }\n function translateRange(range, keyTail) {\n return {\n type: range.type === 1 ? 2 : range.type,\n lower: pad(range.lower, range.lowerOpen ? down.MAX_KEY : down.MIN_KEY, keyTail),\n lowerOpen: true,\n upper: pad(range.upper, range.upperOpen ? down.MIN_KEY : down.MAX_KEY, keyTail),\n upperOpen: true\n };\n }\n function translateRequest(req) {\n const index = req.query.index;\n return index.isVirtual ? {\n ...req,\n query: {\n index,\n range: translateRange(req.query.range, index.keyTail)\n }\n } : req;\n }\n const result = {\n ...table,\n schema: {\n ...schema,\n primaryKey,\n indexes: allVirtualIndexes,\n getIndexByKeyPath: findBestIndex\n },\n count(req) {\n return table.count(translateRequest(req));\n },\n query(req) {\n return table.query(translateRequest(req));\n },\n openCursor(req) {\n const {\n keyTail,\n isVirtual,\n keyLength\n } = req.query.index;\n if (!isVirtual) return table.openCursor(req);\n function createVirtualCursor(cursor) {\n function _continue(key) {\n key != null ? cursor.continue(pad(key, req.reverse ? down.MAX_KEY : down.MIN_KEY, keyTail)) : req.unique ? cursor.continue(cursor.key.slice(0, keyLength).concat(req.reverse ? down.MIN_KEY : down.MAX_KEY, keyTail)) : cursor.continue();\n }\n const virtualCursor = Object.create(cursor, {\n continue: {\n value: _continue\n },\n continuePrimaryKey: {\n value(key, primaryKey) {\n cursor.continuePrimaryKey(pad(key, down.MAX_KEY, keyTail), primaryKey);\n }\n },\n primaryKey: {\n get() {\n return cursor.primaryKey;\n }\n },\n key: {\n get() {\n const key = cursor.key;\n return keyLength === 1 ? key[0] : key.slice(0, keyLength);\n }\n },\n value: {\n get() {\n return cursor.value;\n }\n }\n });\n return virtualCursor;\n }\n return table.openCursor(translateRequest(req)).then(cursor => cursor && createVirtualCursor(cursor));\n }\n };\n return result;\n }\n };\n}\nconst virtualIndexMiddleware = {\n stack: \"dbcore\",\n name: \"VirtualIndexMiddleware\",\n level: 1,\n create: createVirtualIndexMiddleware\n};\nfunction getObjectDiff(a, b, rv, prfx) {\n rv = rv || {};\n prfx = prfx || '';\n keys(a).forEach(prop => {\n if (!hasOwn(b, prop)) {\n rv[prfx + prop] = undefined;\n } else {\n var ap = a[prop],\n bp = b[prop];\n if (typeof ap === 'object' && typeof bp === 'object' && ap && bp) {\n const apTypeName = toStringTag(ap);\n const bpTypeName = toStringTag(bp);\n if (apTypeName !== bpTypeName) {\n rv[prfx + prop] = b[prop];\n } else if (apTypeName === 'Object') {\n getObjectDiff(ap, bp, rv, prfx + prop + '.');\n } else if (ap !== bp) {\n rv[prfx + prop] = b[prop];\n }\n } else if (ap !== bp) rv[prfx + prop] = b[prop];\n }\n });\n keys(b).forEach(prop => {\n if (!hasOwn(a, prop)) {\n rv[prfx + prop] = b[prop];\n }\n });\n return rv;\n}\nfunction getEffectiveKeys(primaryKey, req) {\n if (req.type === 'delete') return req.keys;\n return req.keys || req.values.map(primaryKey.extractKey);\n}\nconst hooksMiddleware = {\n stack: \"dbcore\",\n name: \"HooksMiddleware\",\n level: 2,\n create: downCore => ({\n ...downCore,\n table(tableName) {\n const downTable = downCore.table(tableName);\n const {\n primaryKey\n } = downTable.schema;\n const tableMiddleware = {\n ...downTable,\n mutate(req) {\n const dxTrans = PSD.trans;\n const {\n deleting,\n creating,\n updating\n } = dxTrans.table(tableName).hook;\n switch (req.type) {\n case 'add':\n if (creating.fire === nop) break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'put':\n if (creating.fire === nop && updating.fire === nop) break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'delete':\n if (deleting.fire === nop) break;\n return dxTrans._promise('readwrite', () => addPutOrDelete(req), true);\n case 'deleteRange':\n if (deleting.fire === nop) break;\n return dxTrans._promise('readwrite', () => deleteRange(req), true);\n }\n return downTable.mutate(req);\n function addPutOrDelete(req) {\n const dxTrans = PSD.trans;\n const keys = req.keys || getEffectiveKeys(primaryKey, req);\n if (!keys) throw new Error(\"Keys missing\");\n req = req.type === 'add' || req.type === 'put' ? {\n ...req,\n keys\n } : {\n ...req\n };\n if (req.type !== 'delete') req.values = [...req.values];\n if (req.keys) req.keys = [...req.keys];\n return getExistingValues(downTable, req, keys).then(existingValues => {\n const contexts = keys.map((key, i) => {\n const existingValue = existingValues[i];\n const ctx = {\n onerror: null,\n onsuccess: null\n };\n if (req.type === 'delete') {\n deleting.fire.call(ctx, key, existingValue, dxTrans);\n } else if (req.type === 'add' || existingValue === undefined) {\n const generatedPrimaryKey = creating.fire.call(ctx, key, req.values[i], dxTrans);\n if (key == null && generatedPrimaryKey != null) {\n key = generatedPrimaryKey;\n req.keys[i] = key;\n if (!primaryKey.outbound) {\n setByKeyPath(req.values[i], primaryKey.keyPath, key);\n }\n }\n } else {\n const objectDiff = getObjectDiff(existingValue, req.values[i]);\n const additionalChanges = updating.fire.call(ctx, objectDiff, key, existingValue, dxTrans);\n if (additionalChanges) {\n const requestedValue = req.values[i];\n Object.keys(additionalChanges).forEach(keyPath => {\n if (hasOwn(requestedValue, keyPath)) {\n requestedValue[keyPath] = additionalChanges[keyPath];\n } else {\n setByKeyPath(requestedValue, keyPath, additionalChanges[keyPath]);\n }\n });\n }\n }\n return ctx;\n });\n return downTable.mutate(req).then(({\n failures,\n results,\n numFailures,\n lastResult\n }) => {\n for (let i = 0; i < keys.length; ++i) {\n const primKey = results ? results[i] : keys[i];\n const ctx = contexts[i];\n if (primKey == null) {\n ctx.onerror && ctx.onerror(failures[i]);\n } else {\n ctx.onsuccess && ctx.onsuccess(req.type === 'put' && existingValues[i] ? req.values[i] : primKey);\n }\n }\n return {\n failures,\n results,\n numFailures,\n lastResult\n };\n }).catch(error => {\n contexts.forEach(ctx => ctx.onerror && ctx.onerror(error));\n return Promise.reject(error);\n });\n });\n }\n function deleteRange(req) {\n return deleteNextChunk(req.trans, req.range, 10000);\n }\n function deleteNextChunk(trans, range, limit) {\n return downTable.query({\n trans,\n values: false,\n query: {\n index: primaryKey,\n range\n },\n limit\n }).then(({\n result\n }) => {\n return addPutOrDelete({\n type: 'delete',\n keys: result,\n trans\n }).then(res => {\n if (res.numFailures > 0) return Promise.reject(res.failures[0]);\n if (result.length < limit) {\n return {\n failures: [],\n numFailures: 0,\n lastResult: undefined\n };\n } else {\n return deleteNextChunk(trans, {\n ...range,\n lower: result[result.length - 1],\n lowerOpen: true\n }, limit);\n }\n });\n });\n }\n }\n };\n return tableMiddleware;\n }\n })\n};\nfunction getExistingValues(table, req, effectiveKeys) {\n return req.type === \"add\" ? Promise.resolve([]) : table.getMany({\n trans: req.trans,\n keys: effectiveKeys,\n cache: \"immutable\"\n });\n}\nfunction getFromTransactionCache(keys, cache, clone) {\n try {\n if (!cache) return null;\n if (cache.keys.length < keys.length) return null;\n const result = [];\n for (let i = 0, j = 0; i < cache.keys.length && j < keys.length; ++i) {\n if (cmp(cache.keys[i], keys[j]) !== 0) continue;\n result.push(clone ? deepClone(cache.values[i]) : cache.values[i]);\n ++j;\n }\n return result.length === keys.length ? result : null;\n } catch (_a) {\n return null;\n }\n}\nconst cacheExistingValuesMiddleware = {\n stack: \"dbcore\",\n level: -1,\n create: core => {\n return {\n table: tableName => {\n const table = core.table(tableName);\n return {\n ...table,\n getMany: req => {\n if (!req.cache) {\n return table.getMany(req);\n }\n const cachedResult = getFromTransactionCache(req.keys, req.trans[\"_cache\"], req.cache === \"clone\");\n if (cachedResult) {\n return DexiePromise.resolve(cachedResult);\n }\n return table.getMany(req).then(res => {\n req.trans[\"_cache\"] = {\n keys: req.keys,\n values: req.cache === \"clone\" ? deepClone(res) : res\n };\n return res;\n });\n },\n mutate: req => {\n if (req.type !== \"add\") req.trans[\"_cache\"] = null;\n return table.mutate(req);\n }\n };\n }\n };\n }\n};\nfunction isEmptyRange(node) {\n return !(\"from\" in node);\n}\nconst RangeSet = function (fromOrTree, to) {\n if (this) {\n extend(this, arguments.length ? {\n d: 1,\n from: fromOrTree,\n to: arguments.length > 1 ? to : fromOrTree\n } : {\n d: 0\n });\n } else {\n const rv = new RangeSet();\n if (fromOrTree && \"d\" in fromOrTree) {\n extend(rv, fromOrTree);\n }\n return rv;\n }\n};\nprops(RangeSet.prototype, {\n add(rangeSet) {\n mergeRanges(this, rangeSet);\n return this;\n },\n addKey(key) {\n addRange(this, key, key);\n return this;\n },\n addKeys(keys) {\n keys.forEach(key => addRange(this, key, key));\n return this;\n },\n [iteratorSymbol]() {\n return getRangeSetIterator(this);\n }\n});\nfunction addRange(target, from, to) {\n const diff = cmp(from, to);\n if (isNaN(diff)) return;\n if (diff > 0) throw RangeError();\n if (isEmptyRange(target)) return extend(target, {\n from,\n to,\n d: 1\n });\n const left = target.l;\n const right = target.r;\n if (cmp(to, target.from) < 0) {\n left ? addRange(left, from, to) : target.l = {\n from,\n to,\n d: 1,\n l: null,\n r: null\n };\n return rebalance(target);\n }\n if (cmp(from, target.to) > 0) {\n right ? addRange(right, from, to) : target.r = {\n from,\n to,\n d: 1,\n l: null,\n r: null\n };\n return rebalance(target);\n }\n if (cmp(from, target.from) < 0) {\n target.from = from;\n target.l = null;\n target.d = right ? right.d + 1 : 1;\n }\n if (cmp(to, target.to) > 0) {\n target.to = to;\n target.r = null;\n target.d = target.l ? target.l.d + 1 : 1;\n }\n const rightWasCutOff = !target.r;\n if (left && !target.l) {\n mergeRanges(target, left);\n }\n if (right && rightWasCutOff) {\n mergeRanges(target, right);\n }\n}\nfunction mergeRanges(target, newSet) {\n function _addRangeSet(target, {\n from,\n to,\n l,\n r\n }) {\n addRange(target, from, to);\n if (l) _addRangeSet(target, l);\n if (r) _addRangeSet(target, r);\n }\n if (!isEmptyRange(newSet)) _addRangeSet(target, newSet);\n}\nfunction rangesOverlap(rangeSet1, rangeSet2) {\n const i1 = getRangeSetIterator(rangeSet2);\n let nextResult1 = i1.next();\n if (nextResult1.done) return false;\n let a = nextResult1.value;\n const i2 = getRangeSetIterator(rangeSet1);\n let nextResult2 = i2.next(a.from);\n let b = nextResult2.value;\n while (!nextResult1.done && !nextResult2.done) {\n if (cmp(b.from, a.to) <= 0 && cmp(b.to, a.from) >= 0) return true;\n cmp(a.from, b.from) < 0 ? a = (nextResult1 = i1.next(b.from)).value : b = (nextResult2 = i2.next(a.from)).value;\n }\n return false;\n}\nfunction getRangeSetIterator(node) {\n let state = isEmptyRange(node) ? null : {\n s: 0,\n n: node\n };\n return {\n next(key) {\n const keyProvided = arguments.length > 0;\n while (state) {\n switch (state.s) {\n case 0:\n state.s = 1;\n if (keyProvided) {\n while (state.n.l && cmp(key, state.n.from) < 0) state = {\n up: state,\n n: state.n.l,\n s: 1\n };\n } else {\n while (state.n.l) state = {\n up: state,\n n: state.n.l,\n s: 1\n };\n }\n case 1:\n state.s = 2;\n if (!keyProvided || cmp(key, state.n.to) <= 0) return {\n value: state.n,\n done: false\n };\n case 2:\n if (state.n.r) {\n state.s = 3;\n state = {\n up: state,\n n: state.n.r,\n s: 0\n };\n continue;\n }\n case 3:\n state = state.up;\n }\n }\n return {\n done: true\n };\n }\n };\n}\nfunction rebalance(target) {\n var _a, _b;\n const diff = (((_a = target.r) === null || _a === void 0 ? void 0 : _a.d) || 0) - (((_b = target.l) === null || _b === void 0 ? void 0 : _b.d) || 0);\n const r = diff > 1 ? \"r\" : diff < -1 ? \"l\" : \"\";\n if (r) {\n const l = r === \"r\" ? \"l\" : \"r\";\n const rootClone = {\n ...target\n };\n const oldRootRight = target[r];\n target.from = oldRootRight.from;\n target.to = oldRootRight.to;\n target[r] = oldRootRight[r];\n rootClone[r] = oldRootRight[l];\n target[l] = rootClone;\n rootClone.d = computeDepth(rootClone);\n }\n target.d = computeDepth(target);\n}\nfunction computeDepth({\n r,\n l\n}) {\n return (r ? l ? Math.max(r.d, l.d) : r.d : l ? l.d : 0) + 1;\n}\nconst observabilityMiddleware = {\n stack: \"dbcore\",\n level: 0,\n create: core => {\n const dbName = core.schema.name;\n const FULL_RANGE = new RangeSet(core.MIN_KEY, core.MAX_KEY);\n return {\n ...core,\n table: tableName => {\n const table = core.table(tableName);\n const {\n schema\n } = table;\n const {\n primaryKey\n } = schema;\n const {\n extractKey,\n outbound\n } = primaryKey;\n const tableClone = {\n ...table,\n mutate: req => {\n const trans = req.trans;\n const mutatedParts = trans.mutatedParts || (trans.mutatedParts = {});\n const getRangeSet = indexName => {\n const part = `idb://${dbName}/${tableName}/${indexName}`;\n return mutatedParts[part] || (mutatedParts[part] = new RangeSet());\n };\n const pkRangeSet = getRangeSet(\"\");\n const delsRangeSet = getRangeSet(\":dels\");\n const {\n type\n } = req;\n let [keys, newObjs] = req.type === \"deleteRange\" ? [req.range] : req.type === \"delete\" ? [req.keys] : req.values.length < 50 ? [[], req.values] : [];\n const oldCache = req.trans[\"_cache\"];\n return table.mutate(req).then(res => {\n if (isArray(keys)) {\n if (type !== \"delete\") keys = res.results;\n pkRangeSet.addKeys(keys);\n const oldObjs = getFromTransactionCache(keys, oldCache);\n if (!oldObjs && type !== \"add\") {\n delsRangeSet.addKeys(keys);\n }\n if (oldObjs || newObjs) {\n trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs);\n }\n } else if (keys) {\n const range = {\n from: keys.lower,\n to: keys.upper\n };\n delsRangeSet.add(range);\n pkRangeSet.add(range);\n } else {\n pkRangeSet.add(FULL_RANGE);\n delsRangeSet.add(FULL_RANGE);\n schema.indexes.forEach(idx => getRangeSet(idx.name).add(FULL_RANGE));\n }\n return res;\n });\n }\n };\n const getRange = ({\n query: {\n index,\n range\n }\n }) => {\n var _a, _b;\n return [index, new RangeSet((_a = range.lower) !== null && _a !== void 0 ? _a : core.MIN_KEY, (_b = range.upper) !== null && _b !== void 0 ? _b : core.MAX_KEY)];\n };\n const readSubscribers = {\n get: req => [primaryKey, new RangeSet(req.key)],\n getMany: req => [primaryKey, new RangeSet().addKeys(req.keys)],\n count: getRange,\n query: getRange,\n openCursor: getRange\n };\n keys(readSubscribers).forEach(method => {\n tableClone[method] = function (req) {\n const {\n subscr\n } = PSD;\n if (subscr) {\n const getRangeSet = indexName => {\n const part = `idb://${dbName}/${tableName}/${indexName}`;\n return subscr[part] || (subscr[part] = new RangeSet());\n };\n const pkRangeSet = getRangeSet(\"\");\n const delsRangeSet = getRangeSet(\":dels\");\n const [queriedIndex, queriedRanges] = readSubscribers[method](req);\n getRangeSet(queriedIndex.name || \"\").add(queriedRanges);\n if (!queriedIndex.isPrimaryKey) {\n if (method === \"count\") {\n delsRangeSet.add(FULL_RANGE);\n } else {\n const keysPromise = method === \"query\" && outbound && req.values && table.query({\n ...req,\n values: false\n });\n return table[method].apply(this, arguments).then(res => {\n if (method === \"query\") {\n if (outbound && req.values) {\n return keysPromise.then(({\n result: resultingKeys\n }) => {\n pkRangeSet.addKeys(resultingKeys);\n return res;\n });\n }\n const pKeys = req.values ? res.result.map(extractKey) : res.result;\n if (req.values) {\n pkRangeSet.addKeys(pKeys);\n } else {\n delsRangeSet.addKeys(pKeys);\n }\n } else if (method === \"openCursor\") {\n const cursor = res;\n const wantValues = req.values;\n return cursor && Object.create(cursor, {\n key: {\n get() {\n delsRangeSet.addKey(cursor.primaryKey);\n return cursor.key;\n }\n },\n primaryKey: {\n get() {\n const pkey = cursor.primaryKey;\n delsRangeSet.addKey(pkey);\n return pkey;\n }\n },\n value: {\n get() {\n wantValues && pkRangeSet.addKey(cursor.primaryKey);\n return cursor.value;\n }\n }\n });\n }\n return res;\n });\n }\n }\n }\n return table[method].apply(this, arguments);\n };\n });\n return tableClone;\n }\n };\n }\n};\nfunction trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs) {\n function addAffectedIndex(ix) {\n const rangeSet = getRangeSet(ix.name || \"\");\n function extractKey(obj) {\n return obj != null ? ix.extractKey(obj) : null;\n }\n const addKeyOrKeys = key => ix.multiEntry && isArray(key) ? key.forEach(key => rangeSet.addKey(key)) : rangeSet.addKey(key);\n (oldObjs || newObjs).forEach((_, i) => {\n const oldKey = oldObjs && extractKey(oldObjs[i]);\n const newKey = newObjs && extractKey(newObjs[i]);\n if (cmp(oldKey, newKey) !== 0) {\n if (oldKey != null) addKeyOrKeys(oldKey);\n if (newKey != null) addKeyOrKeys(newKey);\n }\n });\n }\n schema.indexes.forEach(addAffectedIndex);\n}\nclass Dexie$1 {\n constructor(name, options) {\n this._middlewares = {};\n this.verno = 0;\n const deps = Dexie$1.dependencies;\n this._options = options = {\n addons: Dexie$1.addons,\n autoOpen: true,\n indexedDB: deps.indexedDB,\n IDBKeyRange: deps.IDBKeyRange,\n ...options\n };\n this._deps = {\n indexedDB: options.indexedDB,\n IDBKeyRange: options.IDBKeyRange\n };\n const {\n addons\n } = options;\n this._dbSchema = {};\n this._versions = [];\n this._storeNames = [];\n this._allTables = {};\n this.idbdb = null;\n this._novip = this;\n const state = {\n dbOpenError: null,\n isBeingOpened: false,\n onReadyBeingFired: null,\n openComplete: false,\n dbReadyResolve: nop,\n dbReadyPromise: null,\n cancelOpen: nop,\n openCanceller: null,\n autoSchema: true,\n PR1398_maxLoop: 3\n };\n state.dbReadyPromise = new DexiePromise(resolve => {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise((_, reject) => {\n state.cancelOpen = reject;\n });\n this._state = state;\n this.name = name;\n this.on = Events(this, \"populate\", \"blocked\", \"versionchange\", \"close\", {\n ready: [promisableChain, nop]\n });\n this.on.ready.subscribe = override(this.on.ready.subscribe, subscribe => {\n return (subscriber, bSticky) => {\n Dexie$1.vip(() => {\n const state = this._state;\n if (state.openComplete) {\n if (!state.dbOpenError) DexiePromise.resolve().then(subscriber);\n if (bSticky) subscribe(subscriber);\n } else if (state.onReadyBeingFired) {\n state.onReadyBeingFired.push(subscriber);\n if (bSticky) subscribe(subscriber);\n } else {\n subscribe(subscriber);\n const db = this;\n if (!bSticky) subscribe(function unsubscribe() {\n db.on.ready.unsubscribe(subscriber);\n db.on.ready.unsubscribe(unsubscribe);\n });\n }\n });\n };\n });\n this.Collection = createCollectionConstructor(this);\n this.Table = createTableConstructor(this);\n this.Transaction = createTransactionConstructor(this);\n this.Version = createVersionConstructor(this);\n this.WhereClause = createWhereClauseConstructor(this);\n this.on(\"versionchange\", ev => {\n if (ev.newVersion > 0) console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`);else console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`);\n this.close();\n });\n this.on(\"blocked\", ev => {\n if (!ev.newVersion || ev.newVersion < ev.oldVersion) console.warn(`Dexie.delete('${this.name}') was blocked`);else console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${ev.oldVersion / 10}`);\n });\n this._maxKey = getMaxKey(options.IDBKeyRange);\n this._createTransaction = (mode, storeNames, dbschema, parentTransaction) => new this.Transaction(mode, storeNames, dbschema, this._options.chromeTransactionDurability, parentTransaction);\n this._fireOnBlocked = ev => {\n this.on(\"blocked\").fire(ev);\n connections.filter(c => c.name === this.name && c !== this && !c._state.vcFired).map(c => c.on(\"versionchange\").fire(ev));\n };\n this.use(virtualIndexMiddleware);\n this.use(hooksMiddleware);\n this.use(observabilityMiddleware);\n this.use(cacheExistingValuesMiddleware);\n this.vip = Object.create(this, {\n _vip: {\n value: true\n }\n });\n addons.forEach(addon => addon(this));\n }\n version(versionNumber) {\n if (isNaN(versionNumber) || versionNumber < 0.1) throw new exceptions.Type(`Given version is not a positive number`);\n versionNumber = Math.round(versionNumber * 10) / 10;\n if (this.idbdb || this._state.isBeingOpened) throw new exceptions.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, versionNumber);\n const versions = this._versions;\n var versionInstance = versions.filter(v => v._cfg.version === versionNumber)[0];\n if (versionInstance) return versionInstance;\n versionInstance = new this.Version(versionNumber);\n versions.push(versionInstance);\n versions.sort(lowerVersionFirst);\n versionInstance.stores({});\n this._state.autoSchema = false;\n return versionInstance;\n }\n _whenReady(fn) {\n return this.idbdb && (this._state.openComplete || PSD.letThrough || this._vip) ? fn() : new DexiePromise((resolve, reject) => {\n if (this._state.openComplete) {\n return reject(new exceptions.DatabaseClosed(this._state.dbOpenError));\n }\n if (!this._state.isBeingOpened) {\n if (!this._options.autoOpen) {\n reject(new exceptions.DatabaseClosed());\n return;\n }\n this.open().catch(nop);\n }\n this._state.dbReadyPromise.then(resolve, reject);\n }).then(fn);\n }\n use({\n stack,\n create,\n level,\n name\n }) {\n if (name) this.unuse({\n stack,\n name\n });\n const middlewares = this._middlewares[stack] || (this._middlewares[stack] = []);\n middlewares.push({\n stack,\n create,\n level: level == null ? 10 : level,\n name\n });\n middlewares.sort((a, b) => a.level - b.level);\n return this;\n }\n unuse({\n stack,\n name,\n create\n }) {\n if (stack && this._middlewares[stack]) {\n this._middlewares[stack] = this._middlewares[stack].filter(mw => create ? mw.create !== create : name ? mw.name !== name : false);\n }\n return this;\n }\n open() {\n return dexieOpen(this);\n }\n _close() {\n const state = this._state;\n const idx = connections.indexOf(this);\n if (idx >= 0) connections.splice(idx, 1);\n if (this.idbdb) {\n try {\n this.idbdb.close();\n } catch (e) {}\n this._novip.idbdb = null;\n }\n state.dbReadyPromise = new DexiePromise(resolve => {\n state.dbReadyResolve = resolve;\n });\n state.openCanceller = new DexiePromise((_, reject) => {\n state.cancelOpen = reject;\n });\n }\n close() {\n this._close();\n const state = this._state;\n this._options.autoOpen = false;\n state.dbOpenError = new exceptions.DatabaseClosed();\n if (state.isBeingOpened) state.cancelOpen(state.dbOpenError);\n }\n delete() {\n const hasArguments = arguments.length > 0;\n const state = this._state;\n return new DexiePromise((resolve, reject) => {\n const doDelete = () => {\n this.close();\n var req = this._deps.indexedDB.deleteDatabase(this.name);\n req.onsuccess = wrap(() => {\n _onDatabaseDeleted(this._deps, this.name);\n resolve();\n });\n req.onerror = eventRejectHandler(reject);\n req.onblocked = this._fireOnBlocked;\n };\n if (hasArguments) throw new exceptions.InvalidArgument(\"Arguments not allowed in db.delete()\");\n if (state.isBeingOpened) {\n state.dbReadyPromise.then(doDelete);\n } else {\n doDelete();\n }\n });\n }\n backendDB() {\n return this.idbdb;\n }\n isOpen() {\n return this.idbdb !== null;\n }\n hasBeenClosed() {\n const dbOpenError = this._state.dbOpenError;\n return dbOpenError && dbOpenError.name === 'DatabaseClosed';\n }\n hasFailed() {\n return this._state.dbOpenError !== null;\n }\n dynamicallyOpened() {\n return this._state.autoSchema;\n }\n get tables() {\n return keys(this._allTables).map(name => this._allTables[name]);\n }\n transaction() {\n const args = extractTransactionArgs.apply(this, arguments);\n return this._transaction.apply(this, args);\n }\n _transaction(mode, tables, scopeFunc) {\n let parentTransaction = PSD.trans;\n if (!parentTransaction || parentTransaction.db !== this || mode.indexOf('!') !== -1) parentTransaction = null;\n const onlyIfCompatible = mode.indexOf('?') !== -1;\n mode = mode.replace('!', '').replace('?', '');\n let idbMode, storeNames;\n try {\n storeNames = tables.map(table => {\n var storeName = table instanceof this.Table ? table.name : table;\n if (typeof storeName !== 'string') throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return storeName;\n });\n if (mode == \"r\" || mode === READONLY) idbMode = READONLY;else if (mode == \"rw\" || mode == READWRITE) idbMode = READWRITE;else throw new exceptions.InvalidArgument(\"Invalid transaction mode: \" + mode);\n if (parentTransaction) {\n if (parentTransaction.mode === READONLY && idbMode === READWRITE) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n } else throw new exceptions.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n }\n if (parentTransaction) {\n storeNames.forEach(storeName => {\n if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {\n if (onlyIfCompatible) {\n parentTransaction = null;\n } else throw new exceptions.SubTransaction(\"Table \" + storeName + \" not included in parent transaction.\");\n }\n });\n }\n if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {\n parentTransaction = null;\n }\n }\n } catch (e) {\n return parentTransaction ? parentTransaction._promise(null, (_, reject) => {\n reject(e);\n }) : rejection(e);\n }\n const enterTransaction = enterTransactionScope.bind(null, this, idbMode, storeNames, parentTransaction, scopeFunc);\n return parentTransaction ? parentTransaction._promise(idbMode, enterTransaction, \"lock\") : PSD.trans ? usePSD(PSD.transless, () => this._whenReady(enterTransaction)) : this._whenReady(enterTransaction);\n }\n table(tableName) {\n if (!hasOwn(this._allTables, tableName)) {\n throw new exceptions.InvalidTable(`Table ${tableName} does not exist`);\n }\n return this._allTables[tableName];\n }\n}\nconst symbolObservable = typeof Symbol !== \"undefined\" && \"observable\" in Symbol ? Symbol.observable : \"@@observable\";\nclass Observable {\n constructor(subscribe) {\n this._subscribe = subscribe;\n }\n subscribe(x, error, complete) {\n return this._subscribe(!x || typeof x === \"function\" ? {\n next: x,\n error,\n complete\n } : x);\n }\n [symbolObservable]() {\n return this;\n }\n}\nfunction extendObservabilitySet(target, newSet) {\n keys(newSet).forEach(part => {\n const rangeSet = target[part] || (target[part] = new RangeSet());\n mergeRanges(rangeSet, newSet[part]);\n });\n return target;\n}\nfunction liveQuery(querier) {\n let hasValue = false;\n let currentValue = undefined;\n const observable = new Observable(observer => {\n const scopeFuncIsAsync = isAsyncFunction(querier);\n function execute(subscr) {\n if (scopeFuncIsAsync) {\n incrementExpectedAwaits();\n }\n const exec = () => newScope(querier, {\n subscr,\n trans: null\n });\n const rv = PSD.trans ? usePSD(PSD.transless, exec) : exec();\n if (scopeFuncIsAsync) {\n rv.then(decrementExpectedAwaits, decrementExpectedAwaits);\n }\n return rv;\n }\n let closed = false;\n let accumMuts = {};\n let currentObs = {};\n const subscription = {\n get closed() {\n return closed;\n },\n unsubscribe: () => {\n closed = true;\n globalEvents.storagemutated.unsubscribe(mutationListener);\n }\n };\n observer.start && observer.start(subscription);\n let querying = false,\n startedListening = false;\n function shouldNotify() {\n return keys(currentObs).some(key => accumMuts[key] && rangesOverlap(accumMuts[key], currentObs[key]));\n }\n const mutationListener = parts => {\n extendObservabilitySet(accumMuts, parts);\n if (shouldNotify()) {\n doQuery();\n }\n };\n const doQuery = () => {\n if (querying || closed) return;\n accumMuts = {};\n const subscr = {};\n const ret = execute(subscr);\n if (!startedListening) {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, mutationListener);\n startedListening = true;\n }\n querying = true;\n Promise.resolve(ret).then(result => {\n hasValue = true;\n currentValue = result;\n querying = false;\n if (closed) return;\n if (shouldNotify()) {\n doQuery();\n } else {\n accumMuts = {};\n currentObs = subscr;\n observer.next && observer.next(result);\n }\n }, err => {\n querying = false;\n hasValue = false;\n observer.error && observer.error(err);\n subscription.unsubscribe();\n });\n };\n doQuery();\n return subscription;\n });\n observable.hasValue = () => hasValue;\n observable.getValue = () => currentValue;\n return observable;\n}\nlet domDeps;\ntry {\n domDeps = {\n indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,\n IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange\n };\n} catch (e) {\n domDeps = {\n indexedDB: null,\n IDBKeyRange: null\n };\n}\nconst Dexie = Dexie$1;\nprops(Dexie, {\n ...fullNameExceptions,\n delete(databaseName) {\n const db = new Dexie(databaseName, {\n addons: []\n });\n return db.delete();\n },\n exists(name) {\n return new Dexie(name, {\n addons: []\n }).open().then(db => {\n db.close();\n return true;\n }).catch('NoSuchDatabaseError', () => false);\n },\n getDatabaseNames(cb) {\n try {\n return getDatabaseNames(Dexie.dependencies).then(cb);\n } catch (_a) {\n return rejection(new exceptions.MissingAPI());\n }\n },\n defineClass() {\n function Class(content) {\n extend(this, content);\n }\n return Class;\n },\n ignoreTransaction(scopeFunc) {\n return PSD.trans ? usePSD(PSD.transless, scopeFunc) : scopeFunc();\n },\n vip,\n async: function (generatorFn) {\n return function () {\n try {\n var rv = awaitIterator(generatorFn.apply(this, arguments));\n if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n };\n },\n spawn: function (generatorFn, args, thiz) {\n try {\n var rv = awaitIterator(generatorFn.apply(thiz, args || []));\n if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);\n return rv;\n } catch (e) {\n return rejection(e);\n }\n },\n currentTransaction: {\n get: () => PSD.trans || null\n },\n waitFor: function (promiseOrFunction, optionalTimeout) {\n const promise = DexiePromise.resolve(typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction).timeout(optionalTimeout || 60000);\n return PSD.trans ? PSD.trans.waitFor(promise) : promise;\n },\n Promise: DexiePromise,\n debug: {\n get: () => debug,\n set: value => {\n setDebug(value, value === 'dexie' ? () => true : dexieStackFrameFilter);\n }\n },\n derive: derive,\n extend: extend,\n props: props,\n override: override,\n Events: Events,\n on: globalEvents,\n liveQuery,\n extendObservabilitySet,\n getByKeyPath: getByKeyPath,\n setByKeyPath: setByKeyPath,\n delByKeyPath: delByKeyPath,\n shallowClone: shallowClone,\n deepClone: deepClone,\n getObjectDiff: getObjectDiff,\n cmp,\n asap: asap$1,\n minKey: minKey,\n addons: [],\n connections: connections,\n errnames: errnames,\n dependencies: domDeps,\n semVer: DEXIE_VERSION,\n version: DEXIE_VERSION.split('.').map(n => parseInt(n)).reduce((p, c, i) => p + c / Math.pow(10, i * 2))\n});\nDexie.maxKey = getMaxKey(Dexie.dependencies.IDBKeyRange);\nif (typeof dispatchEvent !== 'undefined' && typeof addEventListener !== 'undefined') {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, updatedParts => {\n if (!propagatingLocally) {\n let event;\n if (isIEOrEdge) {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, true, true, updatedParts);\n } else {\n event = new CustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, {\n detail: updatedParts\n });\n }\n propagatingLocally = true;\n dispatchEvent(event);\n propagatingLocally = false;\n }\n });\n addEventListener(STORAGE_MUTATED_DOM_EVENT_NAME, ({\n detail\n }) => {\n if (!propagatingLocally) {\n propagateLocally(detail);\n }\n });\n}\nfunction propagateLocally(updateParts) {\n let wasMe = propagatingLocally;\n try {\n propagatingLocally = true;\n globalEvents.storagemutated.fire(updateParts);\n } finally {\n propagatingLocally = wasMe;\n }\n}\nlet propagatingLocally = false;\nif (typeof BroadcastChannel !== 'undefined') {\n const bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);\n if (typeof bc.unref === 'function') {\n bc.unref();\n }\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, changedParts => {\n if (!propagatingLocally) {\n bc.postMessage(changedParts);\n }\n });\n bc.onmessage = ev => {\n if (ev.data) propagateLocally(ev.data);\n };\n} else if (typeof self !== 'undefined' && typeof navigator !== 'undefined') {\n globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, changedParts => {\n try {\n if (!propagatingLocally) {\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem(STORAGE_MUTATED_DOM_EVENT_NAME, JSON.stringify({\n trig: Math.random(),\n changedParts\n }));\n }\n if (typeof self['clients'] === 'object') {\n [...self['clients'].matchAll({\n includeUncontrolled: true\n })].forEach(client => client.postMessage({\n type: STORAGE_MUTATED_DOM_EVENT_NAME,\n changedParts\n }));\n }\n }\n } catch (_a) {}\n });\n if (typeof addEventListener !== 'undefined') {\n addEventListener('storage', ev => {\n if (ev.key === STORAGE_MUTATED_DOM_EVENT_NAME) {\n const data = JSON.parse(ev.newValue);\n if (data) propagateLocally(data.changedParts);\n }\n });\n }\n const swContainer = self.document && navigator.serviceWorker;\n if (swContainer) {\n swContainer.addEventListener('message', propagateMessageLocally);\n }\n}\nfunction propagateMessageLocally({\n data\n}) {\n if (data && data.type === STORAGE_MUTATED_DOM_EVENT_NAME) {\n propagateLocally(data.changedParts);\n }\n}\nDexiePromise.rejectionMapper = mapError;\nsetDebug(debug, dexieStackFrameFilter);\nexport { Dexie$1 as Dexie, RangeSet, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap };\n","import { InjectionToken } from '@angular/core';\r\nimport { IDbContext } from '../database-context.interface';\r\n\r\nexport const DATABASE_CONFIG_TOKEN = new InjectionToken('__DATABASE_CONFIG__');\r\n","import { AssetTypeIdentifier } from \"../../model/exam/asset-type-identifier\";\r\nimport { QuestionLayoutDTO } from \"../../model/exam/question-layout-dto\";\r\n\r\nexport class AssetEntity {\r\n public id?: string;\r\n public assetId!: string;\r\n public candidateQuestionId!: string;\r\n public questionAssetTypeId!: string;\r\n public name!: string;\r\n public url!: string;\r\n public layout!: QuestionLayoutDTO;\r\n public layoutTypeIdentifier!: number;\r\n\tpublic assetTypeIdentifier!: AssetTypeIdentifier;\r\n\tpublic labelText!: string;\r\n\tpublic labelPositionIdentifier?: number;\r\n\tpublic labelAlignmentIdentifier?: number;\r\n}\r\n","export class CandidateQuestionEntity {\r\n public id?: number;\r\n public candidateQuestionId!: string;\r\n public examCandidateId!: string;\r\n public questionTypeId!: string;\r\n public questionText!: string;\r\n public potentialScore: number = 0;\r\n public orderIndex!: number;\r\n public responseCount!: number;\r\n public flagged!: boolean;\r\n\tpublic sectionId!: string;\r\n\tpublic first?: boolean;\r\n\tpublic last?: boolean;\r\n}\r\n","import { ExamLogType } from '../../model/exam/log/exam-log-type.enum';\r\n\r\nexport class ExamLogEntity {\r\n public message!: string;\r\n public type!: ExamLogType;\r\n public loggedDate!: Date;\r\n}\r\n","export class KeyValueEntity {\r\n\tpublic id?: number;\r\n public key!: string;\r\n public value!: any;\r\n}\r\n","import { IAnswer } from \"../../model/answer/answer.interface\";\r\nimport { QuestionLayoutDTO } from \"../../model/exam/question-layout-dto\";\r\n\r\nexport class QuestionAnswerEntity {\r\n public id?: number;\r\n public questionAnswerId!: string;\r\n public candidateQuestionId!: string;\r\n public answerTypeId!: string;\r\n public potentialScore!: number;\r\n public answer!: IAnswer;\r\n public layout!: QuestionLayoutDTO;\r\n\tpublic layoutTypeIdentifier!: number;\r\n\tpublic labelText!: string;\r\n\tpublic labelPositionIdentifier?: number;\r\n\tpublic labelAlignmentIdentifier?: number;\r\n}\r\n","export class QuestionSectionEntity {\r\n\tpublic id?: number;\r\n\tpublic questionSectionId!: string;\r\n\tpublic name!: string;\r\n\tpublic minimumScore!: number;\r\n\tpublic maximumScore!: number;\r\n\tpublic breakDuration?: number;\r\n\tpublic duration?: number;\r\n\tpublic orderIndex!: number;\r\n\tpublic breakStarted!: Date;\r\n\tpublic breakEnded!: Date;\r\n\tpublic sectionStarted?: Date;\r\n\tpublic sectionEnded?: Date;\r\n\tpublic timeAdjustment?: number;\r\n\tpublic paused?: number;\r\n\tpublic examCandidateId!: string;\r\n public canNavigateAway!: boolean;\r\n}\r\n","import { TimerType } from \"../../model/exam/timer-type.enum\";\r\n\r\nexport class TimedBlockEntity {\r\n\tpublic index!: number;\r\n\tpublic sectionId?: string;\r\n\tpublic type!: TimerType;\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport Dexie from 'dexie';\r\nimport { DATABASE_CONFIG_TOKEN } from './config/database-config-token';\r\nimport { IDbContext } from './database-context.interface';\r\nimport { AssetEntity } from './entities/asset-entity';\r\nimport { CandidateQuestionEntity } from './entities/candidate-question-entity';\r\nimport { ExamLogEntity } from './entities/exam-log-entity';\r\nimport { KeyValueEntity } from './entities/key-value-entity';\r\nimport { QuestionAnswerEntity } from './entities/question-answer-entity';\r\nimport { QuestionSectionEntity } from './entities/question-section-entity';\r\nimport { TimedBlockEntity } from './entities/timed-block-entity';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class AppDatabase extends Dexie {\r\n\t[key:string]:any;\r\n\t\r\n\tpublic keyValues!: Dexie.Table;\r\n\tpublic candidateQuestions!: Dexie.Table;\r\n\tpublic questionAnswers!: Dexie.Table;\r\n\tpublic assets!: Dexie.Table;\r\n\tpublic questionSections!: Dexie.Table;\r\n\tpublic examLogs!: Dexie.Table;\r\n\tpublic timedBlocks!: Dexie.Table;\r\n\r\n\tconstructor(@Inject(DATABASE_CONFIG_TOKEN) private context: IDbContext) {\r\n\t\tsuper(context.databaseName);\r\n\t\tthis.version(context.databaseVersion || 1).stores(context.schema);\r\n\r\n\t\tthis.keyValues.mapToClass(KeyValueEntity);\r\n\t\tthis.candidateQuestions.mapToClass(CandidateQuestionEntity);\r\n\t\tthis.questionAnswers.mapToClass(QuestionAnswerEntity);\r\n\t\tthis.assets.mapToClass(AssetEntity);\r\n\t\tthis.questionSections.mapToClass(QuestionSectionEntity);\r\n\t\tthis.examLogs.mapToClass(ExamLogEntity);\r\n\t\tthis.timedBlocks.mapToClass(TimedBlockEntity);\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { from, Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { CandidateQuestionDto } from '../../model/exam/candidate-question-dto';\r\nimport { AppDatabase } from '../app.database';\r\nimport { CandidateQuestionEntity } from '../entities/candidate-question-entity';\r\nimport { BaseRepository } from './base-repository';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class CandidateQuestionRepositoryService extends BaseRepository {\r\n\r\n\tconstructor(protected override db: AppDatabase) {\r\n\t\tsuper(db, 'candidateQuestions');\r\n\t}\r\n\r\n\tpublic getLastQuestion(): Observable {\r\n\t\treturn from(this.db.candidateQuestions.orderBy(\"orderIndex\").reverse().first()) as Observable;\r\n\t}\r\n\r\n\tpublic getSectionQuestions(sectionId: string): Observable {\r\n\t\treturn from(this.db.candidateQuestions.where(\"sectionId\").equals(sectionId).toArray());\r\n\t}\r\n\r\n\tpublic checkFlaggedQuestions(): Observable {\r\n\t\treturn from(this.db.candidateQuestions.where(\"flagged\").equals(\"true\").count())\r\n\t\t\t.pipe(map((val: number) => val > 0));\r\n\t}\r\n\r\n\tpublic checkNonAttemptedResponses(): Observable {\r\n\t\treturn from(this.db.candidateQuestions.where(\"responseCount\").equals(0).count())\r\n\t\t\t.pipe(map((val: number) => val > 0));\r\n\t}\r\n\r\n\tpublic convertDto(entity: CandidateQuestionEntity): CandidateQuestionDto {\r\n\t\treturn {\r\n\t\t\tid: entity.candidateQuestionId,\r\n\t\t\texamCandidateId: entity.examCandidateId,\r\n\t\t\tquestionTypeId: entity.questionTypeId,\r\n\t\t\tquestionText: entity.questionText,\r\n\t\t\tpotentialScore: entity.potentialScore,\r\n\t\t\torderIndex: entity.orderIndex,\r\n\t\t\tresponseCount: entity.responseCount,\r\n\t\t\tflagged: entity.flagged,\r\n\t\t\tsectionId: entity.sectionId,\r\n\t\t\tfirst: entity.first,\r\n\t\t\tlast: entity.last\r\n\t\t};\r\n\t}\r\n\tpublic convertEntity(dto: CandidateQuestionDto): CandidateQuestionEntity {\r\n\t\treturn {\r\n\t\t\tcandidateQuestionId: dto.id,\r\n\t\t\texamCandidateId: dto.examCandidateId,\r\n\t\t\tquestionTypeId: dto.questionTypeId,\r\n\t\t\tquestionText: dto.questionText,\r\n\t\t\tpotentialScore: dto.potentialScore,\r\n\t\t\torderIndex: dto.orderIndex,\r\n\t\t\tresponseCount: dto.responseCount,\r\n\t\t\tflagged: dto.flagged,\r\n\t\t\tsectionId: dto.sectionId,\r\n\t\t\tfirst: dto.first,\r\n\t\t\tlast: dto.last\r\n\t\t};\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { AppDatabase } from '../app.database';\r\nimport { QuestionSectionEntity } from '../entities/question-section-entity';\r\nimport { BaseRepository } from './base-repository';\r\nimport { QuestionSectionDto } from '../../model/exam/question-section-dto';\r\nimport { Observable, from } from 'rxjs';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class QuestionSectionRepositoryService extends BaseRepository {\r\n\r\n\tconstructor(protected override db: AppDatabase) {\r\n\t\tsuper(db, 'questionSections');\r\n\t}\r\n\r\n\tpublic getBySectionNumber(number: number): Observable {\r\n\t\treturn from(this.db.questionSections.where('orderIndex').equals(number).first()) as Observable;\r\n\t}\r\n\r\n public convertDto(entity: QuestionSectionEntity): QuestionSectionDto {\r\n\t\treturn {\r\n\t\t\tid: entity.questionSectionId,\r\n\t\t\tbreakDuration: entity.breakDuration,\r\n\t\t\tduration: entity.duration,\r\n\t\t\tmaximumScore: entity.maximumScore,\r\n\t\t\tminimumScore: entity.minimumScore,\r\n\t\t\tname: entity.name,\r\n\t\t\torderIndex: entity.orderIndex,\r\n\t\t\tbreakStarted: entity.breakStarted,\r\n\t\t\tbreakEnded: entity.breakEnded,\r\n\t\t\tsectionStarted: entity.sectionStarted,\r\n\t\t\tsectionEnded: entity.sectionEnded,\r\n\t\t\ttimeAdjustment: entity.timeAdjustment,\r\n\t\t\tpaused: entity.paused,\r\n\t\t\texamCandidateId: entity.examCandidateId,\r\n\t\t\tcanNavigateAway: entity.canNavigateAway\r\n\t\t};\r\n }\r\n public convertEntity(dto: QuestionSectionDto): QuestionSectionEntity {\r\n\t\treturn {\r\n\t\t\tquestionSectionId: dto.id,\r\n\t\t\tbreakDuration: dto.breakDuration,\r\n\t\t\tduration: dto.duration,\r\n\t\t\tmaximumScore: dto.maximumScore,\r\n\t\t\tminimumScore: dto.minimumScore,\r\n\t\t\tname: dto.name,\r\n\t\t\torderIndex: dto.orderIndex,\r\n\t\t\tbreakStarted: dto.breakStarted,\r\n\t\t\tbreakEnded: dto.breakEnded,\r\n\t\t\tsectionStarted: dto.sectionStarted,\r\n\t\t\tsectionEnded: dto.sectionEnded,\r\n\t\t\ttimeAdjustment: dto.timeAdjustment,\r\n\t\t\tpaused: dto.paused,\r\n\t\t\texamCandidateId: dto.examCandidateId,\r\n\t\t\tcanNavigateAway: dto.canNavigateAway\r\n\t\t};\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { from, Observable } from 'rxjs';\r\nimport { map, switchMap } from 'rxjs/operators';\r\nimport { AppDatabase } from '../app.database';\r\nimport { KeyValueEntity } from '../entities/key-value-entity';\r\nimport { BaseRepository } from './base-repository';\r\nimport { ExamSectionBreakResponseDto } from '../../model/exam/exam-section-break-response-dto';\r\nimport { KeyValue } from '@angular/common';\r\nimport { LockedState } from '../../service/lockout.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class KeyValueRepositoryService extends BaseRepository {\r\n\r\n\r\n\tconstructor(protected override db: AppDatabase) {\r\n\t\tsuper(db, 'keyValues');\r\n\t}\r\n\r\n\tpublic getCurrentBlock(): Observable {\r\n\t\treturn this.get('key', 'currentBlock')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setCurrentBlock(currentBlock: number): Observable {\r\n\t\treturn this.get('key', 'currentBlock')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = currentBlock;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'currentBlock',\r\n\t\t\t\t\t\tvalue: currentBlock\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\r\n\r\n\tpublic setLearnerName(learnerName: string): Observable {\r\n\t\treturn this.get('key', 'learnerName')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = learnerName;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'learnerName',\r\n\t\t\t\t\t\tvalue: learnerName\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getLearnerName(): Observable {\r\n\t\treturn this.get('key', 'learnerName')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setSubjectName(subjectName: string): Observable {\r\n\t\treturn this.get('key', 'subjectName')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = subjectName;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'subjectName',\r\n\t\t\t\t\t\tvalue: subjectName\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getSubjectName(): Observable {\r\n\t\treturn this.get('key', 'subjectName')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setScheduledFinish(scheduledFinish: Date): Observable {\r\n\t\treturn this.get('key', 'scheduledFinish')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = scheduledFinish;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'scheduledFinish',\r\n\t\t\t\t\t\tvalue: scheduledFinish\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getScheduledFinish(): Observable {\r\n\t\treturn this.get('key', 'scheduledFinish')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn new Date(keyValueEntity?.value);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setCurrentQuestionNumber(currentQuestionNumber: number): Observable {\r\n\t\treturn this.get('key', 'currentQuestionNumber')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = currentQuestionNumber;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'currentQuestionNumber',\r\n\t\t\t\t\t\tvalue: currentQuestionNumber\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getCurrentQuestionNumber(): Observable {\r\n\t\treturn this.get('key', 'currentQuestionNumber')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn Number(keyValueEntity?.value);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getCurrentSectionNumber(): Observable {\r\n\t\treturn this.get('key', 'currentSectionNumber')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setCurrentSectionNumber(currentSectionNumber: number): Observable {\r\n\t\treturn this.get('key', 'currentSectionNumber')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = currentSectionNumber;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'currentSectionNumber',\r\n\t\t\t\t\t\tvalue: currentSectionNumber\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setPauseTime(pauseTime: Date): Observable {\r\n\t\treturn this.get('key', 'pauseTime')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = pauseTime;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'pauseTime',\r\n\t\t\t\t\t\tvalue: pauseTime\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getPauseTime(): Observable {\r\n\t\treturn this.get('key', 'pauseTime')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn new Date(keyValueEntity?.value);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setInBreak(value: boolean): Observable {\r\n\t\treturn this.get('key', 'break')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'break',\r\n\t\t\t\t\t\tvalue: value\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getBreakTimes(): Observable {\r\n\t\treturn this.get('key', 'breakTimes')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getInBreak(): Observable {\r\n\t\treturn this.get('key', 'break')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setBreakTimes(value: ExamSectionBreakResponseDto): Observable {\r\n\t\treturn this.get('key', 'breakTimes')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'breakTimes',\r\n\t\t\t\t\t\tvalue: value\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getExamType(): Observable {\r\n\t\treturn this.get('key', 'examType')\r\n\t\t\t.pipe(map((KeyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn KeyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setExamType(examType: string): Observable {\r\n\t\treturn this.get('key', 'examType')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = examType;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'examType',\r\n\t\t\t\t\t\tvalue: examType\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setChecksum(checksum: Uint8Array): Observable {\r\n return this.get('key', 'checksum')\r\n .pipe(map((existingValue: KeyValueEntity) => {\r\n if (existingValue) {\r\n existingValue.value = checksum;\r\n } else {\r\n existingValue = {\r\n key: 'checksum',\r\n value: checksum\r\n };\r\n }\r\n\r\n return existingValue;\r\n })).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n return this.put(existingValue);\r\n }));\r\n }\r\n\r\n public getChecksum(): Observable {\r\n return this.get('key', 'checksum')\r\n .pipe(map((keyValueEntity: KeyValueEntity) => {\r\n return keyValueEntity?.value as Uint8Array;\r\n }));\r\n\t}\r\n\r\n\tpublic convertDto(entity: KeyValueEntity): object {\r\n\t\tthrow new Error(\"Method not implemented.\");\r\n\t}\r\n\tpublic convertEntity(dto: object): KeyValueEntity {\r\n\t\tthrow new Error(\"Method not implemented.\");\r\n\t}\r\n\r\n\tpublic setEndTime(endTime: Date): Observable {\r\n\t\treturn this.get('key', 'endTime')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = endTime;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'endTime',\r\n\t\t\t\t\t\tvalue: endTime\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getEndTime(): Observable {\r\n\t\treturn this.get('key', 'endTime')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn new Date(keyValueEntity?.value);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getLockedState(): Observable {\r\n\t\treturn this.get('key', 'locked')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setLockedState(value: LockedState): Observable {\r\n\t\treturn this.get('key', 'locked')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'locked',\r\n\t\t\t\t\t\tvalue: value\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setExamCodeChecksum(examCode: string): Observable {\r\n\t\treturn this.get('key', 'examCode')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = examCode;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'examCode',\r\n\t\t\t\t\t\tvalue: examCode\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getExamCodeChecksum(): Observable {\r\n\t\treturn this.get('key', 'examCode')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setMockFlag(isMock: boolean): Observable {\r\n\t\treturn this.get('key', 'isMock')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = isMock;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'isMock',\r\n\t\t\t\t\t\tvalue: isMock\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getMockFlag(): Observable {\r\n\t\treturn this.get('key', 'isMock')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setIntroductionGuidance(introductionGuidance: string): Observable {\r\n\t\treturn this.get('key', 'introductionGuidance')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = introductionGuidance;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'introductionGuidance',\r\n\t\t\t\t\t\tvalue: introductionGuidance\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getIntroductionGuidance(): Observable {\r\n\t\treturn this.get('key', 'introductionGuidance')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setIsPaused(value: boolean): Observable {\r\n\t\treturn this.get('key', 'paused')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'paused',\r\n\t\t\t\t\t\tvalue: value\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getIsPaused(): Observable {\r\n\t\treturn this.get('key', 'paused')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getPaperCode(): Observable {\r\n\t\treturn this.get('key', 'paperCode')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic setPaperCode(value: string): Observable {\r\n\t\treturn this.get('key', 'paperCode')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'paperCode',\r\n\t\t\t\t\t\tvalue: value\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\tpublic getCanNavigateAway(): Observable {\r\n\t\treturn this.get('key', 'canNavigateAway')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\tpublic setCanNavigateAway(canNavigate: boolean): Observable {\r\n\t\treturn this.get('key', 'canNavigateAway')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = canNavigate;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'canNavigateAway',\r\n\t\t\t\t\t\tvalue: canNavigate\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getMockUploaded(): Observable {\r\n\t\treturn this.get('key', 'mockUploaded')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\tpublic setMockUploaded(mockUploaded: boolean): Observable {\r\n\t\treturn this.get('key', 'mockUploaded')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = mockUploaded;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'mockUploaded',\r\n\t\t\t\t\t\tvalue: mockUploaded\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getMockReference(): Observable {\r\n\t\treturn this.get('key', 'mockReference')\r\n\t\t\t.pipe(map((keyValueEntity: KeyValueEntity) => {\r\n\r\n\t\t\t\tif (!keyValueEntity) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn keyValueEntity?.value;\r\n\t\t\t}));\r\n\t}\r\n\tpublic setMockReference(mockReference: string): Observable {\r\n\t\treturn this.get('key', 'mockReference')\r\n\t\t\t.pipe(map((existingValue: KeyValueEntity) => {\r\n\t\t\t\tif (existingValue) {\r\n\t\t\t\t\texistingValue.value = mockReference;\r\n\t\t\t\t} else {\r\n\t\t\t\t\texistingValue = {\r\n\t\t\t\t\t\tkey: 'mockReference',\r\n\t\t\t\t\t\tvalue: mockReference\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn existingValue;\r\n\t\t\t})).pipe(switchMap((existingValue: KeyValueEntity) => {\r\n\t\t\t\treturn this.put(existingValue);\r\n\t\t\t}));\r\n\t}\r\n\r\n\r\n\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { forkJoin, Observable, of } from 'rxjs';\r\nimport { map, mergeMap, switchMap } from 'rxjs/operators';\r\nimport { QuestionSectionStateDto } from '../../model/exam/state/question-section-state-dto';\r\nimport { CandidateQuestionEntity } from '../entities/candidate-question-entity';\r\nimport { QuestionSectionEntity } from '../entities/question-section-entity';\r\nimport { CandidateQuestionRepositoryService } from '../repositories/candidate-question-repository.service';\r\nimport { QuestionSectionRepositoryService } from '../repositories/question-section-repository.service';\r\nimport { QuestionSectionDto } from '../../model/exam/question-section-dto';\r\nimport { KeyValueRepositoryService } from '../repositories/key-value-repository.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class QuestionSectionDataService {\r\n\tconstructor(private candidateQuestionRepository: CandidateQuestionRepositoryService,\r\n\t\tprivate questionSectionRepository: QuestionSectionRepositoryService,\r\n\t\tprivate keyValueDataRepository: KeyValueRepositoryService) {\r\n\t\tthis.getSectionQuestions = this.getSectionQuestions.bind(this);\r\n\t}\r\n\r\n\tpublic get(key: string): Observable {\r\n\t\treturn this.questionSectionRepository.get('questionSectionId', key)\r\n\t\t\t.pipe(map((data: QuestionSectionEntity) => {\r\n\t\t\t\treturn this.questionSectionRepository.convertDto(data);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getAll(): Observable {\r\n\t\treturn this.questionSectionRepository.getAll()\r\n\t\t\t.pipe(map(sectionEntities => sectionEntities.map(sectionEntity => this.questionSectionRepository.convertDto(sectionEntity))));\r\n\t}\r\n\r\n\tpublic put(section: QuestionSectionDto): Observable {\r\n\t\tconst entity: QuestionSectionEntity = this.questionSectionRepository.convertEntity(section);\r\n\t\treturn this.questionSectionRepository.put(entity);\r\n\t}\r\n\r\n\tpublic getBySectionNumber(sectionNumber: number) {\r\n\t\treturn this.questionSectionRepository.getBySectionNumber(sectionNumber)\r\n\t\t\t.pipe(map((data: QuestionSectionEntity) => {\r\n\t\t\t\treturn this.questionSectionRepository.convertDto(data);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getCurrentSection(): Observable {\r\n\t\treturn this.keyValueDataRepository.getCurrentSectionNumber()\r\n\t\t\t.pipe(mergeMap((currentSectionNumber: number) => this.getBySectionNumber(currentSectionNumber)))\r\n\t}\r\n\r\n\tpublic getNextSection(sectionNumber: number): Observable {\r\n\t\treturn this.questionSectionRepository.getBySectionNumber(++sectionNumber)\r\n\t\t\t.pipe(map((data: QuestionSectionEntity) => {\r\n\r\n\t\t\t\t\treturn this.questionSectionRepository.convertDto(data);\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getSectionQuestions(): Observable {\r\n\t\treturn this.questionSectionRepository.getAll()\r\n\t\t\t.pipe(switchMap((entities: QuestionSectionEntity[]) => forkJoin(entities.map((sectionEntity: QuestionSectionEntity) => {\r\n\t\t\t\treturn forkJoin({\r\n\t\t\t\t\tsection: of(sectionEntity),\r\n\t\t\t\t\tquestionStates: this.candidateQuestionRepository.getSectionQuestions(sectionEntity.questionSectionId)\r\n\t\t\t\t}).pipe(map((data: { section: QuestionSectionEntity, questionStates: CandidateQuestionEntity[] }) => {\r\n\t\t\t\t\tconst sectionState: QuestionSectionStateDto = {\r\n\t\t\t\t\t\t...this.questionSectionRepository.convertDto(data.section),\r\n\t\t\t\t\t\tquestionStates: data.questionStates.map(candidateQuestionEntity => {\r\n\t\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\t\tquestion: this.candidateQuestionRepository.convertDto(candidateQuestionEntity),\r\n\t\t\t\t\t\t\t\tlayoutItems: []\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t};\r\n\t\t\t\t\treturn sectionState;\r\n\t\t\t\t}));\r\n\t\t\t}))));\r\n\t}\r\n\r\n\tpublic updateTimeAdjustment(section: QuestionSectionDto): Observable {\r\n\t\treturn this.get(section.id)\r\n\t\t\t.pipe(map((localSection: QuestionSectionDto) => {\r\n\t\t\t\tlocalSection.timeAdjustment = (localSection.timeAdjustment ? localSection.timeAdjustment : 0) + section.timeAdjustment!;\r\n\t\t\t\treturn localSection;\r\n\t\t\t}))\r\n\t\t\t.pipe(mergeMap((localSection: QuestionSectionDto) => this.put(localSection)));\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { LockedState } from '../../service/lockout.service';\r\nimport { ExamSectionBreakResponseDto } from '../../model/exam/exam-section-break-response-dto';\r\nimport { KeyValueRepositoryService } from '../repositories/key-value-repository.service';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class KeyValueDataService {\r\n\r\n constructor(private keyValueRepository: KeyValueRepositoryService) { }\r\n\r\n public setLearnerName(learnerName: string): Observable {\r\n return this.keyValueRepository.setLearnerName(learnerName);\r\n\t}\r\n\r\n\tpublic getCurrentBlockIndex(): Observable {\r\n\t\treturn this.keyValueRepository.getCurrentBlock();\r\n\t}\r\n\r\n\tpublic setCurrentBlock(currentBlock: number): Observable {\r\n\t\treturn this.keyValueRepository.setCurrentBlock(currentBlock);\r\n\t}\r\n\r\n public getLearnerName(): Observable {\r\n return this.keyValueRepository.getLearnerName();\r\n }\r\n\r\n public setSubjectName(subjectName: string): Observable {\r\n return this.keyValueRepository.setSubjectName(subjectName);\r\n }\r\n\r\n public getSubjectName(): Observable {\r\n return this.keyValueRepository.getSubjectName();\r\n }\r\n\r\n public setScheduledFinish(scheduledFinish: Date): Observable {\r\n return this.keyValueRepository.setScheduledFinish(scheduledFinish);\r\n }\r\n\r\n public getScheduledFinish(): Observable {\r\n return this.keyValueRepository.getScheduledFinish();\r\n\t}\r\n\r\n\tpublic getCurrentSectionNumber(): Observable {\r\n\t\treturn this.keyValueRepository.getCurrentSectionNumber();\r\n }\r\n\r\n\tpublic getInBreak(): Observable {\r\n\t\treturn this.keyValueRepository.getInBreak();\r\n\t}\r\n\r\n\tpublic setInBreak(value: boolean): Observable {\r\n\t\treturn this.keyValueRepository.setInBreak(value);\r\n\t}\r\n\r\n\tpublic getBreakTime(): Observable {\r\n\t\treturn this.keyValueRepository.getBreakTimes();\r\n\t}\r\n\r\n\tpublic setBreakTimes(value: ExamSectionBreakResponseDto): Observable {\r\n\t\treturn this.keyValueRepository.setBreakTimes(value);\r\n }\r\n\r\n public setExamType(examType: string): Observable {\r\n return this.keyValueRepository.setExamType(examType);\r\n }\r\n\r\n public getExamType(): Observable {\r\n return this.keyValueRepository.getExamType();\r\n }\r\n\r\n\tpublic setCurrentSectionNumber(value: number): Observable {\r\n\t\treturn this.keyValueRepository.setCurrentSectionNumber(value);\r\n\t}\r\n\r\n public setEndTime(endTime: Date): Observable {\r\n return this.keyValueRepository.setEndTime(endTime);\r\n }\r\n\r\n public getEndTime(): Observable {\r\n return this.keyValueRepository.getEndTime();\r\n }\r\n\r\n public setLockedState(lockedState: LockedState): Observable {\r\n return this.keyValueRepository.setLockedState(lockedState);\r\n }\r\n\r\n public getLockedState(): Observable {\r\n return this.keyValueRepository.getLockedState();\r\n }\r\n\r\n public setExamCodeChecksum(examCode: string): Observable {\r\n return this.keyValueRepository.setExamCodeChecksum(examCode);\r\n }\r\n\r\n public getExamCodeChecksum(): Observable {\r\n return this.keyValueRepository.getExamCodeChecksum();\r\n }\r\n\r\n public setMockFlag(isMock: boolean): Observable {\r\n return this.keyValueRepository.setMockFlag(isMock);\r\n }\r\n\r\n public getMockFlag(): Observable {\r\n return this.keyValueRepository.getMockFlag();\r\n }\r\n\r\n public setCurrentQuestionNumber(questionNumber: number): Observable {\r\n return this.keyValueRepository.setCurrentQuestionNumber(questionNumber);\r\n }\r\n\r\n public getCurrentQuestionNumber(): Observable {\r\n return this.keyValueRepository.getCurrentQuestionNumber();\r\n }\r\n\r\n public setIntroductionGuidance(introductionGuidance: string): Observable {\r\n return this.keyValueRepository.setIntroductionGuidance(introductionGuidance);\r\n }\r\n\r\n public getIntroductionGuidance(): Observable {\r\n return this.keyValueRepository.getIntroductionGuidance();\r\n }\r\n\r\n public getIsPaused(): Observable {\r\n return this.keyValueRepository.getIsPaused();\r\n }\r\n\r\n public setIsPaused(isPaused: boolean): Observable {\r\n return this.keyValueRepository.setIsPaused(isPaused);\r\n\t}\r\n\r\n\tpublic getPaperCode(): Observable {\r\n\t\treturn this.keyValueRepository.getPaperCode();\r\n\t}\r\n\r\n\tpublic setPaperCode(paperCode: string): Observable {\r\n\t\treturn this.keyValueRepository.setPaperCode(paperCode);\r\n\t}\r\n\r\n\tpublic getCanNavigateAway(): Observable {\r\n\t\treturn this.keyValueRepository.getCanNavigateAway();\r\n\t}\r\n\r\n\tpublic setCanNavigateAway(canNavigateAway: boolean): Observable {\r\n\t\treturn this.keyValueRepository.setCanNavigateAway(canNavigateAway);\r\n\t}\r\n\r\n\tpublic getMockUploaded(): Observable {\r\n\t\treturn this.keyValueRepository.getMockUploaded();\r\n\t}\r\n\tpublic setMockUploaded(uploaded: boolean): Observable {\r\n\t\treturn this.keyValueRepository.setMockUploaded(uploaded);\r\n\t}\r\n\tpublic getMockReference(): Observable {\r\n\t\treturn this.keyValueRepository.getMockReference();\r\n\t}\r\n\tpublic setMockReference(reference: string): Observable {\r\n\t\treturn this.keyValueRepository.setMockReference(reference);\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { interval, Subject } from 'rxjs';\r\nimport { takeWhile } from 'rxjs/operators';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AutoSaveService {\r\n private autoSaveAnswerSource: Subject = new Subject();\r\n\tpublic autoSaveAnswerChange$ = this.autoSaveAnswerSource.asObservable();\r\n\r\n public isAutoSaving: boolean = false;\r\n\r\n constructor() { }\r\n\r\n public beginAutoSaving(): void {\r\n if (!this.isAutoSaving) {\r\n this.isAutoSaving = true;\r\n this.startAutoSaveProcess();\r\n }\r\n }\r\n\r\n public stopAutoSaving(): void {\r\n this.isAutoSaving = false;\r\n }\r\n\r\n public triggerAutoSave(): void {\r\n this.autoSaveAnswerSource.next();\r\n }\r\n\r\n public startAutoSaveProcess(): void {\r\n interval(30000)\r\n .pipe(takeWhile(() => this.isAutoSaving))\r\n .subscribe(() => {\r\n this.triggerAutoSave();\r\n });\r\n }\r\n}\r\n","import { ExamLogType } from \"./exam-log-type.enum\";\r\n\r\nexport class ExamLogDto {\r\n\tpublic message: string;\r\n\tpublic type: ExamLogType;\r\n\tpublic loggedDate: Date;\r\n\r\n\tconstructor(message: string, type: ExamLogType) {\r\n\t\tthis.message = message;\r\n\t\tthis.type = type;\r\n\t\tthis.loggedDate = new Date();\r\n\t}\r\n}\r\n","export enum ExamLogType {\r\n\tAuthenticationInformation = 0,\r\n\tAuthenticationWarning = 1,\r\n\tCandidateExamInformation = 2,\r\n\tCandidateBreakInformation = 3,\r\n\tCandidateNavigatedWarning = 4,\r\n\tCandidateLocked = 5,\r\n\tCandidateUnlocked = 6\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { iif, interval, Observable, of } from 'rxjs';\r\nimport { first, map, mergeMap, switchMap, takeWhile } from 'rxjs/operators';\r\nimport { KeyValueDataService } from '../database/services/key-value-data.service';\r\nimport { ExamLogDto } from '../model/exam/log/exam-log-dto';\r\nimport { ExamLogType } from '../model/exam/log/exam-log-type.enum';\r\nimport { AutoSaveService } from './autosave.service';\r\nimport { DashboardService } from './dashboard.service';\r\n\r\nexport enum LockedState {\r\n Unlocked,\r\n Locked\r\n}\r\n\r\nexport enum BlurType {\r\n Body,\r\n IFrame\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class LockoutService {\r\n private blurEvents: BlurType[] = [];\r\n private blurWatchingActive: boolean = false;\r\n\r\n constructor(private keyValueDataService: KeyValueDataService,\r\n private router: Router,\r\n private dashboardService: DashboardService,\r\n private autoSaveService: AutoSaveService) {}\r\n\r\n public isLocked(): Observable {\r\n return this.keyValueDataService.getLockedState()\r\n .pipe(map((lockedState: LockedState) => lockedState === LockedState.Locked));\r\n }\r\n\r\n public lockCandidateOut(): void {\r\n this.keyValueDataService.getExamCodeChecksum()\r\n .pipe(switchMap((checksum: string) => iif(\r\n () => !!checksum,\r\n this.keyValueDataService.getLockedState()\r\n .pipe(map((lockedState: LockedState) => {\r\n if (lockedState === LockedState.Unlocked) {\r\n const log = new ExamLogDto('Candidate has been locked', ExamLogType.CandidateLocked);\r\n let logs = [];\r\n\r\n if (localStorage['examLogs']) {\r\n if (JSON.parse(localStorage['examLogs']).length) {\r\n logs = JSON.parse(localStorage['examLogs']);\r\n logs.push(log);\r\n } else {\r\n logs = [log];\r\n }\r\n } else {\r\n logs = [log];\r\n }\r\n\r\n localStorage['examLogs'] = JSON.stringify(logs);\r\n }\r\n }))\r\n .pipe(mergeMap(() => this.keyValueDataService.setLockedState(LockedState.Locked)))\r\n .pipe(mergeMap(() => this.dashboardService.sendLockedNotification()))\r\n .pipe(map(() => this.redirectLocked())),\r\n of(null)\r\n )))\r\n .pipe(first())\r\n .subscribe(() => {\r\n this.blurEvents.length = 0;\r\n this.stopBlurWatching();\r\n });\r\n }\r\n\r\n public redirectLocked(): void {\r\n this.router.navigateByUrl('exam/locked');\r\n }\r\n\r\n public startBlurWatching(): void {\r\n this.keyValueDataService.getExamCodeChecksum().subscribe((checksum: string) => {\r\n if (!!checksum && !this.blurWatchingActive) {\r\n this.blurWatchingActive = true;\r\n this.startBlurWatchingProcess();\r\n }\r\n });\r\n }\r\n\r\n public stopBlurWatching(): void {\r\n this.blurWatchingActive = false;\r\n }\r\n\r\n public consumeBlurItems(): boolean {\r\n if (this.blurEvents.length) {\r\n const lockCandidateOut: boolean = this.blurEvents.indexOf(BlurType.IFrame) === -1;\r\n\r\n this.blurEvents.length = 0;\r\n\r\n if (lockCandidateOut) {\r\n this.stopBlurWatching();\r\n }\r\n\r\n return lockCandidateOut;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public addBlurItem(blurItem: BlurType): void {\r\n if (this.blurWatchingActive) {\r\n this.blurEvents.push(blurItem);\r\n }\r\n }\r\n\r\n private startBlurWatchingProcess(): void {\r\n interval(250)\r\n .pipe(takeWhile(() => this.blurWatchingActive))\r\n .pipe(map(() => this.consumeBlurItems()))\r\n .subscribe((lockCandidate: boolean) => {\r\n if (lockCandidate) {\r\n this.autoSaveService.stopAutoSaving();\r\n this.lockCandidateOut();\r\n }\r\n });\r\n }\r\n}\r\n","export enum AnswerTypeIdentifier {\r\n\tMultiChoiceSingleAnswer = 1,\r\n\tMultiChoiceMultiAnswer,\r\n\tOpenResponse,\r\n\tChart,\r\n\tTable,\r\n\tReorder,\r\n\tCalculator,\r\n\t_3DShape,\r\n\tScale,\r\n\tForm,\r\n\tDocumentUpload\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { FormAnswerItemDTO } from \"./form-answer-item-dto\";\r\n\r\nexport class FormAnswerDTO implements IAnswer {\r\n public answerId!: string;\r\n public answerType!: string;\r\n public answerTypeId!: string;\r\n public answerTypeIdentifier!: number;\r\n public potentialScore!: number;\r\n\tpublic formItems!: FormAnswerItemDTO[];\r\n\r\n\tpublic answered(): boolean {\r\n\t\tconst answered: boolean = this.formItems!.filter(x => (!x.checkedByDefault && x.userInput != null && x.userInput.toString().trim() != \"\") || (x.checkedByDefault && x.userInput == \"False\")).length > 0;\r\n\t\treturn answered;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\n\r\nexport class CalculatorAnswerDto implements IAnswer {\r\n public answerId!: string;\r\n public answerType!: string;\r\n public answerTypeId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic answerJson!: string;\r\n\tpublic showLogByDefault!: boolean;\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.answerJson) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\n\r\n\r\nexport class ChartAnswerDTO implements IAnswer {\r\n\tpublic chartTypeId!: string;\r\n\tpublic answerJSON!: string;\r\n\tpublic chartTypeIdentifier!: number;\r\n\tpublic answerId!: string;\r\n\tpublic answerType!: string;\r\n\tpublic answerTypeId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.answerJSON) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { OpenResponseAnswerDto } from \"./open-response-answer-dto\";\r\n\r\n\r\nexport class OpenResponseAnswerGroupDto implements IAnswer {\r\n\tpublic answerId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic answerType!: string;\r\n\tpublic answerTypeId!: string;\r\n\tpublic answers!: OpenResponseAnswerDto[];\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.answers && this.answers.length) {\r\n\r\n\t\t\tif (this.answers.some(x => x.answerText)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { ReorderAnswerRowDto } from \"./reorder-answer-row-dto\";\r\n\r\nexport class ReorderAnswerDto implements IAnswer {\r\n\tpublic id!: string;\r\n\tpublic answerId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic answerType!: string;\r\n\tpublic answerTypeId!: string;\r\n\tpublic reorderAnswerRows!: ReorderAnswerRowDto[];\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.reorderAnswerRows && this.reorderAnswerRows.length) {\r\n\t\t\treturn this.reorderAnswerRows.some(x => x.orderIndex !== x.initialOrderIndex);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\n\r\n\r\nexport class ScaleAnswerDto implements IAnswer {\r\n public answerId!: string;\r\n public answerType!: string;\r\n public answerTypeId!: string;\r\n public answerTypeIdentifier!: number;\r\n\tpublic pointCount!: number;\r\n\tpublic leftText!: string;\r\n\tpublic middleText!: string;\r\n\tpublic rightText!: string;\r\n\tpublic answerJSON!: string;\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.answerJSON) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { TableAnswerCellDto } from \"./table-answer-cell-dto\";\r\n\r\nexport class TableAnswerDto implements IAnswer {\r\n\tpublic id!: string;\r\n\tpublic answerId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic answerType!: string;\r\n\tpublic answerTypeId!: string;\r\n\tpublic cols!: number;\r\n\tpublic rows!: number;\r\n\tpublic tableAnswerCells: TableAnswerCellDto[] = [];\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.tableAnswerCells && this.tableAnswerCells.length) {\r\n\r\n\t\t\tif (this.tableAnswerCells.some(x => x.isEditable && x.text)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { _3DShapeAssetDto } from \"./3d-shape-asset-dto\";\r\nimport { _3DShapeAnswerDefaultLinesDto } from \"./3d-shape-default-lines-dto\";\r\n\r\nexport class _3DShapeAnswerDto implements IAnswer {\r\n\r\n\tpublic id!: string;\r\n\tpublic answerId!: string;\r\n\tpublic answerType!: string;\r\n\tpublic answerTypeId!: string;\r\n\tpublic answerTypeIdentifier!: number;\r\n\tpublic additionalText!: string;\r\n\tpublic height?: number;\r\n\tpublic width?: number;\r\n\tpublic answerJSON!: string;\r\n\tpublic defaultLines: _3DShapeAnswerDefaultLinesDto[] = [];\r\n\tpublic assetInfo!: _3DShapeAssetDto;\r\n\tpublic potentialScore!: number;\r\n\r\n\tpublic answered(): boolean {\r\n\t\tif (this.answerJSON) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}\r\n","import { IAnswer } from \"../answer.interface\";\r\nimport { MultiChoiceAnswerDTO } from \"./multi-choice-answer-dto\";\r\n\r\nexport class MultiChoiceGroupAnswerDTO implements IAnswer {\r\n public answerId!: string;\r\n public answerType!: string;\r\n public answerTypeId!: string;\r\n public answerTypeIdentifier!: number;\r\n public potentialScore!: number;\r\n public answers!: MultiChoiceAnswerDTO[];\r\n\r\n public answered(): boolean {\r\n\t\tif (this.answers && this.answers.length) {\r\n\r\n\t\t\tif (this.answers.some(x => x.selected)) {\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n}","import { IAnswer } from \"../answer.interface\";\r\n\r\n\r\nexport class DocumentUploadAnswerDto implements IAnswer {\r\n\tpublic id!: string;\r\n public answerId!: string;\r\n public answerType!: string;\r\n public answerTypeId!: string;\r\n public answerTypeIdentifier!: number;\r\n\tpublic docmentUrl!: string;\r\n\tpublic answerJSON!: string;\r\n\tpublic potentialScore!: number;\r\n\tpublic hasInteracted: boolean = false;\r\n\r\n\tpublic answered(): boolean {\r\n\t\treturn this.hasInteracted;\r\n\t}\r\n}\r\n","import { AnswerTypeIdentifier } from \"../../model/answer/answer-type-enum\";\r\nimport { IAnswer } from \"../../model/answer/answer.interface\";\r\nimport { CalculatorAnswerDto } from \"../../model/answer/calculator/calculator-answer-dto\";\r\nimport { ChartAnswerDTO } from \"../../model/answer/chart/chart-answer-dto\";\r\nimport { OpenResponseAnswerGroupDto } from \"../../model/answer/open-response/open-response-group-answer-dto\";\r\nimport { ReorderAnswerDto } from \"../../model/answer/reorder/reorder-answer-dto\";\r\nimport { ScaleAnswerDto } from \"../../model/answer/scale/scale-answer-dto\";\r\nimport { TableAnswerDto } from \"../../model/answer/table/table-answer-dto\";\r\nimport { _3DShapeAnswerDto } from \"../../model/answer/3d-shape/3d-shape-answer-dto\";\r\nimport { MultiChoiceGroupAnswerDTO } from \"../../model/answer/multi-choice/multi-choice-group-answer-dto\";\r\nimport { DocumentUploadAnswerDto } from \"../../model/answer/document-upload/document-upload-answer-dto\";\r\nimport { FormAnswerDTO } from \"../../model/answer/form/form-answer-dto\";\r\n\r\nexport class AnswerFactoryService {\r\n\r\n\tpublic static make(answer: IAnswer): IAnswer {\r\n\t\tswitch (answer.answerTypeIdentifier) {\r\n\r\n\t\t\tcase AnswerTypeIdentifier.Calculator:\r\n\t\t\t\treturn Object.assign(new CalculatorAnswerDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.Chart:\r\n\t\t\t\treturn Object.assign(new ChartAnswerDTO(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.OpenResponse:\r\n\t\t\t\treturn Object.assign(new OpenResponseAnswerGroupDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.Reorder:\r\n\t\t\t\treturn Object.assign(new ReorderAnswerDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.Scale:\r\n\t\t\t\treturn Object.assign(new ScaleAnswerDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.Table:\r\n\t\t\t\treturn Object.assign(new TableAnswerDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier._3DShape:\r\n\t\t\t\treturn Object.assign(new _3DShapeAnswerDto(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.MultiChoiceSingleAnswer:\r\n\t\t\tcase AnswerTypeIdentifier.MultiChoiceMultiAnswer:\r\n\t\t\t\treturn Object.assign(new MultiChoiceGroupAnswerDTO(), answer);\r\n\t\t\tcase AnswerTypeIdentifier.Form:\r\n\t\t\t\treturn Object.assign(new FormAnswerDTO(), answer);\r\n case AnswerTypeIdentifier.DocumentUpload:\r\n\t\t\t\treturn Object.assign(new DocumentUploadAnswerDto(), answer);\r\n\t\t\tdefault:\r\n\t\t\t\treturn answer;\r\n\t\t}\r\n\t}\r\n\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { QuestionAnswerStateDTO } from '../../model/exam/state/question-answer-state-dto';\r\nimport { AppDatabase } from '../app.database';\r\nimport { QuestionAnswerEntity } from '../entities/question-answer-entity';\r\nimport { BaseRepository } from './base-repository';\r\nimport { AnswerFactoryService } from '../services/answer-factory.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class QuestionAnswerRepositoryService extends BaseRepository {\r\n\r\n\tconstructor(protected override db: AppDatabase) {\r\n\t\tsuper(db, 'questionAnswers');\r\n\t}\r\n\r\n\tpublic convertDto(entity: QuestionAnswerEntity): QuestionAnswerStateDTO {\r\n\t\treturn {\r\n\t\t\tid: entity.questionAnswerId,\r\n\t\t\tcandidateQuestionId: entity.candidateQuestionId,\r\n\t\t\tanswerTypeId: entity.answerTypeId,\r\n\t\t\tpotentialScore: entity.potentialScore,\r\n\t\t\tanswer: AnswerFactoryService.make(entity.answer),\r\n\t\t\tlayout: entity.layout,\r\n\t\t\tlayoutTypeIdentifier: entity.layoutTypeIdentifier,\r\n\t\t\tlabelText: entity.labelText,\r\n\t\t\tlabelAlignmentIdentifier: entity.labelAlignmentIdentifier,\r\n\t\t\tlabelPositionIdentifier: entity.labelPositionIdentifier\r\n\t\t}\r\n\t}\r\n\r\n\tpublic convertEntity(dto: QuestionAnswerStateDTO): QuestionAnswerEntity {\r\n\t\treturn {\r\n\t\t\tquestionAnswerId: dto.id,\r\n\t\t\tcandidateQuestionId: dto.candidateQuestionId,\r\n\t\t\tanswerTypeId: dto.answerTypeId,\r\n\t\t\tpotentialScore: dto.potentialScore,\r\n\t\t\tanswer: dto.answer,\r\n\t\t\tlayout: dto.layout,\r\n\t\t\tlayoutTypeIdentifier: dto.layoutTypeIdentifier,\r\n\t\t\tlabelText: dto.labelText,\r\n\t\t\tlabelAlignmentIdentifier: dto.labelAlignmentIdentifier,\r\n\t\t\tlabelPositionIdentifier: dto.labelPositionIdentifier\r\n\t\t}\r\n\t}\r\n}\r\n","import { HttpClient, HttpErrorResponse } from '@angular/common/http';\r\nimport { Inject, Injectable } from '@angular/core';\r\nimport { Observable, of } from 'rxjs';\r\nimport { map, catchError } from 'rxjs/operators';\r\nimport { APIResponse } from '../../model/request/APIResponse';\r\nimport { ConnectionService } from '../connection.service';\r\nimport { ErrorService } from '../error/error.service';\r\nimport { ErrorCode } from '../error/application-error-handler';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class RequestService {\r\n\r\n\tconstructor(private http: HttpClient,\r\n\t\t@Inject('servicesBaseUrl') private servicesBaseUrl: string,\r\n\t\tprivate errorService: ErrorService,\r\n\t\tprivate connectionService: ConnectionService) {\r\n\t\tthis.processResponse = this.processResponse.bind(this);\r\n\t}\r\n\r\n\tpublic get(url: string): Observable> {\r\n\t\treturn this.http.get>(`${this.servicesBaseUrl}/api/${url}`)\r\n\t\t\t.pipe(catchError(err => this.processError(err)))\r\n\t\t\t.pipe(map(this.processResponse));\r\n\t}\r\n\r\n\tpublic post(url: string, body: any): Observable> {\r\n\t\treturn this.http.post>(`${this.servicesBaseUrl}/api/${url}`, body)\r\n\t\t\t.pipe(catchError(err => this.processError(err)))\r\n\t\t\t.pipe(map(this.processResponse));\r\n\t}\r\n\r\n\tpublic put(url: string, body: any): Observable> {\r\n\t\treturn this.http.put>(`${this.servicesBaseUrl}/api/${url}`, body)\r\n\t\t\t.pipe(catchError(err => this.processError(err)))\r\n\t\t\t.pipe(map(this.processResponse));\r\n\t}\r\n\r\n\tpublic delete(url: string): Observable> {\r\n\t\treturn this.http.delete>(`${this.servicesBaseUrl}/api/${url}`)\r\n\t\t\t.pipe(catchError(err => this.processError(err)))\r\n\t\t\t.pipe(map(this.processResponse));\r\n\t}\r\n\r\n\tprivate processError(error: HttpErrorResponse): Observable> {\r\n\t\tconst isTimeout: boolean = error.name.toLocaleLowerCase().indexOf('timeout') !== -1;\r\n\r\n\t\treturn of({\r\n\t\t\tresponseCode: isTimeout ? ErrorCode.ServerTimeout : ErrorCode.ServerUnavailable,\r\n\t\t\tresponseMessage: '',\r\n\t\t\tresponseData: null as unknown as T,\r\n\t\t\tresponseError: ''\r\n\t\t});\r\n\t}\r\n\r\n\tprivate processResponse(response: APIResponse): APIResponse {\r\n\r\n\t\tif (response.responseCode === ErrorCode.ServerTimeout || response.responseCode === ErrorCode.ServerUnavailable) {\r\n\t\t\tif (this.connectionService.isOnline()) {\r\n\t\t\t\tthis.connectionService.goOffline();\r\n\t\t\t\tthis.errorService.showConnectionErrorModal();\r\n\t\t\t}\r\n\t\t} else if (response.responseCode !== 200) {\r\n\t\t\tthis.errorService.goToErrorPage(response.responseCode, response.responseData as unknown as string);\r\n\r\n\t\t\tif (response.responseData) {\r\n\t\t\t\tthrow response.responseData as unknown as string;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn response;\r\n\t}\r\n}\r\n","import { CandidateQuestionDto } from \"./candidate-question-dto\";\r\nimport { QuestionAnswerStateDTO } from \"./state/question-answer-state-dto\";\r\n\r\nexport class SaveQuestionAnswersDTO {\r\n\tpublic questionAnswers!: QuestionAnswerStateDTO[];\r\n\tpublic candidateQuestion!: CandidateQuestionDto;\r\n\tpublic currentQuestionNumber!: number;\r\n}\r\n","import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';\r\nimport { Inject, Injectable } from '@angular/core';\r\nimport { MatDialogRef } from '@angular/material/dialog';\r\nimport { Observable, of } from 'rxjs';\r\nimport { catchError, map } from 'rxjs/operators';\r\nimport { APIResponse } from '../../model/request/APIResponse';\r\nimport { ErrorModalComponent } from '../../site/error/error-modal/error-modal.component';\r\nimport { AuthorisationService } from '../authorisation/authorisation.service';\r\nimport { AutoSaveService } from '../autosave.service';\r\nimport { ConnectionService } from '../connection.service';\r\nimport { ErrorCode } from '../error/application-error-handler';\r\nimport { ErrorService } from '../error/error.service';\r\nimport { LockoutService } from '../lockout.service';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CandidateRequestService {\r\n\r\n constructor(private http: HttpClient,\r\n @Inject('servicesBaseUrl') private servicesBaseUrl: string,\r\n private authorisationService: AuthorisationService,\r\n private errorService: ErrorService,\r\n private connectionService: ConnectionService,\r\n private autoSaveService: AutoSaveService,\r\n private lockoutService: LockoutService) {\r\n this.processResponse = this.processResponse.bind(this);\r\n this.processError = this.processError.bind(this);\r\n }\r\n\r\n public get(url: string): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.get>(`${this.servicesBaseUrl}/api/${url}`, { headers: authHeader })\r\n .pipe(catchError(err => this.processError(err)))\r\n .pipe(map(this.processResponse));\r\n }\r\n\r\n public post(url: string, body: any): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.post>(`${this.servicesBaseUrl}/api/${url}`, body, { headers: authHeader })\r\n .pipe(catchError(err => this.processError(err)))\r\n .pipe(map(this.processResponse));\r\n }\r\n\r\n public put(url: string, body: any): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.put>(`${this.servicesBaseUrl}/api/${url}`, body, { headers: authHeader })\r\n .pipe(catchError(err => this.processError(err)))\r\n .pipe(map(this.processResponse));\r\n }\r\n\r\n public delete(url: string): Observable> {\r\n const authHeader: HttpHeaders = this.authorisationService.getAuthHeader();\r\n return this.http.delete>(`${this.servicesBaseUrl}/api/${url}`, { headers: authHeader })\r\n .pipe(catchError(err => this.processError(err)))\r\n .pipe(map(this.processResponse));\r\n }\r\n\r\n private processError(error: HttpErrorResponse): Observable> {\r\n const isTimeout: boolean = error.name.toLocaleLowerCase().indexOf('timeout') !== -1;\r\n\r\n return of({\r\n responseCode: isTimeout ? ErrorCode.ServerTimeout : ErrorCode.ServerUnavailable,\r\n responseMessage: '',\r\n responseData: null as unknown as T,\r\n responseError: ''\r\n });\r\n }\r\n\r\n private processResponse(response: APIResponse): APIResponse {\r\n if (response.responseCode === ErrorCode.ServerTimeout || response.responseCode === ErrorCode.ServerUnavailable) {\r\n if (this.connectionService.isOnline()) {\r\n this.connectionService.goOffline();\r\n this.errorService.showConnectionErrorModal();\r\n }\r\n } else if (response.responseCode !== 200) {\r\n this.autoSaveService.stopAutoSaving();\r\n this.lockoutService.stopBlurWatching();\r\n \r\n let errorDialogReference: MatDialogRef = this.errorService.showErrorModal(response.responseCode, response.responseData as unknown as string)!;\r\n \r\n if (errorDialogReference) {\r\n errorDialogReference.afterClosed().subscribe(() => {\r\n this.autoSaveService.startAutoSaveProcess();\r\n this.lockoutService.startBlurWatching();\r\n });\r\n }\r\n\r\n if (response.responseData) {\r\n throw response.responseData as unknown as string;\r\n }\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { iif, Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { ExamCandidateReadyStateIdentifer } from '../enum/exam-candidate-ready-state-identifer.enum';\r\nimport { CandidateExamSummaryDTO } from '../model/exam/candidate-exam-summary-dto';\r\nimport { CandidateQuestionDto } from '../model/exam/candidate-question-dto';\r\nimport { ExamPauseDTO } from '../model/exam/exam-pause-dto';\r\nimport { ExamLogDto } from '../model/exam/log/exam-log-dto';\r\nimport { SaveQuestionAnswersDTO } from '../model/exam/save-question-answers-dto';\r\nimport { CandidateExamStateDto } from '../model/exam/state/candidate-exam-state-dto';\r\nimport { QuestionAnswerStateDTO } from '../model/exam/state/question-answer-state-dto';\r\nimport { CandidateAutomarkInfoDto } from '../model/exam/candidate-automark-info-dto';\r\nimport { UploadDataDto } from '../model/exam/upload-data';\r\nimport { APIResponse } from '../model/request/APIResponse';\r\nimport { CandidateRequestService } from './request/candidate-request.service';\r\nimport { RequestService } from './request/request.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class ExamService {\r\n\r\n\tconstructor(private candidateRequestService: CandidateRequestService,\r\n\t\tprivate requestService: RequestService) { }\r\n\r\n\tpublic getExamState(): Observable> {\r\n\t\treturn this.candidateRequestService.get(`candidate/exam/state`);\r\n\t}\r\n\r\n\tpublic getExamSummary(): Observable> {\r\n\t\treturn this.candidateRequestService.get(`candidate/exam/summary`);\r\n\t}\r\n\r\n\tpublic startCandidateExam(): Observable {\r\n\t\treturn this.candidateRequestService.put('candidate/exam/start', null)\r\n\t\t\t.pipe(map(x => x.responseData));\r\n\t}\r\n\r\n\tpublic endCandidateExam(autoEnded?: boolean): Observable> {\r\n\t\treturn this.candidateRequestService.put(autoEnded ? 'candidate/exam/end?autoEnded=true' : 'candidate/exam/end', null);\r\n\t}\r\n\r\n\tpublic saveAnswers(questionAnswers: QuestionAnswerStateDTO[], candidateQuestion: CandidateQuestionDto): Observable> {\r\n\r\n\t\tconst sa = new SaveQuestionAnswersDTO();\r\n\t\tsa.candidateQuestion = candidateQuestion;\r\n\t\tsa.questionAnswers = questionAnswers;\r\n\r\n\t\treturn this.candidateRequestService.post('candidate/answers/save', sa);\r\n\t}\r\n\r\n\tpublic examHasStarted(): Observable> {\r\n\t\treturn this.candidateRequestService.get('candidate/exam/hasstarted');\r\n\t}\r\n\r\n\tpublic synchonizeExamViaPin(uploadData: UploadDataDto, checksum: string, examLogs: ExamLogDto[], pin: string): Observable> {\r\n\t\treturn this.requestService.post('synchronize/exam', { uploadData, checksum, pin, examLogs, accessToken: null });\r\n\t}\r\n\r\n\tpublic synchonizeExamViaAccessToken(uploadData: UploadDataDto, checksum: string, examLogs: ExamLogDto[], accessToken: string): Observable> {\r\n\t\treturn this.requestService.post('synchronize/exam', { uploadData, checksum, accessToken, examLogs, pin: null });\r\n\t}\r\n\r\n\tpublic candidateIsReady(): Observable {\r\n\t\treturn this.candidateRequestService.get('candidate/exam/ready')\r\n\t\t\t.pipe(map(x => x.responseData));\r\n\t}\r\n\r\n\tpublic changeName(learnerName: string): Observable> {\r\n\t\treturn this.candidateRequestService.post('candidate/exam/changename', { learnerName });\r\n\t}\r\n\r\n\tpublic updateCurrentQuestionNumber(currentquestionNumber: number): Observable> {\r\n\t\treturn this.candidateRequestService.post(`candidate/exam/questionnumber/${currentquestionNumber}`, null);\r\n\t}\r\n\r\n\tpublic isPaused(): Observable {\r\n\t\treturn this.candidateRequestService.get('candidate/exam/paused')\r\n\t\t\t.pipe(map((response: APIResponse) => {\r\n\t\t\t\treturn !!response.responseData;\r\n\t\t\t}));\r\n\t}\r\n\r\n\tpublic getCandidateAutomarkingInfo(): Observable> {\r\n\t\treturn this.candidateRequestService.get('candidate/exam/automarkinfo');\r\n\t}\r\n\r\n\tpublic getCandidateId(): Observable {\r\n\t\treturn this.candidateRequestService.get('candidate/id')\r\n\t\t\t.pipe(map((response: APIResponse) => {\r\n\t\t\t\treturn response.responseData;\r\n\t\t\t}));\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { AppDatabase } from '../app.database';\r\nimport { BaseRepository } from './base-repository';\r\nimport { ExamLogEntity } from '../entities/exam-log-entity';\r\nimport { ExamLogDto } from '../../model/exam/log/exam-log-dto';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\nexport class ExamLogRepositoryService extends BaseRepository {\r\n\r\n\tconstructor(protected override db: AppDatabase) {\r\n\t\tsuper(db, 'examLogs');\r\n\t}\r\n\r\n public convertDto(entity: ExamLogEntity): ExamLogDto {\r\n\t\treturn {\r\n message: entity.message,\r\n type: entity.type,\r\n loggedDate: entity.loggedDate\r\n\t\t};\r\n }\r\n public convertEntity(dto: ExamLogDto): ExamLogEntity {\r\n\t\treturn {\r\n message: dto.message,\r\n type: dto.type,\r\n loggedDate: dto.loggedDate\r\n\t\t};\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\nimport { ExamLogDto } from '../../model/exam/log/exam-log-dto';\r\nimport { ExamLogEntity } from '../entities/exam-log-entity';\r\nimport { ExamLogRepositoryService } from '../repositories/exam-log-repository.service';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ExamLogDataService {\r\n constructor (private examLogRepository: ExamLogRepositoryService) { }\r\n\r\n public getAll(): Observable {\r\n return this.examLogRepository.getAll()\r\n .pipe(map((examLogEntities: ExamLogEntity[]) => examLogEntities.map((examLogEntity: ExamLogEntity) => this.examLogRepository.convertDto(examLogEntity))));\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { forkJoin, from, Observable, of } from 'rxjs';\r\nimport { map, mergeMap, switchMap } from 'rxjs/operators';\r\nimport { CandidateQuestionEntity } from '../database/entities/candidate-question-entity';\r\nimport { QuestionAnswerEntity } from '../database/entities/question-answer-entity';\r\nimport { CandidateQuestionRepositoryService } from '../database/repositories/candidate-question-repository.service';\r\nimport { KeyValueRepositoryService } from '../database/repositories/key-value-repository.service';\r\nimport { QuestionAnswerRepositoryService } from '../database/repositories/question-answer-repository.service';\r\nimport { ExamLogDataService } from '../database/services/exam-log-data.service';\r\nimport { QuestionSectionDataService } from '../database/services/question-section-data.service';\r\nimport { CandidateQuestionDto } from '../model/exam/candidate-question-dto';\r\nimport { ExamLogDto } from '../model/exam/log/exam-log-dto';\r\nimport { QuestionSectionDto } from '../model/exam/question-section-dto';\r\nimport { QuestionAnswerStateDTO } from '../model/exam/state/question-answer-state-dto';\r\nimport { QuestionStateDto } from '../model/exam/state/question-state-dto';\r\nimport { UploadDataDto } from '../model/exam/upload-data';\r\nimport { AuthorisationService } from './authorisation/authorisation.service';\r\nimport { ExamService } from './exam.service';\r\n\r\nclass UploadPayload {\r\n\tuploadData!: UploadDataDto;\r\n\tchecksum!: string;\r\n\texamLogs!: ExamLogDto[];\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SynchroniseService {\r\n constructor(private examService: ExamService,\r\n private candidateQuestionRepository: CandidateQuestionRepositoryService,\r\n private questionAnswerRepository: QuestionAnswerRepositoryService,\r\n private keyValueRepository: KeyValueRepositoryService,\r\n private questionSectionService: QuestionSectionDataService,\r\n\t\t\t\tprivate examLogDataService: ExamLogDataService,\r\n\t\t\t\tprivate authorisationService: AuthorisationService) { }\r\n\r\n public uploadExamViaPin(pin: string): Observable {\r\n\t\treturn this.GetUploadData()\r\n\t\t\t.pipe(switchMap((uploadData: UploadPayload) => this.examService.synchonizeExamViaPin(uploadData.uploadData, uploadData.checksum, uploadData.examLogs, pin)))\r\n\t\t\t.pipe(map(() => this.clearLogsFromLocalStorage()));\r\n\t}\r\n\r\n\tpublic uploadExamViaAccessToken(): Observable {\r\n\t\tconst accessToken = this.authorisationService.getAccessToken();\r\n\t\treturn this.GetUploadData()\r\n\t\t\t.pipe(switchMap((uploadData: UploadPayload) => this.examService.synchonizeExamViaAccessToken(uploadData.uploadData, uploadData.checksum, uploadData.examLogs, accessToken)))\r\n\t\t\t.pipe(map(() => this.clearLogsFromLocalStorage()));\r\n\t}\r\n\r\n\tpublic calculateChecksum(): Observable {\r\n const candidateQuestionsObservable = this.candidateQuestionRepository.getAll();\r\n const questionAnswersObservable = this.questionAnswerRepository.getAll();\r\n const questionSectionsObservable = this.questionSectionService.getAll();\r\n\r\n return forkJoin({ candidateQuestionEntities: candidateQuestionsObservable, questionAnswerEntities: questionAnswersObservable, sections: questionSectionsObservable })\r\n .pipe(mergeMap((data: { candidateQuestionEntities: CandidateQuestionEntity[], questionAnswerEntities: QuestionAnswerEntity[], sections: QuestionSectionDto[] }) => {\r\n const candidateQuestions: CandidateQuestionDto[] = data.candidateQuestionEntities.map(this.candidateQuestionRepository.convertDto);\r\n const questionAnswers: QuestionAnswerStateDTO[] = data.questionAnswerEntities.map(this.questionAnswerRepository.convertDto);\r\n const questionStates: QuestionStateDto[] = [];\r\n const sections: QuestionSectionDto[] = data.sections;\r\n\r\n for (const candidateQuestion of candidateQuestions) {\r\n questionStates.push({\r\n question: candidateQuestion,\r\n layoutItems: questionAnswers.filter(x => x.candidateQuestionId === candidateQuestion.id)\r\n });\r\n }\r\n\r\n const uploadData: UploadDataDto = {\r\n questionStates,\r\n sections\r\n };\r\n\r\n return from(crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(uploadData))))\r\n .pipe(map((checksumArrayBuffer: ArrayBuffer) => new Uint8Array(checksumArrayBuffer)))\r\n .pipe(mergeMap((checksumByteArray: Uint8Array) => this.keyValueRepository.setChecksum(checksumByteArray)));\r\n }));\r\n }\r\n\r\n\tprivate GetUploadData(): Observable {\r\n\t\tconst candidateQuestionsObservable = this.candidateQuestionRepository.getAll();\r\n\t\tconst questionAnswersObservable = this.questionAnswerRepository.getAll();\r\n\t\tconst questionSectionsObservable = this.questionSectionService.getAll();\r\n\t\tconst checksumObservable = this.keyValueRepository.getChecksum();\r\n\t\tconst examLogsObservable = this.examLogDataService.getAll().pipe(map((existingLogs) => this.getLogsFromLocalStorage(existingLogs)));\r\n\r\n\t\treturn forkJoin({\r\n\t\t\tcandidateQuestionEntities: candidateQuestionsObservable,\r\n\t\t\tquestionAnswerEntities: questionAnswersObservable,\r\n\t\t\tchecksum: checksumObservable,\r\n\t\t\tsections: questionSectionsObservable,\r\n\t\t\texamLogs: examLogsObservable\r\n\t\t})\r\n\t\t.pipe(switchMap((data: {\r\n\t\t\tcandidateQuestionEntities: CandidateQuestionEntity[],\r\n\t\t\tquestionAnswerEntities: QuestionAnswerEntity[],\r\n\t\t\tchecksum: Uint8Array,\r\n\t\t\tsections: QuestionSectionDto[],\r\n\t\t\texamLogs: ExamLogDto[]\r\n\t\t}) => {\r\n\t\t\tconst candidateQuestions: CandidateQuestionDto[] = data.candidateQuestionEntities.map(this.candidateQuestionRepository.convertDto);\r\n\t\t\tconst questionAnswers: QuestionAnswerStateDTO[] = data.questionAnswerEntities.map(this.questionAnswerRepository.convertDto);\r\n\t\t\tconst checksum: Uint8Array = data.checksum;\r\n\t\t\tconst strChecksum: string = btoa(String.fromCharCode(...checksum));\r\n\r\n\t\t\tconst questionStates: QuestionStateDto[] = [];\r\n\r\n\t\t\tfor (const candidateQuestion of candidateQuestions) {\r\n\t\t\t\tquestionStates.push({\r\n\t\t\t\t\tquestion: candidateQuestion,\r\n\t\t\t\t\tlayoutItems: questionAnswers.filter(x => x.candidateQuestionId === candidateQuestion.id)\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tconst uploadData: UploadDataDto = {\r\n\t\t\t\tquestionStates,\r\n\t\t\t\tsections: data.sections\r\n\t\t\t};\r\n\r\n\t\t\treturn of({\r\n\t\t\t\tuploadData,\r\n\t\t\t\tchecksum: strChecksum,\r\n\t\t\t\texamLogs: data.examLogs\r\n\t\t\t});\r\n\t\t}));\r\n\t}\r\n\r\n private getLogsFromLocalStorage(existingLogs: ExamLogDto[]): ExamLogDto[] {\r\n\r\n\t\tif (localStorage['examLogs']) {\r\n\t\t\tconst logs = JSON.parse(localStorage['examLogs']) as ExamLogDto[];\r\n\t\t\treturn existingLogs.concat(logs);\r\n\t\t}\r\n\r\n\t\treturn existingLogs;\r\n\t}\r\n\r\n\tprivate clearLogsFromLocalStorage(): void {\r\n\r\n\t\tif (localStorage['examLogs']) {\r\n\t\t\tlocalStorage.removeItem('examLogs');\r\n\t\t}\r\n\t}\r\n}\r\n"],"mappings":"yRASA,IAAaA,IAAgB,IAAA,CAAvB,IAAOA,EAAP,MAAOA,CAAgB,CACzBC,YAAoBC,EACAC,EAC2BC,EAAuB,CAFlD,KAAAF,qBAAAA,EACA,KAAAC,KAAAA,EAC2B,KAAAC,gBAAAA,CAA2B,CAEnEC,wBAAsB,CACzB,IAAMC,EAA0B,KAAKJ,qBAAqBK,cAAa,EACvE,OAAO,KAAKJ,KAAKK,KAAwB,GAAG,KAAKJ,eAAe,2BAA4B,KAAM,CAAEK,QAASH,CAAU,CAAE,CAC7H,CAEOI,wBAAsB,CACzB,IAAMJ,EAA0B,KAAKJ,qBAAqBK,cAAa,EACvE,OAAO,KAAKJ,KAAKK,KAAwB,GAAG,KAAKJ,eAAe,2BAA4B,KAAM,CAAEK,QAASH,CAAU,CAAE,CAC7H,CAEIK,yBAAyBC,EAAc,CAC7C,IAAMN,EAA0B,KAAKJ,qBAAq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W8C,wBAAwBD,EAA0B,CAE5D,GAAIO,aAAa,SAAa,CAC7B,IAAMC,EAAOjB,KAAKkB,MAAMF,aAAa,QAAW,EAChD,OAAOP,EAAaU,OAAOF,CAAI,CAChC,CAEA,OAAOR,CACR,CAEQ3C,2BAAyB,CAE5BkD,aAAa,UAChBA,aAAaI,WAAW,UAAU,CAEpC,yCAnHYzE,GAAkB0E,EAAAC,EAAA,EAAAD,EAAAE,EAAA,EAAAF,EAAAG,EAAA,EAAAH,EAAAI,EAAA,EAAAJ,EAAAK,EAAA,EAAAL,EAAAM,EAAA,EAAAN,EAAAO,EAAA,CAAA,CAAA,wBAAlBjF,EAAkBkF,QAAlBlF,EAAkBmF,UAAAC,WAFf,MAAM,CAAA,EAEhB,IAAOpF,EAAPqF,SAAOrF,CAAkB,GAAA","names":["DashboardService","constructor","authorisationService","http","servicesBaseUrl","sendOnlineNotification","authHeader","getAuthHeader","post","headers","sendLockedNotification","sendUnlockedNotification","reason","sendQuestionsAnsweredNotification","questionsAnswered","ɵɵinject","AuthorisationService","HttpClient","factory","ɵfac","providedIn","_DashboardService","ConnectionState","ConnectionService","constructor","http","servicesBaseUrl","dashboardService","connectionState","Online","connectionStateSource","Subject","connectionStateChange$","asObservable","goOnline","next","sendOnlineNotification","isOnline","goOffline","Offline","beginOfflinePolling","isOffline","canContactServer","connectionTest","interval","pipe","takeWhile","mergeMap","subscribe","response","get","catchError","of","ɵɵinject","HttpClient","DashboardService","factory","ɵfac","providedIn","_ConnectionService","BaseRepository","constructor","db","collectionName","add","value","from","transaction","__async","put","bulkAdd","values","key","update","bulkPut","clear","count","isEmpty","pipe","map","get","param","where","first","getMultiple","equals","toArray","getAll","getWhere","anyOf","_global","keys","isArray","extend","obj","extension","key","getProto","_hasOwn","hasOwn","prop","props","proto","setProp","defineProperty","functionOrGetSet","options","derive","Child","Parent","getOwnPropertyDescriptor","getPropertyDescriptor","pd","_slice","slice","args","start","end","override","origFunc","overridedFactory","assert","b","asap$1","fn","arrayToObject","array","extractor","result","item","i","nameAndValue","tryCatch","onerror","ex","getByKeyPath","keyPath","rv","l","val","period","innerObj","setByKeyPath","value","currentKeyPath","remainingKeyPath","delByKeyPath","kp","shallowClone","m","concat","flatten","a","intrinsicTypeNames","num","t","intrinsicTypes","x","circularRefs","deepClone","any","innerDeepClone","toString","toStringTag","o","iteratorSymbol","getIteratorOf","NO_CHAR_ARRAY","getArrayOf","arrayLike","it","isAsyncFunction","debug","setDebug","filter","libraryFilter","NEEDS_THROW_FOR_STACK","getErrorWithStack","e","prettyStack","exception","numIgnoredFrames","stack","frame","dexieErrorNames","idbDomErrorNames","errorList","defaultTexts","DexieError","name","msg","getMultiErrorMessage","failures","v","s","ModifyError","successCount","failedKeys","BulkError","pos","errnames","BaseException","exceptions","fullName","msgOrInner","inner","exceptionMap","mapError","domError","message","fullNameExceptions","nop","mirror","pureFunctionChain","f1","f2","callBoth","on1","on2","hookCreatingChain","res","onsuccess","res2","hookDeletingChain","hookUpdatingChain","modifications","reverseStoppableEventChain","promisableChain","thiz","INTERNAL","LONG_STACKS_CLIP_LIMIT","MAX_LONG_STACKS","ZONE_ECHO_LIMIT","resolvedNativePromise","nativePromiseProto","resolvedGlobalPromise","globalP","nativeP","nativePromiseThen","NativePromise","patchGlobalPromise","stack_being_generated","schedulePhysicalTick","physicalTick","hiddenDiv","asap","callback","microtickQueue","needsNewPhysicalTick","isOutsideMicroTick","unhandledErrors","rejectingErrors","currentFulfiller","rejectionMapper","globalPSD","globalError","uh","PSD","numScheduledCalls","tickFinalizers","DexiePromise","psd","handleRejection","executePromiseTask","thenProp","microTaskId","totalEchoes","then","onFulfilled","onRejected","possibleAwait","cleanup","decrementExpectedAwaits","resolve","reject","propagateToListener","Listener","nativeAwaitCompatibleWrap","linkToPreviousPromise","type","handler","err","PromiseReject","onFinally","stacks","getStack","ms","handle","snapShot","zone","values","onPossibleParallellAsync","remaining","newScope","usePSD","zoneProps","run_at_end_of_this_or_next_physical_tick","possiblePromises","results","p","reason","failure","promise","shouldExecuteTick","beginMicroTickScope","propagateAllListeners","endMicroTickScope","origProp","addPossiblyUnhandledError","listeners","len","finalizePhysicalTick","listener","cb","callListener","ret","markErrorAsHandled","limit","errorName","prev","numPrev","wasRootExec","callbacks","unhandledErrs","finalizers","finalizer","wrap","errorCatcher","outerScope","switchToZone","task","taskCounter","zoneStack","zoneEchoes","zone_id_counter","a1","a2","parent","globalEnv","getPatchedPromiseThen","incrementExpectedAwaits","possiblePromise","rejection","zoneEnterEcho","targetZone","zoneLeaveEcho","bEnteringZone","currentZone","enqueueNativeMicroTask","GlobalPromise","targetEnv","a3","job","outerZone","origThen","onResolved","UNHANDLEDREJECTION","event","eventData","tempTransaction","db","mode","storeNames","trans","DEXIE_VERSION","maxString","minKey","INVALID_KEY_ARGUMENT","STRING_EXPECTED","connections","isIEOrEdge","hasIEDeleteObjectStoreBug","hangsOnDeleteLargeKeyRange","dexieStackFrameFilter","DBNAMES_DB","READONLY","READWRITE","combine","filter1","filter2","AnyRange","workaroundForUndefinedPrimKey","Table","writeLocked","tableName","checkTableInTransaction","keyOrCrit","indexOrCrit","keyPaths","compoundIndex","ix","keyPathsInValidOrder","idxByName","idb","equals","idx","filterFunction","prevIndex","prevFilterFn","index","thenShortcut","offset","numRows","constructor","readHook","Class","content","auto","objToAdd","lastResult","keyOrObject","objects","keysOrOptions","wantResults","numObjects","objectsToAdd","numFailures","objectsToPut","numKeys","Events","ctx","evs","eventName","subscriber","add","chainFunction","defaultFunction","addConfiguredEvents","context","cfg","makeClassConstructor","prototype","createTableConstructor","tableSchema","isPlainKeyRange","ignoreLimitFilter","addFilter","addReplayFilter","factory","isLimitFilter","curr","addMatchFilter","getIndexOrStore","coreSchema","openCursor","coreTable","iter","coreTrans","set","union","cursor","advance","primaryKey","iterate","cursorPromise","valueMapper","mappedFn","c","wrappedFn","advancer","cmp","ta","tb","compareUint8Arrays","getUint8Array","compareArrays","al","bl","tsTag","Collection","count","parts","lastPart","lastIndex","getval","order","sorter","aVal","bVal","offsetLeft","rowsLeft","bIncludeStopEntry","indexName","strKey","found","changes","modifyer","anythingModified","outbound","extractKey","totalFailures","applyMutateResult","expectedCount","nextChunk","addValues","putValues","putKeys","deleteKeys","origValue","criteria","deleteCallback","range","coreRange","createCollectionConstructor","whereClause","keyRangeGenerator","keyRange","error","whereCtx","table","readingHook","simpleCompare","simpleCompareReverse","fail","collectionOrWhereClause","T","collection","WhereClause","emptyCollection","rangeEqual","upperFactory","dir","lowerFactory","nextCasing","lowerKey","upperNeedle","lowerNeedle","length","llp","lwrKeyChar","addIgnoreCaseAlgorithm","match","needles","suffix","upper","lower","compare","upperNeedles","lowerNeedles","direction","nextKeySuffix","needlesLen","initDirection","needleBounds","needle","nb","createRange","firstPossibleNeedle","lowestPossibleCasing","casing","lowerOpen","upperOpen","includeLower","includeUpper","str","n","ranges","ascending","descending","min","max","includeLowers","includeUppers","addRange","newRange","sortDirection","rangeSorter","rangePos","keyIsBeyondCurrentEntry","keyIsBeforeCurrentEntry","keyWithinCurrentRange","checkKey","createWhereClauseConstructor","orCollection","indexedDB","eventRejectHandler","preventDefault","DEXIE_STORAGE_MUTATED_EVENT_NAME","STORAGE_MUTATED_DOM_EVENT_NAME","globalEvents","Transaction","fnAndPSD","idbtrans","idbdb","dbOpenError","ev","bWriteLock","promiseLike","root","store","spin","currentWaitPromise","memoizedTables","transactionBoundTable","createTransactionConstructor","dbschema","chromeTransactionDurability","wasActive","createIndexSpec","unique","multi","compound","isPrimKey","nameFromKeyPath","createTableSchema","primKey","indexes","safariMultiStoreFix","getMaxKey","IdbKeyRange","getKeyExtractor","getSinglePathKeyExtractor","arrayify","_id_counter","getKeyPathAlias","createDBCore","tmpTrans","extractSchema","tables","autoIncrement","indexByKeyPath","multiEntry","makeIDBKeyRange","createDbCoreTable","mutate","isAddOrPut","req","reqs","errorHandler","args1","args2","done","query","reverse","source","_cursorContinue","_cursorContinuePrimaryKey","_cursorAdvance","doThrowCursorIsNotStarted","doThrowCursorIsStopped","gotOne","iterationPromise","resolveIteration","rejectIteration","guardedCallback","hasGetAll","request","nonInfinitLimit","idbKeyRange","keyCount","callbackCount","successHandler","schema","tableMap","createMiddlewareStack","stackImpl","middlewares","down","create","__spreadValues","createMiddlewareStacks","IDBKeyRange","generateMiddlewareStacks","tbl","setApiOnPlace","objs","tableNames","propDesc","removeTablesApi","lowerVersionFirst","runUpgraders","oldVersion","idbUpgradeTrans","globalSchema","rejectTransaction","transless","createTable","updateTablesAndIndexes","queue","versions","buildGlobalSchema","anyContentUpgraderHasRun","version","oldSchema","newSchema","adjustToExistingIndexNames","diff","getSchemaDiff","tuple","change","addIndex","idxName","contentUpgrade","upgradeSchema","contentUpgradeIsAsync","returnValue","promiseFollowed","decrementor","deleteRemovedTables","runQueue","createMissingTables","oldDef","newDef","oldIndexes","newIndexes","oldIdx","newIdx","storeName","j","idbindex","readGlobalSchema","verifyInstalledSchema","installedSchema","ch","dexieName","indexSpec","parseIndexSyntax","primKeyAndIndexes","indexNum","Version","stores","outSchema","storesSpec","upgradeFunction","createVersionConstructor","versionNumber","getDbNamesTable","dbNamesDB","Dexie$1","hasDatabasesNative","getDatabaseNames","infos","info","_onDatabaseCreated","_onDatabaseDeleted","vip","idbReady","isSafari","intervalId","tryIdb","dexieOpen","state","openCanceller","throwIfCancelled","resolveDbReady","upgradeTransaction","wasCreated","tryOpenDB","dbName","delreq","oldVer","objectStoreNames","fireRemainders","remainders","awaitIterator","iterator","callNext","doThrow","onSuccess","step","onError","getNext","next","extractTransactionArgs","_tableArgs_","scopeFunc","enterTransactionScope","parentTransaction","scopeFuncIsAsync","pad","createVirtualIndexMiddleware","__spreadProps","indexLookup","allVirtualIndexes","addVirtualIndexes","keyTail","lowLevelIndex","keyPathAlias","indexList","keyLength","isVirtual","virtualIndex","virtualKeyPath","findBestIndex","translateRange","translateRequest","createVirtualCursor","_continue","virtualIndexMiddleware","getObjectDiff","prfx","ap","bp","apTypeName","bpTypeName","getEffectiveKeys","hooksMiddleware","downCore","downTable","dxTrans","deleting","creating","updating","addPutOrDelete","deleteRange","getExistingValues","existingValues","contexts","existingValue","generatedPrimaryKey","objectDiff","additionalChanges","requestedValue","deleteNextChunk","effectiveKeys","getFromTransactionCache","cache","clone","cacheExistingValuesMiddleware","core","cachedResult","isEmptyRange","node","RangeSet","fromOrTree","to","rangeSet","mergeRanges","getRangeSetIterator","target","from","left","right","rebalance","rightWasCutOff","newSet","_addRangeSet","r","rangesOverlap","rangeSet1","rangeSet2","i1","nextResult1","i2","nextResult2","keyProvided","_a","_b","rootClone","oldRootRight","computeDepth","observabilityMiddleware","FULL_RANGE","tableClone","mutatedParts","getRangeSet","part","pkRangeSet","delsRangeSet","newObjs","oldCache","oldObjs","trackAffectedIndexes","getRange","readSubscribers","method","subscr","queriedIndex","queriedRanges","keysPromise","resultingKeys","pKeys","wantValues","pkey","addAffectedIndex","addKeyOrKeys","_","oldKey","newKey","_Dexie$1","deps","addons","subscribe","bSticky","unsubscribe","addon","versionInstance","level","mw","hasArguments","doDelete","onlyIfCompatible","idbMode","enterTransaction","symbolObservable","Observable","complete","extendObservabilitySet","liveQuery","querier","hasValue","currentValue","observable","observer","execute","exec","closed","accumMuts","currentObs","subscription","mutationListener","querying","startedListening","shouldNotify","doQuery","domDeps","Dexie","databaseName","generatorFn","promiseOrFunction","optionalTimeout","updatedParts","propagatingLocally","detail","propagateLocally","updateParts","wasMe","bc","changedParts","client","data","swContainer","propagateMessageLocally","DATABASE_CONFIG_TOKEN","InjectionToken","AssetEntity","CandidateQuestionEntity","constructor","potentialScore","ExamLogEntity","KeyValueEntity","QuestionAnswerEntity","QuestionSectionEntity","TimedBlockEntity","AppDatabase","Dexie","constructor","context","databaseName","version","databaseVersion","stores","schema","keyValues","mapToClass","KeyValueEntity","candidateQuestions","CandidateQuestionEntity","questionAnswers","QuestionAnswerEntity","assets","AssetEntity","questionSections","QuestionSectionEntity","examLogs","ExamLogEntity","timedBlocks","TimedBlockEntity","ɵɵinject","DATABASE_CONFIG_TOKEN","factory","ɵfac","providedIn","_AppDatabase","CandidateQuestionRepositoryService","BaseRepository","constructor","db","getLastQuestion","from","candidateQuestions","orderBy","reverse","first","getSectionQuestions","sectionId","where","equals","toArray","checkFlaggedQuestions","count","pipe","map","val","checkNonAttemptedResponses","convertDto","entity","id","candidateQuestionId","examCandidateId","questionTypeId","questionText","potentialScore","orderIndex","responseCount","flagged","last","convertEntity","dto","ɵɵinject","AppDatabase","factory","ɵfac","providedIn","_CandidateQuestionRepositoryService","QuestionSectionRepositoryService","BaseRepository","constructor","db","getBySectionNumber","number","from","questionSections","where","equals","first","convertDto","entity","id","questionSectionId","breakDuration","duration","maximumScore","minimumScore","name","orderIndex","breakStarted","breakEnded","sectionStarted","sectionEnded","timeAdjustment","paused","examCandidateId","canNavigateAway","convertEntity","dto","ɵɵinject","AppDatabase","factory","ɵfac","providedIn","_QuestionSectionRepositoryService","KeyValueRepositoryService","BaseRepository","constructor","db","getCurrentBlock","get","pipe","map","keyValueEntity","value","setCurrentBlock","currentBlock","existingValue","key","switchMap","put","setLearnerName","learnerName","getLearnerName","setSubjectName","subjectName","getSubjectName","setScheduledFinish","scheduledFinish","getScheduledFinish","Date","setCurrentQuestionNumber","currentQuestionNumber","getCurrentQuestionNumber","Number","getCurrentSectionNumber","setCurrentSectionNumber","currentSectionNumber","setPauseTime","pauseTime","getPauseTime","setInBreak","getBreakTimes","getInBreak","setBreakTimes","getExamType","KeyValueEntity","setExamType","examType","setChecksum","checksum","getChecksum","convertDto","entity","Error","convertEntity","dto","setEndTime","endTime","getEndTime","getLockedState","setLockedState","setExamCodeChecksum","examCode","getExamCodeChecksum","setMockFlag","isMock","getMockFlag","setIntroductionGuidance","introductionGuidance","getIntroductionGuidance","setIsPaused","getIsPaused","getPaperCode","setPaperCode","getCanNavigateAway","setCanNavigateAway","canNavigate","getMockUploaded","setMockUploaded","mockUploaded","getMockReference","setMockReference","mockReference","ɵɵinject","AppDatabase","factory","ɵfac","providedIn","_KeyValueRepositoryService","QuestionSectionDataService","constructor","candidateQuestionRepository","questionSectionRepository","keyValueDataRepository","getSectionQuestions","bind","get","key","pipe","map","data","convertDto","getAll","sectionEntities","sectionEntity","put","section","entity","convertEntity","getBySectionNumber","sectionNumber","getCurrentSection","getCurrentSectionNumber","mergeMap","currentSectionNumber","getNextSection","switchMap","entities","forkJoin","of","questionStates","questionSectionId","__spreadProps","__spreadValues","candidateQuestionEntity","question","layoutItems","updateTimeAdjustment","id","localSection","timeAdjustment","ɵɵinject","CandidateQuestionRepositoryService","QuestionSectionRepositoryService","KeyValueRepositoryService","factory","ɵfac","providedIn","_QuestionSectionDataService","KeyValueDataService","constructor","keyValueRepository","setLearnerName","learnerName","getCurrentBlockIndex","getCurrentBlock","setCurrentBlock","currentBlock","getLearnerName","setSubjectName","subjectName","getSubjectName","setScheduledFinish","scheduledFinish","getScheduledFinish","getCurrentSectionNumber","getInBreak","setInBreak","value","getBreakTime","getBreakTimes","setBreakTimes","setExamType","examType","getExamType","setCurrentSectionNumber","setEndTime","endTime","getEndTime","setLockedState","lockedState","getLockedState","setExamCodeChecksum","examCode","getExamCodeChecksum","setMockFlag","isMock","getMockFlag","setCurrentQuestionNumber","questionNumber","getCurrentQuestionNumber","setIntroductionGuidance","introductionGuidance","getIntroductionGuidance","getIsPaused","setIsPaused","isPaused","getPaperCode","setPaperCode","paperCode","getCanNavigateAway","setCanNavigateAway","canNavigateAway","getMockUploaded","setMockUploaded","uploaded","getMockReference","setMockReference","reference","ɵɵinject","KeyValueRepositoryService","factory","ɵfac","providedIn","_KeyValueDataService","AutoSaveService","constructor","autoSaveAnswerSource","Subject","autoSaveAnswerChange$","asObservable","isAutoSaving","beginAutoSaving","startAutoSaveProcess","stopAutoSaving","triggerAutoSave","next","interval","pipe","takeWhile","subscribe","factory","ɵfac","providedIn","_AutoSaveService","ExamLogDto","constructor","message","type","loggedDate","Date","ExamLogType","LockedState","BlurType","LockoutService","constructor","keyValueDataService","router","dashboardService","autoSaveService","blurEvents","blurWatchingActive","isLocked","getLockedState","pipe","map","lockedState","Locked","lockCandidateOut","getExamCodeChecksum","switchMap","checksum","iif","Unlocked","log","ExamLogDto","ExamLogType","CandidateLocked","logs","localStorage","JSON","parse","length","push","stringify","mergeMap","setLockedState","sendLockedNotification","redirectLocked","of","first","subscribe","stopBlurWatching","navigateByUrl","startBlurWatching","startBlurWatchingProcess","consumeBlurItems","indexOf","IFrame","addBlurItem","blurItem","interval","takeWhile","lockCandidate","stopAutoSaving","ɵɵinject","KeyValueDataService","Router","DashboardService","AutoSaveService","factory","ɵfac","providedIn","_LockoutService","AnswerTypeIdentifier","FormAnswerDTO","answered","formItems","filter","x","checkedByDefault","userInput","toString","trim","length","CalculatorAnswerDto","answered","answerJson","ChartAnswerDTO","answered","answerJSON","OpenResponseAnswerGroupDto","answered","answers","length","some","x","answerText","ReorderAnswerDto","answered","reorderAnswerRows","length","some","x","orderIndex","initialOrderIndex","ScaleAnswerDto","answered","answerJSON","TableAnswerDto","constructor","tableAnswerCells","answered","length","some","x","isEditable","text","_3DShapeAnswerDto","constructor","defaultLines","answered","answerJSON","MultiChoiceGroupAnswerDTO","answered","answers","length","some","x","selected","DocumentUploadAnswerDto","constructor","hasInteracted","answered","AnswerFactoryService","make","answer","answerTypeIdentifier","AnswerTypeIdentifier","Calculator","Object","assign","CalculatorAnswerDto","Chart","ChartAnswerDTO","OpenResponse","OpenResponseAnswerGroupDto","Reorder","ReorderAnswerDto","Scale","ScaleAnswerDto","Table","TableAnswerDto","_3DShape","_3DShapeAnswerDto","MultiChoiceSingleAnswer","MultiChoiceMultiAnswer","MultiChoiceGroupAnswerDTO","Form","FormAnswerDTO","DocumentUpload","DocumentUploadAnswerDto","QuestionAnswerRepositoryService","BaseRepository","constructor","db","convertDto","entity","id","questionAnswerId","candidateQuestionId","answerTypeId","potentialScore","answer","AnswerFactoryService","make","layout","layoutTypeIdentifier","labelText","labelAlignmentIdentifier","labelPositionIdentifier","convertEntity","dto","ɵɵinject","AppDatabase","factory","ɵfac","providedIn","_QuestionAnswerRepositoryService","RequestService","constructor","http","servicesBaseUrl","errorService","connectionService","processResponse","bind","get","url","pipe","catchError","err","processError","map","post","body","put","delete","error","isTimeout","name","toLocaleLowerCase","indexOf","of","responseCode","ErrorCode","ServerTimeout","ServerUnavailable","responseMessage","responseData","responseError","response","isOnline","goOffline","showConnectionErrorModal","goToErrorPage","ɵɵinject","HttpClient","ErrorService","ConnectionService","factory","ɵfac","providedIn","_RequestService","SaveQuestionAnswersDTO","CandidateRequestService","constructor","http","servicesBaseUrl","authorisationService","errorService","connectionService","autoSaveService","lockoutService","processResponse","bind","processError","get","url","authHeader","getAuthHeader","headers","pipe","catchError","err","map","post","body","put","delete","error","isTimeout","name","toLocaleLowerCase","indexOf","of","responseCode","ErrorCode","ServerTimeout","ServerUnavailable","responseMessage","responseData","responseError","response","isOnline","goOffline","showConnectionErrorModal","stopAutoSaving","stopBlurWatching","errorDialogReference","showErrorModal","afterClosed","subscribe","startAutoSaveProcess","startBlurWatching","ɵɵinject","HttpClient","AuthorisationService","ErrorService","ConnectionService","AutoSaveService","LockoutService","factory","ɵfac","providedIn","_CandidateRequestService","ExamService","constructor","candidateRequestService","requestService","getExamState","get","getExamSummary","startCandidateExam","put","pipe","map","x","responseData","endCandidateExam","autoEnded","saveAnswers","questionAnswers","candidateQuestion","sa","SaveQuestionAnswersDTO","post","examHasStarted","synchonizeExamViaPin","uploadData","checksum","examLogs","pin","accessToken","synchonizeExamViaAccessToken","candidateIsReady","changeName","learnerName","updateCurrentQuestionNumber","currentquestionNumber","isPaused","response","getCandidateAutomarkingInfo","getCandidateId","ɵɵinject","CandidateRequestService","RequestService","factory","ɵfac","providedIn","_ExamService","ExamLogRepositoryService","BaseRepository","constructor","db","convertDto","entity","message","type","loggedDate","convertEntity","dto","ɵɵinject","AppDatabase","factory","ɵfac","providedIn","_ExamLogRepositoryService","ExamLogDataService","constructor","examLogRepository","getAll","pipe","map","examLogEntities","examLogEntity","convertDto","ɵɵinject","ExamLogRepositoryService","factory","ɵfac","providedIn","_ExamLogDataService","SynchroniseService","constructor","examService","candidateQuestionRepository","questionAnswerRepository","keyValueRepository","questionSectionService","examLogDataService","authorisationService","uploadExamViaPin","pin","GetUploadData","pipe","switchMap","uploadData","synchonizeExamViaPin","checksum","examLogs","map","clearLogsFromLocalStorage","uploadExamViaAccessToken","accessToken","getAccessToken","synchonizeExamViaAccessToken","calculateChecksum","candidateQuestionsObservable","getAll","questionAnswersObservable","questionSectionsObservable","forkJoin","candidateQuestionEntities","questionAnswerEntities","sections","mergeMap","data","candidateQuestions","convertDto","questionAnswers","questionStates","candidateQuestion","push","question","layoutItems","filter","x","candidateQuestionId","id","from","crypto","subtle","digest","TextEncoder","encode","JSON","stringify","checksumArrayBuffer","Uint8Array","checksumByteArray","setChecksum","checksumObservable","getChecksum","examLogsObservable","existingLogs","getLogsFromLocalStorage","strChecksum","btoa","String","fromCharCode","of","localStorage","logs","parse","concat","removeItem","ɵɵinject","ExamService","CandidateQuestionRepositoryService","QuestionAnswerRepositoryService","KeyValueRepositoryService","QuestionSectionDataService","ExamLogDataService","AuthorisationService","factory","ɵfac","providedIn","_SynchroniseService"],"x_google_ignoreList":[3]}