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BAAkB,CAAEwtB,SAAQ7wB,KAAMmC,EAAKG,QAClD4vB,EAAW,CAAE1wB,KAAM,cAAexB,KAAMmC,EAAKG,QAcrD,CAXA,MAAOkB,GACgB,mBAAfA,EAAMoK,WACAmkB,EAAOjK,OAAOtkB,EAAM8K,QAAU,CAAE0Z,WAAW,IAE7B,0BAAfxkB,EAAMoK,WACLmkB,EAAOjK,OAAO,CAAEE,WAAW,KAGjCyE,EAAQjpB,MAAMA,GACd0uB,EAAW,CAAE1wB,KAAM,QAASgC,MAAOuL,GAAe,eAAfA,CAA+BvL,KAE1E,CAvMW,IAACma,EAAMiV,CAwMrB,EA1CD,EAPA,CAiDI,GAEL,CAACb,EAAQlB,EAAQnM,EAAOqM,EAASI,EAAQE,EAAYL,IAChD9F,GAAWC,QAAQe,IAAI+G,GAAYC,SAAU,CAAE/0B,MAAOm0B,EAAKpB,SAAYI,EAAKhb,UAAWgc,EAAI3C,UAAYsB,EAErGmB,EAAOE,EAAKpB,EAAU1tB,GADtBytB,GACgC,EAKxCgC,IAAc,IAAAE,eAAc5C,IAClC,SAAS6C,KACL,MAAMC,GAAU,IAAAC,YAAWL,IAC3B,QAAgBtuB,IAAZ0uB,EACA,MAAM,IAAI1lB,MAAM,0DAEpB,OAAO0lB,CACX,C","sources":["webpack://NX/./node_modules/@nxweb/auth/esm/index.js"],"sourcesContent":["/*! auth v3.6.0+672cee21 | Copyright (c) 2022 NextPlatform. All rights reserved. */\nimport { debuglog } from 'util';\nimport require$$0, { createContext, useRef, useMemo, useReducer, useCallback, useEffect, useContext } from 'react';\n\nconst LOG_PREFIX = '[@nxweb/auth]';\nconst KEY_SEPARATOR = '➝';\nconst STORAGE_PREFIX = ['⌘', process.pkg.name || 'nxweb-app', 'auth'].filter(Boolean).join(':');\nconst TRANSACTION_PREFIX = [STORAGE_PREFIX, 'tx'].join(':');\n/**\n * A list of errors that can be issued by the authorization server which the\n * user can recover from by signing in interactively.\n * https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n */\nconst RECOVERABLE_ERRORS = [\n 'login_required',\n 'consent_required',\n 'interaction_required',\n 'account_selection_required',\n // Strictly speaking the user can't recover from `access_denied` - but they\n // can get more information about their access being denied by logging in\n // interactively.\n 'access_denied'\n];\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\n\nvar _User_id, _User_name, _User_email, _User_phone, _User_picture, _User_groups, _User_raw, _Token_type, _Token_issuer, _Token_accessToken, _Token_idToken, _Token_refreshToken, _Token_scope, _Token_issuedAt, _Token_expiresIn, _Token_expiresAt, _Token_raw, _Auth_organization, _Auth_user, _Auth_token, _Auth_claims, _Auth_raw, _Auth_hash;\nclass User {\n constructor(data) {\n _User_id.set(this, void 0);\n _User_name.set(this, void 0);\n _User_email.set(this, void 0);\n _User_phone.set(this, void 0);\n _User_picture.set(this, void 0);\n _User_groups.set(this, void 0);\n _User_raw.set(this, void 0);\n __classPrivateFieldSet(this, _User_id, data?.id || data?.sub || '', \"f\");\n __classPrivateFieldSet(this, _User_name, data?.name || '', \"f\");\n __classPrivateFieldSet(this, _User_email, data?.email || '', \"f\");\n __classPrivateFieldSet(this, _User_phone, data?.phone || data?.phone_number || '', \"f\");\n __classPrivateFieldSet(this, _User_picture, data?.picture || data?.profile_picture || '', \"f\");\n __classPrivateFieldSet(this, _User_groups, data?.groups || [], \"f\");\n __classPrivateFieldSet(this, _User_raw, data, \"f\");\n if (new.target === User) {\n Object.freeze(this);\n }\n }\n get id() {\n return __classPrivateFieldGet(this, _User_id, \"f\");\n }\n get name() {\n return __classPrivateFieldGet(this, _User_name, \"f\");\n }\n get email() {\n return __classPrivateFieldGet(this, _User_email, \"f\");\n }\n get phone() {\n return __classPrivateFieldGet(this, _User_phone, \"f\");\n }\n get picture() {\n return __classPrivateFieldGet(this, _User_picture, \"f\");\n }\n get groups() {\n return __classPrivateFieldGet(this, _User_groups, \"f\");\n }\n equal(user) {\n return typeof user !== 'undefined' && this.id === user.id;\n }\n data(key) {\n return __classPrivateFieldGet(this, _User_raw, \"f\")?.[key];\n }\n raw() {\n return __classPrivateFieldGet(this, _User_raw, \"f\");\n }\n toString() {\n return this.id\n ? this.email\n ? `${this.name} <${this.email}>` : this.name\n : 'Anonymous';\n }\n}\n_User_id = new WeakMap(), _User_name = new WeakMap(), _User_email = new WeakMap(), _User_phone = new WeakMap(), _User_picture = new WeakMap(), _User_groups = new WeakMap(), _User_raw = new WeakMap();\nObject.defineProperty(User, \"Anonymous\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new User()\n});\nclass Token {\n constructor(data) {\n _Token_type.set(this, void 0);\n _Token_issuer.set(this, void 0);\n _Token_accessToken.set(this, void 0);\n _Token_idToken.set(this, void 0);\n _Token_refreshToken.set(this, void 0);\n _Token_scope.set(this, void 0);\n _Token_issuedAt.set(this, void 0);\n _Token_expiresIn.set(this, void 0);\n _Token_expiresAt.set(this, void 0);\n _Token_raw.set(this, void 0);\n __classPrivateFieldSet(this, _Token_type, data?.type || '', \"f\");\n __classPrivateFieldSet(this, _Token_issuer, data?.issuer || '', \"f\");\n __classPrivateFieldSet(this, _Token_accessToken, data?.accessToken || '', \"f\");\n __classPrivateFieldSet(this, _Token_idToken, data?.idToken || '', \"f\");\n __classPrivateFieldSet(this, _Token_refreshToken, data?.refreshToken || '', \"f\");\n __classPrivateFieldSet(this, _Token_scope, data?.scope || '', \"f\");\n __classPrivateFieldSet(this, _Token_issuedAt, data?.issuedAt, \"f\");\n __classPrivateFieldSet(this, _Token_expiresIn, data?.expiresIn, \"f\");\n __classPrivateFieldSet(this, _Token_expiresAt, data?.expiresAt, \"f\");\n __classPrivateFieldSet(this, _Token_raw, data, \"f\");\n if (new.target === Token) {\n Object.freeze(this);\n }\n }\n get type() {\n return __classPrivateFieldGet(this, _Token_type, \"f\");\n }\n get accessToken() {\n return __classPrivateFieldGet(this, _Token_accessToken, \"f\");\n }\n get idToken() {\n return __classPrivateFieldGet(this, _Token_idToken, \"f\");\n }\n get refreshToken() {\n return __classPrivateFieldGet(this, _Token_refreshToken, \"f\");\n }\n get scope() {\n return __classPrivateFieldGet(this, _Token_scope, \"f\");\n }\n get issuer() {\n return __classPrivateFieldGet(this, _Token_issuer, \"f\");\n }\n get expiresIn() {\n return __classPrivateFieldGet(this, _Token_expiresIn, \"f\");\n }\n get expiresAt() {\n return __classPrivateFieldGet(this, _Token_expiresAt, \"f\");\n }\n get issuedAt() {\n return __classPrivateFieldGet(this, _Token_issuedAt, \"f\");\n }\n get authorization() {\n return this.accessToken ? (this.type\n ? `${this.type} ${this.accessToken}`\n : this.accessToken) : '';\n }\n equal(token) {\n return typeof token !== 'undefined' && ((this.type === token.type && this.accessToken === token.accessToken) ||\n (typeof token.idToken !== 'undefined' && this.idToken === token.idToken));\n }\n data(key) {\n return __classPrivateFieldGet(this, _Token_raw, \"f\")?.[key];\n }\n raw() {\n return __classPrivateFieldGet(this, _Token_raw, \"f\");\n }\n}\n_Token_type = new WeakMap(), _Token_issuer = new WeakMap(), _Token_accessToken = new WeakMap(), _Token_idToken = new WeakMap(), _Token_refreshToken = new WeakMap(), _Token_scope = new WeakMap(), _Token_issuedAt = new WeakMap(), _Token_expiresIn = new WeakMap(), _Token_expiresAt = new WeakMap(), _Token_raw = new WeakMap();\nObject.defineProperty(Token, \"Empty\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Token()\n});\n// export class IDToken implements IDTokenData {\n// public static Empty = new IDToken();\n// readonly #jwt: string;\n// readonly #raw?: Record;\n// constructor(data?: string) {\n// this.#jwt = data || '';\n// this.#raw = this.#jwt\n// ? decodeJWT(this.#jwt)\n// : Object.create(null);\n// if (new.target === IDToken) {\n// Object.freeze(this);\n// }\n// }\n// get jwt() : string {\n// return this.#jwt;\n// }\n// get jti() : string | undefined {\n// return this.#raw?.jti;\n// }\n// get subject() : string | undefined {\n// return this.#raw?.sub;\n// }\n// get audience(): string | string[] | undefined {\n// return this.#raw?.aud;\n// }\n// get issuer() : string | undefined {\n// return this.#raw?.iss;\n// }\n// get issuedAt(): number | undefined {\n// return this.#raw?.iat;\n// }\n// get expiresIn(): number | undefined {\n// return this.#raw?.exp && this.#raw.exp - Date.now();\n// }\n// get expiresAt(): number | undefined {\n// return this.#raw?.exp;\n// }\n// equal(token?: IDToken): boolean {\n// return typeof token !== 'undefined' &&\n// this.jwt === token.jwt;\n// }\n// data(key: string): string | undefined {\n// return this.#raw?.[key];\n// }\n// raw(): Record | undefined {\n// return { ...this.#raw };\n// }\n// }\nclass Auth {\n constructor(data, hash) {\n _Auth_organization.set(this, void 0);\n _Auth_user.set(this, void 0);\n _Auth_token.set(this, void 0);\n _Auth_claims.set(this, void 0);\n _Auth_raw.set(this, void 0);\n _Auth_hash.set(this, void 0);\n __classPrivateFieldSet(this, _Auth_organization, data?.organization || '', \"f\");\n __classPrivateFieldSet(this, _Auth_token, data?.token ? new Token(data.token) : Token.Empty, \"f\");\n __classPrivateFieldSet(this, _Auth_claims, new Map(data?.claims && Object.entries(data?.claims)), \"f\");\n __classPrivateFieldSet(this, _Auth_user, data?.user ? new User({\n ...data.user, groups: __classPrivateFieldGet(this, _Auth_claims, \"f\").get('groups')\n }) : User.Anonymous, \"f\");\n __classPrivateFieldSet(this, _Auth_raw, data, \"f\");\n __classPrivateFieldSet(this, _Auth_hash, hash, \"f\");\n if (new.target === Auth) {\n Object.freeze(this);\n }\n }\n get organization() {\n return __classPrivateFieldGet(this, _Auth_organization, \"f\");\n }\n get user() {\n return __classPrivateFieldGet(this, _Auth_user, \"f\");\n }\n get token() {\n return __classPrivateFieldGet(this, _Auth_token, \"f\");\n }\n get claims() {\n return __classPrivateFieldGet(this, _Auth_claims, \"f\");\n }\n get anonymous() {\n return this.user.equal(User.Anonymous);\n }\n get loggedIn() {\n return !this.anonymous && (!this.token.equal(Token.Empty));\n }\n get hash() {\n return __classPrivateFieldGet(this, _Auth_hash, \"f\") || '';\n }\n equal(auth) {\n return auth?.token\n ? this.token.equal(auth.token)\n : auth?.user\n ? this.user.equal(auth.user)\n : false;\n }\n raw() {\n return __classPrivateFieldGet(this, _Auth_raw, \"f\");\n }\n}\n_Auth_organization = new WeakMap(), _Auth_user = new WeakMap(), _Auth_token = new WeakMap(), _Auth_claims = new WeakMap(), _Auth_raw = new WeakMap(), _Auth_hash = new WeakMap();\nObject.defineProperty(Auth, \"Empty\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Auth()\n});\n\nconst getConfigValue = (options, key, platform = 'web') => {\n let base = options[key];\n if (options?.platform?.[platform] && key in options.platform[platform]) {\n base = options?.platform?.[platform][key];\n }\n return base;\n};\nconst buildConfig = (options, platform = 'web') => {\n const parametersMapHelper = getConfigValue(options, 'additionalParameters', platform);\n const additionalParameters = parametersMapHelper && Object.entries(parametersMapHelper).reduce((obj, [key, value]) => {\n if (key && key.trim().length > 0) {\n if (value && value.trim().length > 0) {\n obj[key] = value;\n }\n }\n return obj;\n }, Object.create(null));\n const headersMapHelper = getConfigValue(options, 'additionalResourceHeaders', platform);\n const additionalResourceHeaders = headersMapHelper && Object.entries(headersMapHelper).reduce((obj, [key, value]) => {\n if (key && key.trim().length > 0) {\n if (value && value.trim().length > 0) {\n obj[key] = value;\n }\n }\n return obj;\n }, Object.create(null));\n const config = {\n debug: getConfigValue(options, 'debug', platform),\n domain: getConfigValue(options, 'domain', platform),\n cookieDomain: getConfigValue(options, 'cookieDomain', platform),\n issuer: getConfigValue(options, 'issuer', platform),\n audience: getConfigValue(options, 'audience', platform),\n organization: getConfigValue(options, 'organization', platform),\n clientId: getConfigValue(options, 'clientId', platform),\n clientSecret: getConfigValue(options, 'clientSecret', platform),\n scope: getConfigValue(options, 'scope', platform),\n responseType: getConfigValue(options, 'responseType', platform) || 'code',\n responseMode: getConfigValue(options, 'responseMode', platform),\n tokenAuthMethod: getConfigValue(options, 'tokenAuthMethod', platform) || 'client_secret_post',\n redirectMethod: getConfigValue(options, 'redirectMethod', platform),\n authorizeURL: getConfigValue(options, 'authorizeURL', platform),\n redirectURL: getConfigValue(options, 'redirectURL', platform),\n tokenURL: getConfigValue(options, 'tokenURL', platform),\n logoutURL: getConfigValue(options, 'logoutURL', platform),\n logoutRedirectURL: getConfigValue(options, 'logoutRedirectURL', platform),\n state: getConfigValue(options, 'state', platform),\n timeout: getConfigValue(options, 'timeout', platform),\n maxAge: getConfigValue(options, 'maxAge', platform),\n leeway: getConfigValue(options, 'leeway', platform),\n useFormData: getConfigValue(options, 'useFormData', platform) !== false,\n usePKCE: getConfigValue(options, 'usePKCE', platform) !== false,\n useRefreshToken: getConfigValue(options, 'useRefreshToken', platform),\n additionalParameters,\n additionalResourceHeaders\n };\n switch (platform) {\n case 'web':\n return { ...config, ...(options?.platform?.web || {}) };\n case 'android':\n return { ...config, ...(options?.platform?.android || {}) };\n case 'ios':\n return { ...config, ...(options?.platform?.ios || {}) };\n default:\n return { ...config, ...(options?.platform?.[platform] || {}) };\n }\n};\n\nconst NullLogger = Object.create(null, {\n clear: { value: () => { } },\n debug: { value: () => { } },\n info: { value: () => { } },\n warn: { value: () => { } },\n error: { value: () => { } }\n});\n\nvar _Transaction_log, _Transaction_storage, _Transaction_clientId, _Transaction_key, _Transaction_transaction;\nclass Transaction {\n constructor(storage, clientId, prefix = TRANSACTION_PREFIX, log) {\n _Transaction_log.set(this, void 0);\n _Transaction_storage.set(this, void 0);\n _Transaction_clientId.set(this, void 0);\n _Transaction_key.set(this, void 0);\n _Transaction_transaction.set(this, void 0);\n __classPrivateFieldSet(this, _Transaction_log, log || NullLogger, \"f\");\n __classPrivateFieldSet(this, _Transaction_storage, storage, \"f\");\n __classPrivateFieldSet(this, _Transaction_clientId, clientId, \"f\");\n __classPrivateFieldSet(this, _Transaction_key, [prefix, __classPrivateFieldGet(this, _Transaction_clientId, \"f\")].filter((o) => !!o).join('|'), \"f\");\n __classPrivateFieldSet(this, _Transaction_transaction, __classPrivateFieldGet(this, _Transaction_storage, \"f\").get(__classPrivateFieldGet(this, _Transaction_key, \"f\")), \"f\");\n }\n create(entry, expires) {\n __classPrivateFieldSet(this, _Transaction_transaction, entry, \"f\");\n const exp = expires && expires > 0 ? expires : Date.now() + 86400000; // 1 day\n __classPrivateFieldGet(this, _Transaction_storage, \"f\").save(__classPrivateFieldGet(this, _Transaction_key, \"f\"), entry, {\n expires: exp\n });\n __classPrivateFieldGet(this, _Transaction_log, \"f\").debug('transaction', {\n storage: __classPrivateFieldGet(this, _Transaction_storage, \"f\").name,\n key: __classPrivateFieldGet(this, _Transaction_key, \"f\"),\n expires: exp\n }, entry);\n }\n get() {\n return __classPrivateFieldGet(this, _Transaction_transaction, \"f\");\n }\n remove() {\n __classPrivateFieldSet(this, _Transaction_transaction, undefined, \"f\");\n __classPrivateFieldGet(this, _Transaction_storage, \"f\").remove(__classPrivateFieldGet(this, _Transaction_key, \"f\"));\n }\n}\n_Transaction_log = new WeakMap(), _Transaction_storage = new WeakMap(), _Transaction_clientId = new WeakMap(), _Transaction_key = new WeakMap(), _Transaction_transaction = new WeakMap();\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nvar browserTabsLock = {};\n\nvar processLock = {};\n\nObject.defineProperty(processLock, \"__esModule\", { value: true });\nvar ProcessLocking = /** @class */ (function () {\n function ProcessLocking() {\n var _this = this;\n this.locked = new Map();\n this.addToLocked = function (key, toAdd) {\n var callbacks = _this.locked.get(key);\n if (callbacks === undefined) {\n if (toAdd === undefined) {\n _this.locked.set(key, []);\n }\n else {\n _this.locked.set(key, [toAdd]);\n }\n }\n else {\n if (toAdd !== undefined) {\n callbacks.unshift(toAdd);\n _this.locked.set(key, callbacks);\n }\n }\n };\n this.isLocked = function (key) {\n return _this.locked.has(key);\n };\n this.lock = function (key) {\n return new Promise(function (resolve, reject) {\n if (_this.isLocked(key)) {\n _this.addToLocked(key, resolve);\n }\n else {\n _this.addToLocked(key);\n resolve();\n }\n });\n };\n this.unlock = function (key) {\n var callbacks = _this.locked.get(key);\n if (callbacks === undefined || callbacks.length === 0) {\n _this.locked.delete(key);\n return;\n }\n var toCall = callbacks.pop();\n _this.locked.set(key, callbacks);\n if (toCall !== undefined) {\n setTimeout(toCall, 0);\n }\n };\n }\n ProcessLocking.getInstance = function () {\n if (ProcessLocking.instance === undefined) {\n ProcessLocking.instance = new ProcessLocking();\n }\n return ProcessLocking.instance;\n };\n return ProcessLocking;\n}());\nfunction getLock() {\n return ProcessLocking.getInstance();\n}\nprocessLock.default = getLock;\n\nvar __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(browserTabsLock, \"__esModule\", { value: true });\nvar processLock_1 = processLock;\n/**\n * @author: SuperTokens (https://github.com/supertokens)\n * This library was created as a part of a larger project, SuperTokens(https://supertokens.io) - the best session management solution.\n * You can also check out our other projects on https://github.com/supertokens\n *\n * To contribute to this package visit https://github.com/supertokens/browser-tabs-lock\n * If you face any problems you can file an issue on https://github.com/supertokens/browser-tabs-lock/issues\n *\n * If you have any questions or if you just want to say hi visit https://supertokens.io/discord\n */\n/**\n * @constant\n * @type {string}\n * @default\n * @description All the locks taken by this package will have this as prefix\n*/\nvar LOCK_STORAGE_KEY = 'browser-tabs-lock-key';\n/**\n * @function delay\n * @param {number} milliseconds - How long the delay should be in terms of milliseconds\n * @returns {Promise}\n */\nfunction delay(milliseconds) {\n return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });\n}\n/**\n * @function generateRandomString\n * @params {number} length - How long the random string should be\n * @returns {string}\n * @description returns random string whose length is equal to the length passed as parameter\n */\nfunction generateRandomString(length) {\n var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var randomstring = '';\n for (var i = 0; i < length; i++) {\n var INDEX = Math.floor(Math.random() * CHARS.length);\n randomstring += CHARS[INDEX];\n }\n return randomstring;\n}\n/**\n * @function getLockId\n * @returns {string}\n * @description Generates an id which will be unique for the browser tab\n */\nfunction getLockId() {\n return Date.now().toString() + generateRandomString(15);\n}\nvar SuperTokensLock = /** @class */ (function () {\n function SuperTokensLock() {\n this.acquiredIatSet = new Set();\n this.id = getLockId();\n this.acquireLock = this.acquireLock.bind(this);\n this.releaseLock = this.releaseLock.bind(this);\n this.releaseLock__private__ = this.releaseLock__private__.bind(this);\n this.waitForSomethingToChange = this.waitForSomethingToChange.bind(this);\n this.refreshLockWhileAcquired = this.refreshLockWhileAcquired.bind(this);\n if (SuperTokensLock.waiters === undefined) {\n SuperTokensLock.waiters = [];\n }\n }\n /**\n * @async\n * @memberOf Lock\n * @function acquireLock\n * @param {string} lockKey - Key for which the lock is being acquired\n * @param {number} [timeout=5000] - Maximum time for which the function will wait to acquire the lock\n * @returns {Promise}\n * @description Will return true if lock is being acquired, else false.\n * Also the lock can be acquired for maximum 10 secs\n */\n SuperTokensLock.prototype.acquireLock = function (lockKey, timeout) {\n if (timeout === void 0) { timeout = 5000; }\n return __awaiter(this, void 0, void 0, function () {\n var iat, MAX_TIME, STORAGE_KEY, STORAGE, lockObj, TIMEOUT_KEY, lockObjPostDelay;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n iat = Date.now() + generateRandomString(4);\n MAX_TIME = Date.now() + timeout;\n STORAGE_KEY = LOCK_STORAGE_KEY + \"-\" + lockKey;\n STORAGE = window.localStorage;\n _a.label = 1;\n case 1:\n if (!(Date.now() < MAX_TIME)) return [3 /*break*/, 8];\n return [4 /*yield*/, delay(30)];\n case 2:\n _a.sent();\n lockObj = STORAGE.getItem(STORAGE_KEY);\n if (!(lockObj === null)) return [3 /*break*/, 5];\n TIMEOUT_KEY = this.id + \"-\" + lockKey + \"-\" + iat;\n // there is a problem if setItem happens at the exact same time for 2 different processes.. so we add some random delay here.\n return [4 /*yield*/, delay(Math.floor(Math.random() * 25))];\n case 3:\n // there is a problem if setItem happens at the exact same time for 2 different processes.. so we add some random delay here.\n _a.sent();\n STORAGE.setItem(STORAGE_KEY, JSON.stringify({\n id: this.id,\n iat: iat,\n timeoutKey: TIMEOUT_KEY,\n timeAcquired: Date.now(),\n timeRefreshed: Date.now()\n }));\n return [4 /*yield*/, delay(30)];\n case 4:\n _a.sent(); // this is to prevent race conditions. This time must be more than the time it takes for storage.setItem\n lockObjPostDelay = STORAGE.getItem(STORAGE_KEY);\n if (lockObjPostDelay !== null) {\n lockObjPostDelay = JSON.parse(lockObjPostDelay);\n if (lockObjPostDelay.id === this.id && lockObjPostDelay.iat === iat) {\n this.acquiredIatSet.add(iat);\n this.refreshLockWhileAcquired(STORAGE_KEY, iat);\n return [2 /*return*/, true];\n }\n }\n return [3 /*break*/, 7];\n case 5:\n SuperTokensLock.lockCorrector();\n return [4 /*yield*/, this.waitForSomethingToChange(MAX_TIME)];\n case 6:\n _a.sent();\n _a.label = 7;\n case 7:\n iat = Date.now() + generateRandomString(4);\n return [3 /*break*/, 1];\n case 8: return [2 /*return*/, false];\n }\n });\n });\n };\n SuperTokensLock.prototype.refreshLockWhileAcquired = function (storageKey, iat) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {\n var STORAGE, lockObj;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, processLock_1.default().lock(iat)];\n case 1:\n _a.sent();\n if (!this.acquiredIatSet.has(iat)) {\n processLock_1.default().unlock(iat);\n return [2 /*return*/];\n }\n STORAGE = window.localStorage;\n lockObj = STORAGE.getItem(storageKey);\n if (lockObj !== null) {\n lockObj = JSON.parse(lockObj);\n lockObj.timeRefreshed = Date.now();\n STORAGE.setItem(storageKey, JSON.stringify(lockObj));\n processLock_1.default().unlock(iat);\n }\n else {\n processLock_1.default().unlock(iat);\n return [2 /*return*/];\n }\n this.refreshLockWhileAcquired(storageKey, iat);\n return [2 /*return*/];\n }\n });\n }); }, 1000);\n return [2 /*return*/];\n });\n });\n };\n SuperTokensLock.prototype.waitForSomethingToChange = function (MAX_TIME) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, new Promise(function (resolve) {\n var resolvedCalled = false;\n var startedAt = Date.now();\n var MIN_TIME_TO_WAIT = 50; // ms\n var removedListeners = false;\n function stopWaiting() {\n if (!removedListeners) {\n window.removeEventListener('storage', stopWaiting);\n SuperTokensLock.removeFromWaiting(stopWaiting);\n clearTimeout(timeOutId);\n removedListeners = true;\n }\n if (!resolvedCalled) {\n resolvedCalled = true;\n var timeToWait = MIN_TIME_TO_WAIT - (Date.now() - startedAt);\n if (timeToWait > 0) {\n setTimeout(resolve, timeToWait);\n }\n else {\n resolve();\n }\n }\n }\n window.addEventListener('storage', stopWaiting);\n SuperTokensLock.addToWaiting(stopWaiting);\n var timeOutId = setTimeout(stopWaiting, Math.max(0, MAX_TIME - Date.now()));\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n SuperTokensLock.addToWaiting = function (func) {\n this.removeFromWaiting(func);\n if (SuperTokensLock.waiters === undefined) {\n return;\n }\n SuperTokensLock.waiters.push(func);\n };\n SuperTokensLock.removeFromWaiting = function (func) {\n if (SuperTokensLock.waiters === undefined) {\n return;\n }\n SuperTokensLock.waiters = SuperTokensLock.waiters.filter(function (i) { return i !== func; });\n };\n SuperTokensLock.notifyWaiters = function () {\n if (SuperTokensLock.waiters === undefined) {\n return;\n }\n var waiters = SuperTokensLock.waiters.slice(); // so that if Lock.waiters is changed it's ok.\n waiters.forEach(function (i) { return i(); });\n };\n /**\n * @function releaseLock\n * @memberOf Lock\n * @param {string} lockKey - Key for which lock is being released\n * @returns {void}\n * @description Release a lock.\n */\n SuperTokensLock.prototype.releaseLock = function (lockKey) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.releaseLock__private__(lockKey)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n /**\n * @function releaseLock\n * @memberOf Lock\n * @param {string} lockKey - Key for which lock is being released\n * @returns {void}\n * @description Release a lock.\n */\n SuperTokensLock.prototype.releaseLock__private__ = function (lockKey) {\n return __awaiter(this, void 0, void 0, function () {\n var STORAGE, STORAGE_KEY, lockObj;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n STORAGE = window.localStorage;\n STORAGE_KEY = LOCK_STORAGE_KEY + \"-\" + lockKey;\n lockObj = STORAGE.getItem(STORAGE_KEY);\n if (lockObj === null) {\n return [2 /*return*/];\n }\n lockObj = JSON.parse(lockObj);\n if (!(lockObj.id === this.id)) return [3 /*break*/, 2];\n return [4 /*yield*/, processLock_1.default().lock(lockObj.iat)];\n case 1:\n _a.sent();\n this.acquiredIatSet.delete(lockObj.iat);\n STORAGE.removeItem(STORAGE_KEY);\n processLock_1.default().unlock(lockObj.iat);\n SuperTokensLock.notifyWaiters();\n _a.label = 2;\n case 2: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * @function lockCorrector\n * @returns {void}\n * @description If a lock is acquired by a tab and the tab is closed before the lock is\n * released, this function will release those locks\n */\n SuperTokensLock.lockCorrector = function () {\n var MIN_ALLOWED_TIME = Date.now() - 5000;\n var STORAGE = window.localStorage;\n var KEYS = Object.keys(STORAGE);\n var notifyWaiters = false;\n for (var i = 0; i < KEYS.length; i++) {\n var LOCK_KEY = KEYS[i];\n if (LOCK_KEY.includes(LOCK_STORAGE_KEY)) {\n var lockObj = STORAGE.getItem(LOCK_KEY);\n if (lockObj !== null) {\n lockObj = JSON.parse(lockObj);\n if ((lockObj.timeRefreshed === undefined && lockObj.timeAcquired < MIN_ALLOWED_TIME) ||\n (lockObj.timeRefreshed !== undefined && lockObj.timeRefreshed < MIN_ALLOWED_TIME)) {\n STORAGE.removeItem(LOCK_KEY);\n notifyWaiters = true;\n }\n }\n }\n }\n if (notifyWaiters) {\n SuperTokensLock.notifyWaiters();\n }\n };\n SuperTokensLock.waiters = undefined;\n return SuperTokensLock;\n}());\nvar _default = browserTabsLock.default = SuperTokensLock;\n\nvar _CacheKey_prefix, _CacheKey_clientId, _CacheKey_scope, _CacheKey_organization, _CacheKey_audience;\nclass CacheKey {\n constructor(data, prefix = STORAGE_PREFIX) {\n _CacheKey_prefix.set(this, void 0);\n _CacheKey_clientId.set(this, void 0);\n _CacheKey_scope.set(this, void 0);\n _CacheKey_organization.set(this, void 0);\n _CacheKey_audience.set(this, void 0);\n __classPrivateFieldSet(this, _CacheKey_prefix, prefix, \"f\");\n __classPrivateFieldSet(this, _CacheKey_clientId, data.clientId, \"f\");\n __classPrivateFieldSet(this, _CacheKey_scope, data.scope || '', \"f\");\n __classPrivateFieldSet(this, _CacheKey_organization, data.organization || 'default', \"f\");\n __classPrivateFieldSet(this, _CacheKey_audience, data.audience || data.clientId, \"f\");\n }\n get prefix() {\n return __classPrivateFieldGet(this, _CacheKey_prefix, \"f\");\n }\n get clientId() {\n return __classPrivateFieldGet(this, _CacheKey_clientId, \"f\");\n }\n get scope() {\n return __classPrivateFieldGet(this, _CacheKey_scope, \"f\");\n }\n get organization() {\n return __classPrivateFieldGet(this, _CacheKey_organization, \"f\");\n }\n get audience() {\n return __classPrivateFieldGet(this, _CacheKey_audience, \"f\");\n }\n /**\n * Converts this `CacheKey` instance into a string for use in a cache\n * @returns A string representation of the key\n */\n toString() {\n return __classPrivateFieldGet(this, _CacheKey_audience, \"f\") && __classPrivateFieldGet(this, _CacheKey_audience, \"f\") !== __classPrivateFieldGet(this, _CacheKey_clientId, \"f\")\n ? [__classPrivateFieldGet(this, _CacheKey_prefix, \"f\"), __classPrivateFieldGet(this, _CacheKey_clientId, \"f\"), __classPrivateFieldGet(this, _CacheKey_scope, \"f\").replaceAll(/\\s/g, '+'), __classPrivateFieldGet(this, _CacheKey_organization, \"f\"), __classPrivateFieldGet(this, _CacheKey_audience, \"f\")].join(KEY_SEPARATOR)\n : [__classPrivateFieldGet(this, _CacheKey_prefix, \"f\"), __classPrivateFieldGet(this, _CacheKey_clientId, \"f\"), __classPrivateFieldGet(this, _CacheKey_scope, \"f\").replaceAll(/\\s/g, '+'), __classPrivateFieldGet(this, _CacheKey_organization, \"f\")].join(KEY_SEPARATOR);\n }\n /**\n * Converts a string into a `CacheKey` instance.\n * @param key - The string to convert\n * @returns An instance of `CacheKey`\n */\n static fromString(key) {\n const [prefix, clientId, scope, organization, audience] = key.split(KEY_SEPARATOR);\n return new CacheKey({ clientId, scope, organization, audience }, prefix);\n }\n /**\n * Utility function to build a `CacheKey` instance from a cache entry\n * @param entry - The entry\n * @returns An instance of `CacheKey`\n */\n static fromCacheEntry(entry, prefix = STORAGE_PREFIX) {\n const { clientId, scope, organization, audience } = entry;\n return new CacheKey({\n clientId,\n scope,\n organization,\n audience\n }, prefix);\n }\n}\n_CacheKey_prefix = new WeakMap(), _CacheKey_clientId = new WeakMap(), _CacheKey_scope = new WeakMap(), _CacheKey_organization = new WeakMap(), _CacheKey_audience = new WeakMap();\n\nvar _AuthError_code, _AuthError_params;\nconst ErrMissingClientID = 'missing_client_id';\nconst ErrMissingAuthorizeURL = 'missing_auth_url';\nconst ErrMissingRedirectURL = 'missing_redirect_url';\nconst ErrMissingTokenURL = 'missing_token_url';\nconst ErrMissingResponseType = 'missing_response_type';\nconst ErrAuthTimeout = 'auth_timeout';\nconst ErrAuthCancelled = 'auth_cancelled';\nconst ErrAuthInvalidCode = 'invalid_code';\nconst ErrAuthInvalidResponse = 'invalid_response';\nconst ErrAuthInvalidState = 'invalid_state';\nconst ErrAuthInvalidPKCELength = 'invalid_pkce_length';\nconst ErrAuthUnsupportedCrypto = 'unsupported_crypto';\nconst ErrAuthInsecureCrypto = 'insecure_crypto';\nconst ErrAuthInvalidRefreshToken = 'invalid_refresh_token';\nconst ErrAuthPopupCancelled = 'popup_cancelled';\nconst ErrAuthPopupTimeout = 'popup_timeout';\nclass ConfigError extends Error {\n constructor(code, message) {\n super(message);\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.code = code;\n Object.setPrototypeOf(this, ConfigError.prototype);\n }\n}\nconst MissingClientIDError = new ConfigError(ErrMissingClientID, 'missing client-id configuration');\nconst MissingAuthorizeURLError = new ConfigError(ErrMissingAuthorizeURL, 'missing authorization url configuration');\nconst MissingRedirectURLError = new ConfigError(ErrMissingRedirectURL, 'missing redirect url configuration');\nconst MissingResponseTypeError = new ConfigError(ErrMissingResponseType, 'missing response type configuration');\nconst MissingTokenURLError = new ConfigError(ErrMissingTokenURL, 'missing token url configuration. Token URL is required if response type include `code`.');\nclass AuthError extends Error {\n constructor(code, message, params) {\n super(message);\n _AuthError_code.set(this, void 0);\n _AuthError_params.set(this, void 0);\n __classPrivateFieldSet(this, _AuthError_code, code, \"f\");\n __classPrivateFieldSet(this, _AuthError_params, params, \"f\");\n Object.setPrototypeOf(this, AuthError.prototype);\n }\n get code() {\n return __classPrivateFieldGet(this, _AuthError_code, \"f\");\n }\n get params() {\n return __classPrivateFieldGet(this, _AuthError_params, \"f\");\n }\n}\n_AuthError_code = new WeakMap(), _AuthError_params = new WeakMap();\nconst AuthTimeoutError = new AuthError(ErrAuthTimeout, 'authorization timeout');\nnew AuthError(ErrAuthCancelled, 'authorization cancelled');\nnew AuthError(ErrAuthInvalidCode, 'invalid authorization code in response');\nconst AuthInvalidResponseError = new AuthError(ErrAuthInvalidResponse, 'invalid authorization response');\nconst AuthInvalidStateError = new AuthError(ErrAuthInvalidState, 'invalid authorization state');\nnew AuthError(ErrAuthInvalidPKCELength, 'invalid PKCE code verifier length');\nconst AuthInvalidRefreshTokenError = new AuthError(ErrAuthInvalidRefreshToken, 'invalid refresh token in response');\nconst AuthUnsupportedCryptoError = new AuthError(ErrAuthUnsupportedCrypto, 'unsupported platform, `window.crypto` is required');\nconst AuthInsecureCryptoError = new AuthError(ErrAuthInsecureCrypto, 'unsupported environment, must run on a secure origin');\nconst AuthPopupCancelledError = new AuthError(ErrAuthPopupCancelled, 'popup closed');\nconst AuthPopupTimeoutError = new AuthError(ErrAuthPopupTimeout, 'popup timeout');\nconst normalizeError = (fallbackMessage) => (error) => {\n if ('error' in error) {\n return new AuthError(error.error, error.error_description);\n }\n if (error instanceof Error) {\n return error;\n }\n return new Error(fallbackMessage);\n};\n\nconst BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst getCrypto = () => {\n // ie 11.x uses msCrypto\n return (window.crypto || window.msCrypto);\n};\nconst getCryptoSubtle = () => {\n const crypto = getCrypto();\n // safari 10.x uses webkitSubtle\n return crypto.subtle || crypto.webkitSubtle;\n};\nconst validateCrypto = () => {\n if (!getCrypto()) {\n throw AuthUnsupportedCryptoError;\n }\n if (typeof getCryptoSubtle() === 'undefined') {\n throw AuthInsecureCryptoError;\n }\n};\nconst toUint8Array = (str) => {\n const buf = new ArrayBuffer(str.length);\n const bufView = new Uint8Array(buf);\n for (let i = 0; i < str.length; i++) {\n bufView[i] = str.charCodeAt(i);\n }\n return bufView;\n};\nconst toBase64URL = (base64) => {\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\nconst toBase64 = (bytes) => {\n const len = bytes.length;\n let base64 = '';\n for (let i = 0; i < len; i += 3) {\n // eslint-disable-next-line no-bitwise\n base64 += BASE64_CHARS[bytes[i] >> 2];\n // eslint-disable-next-line no-bitwise\n base64 += BASE64_CHARS[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n // eslint-disable-next-line no-bitwise\n base64 += BASE64_CHARS[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n // eslint-disable-next-line no-bitwise\n base64 += BASE64_CHARS[bytes[i + 2] & 63];\n }\n if ((len % 3) === 2) {\n base64 = `${base64.substring(0, base64.length - 1)}=`;\n }\n else if (len % 3 === 1) {\n base64 = `${base64.substring(0, base64.length - 2)}==`;\n }\n return base64;\n};\nconst fromBaseB64 = (input) => {\n return decodeURIComponent(window.atob(input.replace(/_/g, '/').replace(/-/g, '+'))\n .split('')\n .map((c) => {\n return `%${(`00${c.charCodeAt(0).toString(16)}`).slice(-2)}`;\n })\n .join(''));\n};\nconst deriveChallenge = async (codeVerifier) => {\n if (codeVerifier.length < 43 || codeVerifier.length > 128) {\n throw new Error('invalid code verifier length, could length should be between 48 and 128');\n }\n const arrayBuffer = await getCryptoSubtle().digest('SHA-256', toUint8Array(codeVerifier));\n return toBase64URL(toBase64(new Uint8Array(arrayBuffer)));\n};\nconst randomString = (length = 10) => {\n const haystack = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let randomStr;\n if (window.crypto) {\n let numberArray = new Uint32Array(length);\n window.crypto.getRandomValues(numberArray);\n numberArray = numberArray.map((x) => haystack.charCodeAt(x % haystack.length));\n const stringArray = [];\n numberArray.forEach((x) => {\n stringArray.push(haystack.charAt(x % haystack.length));\n });\n randomStr = stringArray.join('');\n }\n else {\n randomStr = '';\n for (let i = 0; i < length; i++) {\n randomStr += haystack.charAt(Math.floor(Math.random() * haystack.length));\n }\n }\n return randomStr;\n};\n/**\n * Encrypts plaintext using AES-GCM with supplied password, for decryption with decrypt().\n * (c) Chris Veness MIT Licence\n *\n * @param plaintext - Plaintext to be encrypted.\n * @param password - Password to use to encrypt plaintext.\n * @returns Encrypted ciphertext.\n *\n * @example\n * ```js\n * const ciphertext = await encrypt('my secret text', 'pw');\n * encrypt('my secret text', 'pw').then(function(ciphertext) { console.log(ciphertext); });\n * ```\n */\nconst encrypt = async (plaintext, password, algorithm = 'AES-GCM') => {\n const pwUtf8 = new TextEncoder().encode(password); // encode password as UTF-8\n const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8); // hash the password\n const iv = crypto.getRandomValues(new Uint8Array(12)); // get 96-bit random iv\n const ivStr = Array.from(iv).map((b) => String.fromCharCode(b)).join(''); // iv as utf-8 string\n const alg = { name: algorithm, iv }; // specify algorithm to use\n const key = await crypto.subtle.importKey('raw', pwHash, alg, false, ['encrypt']); // generate key from pw\n const ptUint8 = new TextEncoder().encode(plaintext); // encode plaintext as UTF-8\n const ctBuffer = await crypto.subtle.encrypt(alg, key, ptUint8); // encrypt plaintext using key\n const ctArray = Array.from(new Uint8Array(ctBuffer)); // ciphertext as byte array\n const ctStr = ctArray.map((byte) => String.fromCharCode(byte)).join(''); // ciphertext as string\n return window.btoa(ivStr + ctStr); // iv+ciphertext base64-encoded\n};\n/**\n * Decrypts ciphertext encrypted with encrypt() using supplied password.\n * (c) Chris Veness MIT Licence\n *\n * @param ciphertext - Ciphertext to be decrypted.\n * @param password - Password to use to decrypt ciphertext.\n * @returns Decrypted plaintext.\n *\n * @example\n * ```js\n * const plaintext = await decrypt(ciphertext, 'pw');\n * decrypt(ciphertext, 'pw').then(function(plaintext) { console.log(plaintext); });\n * ```\n */\nconst decrypt = async (ciphertext, password, algorithm = 'AES-GCM') => {\n const pwUtf8 = new TextEncoder().encode(password); // encode password as UTF-8\n const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8); // hash the password\n const ivStr = window.atob(ciphertext).slice(0, 12); // decode base64 iv\n const iv = new Uint8Array(Array.from(ivStr).map((ch) => ch.charCodeAt(0))); // iv as Uint8Array\n const alg = { name: algorithm, iv }; // specify algorithm to use\n const key = await crypto.subtle.importKey('raw', pwHash, alg, false, ['decrypt']); // generate key from pw\n const ctStr = window.atob(ciphertext).slice(12); // decode base64 ciphertext\n const ctUint8 = new Uint8Array(Array.from(ctStr).map((ch) => ch.charCodeAt(0))); // ciphertext as Uint8Array\n // note: why doesn't ctUint8 = new TextEncoder().encode(ctStr) work?\n try {\n const plainBuffer = await crypto.subtle.decrypt(alg, key, ctUint8); // decrypt ciphertext using key\n const plaintext = new TextDecoder().decode(plainBuffer); // plaintext from ArrayBuffer\n return plaintext; // return the plaintext\n }\n catch (e) {\n throw new Error('Decrypt failed');\n }\n};\n\nvar _a$2, _ObjectHash_algorithm, _ObjectHash_object, _ObjectHash_toHex, _ObjectHash_toBinary, _ObjectHash_toBase64, _ObjectHash_toBase64URL;\nconst algorithms = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512', 'none'];\nconst encodings = ['buffer', 'hex', 'binary', 'base64', 'base64url'];\nclass ObjectHash {\n constructor(algorithm = 'SHA-384') {\n _ObjectHash_algorithm.set(this, void 0);\n _ObjectHash_object.set(this, void 0);\n if (algorithm !== 'none') {\n validateCrypto();\n }\n __classPrivateFieldSet(this, _ObjectHash_algorithm, algorithm, \"f\");\n __classPrivateFieldSet(this, _ObjectHash_object, Object.create(null), \"f\");\n }\n update(object) {\n if (typeof object === 'object') {\n __classPrivateFieldSet(this, _ObjectHash_object, { ...__classPrivateFieldGet(this, _ObjectHash_object, \"f\"), ...object }, \"f\");\n }\n return this;\n }\n async digest(encoding = 'hex') {\n const json = JSON.stringify(__classPrivateFieldGet(this, _ObjectHash_object, \"f\"));\n if (__classPrivateFieldGet(this, _ObjectHash_algorithm, \"f\") === 'none') {\n return json;\n }\n const buffer = await getCryptoSubtle().digest(__classPrivateFieldGet(this, _ObjectHash_algorithm, \"f\"), new TextEncoder().encode(json));\n switch (encoding) {\n case 'binary':\n return __classPrivateFieldGet(ObjectHash, _a$2, \"m\", _ObjectHash_toBinary).call(ObjectHash, buffer);\n case 'base64':\n return __classPrivateFieldGet(ObjectHash, _a$2, \"m\", _ObjectHash_toBase64).call(ObjectHash, buffer);\n case 'base64url':\n return __classPrivateFieldGet(ObjectHash, _a$2, \"m\", _ObjectHash_toBase64URL).call(ObjectHash, buffer);\n case 'hex':\n return __classPrivateFieldGet(ObjectHash, _a$2, \"m\", _ObjectHash_toHex).call(ObjectHash, buffer);\n default:\n return buffer;\n }\n }\n}\n_a$2 = ObjectHash, _ObjectHash_algorithm = new WeakMap(), _ObjectHash_object = new WeakMap(), _ObjectHash_toHex = function _ObjectHash_toHex(buffer) {\n return [...new Uint8Array(buffer)]\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n}, _ObjectHash_toBinary = function _ObjectHash_toBinary(buffer) {\n return new Uint8Array(buffer).reduce((str, byte) => str + byte.toString(2).padStart(8, '0'), '');\n}, _ObjectHash_toBase64 = function _ObjectHash_toBase64(buffer) {\n let base64 = '';\n const encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n const bytes = new Uint8Array(buffer);\n const { byteLength } = bytes;\n const byteRemainder = byteLength % 3;\n const mainLength = byteLength - byteRemainder;\n let a, b, c, d;\n let chunk;\n // Main loop deals with bytes in chunks of 3\n for (let i = 0; i < mainLength; i += 3) {\n // Combine the three bytes into a single integer\n // eslint-disable-next-line no-bitwise\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n // Use bitmasks to extract 6-bit segments from the triplet\n // eslint-disable-next-line no-bitwise\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n // eslint-disable-next-line no-bitwise\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\n // eslint-disable-next-line no-bitwise\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\n // eslint-disable-next-line no-bitwise\n d = chunk & 63; // 63 = 2^6 - 1\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n }\n // Deal with the remaining bytes and padding\n if (byteRemainder === 1) {\n chunk = bytes[mainLength];\n // eslint-disable-next-line no-bitwise\n a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2\n // Set the 4 least significant bits to zero\n // eslint-disable-next-line no-bitwise\n b = (chunk & 3) << 4; // 3 = 2^2 - 1\n base64 += `${encodings[a] + encodings[b]}==`;\n }\n else if (byteRemainder === 2) {\n // eslint-disable-next-line no-bitwise\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\n // eslint-disable-next-line no-bitwise\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\n // eslint-disable-next-line no-bitwise\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n // Set the 2 least significant bits to zero\n // eslint-disable-next-line no-bitwise\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\n base64 += `${encodings[a] + encodings[b] + encodings[c]}=`;\n }\n return base64;\n}, _ObjectHash_toBase64URL = function _ObjectHash_toBase64URL(buffer) {\n return __classPrivateFieldGet(ObjectHash, _a$2, \"m\", _ObjectHash_toBase64).call(ObjectHash, buffer).replace(/\\+/g, '-').replace(/\\//, '_').replace(/=+$/, '');\n};\nconst objectHash = async (object, options) => {\n const opts = {\n algorithm: (options?.algorithm || 'SHA-384'),\n encoding: (options?.encoding || 'hex')\n };\n if (typeof object === 'undefined') {\n throw new Error('object argument required.');\n }\n if (algorithms.indexOf(opts.algorithm) === -1) {\n throw new Error(`algorithm \"${opts.encoding}\" not supported. supported values: ${algorithms.join(', ')}`);\n }\n if (encodings.indexOf(opts.encoding) === -1) {\n throw new Error(`encoding \"${opts.encoding}\" not supported. supported values: ${encodings.join(', ')}`);\n }\n const hasher = new ObjectHash(opts.algorithm);\n const digest = await hasher.update(object).digest(opts.encoding);\n return digest;\n};\n\n// import { CacheKeyManifest } from './key-manifest';\nvar _CacheManager_instances, _a$1, _CacheManager_prefix, _CacheManager_cache, _CacheManager_log, _CacheManager_nowProvider, _CacheManager_sign, _CacheManager_getCacheKeys, _CacheManager_validate, _CacheManager_matchExistingCacheKey;\nconst DEFAULT_EXPIRY_ADJUSTMENT_SECONDS = 0;\nconst DefaultNowProvider = () => Date.now();\nclass CacheManager {\n constructor(cache, logger, \n // keyManifest?: CacheKeyManifest,\n nowProvider = DefaultNowProvider, prefix = STORAGE_PREFIX) {\n _CacheManager_instances.add(this);\n _CacheManager_prefix.set(this, void 0);\n _CacheManager_cache.set(this, void 0);\n _CacheManager_log.set(this, void 0);\n _CacheManager_nowProvider.set(this, void 0);\n __classPrivateFieldSet(this, _CacheManager_prefix, prefix, \"f\");\n __classPrivateFieldSet(this, _CacheManager_cache, cache, \"f\");\n __classPrivateFieldSet(this, _CacheManager_log, logger, \"f\");\n __classPrivateFieldSet(this, _CacheManager_nowProvider, nowProvider, \"f\");\n }\n async get(cacheKey, secure = false, expiryAdjustmentSeconds = DEFAULT_EXPIRY_ADJUSTMENT_SECONDS) {\n const key = cacheKey.toString();\n let entry = await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").get(key, secure);\n if (!entry) {\n const keys = await __classPrivateFieldGet(this, _CacheManager_instances, \"m\", _CacheManager_getCacheKeys).call(this);\n if (!keys)\n return;\n const matchedKey = __classPrivateFieldGet(CacheManager, _a$1, \"m\", _CacheManager_matchExistingCacheKey).call(CacheManager, cacheKey, keys, __classPrivateFieldGet(this, _CacheManager_prefix, \"f\"));\n if (matchedKey) {\n entry = await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").get(matchedKey, secure);\n }\n }\n // if we still don't have an entry, exit.\n if (!entry) {\n __classPrivateFieldGet(this, _CacheManager_log, \"f\").debug('cache:get:miss', key);\n return;\n }\n // if an entry is not valid, remove and exit.\n if (!await __classPrivateFieldGet(CacheManager, _a$1, \"m\", _CacheManager_validate).call(CacheManager, entry)) {\n __classPrivateFieldGet(this, _CacheManager_log, \"f\").debug('cache:get:invalid', key);\n await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").remove(key);\n return;\n }\n const now = await __classPrivateFieldGet(this, _CacheManager_nowProvider, \"f\").call(this);\n const nowSeconds = Math.floor(now / 1000);\n // if an entry expired\n if (entry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {\n // if an entry has refresh token, refresh and exit;\n if (entry.token?.refreshToken) {\n __classPrivateFieldGet(this, _CacheManager_log, \"f\").debug('cache:get:refresh', key);\n await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").set(key, entry, secure);\n return entry;\n }\n // remove and exit;\n __classPrivateFieldGet(this, _CacheManager_log, \"f\").debug('cache:get:expired', key);\n await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").remove(key);\n // await this.keyManifest?.remove(cacheKey.toKey());\n return;\n }\n __classPrivateFieldGet(this, _CacheManager_log, \"f\").debug('cache:get:hit', key);\n return entry;\n }\n async set(entry, secure = false) {\n const cacheKey = new CacheKey({\n clientId: entry.clientId,\n scope: entry.scope,\n organization: entry.organization,\n audience: entry.audience\n }, __classPrivateFieldGet(this, _CacheManager_prefix, \"f\"));\n const signedEntry = await __classPrivateFieldGet(this, _CacheManager_instances, \"m\", _CacheManager_sign).call(this, entry);\n await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").set(cacheKey.toString(), signedEntry, secure);\n // await this.keyManifest?.add(cacheKey.toKey());\n }\n async clear(clientId) {\n const keys = await __classPrivateFieldGet(this, _CacheManager_instances, \"m\", _CacheManager_getCacheKeys).call(this);\n if (!keys) {\n return;\n }\n await keys\n .filter((key) => (clientId ? key.includes(clientId) : true))\n .reduce(async (memo, key) => {\n await memo;\n await __classPrivateFieldGet(this, _CacheManager_cache, \"f\").remove(key);\n }, Promise.resolve());\n // await this.keyManifest?.clear();\n }\n /**\n * Note: only call this if you're sure synchronous caches are being used.\n */\n clearSync(clientId) {\n const keys = __classPrivateFieldGet(this, _CacheManager_cache, \"f\").keys();\n /* istanbul ignore next */\n if (!keys)\n return;\n keys\n .filter((key) => (clientId ? key.includes(clientId) : true))\n .forEach((key) => {\n __classPrivateFieldGet(this, _CacheManager_cache, \"f\").remove(key);\n });\n }\n}\n_a$1 = CacheManager, _CacheManager_prefix = new WeakMap(), _CacheManager_cache = new WeakMap(), _CacheManager_log = new WeakMap(), _CacheManager_nowProvider = new WeakMap(), _CacheManager_instances = new WeakSet(), _CacheManager_sign = async function _CacheManager_sign(entry) {\n const now = await __classPrivateFieldGet(this, _CacheManager_nowProvider, \"f\").call(this);\n const expiresInTime = Math.floor(now / 1000) + (entry?.token?.expiresIn || 0);\n const expirySeconds = Math.min(expiresInTime, expiresInTime // entry.decodedToken.claims.exp\n );\n const data = { ...entry, expiresAt: expirySeconds };\n return { ...data, signature: await objectHash(data, { encoding: 'hex' }) };\n}, _CacheManager_getCacheKeys = async function _CacheManager_getCacheKeys() {\n return __classPrivateFieldGet(this, _CacheManager_cache, \"f\").keys();\n // return this.keyManifest\n // ? (await this.keyManifest.get())?.keys\n // : await this.cache.keys();\n}, _CacheManager_validate = async function _CacheManager_validate(entry) {\n const { signature, ...data } = entry;\n return signature === await objectHash(data, { encoding: 'hex' });\n}, _CacheManager_matchExistingCacheKey = function _CacheManager_matchExistingCacheKey(keyToMatch, keys, prefix = STORAGE_PREFIX) {\n return keys.filter((key) => {\n const cacheKey = CacheKey.fromString(key);\n const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(' '));\n const scopesToMatch = keyToMatch.scope.split(' ');\n const hasAllScopes = cacheKey.scope &&\n scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);\n return (cacheKey.prefix === prefix &&\n cacheKey.clientId === keyToMatch.clientId &&\n cacheKey.organization === keyToMatch.organization &&\n cacheKey.audience === keyToMatch.audience &&\n hasAllScopes);\n })[0];\n};\n\nvar _a, _InMemoryCache_storage, _InMemoryCache_prefix;\nclass InMemoryCache {\n constructor(prefix = STORAGE_PREFIX) {\n _InMemoryCache_prefix.set(this, void 0);\n __classPrivateFieldSet(this, _InMemoryCache_prefix, prefix, \"f\");\n }\n // eslint-disable-next-line class-methods-use-this\n set(key, entry) {\n __classPrivateFieldGet(InMemoryCache, _a, \"f\", _InMemoryCache_storage).set(key, entry);\n }\n // eslint-disable-next-line class-methods-use-this\n get(key) {\n const cache = __classPrivateFieldGet(InMemoryCache, _a, \"f\", _InMemoryCache_storage).get(key);\n if (!cache)\n return null;\n return cache;\n }\n // eslint-disable-next-line class-methods-use-this\n remove(key) {\n __classPrivateFieldGet(InMemoryCache, _a, \"f\", _InMemoryCache_storage).delete(key);\n }\n keys() {\n return [...__classPrivateFieldGet(InMemoryCache, _a, \"f\", _InMemoryCache_storage).keys()].filter((key) => key.startsWith(__classPrivateFieldGet(this, _InMemoryCache_prefix, \"f\")));\n }\n}\n_a = InMemoryCache, _InMemoryCache_prefix = new WeakMap();\n_InMemoryCache_storage = { value: new Map() };\n\nvar _LocalStorageCache_prefix, _LocalStorageCache_secret, _LocalStorageCache_algorithm, _SessionStorageCache_prefix;\nclass LocalStorageCache {\n constructor(prefix = STORAGE_PREFIX, secret, algorithm) {\n _LocalStorageCache_prefix.set(this, void 0);\n _LocalStorageCache_secret.set(this, void 0);\n _LocalStorageCache_algorithm.set(this, void 0);\n __classPrivateFieldSet(this, _LocalStorageCache_prefix, prefix, \"f\");\n __classPrivateFieldSet(this, _LocalStorageCache_secret, secret || process.env.NXWEB_AUTH_KEY || '', \"f\");\n __classPrivateFieldSet(this, _LocalStorageCache_algorithm, algorithm, \"f\");\n }\n // eslint-disable-next-line class-methods-use-this\n async set(key, entry, secure = false) {\n const item = secure\n ? await encrypt(JSON.stringify(entry), __classPrivateFieldGet(this, _LocalStorageCache_secret, \"f\"), __classPrivateFieldGet(this, _LocalStorageCache_algorithm, \"f\"))\n : JSON.stringify(entry);\n if (!item)\n return;\n localStorage.setItem(key, item);\n }\n // eslint-disable-next-line class-methods-use-this\n async get(key, secure = false) {\n const item = window.localStorage.getItem(key);\n if (!item)\n return null;\n try {\n const json = secure\n ? await decrypt(item, __classPrivateFieldGet(this, _LocalStorageCache_secret, \"f\"), __classPrivateFieldGet(this, _LocalStorageCache_algorithm, \"f\"))\n : item;\n if (!json)\n return null;\n const payload = JSON.parse(json);\n return payload;\n }\n catch (e) {\n /* istanbul ignore next */\n return null;\n }\n }\n // eslint-disable-next-line class-methods-use-this\n remove(key) {\n localStorage.removeItem(key);\n }\n keys() {\n return Object.keys(window.localStorage).filter((key) => key.startsWith(__classPrivateFieldGet(this, _LocalStorageCache_prefix, \"f\")));\n }\n}\n_LocalStorageCache_prefix = new WeakMap(), _LocalStorageCache_secret = new WeakMap(), _LocalStorageCache_algorithm = new WeakMap();\nclass SessionStorageCache {\n constructor(prefix = STORAGE_PREFIX) {\n _SessionStorageCache_prefix.set(this, void 0);\n __classPrivateFieldSet(this, _SessionStorageCache_prefix, prefix, \"f\");\n }\n // eslint-disable-next-line class-methods-use-this\n set(key, entry) {\n sessionStorage.setItem(key, JSON.stringify(entry));\n }\n // eslint-disable-next-line class-methods-use-this\n get(key) {\n const json = window.localStorage.getItem(key);\n if (!json)\n return null;\n try {\n const payload = JSON.parse(json);\n return payload;\n }\n catch (e) {\n /* istanbul ignore next */\n return null;\n }\n }\n // eslint-disable-next-line class-methods-use-this\n remove(key) {\n sessionStorage.removeItem(key);\n }\n keys() {\n return Object.keys(window.sessionStorage).filter((key) => key.startsWith(__classPrivateFieldGet(this, _SessionStorageCache_prefix, \"f\")));\n }\n}\n_SessionStorageCache_prefix = new WeakMap();\n\nvar LogLevel;\n(function (LogLevel) {\n LogLevel[LogLevel[\"None\"] = 0] = \"None\";\n LogLevel[LogLevel[\"Error\"] = 1] = \"Error\";\n LogLevel[LogLevel[\"Warning\"] = 2] = \"Warning\";\n LogLevel[LogLevel[\"Info\"] = 3] = \"Info\";\n LogLevel[LogLevel[\"Debug\"] = 4] = \"Debug\";\n})(LogLevel || (LogLevel = {}));\n\nvar _DebugLogger_level, _DebugLogger_logger;\nclass DebugLogger {\n constructor(options) {\n _DebugLogger_level.set(this, void 0);\n _DebugLogger_logger.set(this, void 0);\n __classPrivateFieldSet(this, _DebugLogger_level, options?.level || LogLevel.Debug, \"f\");\n __classPrivateFieldSet(this, _DebugLogger_logger, debuglog(options?.prefix || LOG_PREFIX.replace(/^\\[|\\]$/g, '')), \"f\");\n }\n // eslint-disable-next-line class-methods-use-this\n clear() {\n // NOP\n }\n debug(message, ...args) {\n if (__classPrivateFieldGet(this, _DebugLogger_level, \"f\") < LogLevel.Debug)\n return;\n __classPrivateFieldGet(this, _DebugLogger_logger, \"f\").call(this, message, ...args);\n }\n info(message, ...args) {\n if (__classPrivateFieldGet(this, _DebugLogger_level, \"f\") < LogLevel.Info)\n return;\n __classPrivateFieldGet(this, _DebugLogger_logger, \"f\").call(this, message, ...args);\n }\n warn(message, ...args) {\n if (__classPrivateFieldGet(this, _DebugLogger_level, \"f\") < LogLevel.Warning)\n return;\n __classPrivateFieldGet(this, _DebugLogger_logger, \"f\").call(this, message, ...args);\n }\n error(message, ...args) {\n if (__classPrivateFieldGet(this, _DebugLogger_level, \"f\") < LogLevel.Error)\n return;\n __classPrivateFieldGet(this, _DebugLogger_logger, \"f\").call(this, message, ...args);\n }\n}\n_DebugLogger_level = new WeakMap(), _DebugLogger_logger = new WeakMap();\n\nconst compact = (value) => {\n return value && Object.entries(value).reduce((obj, [k, v]) => {\n if (typeof v !== 'undefined') {\n obj[k] = v;\n }\n return obj;\n }, {});\n};\nconst isNumber = (n) => typeof n === 'number';\nconst parseNumber = (value) => {\n if (typeof value === 'number') {\n return value;\n }\n return typeof value === 'string' ? parseInt(value, 10) : undefined;\n};\nconst getDomain = (url) => {\n const domain = !/^https?:\\/\\//.test(url)\n ? `https://${url}`\n : url;\n return new URL(domain).origin;\n};\nconst getIssuer = (issuer, fallback) => {\n if (issuer) {\n return /^https?:\\/\\//.test(issuer) ? issuer : `https://${issuer}`;\n }\n return getDomain(fallback || '');\n};\nconst getUniqueScope = (...scopes) => {\n const entries = scopes.map((s) => (typeof s === 'string' ? s?.trim().split(' ') : []));\n return Array.from(new Set(entries.flat()))\n .filter((s) => !!s) // remove empty entries\n .sort() // sort scopes so it can be used as key\n .join(' ');\n};\nconst hasResponseType = (type, value) => {\n return value?.split(' ').includes(type) || false;\n};\n\nconst UserClaims = [\n 'name',\n 'given_name',\n 'family_name',\n 'middle_name',\n 'nickname',\n 'preferred_username',\n 'profile',\n 'picture',\n 'website',\n 'email',\n 'email_verified',\n 'gender',\n 'birthdate',\n 'zoneinfo',\n 'locale',\n 'phone_number',\n 'phone_number_verified',\n 'address',\n 'updated_at',\n 'sub'\n];\nconst buildAuthorizeURLParams = async (options, additionalParameters) => {\n const { clientId, responseType, redirectURL, scope, responseMode, state, nonce, codeVerifier, usePKCE, prompt, organization, audience } = options || {};\n const searchParams = new URLSearchParams();\n searchParams.set('client_id', clientId || '');\n searchParams.set('response_type', responseType || '');\n if (redirectURL) {\n searchParams.set('redirect_uri', redirectURL);\n }\n if (scope) {\n searchParams.set('scope', getUniqueScope(scope));\n }\n if (responseMode) {\n // if response type is not \"code\", then force response mode to \"fragment\"\n searchParams.set('response_mode', responseType !== 'code' ? 'fragment' : responseMode);\n }\n if (state) {\n searchParams.set('state', state);\n }\n if (nonce) {\n searchParams.set('nonce', nonce);\n }\n if (usePKCE !== false && codeVerifier) {\n const challenge = await deriveChallenge(codeVerifier);\n if (challenge) {\n searchParams.set('code_challenge', challenge);\n searchParams.set('code_challenge_method', 'S256');\n }\n else {\n searchParams.set('code_challenge', codeVerifier);\n searchParams.set('code_challenge_method', 'plain');\n }\n }\n if (prompt) {\n searchParams.set('prompt', prompt);\n }\n if (organization) {\n searchParams.set('organization', organization);\n }\n if (audience && audience !== clientId) {\n // if we have audience and the audience is not our clientId\n searchParams.set('audience', audience);\n }\n if (additionalParameters) {\n for (const [key, value] of Object.entries(additionalParameters)) {\n searchParams.append(key, value);\n }\n }\n return searchParams;\n};\nconst buildTokenURLHeaders = (options) => {\n const { clientId, clientSecret, codeVerifier, tokenAuthMethod, usePKCE, useFormData } = options;\n const headers = {\n Accept: 'application/json',\n 'Content-Type': useFormData\n ? 'application/x-www-form-urlencoded'\n : 'application/json'\n };\n // hydra requires BasicAuth for determining client specific cors settings\n // even though tokenAuthMethod is explicitly set to 'none'\n if (tokenAuthMethod === 'client_secret_basic' || tokenAuthMethod === 'none') {\n // only send clientSecret when usePKCE is explicitly set to false\n // or codeVerifier is not set\n if (usePKCE === false || typeof codeVerifier === 'undefined') {\n headers.Authorization = `Basic ${window.btoa(`${clientId || ''}:${clientSecret || ''}`)}`;\n }\n else {\n headers.Authorization = `Basic ${window.btoa(`${clientId || ''}:`)}`;\n }\n }\n return headers;\n};\nconst buildTokenURLParams = (options, additionalParameters) => {\n const { grantType, refreshToken, code, redirectURL, codeVerifier, clientId, clientSecret, tokenAuthMethod, usePKCE } = options;\n const searchParams = new URLSearchParams();\n if (grantType) {\n searchParams.set('grant_type', grantType);\n }\n if (refreshToken) {\n searchParams.set('refresh_token', refreshToken);\n }\n if (code) {\n searchParams.set('code', code);\n }\n if (redirectURL) {\n searchParams.set('redirect_uri', redirectURL);\n }\n if (tokenAuthMethod === 'client_secret_post' || tokenAuthMethod === 'none') {\n if (clientId) {\n searchParams.set('client_id', clientId);\n }\n // only send clientSecret when tokenAuthMethod is not 'none'\n // and usePKCE is explicitly set to false\n if (clientSecret && usePKCE === false && tokenAuthMethod !== 'none') {\n searchParams.set('client_secret', clientSecret);\n }\n }\n else if (tokenAuthMethod === 'client_secret_jwt') {\n searchParams.set('client_assertion_type', 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer');\n if (clientSecret) {\n searchParams.set('client_assertion', clientSecret);\n }\n }\n else if (tokenAuthMethod === 'private_key_jwt' && clientSecret) {\n searchParams.set('client_assertion', clientSecret);\n }\n if (usePKCE !== false && codeVerifier) {\n searchParams.set('code_verifier', codeVerifier);\n }\n if (additionalParameters) {\n for (const [key, value] of Object.entries(additionalParameters)) {\n searchParams.append(key, value);\n }\n }\n return searchParams;\n};\nconst buildLogoutURLParams = (options, additionalParameters) => {\n const { redirectURL, clientId, idTokenHint, state } = options || {};\n const searchParams = new URLSearchParams();\n if (clientId) {\n searchParams.set('client_id', clientId);\n }\n if (idTokenHint) {\n searchParams.set('id_token_hint', idTokenHint);\n if (redirectURL) {\n // post_logout_redirect_uri should only be set with idTokenHint\n searchParams.set('post_logout_redirect_uri', redirectURL);\n }\n }\n if (state) {\n searchParams.set('state', state);\n }\n if (additionalParameters) {\n for (const [key, value] of Object.entries(additionalParameters)) {\n searchParams.append(key, value);\n }\n }\n return searchParams;\n};\nconst buildURL = (url, options) => {\n const { domain, params, fragment } = options || {};\n const base = new URL(url, domain || undefined);\n if (params) {\n base.search = params.toString();\n }\n if (fragment) {\n base.hash = `#${fragment}`;\n }\n return base;\n};\nconst buildURLString = (url, options) => {\n return buildURL(url, options).toString().replace(/=(?=&|$)/g, '');\n};\nconst parseAuthorizeResult = (value) => {\n const qs = value.indexOf('#') > -1\n ? value.substring(0, value.indexOf('#'))\n : value;\n const queryParams = new URLSearchParams(qs);\n const parsedQuery = Object.fromEntries(queryParams);\n // eslint-disable-next-line camelcase\n const { code, state, expires_in: expiresIn, error, error_description: description, ...others } = parsedQuery;\n if (queryParams.has('error')) {\n return { error, description };\n }\n return {\n code,\n state,\n expiresIn: expiresIn ? parseInt(expiresIn, 10) : undefined,\n ...others\n };\n};\nconst parseTokenResult = (issuer, value) => {\n const { \n // eslint-disable-next-line camelcase\n token_type: type, id_token: idToken, access_token: accessToken, refresh_token: refreshToken, expires_in, scope } = value || {};\n const result = {\n type,\n issuer,\n idToken,\n accessToken,\n refreshToken,\n scope\n };\n // eslint-disable-next-line camelcase\n if (expires_in) {\n result.expiresIn = parseInt(expires_in, 10);\n }\n return result;\n};\nconst parseToken = (token) => {\n const parts = token.split('.');\n const [header, payload, signature] = parts;\n if (parts.length !== 3 || !header || !payload || !signature) {\n throw new Error('ID token could not be decoded');\n }\n const decoded = {\n encoded: { header, payload, signature },\n header: JSON.parse(fromBaseB64(header)),\n claims: { __raw: token },\n user: {}\n };\n const body = JSON.parse(fromBaseB64(payload));\n return Object.entries(body).reduce((obj, [k, v]) => {\n if (UserClaims.includes(k)) {\n obj.user[k] = v;\n }\n else {\n obj.claims[k] = v;\n }\n return obj;\n }, decoded);\n};\nconst verifyToken = (token, options) => {\n const { issuer, audience, nonce, organization, maxAge, leeway = 60, now = Date.now() } = options || {};\n const decoded = parseToken(token);\n if (!decoded.claims.iss) {\n throw new Error('issuer (iss) claim must be a string present in the ID token');\n }\n if (decoded.claims.iss.replace(/\\/$/, '') !== issuer?.replace(/\\/$/, '')) {\n throw new Error(`issuer (iss) claim mismatch in the ID token; expected \"${issuer}\", found \"${decoded.claims.iss}\"`);\n }\n if (!decoded.user.sub) {\n throw new Error('subject (sub) claim must be a string present in the ID token');\n }\n if (decoded.header.alg !== 'RS256') {\n throw new Error(`signature algorithm of \"${decoded.header.alg}\" is not supported. Expected the ID token to be signed with \"RS256\".`);\n }\n if (!decoded.claims.aud || !(typeof decoded.claims.aud === 'string' ||\n Array.isArray(decoded.claims.aud))) {\n throw new Error('audience (aud) claim must be a string or array of strings present in the ID token');\n }\n if (audience && Array.isArray(decoded.claims.aud)) {\n if (!decoded.claims.aud.includes(audience)) {\n throw new Error(`audience (aud) claim mismatch in the ID token; expected \"${audience}\" but was not one of \"${decoded.claims.aud.join(', ')}\"`);\n }\n if (decoded.claims.aud.length > 1) {\n if (!decoded.claims.azp) {\n throw new Error('authorized party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values');\n }\n if (decoded.claims.azp !== audience) {\n throw new Error(`authorized party (azp) claim mismatch in the ID token; expected \"${audience}\", found \"${decoded.claims.azp}\"`);\n }\n }\n }\n else if (audience && decoded.claims.aud !== audience) {\n throw new Error(`audience (aud) claim mismatch in the ID token; expected \"${audience}\" but found \"${decoded.claims.aud}\"`);\n }\n if (nonce) {\n if (!decoded.claims.nonce) {\n throw new Error('Nonce (nonce) claim must be a string present in the ID token');\n }\n if (decoded.claims.nonce !== nonce) {\n throw new Error(`nonce (nonce) claim mismatch in the ID token; expected \"${nonce}\", found \"${decoded.claims.nonce}\"`);\n }\n }\n if (maxAge && !isNumber(decoded.claims.auth_time)) {\n throw new Error('Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified');\n }\n /* istanbul ignore next */\n if (!isNumber(decoded.claims.exp)) {\n throw new Error('Expiration Time (exp) claim must be a number present in the ID token');\n }\n if (!isNumber(decoded.claims.iat)) {\n throw new Error('Issued At (iat) claim must be a number present in the ID token');\n }\n const current = new Date(now);\n const expDate = new Date(0);\n const nbfDate = new Date(0);\n const authTimeDate = new Date(0);\n authTimeDate.setUTCSeconds(parseInt(decoded.claims.auth_time || '0', 10) + (maxAge || 0) + leeway);\n expDate.setUTCSeconds((decoded.claims.exp || 0) + leeway);\n nbfDate.setUTCSeconds((decoded.claims.nbf || 0) - leeway);\n if (current > expDate) {\n throw new Error(`expiration time (exp) claim error in the ID token; current time (${current}) is after expiration time (${expDate})`);\n }\n if (isNumber(decoded.claims.nbf) && current < nbfDate) {\n throw new Error(`not before time (nbf) claim in the ID token indicates that this token can't be used just yet. Currrent time (${current}) is before ${nbfDate}`);\n }\n // only verify auth_time if maxAge is specified\n if (maxAge && isNumber(decoded.claims.auth_time) && current > authTimeDate) {\n throw new Error(`authentication time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Currrent time (${current}) is after last auth at ${authTimeDate}`);\n }\n if (organization) {\n if (!decoded.claims.org_id) {\n throw new Error('organization ID (org_id) claim must be a string present in the ID token');\n }\n else if (organization !== decoded.claims.org_id) {\n throw new Error(`organization ID (org_id) claim mismatch in the ID token; expected \"${organization}\", found \"${decoded.claims.org_id}\"`);\n }\n }\n return decoded;\n};\nconst getResponseParams = (url, responseType) => {\n const ref = url instanceof URL ? url : new URL(url);\n const err = ref.searchParams.get('error');\n if (err) {\n const desc = ref.searchParams.get('error_description');\n return {\n error: err,\n description: desc || ''\n };\n }\n const res = (responseType || '').split(' ').map((o) => o.trim());\n const param = new URLSearchParams(res.includes('token') || res.includes('id_token')\n ? ref.hash.replace(/^#/, '')\n : ref.search);\n return [...param.entries()].reduce((acc, [key, val]) => {\n // eslint-disable-next-line no-prototype-builtins\n if (acc.hasOwnProperty(key)) {\n if (Array.isArray(acc[key])) {\n acc[key].push(val);\n }\n else {\n // if it's not an array, but contains a value, we'll convert it into an array\n // and add the current value to it\n acc[key] = [acc[key], val];\n }\n }\n else {\n acc[key] = val;\n }\n return acc;\n }, {});\n};\n\nvar __assign = (undefined && undefined.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nfunction stringifyAttribute(name, value) {\r\n if (!value) {\r\n return '';\r\n }\r\n var stringified = '; ' + name;\r\n if (value === true) {\r\n return stringified; // boolean attributes shouldn't have a value\r\n }\r\n return stringified + '=' + value;\r\n}\r\nfunction stringifyAttributes(attributes) {\r\n if (typeof attributes.expires === 'number') {\r\n var expires = new Date();\r\n expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);\r\n attributes.expires = expires;\r\n }\r\n return stringifyAttribute('Expires', attributes.expires ? attributes.expires.toUTCString() : '')\r\n + stringifyAttribute('Domain', attributes.domain)\r\n + stringifyAttribute('Path', attributes.path)\r\n + stringifyAttribute('Secure', attributes.secure)\r\n + stringifyAttribute('SameSite', attributes.sameSite);\r\n}\r\nfunction encode(name, value, attributes) {\r\n return encodeURIComponent(name)\r\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) // allowed special characters\r\n .replace(/\\(/g, '%28').replace(/\\)/g, '%29') // replace opening and closing parens\r\n + '=' + encodeURIComponent(value)\r\n // allowed special characters\r\n .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)\r\n + stringifyAttributes(attributes);\r\n}\r\nfunction parse(cookieString) {\r\n var result = {};\r\n var cookies = cookieString ? cookieString.split('; ') : [];\r\n for (var _i = 0, cookies_1 = cookies; _i < cookies_1.length; _i++) {\r\n var cookie = cookies_1[_i];\r\n var parts = cookie.split('=');\r\n var value = parts.slice(1).join('=');\r\n if (value[0] === '\"') {\r\n value = value.slice(1, -1);\r\n }\r\n try {\r\n var name_1 = decodeURIComponent(parts[0]);\r\n result[name_1] = value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent);\r\n }\r\n catch (e) {\r\n // ignore cookies with invalid name/value encoding\r\n }\r\n }\r\n return result;\r\n}\r\nfunction getAll() {\r\n return parse(document.cookie);\r\n}\r\nfunction get(name) {\r\n return getAll()[name];\r\n}\r\nfunction set(name, value, attributes) {\r\n document.cookie = encode(name, value, __assign({ path: '/' }, attributes));\r\n}\r\nfunction remove(name, attributes) {\r\n set(name, '', __assign(__assign({}, attributes), { expires: -1 }));\r\n}\n\n/**\n * A storage protocol for marshalling data to/from cookies\n */\nclass CookieStorage {\n // eslint-disable-next-line class-methods-use-this\n get name() {\n return 'cookie';\n }\n // eslint-disable-next-line class-methods-use-this\n get(key) {\n const value = get(key);\n if (typeof value === 'undefined') {\n return;\n }\n return JSON.parse(value);\n }\n // eslint-disable-next-line class-methods-use-this\n save(key, value, options = {}) {\n let attributes = {};\n if (window.location.protocol === 'https:') {\n attributes = {\n secure: true,\n sameSite: 'none'\n };\n }\n if (options?.expires) {\n attributes.expires = options.expires;\n }\n if (options?.domain) {\n attributes.domain = options.domain;\n }\n set(key, JSON.stringify(value), attributes);\n }\n // eslint-disable-next-line class-methods-use-this\n remove(key, options = {}) {\n const attributes = {};\n if (options?.domain) {\n attributes.domain = options.domain;\n }\n remove(key, attributes);\n }\n}\n\n/**\n * A storage protocol for marshalling data to/from session storage\n */\nclass SessionStorage {\n // eslint-disable-next-line class-methods-use-this\n get name() {\n return 'session';\n }\n // eslint-disable-next-line class-methods-use-this\n get(key) {\n if (typeof sessionStorage === 'undefined') {\n return;\n }\n const value = sessionStorage.getItem(key);\n if (typeof value === 'undefined' || value === null) {\n return;\n }\n return JSON.parse(value);\n }\n // eslint-disable-next-line class-methods-use-this\n save(key, value) {\n sessionStorage.setItem(key, JSON.stringify(value));\n }\n // eslint-disable-next-line class-methods-use-this\n remove(key) {\n sessionStorage.removeItem(key);\n }\n}\n\nfunction fetchDefault(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return {ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t;}),t(a());},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null);})}\n\nconst DEFAULT_TIMEOUT = 10000;\nconst DEFAULT_RETRY = 3;\n// see: https://github.com/microsoft/TypeScript/issues/50690\nconst fetch = fetchDefault;\nconst doFetch = async (url, fetchOptions) => {\n const response = await fetch(url, fetchOptions);\n return {\n ok: response.ok,\n data: await response.json()\n };\n};\nconst fetchWithoutWorker = async (url, options, timeout) => {\n const controller = createAbortController();\n options.signal = controller.signal;\n let timeoutId;\n // The promise will resolve with one of these two promises (the fetch or the timeout), whichever completes first.\n return Promise.race([\n doFetch(url, options),\n new Promise((_, reject) => {\n timeoutId = setTimeout(() => {\n controller.abort();\n reject(new Error(\"timeout while executing 'fetch'\"));\n }, timeout);\n })\n ]).finally(() => clearTimeout(timeoutId));\n};\nconst fetchWithWorker = async (worker, url, options, scope, organization, audience, formData, timeout = DEFAULT_TIMEOUT) => {\n return sendMessage({\n url,\n options,\n auth: { scope, organization, audience },\n formData,\n timeout\n }, worker);\n};\nconst createAbortController = () => new AbortController();\n/**\n * Sends the specified message to the web worker\n * @param message - The message to send\n * @param to - The worker to send the message to\n */\nconst sendMessage = (message, to) => new Promise((resolve, reject) => {\n const messageChannel = new MessageChannel();\n // eslint-disable-next-line func-names\n messageChannel.port1.onmessage = function (event) {\n // Only for fetch errors, as these get retried\n if (event.data?.error) {\n reject(event.data.error);\n }\n else {\n resolve(event.data);\n }\n };\n to.postMessage(message, [messageChannel.port2]);\n});\nconst switchFetch = async (url, options, scope, organization, audience, worker, formData, timeout = DEFAULT_TIMEOUT) => {\n if (worker) {\n return fetchWithWorker(worker, url, options, scope, organization, audience, formData, timeout);\n }\n return fetchWithoutWorker(url, options, timeout);\n};\nasync function getJSON(url, options, scope, organization, audience, worker, formData, timeout = DEFAULT_TIMEOUT) {\n let fetchError = null;\n let response;\n for (let i = 0; i < DEFAULT_RETRY; i++) {\n try {\n response = await switchFetch(url, options, scope, organization, audience, worker, formData, timeout);\n fetchError = null;\n break;\n }\n catch (e) {\n // Fetch only fails in the case of a network issue, so should be\n // retried here. Failure status (4xx, 5xx, etc) return a resolved Promise\n // with the failure in the body.\n // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\n fetchError = e;\n }\n }\n if (fetchError) {\n // unfetch uses XMLHttpRequest under the hood which throws\n // ProgressEvents on error, which don't have message properties\n fetchError.message ||= 'Failed to fetch';\n throw fetchError;\n }\n const { \n // eslint-disable-next-line camelcase\n data: { error, ...data }, ok } = response;\n if (!ok || error) {\n throw new AuthError(error || 'request_error', error?.error_description || `HTTP error. Unable to fetch ${url}`);\n }\n return data;\n}\n\nvar _WebAuthClient_instances, _WebAuthClient_debug, _WebAuthClient_worker, _WebAuthClient_log, _WebAuthClient_cache, _WebAuthClient_manager, _WebAuthClient_storage, _WebAuthClient_transaction, _WebAuthClient_nowProvider, _WebAuthClient_config, _WebAuthClient_authenticatedCookieName, _WebAuthClient_organizationCookieName, _WebAuthClient_domain, _WebAuthClient_issuer, _WebAuthClient_useRefreshToken, _WebAuthClient_useRefreshTokenFallback, _WebAuthClient_useWebMessage, _WebAuthClient_getClientId, _WebAuthClient_getScope, _WebAuthClient_getOrganization, _WebAuthClient_getAudience, _WebAuthClient_getAuthorizeURL, _WebAuthClient_getTokenURL, _WebAuthClient_getRedirectURL, _WebAuthClient_getLogoutURL, _WebAuthClient_getLogoutRedirectURL, _WebAuthClient_getRedirectMethod, _WebAuthClient_getResponseType, _WebAuthClient_getResponseMode, _WebAuthClient_getTokenAuthMethod, _WebAuthClient_getTimeout, _WebAuthClient_getCookieDomain, _WebAuthClient_getToken, _WebAuthClient_getTokenUsingIFrame, _WebAuthClient_getTokenUsingRefreshToken, _WebAuthClient_getAuth, _WebAuthClient_getCacheData, _WebAuthClient_setCacheData, _WebAuthClient_verifyIdToken, _WebAuthClient_prepareLogger, _WebAuthClient_prepareCache, _WebAuthClient_prepareStorage;\nconst singlePromiseMap = {};\nconst Lock = _default;\nconst lock = new Lock();\nconst GET_TOKEN_LOCK = [STORAGE_PREFIX, 'syncLock', 'getToken'].join(KEY_SEPARATOR);\nconst authenticatedCookieName = (clientId) => `__NXAUTH|${clientId}|authenticated`;\nconst organizationCookieName = (clientId) => `__NXAUTH|${clientId}|organization`;\nconst validateConfig = (config) => {\n if (!config.clientId) {\n throw MissingClientIDError;\n }\n if (!config.authorizeURL) {\n throw MissingAuthorizeURLError;\n }\n if (!config.redirectURL) {\n throw MissingRedirectURLError;\n }\n if (!config.responseType) {\n throw MissingResponseTypeError;\n }\n if (hasResponseType('code', config.responseType) && !config.tokenURL) {\n throw MissingTokenURLError;\n }\n};\nconst singlePromise = (cb, key) => {\n let promise = singlePromiseMap[key];\n if (!promise) {\n promise = cb().finally(() => {\n delete singlePromiseMap[key];\n promise = null;\n });\n singlePromiseMap[key] = promise;\n }\n return promise;\n};\nconst retryPromise = async (cb, maxNumberOfRetries = 3) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n return false;\n};\nconst runIFrame = (url, eventOrigin, redirectURL, timeout = 60000) => {\n return new Promise((resolve, reject) => {\n const iframe = window.document.createElement('iframe');\n iframe.setAttribute('width', '0');\n iframe.setAttribute('height', '0');\n iframe.style.display = 'none';\n let messageHandler;\n const removeIFrame = () => {\n if (window.document.body.contains(iframe)) {\n window.document.body.removeChild(iframe);\n window.removeEventListener('message', messageHandler, false);\n }\n };\n const timeoutSetTimeoutId = window.setTimeout(() => {\n reject(AuthTimeoutError);\n removeIFrame();\n }, timeout);\n const cleanUp = (delay = 2000) => {\n clearTimeout(timeoutSetTimeoutId);\n window.removeEventListener('message', messageHandler, false);\n // Delay the removal of the iframe to prevent hanging loading status\n window.setTimeout(removeIFrame, delay);\n };\n const attachUnload = () => {\n const unloadHandler = () => {\n window.setTimeout(() => {\n let href;\n try {\n href = iframe.contentWindow?.location.href;\n if (href && redirectURL && href.indexOf(redirectURL) >= 0) {\n const queryStringFragments = href.split(href.indexOf('?') > 0 ? '?' : '#').slice(1);\n const result = queryStringFragments.length > 0\n ? parseAuthorizeResult(queryStringFragments.join(''))\n : undefined;\n if (result) {\n resolve(result);\n }\n }\n }\n catch (ignore) {\n // ignore DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.\n reject(ignore);\n }\n finally {\n cleanUp();\n }\n }, 0);\n };\n if (iframe.contentWindow) {\n try {\n iframe.contentWindow.removeEventListener('unload', unloadHandler);\n iframe.contentWindow.addEventListener('unload', unloadHandler);\n }\n catch {\n // DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.\n }\n }\n };\n messageHandler = function (e) {\n if (e.origin !== eventOrigin)\n return;\n if (!e.data || e.data.type !== 'authorization_response')\n return;\n const eventSource = e.source;\n if (eventSource) {\n eventSource.close();\n }\n e.data.response.error\n ? reject(e.data.response)\n : resolve(e.data.response);\n cleanUp();\n };\n window.addEventListener('message', messageHandler, false);\n window.document.body.appendChild(iframe);\n iframe.addEventListener('load', attachUnload);\n iframe.setAttribute('src', url);\n });\n};\nconst openPopup = (url, options) => {\n const { width = 400, height = 600 } = options || {};\n const left = options?.left || window.screenX + (window.innerWidth - width) / 2;\n const top = options?.top || window.screenY + (window.innerHeight - height) / 2;\n const popupName = options?.name || [STORAGE_PREFIX, 'popup'].join(KEY_SEPARATOR);\n return window.open(url, popupName, `left=${left},top=${top},width=${width},height=${height},resizable,scrollbars=yes,status=1`);\n};\nconst runPopup = (useWebMessage, options, logger) => {\n const { popup, timeout = 60000 } = options;\n return new Promise((resolve, reject) => {\n let popupEventListener;\n let pluginClosed = false;\n let perodicId;\n // Check each second if the popup is closed triggering a PopupCancelledError\n const popupTimer = window.setInterval(() => {\n if (popup && popup.closed && !pluginClosed) {\n clearInterval(popupTimer);\n clearTimeout(timeoutId);\n clearTimeout(perodicId);\n window.removeEventListener('message', popupEventListener, false);\n pluginClosed = true;\n reject(AuthPopupCancelledError);\n }\n }, 1000);\n const timeoutId = window.setTimeout(() => {\n clearInterval(popupTimer);\n clearTimeout(timeoutId);\n clearTimeout(perodicId);\n window.removeEventListener('message', popupEventListener, false);\n if (!popup.closed) {\n pluginClosed = true;\n popup.close();\n }\n reject(AuthPopupTimeoutError);\n }, timeout);\n if (useWebMessage) {\n popupEventListener = function (e) {\n if (!e.data || e.data.type !== 'authorization_response') {\n return;\n }\n clearTimeout(timeoutId);\n clearInterval(popupTimer);\n window.removeEventListener('message', popupEventListener, false);\n pluginClosed = true;\n popup?.close();\n if (e.data.response.error) {\n return reject(e.data.response);\n }\n resolve(e.data.response);\n };\n window.addEventListener('message', popupEventListener);\n }\n else { // use traditional polling\n const interval = 300;\n const checkFn = (opts, res, rej) => {\n if (popup?.closed || pluginClosed) {\n return;\n }\n let href;\n try {\n href = popup?.location.href;\n }\n catch (ignore) {\n // ignore DOMException: Blocked a frame with origin \"...\" from accessing a cross-origin frame.\n }\n if (href && opts.redirectURL && href.indexOf(opts.redirectURL) >= 0) {\n logger?.debug('client:runPopup:redirect', { url: href });\n const response = getResponseParams(href, opts.responseType);\n logger?.debug('client:runPopup:response', { response });\n clearTimeout(timeoutId);\n clearInterval(popupTimer);\n clearTimeout(perodicId);\n pluginClosed = true;\n popup?.close();\n if (!response) {\n return rej(AuthInvalidResponseError);\n }\n return response.error ? rej(response) : res(response);\n }\n clearInterval(perodicId);\n perodicId = window.setTimeout(() => checkFn(opts, res, rej), interval);\n };\n logger?.debug('client:runPopup:check', { options });\n perodicId = window.setTimeout(() => checkFn(options, resolve, reject), interval);\n }\n });\n};\nclass WebAuthClient {\n constructor(config, options) {\n _WebAuthClient_instances.add(this);\n _WebAuthClient_debug.set(this, void 0);\n _WebAuthClient_worker.set(this, void 0);\n _WebAuthClient_log.set(this, void 0);\n _WebAuthClient_cache.set(this, void 0);\n _WebAuthClient_manager.set(this, void 0);\n _WebAuthClient_storage.set(this, void 0);\n _WebAuthClient_transaction.set(this, void 0);\n _WebAuthClient_nowProvider.set(this, void 0);\n _WebAuthClient_config.set(this, void 0);\n _WebAuthClient_authenticatedCookieName.set(this, void 0);\n _WebAuthClient_organizationCookieName.set(this, void 0);\n _WebAuthClient_domain.set(this, void 0);\n _WebAuthClient_issuer.set(this, void 0);\n _WebAuthClient_useRefreshToken.set(this, void 0);\n _WebAuthClient_useRefreshTokenFallback.set(this, void 0);\n _WebAuthClient_useWebMessage.set(this, void 0);\n validateCrypto();\n validateConfig(config);\n __classPrivateFieldSet(this, _WebAuthClient_config, config, \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_debug, config.debug || false, \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_authenticatedCookieName, authenticatedCookieName(__classPrivateFieldGet(this, _WebAuthClient_config, \"f\").clientId), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_organizationCookieName, organizationCookieName(__classPrivateFieldGet(this, _WebAuthClient_config, \"f\").clientId), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_domain, getDomain(__classPrivateFieldGet(this, _WebAuthClient_config, \"f\").domain || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").authorizeURL || ''), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_issuer, getIssuer(__classPrivateFieldGet(this, _WebAuthClient_config, \"f\").issuer, __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").domain || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").authorizeURL), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_useRefreshToken, options?.useRefreshToken !== false || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").useRefreshToken !== false, \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_useRefreshTokenFallback, options?.useRefreshTokenFallback !== false, \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_useWebMessage, options?.useWebMessage === true || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").useWebMessage === true, \"f\");\n // keep these in separate lines!\n // Most bundlers support \"... = new Worker(new URL(...))\" pattern\n // providing the url as variables should keep it out of bundler's static-analyzer\n const workerURL = new URL('../workers/token.worker.js', import.meta.url);\n __classPrivateFieldSet(this, _WebAuthClient_worker, new Worker(workerURL, { type: 'module' }), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_log, __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_prepareLogger).call(this, options?.logger), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_cache, __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_prepareCache).call(this, options?.cache), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_nowProvider, options?.nowProvider || DefaultNowProvider, \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_manager, new CacheManager(__classPrivateFieldGet(this, _WebAuthClient_cache, \"f\"), __classPrivateFieldGet(this, _WebAuthClient_log, \"f\"), __classPrivateFieldGet(this, _WebAuthClient_nowProvider, \"f\")), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_storage, __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_prepareStorage).call(this, options?.storage), \"f\");\n __classPrivateFieldSet(this, _WebAuthClient_transaction, new Transaction(new SessionStorage(), __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").clientId, TRANSACTION_PREFIX, __classPrivateFieldGet(this, _WebAuthClient_log, \"f\")), \"f\");\n }\n /**\n * ```js\n * await auth.buildAuthorizeUrl(options);\n * ```\n *\n * Builds an `/authorize` URL for loginWithRedirect using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated.\n *\n * @param options - The login URL options\n * @param additionalParameters - The additional parameters to include in URL\n */\n async buildLoginURL(options, additionalParameters) {\n const { usePKCE, additionalParameters: addonParams } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n const { nonce, state, codeVerifier, prompt, fragment } = options || {};\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options?.redirectURL);\n const responseType = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getResponseType).call(this);\n const responseMode = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getResponseMode).call(this, options?.responseMode);\n const params = await buildAuthorizeURLParams({\n clientId,\n scope,\n organization,\n redirectURL,\n responseType,\n responseMode,\n nonce,\n state,\n codeVerifier,\n prompt,\n usePKCE\n }, { ...(addonParams || {}), ...(additionalParameters || {}) });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:buildLoginURL:params', Object.fromEntries(params));\n const authorizeURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuthorizeURL).call(this);\n const url = buildURLString(authorizeURL, { domain: __classPrivateFieldGet(this, _WebAuthClient_domain, \"f\"), params, fragment });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:buildLoginURL:url', url);\n return url;\n }\n /**\n * ```js\n * await auth.loginWithRedirect(options);\n * ```\n *\n * Performs a redirect to `/authorize` using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated.\n *\n * @param options - The login options\n * @param additionalParameters - The additional parameters to include in URL\n */\n async loginWithRedirect(options, additionalParameters) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this);\n const audience = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAudience).call(this);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options?.redirectURL);\n const redirectMethod = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectMethod).call(this, options?.redirectMethod);\n const nonce = randomString(32);\n const state = randomString(32);\n const codeVerifier = randomString(64);\n const url = await this.buildLoginURL({\n ...options, redirectURL, nonce, state, codeVerifier\n }, additionalParameters);\n const entry = {\n clientId,\n scope,\n audience,\n organization,\n redirectURL,\n redirectMethod,\n nonce,\n state,\n codeVerifier,\n data: options?.data,\n fragment: options?.fragment\n };\n __classPrivateFieldGet(this, _WebAuthClient_transaction, \"f\").create(entry);\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:loginWithRedirect:entry', entry);\n window.location[redirectMethod](url);\n }\n /**\n * ```js\n * try {\n * await loginWithPopup(options);\n * } catch(e) {\n * if (e instanceof AuthError && e.code === ErrAuthPopupCancelled) {\n * // Popup was closed before login completed\n * }\n * }\n * ```\n *\n * Opens a popup with the `/authorize` URL using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated. If the response is successful,\n * results will be valid according to their expiration times.\n *\n * IMPORTANT: This method has to be called from an event handler\n * that was started by the user like a button click, for example,\n * otherwise the popup will be blocked in most browsers.\n *\n * @param options - The login options\n * @param additionalParameters - The additional parameters to include in URL\n */\n async loginWithPopup(options, additionalParameters) {\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options?.redirectURL);\n const timeout = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTimeout).call(this, options?.timeout);\n const nonce = randomString(32);\n const state = randomString(32);\n const codeVerifier = randomString(64);\n const { popup, windowOptions } = options || {};\n let popupHandle = popup;\n if (!popupHandle) {\n popupHandle = openPopup('', windowOptions);\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:loginWithPopup:openPopup', windowOptions);\n if (!popupHandle) {\n throw new Error(`Unable to open a popup! Please make sure your browser is allowing pop-ups and redirects from ${window.location.origin}.`);\n }\n }\n const url = await this.buildLoginURL({\n ...options, redirectURL, nonce, state, codeVerifier, responseMode: __classPrivateFieldGet(this, _WebAuthClient_useWebMessage, \"f\") ? 'web_message' : options?.responseMode\n }, additionalParameters);\n popupHandle.location.href = url;\n const result = await runPopup(__classPrivateFieldGet(this, _WebAuthClient_useWebMessage, \"f\"), { ...options, redirectURL, popup: popupHandle, timeout }, __classPrivateFieldGet(this, _WebAuthClient_log, \"f\"));\n if ('error' in result) {\n throw new AuthError(result.error, result.description);\n }\n else if (state !== result.state) {\n throw AuthInvalidStateError;\n }\n const authResult = await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuth).call(this, {\n grantType: 'authorization_code',\n redirectURL,\n code: result.code,\n codeVerifier,\n nonce,\n timeout\n });\n if (authResult) {\n const { token, user, claims } = authResult;\n await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_setCacheData).call(this, { token, user, claims });\n }\n }\n /**\n * After the browser redirects back to the callback page,\n * call `handleRedirectCallback` to handle success and error\n * responses from identity provider. If the response is successful, results\n * will be valid according to their expiration times.\n */\n async handleRedirectCallback(url = window.location.href) {\n const queryStringFragments = url.split(url.indexOf('?') > 0 ? '?' : '#').slice(1);\n if (queryStringFragments.length === 0) {\n throw new Error('There are no query params available for parsing.');\n }\n const result = parseAuthorizeResult(queryStringFragments.join(''));\n if ('error' in result) {\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:handleRedirectCallback:error', {\n error: result.error,\n description: result.description\n });\n throw new AuthError(result.error, result.description);\n }\n const entry = __classPrivateFieldGet(this, _WebAuthClient_transaction, \"f\").get();\n if (!entry) {\n throw AuthInvalidStateError;\n }\n __classPrivateFieldGet(this, _WebAuthClient_transaction, \"f\").remove();\n const { codeVerifier, nonce } = entry;\n const { state, code, ...others } = result;\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:handleRedirectCallback:entry', {\n entry,\n state,\n code,\n codeVerifier\n });\n // Transaction should have a `codeVerifier` to do PKCE for CSRF protection\n if (!codeVerifier || (entry.state && entry.state !== state)) {\n throw AuthInvalidStateError;\n }\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this, entry.organization);\n const timeout = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTimeout).call(this);\n const authResult = await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuth).call(this, {\n organization,\n grantType: 'authorization_code',\n code,\n codeVerifier,\n nonce,\n timeout\n });\n if (authResult) {\n const { token, user, claims } = authResult;\n await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_setCacheData).call(this, { token, user, claims });\n }\n return {\n code, state, data: entry.data, ...others\n };\n }\n /**\n * ```js\n * await buildLogoutUrl(options);\n * ```\n *\n * Builds a URL to the logout endpoint using the parameters provided as arguments.\n *\n * @param options - The logout URL options.\n * @param additionalParameters - The additional parameters to include in URL\n */\n buildLogoutURL(options = {}, additionalParameters) {\n const { additionalParameters: addonParams } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n const { idTokenHint, state } = options;\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const logoutURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getLogoutURL).call(this);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getLogoutRedirectURL).call(this, options.redirectURL);\n const params = buildLogoutURLParams({\n clientId,\n redirectURL,\n idTokenHint,\n state\n }, { ...(addonParams || {}), ...(additionalParameters || {}) });\n const url = buildURLString(logoutURL, { domain: __classPrivateFieldGet(this, _WebAuthClient_domain, \"f\"), params });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:logoutURL', url, {\n clientId,\n redirectURL,\n idTokenHint,\n state,\n additionalParameters\n });\n return url;\n }\n /**\n * ```js\n * logout();\n * ```\n *\n * Clears the application session and performs a redirect using\n * the parameters provided as arguments, to clear the session.\n *\n * **Note:** If you are using a custom cache, and specifying `localOnly: true`,\n * you should `await` the result of calling `logout`.\n *\n * If the `federated` option is specified it also clears the Identity Provider session.\n * If the `localOnly` option is specified, it only clears the application session.\n * It is invalid to set both the `federated` and `localOnly` options to `true`,\n * and an error will be thrown if you do.\n *\n * @param options - The logout options.\n * @param additionalParameters - The additional parameters to include in URL\n */\n logout(options = {}, additionalParameters) {\n const domain = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCookieDomain).call(this);\n const postCacheClear = () => {\n const { localOnly, ...logoutOptions } = options;\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").remove(__classPrivateFieldGet(this, _WebAuthClient_organizationCookieName, \"f\"), { domain });\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").remove(__classPrivateFieldGet(this, _WebAuthClient_authenticatedCookieName, \"f\"), { domain });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:logout', { ...options, localOnly });\n if (localOnly) {\n window.location.assign(logoutOptions.redirectURL || window.location.origin);\n }\n else {\n const url = this.buildLogoutURL(logoutOptions, additionalParameters);\n window.location.assign(url);\n }\n };\n if (__classPrivateFieldGet(this, _WebAuthClient_cache, \"f\")) {\n return __classPrivateFieldGet(this, _WebAuthClient_manager, \"f\").clear().then(() => postCacheClear());\n }\n // this.#manager.clearSync();\n // postCacheClear();\n }\n /**\n * ```js\n * const user = await getAuth();\n * ```\n *\n * Returns the token and user information if available (decoded\n * from the `id_token`).\n *\n * If you provide an audience or scope, they should match an existing Access Token\n * (the SDK stores a corresponding ID Token with every Access Token, and uses the\n * scope and audience to look up the ID Token)\n *\n * @typeparam T - The type to return.\n * @param options - The getUser options\n */\n async getAuth(options) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this, options?.scope);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this, options?.organization);\n const audience = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAudience).call(this, options?.audience);\n return __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCacheData).call(this, { clientId, organization, scope, audience });\n }\n /**\n * ```js\n * await checkSession();\n * ```\n *\n * Check if the user is logged in using `getToken`. The difference\n * with `getToken` is that this doesn't return a token, but it will\n * pre-fill the token cache.\n *\n * This method also heeds the `{prefix}|{clientId}|authenticated` cookie, as an optimization\n * to prevent calling identity provider unnecessarily. If the cookie is not present because\n * there was no previous login (or it has expired) then tokens will not be refreshed.\n *\n * **Note:** the cookie **may not** be present if running an app using a private tab, as some\n * browsers clear JS cookie data and local storage when the tab or page is closed, or on page reload. This effectively\n * means that `checkSession` could silently return without authenticating the user on page refresh when\n * using a private tab, despite having previously logged in. As a workaround, use `getToken` instead\n * and handle the possible `login_required` error.\n *\n * @param options - The options\n */\n async checkSession(options) {\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:checkSession', compact(options));\n if (!__classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").get(__classPrivateFieldGet(this, _WebAuthClient_authenticatedCookieName, \"f\"))) {\n return;\n }\n try {\n await this.getToken(options);\n }\n catch (error) {\n if (!RECOVERABLE_ERRORS.includes(error.error)) {\n throw error;\n }\n }\n }\n /**\n * Fetches a new access token, and either returns just the access token (the default)\n * or the response from the /oauth/token endpoint, depending on the `details` option.\n *\n * ```js\n * const token = await getToken(options);\n * ```\n *\n * If there's a valid token stored and it has more than 60 seconds\n * remaining before expiration, return the token. Otherwise, attempt\n * to obtain a new token.\n *\n * A new token will be obtained either by opening an iframe or a\n * refresh token (if `useRefreshToken` is `true`)\n \n * If iframes are used, opens an iframe with the `/authorize` URL\n * using the parameters provided as arguments. Random and secure `state`\n * and `nonce` parameters will be auto-generated. If the response is successful,\n * results will be validated according to their expiration times.\n *\n * If refresh tokens are used, the token endpoint is called directly with the\n * 'refresh_token' grant. If no refresh token is available to make this call,\n * the SDK falls back to using an iframe to the '/authorize' URL.\n *\n * This method may use a web worker to perform the token call if the in-memory\n * cache is used.\n *\n * If an `audience` value is given to this function, the SDK always falls\n * back to using an iframe to make the token exchange.\n *\n * Note that in all cases, falling back to an iframe requires access to\n * the cookie.\n *\n * @param options - The options\n */\n async getToken(options = {}) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this, options.scope);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this, options.organization);\n const audience = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAudience).call(this, options.audience);\n return singlePromise(() => __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getToken).call(this, { ...options, audience, scope, organization }), [clientId, scope, organization, audience].join('|'));\n }\n}\n_WebAuthClient_debug = new WeakMap(), _WebAuthClient_worker = new WeakMap(), _WebAuthClient_log = new WeakMap(), _WebAuthClient_cache = new WeakMap(), _WebAuthClient_manager = new WeakMap(), _WebAuthClient_storage = new WeakMap(), _WebAuthClient_transaction = new WeakMap(), _WebAuthClient_nowProvider = new WeakMap(), _WebAuthClient_config = new WeakMap(), _WebAuthClient_authenticatedCookieName = new WeakMap(), _WebAuthClient_organizationCookieName = new WeakMap(), _WebAuthClient_domain = new WeakMap(), _WebAuthClient_issuer = new WeakMap(), _WebAuthClient_useRefreshToken = new WeakMap(), _WebAuthClient_useRefreshTokenFallback = new WeakMap(), _WebAuthClient_useWebMessage = new WeakMap(), _WebAuthClient_instances = new WeakSet(), _WebAuthClient_getClientId = function _WebAuthClient_getClientId() {\n return __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").clientId;\n}, _WebAuthClient_getScope = function _WebAuthClient_getScope(scope) {\n return getUniqueScope(scope, __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").scope);\n}, _WebAuthClient_getOrganization = function _WebAuthClient_getOrganization(organization) {\n return organization ||\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").get(__classPrivateFieldGet(this, _WebAuthClient_organizationCookieName, \"f\")) ||\n __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").organization;\n}, _WebAuthClient_getAudience = function _WebAuthClient_getAudience(audience) {\n return audience || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").audience;\n}, _WebAuthClient_getAuthorizeURL = function _WebAuthClient_getAuthorizeURL() {\n return __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").authorizeURL;\n}, _WebAuthClient_getTokenURL = function _WebAuthClient_getTokenURL() {\n return __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").tokenURL;\n}, _WebAuthClient_getRedirectURL = function _WebAuthClient_getRedirectURL(redirectURL) {\n return redirectURL ||\n __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").redirectURL ||\n window.location.origin;\n}, _WebAuthClient_getLogoutURL = function _WebAuthClient_getLogoutURL(logoutURL) {\n return logoutURL || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").logoutURL;\n}, _WebAuthClient_getLogoutRedirectURL = function _WebAuthClient_getLogoutRedirectURL(redirectURL) {\n return redirectURL ||\n __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").logoutRedirectURL ||\n window.location.origin;\n}, _WebAuthClient_getRedirectMethod = function _WebAuthClient_getRedirectMethod(redirectMethod) {\n return redirectMethod || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").redirectMethod || 'assign';\n}, _WebAuthClient_getResponseType = function _WebAuthClient_getResponseType(responseType) {\n return responseType || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").responseType || 'none';\n}, _WebAuthClient_getResponseMode = function _WebAuthClient_getResponseMode(responseMode) {\n return responseMode || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").responseMode;\n}, _WebAuthClient_getTokenAuthMethod = function _WebAuthClient_getTokenAuthMethod(tokenAuthMethod) {\n return tokenAuthMethod || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").tokenAuthMethod;\n}, _WebAuthClient_getTimeout = function _WebAuthClient_getTimeout(timeout) {\n return timeout || __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").timeout;\n}, _WebAuthClient_getCookieDomain = function _WebAuthClient_getCookieDomain() {\n return __classPrivateFieldGet(this, _WebAuthClient_config, \"f\").cookieDomain;\n}, _WebAuthClient_getToken = async function _WebAuthClient_getToken(options = {}) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const { ignoreCache, details, scope, organization, audience } = options;\n // Check the cache before acquiring the lock to avoid the latency of\n // `lock.acquireLock` when the cache is populated.\n if (!ignoreCache) {\n const cache = await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCacheData).call(this, { clientId, scope, organization, audience });\n if (cache) {\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getToken:cache', cache);\n return details ? cache.token : cache.token?.accessToken;\n }\n }\n if (await retryPromise(() => lock.acquireLock(GET_TOKEN_LOCK, 5000), 10)) {\n try {\n // Check the cache a second time, because it may have been populated\n // by a previous call while this call was waiting to acquire the lock.\n if (!ignoreCache) {\n const cache = await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCacheData).call(this, { clientId, scope, organization, audience });\n if (cache) {\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getToken:cache', cache);\n return details ? cache.token : cache.token?.accessToken;\n }\n }\n const nonce = randomString(32);\n const state = randomString(32);\n const codeVerifier = randomString(64);\n const result = __classPrivateFieldGet(this, _WebAuthClient_useRefreshToken, \"f\")\n ? await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenUsingRefreshToken).call(this, options, { nonce, state, codeVerifier })\n : __classPrivateFieldGet(this, _WebAuthClient_useWebMessage, \"f\")\n ? await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenUsingIFrame).call(this, options, { nonce, state, codeVerifier })\n : await this.loginWithRedirect();\n if (!result)\n return;\n const { token, user, claims } = result;\n await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_setCacheData).call(this, { token, user, claims });\n return details ? token : token?.accessToken;\n }\n finally {\n await lock.releaseLock(GET_TOKEN_LOCK);\n }\n }\n else {\n throw AuthTimeoutError;\n }\n}, _WebAuthClient_getTokenUsingIFrame = async function _WebAuthClient_getTokenUsingIFrame(options, args) {\n const { usePKCE } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options.redirectURL);\n const responseType = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getResponseType).call(this);\n const responseMode = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getResponseMode).call(this, 'web_message');\n const timeout = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTimeout).call(this, options.timeout);\n const { scope, organization, audience } = options;\n const { nonce, state, codeVerifier } = args;\n const params = await buildAuthorizeURLParams({\n clientId,\n scope,\n organization,\n audience,\n redirectURL,\n responseType,\n responseMode,\n prompt: 'none',\n nonce,\n state,\n codeVerifier,\n usePKCE\n });\n const authorizeURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuthorizeURL).call(this);\n const url = buildURLString(authorizeURL, { domain: __classPrivateFieldGet(this, _WebAuthClient_domain, \"f\"), params });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getTokenUsingIFrame:options', { url, params: Object.fromEntries(params) });\n try {\n // When a browser is running in a Cross-Origin Isolated context, using iframes is not possible.\n // It doesn't throw an error but times out instead, so we should exit early and inform the user about the reason.\n // https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated\n if (window.crossOriginIsolated) {\n throw new AuthError('login_required', 'The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.');\n }\n const result = await runIFrame(url, __classPrivateFieldGet(this, _WebAuthClient_domain, \"f\"), redirectURL, timeout);\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getTokenUsingIFrame:result', result);\n if ('error' in result) {\n throw new AuthError(result.error, result.description);\n }\n else if (state !== result.state) {\n throw AuthInvalidStateError;\n }\n return await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuth).call(this, {\n scope,\n organization,\n audience,\n grantType: 'authorization_code',\n redirectURL,\n code: result.code,\n codeVerifier,\n nonce,\n timeout\n });\n }\n catch (e) {\n if (e.error === 'login_required') {\n this.logout({ localOnly: true });\n }\n else {\n throw e;\n }\n }\n}, _WebAuthClient_getTokenUsingRefreshToken = async function _WebAuthClient_getTokenUsingRefreshToken(options, args) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const { scope, organization, audience } = options;\n const cache = await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCacheData).call(this, { clientId, scope, organization, audience });\n const refreshToken = cache?.token?.refreshToken;\n // if we don't have a refresh token in memory or web worker memory\n // fallback to an iframe.\n if (!refreshToken && !__classPrivateFieldGet(this, _WebAuthClient_worker, \"f\")) {\n if (!__classPrivateFieldGet(this, _WebAuthClient_useRefreshTokenFallback, \"f\")) {\n throw AuthInvalidRefreshTokenError;\n }\n if (__classPrivateFieldGet(this, _WebAuthClient_useWebMessage, \"f\")) {\n return __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenUsingIFrame).call(this, options, args);\n }\n throw new AuthError('login_required', 'The provider does not support retrieving a token silently without refresh token.', { idTokenHint: cache?.token?.idToken });\n }\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getTokenUsingRefreshToken', refreshToken);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options.redirectURL);\n const timeout = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTimeout).call(this, options.timeout);\n const { nonce } = args;\n try {\n return await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAuth).call(this, {\n organization,\n grantType: 'refresh_token',\n redirectURL,\n refreshToken,\n codeVerifier: null,\n nonce,\n timeout\n });\n }\n catch (e) {\n if (__classPrivateFieldGet(this, _WebAuthClient_useWebMessage, \"f\") &&\n (e instanceof AuthError && e.code === ErrAuthInvalidRefreshToken) &&\n __classPrivateFieldGet(this, _WebAuthClient_useRefreshTokenFallback, \"f\")) {\n // fallback to an iframe.\n return __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenUsingIFrame).call(this, options, args);\n }\n throw e;\n }\n}, _WebAuthClient_getAuth = async function _WebAuthClient_getAuth(options) {\n const { clientSecret, usePKCE, useFormData } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n const { grantType, refreshToken, code, codeVerifier = null, nonce = randomString(32), timeout = 10000 } = options;\n const worker = __classPrivateFieldGet(this, _WebAuthClient_worker, \"f\");\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const tokenURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenURL).call(this);\n const tokenAuthMethod = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getTokenAuthMethod).call(this);\n const redirectURL = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getRedirectURL).call(this, options.redirectURL);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this, options.scope);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this, options.organization);\n const audience = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAudience).call(this, options.audience);\n const tokenOptions = {\n clientId,\n clientSecret,\n scope,\n organization,\n audience,\n grantType,\n tokenURL,\n redirectURL,\n tokenAuthMethod,\n refreshToken,\n code,\n codeVerifier,\n nonce,\n usePKCE,\n useFormData\n };\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getAuth:options', options);\n const headers = buildTokenURLHeaders(tokenOptions);\n const params = buildTokenURLParams(tokenOptions);\n const body = useFormData\n ? params.toString()\n : JSON.stringify(Object.fromEntries(params));\n const url = buildURLString(tokenURL, { domain: __classPrivateFieldGet(this, _WebAuthClient_domain, \"f\") });\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getAuthResult:params', { url, headers, params: Object.fromEntries(params), body });\n const authResult = await getJSON(url, {\n method: 'POST',\n body,\n headers\n }, scope, organization, audience, worker, useFormData, timeout);\n const token = parseTokenResult(__classPrivateFieldGet(this, _WebAuthClient_issuer, \"f\"), authResult);\n const { user, claims } = token.idToken\n ? await __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_verifyIdToken).call(this, token.idToken, nonce, organization, audience)\n : {};\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getAuthResult:result', {\n result: authResult,\n parsed: { token, user, claims }\n });\n return { token, user, claims };\n}, _WebAuthClient_getCacheData = async function _WebAuthClient_getCacheData(key) {\n const cacheKey = new CacheKey(key);\n const entry = await __classPrivateFieldGet(this, _WebAuthClient_manager, \"f\").get(cacheKey, !__classPrivateFieldGet(this, _WebAuthClient_debug, \"f\"), 60);\n __classPrivateFieldGet(this, _WebAuthClient_log, \"f\").debug('client:getCacheData', cacheKey.toString(), entry);\n return entry;\n}, _WebAuthClient_setCacheData = async function _WebAuthClient_setCacheData(data, expires = 1) {\n const clientId = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getClientId).call(this);\n const domain = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getCookieDomain).call(this);\n const organization = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getOrganization).call(this);\n const audience = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getAudience).call(this);\n const scope = __classPrivateFieldGet(this, _WebAuthClient_instances, \"m\", _WebAuthClient_getScope).call(this);\n const { token, user, claims } = data;\n await __classPrivateFieldGet(this, _WebAuthClient_manager, \"f\").set({\n clientId: clientId,\n scope,\n organization,\n audience,\n token,\n user,\n claims\n }, !__classPrivateFieldGet(this, _WebAuthClient_debug, \"f\"));\n // save authenticated cookie\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").save(__classPrivateFieldGet(this, _WebAuthClient_authenticatedCookieName, \"f\"), __classPrivateFieldGet(this, _WebAuthClient_nowProvider, \"f\").call(this), {\n expires,\n domain\n });\n // save organization-hint cookie, if any\n if (claims?.org_id) {\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").save(__classPrivateFieldGet(this, _WebAuthClient_organizationCookieName, \"f\"), claims?.org_id, {\n expires, domain\n });\n }\n else {\n __classPrivateFieldGet(this, _WebAuthClient_storage, \"f\").remove(__classPrivateFieldGet(this, _WebAuthClient_organizationCookieName, \"f\"), {\n domain\n });\n }\n}, _WebAuthClient_verifyIdToken = async function _WebAuthClient_verifyIdToken(idToken, nonce, organization, audience) {\n const now = await __classPrivateFieldGet(this, _WebAuthClient_nowProvider, \"f\").call(this);\n const { leeway, maxAge } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n return verifyToken(idToken, {\n issuer: __classPrivateFieldGet(this, _WebAuthClient_issuer, \"f\"),\n audience,\n nonce,\n organization,\n leeway,\n maxAge: parseNumber(maxAge),\n now\n });\n}, _WebAuthClient_prepareLogger = function _WebAuthClient_prepareLogger(logger) {\n const { debug } = __classPrivateFieldGet(this, _WebAuthClient_config, \"f\");\n return logger || new DebugLogger({\n level: typeof debug === 'boolean'\n ? debug ? LogLevel.Debug : LogLevel.None\n : LogLevel.Error\n });\n}, _WebAuthClient_prepareCache = function _WebAuthClient_prepareCache(cache, prefix) {\n return cache || (__classPrivateFieldGet(this, _WebAuthClient_useRefreshToken, \"f\")\n ? new LocalStorageCache(prefix)\n : new InMemoryCache(prefix));\n}, _WebAuthClient_prepareStorage = function _WebAuthClient_prepareStorage(storage) {\n return storage || new CookieStorage();\n};\n\nvar jsxRuntime = {exports: {}};\n\nvar reactJsxRuntime_production_min = {};\n\n/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar hasRequiredReactJsxRuntime_production_min;\n\nfunction requireReactJsxRuntime_production_min () {\n\tif (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;\n\thasRequiredReactJsxRuntime_production_min = 1;\nvar f=require$$0,k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\n\tfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;\n\treturn reactJsxRuntime_production_min;\n}\n\n(function (module) {\n\n\t{\n\t module.exports = requireReactJsxRuntime_production_min();\n\t}\n} (jsxRuntime));\n\nconst resolveCache = (cache, prefix) => {\n if (!cache)\n return;\n if (typeof cache === 'object')\n return cache;\n switch (cache) {\n case 'local':\n return new LocalStorageCache(prefix);\n case 'session':\n return new SessionStorageCache(prefix);\n default:\n return new InMemoryCache(prefix);\n }\n};\n\nvar _ConsoleLogger_prefix, _ConsoleLogger_level;\nclass ConsoleLogger {\n constructor(options) {\n _ConsoleLogger_prefix.set(this, void 0);\n _ConsoleLogger_level.set(this, void 0);\n __classPrivateFieldSet(this, _ConsoleLogger_prefix, options?.prefix || LOG_PREFIX, \"f\");\n __classPrivateFieldSet(this, _ConsoleLogger_level, options?.level || LogLevel.Debug, \"f\");\n }\n // eslint-disable-next-line class-methods-use-this\n clear() {\n // eslint-disable-next-line no-console\n console.clear();\n }\n debug(message, ...args) {\n if (__classPrivateFieldGet(this, _ConsoleLogger_level, \"f\") < LogLevel.Debug)\n return;\n console.debug(__classPrivateFieldGet(this, _ConsoleLogger_prefix, \"f\"), message, ...args);\n }\n info(message, ...args) {\n if (__classPrivateFieldGet(this, _ConsoleLogger_level, \"f\") < LogLevel.Info)\n return;\n // eslint-disable-next-line no-console\n console.info(__classPrivateFieldGet(this, _ConsoleLogger_prefix, \"f\"), message, ...args);\n }\n warn(message, ...args) {\n if (__classPrivateFieldGet(this, _ConsoleLogger_level, \"f\") < LogLevel.Warning)\n return;\n console.warn(__classPrivateFieldGet(this, _ConsoleLogger_prefix, \"f\"), message, ...args);\n }\n error(message, ...args) {\n if (__classPrivateFieldGet(this, _ConsoleLogger_level, \"f\") < LogLevel.Error)\n return;\n console.error(__classPrivateFieldGet(this, _ConsoleLogger_prefix, \"f\"), message, ...args);\n }\n}\n_ConsoleLogger_prefix = new WeakMap(), _ConsoleLogger_level = new WeakMap();\n\nconst detectPlatforms = (win) => {\n return (Object.keys(PLATFORMS_MAP)).filter((p) => PLATFORMS_MAP[p](win));\n};\nconst testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);\nconst setupPlatforms = (win = window) => {\n if (typeof win === 'undefined') {\n return [];\n }\n win.Ionic ||= {};\n let { platforms } = win.Ionic;\n if (platforms == null) {\n platforms = detectPlatforms(win);\n // compat with ionic\n win.Ionic.platforms = platforms;\n platforms.forEach((p) => { win.document.documentElement.classList.add(`plt-${p}`); });\n }\n return platforms;\n};\nconst getPlatforms = (win) => setupPlatforms(win);\nconst matchMedia = (win, query) => win.matchMedia?.(query).matches;\nconst isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');\nconst isDesktop = (win) => !isMobile(win);\nconst isHybrid = (win) => isCordova(win) || isCapacitorNative(win);\nconst isCordova = (win) => !!(win.cordova || win.phonegap || win.PhoneGap);\nconst isCapacitorNative = (win) => {\n const capacitor = win.Capacitor;\n return !!capacitor?.isNative;\n};\nconst isElectron = (win) => testUserAgent(win, /electron/i);\nconst isPWA = (win) => !!(win.matchMedia?.('(display-mode: standalone)').matches || win.navigator.standalone);\nconst isMobileWeb = (win) => isMobile(win) && !isHybrid(win);\nconst isIpad = (win) => {\n // iOS 12 and below\n if (testUserAgent(win, /iPad/i)) {\n return true;\n }\n // iOS 13+\n if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {\n return true;\n }\n return false;\n};\nconst isIphone = (win) => testUserAgent(win, /iPhone/i);\nconst isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);\nconst isAndroid = (win) => testUserAgent(win, /android|sink/i);\nconst isAndroidTablet = (win) => {\n return isAndroid(win) && !testUserAgent(win, /mobile/i);\n};\nconst isPhablet = (win) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;\n};\nconst isTablet = (win) => {\n const width = win.innerWidth;\n const height = win.innerHeight;\n const smallest = Math.min(width, height);\n const largest = Math.max(width, height);\n return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);\n};\nfunction isPlatform(winOrPlatform, platform) {\n if (typeof winOrPlatform === 'string') {\n // eslint-disable-next-line no-param-reassign\n platform = winOrPlatform;\n winOrPlatform = undefined;\n }\n return getPlatforms(winOrPlatform).includes(platform);\n}\nconst PLATFORMS_MAP = {\n ipad: isIpad,\n iphone: isIphone,\n ios: isIOS,\n android: isAndroid,\n phablet: isPhablet,\n tablet: isTablet,\n cordova: isCordova,\n capacitor: isCapacitorNative,\n electron: isElectron,\n pwa: isPWA,\n mobile: isMobile,\n mobileweb: isMobileWeb,\n desktop: isDesktop,\n hybrid: isHybrid,\n web: () => true\n};\n\n/**\n * Handles how that state changes in the `useAuth` hook.\n */\nconst AuthReducer = (state, action) => {\n switch (action.type) {\n case 'LOGIN_POPUP_STARTED':\n return {\n ...state,\n loading: true\n };\n case 'LOGIN_MANUAL':\n return {\n ...state,\n loading: false,\n authenticated: true,\n data: action.data,\n error: undefined\n };\n case 'LOGIN_POPUP_COMPLETE':\n case 'INITIALIZED':\n return {\n ...state,\n loading: false,\n authenticated: !!action.data?.token?.accessToken,\n data: action.data,\n error: undefined\n };\n case 'HANDLE_REDIRECT_COMPLETE':\n case 'GET_ACCESS_TOKEN_COMPLETE':\n if (state.data?.hash === action.data?.hash) {\n return state;\n }\n return {\n ...state,\n loading: false,\n authenticated: !!action.data?.token?.accessToken,\n data: action.data\n };\n case 'LOGOUT':\n return {\n ...state,\n authenticated: false,\n data: undefined\n };\n case 'ERROR':\n return {\n ...state,\n loading: false,\n error: action.error\n };\n default:\n return state;\n }\n};\n\nconst CODE_RE = /[?&]code=[^&]+/;\nconst STATE_RE = /[?&]state=[^&]+/;\nconst ERROR_RE = /[?&]error=[^&]+/;\nconst hasAuthParams = (searchParams = window.location.search) => (CODE_RE.test(searchParams) || ERROR_RE.test(searchParams)) && STATE_RE.test(searchParams);\n\nconst stub = () => {\n throw new Error('You forgot to wrap your component in .');\n};\nconst defaultOnRedirectCallback = (state) => {\n window.history.replaceState({}, document.title, state?.returnTo || window.location.pathname);\n};\nconst createDispatcher = (dispatch, logger) => {\n return (action) => {\n switch (action.type) {\n case 'ERROR':\n logger?.error('provider:dispatch', { type: action.type, error: action.error });\n break;\n case 'INITIALIZED':\n case 'LOGIN_POPUP_COMPLETE':\n case 'GET_ACCESS_TOKEN_COMPLETE':\n case 'HANDLE_REDIRECT_COMPLETE': {\n const { organization, user, token, claims, hash } = action.data || {};\n logger?.debug('provider:dispatch', {\n type: action.type,\n data: action.data === Auth.Empty\n ? Object.create(null)\n : {\n organization,\n user: user?.raw(),\n token: token?.raw(),\n claims: claims && Object.fromEntries(claims),\n hash\n }\n });\n break;\n }\n default:\n logger?.debug('provider:dispatch', { type: action.type });\n break;\n }\n dispatch(action);\n };\n};\nconst isPathExcluded = (path, list) => {\n if (!list)\n return false;\n return list\n .map((o) => {\n if (o instanceof RegExp) {\n return o;\n }\n return typeof o === 'string'\n ? new RegExp(o, 'i')\n : undefined;\n })\n .some((pattern) => pattern?.test(path));\n};\nconst initialContext = {\n authenticated: false,\n loading: true,\n data: Auth.Empty,\n config: {},\n buildLoginURL: stub,\n login: stub,\n loginWithRedirect: stub,\n loginWithPopup: stub,\n handleRedirectCallback: stub,\n buildLogoutURL: stub,\n logout: stub\n // getAccessTokenSilently: stub,\n // getAccessTokenWithPopup: stub,\n // getIdTokenClaims: stub,\n};\nconst AuthProvider = ({ config, platform, client, cache, logger, debug = false, manual = false, disabled = false, ignoreCache = false, popup = false, exclude, skipRedirect, loader, error, children, onInit, onConfigChange, onRedirect = defaultOnRedirectCallback }) => {\n const init = useRef(false);\n const enabled = useMemo(() => {\n if (typeof disabled === 'function') {\n return !disabled(window.location.pathname);\n }\n return !disabled;\n }, [disabled]);\n const curPlatform = useMemo(() => platform || (isPlatform('ios') ? 'ios' : isPlatform('android') ? 'android' : 'web'), [platform]);\n const options = useMemo(() => buildConfig({ ...config, debug: debug || config.debug }, curPlatform), [debug, config, curPlatform]);\n const log = useMemo(() => logger || (options.debug ? new ConsoleLogger() : NullLogger), [logger, options.debug]);\n const engine = useMemo(() => {\n return typeof client === 'function'\n ? client(options)\n : client || new WebAuthClient(options, { logger: log, cache: resolveCache(cache) });\n }, [cache, client, options, log]);\n const [state, dispatch] = useReducer(AuthReducer, {\n authenticated: false,\n loading: true,\n config: Object.freeze(options)\n });\n const dispatcher = useMemo(() => createDispatcher(dispatch, logger), [logger]);\n const render = useCallback((api, view, error) => {\n if (!enabled || api?.authenticated) {\n return typeof view === 'function'\n ? view(api, window.location.pathname)\n : view;\n }\n if (typeof error === 'function') {\n return error(api, window.location.pathname) || null;\n }\n return error === true\n ? null\n : typeof view === 'function' ? view(api, window.location.pathname) : view;\n }, [enabled]);\n const buildLoginURL = useCallback((options, additionalParameters) => engine.buildLoginURL(options, additionalParameters), [engine]);\n const loginWithRedirect = useCallback((options, additionalParameters) => engine.loginWithRedirect(options, additionalParameters), [engine]);\n const loginWithPopup = useCallback(async (options, additionalParameters) => {\n dispatcher({ type: 'LOGIN_POPUP_STARTED' });\n try {\n await engine.loginWithPopup(options, additionalParameters);\n }\n catch (error) {\n if (error instanceof AuthError && (error.code === ErrAuthPopupCancelled ||\n error.code === ErrAuthPopupTimeout)) {\n dispatcher({ type: 'ERROR', error });\n }\n else {\n dispatcher({ type: 'ERROR', error: normalizeError('login failed')(error) });\n }\n return;\n }\n const data = await engine.getAuth();\n const hash = data && await objectHash(data, { encoding: 'hex' });\n dispatcher({ type: 'LOGIN_POPUP_COMPLETE', data: data && new Auth(data, hash) });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [engine]);\n const login = useCallback(async (auth) => {\n const hash = auth && await objectHash(auth, { encoding: 'hex' });\n dispatcher({ type: 'LOGIN_MANUAL', data: auth ? new Auth(auth, hash) : Auth.Empty });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const handleRedirectCallback = useCallback(async (url) => {\n try {\n return await engine.handleRedirectCallback(url);\n }\n catch (error) {\n throw normalizeError('failed retrieving access token')(error);\n }\n finally {\n const data = await engine.getAuth();\n const hash = data && await objectHash(data, { encoding: 'hex' });\n dispatcher({\n type: 'HANDLE_REDIRECT_COMPLETE',\n data: data && new Auth(data, hash)\n });\n }\n }, [dispatcher, engine]);\n const buildLogoutURL = useCallback((options, additionalParameters) => engine.buildLogoutURL(options, additionalParameters), [engine]);\n const logout = useCallback((options, additionalParameters) => {\n const opts = { ...(options || {}), idTokenHint: state.data?.token?.idToken };\n return engine.logout(opts, additionalParameters);\n }, [engine, state]);\n const api = useMemo(() => {\n return {\n ...state,\n buildLoginURL,\n login,\n loginWithRedirect,\n loginWithPopup,\n buildLogoutURL,\n logout,\n handleRedirectCallback\n // getAccessTokenSilently,\n // getAccessTokenWithPopup,\n // getIdTokenClaims,\n };\n }, [\n state,\n buildLoginURL,\n login,\n loginWithRedirect,\n loginWithPopup,\n buildLogoutURL,\n logout,\n handleRedirectCallback\n // getAccessTokenSilently,\n // getAccessTokenWithPopup,\n // getIdTokenClaims\n ]);\n useEffect(() => {\n if (onConfigChange) {\n onConfigChange(options);\n }\n log?.debug('provider:configuration', { config: compact(options), platform: curPlatform });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, curPlatform]);\n useEffect(() => {\n log?.debug('provider:initialized', { initialized: init.current, onInit });\n if (init.current) {\n return;\n }\n if (onInit) {\n const config = compact(options);\n log?.debug('provider:initialization', config);\n onInit(api, config);\n }\n init.current = true;\n (async () => {\n try {\n if (hasAuthParams() && !skipRedirect) {\n const result = await engine.handleRedirectCallback();\n onRedirect(result);\n }\n else if (enabled && !isPathExcluded(window.location.pathname, exclude)) {\n log?.debug('provider:checkSession', { location: window.location.pathname });\n await engine.checkSession({ ignoreCache });\n }\n const data = await engine.getAuth();\n log?.debug('provider:authorize', compact({ data }));\n if (data) {\n const hash = data && await objectHash(data, { encoding: 'hex' });\n dispatcher({ type: 'INITIALIZED', data: data && new Auth(data, hash) });\n }\n else if (enabled && !manual) {\n log?.debug('provider:login', { manual, popup });\n if (popup === true) {\n await loginWithPopup();\n }\n else {\n await loginWithRedirect();\n }\n }\n else {\n log?.debug('provider:login', { manual, data: Auth.Empty });\n dispatcher({ type: 'INITIALIZED', data: Auth.Empty });\n }\n }\n catch (error) {\n if (error.code === 'login_required') {\n await engine.logout(error.params || { localOnly: true });\n }\n else if (error.code === 'invalid_refresh_token') {\n await engine.logout({ localOnly: true });\n }\n else {\n console.error(error);\n dispatcher({ type: 'ERROR', error: normalizeError('login failed')(error) });\n }\n }\n })();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [engine, manual, popup, exclude, onInit, onRedirect, skipRedirect]);\n return (jsxRuntime.exports.jsx(AuthContext.Provider, { value: api, children: (!init.current || api.loading) && loader\n ? loader\n : render(api, children, error) }));\n};\n/**\n * The Auth Context\n */\nconst AuthContext = createContext(initialContext);\nfunction useAuth() {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error('useAuth must be used within a component');\n }\n return context;\n}\n\nexport { Auth, AuthContext, AuthProvider, AuthReducer, LOG_PREFIX, STORAGE_PREFIX, TRANSACTION_PREFIX, Token, Transaction, User, WebAuthClient, buildConfig, getConfigValue, useAuth };\n//# sourceMappingURL=index.js.map\n"],"names":["LOG_PREFIX","KEY_SEPARATOR","STORAGE_PREFIX","filter","Boolean","join","TRANSACTION_PREFIX","RECOVERABLE_ERRORS","__classPrivateFieldGet","receiver","state","kind","f","TypeError","has","call","value","get","__classPrivateFieldSet","set","_User_id","_User_name","_User_email","_User_phone","_User_picture","_User_groups","_User_raw","_Token_type","_Token_issuer","_Token_accessToken","_Token_idToken","_Token_refreshToken","_Token_scope","_Token_issuedAt","_Token_expiresIn","_Token_expiresAt","_Token_raw","_Auth_organization","_Auth_user","_Auth_token","_Auth_claims","_Auth_raw","_Auth_hash","User","constructor","data","this","id","sub","name","email","phone","phone_number","picture","profile_picture","groups","Object","freeze","equal","user","key","raw","toString","WeakMap","defineProperty","enumerable","configurable","writable","Token","type","issuer","accessToken","idToken","refreshToken","scope","issuedAt","expiresIn","expiresAt","authorization","token","Auth","hash","organization","Empty","Map","claims","entries","Anonymous","anonymous","loggedIn","auth","getConfigValue","options","platform","base","NullLogger","create","clear","debug","info","warn","error","_Transaction_log","_Transaction_storage","_Transaction_clientId","_Transaction_key","_Transaction_transaction","Transaction","storage","clientId","prefix","log","o","entry","expires","exp","Date","now","save","remove","undefined","commonjsGlobal","globalThis","window","global","self","browserTabsLock","processLock","ProcessLocking","_this","locked","addToLocked","toAdd","callbacks","unshift","isLocked","lock","Promise","resolve","reject","unlock","length","toCall","pop","setTimeout","delete","getInstance","instance","default","__awaiter","thisArg","_arguments","P","generator","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","y","t","g","_","label","sent","trys","ops","verb","Symbol","iterator","n","v","op","push","processLock_1","LOCK_STORAGE_KEY","delay","milliseconds","generateRandomString","CHARS","randomstring","i","Math","floor","random","_CacheKey_prefix","_CacheKey_clientId","_CacheKey_scope","_CacheKey_organization","_CacheKey_audience","_AuthError_code","_AuthError_params","SuperTokensLock","acquiredIatSet","Set","acquireLock","bind","releaseLock","releaseLock__private__","waitForSomethingToChange","refreshLockWhileAcquired","waiters","prototype","lockKey","timeout","iat","MAX_TIME","STORAGE_KEY","STORAGE","TIMEOUT_KEY","lockObjPostDelay","_a","localStorage","getItem","setItem","JSON","stringify","timeoutKey","timeAcquired","timeRefreshed","parse","add","lockCorrector","storageKey","lockObj","resolvedCalled","startedAt","MIN_TIME_TO_WAIT","removedListeners","stopWaiting","removeEventListener","removeFromWaiting","clearTimeout","timeOutId","timeToWait","addEventListener","addToWaiting","max","func","notifyWaiters","slice","forEach","removeItem","MIN_ALLOWED_TIME","KEYS","keys","LOCK_KEY","includes","_default","CacheKey","audience","replaceAll","static","split","ErrAuthInvalidRefreshToken","ErrAuthPopupCancelled","ErrAuthPopupTimeout","ConfigError","Error","code","message","super","setPrototypeOf","MissingClientIDError","MissingAuthorizeURLError","MissingRedirectURLError","MissingResponseTypeError","MissingTokenURLError","AuthError","params","AuthTimeoutError","AuthInvalidResponseError","AuthInvalidStateError","AuthInvalidRefreshTokenError","AuthUnsupportedCryptoError","AuthInsecureCryptoError","AuthPopupCancelledError","AuthPopupTimeoutError","normalizeError","fallbackMessage","error_description","BASE64_CHARS","getCrypto","crypto","msCrypto","getCryptoSubtle","subtle","webkitSubtle","validateCrypto","fromBaseB64","input","decodeURIComponent","atob","replace","map","c","charCodeAt","deriveChallenge","async","codeVerifier","arrayBuffer","digest","str","buf","ArrayBuffer","bufView","Uint8Array","toUint8Array","bytes","len","base64","substring","toBase64","randomString","haystack","randomStr","numberArray","Uint32Array","getRandomValues","x","stringArray","charAt","_a$2","_ObjectHash_algorithm","_ObjectHash_object","_ObjectHash_toHex","_ObjectHash_toBinary","_ObjectHash_toBase64","_ObjectHash_toBase64URL","algorithms","encodings","ObjectHash","algorithm","update","object","encoding","json","buffer","TextEncoder","encode","b","padStart","reduce","byte","byteLength","byteRemainder","mainLength","a","d","chunk","objectHash","opts","indexOf","hasher","_CacheManager_instances","_a$1","_CacheManager_prefix","_CacheManager_cache","_CacheManager_log","_CacheManager_nowProvider","_CacheManager_sign","_CacheManager_getCacheKeys","_CacheManager_validate","_CacheManager_matchExistingCacheKey","DefaultNowProvider","CacheManager","cache","logger","nowProvider","cacheKey","secure","expiryAdjustmentSeconds","matchedKey","nowSeconds","signedEntry","memo","clearSync","_InMemoryCache_storage","_InMemoryCache_prefix","_LocalStorageCache_prefix","_LocalStorageCache_secret","_LocalStorageCache_algorithm","_SessionStorageCache_prefix","LogLevel","_DebugLogger_level","_DebugLogger_logger","WeakSet","expiresInTime","expirySeconds","min","signature","keyToMatch","fromString","scopeSet","scopesToMatch","hasAllScopes","acc","current","InMemoryCache","startsWith","LocalStorageCache","secret","process","env","NXWEB_AUTH_KEY","item","plaintext","password","pwUtf8","pwHash","iv","ivStr","Array","from","String","fromCharCode","alg","importKey","ptUint8","ctBuffer","encrypt","ctStr","btoa","ciphertext","ch","ctUint8","plainBuffer","decrypt","TextDecoder","decode","SessionStorageCache","sessionStorage","DebugLogger","level","Debug","debuglog","args","Info","Warning","compact","obj","k","isNumber","getDomain","url","domain","test","URL","origin","getUniqueScope","scopes","s","trim","flat","sort","UserClaims","buildAuthorizeURLParams","additionalParameters","responseType","redirectURL","responseMode","nonce","usePKCE","prompt","searchParams","URLSearchParams","challenge","append","buildURLString","fragment","search","buildURL","parseAuthorizeResult","qs","queryParams","parsedQuery","fromEntries","expires_in","description","others","parseInt","verifyToken","maxAge","leeway","decoded","parts","header","payload","encoded","__raw","parseToken","iss","aud","isArray","azp","auth_time","expDate","nbfDate","authTimeDate","setUTCSeconds","nbf","org_id","__assign","assign","arguments","p","hasOwnProperty","stringifyAttribute","stringified","attributes","encodeURIComponent","setMilliseconds","getMilliseconds","toUTCString","path","sameSite","stringifyAttributes","getAll","cookieString","_i","cookies_1","document","cookie","CookieStorage","location","protocol","SessionStorage","DEFAULT_TIMEOUT","DEFAULT_RETRY","fetch","r","XMLHttpRequest","u","ok","status","statusText","responseURL","text","responseText","blob","Blob","response","clone","headers","toLowerCase","l","open","method","onload","getAllResponseHeaders","onerror","withCredentials","credentials","setRequestHeader","send","doFetch","fetchOptions","createAbortController","AbortController","sendMessage","to","messageChannel","MessageChannel","port1","onmessage","event","postMessage","port2","switchFetch","worker","formData","fetchWithWorker","controller","timeoutId","signal","race","abort","finally","fetchWithoutWorker","_WebAuthClient_instances","_WebAuthClient_debug","_WebAuthClient_worker","_WebAuthClient_log","_WebAuthClient_cache","_WebAuthClient_manager","_WebAuthClient_storage","_WebAuthClient_transaction","_WebAuthClient_nowProvider","_WebAuthClient_config","_WebAuthClient_authenticatedCookieName","_WebAuthClient_organizationCookieName","_WebAuthClient_domain","_WebAuthClient_issuer","_WebAuthClient_useRefreshToken","_WebAuthClient_useRefreshTokenFallback","_WebAuthClient_useWebMessage","_WebAuthClient_getClientId","_WebAuthClient_getScope","_WebAuthClient_getOrganization","_WebAuthClient_getAudience","_WebAuthClient_getAuthorizeURL","_WebAuthClient_getTokenURL","_WebAuthClient_getRedirectURL","_WebAuthClient_getLogoutURL","_WebAuthClient_getLogoutRedirectURL","_WebAuthClient_getRedirectMethod","_WebAuthClient_getResponseType","_WebAuthClient_getResponseMode","_WebAuthClient_getTokenAuthMethod","_WebAuthClient_getTimeout","_WebAuthClient_getCookieDomain","_WebAuthClient_getToken","_WebAuthClient_getTokenUsingIFrame","_WebAuthClient_getTokenUsingRefreshToken","_WebAuthClient_getAuth","_WebAuthClient_getCacheData","_WebAuthClient_setCacheData","_WebAuthClient_verifyIdToken","_WebAuthClient_prepareLogger","_WebAuthClient_prepareCache","_WebAuthClient_prepareStorage","singlePromiseMap","GET_TOKEN_LOCK","runPopup","useWebMessage","popup","popupEventListener","perodicId","pluginClosed","popupTimer","setInterval","closed","clearInterval","close","interval","checkFn","res","rej","href","ignore","ref","err","val","getResponseParams","WebAuthClient","config","fallback","authorizeURL","tokenURL","validateConfig","organizationCookieName","useRefreshToken","useRefreshTokenFallback","workerURL","Worker","addonParams","redirectMethod","buildLoginURL","windowOptions","popupHandle","width","height","left","screenX","innerWidth","top","screenY","innerHeight","popupName","openPopup","authResult","grantType","queryStringFragments","buildLogoutURL","idTokenHint","logoutURL","buildLogoutURLParams","logout","postCacheClear","localOnly","logoutOptions","getToken","cb","promise","singlePromise","logoutRedirectURL","tokenAuthMethod","cookieDomain","ignoreCache","details","maxNumberOfRetries","retryPromise","loginWithRedirect","crossOriginIsolated","eventOrigin","iframe","createElement","messageHandler","setAttribute","style","display","removeIFrame","contains","removeChild","timeoutSetTimeoutId","cleanUp","eventSource","source","appendChild","unloadHandler","contentWindow","runIFrame","clientSecret","useFormData","tokenOptions","Accept","Authorization","buildTokenURLHeaders","buildTokenURLParams","fetchError","getJSON","token_type","id_token","access_token","refresh_token","parseTokenResult","parsed","None","hasRequiredReactJsxRuntime_production_min","jsxRuntime","exports","reactJsxRuntime_production_min","for","m","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentOwner","__self","__source","q","h","defaultProps","$$typeof","props","_owner","Fragment","jsx","jsxs","requireReactJsxRuntime_production_min","resolveCache","_ConsoleLogger_prefix","_ConsoleLogger_level","ConsoleLogger","console","testUserAgent","win","expr","navigator","userAgent","setupPlatforms","Ionic","platforms","PLATFORMS_MAP","detectPlatforms","documentElement","classList","getPlatforms","isMobile","query","matchMedia","matches","isHybrid","isCordova","isCapacitorNative","cordova","phonegap","PhoneGap","Capacitor","isNative","isIpad","isAndroid","isPlatform","winOrPlatform","ipad","iphone","ios","android","phablet","smallest","largest","tablet","isAndroidTablet","capacitor","electron","pwa","standalone","mobile","mobileweb","desktop","hybrid","web","AuthReducer","action","loading","authenticated","CODE_RE","STATE_RE","ERROR_RE","stub","defaultOnRedirectCallback","history","replaceState","title","returnTo","pathname","initialContext","login","loginWithPopup","handleRedirectCallback","AuthProvider","client","manual","disabled","exclude","skipRedirect","loader","children","onInit","onConfigChange","onRedirect","init","useRef","enabled","useMemo","curPlatform","parametersMapHelper","headersMapHelper","additionalResourceHeaders","buildConfig","engine","dispatch","useReducer","dispatcher","createDispatcher","render","useCallback","api","view","getAuth","useEffect","initialized","hasAuthParams","list","RegExp","some","pattern","checkSession","AuthContext","Provider","createContext","useAuth","context","useContext"],"sourceRoot":""}