{"version":3,"sources":["node_modules/fast-sha256/sha256.js","node_modules/angular-oauth2-oidc/fesm2020/angular-oauth2-oidc.mjs","src/app/models/base.model.ts","src/app/modules/auth/models/register-response.model.ts","src/app/modules/auth/models/auth.model.ts","src/app/modules/auth/models/user.model.ts","src/app/modules/auth/models/claim.model.ts","src/app/modules/auth/services/auth-http/auth-http.service.ts","src/app/modules/auth/services/auth.service.ts","src/app/models/member.model.ts","src/app/models/farm.model.ts","src/app/models/farmworker.model.ts","src/app/models/member-agreement.model.ts","node_modules/dexie/dist/modern/dexie.min.mjs","src/app/database/db.ts","src/app/models/card.model.ts","src/app/models/cardhistory.model.ts","src/app/models/ipg/memberpayment.model.ts","src/app/models/rrimniaga.model.ts","src/app/database/MemberDBService.ts"],"sourcesContent":["(function (root, factory) {\n // Hack to make all exports of this module sha256 function object properties.\n var exports = {};\n factory(exports);\n var sha256 = exports[\"default\"];\n for (var k in exports) {\n sha256[k] = exports[k];\n }\n if (typeof module === 'object' && typeof module.exports === 'object') {\n module.exports = sha256;\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return sha256;\n });\n } else {\n root.sha256 = sha256;\n }\n})(this, function (exports) {\n \"use strict\";\n\n exports.__esModule = true;\n // SHA-256 (+ HMAC and PBKDF2) for JavaScript.\n //\n // Written in 2014-2016 by Dmitry Chestnykh.\n // Public domain, no warranty.\n //\n // Functions (accept and return Uint8Arrays):\n //\n // sha256(message) -> hash\n // sha256.hmac(key, message) -> mac\n // sha256.pbkdf2(password, salt, rounds, dkLen) -> dk\n //\n // Classes:\n //\n // new sha256.Hash()\n // new sha256.HMAC(key)\n //\n exports.digestLength = 32;\n exports.blockSize = 64;\n // SHA-256 constants\n var K = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);\n function hashBlocks(w, v, p, pos, len) {\n var a, b, c, d, e, f, g, h, u, i, j, t1, t2;\n while (len >= 64) {\n a = v[0];\n b = v[1];\n c = v[2];\n d = v[3];\n e = v[4];\n f = v[5];\n g = v[6];\n h = v[7];\n for (i = 0; i < 16; i++) {\n j = pos + i * 4;\n w[i] = (p[j] & 0xff) << 24 | (p[j + 1] & 0xff) << 16 | (p[j + 2] & 0xff) << 8 | p[j + 3] & 0xff;\n }\n for (i = 16; i < 64; i++) {\n u = w[i - 2];\n t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;\n u = w[i - 15];\n t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;\n w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);\n }\n for (i = 0; i < 64; i++) {\n t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i] + w[i] | 0) | 0) | 0;\n t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;\n h = g;\n g = f;\n f = e;\n e = d + t1 | 0;\n d = c;\n c = b;\n b = a;\n a = t1 + t2 | 0;\n }\n v[0] += a;\n v[1] += b;\n v[2] += c;\n v[3] += d;\n v[4] += e;\n v[5] += f;\n v[6] += g;\n v[7] += h;\n pos += 64;\n len -= 64;\n }\n return pos;\n }\n // Hash implements SHA256 hash algorithm.\n var Hash = /** @class */function () {\n function Hash() {\n this.digestLength = exports.digestLength;\n this.blockSize = exports.blockSize;\n // Note: Int32Array is used instead of Uint32Array for performance reasons.\n this.state = new Int32Array(8); // hash state\n this.temp = new Int32Array(64); // temporary state\n this.buffer = new Uint8Array(128); // buffer for data to hash\n this.bufferLength = 0; // number of bytes in buffer\n this.bytesHashed = 0; // number of total bytes hashed\n this.finished = false; // indicates whether the hash was finalized\n this.reset();\n }\n // Resets hash state making it possible\n // to re-use this instance to hash other data.\n Hash.prototype.reset = function () {\n this.state[0] = 0x6a09e667;\n this.state[1] = 0xbb67ae85;\n this.state[2] = 0x3c6ef372;\n this.state[3] = 0xa54ff53a;\n this.state[4] = 0x510e527f;\n this.state[5] = 0x9b05688c;\n this.state[6] = 0x1f83d9ab;\n this.state[7] = 0x5be0cd19;\n this.bufferLength = 0;\n this.bytesHashed = 0;\n this.finished = false;\n return this;\n };\n // Cleans internal buffers and re-initializes hash state.\n Hash.prototype.clean = function () {\n for (var i = 0; i < this.buffer.length; i++) {\n this.buffer[i] = 0;\n }\n for (var i = 0; i < this.temp.length; i++) {\n this.temp[i] = 0;\n }\n this.reset();\n };\n // Updates hash state with the given data.\n //\n // Optionally, length of the data can be specified to hash\n // fewer bytes than data.length.\n //\n // Throws error when trying to update already finalized hash:\n // instance must be reset to use it again.\n Hash.prototype.update = function (data, dataLength) {\n if (dataLength === void 0) {\n dataLength = data.length;\n }\n if (this.finished) {\n throw new Error(\"SHA256: can't update because hash was finished.\");\n }\n var dataPos = 0;\n this.bytesHashed += dataLength;\n if (this.bufferLength > 0) {\n while (this.bufferLength < 64 && dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n if (this.bufferLength === 64) {\n hashBlocks(this.temp, this.state, this.buffer, 0, 64);\n this.bufferLength = 0;\n }\n }\n if (dataLength >= 64) {\n dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);\n dataLength %= 64;\n }\n while (dataLength > 0) {\n this.buffer[this.bufferLength++] = data[dataPos++];\n dataLength--;\n }\n return this;\n };\n // Finalizes hash state and puts hash into out.\n //\n // If hash was already finalized, puts the same value.\n Hash.prototype.finish = function (out) {\n if (!this.finished) {\n var bytesHashed = this.bytesHashed;\n var left = this.bufferLength;\n var bitLenHi = bytesHashed / 0x20000000 | 0;\n var bitLenLo = bytesHashed << 3;\n var padLength = bytesHashed % 64 < 56 ? 64 : 128;\n this.buffer[left] = 0x80;\n for (var i = left + 1; i < padLength - 8; i++) {\n this.buffer[i] = 0;\n }\n this.buffer[padLength - 8] = bitLenHi >>> 24 & 0xff;\n this.buffer[padLength - 7] = bitLenHi >>> 16 & 0xff;\n this.buffer[padLength - 6] = bitLenHi >>> 8 & 0xff;\n this.buffer[padLength - 5] = bitLenHi >>> 0 & 0xff;\n this.buffer[padLength - 4] = bitLenLo >>> 24 & 0xff;\n this.buffer[padLength - 3] = bitLenLo >>> 16 & 0xff;\n this.buffer[padLength - 2] = bitLenLo >>> 8 & 0xff;\n this.buffer[padLength - 1] = bitLenLo >>> 0 & 0xff;\n hashBlocks(this.temp, this.state, this.buffer, 0, padLength);\n this.finished = true;\n }\n for (var i = 0; i < 8; i++) {\n out[i * 4 + 0] = this.state[i] >>> 24 & 0xff;\n out[i * 4 + 1] = this.state[i] >>> 16 & 0xff;\n out[i * 4 + 2] = this.state[i] >>> 8 & 0xff;\n out[i * 4 + 3] = this.state[i] >>> 0 & 0xff;\n }\n return this;\n };\n // Returns the final hash digest.\n Hash.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n // Internal function for use in HMAC for optimization.\n Hash.prototype._saveState = function (out) {\n for (var i = 0; i < this.state.length; i++) {\n out[i] = this.state[i];\n }\n };\n // Internal function for use in HMAC for optimization.\n Hash.prototype._restoreState = function (from, bytesHashed) {\n for (var i = 0; i < this.state.length; i++) {\n this.state[i] = from[i];\n }\n this.bytesHashed = bytesHashed;\n this.finished = false;\n this.bufferLength = 0;\n };\n return Hash;\n }();\n exports.Hash = Hash;\n // HMAC implements HMAC-SHA256 message authentication algorithm.\n var HMAC = /** @class */function () {\n function HMAC(key) {\n this.inner = new Hash();\n this.outer = new Hash();\n this.blockSize = this.inner.blockSize;\n this.digestLength = this.inner.digestLength;\n var pad = new Uint8Array(this.blockSize);\n if (key.length > this.blockSize) {\n new Hash().update(key).finish(pad).clean();\n } else {\n for (var i = 0; i < key.length; i++) {\n pad[i] = key[i];\n }\n }\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36;\n }\n this.inner.update(pad);\n for (var i = 0; i < pad.length; i++) {\n pad[i] ^= 0x36 ^ 0x5c;\n }\n this.outer.update(pad);\n this.istate = new Uint32Array(8);\n this.ostate = new Uint32Array(8);\n this.inner._saveState(this.istate);\n this.outer._saveState(this.ostate);\n for (var i = 0; i < pad.length; i++) {\n pad[i] = 0;\n }\n }\n // Returns HMAC state to the state initialized with key\n // to make it possible to run HMAC over the other data with the same\n // key without creating a new instance.\n HMAC.prototype.reset = function () {\n this.inner._restoreState(this.istate, this.inner.blockSize);\n this.outer._restoreState(this.ostate, this.outer.blockSize);\n return this;\n };\n // Cleans HMAC state.\n HMAC.prototype.clean = function () {\n for (var i = 0; i < this.istate.length; i++) {\n this.ostate[i] = this.istate[i] = 0;\n }\n this.inner.clean();\n this.outer.clean();\n };\n // Updates state with provided data.\n HMAC.prototype.update = function (data) {\n this.inner.update(data);\n return this;\n };\n // Finalizes HMAC and puts the result in out.\n HMAC.prototype.finish = function (out) {\n if (this.outer.finished) {\n this.outer.finish(out);\n } else {\n this.inner.finish(out);\n this.outer.update(out, this.digestLength).finish(out);\n }\n return this;\n };\n // Returns message authentication code.\n HMAC.prototype.digest = function () {\n var out = new Uint8Array(this.digestLength);\n this.finish(out);\n return out;\n };\n return HMAC;\n }();\n exports.HMAC = HMAC;\n // Returns SHA256 hash of data.\n function hash(data) {\n var h = new Hash().update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n }\n exports.hash = hash;\n // Function hash is both available as module.hash and as default export.\n exports[\"default\"] = hash;\n // Returns HMAC-SHA256 of data under the key.\n function hmac(key, data) {\n var h = new HMAC(key).update(data);\n var digest = h.digest();\n h.clean();\n return digest;\n }\n exports.hmac = hmac;\n // Fills hkdf buffer like this:\n // T(1) = HMAC-Hash(PRK, T(0) | info | 0x01)\n function fillBuffer(buffer, hmac, info, counter) {\n // Counter is a byte value: check if it overflowed.\n var num = counter[0];\n if (num === 0) {\n throw new Error(\"hkdf: cannot expand more\");\n }\n // Prepare HMAC instance for new data with old key.\n hmac.reset();\n // Hash in previous output if it was generated\n // (i.e. counter is greater than 1).\n if (num > 1) {\n hmac.update(buffer);\n }\n // Hash in info if it exists.\n if (info) {\n hmac.update(info);\n }\n // Hash in the counter.\n hmac.update(counter);\n // Output result to buffer and clean HMAC instance.\n hmac.finish(buffer);\n // Increment counter inside typed array, this works properly.\n counter[0]++;\n }\n var hkdfSalt = new Uint8Array(exports.digestLength); // Filled with zeroes.\n function hkdf(key, salt, info, length) {\n if (salt === void 0) {\n salt = hkdfSalt;\n }\n if (length === void 0) {\n length = 32;\n }\n var counter = new Uint8Array([1]);\n // HKDF-Extract uses salt as HMAC key, and key as data.\n var okm = hmac(salt, key);\n // Initialize HMAC for expanding with extracted key.\n // Ensure no collisions with `hmac` function.\n var hmac_ = new HMAC(okm);\n // Allocate buffer.\n var buffer = new Uint8Array(hmac_.digestLength);\n var bufpos = buffer.length;\n var out = new Uint8Array(length);\n for (var i = 0; i < length; i++) {\n if (bufpos === buffer.length) {\n fillBuffer(buffer, hmac_, info, counter);\n bufpos = 0;\n }\n out[i] = buffer[bufpos++];\n }\n hmac_.clean();\n buffer.fill(0);\n counter.fill(0);\n return out;\n }\n exports.hkdf = hkdf;\n // Derives a key from password and salt using PBKDF2-HMAC-SHA256\n // with the given number of iterations.\n //\n // The number of bytes returned is equal to dkLen.\n //\n // (For better security, avoid dkLen greater than hash length - 32 bytes).\n function pbkdf2(password, salt, iterations, dkLen) {\n var prf = new HMAC(password);\n var len = prf.digestLength;\n var ctr = new Uint8Array(4);\n var t = new Uint8Array(len);\n var u = new Uint8Array(len);\n var dk = new Uint8Array(dkLen);\n for (var i = 0; i * len < dkLen; i++) {\n var c = i + 1;\n ctr[0] = c >>> 24 & 0xff;\n ctr[1] = c >>> 16 & 0xff;\n ctr[2] = c >>> 8 & 0xff;\n ctr[3] = c >>> 0 & 0xff;\n prf.reset();\n prf.update(salt);\n prf.update(ctr);\n prf.finish(u);\n for (var j = 0; j < len; j++) {\n t[j] = u[j];\n }\n for (var j = 2; j <= iterations; j++) {\n prf.reset();\n prf.update(u).finish(u);\n for (var k = 0; k < len; k++) {\n t[k] ^= u[k];\n }\n }\n for (var j = 0; j < len && i * len + j < dkLen; j++) {\n dk[i * len + j] = t[j];\n }\n }\n for (var i = 0; i < len; i++) {\n t[i] = u[i] = 0;\n }\n for (var i = 0; i < 4; i++) {\n ctr[i] = 0;\n }\n prf.clean();\n return dk;\n }\n exports.pbkdf2 = pbkdf2;\n});","import * as i0 from '@angular/core';\nimport { Injectable, Optional, Inject, NgModule, InjectionToken } from '@angular/core';\nimport { DOCUMENT, CommonModule } from '@angular/common';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders, HttpParams, HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { Subject, of, from, race, throwError, combineLatest, merge } from 'rxjs';\nimport { filter, tap, debounceTime, delay, switchMap, map, first, catchError, timeout, take, mergeMap } from 'rxjs/operators';\nimport fsha256 from 'fast-sha256';\nclass DateTimeProvider {}\nlet SystemDateTimeProvider = /*#__PURE__*/(() => {\n class SystemDateTimeProvider extends DateTimeProvider {\n now() {\n return Date.now();\n }\n new() {\n return new Date();\n }\n }\n SystemDateTimeProvider.ɵfac = /* @__PURE__ */(() => {\n let ɵSystemDateTimeProvider_BaseFactory;\n return function SystemDateTimeProvider_Factory(__ngFactoryType__) {\n return (ɵSystemDateTimeProvider_BaseFactory || (ɵSystemDateTimeProvider_BaseFactory = i0.ɵɵgetInheritedFactory(SystemDateTimeProvider)))(__ngFactoryType__ || SystemDateTimeProvider);\n };\n })();\n SystemDateTimeProvider.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SystemDateTimeProvider,\n factory: SystemDateTimeProvider.ɵfac\n });\n return SystemDateTimeProvider;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\r\n * Additional options that can be passed to tryLogin.\r\n */\nclass LoginOptions {\n constructor() {\n /**\r\n * Set this to true to disable the nonce\r\n * check which is used to avoid\r\n * replay attacks.\r\n * This flag should never be true in\r\n * production environments.\r\n */\n this.disableNonceCheck = false;\n /**\r\n * Normally, you want to clear your hash fragment after\r\n * the lib read the token(s) so that they are not displayed\r\n * anymore in the url. If not, set this to true. For code flow\r\n * this controls removing query string values.\r\n */\n this.preventClearHashAfterLogin = false;\n }\n}\n/**\r\n * Defines the logging interface the OAuthService uses\r\n * internally. Is compatible with the `console` object,\r\n * but you can provide your own implementation as well\r\n * through dependency injection.\r\n */\nclass OAuthLogger {}\n/**\r\n * Defines a simple storage that can be used for\r\n * storing the tokens at client side.\r\n * Is compatible to localStorage and sessionStorage,\r\n * but you can also create your own implementations.\r\n */\nclass OAuthStorage {}\nlet MemoryStorage = /*#__PURE__*/(() => {\n class MemoryStorage {\n constructor() {\n this.data = new Map();\n }\n getItem(key) {\n return this.data.get(key);\n }\n removeItem(key) {\n this.data.delete(key);\n }\n setItem(key, data) {\n this.data.set(key, data);\n }\n }\n MemoryStorage.ɵfac = function MemoryStorage_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || MemoryStorage)();\n };\n MemoryStorage.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: MemoryStorage,\n factory: MemoryStorage.ɵfac\n });\n return MemoryStorage;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\r\n * Represents the received tokens, the received state\r\n * and the parsed claims from the id-token.\r\n */\nclass ReceivedTokens {}\nclass OAuthEvent {\n constructor(type) {\n this.type = type;\n }\n}\nclass OAuthSuccessEvent extends OAuthEvent {\n constructor(type, info = null) {\n super(type);\n this.info = info;\n }\n}\nclass OAuthInfoEvent extends OAuthEvent {\n constructor(type, info = null) {\n super(type);\n this.info = info;\n }\n}\nclass OAuthErrorEvent extends OAuthEvent {\n constructor(type, reason, params = null) {\n super(type);\n this.reason = reason;\n this.params = params;\n }\n}\n\n// see: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_.22Unicode_Problem.22\nfunction b64DecodeUnicode(str) {\n const base64 = str.replace(/\\-/g, '+').replace(/\\_/g, '/');\n return decodeURIComponent(atob(base64).split('').map(function (c) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n}\nfunction base64UrlEncode(str) {\n const base64 = btoa(str);\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\nclass AuthConfig {\n constructor(json) {\n /**\r\n * The client's id as registered with the auth server\r\n */\n this.clientId = '';\n /**\r\n * The client's redirectUri as registered with the auth server\r\n */\n this.redirectUri = '';\n /**\r\n * An optional second redirectUri where the auth server\r\n * redirects the user to after logging out.\r\n */\n this.postLogoutRedirectUri = '';\n /**\r\n * Defines whether to use 'redirectUri' as a replacement\r\n * of 'postLogoutRedirectUri' if the latter is not set.\r\n */\n this.redirectUriAsPostLogoutRedirectUriFallback = true;\n /**\r\n * The auth server's endpoint that allows to log\r\n * the user in when using implicit flow.\r\n */\n this.loginUrl = '';\n /**\r\n * The requested scopes\r\n */\n this.scope = 'openid profile';\n this.resource = '';\n this.rngUrl = '';\n /**\r\n * Defines whether to use OpenId Connect during\r\n * implicit flow.\r\n */\n this.oidc = true;\n /**\r\n * Defines whether to request an access token during\r\n * implicit flow.\r\n */\n this.requestAccessToken = true;\n this.options = null;\n /**\r\n * The issuer's uri.\r\n */\n this.issuer = '';\n /**\r\n * The logout url.\r\n */\n this.logoutUrl = '';\n /**\r\n * Defines whether to clear the hash fragment after logging in.\r\n */\n this.clearHashAfterLogin = true;\n /**\r\n * Url of the token endpoint as defined by OpenId Connect and OAuth 2.\r\n */\n this.tokenEndpoint = null;\n /**\r\n * Url of the revocation endpoint as defined by OpenId Connect and OAuth 2.\r\n */\n this.revocationEndpoint = null;\n /**\r\n * Names of known parameters sent out in the TokenResponse. https://tools.ietf.org/html/rfc6749#section-5.1\r\n */\n this.customTokenParameters = [];\n /**\r\n * Url of the userinfo endpoint as defined by OpenId Connect.\r\n */\n this.userinfoEndpoint = null;\n this.responseType = '';\n /**\r\n * Defines whether additional debug information should\r\n * be shown at the console. Note that in certain browsers\r\n * the verbosity of the console needs to be explicitly set\r\n * to include Debug level messages.\r\n */\n this.showDebugInformation = false;\n /**\r\n * The redirect uri used when doing silent refresh.\r\n */\n this.silentRefreshRedirectUri = '';\n this.silentRefreshMessagePrefix = '';\n /**\r\n * Set this to true to display the iframe used for\r\n * silent refresh for debugging.\r\n */\n this.silentRefreshShowIFrame = false;\n /**\r\n * Timeout for silent refresh.\r\n * @internal\r\n * depreacted b/c of typo, see silentRefreshTimeout\r\n */\n this.siletRefreshTimeout = 1000 * 20;\n /**\r\n * Timeout for silent refresh.\r\n */\n this.silentRefreshTimeout = 1000 * 20;\n /**\r\n * Some auth servers don't allow using password flow\r\n * w/o a client secret while the standards do not\r\n * demand for it. In this case, you can set a password\r\n * here. As this password is exposed to the public\r\n * it does not bring additional security and is therefore\r\n * as good as using no password.\r\n */\n this.dummyClientSecret = null;\n /**\r\n * Defines whether https is required.\r\n * The default value is remoteOnly which only allows\r\n * http for localhost, while every other domains need\r\n * to be used with https.\r\n */\n this.requireHttps = 'remoteOnly';\n /**\r\n * Defines whether every url provided by the discovery\r\n * document has to start with the issuer's url.\r\n */\n this.strictDiscoveryDocumentValidation = true;\n /**\r\n * JSON Web Key Set (https://tools.ietf.org/html/rfc7517)\r\n * with keys used to validate received id_tokens.\r\n * This is taken out of the disovery document. Can be set manually too.\r\n */\n this.jwks = null;\n /**\r\n * Map with additional query parameter that are appended to\r\n * the request when initializing implicit flow.\r\n */\n this.customQueryParams = null;\n this.silentRefreshIFrameName = 'angular-oauth-oidc-silent-refresh-iframe';\n /**\r\n * Defines when the token_timeout event should be raised.\r\n * If you set this to the default value 0.75, the event\r\n * is triggered after 75% of the token's life time.\r\n */\n this.timeoutFactor = 0.75;\n /**\r\n * If true, the lib will try to check whether the user\r\n * is still logged in on a regular basis as described\r\n * in http://openid.net/specs/openid-connect-session-1_0.html#ChangeNotification\r\n */\n this.sessionChecksEnabled = false;\n /**\r\n * Interval in msec for checking the session\r\n * according to http://openid.net/specs/openid-connect-session-1_0.html#ChangeNotification\r\n */\n this.sessionCheckIntervall = 3 * 1000;\n /**\r\n * Url for the iframe used for session checks\r\n */\n this.sessionCheckIFrameUrl = null;\n /**\r\n * Name of the iframe to use for session checks\r\n */\n this.sessionCheckIFrameName = 'angular-oauth-oidc-check-session-iframe';\n /**\r\n * This property has been introduced to disable at_hash checks\r\n * and is indented for Identity Provider that does not deliver\r\n * an at_hash EVEN THOUGH its recommended by the OIDC specs.\r\n * Of course, when disabling these checks then we are bypassing\r\n * a security check which means we are more vulnerable.\r\n */\n this.disableAtHashCheck = false;\n /**\r\n * Defines wether to check the subject of a refreshed token after silent refresh.\r\n * Normally, it should be the same as before.\r\n */\n this.skipSubjectCheck = false;\n this.useIdTokenHintForSilentRefresh = false;\n /**\r\n * Defined whether to skip the validation of the issuer in the discovery document.\r\n * Normally, the discovey document's url starts with the url of the issuer.\r\n */\n this.skipIssuerCheck = false;\n /**\r\n * final state sent to issuer is built as follows:\r\n * state = nonce + nonceStateSeparator + additional state\r\n * Default separator is ';' (encoded %3B).\r\n * In rare cases, this character might be forbidden or inconvenient to use by the issuer so it can be customized.\r\n */\n this.nonceStateSeparator = ';';\n /**\r\n * Set this to true to use HTTP BASIC auth for AJAX calls\r\n */\n this.useHttpBasicAuth = false;\n /**\r\n * The interceptors waits this time span if there is no token\r\n */\n this.waitForTokenInMsec = 0;\n /**\r\n * Code Flow is by defauld used together with PKCI which is also higly recommented.\r\n * You can disbale it here by setting this flag to true.\r\n * https://tools.ietf.org/html/rfc7636#section-1.1\r\n */\n this.disablePKCE = false;\n /**\r\n * Set this to true to preserve the requested route including query parameters after code flow login.\r\n * This setting enables deep linking for the code flow.\r\n */\n this.preserveRequestedRoute = false;\n /**\r\n * This property allows you to override the method that is used to open the login url,\r\n * allowing a way for implementations to specify their own method of routing to new\r\n * urls.\r\n */\n this.openUri = uri => {\n location.href = uri;\n };\n if (json) {\n Object.assign(this, json);\n }\n }\n}\n\n/**\r\n * This custom encoder allows charactes like +, % and / to be used in passwords\r\n */\nclass WebHttpUrlEncodingCodec {\n encodeKey(k) {\n return encodeURIComponent(k);\n }\n encodeValue(v) {\n return encodeURIComponent(v);\n }\n decodeKey(k) {\n return decodeURIComponent(k);\n }\n decodeValue(v) {\n return decodeURIComponent(v);\n }\n}\n\n/**\r\n * Interface for Handlers that are hooked in to\r\n * validate tokens.\r\n */\nclass ValidationHandler {}\n/**\r\n * This abstract implementation of ValidationHandler already implements\r\n * the method validateAtHash. However, to make use of it,\r\n * you have to override the method calcHash.\r\n */\nclass AbstractValidationHandler {\n /**\r\n * Validates the at_hash in an id_token against the received access_token.\r\n */\n async validateAtHash(params) {\n let hashAlg = this.inferHashAlgorithm(params.idTokenHeader);\n let tokenHash = await this.calcHash(params.accessToken, hashAlg); // sha256(accessToken, { asString: true });\n let leftMostHalf = tokenHash.substr(0, tokenHash.length / 2);\n let atHash = base64UrlEncode(leftMostHalf);\n let claimsAtHash = params.idTokenClaims['at_hash'].replace(/=/g, '');\n if (atHash !== claimsAtHash) {\n console.error('exptected at_hash: ' + atHash);\n console.error('actual at_hash: ' + claimsAtHash);\n }\n return atHash === claimsAtHash;\n }\n /**\r\n * Infers the name of the hash algorithm to use\r\n * from the alg field of an id_token.\r\n *\r\n * @param jwtHeader the id_token's parsed header\r\n */\n inferHashAlgorithm(jwtHeader) {\n let alg = jwtHeader['alg'];\n if (!alg.match(/^.S[0-9]{3}$/)) {\n throw new Error('Algorithm not supported: ' + alg);\n }\n return 'sha-' + alg.substr(2);\n }\n}\nlet UrlHelperService = /*#__PURE__*/(() => {\n class UrlHelperService {\n getHashFragmentParams(customHashFragment) {\n let hash = customHashFragment || window.location.hash;\n hash = decodeURIComponent(hash);\n if (hash.indexOf('#') !== 0) {\n return {};\n }\n const questionMarkPosition = hash.indexOf('?');\n if (questionMarkPosition > -1) {\n hash = hash.substr(questionMarkPosition + 1);\n } else {\n hash = hash.substr(1);\n }\n return this.parseQueryString(hash);\n }\n parseQueryString(queryString) {\n const data = {};\n let pairs, pair, separatorIndex, escapedKey, escapedValue, key, value;\n if (queryString === null) {\n return data;\n }\n pairs = queryString.split('&');\n for (let i = 0; i < pairs.length; i++) {\n pair = pairs[i];\n separatorIndex = pair.indexOf('=');\n if (separatorIndex === -1) {\n escapedKey = pair;\n escapedValue = null;\n } else {\n escapedKey = pair.substr(0, separatorIndex);\n escapedValue = pair.substr(separatorIndex + 1);\n }\n key = decodeURIComponent(escapedKey);\n value = decodeURIComponent(escapedValue);\n if (key.substr(0, 1) === '/') {\n key = key.substr(1);\n }\n data[key] = value;\n }\n return data;\n }\n }\n UrlHelperService.ɵfac = function UrlHelperService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlHelperService)();\n };\n UrlHelperService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlHelperService,\n factory: UrlHelperService.ɵfac\n });\n return UrlHelperService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\r\n * [js-sha256]{@link https://github.com/emn178/js-sha256}\r\n *\r\n * @version 0.9.0\r\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\r\n * @copyright Chen, Yi-Cyuan 2014-2017\r\n * @license MIT\r\n */\n/*jslint bitwise: true */\nfunction factory() {\n var ERROR = 'input is invalid type';\n var WINDOW = typeof window === 'object';\n var root = WINDOW ? window : {};\n if (root.JS_SHA256_NO_WINDOW) {\n WINDOW = false;\n }\n var WEB_WORKER = !WINDOW && typeof self === 'object';\n var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;\n if (NODE_JS) {\n root = global;\n } else if (WEB_WORKER) {\n root = self;\n }\n var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module === 'object' && module.exports;\n var AMD = typeof define === 'function' && define.amd;\n var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';\n const HEX_CHARS = '0123456789abcdef'.split('');\n const EXTRA = [-2147483648, 8388608, 32768, 128];\n const SHIFT = [24, 16, 8, 0];\n const K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n const OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer'];\n var blocks = [];\n if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {\n Array.isArray = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n };\n }\n if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {\n ArrayBuffer.isView = function (obj) {\n return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;\n };\n }\n var createOutputMethod = function (outputType, is224) {\n return function (message) {\n return new Sha256(is224, true).update(message)[outputType]();\n };\n };\n var createMethod = function (is224) {\n var method = createOutputMethod('hex', is224);\n if (NODE_JS) {\n method = nodeWrap(method, is224);\n }\n method.create = function () {\n return new Sha256(is224);\n };\n method.update = function (message) {\n return method.create().update(message);\n };\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createOutputMethod(type, is224);\n }\n return method;\n };\n var nodeWrap = function (method, is224) {\n var crypto = eval(\"require('crypto')\");\n var Buffer = eval(\"require('buffer').Buffer\");\n var algorithm = is224 ? 'sha224' : 'sha256';\n var nodeMethod = function (message) {\n if (typeof message === 'string') {\n return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');\n } else {\n if (message === null || message === undefined) {\n throw new Error(ERROR);\n } else if (message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n }\n }\n if (Array.isArray(message) || ArrayBuffer.isView(message) || message.constructor === Buffer) {\n return crypto.createHash(algorithm).update(new Buffer(message)).digest('hex');\n } else {\n return method(message);\n }\n };\n return nodeMethod;\n };\n var createHmacOutputMethod = function (outputType, is224) {\n return function (key, message) {\n return new HmacSha256(key, is224, true).update(message)[outputType]();\n };\n };\n var createHmacMethod = function (is224) {\n var method = createHmacOutputMethod('hex', is224);\n method.create = function (key) {\n return new HmacSha256(key, is224);\n };\n method.update = function (key, message) {\n return method.create(key).update(message);\n };\n for (var i = 0; i < OUTPUT_TYPES.length; ++i) {\n var type = OUTPUT_TYPES[i];\n method[type] = createHmacOutputMethod(type, is224);\n }\n return method;\n };\n function Sha256(is224, sharedMemory) {\n if (sharedMemory) {\n blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n this.blocks = blocks;\n } else {\n this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n }\n if (is224) {\n this.h0 = 0xc1059ed8;\n this.h1 = 0x367cd507;\n this.h2 = 0x3070dd17;\n this.h3 = 0xf70e5939;\n this.h4 = 0xffc00b31;\n this.h5 = 0x68581511;\n this.h6 = 0x64f98fa7;\n this.h7 = 0xbefa4fa4;\n } else {\n // 256\n this.h0 = 0x6a09e667;\n this.h1 = 0xbb67ae85;\n this.h2 = 0x3c6ef372;\n this.h3 = 0xa54ff53a;\n this.h4 = 0x510e527f;\n this.h5 = 0x9b05688c;\n this.h6 = 0x1f83d9ab;\n this.h7 = 0x5be0cd19;\n }\n this.block = this.start = this.bytes = this.hBytes = 0;\n this.finalized = this.hashed = false;\n this.first = true;\n this.is224 = is224;\n }\n Sha256.prototype.update = function (message) {\n if (this.finalized) {\n return;\n }\n var notString,\n type = typeof message;\n if (type !== 'string') {\n if (type === 'object') {\n if (message === null) {\n throw new Error(ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(ERROR);\n }\n }\n } else {\n throw new Error(ERROR);\n }\n notString = true;\n }\n var code,\n index = 0,\n i,\n length = message.length,\n blocks = this.blocks;\n while (index < length) {\n if (this.hashed) {\n this.hashed = false;\n blocks[0] = this.block;\n blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n }\n if (notString) {\n for (i = this.start; index < length && i < 64; ++index) {\n blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < 64; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >> 2] |= (0xc0 | code >> 6) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >> 2] |= (0xe0 | code >> 12) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n } else {\n code = 0x10000 + ((code & 0x3ff) << 10 | message.charCodeAt(++index) & 0x3ff);\n blocks[i >> 2] |= (0xf0 | code >> 18) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 12 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];\n blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];\n }\n }\n }\n this.lastByteIndex = i;\n this.bytes += i - this.start;\n if (i >= 64) {\n this.block = blocks[16];\n this.start = i - 64;\n this.hash();\n this.hashed = true;\n } else {\n this.start = i;\n }\n }\n if (this.bytes > 4294967295) {\n this.hBytes += this.bytes / 4294967296 << 0;\n this.bytes = this.bytes % 4294967296;\n }\n return this;\n };\n Sha256.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks,\n i = this.lastByteIndex;\n blocks[16] = this.block;\n blocks[i >> 2] |= EXTRA[i & 3];\n this.block = blocks[16];\n if (i >= 56) {\n if (!this.hashed) {\n this.hash();\n }\n blocks[0] = this.block;\n blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;\n }\n blocks[14] = this.hBytes << 3 | this.bytes >>> 29;\n blocks[15] = this.bytes << 3;\n this.hash();\n };\n Sha256.prototype.hash = function () {\n var a = this.h0,\n b = this.h1,\n c = this.h2,\n d = this.h3,\n e = this.h4,\n f = this.h5,\n g = this.h6,\n h = this.h7,\n blocks = this.blocks,\n j,\n s0,\n s1,\n maj,\n t1,\n t2,\n ch,\n ab,\n da,\n cd,\n bc;\n for (j = 16; j < 64; ++j) {\n // rightrotate\n t1 = blocks[j - 15];\n s0 = (t1 >>> 7 | t1 << 25) ^ (t1 >>> 18 | t1 << 14) ^ t1 >>> 3;\n t1 = blocks[j - 2];\n s1 = (t1 >>> 17 | t1 << 15) ^ (t1 >>> 19 | t1 << 13) ^ t1 >>> 10;\n blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;\n }\n bc = b & c;\n for (j = 0; j < 64; j += 4) {\n if (this.first) {\n if (this.is224) {\n ab = 300032;\n t1 = blocks[0] - 1413257819;\n h = t1 - 150054599 << 0;\n d = t1 + 24177077 << 0;\n } else {\n ab = 704751109;\n t1 = blocks[0] - 210244248;\n h = t1 - 1521486534 << 0;\n d = t1 + 143694565 << 0;\n }\n this.first = false;\n } else {\n s0 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10);\n s1 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7);\n ab = a & b;\n maj = ab ^ a & c ^ bc;\n ch = e & f ^ ~e & g;\n t1 = h + s1 + ch + K[j] + blocks[j];\n t2 = s0 + maj;\n h = d + t1 << 0;\n d = t1 + t2 << 0;\n }\n s0 = (d >>> 2 | d << 30) ^ (d >>> 13 | d << 19) ^ (d >>> 22 | d << 10);\n s1 = (h >>> 6 | h << 26) ^ (h >>> 11 | h << 21) ^ (h >>> 25 | h << 7);\n da = d & a;\n maj = da ^ d & b ^ ab;\n ch = h & e ^ ~h & f;\n t1 = g + s1 + ch + K[j + 1] + blocks[j + 1];\n t2 = s0 + maj;\n g = c + t1 << 0;\n c = t1 + t2 << 0;\n s0 = (c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10);\n s1 = (g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7);\n cd = c & d;\n maj = cd ^ c & a ^ da;\n ch = g & h ^ ~g & e;\n t1 = f + s1 + ch + K[j + 2] + blocks[j + 2];\n t2 = s0 + maj;\n f = b + t1 << 0;\n b = t1 + t2 << 0;\n s0 = (b >>> 2 | b << 30) ^ (b >>> 13 | b << 19) ^ (b >>> 22 | b << 10);\n s1 = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7);\n bc = b & c;\n maj = bc ^ b & d ^ cd;\n ch = f & g ^ ~f & h;\n t1 = e + s1 + ch + K[j + 3] + blocks[j + 3];\n t2 = s0 + maj;\n e = a + t1 << 0;\n a = t1 + t2 << 0;\n }\n this.h0 = this.h0 + a << 0;\n this.h1 = this.h1 + b << 0;\n this.h2 = this.h2 + c << 0;\n this.h3 = this.h3 + d << 0;\n this.h4 = this.h4 + e << 0;\n this.h5 = this.h5 + f << 0;\n this.h6 = this.h6 + g << 0;\n this.h7 = this.h7 + h << 0;\n };\n Sha256.prototype.hex = function () {\n this.finalize();\n var h0 = this.h0,\n h1 = this.h1,\n h2 = this.h2,\n h3 = this.h3,\n h4 = this.h4,\n h5 = this.h5,\n h6 = this.h6,\n h7 = this.h7;\n var hex = HEX_CHARS[h0 >> 28 & 0x0F] + HEX_CHARS[h0 >> 24 & 0x0F] + HEX_CHARS[h0 >> 20 & 0x0F] + HEX_CHARS[h0 >> 16 & 0x0F] + HEX_CHARS[h0 >> 12 & 0x0F] + HEX_CHARS[h0 >> 8 & 0x0F] + HEX_CHARS[h0 >> 4 & 0x0F] + HEX_CHARS[h0 & 0x0F] + HEX_CHARS[h1 >> 28 & 0x0F] + HEX_CHARS[h1 >> 24 & 0x0F] + HEX_CHARS[h1 >> 20 & 0x0F] + HEX_CHARS[h1 >> 16 & 0x0F] + HEX_CHARS[h1 >> 12 & 0x0F] + HEX_CHARS[h1 >> 8 & 0x0F] + HEX_CHARS[h1 >> 4 & 0x0F] + HEX_CHARS[h1 & 0x0F] + HEX_CHARS[h2 >> 28 & 0x0F] + HEX_CHARS[h2 >> 24 & 0x0F] + HEX_CHARS[h2 >> 20 & 0x0F] + HEX_CHARS[h2 >> 16 & 0x0F] + HEX_CHARS[h2 >> 12 & 0x0F] + HEX_CHARS[h2 >> 8 & 0x0F] + HEX_CHARS[h2 >> 4 & 0x0F] + HEX_CHARS[h2 & 0x0F] + HEX_CHARS[h3 >> 28 & 0x0F] + HEX_CHARS[h3 >> 24 & 0x0F] + HEX_CHARS[h3 >> 20 & 0x0F] + HEX_CHARS[h3 >> 16 & 0x0F] + HEX_CHARS[h3 >> 12 & 0x0F] + HEX_CHARS[h3 >> 8 & 0x0F] + HEX_CHARS[h3 >> 4 & 0x0F] + HEX_CHARS[h3 & 0x0F] + HEX_CHARS[h4 >> 28 & 0x0F] + HEX_CHARS[h4 >> 24 & 0x0F] + HEX_CHARS[h4 >> 20 & 0x0F] + HEX_CHARS[h4 >> 16 & 0x0F] + HEX_CHARS[h4 >> 12 & 0x0F] + HEX_CHARS[h4 >> 8 & 0x0F] + HEX_CHARS[h4 >> 4 & 0x0F] + HEX_CHARS[h4 & 0x0F] + HEX_CHARS[h5 >> 28 & 0x0F] + HEX_CHARS[h5 >> 24 & 0x0F] + HEX_CHARS[h5 >> 20 & 0x0F] + HEX_CHARS[h5 >> 16 & 0x0F] + HEX_CHARS[h5 >> 12 & 0x0F] + HEX_CHARS[h5 >> 8 & 0x0F] + HEX_CHARS[h5 >> 4 & 0x0F] + HEX_CHARS[h5 & 0x0F] + HEX_CHARS[h6 >> 28 & 0x0F] + HEX_CHARS[h6 >> 24 & 0x0F] + HEX_CHARS[h6 >> 20 & 0x0F] + HEX_CHARS[h6 >> 16 & 0x0F] + HEX_CHARS[h6 >> 12 & 0x0F] + HEX_CHARS[h6 >> 8 & 0x0F] + HEX_CHARS[h6 >> 4 & 0x0F] + HEX_CHARS[h6 & 0x0F];\n if (!this.is224) {\n hex += HEX_CHARS[h7 >> 28 & 0x0F] + HEX_CHARS[h7 >> 24 & 0x0F] + HEX_CHARS[h7 >> 20 & 0x0F] + HEX_CHARS[h7 >> 16 & 0x0F] + HEX_CHARS[h7 >> 12 & 0x0F] + HEX_CHARS[h7 >> 8 & 0x0F] + HEX_CHARS[h7 >> 4 & 0x0F] + HEX_CHARS[h7 & 0x0F];\n }\n return hex;\n };\n Sha256.prototype.toString = Sha256.prototype.hex;\n Sha256.prototype.digest = function () {\n this.finalize();\n var h0 = this.h0,\n h1 = this.h1,\n h2 = this.h2,\n h3 = this.h3,\n h4 = this.h4,\n h5 = this.h5,\n h6 = this.h6,\n h7 = this.h7;\n var arr = [h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF];\n if (!this.is224) {\n arr.push(h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF);\n }\n return arr;\n };\n Sha256.prototype.array = Sha256.prototype.digest;\n Sha256.prototype.arrayBuffer = function () {\n this.finalize();\n var buffer = new ArrayBuffer(this.is224 ? 28 : 32);\n var dataView = new DataView(buffer);\n dataView.setUint32(0, this.h0);\n dataView.setUint32(4, this.h1);\n dataView.setUint32(8, this.h2);\n dataView.setUint32(12, this.h3);\n dataView.setUint32(16, this.h4);\n dataView.setUint32(20, this.h5);\n dataView.setUint32(24, this.h6);\n if (!this.is224) {\n dataView.setUint32(28, this.h7);\n }\n return buffer;\n };\n function HmacSha256(key, is224, sharedMemory) {\n var i,\n type = typeof key;\n if (type === 'string') {\n var bytes = [],\n length = key.length,\n index = 0,\n code;\n for (i = 0; i < length; ++i) {\n code = key.charCodeAt(i);\n if (code < 0x80) {\n bytes[index++] = code;\n } else if (code < 0x800) {\n bytes[index++] = 0xc0 | code >> 6;\n bytes[index++] = 0x80 | code & 0x3f;\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes[index++] = 0xe0 | code >> 12;\n bytes[index++] = 0x80 | code >> 6 & 0x3f;\n bytes[index++] = 0x80 | code & 0x3f;\n } else {\n code = 0x10000 + ((code & 0x3ff) << 10 | key.charCodeAt(++i) & 0x3ff);\n bytes[index++] = 0xf0 | code >> 18;\n bytes[index++] = 0x80 | code >> 12 & 0x3f;\n bytes[index++] = 0x80 | code >> 6 & 0x3f;\n bytes[index++] = 0x80 | code & 0x3f;\n }\n }\n key = bytes;\n } else {\n if (type === 'object') {\n if (key === null) {\n throw new Error(ERROR);\n } else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {\n key = new Uint8Array(key);\n } else if (!Array.isArray(key)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {\n throw new Error(ERROR);\n }\n }\n } else {\n throw new Error(ERROR);\n }\n }\n if (key.length > 64) {\n key = new Sha256(is224, true).update(key).array();\n }\n var oKeyPad = [],\n iKeyPad = [];\n for (i = 0; i < 64; ++i) {\n var b = key[i] || 0;\n oKeyPad[i] = 0x5c ^ b;\n iKeyPad[i] = 0x36 ^ b;\n }\n Sha256.call(this, is224, sharedMemory);\n this.update(iKeyPad);\n this.oKeyPad = oKeyPad;\n this.inner = true;\n this.sharedMemory = sharedMemory;\n }\n HmacSha256.prototype = new Sha256();\n HmacSha256.prototype.finalize = function () {\n Sha256.prototype.finalize.call(this);\n if (this.inner) {\n this.inner = false;\n var innerHash = this.array();\n Sha256.call(this, this.is224, this.sharedMemory);\n this.update(this.oKeyPad);\n this.update(innerHash);\n Sha256.prototype.finalize.call(this);\n }\n };\n var exports = createMethod();\n exports.sha256 = exports;\n exports.sha224 = createMethod(true);\n exports.sha256.hmac = createHmacMethod();\n exports.sha224.hmac = createHmacMethod(true);\n return exports;\n}\nconst sha256 = factory();\n/**\r\n * Abstraction for crypto algorithms\r\n */\nclass HashHandler {}\nfunction decodeUTF8(s) {\n if (typeof s !== 'string') throw new TypeError('expected string');\n var i,\n d = s,\n b = new Uint8Array(d.length);\n for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);\n return b;\n}\nfunction encodeUTF8(arr) {\n var i,\n s = [];\n for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));\n return s.join('');\n}\nlet DefaultHashHandler = /*#__PURE__*/(() => {\n class DefaultHashHandler {\n async calcHash(valueToHash, algorithm) {\n // const encoder = new TextEncoder();\n // const hashArray = await window.crypto.subtle.digest(algorithm, data);\n // const data = encoder.encode(valueToHash);\n // const fhash = fsha256(valueToHash);\n const candHash = encodeUTF8(fsha256(decodeUTF8(valueToHash)));\n // const hashArray = (sha256 as any).array(valueToHash);\n // // const hashString = this.toHashString(hashArray);\n // const hashString = this.toHashString2(hashArray);\n // console.debug('hash orig - cand', candHash, hashString);\n // alert(1);\n return candHash;\n }\n toHashString2(byteArray) {\n let result = '';\n for (let e of byteArray) {\n result += String.fromCharCode(e);\n }\n return result;\n }\n toHashString(buffer) {\n const byteArray = new Uint8Array(buffer);\n let result = '';\n for (let e of byteArray) {\n result += String.fromCharCode(e);\n }\n return result;\n }\n }\n DefaultHashHandler.ɵfac = function DefaultHashHandler_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultHashHandler)();\n };\n DefaultHashHandler.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultHashHandler,\n factory: DefaultHashHandler.ɵfac\n });\n return DefaultHashHandler;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\r\n * Service for logging in and logging out with\r\n * OIDC and OAuth2. Supports implicit flow and\r\n * password flow.\r\n */\nlet OAuthService = /*#__PURE__*/(() => {\n class OAuthService extends AuthConfig {\n constructor(ngZone, http, storage, tokenValidationHandler, config, urlHelper, logger, crypto, document, dateTimeService) {\n super();\n this.ngZone = ngZone;\n this.http = http;\n this.config = config;\n this.urlHelper = urlHelper;\n this.logger = logger;\n this.crypto = crypto;\n this.dateTimeService = dateTimeService;\n /**\r\n * @internal\r\n * Deprecated: use property events instead\r\n */\n this.discoveryDocumentLoaded = false;\n /**\r\n * The received (passed around) state, when logging\r\n * in with implicit flow.\r\n */\n this.state = '';\n this.eventsSubject = new Subject();\n this.discoveryDocumentLoadedSubject = new Subject();\n this.grantTypesSupported = [];\n this.inImplicitFlow = false;\n this.saveNoncesInLocalStorage = false;\n this.debug('angular-oauth2-oidc v10');\n // See https://github.com/manfredsteyer/angular-oauth2-oidc/issues/773 for why this is needed\n this.document = document;\n if (!config) {\n config = {};\n }\n this.discoveryDocumentLoaded$ = this.discoveryDocumentLoadedSubject.asObservable();\n this.events = this.eventsSubject.asObservable();\n if (tokenValidationHandler) {\n this.tokenValidationHandler = tokenValidationHandler;\n }\n if (config) {\n this.configure(config);\n }\n try {\n if (storage) {\n this.setStorage(storage);\n } else if (typeof sessionStorage !== 'undefined') {\n this.setStorage(sessionStorage);\n }\n } catch (e) {\n console.error('No OAuthStorage provided and cannot access default (sessionStorage).' + 'Consider providing a custom OAuthStorage implementation in your module.', e);\n }\n // in IE, sessionStorage does not always survive a redirect\n if (this.checkLocalStorageAccessable()) {\n const ua = window?.navigator?.userAgent;\n const msie = ua?.includes('MSIE ') || ua?.includes('Trident');\n if (msie) {\n this.saveNoncesInLocalStorage = true;\n }\n }\n this.setupRefreshTimer();\n }\n checkLocalStorageAccessable() {\n if (typeof window === 'undefined') return false;\n const test = 'test';\n try {\n if (typeof window['localStorage'] === 'undefined') return false;\n localStorage.setItem(test, test);\n localStorage.removeItem(test);\n return true;\n } catch (e) {\n return false;\n }\n }\n /**\r\n * Use this method to configure the service\r\n * @param config the configuration\r\n */\n configure(config) {\n // For the sake of downward compatibility with\n // original configuration API\n Object.assign(this, new AuthConfig(), config);\n this.config = Object.assign({}, new AuthConfig(), config);\n if (this.sessionChecksEnabled) {\n this.setupSessionCheck();\n }\n this.configChanged();\n }\n configChanged() {\n this.setupRefreshTimer();\n }\n restartSessionChecksIfStillLoggedIn() {\n if (this.hasValidIdToken()) {\n this.initSessionCheck();\n }\n }\n restartRefreshTimerIfStillLoggedIn() {\n this.setupExpirationTimers();\n }\n setupSessionCheck() {\n this.events.pipe(filter(e => e.type === 'token_received')).subscribe(e => {\n this.initSessionCheck();\n });\n }\n /**\r\n * Will setup up silent refreshing for when the token is\r\n * about to expire. When the user is logged out via this.logOut method, the\r\n * silent refreshing will pause and not refresh the tokens until the user is\r\n * logged back in via receiving a new token.\r\n * @param params Additional parameter to pass\r\n * @param listenTo Setup automatic refresh of a specific token type\r\n */\n setupAutomaticSilentRefresh(params = {}, listenTo, noPrompt = true) {\n let shouldRunSilentRefresh = true;\n this.clearAutomaticRefreshTimer();\n this.automaticRefreshSubscription = this.events.pipe(tap(e => {\n if (e.type === 'token_received') {\n shouldRunSilentRefresh = true;\n } else if (e.type === 'logout') {\n shouldRunSilentRefresh = false;\n }\n }), filter(e => e.type === 'token_expires' && (listenTo == null || listenTo === 'any' || e.info === listenTo)), debounceTime(1000)).subscribe(_ => {\n if (shouldRunSilentRefresh) {\n // this.silentRefresh(params, noPrompt).catch(_ => {\n this.refreshInternal(params, noPrompt).catch(_ => {\n this.debug('Automatic silent refresh did not work');\n });\n }\n });\n this.restartRefreshTimerIfStillLoggedIn();\n }\n refreshInternal(params, noPrompt) {\n if (!this.useSilentRefresh && this.responseType === 'code') {\n return this.refreshToken();\n } else {\n return this.silentRefresh(params, noPrompt);\n }\n }\n /**\r\n * Convenience method that first calls `loadDiscoveryDocument(...)` and\r\n * directly chains using the `then(...)` part of the promise to call\r\n * the `tryLogin(...)` method.\r\n *\r\n * @param options LoginOptions to pass through to `tryLogin(...)`\r\n */\n loadDiscoveryDocumentAndTryLogin(options = null) {\n return this.loadDiscoveryDocument().then(doc => {\n return this.tryLogin(options);\n });\n }\n /**\r\n * Convenience method that first calls `loadDiscoveryDocumentAndTryLogin(...)`\r\n * and if then chains to `initLoginFlow()`, but only if there is no valid\r\n * IdToken or no valid AccessToken.\r\n *\r\n * @param options LoginOptions to pass through to `tryLogin(...)`\r\n */\n loadDiscoveryDocumentAndLogin(options = null) {\n options = options || {};\n return this.loadDiscoveryDocumentAndTryLogin(options).then(_ => {\n if (!this.hasValidIdToken() || !this.hasValidAccessToken()) {\n const state = typeof options.state === 'string' ? options.state : '';\n this.initLoginFlow(state);\n return false;\n } else {\n return true;\n }\n });\n }\n debug(...args) {\n if (this.showDebugInformation) {\n this.logger.debug.apply(this.logger, args);\n }\n }\n validateUrlFromDiscoveryDocument(url) {\n const errors = [];\n const httpsCheck = this.validateUrlForHttps(url);\n const issuerCheck = this.validateUrlAgainstIssuer(url);\n if (!httpsCheck) {\n errors.push('https for all urls required. Also for urls received by discovery.');\n }\n if (!issuerCheck) {\n errors.push('Every url in discovery document has to start with the issuer url.' + 'Also see property strictDiscoveryDocumentValidation.');\n }\n return errors;\n }\n validateUrlForHttps(url) {\n if (!url) {\n return true;\n }\n const lcUrl = url.toLowerCase();\n if (this.requireHttps === false) {\n return true;\n }\n if ((lcUrl.match(/^http:\\/\\/localhost($|[:\\/])/) || lcUrl.match(/^http:\\/\\/localhost($|[:\\/])/)) && this.requireHttps === 'remoteOnly') {\n return true;\n }\n return lcUrl.startsWith('https://');\n }\n assertUrlNotNullAndCorrectProtocol(url, description) {\n if (!url) {\n throw new Error(`'${description}' should not be null`);\n }\n if (!this.validateUrlForHttps(url)) {\n throw new Error(`'${description}' must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).`);\n }\n }\n validateUrlAgainstIssuer(url) {\n if (!this.strictDiscoveryDocumentValidation) {\n return true;\n }\n if (!url) {\n return true;\n }\n return url.toLowerCase().startsWith(this.issuer.toLowerCase());\n }\n setupRefreshTimer() {\n if (typeof window === 'undefined') {\n this.debug('timer not supported on this plattform');\n return;\n }\n if (this.hasValidIdToken() || this.hasValidAccessToken()) {\n this.clearAccessTokenTimer();\n this.clearIdTokenTimer();\n this.setupExpirationTimers();\n }\n if (this.tokenReceivedSubscription) this.tokenReceivedSubscription.unsubscribe();\n this.tokenReceivedSubscription = this.events.pipe(filter(e => e.type === 'token_received')).subscribe(_ => {\n this.clearAccessTokenTimer();\n this.clearIdTokenTimer();\n this.setupExpirationTimers();\n });\n }\n setupExpirationTimers() {\n if (this.hasValidAccessToken()) {\n this.setupAccessTokenTimer();\n }\n if (this.hasValidIdToken()) {\n this.setupIdTokenTimer();\n }\n }\n setupAccessTokenTimer() {\n const expiration = this.getAccessTokenExpiration();\n const storedAt = this.getAccessTokenStoredAt();\n const timeout = this.calcTimeout(storedAt, expiration);\n this.ngZone.runOutsideAngular(() => {\n this.accessTokenTimeoutSubscription = of(new OAuthInfoEvent('token_expires', 'access_token')).pipe(delay(timeout)).subscribe(e => {\n this.ngZone.run(() => {\n this.eventsSubject.next(e);\n });\n });\n });\n }\n setupIdTokenTimer() {\n const expiration = this.getIdTokenExpiration();\n const storedAt = this.getIdTokenStoredAt();\n const timeout = this.calcTimeout(storedAt, expiration);\n this.ngZone.runOutsideAngular(() => {\n this.idTokenTimeoutSubscription = of(new OAuthInfoEvent('token_expires', 'id_token')).pipe(delay(timeout)).subscribe(e => {\n this.ngZone.run(() => {\n this.eventsSubject.next(e);\n });\n });\n });\n }\n /**\r\n * Stops timers for automatic refresh.\r\n * To restart it, call setupAutomaticSilentRefresh again.\r\n */\n stopAutomaticRefresh() {\n this.clearAccessTokenTimer();\n this.clearIdTokenTimer();\n this.clearAutomaticRefreshTimer();\n }\n clearAccessTokenTimer() {\n if (this.accessTokenTimeoutSubscription) {\n this.accessTokenTimeoutSubscription.unsubscribe();\n }\n }\n clearIdTokenTimer() {\n if (this.idTokenTimeoutSubscription) {\n this.idTokenTimeoutSubscription.unsubscribe();\n }\n }\n clearAutomaticRefreshTimer() {\n if (this.automaticRefreshSubscription) {\n this.automaticRefreshSubscription.unsubscribe();\n }\n }\n calcTimeout(storedAt, expiration) {\n const now = this.dateTimeService.now();\n const delta = (expiration - storedAt) * this.timeoutFactor - (now - storedAt);\n return Math.max(0, delta);\n }\n /**\r\n * DEPRECATED. Use a provider for OAuthStorage instead:\r\n *\r\n * { provide: OAuthStorage, useFactory: oAuthStorageFactory }\r\n * export function oAuthStorageFactory(): OAuthStorage { return localStorage; }\r\n * Sets a custom storage used to store the received\r\n * tokens on client side. By default, the browser's\r\n * sessionStorage is used.\r\n * @ignore\r\n *\r\n * @param storage\r\n */\n setStorage(storage) {\n this._storage = storage;\n this.configChanged();\n }\n /**\r\n * Loads the discovery document to configure most\r\n * properties of this service. The url of the discovery\r\n * document is infered from the issuer's url according\r\n * to the OpenId Connect spec. To use another url you\r\n * can pass it to to optional parameter fullUrl.\r\n *\r\n * @param fullUrl\r\n */\n loadDiscoveryDocument(fullUrl = null) {\n return new Promise((resolve, reject) => {\n if (!fullUrl) {\n fullUrl = this.issuer || '';\n if (!fullUrl.endsWith('/')) {\n fullUrl += '/';\n }\n fullUrl += '.well-known/openid-configuration';\n }\n if (!this.validateUrlForHttps(fullUrl)) {\n reject(\"issuer must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n return;\n }\n this.http.get(fullUrl).subscribe(doc => {\n if (!this.validateDiscoveryDocument(doc)) {\n this.eventsSubject.next(new OAuthErrorEvent('discovery_document_validation_error', null));\n reject('discovery_document_validation_error');\n return;\n }\n this.loginUrl = doc.authorization_endpoint;\n this.logoutUrl = doc.end_session_endpoint || this.logoutUrl;\n this.grantTypesSupported = doc.grant_types_supported;\n this.issuer = doc.issuer;\n this.tokenEndpoint = doc.token_endpoint;\n this.userinfoEndpoint = doc.userinfo_endpoint || this.userinfoEndpoint;\n this.jwksUri = doc.jwks_uri;\n this.sessionCheckIFrameUrl = doc.check_session_iframe || this.sessionCheckIFrameUrl;\n this.discoveryDocumentLoaded = true;\n this.discoveryDocumentLoadedSubject.next(doc);\n this.revocationEndpoint = doc.revocation_endpoint || this.revocationEndpoint;\n if (this.sessionChecksEnabled) {\n this.restartSessionChecksIfStillLoggedIn();\n }\n this.loadJwks().then(jwks => {\n const result = {\n discoveryDocument: doc,\n jwks: jwks\n };\n const event = new OAuthSuccessEvent('discovery_document_loaded', result);\n this.eventsSubject.next(event);\n resolve(event);\n return;\n }).catch(err => {\n this.eventsSubject.next(new OAuthErrorEvent('discovery_document_load_error', err));\n reject(err);\n return;\n });\n }, err => {\n this.logger.error('error loading discovery document', err);\n this.eventsSubject.next(new OAuthErrorEvent('discovery_document_load_error', err));\n reject(err);\n });\n });\n }\n loadJwks() {\n return new Promise((resolve, reject) => {\n if (this.jwksUri) {\n this.http.get(this.jwksUri).subscribe(jwks => {\n this.jwks = jwks;\n this.eventsSubject.next(new OAuthSuccessEvent('discovery_document_loaded'));\n resolve(jwks);\n }, err => {\n this.logger.error('error loading jwks', err);\n this.eventsSubject.next(new OAuthErrorEvent('jwks_load_error', err));\n reject(err);\n });\n } else {\n resolve(null);\n }\n });\n }\n validateDiscoveryDocument(doc) {\n let errors;\n if (!this.skipIssuerCheck && doc.issuer !== this.issuer) {\n this.logger.error('invalid issuer in discovery document', 'expected: ' + this.issuer, 'current: ' + doc.issuer);\n return false;\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.authorization_endpoint);\n if (errors.length > 0) {\n this.logger.error('error validating authorization_endpoint in discovery document', errors);\n return false;\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.end_session_endpoint);\n if (errors.length > 0) {\n this.logger.error('error validating end_session_endpoint in discovery document', errors);\n return false;\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.token_endpoint);\n if (errors.length > 0) {\n this.logger.error('error validating token_endpoint in discovery document', errors);\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.revocation_endpoint);\n if (errors.length > 0) {\n this.logger.error('error validating revocation_endpoint in discovery document', errors);\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.userinfo_endpoint);\n if (errors.length > 0) {\n this.logger.error('error validating userinfo_endpoint in discovery document', errors);\n return false;\n }\n errors = this.validateUrlFromDiscoveryDocument(doc.jwks_uri);\n if (errors.length > 0) {\n this.logger.error('error validating jwks_uri in discovery document', errors);\n return false;\n }\n if (this.sessionChecksEnabled && !doc.check_session_iframe) {\n this.logger.warn('sessionChecksEnabled is activated but discovery document' + ' does not contain a check_session_iframe field');\n }\n return true;\n }\n /**\r\n * Uses password flow to exchange userName and password for an\r\n * access_token. After receiving the access_token, this method\r\n * uses it to query the userinfo endpoint in order to get information\r\n * about the user in question.\r\n *\r\n * When using this, make sure that the property oidc is set to false.\r\n * Otherwise stricter validations take place that make this operation\r\n * fail.\r\n *\r\n * @param userName\r\n * @param password\r\n * @param headers Optional additional http-headers.\r\n */\n fetchTokenUsingPasswordFlowAndLoadUserProfile(userName, password, headers = new HttpHeaders()) {\n return this.fetchTokenUsingPasswordFlow(userName, password, headers).then(() => this.loadUserProfile());\n }\n /**\r\n * Loads the user profile by accessing the user info endpoint defined by OpenId Connect.\r\n *\r\n * When using this with OAuth2 password flow, make sure that the property oidc is set to false.\r\n * Otherwise stricter validations take place that make this operation fail.\r\n */\n loadUserProfile() {\n if (!this.hasValidAccessToken()) {\n throw new Error('Can not load User Profile without access_token');\n }\n if (!this.validateUrlForHttps(this.userinfoEndpoint)) {\n throw new Error(\"userinfoEndpoint must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n }\n return new Promise((resolve, reject) => {\n const headers = new HttpHeaders().set('Authorization', 'Bearer ' + this.getAccessToken());\n this.http.get(this.userinfoEndpoint, {\n headers,\n observe: 'response',\n responseType: 'text'\n }).subscribe(response => {\n this.debug('userinfo received', JSON.stringify(response));\n if (response.headers.get('content-type').startsWith('application/json')) {\n let info = JSON.parse(response.body);\n const existingClaims = this.getIdentityClaims() || {};\n if (!this.skipSubjectCheck) {\n if (this.oidc && (!existingClaims['sub'] || info.sub !== existingClaims['sub'])) {\n const err = 'if property oidc is true, the received user-id (sub) has to be the user-id ' + 'of the user that has logged in with oidc.\\n' + 'if you are not using oidc but just oauth2 password flow set oidc to false';\n reject(err);\n return;\n }\n }\n info = Object.assign({}, existingClaims, info);\n this._storage.setItem('id_token_claims_obj', JSON.stringify(info));\n this.eventsSubject.next(new OAuthSuccessEvent('user_profile_loaded'));\n resolve({\n info\n });\n } else {\n this.debug('userinfo is not JSON, treating it as JWE/JWS');\n this.eventsSubject.next(new OAuthSuccessEvent('user_profile_loaded'));\n resolve(JSON.parse(response.body));\n }\n }, err => {\n this.logger.error('error loading user info', err);\n this.eventsSubject.next(new OAuthErrorEvent('user_profile_load_error', err));\n reject(err);\n });\n });\n }\n /**\r\n * Uses password flow to exchange userName and password for an access_token.\r\n * @param userName\r\n * @param password\r\n * @param headers Optional additional http-headers.\r\n */\n fetchTokenUsingPasswordFlow(userName, password, headers = new HttpHeaders()) {\n const parameters = {\n username: userName,\n password: password\n };\n return this.fetchTokenUsingGrant('password', parameters, headers);\n }\n /**\r\n * Uses a custom grant type to retrieve tokens.\r\n * @param grantType Grant type.\r\n * @param parameters Parameters to pass.\r\n * @param headers Optional additional HTTP headers.\r\n */\n fetchTokenUsingGrant(grantType, parameters, headers = new HttpHeaders()) {\n this.assertUrlNotNullAndCorrectProtocol(this.tokenEndpoint, 'tokenEndpoint');\n /**\r\n * A `HttpParameterCodec` that uses `encodeURIComponent` and `decodeURIComponent` to\r\n * serialize and parse URL parameter keys and values.\r\n *\r\n * @stable\r\n */\n let params = new HttpParams({\n encoder: new WebHttpUrlEncodingCodec()\n }).set('grant_type', grantType).set('scope', this.scope);\n if (this.useHttpBasicAuth) {\n const header = btoa(`${this.clientId}:${this.dummyClientSecret}`);\n headers = headers.set('Authorization', 'Basic ' + header);\n }\n if (!this.useHttpBasicAuth) {\n params = params.set('client_id', this.clientId);\n }\n if (!this.useHttpBasicAuth && this.dummyClientSecret) {\n params = params.set('client_secret', this.dummyClientSecret);\n }\n if (this.customQueryParams) {\n for (const key of Object.getOwnPropertyNames(this.customQueryParams)) {\n params = params.set(key, this.customQueryParams[key]);\n }\n }\n // set explicit parameters last, to allow overwriting\n for (const key of Object.keys(parameters)) {\n params = params.set(key, parameters[key]);\n }\n headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');\n return new Promise((resolve, reject) => {\n this.http.post(this.tokenEndpoint, params, {\n headers\n }).subscribe(tokenResponse => {\n this.debug('tokenResponse', tokenResponse);\n this.storeAccessTokenResponse(tokenResponse.access_token, tokenResponse.refresh_token, tokenResponse.expires_in || this.fallbackAccessTokenExpirationTimeInSec, tokenResponse.scope, this.extractRecognizedCustomParameters(tokenResponse));\n if (this.oidc && tokenResponse.id_token) {\n this.processIdToken(tokenResponse.id_token, tokenResponse.access_token).then(result => {\n this.storeIdToken(result);\n resolve(tokenResponse);\n });\n }\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n resolve(tokenResponse);\n }, err => {\n this.logger.error('Error performing ${grantType} flow', err);\n this.eventsSubject.next(new OAuthErrorEvent('token_error', err));\n reject(err);\n });\n });\n }\n /**\r\n * Refreshes the token using a refresh_token.\r\n * This does not work for implicit flow, b/c\r\n * there is no refresh_token in this flow.\r\n * A solution for this is provided by the\r\n * method silentRefresh.\r\n */\n refreshToken() {\n this.assertUrlNotNullAndCorrectProtocol(this.tokenEndpoint, 'tokenEndpoint');\n return new Promise((resolve, reject) => {\n let params = new HttpParams({\n encoder: new WebHttpUrlEncodingCodec()\n }).set('grant_type', 'refresh_token').set('scope', this.scope).set('refresh_token', this._storage.getItem('refresh_token'));\n let headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');\n if (this.useHttpBasicAuth) {\n const header = btoa(`${this.clientId}:${this.dummyClientSecret}`);\n headers = headers.set('Authorization', 'Basic ' + header);\n }\n if (!this.useHttpBasicAuth) {\n params = params.set('client_id', this.clientId);\n }\n if (!this.useHttpBasicAuth && this.dummyClientSecret) {\n params = params.set('client_secret', this.dummyClientSecret);\n }\n if (this.customQueryParams) {\n for (const key of Object.getOwnPropertyNames(this.customQueryParams)) {\n params = params.set(key, this.customQueryParams[key]);\n }\n }\n this.http.post(this.tokenEndpoint, params, {\n headers\n }).pipe(switchMap(tokenResponse => {\n if (tokenResponse.id_token) {\n return from(this.processIdToken(tokenResponse.id_token, tokenResponse.access_token, true)).pipe(tap(result => this.storeIdToken(result)), map(_ => tokenResponse));\n } else {\n return of(tokenResponse);\n }\n })).subscribe(tokenResponse => {\n this.debug('refresh tokenResponse', tokenResponse);\n this.storeAccessTokenResponse(tokenResponse.access_token, tokenResponse.refresh_token, tokenResponse.expires_in || this.fallbackAccessTokenExpirationTimeInSec, tokenResponse.scope, this.extractRecognizedCustomParameters(tokenResponse));\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n this.eventsSubject.next(new OAuthSuccessEvent('token_refreshed'));\n resolve(tokenResponse);\n }, err => {\n this.logger.error('Error refreshing token', err);\n this.eventsSubject.next(new OAuthErrorEvent('token_refresh_error', err));\n reject(err);\n });\n });\n }\n removeSilentRefreshEventListener() {\n if (this.silentRefreshPostMessageEventListener) {\n window.removeEventListener('message', this.silentRefreshPostMessageEventListener);\n this.silentRefreshPostMessageEventListener = null;\n }\n }\n setupSilentRefreshEventListener() {\n this.removeSilentRefreshEventListener();\n this.silentRefreshPostMessageEventListener = e => {\n const message = this.processMessageEventMessage(e);\n this.tryLogin({\n customHashFragment: message,\n preventClearHashAfterLogin: true,\n customRedirectUri: this.silentRefreshRedirectUri || this.redirectUri\n }).catch(err => this.debug('tryLogin during silent refresh failed', err));\n };\n window.addEventListener('message', this.silentRefreshPostMessageEventListener);\n }\n /**\r\n * Performs a silent refresh for implicit flow.\r\n * Use this method to get new tokens when/before\r\n * the existing tokens expire.\r\n */\n silentRefresh(params = {}, noPrompt = true) {\n const claims = this.getIdentityClaims() || {};\n if (this.useIdTokenHintForSilentRefresh && this.hasValidIdToken()) {\n params['id_token_hint'] = this.getIdToken();\n }\n if (!this.validateUrlForHttps(this.loginUrl)) {\n throw new Error(\"loginUrl must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n }\n if (typeof this.document === 'undefined') {\n throw new Error('silent refresh is not supported on this platform');\n }\n const existingIframe = this.document.getElementById(this.silentRefreshIFrameName);\n if (existingIframe) {\n this.document.body.removeChild(existingIframe);\n }\n this.silentRefreshSubject = claims['sub'];\n const iframe = this.document.createElement('iframe');\n iframe.id = this.silentRefreshIFrameName;\n this.setupSilentRefreshEventListener();\n const redirectUri = this.silentRefreshRedirectUri || this.redirectUri;\n this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => {\n iframe.setAttribute('src', url);\n if (!this.silentRefreshShowIFrame) {\n iframe.style['display'] = 'none';\n }\n this.document.body.appendChild(iframe);\n });\n const errors = this.events.pipe(filter(e => e instanceof OAuthErrorEvent), first());\n const success = this.events.pipe(filter(e => e.type === 'token_received'), first());\n const timeout = of(new OAuthErrorEvent('silent_refresh_timeout', null)).pipe(delay(this.silentRefreshTimeout));\n return race([errors, success, timeout]).pipe(map(e => {\n if (e instanceof OAuthErrorEvent) {\n if (e.type === 'silent_refresh_timeout') {\n this.eventsSubject.next(e);\n } else {\n e = new OAuthErrorEvent('silent_refresh_error', e);\n this.eventsSubject.next(e);\n }\n throw e;\n } else if (e.type === 'token_received') {\n e = new OAuthSuccessEvent('silently_refreshed');\n this.eventsSubject.next(e);\n }\n return e;\n })).toPromise();\n }\n /**\r\n * This method exists for backwards compatibility.\r\n * {@link OAuthService#initLoginFlowInPopup} handles both code\r\n * and implicit flows.\r\n */\n initImplicitFlowInPopup(options) {\n return this.initLoginFlowInPopup(options);\n }\n initLoginFlowInPopup(options) {\n options = options || {};\n return this.createLoginUrl(null, null, this.silentRefreshRedirectUri, false, {\n display: 'popup'\n }).then(url => {\n return new Promise((resolve, reject) => {\n /**\r\n * Error handling section\r\n */\n const checkForPopupClosedInterval = 500;\n let windowRef = null;\n // If we got no window reference we open a window\n // else we are using the window already opened\n if (!options.windowRef) {\n windowRef = window.open(url, 'ngx-oauth2-oidc-login', this.calculatePopupFeatures(options));\n } else if (options.windowRef && !options.windowRef.closed) {\n windowRef = options.windowRef;\n windowRef.location.href = url;\n }\n let checkForPopupClosedTimer;\n const tryLogin = hash => {\n this.tryLogin({\n customHashFragment: hash,\n preventClearHashAfterLogin: true,\n customRedirectUri: this.silentRefreshRedirectUri\n }).then(() => {\n cleanup();\n resolve(true);\n }, err => {\n cleanup();\n reject(err);\n });\n };\n const checkForPopupClosed = () => {\n if (!windowRef || windowRef.closed) {\n cleanup();\n reject(new OAuthErrorEvent('popup_closed', {}));\n }\n };\n if (!windowRef) {\n reject(new OAuthErrorEvent('popup_blocked', {}));\n } else {\n checkForPopupClosedTimer = window.setInterval(checkForPopupClosed, checkForPopupClosedInterval);\n }\n const cleanup = () => {\n window.clearInterval(checkForPopupClosedTimer);\n window.removeEventListener('storage', storageListener);\n window.removeEventListener('message', listener);\n if (windowRef !== null) {\n windowRef.close();\n }\n windowRef = null;\n };\n const listener = e => {\n const message = this.processMessageEventMessage(e);\n if (message && message !== null) {\n window.removeEventListener('storage', storageListener);\n tryLogin(message);\n } else {\n console.log('false event firing');\n }\n };\n const storageListener = event => {\n if (event.key === 'auth_hash') {\n window.removeEventListener('message', listener);\n tryLogin(event.newValue);\n }\n };\n window.addEventListener('message', listener);\n window.addEventListener('storage', storageListener);\n });\n });\n }\n calculatePopupFeatures(options) {\n // Specify an static height and width and calculate centered position\n const height = options.height || 470;\n const width = options.width || 500;\n const left = window.screenLeft + (window.outerWidth - width) / 2;\n const top = window.screenTop + (window.outerHeight - height) / 2;\n return `location=no,toolbar=no,width=${width},height=${height},top=${top},left=${left}`;\n }\n processMessageEventMessage(e) {\n let expectedPrefix = '#';\n if (this.silentRefreshMessagePrefix) {\n expectedPrefix += this.silentRefreshMessagePrefix;\n }\n if (!e || !e.data || typeof e.data !== 'string') {\n return;\n }\n const prefixedMessage = e.data;\n if (!prefixedMessage.startsWith(expectedPrefix)) {\n return;\n }\n return '#' + prefixedMessage.substr(expectedPrefix.length);\n }\n canPerformSessionCheck() {\n if (!this.sessionChecksEnabled) {\n return false;\n }\n if (!this.sessionCheckIFrameUrl) {\n console.warn('sessionChecksEnabled is activated but there is no sessionCheckIFrameUrl');\n return false;\n }\n const sessionState = this.getSessionState();\n if (!sessionState) {\n console.warn('sessionChecksEnabled is activated but there is no session_state');\n return false;\n }\n if (typeof this.document === 'undefined') {\n return false;\n }\n return true;\n }\n setupSessionCheckEventListener() {\n this.removeSessionCheckEventListener();\n this.sessionCheckEventListener = e => {\n const origin = e.origin.toLowerCase();\n const issuer = this.issuer.toLowerCase();\n this.debug('sessionCheckEventListener');\n if (!issuer.startsWith(origin)) {\n this.debug('sessionCheckEventListener', 'wrong origin', origin, 'expected', issuer, 'event', e);\n return;\n }\n // only run in Angular zone if it is 'changed' or 'error'\n switch (e.data) {\n case 'unchanged':\n this.ngZone.run(() => {\n this.handleSessionUnchanged();\n });\n break;\n case 'changed':\n this.ngZone.run(() => {\n this.handleSessionChange();\n });\n break;\n case 'error':\n this.ngZone.run(() => {\n this.handleSessionError();\n });\n break;\n }\n this.debug('got info from session check inframe', e);\n };\n // prevent Angular from refreshing the view on every message (runs in intervals)\n this.ngZone.runOutsideAngular(() => {\n window.addEventListener('message', this.sessionCheckEventListener);\n });\n }\n handleSessionUnchanged() {\n this.debug('session check', 'session unchanged');\n this.eventsSubject.next(new OAuthInfoEvent('session_unchanged'));\n }\n handleSessionChange() {\n this.eventsSubject.next(new OAuthInfoEvent('session_changed'));\n this.stopSessionCheckTimer();\n if (!this.useSilentRefresh && this.responseType === 'code') {\n this.refreshToken().then(_ => {\n this.debug('token refresh after session change worked');\n }).catch(_ => {\n this.debug('token refresh did not work after session changed');\n this.eventsSubject.next(new OAuthInfoEvent('session_terminated'));\n this.logOut(true);\n });\n } else if (this.silentRefreshRedirectUri) {\n this.silentRefresh().catch(_ => this.debug('silent refresh failed after session changed'));\n this.waitForSilentRefreshAfterSessionChange();\n } else {\n this.eventsSubject.next(new OAuthInfoEvent('session_terminated'));\n this.logOut(true);\n }\n }\n waitForSilentRefreshAfterSessionChange() {\n this.events.pipe(filter(e => e.type === 'silently_refreshed' || e.type === 'silent_refresh_timeout' || e.type === 'silent_refresh_error'), first()).subscribe(e => {\n if (e.type !== 'silently_refreshed') {\n this.debug('silent refresh did not work after session changed');\n this.eventsSubject.next(new OAuthInfoEvent('session_terminated'));\n this.logOut(true);\n }\n });\n }\n handleSessionError() {\n this.stopSessionCheckTimer();\n this.eventsSubject.next(new OAuthInfoEvent('session_error'));\n }\n removeSessionCheckEventListener() {\n if (this.sessionCheckEventListener) {\n window.removeEventListener('message', this.sessionCheckEventListener);\n this.sessionCheckEventListener = null;\n }\n }\n initSessionCheck() {\n if (!this.canPerformSessionCheck()) {\n return;\n }\n const existingIframe = this.document.getElementById(this.sessionCheckIFrameName);\n if (existingIframe) {\n this.document.body.removeChild(existingIframe);\n }\n const iframe = this.document.createElement('iframe');\n iframe.id = this.sessionCheckIFrameName;\n this.setupSessionCheckEventListener();\n const url = this.sessionCheckIFrameUrl;\n iframe.setAttribute('src', url);\n iframe.style.display = 'none';\n this.document.body.appendChild(iframe);\n this.startSessionCheckTimer();\n }\n startSessionCheckTimer() {\n this.stopSessionCheckTimer();\n this.ngZone.runOutsideAngular(() => {\n this.sessionCheckTimer = setInterval(this.checkSession.bind(this), this.sessionCheckIntervall);\n });\n }\n stopSessionCheckTimer() {\n if (this.sessionCheckTimer) {\n clearInterval(this.sessionCheckTimer);\n this.sessionCheckTimer = null;\n }\n }\n checkSession() {\n const iframe = this.document.getElementById(this.sessionCheckIFrameName);\n if (!iframe) {\n this.logger.warn('checkSession did not find iframe', this.sessionCheckIFrameName);\n }\n const sessionState = this.getSessionState();\n if (!sessionState) {\n this.stopSessionCheckTimer();\n }\n const message = this.clientId + ' ' + sessionState;\n iframe.contentWindow.postMessage(message, this.issuer);\n }\n async createLoginUrl(state = '', loginHint = '', customRedirectUri = '', noPrompt = false, params = {}) {\n const that = this;\n let redirectUri;\n if (customRedirectUri) {\n redirectUri = customRedirectUri;\n } else {\n redirectUri = this.redirectUri;\n }\n const nonce = await this.createAndSaveNonce();\n if (state) {\n state = nonce + this.config.nonceStateSeparator + encodeURIComponent(state);\n } else {\n state = nonce;\n }\n if (!this.requestAccessToken && !this.oidc) {\n throw new Error('Either requestAccessToken or oidc or both must be true');\n }\n if (this.config.responseType) {\n this.responseType = this.config.responseType;\n } else {\n if (this.oidc && this.requestAccessToken) {\n this.responseType = 'id_token token';\n } else if (this.oidc && !this.requestAccessToken) {\n this.responseType = 'id_token';\n } else {\n this.responseType = 'token';\n }\n }\n const seperationChar = that.loginUrl.indexOf('?') > -1 ? '&' : '?';\n let scope = that.scope;\n if (this.oidc && !scope.match(/(^|\\s)openid($|\\s)/)) {\n scope = 'openid ' + scope;\n }\n let url = that.loginUrl + seperationChar + 'response_type=' + encodeURIComponent(that.responseType) + '&client_id=' + encodeURIComponent(that.clientId) + '&state=' + encodeURIComponent(state) + '&redirect_uri=' + encodeURIComponent(redirectUri) + '&scope=' + encodeURIComponent(scope);\n if (this.responseType.includes('code') && !this.disablePKCE) {\n const [challenge, verifier] = await this.createChallangeVerifierPairForPKCE();\n if (this.saveNoncesInLocalStorage && typeof window['localStorage'] !== 'undefined') {\n localStorage.setItem('PKCE_verifier', verifier);\n } else {\n this._storage.setItem('PKCE_verifier', verifier);\n }\n url += '&code_challenge=' + challenge;\n url += '&code_challenge_method=S256';\n }\n if (loginHint) {\n url += '&login_hint=' + encodeURIComponent(loginHint);\n }\n if (that.resource) {\n url += '&resource=' + encodeURIComponent(that.resource);\n }\n if (that.oidc) {\n url += '&nonce=' + encodeURIComponent(nonce);\n }\n if (noPrompt) {\n url += '&prompt=none';\n }\n for (const key of Object.keys(params)) {\n url += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);\n }\n if (this.customQueryParams) {\n for (const key of Object.getOwnPropertyNames(this.customQueryParams)) {\n url += '&' + key + '=' + encodeURIComponent(this.customQueryParams[key]);\n }\n }\n return url;\n }\n initImplicitFlowInternal(additionalState = '', params = '') {\n if (this.inImplicitFlow) {\n return;\n }\n this.inImplicitFlow = true;\n if (!this.validateUrlForHttps(this.loginUrl)) {\n throw new Error(\"loginUrl must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n }\n let addParams = {};\n let loginHint = null;\n if (typeof params === 'string') {\n loginHint = params;\n } else if (typeof params === 'object') {\n addParams = params;\n }\n this.createLoginUrl(additionalState, loginHint, null, false, addParams).then(this.config.openUri).catch(error => {\n console.error('Error in initImplicitFlow', error);\n this.inImplicitFlow = false;\n });\n }\n /**\r\n * Starts the implicit flow and redirects to user to\r\n * the auth servers' login url.\r\n *\r\n * @param additionalState Optional state that is passed around.\r\n * You'll find this state in the property `state` after `tryLogin` logged in the user.\r\n * @param params Hash with additional parameter. If it is a string, it is used for the\r\n * parameter loginHint (for the sake of compatibility with former versions)\r\n */\n initImplicitFlow(additionalState = '', params = '') {\n if (this.loginUrl !== '') {\n this.initImplicitFlowInternal(additionalState, params);\n } else {\n this.events.pipe(filter(e => e.type === 'discovery_document_loaded')).subscribe(_ => this.initImplicitFlowInternal(additionalState, params));\n }\n }\n /**\r\n * Reset current implicit flow\r\n *\r\n * @description This method allows resetting the current implict flow in order to be initialized again.\r\n */\n resetImplicitFlow() {\n this.inImplicitFlow = false;\n }\n callOnTokenReceivedIfExists(options) {\n const that = this;\n if (options.onTokenReceived) {\n const tokenParams = {\n idClaims: that.getIdentityClaims(),\n idToken: that.getIdToken(),\n accessToken: that.getAccessToken(),\n state: that.state\n };\n options.onTokenReceived(tokenParams);\n }\n }\n storeAccessTokenResponse(accessToken, refreshToken, expiresIn, grantedScopes, customParameters) {\n this._storage.setItem('access_token', accessToken);\n if (grantedScopes && !Array.isArray(grantedScopes)) {\n this._storage.setItem('granted_scopes', JSON.stringify(grantedScopes.split(' ')));\n } else if (grantedScopes && Array.isArray(grantedScopes)) {\n this._storage.setItem('granted_scopes', JSON.stringify(grantedScopes));\n }\n this._storage.setItem('access_token_stored_at', '' + this.dateTimeService.now());\n if (expiresIn) {\n const expiresInMilliSeconds = expiresIn * 1000;\n const now = this.dateTimeService.new();\n const expiresAt = now.getTime() + expiresInMilliSeconds;\n this._storage.setItem('expires_at', '' + expiresAt);\n }\n if (refreshToken) {\n this._storage.setItem('refresh_token', refreshToken);\n }\n if (customParameters) {\n customParameters.forEach((value, key) => {\n this._storage.setItem(key, value);\n });\n }\n }\n /**\r\n * Delegates to tryLoginImplicitFlow for the sake of competability\r\n * @param options Optional options.\r\n */\n tryLogin(options = null) {\n if (this.config.responseType === 'code') {\n return this.tryLoginCodeFlow(options).then(_ => true);\n } else {\n return this.tryLoginImplicitFlow(options);\n }\n }\n parseQueryString(queryString) {\n if (!queryString || queryString.length === 0) {\n return {};\n }\n if (queryString.charAt(0) === '?') {\n queryString = queryString.substr(1);\n }\n return this.urlHelper.parseQueryString(queryString);\n }\n async tryLoginCodeFlow(options = null) {\n options = options || {};\n const querySource = options.customHashFragment ? options.customHashFragment.substring(1) : window.location.search;\n const parts = this.getCodePartsFromUrl(querySource);\n const code = parts['code'];\n const state = parts['state'];\n const sessionState = parts['session_state'];\n if (!options.preventClearHashAfterLogin) {\n const href = location.origin + location.pathname + location.search.replace(/code=[^&\\$]*/, '').replace(/scope=[^&\\$]*/, '').replace(/state=[^&\\$]*/, '').replace(/session_state=[^&\\$]*/, '').replace(/^\\?&/, '?').replace(/&$/, '').replace(/^\\?$/, '').replace(/&+/g, '&').replace(/\\?&/, '?').replace(/\\?$/, '') + location.hash;\n history.replaceState(null, window.name, href);\n }\n let [nonceInState, userState] = this.parseState(state);\n this.state = userState;\n if (parts['error']) {\n this.debug('error trying to login');\n this.handleLoginError(options, parts);\n const err = new OAuthErrorEvent('code_error', {}, parts);\n this.eventsSubject.next(err);\n return Promise.reject(err);\n }\n if (!options.disableNonceCheck) {\n if (!nonceInState) {\n this.saveRequestedRoute();\n return Promise.resolve();\n }\n if (!options.disableOAuth2StateCheck) {\n const success = this.validateNonce(nonceInState);\n if (!success) {\n const event = new OAuthErrorEvent('invalid_nonce_in_state', null);\n this.eventsSubject.next(event);\n return Promise.reject(event);\n }\n }\n this.storeSessionState(sessionState);\n if (code) {\n await this.getTokenFromCode(code, options);\n this.restoreRequestedRoute();\n return Promise.resolve();\n } else {\n return Promise.resolve();\n }\n }\n return Promise.reject();\n }\n saveRequestedRoute() {\n if (this.config.preserveRequestedRoute) {\n this._storage.setItem('requested_route', window.location.pathname + window.location.search);\n }\n }\n restoreRequestedRoute() {\n const requestedRoute = this._storage.getItem('requested_route');\n if (requestedRoute) {\n history.replaceState(null, '', window.location.origin + requestedRoute);\n }\n }\n /**\r\n * Retrieve the returned auth code from the redirect uri that has been called.\r\n * If required also check hash, as we could use hash location strategy.\r\n */\n getCodePartsFromUrl(queryString) {\n if (!queryString || queryString.length === 0) {\n return this.urlHelper.getHashFragmentParams();\n }\n // normalize query string\n if (queryString.charAt(0) === '?') {\n queryString = queryString.substr(1);\n }\n return this.urlHelper.parseQueryString(queryString);\n }\n /**\r\n * Get token using an intermediate code. Works for the Authorization Code flow.\r\n */\n getTokenFromCode(code, options) {\n let params = new HttpParams({\n encoder: new WebHttpUrlEncodingCodec()\n }).set('grant_type', 'authorization_code').set('code', code).set('redirect_uri', options.customRedirectUri || this.redirectUri);\n if (!this.disablePKCE) {\n let PKCEVerifier;\n if (this.saveNoncesInLocalStorage && typeof window['localStorage'] !== 'undefined') {\n PKCEVerifier = localStorage.getItem('PKCE_verifier');\n } else {\n PKCEVerifier = this._storage.getItem('PKCE_verifier');\n }\n if (!PKCEVerifier) {\n console.warn('No PKCE verifier found in oauth storage!');\n } else {\n params = params.set('code_verifier', PKCEVerifier);\n }\n }\n return this.fetchAndProcessToken(params, options);\n }\n fetchAndProcessToken(params, options) {\n options = options || {};\n this.assertUrlNotNullAndCorrectProtocol(this.tokenEndpoint, 'tokenEndpoint');\n let headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');\n if (this.useHttpBasicAuth) {\n const header = btoa(`${this.clientId}:${this.dummyClientSecret}`);\n headers = headers.set('Authorization', 'Basic ' + header);\n }\n if (!this.useHttpBasicAuth) {\n params = params.set('client_id', this.clientId);\n }\n if (!this.useHttpBasicAuth && this.dummyClientSecret) {\n params = params.set('client_secret', this.dummyClientSecret);\n }\n return new Promise((resolve, reject) => {\n if (this.customQueryParams) {\n for (let key of Object.getOwnPropertyNames(this.customQueryParams)) {\n params = params.set(key, this.customQueryParams[key]);\n }\n }\n this.http.post(this.tokenEndpoint, params, {\n headers\n }).subscribe(tokenResponse => {\n this.debug('refresh tokenResponse', tokenResponse);\n this.storeAccessTokenResponse(tokenResponse.access_token, tokenResponse.refresh_token, tokenResponse.expires_in || this.fallbackAccessTokenExpirationTimeInSec, tokenResponse.scope, this.extractRecognizedCustomParameters(tokenResponse));\n if (this.oidc && tokenResponse.id_token) {\n this.processIdToken(tokenResponse.id_token, tokenResponse.access_token, options.disableNonceCheck).then(result => {\n this.storeIdToken(result);\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n this.eventsSubject.next(new OAuthSuccessEvent('token_refreshed'));\n resolve(tokenResponse);\n }).catch(reason => {\n this.eventsSubject.next(new OAuthErrorEvent('token_validation_error', reason));\n console.error('Error validating tokens');\n console.error(reason);\n reject(reason);\n });\n } else {\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n this.eventsSubject.next(new OAuthSuccessEvent('token_refreshed'));\n resolve(tokenResponse);\n }\n }, err => {\n console.error('Error getting token', err);\n this.eventsSubject.next(new OAuthErrorEvent('token_refresh_error', err));\n reject(err);\n });\n });\n }\n /**\r\n * Checks whether there are tokens in the hash fragment\r\n * as a result of the implicit flow. These tokens are\r\n * parsed, validated and used to sign the user in to the\r\n * current client.\r\n *\r\n * @param options Optional options.\r\n */\n tryLoginImplicitFlow(options = null) {\n options = options || {};\n let parts;\n if (options.customHashFragment) {\n parts = this.urlHelper.getHashFragmentParams(options.customHashFragment);\n } else {\n parts = this.urlHelper.getHashFragmentParams();\n }\n this.debug('parsed url', parts);\n const state = parts['state'];\n let [nonceInState, userState] = this.parseState(state);\n this.state = userState;\n if (parts['error']) {\n this.debug('error trying to login');\n this.handleLoginError(options, parts);\n const err = new OAuthErrorEvent('token_error', {}, parts);\n this.eventsSubject.next(err);\n return Promise.reject(err);\n }\n const accessToken = parts['access_token'];\n const idToken = parts['id_token'];\n const sessionState = parts['session_state'];\n const grantedScopes = parts['scope'];\n if (!this.requestAccessToken && !this.oidc) {\n return Promise.reject('Either requestAccessToken or oidc (or both) must be true.');\n }\n if (this.requestAccessToken && !accessToken) {\n return Promise.resolve(false);\n }\n if (this.requestAccessToken && !options.disableOAuth2StateCheck && !state) {\n return Promise.resolve(false);\n }\n if (this.oidc && !idToken) {\n return Promise.resolve(false);\n }\n if (this.sessionChecksEnabled && !sessionState) {\n this.logger.warn('session checks (Session Status Change Notification) ' + 'were activated in the configuration but the id_token ' + 'does not contain a session_state claim');\n }\n if (this.requestAccessToken && !options.disableNonceCheck) {\n const success = this.validateNonce(nonceInState);\n if (!success) {\n const event = new OAuthErrorEvent('invalid_nonce_in_state', null);\n this.eventsSubject.next(event);\n return Promise.reject(event);\n }\n }\n if (this.requestAccessToken) {\n this.storeAccessTokenResponse(accessToken, null, parts['expires_in'] || this.fallbackAccessTokenExpirationTimeInSec, grantedScopes);\n }\n if (!this.oidc) {\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n if (this.clearHashAfterLogin && !options.preventClearHashAfterLogin) {\n this.clearLocationHash();\n }\n this.callOnTokenReceivedIfExists(options);\n return Promise.resolve(true);\n }\n return this.processIdToken(idToken, accessToken, options.disableNonceCheck).then(result => {\n if (options.validationHandler) {\n return options.validationHandler({\n accessToken: accessToken,\n idClaims: result.idTokenClaims,\n idToken: result.idToken,\n state: state\n }).then(_ => result);\n }\n return result;\n }).then(result => {\n this.storeIdToken(result);\n this.storeSessionState(sessionState);\n if (this.clearHashAfterLogin && !options.preventClearHashAfterLogin) {\n this.clearLocationHash();\n }\n this.eventsSubject.next(new OAuthSuccessEvent('token_received'));\n this.callOnTokenReceivedIfExists(options);\n this.inImplicitFlow = false;\n return true;\n }).catch(reason => {\n this.eventsSubject.next(new OAuthErrorEvent('token_validation_error', reason));\n this.logger.error('Error validating tokens');\n this.logger.error(reason);\n return Promise.reject(reason);\n });\n }\n parseState(state) {\n let nonce = state;\n let userState = '';\n if (state) {\n const idx = state.indexOf(this.config.nonceStateSeparator);\n if (idx > -1) {\n nonce = state.substr(0, idx);\n userState = state.substr(idx + this.config.nonceStateSeparator.length);\n }\n }\n return [nonce, userState];\n }\n validateNonce(nonceInState) {\n let savedNonce;\n if (this.saveNoncesInLocalStorage && typeof window['localStorage'] !== 'undefined') {\n savedNonce = localStorage.getItem('nonce');\n } else {\n savedNonce = this._storage.getItem('nonce');\n }\n if (savedNonce !== nonceInState) {\n const err = 'Validating access_token failed, wrong state/nonce.';\n console.error(err, savedNonce, nonceInState);\n return false;\n }\n return true;\n }\n storeIdToken(idToken) {\n this._storage.setItem('id_token', idToken.idToken);\n this._storage.setItem('id_token_claims_obj', idToken.idTokenClaimsJson);\n this._storage.setItem('id_token_expires_at', '' + idToken.idTokenExpiresAt);\n this._storage.setItem('id_token_stored_at', '' + this.dateTimeService.now());\n }\n storeSessionState(sessionState) {\n this._storage.setItem('session_state', sessionState);\n }\n getSessionState() {\n return this._storage.getItem('session_state');\n }\n handleLoginError(options, parts) {\n if (options.onLoginError) {\n options.onLoginError(parts);\n }\n if (this.clearHashAfterLogin && !options.preventClearHashAfterLogin) {\n this.clearLocationHash();\n }\n }\n getClockSkewInMsec(defaultSkewMsc = 600000) {\n if (!this.clockSkewInSec) {\n return defaultSkewMsc;\n }\n return this.clockSkewInSec * 1000;\n }\n /**\r\n * @ignore\r\n */\n processIdToken(idToken, accessToken, skipNonceCheck = false) {\n const tokenParts = idToken.split('.');\n const headerBase64 = this.padBase64(tokenParts[0]);\n const headerJson = b64DecodeUnicode(headerBase64);\n const header = JSON.parse(headerJson);\n const claimsBase64 = this.padBase64(tokenParts[1]);\n const claimsJson = b64DecodeUnicode(claimsBase64);\n const claims = JSON.parse(claimsJson);\n let savedNonce;\n if (this.saveNoncesInLocalStorage && typeof window['localStorage'] !== 'undefined') {\n savedNonce = localStorage.getItem('nonce');\n } else {\n savedNonce = this._storage.getItem('nonce');\n }\n if (Array.isArray(claims.aud)) {\n if (claims.aud.every(v => v !== this.clientId)) {\n const err = 'Wrong audience: ' + claims.aud.join(',');\n this.logger.warn(err);\n return Promise.reject(err);\n }\n } else {\n if (claims.aud !== this.clientId) {\n const err = 'Wrong audience: ' + claims.aud;\n this.logger.warn(err);\n return Promise.reject(err);\n }\n }\n if (!claims.sub) {\n const err = 'No sub claim in id_token';\n this.logger.warn(err);\n return Promise.reject(err);\n }\n /* For now, we only check whether the sub against\r\n * silentRefreshSubject when sessionChecksEnabled is on\r\n * We will reconsider in a later version to do this\r\n * in every other case too.\r\n */\n if (this.sessionChecksEnabled && this.silentRefreshSubject && this.silentRefreshSubject !== claims['sub']) {\n const err = 'After refreshing, we got an id_token for another user (sub). ' + `Expected sub: ${this.silentRefreshSubject}, received sub: ${claims['sub']}`;\n this.logger.warn(err);\n return Promise.reject(err);\n }\n if (!claims.iat) {\n const err = 'No iat claim in id_token';\n this.logger.warn(err);\n return Promise.reject(err);\n }\n if (!this.skipIssuerCheck && claims.iss !== this.issuer) {\n const err = 'Wrong issuer: ' + claims.iss;\n this.logger.warn(err);\n return Promise.reject(err);\n }\n if (!skipNonceCheck && claims.nonce !== savedNonce) {\n const err = 'Wrong nonce: ' + claims.nonce;\n this.logger.warn(err);\n return Promise.reject(err);\n }\n // at_hash is not applicable to authorization code flow\n // addressing https://github.com/manfredsteyer/angular-oauth2-oidc/issues/661\n // i.e. Based on spec the at_hash check is only true for implicit code flow on Ping Federate\n // https://www.pingidentity.com/developer/en/resources/openid-connect-developers-guide.html\n if (this.hasOwnProperty('responseType') && (this.responseType === 'code' || this.responseType === 'id_token')) {\n this.disableAtHashCheck = true;\n }\n if (!this.disableAtHashCheck && this.requestAccessToken && !claims['at_hash']) {\n const err = 'An at_hash is needed!';\n this.logger.warn(err);\n return Promise.reject(err);\n }\n const now = this.dateTimeService.now();\n const issuedAtMSec = claims.iat * 1000;\n const expiresAtMSec = claims.exp * 1000;\n const clockSkewInMSec = this.getClockSkewInMsec(); // (this.getClockSkewInMsec() || 600) * 1000;\n if (issuedAtMSec - clockSkewInMSec >= now || expiresAtMSec + clockSkewInMSec <= now) {\n const err = 'Token has expired';\n console.error(err);\n console.error({\n now: now,\n issuedAtMSec: issuedAtMSec,\n expiresAtMSec: expiresAtMSec\n });\n return Promise.reject(err);\n }\n const validationParams = {\n accessToken: accessToken,\n idToken: idToken,\n jwks: this.jwks,\n idTokenClaims: claims,\n idTokenHeader: header,\n loadKeys: () => this.loadJwks()\n };\n if (this.disableAtHashCheck) {\n return this.checkSignature(validationParams).then(_ => {\n const result = {\n idToken: idToken,\n idTokenClaims: claims,\n idTokenClaimsJson: claimsJson,\n idTokenHeader: header,\n idTokenHeaderJson: headerJson,\n idTokenExpiresAt: expiresAtMSec\n };\n return result;\n });\n }\n return this.checkAtHash(validationParams).then(atHashValid => {\n if (!this.disableAtHashCheck && this.requestAccessToken && !atHashValid) {\n const err = 'Wrong at_hash';\n this.logger.warn(err);\n return Promise.reject(err);\n }\n return this.checkSignature(validationParams).then(_ => {\n const atHashCheckEnabled = !this.disableAtHashCheck;\n const result = {\n idToken: idToken,\n idTokenClaims: claims,\n idTokenClaimsJson: claimsJson,\n idTokenHeader: header,\n idTokenHeaderJson: headerJson,\n idTokenExpiresAt: expiresAtMSec\n };\n if (atHashCheckEnabled) {\n return this.checkAtHash(validationParams).then(atHashValid => {\n if (this.requestAccessToken && !atHashValid) {\n const err = 'Wrong at_hash';\n this.logger.warn(err);\n return Promise.reject(err);\n } else {\n return result;\n }\n });\n } else {\n return result;\n }\n });\n });\n }\n /**\r\n * Returns the received claims about the user.\r\n */\n getIdentityClaims() {\n const claims = this._storage.getItem('id_token_claims_obj');\n if (!claims) {\n return null;\n }\n return JSON.parse(claims);\n }\n /**\r\n * Returns the granted scopes from the server.\r\n */\n getGrantedScopes() {\n const scopes = this._storage.getItem('granted_scopes');\n if (!scopes) {\n return null;\n }\n return JSON.parse(scopes);\n }\n /**\r\n * Returns the current id_token.\r\n */\n getIdToken() {\n return this._storage ? this._storage.getItem('id_token') : null;\n }\n padBase64(base64data) {\n while (base64data.length % 4 !== 0) {\n base64data += '=';\n }\n return base64data;\n }\n /**\r\n * Returns the current access_token.\r\n */\n getAccessToken() {\n return this._storage ? this._storage.getItem('access_token') : null;\n }\n getRefreshToken() {\n return this._storage ? this._storage.getItem('refresh_token') : null;\n }\n /**\r\n * Returns the expiration date of the access_token\r\n * as milliseconds since 1970.\r\n */\n getAccessTokenExpiration() {\n if (!this._storage.getItem('expires_at')) {\n return null;\n }\n return parseInt(this._storage.getItem('expires_at'), 10);\n }\n getAccessTokenStoredAt() {\n return parseInt(this._storage.getItem('access_token_stored_at'), 10);\n }\n getIdTokenStoredAt() {\n return parseInt(this._storage.getItem('id_token_stored_at'), 10);\n }\n /**\r\n * Returns the expiration date of the id_token\r\n * as milliseconds since 1970.\r\n */\n getIdTokenExpiration() {\n if (!this._storage.getItem('id_token_expires_at')) {\n return null;\n }\n return parseInt(this._storage.getItem('id_token_expires_at'), 10);\n }\n /**\r\n * Checkes, whether there is a valid access_token.\r\n */\n hasValidAccessToken() {\n if (this.getAccessToken()) {\n const expiresAt = this._storage.getItem('expires_at');\n const now = this.dateTimeService.new();\n if (expiresAt && parseInt(expiresAt, 10) < now.getTime() - this.getClockSkewInMsec()) {\n return false;\n }\n return true;\n }\n return false;\n }\n /**\r\n * Checks whether there is a valid id_token.\r\n */\n hasValidIdToken() {\n if (this.getIdToken()) {\n const expiresAt = this._storage.getItem('id_token_expires_at');\n const now = this.dateTimeService.new();\n if (expiresAt && parseInt(expiresAt, 10) < now.getTime() - this.getClockSkewInMsec()) {\n return false;\n }\n return true;\n }\n return false;\n }\n /**\r\n * Retrieve a saved custom property of the TokenReponse object. Only if predefined in authconfig.\r\n */\n getCustomTokenResponseProperty(requestedProperty) {\n return this._storage && this.config.customTokenParameters && this.config.customTokenParameters.indexOf(requestedProperty) >= 0 && this._storage.getItem(requestedProperty) !== null ? JSON.parse(this._storage.getItem(requestedProperty)) : null;\n }\n /**\r\n * Returns the auth-header that can be used\r\n * to transmit the access_token to a service\r\n */\n authorizationHeader() {\n return 'Bearer ' + this.getAccessToken();\n }\n logOut(customParameters = {}, state = '') {\n let noRedirectToLogoutUrl = false;\n if (typeof customParameters === 'boolean') {\n noRedirectToLogoutUrl = customParameters;\n customParameters = {};\n }\n const id_token = this.getIdToken();\n this._storage.removeItem('access_token');\n this._storage.removeItem('id_token');\n this._storage.removeItem('refresh_token');\n if (this.saveNoncesInLocalStorage) {\n localStorage.removeItem('nonce');\n localStorage.removeItem('PKCE_verifier');\n } else {\n this._storage.removeItem('nonce');\n this._storage.removeItem('PKCE_verifier');\n }\n this._storage.removeItem('expires_at');\n this._storage.removeItem('id_token_claims_obj');\n this._storage.removeItem('id_token_expires_at');\n this._storage.removeItem('id_token_stored_at');\n this._storage.removeItem('access_token_stored_at');\n this._storage.removeItem('granted_scopes');\n this._storage.removeItem('session_state');\n if (this.config.customTokenParameters) {\n this.config.customTokenParameters.forEach(customParam => this._storage.removeItem(customParam));\n }\n this.silentRefreshSubject = null;\n this.eventsSubject.next(new OAuthInfoEvent('logout'));\n if (!this.logoutUrl) {\n return;\n }\n if (noRedirectToLogoutUrl) {\n return;\n }\n if (!id_token && !this.postLogoutRedirectUri) {\n return;\n }\n let logoutUrl;\n if (!this.validateUrlForHttps(this.logoutUrl)) {\n throw new Error(\"logoutUrl must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n }\n // For backward compatibility\n if (this.logoutUrl.indexOf('{{') > -1) {\n logoutUrl = this.logoutUrl.replace(/\\{\\{id_token\\}\\}/, encodeURIComponent(id_token)).replace(/\\{\\{client_id\\}\\}/, encodeURIComponent(this.clientId));\n } else {\n let params = new HttpParams({\n encoder: new WebHttpUrlEncodingCodec()\n });\n if (id_token) {\n params = params.set('id_token_hint', id_token);\n }\n const postLogoutUrl = this.postLogoutRedirectUri || this.redirectUriAsPostLogoutRedirectUriFallback && this.redirectUri || '';\n if (postLogoutUrl) {\n params = params.set('post_logout_redirect_uri', postLogoutUrl);\n if (state) {\n params = params.set('state', state);\n }\n }\n for (let key in customParameters) {\n params = params.set(key, customParameters[key]);\n }\n logoutUrl = this.logoutUrl + (this.logoutUrl.indexOf('?') > -1 ? '&' : '?') + params.toString();\n }\n this.config.openUri(logoutUrl);\n }\n /**\r\n * @ignore\r\n */\n createAndSaveNonce() {\n const that = this;\n return this.createNonce().then(function (nonce) {\n // Use localStorage for nonce if possible\n // localStorage is the only storage who survives a\n // redirect in ALL browsers (also IE)\n // Otherwiese we'd force teams who have to support\n // IE into using localStorage for everything\n if (that.saveNoncesInLocalStorage && typeof window['localStorage'] !== 'undefined') {\n localStorage.setItem('nonce', nonce);\n } else {\n that._storage.setItem('nonce', nonce);\n }\n return nonce;\n });\n }\n /**\r\n * @ignore\r\n */\n ngOnDestroy() {\n this.clearAccessTokenTimer();\n this.clearIdTokenTimer();\n this.removeSilentRefreshEventListener();\n const silentRefreshFrame = this.document.getElementById(this.silentRefreshIFrameName);\n if (silentRefreshFrame) {\n silentRefreshFrame.remove();\n }\n this.stopSessionCheckTimer();\n this.removeSessionCheckEventListener();\n const sessionCheckFrame = this.document.getElementById(this.sessionCheckIFrameName);\n if (sessionCheckFrame) {\n sessionCheckFrame.remove();\n }\n }\n createNonce() {\n return new Promise(resolve => {\n if (this.rngUrl) {\n throw new Error('createNonce with rng-web-api has not been implemented so far');\n }\n /*\r\n * This alphabet is from:\r\n * https://tools.ietf.org/html/rfc7636#section-4.1\r\n *\r\n * [A-Z] / [a-z] / [0-9] / \"-\" / \".\" / \"_\" / \"~\"\r\n */\n const unreserved = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n let size = 45;\n let id = '';\n const crypto = typeof self === 'undefined' ? null : self.crypto || self['msCrypto'];\n if (crypto) {\n let bytes = new Uint8Array(size);\n crypto.getRandomValues(bytes);\n // Needed for IE\n if (!bytes.map) {\n bytes.map = Array.prototype.map;\n }\n bytes = bytes.map(x => unreserved.charCodeAt(x % unreserved.length));\n id = String.fromCharCode.apply(null, bytes);\n } else {\n while (0 < size--) {\n id += unreserved[Math.random() * unreserved.length | 0];\n }\n }\n resolve(base64UrlEncode(id));\n });\n }\n async checkAtHash(params) {\n if (!this.tokenValidationHandler) {\n this.logger.warn('No tokenValidationHandler configured. Cannot check at_hash.');\n return true;\n }\n return this.tokenValidationHandler.validateAtHash(params);\n }\n checkSignature(params) {\n if (!this.tokenValidationHandler) {\n this.logger.warn('No tokenValidationHandler configured. Cannot check signature.');\n return Promise.resolve(null);\n }\n return this.tokenValidationHandler.validateSignature(params);\n }\n /**\r\n * Start the implicit flow or the code flow,\r\n * depending on your configuration.\r\n */\n initLoginFlow(additionalState = '', params = {}) {\n if (this.responseType === 'code') {\n return this.initCodeFlow(additionalState, params);\n } else {\n return this.initImplicitFlow(additionalState, params);\n }\n }\n /**\r\n * Starts the authorization code flow and redirects to user to\r\n * the auth servers login url.\r\n */\n initCodeFlow(additionalState = '', params = {}) {\n if (this.loginUrl !== '') {\n this.initCodeFlowInternal(additionalState, params);\n } else {\n this.events.pipe(filter(e => e.type === 'discovery_document_loaded')).subscribe(_ => this.initCodeFlowInternal(additionalState, params));\n }\n }\n initCodeFlowInternal(additionalState = '', params = {}) {\n if (!this.validateUrlForHttps(this.loginUrl)) {\n throw new Error(\"loginUrl must use HTTPS (with TLS), or config value for property 'requireHttps' must be set to 'false' and allow HTTP (without TLS).\");\n }\n let addParams = {};\n let loginHint = null;\n if (typeof params === 'string') {\n loginHint = params;\n } else if (typeof params === 'object') {\n addParams = params;\n }\n this.createLoginUrl(additionalState, loginHint, null, false, addParams).then(this.config.openUri).catch(error => {\n console.error('Error in initAuthorizationCodeFlow');\n console.error(error);\n });\n }\n async createChallangeVerifierPairForPKCE() {\n if (!this.crypto) {\n throw new Error('PKCE support for code flow needs a CryptoHander. Did you import the OAuthModule using forRoot() ?');\n }\n const verifier = await this.createNonce();\n const challengeRaw = await this.crypto.calcHash(verifier, 'sha-256');\n const challenge = base64UrlEncode(challengeRaw);\n return [challenge, verifier];\n }\n extractRecognizedCustomParameters(tokenResponse) {\n let foundParameters = new Map();\n if (!this.config.customTokenParameters) {\n return foundParameters;\n }\n this.config.customTokenParameters.forEach(recognizedParameter => {\n if (tokenResponse[recognizedParameter]) {\n foundParameters.set(recognizedParameter, JSON.stringify(tokenResponse[recognizedParameter]));\n }\n });\n return foundParameters;\n }\n /**\r\n * Revokes the auth token to secure the vulnarability\r\n * of the token issued allowing the authorization server to clean\r\n * up any security credentials associated with the authorization\r\n */\n revokeTokenAndLogout(customParameters = {}, ignoreCorsIssues = false) {\n let revokeEndpoint = this.revocationEndpoint;\n let accessToken = this.getAccessToken();\n let refreshToken = this.getRefreshToken();\n if (!accessToken) {\n return;\n }\n let params = new HttpParams({\n encoder: new WebHttpUrlEncodingCodec()\n });\n let headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');\n if (this.useHttpBasicAuth) {\n const header = btoa(`${this.clientId}:${this.dummyClientSecret}`);\n headers = headers.set('Authorization', 'Basic ' + header);\n }\n if (!this.useHttpBasicAuth) {\n params = params.set('client_id', this.clientId);\n }\n if (!this.useHttpBasicAuth && this.dummyClientSecret) {\n params = params.set('client_secret', this.dummyClientSecret);\n }\n if (this.customQueryParams) {\n for (const key of Object.getOwnPropertyNames(this.customQueryParams)) {\n params = params.set(key, this.customQueryParams[key]);\n }\n }\n return new Promise((resolve, reject) => {\n let revokeAccessToken;\n let revokeRefreshToken;\n if (accessToken) {\n let revokationParams = params.set('token', accessToken).set('token_type_hint', 'access_token');\n revokeAccessToken = this.http.post(revokeEndpoint, revokationParams, {\n headers\n });\n } else {\n revokeAccessToken = of(null);\n }\n if (refreshToken) {\n let revokationParams = params.set('token', refreshToken).set('token_type_hint', 'refresh_token');\n revokeRefreshToken = this.http.post(revokeEndpoint, revokationParams, {\n headers\n });\n } else {\n revokeRefreshToken = of(null);\n }\n if (ignoreCorsIssues) {\n revokeAccessToken = revokeAccessToken.pipe(catchError(err => {\n if (err.status === 0) {\n return of(null);\n }\n return throwError(err);\n }));\n revokeRefreshToken = revokeRefreshToken.pipe(catchError(err => {\n if (err.status === 0) {\n return of(null);\n }\n return throwError(err);\n }));\n }\n combineLatest([revokeAccessToken, revokeRefreshToken]).subscribe(res => {\n this.logOut(customParameters);\n resolve(res);\n this.logger.info('Token successfully revoked');\n }, err => {\n this.logger.error('Error revoking token', err);\n this.eventsSubject.next(new OAuthErrorEvent('token_revoke_error', err));\n reject(err);\n });\n });\n }\n /**\r\n * Clear location.hash if it's present\r\n */\n clearLocationHash() {\n // Checking for empty hash is necessary for Firefox\n // as setting an empty hash to an empty string adds # to the URL\n if (location.hash != '') {\n location.hash = '';\n }\n }\n }\n OAuthService.ɵfac = function OAuthService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || OAuthService)(i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(OAuthStorage, 8), i0.ɵɵinject(ValidationHandler, 8), i0.ɵɵinject(AuthConfig, 8), i0.ɵɵinject(UrlHelperService), i0.ɵɵinject(OAuthLogger), i0.ɵɵinject(HashHandler, 8), i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(DateTimeProvider));\n };\n OAuthService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: OAuthService,\n factory: OAuthService.ɵfac\n });\n return OAuthService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass OAuthModuleConfig {}\nclass OAuthResourceServerConfig {}\nclass OAuthResourceServerErrorHandler {}\nclass OAuthNoopResourceServerErrorHandler {\n handleError(err) {\n return throwError(err);\n }\n}\nlet DefaultOAuthInterceptor = /*#__PURE__*/(() => {\n class DefaultOAuthInterceptor {\n constructor(oAuthService, errorHandler, moduleConfig) {\n this.oAuthService = oAuthService;\n this.errorHandler = errorHandler;\n this.moduleConfig = moduleConfig;\n }\n checkUrl(url) {\n if (this.moduleConfig.resourceServer.customUrlValidation) {\n return this.moduleConfig.resourceServer.customUrlValidation(url);\n }\n if (this.moduleConfig.resourceServer.allowedUrls) {\n return !!this.moduleConfig.resourceServer.allowedUrls.find(u => url.toLowerCase().startsWith(u.toLowerCase()));\n }\n return true;\n }\n intercept(req, next) {\n const url = req.url.toLowerCase();\n if (!this.moduleConfig || !this.moduleConfig.resourceServer || !this.checkUrl(url)) {\n return next.handle(req);\n }\n const sendAccessToken = this.moduleConfig.resourceServer.sendAccessToken;\n if (!sendAccessToken) {\n return next.handle(req).pipe(catchError(err => this.errorHandler.handleError(err)));\n }\n return merge(of(this.oAuthService.getAccessToken()).pipe(filter(token => !!token)), this.oAuthService.events.pipe(filter(e => e.type === 'token_received'), timeout(this.oAuthService.waitForTokenInMsec || 0), catchError(_ => of(null)),\n // timeout is not an error\n map(_ => this.oAuthService.getAccessToken()))).pipe(take(1), mergeMap(token => {\n if (token) {\n const header = 'Bearer ' + token;\n const headers = req.headers.set('Authorization', header);\n req = req.clone({\n headers\n });\n }\n return next.handle(req).pipe(catchError(err => this.errorHandler.handleError(err)));\n }));\n }\n }\n DefaultOAuthInterceptor.ɵfac = function DefaultOAuthInterceptor_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultOAuthInterceptor)(i0.ɵɵinject(OAuthService), i0.ɵɵinject(OAuthResourceServerErrorHandler), i0.ɵɵinject(OAuthModuleConfig, 8));\n };\n DefaultOAuthInterceptor.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultOAuthInterceptor,\n factory: DefaultOAuthInterceptor.ɵfac\n });\n return DefaultOAuthInterceptor;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\r\n * A validation handler that isn't validating nothing.\r\n * Can be used to skip validation (at your own risk).\r\n */\nclass NullValidationHandler {\n validateSignature(validationParams) {\n return Promise.resolve(null);\n }\n validateAtHash(validationParams) {\n return Promise.resolve(true);\n }\n}\nfunction createDefaultLogger() {\n return console;\n}\nfunction createDefaultStorage() {\n return typeof sessionStorage !== 'undefined' ? sessionStorage : new MemoryStorage();\n}\nlet OAuthModule = /*#__PURE__*/(() => {\n class OAuthModule {\n static forRoot(config = null, validationHandlerClass = NullValidationHandler) {\n return {\n ngModule: OAuthModule,\n providers: [OAuthService, UrlHelperService, {\n provide: OAuthLogger,\n useFactory: createDefaultLogger\n }, {\n provide: OAuthStorage,\n useFactory: createDefaultStorage\n }, {\n provide: ValidationHandler,\n useClass: validationHandlerClass\n }, {\n provide: HashHandler,\n useClass: DefaultHashHandler\n }, {\n provide: OAuthResourceServerErrorHandler,\n useClass: OAuthNoopResourceServerErrorHandler\n }, {\n provide: OAuthModuleConfig,\n useValue: config\n }, {\n provide: HTTP_INTERCEPTORS,\n useClass: DefaultOAuthInterceptor,\n multi: true\n }, {\n provide: DateTimeProvider,\n useClass: SystemDateTimeProvider\n }]\n };\n }\n }\n OAuthModule.ɵfac = function OAuthModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || OAuthModule)();\n };\n OAuthModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: OAuthModule\n });\n OAuthModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n imports: [[CommonModule]]\n });\n return OAuthModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst err = `PLEASE READ THIS CAREFULLY:\n\nBeginning with angular-oauth2-oidc version 9, the JwksValidationHandler\nhas been moved to an library of its own. If you need it for implementing\nOAuth2/OIDC **implicit flow**, please install it using npm:\n\n npm i angular-oauth2-oidc-jwks --save\n\nAfter that, you can import it into your application:\n\n import { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';\n\nPlease note, that this dependency is not needed for the **code flow**,\nwhich is nowadays the **recommented** one for single page applications.\nThis also results in smaller bundle sizes.\n`;\n/**\r\n * This is just a dummy of the JwksValidationHandler\r\n * telling the users that the real one has been moved\r\n * to an library of its own, namely angular-oauth2-oidc-utils\r\n */\nclass JwksValidationHandler extends NullValidationHandler {\n constructor() {\n super();\n console.error(err);\n }\n}\nconst AUTH_CONFIG = new InjectionToken('AUTH_CONFIG');\n\n/**\r\n * Generated bundle index. Do not edit.\r\n */\n\nexport { AUTH_CONFIG, AbstractValidationHandler, AuthConfig, DateTimeProvider, DefaultHashHandler, DefaultOAuthInterceptor, HashHandler, JwksValidationHandler, LoginOptions, MemoryStorage, NullValidationHandler, OAuthErrorEvent, OAuthEvent, OAuthInfoEvent, OAuthLogger, OAuthModule, OAuthModuleConfig, OAuthNoopResourceServerErrorHandler, OAuthResourceServerConfig, OAuthResourceServerErrorHandler, OAuthService, OAuthStorage, OAuthSuccessEvent, ReceivedTokens, SystemDateTimeProvider, UrlHelperService, ValidationHandler };","export class BaseModel {\r\n\r\n}","import { BaseModel } from \"src/app/models/base.model\";\r\nimport { AppUser } from \"src/app/models/user/app-user.model\";\r\n\r\nexport class RegisterResponseModel extends BaseModel {\r\n success: boolean;\r\n errors: string[];\r\n warnings: string[];\r\n user: AppUser;\r\n}\r\n","import { ClaimModel } from \"./claim.model\";\r\n\r\nexport class AuthModel {\r\n accessToken: string;\r\n refreshToken: string;\r\n expiresIn: Date;\r\n claim: ClaimModel;\r\n setAuth(auth: AuthModel) {\r\n this.accessToken = auth.accessToken;\r\n this.refreshToken = auth.refreshToken;\r\n this.expiresIn = auth.expiresIn;\r\n this.claim = auth.claim;\r\n }\r\n}\r\n","import { AuthModel } from \"./auth.model\";\r\n\r\nexport class UserModel extends AuthModel {\r\n id: string;\r\n username: string;\r\n nric:string;\r\n password: string;\r\n name: string;\r\n email: string;\r\n accountStatus: string;\r\n profileImage: string;\r\n roles: number[] = [];\r\n occupation: string;\r\n companyName: string;\r\n phoneNumber: string;\r\n // account information\r\n language: string;\r\n memberId: number;\r\n // officeId: any;\r\n city: string;\r\n officeId: number;\r\n setUser(_user: unknown) {\r\n const user = _user as UserModel;\r\n this.id = user.id;\r\n this.nric = user.nric;\r\n this.username = user.username || '';\r\n this.password = user.password || '';\r\n this.name = user.name || '';\r\n this.email = user.email || '';\r\n this.profileImage = user.profileImage || './assets/images/profile-placeholder.png';\r\n this.roles = user.roles || [];\r\n this.occupation = user.occupation || '';\r\n this.companyName = user.companyName || '';\r\n this.phoneNumber = user.phoneNumber || '';\r\n this.memberId = user.memberId;\r\n this.accountStatus = user.accountStatus;\r\n this.city = user.city || '';\r\n this.officeId = user.officeId || 0;\r\n }\r\n\r\n}\r\n","export class ClaimModel {\r\n userId: string;\r\n email: string;\r\n //sub: string;\r\n preferred_username: string;\r\n name: string;\r\n role: string[];\r\n accountStatus: string;\r\n\r\n setAuth(claim: ClaimModel) {\r\n this.userId = claim.userId;\r\n this.email = claim.email;\r\n //this.sub = claim.sub;\r\n this.preferred_username = claim.preferred_username;\r\n this.name = claim.name;\r\n this.role = claim.role;\r\n this.accountStatus = claim.accountStatus;\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { environment } from \"src/environments/environment\";\r\nimport { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { AuthConfig, OAuthService } from 'angular-oauth2-oidc';\r\nimport { Observable, from, of } from \"rxjs\";\r\nimport { UserModel } from \"../../models/user.model\";\r\nimport { ClaimModel } from \"../../models/claim.model\";\r\nimport { AuthModel } from \"../../models/auth.model\";\r\nimport { ResultModel } from \"src/app/models/result.model\";\r\nimport { RegisterResponseModel } from \"../../models/register-response.model\";\r\nimport { ChangePasswordResponseModel } from \"src/app/models/change-password/change-password-response.model\";\r\nimport { ChangePasswordModel } from \"src/app/models/change-password/change-password.model\";\r\nimport { ResultResendActivationCodeModel } from \"src/app/models/result-resend-activation-code.model\";\r\nimport { ForgotChangePasswordModel } from \"src/app/models/forgot-change-password/change-password.model\";\r\nimport { ForgotChangePasswordResponseModel } from \"src/app/models/forgot-change-password/forgot-change-password-response.model\";\r\n\r\n// const API_USERS_URL = `${environment.apiUrl}/auth`;\r\nconst ACCOUNT_USERS_URL = `${environment.idsUrl}/account`;\r\n\r\nlet urls = Array('http://localhost:44303');\r\nconst clientId = `${environment.clientId}`;\r\n\r\nexport const authCodeFlowConfig: AuthConfig = {\r\n // Url of the Identity Provider\r\n issuer: `${environment.idsUrl}`,\r\n requireHttps: false,//true\r\n //allowedUrls:urls,\r\n // URL of the SPA to redirect the user to after login\r\n redirectUri: window.location.origin + '/index.html',\r\n // URL of the SPA to redirect the user after silent refresh\r\n silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',\r\n // The SPA's id. The SPA is registerd with this id at the auth-server\r\n // clientId: 'server.code',\r\n clientId: clientId,//'patg_public_mobile',\r\n // Just needed if your auth server demands a secret. In general, this\r\n // is a sign that the auth server is not configured with SPAs in mind\r\n // and it might not enforce further best practices vital for security\r\n // such applications.\r\n dummyClientSecret: 'patg_public_mobilev1',\r\n responseType: 'code',\r\n // set the scope for the permissions the client should request\r\n // The first four are defined by OIDC.\r\n // Important: Request offline_access to get a refresh token\r\n // The api scope is a usecase specific one\r\n scope: 'openid profile email api.read', //offline_access api\r\n showDebugInformation: true,\r\n tokenEndpoint: environment.IDS_CONFIG_TOKENENDPOINT,\r\n userinfoEndpoint: environment.IDS_CONFIG_USERINFOENDPOINT,\r\n skipIssuerCheck: true,\r\n oidc: false,\r\n};\r\n\r\nauthCodeFlowConfig.strictDiscoveryDocumentValidation = false;\r\n\r\ninterface LoginInputModel {\r\n username: string, password: string //, rememberLogin:boolean, returnUrl:string\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AuthHTTPService {\r\n\r\n constructor(private http: HttpClient,\r\n private oauthService: OAuthService,\r\n\r\n ) {\r\n // console.log(authCodeFlowConfig);\r\n // console.log(authCodeFlowConfig.issuer);\r\n this.oauthService.configure(authCodeFlowConfig);\r\n this.oauthService.loadDiscoveryDocumentAndTryLogin();\r\n }\r\n\r\n login(username: string, password: string): Observable {\r\n const promise = this.oauthService\r\n .fetchTokenUsingPasswordFlowAndLoadUserProfile(\r\n username,\r\n password\r\n ).then(response => {\r\n const info = (response as any).info;\r\n const userModel = this.getUserModel(info);\r\n return userModel;\r\n })\r\n\r\n const observable = from(promise);\r\n return observable;\r\n }\r\n\r\n /**\r\n * Register user with selfie image\r\n * @param formData\r\n * @returns\r\n */\r\n createNewUser(formData: FormData): Observable {\r\n // return this.http.post(`${ACCOUNT_USERS_URL}/RegisterNewUser`, formData);\r\n return this.http.post(`${ACCOUNT_USERS_URL}/RegisterNewUser2`, formData);\r\n }\r\n\r\n /**\r\n * Change user password\r\n * @param changePasswordModel\r\n * @returns\r\n */\r\n changePassword(changePasswordModel: ChangePasswordModel): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/ChangePassword`, changePasswordModel);\r\n }\r\n\r\n /**\r\n * Change user password\r\n * @param changePasswordModel\r\n * @returns\r\n */\r\n resetPassword(resetPasswordModel: ForgotChangePasswordModel): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/ResetPasswordByOTP`, resetPasswordModel);\r\n }\r\n\r\n requestResendActivationCode(username: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/RequestResendActivationCode?username=${username}`, username);\r\n }\r\n\r\n requestsendActivationCode(username: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/RequestSendActivationCode?username=${username}`, username);\r\n }\r\n\r\n verifyActivationCode(code: string, phoneNumber: string, username: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/VerifyPhoneConfirmationCode?code=${code}&phoneNumber=${phoneNumber}&username=${username}`,\r\n {\r\n code:code,\r\n phoneNumber: phoneNumber,\r\n username: username\r\n });\r\n }\r\n\r\n verifyToken(code: string, phoneNumber: string, username: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/VerifyToken?code=${code}&phoneNumber=${phoneNumber}&username=${username}`,\r\n {\r\n code:code,\r\n phoneNumber: phoneNumber,\r\n username: username\r\n });\r\n }\r\n\r\n // Your server should check email => If email exists send link to the user and return true | If email doesn't exist return false\r\n forgotPassword(email: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/RequestForgotPassword?email=${email}`, email);\r\n }\r\n\r\n forgotPasswordByPhoneNumber(username: string): Observable {\r\n return this.http.post(`${ACCOUNT_USERS_URL}/RequestForgotPasswordMobile?username=${username}`, username);\r\n }\r\n\r\n getUserModel(loginResponseModel: any): UserModel {\r\n let claims: any = this.oauthService.getIdentityClaims();\r\n const accessToken = this.oauthService.getAccessToken();\r\n const refreshToken = this.oauthService.getRefreshToken();\r\n const userClaim = new ClaimModel();\r\n userClaim.userId = claims['sub'];\r\n userClaim.email = claims['email'];\r\n userClaim.preferred_username = claims['preferred_username'];\r\n userClaim.name = claims['name'];\r\n userClaim.role = claims['http://schemas.microsoft.com/ws/2008/06/identity/claims/role'];\r\n const userModel: UserModel = new UserModel();\r\n userModel.accessToken = accessToken;\r\n userModel.refreshToken = refreshToken;\r\n userModel.claim = userClaim;\r\n userModel.expiresIn = new Date();\r\n userModel.memberId = loginResponseModel['MemberId'] === '' ? 0 : +loginResponseModel['MemberId'];\r\n userModel.id = loginResponseModel['sub'];\r\n userModel.username = claims['preferred_username'];// loginResponseModel['userName'];\r\n userModel.nric = claims['preferred_username']; //loginResponseModel['userName'];\r\n userModel.name = loginResponseModel['given_name'];\r\n userModel.email = loginResponseModel['email'];\r\n userModel.roles = new Array(loginResponseModel['role']);\r\n userModel.language = 'ms';\r\n userModel.accountStatus = loginResponseModel['accountStatus'];\r\n userModel.phoneNumber = loginResponseModel['phone_number'];\r\n userModel.officeId = loginResponseModel['officeId'];\r\n return userModel;\r\n }\r\n\r\n getUserByToken(token: string): Observable {\r\n let claims: any = this.oauthService.getIdentityClaims();\r\n if(claims == null){\r\n let user: UserModel = {\r\n id: '',\r\n username: '',\r\n nric: '',\r\n password: '',\r\n accountStatus: '0',\r\n name: '',\r\n email: '',\r\n profileImage: './assets/images/profile-placeholder.png',\r\n roles: [],\r\n occupation: '',\r\n companyName: '',\r\n phoneNumber: '',\r\n language: '',\r\n setUser: function (_user: unknown): void {\r\n throw new Error('Function not implemented.');\r\n },\r\n accessToken: '',\r\n refreshToken: '',\r\n expiresIn: new Date(),\r\n claim: new ClaimModel,\r\n setAuth: function (auth: AuthModel): void {\r\n throw new Error('Function not implemented.');\r\n },\r\n memberId:0,\r\n city:'',\r\n officeId: 0\r\n };\r\n return of(user);\r\n }\r\n\r\n // return user info\r\n var today = new Date();\r\n today.setHours(today.getHours() + 1);\r\n let user: UserModel = {\r\n id: claims['sub'],\r\n email: claims['email'],\r\n username: claims['preferred_username'],\r\n name: claims['name'],\r\n nric: '',\r\n password: '',\r\n accountStatus: '0',\r\n profileImage:'./assets/images/profile-placeholder.png',\r\n roles: [],\r\n occupation: '',\r\n companyName: '',\r\n phoneNumber: '',\r\n language: '',\r\n setUser: function (_user: unknown): void {\r\n throw new Error('Function not implemented.');\r\n },\r\n accessToken: '',\r\n refreshToken: '',\r\n expiresIn: today,\r\n claim: new ClaimModel,\r\n setAuth: function (auth: AuthModel): void {\r\n throw new Error('Function not implemented.');\r\n },\r\n memberId:0,\r\n city:'',\r\n officeId: 0\r\n }\r\n\r\n return of(user);\r\n }\r\n\r\n requestRefreshToken(refreshToken: string){\r\n const httpOptions = {\r\n headers: new HttpHeaders({\r\n 'Content-Type': 'application/json',\r\n 'Authorization': `Bearer ${refreshToken}`\r\n })\r\n };\r\n return this.http.post(`${environment.idsUrl}/token/refresh`, {}, httpOptions);\r\n }\r\n\r\n}\r\n","import { Inject, Injectable, OnDestroy } from '@angular/core';\r\nimport { Observable, BehaviorSubject, of, Subscription, throwError, from } from 'rxjs';\r\nimport { map, catchError, switchMap, finalize, tap } from 'rxjs/operators';\r\nimport { environment } from 'src/environments/environment';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { UserModel } from '../models/user.model';\r\nimport { AuthHTTPService } from './auth-http/auth-http.service';\r\nimport { ResultModel } from 'src/app/models/result.model';\r\nimport { RegisterResponseModel } from '../models/register-response.model';\r\nimport { ChangePasswordResponseModel } from 'src/app/models/change-password/change-password-response.model';\r\nimport { ChangePasswordModel } from 'src/app/models/change-password/change-password.model';\r\nimport { HttpHeaders } from '@angular/common/http';\r\nimport { ResultResendActivationCodeModel } from 'src/app/models/result-resend-activation-code.model';\r\nimport { ForgotChangePasswordModel } from 'src/app/models/forgot-change-password/change-password.model';\r\nimport { ForgotChangePasswordResponseModel } from 'src/app/models/forgot-change-password/forgot-change-password-response.model';\r\n\r\nexport type UserType = UserModel | undefined;\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AuthService implements OnDestroy {\r\n // private fields\r\n private unsubscribe: Subscription[] = []; // Read more: => https://brianflove.com/2016/12/11/anguar-2-unsubscribe-observables/\r\n private authLocalStorageToken = `${environment.appVersion}-${environment.USERDATA_KEY}`;\r\n\r\n // public fields\r\n currentUser$: Observable;\r\n isLoading$: Observable;\r\n currentUserSubject: BehaviorSubject;\r\n isLoadingSubject: BehaviorSubject;\r\n\r\n constructor(\r\n private authHttpService: AuthHTTPService,\r\n private router: Router,\r\n ) {\r\n this.isLoadingSubject = new BehaviorSubject(false);\r\n this.currentUserSubject = new BehaviorSubject(undefined);\r\n this.currentUser$ = this.currentUserSubject.asObservable();\r\n this.isLoading$ = this.isLoadingSubject.asObservable();\r\n }\r\n\r\n get currentUserValue(): UserType {\r\n return this.currentUserSubject.value;\r\n }\r\n\r\n set currentUserValue(user: UserType) {\r\n this.currentUserSubject.next(user);\r\n }\r\n\r\n login(username: string, password: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.login(username, password)\r\n .pipe(\r\n map((userModel: UserModel) => {\r\n this.setAuthFromLocalStorage(userModel);\r\n return userModel;\r\n }),\r\n switchMap(() => this.getUserByToken()),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n // need create new user\r\n registerWithImage(formData: FormData): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.createNewUser(formData).pipe(\r\n map((registerResponseModel: RegisterResponseModel) => {\r\n //this.isLoadingSubject.next(false);\r\n return registerResponseModel;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n const registerResponseModel = new RegisterResponseModel();\r\n registerResponseModel.success = false;\r\n registerResponseModel.errors = new Array();\r\n const error = 'Terdapat ralat semasa pendaftaran. Sila cuba lagi dan hubungi pihak LGM jika berterusan';\r\n registerResponseModel.errors[0] = error;\r\n return of(registerResponseModel);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n // need create new user\r\n changePassword(changePasswordModel: ChangePasswordModel): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.changePassword(changePasswordModel).pipe(\r\n map((changePasswordResponseModel: ChangePasswordResponseModel) => {\r\n //this.isLoadingSubject.next(false);\r\n return changePasswordResponseModel;\r\n }),\r\n // user need to verify email first\r\n //switchMap(() => this.loginWithOpenId(user.nric, user.password)),\r\n catchError((err) => {\r\n //console.error('err', err);\r\n return of('Terdapat ralat semasa menukar kata laluan. Sila cuba lagi dan hubungi pihak LGM jika berterusan');\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n // need create new user\r\n resetPassword(changePasswordModel: ForgotChangePasswordModel): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.resetPassword(changePasswordModel).pipe(\r\n map((changePasswordResponseModel: ForgotChangePasswordResponseModel) => {\r\n //this.isLoadingSubject.next(false);\r\n return changePasswordResponseModel;\r\n }),\r\n // user need to verify email first\r\n //switchMap(() => this.loginWithOpenId(user.nric, user.password)),\r\n catchError((err) => {\r\n //console.error('err', err);\r\n return of('Terdapat ralat semasa set semula kata laluan. Sila cuba lagi dan hubungi pihak LGM jika berterusan');\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n getUserByToken(): Observable {\r\n const auth = this.getAuthFromLocalStorage();\r\n if (!auth || !auth.accessToken) {\r\n return of(undefined);\r\n }\r\n\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.getUserByToken(auth.accessToken).pipe(\r\n map((user: UserType) => {\r\n if (user) {\r\n this.currentUserSubject.next(user);\r\n } else {\r\n this.logout();\r\n }\r\n return user;\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n getAccessTokenUsingRefreshToken(): Observable {\r\n const auth = this.getAuthFromLocalStorage();\r\n if (!auth || !auth.accessToken) {\r\n return of('');\r\n }\r\n return from(auth.refreshToken).pipe(\r\n switchMap(refreshToken => {\r\n return this.authHttpService.requestRefreshToken(refreshToken);\r\n }),\r\n map(response => response.access_token),\r\n // tap(accessToken => this.storage.set(this.ACCESS_TOKEN, accessToken))\r\n );\r\n }\r\n\r\n private getAuthFromLocalStorage(): UserModel | undefined {\r\n try {\r\n const lsValue = localStorage.getItem(this.authLocalStorageToken);\r\n if (!lsValue) {\r\n return undefined;\r\n }\r\n const authData = JSON.parse(lsValue);\r\n return authData;\r\n } catch (error) {\r\n console.error(error);\r\n return undefined;\r\n }\r\n }\r\n\r\n private setAuthFromLocalStorage(userModel: UserModel): boolean {\r\n // store auth authToken/refreshToken/epiresIn in local storage to keep user logged in between page refreshes\r\n if (userModel && userModel.accessToken) {\r\n localStorage.clear();\r\n localStorage.setItem(this.authLocalStorageToken, JSON.stringify(userModel));\r\n localStorage.setItem('username', userModel.username);\r\n localStorage.setItem('userId', userModel.id);\r\n localStorage.setItem('fullname', userModel.name);\r\n localStorage.setItem('email', userModel.email);\r\n localStorage.setItem('nric', userModel.nric); // New user who does not have Patg account does not have memberId\r\n localStorage.setItem('accountStatus', userModel.accountStatus);\r\n localStorage.setItem('phoneNo', userModel.phoneNumber);\r\n localStorage.setItem('city', userModel.city);\r\n // console.log(\"accs :\" + userModel.accountStatus);\r\n if (userModel.memberId !== undefined) {\r\n localStorage.setItem('memberId', userModel.memberId.toString());\r\n }\r\n else\r\n localStorage.setItem('memberId', \"0\");\r\n\r\n if (userModel.officeId !== undefined) {\r\n localStorage.setItem('officeId', userModel.officeId.toString());\r\n }\r\n else{\r\n localStorage.setItem('officeId', '0');\r\n }\r\n\r\n\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n logout() {\r\n this.clearStorage();\r\n let regisration = localStorage.getItem('registration');\r\n if (regisration) {\r\n this.router.navigate(['/auth/registration']);\r\n }\r\n else {\r\n // this.router.navigate(['/auth/login']);\r\n this.router.navigate(['/auth/welcome']);\r\n }\r\n // set this to undefined so that it will not login again (see code in login constructor)\r\n this.currentUserSubject = new BehaviorSubject(undefined);\r\n }\r\n\r\n resendActivationCode(username: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.requestResendActivationCode(username)\r\n .pipe(\r\n map((requestActivationCodeResp: ResultResendActivationCodeModel) => {\r\n return requestActivationCodeResp;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n sendActivationCode(username: string, phoneNumber: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.requestResendActivationCode(username)\r\n .pipe(\r\n map((requestActivationCodeResp: ResultModel) => {\r\n return requestActivationCodeResp;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n verifyActivationCode(code: string, phoneNumber: string, username: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.verifyActivationCode(code, phoneNumber, username)\r\n .pipe(\r\n map((requestActivationCodeResp: ResultModel) => {\r\n return requestActivationCodeResp;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n verifyToken(code: string, phoneNumber: string, username: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService.verifyToken(code, phoneNumber, username)\r\n .pipe(\r\n map((requestActivationCodeResp: ResultModel) => {\r\n return requestActivationCodeResp;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n /**\r\n * Request forgot password by username\r\n */\r\n forgotPassword(email: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService\r\n .forgotPassword(email)\r\n .pipe(\r\n map((resultModel: ResultModel) => {\r\n return resultModel;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n forgotPasswordByPhoneNumber(username: string): Observable {\r\n this.isLoadingSubject.next(true);\r\n return this.authHttpService\r\n .forgotPasswordByPhoneNumber(username)\r\n .pipe(\r\n map((resultModel: ResultModel) => {\r\n return resultModel;\r\n }),\r\n catchError((err) => {\r\n console.error('err', err);\r\n return of(undefined);\r\n }),\r\n finalize(() => this.isLoadingSubject.next(false))\r\n );\r\n }\r\n\r\n clearStorage() {\r\n localStorage.removeItem(this.authLocalStorageToken);\r\n // localStorage.removeItem('username');\r\n // localStorage.removeItem('userId');\r\n // localStorage.removeItem('memberId');\r\n // localStorage.removeItem('accountStatus');\r\n // localStorage.removeItem('fullname');\r\n // localStorage.removeItem('nric');\r\n // localStorage.removeItem('member');\r\n // localStorage.removeItem('patgRegStatus');\r\n // localStorage.removeItem('profileImage');\r\n // localStorage.removeItem('phoneNo');\r\n // localStorage.removeItem('email');\r\n localStorage.clear();\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.unsubscribe.forEach((sb) => sb.unsubscribe());\r\n }\r\n}\r\n","import { BaseModel } from \"./base.model\";\r\n\r\nexport class MemberModel extends BaseModel{\r\n auto_id?:number;\r\n memberId: number;\r\n memberName: string | null;\r\n memberIC: string | null;\r\n memberOldIC: string | null;\r\n memberCitizenship: string | null;\r\n memberBirthYear: number | null;\r\n memberAddr1: string | null;\r\n memberAddr2: string | null;\r\n memberAddr3: string | null;\r\n memberZipCode: string | null;\r\n memberCity: string | null;\r\n memberAddrState: number | null;\r\n memberAddrDistrict: number | null;\r\n sex: string | null;\r\n raceCode: string | null;\r\n raceName: string | null;\r\n maritalStatusId: number | null;\r\n memberPhone: string | null;\r\n memberPhoneHome: string | null;\r\n memberEmail: string | null;\r\n incomeLevelId: number | null;\r\n educationLevelId: number | null;\r\n memberOtherActivities: string | null;\r\n memberOtherIncome: string | null;\r\n actFreqId: number | null;\r\n memberNotes1: string | null;\r\n memberNotes2: string | null;\r\n memberRegisterDate: string | null;\r\n memberImage: string | null;\r\n memberImageMD5: string | null;\r\n farmOwnerId: number | null;\r\n cardCollectBranch: number | null;\r\n //preRegId: number | null;\r\n bankId: number | null;\r\n lastUpdate: string | null;\r\n personUpdate: string | null;\r\n vendor_update: boolean | null;\r\n uip_elev: boolean | null;\r\n memberDUN: string | null;\r\n memberParlimen: string | null;\r\n memberDUNChecked: number;\r\n memberFarmDunUpdated: number;\r\n memberFormNo: string | null;\r\n memberFormReceiver: string | null;\r\n memberActive: number;\r\n memberStatus: number;\r\n memberParlimenId: number;\r\n memberDunId: number;\r\n member_created_at: string | null;\r\n member_created_by: number | null;\r\n accBankNo: string | null;\r\n stateName: string | null;\r\n districtName: string | null;\r\n parlimen: string | null;\r\n dun: string | null;\r\n maritalStatusName: string | null;\r\n incomeLevelName: string | null;\r\n bankName: string | null;\r\n educationLevelName: string | null;\r\n actFreqName: string | null;\r\n patgRegId: number | null;\r\n patgRegStatusId: number | null;\r\n \r\n // memberId:any;\r\n // memberName:any;\r\n // memberIC:any;\r\n // memberOldIC:any;\r\n // memberCitizenship:any;\r\n // memberBirthYear:any;\r\n // memberAddr1:any;\r\n // memberAddr2:any;\r\n // memberAddr3:any;\r\n // memberZipCode:any;\r\n // memberCity:any;\r\n // memberAddrState:any;\r\n // memberAddrDistrict:any;\r\n // sex:any;\r\n // raceCode:any;\r\n // maritalStatusId:any;\r\n // memberPhone:any;\r\n // memberPhoneHome:any;\r\n // memberEmail:any;\r\n // incomeLevelId:any;\r\n // educationLevelId:any;\r\n // memberOtherActivities:any;\r\n // memberOtherIncome:any;\r\n // actFreqId:any;\r\n // memberNotes1:any;\r\n // memberNotes2:any;\r\n // memberRegisterDate:any;\r\n // memberImage:any;\r\n // memberImageMD5:any;\r\n // farmOwnerId:any;\r\n // cardCollectBranch:any;\r\n // preRegId:any;\r\n // bankId:any;\r\n // lastUpdate:any;\r\n // personUpdate:any;\r\n // vendor_update:any;\r\n // uip_elev:any;\r\n // memberDUN:any;\r\n // memberParlimen:any;\r\n // memberDUNChecked:any;\r\n // memberFarmDunUpdated:any;\r\n // memberFormNo:any;\r\n // memberFormReceiver:any;\r\n // memberActive:any;\r\n // memberStatus:any;\r\n // memberParlimenId:any;\r\n // memberDunId:any;\r\n // member_created_at:any;\r\n // member_created_by:any;\r\n // accBankNo:any;\r\n // stateName:any;\r\n // districtName:any;\r\n // parlimen:any;\r\n // dun:any;\r\n // maritalStatusName:any;\r\n // raceName:any;\r\n // incomeLevelName:any;\r\n // bankName:any;\r\n // educationLevelName:any;\r\n // actFreqName:any;\r\n\r\n // constructor(original: Object) { \r\n // Object.assign(this, original);\r\n // }\r\n\r\n constructor(params: Partial = {} as MemberModel) {\r\n super();\r\n Object.assign(this, params);\r\n }\r\n\r\n static createCopy(objectToCopy: MemberModel | null): MemberModel | null{\r\n if(objectToCopy === null) return null;\r\n return (JSON.parse(JSON.stringify(objectToCopy)));\r\n }\r\n\r\n }","import { BaseModel } from \"./base.model\";\r\nexport class FarmModel extends BaseModel {\r\n auto_id?: number;\r\n farmId: any;\r\n farmGrantNo: any;\r\n subDivId: any;\r\n farmFractionCount: any;\r\n farmVillageName: any;\r\n farmLotNo: any;\r\n farmAreaH: any;\r\n farmAreaAcre: any;\r\n farmAreaRelung: any;\r\n farmAreaHectare: any;\r\n lotRuleId: any;\r\n lotCatId: any;\r\n farmCloneType: any;\r\n farmPlantYear: any;\r\n farmNotes: any;\r\n farmLastUpdate: any;\r\n farmPersoUpdate: any;\r\n farmParlimen: any;\r\n farmDun: any;\r\n farmAgencyId: any;\r\n farmRubberTypeId: any;\r\n farmAreaRood: any;\r\n farmAreaPole: any;\r\n farmAreaJempa: any;\r\n farmAreaM2: any;\r\n farmPlantYearExceedDueYear: any;\r\n stateName: any;\r\n districtName: any;\r\n subDivName: any;\r\n cardNo: any;\r\n cardAgencyId: any;\r\n farmWorkerId: any;\r\n farmWorkerAreaHectare: any;\r\n farmWorkerAreaHectareWork: any;\r\n cardInProcess: any;\r\n agencyName: any;\r\n farmIsOwned: any;\r\n farmIsWorked: any;\r\n farmWorkerSubCatId: any;\r\n lotRuleName: any;\r\n lotCatName: any;\r\n grantImage1: string | null;\r\n grantImage2: string | null;\r\n grantImage3: string | null;\r\n grantImage4: string | null;\r\n grantImage5: string | null;\r\n grantImage1Id: string | null;\r\n grantImage2Id: string | null;\r\n grantImage3Id: string | null;\r\n grantImage4Id: string | null;\r\n grantImage5Id: string | null;\r\n permissionFormImage: string;\r\n appConfirmationFormImage: string;\r\n swornStatDecLetterImage: string;\r\n permissionFormImageId: string;\r\n appConfirmationFormImageId: string;\r\n swornStatDecLetterImageId: string;\r\n\r\n isOwn: any;\r\n isWork: any;\r\n workfarmWorkerAreaHectare: any;\r\n workfarmWorkerAreaHectareWork: any;\r\n\r\n patgRegId: number;\r\n patgRegStatusId: number;\r\n statusName: string;\r\n hasLetterOrReceiptLandAppTOL: any;\r\n hasLetterOrOfficialDocRelevantOffice: any;\r\n hasLetterOrReceiptChangeLandCondition: any;\r\n ownerType: any;\r\n hasOwnerHasLetterOrReceiptChangeLandCondition: any;\r\n hasOwnerHasLetterOrReceiptLandAppTOL: any;\r\n swornStatuoDecLetterTOL: any;\r\n swornStatuoDecLetterProveAsPentadbir: any;\r\n swornStatuoDecLetterChangeLandCond: any;\r\n appConfirmationFormPeribumi: any;\r\n appConfirmationFormPeneroka: any;\r\n appConfirmationFormAgency: any;\r\n appLandReceiptOrLetterTOL: any;\r\n officeLandDocOrLetter: any;\r\n changeLandCondReceiptOrLetter: any;\r\n ownerPermissionForm: any;\r\n appConfirmationForm: any;\r\n swornStatuoDecLetter: any;\r\n hasLandGrant: any;\r\n showReceiptChangeLotRuleQ: any;\r\n showLetterRelevantOfficerQ: any;\r\n showLetterOrReceiptLandOfficeQ: any;\r\n showLandGrantQ: any;\r\n showOwnerTypeQ: any;\r\n showPenerokaTOLQ: any;\r\n\r\n ownerPermissionFormId: string | null;\r\n appConfirmationFormId: string | null;\r\n swornStatuoDecLetterId: string | null;\r\n changeLandCondReceiptOrLetterId: string | null;\r\n officeLandDocOrLetterId: string | null;\r\n appLandReceiptOrLetterTOLId: string | null;\r\n appConfirmationFormAgencyId: string | null;\r\n appConfirmationFormPenerokaId: string | null;\r\n appConfirmationFormPeribumiId: string | null;\r\n swornStatuoDecLetterChangeLandCondId: string | null;\r\n swornStatuoDecLetterProveAsPentadbirId: string | null;\r\n swornStatuoDecLetterTOLId: string | null;\r\n /**\r\n * Default constructor\r\n * @param params Partial properties of Farm Model\r\n */\r\n constructor(params: Partial = {} as FarmModel) {\r\n super();\r\n Object.assign(this, params);\r\n }\r\n\r\n static createCopy(objectToCopy: FarmModel | null): FarmModel | null {\r\n if (objectToCopy === null) return null;\r\n return (JSON.parse(JSON.stringify(objectToCopy)));\r\n }\r\n}\r\n\r\n\r\n","import { BaseModel } from \"./base.model\";\r\n\r\nexport class FarmWorkerModel extends BaseModel {\r\n auto_id?: number;\r\n farmWorkerId: any;\r\n farmId: any;\r\n memberId: any;\r\n catId: any;\r\n farmWorkerUseFraction: any;\r\n fractionId: any;\r\n farmWorkerAreaH: any;//any;\r\n farmWorkerAreaAcre: number;//any;\r\n farmWorkerAreaRelung: number;//any;\r\n farmWorkerAreaHectare: number;// any;\r\n farmWorkerActive: any;\r\n farmWorkerLastUpdate: any;\r\n farmWokerPersonUpdate: any;\r\n fractionNominator: any;\r\n fractionDenominator: any;\r\n farmWorkerAreaRood: number;//any;\r\n farmWorkerAreaPole: number;//any;\r\n farmWorkerAreaHWork: any;\r\n farmWorkerAreaAcreWork: number;//any;\r\n farmWorkerAreaRelungWork: number;//any;\r\n farmWorkerAreaHectareWork: number;//any;\r\n farmWorkerAreaRoodWork: number;//any;\r\n farmWorkerAreaPoleWork: number;//any;\r\n farmWorkerSubCatId: any;\r\n farmWorkerUseFractionWork: any;\r\n fractionNominatorWork: any;\r\n fractionDenominatorWork: any;\r\n farmWorkerAreaJempa: number;//any;\r\n farmWorkerAreaMeter2: number;//any;\r\n farmWorkerAreaJempaWork: number;//any;\r\n farmWorkerAreaMeter2Work: number;//any;\r\n subCatName: any;\r\n //SubCatId: any;\r\n memberName: any;\r\n memberIC: any;\r\n cardNo: any;\r\n memberActive: any;\r\n patgRegId: number;\r\n patgRegStatusId: number;\r\n\r\n farmWorkerTotalOwnArea: number;\r\n farmWorkerTotalWorkArea: number;\r\n farmWorkerTotalOwnWorkArea: number;\r\n patgLiveMemberId: number | null | undefined;\r\n \r\n /**\r\n * Default constructor\r\n * @param params Partial properties of Farm Model\r\n */\r\n constructor(params: Partial = {} as FarmWorkerModel) {\r\n super();\r\n Object.assign(this, params);\r\n }\r\n\r\n static createCopy(objectToCopy: FarmWorkerModel | null): FarmWorkerModel | null{\r\n if(objectToCopy === null) return null;\r\n return (JSON.parse(JSON.stringify(objectToCopy)));\r\n }\r\n}\r\n","import { BaseModel } from \"./base.model\";\r\n\r\nexport class MemberAgreementModel extends BaseModel {\r\n memberName: string | null;\r\n cardId: number | null;\r\n cardNo: string | null;\r\n no_owner_verified: number | null;\r\n name: string | null;\r\n ratioOwner: number | null;\r\n ratioWorker: number | null;\r\n ownerName: string | null;\r\n ownerCardNo: string | null;\r\n office_id: number | string;\r\n}\r\n","const e = \"undefined\" != typeof globalThis ? globalThis : \"undefined\" != typeof self ? self : \"undefined\" != typeof window ? window : global,\n t = Object.keys,\n n = Array.isArray;\nfunction r(e, n) {\n return \"object\" != typeof n || t(n).forEach(function (t) {\n e[t] = n[t];\n }), e;\n}\n\"undefined\" == typeof Promise || e.Promise || (e.Promise = Promise);\nconst s = Object.getPrototypeOf,\n i = {}.hasOwnProperty;\nfunction o(e, t) {\n return i.call(e, t);\n}\nfunction a(e, n) {\n \"function\" == typeof n && (n = n(s(e))), (\"undefined\" == typeof Reflect ? t : Reflect.ownKeys)(n).forEach(t => {\n l(e, t, n[t]);\n });\n}\nconst u = Object.defineProperty;\nfunction l(e, t, n, s) {\n u(e, t, r(n && o(n, \"get\") && \"function\" == typeof n.get ? {\n get: n.get,\n set: n.set,\n configurable: !0\n } : {\n value: n,\n configurable: !0,\n writable: !0\n }, s));\n}\nfunction c(e) {\n return {\n from: function (t) {\n return e.prototype = Object.create(t.prototype), l(e.prototype, \"constructor\", e), {\n extend: a.bind(null, e.prototype)\n };\n }\n };\n}\nconst h = Object.getOwnPropertyDescriptor;\nfunction d(e, t) {\n let n;\n return h(e, t) || (n = s(e)) && d(n, t);\n}\nconst f = [].slice;\nfunction p(e, t, n) {\n return f.call(e, t, n);\n}\nfunction y(e, t) {\n return t(e);\n}\nfunction m(e) {\n if (!e) throw new Error(\"Assertion Failed\");\n}\nfunction v(t) {\n e.setImmediate ? setImmediate(t) : setTimeout(t, 0);\n}\nfunction g(e, t) {\n return e.reduce((e, n, r) => {\n var s = t(n, r);\n return s && (e[s[0]] = s[1]), e;\n }, {});\n}\nfunction b(e, t) {\n if (o(e, t)) return e[t];\n if (!t) return e;\n if (\"string\" != typeof t) {\n for (var n = [], r = 0, s = t.length; r < s; ++r) {\n var i = b(e, t[r]);\n n.push(i);\n }\n return n;\n }\n var a = t.indexOf(\".\");\n if (-1 !== a) {\n var u = e[t.substr(0, a)];\n return void 0 === u ? void 0 : b(u, t.substr(a + 1));\n }\n}\nfunction _(e, t, r) {\n if (e && void 0 !== t && (!(\"isFrozen\" in Object) || !Object.isFrozen(e))) if (\"string\" != typeof t && \"length\" in t) {\n m(\"string\" != typeof r && \"length\" in r);\n for (var s = 0, i = t.length; s < i; ++s) _(e, t[s], r[s]);\n } else {\n var a = t.indexOf(\".\");\n if (-1 !== a) {\n var u = t.substr(0, a),\n l = t.substr(a + 1);\n if (\"\" === l) void 0 === r ? n(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = r;else {\n var c = e[u];\n c && o(e, u) || (c = e[u] = {}), _(c, l, r);\n }\n } else void 0 === r ? n(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = r;\n }\n}\nfunction w(e) {\n var t = {};\n for (var n in e) o(e, n) && (t[n] = e[n]);\n return t;\n}\nconst x = [].concat;\nfunction k(e) {\n return x.apply([], e);\n}\nconst E = \"Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey\".split(\",\").concat(k([8, 16, 32, 64].map(e => [\"Int\", \"Uint\", \"Float\"].map(t => t + e + \"Array\")))).filter(t => e[t]),\n P = E.map(t => e[t]);\ng(E, e => [e, !0]);\nlet K = null;\nfunction O(e) {\n K = \"undefined\" != typeof WeakMap && new WeakMap();\n const t = S(e);\n return K = null, t;\n}\nfunction S(e) {\n if (!e || \"object\" != typeof e) return e;\n let t = K && K.get(e);\n if (t) return t;\n if (n(e)) {\n t = [], K && K.set(e, t);\n for (var r = 0, i = e.length; r < i; ++r) t.push(S(e[r]));\n } else if (P.indexOf(e.constructor) >= 0) t = e;else {\n const n = s(e);\n for (var a in t = n === Object.prototype ? {} : Object.create(n), K && K.set(e, t), e) o(e, a) && (t[a] = S(e[a]));\n }\n return t;\n}\nconst {\n toString: A\n} = {};\nfunction C(e) {\n return A.call(e).slice(8, -1);\n}\nconst j = \"undefined\" != typeof Symbol ? Symbol.iterator : \"@@iterator\",\n D = \"symbol\" == typeof j ? function (e) {\n var t;\n return null != e && (t = e[j]) && t.apply(e);\n } : function () {\n return null;\n },\n I = {};\nfunction B(e) {\n var t, r, s, i;\n if (1 === arguments.length) {\n if (n(e)) return e.slice();\n if (this === I && \"string\" == typeof e) return [e];\n if (i = D(e)) {\n for (r = []; !(s = i.next()).done;) r.push(s.value);\n return r;\n }\n if (null == e) return [e];\n if (\"number\" == typeof (t = e.length)) {\n for (r = new Array(t); t--;) r[t] = e[t];\n return r;\n }\n return [e];\n }\n for (t = arguments.length, r = new Array(t); t--;) r[t] = arguments[t];\n return r;\n}\nconst T = \"undefined\" != typeof Symbol ? e => \"AsyncFunction\" === e[Symbol.toStringTag] : () => !1;\nvar R = \"undefined\" != typeof location && /^(http|https):\\/\\/(localhost|127\\.0\\.0\\.1)/.test(location.href);\nfunction F(e, t) {\n R = e, M = t;\n}\nvar M = () => !0;\nconst N = !new Error(\"\").stack;\nfunction q() {\n if (N) try {\n throw q.arguments, new Error();\n } catch (e) {\n return e;\n }\n return new Error();\n}\nfunction $(e, t) {\n var n = e.stack;\n return n ? (t = t || 0, 0 === n.indexOf(e.name) && (t += (e.name + e.message).split(\"\\n\").length), n.split(\"\\n\").slice(t).filter(M).map(e => \"\\n\" + e).join(\"\")) : \"\";\n}\nvar U = [\"Unknown\", \"Constraint\", \"Data\", \"TransactionInactive\", \"ReadOnly\", \"Version\", \"NotFound\", \"InvalidState\", \"InvalidAccess\", \"Abort\", \"Timeout\", \"QuotaExceeded\", \"Syntax\", \"DataClone\"],\n L = [\"Modify\", \"Bulk\", \"OpenFailed\", \"VersionChange\", \"Schema\", \"Upgrade\", \"InvalidTable\", \"MissingAPI\", \"NoSuchDatabase\", \"InvalidArgument\", \"SubTransaction\", \"Unsupported\", \"Internal\", \"DatabaseClosed\", \"PrematureCommit\", \"ForeignAwait\"].concat(U),\n V = {\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 W(e, t) {\n this._e = q(), this.name = e, this.message = t;\n}\nfunction Y(e, t) {\n return e + \". Errors: \" + Object.keys(t).map(e => t[e].toString()).filter((e, t, n) => n.indexOf(e) === t).join(\"\\n\");\n}\nfunction z(e, t, n, r) {\n this._e = q(), this.failures = t, this.failedKeys = r, this.successCount = n, this.message = Y(e, t);\n}\nfunction G(e, t) {\n this._e = q(), this.name = \"BulkError\", this.failures = Object.keys(t).map(e => t[e]), this.failuresByPos = t, this.message = Y(e, t);\n}\nc(W).from(Error).extend({\n stack: {\n get: function () {\n return this._stack || (this._stack = this.name + \": \" + this.message + $(this._e, 2));\n }\n },\n toString: function () {\n return this.name + \": \" + this.message;\n }\n}), c(z).from(W), c(G).from(W);\nvar H = L.reduce((e, t) => (e[t] = t + \"Error\", e), {});\nconst Q = W;\nvar X = L.reduce((e, t) => {\n var n = t + \"Error\";\n function r(e, r) {\n this._e = q(), this.name = n, e ? \"string\" == typeof e ? (this.message = `${e}${r ? \"\\n \" + r : \"\"}`, this.inner = r || null) : \"object\" == typeof e && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = V[t] || n, this.inner = null);\n }\n return c(r).from(Q), e[t] = r, e;\n}, {});\nX.Syntax = SyntaxError, X.Type = TypeError, X.Range = RangeError;\nvar J = U.reduce((e, t) => (e[t + \"Error\"] = X[t], e), {});\nvar Z = L.reduce((e, t) => (-1 === [\"Syntax\", \"Type\", \"Range\"].indexOf(t) && (e[t + \"Error\"] = X[t]), e), {});\nfunction ee() {}\nfunction te(e) {\n return e;\n}\nfunction ne(e, t) {\n return null == e || e === te ? t : function (n) {\n return t(e(n));\n };\n}\nfunction re(e, t) {\n return function () {\n e.apply(this, arguments), t.apply(this, arguments);\n };\n}\nfunction se(e, t) {\n return e === ee ? t : function () {\n var n = e.apply(this, arguments);\n void 0 !== n && (arguments[0] = n);\n var r = this.onsuccess,\n s = this.onerror;\n this.onsuccess = null, this.onerror = null;\n var i = t.apply(this, arguments);\n return r && (this.onsuccess = this.onsuccess ? re(r, this.onsuccess) : r), s && (this.onerror = this.onerror ? re(s, this.onerror) : s), void 0 !== i ? i : n;\n };\n}\nfunction ie(e, t) {\n return e === ee ? t : function () {\n e.apply(this, arguments);\n var n = this.onsuccess,\n r = this.onerror;\n this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? re(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? re(r, this.onerror) : r);\n };\n}\nfunction oe(e, t) {\n return e === ee ? t : function (n) {\n var s = e.apply(this, arguments);\n r(n, s);\n var i = this.onsuccess,\n o = this.onerror;\n this.onsuccess = null, this.onerror = null;\n var a = t.apply(this, arguments);\n return i && (this.onsuccess = this.onsuccess ? re(i, this.onsuccess) : i), o && (this.onerror = this.onerror ? re(o, this.onerror) : o), void 0 === s ? void 0 === a ? void 0 : a : r(s, a);\n };\n}\nfunction ae(e, t) {\n return e === ee ? t : function () {\n return !1 !== t.apply(this, arguments) && e.apply(this, arguments);\n };\n}\nfunction ue(e, t) {\n return e === ee ? t : function () {\n var n = e.apply(this, arguments);\n if (n && \"function\" == typeof n.then) {\n for (var r = this, s = arguments.length, i = new Array(s); s--;) i[s] = arguments[s];\n return n.then(function () {\n return t.apply(r, i);\n });\n }\n return t.apply(this, arguments);\n };\n}\nZ.ModifyError = z, Z.DexieError = W, Z.BulkError = G;\nvar le = {};\nconst ce = 100,\n [he, de, fe] = \"undefined\" == typeof Promise ? [] : (() => {\n let e = Promise.resolve();\n if (\"undefined\" == typeof crypto || !crypto.subtle) return [e, s(e), e];\n const t = crypto.subtle.digest(\"SHA-512\", new Uint8Array([0]));\n return [t, s(t), e];\n })(),\n pe = de && de.then,\n ye = he && he.constructor,\n me = !!fe;\nvar ve = !1,\n ge = fe ? () => {\n fe.then($e);\n } : e.setImmediate ? setImmediate.bind(null, $e) : e.MutationObserver ? () => {\n var e = document.createElement(\"div\");\n new MutationObserver(() => {\n $e(), e = null;\n }).observe(e, {\n attributes: !0\n }), e.setAttribute(\"i\", \"1\");\n } : () => {\n setTimeout($e, 0);\n },\n be = function (e, t) {\n Se.push([e, t]), we && (ge(), we = !1);\n },\n _e = !0,\n we = !0,\n xe = [],\n ke = [],\n Ee = null,\n Pe = te,\n Ke = {\n id: \"global\",\n global: !0,\n ref: 0,\n unhandleds: [],\n onunhandled: dt,\n pgp: !1,\n env: {},\n finalize: function () {\n this.unhandleds.forEach(e => {\n try {\n dt(e[0], e[1]);\n } catch (e) {}\n });\n }\n },\n Oe = Ke,\n Se = [],\n Ae = 0,\n Ce = [];\nfunction je(e) {\n if (\"object\" != typeof this) throw new TypeError(\"Promises must be constructed via new\");\n this._listeners = [], this.onuncatched = ee, this._lib = !1;\n var t = this._PSD = Oe;\n if (R && (this._stackHolder = q(), this._prev = null, this._numPrev = 0), \"function\" != typeof e) {\n if (e !== le) throw new TypeError(\"Not a function\");\n return this._state = arguments[1], this._value = arguments[2], void (!1 === this._state && Te(this, this._value));\n }\n this._state = null, this._value = null, ++t.ref, Be(this, e);\n}\nconst De = {\n get: function () {\n var e = Oe,\n t = Xe;\n function n(n, r) {\n var s = !e.global && (e !== Oe || t !== Xe);\n const i = s && !tt();\n var o = new je((t, o) => {\n Fe(this, new Ie(lt(n, e, s, i), lt(r, e, s, i), t, o, e));\n });\n return R && qe(o, this), o;\n }\n return n.prototype = le, n;\n },\n set: function (e) {\n l(this, \"then\", e && e.prototype === le ? De : {\n get: function () {\n return e;\n },\n set: De.set\n });\n }\n};\nfunction Ie(e, t, n, r, s) {\n this.onFulfilled = \"function\" == typeof e ? e : null, this.onRejected = \"function\" == typeof t ? t : null, this.resolve = n, this.reject = r, this.psd = s;\n}\nfunction Be(e, t) {\n try {\n t(t => {\n if (null === e._state) {\n if (t === e) throw new TypeError(\"A promise cannot be resolved with itself.\");\n var n = e._lib && Ue();\n t && \"function\" == typeof t.then ? Be(e, (e, n) => {\n t instanceof je ? t._then(e, n) : t.then(e, n);\n }) : (e._state = !0, e._value = t, Re(e)), n && Le();\n }\n }, Te.bind(null, e));\n } catch (t) {\n Te(e, t);\n }\n}\nfunction Te(e, t) {\n if (ke.push(t), null === e._state) {\n var n = e._lib && Ue();\n t = Pe(t), e._state = !1, e._value = t, R && null !== t && \"object\" == typeof t && !t._promise && function (e, t, n) {\n try {\n e.apply(null, n);\n } catch (e) {\n t && t(e);\n }\n }(() => {\n var n = d(t, \"stack\");\n t._promise = e, l(t, \"stack\", {\n get: () => ve ? n && (n.get ? n.get.apply(t) : n.value) : e.stack\n });\n }), function (e) {\n xe.some(t => t._value === e._value) || xe.push(e);\n }(e), Re(e), n && Le();\n }\n}\nfunction Re(e) {\n var t = e._listeners;\n e._listeners = [];\n for (var n = 0, r = t.length; n < r; ++n) Fe(e, t[n]);\n var s = e._PSD;\n --s.ref || s.finalize(), 0 === Ae && (++Ae, be(() => {\n 0 == --Ae && Ve();\n }, []));\n}\nfunction Fe(e, t) {\n if (null !== e._state) {\n var n = e._state ? t.onFulfilled : t.onRejected;\n if (null === n) return (e._state ? t.resolve : t.reject)(e._value);\n ++t.psd.ref, ++Ae, be(Me, [n, e, t]);\n } else e._listeners.push(t);\n}\nfunction Me(e, t, n) {\n try {\n Ee = t;\n var r,\n s = t._value;\n t._state ? r = e(s) : (ke.length && (ke = []), r = e(s), -1 === ke.indexOf(s) && function (e) {\n var t = xe.length;\n for (; t;) if (xe[--t]._value === e._value) return void xe.splice(t, 1);\n }(t)), n.resolve(r);\n } catch (e) {\n n.reject(e);\n } finally {\n Ee = null, 0 == --Ae && Ve(), --n.psd.ref || n.psd.finalize();\n }\n}\nfunction Ne(e, t, n) {\n if (t.length === n) return t;\n var r = \"\";\n if (!1 === e._state) {\n var s,\n i,\n o = e._value;\n null != o ? (s = o.name || \"Error\", i = o.message || o, r = $(o, 0)) : (s = o, i = \"\"), t.push(s + (i ? \": \" + i : \"\") + r);\n }\n return R && ((r = $(e._stackHolder, 2)) && -1 === t.indexOf(r) && t.push(r), e._prev && Ne(e._prev, t, n)), t;\n}\nfunction qe(e, t) {\n var n = t ? t._numPrev + 1 : 0;\n n < 100 && (e._prev = t, e._numPrev = n);\n}\nfunction $e() {\n Ue() && Le();\n}\nfunction Ue() {\n var e = _e;\n return _e = !1, we = !1, e;\n}\nfunction Le() {\n var e, t, n;\n do {\n for (; Se.length > 0;) for (e = Se, Se = [], n = e.length, t = 0; t < n; ++t) {\n var r = e[t];\n r[0].apply(null, r[1]);\n }\n } while (Se.length > 0);\n _e = !0, we = !0;\n}\nfunction Ve() {\n var e = xe;\n xe = [], e.forEach(e => {\n e._PSD.onunhandled.call(null, e._value, e);\n });\n for (var t = Ce.slice(0), n = t.length; n;) t[--n]();\n}\nfunction We(e) {\n return new je(le, !1, e);\n}\nfunction Ye(e, t) {\n var n = Oe;\n return function () {\n var r = Ue(),\n s = Oe;\n try {\n return it(n, !0), e.apply(this, arguments);\n } catch (e) {\n t && t(e);\n } finally {\n it(s, !1), r && Le();\n }\n };\n}\na(je.prototype, {\n then: De,\n _then: function (e, t) {\n Fe(this, new Ie(null, null, e, t, Oe));\n },\n catch: function (e) {\n if (1 === arguments.length) return this.then(null, e);\n var t = arguments[0],\n n = arguments[1];\n return \"function\" == typeof t ? this.then(null, e => e instanceof t ? n(e) : We(e)) : this.then(null, e => e && e.name === t ? n(e) : We(e));\n },\n finally: function (e) {\n return this.then(t => (e(), t), t => (e(), We(t)));\n },\n stack: {\n get: function () {\n if (this._stack) return this._stack;\n try {\n ve = !0;\n var e = Ne(this, [], 20).join(\"\\nFrom previous: \");\n return null !== this._state && (this._stack = e), e;\n } finally {\n ve = !1;\n }\n }\n },\n timeout: function (e, t) {\n return e < 1 / 0 ? new je((n, r) => {\n var s = setTimeout(() => r(new X.Timeout(t)), e);\n this.then(n, r).finally(clearTimeout.bind(null, s));\n }) : this;\n }\n}), \"undefined\" != typeof Symbol && Symbol.toStringTag && l(je.prototype, Symbol.toStringTag, \"Dexie.Promise\"), Ke.env = ot(), a(je, {\n all: function () {\n var e = B.apply(null, arguments).map(nt);\n return new je(function (t, n) {\n 0 === e.length && t([]);\n var r = e.length;\n e.forEach((s, i) => je.resolve(s).then(n => {\n e[i] = n, --r || t(e);\n }, n));\n });\n },\n resolve: e => {\n if (e instanceof je) return e;\n if (e && \"function\" == typeof e.then) return new je((t, n) => {\n e.then(t, n);\n });\n var t = new je(le, !0, e);\n return qe(t, Ee), t;\n },\n reject: We,\n race: function () {\n var e = B.apply(null, arguments).map(nt);\n return new je((t, n) => {\n e.map(e => je.resolve(e).then(t, n));\n });\n },\n PSD: {\n get: () => Oe,\n set: e => Oe = e\n },\n totalEchoes: {\n get: () => Xe\n },\n newPSD: Ze,\n usePSD: at,\n scheduler: {\n get: () => be,\n set: e => {\n be = e;\n }\n },\n rejectionMapper: {\n get: () => Pe,\n set: e => {\n Pe = e;\n }\n },\n follow: (e, t) => new je((n, r) => Ze((t, n) => {\n var r = Oe;\n r.unhandleds = [], r.onunhandled = n, r.finalize = re(function () {\n !function (e) {\n function t() {\n e(), Ce.splice(Ce.indexOf(t), 1);\n }\n Ce.push(t), ++Ae, be(() => {\n 0 == --Ae && Ve();\n }, []);\n }(() => {\n 0 === this.unhandleds.length ? t() : n(this.unhandleds[0]);\n });\n }, r.finalize), e();\n }, t, n, r))\n}), ye && (ye.allSettled && l(je, \"allSettled\", function () {\n const e = B.apply(null, arguments).map(nt);\n return new je(t => {\n 0 === e.length && t([]);\n let n = e.length;\n const r = new Array(n);\n e.forEach((e, s) => je.resolve(e).then(e => r[s] = {\n status: \"fulfilled\",\n value: e\n }, e => r[s] = {\n status: \"rejected\",\n reason: e\n }).then(() => --n || t(r)));\n });\n}), ye.any && \"undefined\" != typeof AggregateError && l(je, \"any\", function () {\n const e = B.apply(null, arguments).map(nt);\n return new je((t, n) => {\n 0 === e.length && n(new AggregateError([]));\n let r = e.length;\n const s = new Array(r);\n e.forEach((e, i) => je.resolve(e).then(e => t(e), e => {\n s[i] = e, --r || n(new AggregateError(s));\n }));\n });\n}));\nconst ze = {\n awaits: 0,\n echoes: 0,\n id: 0\n};\nvar Ge = 0,\n He = [],\n Qe = 0,\n Xe = 0,\n Je = 0;\nfunction Ze(e, t, n, s) {\n var i = Oe,\n o = Object.create(i);\n o.parent = i, o.ref = 0, o.global = !1, o.id = ++Je;\n var a = Ke.env;\n o.env = me ? {\n Promise: je,\n PromiseProp: {\n value: je,\n configurable: !0,\n writable: !0\n },\n all: je.all,\n race: je.race,\n allSettled: je.allSettled,\n any: je.any,\n resolve: je.resolve,\n reject: je.reject,\n nthen: ct(a.nthen, o),\n gthen: ct(a.gthen, o)\n } : {}, t && r(o, t), ++i.ref, o.finalize = function () {\n --this.parent.ref || this.parent.finalize();\n };\n var u = at(o, e, n, s);\n return 0 === o.ref && o.finalize(), u;\n}\nfunction et() {\n return ze.id || (ze.id = ++Ge), ++ze.awaits, ze.echoes += ce, ze.id;\n}\nfunction tt() {\n return !!ze.awaits && (0 == --ze.awaits && (ze.id = 0), ze.echoes = ze.awaits * ce, !0);\n}\nfunction nt(e) {\n return ze.echoes && e && e.constructor === ye ? (et(), e.then(e => (tt(), e), e => (tt(), ft(e)))) : e;\n}\nfunction rt(e) {\n ++Xe, ze.echoes && 0 != --ze.echoes || (ze.echoes = ze.id = 0), He.push(Oe), it(e, !0);\n}\nfunction st() {\n var e = He[He.length - 1];\n He.pop(), it(e, !1);\n}\nfunction it(t, n) {\n var r = Oe;\n if ((n ? !ze.echoes || Qe++ && t === Oe : !Qe || --Qe && t === Oe) || ut(n ? rt.bind(null, t) : st), t !== Oe && (Oe = t, r === Ke && (Ke.env = ot()), me)) {\n var s = Ke.env.Promise,\n i = t.env;\n de.then = i.nthen, s.prototype.then = i.gthen, (r.global || t.global) && (Object.defineProperty(e, \"Promise\", i.PromiseProp), s.all = i.all, s.race = i.race, s.resolve = i.resolve, s.reject = i.reject, i.allSettled && (s.allSettled = i.allSettled), i.any && (s.any = i.any));\n }\n}\nfunction ot() {\n var t = e.Promise;\n return me ? {\n Promise: t,\n PromiseProp: Object.getOwnPropertyDescriptor(e, \"Promise\"),\n all: t.all,\n race: t.race,\n allSettled: t.allSettled,\n any: t.any,\n resolve: t.resolve,\n reject: t.reject,\n nthen: de.then,\n gthen: t.prototype.then\n } : {};\n}\nfunction at(e, t, n, r, s) {\n var i = Oe;\n try {\n return it(e, !0), t(n, r, s);\n } finally {\n it(i, !1);\n }\n}\nfunction ut(e) {\n pe.call(he, e);\n}\nfunction lt(e, t, n, r) {\n return \"function\" != typeof e ? e : function () {\n var s = Oe;\n n && et(), it(t, !0);\n try {\n return e.apply(this, arguments);\n } finally {\n it(s, !1), r && ut(tt);\n }\n };\n}\nfunction ct(e, t) {\n return function (n, r) {\n return e.call(this, lt(n, t), lt(r, t));\n };\n}\n-1 === (\"\" + pe).indexOf(\"[native code]\") && (et = tt = ee);\nconst ht = \"unhandledrejection\";\nfunction dt(t, n) {\n var s;\n try {\n s = n.onuncatched(t);\n } catch (e) {}\n if (!1 !== s) try {\n var i,\n o = {\n promise: n,\n reason: t\n };\n if (e.document && document.createEvent ? ((i = document.createEvent(\"Event\")).initEvent(ht, !0, !0), r(i, o)) : e.CustomEvent && r(i = new CustomEvent(ht, {\n detail: o\n }), o), i && e.dispatchEvent && (dispatchEvent(i), !e.PromiseRejectionEvent && e.onunhandledrejection)) try {\n e.onunhandledrejection(i);\n } catch (e) {}\n R && i && !i.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);\n } catch (e) {}\n}\nvar ft = je.reject;\nfunction pt(e, t, n, r) {\n if (e.idbdb && (e._state.openComplete || Oe.letThrough || e._vip)) {\n var s = e._createTransaction(t, n, e._dbSchema);\n try {\n s.create(), e._state.PR1398_maxLoop = 3;\n } catch (s) {\n return s.name === H.InvalidState && e.isOpen() && --e._state.PR1398_maxLoop > 0 ? (console.warn(\"Dexie: Need to reopen db\"), e._close(), e.open().then(() => pt(e, t, n, r))) : ft(s);\n }\n return s._promise(t, (e, t) => Ze(() => (Oe.trans = s, r(e, t, s)))).then(e => s._completion.then(() => e));\n }\n if (e._state.openComplete) return ft(new X.DatabaseClosed(e._state.dbOpenError));\n if (!e._state.isBeingOpened) {\n if (!e._options.autoOpen) return ft(new X.DatabaseClosed());\n e.open().catch(ee);\n }\n return e._state.dbReadyPromise.then(() => pt(e, t, n, r));\n}\nconst yt = \"3.2.4\",\n mt = String.fromCharCode(65535),\n vt = -1 / 0,\n gt = \"Invalid key provided. Keys must be of type string, number, Date or Array.\",\n bt = \"String expected.\",\n _t = [],\n wt = \"undefined\" != typeof navigator && /(MSIE|Trident|Edge)/.test(navigator.userAgent),\n xt = wt,\n kt = wt,\n Et = e => !/(dexie\\.js|dexie\\.min\\.js)/.test(e),\n Pt = \"__dbnames\",\n Kt = \"readonly\",\n Ot = \"readwrite\";\nfunction St(e, t) {\n return e ? t ? function () {\n return e.apply(this, arguments) && t.apply(this, arguments);\n } : e : t;\n}\nconst At = {\n type: 3,\n lower: -1 / 0,\n lowerOpen: !1,\n upper: [[]],\n upperOpen: !1\n};\nfunction Ct(e) {\n return \"string\" != typeof e || /\\./.test(e) ? e => e : t => (void 0 === t[e] && e in t && delete (t = O(t))[e], t);\n}\nclass jt {\n _trans(e, t, n) {\n const r = this._tx || Oe.trans,\n s = this.name;\n function i(e, n, r) {\n if (!r.schema[s]) throw new X.NotFound(\"Table \" + s + \" not part of transaction\");\n return t(r.idbtrans, r);\n }\n const o = Ue();\n try {\n return r && r.db === this.db ? r === Oe.trans ? r._promise(e, i, n) : Ze(() => r._promise(e, i, n), {\n trans: r,\n transless: Oe.transless || Oe\n }) : pt(this.db, e, [this.name], i);\n } finally {\n o && Le();\n }\n }\n get(e, t) {\n return e && e.constructor === Object ? this.where(e).first(t) : this._trans(\"readonly\", t => this.core.get({\n trans: t,\n key: e\n }).then(e => this.hook.reading.fire(e))).then(t);\n }\n where(e) {\n if (\"string\" == typeof e) return new this.db.WhereClause(this, e);\n if (n(e)) return new this.db.WhereClause(this, `[${e.join(\"+\")}]`);\n const r = t(e);\n if (1 === r.length) return this.where(r[0]).equals(e[r[0]]);\n const s = this.schema.indexes.concat(this.schema.primKey).filter(e => e.compound && r.every(t => e.keyPath.indexOf(t) >= 0) && e.keyPath.every(e => r.indexOf(e) >= 0))[0];\n if (s && this.db._maxKey !== mt) return this.where(s.name).equals(s.keyPath.map(t => e[t]));\n !s && R && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${r.join(\"+\")}]`);\n const {\n idxByName: i\n } = this.schema,\n o = this.db._deps.indexedDB;\n function a(e, t) {\n try {\n return 0 === o.cmp(e, t);\n } catch (e) {\n return !1;\n }\n }\n const [u, l] = r.reduce(([t, r], s) => {\n const o = i[s],\n u = e[s];\n return [t || o, t || !o ? St(r, o && o.multi ? e => {\n const t = b(e, s);\n return n(t) && t.some(e => a(u, e));\n } : e => a(u, b(e, s))) : r];\n }, [null, null]);\n return u ? this.where(u.name).equals(e[u.keyPath]).filter(l) : s ? this.filter(l) : this.where(r).equals(\"\");\n }\n filter(e) {\n return this.toCollection().and(e);\n }\n count(e) {\n return this.toCollection().count(e);\n }\n offset(e) {\n return this.toCollection().offset(e);\n }\n limit(e) {\n return this.toCollection().limit(e);\n }\n each(e) {\n return this.toCollection().each(e);\n }\n toArray(e) {\n return this.toCollection().toArray(e);\n }\n toCollection() {\n return new this.db.Collection(new this.db.WhereClause(this));\n }\n orderBy(e) {\n return new this.db.Collection(new this.db.WhereClause(this, n(e) ? `[${e.join(\"+\")}]` : e));\n }\n reverse() {\n return this.toCollection().reverse();\n }\n mapToClass(e) {\n this.schema.mappedClass = e;\n const t = t => {\n if (!t) return t;\n const n = Object.create(e.prototype);\n for (var r in t) if (o(t, r)) try {\n n[r] = t[r];\n } catch (e) {}\n return n;\n };\n return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = t, this.hook(\"reading\", t), e;\n }\n defineClass() {\n return this.mapToClass(function (e) {\n r(this, e);\n });\n }\n add(e, t) {\n const {\n auto: n,\n keyPath: r\n } = this.schema.primKey;\n let s = e;\n return r && n && (s = Ct(r)(e)), this._trans(\"readwrite\", e => this.core.mutate({\n trans: e,\n type: \"add\",\n keys: null != t ? [t] : null,\n values: [s]\n })).then(e => e.numFailures ? je.reject(e.failures[0]) : e.lastResult).then(t => {\n if (r) try {\n _(e, r, t);\n } catch (e) {}\n return t;\n });\n }\n update(e, r) {\n if (\"object\" != typeof e || n(e)) return this.where(\":id\").equals(e).modify(r);\n {\n const n = b(e, this.schema.primKey.keyPath);\n if (void 0 === n) return ft(new X.InvalidArgument(\"Given object does not contain its primary key\"));\n try {\n \"function\" != typeof r ? t(r).forEach(t => {\n _(e, t, r[t]);\n }) : r(e, {\n value: e,\n primKey: n\n });\n } catch (e) {}\n return this.where(\":id\").equals(n).modify(r);\n }\n }\n put(e, t) {\n const {\n auto: n,\n keyPath: r\n } = this.schema.primKey;\n let s = e;\n return r && n && (s = Ct(r)(e)), this._trans(\"readwrite\", e => this.core.mutate({\n trans: e,\n type: \"put\",\n values: [s],\n keys: null != t ? [t] : null\n })).then(e => e.numFailures ? je.reject(e.failures[0]) : e.lastResult).then(t => {\n if (r) try {\n _(e, r, t);\n } catch (e) {}\n return t;\n });\n }\n delete(e) {\n return this._trans(\"readwrite\", t => this.core.mutate({\n trans: t,\n type: \"delete\",\n keys: [e]\n })).then(e => e.numFailures ? je.reject(e.failures[0]) : void 0);\n }\n clear() {\n return this._trans(\"readwrite\", e => this.core.mutate({\n trans: e,\n type: \"deleteRange\",\n range: At\n })).then(e => e.numFailures ? je.reject(e.failures[0]) : void 0);\n }\n bulkGet(e) {\n return this._trans(\"readonly\", t => this.core.getMany({\n keys: e,\n trans: t\n }).then(e => e.map(e => this.hook.reading.fire(e))));\n }\n bulkAdd(e, t, n) {\n const r = Array.isArray(t) ? t : void 0,\n s = (n = n || (r ? void 0 : t)) ? n.allKeys : void 0;\n return this._trans(\"readwrite\", t => {\n const {\n auto: n,\n keyPath: i\n } = this.schema.primKey;\n if (i && r) throw new X.InvalidArgument(\"bulkAdd(): keys argument invalid on tables with inbound keys\");\n if (r && r.length !== e.length) throw new X.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const o = e.length;\n let a = i && n ? e.map(Ct(i)) : e;\n return this.core.mutate({\n trans: t,\n type: \"add\",\n keys: r,\n values: a,\n wantResults: s\n }).then(({\n numFailures: e,\n results: t,\n lastResult: n,\n failures: r\n }) => {\n if (0 === e) return s ? t : n;\n throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`, r);\n });\n });\n }\n bulkPut(e, t, n) {\n const r = Array.isArray(t) ? t : void 0,\n s = (n = n || (r ? void 0 : t)) ? n.allKeys : void 0;\n return this._trans(\"readwrite\", t => {\n const {\n auto: n,\n keyPath: i\n } = this.schema.primKey;\n if (i && r) throw new X.InvalidArgument(\"bulkPut(): keys argument invalid on tables with inbound keys\");\n if (r && r.length !== e.length) throw new X.InvalidArgument(\"Arguments objects and keys must have the same length\");\n const o = e.length;\n let a = i && n ? e.map(Ct(i)) : e;\n return this.core.mutate({\n trans: t,\n type: \"put\",\n keys: r,\n values: a,\n wantResults: s\n }).then(({\n numFailures: e,\n results: t,\n lastResult: n,\n failures: r\n }) => {\n if (0 === e) return s ? t : n;\n throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`, r);\n });\n });\n }\n bulkDelete(e) {\n const t = e.length;\n return this._trans(\"readwrite\", t => this.core.mutate({\n trans: t,\n type: \"delete\",\n keys: e\n })).then(({\n numFailures: e,\n lastResult: n,\n failures: r\n }) => {\n if (0 === e) return n;\n throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`, r);\n });\n }\n}\nfunction Dt(e) {\n var r = {},\n s = function (t, n) {\n if (n) {\n for (var s = arguments.length, i = new Array(s - 1); --s;) i[s - 1] = arguments[s];\n return r[t].subscribe.apply(null, i), e;\n }\n if (\"string\" == typeof t) return r[t];\n };\n s.addEventType = a;\n for (var i = 1, o = arguments.length; i < o; ++i) a(arguments[i]);\n return s;\n function a(e, i, o) {\n if (\"object\" != typeof e) {\n var u;\n i || (i = ae), o || (o = ee);\n var l = {\n subscribers: [],\n fire: o,\n subscribe: function (e) {\n -1 === l.subscribers.indexOf(e) && (l.subscribers.push(e), l.fire = i(l.fire, e));\n },\n unsubscribe: function (e) {\n l.subscribers = l.subscribers.filter(function (t) {\n return t !== e;\n }), l.fire = l.subscribers.reduce(i, o);\n }\n };\n return r[e] = s[e] = l, l;\n }\n t(u = e).forEach(function (e) {\n var t = u[e];\n if (n(t)) a(e, u[e][0], u[e][1]);else {\n if (\"asap\" !== t) throw new X.InvalidArgument(\"Invalid event config\");\n var r = a(e, te, function () {\n for (var e = arguments.length, t = new Array(e); e--;) t[e] = arguments[e];\n r.subscribers.forEach(function (e) {\n v(function () {\n e.apply(null, t);\n });\n });\n });\n }\n });\n }\n}\nfunction It(e, t) {\n return c(t).from({\n prototype: e\n }), t;\n}\nfunction Bt(e, t) {\n return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);\n}\nfunction Tt(e, t) {\n e.filter = St(e.filter, t);\n}\nfunction Rt(e, t, n) {\n var r = e.replayFilter;\n e.replayFilter = r ? () => St(r(), t()) : t, e.justLimit = n && !r;\n}\nfunction Ft(e, t) {\n if (e.isPrimKey) return t.primaryKey;\n const n = t.getIndexByKeyPath(e.index);\n if (!n) throw new X.Schema(\"KeyPath \" + e.index + \" on object store \" + t.name + \" is not indexed\");\n return n;\n}\nfunction Mt(e, t, n) {\n const r = Ft(e, t.schema);\n return t.openCursor({\n trans: n,\n values: !e.keysOnly,\n reverse: \"prev\" === e.dir,\n unique: !!e.unique,\n query: {\n index: r,\n range: e.range\n }\n });\n}\nfunction Nt(e, t, n, r) {\n const s = e.replayFilter ? St(e.filter, e.replayFilter()) : e.filter;\n if (e.or) {\n const i = {},\n a = (e, n, r) => {\n if (!s || s(n, r, e => n.stop(e), e => n.fail(e))) {\n var a = n.primaryKey,\n u = \"\" + a;\n \"[object ArrayBuffer]\" === u && (u = \"\" + new Uint8Array(a)), o(i, u) || (i[u] = !0, t(e, n, r));\n }\n };\n return Promise.all([e.or._iterate(a, n), qt(Mt(e, r, n), e.algorithm, a, !e.keysOnly && e.valueMapper)]);\n }\n return qt(Mt(e, r, n), St(e.algorithm, s), t, !e.keysOnly && e.valueMapper);\n}\nfunction qt(e, t, n, r) {\n var s = Ye(r ? (e, t, s) => n(r(e), t, s) : n);\n return e.then(e => {\n if (e) return e.start(() => {\n var n = () => e.continue();\n t && !t(e, e => n = e, t => {\n e.stop(t), n = ee;\n }, t => {\n e.fail(t), n = ee;\n }) || s(e.value, e, e => n = e), n();\n });\n });\n}\nfunction $t(e, t) {\n try {\n const n = Ut(e),\n r = Ut(t);\n if (n !== r) return \"Array\" === n ? 1 : \"Array\" === r ? -1 : \"binary\" === n ? 1 : \"binary\" === r ? -1 : \"string\" === n ? 1 : \"string\" === r ? -1 : \"Date\" === n ? 1 : \"Date\" !== r ? NaN : -1;\n switch (n) {\n case \"number\":\n case \"Date\":\n case \"string\":\n return e > t ? 1 : e < t ? -1 : 0;\n case \"binary\":\n return function (e, t) {\n const n = e.length,\n r = t.length,\n s = n < r ? n : r;\n for (let n = 0; n < s; ++n) if (e[n] !== t[n]) return e[n] < t[n] ? -1 : 1;\n return n === r ? 0 : n < r ? -1 : 1;\n }(Lt(e), Lt(t));\n case \"Array\":\n return function (e, t) {\n const n = e.length,\n r = t.length,\n s = n < r ? n : r;\n for (let n = 0; n < s; ++n) {\n const r = $t(e[n], t[n]);\n if (0 !== r) return r;\n }\n return n === r ? 0 : n < r ? -1 : 1;\n }(e, t);\n }\n } catch (e) {}\n return NaN;\n}\nfunction Ut(e) {\n const t = typeof e;\n if (\"object\" !== t) return t;\n if (ArrayBuffer.isView(e)) return \"binary\";\n const n = C(e);\n return \"ArrayBuffer\" === n ? \"binary\" : n;\n}\nfunction Lt(e) {\n return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);\n}\nclass Vt {\n _read(e, t) {\n var n = this._ctx;\n return n.error ? n.table._trans(null, ft.bind(null, n.error)) : n.table._trans(\"readonly\", e).then(t);\n }\n _write(e) {\n var t = this._ctx;\n return t.error ? t.table._trans(null, ft.bind(null, t.error)) : t.table._trans(\"readwrite\", e, \"locked\");\n }\n _addAlgorithm(e) {\n var t = this._ctx;\n t.algorithm = St(t.algorithm, e);\n }\n _iterate(e, t) {\n return Nt(this._ctx, e, t, this._ctx.table.core);\n }\n clone(e) {\n var t = Object.create(this.constructor.prototype),\n n = Object.create(this._ctx);\n return e && r(n, e), t._ctx = n, t;\n }\n raw() {\n return this._ctx.valueMapper = null, this;\n }\n each(e) {\n var t = this._ctx;\n return this._read(n => Nt(t, e, n, t.table.core));\n }\n count(e) {\n return this._read(e => {\n const t = this._ctx,\n n = t.table.core;\n if (Bt(t, !0)) return n.count({\n trans: e,\n query: {\n index: Ft(t, n.schema),\n range: t.range\n }\n }).then(e => Math.min(e, t.limit));\n var r = 0;\n return Nt(t, () => (++r, !1), e, n).then(() => r);\n }).then(e);\n }\n sortBy(e, t) {\n const n = e.split(\".\").reverse(),\n r = n[0],\n s = n.length - 1;\n function i(e, t) {\n return t ? i(e[n[t]], t - 1) : e[r];\n }\n var o = \"next\" === this._ctx.dir ? 1 : -1;\n function a(e, t) {\n var n = i(e, s),\n r = i(t, s);\n return n < r ? -o : n > r ? o : 0;\n }\n return this.toArray(function (e) {\n return e.sort(a);\n }).then(t);\n }\n toArray(e) {\n return this._read(e => {\n var t = this._ctx;\n if (\"next\" === t.dir && Bt(t, !0) && t.limit > 0) {\n const {\n valueMapper: n\n } = t,\n r = Ft(t, t.table.core.schema);\n return t.table.core.query({\n trans: e,\n limit: t.limit,\n values: !0,\n query: {\n index: r,\n range: t.range\n }\n }).then(({\n result: e\n }) => n ? e.map(n) : e);\n }\n {\n const n = [];\n return Nt(t, e => n.push(e), e, t.table.core).then(() => n);\n }\n }, e);\n }\n offset(e) {\n var t = this._ctx;\n return e <= 0 || (t.offset += e, Bt(t) ? Rt(t, () => {\n var t = e;\n return (e, n) => 0 === t || (1 === t ? (--t, !1) : (n(() => {\n e.advance(t), t = 0;\n }), !1));\n }) : Rt(t, () => {\n var t = e;\n return () => --t < 0;\n })), this;\n }\n limit(e) {\n return this._ctx.limit = Math.min(this._ctx.limit, e), Rt(this._ctx, () => {\n var t = e;\n return function (e, n, r) {\n return --t <= 0 && n(r), t >= 0;\n };\n }, !0), this;\n }\n until(e, t) {\n return Tt(this._ctx, function (n, r, s) {\n return !e(n.value) || (r(s), t);\n }), this;\n }\n first(e) {\n return this.limit(1).toArray(function (e) {\n return e[0];\n }).then(e);\n }\n last(e) {\n return this.reverse().first(e);\n }\n filter(e) {\n var t, n;\n return Tt(this._ctx, function (t) {\n return e(t.value);\n }), t = this._ctx, n = e, t.isMatch = St(t.isMatch, n), this;\n }\n and(e) {\n return this.filter(e);\n }\n or(e) {\n return new this.db.WhereClause(this._ctx.table, e, this);\n }\n reverse() {\n return this._ctx.dir = \"prev\" === this._ctx.dir ? \"next\" : \"prev\", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;\n }\n desc() {\n return this.reverse();\n }\n eachKey(e) {\n var t = this._ctx;\n return t.keysOnly = !t.isMatch, this.each(function (t, n) {\n e(n.key, n);\n });\n }\n eachUniqueKey(e) {\n return this._ctx.unique = \"unique\", this.eachKey(e);\n }\n eachPrimaryKey(e) {\n var t = this._ctx;\n return t.keysOnly = !t.isMatch, this.each(function (t, n) {\n e(n.primaryKey, n);\n });\n }\n keys(e) {\n var t = this._ctx;\n t.keysOnly = !t.isMatch;\n var n = [];\n return this.each(function (e, t) {\n n.push(t.key);\n }).then(function () {\n return n;\n }).then(e);\n }\n primaryKeys(e) {\n var t = this._ctx;\n if (\"next\" === t.dir && Bt(t, !0) && t.limit > 0) return this._read(e => {\n var n = Ft(t, t.table.core.schema);\n return t.table.core.query({\n trans: e,\n values: !1,\n limit: t.limit,\n query: {\n index: n,\n range: t.range\n }\n });\n }).then(({\n result: e\n }) => e).then(e);\n t.keysOnly = !t.isMatch;\n var n = [];\n return this.each(function (e, t) {\n n.push(t.primaryKey);\n }).then(function () {\n return n;\n }).then(e);\n }\n uniqueKeys(e) {\n return this._ctx.unique = \"unique\", this.keys(e);\n }\n firstKey(e) {\n return this.limit(1).keys(function (e) {\n return e[0];\n }).then(e);\n }\n lastKey(e) {\n return this.reverse().firstKey(e);\n }\n distinct() {\n var e = this._ctx,\n t = e.index && e.table.schema.idxByName[e.index];\n if (!t || !t.multi) return this;\n var n = {};\n return Tt(this._ctx, function (e) {\n var t = e.primaryKey.toString(),\n r = o(n, t);\n return n[t] = !0, !r;\n }), this;\n }\n modify(e) {\n var n = this._ctx;\n return this._write(r => {\n var s;\n if (\"function\" == typeof e) s = e;else {\n var i = t(e),\n o = i.length;\n s = function (t) {\n for (var n = !1, r = 0; r < o; ++r) {\n var s = i[r],\n a = e[s];\n b(t, s) !== a && (_(t, s, a), n = !0);\n }\n return n;\n };\n }\n const a = n.table.core,\n {\n outbound: u,\n extractKey: l\n } = a.schema.primaryKey,\n c = this.db._options.modifyChunkSize || 200,\n h = [];\n let d = 0;\n const f = [],\n p = (e, n) => {\n const {\n failures: r,\n numFailures: s\n } = n;\n d += e - s;\n for (let e of t(r)) h.push(r[e]);\n };\n return this.clone().primaryKeys().then(t => {\n const i = o => {\n const h = Math.min(c, t.length - o);\n return a.getMany({\n trans: r,\n keys: t.slice(o, o + h),\n cache: \"immutable\"\n }).then(d => {\n const f = [],\n y = [],\n m = u ? [] : null,\n v = [];\n for (let e = 0; e < h; ++e) {\n const n = d[e],\n r = {\n value: O(n),\n primKey: t[o + e]\n };\n !1 !== s.call(r, r.value, r) && (null == r.value ? v.push(t[o + e]) : u || 0 === $t(l(n), l(r.value)) ? (y.push(r.value), u && m.push(t[o + e])) : (v.push(t[o + e]), f.push(r.value)));\n }\n const g = Bt(n) && n.limit === 1 / 0 && (\"function\" != typeof e || e === Wt) && {\n index: n.index,\n range: n.range\n };\n return Promise.resolve(f.length > 0 && a.mutate({\n trans: r,\n type: \"add\",\n values: f\n }).then(e => {\n for (let t in e.failures) v.splice(parseInt(t), 1);\n p(f.length, e);\n })).then(() => (y.length > 0 || g && \"object\" == typeof e) && a.mutate({\n trans: r,\n type: \"put\",\n keys: m,\n values: y,\n criteria: g,\n changeSpec: \"function\" != typeof e && e\n }).then(e => p(y.length, e))).then(() => (v.length > 0 || g && e === Wt) && a.mutate({\n trans: r,\n type: \"delete\",\n keys: v,\n criteria: g\n }).then(e => p(v.length, e))).then(() => t.length > o + h && i(o + c));\n });\n };\n return i(0).then(() => {\n if (h.length > 0) throw new z(\"Error modifying one or more objects\", h, d, f);\n return t.length;\n });\n });\n });\n }\n delete() {\n var e = this._ctx,\n t = e.range;\n return Bt(e) && (e.isPrimKey && !kt || 3 === t.type) ? this._write(n => {\n const {\n primaryKey: r\n } = e.table.core.schema,\n s = t;\n return e.table.core.count({\n trans: n,\n query: {\n index: r,\n range: s\n }\n }).then(t => e.table.core.mutate({\n trans: n,\n type: \"deleteRange\",\n range: s\n }).then(({\n failures: e,\n lastResult: n,\n results: r,\n numFailures: s\n }) => {\n if (s) throw new z(\"Could not delete some values\", Object.keys(e).map(t => e[t]), t - s);\n return t - s;\n }));\n }) : this.modify(Wt);\n }\n}\nconst Wt = (e, t) => t.value = null;\nfunction Yt(e, t) {\n return e < t ? -1 : e === t ? 0 : 1;\n}\nfunction zt(e, t) {\n return e > t ? -1 : e === t ? 0 : 1;\n}\nfunction Gt(e, t, n) {\n var r = e instanceof en ? new e.Collection(e) : e;\n return r._ctx.error = n ? new n(t) : new TypeError(t), r;\n}\nfunction Ht(e) {\n return new e.Collection(e, () => Zt(\"\")).limit(0);\n}\nfunction Qt(e, t, n, r, s, i) {\n for (var o = Math.min(e.length, r.length), a = -1, u = 0; u < o; ++u) {\n var l = t[u];\n if (l !== r[u]) return s(e[u], n[u]) < 0 ? e.substr(0, u) + n[u] + n.substr(u + 1) : s(e[u], r[u]) < 0 ? e.substr(0, u) + r[u] + n.substr(u + 1) : a >= 0 ? e.substr(0, a) + t[a] + n.substr(a + 1) : null;\n s(e[u], l) < 0 && (a = u);\n }\n return o < r.length && \"next\" === i ? e + n.substr(e.length) : o < e.length && \"prev\" === i ? e.substr(0, n.length) : a < 0 ? null : e.substr(0, a) + r[a] + n.substr(a + 1);\n}\nfunction Xt(e, t, n, r) {\n var s,\n i,\n o,\n a,\n u,\n l,\n c,\n h = n.length;\n if (!n.every(e => \"string\" == typeof e)) return Gt(e, bt);\n function d(e) {\n s = function (e) {\n return \"next\" === e ? e => e.toUpperCase() : e => e.toLowerCase();\n }(e), i = function (e) {\n return \"next\" === e ? e => e.toLowerCase() : e => e.toUpperCase();\n }(e), o = \"next\" === e ? Yt : zt;\n var t = n.map(function (e) {\n return {\n lower: i(e),\n upper: s(e)\n };\n }).sort(function (e, t) {\n return o(e.lower, t.lower);\n });\n a = t.map(function (e) {\n return e.upper;\n }), u = t.map(function (e) {\n return e.lower;\n }), l = e, c = \"next\" === e ? \"\" : r;\n }\n d(\"next\");\n var f = new e.Collection(e, () => Jt(a[0], u[h - 1] + r));\n f._ondirectionchange = function (e) {\n d(e);\n };\n var p = 0;\n return f._addAlgorithm(function (e, n, r) {\n var s = e.key;\n if (\"string\" != typeof s) return !1;\n var d = i(s);\n if (t(d, u, p)) return !0;\n for (var f = null, y = p; y < h; ++y) {\n var m = Qt(s, d, a[y], u[y], o, l);\n null === m && null === f ? p = y + 1 : (null === f || o(f, m) > 0) && (f = m);\n }\n return n(null !== f ? function () {\n e.continue(f + c);\n } : r), !1;\n }), f;\n}\nfunction Jt(e, t, n, r) {\n return {\n type: 2,\n lower: e,\n upper: t,\n lowerOpen: n,\n upperOpen: r\n };\n}\nfunction Zt(e) {\n return {\n type: 1,\n lower: e,\n upper: e\n };\n}\nclass en {\n get Collection() {\n return this._ctx.table.db.Collection;\n }\n between(e, t, n, r) {\n n = !1 !== n, r = !0 === r;\n try {\n return this._cmp(e, t) > 0 || 0 === this._cmp(e, t) && (n || r) && (!n || !r) ? Ht(this) : new this.Collection(this, () => Jt(e, t, !n, !r));\n } catch (e) {\n return Gt(this, gt);\n }\n }\n equals(e) {\n return null == e ? Gt(this, gt) : new this.Collection(this, () => Zt(e));\n }\n above(e) {\n return null == e ? Gt(this, gt) : new this.Collection(this, () => Jt(e, void 0, !0));\n }\n aboveOrEqual(e) {\n return null == e ? Gt(this, gt) : new this.Collection(this, () => Jt(e, void 0, !1));\n }\n below(e) {\n return null == e ? Gt(this, gt) : new this.Collection(this, () => Jt(void 0, e, !1, !0));\n }\n belowOrEqual(e) {\n return null == e ? Gt(this, gt) : new this.Collection(this, () => Jt(void 0, e));\n }\n startsWith(e) {\n return \"string\" != typeof e ? Gt(this, bt) : this.between(e, e + mt, !0, !0);\n }\n startsWithIgnoreCase(e) {\n return \"\" === e ? this.startsWith(e) : Xt(this, (e, t) => 0 === e.indexOf(t[0]), [e], mt);\n }\n equalsIgnoreCase(e) {\n return Xt(this, (e, t) => e === t[0], [e], \"\");\n }\n anyOfIgnoreCase() {\n var e = B.apply(I, arguments);\n return 0 === e.length ? Ht(this) : Xt(this, (e, t) => -1 !== t.indexOf(e), e, \"\");\n }\n startsWithAnyOfIgnoreCase() {\n var e = B.apply(I, arguments);\n return 0 === e.length ? Ht(this) : Xt(this, (e, t) => t.some(t => 0 === e.indexOf(t)), e, mt);\n }\n anyOf() {\n const e = B.apply(I, arguments);\n let t = this._cmp;\n try {\n e.sort(t);\n } catch (e) {\n return Gt(this, gt);\n }\n if (0 === e.length) return Ht(this);\n const n = new this.Collection(this, () => Jt(e[0], e[e.length - 1]));\n n._ondirectionchange = n => {\n t = \"next\" === n ? this._ascending : this._descending, e.sort(t);\n };\n let r = 0;\n return n._addAlgorithm((n, s, i) => {\n const o = n.key;\n for (; t(o, e[r]) > 0;) if (++r, r === e.length) return s(i), !1;\n return 0 === t(o, e[r]) || (s(() => {\n n.continue(e[r]);\n }), !1);\n }), n;\n }\n notEqual(e) {\n return this.inAnyRange([[vt, e], [e, this.db._maxKey]], {\n includeLowers: !1,\n includeUppers: !1\n });\n }\n noneOf() {\n const e = B.apply(I, arguments);\n if (0 === e.length) return new this.Collection(this);\n try {\n e.sort(this._ascending);\n } catch (e) {\n return Gt(this, gt);\n }\n const t = e.reduce((e, t) => e ? e.concat([[e[e.length - 1][1], t]]) : [[vt, t]], null);\n return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, {\n includeLowers: !1,\n includeUppers: !1\n });\n }\n inAnyRange(e, t) {\n const n = this._cmp,\n r = this._ascending,\n s = this._descending,\n i = this._min,\n o = this._max;\n if (0 === e.length) return Ht(this);\n if (!e.every(e => void 0 !== e[0] && void 0 !== e[1] && r(e[0], e[1]) <= 0)) return Gt(this, \"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower\", X.InvalidArgument);\n const a = !t || !1 !== t.includeLowers,\n u = t && !0 === t.includeUppers;\n let l,\n c = r;\n function h(e, t) {\n return c(e[0], t[0]);\n }\n try {\n l = e.reduce(function (e, t) {\n let r = 0,\n s = e.length;\n for (; r < s; ++r) {\n const s = e[r];\n if (n(t[0], s[1]) < 0 && n(t[1], s[0]) > 0) {\n s[0] = i(s[0], t[0]), s[1] = o(s[1], t[1]);\n break;\n }\n }\n return r === s && e.push(t), e;\n }, []), l.sort(h);\n } catch (e) {\n return Gt(this, gt);\n }\n let d = 0;\n const f = u ? e => r(e, l[d][1]) > 0 : e => r(e, l[d][1]) >= 0,\n p = a ? e => s(e, l[d][0]) > 0 : e => s(e, l[d][0]) >= 0;\n let y = f;\n const m = new this.Collection(this, () => Jt(l[0][0], l[l.length - 1][1], !a, !u));\n return m._ondirectionchange = e => {\n \"next\" === e ? (y = f, c = r) : (y = p, c = s), l.sort(h);\n }, m._addAlgorithm((e, t, n) => {\n for (var s = e.key; y(s);) if (++d, d === l.length) return t(n), !1;\n return !!function (e) {\n return !f(e) && !p(e);\n }(s) || (0 === this._cmp(s, l[d][1]) || 0 === this._cmp(s, l[d][0]) || t(() => {\n c === r ? e.continue(l[d][0]) : e.continue(l[d][1]);\n }), !1);\n }), m;\n }\n startsWithAnyOf() {\n const e = B.apply(I, arguments);\n return e.every(e => \"string\" == typeof e) ? 0 === e.length ? Ht(this) : this.inAnyRange(e.map(e => [e, e + mt])) : Gt(this, \"startsWithAnyOf() only works with strings\");\n }\n}\nfunction tn(e) {\n return Ye(function (t) {\n return nn(t), e(t.target.error), !1;\n });\n}\nfunction nn(e) {\n e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();\n}\nconst rn = \"storagemutated\",\n sn = \"x-storagemutated-1\",\n on = Dt(null, rn);\nclass an {\n _lock() {\n return m(!Oe.global), ++this._reculock, 1 !== this._reculock || Oe.global || (Oe.lockOwnerFor = this), this;\n }\n _unlock() {\n if (m(!Oe.global), 0 == --this._reculock) for (Oe.global || (Oe.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked();) {\n var e = this._blockedFuncs.shift();\n try {\n at(e[1], e[0]);\n } catch (e) {}\n }\n return this;\n }\n _locked() {\n return this._reculock && Oe.lockOwnerFor !== this;\n }\n create(e) {\n if (!this.mode) return this;\n const t = this.db.idbdb,\n n = this.db._state.dbOpenError;\n if (m(!this.idbtrans), !e && !t) switch (n && n.name) {\n case \"DatabaseClosedError\":\n throw new X.DatabaseClosed(n);\n case \"MissingAPIError\":\n throw new X.MissingAPI(n.message, n);\n default:\n throw new X.OpenFailed(n);\n }\n if (!this.active) throw new X.TransactionInactive();\n return m(null === this._completion._state), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }) : t.transaction(this.storeNames, this.mode, {\n durability: this.chromeTransactionDurability\n }))).onerror = Ye(t => {\n nn(t), this._reject(e.error);\n }), e.onabort = Ye(t => {\n nn(t), this.active && this._reject(new X.Abort(e.error)), this.active = !1, this.on(\"abort\").fire(t);\n }), e.oncomplete = Ye(() => {\n this.active = !1, this._resolve(), \"mutatedParts\" in e && on.storagemutated.fire(e.mutatedParts);\n }), this;\n }\n _promise(e, t, n) {\n if (\"readwrite\" === e && \"readwrite\" !== this.mode) return ft(new X.ReadOnly(\"Transaction is readonly\"));\n if (!this.active) return ft(new X.TransactionInactive());\n if (this._locked()) return new je((r, s) => {\n this._blockedFuncs.push([() => {\n this._promise(e, t, n).then(r, s);\n }, Oe]);\n });\n if (n) return Ze(() => {\n var e = new je((e, n) => {\n this._lock();\n const r = t(e, n, this);\n r && r.then && r.then(e, n);\n });\n return e.finally(() => this._unlock()), e._lib = !0, e;\n });\n var r = new je((e, n) => {\n var r = t(e, n, this);\n r && r.then && r.then(e, n);\n });\n return r._lib = !0, r;\n }\n _root() {\n return this.parent ? this.parent._root() : this;\n }\n waitFor(e) {\n var t = this._root();\n const n = je.resolve(e);\n if (t._waitingFor) t._waitingFor = t._waitingFor.then(() => n);else {\n t._waitingFor = n, t._waitingQueue = [];\n var r = t.idbtrans.objectStore(t.storeNames[0]);\n !function e() {\n for (++t._spinCount; t._waitingQueue.length;) t._waitingQueue.shift()();\n t._waitingFor && (r.get(-1 / 0).onsuccess = e);\n }();\n }\n var s = t._waitingFor;\n return new je((e, r) => {\n n.then(n => t._waitingQueue.push(Ye(e.bind(null, n))), e => t._waitingQueue.push(Ye(r.bind(null, e)))).finally(() => {\n t._waitingFor === s && (t._waitingFor = null);\n });\n });\n }\n abort() {\n this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new X.Abort()));\n }\n table(e) {\n const t = this._memoizedTables || (this._memoizedTables = {});\n if (o(t, e)) return t[e];\n const n = this.schema[e];\n if (!n) throw new X.NotFound(\"Table \" + e + \" not part of transaction\");\n const r = new this.db.Table(e, n, this);\n return r.core = this.db.core.table(e), t[e] = r, r;\n }\n}\nfunction un(e, t, n, r, s, i, o) {\n return {\n name: e,\n keyPath: t,\n unique: n,\n multi: r,\n auto: s,\n compound: i,\n src: (n && !o ? \"&\" : \"\") + (r ? \"*\" : \"\") + (s ? \"++\" : \"\") + ln(t)\n };\n}\nfunction ln(e) {\n return \"string\" == typeof e ? e : e ? \"[\" + [].join.call(e, \"+\") + \"]\" : \"\";\n}\nfunction cn(e, t, n) {\n return {\n name: e,\n primKey: t,\n indexes: n,\n mappedClass: null,\n idxByName: g(n, e => [e.name, e])\n };\n}\nlet hn = e => {\n try {\n return e.only([[]]), hn = () => [[]], [[]];\n } catch (e) {\n return hn = () => mt, mt;\n }\n};\nfunction dn(e) {\n return null == e ? () => {} : \"string\" == typeof e ? function (e) {\n const t = e.split(\".\");\n return 1 === t.length ? t => t[e] : t => b(t, e);\n }(e) : t => b(t, e);\n}\nfunction fn(e) {\n return [].slice.call(e);\n}\nlet pn = 0;\nfunction yn(e) {\n return null == e ? \":id\" : \"string\" == typeof e ? e : `[${e.join(\"+\")}]`;\n}\nfunction mn(e, t, r) {\n function s(e) {\n if (3 === e.type) return null;\n if (4 === e.type) throw new Error(\"Cannot convert never type to IDBKeyRange\");\n const {\n lower: n,\n upper: r,\n lowerOpen: s,\n upperOpen: i\n } = e;\n return void 0 === n ? void 0 === r ? null : t.upperBound(r, !!i) : void 0 === r ? t.lowerBound(n, !!s) : t.bound(n, r, !!s, !!i);\n }\n const {\n schema: i,\n hasGetAll: o\n } = function (e, t) {\n const r = fn(e.objectStoreNames);\n return {\n schema: {\n name: e.name,\n tables: r.map(e => t.objectStore(e)).map(e => {\n const {\n keyPath: t,\n autoIncrement: r\n } = e,\n s = n(t),\n i = null == t,\n o = {},\n a = {\n name: e.name,\n primaryKey: {\n name: null,\n isPrimaryKey: !0,\n outbound: i,\n compound: s,\n keyPath: t,\n autoIncrement: r,\n unique: !0,\n extractKey: dn(t)\n },\n indexes: fn(e.indexNames).map(t => e.index(t)).map(e => {\n const {\n name: t,\n unique: r,\n multiEntry: s,\n keyPath: i\n } = e,\n a = {\n name: t,\n compound: n(i),\n keyPath: i,\n unique: r,\n multiEntry: s,\n extractKey: dn(i)\n };\n return o[yn(i)] = a, a;\n }),\n getIndexByKeyPath: e => o[yn(e)]\n };\n return o[\":id\"] = a.primaryKey, null != t && (o[yn(t)] = a.primaryKey), a;\n })\n },\n hasGetAll: r.length > 0 && \"getAll\" in t.objectStore(r[0]) && !(\"undefined\" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604)\n };\n }(e, r),\n a = i.tables.map(e => function (e) {\n const t = e.name;\n return {\n name: t,\n schema: e,\n mutate: function ({\n trans: e,\n type: n,\n keys: r,\n values: i,\n range: o\n }) {\n return new Promise((a, u) => {\n a = Ye(a);\n const l = e.objectStore(t),\n c = null == l.keyPath,\n h = \"put\" === n || \"add\" === n;\n if (!h && \"delete\" !== n && \"deleteRange\" !== n) throw new Error(\"Invalid operation type: \" + n);\n const {\n length: d\n } = r || i || {\n length: 1\n };\n if (r && i && r.length !== i.length) throw new Error(\"Given keys array must have same length as given values array.\");\n if (0 === d) return a({\n numFailures: 0,\n failures: {},\n results: [],\n lastResult: void 0\n });\n let f;\n const p = [],\n y = [];\n let m = 0;\n const v = e => {\n ++m, nn(e);\n };\n if (\"deleteRange\" === n) {\n if (4 === o.type) return a({\n numFailures: m,\n failures: y,\n results: [],\n lastResult: void 0\n });\n 3 === o.type ? p.push(f = l.clear()) : p.push(f = l.delete(s(o)));\n } else {\n const [e, t] = h ? c ? [i, r] : [i, null] : [r, null];\n if (h) for (let r = 0; r < d; ++r) p.push(f = t && void 0 !== t[r] ? l[n](e[r], t[r]) : l[n](e[r])), f.onerror = v;else for (let t = 0; t < d; ++t) p.push(f = l[n](e[t])), f.onerror = v;\n }\n const g = e => {\n const t = e.target.result;\n p.forEach((e, t) => null != e.error && (y[t] = e.error)), a({\n numFailures: m,\n failures: y,\n results: \"delete\" === n ? r : p.map(e => e.result),\n lastResult: t\n });\n };\n f.onerror = e => {\n v(e), g(e);\n }, f.onsuccess = g;\n });\n },\n getMany: ({\n trans: e,\n keys: n\n }) => new Promise((r, s) => {\n r = Ye(r);\n const i = e.objectStore(t),\n o = n.length,\n a = new Array(o);\n let u,\n l = 0,\n c = 0;\n const h = e => {\n const t = e.target;\n a[t._pos] = t.result, ++c === l && r(a);\n },\n d = tn(s);\n for (let e = 0; e < o; ++e) null != n[e] && (u = i.get(n[e]), u._pos = e, u.onsuccess = h, u.onerror = d, ++l);\n 0 === l && r(a);\n }),\n get: ({\n trans: e,\n key: n\n }) => new Promise((r, s) => {\n r = Ye(r);\n const i = e.objectStore(t).get(n);\n i.onsuccess = e => r(e.target.result), i.onerror = tn(s);\n }),\n query: function (e) {\n return n => new Promise((r, i) => {\n r = Ye(r);\n const {\n trans: o,\n values: a,\n limit: u,\n query: l\n } = n,\n c = u === 1 / 0 ? void 0 : u,\n {\n index: h,\n range: d\n } = l,\n f = o.objectStore(t),\n p = h.isPrimaryKey ? f : f.index(h.name),\n y = s(d);\n if (0 === u) return r({\n result: []\n });\n if (e) {\n const e = a ? p.getAll(y, c) : p.getAllKeys(y, c);\n e.onsuccess = e => r({\n result: e.target.result\n }), e.onerror = tn(i);\n } else {\n let e = 0;\n const t = a || !(\"openKeyCursor\" in p) ? p.openCursor(y) : p.openKeyCursor(y),\n n = [];\n t.onsuccess = s => {\n const i = t.result;\n return i ? (n.push(a ? i.value : i.primaryKey), ++e === u ? r({\n result: n\n }) : void i.continue()) : r({\n result: n\n });\n }, t.onerror = tn(i);\n }\n });\n }(o),\n openCursor: function ({\n trans: e,\n values: n,\n query: r,\n reverse: i,\n unique: o\n }) {\n return new Promise((a, u) => {\n a = Ye(a);\n const {\n index: l,\n range: c\n } = r,\n h = e.objectStore(t),\n d = l.isPrimaryKey ? h : h.index(l.name),\n f = i ? o ? \"prevunique\" : \"prev\" : o ? \"nextunique\" : \"next\",\n p = n || !(\"openKeyCursor\" in d) ? d.openCursor(s(c), f) : d.openKeyCursor(s(c), f);\n p.onerror = tn(u), p.onsuccess = Ye(t => {\n const n = p.result;\n if (!n) return void a(null);\n n.___id = ++pn, n.done = !1;\n const r = n.continue.bind(n);\n let s = n.continuePrimaryKey;\n s && (s = s.bind(n));\n const i = n.advance.bind(n),\n o = () => {\n throw new Error(\"Cursor not stopped\");\n };\n n.trans = e, n.stop = n.continue = n.continuePrimaryKey = n.advance = () => {\n throw new Error(\"Cursor not started\");\n }, n.fail = Ye(u), n.next = function () {\n let e = 1;\n return this.start(() => e-- ? this.continue() : this.stop()).then(() => this);\n }, n.start = e => {\n const t = new Promise((e, t) => {\n e = Ye(e), p.onerror = tn(t), n.fail = t, n.stop = t => {\n n.stop = n.continue = n.continuePrimaryKey = n.advance = o, e(t);\n };\n }),\n a = () => {\n if (p.result) try {\n e();\n } catch (e) {\n n.fail(e);\n } else n.done = !0, n.start = () => {\n throw new Error(\"Cursor behind last entry\");\n }, n.stop();\n };\n return p.onsuccess = Ye(e => {\n p.onsuccess = a, a();\n }), n.continue = r, n.continuePrimaryKey = s, n.advance = i, a(), t;\n }, a(n);\n }, u);\n });\n },\n count({\n query: e,\n trans: n\n }) {\n const {\n index: r,\n range: i\n } = e;\n return new Promise((e, o) => {\n const a = n.objectStore(t),\n u = r.isPrimaryKey ? a : a.index(r.name),\n l = s(i),\n c = l ? u.count(l) : u.count();\n c.onsuccess = Ye(t => e(t.target.result)), c.onerror = tn(o);\n });\n }\n };\n }(e)),\n u = {};\n return a.forEach(e => u[e.name] = e), {\n stack: \"dbcore\",\n transaction: e.transaction.bind(e),\n table(e) {\n if (!u[e]) throw new Error(`Table '${e}' not found`);\n return u[e];\n },\n MIN_KEY: -1 / 0,\n MAX_KEY: hn(t),\n schema: i\n };\n}\nfunction vn({\n _novip: e\n}, t) {\n const n = t.db,\n r = function (e, t, {\n IDBKeyRange: n,\n indexedDB: r\n }, s) {\n const i = function (e, t) {\n return t.reduce((e, {\n create: t\n }) => ({\n ...e,\n ...t(e)\n }), e);\n }(mn(t, n, s), e.dbcore);\n return {\n dbcore: i\n };\n }(e._middlewares, n, e._deps, t);\n e.core = r.dbcore, e.tables.forEach(t => {\n const n = t.name;\n e.core.schema.tables.some(e => e.name === n) && (t.core = e.core.table(n), e[n] instanceof e.Table && (e[n].core = t.core));\n });\n}\nfunction gn({\n _novip: e\n}, t, n, r) {\n n.forEach(n => {\n const s = r[n];\n t.forEach(t => {\n const r = d(t, n);\n (!r || \"value\" in r && void 0 === r.value) && (t === e.Transaction.prototype || t instanceof e.Transaction ? l(t, n, {\n get() {\n return this.table(n);\n },\n set(e) {\n u(this, n, {\n value: e,\n writable: !0,\n configurable: !0,\n enumerable: !0\n });\n }\n }) : t[n] = new e.Table(n, s));\n });\n });\n}\nfunction bn({\n _novip: e\n}, t) {\n t.forEach(t => {\n for (let n in t) t[n] instanceof e.Table && delete t[n];\n });\n}\nfunction _n(e, t) {\n return e._cfg.version - t._cfg.version;\n}\nfunction wn(e, n, r, s) {\n const i = e._dbSchema,\n o = e._createTransaction(\"readwrite\", e._storeNames, i);\n o.create(r), o._completion.catch(s);\n const a = o._reject.bind(o),\n u = Oe.transless || Oe;\n Ze(() => {\n Oe.trans = o, Oe.transless = u, 0 === n ? (t(i).forEach(e => {\n kn(r, e, i[e].primKey, i[e].indexes);\n }), vn(e, r), je.follow(() => e.on.populate.fire(o)).catch(a)) : function ({\n _novip: e\n }, n, r, s) {\n const i = [],\n o = e._versions;\n let a = e._dbSchema = Pn(e, e.idbdb, s),\n u = !1;\n const l = o.filter(e => e._cfg.version >= n);\n function c() {\n return i.length ? je.resolve(i.shift()(r.idbtrans)).then(c) : je.resolve();\n }\n return l.forEach(o => {\n i.push(() => {\n const i = a,\n l = o._cfg.dbschema;\n Kn(e, i, s), Kn(e, l, s), a = e._dbSchema = l;\n const c = xn(i, l);\n c.add.forEach(e => {\n kn(s, e[0], e[1].primKey, e[1].indexes);\n }), c.change.forEach(e => {\n if (e.recreate) throw new X.Upgrade(\"Not yet support for changing primary key\");\n {\n const t = s.objectStore(e.name);\n e.add.forEach(e => En(t, e)), e.change.forEach(e => {\n t.deleteIndex(e.name), En(t, e);\n }), e.del.forEach(e => t.deleteIndex(e));\n }\n });\n const h = o._cfg.contentUpgrade;\n if (h && o._cfg.version > n) {\n vn(e, s), r._memoizedTables = {}, u = !0;\n let n = w(l);\n c.del.forEach(e => {\n n[e] = i[e];\n }), bn(e, [e.Transaction.prototype]), gn(e, [e.Transaction.prototype], t(n), n), r.schema = n;\n const o = T(h);\n let a;\n o && et();\n const d = je.follow(() => {\n if (a = h(r), a && o) {\n var e = tt.bind(null, null);\n a.then(e, e);\n }\n });\n return a && \"function\" == typeof a.then ? je.resolve(a) : d.then(() => a);\n }\n }), i.push(t => {\n if (!u || !xt) {\n !function (e, t) {\n [].slice.call(t.db.objectStoreNames).forEach(n => null == e[n] && t.db.deleteObjectStore(n));\n }(o._cfg.dbschema, t);\n }\n bn(e, [e.Transaction.prototype]), gn(e, [e.Transaction.prototype], e._storeNames, e._dbSchema), r.schema = e._dbSchema;\n });\n }), c().then(() => {\n var e, n;\n n = s, t(e = a).forEach(t => {\n n.db.objectStoreNames.contains(t) || kn(n, t, e[t].primKey, e[t].indexes);\n });\n });\n }(e, n, o, r).catch(a);\n });\n}\nfunction xn(e, t) {\n const n = {\n del: [],\n add: [],\n change: []\n };\n let r;\n for (r in e) t[r] || n.del.push(r);\n for (r in t) {\n const s = e[r],\n i = t[r];\n if (s) {\n const e = {\n name: r,\n def: i,\n recreate: !1,\n del: [],\n add: [],\n change: []\n };\n if (\"\" + (s.primKey.keyPath || \"\") != \"\" + (i.primKey.keyPath || \"\") || s.primKey.auto !== i.primKey.auto && !wt) e.recreate = !0, n.change.push(e);else {\n const t = s.idxByName,\n r = i.idxByName;\n let o;\n for (o in t) r[o] || e.del.push(o);\n for (o in r) {\n const n = t[o],\n s = r[o];\n n ? n.src !== s.src && e.change.push(s) : e.add.push(s);\n }\n (e.del.length > 0 || e.add.length > 0 || e.change.length > 0) && n.change.push(e);\n }\n } else n.add.push([r, i]);\n }\n return n;\n}\nfunction kn(e, t, n, r) {\n const s = e.db.createObjectStore(t, n.keyPath ? {\n keyPath: n.keyPath,\n autoIncrement: n.auto\n } : {\n autoIncrement: n.auto\n });\n return r.forEach(e => En(s, e)), s;\n}\nfunction En(e, t) {\n e.createIndex(t.name, t.keyPath, {\n unique: t.unique,\n multiEntry: t.multi\n });\n}\nfunction Pn(e, t, n) {\n const r = {};\n return p(t.objectStoreNames, 0).forEach(e => {\n const t = n.objectStore(e);\n let s = t.keyPath;\n const i = un(ln(s), s || \"\", !1, !1, !!t.autoIncrement, s && \"string\" != typeof s, !0),\n o = [];\n for (let e = 0; e < t.indexNames.length; ++e) {\n const n = t.index(t.indexNames[e]);\n s = n.keyPath;\n var a = un(n.name, s, !!n.unique, !!n.multiEntry, !1, s && \"string\" != typeof s, !1);\n o.push(a);\n }\n r[e] = cn(e, i, o);\n }), r;\n}\nfunction Kn({\n _novip: t\n}, n, r) {\n const s = r.db.objectStoreNames;\n for (let e = 0; e < s.length; ++e) {\n const i = s[e],\n o = r.objectStore(i);\n t._hasGetAll = \"getAll\" in o;\n for (let e = 0; e < o.indexNames.length; ++e) {\n const t = o.indexNames[e],\n r = o.index(t).keyPath,\n s = \"string\" == typeof r ? r : \"[\" + p(r).join(\"+\") + \"]\";\n if (n[i]) {\n const e = n[i].idxByName[s];\n e && (e.name = t, delete n[i].idxByName[s], n[i].idxByName[t] = e);\n }\n }\n }\n \"undefined\" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\\/|Edge\\/)/.test(navigator.userAgent) && e.WorkerGlobalScope && e instanceof e.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\\/(\\d*)/))[1] < 604 && (t._hasGetAll = !1);\n}\nclass On {\n _parseStoresSpec(e, r) {\n t(e).forEach(t => {\n if (null !== e[t]) {\n var s = e[t].split(\",\").map((e, t) => {\n const r = (e = e.trim()).replace(/([&*]|\\+\\+)/g, \"\"),\n s = /^\\[/.test(r) ? r.match(/^\\[(.*)\\]$/)[1].split(\"+\") : r;\n return un(r, s || null, /\\&/.test(e), /\\*/.test(e), /\\+\\+/.test(e), n(s), 0 === t);\n }),\n i = s.shift();\n if (i.multi) throw new X.Schema(\"Primary key cannot be multi-valued\");\n s.forEach(e => {\n if (e.auto) throw new X.Schema(\"Only primary key can be marked as autoIncrement (++)\");\n if (!e.keyPath) throw new X.Schema(\"Index must have a name and cannot be an empty string\");\n }), r[t] = cn(t, i, s);\n }\n });\n }\n stores(e) {\n const n = this.db;\n this._cfg.storesSource = this._cfg.storesSource ? r(this._cfg.storesSource, e) : e;\n const s = n._versions,\n i = {};\n let o = {};\n return s.forEach(e => {\n r(i, e._cfg.storesSource), o = e._cfg.dbschema = {}, e._parseStoresSpec(i, o);\n }), n._dbSchema = o, bn(n, [n._allTables, n, n.Transaction.prototype]), gn(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], t(o), o), n._storeNames = t(o), this;\n }\n upgrade(e) {\n return this._cfg.contentUpgrade = ue(this._cfg.contentUpgrade || ee, e), this;\n }\n}\nfunction Sn(e, t) {\n let n = e._dbNamesDB;\n return n || (n = e._dbNamesDB = new Xn(Pt, {\n addons: [],\n indexedDB: e,\n IDBKeyRange: t\n }), n.version(1).stores({\n dbnames: \"name\"\n })), n.table(\"dbnames\");\n}\nfunction An(e) {\n return e && \"function\" == typeof e.databases;\n}\nfunction Cn(e) {\n return Ze(function () {\n return Oe.letThrough = !0, e();\n });\n}\nfunction jn() {\n var e;\n return !navigator.userAgentData && /Safari\\//.test(navigator.userAgent) && !/Chrom(e|ium)\\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function (t) {\n var n = function () {\n return indexedDB.databases().finally(t);\n };\n e = setInterval(n, 100), n();\n }).finally(function () {\n return clearInterval(e);\n }) : Promise.resolve();\n}\nfunction Dn(e) {\n const n = e._state,\n {\n indexedDB: r\n } = e._deps;\n if (n.isBeingOpened || e.idbdb) return n.dbReadyPromise.then(() => n.dbOpenError ? ft(n.dbOpenError) : e);\n R && (n.openCanceller._stackHolder = q()), n.isBeingOpened = !0, n.dbOpenError = null, n.openComplete = !1;\n const s = n.openCanceller;\n function i() {\n if (n.openCanceller !== s) throw new X.DatabaseClosed(\"db.open() was cancelled\");\n }\n let o = n.dbReadyResolve,\n a = null,\n u = !1;\n return je.race([s, (\"undefined\" == typeof navigator ? je.resolve() : jn()).then(() => new je((s, o) => {\n if (i(), !r) throw new X.MissingAPI();\n const l = e.name,\n c = n.autoSchema ? r.open(l) : r.open(l, Math.round(10 * e.verno));\n if (!c) throw new X.MissingAPI();\n c.onerror = tn(o), c.onblocked = Ye(e._fireOnBlocked), c.onupgradeneeded = Ye(t => {\n if (a = c.transaction, n.autoSchema && !e._options.allowEmptyDB) {\n c.onerror = nn, a.abort(), c.result.close();\n const e = r.deleteDatabase(l);\n e.onsuccess = e.onerror = Ye(() => {\n o(new X.NoSuchDatabase(`Database ${l} doesnt exist`));\n });\n } else {\n a.onerror = tn(o);\n var s = t.oldVersion > Math.pow(2, 62) ? 0 : t.oldVersion;\n u = s < 1, e._novip.idbdb = c.result, wn(e, s / 10, a, o);\n }\n }, o), c.onsuccess = Ye(() => {\n a = null;\n const r = e._novip.idbdb = c.result,\n i = p(r.objectStoreNames);\n if (i.length > 0) try {\n const s = r.transaction(1 === (o = i).length ? o[0] : o, \"readonly\");\n n.autoSchema ? function ({\n _novip: e\n }, n, r) {\n e.verno = n.version / 10;\n const s = e._dbSchema = Pn(0, n, r);\n e._storeNames = p(n.objectStoreNames, 0), gn(e, [e._allTables], t(s), s);\n }(e, r, s) : (Kn(e, e._dbSchema, s), function (e, t) {\n const n = xn(Pn(0, e.idbdb, t), e._dbSchema);\n return !(n.add.length || n.change.some(e => e.add.length || e.change.length));\n }(e, s) || console.warn(\"Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.\")), vn(e, s);\n } catch (e) {}\n var o;\n _t.push(e), r.onversionchange = Ye(t => {\n n.vcFired = !0, e.on(\"versionchange\").fire(t);\n }), r.onclose = Ye(t => {\n e.on(\"close\").fire(t);\n }), u && function ({\n indexedDB: e,\n IDBKeyRange: t\n }, n) {\n !An(e) && n !== Pt && Sn(e, t).put({\n name: n\n }).catch(ee);\n }(e._deps, l), s();\n }, o);\n }))]).then(() => (i(), n.onReadyBeingFired = [], je.resolve(Cn(() => e.on.ready.fire(e.vip))).then(function t() {\n if (n.onReadyBeingFired.length > 0) {\n let r = n.onReadyBeingFired.reduce(ue, ee);\n return n.onReadyBeingFired = [], je.resolve(Cn(() => r(e.vip))).then(t);\n }\n }))).finally(() => {\n n.onReadyBeingFired = null, n.isBeingOpened = !1;\n }).then(() => e).catch(t => {\n n.dbOpenError = t;\n try {\n a && a.abort();\n } catch (e) {}\n return s === n.openCanceller && e._close(), ft(t);\n }).finally(() => {\n n.openComplete = !0, o();\n });\n}\nfunction In(e) {\n var t = t => e.next(t),\n r = i(t),\n s = i(t => e.throw(t));\n function i(e) {\n return t => {\n var i = e(t),\n o = i.value;\n return i.done ? o : o && \"function\" == typeof o.then ? o.then(r, s) : n(o) ? Promise.all(o).then(r, s) : r(o);\n };\n }\n return i(t)();\n}\nfunction Bn(e, t, n) {\n var r = arguments.length;\n if (r < 2) throw new X.InvalidArgument(\"Too few arguments\");\n for (var s = new Array(r - 1); --r;) s[r - 1] = arguments[r];\n return n = s.pop(), [e, k(s), n];\n}\nfunction Tn(e, t, n, r, s) {\n return je.resolve().then(() => {\n const i = Oe.transless || Oe,\n o = e._createTransaction(t, n, e._dbSchema, r),\n a = {\n trans: o,\n transless: i\n };\n if (r) o.idbtrans = r.idbtrans;else try {\n o.create(), e._state.PR1398_maxLoop = 3;\n } catch (r) {\n return r.name === H.InvalidState && e.isOpen() && --e._state.PR1398_maxLoop > 0 ? (console.warn(\"Dexie: Need to reopen db\"), e._close(), e.open().then(() => Tn(e, t, n, null, s))) : ft(r);\n }\n const u = T(s);\n let l;\n u && et();\n const c = je.follow(() => {\n if (l = s.call(o, o), l) if (u) {\n var e = tt.bind(null, null);\n l.then(e, e);\n } else \"function\" == typeof l.next && \"function\" == typeof l.throw && (l = In(l));\n }, a);\n return (l && \"function\" == typeof l.then ? je.resolve(l).then(e => o.active ? e : ft(new X.PrematureCommit(\"Transaction committed too early. See http://bit.ly/2kdckMn\"))) : c.then(() => l)).then(e => (r && o._resolve(), o._completion.then(() => e))).catch(e => (o._reject(e), ft(e)));\n });\n}\nfunction Rn(e, t, r) {\n const s = n(e) ? e.slice() : [e];\n for (let e = 0; e < r; ++e) s.push(t);\n return s;\n}\nconst Fn = {\n stack: \"dbcore\",\n name: \"VirtualIndexMiddleware\",\n level: 1,\n create: function (e) {\n return {\n ...e,\n table(t) {\n const n = e.table(t),\n {\n schema: r\n } = n,\n s = {},\n i = [];\n function o(e, t, n) {\n const r = yn(e),\n a = s[r] = s[r] || [],\n u = null == e ? 0 : \"string\" == typeof e ? 1 : e.length,\n l = t > 0,\n c = {\n ...n,\n isVirtual: l,\n keyTail: t,\n keyLength: u,\n extractKey: dn(e),\n unique: !l && n.unique\n };\n if (a.push(c), c.isPrimaryKey || i.push(c), u > 1) {\n o(2 === u ? e[0] : e.slice(0, u - 1), t + 1, n);\n }\n return a.sort((e, t) => e.keyTail - t.keyTail), c;\n }\n const a = o(r.primaryKey.keyPath, 0, r.primaryKey);\n s[\":id\"] = [a];\n for (const e of r.indexes) o(e.keyPath, 0, e);\n function u(t) {\n const n = t.query.index;\n return n.isVirtual ? {\n ...t,\n query: {\n index: n,\n range: (r = t.query.range, s = n.keyTail, {\n type: 1 === r.type ? 2 : r.type,\n lower: Rn(r.lower, r.lowerOpen ? e.MAX_KEY : e.MIN_KEY, s),\n lowerOpen: !0,\n upper: Rn(r.upper, r.upperOpen ? e.MIN_KEY : e.MAX_KEY, s),\n upperOpen: !0\n })\n }\n } : t;\n var r, s;\n }\n const l = {\n ...n,\n schema: {\n ...r,\n primaryKey: a,\n indexes: i,\n getIndexByKeyPath: function (e) {\n const t = s[yn(e)];\n return t && t[0];\n }\n },\n count: e => n.count(u(e)),\n query: e => n.query(u(e)),\n openCursor(t) {\n const {\n keyTail: r,\n isVirtual: s,\n keyLength: i\n } = t.query.index;\n if (!s) return n.openCursor(t);\n return n.openCursor(u(t)).then(n => n && function (n) {\n const s = Object.create(n, {\n continue: {\n value: function (s) {\n null != s ? n.continue(Rn(s, t.reverse ? e.MAX_KEY : e.MIN_KEY, r)) : t.unique ? n.continue(n.key.slice(0, i).concat(t.reverse ? e.MIN_KEY : e.MAX_KEY, r)) : n.continue();\n }\n },\n continuePrimaryKey: {\n value(t, s) {\n n.continuePrimaryKey(Rn(t, e.MAX_KEY, r), s);\n }\n },\n primaryKey: {\n get: () => n.primaryKey\n },\n key: {\n get() {\n const e = n.key;\n return 1 === i ? e[0] : e.slice(0, i);\n }\n },\n value: {\n get: () => n.value\n }\n });\n return s;\n }(n));\n }\n };\n return l;\n }\n };\n }\n};\nfunction Mn(e, n, r, s) {\n return r = r || {}, s = s || \"\", t(e).forEach(t => {\n if (o(n, t)) {\n var i = e[t],\n a = n[t];\n if (\"object\" == typeof i && \"object\" == typeof a && i && a) {\n const e = C(i);\n e !== C(a) ? r[s + t] = n[t] : \"Object\" === e ? Mn(i, a, r, s + t + \".\") : i !== a && (r[s + t] = n[t]);\n } else i !== a && (r[s + t] = n[t]);\n } else r[s + t] = void 0;\n }), t(n).forEach(t => {\n o(e, t) || (r[s + t] = n[t]);\n }), r;\n}\nconst Nn = {\n stack: \"dbcore\",\n name: \"HooksMiddleware\",\n level: 2,\n create: e => ({\n ...e,\n table(t) {\n const n = e.table(t),\n {\n primaryKey: r\n } = n.schema,\n s = {\n ...n,\n mutate(e) {\n const s = Oe.trans,\n {\n deleting: i,\n creating: a,\n updating: u\n } = s.table(t).hook;\n switch (e.type) {\n case \"add\":\n if (a.fire === ee) break;\n return s._promise(\"readwrite\", () => l(e), !0);\n case \"put\":\n if (a.fire === ee && u.fire === ee) break;\n return s._promise(\"readwrite\", () => l(e), !0);\n case \"delete\":\n if (i.fire === ee) break;\n return s._promise(\"readwrite\", () => l(e), !0);\n case \"deleteRange\":\n if (i.fire === ee) break;\n return s._promise(\"readwrite\", () => function (e) {\n return c(e.trans, e.range, 1e4);\n }(e), !0);\n }\n return n.mutate(e);\n function l(e) {\n const t = Oe.trans,\n s = e.keys || function (e, t) {\n return \"delete\" === t.type ? t.keys : t.keys || t.values.map(e.extractKey);\n }(r, e);\n if (!s) throw new Error(\"Keys missing\");\n return \"delete\" !== (e = \"add\" === e.type || \"put\" === e.type ? {\n ...e,\n keys: s\n } : {\n ...e\n }).type && (e.values = [...e.values]), e.keys && (e.keys = [...e.keys]), function (e, t, n) {\n return \"add\" === t.type ? Promise.resolve([]) : e.getMany({\n trans: t.trans,\n keys: n,\n cache: \"immutable\"\n });\n }(n, e, s).then(l => {\n const c = s.map((n, s) => {\n const c = l[s],\n h = {\n onerror: null,\n onsuccess: null\n };\n if (\"delete\" === e.type) i.fire.call(h, n, c, t);else if (\"add\" === e.type || void 0 === c) {\n const i = a.fire.call(h, n, e.values[s], t);\n null == n && null != i && (n = i, e.keys[s] = n, r.outbound || _(e.values[s], r.keyPath, n));\n } else {\n const r = Mn(c, e.values[s]),\n i = u.fire.call(h, r, n, c, t);\n if (i) {\n const t = e.values[s];\n Object.keys(i).forEach(e => {\n o(t, e) ? t[e] = i[e] : _(t, e, i[e]);\n });\n }\n }\n return h;\n });\n return n.mutate(e).then(({\n failures: t,\n results: n,\n numFailures: r,\n lastResult: i\n }) => {\n for (let r = 0; r < s.length; ++r) {\n const i = n ? n[r] : s[r],\n o = c[r];\n null == i ? o.onerror && o.onerror(t[r]) : o.onsuccess && o.onsuccess(\"put\" === e.type && l[r] ? e.values[r] : i);\n }\n return {\n failures: t,\n results: n,\n numFailures: r,\n lastResult: i\n };\n }).catch(e => (c.forEach(t => t.onerror && t.onerror(e)), Promise.reject(e)));\n });\n }\n function c(e, t, s) {\n return n.query({\n trans: e,\n values: !1,\n query: {\n index: r,\n range: t\n },\n limit: s\n }).then(({\n result: n\n }) => l({\n type: \"delete\",\n keys: n,\n trans: e\n }).then(r => r.numFailures > 0 ? Promise.reject(r.failures[0]) : n.length < s ? {\n failures: [],\n numFailures: 0,\n lastResult: void 0\n } : c(e, {\n ...t,\n lower: n[n.length - 1],\n lowerOpen: !0\n }, s)));\n }\n }\n };\n return s;\n }\n })\n};\nfunction qn(e, t, n) {\n try {\n if (!t) return null;\n if (t.keys.length < e.length) return null;\n const r = [];\n for (let s = 0, i = 0; s < t.keys.length && i < e.length; ++s) 0 === $t(t.keys[s], e[i]) && (r.push(n ? O(t.values[s]) : t.values[s]), ++i);\n return r.length === e.length ? r : null;\n } catch (e) {\n return null;\n }\n}\nconst $n = {\n stack: \"dbcore\",\n level: -1,\n create: e => ({\n table: t => {\n const n = e.table(t);\n return {\n ...n,\n getMany: e => {\n if (!e.cache) return n.getMany(e);\n const t = qn(e.keys, e.trans._cache, \"clone\" === e.cache);\n return t ? je.resolve(t) : n.getMany(e).then(t => (e.trans._cache = {\n keys: e.keys,\n values: \"clone\" === e.cache ? O(t) : t\n }, t));\n },\n mutate: e => (\"add\" !== e.type && (e.trans._cache = null), n.mutate(e))\n };\n }\n })\n};\nfunction Un(e) {\n return !(\"from\" in e);\n}\nconst Ln = function (e, t) {\n if (!this) {\n const t = new Ln();\n return e && \"d\" in e && r(t, e), t;\n }\n r(this, arguments.length ? {\n d: 1,\n from: e,\n to: arguments.length > 1 ? t : e\n } : {\n d: 0\n });\n};\nfunction Vn(e, t, n) {\n const s = $t(t, n);\n if (isNaN(s)) return;\n if (s > 0) throw RangeError();\n if (Un(e)) return r(e, {\n from: t,\n to: n,\n d: 1\n });\n const i = e.l,\n o = e.r;\n if ($t(n, e.from) < 0) return i ? Vn(i, t, n) : e.l = {\n from: t,\n to: n,\n d: 1,\n l: null,\n r: null\n }, Gn(e);\n if ($t(t, e.to) > 0) return o ? Vn(o, t, n) : e.r = {\n from: t,\n to: n,\n d: 1,\n l: null,\n r: null\n }, Gn(e);\n $t(t, e.from) < 0 && (e.from = t, e.l = null, e.d = o ? o.d + 1 : 1), $t(n, e.to) > 0 && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1);\n const a = !e.r;\n i && !e.l && Wn(e, i), o && a && Wn(e, o);\n}\nfunction Wn(e, t) {\n Un(t) || function e(t, {\n from: n,\n to: r,\n l: s,\n r: i\n }) {\n Vn(t, n, r), s && e(t, s), i && e(t, i);\n }(e, t);\n}\nfunction Yn(e, t) {\n const n = zn(t);\n let r = n.next();\n if (r.done) return !1;\n let s = r.value;\n const i = zn(e);\n let o = i.next(s.from),\n a = o.value;\n for (; !r.done && !o.done;) {\n if ($t(a.from, s.to) <= 0 && $t(a.to, s.from) >= 0) return !0;\n $t(s.from, a.from) < 0 ? s = (r = n.next(a.from)).value : a = (o = i.next(s.from)).value;\n }\n return !1;\n}\nfunction zn(e) {\n let t = Un(e) ? null : {\n s: 0,\n n: e\n };\n return {\n next(e) {\n const n = arguments.length > 0;\n for (; t;) switch (t.s) {\n case 0:\n if (t.s = 1, n) for (; t.n.l && $t(e, t.n.from) < 0;) t = {\n up: t,\n n: t.n.l,\n s: 1\n };else for (; t.n.l;) t = {\n up: t,\n n: t.n.l,\n s: 1\n };\n case 1:\n if (t.s = 2, !n || $t(e, t.n.to) <= 0) return {\n value: t.n,\n done: !1\n };\n case 2:\n if (t.n.r) {\n t.s = 3, t = {\n up: t,\n n: t.n.r,\n s: 0\n };\n continue;\n }\n case 3:\n t = t.up;\n }\n return {\n done: !0\n };\n }\n };\n}\nfunction Gn(e) {\n var t, n;\n const r = ((null === (t = e.r) || void 0 === t ? void 0 : t.d) || 0) - ((null === (n = e.l) || void 0 === n ? void 0 : n.d) || 0),\n s = r > 1 ? \"r\" : r < -1 ? \"l\" : \"\";\n if (s) {\n const t = \"r\" === s ? \"l\" : \"r\",\n n = {\n ...e\n },\n r = e[s];\n e.from = r.from, e.to = r.to, e[s] = r[s], n[s] = r[t], e[t] = n, n.d = Hn(n);\n }\n e.d = Hn(e);\n}\nfunction Hn({\n r: e,\n l: t\n}) {\n return (e ? t ? Math.max(e.d, t.d) : e.d : t ? t.d : 0) + 1;\n}\na(Ln.prototype, {\n add(e) {\n return Wn(this, e), this;\n },\n addKey(e) {\n return Vn(this, e, e), this;\n },\n addKeys(e) {\n return e.forEach(e => Vn(this, e, e)), this;\n },\n [j]() {\n return zn(this);\n }\n});\nconst Qn = {\n stack: \"dbcore\",\n level: 0,\n create: e => {\n const r = e.schema.name,\n s = new Ln(e.MIN_KEY, e.MAX_KEY);\n return {\n ...e,\n table: i => {\n const o = e.table(i),\n {\n schema: a\n } = o,\n {\n primaryKey: u\n } = a,\n {\n extractKey: l,\n outbound: c\n } = u,\n h = {\n ...o,\n mutate: e => {\n const t = e.trans,\n u = t.mutatedParts || (t.mutatedParts = {}),\n l = e => {\n const t = `idb://${r}/${i}/${e}`;\n return u[t] || (u[t] = new Ln());\n },\n c = l(\"\"),\n h = l(\":dels\"),\n {\n type: d\n } = e;\n let [f, p] = \"deleteRange\" === e.type ? [e.range] : \"delete\" === e.type ? [e.keys] : e.values.length < 50 ? [[], e.values] : [];\n const y = e.trans._cache;\n return o.mutate(e).then(e => {\n if (n(f)) {\n \"delete\" !== d && (f = e.results), c.addKeys(f);\n const t = qn(f, y);\n t || \"add\" === d || h.addKeys(f), (t || p) && function (e, t, r, s) {\n function i(t) {\n const i = e(t.name || \"\");\n function o(e) {\n return null != e ? t.extractKey(e) : null;\n }\n const a = e => t.multiEntry && n(e) ? e.forEach(e => i.addKey(e)) : i.addKey(e);\n (r || s).forEach((e, t) => {\n const n = r && o(r[t]),\n i = s && o(s[t]);\n 0 !== $t(n, i) && (null != n && a(n), null != i && a(i));\n });\n }\n t.indexes.forEach(i);\n }(l, a, t, p);\n } else if (f) {\n const e = {\n from: f.lower,\n to: f.upper\n };\n h.add(e), c.add(e);\n } else c.add(s), h.add(s), a.indexes.forEach(e => l(e.name).add(s));\n return e;\n });\n }\n },\n d = ({\n query: {\n index: t,\n range: n\n }\n }) => {\n var r, s;\n return [t, new Ln(null !== (r = n.lower) && void 0 !== r ? r : e.MIN_KEY, null !== (s = n.upper) && void 0 !== s ? s : e.MAX_KEY)];\n },\n f = {\n get: e => [u, new Ln(e.key)],\n getMany: e => [u, new Ln().addKeys(e.keys)],\n count: d,\n query: d,\n openCursor: d\n };\n return t(f).forEach(e => {\n h[e] = function (t) {\n const {\n subscr: n\n } = Oe;\n if (n) {\n const a = e => {\n const t = `idb://${r}/${i}/${e}`;\n return n[t] || (n[t] = new Ln());\n },\n u = a(\"\"),\n h = a(\":dels\"),\n [d, p] = f[e](t);\n if (a(d.name || \"\").add(p), !d.isPrimaryKey) {\n if (\"count\" !== e) {\n const n = \"query\" === e && c && t.values && o.query({\n ...t,\n values: !1\n });\n return o[e].apply(this, arguments).then(r => {\n if (\"query\" === e) {\n if (c && t.values) return n.then(({\n result: e\n }) => (u.addKeys(e), r));\n const e = t.values ? r.result.map(l) : r.result;\n t.values ? u.addKeys(e) : h.addKeys(e);\n } else if (\"openCursor\" === e) {\n const e = r,\n n = t.values;\n return e && Object.create(e, {\n key: {\n get: () => (h.addKey(e.primaryKey), e.key)\n },\n primaryKey: {\n get() {\n const t = e.primaryKey;\n return h.addKey(t), t;\n }\n },\n value: {\n get: () => (n && u.addKey(e.primaryKey), e.value)\n }\n });\n }\n return r;\n });\n }\n h.add(s);\n }\n }\n return o[e].apply(this, arguments);\n };\n }), h;\n }\n };\n }\n};\nclass Xn {\n constructor(e, t) {\n this._middlewares = {}, this.verno = 0;\n const n = Xn.dependencies;\n this._options = t = {\n addons: Xn.addons,\n autoOpen: !0,\n indexedDB: n.indexedDB,\n IDBKeyRange: n.IDBKeyRange,\n ...t\n }, this._deps = {\n indexedDB: t.indexedDB,\n IDBKeyRange: t.IDBKeyRange\n };\n const {\n addons: r\n } = t;\n this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;\n const s = {\n dbOpenError: null,\n isBeingOpened: !1,\n onReadyBeingFired: null,\n openComplete: !1,\n dbReadyResolve: ee,\n dbReadyPromise: null,\n cancelOpen: ee,\n openCanceller: null,\n autoSchema: !0,\n PR1398_maxLoop: 3\n };\n var i;\n s.dbReadyPromise = new je(e => {\n s.dbReadyResolve = e;\n }), s.openCanceller = new je((e, t) => {\n s.cancelOpen = t;\n }), this._state = s, this.name = e, this.on = Dt(this, \"populate\", \"blocked\", \"versionchange\", \"close\", {\n ready: [ue, ee]\n }), this.on.ready.subscribe = y(this.on.ready.subscribe, e => (t, n) => {\n Xn.vip(() => {\n const r = this._state;\n if (r.openComplete) r.dbOpenError || je.resolve().then(t), n && e(t);else if (r.onReadyBeingFired) r.onReadyBeingFired.push(t), n && e(t);else {\n e(t);\n const r = this;\n n || e(function e() {\n r.on.ready.unsubscribe(t), r.on.ready.unsubscribe(e);\n });\n }\n });\n }), this.Collection = (i = this, It(Vt.prototype, function (e, t) {\n this.db = i;\n let n = At,\n r = null;\n if (t) try {\n n = t();\n } catch (e) {\n r = e;\n }\n const s = e._ctx,\n o = s.table,\n a = o.hook.reading.fire;\n this._ctx = {\n table: o,\n index: s.index,\n isPrimKey: !s.index || o.schema.primKey.keyPath && s.index === o.schema.primKey.name,\n range: n,\n keysOnly: !1,\n dir: \"next\",\n unique: \"\",\n algorithm: null,\n filter: null,\n replayFilter: null,\n justLimit: !0,\n isMatch: null,\n offset: 0,\n limit: 1 / 0,\n error: r,\n or: s.or,\n valueMapper: a !== te ? a : null\n };\n })), this.Table = function (e) {\n return It(jt.prototype, function (t, n, r) {\n this.db = e, this._tx = r, this.name = t, this.schema = n, this.hook = e._allTables[t] ? e._allTables[t].hook : Dt(null, {\n creating: [se, ee],\n reading: [ne, te],\n updating: [oe, ee],\n deleting: [ie, ee]\n });\n });\n }(this), this.Transaction = function (e) {\n return It(an.prototype, function (t, n, r, s, i) {\n this.db = e, this.mode = t, this.storeNames = n, this.schema = r, this.chromeTransactionDurability = s, this.idbtrans = null, this.on = Dt(this, \"complete\", \"error\", \"abort\"), this.parent = i || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new je((e, t) => {\n this._resolve = e, this._reject = t;\n }), this._completion.then(() => {\n this.active = !1, this.on.complete.fire();\n }, e => {\n var t = this.active;\n return this.active = !1, this.on.error.fire(e), this.parent ? this.parent._reject(e) : t && this.idbtrans && this.idbtrans.abort(), ft(e);\n });\n });\n }(this), this.Version = function (e) {\n return It(On.prototype, function (t) {\n this.db = e, this._cfg = {\n version: t,\n storesSource: null,\n dbschema: {},\n tables: {},\n contentUpgrade: null\n };\n });\n }(this), this.WhereClause = function (e) {\n return It(en.prototype, function (t, n, r) {\n this.db = e, this._ctx = {\n table: t,\n index: \":id\" === n ? null : n,\n or: r\n };\n const s = e._deps.indexedDB;\n if (!s) throw new X.MissingAPI();\n this._cmp = this._ascending = s.cmp.bind(s), this._descending = (e, t) => s.cmp(t, e), this._max = (e, t) => s.cmp(e, t) > 0 ? e : t, this._min = (e, t) => s.cmp(e, t) < 0 ? e : t, this._IDBKeyRange = e._deps.IDBKeyRange;\n });\n }(this), this.on(\"versionchange\", e => {\n e.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();\n }), this.on(\"blocked\", e => {\n !e.newVersion || e.newVersion < e.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion / 10}`);\n }), this._maxKey = hn(t.IDBKeyRange), this._createTransaction = (e, t, n, r) => new this.Transaction(e, t, n, this._options.chromeTransactionDurability, r), this._fireOnBlocked = e => {\n this.on(\"blocked\").fire(e), _t.filter(e => e.name === this.name && e !== this && !e._state.vcFired).map(t => t.on(\"versionchange\").fire(e));\n }, this.use(Fn), this.use(Nn), this.use(Qn), this.use($n), this.vip = Object.create(this, {\n _vip: {\n value: !0\n }\n }), r.forEach(e => e(this));\n }\n version(e) {\n if (isNaN(e) || e < .1) throw new X.Type(\"Given version is not a positive number\");\n if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new X.Schema(\"Cannot add version when database is open\");\n this.verno = Math.max(this.verno, e);\n const t = this._versions;\n var n = t.filter(t => t._cfg.version === e)[0];\n return n || (n = new this.Version(e), t.push(n), t.sort(_n), n.stores({}), this._state.autoSchema = !1, n);\n }\n _whenReady(e) {\n return this.idbdb && (this._state.openComplete || Oe.letThrough || this._vip) ? e() : new je((e, t) => {\n if (this._state.openComplete) return t(new X.DatabaseClosed(this._state.dbOpenError));\n if (!this._state.isBeingOpened) {\n if (!this._options.autoOpen) return void t(new X.DatabaseClosed());\n this.open().catch(ee);\n }\n this._state.dbReadyPromise.then(e, t);\n }).then(e);\n }\n use({\n stack: e,\n create: t,\n level: n,\n name: r\n }) {\n r && this.unuse({\n stack: e,\n name: r\n });\n const s = this._middlewares[e] || (this._middlewares[e] = []);\n return s.push({\n stack: e,\n create: t,\n level: null == n ? 10 : n,\n name: r\n }), s.sort((e, t) => e.level - t.level), this;\n }\n unuse({\n stack: e,\n name: t,\n create: n\n }) {\n return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter(e => n ? e.create !== n : !!t && e.name !== t)), this;\n }\n open() {\n return Dn(this);\n }\n _close() {\n const e = this._state,\n t = _t.indexOf(this);\n if (t >= 0 && _t.splice(t, 1), this.idbdb) {\n try {\n this.idbdb.close();\n } catch (e) {}\n this._novip.idbdb = null;\n }\n e.dbReadyPromise = new je(t => {\n e.dbReadyResolve = t;\n }), e.openCanceller = new je((t, n) => {\n e.cancelOpen = n;\n });\n }\n close() {\n this._close();\n const e = this._state;\n this._options.autoOpen = !1, e.dbOpenError = new X.DatabaseClosed(), e.isBeingOpened && e.cancelOpen(e.dbOpenError);\n }\n delete() {\n const e = arguments.length > 0,\n t = this._state;\n return new je((n, r) => {\n const s = () => {\n this.close();\n var e = this._deps.indexedDB.deleteDatabase(this.name);\n e.onsuccess = Ye(() => {\n !function ({\n indexedDB: e,\n IDBKeyRange: t\n }, n) {\n !An(e) && n !== Pt && Sn(e, t).delete(n).catch(ee);\n }(this._deps, this.name), n();\n }), e.onerror = tn(r), e.onblocked = this._fireOnBlocked;\n };\n if (e) throw new X.InvalidArgument(\"Arguments not allowed in db.delete()\");\n t.isBeingOpened ? t.dbReadyPromise.then(s) : s();\n });\n }\n backendDB() {\n return this.idbdb;\n }\n isOpen() {\n return null !== this.idbdb;\n }\n hasBeenClosed() {\n const e = this._state.dbOpenError;\n return e && \"DatabaseClosed\" === e.name;\n }\n hasFailed() {\n return null !== this._state.dbOpenError;\n }\n dynamicallyOpened() {\n return this._state.autoSchema;\n }\n get tables() {\n return t(this._allTables).map(e => this._allTables[e]);\n }\n transaction() {\n const e = Bn.apply(this, arguments);\n return this._transaction.apply(this, e);\n }\n _transaction(e, t, n) {\n let r = Oe.trans;\n r && r.db === this && -1 === e.indexOf(\"!\") || (r = null);\n const s = -1 !== e.indexOf(\"?\");\n let i, o;\n e = e.replace(\"!\", \"\").replace(\"?\", \"\");\n try {\n if (o = t.map(e => {\n var t = e instanceof this.Table ? e.name : e;\n if (\"string\" != typeof t) throw new TypeError(\"Invalid table argument to Dexie.transaction(). Only Table or String are allowed\");\n return t;\n }), \"r\" == e || e === Kt) i = Kt;else {\n if (\"rw\" != e && e != Ot) throw new X.InvalidArgument(\"Invalid transaction mode: \" + e);\n i = Ot;\n }\n if (r) {\n if (r.mode === Kt && i === Ot) {\n if (!s) throw new X.SubTransaction(\"Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY\");\n r = null;\n }\n r && o.forEach(e => {\n if (r && -1 === r.storeNames.indexOf(e)) {\n if (!s) throw new X.SubTransaction(\"Table \" + e + \" not included in parent transaction.\");\n r = null;\n }\n }), s && r && !r.active && (r = null);\n }\n } catch (e) {\n return r ? r._promise(null, (t, n) => {\n n(e);\n }) : ft(e);\n }\n const a = Tn.bind(null, this, i, o, r, n);\n return r ? r._promise(i, a, \"lock\") : Oe.trans ? at(Oe.transless, () => this._whenReady(a)) : this._whenReady(a);\n }\n table(e) {\n if (!o(this._allTables, e)) throw new X.InvalidTable(`Table ${e} does not exist`);\n return this._allTables[e];\n }\n}\nconst Jn = \"undefined\" != typeof Symbol && \"observable\" in Symbol ? Symbol.observable : \"@@observable\";\nclass Zn {\n constructor(e) {\n this._subscribe = e;\n }\n subscribe(e, t, n) {\n return this._subscribe(e && \"function\" != typeof e ? e : {\n next: e,\n error: t,\n complete: n\n });\n }\n [Jn]() {\n return this;\n }\n}\nfunction er(e, n) {\n return t(n).forEach(t => {\n Wn(e[t] || (e[t] = new Ln()), n[t]);\n }), e;\n}\nfunction tr(e) {\n let n,\n r = !1;\n const s = new Zn(s => {\n const i = T(e);\n let o = !1,\n a = {},\n u = {};\n const l = {\n get closed() {\n return o;\n },\n unsubscribe: () => {\n o = !0, on.storagemutated.unsubscribe(f);\n }\n };\n s.start && s.start(l);\n let c = !1,\n h = !1;\n function d() {\n return t(u).some(e => a[e] && Yn(a[e], u[e]));\n }\n const f = e => {\n er(a, e), d() && p();\n },\n p = () => {\n if (c || o) return;\n a = {};\n const t = {},\n y = function (t) {\n i && et();\n const n = () => Ze(e, {\n subscr: t,\n trans: null\n }),\n r = Oe.trans ? at(Oe.transless, n) : n();\n return i && r.then(tt, tt), r;\n }(t);\n h || (on(rn, f), h = !0), c = !0, Promise.resolve(y).then(e => {\n r = !0, n = e, c = !1, o || (d() ? p() : (a = {}, u = t, s.next && s.next(e)));\n }, e => {\n c = !1, r = !1, s.error && s.error(e), l.unsubscribe();\n });\n };\n return p(), l;\n });\n return s.hasValue = () => r, s.getValue = () => n, s;\n}\nlet nr;\ntry {\n nr = {\n indexedDB: e.indexedDB || e.mozIndexedDB || e.webkitIndexedDB || e.msIndexedDB,\n IDBKeyRange: e.IDBKeyRange || e.webkitIDBKeyRange\n };\n} catch (e) {\n nr = {\n indexedDB: null,\n IDBKeyRange: null\n };\n}\nconst rr = Xn;\nfunction sr(e) {\n let t = ir;\n try {\n ir = !0, on.storagemutated.fire(e);\n } finally {\n ir = t;\n }\n}\na(rr, {\n ...Z,\n delete: e => new rr(e, {\n addons: []\n }).delete(),\n exists: e => new rr(e, {\n addons: []\n }).open().then(e => (e.close(), !0)).catch(\"NoSuchDatabaseError\", () => !1),\n getDatabaseNames(e) {\n try {\n return function ({\n indexedDB: e,\n IDBKeyRange: t\n }) {\n return An(e) ? Promise.resolve(e.databases()).then(e => e.map(e => e.name).filter(e => e !== Pt)) : Sn(e, t).toCollection().primaryKeys();\n }(rr.dependencies).then(e);\n } catch (e) {\n return ft(new X.MissingAPI());\n }\n },\n defineClass: () => function (e) {\n r(this, e);\n },\n ignoreTransaction: e => Oe.trans ? at(Oe.transless, e) : e(),\n vip: Cn,\n async: function (e) {\n return function () {\n try {\n var t = In(e.apply(this, arguments));\n return t && \"function\" == typeof t.then ? t : je.resolve(t);\n } catch (e) {\n return ft(e);\n }\n };\n },\n spawn: function (e, t, n) {\n try {\n var r = In(e.apply(n, t || []));\n return r && \"function\" == typeof r.then ? r : je.resolve(r);\n } catch (e) {\n return ft(e);\n }\n },\n currentTransaction: {\n get: () => Oe.trans || null\n },\n waitFor: function (e, t) {\n const n = je.resolve(\"function\" == typeof e ? rr.ignoreTransaction(e) : e).timeout(t || 6e4);\n return Oe.trans ? Oe.trans.waitFor(n) : n;\n },\n Promise: je,\n debug: {\n get: () => R,\n set: e => {\n F(e, \"dexie\" === e ? () => !0 : Et);\n }\n },\n derive: c,\n extend: r,\n props: a,\n override: y,\n Events: Dt,\n on: on,\n liveQuery: tr,\n extendObservabilitySet: er,\n getByKeyPath: b,\n setByKeyPath: _,\n delByKeyPath: function (e, t) {\n \"string\" == typeof t ? _(e, t, void 0) : \"length\" in t && [].map.call(t, function (t) {\n _(e, t, void 0);\n });\n },\n shallowClone: w,\n deepClone: O,\n getObjectDiff: Mn,\n cmp: $t,\n asap: v,\n minKey: vt,\n addons: [],\n connections: _t,\n errnames: H,\n dependencies: nr,\n semVer: yt,\n version: yt.split(\".\").map(e => parseInt(e)).reduce((e, t, n) => e + t / Math.pow(10, 2 * n))\n}), rr.maxKey = hn(rr.dependencies.IDBKeyRange), \"undefined\" != typeof dispatchEvent && \"undefined\" != typeof addEventListener && (on(rn, e => {\n if (!ir) {\n let t;\n wt ? (t = document.createEvent(\"CustomEvent\"), t.initCustomEvent(sn, !0, !0, e)) : t = new CustomEvent(sn, {\n detail: e\n }), ir = !0, dispatchEvent(t), ir = !1;\n }\n}), addEventListener(sn, ({\n detail: e\n}) => {\n ir || sr(e);\n}));\nlet ir = !1;\nif (\"undefined\" != typeof BroadcastChannel) {\n const e = new BroadcastChannel(sn);\n \"function\" == typeof e.unref && e.unref(), on(rn, t => {\n ir || e.postMessage(t);\n }), e.onmessage = e => {\n e.data && sr(e.data);\n };\n} else if (\"undefined\" != typeof self && \"undefined\" != typeof navigator) {\n on(rn, e => {\n try {\n ir || (\"undefined\" != typeof localStorage && localStorage.setItem(sn, JSON.stringify({\n trig: Math.random(),\n changedParts: e\n })), \"object\" == typeof self.clients && [...self.clients.matchAll({\n includeUncontrolled: !0\n })].forEach(t => t.postMessage({\n type: sn,\n changedParts: e\n })));\n } catch (e) {}\n }), \"undefined\" != typeof addEventListener && addEventListener(\"storage\", e => {\n if (e.key === sn) {\n const t = JSON.parse(e.newValue);\n t && sr(t.changedParts);\n }\n });\n const e = self.document && navigator.serviceWorker;\n e && e.addEventListener(\"message\", function ({\n data: e\n }) {\n e && e.type === sn && sr(e.changedParts);\n });\n}\nje.rejectionMapper = function (e, t) {\n if (!e || e instanceof W || e instanceof TypeError || e instanceof SyntaxError || !e.name || !J[e.name]) return e;\n var n = new J[e.name](t || e.message, e);\n return \"stack\" in e && l(n, \"stack\", {\n get: function () {\n return this.inner.stack;\n }\n }), n;\n}, F(R, Et);\nexport { Xn as Dexie, Ln as RangeSet, Xn as default, tr as liveQuery, Wn as mergeRanges, Yn as rangesOverlap };\n","import Dexie, { Table } from 'dexie';\r\nimport { FarmModel } from '../models/farm.model';\r\nimport { MemberModel } from '../models/member.model';\r\n\r\nexport interface TodoList {\r\n id?: number;\r\n title: string;\r\n }\r\n export interface TodoItem {\r\n id?: number;\r\n todoListId: number;\r\n title: string;\r\n done?: boolean;\r\n }\r\n\r\n export interface GenericItem {\r\n id?: number;\r\n tablename?: string;\r\n value:any;\r\n }\r\n\r\n export class AppDB extends Dexie {\r\n todoItems!: Table;\r\n todoLists!: Table;\r\n genericItems!: Table;\r\n regProfile!: Table;\r\n regFarm!: Table;\r\n \r\n constructor() {\r\n super('patgOnlineDB');\r\n this.init();\r\n }\r\n\r\n public init(){ \r\n this.version(3).stores({\r\n regProfile: 'memberIC',\r\n regFarm: '++farmId',\r\n regFarmWorker: '++farmWorkerId',\r\n todoLists: '++id',\r\n todoItems: '++id, todoListId',\r\n genericItems:'auto_id,tablename,[tablename+cardId],[tablename+farmId],[tablename+cardStatus],[tablename+memberId],[tablename+farmIsOwned],[tablename+farmIsWorked],[tablename+farmIsOwned+farmIsWorked],[tablename+stateId],[tablename+districtId],[tablename+parlimen_id],[tablename+ips_year+ips_month]',\r\n });\r\n \r\n this.on('populate', () => this.populate());\r\n }\r\n \r\n async populate() {\r\n const username = localStorage.getItem('username');\r\n if(username !== null){\r\n // add temporary table for member registration\r\n let memberModel: MemberModel = {} as MemberModel;\r\n memberModel.memberIC = username;\r\n await db.regProfile.add(memberModel);\r\n\r\n // add temporary table for Farm registration\r\n let farmModel: FarmModel = {} as FarmModel;\r\n farmModel.farmId = 1;\r\n await db.regFarm.add(farmModel);\r\n\r\n }\r\n \r\n const todoListId = await db.todoLists.add({\r\n title: 'To Do Today',\r\n });\r\n\r\n \r\n //await this.populateCard();\r\n //await this.populateFarm();\r\n\r\n await db.todoItems.bulkAdd([\r\n {\r\n todoListId,\r\n title: 'Feed the birds',\r\n },\r\n {\r\n todoListId,\r\n title: 'Watch a movie',\r\n },\r\n {\r\n todoListId,\r\n title: 'Have some sleep',\r\n },\r\n ]);\r\n }\r\n\r\n\r\n public async populateMemberInfo(){\r\n // this.memberService.getList().subscribe(data=> {\r\n // this.member=data;\r\n // let obj:any={};\r\n // obj['tablename']=\"member\";\r\n // obj['id']=this.member.memberid;\r\n // obj['value']=this.member;\r\n // // console.log(obj);\r\n // db.genericItems.add(obj);\r\n // // console.log(this.member.memberName);\r\n // //this.member=new MemberModel({data.toString()});\r\n // //console.log(this.member.memberName);\r\n // });\r\n }\r\n\r\n \r\n \r\n\r\n async populateCard(){\r\n var jsonStr='[{\"cardid\":1,\"cardno\":\"C/01/01/00001\"},{\"cardid\":10,\"cardno\":\"C/01/01/00002\"}]';\r\n var dList = JSON.parse(jsonStr);\r\n dList.forEach(function(item:any, index:any){\r\n item['tablename']='card';\r\n item['auto_id']=\"card_\" + item.cardid;\r\n }); \r\n //console.log(dList[0]);\r\n await db.genericItems.bulkAdd(dList);\r\n }\r\n\r\n async populateFarm(){\r\n var jsonStr='[{\"farmid\":1,\"no_geran\":\"F00001\"},{\"farmid\":5,\"no_geran\":\"F00002\"}]';\r\n var dList = JSON.parse(jsonStr);\r\n dList.forEach(function(item:any, index:any){\r\n item['tablename']='farm';\r\n item['auto_id']=\"farm_\"+item.farmid;\r\n }); \r\n //console.log(dList[0]);\r\n await db.genericItems.bulkAdd(dList);\r\n }\r\n\r\n }\r\n \r\n export const db = new AppDB();","export class CardModel {\r\n auto_id?: number;\r\n cardId: any;\r\n memberId: any;\r\n cardNo: any;\r\n cardStartDate: any;\r\n cardEndDate: any;\r\n cardActive: any;\r\n cardPrinted: any;\r\n cardEncoded: any;\r\n cardCollected: any;\r\n cardSerialNo: any;\r\n cardTotalFarmHectare: any;\r\n cardNotes: any;\r\n officeId: any;\r\n cardCancelled: any;\r\n cardCancelReason: any;\r\n cardCancelledBy: any;\r\n collectionDate: any;\r\n collectorIC: any;\r\n collectorIssuer: any;\r\n cardRenewed: any;\r\n cardReissued: any;\r\n cardReissuedReason: any;\r\n cardReissuedCount: any;\r\n cardRefNo: any;\r\n cardCreatedBy: any;\r\n cardCreatedDate: any;\r\n lastUpdate: any;\r\n personUpdate: any;\r\n cardExpired: any;\r\n cardReqApproval: any;\r\n cardApprovalType: any;\r\n cardApprovalReqBy: any;\r\n cardOrg: any;\r\n cardLGMSerialNo: any;\r\n cardCollectionDate: any;\r\n cardCollectionMethod: any;\r\n cardIsImm: any;\r\n cardImmYear: any;\r\n cardIsAgency: any;\r\n cardAgencyId: any;\r\n cardInProcess: any;\r\n cardCatId: any;\r\n cardReqUpdate: any;\r\n cardUpdated: any;\r\n cardSubCatId: any;\r\n cardNewChangeApplication: any;\r\n CardReqApprovalL1: any;\r\n CardBatchId: any;\r\n cardChangeSubcat: any;\r\n cardApprovedBy: any;\r\n cardStatus: any;\r\n\r\n agencyName: any;\r\n subCatName: any;\r\n restrictionDetails:any;\r\n cardStatusName:any;\r\n patgOnlineInProcess: number;\r\n patgOnlineProcessType: number;\r\n \r\n processStatus: any;\r\n}\r\n","import { BaseModel } from \"./base.model\";\r\n\r\nexport class CardHistoryModel extends BaseModel{\r\n constructor(params: Partial = {} as CardHistoryModel) {\r\n super();\r\n Object.assign(this, params);\r\n }\r\n auto_id?:number;\r\n id:any;\r\n datetime:any;\r\n cardId:any;\r\n userid:any;\r\n officeid:any;\r\n formReceivedId:any;\r\n formReceivedNo:any;\r\n actionName:any;\r\n notes:any;\r\n userfullname:any;\r\n}","import { BaseModel } from \"../base.model\";\r\n\r\nexport class MasterPaymentModel extends BaseModel {\r\n auto_id?:number;\r\n ipgType:any;\r\n iaad_id:any;\r\n ia_id:any;\r\n ia_parent:any;\r\n ips_id:any;\r\n ips_name:any;\r\n ips_year:any;\r\n ips_month:any;\r\n ia_created_date:any;\r\n ia_status_name:any;\r\n kgkPermohonan:any;\r\n beratKeringDibayar:any;\r\n NilaiPermohonan:any;\r\n amaunDibayar:any;\r\n tarikhDibayar:any;\r\n rt_id:any;\r\n jenisGetah:any;\r\n ia_isErd:any;\r\n ia_notes:any;\r\n ia_member:any;\r\n membername:any;\r\n memberic:any;\r\n memberactive:any;\r\n ia_card:any;\r\n cardno:any;\r\n cardactive:any;\r\n cardInProcess:any;\r\n stateIdCard:any;\r\n stateNameCard:any;\r\n districtIdCard:any;\r\n districtNameCard:any;\r\n subDivIdCard:any;\r\n subDivNameCard:any;\r\n subDivParlimen:any;\r\n subDivDun:any;\r\n as_id:any;\r\n as_name:any;\r\n agencyId:any;\r\n agencyName:any;\r\n officeId:any;\r\n officeName:any;\r\n ia_status:any;\r\n iaa_status:any;\r\n ib_id:any;\r\n iaa_id:any;\r\n bankfilename:any;\r\n ia_bankRemark:any;\r\n ia_bankRemarkOri:any;\r\n ibc_id:any;\r\n ibc_amount:any;\r\n ibc_new_app:any;\r\n ibc_kgk_total:any;\r\n ibc_amount_allowed:any;\r\n ibc_kgk_allowed:any;\r\n SubCatName:any;\r\n cardId:any;\r\n ia_folio:any;\r\n ia_no:any;\r\n ia_phone:any;\r\n ia_bankname:any;\r\n ia_accountno:any;\r\n cardTotalFarmHectare:any;\r\n}","\r\nimport { BaseModel } from \"./base.model\";\r\nexport class RRIMNiagaModel extends BaseModel {\r\n auto_id?: number;\r\n berat: any;\r\n beratKering: any;\r\n drc: any;\r\n harga: any;\r\n jenisGetah: any;\r\n licenseNo: any;\r\n nama: any;\r\n negeri: any;\r\n noIc: any;\r\n noPatG: any;\r\n noResit: any;\r\n pelesen: any;\r\n tarikh: any;\r\n year: any;\r\n month: any;\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable, throwError } from 'rxjs';\r\nimport { catchError, retry } from 'rxjs/operators';\r\nimport { AppDB, db } from './db';\r\nimport { MemberModel } from '../models/member.model';\r\nimport { DropDownService } from '../services/drop_down_service';\r\nimport { DropDownModel } from '../models/dropdown.model';\r\nimport { CurrentMemberService } from '../services/current-member.service';\r\nimport { FarmModel } from '../models/farm.model';\r\nimport { ModelHelper } from '../helpers/ModelHelper';\r\nimport { FarmWorkerModel } from '../models/farmworker.model';\r\nimport { CardModel } from '../models/card.model';\r\nimport { CardHistoryModel } from '../models/cardhistory.model';\r\nimport { MasterPaymentModel } from '../models/ipg/memberpayment.model';\r\nimport { RRIMNiagaModel } from '../models/rrimniaga.model';\r\nimport { MemberAgreementModel } from '../models/member-agreement.model';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class MemberDbService {\r\n member: MemberModel;\r\n farms: any = {};\r\n farmsWork: any = {};\r\n farmsWorker: any = {};\r\n farmsWorkerData: any = {};\r\n cards: any = {};\r\n agreements: any = {};\r\n card: CardModel;\r\n otheraids: any = {};\r\n rrimniaga: any = {};\r\n constructor(private currentMemberService: CurrentMemberService) {\r\n \r\n }\r\n\r\n async clearData(){\r\n db.genericItems.clear();\r\n db.regProfile.clear();\r\n db.regFarm.clear();\r\n }\r\n\r\n deleteDB(){\r\n db.delete();\r\n }\r\n\r\n \r\n public async populateMemberData() {\r\n await this.populateBasicData();\r\n await this.populateCardsActive();\r\n await this.populateCardsInActive();\r\n await this.populateCardsCancelled();\r\n await this.populateCardHistories();\r\n await this.populateFarmOwn();\r\n await this.populateFarmWork();\r\n await this.populateFarmWorkers();\r\n await this.populateFarmInActiveProcess();\r\n await this.populateAgreement();\r\n await this.populateIpgs();\r\n await this.populateRRIMNiaga();\r\n }\r\n\r\n /**\r\n * Populate basic data\r\n */\r\n public async populateBasicData() {\r\n this.currentMemberService.getInfo().subscribe((data: any) => {\r\n this.member = data;\r\n if(this.member && this.member != null){\r\n let obj: any = {};\r\n obj['tablename'] = 'member';\r\n if(this.member.memberId){\r\n obj['auto_id'] = 'member_' + this.member.memberId;\r\n }\r\n obj['value'] = this.member;\r\n //console.log(obj);\r\n db.genericItems.add(obj);\r\n }\r\n\r\n //console.log(this.member.memberName);\r\n //this.member=new MemberModel({data.toString()});\r\n //console.log(this.member.memberName);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member active cards\r\n */\r\n public async populateCardsActive() {\r\n let result = this.currentMemberService.getCardsActive().subscribe((data: any) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'card';\r\n item['auto_id'] = 'card_' + item.cardId;\r\n item['cardStatus'] = 1;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member inactive cards\r\n */\r\n public async populateCardsInActive() {\r\n let result = this.currentMemberService\r\n .getCardsInActive()\r\n .subscribe((data:any) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'card';\r\n item['auto_id'] = 'card_' + item.cardId;\r\n item['cardStatus'] = 2;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member cancelled cards\r\n */\r\n public async populateCardsCancelled() {\r\n let result = this.currentMemberService\r\n .getCardsCancelled()\r\n .subscribe((data) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'card';\r\n item['auto_id'] = 'card_' + item.cardId;\r\n item['cardStatus'] = 3;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member card histories\r\n */\r\n public async populateCardHistories() {\r\n let result = this.currentMemberService\r\n .getCardHistories()\r\n .subscribe((data) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'card_history';\r\n item['auto_id'] = 'card_history_' + item.id;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * populate member owned farms\r\n */\r\n public async populateFarmOwn() {\r\n this.currentMemberService.getFarmsOwn().subscribe((data: any) => {\r\n //console.log(data);\r\n this.farms = data;\r\n this.farms?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'farm';\r\n item['auto_id'] = 'farm_' + item.farmId;\r\n\r\n var ownTypes = [1, 2, 4, 5, 6];\r\n if (ownTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsOwned'] = 1;\r\n }\r\n\r\n var WorkTypes = [1, 3, 4, 5, 6];\r\n if (WorkTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsWorked'] = 1;\r\n }\r\n\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.farms);\r\n });\r\n }\r\n\r\n /**\r\n * populate member work on farms\r\n */\r\n public async populateFarmWork() {\r\n this.currentMemberService.getFarmsWork().subscribe((data) => {\r\n //console.log(data);\r\n this.farmsWork = data;\r\n this.farmsWork?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'farm';\r\n item['auto_id'] = 'farm_' + item.farmId;\r\n var ownTypes = [1, 2, 4, 5, 6];\r\n if (ownTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsOwned'] = 1;\r\n }\r\n\r\n var WorkTypes = [1, 3, 4, 5, 6];\r\n if (WorkTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsWorked'] = 1;\r\n }\r\n }); //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.farmsWork);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member farm workers\r\n */\r\n public async populateFarmWorkers() {\r\n let result = this.currentMemberService\r\n .getFarmsWorkers()\r\n .subscribe((data) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'farmworker';\r\n item['auto_id'] = 'farmworker_' + item.farmWorkerId;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * populate member work on farms\r\n */\r\n public async populateFarmInActiveProcess() {\r\n this.currentMemberService.getFarmsInActiveProcess().subscribe((data: any) => {\r\n //console.log(data);\r\n this.farmsWork = data;\r\n this.farmsWork?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'farm';\r\n item['auto_id'] = 'farm_' + item.farmId;\r\n var ownTypes = [1, 2, 4, 5, 6];\r\n if (ownTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsOwned'] = 1;\r\n }\r\n\r\n var WorkTypes = [1, 3, 4, 5, 6];\r\n if (WorkTypes.includes(item.farmWorkerSubCatId)) {\r\n item['farmIsWorked'] = 1;\r\n }\r\n }); //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.farmsWork);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member active cards\r\n */\r\n public async populateAgreement() {\r\n let result = this.currentMemberService.getAgreements().subscribe((data: any) => {\r\n //console.log(\"get agreement\");\r\n //console.log(data);\r\n this.agreements = data;\r\n this.agreements?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'agreement';\r\n item['auto_id'] = 'agreement_' + item.cardId;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.agreements);\r\n });\r\n }\r\n\r\n /**\r\n * Populate member ipg\r\n */\r\n public async populateIpgs() {\r\n let result = this.currentMemberService.getIpgs().subscribe((data: any) => {\r\n //console.log(data);\r\n this.cards = data;\r\n this.cards?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'ipg';\r\n item['auto_id'] = 'ipg_' + item.ia_id;\r\n });\r\n //console.log(dList[0]);\r\n db.genericItems.bulkAdd(this.cards);\r\n });\r\n }\r\n\r\n /**\r\n * Populate other aids\r\n */\r\n public async populateRRIMNiaga() {\r\n this.currentMemberService.getRRIMNiaga().subscribe((data: any) => {\r\n this.rrimniaga = data;\r\n this.rrimniaga?.forEach(function (item: any, index: any) {\r\n item['tablename'] = 'rrimniaga';\r\n item['auto_id'] = 'rrimniaga_' + item.noResit;\r\n item['year'] = parseInt(item.tarikh.substring(0, 4));\r\n });\r\n db.genericItems.bulkAdd(this.rrimniaga);\r\n });\r\n }\r\n\r\n /**\r\n * Get member\r\n * @returns member\r\n */\r\n public async getMember() {\r\n let members = await db.genericItems\r\n .where('tablename')\r\n .equals('member')\r\n .toArray();\r\n var m = new MemberModel();\r\n Object.assign(m, members[0]?.value);\r\n return m;\r\n }\r\n\r\n /**\r\n * Get member farm list\r\n * @returns member farm list\r\n */\r\n public async getFarmList(): Promise {\r\n let farms = await db.genericItems\r\n .where('tablename')\r\n .equals('farm')\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farms, FarmModel);\r\n //return list;\r\n let farmList: Array = [];\r\n farms.forEach(farm => {\r\n let m = new FarmModel();\r\n Object.assign(m, farm);\r\n farmList.push(m);\r\n });\r\n return farmList;\r\n }\r\n\r\n /**\r\n * Get member farm worker list\r\n * @returns member worker farm list\r\n */\r\n public async getFarmWorkerListByMember(memberId: any): Promise {\r\n let farmWorkers = await db.genericItems\r\n .where({ tablename: 'farmworker', memberId: memberId })\r\n .sortBy('name');\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farmWorker, FarmWorkerModel);\r\n //return list;\r\n let farmWorkerList: Array = [];\r\n farmWorkers.forEach(farm => {\r\n let m = new FarmWorkerModel();\r\n Object.assign(m, farm);\r\n farmWorkerList.push(m);\r\n });\r\n return farmWorkerList;\r\n }\r\n\r\n /**\r\n * Get member farm worker list\r\n * @returns member worker farm list\r\n */\r\n public async getFarmWorkerListByFarm(farmId: any): Promise {\r\n let farmWorkers = await db.genericItems\r\n .where({ tablename: 'farmworker', farmId: farmId })\r\n .toArray();\r\n //console.log(farms);\r\n // var list = ModelHelper.castToModelList(farmWorker, FarmWorkerModel);\r\n // return list;\r\n\r\n let farmWorkerList: Array = [];\r\n farmWorkers.forEach(farm => {\r\n let m = new FarmWorkerModel();\r\n Object.assign(m, farm);\r\n farmWorkerList.push(m);\r\n });\r\n return farmWorkerList;\r\n }\r\n\r\n /**\r\n * Get member farm worker list\r\n * @returns member worker farm list\r\n */ \r\n public async getFarmWorkerDataList(cardId: any): Promise {\r\n\r\n let farmWorker = await db.genericItems\r\n .where({ tablename: 'farmworker', cardId: cardId })\r\n .toArray();\r\n //var list = ModelHelper.castToModelList(farmWorker, FarmWorkerModel);\r\n let list: Array = [];\r\n farmWorker.forEach(farm => {\r\n let m = new FarmWorkerModel();\r\n Object.assign(m, farm);\r\n list.push(m);\r\n });\r\n\r\n //console.log(list);\r\n var farmList: FarmModel[] = [];\r\n\r\n for (let item of list) {\r\n // console.log(\"farmid 3:\" + item.farmId);\r\n let farm = await db.genericItems\r\n .where({ tablename: 'farm', farmId: item.farmId })\r\n .toArray();\r\n //var farms = ModelHelper.castToModelList(farm, FarmModel);\r\n let farms: Array = [];\r\n farm.forEach(farm1 => {\r\n let m = new FarmModel();\r\n Object.assign(m, farm1);\r\n farms.push(m);\r\n });\r\n\r\n for (let f of farms) {\r\n farmList.push(f);\r\n }\r\n }\r\n //console.log(\"farmlist 4\");\r\n //console.log(farmList);\r\n return farmList;\r\n }\r\n\r\n /**\r\n * Get card histories\r\n * @param cardId card id\r\n * @returns card histories\r\n */\r\n public async getCardHistoryByCard(cardId: any):Promise {\r\n let cardHistories = await db.genericItems\r\n .where({ tablename: 'card_history', cardId: cardId })\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(cardHistories, CardHistoryModel);\r\n let list: CardHistoryModel[] = [];\r\n cardHistories.forEach((card:any) => {\r\n let model = new CardHistoryModel();\r\n Object.assign(model, card);\r\n list.push(model);\r\n });\r\n return list;\r\n }\r\n\r\n /**\r\n * Get member ipg\r\n * @returns member ipg\r\n */\r\n public async getIpgList() {\r\n let ipgs = await db.genericItems\r\n .where({ tablename: 'ipg' })\r\n .reverse()\r\n .sortBy(\"ips_year\");\r\n\r\n //var list = ModelHelper.castToModelList(ipgs, MasterPaymentModel);\r\n let list: MasterPaymentModel[] = [];\r\n ipgs.forEach((ipg:any) => {\r\n let model = new MasterPaymentModel();\r\n Object.assign(model, ipg);\r\n list.push(model);\r\n });\r\n\r\n list.sort((a: any, b: any) => b.ips_year - a.ips_year || b.ips_month - a.ips_month);\r\n return list;\r\n //return ipgs;\r\n }\r\n\r\n /**\r\n * Get member active cards\r\n * @returns member cards\r\n */\r\n public async getCardActiveList(): Promise {\r\n let farms = await db.genericItems\r\n .where({ tablename: 'card', cardStatus: 1 })\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farms, CardModel);\r\n let list: CardModel[] = [];\r\n farms.forEach((farm:any) => {\r\n let model = new CardModel();\r\n Object.assign(model, farm);\r\n list.push(model);\r\n });\r\n return list;\r\n }\r\n\r\n /**\r\n * Get member inactive cards\r\n * @returns member cards\r\n */\r\n public async getCardInactiveList(): Promise {\r\n let farms = await db.genericItems\r\n .where({ tablename: 'card', cardStatus: 2 })\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farms, CardModel);\r\n let list: CardModel[] = [];\r\n farms.forEach((farm:any) => {\r\n let model = new CardModel();\r\n Object.assign(model, farm);\r\n list.push(model);\r\n });\r\n return list;\r\n }\r\n\r\n /**\r\n * Get member farm owned list\r\n * @returns member owned farm list\r\n */\r\n public async getFarmOwnedList(): Promise {\r\n let farms = await db.genericItems\r\n .where({ tablename: 'farm', farmIsOwned: 1 })\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farms, FarmModel);\r\n let list: FarmModel[] = [];\r\n farms.forEach((farm:any) => {\r\n let model = new FarmModel();\r\n Object.assign(model, farm);\r\n list.push(model);\r\n });\r\n return list;\r\n }\r\n\r\n\r\n /**\r\n * Get member farm work list\r\n * @returns member work farm list\r\n */\r\n public async getFarmWorkedList(): Promise {\r\n let farms = await db.genericItems\r\n .where({ tablename: 'farm', farmIsWorked: 1 })\r\n .toArray();\r\n //console.log(farms);\r\n //var list = ModelHelper.castToModelList(farms, FarmModel);\r\n let list: FarmModel[] = [];\r\n farms.forEach((farm:any) => {\r\n let model = new FarmModel();\r\n Object.assign(model, farm);\r\n list.push(model);\r\n });\r\n return list;\r\n }\r\n\r\n /**\r\n * Get member farm worker list\r\n * @returns member worker farm list\r\n */\r\n public async getRRIMNiagaList(): Promise {\r\n\r\n let rrimniaga = await db.genericItems\r\n .where({ tablename: 'rrimniaga' })\r\n .reverse()\r\n .sortBy('tarikh');\r\n //var list = ModelHelper.castToModelList(rrimniaga, RRIMNiagaModel);\r\n let list: RRIMNiagaModel[] = [];\r\n rrimniaga.forEach((rrimniagaModel:any) => {\r\n let model = new RRIMNiagaModel();\r\n Object.assign(model, rrimniagaModel);\r\n list.push(model);\r\n });\r\n\r\n //console.log(list);\r\n var rrimniagaList: RRIMNiagaModel[] = [];\r\n\r\n for (let item of list) {\r\n rrimniagaList.push(item);\r\n }\r\n return rrimniagaList;\r\n }\r\n\r\n /**\r\n * Get agreement\r\n * @returns agreementlist ipg\r\n */\r\n public async getAgreementList() {\r\n let agreements = await db.genericItems\r\n .where({ tablename: 'agreement' })\r\n .toArray();\r\n \r\n //var list = ModelHelper.castToModelList(agreements, MemberAgreementModel);\r\n let list: MemberAgreementModel[] = [];\r\n agreements.forEach((rrimniagaModel:any) => {\r\n let model = new MemberAgreementModel();\r\n Object.assign(model, rrimniagaModel);\r\n list.push(model);\r\n });\r\n var memberAgreemenentList: MemberAgreementModel[] = [];\r\n\r\n for (let item of list) {\r\n memberAgreemenentList.push(item);\r\n }\r\n //console.log(\"agreement list\");\r\n //console.log(list);\r\n return memberAgreemenentList;\r\n }\r\n}\r\n\r\n"],"mappings":"+cAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,eAAC,SAAUC,EAAMC,EAAS,CAExB,IAAIH,EAAU,CAAC,EACfG,EAAQH,CAAO,EACf,IAAII,EAASJ,EAAQ,QACrB,QAASK,KAAKL,EACZI,EAAOC,CAAC,EAAIL,EAAQK,CAAC,EAEnB,OAAOJ,IAAW,UAAY,OAAOA,GAAO,SAAY,SAC1DA,GAAO,QAAUG,EACR,OAAO,QAAW,YAAc,OAAO,IAChD,OAAO,UAAY,CACjB,OAAOA,CACT,CAAC,EAEDF,EAAK,OAASE,CAElB,GAAGJ,GAAM,SAAUA,EAAS,CAC1B,aAEAA,EAAQ,WAAa,GAiBrBA,EAAQ,aAAe,GACvBA,EAAQ,UAAY,GAEpB,IAAIM,E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GC,aACtByD,MAAM,CAAEe,UAAW,WAAW,CAAE,EAChCiB,QAAO,EACPhB,OAAO,QAAQ,EAEdM,EAAyB,CAAA,EAC7BnF,EAAUgC,QAAS8E,GAAsB,CACvC,IAAIrB,EAAQ,IAAIsB,GAChB7C,OAAOC,OAAOsB,EAAOqB,CAAc,EACnC3B,EAAKV,KAAKgB,CAAK,CACjB,CAAC,EAGD,IAAIuB,EAAkC,CAAA,EAEtC,QAAS/E,KAAQkD,EACf6B,EAAcvC,KAAKxC,CAAI,EAEzB,OAAO+E,CACT,GAMeC,kBAAgB,QAAA/G,EAAA,sBAC3B,IAAIJ,EAAa,MAAMK,EAAGC,aACvByD,MAAM,CAAEe,UAAW,WAAW,CAAE,EAChCb,QAAO,EAGNoB,EAA+B,CAAA,EACnCrF,EAAWkC,QAAS8E,GAAsB,CACxC,IAAIrB,EAAQ,IAAIyB,GAChBhD,OAAOC,OAAOsB,EAAOqB,CAAc,EACnC3B,EAAKV,KAAKgB,CAAK,CACjB,CAAC,EACD,IAAI0B,EAAgD,CAAA,EAEpD,QAASlF,KAAQkD,EACfgC,EAAsB1C,KAAKxC,CAAI,EAIjC,OAAOkF,CACT,mDAvjBS7H,GAAe8H,EAAAC,EAAA,CAAA,CAAA,CAAA,kCAAf/H,EAAegI,QAAfhI,EAAeiI,UAAAC,WAFd,MAAM,CAAA,CAAA,SAEPlI,CAAe,GAAA","names":["require_sha256","__commonJSMin","exports","module","root","factory","sha256","k","K","hashBlocks","w","v","p","pos","len","a","b","c","d","e","f","g","h","u","i","j","t1","t2","Hash","data","dataLength","dataPos","out","bytesHashed","left","bitLenHi","bitLenLo","padLength","from","HMAC","key","pad","hash","digest","hmac","fillBuffer","buffer","info","counter","num","hkdfSalt","hkdf","salt","length","okm","hmac_","bufpos","pbkdf2","password","iterations","dkLen","prf","ctr","t","dk","import_fast_sha256","DateTimeProvider","SystemDateTimeProvider","ɵSystemDateTimeProvider_BaseFactory","__ngFactoryType__","ɵɵgetInheritedFactory","ɵɵdefineInjectable","LoginOptions","OAuthLogger","OAuthStorage","MemoryStorage","key","data","ReceivedTokens","OAuthEvent","type","OAuthSuccessEvent","info","OAuthInfoEvent","OAuthErrorEvent","reason","params","b64DecodeUnicode","str","base64","c","base64UrlEncode","AuthConfig","json","uri","WebHttpUrlEncodingCodec","k","v","ValidationHandler","AbstractValidationHandler","__async","hashAlg","tokenHash","leftMostHalf","atHash","claimsAtHash","jwtHeader","alg","UrlHelperService","customHashFragment","hash","questionMarkPosition","queryString","pairs","pair","separatorIndex","escapedKey","escapedValue","value","i","factory","obj","outputType","is224","message","method","sharedMemory","notString","code","index","length","blocks","a","b","d","e","f","g","h","j","s0","s1","maj","t1","t2","ch","ab","da","cd","bc","h0","h1","h2","h3","h4","h5","h6","h7","hex","arr","buffer","dataView","bytes","oKeyPad","iKeyPad","innerHash","sha256","HashHandler","decodeUTF8","s","encodeUTF8","DefaultHashHandler","valueToHash","algorithm","fsha256","byteArray","result","OAuthService","ngZone","http","storage","tokenValidationHandler","config","urlHelper","logger","crypto","document","dateTimeService","Subject","ua","test","filter","listenTo","noPrompt","shouldRunSilentRefresh","tap","debounceTime","_","options","doc","state","args","url","errors","httpsCheck","issuerCheck","lcUrl","description","expiration","storedAt","timeout","of","delay","now","delta","fullUrl","resolve","reject","jwks","event","err","userName","password","headers","HttpHeaders","response","existingClaims","parameters","grantType","HttpParams","header","tokenResponse","switchMap","from","map","claims","existingIframe","iframe","redirectUri","first","success","race","windowRef","checkForPopupClosedTimer","tryLogin","cleanup","checkForPopupClosed","storageListener","listener","height","width","left","top","expectedPrefix","prefixedMessage","origin","issuer","sessionState","loginHint","customRedirectUri","that","nonce","seperationChar","scope","challenge","verifier","additionalState","addParams","error","tokenParams","accessToken","refreshToken","expiresIn","grantedScopes","customParameters","expiresInMilliSeconds","expiresAt","querySource","parts","href","nonceInState","userState","requestedRoute","PKCEVerifier","idToken","idx","savedNonce","defaultSkewMsc","skipNonceCheck","tokenParts","headerBase64","headerJson","claimsBase64","claimsJson","issuedAtMSec","expiresAtMSec","clockSkewInMSec","validationParams","atHashValid","atHashCheckEnabled","scopes","base64data","requestedProperty","noRedirectToLogoutUrl","id_token","customParam","logoutUrl","postLogoutUrl","silentRefreshFrame","sessionCheckFrame","unreserved","size","id","x","challengeRaw","foundParameters","recognizedParameter","ignoreCorsIssues","revokeEndpoint","revokeAccessToken","revokeRefreshToken","revokationParams","catchError","throwError","combineLatest","res","ɵɵinject","NgZone","HttpClient","DOCUMENT","OAuthModuleConfig","OAuthResourceServerConfig","OAuthResourceServerErrorHandler","OAuthNoopResourceServerErrorHandler","DefaultOAuthInterceptor","oAuthService","errorHandler","moduleConfig","u","req","next","merge","token","take","mergeMap","NullValidationHandler","createDefaultLogger","createDefaultStorage","OAuthModule","validationHandlerClass","HTTP_INTERCEPTORS","ɵɵdefineNgModule","ɵɵdefineInjector","CommonModule","JwksValidationHandler","AUTH_CONFIG","InjectionToken","BaseModel","RegisterResponseModel","BaseModel","AuthModel","setAuth","auth","accessToken","refreshToken","expiresIn","claim","UserModel","AuthModel","constructor","roles","setUser","_user","user","id","nric","username","password","name","email","profileImage","occupation","companyName","phoneNumber","memberId","accountStatus","city","officeId","ClaimModel","setAuth","claim","userId","email","preferred_username","name","role","accountStatus","ACCOUNT_USERS_URL","environment","idsUrl","urls","Array","clientId","authCodeFlowConfig","issuer","requireHttps","redirectUri","window","location","origin","silentRefreshRedirectUri","dummyClientSecret","responseType","scope","showDebugInformation","tokenEndpoint","IDS_CONFIG_TOKENENDPOINT","userinfoEndpoint","IDS_CONFIG_USERINFOENDPOINT","skipIssuerCheck","oidc","strictDiscoveryDocumentValidation","AuthHTTPService","constructor","http","oauthService","configure","loadDiscoveryDocumentAndTryLogin","login","username","password","promise","fetchTokenUsingPasswordFlowAndLoadUserProfile","then","response","info","getUserModel","from","createNewUser","formData","post","changePassword","changePasswordModel","resetPassword","resetPasswordModel","requestResendActivationCode","requestsendActivationCode","verifyActivationCode","code","phoneNumber","verifyToken","forgotPassword","email","forgotPasswordByPhoneNumber","loginResponseModel","claims","getIdentityClaims","accessToken","getAccessToken","refreshToken","getRefreshToken","userClaim","ClaimModel","userId","preferred_username","name","role","userModel","UserModel","claim","expiresIn","Date","memberId","id","nric","roles","language","accountStatus","officeId","getUserByToken","token","user","profileImage","occupation","companyName","setUser","_user","Error","setAuth","auth","city","of","today","setHours","getHours","requestRefreshToken","httpOptions","headers","HttpHeaders","ɵɵinject","HttpClient","OAuthService","factory","ɵfac","providedIn","AuthService","constructor","authHttpService","router","unsubscribe","authLocalStorageToken","environment","appVersion","USERDATA_KEY","isLoadingSubject","BehaviorSubject","currentUserSubject","undefined","currentUser$","asObservable","isLoading$","currentUserValue","value","user","next","login","username","password","pipe","map","userModel","setAuthFromLocalStorage","switchMap","getUserByToken","finalize","registerWithImage","formData","createNewUser","registerResponseModel","catchError","err","console","error","RegisterResponseModel","success","errors","Array","of","changePassword","changePasswordModel","changePasswordResponseModel","resetPassword","auth","getAuthFromLocalStorage","accessToken","logout","getAccessTokenUsingRefreshToken","from","refreshToken","requestRefreshToken","response","access_token","lsValue","localStorage","getItem","JSON","parse","clear","setItem","stringify","id","name","email","nric","accountStatus","phoneNumber","city","memberId","toString","officeId","clearStorage","navigate","resendActivationCode","requestResendActivationCode","requestActivationCodeResp","sendActivationCode","verifyActivationCode","code","verifyToken","forgotPassword","resultModel","forgotPasswordByPhoneNumber","removeItem","ngOnDestroy","forEach","sb","ɵɵinject","AuthHTTPService","Router","factory","ɵfac","providedIn","MemberModel","BaseModel","constructor","params","Object","assign","createCopy","objectToCopy","JSON","parse","stringify","FarmModel","BaseModel","constructor","params","Object","assign","createCopy","objectToCopy","JSON","parse","stringify","FarmWorkerModel","BaseModel","constructor","params","Object","assign","createCopy","objectToCopy","JSON","parse","stringify","MemberAgreementModel","BaseModel","e","t","n","r","s","i","o","a","l","u","c","h","d","f","p","y","m","v","g","b","_","w","x","k","E","P","K","O","S","A","C","j","D","I","B","T","R","F","M","N","q","$","U","L","V","W","Y","z","G","H","Q","X","J","Z","ee","te","ne","re","se","ie","oe","ae","ue","le","ce","he","de","fe","pe","ye","me","ve","ge","$e","be","Se","we","_e","xe","ke","Ee","Pe","Ke","dt","Oe","Ae","Ce","je","Te","Be","De","Xe","tt","Fe","Ie","lt","qe","Ue","Re","Le","Ve","Me","Ne","We","Ye","it","ot","nt","Ze","at","ze","Ge","He","Qe","Je","ct","et","ft","rt","st","ut","ht","pt","yt","mt","vt","gt","bt","_t","wt","xt","kt","Et","Pt","Kt","Ot","St","At","Ct","jt","Dt","It","Bt","Tt","Rt","Ft","Mt","Nt","qt","$t","Ut","Lt","Vt","Wt","Yt","zt","Gt","en","Ht","Zt","Qt","Xt","Jt","tn","nn","rn","sn","on","an","un","ln","cn","hn","dn","fn","pn","yn","mn","vn","__spreadValues","gn","bn","_n","wn","kn","Pn","Kn","xn","En","On","Sn","Xn","An","Cn","jn","Dn","In","Bn","Tn","Rn","Fn","__spreadProps","Mn","Nn","qn","$n","Un","Ln","Vn","Gn","Wn","Yn","zn","Hn","Qn","_Xn","Jn","Zn","er","tr","nr","rr","sr","ir","AppDB","Dexie","constructor","init","version","stores","regProfile","regFarm","regFarmWorker","todoLists","todoItems","genericItems","on","populate","__async","username","localStorage","getItem","memberModel","memberIC","db","add","farmModel","farmId","todoListId","title","bulkAdd","populateMemberInfo","populateCard","jsonStr","dList","JSON","parse","forEach","item","index","cardid","populateFarm","farmid","CardModel","CardHistoryModel","BaseModel","constructor","params","Object","assign","MasterPaymentModel","BaseModel","RRIMNiagaModel","BaseModel","MemberDbService","constructor","currentMemberService","farms","farmsWork","farmsWorker","farmsWorkerData","cards","agreements","otheraids","rrimniaga","clearData","__async","db","genericItems","clear","regProfile","regFarm","deleteDB","delete","populateMemberData","populateBasicData","populateCardsActive","populateCardsInActive","populateCardsCancelled","populateCardHistories","populateFarmOwn","populateFarmWork","populateFarmWorkers","populateFarmInActiveProcess","populateAgreement","populateIpgs","populateRRIMNiaga","getInfo","subscribe","data","member","obj","memberId","add","result","getCardsActive","forEach","item","index","cardId","bulkAdd","getCardsInActive","getCardsCancelled","getCardHistories","id","getFarmsOwn","farmId","ownTypes","includes","farmWorkerSubCatId","WorkTypes","getFarmsWork","getFarmsWorkers","farmWorkerId","getFarmsInActiveProcess","getAgreements","getIpgs","ia_id","getRRIMNiaga","noResit","parseInt","tarikh","substring","getMember","members","where","equals","toArray","m","MemberModel","Object","assign","value","getFarmList","farmList","farm","FarmModel","push","getFarmWorkerListByMember","farmWorkers","tablename","sortBy","farmWorkerList","FarmWorkerModel","getFarmWorkerListByFarm","getFarmWorkerDataList","farmWorker","list","farm1","f","getCardHistoryByCard","cardHistories","card","model","CardHistoryModel","getIpgList","ipgs","reverse","ipg","MasterPaymentModel","sort","a","b","ips_year","ips_month","getCardActiveList","cardStatus","CardModel","getCardInactiveList","getFarmOwnedList","farmIsOwned","getFarmWorkedList","farmIsWorked","getRRIMNiagaList","rrimniagaModel","RRIMNiagaModel","rrimniagaList","getAgreementList","MemberAgreementModel","memberAgreemenentList","ɵɵinject","CurrentMemberService","factory","ɵfac","providedIn"],"x_google_ignoreList":[0,1,13]}