@thunderid/browser 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/LICENSE +201 -0
  2. package/dist/FetchHttpClient.d.ts +33 -0
  3. package/dist/FetchHttpClient.d.ts.map +1 -0
  4. package/dist/ThunderIDBrowserClient.d.ts +29 -0
  5. package/dist/ThunderIDBrowserClient.d.ts.map +1 -0
  6. package/dist/__legacy__/client.d.ts +767 -0
  7. package/dist/__legacy__/client.d.ts.map +1 -0
  8. package/dist/__legacy__/clients/index.d.ts +20 -0
  9. package/dist/__legacy__/clients/index.d.ts.map +1 -0
  10. package/dist/__legacy__/clients/main-thread-client.d.ts +23 -0
  11. package/dist/__legacy__/clients/main-thread-client.d.ts.map +1 -0
  12. package/dist/__legacy__/clients/web-worker-client.d.ts +22 -0
  13. package/dist/__legacy__/clients/web-worker-client.d.ts.map +1 -0
  14. package/dist/__legacy__/constants/errors.d.ts +19 -0
  15. package/dist/__legacy__/constants/errors.d.ts.map +1 -0
  16. package/dist/__legacy__/constants/hooks.d.ts +30 -0
  17. package/dist/__legacy__/constants/hooks.d.ts.map +1 -0
  18. package/dist/__legacy__/constants/index.d.ts +24 -0
  19. package/dist/__legacy__/constants/index.d.ts.map +1 -0
  20. package/dist/__legacy__/constants/messages-types.d.ts +52 -0
  21. package/dist/__legacy__/constants/messages-types.d.ts.map +1 -0
  22. package/dist/__legacy__/constants/parameters.d.ts +22 -0
  23. package/dist/__legacy__/constants/parameters.d.ts.map +1 -0
  24. package/dist/__legacy__/constants/session-management.d.ts +26 -0
  25. package/dist/__legacy__/constants/session-management.d.ts.map +1 -0
  26. package/dist/__legacy__/constants/storage.d.ts +19 -0
  27. package/dist/__legacy__/constants/storage.d.ts.map +1 -0
  28. package/dist/__legacy__/helpers/authentication-helper.d.ts +59 -0
  29. package/dist/__legacy__/helpers/authentication-helper.d.ts.map +1 -0
  30. package/dist/__legacy__/helpers/index.d.ts +21 -0
  31. package/dist/__legacy__/helpers/index.d.ts.map +1 -0
  32. package/dist/__legacy__/helpers/session-management-helper.d.ts +21 -0
  33. package/dist/__legacy__/helpers/session-management-helper.d.ts.map +1 -0
  34. package/dist/__legacy__/helpers/spa-helper.d.ts +30 -0
  35. package/dist/__legacy__/helpers/spa-helper.d.ts.map +1 -0
  36. package/dist/__legacy__/models/client-config.d.ts +55 -0
  37. package/dist/__legacy__/models/client-config.d.ts.map +1 -0
  38. package/dist/__legacy__/models/client.d.ts +85 -0
  39. package/dist/__legacy__/models/client.d.ts.map +1 -0
  40. package/dist/__legacy__/models/http-client.d.ts +30 -0
  41. package/dist/__legacy__/models/http-client.d.ts.map +1 -0
  42. package/dist/__legacy__/models/index.d.ts +27 -0
  43. package/dist/__legacy__/models/index.d.ts.map +1 -0
  44. package/dist/__legacy__/models/message.d.ts +47 -0
  45. package/dist/__legacy__/models/message.d.ts.map +1 -0
  46. package/dist/__legacy__/models/request-custom-grant.d.ts +25 -0
  47. package/dist/__legacy__/models/request-custom-grant.d.ts.map +1 -0
  48. package/dist/__legacy__/models/session-management-helper.d.ts +24 -0
  49. package/dist/__legacy__/models/session-management-helper.d.ts.map +1 -0
  50. package/dist/__legacy__/models/sign-in.d.ts +22 -0
  51. package/dist/__legacy__/models/sign-in.d.ts.map +1 -0
  52. package/dist/__legacy__/models/sign-out-error.d.ts +22 -0
  53. package/dist/__legacy__/models/sign-out-error.d.ts.map +1 -0
  54. package/dist/__legacy__/models/storage.d.ts +39 -0
  55. package/dist/__legacy__/models/storage.d.ts.map +1 -0
  56. package/dist/__legacy__/models/web-worker.d.ts +57 -0
  57. package/dist/__legacy__/models/web-worker.d.ts.map +1 -0
  58. package/dist/__legacy__/stores/index.d.ts +21 -0
  59. package/dist/__legacy__/stores/index.d.ts.map +1 -0
  60. package/dist/__legacy__/stores/local-store.d.ts +24 -0
  61. package/dist/__legacy__/stores/local-store.d.ts.map +1 -0
  62. package/dist/__legacy__/stores/memory-store.d.ts +26 -0
  63. package/dist/__legacy__/stores/memory-store.d.ts.map +1 -0
  64. package/dist/__legacy__/stores/session-store.d.ts +24 -0
  65. package/dist/__legacy__/stores/session-store.d.ts.map +1 -0
  66. package/dist/__legacy__/utils/crypto-utils.d.ts +32 -0
  67. package/dist/__legacy__/utils/crypto-utils.d.ts.map +1 -0
  68. package/dist/__legacy__/utils/index.d.ts +20 -0
  69. package/dist/__legacy__/utils/index.d.ts.map +1 -0
  70. package/dist/__legacy__/utils/message-utils.d.ts +38 -0
  71. package/dist/__legacy__/utils/message-utils.d.ts.map +1 -0
  72. package/dist/__legacy__/utils/spa-utils.d.ts +108 -0
  73. package/dist/__legacy__/utils/spa-utils.d.ts.map +1 -0
  74. package/dist/__legacy__/worker/index.d.ts +20 -0
  75. package/dist/__legacy__/worker/index.d.ts.map +1 -0
  76. package/dist/__legacy__/worker/worker-core.d.ts +22 -0
  77. package/dist/__legacy__/worker/worker-core.d.ts.map +1 -0
  78. package/dist/__legacy__/worker/worker-receiver.d.ts +22 -0
  79. package/dist/__legacy__/worker/worker-receiver.d.ts.map +1 -0
  80. package/dist/cjs/index.js +5172 -0
  81. package/dist/cjs/index.js.map +1 -0
  82. package/dist/index.d.ts +45 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +5136 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/models/config.d.ts +20 -0
  87. package/dist/models/config.d.ts.map +1 -0
  88. package/dist/theme/getActiveTheme.d.ts +28 -0
  89. package/dist/theme/getActiveTheme.d.ts.map +1 -0
  90. package/dist/theme/themeDetection.d.ts +41 -0
  91. package/dist/theme/themeDetection.d.ts.map +1 -0
  92. package/dist/utils/handleWebAuthnAuthentication.d.ts +98 -0
  93. package/dist/utils/handleWebAuthnAuthentication.d.ts.map +1 -0
  94. package/dist/utils/hasAuthParamsInUrl.d.ts +26 -0
  95. package/dist/utils/hasAuthParamsInUrl.d.ts.map +1 -0
  96. package/dist/utils/hasCalledForThisInstanceInUrl.d.ts +27 -0
  97. package/dist/utils/hasCalledForThisInstanceInUrl.d.ts.map +1 -0
  98. package/dist/utils/http.d.ts +51 -0
  99. package/dist/utils/http.d.ts.map +1 -0
  100. package/dist/utils/navigate.d.ts +43 -0
  101. package/dist/utils/navigate.d.ts.map +1 -0
  102. package/dist/utils/v2/resolveEmojiUrisInHtml.d.ts +30 -0
  103. package/dist/utils/v2/resolveEmojiUrisInHtml.d.ts.map +1 -0
  104. package/dist/web.worker.d.ts +20 -0
  105. package/dist/web.worker.d.ts.map +1 -0
  106. package/package.json +75 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["HttpClient","url: string","qs: string","url","headers: Record<string, string>","body: BodyInit | undefined","fetchResponse: Response","networkError: any","responseData: T","responseHeaders: Record<string, string>","serializedError: string","url","url: URL","error: string | null","description: string | null","urlObject: URL","_clientID: string","_checkSessionEndpoint: string","_sessionState: () => Promise<string>","_interval: number","_redirectURL: string","_sessionRefreshInterval: number","_signOut: () => Promise<string>","_sessionRefreshIntervalTimeout: number","_checkSessionIntervalTimeout: number","_storage: BrowserStorage","_setSessionState: (sessionState: string) => void","_getSignInUrl: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>","OP_IFRAME","opIframe: HTMLIFrameElement","promptNoneIFrame: HTMLIFrameElement","code","message: Message<AuthorizationInfo>","message: Message<string>","message: Message<null>","refreshTimer: number","byteLength","len","i","i","buffer","Buffer","i","len","buffer","byteLength","code","Buffer","Buffer","Buffer","jwtVerifyOptions: JWTVerifyOptions","initiateStore","_store: Storage","_cryptoUtils: SPACryptoUtils","_httpErrorCallback: (error: HttpError) => void | Promise<void>","_httpFinishCallback: () => void","oidcEndpoints: OIDCEndpoints","config","resolvedAuthorizationCode: string","resolvedSessionState: string","resolvedState: string","resolvedTokenRequestConfig: {\n params: Record<string, unknown>;\n }","pkceKey: string","authorizeUrl: URL","url","timer: number","urlString: string","url: string","_config: Config","refreshTokenError: Message<string>","error: any","config: Config","refreshAccessTokenResponse: User","refreshError: any","error","requests: Promise<HttpResponse<any>>[]","refreshTokenResponse: TokenResponse | User","pkce","promptNoneIFrame: HTMLIFrameElement","data: Message<AuthorizationInfo | null>","url","httpClientHandlers: HttpClientCallbacks","_requestTimeout: number","_store: Storage","_cryptoUtils: SPACryptoUtils","message: Message<string>","_authenticationHelper: AuthenticationHelper<WebWorkerClientConfig>","worker: Worker","config","oidcEndpoints: OIDCEndpoints","config: AuthClientConfig<WebWorkerClientConfig>","response: AuthorizationResponse","pkceKey: string","urlString: string","message: Message<AuthorizationInfo>","url","resolvedAuthorizationCode: string","resolvedSessionState: string","resolvedState: string","logger: ReturnType<typeof createPackageComponentLogger>","DefaultConfig: Partial<AuthClientConfig<Config>>","WorkerFile","mergedConfig: AuthClientConfig<MainThreadClientConfig>","signOutFail: boolean | SignOutError","_store: Storage","_cryptoUtils: SPACryptoUtils","_authenticationHelper: AuthenticationHelper<WebWorkerClientConfig>","state: string","url","config","timer: number","ctx: WebWorkerClass<any>","webWorker: WebWorkerCoreInterface","targetUrl: URL","url","logger: ReturnType<typeof createPackageComponentLogger>","observer: MutationObserver","mediaQuery: MediaQueryList","logger: ReturnType<typeof createPackageComponentLogger>","decodedChallenge: any","currentDomain: string","challengeRpId: string","rpIdToUse: string","adjustedOptions: any","credential: PublicKeyCredential","authData: AuthenticatorAssertionResponse","tokenResponse: {credential: any; requestId: string}","client: ThunderIDSPAClient","emoji: string","altMatch: RegExpMatchArray | null"],"sources":["../src/FetchHttpClient.ts","../src/__legacy__/constants/messages-types.ts","../src/__legacy__/constants/storage.ts","../src/__legacy__/constants/hooks.ts","../src/__legacy__/constants/session-management.ts","../src/__legacy__/constants/parameters.ts","../src/__legacy__/constants/errors.ts","../src/__legacy__/models/storage.ts","../src/__legacy__/utils/message-utils.ts","../src/__legacy__/utils/spa-utils.ts","../src/__legacy__/helpers/session-management-helper.ts","../src/__legacy__/helpers/spa-helper.ts","../src/__legacy__/stores/local-store.ts","../src/__legacy__/stores/memory-store.ts","../src/__legacy__/stores/session-store.ts","../../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js","../../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js","../src/__legacy__/utils/crypto-utils.ts","../src/__legacy__/clients/main-thread-client.ts","../src/__legacy__/helpers/authentication-helper.ts","../src/__legacy__/clients/web-worker-client.ts","../src/web.worker.ts","../src/__legacy__/client.ts","../src/__legacy__/models/web-worker.ts","../src/__legacy__/worker/worker-core.ts","../src/__legacy__/worker/worker-receiver.ts","../src/utils/hasAuthParamsInUrl.ts","../src/utils/hasCalledForThisInstanceInUrl.ts","../src/utils/navigate.ts","../src/ThunderIDBrowserClient.ts","../src/theme/themeDetection.ts","../src/theme/getActiveTheme.ts","../src/utils/handleWebAuthnAuthentication.ts","../src/utils/http.ts","../src/utils/v2/resolveEmojiUrisInHtml.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {HttpClient, HttpError, HttpRequestConfig, HttpResponse} from '@thunderid/javascript';\n\n/**\n * Fetch-based HTTP client. Extends `HttpClient` and implements `transport()`\n * using the native Fetch API.\n *\n * To plug in a custom HTTP transport, extend `HttpClient` from `@thunderid/javascript`\n * and override `transport()`, then pass your implementation where `FetchHttpClient`\n * is currently used.\n */\nexport class FetchHttpClient extends HttpClient {\n private static instances: Map<number, FetchHttpClient> = new Map<number, FetchHttpClient>();\n\n static getInstance(\n instanceId = 0,\n isHandlerEnabled = true,\n attachToken: (request: HttpRequestConfig) => Promise<void> = (): Promise<void> => Promise.resolve(),\n ): FetchHttpClient {\n if (!this.instances.has(instanceId)) {\n this.instances.set(instanceId, new FetchHttpClient(isHandlerEnabled, attachToken));\n }\n return this.instances.get(instanceId);\n }\n\n static destroyInstance(instanceId = 0): void {\n this.instances.delete(instanceId);\n }\n\n protected async transport<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\n const {\n attachToken,\n data,\n headers: configHeaders,\n method,\n params,\n shouldAttachIDPAccessToken,\n shouldEncodeToFormData,\n startTimeInMs,\n url: configUrl,\n ...fetchOptions\n } = config;\n\n let url: string = configUrl ?? '';\n\n if (params) {\n const qs: string = new URLSearchParams(params).toString();\n if (qs) {\n url = `${url}${url.includes('?') ? '&' : '?'}${qs}`;\n }\n }\n\n const headers: Record<string, string> = {...(configHeaders ?? {})};\n let body: BodyInit | undefined;\n\n if (data !== undefined) {\n if (data instanceof FormData) {\n body = data;\n } else {\n body = JSON.stringify(data);\n if (!headers['Content-Type'] && !headers['content-type']) {\n headers['Content-Type'] = 'application/json';\n }\n }\n }\n\n let fetchResponse: Response;\n\n try {\n fetchResponse = await fetch(url, {\n credentials: 'include',\n ...fetchOptions,\n body,\n headers,\n method: (method ?? 'GET').toUpperCase(),\n });\n } catch (networkError: any) {\n throw Object.assign(new Error(networkError.message), {\n code: 'NETWORK_ERROR',\n config,\n } as Partial<HttpError>);\n }\n\n const contentType: string = fetchResponse.headers.get('content-type') ?? '';\n const responseData: T = contentType.includes('application/json')\n ? await fetchResponse.json()\n : ((await fetchResponse.text()) as any);\n\n const responseHeaders: Record<string, string> = {};\n fetchResponse.headers.forEach((value: string, key: string) => {\n responseHeaders[key] = value;\n });\n\n if (!fetchResponse.ok) {\n throw Object.assign(new Error(fetchResponse.statusText), {\n config,\n response: {\n data: responseData,\n headers: responseHeaders,\n status: fetchResponse.status,\n statusText: fetchResponse.statusText,\n },\n } as Partial<HttpError>);\n }\n\n return {\n config,\n data: responseData,\n headers: responseHeaders,\n status: fetchResponse.status,\n statusText: fetchResponse.statusText,\n };\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const INIT = 'init';\nexport const SIGN_IN = 'sign-in';\nexport const AUTH_CODE = 'auth-code';\nexport const SIGN_OUT = 'sign-out';\nexport const HTTP_REQUEST = 'http-request';\nexport const HTTP_REQUEST_ALL = 'http-request-all';\nexport const REQUEST_CUSTOM_GRANT = 'request-custom-grant';\nexport const REVOKE_ACCESS_TOKEN = 'revoke-access-token';\nexport const END_USER_SESSION = 'end-user-session';\nexport const REQUEST_START = 'request-start';\nexport const REQUEST_SUCCESS = 'request-success';\nexport const REQUEST_ERROR = 'request-error';\nexport const REQUEST_FINISH = 'request-finish';\nexport const GET_OIDC_SERVICE_ENDPOINTS = 'get-oidc-service-endpoints';\nexport const GET_BASIC_USER_INFO = 'get-basic-user-info';\nexport const GET_DECODED_ID_TOKEN = 'get-decoded-id-token';\nexport const GET_DECODED_IDP_ID_TOKEN = 'get-decoded-idp-id-token';\nexport const GET_CRYPTO_HELPER = 'get-crypto-helper';\nexport const ENABLE_HTTP_HANDLER = 'enable_http_handler';\nexport const DISABLE_HTTP_HANDLER = 'disable_http_handler';\nexport const GET_AUTH_URL = 'get_auth_url';\nexport const REQUEST_ACCESS_TOKEN = 'request_get_token';\nexport const IS_AUTHENTICATED = 'is_authenticated';\nexport const GET_SIGN_OUT_URL = 'get_sign_out_url';\nexport const REFRESH_ACCESS_TOKEN = 'refresh_access-token';\nexport const REFRESH_ACCESS_TOKEN_ERR0R = 'refresh-access-token-error';\nexport const SET_SESSION_STATE = 'set_session_state';\nexport const START_AUTO_REFRESH_TOKEN = 'start_auto_refresh_token';\nexport const UPDATE_CONFIG = 'update_config';\nexport const GET_ID_TOKEN = 'get_id_token';\nexport const CHECK_SESSION_SIGNED_IN = 'check_session_signed_in';\nexport const CHECK_SESSION_SIGNED_OUT = 'check_session_signed_out';\nexport const GET_CONFIG_DATA = 'get_config_data';\nexport const SET_SESSION_STATE_FROM_IFRAME = 'set_session_state_from_iframe';\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const TOKEN_REQUEST_CONFIG_KEY = 'token_request_config';\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum Hooks {\n SignIn = 'sign-in',\n SignOut = 'sign-out',\n Initialize = 'initialize',\n HttpRequestStart = 'http-request-start',\n HttpRequestFinish = 'http-request-finish',\n HttpRequestError = 'http-request-error',\n HttpRequestSuccess = 'http-request-success',\n RevokeAccessToken = 'revoke-access-token',\n CustomGrant = 'custom-grant',\n SignOutFailed = 'sign-out-failed',\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const OP_IFRAME = 'opIFrame';\nexport const RP_IFRAME = 'rpIFrame';\nexport const PROMPT_NONE_IFRAME = 'promptNoneIFrame';\nexport const STATE = 'Y2hlY2tTZXNzaW9u';\nexport const SILENT_SIGN_IN_STATE = 'sign-in-silently';\nexport const INITIALIZED_SIGN_IN = 'initialized-sign-in';\nexport const INITIALIZED_SILENT_SIGN_IN = 'initialized-silent-sign-in';\nexport const PROMPT_NONE_REQUEST_SENT = 'promptNoneRequestSent';\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const ERROR = 'error';\nexport const ERROR_DESCRIPTION = 'error_description';\nexport const CUSTOM_GRANT_CONFIG = 'custom_grant_config';\nexport const STATE_QUERY = 'state';\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const ACCESS_TOKEN_INVALID = 'Access token is invalid';\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Enum for the different storage types.\n */\nexport enum BrowserStorage {\n /**\n * Stores the session information in the local storage\n */\n LocalStorage = 'localStorage',\n /**\n * Store the session information in the session storage.\n */\n SessionStorage = 'sessionStorage',\n /**\n * Store the session information in the web worker.\n */\n WebWorker = 'webWorker',\n /**\n * Store the session information in the browser memory.\n */\n BrowserMemory = 'browserMemory',\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ResponseMessage} from '../models';\n\nexport class MessageUtils {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n /**\n * JSON stringifies the passed object.\n *\n * @param {any} data The data object.\n *\n * @return {ResponseMessage<string>} JSON string.\n */\n\n public static generateSuccessMessage(data?: any): ResponseMessage<string> {\n return {\n blob: data?.data instanceof Blob ? data?.data : null,\n data: JSON.stringify(data ?? ''),\n success: true,\n };\n }\n\n /**\n * JSON stringifies the passed object.\n *\n * @param {any} error The error object.\n *\n * @return {ResponseMessage<string>} JSON string.\n */\n\n public static generateFailureMessage(error?: any): ResponseMessage<string> {\n if (error?.toJSON) {\n delete error.toJSON;\n }\n\n let serializedError: string;\n\n try {\n // Handle Error objects specially\n if (error instanceof Error) {\n serializedError = JSON.stringify({\n name: error.name,\n message: error.message,\n stack: error.stack,\n // Copy any additional enumerable properties\n ...error,\n });\n } else if (typeof error === 'object' && error !== null) {\n // For other objects, try to stringify and fallback to a safe representation\n try {\n serializedError = JSON.stringify(error);\n } catch {\n serializedError = JSON.stringify({\n message: error.toString ? error.toString() : 'Unknown error',\n originalError: String(error),\n });\n }\n } else {\n // For primitives, stringify directly\n serializedError = JSON.stringify(error ?? 'Unknown error');\n }\n } catch {\n // Final fallback if all else fails\n serializedError = JSON.stringify({\n message: 'Error serialization failed',\n originalError: String(error),\n });\n }\n\n return {\n error: serializedError,\n success: false,\n };\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThunderIDAuthClient, OIDCRequestConstants} from '@thunderid/javascript';\nimport {SignOutError} from '../..';\nimport {\n ERROR,\n ERROR_DESCRIPTION,\n INITIALIZED_SILENT_SIGN_IN,\n PROMPT_NONE_REQUEST_SENT,\n SILENT_SIGN_IN_STATE,\n STATE_QUERY,\n} from '../constants';\n\nexport class SPAUtils {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private constructor() {}\n\n public static removeAuthorizationCode(): void {\n const url = location.href;\n\n history.pushState({}, document.title, url.replace(/\\?code=.*$/, ''));\n }\n\n public static getPKCE(pkceKey: string): string {\n return sessionStorage.getItem(pkceKey) ?? '';\n }\n\n public static setPKCE(pkceKey: string, pkce: string): void {\n sessionStorage.setItem(pkceKey, pkce);\n }\n\n public static setSignOutURL(url: string, clientId: string, instanceId: number): void {\n sessionStorage.setItem(\n `${OIDCRequestConstants.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${instanceId}-${clientId}`,\n url,\n );\n }\n\n public static getSignOutUrl(clientId: string, instanceId: number): string {\n return (\n sessionStorage.getItem(\n `${OIDCRequestConstants.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${instanceId}-${clientId}`,\n ) ?? ''\n );\n }\n\n public static removePKCE(pkceKey: string): void {\n sessionStorage.removeItem(pkceKey);\n }\n\n /**\n * This method is used to discontinue the execution of the `signIn` method if `callOnlyOnRedirect` is true and\n * the method is not called on being redirected from the authorization server.\n *\n * This method can be used to allow the `signIn` method to be called only\n * on being redirected from the authorization server.\n *\n * @param callOnlyOnRedirect {boolean} - True if the method should only be called on redirect.\n * @param authorizationCode {string} - Authorization code.\n *\n * @returns {boolean} - True if the method should be called.\n */\n public static canContinueSignIn(callOnlyOnRedirect: boolean, authorizationCode?: string): boolean {\n if (callOnlyOnRedirect && !SPAUtils.hasErrorInURL() && !SPAUtils.hasAuthSearchParamsInURL() && !authorizationCode) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Specifies if `trySilentSignIn` has been called.\n *\n * @returns {boolean} True if the `trySilentSignIn` method has been called once.\n */\n public static isInitializedSilentSignIn(): boolean {\n return SPAUtils.isSilentStatePresentInURL();\n }\n\n /**\n * Specifies if the `signIn` method has been called.\n *\n * @returns {boolean} True if the `signIn` has been called.\n */\n public static wasSignInCalled(): boolean {\n if (SPAUtils.hasErrorInURL() || SPAUtils.hasAuthSearchParamsInURL()) {\n if (!this.isSilentStatePresentInURL()) {\n return true;\n }\n }\n\n return false;\n }\n\n public static wasSilentSignInCalled(): boolean {\n const silentSignIsInitialized = sessionStorage.getItem(INITIALIZED_SILENT_SIGN_IN);\n const isSilentSignInInitialized = silentSignIsInitialized ? JSON.parse(silentSignIsInitialized) : null;\n\n return Boolean(isSilentSignInInitialized);\n }\n\n public static async isSignOutSuccessful(): Promise<boolean> {\n if (ThunderIDAuthClient.isSignOutSuccessful(window.location.href)) {\n const newUrl = window.location.href.split('?')[0];\n history.pushState({}, document.title, newUrl);\n\n await ThunderIDAuthClient.clearSession();\n\n return true;\n }\n return false;\n }\n\n public static didSignOutFail(): boolean | SignOutError {\n if (ThunderIDAuthClient.didSignOutFail(window.location.href)) {\n const url: URL = new URL(window.location.href);\n const error: string | null = url.searchParams.get(ERROR);\n const description: string | null = url.searchParams.get(ERROR_DESCRIPTION);\n const newUrl = window.location.href.split('?')[0];\n history.pushState({}, document.title, newUrl);\n\n return {\n description: description ?? '',\n error: error ?? '',\n };\n }\n\n return false;\n }\n\n /**\n * Checks if the URL the user agent is redirected to after an authorization request has the state parameter.\n *\n * @returns {boolean} True if there is a session-check state or a silent sign-in state.\n */\n public static isSilentStatePresentInURL(): boolean {\n const state = new URL(window.location.href).searchParams.get('state');\n\n return state?.includes(SILENT_SIGN_IN_STATE) ?? false;\n }\n\n /**\n * Util function to test if `code` and `session_state` are available in the URL as search params.\n * @since 0.2.0\n * @deprecated Use `hasAuthParamsInUrl` from `@thunderid/browser` instead.\n *\n * @param params - Search params.\n * @return {boolean}\n */\n public static hasAuthSearchParamsInURL(params: string = window.location.search): boolean {\n const AUTH_CODE_REGEXP = /[?&]code=[^&]+/;\n\n return AUTH_CODE_REGEXP.test(params);\n }\n\n /**\n * Util function to check if the URL contains an error.\n *\n * @param url - URL to be checked.\n *\n * @returns {boolean} - True if the URL contains an error.\n */\n public static hasErrorInURL(url: string = window.location.href): boolean {\n const urlObject: URL = new URL(url);\n return (\n !!urlObject.searchParams.get(ERROR) &&\n urlObject.searchParams.get(STATE_QUERY) !== OIDCRequestConstants.Params.SIGN_OUT_SUCCESS\n );\n }\n\n /**\n * Checks if a prompt none can be sent by checking if a request has already been sent.\n *\n * @since 0.2.3\n *\n * @returns {boolean} - True if a prompt none request has not been sent.\n */\n public static canSendPromptNoneRequest(): boolean {\n const promptNoneRequestSentRaw = sessionStorage.getItem(PROMPT_NONE_REQUEST_SENT);\n const promptNoneRequestSent = promptNoneRequestSentRaw ? JSON.parse(promptNoneRequestSentRaw) : null;\n\n return !promptNoneRequestSent;\n }\n\n /**\n * Sets the status of prompt none request.\n *\n * @since 0.2.3\n *\n * @param canSend {boolean} - True if a prompt none request can be sent.\n */\n public static setPromptNoneRequestSent(canSend: boolean): void {\n sessionStorage.setItem(PROMPT_NONE_REQUEST_SENT, JSON.stringify(canSend));\n }\n\n /**\n * Waits for a specified amount of time to give the user agent enough time to redirect.\n *\n * @param time {number} - Time in seconds.\n */\n public static async waitTillPageRedirect(time?: number): Promise<void> {\n const timeToWait = time ?? 3000;\n\n await new Promise((resolve) => setTimeout(resolve, timeToWait * 1000));\n }\n\n /**\n * Waits for a condition before executing the rest of the code in non-blocking manner.\n *\n * @param condition {() => boolean} - Condition to be checked.\n * @param timeout {number} - Time in miliseconds.\n */\n public static until = (condition: () => boolean, timeout = 500) => {\n const poll = (done) => (condition() ? done() : setTimeout(() => poll(done), timeout));\n\n return new Promise(poll);\n };\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThunderIDAuthClient, ExtendedAuthorizeRequestUrlParams, OIDCRequestConstants} from '@thunderid/javascript';\nimport {\n CHECK_SESSION_SIGNED_IN,\n CHECK_SESSION_SIGNED_OUT,\n INITIALIZED_SILENT_SIGN_IN,\n OP_IFRAME,\n PROMPT_NONE_IFRAME,\n RP_IFRAME,\n SET_SESSION_STATE_FROM_IFRAME,\n SILENT_SIGN_IN_STATE,\n STATE,\n STATE_QUERY,\n} from '../constants';\nimport {AuthorizationInfo, Message, SessionManagementHelperInterface} from '../models';\nimport {BrowserStorage} from '../models/storage';\nimport {SPAUtils} from '../utils';\n\nexport const SessionManagementHelper = (() => {\n let _clientID: string;\n let _checkSessionEndpoint: string;\n let _sessionState: () => Promise<string>;\n let _interval: number;\n let _redirectURL: string;\n let _sessionRefreshInterval: number;\n let _signOut: () => Promise<string>;\n let _sessionRefreshIntervalTimeout: number;\n let _checkSessionIntervalTimeout: number;\n let _storage: BrowserStorage;\n let _setSessionState: (sessionState: string) => void;\n let _getSignInUrl: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>;\n\n const initialize = (\n clientId: string,\n checkSessionEndpoint: string,\n getSessionState: () => Promise<string>,\n interval: number,\n sessionRefreshInterval: number,\n redirectURL: string,\n getSignInUrl: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>,\n ): void => {\n _clientID = clientId;\n _checkSessionEndpoint = checkSessionEndpoint;\n _sessionState = getSessionState;\n _interval = interval;\n _redirectURL = redirectURL;\n _sessionRefreshInterval = sessionRefreshInterval;\n _getSignInUrl = getSignInUrl;\n\n if (_interval > -1) {\n initiateCheckSession();\n }\n\n if (_sessionRefreshInterval > -1) {\n sessionRefreshInterval = setInterval(() => {\n sendPromptNoneRequest();\n }, _sessionRefreshInterval * 1000) as unknown as number;\n }\n };\n\n const initiateCheckSession = async (): Promise<void> => {\n if (!_checkSessionEndpoint || !_clientID || !_redirectURL) {\n return;\n }\n\n const OP_IFRAME = 'opIFrame';\n\n async function checkSession(): Promise<void> {\n const sessionState = await _sessionState();\n if (Boolean(_clientID) && Boolean(sessionState)) {\n const message = `${_clientID} ${sessionState}`;\n const rpIFrame = document.getElementById(RP_IFRAME) as HTMLIFrameElement;\n const opIframe: HTMLIFrameElement = rpIFrame?.contentDocument?.getElementById(OP_IFRAME) as HTMLIFrameElement;\n const win: Window | null = opIframe.contentWindow;\n win?.postMessage(message, _checkSessionEndpoint);\n }\n }\n\n const rpIFrame = document.getElementById(RP_IFRAME) as HTMLIFrameElement;\n const opIframe: HTMLIFrameElement = rpIFrame?.contentDocument?.getElementById(OP_IFRAME) as HTMLIFrameElement;\n opIframe.src = _checkSessionEndpoint + '?client_id=' + _clientID + '&redirect_uri=' + _redirectURL;\n\n _checkSessionIntervalTimeout = setInterval(checkSession, _interval * 1000) as unknown as number;\n\n listenToResponseFromOPIFrame();\n };\n\n /**\n * Destroys session intervals.\n */\n const reset = (): void => {\n clearInterval(_checkSessionIntervalTimeout);\n clearInterval(_sessionRefreshIntervalTimeout);\n };\n\n const listenToResponseFromOPIFrame = (): void => {\n async function receiveMessage(e: MessageEvent) {\n const targetOrigin = _checkSessionEndpoint;\n\n if (!targetOrigin || targetOrigin?.indexOf(e.origin) < 0 || e?.data?.type === SET_SESSION_STATE_FROM_IFRAME) {\n return;\n }\n\n if (e.data === 'unchanged') {\n // [RP] session state has not changed\n } else if (e.data === 'error') {\n window.location.href = await _signOut();\n } else if (e.data === 'changed') {\n // [RP] session state has changed. Sending prompt=none request...\n sendPromptNoneRequest();\n }\n }\n\n window?.addEventListener('message', receiveMessage, false);\n };\n\n const sendPromptNoneRequest = async () => {\n const rpIFrame = document.getElementById(RP_IFRAME) as HTMLIFrameElement;\n\n const promptNoneIFrame: HTMLIFrameElement = rpIFrame?.contentDocument?.getElementById(\n PROMPT_NONE_IFRAME,\n ) as HTMLIFrameElement;\n\n if (SPAUtils.canSendPromptNoneRequest()) {\n SPAUtils.setPromptNoneRequestSent(true);\n\n const receiveMessageListener = (e: MessageEvent<Message<string>>) => {\n if (e?.data?.type === SET_SESSION_STATE_FROM_IFRAME) {\n _setSessionState(e?.data?.data ?? '');\n window?.removeEventListener('message', receiveMessageListener);\n }\n };\n\n if (_storage === BrowserStorage.BrowserMemory || _storage === BrowserStorage.WebWorker) {\n window?.addEventListener('message', receiveMessageListener);\n }\n\n const promptNoneURL: string = await _getSignInUrl({\n prompt: 'none',\n response_mode: 'query',\n state: STATE,\n });\n\n promptNoneIFrame.src = promptNoneURL;\n }\n };\n\n /**\n * This contains the logic to process the response of a prompt none request.\n *\n * @param setSessionState The method that sets the session state.\n * on the output of the content of the redirect URL\n */\n const receivePromptNoneResponse = async (\n setSessionState?: (sessionState: string | null) => Promise<void>,\n ): Promise<boolean> => {\n const state = new URL(window.location.href).searchParams.get(STATE_QUERY);\n const sessionState = new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.SESSION_STATE);\n const parent = window.parent.parent;\n\n if (state !== null && (state.includes(STATE) || state.includes(SILENT_SIGN_IN_STATE))) {\n // Prompt none response.\n const code = new URL(window.location.href).searchParams.get('code');\n\n if (code !== null && code.length !== 0) {\n if (state.includes(SILENT_SIGN_IN_STATE)) {\n const message: Message<AuthorizationInfo> = {\n data: {\n code,\n sessionState: sessionState ?? '',\n state,\n },\n type: CHECK_SESSION_SIGNED_IN,\n };\n\n sessionStorage.setItem(INITIALIZED_SILENT_SIGN_IN, 'false');\n parent.postMessage(message, parent.origin);\n SPAUtils.setPromptNoneRequestSent(false);\n\n window.location.href = 'about:blank';\n\n await SPAUtils.waitTillPageRedirect();\n\n return true;\n }\n\n const newSessionState = new URL(window.location.href).searchParams.get('session_state');\n\n if (_storage === BrowserStorage.LocalStorage || _storage === BrowserStorage.SessionStorage) {\n setSessionState && (await setSessionState(newSessionState));\n } else {\n const message: Message<string> = {\n data: newSessionState ?? '',\n type: SET_SESSION_STATE_FROM_IFRAME,\n };\n\n window?.parent?.parent?.postMessage(message);\n }\n\n SPAUtils.setPromptNoneRequestSent(false);\n\n window.location.href = 'about:blank';\n\n await SPAUtils.waitTillPageRedirect();\n\n return true;\n } else {\n if (state.includes(SILENT_SIGN_IN_STATE)) {\n const message: Message<null> = {\n type: CHECK_SESSION_SIGNED_OUT,\n };\n\n window.parent.parent.postMessage(message, parent.origin);\n SPAUtils.setPromptNoneRequestSent(false);\n\n window.location.href = 'about:blank';\n\n await SPAUtils.waitTillPageRedirect();\n\n return true;\n }\n\n SPAUtils.setPromptNoneRequestSent(false);\n\n const signOutURL = await _signOut();\n // Clearing user session data before redirecting to the signOutURL because user has been already logged\n // out by the initial logout request in the single logout flow.\n await ThunderIDAuthClient.clearSession();\n parent.location.href = signOutURL;\n window.location.href = 'about:blank';\n\n await SPAUtils.waitTillPageRedirect();\n\n return true;\n }\n }\n\n return false;\n };\n\n return async (\n signOut: () => Promise<string>,\n storage: BrowserStorage,\n setSessionState: (sessionState: string) => void,\n ): Promise<SessionManagementHelperInterface> => {\n let rpIFrame = document.createElement('iframe');\n rpIFrame.setAttribute('id', RP_IFRAME);\n rpIFrame.style.display = 'none';\n\n let rpIframeLoaded = false;\n rpIFrame.onload = () => {\n rpIFrame = document.getElementById(RP_IFRAME) as HTMLIFrameElement;\n\n const rpDoc = rpIFrame?.contentDocument;\n\n const opIFrame = rpDoc?.createElement('iframe');\n if (opIFrame) {\n opIFrame.setAttribute('id', OP_IFRAME);\n opIFrame.style.display = 'none';\n }\n\n const promptNoneIFrame = rpDoc?.createElement('iframe');\n if (promptNoneIFrame) {\n promptNoneIFrame.setAttribute('id', PROMPT_NONE_IFRAME);\n promptNoneIFrame.style.display = 'none';\n }\n\n opIFrame && rpIFrame?.contentDocument?.body?.appendChild(opIFrame);\n promptNoneIFrame && rpIFrame?.contentDocument?.body?.appendChild(promptNoneIFrame);\n\n rpIframeLoaded = true;\n };\n\n document?.body?.appendChild(rpIFrame);\n\n _signOut = signOut;\n\n _storage = storage;\n _setSessionState = setSessionState;\n\n const sleep = (): Promise<any> => {\n return new Promise((resolve) => setTimeout(resolve, 1));\n };\n\n while (rpIframeLoaded === false) {\n await sleep();\n }\n\n return {\n initialize,\n receivePromptNoneResponse,\n reset,\n };\n };\n})();\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThunderIDAuthClient, StorageManager, TokenConstants} from '@thunderid/javascript';\n\nimport {AuthenticationHelper} from '../helpers/authentication-helper';\nimport {MainThreadClientConfig, WebWorkerClientConfig} from '../models/client-config';\n\nexport class SPAHelper<T extends MainThreadClientConfig | WebWorkerClientConfig> {\n private _authenticationClient: ThunderIDAuthClient<T>;\n private _storageManager: StorageManager<T>;\n private _isTokenRefreshLoading = false;\n\n public constructor(authClient: ThunderIDAuthClient<T>) {\n this._authenticationClient = authClient;\n this._storageManager = this._authenticationClient.getStorageManager();\n }\n\n public async refreshAccessTokenAutomatically(\n authenticationHelper: AuthenticationHelper<MainThreadClientConfig | WebWorkerClientConfig>,\n ): Promise<void> {\n const shouldRefreshAutomatically: boolean =\n (await this._storageManager.getConfigData())?.periodicTokenRefresh ?? false;\n\n if (!shouldRefreshAutomatically) {\n return;\n }\n\n const sessionData = await this._storageManager.getSessionData();\n if (sessionData.refresh_token) {\n if (sessionData.created_at == null || sessionData.expires_in == null) {\n return;\n }\n\n const TOKEN_REFRESH_BUFFER_MS = 10_000;\n const expiryTime = Number(sessionData.expires_in) * 1000;\n const absoluteExpiryTime: number = sessionData.created_at + expiryTime;\n const timeUntilRefresh = absoluteExpiryTime - Date.now() - TOKEN_REFRESH_BUFFER_MS;\n\n if (timeUntilRefresh <= 0) {\n if (this._isTokenRefreshLoading) return;\n\n this._isTokenRefreshLoading = true;\n try {\n await authenticationHelper.refreshAccessToken();\n } finally {\n this._isTokenRefreshLoading = false;\n }\n return;\n }\n\n const timer = setTimeout(async () => {\n if (this._isTokenRefreshLoading) return;\n\n this._isTokenRefreshLoading = true;\n try {\n await authenticationHelper.refreshAccessToken();\n } finally {\n this._isTokenRefreshLoading = false;\n }\n }, timeUntilRefresh);\n\n await this._storageManager.setTemporaryDataParameter(\n TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER,\n JSON.stringify(timer),\n );\n }\n }\n\n public async getRefreshTimeoutTimer(): Promise<number> {\n if (await this._storageManager.getTemporaryDataParameter(TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER)) {\n return JSON.parse(\n (await this._storageManager.getTemporaryDataParameter(\n TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER,\n )) as string,\n );\n }\n\n return -1;\n }\n\n public async clearRefreshTokenTimeout(timer?: number): Promise<void> {\n if (timer) {\n clearTimeout(timer);\n\n return;\n }\n\n const refreshTimer: number = await this.getRefreshTimeoutTimer();\n\n if (refreshTimer !== -1) {\n clearTimeout(refreshTimer);\n }\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nimport {Storage} from '@thunderid/javascript';\n\nexport class LocalStore implements Storage {\n public async setData(key: string, value: string): Promise<void> {\n localStorage.setItem(key, value);\n }\n\n public async getData(key: string): Promise<string> {\n return localStorage.getItem(key) ?? '{}';\n }\n\n public async removeData(key: string): Promise<void> {\n localStorage.removeItem(key);\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nimport {Storage} from '@thunderid/javascript';\n\nexport class MemoryStore implements Storage {\n private _data: Map<string, string>;\n\n public constructor() {\n this._data = new Map();\n }\n\n public async setData(key: string, value: string): Promise<void> {\n this._data.set(key, value);\n }\n\n public async getData(key: string): Promise<string> {\n return this._data?.get(key) ?? '{}';\n }\n\n public async removeData(key: string): Promise<void> {\n this._data.delete(key);\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nimport {Storage} from '@thunderid/javascript';\n\nexport class SessionStore implements Storage {\n public async setData(key: string, value: string): Promise<void> {\n sessionStorage.setItem(key, value);\n }\n\n public async getData(key: string): Promise<string> {\n return sessionStorage.getItem(key) ?? '{}';\n }\n\n public async removeData(key: string): Promise<void> {\n sessionStorage.removeItem(key);\n }\n}\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return '<Buffer ' + str + '>'\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict'\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = require('safe-buffer').Buffer\nvar crypto = global.crypto || global.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Buffer} from 'buffer';\nimport {ThunderIDAuthException, Crypto, JWKInterface} from '@thunderid/javascript';\nimport base64url from 'base64url';\nimport sha256 from 'fast-sha256';\nimport {createLocalJWKSet, jwtVerify, JWTVerifyOptions} from 'jose';\nimport randombytes from 'randombytes';\n\nexport class SPACryptoUtils implements Crypto<Buffer | string> {\n /**\n * Get URL encoded string.\n *\n * @returns {string} base 64 url encoded value.\n */\n public base64URLEncode(value: Buffer | string): string {\n return base64url.encode(value).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n }\n\n public base64URLDecode(value: string): string {\n return base64url.decode(value).toString();\n }\n\n public hashSha256(data: string): string | Buffer {\n return Buffer.from(sha256(new TextEncoder().encode(data)));\n }\n\n public generateRandomBytes(length: number): string | Buffer {\n return randombytes(length);\n }\n\n public verifyJwt(\n idToken: string,\n jwk: Partial<JWKInterface>,\n algorithms: string[],\n clientId: string,\n issuer: string,\n subject: string,\n clockTolerance?: number,\n validateJwtIssuer?: boolean,\n ): Promise<boolean> {\n const jwtVerifyOptions: JWTVerifyOptions = {\n algorithms: algorithms,\n audience: [clientId],\n clockTolerance: clockTolerance,\n subject: subject,\n };\n\n if (validateJwtIssuer ?? true) {\n jwtVerifyOptions.issuer = issuer;\n }\n\n return jwtVerify(\n idToken,\n createLocalJWKSet({\n keys: [jwk],\n }),\n jwtVerifyOptions,\n )\n .then(() => {\n return Promise.resolve(true);\n })\n .catch((error) => {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-CRYPTO-UTILS-VJ-IV01',\n error?.reason ?? JSON.stringify(error),\n `${error?.code} ${error?.claim}`,\n ),\n );\n });\n }\n}\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDAuthClient,\n AuthClientConfig,\n User,\n IsomorphicCrypto,\n StorageManager,\n IdToken,\n ExtendedAuthorizeRequestUrlParams,\n OIDCEndpoints,\n OIDCRequestConstants,\n SessionData,\n Storage,\n extractPkceStorageKeyFromState,\n initializeEmbeddedSignInFlow,\n} from '@thunderid/javascript';\nimport {FetchHttpClient} from '../../FetchHttpClient';\nimport {SILENT_SIGN_IN_STATE, TOKEN_REQUEST_CONFIG_KEY} from '../constants';\nimport {AuthenticationHelper} from '../helpers/authentication-helper';\nimport {SessionManagementHelper} from '../helpers/session-management-helper';\nimport {SPAHelper} from '../helpers/spa-helper';\nimport {HttpError, HttpRequestConfig, HttpResponse, MainThreadClientConfig, MainThreadClientInterface} from '../models';\nimport {SPACustomGrantConfig} from '../models/request-custom-grant';\nimport {BrowserStorage} from '../models/storage';\nimport {LocalStore, MemoryStore, SessionStore} from '../stores';\nimport {SPAUtils} from '../utils';\nimport {SPACryptoUtils} from '../utils/crypto-utils';\n\nconst initiateStore = (store: BrowserStorage | undefined): Storage => {\n switch (store) {\n case BrowserStorage.LocalStorage:\n return new LocalStore();\n case BrowserStorage.SessionStorage:\n return new SessionStore();\n case BrowserStorage.BrowserMemory:\n return new MemoryStore();\n default:\n return new SessionStore();\n }\n};\n\nexport const MainThreadClient = async (\n instanceId: number,\n config: AuthClientConfig<MainThreadClientConfig>,\n getAuthHelper: (\n authClient: ThunderIDAuthClient<MainThreadClientConfig>,\n spaHelper: SPAHelper<MainThreadClientConfig>,\n ) => AuthenticationHelper<MainThreadClientConfig>,\n): Promise<MainThreadClientInterface> => {\n const _store: Storage = initiateStore(config.storage as BrowserStorage);\n const _cryptoUtils: SPACryptoUtils = new SPACryptoUtils();\n const _authenticationClient = new ThunderIDAuthClient<MainThreadClientConfig>();\n await _authenticationClient.initialize(config, _store, _cryptoUtils, instanceId);\n\n const _spaHelper = new SPAHelper<MainThreadClientConfig>(_authenticationClient);\n const _dataLayer = _authenticationClient.getStorageManager();\n const _sessionManagementHelper = await SessionManagementHelper(\n async () => _authenticationClient.getSignOutUrl(),\n (config.storage as BrowserStorage) ?? BrowserStorage.SessionStorage,\n (sessionState: string) =>\n _dataLayer.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState ?? '',\n ),\n );\n\n const _authenticationHelper = getAuthHelper(_authenticationClient, _spaHelper);\n\n let _getSignOutURLFromSessionStorage = false;\n\n const attachToken = async (request: HttpRequestConfig): Promise<void> => {\n await _authenticationHelper.attachTokenToRequestConfig(request);\n };\n\n const _httpClient = FetchHttpClient.getInstance(instanceId, true, attachToken);\n let _isHttpHandlerEnabled = true;\n let _httpErrorCallback: (error: HttpError) => void | Promise<void>;\n let _httpFinishCallback: () => void;\n\n const setHttpRequestStartCallback = (callback: () => void): void => {\n _httpClient?.setHttpRequestStartCallback && _httpClient.setHttpRequestStartCallback(callback);\n };\n\n const setHttpRequestSuccessCallback = (callback: (response: HttpResponse) => void): void => {\n _httpClient?.setHttpRequestSuccessCallback && _httpClient.setHttpRequestSuccessCallback(callback);\n };\n\n const setHttpRequestFinishCallback = (callback: () => void): void => {\n _httpClient?.setHttpRequestFinishCallback && _httpClient.setHttpRequestFinishCallback(callback);\n };\n\n const setHttpRequestErrorCallback = (callback: (error: HttpError) => void | Promise<void>): void => {\n _httpErrorCallback = callback;\n };\n\n const httpRequest = async (requestConfig: HttpRequestConfig): Promise<HttpResponse> =>\n _authenticationHelper.httpRequest(\n _httpClient,\n requestConfig,\n _isHttpHandlerEnabled,\n _httpErrorCallback,\n _httpFinishCallback,\n );\n\n const httpRequestAll = async (requestConfigs: HttpRequestConfig[]): Promise<HttpResponse[] | undefined> =>\n _authenticationHelper.httpRequestAll(\n requestConfigs,\n _httpClient,\n _isHttpHandlerEnabled,\n _httpErrorCallback,\n _httpFinishCallback,\n );\n\n const getHttpClient = (): FetchHttpClient => _httpClient;\n\n const enableHttpHandler = (): boolean => {\n _authenticationHelper.enableHttpHandler(_httpClient);\n _isHttpHandlerEnabled = true;\n\n return true;\n };\n\n const disableHttpHandler = (): boolean => {\n _authenticationHelper.disableHttpHandler(_httpClient);\n _isHttpHandlerEnabled = false;\n\n return true;\n };\n\n const checkSession = async (): Promise<void> => {\n const oidcEndpoints: OIDCEndpoints = (await _authenticationClient.getOpenIDProviderEndpoints()) as OIDCEndpoints;\n const config = await _dataLayer.getConfigData();\n\n _authenticationHelper.initializeSessionManger(\n config,\n oidcEndpoints,\n async () => (await _authenticationClient.getUserSession()).sessionState,\n async (params?: ExtendedAuthorizeRequestUrlParams): Promise<string> => _authenticationClient.getSignInUrl(params),\n _sessionManagementHelper,\n );\n };\n\n const shouldStopAuthn = async (): Promise<boolean> =>\n _sessionManagementHelper.receivePromptNoneResponse(async (sessionState: string | null) => {\n await _dataLayer.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState ?? '',\n );\n });\n\n const setSessionStatus = async (sessionStatus: string): Promise<void> => {\n await _dataLayer.setSessionStatus(sessionStatus);\n };\n\n const signIn = async (\n signInConfig?: ExtendedAuthorizeRequestUrlParams,\n authorizationCode?: string,\n sessionState?: string,\n state?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User> => {\n const basicUserInfo = await _authenticationHelper.handleSignIn(shouldStopAuthn, checkSession, undefined);\n\n if (basicUserInfo) {\n return basicUserInfo;\n }\n let resolvedAuthorizationCode: string;\n let resolvedSessionState: string;\n let resolvedState: string;\n let resolvedTokenRequestConfig: {\n params: Record<string, unknown>;\n } = {params: {}};\n\n if (config?.responseMode === 'form_post' && authorizationCode) {\n resolvedAuthorizationCode = authorizationCode;\n resolvedSessionState = sessionState ?? '';\n resolvedState = state ?? '';\n } else {\n resolvedAuthorizationCode =\n new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.AUTHORIZATION_CODE) ?? '';\n resolvedSessionState =\n new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.SESSION_STATE) ?? '';\n resolvedState = new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.STATE) ?? '';\n\n SPAUtils.removeAuthorizationCode();\n }\n\n if (resolvedAuthorizationCode && resolvedState) {\n setSessionStatus('true');\n const storedTokenRequestConfig = await _dataLayer.getTemporaryDataParameter(TOKEN_REQUEST_CONFIG_KEY);\n if (storedTokenRequestConfig && typeof storedTokenRequestConfig === 'string') {\n resolvedTokenRequestConfig = JSON.parse(storedTokenRequestConfig);\n }\n return requestAccessToken(\n resolvedAuthorizationCode,\n resolvedSessionState,\n resolvedState,\n resolvedTokenRequestConfig,\n );\n }\n\n return _authenticationClient.getSignInUrl(signInConfig).then(async (url: string) => {\n if (config.storage === BrowserStorage.BrowserMemory && config.enablePKCE) {\n const pkceKey: string = extractPkceStorageKeyFromState(resolvedState);\n\n SPAUtils.setPKCE(pkceKey, await _authenticationClient.getPKCECode(resolvedState));\n }\n\n if (tokenRequestConfig) {\n _dataLayer.setTemporaryDataParameter(TOKEN_REQUEST_CONFIG_KEY, JSON.stringify(tokenRequestConfig));\n }\n\n // FIXME: This is a workaround to handle the `response_mode` as `direct` in the sign-in config.\n if (signInConfig?.['response_mode'] === 'direct') {\n const authorizeUrl: URL = new URL(url);\n\n return initializeEmbeddedSignInFlow({\n url: `${authorizeUrl.origin}${authorizeUrl.pathname}`,\n payload: Object.fromEntries(authorizeUrl.searchParams.entries()),\n });\n }\n\n location.href = url;\n\n await SPAUtils.waitTillPageRedirect();\n\n return Promise.resolve({\n allowedScopes: '',\n displayName: '',\n email: '',\n sessionState: '',\n sub: '',\n tenantDomain: '',\n username: '',\n });\n });\n };\n\n const signOut = async (): Promise<boolean> => {\n if ((await _authenticationClient.isSignedIn()) && !_getSignOutURLFromSessionStorage) {\n location.href = await _authenticationClient.getSignOutUrl();\n } else {\n location.href = SPAUtils.getSignOutUrl(config.clientId, instanceId);\n }\n\n _spaHelper.clearRefreshTokenTimeout();\n\n await _dataLayer.removeOIDCProviderMetaData();\n await _dataLayer.removeTemporaryData();\n await _dataLayer.removeSessionData();\n await _dataLayer.removeSessionStatus();\n\n await SPAUtils.waitTillPageRedirect();\n\n return true;\n };\n\n const enableRetrievingSignOutURLFromSession = (config: SPACustomGrantConfig) => {\n if (config.preventSignOutURLUpdate) {\n _getSignOutURLFromSessionStorage = true;\n }\n };\n\n const exchangeToken = async (config: SPACustomGrantConfig): Promise<User | Response> =>\n _authenticationHelper.exchangeToken(config, enableRetrievingSignOutURLFromSession);\n\n const refreshAccessToken = async (): Promise<User> => {\n try {\n return await _authenticationHelper.refreshAccessToken(enableRetrievingSignOutURLFromSession);\n } catch (error) {\n return Promise.reject(error);\n }\n };\n\n const revokeAccessToken = async (): Promise<boolean> => {\n const timer: number = await _spaHelper.getRefreshTimeoutTimer();\n\n return _authenticationClient\n .revokeAccessToken()\n .then(() => {\n _sessionManagementHelper.reset();\n _spaHelper.clearRefreshTokenTimeout(timer);\n\n return Promise.resolve(true);\n })\n .catch((error) => Promise.reject(error));\n };\n\n const requestAccessToken = async (\n resolvedAuthorizationCode: string,\n resolvedSessionState: string,\n resolvedState: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User> =>\n _authenticationHelper.requestAccessToken(\n resolvedAuthorizationCode,\n resolvedSessionState,\n checkSession,\n undefined,\n resolvedState,\n tokenRequestConfig,\n );\n\n const constructSilentSignInUrl = async (additionalParams: Record<string, string | boolean> = {}): Promise<string> => {\n const config = await _dataLayer.getConfigData();\n const urlString: string = await _authenticationClient.getSignInUrl({\n prompt: 'none',\n state: SILENT_SIGN_IN_STATE,\n ...additionalParams,\n });\n\n // Replace form_post with query\n const urlObject = new URL(urlString);\n urlObject.searchParams.set('response_mode', 'query');\n const url: string = urlObject.toString();\n\n if (config.storage === BrowserStorage.BrowserMemory && config.enablePKCE) {\n const state = urlObject.searchParams.get(OIDCRequestConstants.Params.STATE);\n\n SPAUtils.setPKCE(\n extractPkceStorageKeyFromState(state ?? ''),\n await _authenticationClient.getPKCECode(state ?? ''),\n );\n }\n\n return url;\n };\n\n /**\n * This method checks if there is an active user session in the server by sending a prompt none request.\n * If the user is signed in, this method sends a token request. Returns false otherwise.\n *\n * @return {Promise<User|boolean} Returns a Promise that resolves with the User\n * if the user is signed in or with `false` if there is no active user session in the server.\n */\n const signInSilently = async (\n additionalParams?: Record<string, string | boolean>,\n tokenRequestConfig?: {params: Record<string, unknown>},\n ): Promise<User | boolean> =>\n _authenticationHelper.signInSilently(\n constructSilentSignInUrl,\n requestAccessToken,\n _sessionManagementHelper,\n additionalParams,\n tokenRequestConfig,\n );\n\n const getUser = async (): Promise<User> => _authenticationHelper.getUser();\n\n const getDecodedIdToken = async (sessionId?: string): Promise<IdToken> =>\n _authenticationHelper.getDecodedIdToken(sessionId);\n\n const getCrypto = async (): Promise<IsomorphicCrypto> => _authenticationHelper.getCrypto();\n\n const getIdToken = async (): Promise<string> => _authenticationHelper.getIdToken();\n\n const getOpenIDProviderEndpoints = async (): Promise<OIDCEndpoints> =>\n _authenticationHelper.getOpenIDProviderEndpoints();\n\n const getAccessToken = async (sessionId?: string): Promise<string> => _authenticationHelper.getAccessToken(sessionId);\n\n const getStorageManager = async (): Promise<StorageManager<MainThreadClientConfig>> =>\n _authenticationHelper.getStorageManager();\n\n const getConfigData = async (): Promise<AuthClientConfig<MainThreadClientConfig>> => _dataLayer.getConfigData();\n\n const isSignedIn = async (): Promise<boolean> => _authenticationHelper.isSignedIn();\n\n const isSessionActive = async (): Promise<boolean> => (await _dataLayer.getSessionStatus()) === 'true';\n\n const reInitialize = async (newConfig: Partial<AuthClientConfig<MainThreadClientConfig>>): Promise<void> => {\n const existingConfig = await _dataLayer.getConfigData();\n const isCheckSessionIframeDifferent = !(\n existingConfig &&\n existingConfig.endpoints &&\n existingConfig.endpoints.checkSessionIframe &&\n newConfig &&\n newConfig.endpoints &&\n newConfig.endpoints.checkSessionIframe &&\n existingConfig.endpoints.checkSessionIframe === newConfig.endpoints.checkSessionIframe\n );\n const config = {...existingConfig, ...newConfig};\n await _authenticationClient.reInitialize(config);\n\n // Re-initiates check session if the check session endpoint is updated.\n if (config.syncSession && isCheckSessionIframeDifferent) {\n _sessionManagementHelper.reset();\n\n checkSession();\n }\n };\n\n const decodeJwtToken = async <T = Record<string, unknown>>(token: string): Promise<T> => {\n return _authenticationClient.decodeJwtToken<T>(token);\n };\n\n const startAutoRefreshToken = async (): Promise<void> => {\n _spaHelper.clearRefreshTokenTimeout();\n await _spaHelper.refreshAccessTokenAutomatically(_authenticationHelper);\n };\n\n return {\n disableHttpHandler,\n enableHttpHandler,\n getAccessToken,\n getUser,\n getConfigData,\n getCrypto,\n getStorageManager,\n getDecodedIdToken,\n getHttpClient,\n getIdToken,\n getOpenIDProviderEndpoints,\n httpRequest,\n httpRequestAll,\n isSignedIn,\n isSessionActive,\n refreshAccessToken,\n exchangeToken,\n revokeAccessToken,\n setHttpRequestErrorCallback,\n setHttpRequestFinishCallback,\n setHttpRequestStartCallback,\n setHttpRequestSuccessCallback,\n signIn,\n signOut,\n signInSilently,\n startAutoRefreshToken,\n reInitialize,\n decodeJwtToken,\n };\n};\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDAuthClient,\n ThunderIDAuthException,\n AuthClientConfig,\n User,\n IsomorphicCrypto,\n TokenExchangeRequestConfig,\n StorageManager,\n IdToken,\n ExtendedAuthorizeRequestUrlParams,\n OIDCEndpoints,\n TokenResponse,\n extractPkceStorageKeyFromState,\n Config,\n HttpClient,\n} from '@thunderid/javascript';\nimport {SPAHelper} from './spa-helper';\nimport {\n ACCESS_TOKEN_INVALID,\n CHECK_SESSION_SIGNED_IN,\n CHECK_SESSION_SIGNED_OUT,\n CUSTOM_GRANT_CONFIG,\n ERROR,\n ERROR_DESCRIPTION,\n PROMPT_NONE_IFRAME,\n REFRESH_ACCESS_TOKEN_ERR0R,\n RP_IFRAME,\n} from '../constants';\nimport {\n AuthorizationInfo,\n HttpError,\n HttpRequestConfig,\n HttpRequestInterface,\n HttpResponse,\n MainThreadClientConfig,\n Message,\n SessionManagementHelperInterface,\n WebWorkerClientConfig,\n} from '../models';\nimport {SPACustomGrantConfig} from '../models/request-custom-grant';\nimport {BrowserStorage} from '../models/storage';\nimport {SPAUtils} from '../utils';\n\nexport class AuthenticationHelper<T extends MainThreadClientConfig | WebWorkerClientConfig> {\n protected _authenticationClient: ThunderIDAuthClient<T>;\n protected _storageManager: StorageManager<T>;\n protected _spaHelper: SPAHelper<T>;\n protected _instanceId: number;\n protected _isTokenRefreshing: boolean;\n\n public constructor(authClient: ThunderIDAuthClient<T>, spaHelper: SPAHelper<T>) {\n this._authenticationClient = authClient;\n this._storageManager = this._authenticationClient.getStorageManager();\n this._spaHelper = spaHelper;\n this._instanceId = this._authenticationClient.getInstanceId();\n this._isTokenRefreshing = false;\n }\n\n public enableHttpHandler(httpClient: HttpClient): void {\n httpClient?.enableHandler && httpClient.enableHandler();\n }\n\n public disableHttpHandler(httpClient: HttpClient): void {\n httpClient?.disableHandler && httpClient.disableHandler();\n }\n\n public initializeSessionManger(\n config: AuthClientConfig<T>,\n oidcEndpoints: OIDCEndpoints,\n getSessionState: () => Promise<string>,\n getAuthzURL: (params?: ExtendedAuthorizeRequestUrlParams) => Promise<string>,\n sessionManagementHelper: SessionManagementHelperInterface,\n ): void {\n sessionManagementHelper.initialize(\n config.clientId,\n oidcEndpoints.checkSessionIframe ?? '',\n getSessionState,\n config.checkSessionInterval ?? 3,\n config.sessionRefreshInterval ?? 300,\n config.afterSignInUrl,\n getAuthzURL,\n );\n }\n\n public async exchangeToken(\n config: SPACustomGrantConfig,\n enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void,\n ): Promise<User | Response> {\n const _config: Config = (await this._storageManager.getConfigData()) as Config;\n let useDefaultEndpoint = true;\n let matches = false;\n\n // If the config does not contains a token endpoint, default token endpoint will be used.\n if (config?.tokenEndpoint) {\n useDefaultEndpoint = false;\n\n // Only validate URLs for WebWorker storage\n if (_config.storage === BrowserStorage.WebWorker) {\n for (const baseUrl of [...(_config?.allowedExternalUrls ?? []), (config as any).baseUrl]) {\n if (baseUrl && config.tokenEndpoint?.startsWith(baseUrl)) {\n matches = true;\n break;\n }\n }\n } else {\n matches = true;\n }\n }\n\n if (config.shouldReplayAfterRefresh) {\n this._storageManager.setTemporaryDataParameter(CUSTOM_GRANT_CONFIG, JSON.stringify(config));\n }\n\n if (useDefaultEndpoint || matches) {\n return this._authenticationClient\n .exchangeToken(config)\n .then(async (response: Response | TokenResponse) => {\n if (enableRetrievingSignOutURLFromSession && typeof enableRetrievingSignOutURLFromSession === 'function') {\n enableRetrievingSignOutURLFromSession(config);\n }\n\n if (config.returnsSession) {\n this._spaHelper.refreshAccessTokenAutomatically(this);\n\n return this._authenticationClient.getUser();\n } else {\n return response as Response;\n }\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n } else {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-MAIN_THREAD_CLIENT-RCG-IV01',\n 'Request to the provided endpoint is prohibited.',\n 'Requests can only be sent to resource servers specified by the `allowedExternalUrls`' +\n ' attribute while initializing the SDK. The specified token endpoint in this request ' +\n 'cannot be found among the `allowedExternalUrls`',\n ),\n );\n }\n }\n\n public async getCustomGrantConfigData(): Promise<AuthClientConfig<TokenExchangeRequestConfig> | null> {\n const configString = await this._storageManager.getTemporaryDataParameter(CUSTOM_GRANT_CONFIG);\n\n if (configString) {\n return JSON.parse(configString as string);\n } else {\n return null;\n }\n }\n\n public async refreshAccessToken(\n enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void,\n ): Promise<User> {\n try {\n await this._authenticationClient.refreshAccessToken();\n const customGrantConfig = await this.getCustomGrantConfigData();\n if (customGrantConfig) {\n await this.exchangeToken(customGrantConfig, enableRetrievingSignOutURLFromSession);\n }\n this._spaHelper.refreshAccessTokenAutomatically(this);\n\n return this._authenticationClient.getUser();\n } catch (error) {\n const refreshTokenError: Message<string> = {\n type: REFRESH_ACCESS_TOKEN_ERR0R,\n };\n\n window.postMessage(refreshTokenError);\n return Promise.reject(error);\n }\n }\n\n protected async retryFailedRequests(failedRequest: HttpRequestInterface): Promise<HttpResponse> {\n const httpClient = failedRequest.httpClient;\n const requestConfig = failedRequest.requestConfig;\n const isHttpHandlerEnabled = failedRequest.isHttpHandlerEnabled;\n const httpErrorCallback = failedRequest.httpErrorCallback;\n const httpFinishCallback = failedRequest.httpFinishCallback;\n\n // Wait until the token is refreshed.\n await SPAUtils.until(() => !this._isTokenRefreshing);\n\n try {\n const httpResponse = await httpClient.request(requestConfig);\n\n return Promise.resolve(httpResponse);\n } catch (error: any) {\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback(error);\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n return Promise.reject(error);\n }\n }\n\n public async httpRequest(\n httpClient: HttpClient,\n requestConfig: HttpRequestConfig,\n isHttpHandlerEnabled?: boolean,\n httpErrorCallback?: (error: HttpError) => void | Promise<void>,\n httpFinishCallback?: () => void,\n enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void,\n ): Promise<HttpResponse> {\n let matches = false;\n const config: Config = (await this._storageManager.getConfigData()) as Config;\n\n // Only validate URLs for WebWorker storage\n if (config.storage === BrowserStorage.WebWorker) {\n for (const baseUrl of [...(config?.allowedExternalUrls ?? []), (config as any).baseUrl]) {\n if (baseUrl && requestConfig?.url?.startsWith(baseUrl)) {\n matches = true;\n\n break;\n }\n }\n } else {\n matches = true;\n }\n\n if (matches) {\n return httpClient\n .request(requestConfig)\n .then((response: HttpResponse) => {\n return Promise.resolve(response);\n })\n .catch(async (error: HttpError) => {\n if (error?.response?.status === 401 || !error?.response) {\n if (this._isTokenRefreshing) {\n return this.retryFailedRequests({\n enableRetrievingSignOutURLFromSession,\n httpClient,\n httpErrorCallback,\n httpFinishCallback,\n isHttpHandlerEnabled,\n requestConfig,\n });\n }\n\n this._isTokenRefreshing = true;\n // Try to refresh the token\n let refreshAccessTokenResponse: User;\n try {\n refreshAccessTokenResponse = await this.refreshAccessToken(enableRetrievingSignOutURLFromSession);\n\n this._isTokenRefreshing = false;\n } catch (refreshError: any) {\n this._isTokenRefreshing = false;\n\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback({\n ...error,\n code: ACCESS_TOKEN_INVALID,\n });\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n throw new ThunderIDAuthException(\n 'SPA-AUTH_HELPER-HR-SE01',\n refreshError?.name ?? 'Refresh token request failed.',\n refreshError?.message ??\n 'An error occurred while trying to refresh the ' +\n 'access token following a 401 response from the server.',\n );\n }\n\n // Retry the request after refreshing the token\n if (refreshAccessTokenResponse) {\n try {\n const httpResponse = await httpClient.request(requestConfig);\n return Promise.resolve(httpResponse);\n } catch (error: any) {\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback(error);\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n return Promise.reject(error);\n }\n }\n }\n\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback(error);\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n return Promise.reject(error);\n });\n } else {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_HELPER-HR-IV02',\n 'Request to the provided endpoint is prohibited.',\n 'Requests can only be sent to resource servers specified by the `allowedExternalUrls`' +\n ' attribute while initializing the SDK. The specified endpoint in this request ' +\n 'cannot be found among the `allowedExternalUrls`',\n ),\n );\n }\n }\n\n public async httpRequestAll(\n requestConfigs: HttpRequestConfig[],\n httpClient: HttpClient,\n isHttpHandlerEnabled?: boolean,\n httpErrorCallback?: (error: HttpError) => void | Promise<void>,\n httpFinishCallback?: () => void,\n ): Promise<HttpResponse[] | undefined> {\n let matches = true;\n const config: Config = (await this._storageManager.getConfigData()) as Config;\n\n // Only validate URLs for WebWorker storage\n if (config.storage === BrowserStorage.WebWorker) {\n for (const requestConfig of requestConfigs) {\n let urlMatches = false;\n\n for (const baseUrl of [...(config?.allowedExternalUrls ?? []), (config as any).baseUrl]) {\n if (baseUrl && requestConfig.url?.startsWith(baseUrl)) {\n urlMatches = true;\n\n break;\n }\n }\n\n if (!urlMatches) {\n matches = false;\n\n break;\n }\n }\n }\n\n const requests: Promise<HttpResponse<any>>[] = [];\n\n if (matches) {\n requestConfigs.forEach((request) => {\n requests.push(httpClient.request(request));\n });\n\n return (\n httpClient?.all &&\n httpClient\n .all(requests)\n .then((responses: HttpResponse[]) => {\n return Promise.resolve(responses);\n })\n .catch(async (error: HttpError) => {\n if (error?.response?.status === 401 || !error?.response) {\n let refreshTokenResponse: TokenResponse | User;\n try {\n refreshTokenResponse = await this._authenticationClient.refreshAccessToken();\n } catch (refreshError: any) {\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback({\n ...error,\n code: ACCESS_TOKEN_INVALID,\n });\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n throw new ThunderIDAuthException(\n 'SPA-AUTH_HELPER-HRA-SE01',\n refreshError?.name ?? 'Refresh token request failed.',\n refreshError?.message ??\n 'An error occurred while trying to refresh the ' +\n 'access token following a 401 response from the server.',\n );\n }\n\n if (refreshTokenResponse) {\n return (\n httpClient.all &&\n httpClient\n .all(requests)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch(async (error) => {\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback(error);\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n return Promise.reject(error);\n })\n );\n }\n }\n\n if (isHttpHandlerEnabled) {\n if (typeof httpErrorCallback === 'function') {\n await httpErrorCallback(error);\n }\n if (typeof httpFinishCallback === 'function') {\n httpFinishCallback();\n }\n }\n\n return Promise.reject(error);\n })\n );\n } else {\n throw new ThunderIDAuthException(\n 'SPA-AUTH_HELPER-HRA-IV02',\n 'Request to the provided endpoint is prohibited.',\n 'Requests can only be sent to resource servers specified by the `allowedExternalUrls`' +\n ' attribute while initializing the SDK. The specified endpoint in this request ' +\n 'cannot be found among the `allowedExternalUrls`',\n );\n }\n }\n\n public async requestAccessToken(\n authorizationCode?: string,\n sessionState?: string,\n checkSession?: () => Promise<void>,\n pkce?: string,\n state?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User> {\n const config = await this._storageManager.getConfigData();\n\n if (config.storage === BrowserStorage.BrowserMemory && config.enablePKCE && sessionState) {\n const pkce = SPAUtils.getPKCE(extractPkceStorageKeyFromState(sessionState));\n\n await this._authenticationClient.setPKCECode(extractPkceStorageKeyFromState(sessionState), pkce);\n } else if (config.storage === BrowserStorage.WebWorker && pkce) {\n await this._authenticationClient.setPKCECode(pkce, state ?? '');\n }\n\n if (authorizationCode) {\n return this._authenticationClient\n .requestAccessToken(authorizationCode, sessionState ?? '', state ?? '', undefined, tokenRequestConfig)\n .then(async () => {\n // Disable this temporarily\n /* if (config.storage === Storage.BrowserMemory) {\n SPAUtils.setSignOutURL(await _authenticationClient.getSignOutUrl());\n } */\n if (config.storage !== BrowserStorage.WebWorker) {\n SPAUtils.setSignOutURL(await this._authenticationClient.getSignOutUrl(), config.clientId, this._instanceId);\n\n if (this._spaHelper) {\n this._spaHelper.clearRefreshTokenTimeout();\n this._spaHelper.refreshAccessTokenAutomatically(this);\n }\n\n // Enable OIDC Sessions Management only if it is set to true in the config.\n if (checkSession && typeof checkSession === 'function' && config.syncSession) {\n checkSession();\n }\n } else {\n if (this._spaHelper) {\n this._spaHelper.refreshAccessTokenAutomatically(this);\n }\n }\n\n return this._authenticationClient.getUser();\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n }\n\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_HELPER-RAT1-NF01',\n 'No authorization code.',\n 'No authorization code was found.',\n ),\n );\n }\n\n public async signInSilently(\n constructSilentSignInUrl: (additionalParams?: Record<string, string | boolean>) => Promise<string>,\n requestAccessToken: (\n authzCode: string,\n sessionState: string,\n state: string,\n tokenRequestConfig?: {params: Record<string, unknown>},\n ) => Promise<User>,\n sessionManagementHelper: SessionManagementHelperInterface,\n additionalParams?: Record<string, string | boolean>,\n tokenRequestConfig?: {params: Record<string, unknown>},\n ): Promise<User | boolean> {\n // This block is executed by the iFrame when the server redirects with the authorization code.\n if (SPAUtils.isInitializedSilentSignIn()) {\n await sessionManagementHelper.receivePromptNoneResponse();\n\n return Promise.resolve({\n allowedScopes: '',\n displayName: '',\n email: '',\n sessionState: '',\n sub: '',\n tenantDomain: '',\n username: '',\n });\n }\n\n // This gets executed in the main thread and sends the prompt none request.\n const rpIFrame = document.getElementById(RP_IFRAME) as HTMLIFrameElement;\n\n const promptNoneIFrame: HTMLIFrameElement = rpIFrame?.contentDocument?.getElementById(\n PROMPT_NONE_IFRAME,\n ) as HTMLIFrameElement;\n\n try {\n const url = await constructSilentSignInUrl(additionalParams);\n\n promptNoneIFrame.src = url;\n } catch (error) {\n return Promise.reject(error);\n }\n\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n resolve(false);\n }, 10000);\n\n const listenToPromptNoneIFrame = async (e: MessageEvent) => {\n const data: Message<AuthorizationInfo | null> = e.data;\n\n if (data?.type == CHECK_SESSION_SIGNED_OUT) {\n window.removeEventListener('message', listenToPromptNoneIFrame);\n clearTimeout(timer);\n resolve(false);\n }\n\n if (data?.type == CHECK_SESSION_SIGNED_IN && data?.data?.code) {\n requestAccessToken(data?.data?.code, data?.data?.sessionState, data?.data?.state, tokenRequestConfig)\n .then((response: User) => {\n window.removeEventListener('message', listenToPromptNoneIFrame);\n resolve(response);\n })\n .catch((error) => {\n window.removeEventListener('message', listenToPromptNoneIFrame);\n reject(error);\n })\n .finally(() => {\n clearTimeout(timer);\n });\n }\n };\n\n window.addEventListener('message', listenToPromptNoneIFrame);\n });\n }\n\n public async handleSignIn(\n shouldStopAuthn: () => Promise<boolean>,\n checkSession: () => Promise<void>,\n tryRetrievingUserInfo?: () => Promise<User | undefined>,\n ): Promise<User | undefined> {\n const config = await this._storageManager.getConfigData();\n\n if (await shouldStopAuthn()) {\n return Promise.resolve({\n allowedScopes: '',\n displayName: '',\n email: '',\n sessionState: '',\n sub: '',\n tenantDomain: '',\n username: '',\n });\n }\n\n if (config.storage !== BrowserStorage.WebWorker) {\n if (await this._authenticationClient.isSignedIn()) {\n this._spaHelper.clearRefreshTokenTimeout();\n this._spaHelper.refreshAccessTokenAutomatically(this);\n\n // Enable OIDC Sessions Management only if it is set to true in the config.\n if (config.syncSession) {\n checkSession();\n }\n\n return Promise.resolve(await this._authenticationClient.getUser());\n }\n }\n\n const error = new URL(window.location.href).searchParams.get(ERROR);\n const errorDescription = new URL(window.location.href).searchParams.get(ERROR_DESCRIPTION);\n\n if (error) {\n const url = new URL(window.location.href);\n url.searchParams.delete(ERROR);\n url.searchParams.delete(ERROR_DESCRIPTION);\n\n history.pushState(null, document.title, url.toString());\n\n throw new ThunderIDAuthException('SPA-AUTH_HELPER-SI-SE01', error, errorDescription ?? '');\n }\n\n if (config.storage === BrowserStorage.WebWorker && tryRetrievingUserInfo) {\n const basicUserInfo = await tryRetrievingUserInfo();\n\n if (basicUserInfo) {\n return basicUserInfo;\n }\n }\n\n return Promise.resolve(undefined);\n }\n\n public async attachTokenToRequestConfig(request: HttpRequestConfig): Promise<void> {\n const requestConfig = {attachToken: true, ...request};\n if (requestConfig.attachToken) {\n if (requestConfig.shouldAttachIDPAccessToken) {\n request.headers = {\n ...request.headers,\n Authorization: `Bearer ${await this.getIDPAccessToken()}`,\n };\n } else {\n request.headers = {\n ...request.headers,\n Authorization: `Bearer ${await this.getAccessToken()}`,\n };\n }\n }\n }\n\n public async getUser(): Promise<User> {\n return this._authenticationClient.getUser();\n }\n\n public async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return this._authenticationClient.getDecodedIdToken(sessionId);\n }\n\n public async getDecodedIDPIDToken(): Promise<IdToken> {\n return this._authenticationClient.getDecodedIdToken();\n }\n\n public async getCrypto(): Promise<IsomorphicCrypto> {\n return this._authenticationClient.getCrypto();\n }\n\n public async getIdToken(): Promise<string> {\n return this._authenticationClient.getIdToken();\n }\n\n public async getOpenIDProviderEndpoints(): Promise<OIDCEndpoints> {\n return this._authenticationClient.getOpenIDProviderEndpoints() as any;\n }\n\n public async getAccessToken(sessionId?: string): Promise<string> {\n return this._authenticationClient.getAccessToken(sessionId);\n }\n\n public async getIDPAccessToken(): Promise<string> {\n return (await this._storageManager.getSessionData())?.access_token;\n }\n\n public getStorageManager(): StorageManager<T> {\n return this._storageManager;\n }\n\n public async isSignedIn(): Promise<boolean> {\n return this._authenticationClient.isSignedIn();\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDAuthClient,\n ThunderIDAuthException,\n AuthClientConfig,\n User,\n IsomorphicCrypto,\n TokenExchangeRequestConfig,\n IdToken,\n ExtendedAuthorizeRequestUrlParams,\n OIDCEndpoints,\n OIDCRequestConstants,\n Storage,\n extractPkceStorageKeyFromState,\n} from '@thunderid/javascript';\nimport {\n DISABLE_HTTP_HANDLER,\n ENABLE_HTTP_HANDLER,\n GET_AUTH_URL,\n GET_BASIC_USER_INFO,\n GET_CONFIG_DATA,\n GET_CRYPTO_HELPER,\n GET_DECODED_IDP_ID_TOKEN,\n GET_DECODED_ID_TOKEN,\n GET_ID_TOKEN,\n GET_OIDC_SERVICE_ENDPOINTS,\n GET_SIGN_OUT_URL,\n HTTP_REQUEST,\n HTTP_REQUEST_ALL,\n INIT,\n IS_AUTHENTICATED,\n REFRESH_ACCESS_TOKEN,\n REQUEST_ACCESS_TOKEN,\n REQUEST_CUSTOM_GRANT,\n REQUEST_FINISH,\n REQUEST_START,\n REQUEST_SUCCESS,\n REVOKE_ACCESS_TOKEN,\n SET_SESSION_STATE,\n SIGN_OUT,\n SILENT_SIGN_IN_STATE,\n START_AUTO_REFRESH_TOKEN,\n UPDATE_CONFIG,\n} from '../constants';\nimport {AuthenticationHelper, SPAHelper, SessionManagementHelper} from '../helpers';\nimport {\n AuthorizationInfo,\n AuthorizationResponse,\n HttpError,\n HttpRequestConfig,\n HttpResponse,\n Message,\n ResponseMessage,\n WebWorkerClientConfig,\n WebWorkerClientInterface,\n} from '../models';\n\ninterface HttpClientCallbacks {\n requestStartCallback: () => void;\n requestSuccessCallback: (response: HttpResponse) => void;\n requestErrorCallback: (error: HttpError) => void | Promise<void>;\n requestFinishCallback: () => void;\n}\nimport {SPACustomGrantConfig} from '../models/request-custom-grant';\nimport {BrowserStorage} from '../models/storage';\nimport {LocalStore, MemoryStore, SessionStore} from '../stores';\nimport {SPAUtils} from '../utils';\nimport {SPACryptoUtils} from '../utils/crypto-utils';\n\nconst initiateStore = (store: BrowserStorage | undefined): Storage => {\n switch (store) {\n case BrowserStorage.LocalStorage:\n return new LocalStore();\n case BrowserStorage.SessionStorage:\n return new SessionStore();\n case BrowserStorage.BrowserMemory:\n return new MemoryStore();\n default:\n return new SessionStore();\n }\n};\n\nexport const WebWorkerClient = async (\n instanceId: number,\n config: AuthClientConfig<WebWorkerClientConfig>,\n webWorker: new () => Worker,\n getAuthHelper: (\n authClient: ThunderIDAuthClient<WebWorkerClientConfig>,\n spaHelper: SPAHelper<WebWorkerClientConfig>,\n ) => AuthenticationHelper<WebWorkerClientConfig>,\n): Promise<WebWorkerClientInterface> => {\n /**\n * HttpClient handlers\n */\n let httpClientHandlers: HttpClientCallbacks;\n /**\n * API request time out.\n */\n const _requestTimeout: number = config?.requestTimeout ?? 60000;\n let _isHttpHandlerEnabled = true;\n let _getSignOutURLFromSessionStorage = false;\n\n const _store: Storage = initiateStore(config.storage as BrowserStorage);\n const _cryptoUtils: SPACryptoUtils = new SPACryptoUtils();\n const _authenticationClient = new ThunderIDAuthClient<WebWorkerClientConfig>();\n await _authenticationClient.initialize(config, _store, _cryptoUtils, instanceId);\n const _spaHelper = new SPAHelper<WebWorkerClientConfig>(_authenticationClient);\n\n const _sessionManagementHelper = await SessionManagementHelper(\n async () => {\n const message: Message<string> = {\n type: SIGN_OUT,\n };\n\n try {\n const signOutURL = await communicate<string, string>(message);\n\n return signOutURL;\n } catch {\n return SPAUtils.getSignOutUrl(config.clientId, instanceId);\n }\n },\n config.storage as BrowserStorage,\n (sessionState: string) => setSessionState(sessionState),\n );\n\n const _authenticationHelper: AuthenticationHelper<WebWorkerClientConfig> = getAuthHelper(\n _authenticationClient,\n _spaHelper,\n );\n\n const worker: Worker = new webWorker();\n\n const communicate = <T, R>(message: Message<T>): Promise<R> => {\n const channel = new MessageChannel();\n\n worker.postMessage(message, [channel.port2]);\n\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(\n new ThunderIDAuthException(\n 'SPA-WEB_WORKER_CLIENT-COM-TO01',\n 'Operation timed out.',\n 'No response was received from the web worker for ' +\n _requestTimeout / 1000 +\n ' since dispatching the request',\n ),\n );\n }, _requestTimeout);\n\n return (channel.port1.onmessage = ({data}: {data: ResponseMessage<string>}) => {\n clearTimeout(timer);\n channel.port1.close();\n channel.port2.close();\n\n if (data?.success) {\n const responseData = data?.data ? JSON.parse(data?.data) : null;\n if (data?.blob) {\n responseData.data = data?.blob;\n }\n\n resolve(responseData);\n } else {\n let error = null;\n if (data.error) {\n try {\n error = JSON.parse(data.error);\n } catch (parseError) {\n // If JSON parsing fails, create a proper error object\n error = new ThunderIDAuthException(\n 'SPA-WEB_WORKER_CLIENT-COM-PE01',\n 'Worker communication error.',\n `Failed to parse worker error response: ${data.error}`,\n );\n }\n } else {\n error = new ThunderIDAuthException(\n 'SPA-WEB_WORKER_CLIENT-COM-UE01',\n 'Unknown worker error.',\n 'An unknown error occurred in the web worker.',\n );\n }\n reject(error);\n }\n });\n });\n };\n\n /**\n * Allows using custom grant types.\n *\n * @param {CustomGrantRequestParams} requestParams Request Parameters.\n *\n * @returns {Promise<HttpResponse|boolean>} A promise that resolves with a boolean value or the request\n * response if the the `returnResponse` attribute in the `requestParams` object is set to `true`.\n */\n const exchangeToken = (requestParams: SPACustomGrantConfig): Promise<Response | User> => {\n const message: Message<TokenExchangeRequestConfig> = {\n data: requestParams,\n type: REQUEST_CUSTOM_GRANT,\n };\n\n return communicate<TokenExchangeRequestConfig, Response | User>(message)\n .then((response) => {\n if (requestParams.preventSignOutURLUpdate) {\n _getSignOutURLFromSessionStorage = true;\n }\n\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n /**\n *\n * Send the API request to the web worker and returns the response.\n *\n * @param {HttpRequestConfig} config The Http Request Config object\n *\n * @returns {Promise<HttpResponse>} A promise that resolves with the response data.\n */\n const httpRequest = <T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>> => {\n /**\n *\n * Currently FormData is not supported to send to a web worker\n *\n * Below workaround will represent FormData object as a JSON.\n * This workaround will not be needed once FormData object is made cloneable\n * Reference: https://github.com/whatwg/xhr/issues/55\n */\n if (config?.data && config?.data instanceof FormData) {\n config.data = {...Object.fromEntries((config?.data as any).entries()), formData: true};\n }\n\n const message: Message<HttpRequestConfig> = {\n data: config,\n type: HTTP_REQUEST,\n };\n\n return communicate<HttpRequestConfig, HttpResponse<T>>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch(async (error) => {\n if (_isHttpHandlerEnabled) {\n if (typeof httpClientHandlers.requestErrorCallback === 'function') {\n await httpClientHandlers.requestErrorCallback(error);\n }\n if (typeof httpClientHandlers.requestFinishCallback === 'function') {\n httpClientHandlers.requestFinishCallback();\n }\n }\n\n return Promise.reject(error);\n });\n };\n\n /**\n *\n * Send multiple API requests to the web worker and returns the response.\n * Similar `axios.spread` in functionality.\n *\n * @param {HttpRequestConfig[]} configs - The Http Request Config object\n *\n * @returns {Promise<HttpResponse<T>[]>} A promise that resolves with the response data.\n */\n const httpRequestAll = <T = any>(configs: HttpRequestConfig[]): Promise<HttpResponse<T>[]> => {\n const message: Message<HttpRequestConfig[]> = {\n data: configs,\n type: HTTP_REQUEST_ALL,\n };\n\n return communicate<HttpRequestConfig[], HttpResponse<T>[]>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch(async (error) => {\n if (_isHttpHandlerEnabled) {\n if (typeof httpClientHandlers.requestErrorCallback === 'function') {\n await httpClientHandlers.requestErrorCallback(error);\n }\n if (typeof httpClientHandlers.requestFinishCallback === 'function') {\n httpClientHandlers.requestFinishCallback();\n }\n }\n\n return Promise.reject(error);\n });\n };\n\n const enableHttpHandler = (): Promise<boolean> => {\n const message: Message<null> = {\n type: ENABLE_HTTP_HANDLER,\n };\n return communicate<null, null>(message)\n .then(() => {\n _isHttpHandlerEnabled = true;\n\n return Promise.resolve(true);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const disableHttpHandler = (): Promise<boolean> => {\n const message: Message<null> = {\n type: DISABLE_HTTP_HANDLER,\n };\n return communicate<null, null>(message)\n .then(() => {\n _isHttpHandlerEnabled = false;\n\n return Promise.resolve(true);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n /**\n * Initializes the object with authentication parameters.\n *\n * @param {ConfigInterface} config The configuration object.\n *\n * @returns {Promise<boolean>} Promise that resolves when initialization is successful.\n *\n */\n const initialize = (): Promise<boolean> => {\n if (!httpClientHandlers) {\n httpClientHandlers = {\n requestErrorCallback: () => Promise.resolve(),\n requestFinishCallback: () => null,\n requestStartCallback: () => null,\n requestSuccessCallback: () => null,\n };\n }\n\n worker.onmessage = ({data}) => {\n switch (data.type) {\n case REQUEST_FINISH:\n httpClientHandlers?.requestFinishCallback && httpClientHandlers?.requestFinishCallback();\n break;\n case REQUEST_START:\n httpClientHandlers?.requestStartCallback && httpClientHandlers?.requestStartCallback();\n break;\n case REQUEST_SUCCESS:\n httpClientHandlers?.requestSuccessCallback &&\n httpClientHandlers?.requestSuccessCallback(data.data ? JSON.parse(data.data) : null);\n break;\n }\n };\n\n const message: Message<AuthClientConfig<WebWorkerClientConfig>> = {\n data: config,\n instanceId,\n type: INIT,\n };\n\n return communicate<AuthClientConfig<WebWorkerClientConfig>, null>(message)\n .then(() => {\n return Promise.resolve(true);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const setSessionState = (sessionState: string | null): Promise<void> => {\n const message: Message<string | null> = {\n data: sessionState,\n type: SET_SESSION_STATE,\n };\n\n return communicate<string | null, void>(message);\n };\n\n const startAutoRefreshToken = (): Promise<void> => {\n const message: Message<null> = {\n type: START_AUTO_REFRESH_TOKEN,\n };\n\n return communicate<null, void>(message);\n };\n\n const checkSession = async (): Promise<void> => {\n const oidcEndpoints: OIDCEndpoints = await getOpenIDProviderEndpoints();\n const config: AuthClientConfig<WebWorkerClientConfig> = await getConfigData();\n\n _authenticationHelper.initializeSessionManger(\n config,\n oidcEndpoints,\n async () => (await _authenticationClient.getUserSession()).sessionState,\n async (params?: ExtendedAuthorizeRequestUrlParams): Promise<string> =>\n (await getSignInUrl(params)).authorizationURL,\n _sessionManagementHelper,\n );\n };\n\n const constructSilentSignInUrl = async (additionalParams: Record<string, string | boolean> = {}): Promise<string> => {\n const config: AuthClientConfig<WebWorkerClientConfig> = await getConfigData();\n const message: Message<ExtendedAuthorizeRequestUrlParams> = {\n data: {\n prompt: 'none',\n state: SILENT_SIGN_IN_STATE,\n ...additionalParams,\n },\n type: GET_AUTH_URL,\n };\n\n const response: AuthorizationResponse = await communicate<ExtendedAuthorizeRequestUrlParams, AuthorizationResponse>(\n message,\n );\n\n const pkceKey: string = extractPkceStorageKeyFromState(\n new URL(response.authorizationURL).searchParams.get(OIDCRequestConstants.Params.STATE) ?? '',\n );\n\n response.pkce && config.enablePKCE && SPAUtils.setPKCE(pkceKey, response.pkce);\n\n const urlString: string = response.authorizationURL;\n\n // Replace form_post with query\n const urlObject = new URL(urlString);\n urlObject.searchParams.set('response_mode', 'query');\n const url: string = urlObject.toString();\n\n return url;\n };\n\n /**\n * This method checks if there is an active user session in the server by sending a prompt none request.\n * If the user is signed in, this method sends a token request. Returns false otherwise.\n *\n * @return {Promise<User|boolean} Returns a Promise that resolves with the User\n * if the user is signed in or with `false` if there is no active user session in the server.\n */\n const signInSilently = async (\n additionalParams?: Record<string, string | boolean>,\n tokenRequestConfig?: {params: Record<string, unknown>},\n ): Promise<User | boolean> => {\n return await _authenticationHelper.signInSilently(\n constructSilentSignInUrl,\n requestAccessToken,\n _sessionManagementHelper,\n additionalParams,\n tokenRequestConfig,\n );\n };\n\n /**\n * Generates an authorization URL.\n *\n * @param {ExtendedAuthorizeRequestUrlParams} params Authorization URL params.\n * @returns {Promise<string>} Authorization URL.\n */\n const getSignInUrl = async (params?: ExtendedAuthorizeRequestUrlParams): Promise<AuthorizationResponse> => {\n const config: AuthClientConfig<WebWorkerClientConfig> = await getConfigData();\n\n const message: Message<ExtendedAuthorizeRequestUrlParams> = {\n data: params,\n type: GET_AUTH_URL,\n };\n\n return communicate<ExtendedAuthorizeRequestUrlParams, AuthorizationResponse>(message)\n .then(async (response: AuthorizationResponse) => {\n if (response.pkce && config.enablePKCE) {\n const pkceKey: string = extractPkceStorageKeyFromState(\n new URL(response.authorizationURL).searchParams.get(OIDCRequestConstants.Params.STATE) ?? '',\n );\n\n SPAUtils.setPKCE(pkceKey, response.pkce);\n }\n\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const requestAccessToken = async (\n resolvedAuthorizationCode: string,\n resolvedSessionState: string,\n resolvedState: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User> => {\n const config: AuthClientConfig<WebWorkerClientConfig> = await getConfigData();\n const pkceKey: string = extractPkceStorageKeyFromState(resolvedState);\n\n const message: Message<AuthorizationInfo> = {\n data: {\n code: resolvedAuthorizationCode,\n pkce: config.enablePKCE ? SPAUtils.getPKCE(pkceKey) : undefined,\n sessionState: resolvedSessionState,\n state: resolvedState,\n tokenRequestConfig,\n },\n type: REQUEST_ACCESS_TOKEN,\n };\n\n config.enablePKCE && SPAUtils.removePKCE(pkceKey);\n\n return communicate<AuthorizationInfo, User>(message)\n .then((response) => {\n const message: Message<null> = {\n type: GET_SIGN_OUT_URL,\n };\n\n return communicate<null, string>(message)\n .then((url: string) => {\n SPAUtils.setSignOutURL(url, config.clientId, instanceId);\n\n // Enable OIDC Sessions Management only if it is set to true in the config.\n if (config.syncSession) {\n checkSession();\n }\n\n startAutoRefreshToken();\n\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const shouldStopAuthn = async (): Promise<boolean> => {\n return await _sessionManagementHelper.receivePromptNoneResponse(async (sessionState: string | null) => {\n return setSessionState(sessionState);\n });\n };\n\n const tryRetrievingUserInfo = async (): Promise<User | undefined> => {\n if (await isSignedIn()) {\n await startAutoRefreshToken();\n\n // Enable OIDC Sessions Management only if it is set to true in the config.\n if (config.syncSession) {\n checkSession();\n }\n\n return getUser();\n }\n\n return Promise.resolve(undefined);\n };\n\n /**\n * Initiates the authentication flow.\n *\n * @returns {Promise<UserInfo>} A promise that resolves when authentication is successful.\n */\n const signIn = async (\n params?: ExtendedAuthorizeRequestUrlParams,\n authorizationCode?: string,\n sessionState?: string,\n state?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User> => {\n const basicUserInfo = await _authenticationHelper.handleSignIn(\n shouldStopAuthn,\n checkSession,\n tryRetrievingUserInfo,\n );\n\n if (basicUserInfo) {\n return basicUserInfo;\n } else {\n let resolvedAuthorizationCode: string;\n let resolvedSessionState: string;\n let resolvedState: string;\n\n if (config?.responseMode === 'form_post' && authorizationCode) {\n resolvedAuthorizationCode = authorizationCode;\n resolvedSessionState = sessionState ?? '';\n resolvedState = state ?? '';\n } else {\n resolvedAuthorizationCode =\n new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.AUTHORIZATION_CODE) ?? '';\n resolvedSessionState =\n new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.SESSION_STATE) ?? '';\n resolvedState = new URL(window.location.href).searchParams.get(OIDCRequestConstants.Params.STATE) ?? '';\n\n SPAUtils.removeAuthorizationCode();\n }\n\n if (resolvedAuthorizationCode && resolvedState) {\n return requestAccessToken(resolvedAuthorizationCode, resolvedSessionState, resolvedState, tokenRequestConfig);\n }\n\n return getSignInUrl(params)\n .then(async (response: AuthorizationResponse) => {\n location.href = response.authorizationURL;\n\n await SPAUtils.waitTillPageRedirect();\n\n return Promise.resolve({\n allowedScopes: '',\n displayName: '',\n email: '',\n sessionState: '',\n sub: '',\n tenantDomain: '',\n username: '',\n });\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n }\n };\n\n /**\n * Initiates the sign out flow.\n *\n * @returns {Promise<boolean>} A promise that resolves when sign out is completed.\n */\n const signOut = (): Promise<boolean> => {\n return new Promise((resolve, reject) => {\n if (!_getSignOutURLFromSessionStorage) {\n const message: Message<null> = {\n type: SIGN_OUT,\n };\n\n return communicate<null, string>(message)\n .then(async (response) => {\n window.location.href = response;\n\n await SPAUtils.waitTillPageRedirect();\n\n return resolve(true);\n })\n .catch((error) => {\n return reject(error);\n });\n } else {\n window.location.href = SPAUtils.getSignOutUrl(config.clientId, instanceId);\n\n return SPAUtils.waitTillPageRedirect().then(() => {\n return Promise.resolve(true);\n });\n }\n });\n };\n\n /**\n * Revokes token.\n *\n * @returns {Promise<boolean>} A promise that resolves when revoking is completed.\n */\n const revokeAccessToken = (): Promise<boolean> => {\n const message: Message<null> = {\n type: REVOKE_ACCESS_TOKEN,\n };\n\n return communicate<null, boolean>(message)\n .then((response) => {\n _sessionManagementHelper.reset();\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getOpenIDProviderEndpoints = (): Promise<OIDCEndpoints> => {\n const message: Message<null> = {\n type: GET_OIDC_SERVICE_ENDPOINTS,\n };\n\n return communicate<null, OIDCEndpoints>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getConfigData = (): Promise<AuthClientConfig<WebWorkerClientConfig>> => {\n const message: Message<null> = {\n type: GET_CONFIG_DATA,\n };\n\n return communicate<null, AuthClientConfig<WebWorkerClientConfig>>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getUser = (): Promise<User> => {\n const message: Message<null> = {\n type: GET_BASIC_USER_INFO,\n };\n\n return communicate<null, User>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getDecodedIdToken = (sessionId?: string): Promise<IdToken> => {\n const message: Message<null> = {\n type: GET_DECODED_ID_TOKEN,\n };\n\n return communicate<null, IdToken>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getDecodedIDPIDToken = (): Promise<IdToken> => {\n const message: Message<null> = {\n type: GET_DECODED_IDP_ID_TOKEN,\n };\n\n return communicate<null, IdToken>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getCrypto = (): Promise<IsomorphicCrypto> => {\n const message: Message<null> = {\n type: GET_CRYPTO_HELPER,\n };\n\n return communicate<null, IsomorphicCrypto>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const getIdToken = (): Promise<string> => {\n const message: Message<null> = {\n type: GET_ID_TOKEN,\n };\n\n return communicate<null, string>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const isSignedIn = (): Promise<boolean> => {\n const message: Message<null> = {\n type: IS_AUTHENTICATED,\n };\n\n return communicate<null, boolean>(message)\n .then((response) => {\n return Promise.resolve(response);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n };\n\n const refreshAccessToken = (): Promise<User> => {\n const message: Message<null> = {\n type: REFRESH_ACCESS_TOKEN,\n };\n\n return communicate<null, User>(message);\n };\n\n const setHttpRequestSuccessCallback = (callback: (response: HttpResponse) => void): void => {\n if (callback && typeof callback === 'function') {\n httpClientHandlers.requestSuccessCallback = callback;\n }\n };\n\n const setHttpRequestErrorCallback = (callback: (response: HttpError) => void | Promise<void>): void => {\n if (callback && typeof callback === 'function') {\n httpClientHandlers.requestErrorCallback = callback;\n }\n };\n\n const setHttpRequestStartCallback = (callback: () => void): void => {\n if (callback && typeof callback === 'function') {\n httpClientHandlers.requestStartCallback = callback;\n }\n };\n\n const setHttpRequestFinishCallback = (callback: () => void): void => {\n if (callback && typeof callback === 'function') {\n httpClientHandlers.requestFinishCallback = callback;\n }\n };\n\n const reInitialize = async (newConfig: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void> => {\n const existingConfig = await getConfigData();\n const isCheckSessionIframeDifferent = !(\n existingConfig &&\n existingConfig.endpoints &&\n existingConfig.endpoints.checkSessionIframe &&\n newConfig &&\n newConfig.endpoints &&\n newConfig.endpoints.checkSessionIframe &&\n existingConfig.endpoints.checkSessionIframe === newConfig.endpoints.checkSessionIframe\n );\n const config = {...existingConfig, ...newConfig};\n\n const message: Message<Partial<AuthClientConfig<WebWorkerClientConfig>>> = {\n data: config,\n type: UPDATE_CONFIG,\n };\n\n await communicate<Partial<AuthClientConfig<WebWorkerClientConfig>>, void>(message);\n\n // Re-initiates check session if the check session endpoint is updated.\n if (config.syncSession && isCheckSessionIframeDifferent) {\n _sessionManagementHelper.reset();\n\n checkSession();\n }\n };\n\n const decodeJwtToken = async <T = Record<string, unknown>>(token: string): Promise<T> => {\n return _authenticationClient.decodeJwtToken<T>(token);\n };\n\n return {\n disableHttpHandler,\n enableHttpHandler,\n getUser,\n getConfigData,\n getCrypto,\n getDecodedIDPIDToken,\n getDecodedIdToken,\n getIdToken,\n getOpenIDProviderEndpoints,\n httpRequest,\n httpRequestAll,\n initialize,\n isSignedIn,\n refreshAccessToken,\n exchangeToken,\n revokeAccessToken,\n setHttpRequestErrorCallback,\n setHttpRequestFinishCallback,\n setHttpRequestStartCallback,\n setHttpRequestSuccessCallback,\n signIn,\n signOut,\n signInSilently,\n reInitialize,\n decodeJwtToken,\n };\n};\n","\n const blob = new Blob([\"(function() {\\n\\n//#region rolldown:runtime\\n\\tvar __create = Object.create;\\n\\tvar __defProp = Object.defineProperty;\\n\\tvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\\n\\tvar __getOwnPropNames = Object.getOwnPropertyNames;\\n\\tvar __getProtoOf = Object.getPrototypeOf;\\n\\tvar __hasOwnProp = Object.prototype.hasOwnProperty;\\n\\tvar __commonJS = (cb, mod) => function() {\\n\\t\\treturn mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\\n\\t};\\n\\tvar __copyProps = (to, from$1, except, desc) => {\\n\\t\\tif (from$1 && typeof from$1 === \\\"object\\\" || typeof from$1 === \\\"function\\\") for (var keys = __getOwnPropNames(from$1), i$1 = 0, n = keys.length, key; i$1 < n; i$1++) {\\n\\t\\t\\tkey = keys[i$1];\\n\\t\\t\\tif (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\\n\\t\\t\\t\\tget: ((k) => from$1[k]).bind(null, key),\\n\\t\\t\\t\\tenumerable: !(desc = __getOwnPropDesc(from$1, key)) || desc.enumerable\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\treturn to;\\n\\t};\\n\\tvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \\\"default\\\", {\\n\\t\\tvalue: mod,\\n\\t\\tenumerable: true\\n\\t}) : target, mod));\\n\\n//#endregion\\n\\n//#region ../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js\\n\\tvar require_base64_js = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js\\\": ((exports) => {\\n\\t\\texports.byteLength = byteLength$1;\\n\\t\\texports.toByteArray = toByteArray;\\n\\t\\texports.fromByteArray = fromByteArray;\\n\\t\\tvar lookup = [];\\n\\t\\tvar revLookup = [];\\n\\t\\tvar Arr = typeof Uint8Array !== \\\"undefined\\\" ? Uint8Array : Array;\\n\\t\\tvar code = \\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\\";\\n\\t\\tfor (var i = 0, len = code.length; i < len; ++i) {\\n\\t\\t\\tlookup[i] = code[i];\\n\\t\\t\\trevLookup[code.charCodeAt(i)] = i;\\n\\t\\t}\\n\\t\\trevLookup[\\\"-\\\".charCodeAt(0)] = 62;\\n\\t\\trevLookup[\\\"_\\\".charCodeAt(0)] = 63;\\n\\t\\tfunction getLens(b64) {\\n\\t\\t\\tvar len$1 = b64.length;\\n\\t\\t\\tif (len$1 % 4 > 0) throw new Error(\\\"Invalid string. Length must be a multiple of 4\\\");\\n\\t\\t\\tvar validLen = b64.indexOf(\\\"=\\\");\\n\\t\\t\\tif (validLen === -1) validLen = len$1;\\n\\t\\t\\tvar placeHoldersLen = validLen === len$1 ? 0 : 4 - validLen % 4;\\n\\t\\t\\treturn [validLen, placeHoldersLen];\\n\\t\\t}\\n\\t\\tfunction byteLength$1(b64) {\\n\\t\\t\\tvar lens = getLens(b64);\\n\\t\\t\\tvar validLen = lens[0];\\n\\t\\t\\tvar placeHoldersLen = lens[1];\\n\\t\\t\\treturn (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\\n\\t\\t}\\n\\t\\tfunction _byteLength(b64, validLen, placeHoldersLen) {\\n\\t\\t\\treturn (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;\\n\\t\\t}\\n\\t\\tfunction toByteArray(b64) {\\n\\t\\t\\tvar tmp;\\n\\t\\t\\tvar lens = getLens(b64);\\n\\t\\t\\tvar validLen = lens[0];\\n\\t\\t\\tvar placeHoldersLen = lens[1];\\n\\t\\t\\tvar arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\\n\\t\\t\\tvar curByte = 0;\\n\\t\\t\\tvar len$1 = placeHoldersLen > 0 ? validLen - 4 : validLen;\\n\\t\\t\\tvar i$1;\\n\\t\\t\\tfor (i$1 = 0; i$1 < len$1; i$1 += 4) {\\n\\t\\t\\t\\ttmp = revLookup[b64.charCodeAt(i$1)] << 18 | revLookup[b64.charCodeAt(i$1 + 1)] << 12 | revLookup[b64.charCodeAt(i$1 + 2)] << 6 | revLookup[b64.charCodeAt(i$1 + 3)];\\n\\t\\t\\t\\tarr[curByte++] = tmp >> 16 & 255;\\n\\t\\t\\t\\tarr[curByte++] = tmp >> 8 & 255;\\n\\t\\t\\t\\tarr[curByte++] = tmp & 255;\\n\\t\\t\\t}\\n\\t\\t\\tif (placeHoldersLen === 2) {\\n\\t\\t\\t\\ttmp = revLookup[b64.charCodeAt(i$1)] << 2 | revLookup[b64.charCodeAt(i$1 + 1)] >> 4;\\n\\t\\t\\t\\tarr[curByte++] = tmp & 255;\\n\\t\\t\\t}\\n\\t\\t\\tif (placeHoldersLen === 1) {\\n\\t\\t\\t\\ttmp = revLookup[b64.charCodeAt(i$1)] << 10 | revLookup[b64.charCodeAt(i$1 + 1)] << 4 | revLookup[b64.charCodeAt(i$1 + 2)] >> 2;\\n\\t\\t\\t\\tarr[curByte++] = tmp >> 8 & 255;\\n\\t\\t\\t\\tarr[curByte++] = tmp & 255;\\n\\t\\t\\t}\\n\\t\\t\\treturn arr;\\n\\t\\t}\\n\\t\\tfunction tripletToBase64(num) {\\n\\t\\t\\treturn lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];\\n\\t\\t}\\n\\t\\tfunction encodeChunk(uint8, start, end) {\\n\\t\\t\\tvar tmp;\\n\\t\\t\\tvar output = [];\\n\\t\\t\\tfor (var i$1 = start; i$1 < end; i$1 += 3) {\\n\\t\\t\\t\\ttmp = (uint8[i$1] << 16 & 16711680) + (uint8[i$1 + 1] << 8 & 65280) + (uint8[i$1 + 2] & 255);\\n\\t\\t\\t\\toutput.push(tripletToBase64(tmp));\\n\\t\\t\\t}\\n\\t\\t\\treturn output.join(\\\"\\\");\\n\\t\\t}\\n\\t\\tfunction fromByteArray(uint8) {\\n\\t\\t\\tvar tmp;\\n\\t\\t\\tvar len$1 = uint8.length;\\n\\t\\t\\tvar extraBytes = len$1 % 3;\\n\\t\\t\\tvar parts = [];\\n\\t\\t\\tvar maxChunkLength = 16383;\\n\\t\\t\\tfor (var i$1 = 0, len2 = len$1 - extraBytes; i$1 < len2; i$1 += maxChunkLength) parts.push(encodeChunk(uint8, i$1, i$1 + maxChunkLength > len2 ? len2 : i$1 + maxChunkLength));\\n\\t\\t\\tif (extraBytes === 1) {\\n\\t\\t\\t\\ttmp = uint8[len$1 - 1];\\n\\t\\t\\t\\tparts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + \\\"==\\\");\\n\\t\\t\\t} else if (extraBytes === 2) {\\n\\t\\t\\t\\ttmp = (uint8[len$1 - 2] << 8) + uint8[len$1 - 1];\\n\\t\\t\\t\\tparts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + \\\"=\\\");\\n\\t\\t\\t}\\n\\t\\t\\treturn parts.join(\\\"\\\");\\n\\t\\t}\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js\\n\\tvar require_ieee754 = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js\\\": ((exports) => {\\n\\t\\t/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\\n\\t\\texports.read = function(buffer$1, offset, isLE, mLen, nBytes) {\\n\\t\\t\\tvar e, m;\\n\\t\\t\\tvar eLen = nBytes * 8 - mLen - 1;\\n\\t\\t\\tvar eMax = (1 << eLen) - 1;\\n\\t\\t\\tvar eBias = eMax >> 1;\\n\\t\\t\\tvar nBits = -7;\\n\\t\\t\\tvar i$1 = isLE ? nBytes - 1 : 0;\\n\\t\\t\\tvar d = isLE ? -1 : 1;\\n\\t\\t\\tvar s = buffer$1[offset + i$1];\\n\\t\\t\\ti$1 += d;\\n\\t\\t\\te = s & (1 << -nBits) - 1;\\n\\t\\t\\ts >>= -nBits;\\n\\t\\t\\tnBits += eLen;\\n\\t\\t\\tfor (; nBits > 0; e = e * 256 + buffer$1[offset + i$1], i$1 += d, nBits -= 8);\\n\\t\\t\\tm = e & (1 << -nBits) - 1;\\n\\t\\t\\te >>= -nBits;\\n\\t\\t\\tnBits += mLen;\\n\\t\\t\\tfor (; nBits > 0; m = m * 256 + buffer$1[offset + i$1], i$1 += d, nBits -= 8);\\n\\t\\t\\tif (e === 0) e = 1 - eBias;\\n\\t\\t\\telse if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity;\\n\\t\\t\\telse {\\n\\t\\t\\t\\tm = m + Math.pow(2, mLen);\\n\\t\\t\\t\\te = e - eBias;\\n\\t\\t\\t}\\n\\t\\t\\treturn (s ? -1 : 1) * m * Math.pow(2, e - mLen);\\n\\t\\t};\\n\\t\\texports.write = function(buffer$1, value, offset, isLE, mLen, nBytes) {\\n\\t\\t\\tvar e, m, c;\\n\\t\\t\\tvar eLen = nBytes * 8 - mLen - 1;\\n\\t\\t\\tvar eMax = (1 << eLen) - 1;\\n\\t\\t\\tvar eBias = eMax >> 1;\\n\\t\\t\\tvar rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;\\n\\t\\t\\tvar i$1 = isLE ? 0 : nBytes - 1;\\n\\t\\t\\tvar d = isLE ? 1 : -1;\\n\\t\\t\\tvar s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;\\n\\t\\t\\tvalue = Math.abs(value);\\n\\t\\t\\tif (isNaN(value) || value === Infinity) {\\n\\t\\t\\t\\tm = isNaN(value) ? 1 : 0;\\n\\t\\t\\t\\te = eMax;\\n\\t\\t\\t} else {\\n\\t\\t\\t\\te = Math.floor(Math.log(value) / Math.LN2);\\n\\t\\t\\t\\tif (value * (c = Math.pow(2, -e)) < 1) {\\n\\t\\t\\t\\t\\te--;\\n\\t\\t\\t\\t\\tc *= 2;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (e + eBias >= 1) value += rt / c;\\n\\t\\t\\t\\telse value += rt * Math.pow(2, 1 - eBias);\\n\\t\\t\\t\\tif (value * c >= 2) {\\n\\t\\t\\t\\t\\te++;\\n\\t\\t\\t\\t\\tc /= 2;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (e + eBias >= eMax) {\\n\\t\\t\\t\\t\\tm = 0;\\n\\t\\t\\t\\t\\te = eMax;\\n\\t\\t\\t\\t} else if (e + eBias >= 1) {\\n\\t\\t\\t\\t\\tm = (value * c - 1) * Math.pow(2, mLen);\\n\\t\\t\\t\\t\\te = e + eBias;\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tm = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\\n\\t\\t\\t\\t\\te = 0;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tfor (; mLen >= 8; buffer$1[offset + i$1] = m & 255, i$1 += d, m /= 256, mLen -= 8);\\n\\t\\t\\te = e << mLen | m;\\n\\t\\t\\teLen += mLen;\\n\\t\\t\\tfor (; eLen > 0; buffer$1[offset + i$1] = e & 255, i$1 += d, e /= 256, eLen -= 8);\\n\\t\\t\\tbuffer$1[offset + i$1 - d] |= s * 128;\\n\\t\\t};\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\\n\\tvar require_buffer = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js\\\": ((exports) => {\\n\\t\\tconst base64 = require_base64_js();\\n\\t\\tconst ieee754 = require_ieee754();\\n\\t\\tconst customInspectSymbol = typeof Symbol === \\\"function\\\" && typeof Symbol[\\\"for\\\"] === \\\"function\\\" ? Symbol[\\\"for\\\"](\\\"nodejs.util.inspect.custom\\\") : null;\\n\\t\\texports.Buffer = Buffer$5;\\n\\t\\texports.SlowBuffer = SlowBuffer;\\n\\t\\texports.INSPECT_MAX_BYTES = 50;\\n\\t\\tconst K_MAX_LENGTH = 2147483647;\\n\\t\\texports.kMaxLength = K_MAX_LENGTH;\\n\\t\\t/**\\n\\t\\t* If `Buffer.TYPED_ARRAY_SUPPORT`:\\n\\t\\t* === true Use Uint8Array implementation (fastest)\\n\\t\\t* === false Print warning and recommend using `buffer` v4.x which has an Object\\n\\t\\t* implementation (most compatible, even IE6)\\n\\t\\t*\\n\\t\\t* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\\n\\t\\t* Opera 11.6+, iOS 4.2+.\\n\\t\\t*\\n\\t\\t* We report that the browser does not support typed arrays if the are not subclassable\\n\\t\\t* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\\n\\t\\t* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\\n\\t\\t* for __proto__ and has a buggy typed array implementation.\\n\\t\\t*/\\n\\t\\tBuffer$5.TYPED_ARRAY_SUPPORT = typedArraySupport();\\n\\t\\tif (!Buffer$5.TYPED_ARRAY_SUPPORT && typeof console !== \\\"undefined\\\" && typeof console.error === \\\"function\\\") console.error(\\\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\\\");\\n\\t\\tfunction typedArraySupport() {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst arr = new Uint8Array(1);\\n\\t\\t\\t\\tconst proto = { foo: function() {\\n\\t\\t\\t\\t\\treturn 42;\\n\\t\\t\\t\\t} };\\n\\t\\t\\t\\tObject.setPrototypeOf(proto, Uint8Array.prototype);\\n\\t\\t\\t\\tObject.setPrototypeOf(arr, proto);\\n\\t\\t\\t\\treturn arr.foo() === 42;\\n\\t\\t\\t} catch (e) {\\n\\t\\t\\t\\treturn false;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tObject.defineProperty(Buffer$5.prototype, \\\"parent\\\", {\\n\\t\\t\\tenumerable: true,\\n\\t\\t\\tget: function() {\\n\\t\\t\\t\\tif (!Buffer$5.isBuffer(this)) return void 0;\\n\\t\\t\\t\\treturn this.buffer;\\n\\t\\t\\t}\\n\\t\\t});\\n\\t\\tObject.defineProperty(Buffer$5.prototype, \\\"offset\\\", {\\n\\t\\t\\tenumerable: true,\\n\\t\\t\\tget: function() {\\n\\t\\t\\t\\tif (!Buffer$5.isBuffer(this)) return void 0;\\n\\t\\t\\t\\treturn this.byteOffset;\\n\\t\\t\\t}\\n\\t\\t});\\n\\t\\tfunction createBuffer(length) {\\n\\t\\t\\tif (length > K_MAX_LENGTH) throw new RangeError(\\\"The value \\\\\\\"\\\" + length + \\\"\\\\\\\" is invalid for option \\\\\\\"size\\\\\\\"\\\");\\n\\t\\t\\tconst buf = new Uint8Array(length);\\n\\t\\t\\tObject.setPrototypeOf(buf, Buffer$5.prototype);\\n\\t\\t\\treturn buf;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* The Buffer constructor returns instances of `Uint8Array` that have their\\n\\t\\t* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\\n\\t\\t* `Uint8Array`, so the returned instances will have all the node `Buffer` methods\\n\\t\\t* and the `Uint8Array` methods. Square bracket notation works as expected -- it\\n\\t\\t* returns a single octet.\\n\\t\\t*\\n\\t\\t* The `Uint8Array` prototype remains unmodified.\\n\\t\\t*/\\n\\t\\tfunction Buffer$5(arg, encodingOrOffset, length) {\\n\\t\\t\\tif (typeof arg === \\\"number\\\") {\\n\\t\\t\\t\\tif (typeof encodingOrOffset === \\\"string\\\") throw new TypeError(\\\"The \\\\\\\"string\\\\\\\" argument must be of type string. Received type number\\\");\\n\\t\\t\\t\\treturn allocUnsafe(arg);\\n\\t\\t\\t}\\n\\t\\t\\treturn from(arg, encodingOrOffset, length);\\n\\t\\t}\\n\\t\\tBuffer$5.poolSize = 8192;\\n\\t\\tfunction from(value, encodingOrOffset, length) {\\n\\t\\t\\tif (typeof value === \\\"string\\\") return fromString(value, encodingOrOffset);\\n\\t\\t\\tif (ArrayBuffer.isView(value)) return fromArrayView(value);\\n\\t\\t\\tif (value == null) throw new TypeError(\\\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \\\" + typeof value);\\n\\t\\t\\tif (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length);\\n\\t\\t\\tif (typeof SharedArrayBuffer !== \\\"undefined\\\" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length);\\n\\t\\t\\tif (typeof value === \\\"number\\\") throw new TypeError(\\\"The \\\\\\\"value\\\\\\\" argument must not be of type number. Received type number\\\");\\n\\t\\t\\tconst valueOf = value.valueOf && value.valueOf();\\n\\t\\t\\tif (valueOf != null && valueOf !== value) return Buffer$5.from(valueOf, encodingOrOffset, length);\\n\\t\\t\\tconst b = fromObject(value);\\n\\t\\t\\tif (b) return b;\\n\\t\\t\\tif (typeof Symbol !== \\\"undefined\\\" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === \\\"function\\\") return Buffer$5.from(value[Symbol.toPrimitive](\\\"string\\\"), encodingOrOffset, length);\\n\\t\\t\\tthrow new TypeError(\\\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \\\" + typeof value);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\\n\\t\\t* if value is a number.\\n\\t\\t* Buffer.from(str[, encoding])\\n\\t\\t* Buffer.from(array)\\n\\t\\t* Buffer.from(buffer)\\n\\t\\t* Buffer.from(arrayBuffer[, byteOffset[, length]])\\n\\t\\t**/\\n\\t\\tBuffer$5.from = function(value, encodingOrOffset, length) {\\n\\t\\t\\treturn from(value, encodingOrOffset, length);\\n\\t\\t};\\n\\t\\tObject.setPrototypeOf(Buffer$5.prototype, Uint8Array.prototype);\\n\\t\\tObject.setPrototypeOf(Buffer$5, Uint8Array);\\n\\t\\tfunction assertSize(size) {\\n\\t\\t\\tif (typeof size !== \\\"number\\\") throw new TypeError(\\\"\\\\\\\"size\\\\\\\" argument must be of type number\\\");\\n\\t\\t\\telse if (size < 0) throw new RangeError(\\\"The value \\\\\\\"\\\" + size + \\\"\\\\\\\" is invalid for option \\\\\\\"size\\\\\\\"\\\");\\n\\t\\t}\\n\\t\\tfunction alloc(size, fill, encoding) {\\n\\t\\t\\tassertSize(size);\\n\\t\\t\\tif (size <= 0) return createBuffer(size);\\n\\t\\t\\tif (fill !== void 0) return typeof encoding === \\\"string\\\" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);\\n\\t\\t\\treturn createBuffer(size);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Creates a new filled Buffer instance.\\n\\t\\t* alloc(size[, fill[, encoding]])\\n\\t\\t**/\\n\\t\\tBuffer$5.alloc = function(size, fill, encoding) {\\n\\t\\t\\treturn alloc(size, fill, encoding);\\n\\t\\t};\\n\\t\\tfunction allocUnsafe(size) {\\n\\t\\t\\tassertSize(size);\\n\\t\\t\\treturn createBuffer(size < 0 ? 0 : checked(size) | 0);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\\n\\t\\t* */\\n\\t\\tBuffer$5.allocUnsafe = function(size) {\\n\\t\\t\\treturn allocUnsafe(size);\\n\\t\\t};\\n\\t\\t/**\\n\\t\\t* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\\n\\t\\t*/\\n\\t\\tBuffer$5.allocUnsafeSlow = function(size) {\\n\\t\\t\\treturn allocUnsafe(size);\\n\\t\\t};\\n\\t\\tfunction fromString(string, encoding) {\\n\\t\\t\\tif (typeof encoding !== \\\"string\\\" || encoding === \\\"\\\") encoding = \\\"utf8\\\";\\n\\t\\t\\tif (!Buffer$5.isEncoding(encoding)) throw new TypeError(\\\"Unknown encoding: \\\" + encoding);\\n\\t\\t\\tconst length = byteLength(string, encoding) | 0;\\n\\t\\t\\tlet buf = createBuffer(length);\\n\\t\\t\\tconst actual = buf.write(string, encoding);\\n\\t\\t\\tif (actual !== length) buf = buf.slice(0, actual);\\n\\t\\t\\treturn buf;\\n\\t\\t}\\n\\t\\tfunction fromArrayLike(array) {\\n\\t\\t\\tconst length = array.length < 0 ? 0 : checked(array.length) | 0;\\n\\t\\t\\tconst buf = createBuffer(length);\\n\\t\\t\\tfor (let i$1 = 0; i$1 < length; i$1 += 1) buf[i$1] = array[i$1] & 255;\\n\\t\\t\\treturn buf;\\n\\t\\t}\\n\\t\\tfunction fromArrayView(arrayView) {\\n\\t\\t\\tif (isInstance(arrayView, Uint8Array)) {\\n\\t\\t\\t\\tconst copy = new Uint8Array(arrayView);\\n\\t\\t\\t\\treturn fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);\\n\\t\\t\\t}\\n\\t\\t\\treturn fromArrayLike(arrayView);\\n\\t\\t}\\n\\t\\tfunction fromArrayBuffer(array, byteOffset, length) {\\n\\t\\t\\tif (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError(\\\"\\\\\\\"offset\\\\\\\" is outside of buffer bounds\\\");\\n\\t\\t\\tif (array.byteLength < byteOffset + (length || 0)) throw new RangeError(\\\"\\\\\\\"length\\\\\\\" is outside of buffer bounds\\\");\\n\\t\\t\\tlet buf;\\n\\t\\t\\tif (byteOffset === void 0 && length === void 0) buf = new Uint8Array(array);\\n\\t\\t\\telse if (length === void 0) buf = new Uint8Array(array, byteOffset);\\n\\t\\t\\telse buf = new Uint8Array(array, byteOffset, length);\\n\\t\\t\\tObject.setPrototypeOf(buf, Buffer$5.prototype);\\n\\t\\t\\treturn buf;\\n\\t\\t}\\n\\t\\tfunction fromObject(obj) {\\n\\t\\t\\tif (Buffer$5.isBuffer(obj)) {\\n\\t\\t\\t\\tconst len$1 = checked(obj.length) | 0;\\n\\t\\t\\t\\tconst buf = createBuffer(len$1);\\n\\t\\t\\t\\tif (buf.length === 0) return buf;\\n\\t\\t\\t\\tobj.copy(buf, 0, 0, len$1);\\n\\t\\t\\t\\treturn buf;\\n\\t\\t\\t}\\n\\t\\t\\tif (obj.length !== void 0) {\\n\\t\\t\\t\\tif (typeof obj.length !== \\\"number\\\" || numberIsNaN(obj.length)) return createBuffer(0);\\n\\t\\t\\t\\treturn fromArrayLike(obj);\\n\\t\\t\\t}\\n\\t\\t\\tif (obj.type === \\\"Buffer\\\" && Array.isArray(obj.data)) return fromArrayLike(obj.data);\\n\\t\\t}\\n\\t\\tfunction checked(length) {\\n\\t\\t\\tif (length >= K_MAX_LENGTH) throw new RangeError(\\\"Attempt to allocate Buffer larger than maximum size: 0x\\\" + K_MAX_LENGTH.toString(16) + \\\" bytes\\\");\\n\\t\\t\\treturn length | 0;\\n\\t\\t}\\n\\t\\tfunction SlowBuffer(length) {\\n\\t\\t\\tif (+length != length) length = 0;\\n\\t\\t\\treturn Buffer$5.alloc(+length);\\n\\t\\t}\\n\\t\\tBuffer$5.isBuffer = function isBuffer(b) {\\n\\t\\t\\treturn b != null && b._isBuffer === true && b !== Buffer$5.prototype;\\n\\t\\t};\\n\\t\\tBuffer$5.compare = function compare(a, b) {\\n\\t\\t\\tif (isInstance(a, Uint8Array)) a = Buffer$5.from(a, a.offset, a.byteLength);\\n\\t\\t\\tif (isInstance(b, Uint8Array)) b = Buffer$5.from(b, b.offset, b.byteLength);\\n\\t\\t\\tif (!Buffer$5.isBuffer(a) || !Buffer$5.isBuffer(b)) throw new TypeError(\\\"The \\\\\\\"buf1\\\\\\\", \\\\\\\"buf2\\\\\\\" arguments must be one of type Buffer or Uint8Array\\\");\\n\\t\\t\\tif (a === b) return 0;\\n\\t\\t\\tlet x = a.length;\\n\\t\\t\\tlet y = b.length;\\n\\t\\t\\tfor (let i$1 = 0, len$1 = Math.min(x, y); i$1 < len$1; ++i$1) if (a[i$1] !== b[i$1]) {\\n\\t\\t\\t\\tx = a[i$1];\\n\\t\\t\\t\\ty = b[i$1];\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tif (x < y) return -1;\\n\\t\\t\\tif (y < x) return 1;\\n\\t\\t\\treturn 0;\\n\\t\\t};\\n\\t\\tBuffer$5.isEncoding = function isEncoding(encoding) {\\n\\t\\t\\tswitch (String(encoding).toLowerCase()) {\\n\\t\\t\\t\\tcase \\\"hex\\\":\\n\\t\\t\\t\\tcase \\\"utf8\\\":\\n\\t\\t\\t\\tcase \\\"utf-8\\\":\\n\\t\\t\\t\\tcase \\\"ascii\\\":\\n\\t\\t\\t\\tcase \\\"latin1\\\":\\n\\t\\t\\t\\tcase \\\"binary\\\":\\n\\t\\t\\t\\tcase \\\"base64\\\":\\n\\t\\t\\t\\tcase \\\"ucs2\\\":\\n\\t\\t\\t\\tcase \\\"ucs-2\\\":\\n\\t\\t\\t\\tcase \\\"utf16le\\\":\\n\\t\\t\\t\\tcase \\\"utf-16le\\\": return true;\\n\\t\\t\\t\\tdefault: return false;\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\tBuffer$5.concat = function concat$1(list, length) {\\n\\t\\t\\tif (!Array.isArray(list)) throw new TypeError(\\\"\\\\\\\"list\\\\\\\" argument must be an Array of Buffers\\\");\\n\\t\\t\\tif (list.length === 0) return Buffer$5.alloc(0);\\n\\t\\t\\tlet i$1;\\n\\t\\t\\tif (length === void 0) {\\n\\t\\t\\t\\tlength = 0;\\n\\t\\t\\t\\tfor (i$1 = 0; i$1 < list.length; ++i$1) length += list[i$1].length;\\n\\t\\t\\t}\\n\\t\\t\\tconst buffer$1 = Buffer$5.allocUnsafe(length);\\n\\t\\t\\tlet pos = 0;\\n\\t\\t\\tfor (i$1 = 0; i$1 < list.length; ++i$1) {\\n\\t\\t\\t\\tlet buf = list[i$1];\\n\\t\\t\\t\\tif (isInstance(buf, Uint8Array)) if (pos + buf.length > buffer$1.length) {\\n\\t\\t\\t\\t\\tif (!Buffer$5.isBuffer(buf)) buf = Buffer$5.from(buf);\\n\\t\\t\\t\\t\\tbuf.copy(buffer$1, pos);\\n\\t\\t\\t\\t} else Uint8Array.prototype.set.call(buffer$1, buf, pos);\\n\\t\\t\\t\\telse if (!Buffer$5.isBuffer(buf)) throw new TypeError(\\\"\\\\\\\"list\\\\\\\" argument must be an Array of Buffers\\\");\\n\\t\\t\\t\\telse buf.copy(buffer$1, pos);\\n\\t\\t\\t\\tpos += buf.length;\\n\\t\\t\\t}\\n\\t\\t\\treturn buffer$1;\\n\\t\\t};\\n\\t\\tfunction byteLength(string, encoding) {\\n\\t\\t\\tif (Buffer$5.isBuffer(string)) return string.length;\\n\\t\\t\\tif (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength;\\n\\t\\t\\tif (typeof string !== \\\"string\\\") throw new TypeError(\\\"The \\\\\\\"string\\\\\\\" argument must be one of type string, Buffer, or ArrayBuffer. Received type \\\" + typeof string);\\n\\t\\t\\tconst len$1 = string.length;\\n\\t\\t\\tconst mustMatch = arguments.length > 2 && arguments[2] === true;\\n\\t\\t\\tif (!mustMatch && len$1 === 0) return 0;\\n\\t\\t\\tlet loweredCase = false;\\n\\t\\t\\tfor (;;) switch (encoding) {\\n\\t\\t\\t\\tcase \\\"ascii\\\":\\n\\t\\t\\t\\tcase \\\"latin1\\\":\\n\\t\\t\\t\\tcase \\\"binary\\\": return len$1;\\n\\t\\t\\t\\tcase \\\"utf8\\\":\\n\\t\\t\\t\\tcase \\\"utf-8\\\": return utf8ToBytes(string).length;\\n\\t\\t\\t\\tcase \\\"ucs2\\\":\\n\\t\\t\\t\\tcase \\\"ucs-2\\\":\\n\\t\\t\\t\\tcase \\\"utf16le\\\":\\n\\t\\t\\t\\tcase \\\"utf-16le\\\": return len$1 * 2;\\n\\t\\t\\t\\tcase \\\"hex\\\": return len$1 >>> 1;\\n\\t\\t\\t\\tcase \\\"base64\\\": return base64ToBytes(string).length;\\n\\t\\t\\t\\tdefault:\\n\\t\\t\\t\\t\\tif (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length;\\n\\t\\t\\t\\t\\tencoding = (\\\"\\\" + encoding).toLowerCase();\\n\\t\\t\\t\\t\\tloweredCase = true;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tBuffer$5.byteLength = byteLength;\\n\\t\\tfunction slowToString(encoding, start, end) {\\n\\t\\t\\tlet loweredCase = false;\\n\\t\\t\\tif (start === void 0 || start < 0) start = 0;\\n\\t\\t\\tif (start > this.length) return \\\"\\\";\\n\\t\\t\\tif (end === void 0 || end > this.length) end = this.length;\\n\\t\\t\\tif (end <= 0) return \\\"\\\";\\n\\t\\t\\tend >>>= 0;\\n\\t\\t\\tstart >>>= 0;\\n\\t\\t\\tif (end <= start) return \\\"\\\";\\n\\t\\t\\tif (!encoding) encoding = \\\"utf8\\\";\\n\\t\\t\\twhile (true) switch (encoding) {\\n\\t\\t\\t\\tcase \\\"hex\\\": return hexSlice(this, start, end);\\n\\t\\t\\t\\tcase \\\"utf8\\\":\\n\\t\\t\\t\\tcase \\\"utf-8\\\": return utf8Slice(this, start, end);\\n\\t\\t\\t\\tcase \\\"ascii\\\": return asciiSlice(this, start, end);\\n\\t\\t\\t\\tcase \\\"latin1\\\":\\n\\t\\t\\t\\tcase \\\"binary\\\": return latin1Slice(this, start, end);\\n\\t\\t\\t\\tcase \\\"base64\\\": return base64Slice(this, start, end);\\n\\t\\t\\t\\tcase \\\"ucs2\\\":\\n\\t\\t\\t\\tcase \\\"ucs-2\\\":\\n\\t\\t\\t\\tcase \\\"utf16le\\\":\\n\\t\\t\\t\\tcase \\\"utf-16le\\\": return utf16leSlice(this, start, end);\\n\\t\\t\\t\\tdefault:\\n\\t\\t\\t\\t\\tif (loweredCase) throw new TypeError(\\\"Unknown encoding: \\\" + encoding);\\n\\t\\t\\t\\t\\tencoding = (encoding + \\\"\\\").toLowerCase();\\n\\t\\t\\t\\t\\tloweredCase = true;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tBuffer$5.prototype._isBuffer = true;\\n\\t\\tfunction swap(b, n, m) {\\n\\t\\t\\tconst i$1 = b[n];\\n\\t\\t\\tb[n] = b[m];\\n\\t\\t\\tb[m] = i$1;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.swap16 = function swap16() {\\n\\t\\t\\tconst len$1 = this.length;\\n\\t\\t\\tif (len$1 % 2 !== 0) throw new RangeError(\\\"Buffer size must be a multiple of 16-bits\\\");\\n\\t\\t\\tfor (let i$1 = 0; i$1 < len$1; i$1 += 2) swap(this, i$1, i$1 + 1);\\n\\t\\t\\treturn this;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.swap32 = function swap32() {\\n\\t\\t\\tconst len$1 = this.length;\\n\\t\\t\\tif (len$1 % 4 !== 0) throw new RangeError(\\\"Buffer size must be a multiple of 32-bits\\\");\\n\\t\\t\\tfor (let i$1 = 0; i$1 < len$1; i$1 += 4) {\\n\\t\\t\\t\\tswap(this, i$1, i$1 + 3);\\n\\t\\t\\t\\tswap(this, i$1 + 1, i$1 + 2);\\n\\t\\t\\t}\\n\\t\\t\\treturn this;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.swap64 = function swap64() {\\n\\t\\t\\tconst len$1 = this.length;\\n\\t\\t\\tif (len$1 % 8 !== 0) throw new RangeError(\\\"Buffer size must be a multiple of 64-bits\\\");\\n\\t\\t\\tfor (let i$1 = 0; i$1 < len$1; i$1 += 8) {\\n\\t\\t\\t\\tswap(this, i$1, i$1 + 7);\\n\\t\\t\\t\\tswap(this, i$1 + 1, i$1 + 6);\\n\\t\\t\\t\\tswap(this, i$1 + 2, i$1 + 5);\\n\\t\\t\\t\\tswap(this, i$1 + 3, i$1 + 4);\\n\\t\\t\\t}\\n\\t\\t\\treturn this;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.toString = function toString() {\\n\\t\\t\\tconst length = this.length;\\n\\t\\t\\tif (length === 0) return \\\"\\\";\\n\\t\\t\\tif (arguments.length === 0) return utf8Slice(this, 0, length);\\n\\t\\t\\treturn slowToString.apply(this, arguments);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.toLocaleString = Buffer$5.prototype.toString;\\n\\t\\tBuffer$5.prototype.equals = function equals(b) {\\n\\t\\t\\tif (!Buffer$5.isBuffer(b)) throw new TypeError(\\\"Argument must be a Buffer\\\");\\n\\t\\t\\tif (this === b) return true;\\n\\t\\t\\treturn Buffer$5.compare(this, b) === 0;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.inspect = function inspect() {\\n\\t\\t\\tlet str = \\\"\\\";\\n\\t\\t\\tconst max = exports.INSPECT_MAX_BYTES;\\n\\t\\t\\tstr = this.toString(\\\"hex\\\", 0, max).replace(/(.{2})/g, \\\"$1 \\\").trim();\\n\\t\\t\\tif (this.length > max) str += \\\" ... \\\";\\n\\t\\t\\treturn \\\"<Buffer \\\" + str + \\\">\\\";\\n\\t\\t};\\n\\t\\tif (customInspectSymbol) Buffer$5.prototype[customInspectSymbol] = Buffer$5.prototype.inspect;\\n\\t\\tBuffer$5.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {\\n\\t\\t\\tif (isInstance(target, Uint8Array)) target = Buffer$5.from(target, target.offset, target.byteLength);\\n\\t\\t\\tif (!Buffer$5.isBuffer(target)) throw new TypeError(\\\"The \\\\\\\"target\\\\\\\" argument must be one of type Buffer or Uint8Array. Received type \\\" + typeof target);\\n\\t\\t\\tif (start === void 0) start = 0;\\n\\t\\t\\tif (end === void 0) end = target ? target.length : 0;\\n\\t\\t\\tif (thisStart === void 0) thisStart = 0;\\n\\t\\t\\tif (thisEnd === void 0) thisEnd = this.length;\\n\\t\\t\\tif (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError(\\\"out of range index\\\");\\n\\t\\t\\tif (thisStart >= thisEnd && start >= end) return 0;\\n\\t\\t\\tif (thisStart >= thisEnd) return -1;\\n\\t\\t\\tif (start >= end) return 1;\\n\\t\\t\\tstart >>>= 0;\\n\\t\\t\\tend >>>= 0;\\n\\t\\t\\tthisStart >>>= 0;\\n\\t\\t\\tthisEnd >>>= 0;\\n\\t\\t\\tif (this === target) return 0;\\n\\t\\t\\tlet x = thisEnd - thisStart;\\n\\t\\t\\tlet y = end - start;\\n\\t\\t\\tconst len$1 = Math.min(x, y);\\n\\t\\t\\tconst thisCopy = this.slice(thisStart, thisEnd);\\n\\t\\t\\tconst targetCopy = target.slice(start, end);\\n\\t\\t\\tfor (let i$1 = 0; i$1 < len$1; ++i$1) if (thisCopy[i$1] !== targetCopy[i$1]) {\\n\\t\\t\\t\\tx = thisCopy[i$1];\\n\\t\\t\\t\\ty = targetCopy[i$1];\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tif (x < y) return -1;\\n\\t\\t\\tif (y < x) return 1;\\n\\t\\t\\treturn 0;\\n\\t\\t};\\n\\t\\tfunction bidirectionalIndexOf(buffer$1, val, byteOffset, encoding, dir) {\\n\\t\\t\\tif (buffer$1.length === 0) return -1;\\n\\t\\t\\tif (typeof byteOffset === \\\"string\\\") {\\n\\t\\t\\t\\tencoding = byteOffset;\\n\\t\\t\\t\\tbyteOffset = 0;\\n\\t\\t\\t} else if (byteOffset > 2147483647) byteOffset = 2147483647;\\n\\t\\t\\telse if (byteOffset < -2147483648) byteOffset = -2147483648;\\n\\t\\t\\tbyteOffset = +byteOffset;\\n\\t\\t\\tif (numberIsNaN(byteOffset)) byteOffset = dir ? 0 : buffer$1.length - 1;\\n\\t\\t\\tif (byteOffset < 0) byteOffset = buffer$1.length + byteOffset;\\n\\t\\t\\tif (byteOffset >= buffer$1.length) if (dir) return -1;\\n\\t\\t\\telse byteOffset = buffer$1.length - 1;\\n\\t\\t\\telse if (byteOffset < 0) if (dir) byteOffset = 0;\\n\\t\\t\\telse return -1;\\n\\t\\t\\tif (typeof val === \\\"string\\\") val = Buffer$5.from(val, encoding);\\n\\t\\t\\tif (Buffer$5.isBuffer(val)) {\\n\\t\\t\\t\\tif (val.length === 0) return -1;\\n\\t\\t\\t\\treturn arrayIndexOf(buffer$1, val, byteOffset, encoding, dir);\\n\\t\\t\\t} else if (typeof val === \\\"number\\\") {\\n\\t\\t\\t\\tval = val & 255;\\n\\t\\t\\t\\tif (typeof Uint8Array.prototype.indexOf === \\\"function\\\") if (dir) return Uint8Array.prototype.indexOf.call(buffer$1, val, byteOffset);\\n\\t\\t\\t\\telse return Uint8Array.prototype.lastIndexOf.call(buffer$1, val, byteOffset);\\n\\t\\t\\t\\treturn arrayIndexOf(buffer$1, [val], byteOffset, encoding, dir);\\n\\t\\t\\t}\\n\\t\\t\\tthrow new TypeError(\\\"val must be string, number or Buffer\\\");\\n\\t\\t}\\n\\t\\tfunction arrayIndexOf(arr, val, byteOffset, encoding, dir) {\\n\\t\\t\\tlet indexSize = 1;\\n\\t\\t\\tlet arrLength = arr.length;\\n\\t\\t\\tlet valLength = val.length;\\n\\t\\t\\tif (encoding !== void 0) {\\n\\t\\t\\t\\tencoding = String(encoding).toLowerCase();\\n\\t\\t\\t\\tif (encoding === \\\"ucs2\\\" || encoding === \\\"ucs-2\\\" || encoding === \\\"utf16le\\\" || encoding === \\\"utf-16le\\\") {\\n\\t\\t\\t\\t\\tif (arr.length < 2 || val.length < 2) return -1;\\n\\t\\t\\t\\t\\tindexSize = 2;\\n\\t\\t\\t\\t\\tarrLength /= 2;\\n\\t\\t\\t\\t\\tvalLength /= 2;\\n\\t\\t\\t\\t\\tbyteOffset /= 2;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tfunction read(buf, i$2) {\\n\\t\\t\\t\\tif (indexSize === 1) return buf[i$2];\\n\\t\\t\\t\\telse return buf.readUInt16BE(i$2 * indexSize);\\n\\t\\t\\t}\\n\\t\\t\\tlet i$1;\\n\\t\\t\\tif (dir) {\\n\\t\\t\\t\\tlet foundIndex = -1;\\n\\t\\t\\t\\tfor (i$1 = byteOffset; i$1 < arrLength; i$1++) if (read(arr, i$1) === read(val, foundIndex === -1 ? 0 : i$1 - foundIndex)) {\\n\\t\\t\\t\\t\\tif (foundIndex === -1) foundIndex = i$1;\\n\\t\\t\\t\\t\\tif (i$1 - foundIndex + 1 === valLength) return foundIndex * indexSize;\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tif (foundIndex !== -1) i$1 -= i$1 - foundIndex;\\n\\t\\t\\t\\t\\tfoundIndex = -1;\\n\\t\\t\\t\\t}\\n\\t\\t\\t} else {\\n\\t\\t\\t\\tif (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\\n\\t\\t\\t\\tfor (i$1 = byteOffset; i$1 >= 0; i$1--) {\\n\\t\\t\\t\\t\\tlet found = true;\\n\\t\\t\\t\\t\\tfor (let j = 0; j < valLength; j++) if (read(arr, i$1 + j) !== read(val, j)) {\\n\\t\\t\\t\\t\\t\\tfound = false;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (found) return i$1;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\treturn -1;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.includes = function includes(val, byteOffset, encoding) {\\n\\t\\t\\treturn this.indexOf(val, byteOffset, encoding) !== -1;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.indexOf = function indexOf(val, byteOffset, encoding) {\\n\\t\\t\\treturn bidirectionalIndexOf(this, val, byteOffset, encoding, true);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {\\n\\t\\t\\treturn bidirectionalIndexOf(this, val, byteOffset, encoding, false);\\n\\t\\t};\\n\\t\\tfunction hexWrite(buf, string, offset, length) {\\n\\t\\t\\toffset = Number(offset) || 0;\\n\\t\\t\\tconst remaining = buf.length - offset;\\n\\t\\t\\tif (!length) length = remaining;\\n\\t\\t\\telse {\\n\\t\\t\\t\\tlength = Number(length);\\n\\t\\t\\t\\tif (length > remaining) length = remaining;\\n\\t\\t\\t}\\n\\t\\t\\tconst strLen = string.length;\\n\\t\\t\\tif (length > strLen / 2) length = strLen / 2;\\n\\t\\t\\tlet i$1;\\n\\t\\t\\tfor (i$1 = 0; i$1 < length; ++i$1) {\\n\\t\\t\\t\\tconst parsed = parseInt(string.substr(i$1 * 2, 2), 16);\\n\\t\\t\\t\\tif (numberIsNaN(parsed)) return i$1;\\n\\t\\t\\t\\tbuf[offset + i$1] = parsed;\\n\\t\\t\\t}\\n\\t\\t\\treturn i$1;\\n\\t\\t}\\n\\t\\tfunction utf8Write(buf, string, offset, length) {\\n\\t\\t\\treturn blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);\\n\\t\\t}\\n\\t\\tfunction asciiWrite(buf, string, offset, length) {\\n\\t\\t\\treturn blitBuffer(asciiToBytes(string), buf, offset, length);\\n\\t\\t}\\n\\t\\tfunction base64Write(buf, string, offset, length) {\\n\\t\\t\\treturn blitBuffer(base64ToBytes(string), buf, offset, length);\\n\\t\\t}\\n\\t\\tfunction ucs2Write(buf, string, offset, length) {\\n\\t\\t\\treturn blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.write = function write(string, offset, length, encoding) {\\n\\t\\t\\tif (offset === void 0) {\\n\\t\\t\\t\\tencoding = \\\"utf8\\\";\\n\\t\\t\\t\\tlength = this.length;\\n\\t\\t\\t\\toffset = 0;\\n\\t\\t\\t} else if (length === void 0 && typeof offset === \\\"string\\\") {\\n\\t\\t\\t\\tencoding = offset;\\n\\t\\t\\t\\tlength = this.length;\\n\\t\\t\\t\\toffset = 0;\\n\\t\\t\\t} else if (isFinite(offset)) {\\n\\t\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\t\\tif (isFinite(length)) {\\n\\t\\t\\t\\t\\tlength = length >>> 0;\\n\\t\\t\\t\\t\\tif (encoding === void 0) encoding = \\\"utf8\\\";\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tencoding = length;\\n\\t\\t\\t\\t\\tlength = void 0;\\n\\t\\t\\t\\t}\\n\\t\\t\\t} else throw new Error(\\\"Buffer.write(string, encoding, offset[, length]) is no longer supported\\\");\\n\\t\\t\\tconst remaining = this.length - offset;\\n\\t\\t\\tif (length === void 0 || length > remaining) length = remaining;\\n\\t\\t\\tif (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError(\\\"Attempt to write outside buffer bounds\\\");\\n\\t\\t\\tif (!encoding) encoding = \\\"utf8\\\";\\n\\t\\t\\tlet loweredCase = false;\\n\\t\\t\\tfor (;;) switch (encoding) {\\n\\t\\t\\t\\tcase \\\"hex\\\": return hexWrite(this, string, offset, length);\\n\\t\\t\\t\\tcase \\\"utf8\\\":\\n\\t\\t\\t\\tcase \\\"utf-8\\\": return utf8Write(this, string, offset, length);\\n\\t\\t\\t\\tcase \\\"ascii\\\":\\n\\t\\t\\t\\tcase \\\"latin1\\\":\\n\\t\\t\\t\\tcase \\\"binary\\\": return asciiWrite(this, string, offset, length);\\n\\t\\t\\t\\tcase \\\"base64\\\": return base64Write(this, string, offset, length);\\n\\t\\t\\t\\tcase \\\"ucs2\\\":\\n\\t\\t\\t\\tcase \\\"ucs-2\\\":\\n\\t\\t\\t\\tcase \\\"utf16le\\\":\\n\\t\\t\\t\\tcase \\\"utf-16le\\\": return ucs2Write(this, string, offset, length);\\n\\t\\t\\t\\tdefault:\\n\\t\\t\\t\\t\\tif (loweredCase) throw new TypeError(\\\"Unknown encoding: \\\" + encoding);\\n\\t\\t\\t\\t\\tencoding = (\\\"\\\" + encoding).toLowerCase();\\n\\t\\t\\t\\t\\tloweredCase = true;\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.toJSON = function toJSON() {\\n\\t\\t\\treturn {\\n\\t\\t\\t\\ttype: \\\"Buffer\\\",\\n\\t\\t\\t\\tdata: Array.prototype.slice.call(this._arr || this, 0)\\n\\t\\t\\t};\\n\\t\\t};\\n\\t\\tfunction base64Slice(buf, start, end) {\\n\\t\\t\\tif (start === 0 && end === buf.length) return base64.fromByteArray(buf);\\n\\t\\t\\telse return base64.fromByteArray(buf.slice(start, end));\\n\\t\\t}\\n\\t\\tfunction utf8Slice(buf, start, end) {\\n\\t\\t\\tend = Math.min(buf.length, end);\\n\\t\\t\\tconst res = [];\\n\\t\\t\\tlet i$1 = start;\\n\\t\\t\\twhile (i$1 < end) {\\n\\t\\t\\t\\tconst firstByte = buf[i$1];\\n\\t\\t\\t\\tlet codePoint = null;\\n\\t\\t\\t\\tlet bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;\\n\\t\\t\\t\\tif (i$1 + bytesPerSequence <= end) {\\n\\t\\t\\t\\t\\tlet secondByte, thirdByte, fourthByte, tempCodePoint;\\n\\t\\t\\t\\t\\tswitch (bytesPerSequence) {\\n\\t\\t\\t\\t\\t\\tcase 1:\\n\\t\\t\\t\\t\\t\\t\\tif (firstByte < 128) codePoint = firstByte;\\n\\t\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\t\\tcase 2:\\n\\t\\t\\t\\t\\t\\t\\tsecondByte = buf[i$1 + 1];\\n\\t\\t\\t\\t\\t\\t\\tif ((secondByte & 192) === 128) {\\n\\t\\t\\t\\t\\t\\t\\t\\ttempCodePoint = (firstByte & 31) << 6 | secondByte & 63;\\n\\t\\t\\t\\t\\t\\t\\t\\tif (tempCodePoint > 127) codePoint = tempCodePoint;\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\t\\tcase 3:\\n\\t\\t\\t\\t\\t\\t\\tsecondByte = buf[i$1 + 1];\\n\\t\\t\\t\\t\\t\\t\\tthirdByte = buf[i$1 + 2];\\n\\t\\t\\t\\t\\t\\t\\tif ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {\\n\\t\\t\\t\\t\\t\\t\\t\\ttempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;\\n\\t\\t\\t\\t\\t\\t\\t\\tif (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) codePoint = tempCodePoint;\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\t\\tcase 4:\\n\\t\\t\\t\\t\\t\\t\\tsecondByte = buf[i$1 + 1];\\n\\t\\t\\t\\t\\t\\t\\tthirdByte = buf[i$1 + 2];\\n\\t\\t\\t\\t\\t\\t\\tfourthByte = buf[i$1 + 3];\\n\\t\\t\\t\\t\\t\\t\\tif ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {\\n\\t\\t\\t\\t\\t\\t\\t\\ttempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;\\n\\t\\t\\t\\t\\t\\t\\t\\tif (tempCodePoint > 65535 && tempCodePoint < 1114112) codePoint = tempCodePoint;\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (codePoint === null) {\\n\\t\\t\\t\\t\\tcodePoint = 65533;\\n\\t\\t\\t\\t\\tbytesPerSequence = 1;\\n\\t\\t\\t\\t} else if (codePoint > 65535) {\\n\\t\\t\\t\\t\\tcodePoint -= 65536;\\n\\t\\t\\t\\t\\tres.push(codePoint >>> 10 & 1023 | 55296);\\n\\t\\t\\t\\t\\tcodePoint = 56320 | codePoint & 1023;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tres.push(codePoint);\\n\\t\\t\\t\\ti$1 += bytesPerSequence;\\n\\t\\t\\t}\\n\\t\\t\\treturn decodeCodePointsArray(res);\\n\\t\\t}\\n\\t\\tconst MAX_ARGUMENTS_LENGTH = 4096;\\n\\t\\tfunction decodeCodePointsArray(codePoints) {\\n\\t\\t\\tconst len$1 = codePoints.length;\\n\\t\\t\\tif (len$1 <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints);\\n\\t\\t\\tlet res = \\\"\\\";\\n\\t\\t\\tlet i$1 = 0;\\n\\t\\t\\twhile (i$1 < len$1) res += String.fromCharCode.apply(String, codePoints.slice(i$1, i$1 += MAX_ARGUMENTS_LENGTH));\\n\\t\\t\\treturn res;\\n\\t\\t}\\n\\t\\tfunction asciiSlice(buf, start, end) {\\n\\t\\t\\tlet ret = \\\"\\\";\\n\\t\\t\\tend = Math.min(buf.length, end);\\n\\t\\t\\tfor (let i$1 = start; i$1 < end; ++i$1) ret += String.fromCharCode(buf[i$1] & 127);\\n\\t\\t\\treturn ret;\\n\\t\\t}\\n\\t\\tfunction latin1Slice(buf, start, end) {\\n\\t\\t\\tlet ret = \\\"\\\";\\n\\t\\t\\tend = Math.min(buf.length, end);\\n\\t\\t\\tfor (let i$1 = start; i$1 < end; ++i$1) ret += String.fromCharCode(buf[i$1]);\\n\\t\\t\\treturn ret;\\n\\t\\t}\\n\\t\\tfunction hexSlice(buf, start, end) {\\n\\t\\t\\tconst len$1 = buf.length;\\n\\t\\t\\tif (!start || start < 0) start = 0;\\n\\t\\t\\tif (!end || end < 0 || end > len$1) end = len$1;\\n\\t\\t\\tlet out = \\\"\\\";\\n\\t\\t\\tfor (let i$1 = start; i$1 < end; ++i$1) out += hexSliceLookupTable[buf[i$1]];\\n\\t\\t\\treturn out;\\n\\t\\t}\\n\\t\\tfunction utf16leSlice(buf, start, end) {\\n\\t\\t\\tconst bytes = buf.slice(start, end);\\n\\t\\t\\tlet res = \\\"\\\";\\n\\t\\t\\tfor (let i$1 = 0; i$1 < bytes.length - 1; i$1 += 2) res += String.fromCharCode(bytes[i$1] + bytes[i$1 + 1] * 256);\\n\\t\\t\\treturn res;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.slice = function slice(start, end) {\\n\\t\\t\\tconst len$1 = this.length;\\n\\t\\t\\tstart = ~~start;\\n\\t\\t\\tend = end === void 0 ? len$1 : ~~end;\\n\\t\\t\\tif (start < 0) {\\n\\t\\t\\t\\tstart += len$1;\\n\\t\\t\\t\\tif (start < 0) start = 0;\\n\\t\\t\\t} else if (start > len$1) start = len$1;\\n\\t\\t\\tif (end < 0) {\\n\\t\\t\\t\\tend += len$1;\\n\\t\\t\\t\\tif (end < 0) end = 0;\\n\\t\\t\\t} else if (end > len$1) end = len$1;\\n\\t\\t\\tif (end < start) end = start;\\n\\t\\t\\tconst newBuf = this.subarray(start, end);\\n\\t\\t\\tObject.setPrototypeOf(newBuf, Buffer$5.prototype);\\n\\t\\t\\treturn newBuf;\\n\\t\\t};\\n\\t\\tfunction checkOffset(offset, ext, length) {\\n\\t\\t\\tif (offset % 1 !== 0 || offset < 0) throw new RangeError(\\\"offset is not uint\\\");\\n\\t\\t\\tif (offset + ext > length) throw new RangeError(\\\"Trying to access beyond buffer length\\\");\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.readUintLE = Buffer$5.prototype.readUIntLE = function readUIntLE(offset, byteLength$2, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, byteLength$2, this.length);\\n\\t\\t\\tlet val = this[offset];\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet i$1 = 0;\\n\\t\\t\\twhile (++i$1 < byteLength$2 && (mul *= 256)) val += this[offset + i$1] * mul;\\n\\t\\t\\treturn val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUintBE = Buffer$5.prototype.readUIntBE = function readUIntBE(offset, byteLength$2, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, byteLength$2, this.length);\\n\\t\\t\\tlet val = this[offset + --byteLength$2];\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\twhile (byteLength$2 > 0 && (mul *= 256)) val += this[offset + --byteLength$2] * mul;\\n\\t\\t\\treturn val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUint8 = Buffer$5.prototype.readUInt8 = function readUInt8(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 1, this.length);\\n\\t\\t\\treturn this[offset];\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUint16LE = Buffer$5.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 2, this.length);\\n\\t\\t\\treturn this[offset] | this[offset + 1] << 8;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUint16BE = Buffer$5.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 2, this.length);\\n\\t\\t\\treturn this[offset] << 8 | this[offset + 1];\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUint32LE = Buffer$5.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readUint32BE = Buffer$5.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tvalidateNumber(offset, \\\"offset\\\");\\n\\t\\t\\tconst first = this[offset];\\n\\t\\t\\tconst last = this[offset + 7];\\n\\t\\t\\tif (first === void 0 || last === void 0) boundsError(offset, this.length - 8);\\n\\t\\t\\tconst lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;\\n\\t\\t\\tconst hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;\\n\\t\\t\\treturn BigInt(lo) + (BigInt(hi) << BigInt(32));\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tvalidateNumber(offset, \\\"offset\\\");\\n\\t\\t\\tconst first = this[offset];\\n\\t\\t\\tconst last = this[offset + 7];\\n\\t\\t\\tif (first === void 0 || last === void 0) boundsError(offset, this.length - 8);\\n\\t\\t\\tconst hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\\n\\t\\t\\tconst lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;\\n\\t\\t\\treturn (BigInt(hi) << BigInt(32)) + BigInt(lo);\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.readIntLE = function readIntLE(offset, byteLength$2, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, byteLength$2, this.length);\\n\\t\\t\\tlet val = this[offset];\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet i$1 = 0;\\n\\t\\t\\twhile (++i$1 < byteLength$2 && (mul *= 256)) val += this[offset + i$1] * mul;\\n\\t\\t\\tmul *= 128;\\n\\t\\t\\tif (val >= mul) val -= Math.pow(2, 8 * byteLength$2);\\n\\t\\t\\treturn val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readIntBE = function readIntBE(offset, byteLength$2, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, byteLength$2, this.length);\\n\\t\\t\\tlet i$1 = byteLength$2;\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet val = this[offset + --i$1];\\n\\t\\t\\twhile (i$1 > 0 && (mul *= 256)) val += this[offset + --i$1] * mul;\\n\\t\\t\\tmul *= 128;\\n\\t\\t\\tif (val >= mul) val -= Math.pow(2, 8 * byteLength$2);\\n\\t\\t\\treturn val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readInt8 = function readInt8(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 1, this.length);\\n\\t\\t\\tif (!(this[offset] & 128)) return this[offset];\\n\\t\\t\\treturn (255 - this[offset] + 1) * -1;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 2, this.length);\\n\\t\\t\\tconst val = this[offset] | this[offset + 1] << 8;\\n\\t\\t\\treturn val & 32768 ? val | 4294901760 : val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 2, this.length);\\n\\t\\t\\tconst val = this[offset + 1] | this[offset] << 8;\\n\\t\\t\\treturn val & 32768 ? val | 4294901760 : val;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tvalidateNumber(offset, \\\"offset\\\");\\n\\t\\t\\tconst first = this[offset];\\n\\t\\t\\tconst last = this[offset + 7];\\n\\t\\t\\tif (first === void 0 || last === void 0) boundsError(offset, this.length - 8);\\n\\t\\t\\tconst val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24);\\n\\t\\t\\treturn (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tvalidateNumber(offset, \\\"offset\\\");\\n\\t\\t\\tconst first = this[offset];\\n\\t\\t\\tconst last = this[offset + 7];\\n\\t\\t\\tif (first === void 0 || last === void 0) boundsError(offset, this.length - 8);\\n\\t\\t\\tconst val = (first << 24) + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];\\n\\t\\t\\treturn (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn ieee754.read(this, offset, true, 23, 4);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 4, this.length);\\n\\t\\t\\treturn ieee754.read(this, offset, false, 23, 4);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 8, this.length);\\n\\t\\t\\treturn ieee754.read(this, offset, true, 52, 8);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkOffset(offset, 8, this.length);\\n\\t\\t\\treturn ieee754.read(this, offset, false, 52, 8);\\n\\t\\t};\\n\\t\\tfunction checkInt(buf, value, offset, ext, max, min) {\\n\\t\\t\\tif (!Buffer$5.isBuffer(buf)) throw new TypeError(\\\"\\\\\\\"buffer\\\\\\\" argument must be a Buffer instance\\\");\\n\\t\\t\\tif (value > max || value < min) throw new RangeError(\\\"\\\\\\\"value\\\\\\\" argument is out of bounds\\\");\\n\\t\\t\\tif (offset + ext > buf.length) throw new RangeError(\\\"Index out of range\\\");\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.writeUintLE = Buffer$5.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength$2, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) {\\n\\t\\t\\t\\tconst maxBytes = Math.pow(2, 8 * byteLength$2) - 1;\\n\\t\\t\\t\\tcheckInt(this, value, offset, byteLength$2, maxBytes, 0);\\n\\t\\t\\t}\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet i$1 = 0;\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\twhile (++i$1 < byteLength$2 && (mul *= 256)) this[offset + i$1] = value / mul & 255;\\n\\t\\t\\treturn offset + byteLength$2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUintBE = Buffer$5.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength$2, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tbyteLength$2 = byteLength$2 >>> 0;\\n\\t\\t\\tif (!noAssert) {\\n\\t\\t\\t\\tconst maxBytes = Math.pow(2, 8 * byteLength$2) - 1;\\n\\t\\t\\t\\tcheckInt(this, value, offset, byteLength$2, maxBytes, 0);\\n\\t\\t\\t}\\n\\t\\t\\tlet i$1 = byteLength$2 - 1;\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tthis[offset + i$1] = value & 255;\\n\\t\\t\\twhile (--i$1 >= 0 && (mul *= 256)) this[offset + i$1] = value / mul & 255;\\n\\t\\t\\treturn offset + byteLength$2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUint8 = Buffer$5.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 1, 255, 0);\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\treturn offset + 1;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUint16LE = Buffer$5.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\tthis[offset + 1] = value >>> 8;\\n\\t\\t\\treturn offset + 2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUint16BE = Buffer$5.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 2, 65535, 0);\\n\\t\\t\\tthis[offset] = value >>> 8;\\n\\t\\t\\tthis[offset + 1] = value & 255;\\n\\t\\t\\treturn offset + 2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUint32LE = Buffer$5.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\\n\\t\\t\\tthis[offset + 3] = value >>> 24;\\n\\t\\t\\tthis[offset + 2] = value >>> 16;\\n\\t\\t\\tthis[offset + 1] = value >>> 8;\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\treturn offset + 4;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeUint32BE = Buffer$5.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);\\n\\t\\t\\tthis[offset] = value >>> 24;\\n\\t\\t\\tthis[offset + 1] = value >>> 16;\\n\\t\\t\\tthis[offset + 2] = value >>> 8;\\n\\t\\t\\tthis[offset + 3] = value & 255;\\n\\t\\t\\treturn offset + 4;\\n\\t\\t};\\n\\t\\tfunction wrtBigUInt64LE(buf, value, offset, min, max) {\\n\\t\\t\\tcheckIntBI(value, min, max, buf, offset, 7);\\n\\t\\t\\tlet lo = Number(value & BigInt(4294967295));\\n\\t\\t\\tbuf[offset++] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset++] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset++] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset++] = lo;\\n\\t\\t\\tlet hi = Number(value >> BigInt(32) & BigInt(4294967295));\\n\\t\\t\\tbuf[offset++] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset++] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset++] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset++] = hi;\\n\\t\\t\\treturn offset;\\n\\t\\t}\\n\\t\\tfunction wrtBigUInt64BE(buf, value, offset, min, max) {\\n\\t\\t\\tcheckIntBI(value, min, max, buf, offset, 7);\\n\\t\\t\\tlet lo = Number(value & BigInt(4294967295));\\n\\t\\t\\tbuf[offset + 7] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset + 6] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset + 5] = lo;\\n\\t\\t\\tlo = lo >> 8;\\n\\t\\t\\tbuf[offset + 4] = lo;\\n\\t\\t\\tlet hi = Number(value >> BigInt(32) & BigInt(4294967295));\\n\\t\\t\\tbuf[offset + 3] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset + 2] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset + 1] = hi;\\n\\t\\t\\thi = hi >> 8;\\n\\t\\t\\tbuf[offset] = hi;\\n\\t\\t\\treturn offset + 8;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {\\n\\t\\t\\treturn wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt(\\\"0xffffffffffffffff\\\"));\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {\\n\\t\\t\\treturn wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt(\\\"0xffffffffffffffff\\\"));\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.writeIntLE = function writeIntLE(value, offset, byteLength$2, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) {\\n\\t\\t\\t\\tconst limit = Math.pow(2, 8 * byteLength$2 - 1);\\n\\t\\t\\t\\tcheckInt(this, value, offset, byteLength$2, limit - 1, -limit);\\n\\t\\t\\t}\\n\\t\\t\\tlet i$1 = 0;\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet sub = 0;\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\twhile (++i$1 < byteLength$2 && (mul *= 256)) {\\n\\t\\t\\t\\tif (value < 0 && sub === 0 && this[offset + i$1 - 1] !== 0) sub = 1;\\n\\t\\t\\t\\tthis[offset + i$1] = (value / mul >> 0) - sub & 255;\\n\\t\\t\\t}\\n\\t\\t\\treturn offset + byteLength$2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeIntBE = function writeIntBE(value, offset, byteLength$2, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) {\\n\\t\\t\\t\\tconst limit = Math.pow(2, 8 * byteLength$2 - 1);\\n\\t\\t\\t\\tcheckInt(this, value, offset, byteLength$2, limit - 1, -limit);\\n\\t\\t\\t}\\n\\t\\t\\tlet i$1 = byteLength$2 - 1;\\n\\t\\t\\tlet mul = 1;\\n\\t\\t\\tlet sub = 0;\\n\\t\\t\\tthis[offset + i$1] = value & 255;\\n\\t\\t\\twhile (--i$1 >= 0 && (mul *= 256)) {\\n\\t\\t\\t\\tif (value < 0 && sub === 0 && this[offset + i$1 + 1] !== 0) sub = 1;\\n\\t\\t\\t\\tthis[offset + i$1] = (value / mul >> 0) - sub & 255;\\n\\t\\t\\t}\\n\\t\\t\\treturn offset + byteLength$2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 1, 127, -128);\\n\\t\\t\\tif (value < 0) value = 255 + value + 1;\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\treturn offset + 1;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\tthis[offset + 1] = value >>> 8;\\n\\t\\t\\treturn offset + 2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);\\n\\t\\t\\tthis[offset] = value >>> 8;\\n\\t\\t\\tthis[offset + 1] = value & 255;\\n\\t\\t\\treturn offset + 2;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\\n\\t\\t\\tthis[offset] = value & 255;\\n\\t\\t\\tthis[offset + 1] = value >>> 8;\\n\\t\\t\\tthis[offset + 2] = value >>> 16;\\n\\t\\t\\tthis[offset + 3] = value >>> 24;\\n\\t\\t\\treturn offset + 4;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);\\n\\t\\t\\tif (value < 0) value = 4294967295 + value + 1;\\n\\t\\t\\tthis[offset] = value >>> 24;\\n\\t\\t\\tthis[offset + 1] = value >>> 16;\\n\\t\\t\\tthis[offset + 2] = value >>> 8;\\n\\t\\t\\tthis[offset + 3] = value & 255;\\n\\t\\t\\treturn offset + 4;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {\\n\\t\\t\\treturn wrtBigUInt64LE(this, value, offset, -BigInt(\\\"0x8000000000000000\\\"), BigInt(\\\"0x7fffffffffffffff\\\"));\\n\\t\\t});\\n\\t\\tBuffer$5.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {\\n\\t\\t\\treturn wrtBigUInt64BE(this, value, offset, -BigInt(\\\"0x8000000000000000\\\"), BigInt(\\\"0x7fffffffffffffff\\\"));\\n\\t\\t});\\n\\t\\tfunction checkIEEE754(buf, value, offset, ext, max, min) {\\n\\t\\t\\tif (offset + ext > buf.length) throw new RangeError(\\\"Index out of range\\\");\\n\\t\\t\\tif (offset < 0) throw new RangeError(\\\"Index out of range\\\");\\n\\t\\t}\\n\\t\\tfunction writeFloat(buf, value, offset, littleEndian, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);\\n\\t\\t\\tieee754.write(buf, value, offset, littleEndian, 23, 4);\\n\\t\\t\\treturn offset + 4;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\\n\\t\\t\\treturn writeFloat(this, value, offset, true, noAssert);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\\n\\t\\t\\treturn writeFloat(this, value, offset, false, noAssert);\\n\\t\\t};\\n\\t\\tfunction writeDouble(buf, value, offset, littleEndian, noAssert) {\\n\\t\\t\\tvalue = +value;\\n\\t\\t\\toffset = offset >>> 0;\\n\\t\\t\\tif (!noAssert) checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);\\n\\t\\t\\tieee754.write(buf, value, offset, littleEndian, 52, 8);\\n\\t\\t\\treturn offset + 8;\\n\\t\\t}\\n\\t\\tBuffer$5.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {\\n\\t\\t\\treturn writeDouble(this, value, offset, true, noAssert);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {\\n\\t\\t\\treturn writeDouble(this, value, offset, false, noAssert);\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.copy = function copy(target, targetStart, start, end) {\\n\\t\\t\\tif (!Buffer$5.isBuffer(target)) throw new TypeError(\\\"argument should be a Buffer\\\");\\n\\t\\t\\tif (!start) start = 0;\\n\\t\\t\\tif (!end && end !== 0) end = this.length;\\n\\t\\t\\tif (targetStart >= target.length) targetStart = target.length;\\n\\t\\t\\tif (!targetStart) targetStart = 0;\\n\\t\\t\\tif (end > 0 && end < start) end = start;\\n\\t\\t\\tif (end === start) return 0;\\n\\t\\t\\tif (target.length === 0 || this.length === 0) return 0;\\n\\t\\t\\tif (targetStart < 0) throw new RangeError(\\\"targetStart out of bounds\\\");\\n\\t\\t\\tif (start < 0 || start >= this.length) throw new RangeError(\\\"Index out of range\\\");\\n\\t\\t\\tif (end < 0) throw new RangeError(\\\"sourceEnd out of bounds\\\");\\n\\t\\t\\tif (end > this.length) end = this.length;\\n\\t\\t\\tif (target.length - targetStart < end - start) end = target.length - targetStart + start;\\n\\t\\t\\tconst len$1 = end - start;\\n\\t\\t\\tif (this === target && typeof Uint8Array.prototype.copyWithin === \\\"function\\\") this.copyWithin(targetStart, start, end);\\n\\t\\t\\telse Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);\\n\\t\\t\\treturn len$1;\\n\\t\\t};\\n\\t\\tBuffer$5.prototype.fill = function fill(val, start, end, encoding) {\\n\\t\\t\\tif (typeof val === \\\"string\\\") {\\n\\t\\t\\t\\tif (typeof start === \\\"string\\\") {\\n\\t\\t\\t\\t\\tencoding = start;\\n\\t\\t\\t\\t\\tstart = 0;\\n\\t\\t\\t\\t\\tend = this.length;\\n\\t\\t\\t\\t} else if (typeof end === \\\"string\\\") {\\n\\t\\t\\t\\t\\tencoding = end;\\n\\t\\t\\t\\t\\tend = this.length;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (encoding !== void 0 && typeof encoding !== \\\"string\\\") throw new TypeError(\\\"encoding must be a string\\\");\\n\\t\\t\\t\\tif (typeof encoding === \\\"string\\\" && !Buffer$5.isEncoding(encoding)) throw new TypeError(\\\"Unknown encoding: \\\" + encoding);\\n\\t\\t\\t\\tif (val.length === 1) {\\n\\t\\t\\t\\t\\tconst code$1 = val.charCodeAt(0);\\n\\t\\t\\t\\t\\tif (encoding === \\\"utf8\\\" && code$1 < 128 || encoding === \\\"latin1\\\") val = code$1;\\n\\t\\t\\t\\t}\\n\\t\\t\\t} else if (typeof val === \\\"number\\\") val = val & 255;\\n\\t\\t\\telse if (typeof val === \\\"boolean\\\") val = Number(val);\\n\\t\\t\\tif (start < 0 || this.length < start || this.length < end) throw new RangeError(\\\"Out of range index\\\");\\n\\t\\t\\tif (end <= start) return this;\\n\\t\\t\\tstart = start >>> 0;\\n\\t\\t\\tend = end === void 0 ? this.length : end >>> 0;\\n\\t\\t\\tif (!val) val = 0;\\n\\t\\t\\tlet i$1;\\n\\t\\t\\tif (typeof val === \\\"number\\\") for (i$1 = start; i$1 < end; ++i$1) this[i$1] = val;\\n\\t\\t\\telse {\\n\\t\\t\\t\\tconst bytes = Buffer$5.isBuffer(val) ? val : Buffer$5.from(val, encoding);\\n\\t\\t\\t\\tconst len$1 = bytes.length;\\n\\t\\t\\t\\tif (len$1 === 0) throw new TypeError(\\\"The value \\\\\\\"\\\" + val + \\\"\\\\\\\" is invalid for argument \\\\\\\"value\\\\\\\"\\\");\\n\\t\\t\\t\\tfor (i$1 = 0; i$1 < end - start; ++i$1) this[i$1 + start] = bytes[i$1 % len$1];\\n\\t\\t\\t}\\n\\t\\t\\treturn this;\\n\\t\\t};\\n\\t\\tconst errors = {};\\n\\t\\tfunction E(sym, getMessage, Base) {\\n\\t\\t\\terrors[sym] = class NodeError extends Base {\\n\\t\\t\\t\\tconstructor() {\\n\\t\\t\\t\\t\\tsuper();\\n\\t\\t\\t\\t\\tObject.defineProperty(this, \\\"message\\\", {\\n\\t\\t\\t\\t\\t\\tvalue: getMessage.apply(this, arguments),\\n\\t\\t\\t\\t\\t\\twritable: true,\\n\\t\\t\\t\\t\\t\\tconfigurable: true\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tthis.name = `${this.name} [${sym}]`;\\n\\t\\t\\t\\t\\tthis.stack;\\n\\t\\t\\t\\t\\tdelete this.name;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tget code() {\\n\\t\\t\\t\\t\\treturn sym;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tset code(value) {\\n\\t\\t\\t\\t\\tObject.defineProperty(this, \\\"code\\\", {\\n\\t\\t\\t\\t\\t\\tconfigurable: true,\\n\\t\\t\\t\\t\\t\\tenumerable: true,\\n\\t\\t\\t\\t\\t\\tvalue,\\n\\t\\t\\t\\t\\t\\twritable: true\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\ttoString() {\\n\\t\\t\\t\\t\\treturn `${this.name} [${sym}]: ${this.message}`;\\n\\t\\t\\t\\t}\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\tE(\\\"ERR_BUFFER_OUT_OF_BOUNDS\\\", function(name) {\\n\\t\\t\\tif (name) return `${name} is outside of buffer bounds`;\\n\\t\\t\\treturn \\\"Attempt to access memory outside buffer bounds\\\";\\n\\t\\t}, RangeError);\\n\\t\\tE(\\\"ERR_INVALID_ARG_TYPE\\\", function(name, actual) {\\n\\t\\t\\treturn `The \\\"${name}\\\" argument must be of type number. Received type ${typeof actual}`;\\n\\t\\t}, TypeError);\\n\\t\\tE(\\\"ERR_OUT_OF_RANGE\\\", function(str, range, input) {\\n\\t\\t\\tlet msg = `The value of \\\"${str}\\\" is out of range.`;\\n\\t\\t\\tlet received = input;\\n\\t\\t\\tif (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input));\\n\\t\\t\\telse if (typeof input === \\\"bigint\\\") {\\n\\t\\t\\t\\treceived = String(input);\\n\\t\\t\\t\\tif (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received);\\n\\t\\t\\t\\treceived += \\\"n\\\";\\n\\t\\t\\t}\\n\\t\\t\\tmsg += ` It must be ${range}. Received ${received}`;\\n\\t\\t\\treturn msg;\\n\\t\\t}, RangeError);\\n\\t\\tfunction addNumericalSeparator(val) {\\n\\t\\t\\tlet res = \\\"\\\";\\n\\t\\t\\tlet i$1 = val.length;\\n\\t\\t\\tconst start = val[0] === \\\"-\\\" ? 1 : 0;\\n\\t\\t\\tfor (; i$1 >= start + 4; i$1 -= 3) res = `_${val.slice(i$1 - 3, i$1)}${res}`;\\n\\t\\t\\treturn `${val.slice(0, i$1)}${res}`;\\n\\t\\t}\\n\\t\\tfunction checkBounds(buf, offset, byteLength$2) {\\n\\t\\t\\tvalidateNumber(offset, \\\"offset\\\");\\n\\t\\t\\tif (buf[offset] === void 0 || buf[offset + byteLength$2] === void 0) boundsError(offset, buf.length - (byteLength$2 + 1));\\n\\t\\t}\\n\\t\\tfunction checkIntBI(value, min, max, buf, offset, byteLength$2) {\\n\\t\\t\\tif (value > max || value < min) {\\n\\t\\t\\t\\tconst n = typeof min === \\\"bigint\\\" ? \\\"n\\\" : \\\"\\\";\\n\\t\\t\\t\\tlet range;\\n\\t\\t\\t\\tif (byteLength$2 > 3) if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength$2 + 1) * 8}${n}`;\\n\\t\\t\\t\\telse range = `>= -(2${n} ** ${(byteLength$2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength$2 + 1) * 8 - 1}${n}`;\\n\\t\\t\\t\\telse range = `>= ${min}${n} and <= ${max}${n}`;\\n\\t\\t\\t\\tthrow new errors.ERR_OUT_OF_RANGE(\\\"value\\\", range, value);\\n\\t\\t\\t}\\n\\t\\t\\tcheckBounds(buf, offset, byteLength$2);\\n\\t\\t}\\n\\t\\tfunction validateNumber(value, name) {\\n\\t\\t\\tif (typeof value !== \\\"number\\\") throw new errors.ERR_INVALID_ARG_TYPE(name, \\\"number\\\", value);\\n\\t\\t}\\n\\t\\tfunction boundsError(value, length, type) {\\n\\t\\t\\tif (Math.floor(value) !== value) {\\n\\t\\t\\t\\tvalidateNumber(value, type);\\n\\t\\t\\t\\tthrow new errors.ERR_OUT_OF_RANGE(type || \\\"offset\\\", \\\"an integer\\\", value);\\n\\t\\t\\t}\\n\\t\\t\\tif (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();\\n\\t\\t\\tthrow new errors.ERR_OUT_OF_RANGE(type || \\\"offset\\\", `>= ${type ? 1 : 0} and <= ${length}`, value);\\n\\t\\t}\\n\\t\\tconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;\\n\\t\\tfunction base64clean(str) {\\n\\t\\t\\tstr = str.split(\\\"=\\\")[0];\\n\\t\\t\\tstr = str.trim().replace(INVALID_BASE64_RE, \\\"\\\");\\n\\t\\t\\tif (str.length < 2) return \\\"\\\";\\n\\t\\t\\twhile (str.length % 4 !== 0) str = str + \\\"=\\\";\\n\\t\\t\\treturn str;\\n\\t\\t}\\n\\t\\tfunction utf8ToBytes(string, units) {\\n\\t\\t\\tunits = units || Infinity;\\n\\t\\t\\tlet codePoint;\\n\\t\\t\\tconst length = string.length;\\n\\t\\t\\tlet leadSurrogate = null;\\n\\t\\t\\tconst bytes = [];\\n\\t\\t\\tfor (let i$1 = 0; i$1 < length; ++i$1) {\\n\\t\\t\\t\\tcodePoint = string.charCodeAt(i$1);\\n\\t\\t\\t\\tif (codePoint > 55295 && codePoint < 57344) {\\n\\t\\t\\t\\t\\tif (!leadSurrogate) {\\n\\t\\t\\t\\t\\t\\tif (codePoint > 56319) {\\n\\t\\t\\t\\t\\t\\t\\tif ((units -= 3) > -1) bytes.push(239, 191, 189);\\n\\t\\t\\t\\t\\t\\t\\tcontinue;\\n\\t\\t\\t\\t\\t\\t} else if (i$1 + 1 === length) {\\n\\t\\t\\t\\t\\t\\t\\tif ((units -= 3) > -1) bytes.push(239, 191, 189);\\n\\t\\t\\t\\t\\t\\t\\tcontinue;\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\tleadSurrogate = codePoint;\\n\\t\\t\\t\\t\\t\\tcontinue;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (codePoint < 56320) {\\n\\t\\t\\t\\t\\t\\tif ((units -= 3) > -1) bytes.push(239, 191, 189);\\n\\t\\t\\t\\t\\t\\tleadSurrogate = codePoint;\\n\\t\\t\\t\\t\\t\\tcontinue;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tcodePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;\\n\\t\\t\\t\\t} else if (leadSurrogate) {\\n\\t\\t\\t\\t\\tif ((units -= 3) > -1) bytes.push(239, 191, 189);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tleadSurrogate = null;\\n\\t\\t\\t\\tif (codePoint < 128) {\\n\\t\\t\\t\\t\\tif ((units -= 1) < 0) break;\\n\\t\\t\\t\\t\\tbytes.push(codePoint);\\n\\t\\t\\t\\t} else if (codePoint < 2048) {\\n\\t\\t\\t\\t\\tif ((units -= 2) < 0) break;\\n\\t\\t\\t\\t\\tbytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);\\n\\t\\t\\t\\t} else if (codePoint < 65536) {\\n\\t\\t\\t\\t\\tif ((units -= 3) < 0) break;\\n\\t\\t\\t\\t\\tbytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\\n\\t\\t\\t\\t} else if (codePoint < 1114112) {\\n\\t\\t\\t\\t\\tif ((units -= 4) < 0) break;\\n\\t\\t\\t\\t\\tbytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);\\n\\t\\t\\t\\t} else throw new Error(\\\"Invalid code point\\\");\\n\\t\\t\\t}\\n\\t\\t\\treturn bytes;\\n\\t\\t}\\n\\t\\tfunction asciiToBytes(str) {\\n\\t\\t\\tconst byteArray = [];\\n\\t\\t\\tfor (let i$1 = 0; i$1 < str.length; ++i$1) byteArray.push(str.charCodeAt(i$1) & 255);\\n\\t\\t\\treturn byteArray;\\n\\t\\t}\\n\\t\\tfunction utf16leToBytes(str, units) {\\n\\t\\t\\tlet c, hi, lo;\\n\\t\\t\\tconst byteArray = [];\\n\\t\\t\\tfor (let i$1 = 0; i$1 < str.length; ++i$1) {\\n\\t\\t\\t\\tif ((units -= 2) < 0) break;\\n\\t\\t\\t\\tc = str.charCodeAt(i$1);\\n\\t\\t\\t\\thi = c >> 8;\\n\\t\\t\\t\\tlo = c % 256;\\n\\t\\t\\t\\tbyteArray.push(lo);\\n\\t\\t\\t\\tbyteArray.push(hi);\\n\\t\\t\\t}\\n\\t\\t\\treturn byteArray;\\n\\t\\t}\\n\\t\\tfunction base64ToBytes(str) {\\n\\t\\t\\treturn base64.toByteArray(base64clean(str));\\n\\t\\t}\\n\\t\\tfunction blitBuffer(src, dst, offset, length) {\\n\\t\\t\\tlet i$1;\\n\\t\\t\\tfor (i$1 = 0; i$1 < length; ++i$1) {\\n\\t\\t\\t\\tif (i$1 + offset >= dst.length || i$1 >= src.length) break;\\n\\t\\t\\t\\tdst[i$1 + offset] = src[i$1];\\n\\t\\t\\t}\\n\\t\\t\\treturn i$1;\\n\\t\\t}\\n\\t\\tfunction isInstance(obj, type) {\\n\\t\\t\\treturn obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;\\n\\t\\t}\\n\\t\\tfunction numberIsNaN(obj) {\\n\\t\\t\\treturn obj !== obj;\\n\\t\\t}\\n\\t\\tconst hexSliceLookupTable = (function() {\\n\\t\\t\\tconst alphabet = \\\"0123456789abcdef\\\";\\n\\t\\t\\tconst table = new Array(256);\\n\\t\\t\\tfor (let i$1 = 0; i$1 < 16; ++i$1) {\\n\\t\\t\\t\\tconst i16 = i$1 * 16;\\n\\t\\t\\t\\tfor (let j = 0; j < 16; ++j) table[i16 + j] = alphabet[i$1] + alphabet[j];\\n\\t\\t\\t}\\n\\t\\t\\treturn table;\\n\\t\\t})();\\n\\t\\tfunction defineBigIntMethod(fn) {\\n\\t\\t\\treturn typeof BigInt === \\\"undefined\\\" ? BufferBigIntNotDefined : fn;\\n\\t\\t}\\n\\t\\tfunction BufferBigIntNotDefined() {\\n\\t\\t\\tthrow new Error(\\\"BigInt not supported\\\");\\n\\t\\t}\\n\\t}) });\\n\\n//#endregion\\n//#region ../javascript/src/constants/OIDCDiscoveryConstants.ts\\nvar import_buffer$1 = /* @__PURE__ */ __toESM(require_buffer(), 1);\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants related to OpenID Connect (OIDC) metadata and endpoints.\\n\\t* This object contains all the standard OIDC endpoints and storage keys\\n\\t* used throughout the application for authentication and authorization.\\n\\t*\\n\\t* @remarks\\n\\t* The constants are organized into two main sections:\\n\\t* 1. Endpoints - Contains all OIDC standard endpoint paths\\n\\t* 2. Storage - Contains keys used for storing OIDC-related data\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using an endpoint\\n\\t* const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;\\n\\t*\\n\\t* // Using a storage key\\n\\t* const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;\\n\\t* ```\\n\\t*/\\n\\tconst OIDCDiscoveryConstants$1 = {\\n\\t\\tEndpoints: {\\n\\t\\t\\tAUTHORIZATION: \\\"/oauth2/authorize\\\",\\n\\t\\t\\tEND_SESSION: \\\"/oidc/logout\\\",\\n\\t\\t\\tISSUER: \\\"/oauth2/token\\\",\\n\\t\\t\\tJWKS: \\\"/oauth2/jwks\\\",\\n\\t\\t\\tREVOCATION: \\\"/oauth2/revoke\\\",\\n\\t\\t\\tSESSION_IFRAME: \\\"/oidc/checksession\\\",\\n\\t\\t\\tTOKEN: \\\"/oauth2/token\\\",\\n\\t\\t\\tUSERINFO: \\\"/oauth2/userinfo\\\"\\n\\t\\t},\\n\\t\\tStorage: { StorageKeys: {\\n\\t\\t\\tEndpoints: {\\n\\t\\t\\t\\tAUTHORIZATION: \\\"authorization_endpoint\\\",\\n\\t\\t\\t\\tEND_SESSION: \\\"end_session_endpoint\\\",\\n\\t\\t\\t\\tISSUER: \\\"issuer\\\",\\n\\t\\t\\t\\tJWKS: \\\"jwks_uri\\\",\\n\\t\\t\\t\\tREVOCATION: \\\"revocation_endpoint\\\",\\n\\t\\t\\t\\tSESSION_IFRAME: \\\"check_session_iframe\\\",\\n\\t\\t\\t\\tTOKEN: \\\"token_endpoint\\\",\\n\\t\\t\\t\\tUSERINFO: \\\"userinfo_endpoint\\\"\\n\\t\\t\\t},\\n\\t\\t\\tOPENID_PROVIDER_CONFIG_INITIATED: \\\"op_config_initiated\\\"\\n\\t\\t} }\\n\\t};\\n\\tvar OIDCDiscoveryConstants_default = OIDCDiscoveryConstants$1;\\n\\n//#endregion\\n//#region ../javascript/src/constants/TokenExchangeConstants.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants for OAuth 2.0 Token Exchange operations.\\n\\t* This object contains placeholders used in token exchange requests\\n\\t* and responses for dynamic value substitution.\\n\\t*\\n\\t* @remarks\\n\\t* These placeholders are used in token exchange templates and are replaced\\n\\t* with actual values during request processing. They help in creating\\n\\t* flexible and reusable token exchange configurations.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using placeholders in a token exchange template\\n\\t* const template = `grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=${TokenExchangeConstants.Placeholders.TOKEN}`;\\n\\t* ```\\n\\t*/\\n\\tconst TokenExchangeConstants = { Placeholders: {\\n\\t\\tACCESS_TOKEN: \\\"{{accessToken}}\\\",\\n\\t\\tCLIENT_ID: \\\"{{clientId}}\\\",\\n\\t\\tCLIENT_SECRET: \\\"{{clientSecret}}\\\",\\n\\t\\tSCOPES: \\\"{{scopes}}\\\",\\n\\t\\tUSERNAME: \\\"{{username}}\\\"\\n\\t} };\\n\\tvar TokenExchangeConstants_default = TokenExchangeConstants;\\n\\n//#endregion\\n//#region ../javascript/src/errors/exception.ts\\n/**\\n\\t* Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* @deprecated Use `ThunderIDRuntimeError` for runtime errors and `ThunderIDAPIError` for API errors.\\n\\t*/\\n\\tvar ThunderIDAuthException = class {\\n\\t\\tname;\\n\\t\\tcode;\\n\\t\\tmessage;\\n\\t\\tconstructor(code$1, name, message$1) {\\n\\t\\t\\tthis.message = message$1;\\n\\t\\t\\tthis.name = name;\\n\\t\\t\\tthis.code = code$1;\\n\\t\\t\\tObject.setPrototypeOf(this, new.target.prototype);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/models/platforms.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Enumeration of supported identity platforms.\\n\\t*\\n\\t* - `ThunderID`: Represents the ThunderID cloud identity platform (asgardeo.io domains).\\n\\t* - `IdentityServer`: Represents WSO2 Identity Server (on-prem or custom domains).\\n\\t* - `Unknown`: Used when the platform cannot be determined from the configuration.\\n\\t*\\n\\t* This enum is used to distinguish between different identity providers and to\\n\\t* enable platform-specific logic throughout the SDK.\\n\\t*/\\n\\tlet Platform = /* @__PURE__ */ function(Platform$1) {\\n\\t\\t/** ThunderID cloud identity platform (asgardeo.io domains) */\\n\\t\\tPlatform$1[\\\"ThunderID\\\"] = \\\"THUNDERID\\\";\\n\\t\\t/** @experimental ThunderID V2 */\\n\\t\\tPlatform$1[\\\"ThunderIDV2\\\"] = \\\"ThunderIDV2\\\";\\n\\t\\t/** WSO2 Identity Server (on-prem or custom domains) */\\n\\t\\tPlatform$1[\\\"IdentityServer\\\"] = \\\"IDENTITY_SERVER\\\";\\n\\t\\t/** Unknown or unsupported platform */\\n\\t\\tPlatform$1[\\\"Unknown\\\"] = \\\"UNKNOWN\\\";\\n\\t\\treturn Platform$1;\\n\\t}({});\\n\\n//#endregion\\n//#region ../javascript/src/utils/extractUserClaimsFromIdToken.ts\\n/**\\n\\t* Removes standard protocol-specific claims from the ID token payload\\n\\t* and returns an object of user-specific claims with original attribute names preserved.\\n\\t*\\n\\t* @param payload The raw ID token payload.\\n\\t* @returns A cleaned-up object containing only user-specific claims with original attribute names.\\n\\t*\\n\\t* @example\\n\\t* ````typescript\\n\\t* const idTokenPayload = {\\n\\t* iss: 'https://example.com',\\n\\t* aud: 'client_id',\\n\\t* exp: 1712345678,\\n\\t* iat: 1712345670,\\n\\t* email: 'user@example.com',\\n\\t* given_name: 'John'\\n\\t* };\\n\\t*\\n\\t* const userClaims = extractUserClaimsFromIdToken(idTokenPayload);\\n\\t* // userClaims will be:\\n\\t* // {\\n\\t* // email: 'user@example.com',\\n\\t* // given_name: 'John'\\n\\t* // }\\n\\t* ```\\n\\t*/\\n\\tconst extractUserClaimsFromIdToken = (payload) => {\\n\\t\\tconst filteredPayload = { ...payload };\\n\\t\\t[\\n\\t\\t\\t\\\"iss\\\",\\n\\t\\t\\t\\\"aud\\\",\\n\\t\\t\\t\\\"exp\\\",\\n\\t\\t\\t\\\"iat\\\",\\n\\t\\t\\t\\\"acr\\\",\\n\\t\\t\\t\\\"amr\\\",\\n\\t\\t\\t\\\"azp\\\",\\n\\t\\t\\t\\\"auth_time\\\",\\n\\t\\t\\t\\\"nonce\\\",\\n\\t\\t\\t\\\"c_hash\\\",\\n\\t\\t\\t\\\"at_hash\\\",\\n\\t\\t\\t\\\"nbf\\\",\\n\\t\\t\\t\\\"isk\\\",\\n\\t\\t\\t\\\"sid\\\",\\n\\t\\t\\t\\\"jti\\\",\\n\\t\\t\\t\\\"sub\\\"\\n\\t\\t].forEach((claim) => {\\n\\t\\t\\tdelete filteredPayload[claim];\\n\\t\\t});\\n\\t\\treturn filteredPayload;\\n\\t};\\n\\tvar extractUserClaimsFromIdToken_default = extractUserClaimsFromIdToken;\\n\\n//#endregion\\n//#region ../javascript/src/constants/ScopeConstants.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants for OAuth 2.0 and OpenID Connect scopes.\\n\\t* These scopes define the level of access that the client application\\n\\t* is requesting from the authorization server.\\n\\t*\\n\\t* @remarks\\n\\t* Scopes are space-separated strings that represent different permissions.\\n\\t* The 'openid' scope is required for OpenID Connect flows, while other\\n\\t* scopes provide access to different resources or user information.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Requesting OpenID Connect authentication\\n\\t* const scope = [ScopeConstants.OPENID];\\n\\t*\\n\\t* // Requesting profile information\\n\\t* const scopes = [ScopeConstants.OPENID, ScopeConstants.PROFILE];\\n\\t* ```\\n\\t*/\\n\\tconst ScopeConstants = {\\n\\t\\tINTERNAL_LOGIN: \\\"internal_login\\\",\\n\\t\\tOPENID: \\\"openid\\\",\\n\\t\\tPROFILE: \\\"profile\\\"\\n\\t};\\n\\tvar ScopeConstants_default = ScopeConstants;\\n\\n//#endregion\\n//#region ../javascript/src/constants/OIDCRequestConstants.ts\\n/**\\n\\t* Constants representing standard OpenID Connect (OIDC) request and response parameters.\\n\\t* These parameters are commonly used during authorization, token exchange, and logout flows.\\n\\t*/\\n\\tconst OIDCRequestConstants = {\\n\\t\\tParams: {\\n\\t\\t\\tAUTHORIZATION_CODE: \\\"code\\\",\\n\\t\\t\\tSESSION_STATE: \\\"session_state\\\",\\n\\t\\t\\tSIGN_OUT_SUCCESS: \\\"sign_out_success\\\",\\n\\t\\t\\tSTATE: \\\"state\\\"\\n\\t\\t},\\n\\t\\tSignIn: { Payload: { DEFAULT_SCOPES: [\\n\\t\\t\\tScopeConstants_default.OPENID,\\n\\t\\t\\tScopeConstants_default.PROFILE,\\n\\t\\t\\tScopeConstants_default.INTERNAL_LOGIN\\n\\t\\t] } },\\n\\t\\tSignOut: { Storage: { StorageKeys: { SIGN_OUT_URL: \\\"sign_out_url\\\" } } }\\n\\t};\\n\\tvar OIDCRequestConstants_default = OIDCRequestConstants;\\n\\n//#endregion\\n//#region ../javascript/src/errors/ThunderIDError.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Base class for all ThunderID errors. This class extends the native Error class\\n\\t* and adds support for error codes and proper stack traces. Each error is prefixed\\n\\t* with a lightning emoji and the SDK name for easy identification.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Create a new error with a message and code\\n\\t* throw new ThunderIDError(\\n\\t* \\\"Invalid authentication response\\\",\\n\\t* \\\"AUTH_ERROR\\\"\\n\\t* );\\n\\t*\\n\\t* // Or with a specific SDK name\\n\\t* throw new ThunderIDError(\\n\\t* \\\"Invalid authentication response\\\",\\n\\t* \\\"AUTH_ERROR\\\",\\n\\t* \\\"@thunderid/react\\\"\\n\\t* );\\n\\t*\\n\\t* // The error message will be formatted as:\\n\\t* // ⚡ ThunderID - @thunderid/react: Invalid authentication response\\n\\t* //\\n\\t* // (code=\\\"AUTH_ERROR\\\")\\n\\t*/\\n\\tvar ThunderIDError = class ThunderIDError extends Error {\\n\\t\\tcode;\\n\\t\\torigin;\\n\\t\\tstatic resolveOrigin(origin) {\\n\\t\\t\\tif (!origin) return \\\"@thunderid/javascript\\\";\\n\\t\\t\\treturn `@thunderid/${origin}`;\\n\\t\\t}\\n\\t\\tconstructor(message$1, code$1, origin) {\\n\\t\\t\\tconst resolvedOrigin = ThunderIDError.resolveOrigin(origin);\\n\\t\\t\\tsuper(message$1);\\n\\t\\t\\tthis.name = new.target.name;\\n\\t\\t\\tthis.code = code$1;\\n\\t\\t\\tthis.origin = resolvedOrigin;\\n\\t\\t\\tif (Error.captureStackTrace) Error.captureStackTrace(this, new.target);\\n\\t\\t}\\n\\t\\ttoString() {\\n\\t\\t\\tconst prefix = `⚡ ThunderID - ${this.origin}:`;\\n\\t\\t\\treturn `[${this.name}]\\\\n${prefix} ${this.message}\\\\n(code=\\\"${this.code}\\\")`;\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/errors/ThunderIDRuntimeError.ts\\n/**\\n\\t* Base class for all runtime errors in ThunderID. This class extends ThunderIDError\\n\\t* and adds support for additional error details. Use this class for errors that occur\\n\\t* during runtime execution that are not related to API calls.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* throw new ThunderIDRuntimeError(\\n\\t* \\\"Failed to parse configuration\\\",\\n\\t* \\\"CONFIG_PARSE_ERROR\\\",\\n\\t* { invalidField: \\\"redirectUri\\\" }\\n\\t* );\\n\\t* ```\\n\\t*/\\n\\tvar ThunderIDRuntimeError = class extends ThunderIDError {\\n\\t\\t/**\\n\\t\\t* Creates an instance of ThunderIDRuntimeError.\\n\\t\\t*\\n\\t\\t* @param message - Human-readable description of the error\\n\\t\\t* @param code - A unique error code that identifies the error type\\n\\t\\t* @param details - Additional details about the error that might be helpful for debugging\\n\\t\\t* @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'ThunderID'\\n\\t\\t* @constructor\\n\\t\\t*/\\n\\t\\tconstructor(message$1, code$1, origin, details) {\\n\\t\\t\\tsuper(message$1, code$1, origin);\\n\\t\\t\\tthis.details = details;\\n\\t\\t\\tObject.defineProperty(this, \\\"name\\\", {\\n\\t\\t\\t\\tconfigurable: true,\\n\\t\\t\\t\\tvalue: \\\"ThunderIDRuntimeError\\\",\\n\\t\\t\\t\\twritable: true\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Returns a string representation of the runtime error\\n\\t\\t* @returns Formatted error string with name, code, details, and message\\n\\t\\t*/\\n\\t\\ttoString() {\\n\\t\\t\\tconst details = this.details ? `\\\\nDetails: ${JSON.stringify(this.details, null, 2)}` : \\\"\\\";\\n\\t\\t\\treturn `[${this.name}] (code=\\\"${this.code}\\\")${details}\\\\nMessage: ${this.message}`;\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/utils/processOpenIDScopes.ts\\n/**\\n\\t* Processes OpenID scopes to ensure they are in the correct format.\\n\\t* If the input is a string, it returns it as is.\\n\\t* If the input is an array, it joins the elements into a single string separated by spaces.\\n\\t* If the input is neither, it throws an error.\\n\\t*\\n\\t* Default scopes are only injected when no scopes are configured (undefined, empty string,\\n\\t* or empty array). If the caller explicitly provides scopes, those are used as-is.\\n\\t*\\n\\t* @param scopes - The OpenID scopes to process, which can be a string, an array of strings,\\n\\t* or undefined/null when not configured.\\n\\t* @returns A string of OpenID scopes separated by spaces.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* processOpenIDScopes(\\\"openid profile email\\\"); // returns \\\"openid profile email\\\"\\n\\t* processOpenIDScopes([\\\"openid\\\", \\\"profile\\\", \\\"email\\\"]); // returns \\\"openid profile email\\\"\\n\\t* processOpenIDScopes(undefined); // returns default scopes\\n\\t* processOpenIDScopes(123); // throws ThunderIDRuntimeError\\n\\t* processOpenIDScopes({}); // throws ThunderIDRuntimeError\\n\\t* ```\\n\\t*/\\n\\tconst processOpenIDScopes = (scopes) => {\\n\\t\\tlet processedScopes = [];\\n\\t\\tlet userConfiguredScopes = false;\\n\\t\\tif (scopes !== void 0 && scopes !== null) if (Array.isArray(scopes)) {\\n\\t\\t\\tprocessedScopes = scopes;\\n\\t\\t\\tuserConfiguredScopes = scopes.length > 0;\\n\\t\\t} else if (typeof scopes === \\\"string\\\") {\\n\\t\\t\\tprocessedScopes = scopes ? scopes.split(\\\" \\\") : [];\\n\\t\\t\\tuserConfiguredScopes = scopes.length > 0;\\n\\t\\t} else throw new ThunderIDRuntimeError(\\\"Scopes must be a string or an array of strings.\\\", \\\"processOpenIDScopes-Invalid-001\\\", \\\"javascript\\\", \\\"The provided scopes are not in the expected format. Please provide a string or an array of strings.\\\");\\n\\t\\tif (!userConfiguredScopes) OIDCRequestConstants_default.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope) => {\\n\\t\\t\\tif (!processedScopes.includes(defaultScope)) processedScopes.push(defaultScope);\\n\\t\\t});\\n\\t\\treturn processedScopes.join(\\\" \\\");\\n\\t};\\n\\tvar processOpenIDScopes_default = processOpenIDScopes;\\n\\n//#endregion\\n//#region ../javascript/src/__legacy__/helpers/authentication-helper.ts\\n\\tvar AuthenticationHelper$1 = class {\\n\\t\\tstorageManager;\\n\\t\\tconfig;\\n\\t\\toidcProviderMetaData;\\n\\t\\tcryptoHelper;\\n\\t\\tconstructor(storageManagerInstance, cryptoHelperInstance) {\\n\\t\\t\\tthis.storageManager = storageManagerInstance;\\n\\t\\t\\tthis.config = async () => this.storageManager.getConfigData();\\n\\t\\t\\tthis.oidcProviderMetaData = async () => this.storageManager.loadOpenIDProviderConfiguration();\\n\\t\\t\\tthis.cryptoHelper = cryptoHelperInstance;\\n\\t\\t}\\n\\t\\tasync resolveEndpoints(response) {\\n\\t\\t\\tconst oidcProviderMetaData = {};\\n\\t\\t\\tconst configData = await this.config();\\n\\t\\t\\tif (configData.endpoints) Object.keys(configData.endpoints).forEach((endpointName) => {\\n\\t\\t\\t\\tconst snakeCasedName = endpointName.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\\n\\t\\t\\t\\toidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : \\\"\\\";\\n\\t\\t\\t});\\n\\t\\t\\treturn {\\n\\t\\t\\t\\t...response,\\n\\t\\t\\t\\t...oidcProviderMetaData\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\tasync resolveEndpointsExplicitly() {\\n\\t\\t\\tconst oidcProviderMetaData = {};\\n\\t\\t\\tconst configData = await this.config();\\n\\t\\t\\tconst requiredEndpoints = [\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.AUTHORIZATION,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.END_SESSION,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.JWKS,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.SESSION_IFRAME,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.REVOCATION,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.TOKEN,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.ISSUER,\\n\\t\\t\\t\\tOIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.USERINFO\\n\\t\\t\\t];\\n\\t\\t\\tif (!(configData.endpoints ? requiredEndpoints.every((reqEndpointName) => configData.endpoints ? Object.keys(configData.endpoints).some((endpointName) => {\\n\\t\\t\\t\\treturn endpointName.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`) === reqEndpointName;\\n\\t\\t\\t}) : false) : false)) throw new ThunderIDAuthException(\\\"JS-AUTH_HELPER-REE-NF01\\\", \\\"Required endpoints missing\\\", \\\"Some or all of the required endpoints are missing in the object passed to the `endpoints` attribute of the`AuthConfig` object.\\\");\\n\\t\\t\\tif (configData.endpoints) Object.keys(configData.endpoints).forEach((endpointName) => {\\n\\t\\t\\t\\tconst snakeCasedName = endpointName.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\\n\\t\\t\\t\\toidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : \\\"\\\";\\n\\t\\t\\t});\\n\\t\\t\\treturn { ...oidcProviderMetaData };\\n\\t\\t}\\n\\t\\tasync resolveEndpointsByBaseURL() {\\n\\t\\t\\tconst oidcProviderMetaData = {};\\n\\t\\t\\tconst configData = await this.config();\\n\\t\\t\\tconst { baseUrl } = configData;\\n\\t\\t\\tif (!baseUrl) throw new ThunderIDAuthException(\\\"JS-AUTH_HELPER_REBO-NF01\\\", \\\"Base URL not defined.\\\", \\\"Base URL is not defined in AuthClient config.\\\");\\n\\t\\t\\tif (configData.endpoints) Object.keys(configData.endpoints).forEach((endpointName) => {\\n\\t\\t\\t\\tconst snakeCasedName = endpointName.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\\n\\t\\t\\t\\toidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : \\\"\\\";\\n\\t\\t\\t});\\n\\t\\t\\tconst endpointKeys = OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints;\\n\\t\\t\\tconst endpointPaths = OIDCDiscoveryConstants_default.Endpoints;\\n\\t\\t\\tconst defaultEndpoints = {\\n\\t\\t\\t\\t[endpointKeys.AUTHORIZATION]: `${baseUrl}${endpointPaths.AUTHORIZATION}`,\\n\\t\\t\\t\\t[endpointKeys.END_SESSION]: `${baseUrl}${endpointPaths.END_SESSION}`,\\n\\t\\t\\t\\t[endpointKeys.ISSUER]: `${baseUrl}${endpointPaths.ISSUER}`,\\n\\t\\t\\t\\t[endpointKeys.JWKS]: `${baseUrl}${endpointPaths.JWKS}`,\\n\\t\\t\\t\\t[endpointKeys.SESSION_IFRAME]: `${baseUrl}${endpointPaths.SESSION_IFRAME}`,\\n\\t\\t\\t\\t[endpointKeys.REVOCATION]: `${baseUrl}${endpointPaths.REVOCATION}`,\\n\\t\\t\\t\\t[endpointKeys.TOKEN]: `${baseUrl}${endpointPaths.TOKEN}`,\\n\\t\\t\\t\\t[endpointKeys.USERINFO]: `${baseUrl}${endpointPaths.USERINFO}`\\n\\t\\t\\t};\\n\\t\\t\\tif (configData.platform === Platform.ThunderIDV2) defaultEndpoints[OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.ISSUER] = `${baseUrl}`;\\n\\t\\t\\treturn {\\n\\t\\t\\t\\t...defaultEndpoints,\\n\\t\\t\\t\\t...oidcProviderMetaData\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\tasync validateIdToken(idToken) {\\n\\t\\t\\tconst jwksEndpoint = (await this.storageManager.loadOpenIDProviderConfiguration()).jwks_uri;\\n\\t\\t\\tconst configData = await this.config();\\n\\t\\t\\tif (!jwksEndpoint || jwksEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS_AUTH_HELPER-VIT-NF01\\\", \\\"JWKS endpoint not found.\\\", \\\"No JWKS endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the JWKS endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tlet response;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tresponse = await fetch(jwksEndpoint, { credentials: configData.sendCookiesInRequests ? \\\"include\\\" : \\\"same-origin\\\" });\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_HELPER-VIT-NE02\\\", \\\"Request to jwks endpoint failed.\\\", error ?? \\\"The request sent to get the jwks from the server failed.\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (response.status !== 200 || !response.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_HELPER-VIT-HE03\\\", `Invalid response status received for jwks request (${response.statusText}).`, await response.json());\\n\\t\\t\\tconst { issuer } = await this.oidcProviderMetaData();\\n\\t\\t\\tconst { keys } = await response.json();\\n\\t\\t\\tconst jwk = await this.cryptoHelper.getJWKForTheIdToken(idToken.split(\\\".\\\")[0], keys);\\n\\t\\t\\treturn this.cryptoHelper.isValidIdToken(idToken, jwk, (await this.config()).clientId, issuer ?? \\\"\\\", this.cryptoHelper.decodeJwtToken(idToken).sub, (await this.config()).tokenValidation?.idToken?.clockTolerance, (await this.config()).tokenValidation?.idToken?.validateIssuer ?? true);\\n\\t\\t}\\n\\t\\tgetAuthenticatedUserInfo(idToken) {\\n\\t\\t\\tconst payload = this.cryptoHelper.decodeJwtToken(idToken);\\n\\t\\t\\tconst username = payload?.[\\\"username\\\"] ?? \\\"\\\";\\n\\t\\t\\tconst givenName = payload?.[\\\"given_name\\\"] ?? \\\"\\\";\\n\\t\\t\\tconst familyName = payload?.[\\\"family_name\\\"] ?? \\\"\\\";\\n\\t\\t\\tconst fullName = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || \\\"\\\";\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tdisplayName: payload.preferred_username ?? fullName,\\n\\t\\t\\t\\tusername,\\n\\t\\t\\t\\t...extractUserClaimsFromIdToken_default(payload)\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\tasync replaceCustomGrantTemplateTags(text, userId) {\\n\\t\\t\\tconst configData = await this.config();\\n\\t\\t\\tconst sourceInstanceId = configData.organizationChain?.sourceInstanceId ?? null;\\n\\t\\t\\tlet sessionData;\\n\\t\\t\\tif (sourceInstanceId) {\\n\\t\\t\\t\\tconst { clientId } = configData;\\n\\t\\t\\t\\tlet instanceKey;\\n\\t\\t\\t\\tif (clientId) instanceKey = `instance_${sourceInstanceId}-${clientId}`;\\n\\t\\t\\t\\telse instanceKey = `instance_${sourceInstanceId}`;\\n\\t\\t\\t\\tsessionData = await this.storageManager.getSessionData(userId, instanceKey);\\n\\t\\t\\t\\tif (!sessionData?.access_token) throw new ThunderIDAuthException(\\\"JS-AUTH_HELPER-RCGTT-NE01\\\", \\\"No session data found for source instance.\\\", \\\"Failed to retrieve session data from the source organization context.\\\");\\n\\t\\t\\t} else sessionData = await this.storageManager.getSessionData(userId);\\n\\t\\t\\tconst scope = processOpenIDScopes_default(configData.scopes);\\n\\t\\t\\tif (typeof text !== \\\"string\\\") return text;\\n\\t\\t\\treturn text.replace(TokenExchangeConstants_default.Placeholders.ACCESS_TOKEN, sessionData.access_token).replace(TokenExchangeConstants_default.Placeholders.USERNAME, this.getAuthenticatedUserInfo(sessionData.id_token).username).replace(TokenExchangeConstants_default.Placeholders.SCOPES, scope).replace(TokenExchangeConstants_default.Placeholders.CLIENT_ID, configData.clientId).replace(TokenExchangeConstants_default.Placeholders.CLIENT_SECRET, configData.clientSecret ?? \\\"\\\");\\n\\t\\t}\\n\\t\\tasync clearSession(userId) {\\n\\t\\t\\tawait this.storageManager.removeTemporaryData(userId);\\n\\t\\t\\tawait this.storageManager.removeSessionData(userId);\\n\\t\\t}\\n\\t\\tasync handleTokenResponse(response, userId) {\\n\\t\\t\\tif (response.status !== 200 || !response.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_HELPER-HTR-NE01\\\", `Invalid response status received for token request (${response.statusText}).`, await response.json());\\n\\t\\t\\tconst parsedResponse = await response.json();\\n\\t\\t\\tparsedResponse.created_at = (/* @__PURE__ */ new Date()).getTime();\\n\\t\\t\\tif ((await this.config()).tokenValidation?.idToken?.validate) return this.validateIdToken(parsedResponse.id_token).then(async () => {\\n\\t\\t\\t\\tawait this.storageManager.setSessionData(parsedResponse, userId);\\n\\t\\t\\t\\tconst tokenResponse$1 = {\\n\\t\\t\\t\\t\\taccessToken: parsedResponse.access_token,\\n\\t\\t\\t\\t\\tcreatedAt: parsedResponse.created_at,\\n\\t\\t\\t\\t\\texpiresIn: parsedResponse.expires_in,\\n\\t\\t\\t\\t\\tidToken: parsedResponse.id_token,\\n\\t\\t\\t\\t\\trefreshToken: parsedResponse.refresh_token,\\n\\t\\t\\t\\t\\tscope: parsedResponse.scope,\\n\\t\\t\\t\\t\\ttokenType: parsedResponse.token_type\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\treturn Promise.resolve(tokenResponse$1);\\n\\t\\t\\t});\\n\\t\\t\\tconst tokenResponse = {\\n\\t\\t\\t\\taccessToken: parsedResponse.access_token,\\n\\t\\t\\t\\tcreatedAt: parsedResponse.created_at,\\n\\t\\t\\t\\texpiresIn: parsedResponse.expires_in,\\n\\t\\t\\t\\tidToken: parsedResponse.id_token,\\n\\t\\t\\t\\trefreshToken: parsedResponse.refresh_token,\\n\\t\\t\\t\\tscope: parsedResponse.scope,\\n\\t\\t\\t\\ttokenType: parsedResponse.token_type\\n\\t\\t\\t};\\n\\t\\t\\tawait this.storageManager.setSessionData(parsedResponse, userId);\\n\\t\\t\\treturn Promise.resolve(tokenResponse);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/constants/PKCEConstants.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants related to Proof Key for Code Exchange (PKCE) implementation.\\n\\t* This object contains all the necessary constants for implementing PKCE\\n\\t* flow in the OAuth 2.0 authorization code grant.\\n\\t*\\n\\t* @remarks\\n\\t* PKCE is an extension to the authorization code flow to prevent CSRF and\\n\\t* authorization code injection attacks. The constants are organized into\\n\\t* storage-related sections for managing PKCE state.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using storage keys\\n\\t* const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;\\n\\t* const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;\\n\\t* ```\\n\\t*/\\n\\tconst PKCEConstants = {\\n\\t\\tDEFAULT_CODE_CHALLENGE_METHOD: \\\"S256\\\",\\n\\t\\tStorage: { StorageKeys: {\\n\\t\\t\\tCODE_VERIFIER: \\\"pkce_code_verifier\\\",\\n\\t\\t\\tSEPARATOR: \\\"#\\\"\\n\\t\\t} }\\n\\t};\\n\\tvar PKCEConstants_default = PKCEConstants;\\n\\n//#endregion\\n//#region ../javascript/src/constants/v2/OIDCDiscoveryConstants.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants related to OpenID Connect (OIDC) metadata and endpoints.\\n\\t* This object contains all the standard OIDC endpoints and storage keys\\n\\t* used throughout the application for authentication and authorization.\\n\\t*\\n\\t* @remarks\\n\\t* The constants are organized into two main sections:\\n\\t* 1. Endpoints - Contains all OIDC standard endpoint paths\\n\\t* 2. Storage - Contains keys used for storing OIDC-related data\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using an endpoint\\n\\t* const wellKnownEndpoint = OIDCDiscoveryConstants.Endpoints.WELL_KNOWN;\\n\\t* ```\\n\\t*/\\n\\tconst OIDCDiscoveryConstants = { Endpoints: { WELL_KNOWN: \\\"/.well-known/openid-configuration\\\" } };\\n\\tvar OIDCDiscoveryConstants_default$1 = OIDCDiscoveryConstants;\\n\\n//#endregion\\n//#region ../javascript/src/constants/TokenConstants.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Constants related to OIDC token management and storage.\\n\\t* This object contains configuration values and storage keys\\n\\t* used in token validation and management processes.\\n\\t*\\n\\t* @remarks\\n\\t* The constants are organized into two main sections:\\n\\t* 1. SignatureValidation - Contains supported algorithms for token validation\\n\\t* 2. Storage - Contains keys used for storing token-related data\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using signature validation algorithms\\n\\t* const algorithms = TokenConstants.SignatureValidation.SUPPORTED_ALGORITHMS;\\n\\t*\\n\\t* // Using storage keys\\n\\t* const timerKey = TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER;\\n\\t* ```\\n\\t*/\\n\\tconst TokenConstants = {\\n\\t\\tSignatureValidation: { SUPPORTED_ALGORITHMS: [\\n\\t\\t\\t\\\"RS256\\\",\\n\\t\\t\\t\\\"RS512\\\",\\n\\t\\t\\t\\\"RS384\\\",\\n\\t\\t\\t\\\"PS256\\\"\\n\\t\\t] },\\n\\t\\tStorage: { StorageKeys: { REFRESH_TOKEN_TIMER: \\\"refresh_token_timer\\\" } }\\n\\t};\\n\\tvar TokenConstants_default = TokenConstants;\\n\\n//#endregion\\n//#region ../javascript/src/IsomorphicCrypto.ts\\n\\tvar IsomorphicCrypto = class {\\n\\t\\tcryptoUtils;\\n\\t\\tconstructor(cryptoUtils) {\\n\\t\\t\\tthis.cryptoUtils = cryptoUtils;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Generate code verifier.\\n\\t\\t*\\n\\t\\t* @returns code verifier.\\n\\t\\t*/\\n\\t\\tgetCodeVerifier() {\\n\\t\\t\\treturn this.cryptoUtils.base64URLEncode(this.cryptoUtils.generateRandomBytes(32));\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Derive code challenge from the code verifier.\\n\\t\\t*\\n\\t\\t* @param verifier - Code verifier.\\n\\t\\t*\\n\\t\\t* @returns - code challenge.\\n\\t\\t*/\\n\\t\\tasync getCodeChallenge(verifier) {\\n\\t\\t\\tconst hashed = await this.cryptoUtils.hashSha256(verifier);\\n\\t\\t\\treturn this.cryptoUtils.base64URLEncode(hashed);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Get JWK used for the id_token\\n\\t\\t*\\n\\t\\t* @param jwtHeader - header of the id_token.\\n\\t\\t* @param keys - jwks response.\\n\\t\\t*\\n\\t\\t* @returns public key.\\n\\t\\t*\\n\\t\\t* @throws\\n\\t\\t*/\\n\\t\\tgetJWKForTheIdToken(jwtHeader, keys) {\\n\\t\\t\\tconst headerJSON = JSON.parse(this.cryptoUtils.base64URLDecode(jwtHeader));\\n\\t\\t\\tconst matchingKey = keys.find((key) => headerJSON[\\\"kid\\\"] === key.kid);\\n\\t\\t\\tif (matchingKey) return matchingKey;\\n\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-CRYPTO_UTIL-GJFTIT-IV01\\\", \\\"kid not found.\\\", `Failed to find the 'kid' specified in the id_token. 'kid' found in the header : ${headerJSON[\\\"kid\\\"]}, Expected values: ${keys.map((key) => key.kid).join(\\\", \\\")}`);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Verify id token.\\n\\t\\t*\\n\\t\\t* @param idToken - id_token received from the IdP.\\n\\t\\t* @param jwk - public key used for signing.\\n\\t\\t* @param clientId - app identification.\\n\\t\\t* @param issuer - id_token issuer.\\n\\t\\t* @param username - Username.\\n\\t\\t* @param clockTolerance - Allowed leeway for id_tokens (in seconds).\\n\\t\\t*\\n\\t\\t* @returns whether the id_token is valid.\\n\\t\\t*\\n\\t\\t* @throws\\n\\t\\t*/\\n\\t\\tisValidIdToken(idToken, jwk, clientId, issuer, username, clockTolerance, validateJwtIssuer) {\\n\\t\\t\\treturn this.cryptoUtils.verifyJwt(idToken, jwk, TokenConstants_default.SignatureValidation.SUPPORTED_ALGORITHMS, clientId, issuer, username, clockTolerance, validateJwtIssuer).then((response) => {\\n\\t\\t\\t\\tif (response) return Promise.resolve(true);\\n\\t\\t\\t\\treturn Promise.reject(new ThunderIDAuthException(\\\"JS-CRYPTO_HELPER-IVIT-IV01\\\", \\\"Invalid ID token.\\\", \\\"ID token validation returned false\\\"));\\n\\t\\t\\t}).catch((error) => Promise.reject(error));\\n\\t\\t}\\n\\t\\tdecodeJwtToken(token) {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst utf8String = this.cryptoUtils.base64URLDecode(token?.split(\\\".\\\")[1]);\\n\\t\\t\\t\\treturn JSON.parse(utf8String);\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-CRYPTO_UTIL-DIT-IV02\\\", \\\"Decoding token failed.\\\", error);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/models/store.ts\\n/**\\n\\t* Enum representing different types of data stores used in the application.\\n\\t*/\\n\\tlet Stores = /* @__PURE__ */ function(Stores$1) {\\n\\t\\t/**\\n\\t\\t* Store for configuration data that defines the application's behavior and settings.\\n\\t\\t*/\\n\\t\\tStores$1[\\\"ConfigData\\\"] = \\\"config_data\\\";\\n\\t\\t/**\\n\\t\\t* Store for OpenID Connect provider metadata, including endpoints and configuration.\\n\\t\\t*/\\n\\t\\tStores$1[\\\"OIDCProviderMetaData\\\"] = \\\"oidc_provider_meta_data\\\";\\n\\t\\t/**\\n\\t\\t* Store for persisted data that needs to be retained across sessions and application restarts.\\n\\t\\t*/\\n\\t\\tStores$1[\\\"PersistedData\\\"] = \\\"persisted_data\\\";\\n\\t\\t/**\\n\\t\\t* Store for user session-related data like tokens and authentication state.\\n\\t\\t*/\\n\\t\\tStores$1[\\\"SessionData\\\"] = \\\"session_data\\\";\\n\\t\\t/**\\n\\t\\t* Store for temporary data that needs to persist only for a short duration.\\n\\t\\t*/\\n\\t\\tStores$1[\\\"TemporaryData\\\"] = \\\"temporary_data\\\";\\n\\t\\treturn Stores$1;\\n\\t}({});\\n\\n//#endregion\\n//#region ../javascript/src/StorageManager.ts\\n\\tconst ASGARDEO_SESSION_ACTIVE = \\\"thunderid-session-active\\\";\\n\\tvar StorageManager = class StorageManager {\\n\\t\\tid;\\n\\t\\tstore;\\n\\t\\tconstructor(instanceID, store) {\\n\\t\\t\\tthis.id = instanceID;\\n\\t\\t\\tthis.store = store;\\n\\t\\t}\\n\\t\\tasync setDataInBulk(key, data) {\\n\\t\\t\\tconst existingDataJSON = await this.store.getData(key) ?? null;\\n\\t\\t\\tconst dataToBeSaved = {\\n\\t\\t\\t\\t...existingDataJSON && JSON.parse(existingDataJSON),\\n\\t\\t\\t\\t...data\\n\\t\\t\\t};\\n\\t\\t\\tconst dataToBeSavedJSON = JSON.stringify(dataToBeSaved);\\n\\t\\t\\tawait this.store.setData(key, dataToBeSavedJSON);\\n\\t\\t}\\n\\t\\tasync setValue(key, attribute, value) {\\n\\t\\t\\tconst existingDataJSON = await this.store.getData(key) ?? null;\\n\\t\\t\\tconst dataToBeSaved = {\\n\\t\\t\\t\\t...existingDataJSON && JSON.parse(existingDataJSON),\\n\\t\\t\\t\\t[attribute]: value\\n\\t\\t\\t};\\n\\t\\t\\tconst dataToBeSavedJSON = JSON.stringify(dataToBeSaved);\\n\\t\\t\\tawait this.store.setData(key, dataToBeSavedJSON);\\n\\t\\t}\\n\\t\\tasync removeValue(key, attribute) {\\n\\t\\t\\tconst existingDataJSON = await this.store.getData(key) ?? null;\\n\\t\\t\\tconst dataToBeSaved = { ...existingDataJSON && JSON.parse(existingDataJSON) };\\n\\t\\t\\tdelete dataToBeSaved[attribute];\\n\\t\\t\\tconst dataToBeSavedJSON = JSON.stringify(dataToBeSaved);\\n\\t\\t\\tawait this.store.setData(key, dataToBeSavedJSON);\\n\\t\\t}\\n\\t\\tresolveKey(store, userId, instanceId) {\\n\\t\\t\\tif (userId && instanceId) return `${store}-${instanceId}-${userId}`;\\n\\t\\t\\tif (userId) return `${store}-${this.id}-${userId}`;\\n\\t\\t\\tif (instanceId) return `${store}-${instanceId}`;\\n\\t\\t\\treturn `${store}-${this.id}`;\\n\\t\\t}\\n\\t\\tstatic isLocalStorageAvailable() {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst testValue = \\\"__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__\\\";\\n\\t\\t\\t\\tlocalStorage.setItem(testValue, testValue);\\n\\t\\t\\t\\tlocalStorage.removeItem(testValue);\\n\\t\\t\\t\\treturn true;\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\treturn false;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tasync setConfigData(config) {\\n\\t\\t\\tawait this.setDataInBulk(this.resolveKey(Stores.ConfigData), config);\\n\\t\\t}\\n\\t\\tasync setOIDCProviderMetaData(oidcProviderMetaData) {\\n\\t\\t\\tthis.setDataInBulk(this.resolveKey(Stores.OIDCProviderMetaData), oidcProviderMetaData);\\n\\t\\t}\\n\\t\\tasync setTemporaryData(temporaryData, userId) {\\n\\t\\t\\tthis.setDataInBulk(this.resolveKey(Stores.TemporaryData, userId), temporaryData);\\n\\t\\t}\\n\\t\\tasync setSessionData(sessionData, userId) {\\n\\t\\t\\tthis.setDataInBulk(this.resolveKey(Stores.SessionData, userId), sessionData);\\n\\t\\t}\\n\\t\\tasync setCustomData(key, customData, userId) {\\n\\t\\t\\tthis.setDataInBulk(this.resolveKey(key, userId), customData);\\n\\t\\t}\\n\\t\\tasync getConfigData(userId) {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(Stores.ConfigData, userId)) ?? null);\\n\\t\\t}\\n\\t\\tasync loadOpenIDProviderConfiguration() {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData)) ?? null);\\n\\t\\t}\\n\\t\\tasync getTemporaryData(userId) {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(Stores.TemporaryData, userId)) ?? null);\\n\\t\\t}\\n\\t\\tasync getPersistedData(userId) {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(Stores.PersistedData, userId)) ?? null);\\n\\t\\t}\\n\\t\\tasync setPersistedData(persistedData, userId) {\\n\\t\\t\\tthis.setDataInBulk(this.resolveKey(Stores.PersistedData, userId), persistedData);\\n\\t\\t}\\n\\t\\tasync getSessionData(userId, instanceId) {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(Stores.SessionData, userId, instanceId)) ?? null);\\n\\t\\t}\\n\\t\\tasync getCustomData(key, userId) {\\n\\t\\t\\treturn JSON.parse(await this.store.getData(this.resolveKey(key, userId)) ?? null);\\n\\t\\t}\\n\\t\\tsetSessionStatus(status) {\\n\\t\\t\\tif (StorageManager.isLocalStorageAvailable()) localStorage.setItem(`${ASGARDEO_SESSION_ACTIVE}`, status);\\n\\t\\t}\\n\\t\\tgetSessionStatus() {\\n\\t\\t\\treturn StorageManager.isLocalStorageAvailable() ? localStorage.getItem(`${ASGARDEO_SESSION_ACTIVE}`) ?? \\\"\\\" : \\\"\\\";\\n\\t\\t}\\n\\t\\tremoveSessionStatus() {\\n\\t\\t\\tif (StorageManager.isLocalStorageAvailable()) localStorage.removeItem(`${ASGARDEO_SESSION_ACTIVE}`);\\n\\t\\t}\\n\\t\\tasync removeConfigData() {\\n\\t\\t\\tawait this.store.removeData(this.resolveKey(Stores.ConfigData));\\n\\t\\t}\\n\\t\\tasync removeOIDCProviderMetaData() {\\n\\t\\t\\tawait this.store.removeData(this.resolveKey(Stores.OIDCProviderMetaData));\\n\\t\\t}\\n\\t\\tasync removeTemporaryData(userId) {\\n\\t\\t\\tawait this.store.removeData(this.resolveKey(Stores.TemporaryData, userId));\\n\\t\\t}\\n\\t\\tasync removeSessionData(userId) {\\n\\t\\t\\tawait this.store.removeData(this.resolveKey(Stores.SessionData, userId));\\n\\t\\t}\\n\\t\\tasync getConfigDataParameter(key) {\\n\\t\\t\\tconst data = await this.store.getData(this.resolveKey(Stores.ConfigData));\\n\\t\\t\\treturn data && JSON.parse(data)[key];\\n\\t\\t}\\n\\t\\tasync getOIDCProviderMetaDataParameter(key) {\\n\\t\\t\\tconst data = await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData));\\n\\t\\t\\treturn data && JSON.parse(data)[key];\\n\\t\\t}\\n\\t\\tasync getTemporaryDataParameter(key, userId) {\\n\\t\\t\\tconst data = await this.store.getData(this.resolveKey(Stores.TemporaryData, userId));\\n\\t\\t\\treturn data && JSON.parse(data)[key];\\n\\t\\t}\\n\\t\\tasync getSessionDataParameter(key, userId) {\\n\\t\\t\\tconst data = await this.store.getData(this.resolveKey(Stores.SessionData, userId));\\n\\t\\t\\treturn data && JSON.parse(data)[key];\\n\\t\\t}\\n\\t\\tasync setConfigDataParameter(key, value) {\\n\\t\\t\\tawait this.setValue(this.resolveKey(Stores.ConfigData), key, value);\\n\\t\\t}\\n\\t\\tasync setOIDCProviderMetaDataParameter(key, value) {\\n\\t\\t\\tawait this.setValue(this.resolveKey(Stores.OIDCProviderMetaData), key, value);\\n\\t\\t}\\n\\t\\tasync setTemporaryDataParameter(key, value, userId) {\\n\\t\\t\\tawait this.setValue(this.resolveKey(Stores.TemporaryData, userId), key, value);\\n\\t\\t}\\n\\t\\tasync setSessionDataParameter(key, value, userId) {\\n\\t\\t\\tawait this.setValue(this.resolveKey(Stores.SessionData, userId), key, value);\\n\\t\\t}\\n\\t\\tasync removeConfigDataParameter(key) {\\n\\t\\t\\tawait this.removeValue(this.resolveKey(Stores.ConfigData), key);\\n\\t\\t}\\n\\t\\tasync removeOIDCProviderMetaDataParameter(key) {\\n\\t\\t\\tawait this.removeValue(this.resolveKey(Stores.OIDCProviderMetaData), key);\\n\\t\\t}\\n\\t\\tasync removeTemporaryDataParameter(key, userId) {\\n\\t\\t\\tawait this.removeValue(this.resolveKey(Stores.TemporaryData, userId), key);\\n\\t\\t}\\n\\t\\tasync removeSessionDataParameter(key, userId) {\\n\\t\\t\\tawait this.removeValue(this.resolveKey(Stores.SessionData, userId), key);\\n\\t\\t}\\n\\t};\\n\\tvar StorageManager_default = StorageManager;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/webcrypto.js\\n\\tvar webcrypto_default = crypto;\\n\\tconst isCryptoKey = (key) => key instanceof CryptoKey;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/buffer_utils.js\\n\\tconst encoder = new TextEncoder();\\n\\tconst decoder = new TextDecoder();\\n\\tconst MAX_INT32 = 2 ** 32;\\n\\tfunction concat(...buffers) {\\n\\t\\tconst size = buffers.reduce((acc, { length }) => acc + length, 0);\\n\\t\\tconst buf = new Uint8Array(size);\\n\\t\\tlet i$1 = 0;\\n\\t\\tbuffers.forEach((buffer$1) => {\\n\\t\\t\\tbuf.set(buffer$1, i$1);\\n\\t\\t\\ti$1 += buffer$1.length;\\n\\t\\t});\\n\\t\\treturn buf;\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/base64url.js\\n\\tconst encodeBase64 = (input) => {\\n\\t\\tlet unencoded = input;\\n\\t\\tif (typeof unencoded === \\\"string\\\") unencoded = encoder.encode(unencoded);\\n\\t\\tconst CHUNK_SIZE = 32768;\\n\\t\\tconst arr = [];\\n\\t\\tfor (let i$1 = 0; i$1 < unencoded.length; i$1 += CHUNK_SIZE) arr.push(String.fromCharCode.apply(null, unencoded.subarray(i$1, i$1 + CHUNK_SIZE)));\\n\\t\\treturn btoa(arr.join(\\\"\\\"));\\n\\t};\\n\\tconst encode$2 = (input) => {\\n\\t\\treturn encodeBase64(input).replace(/=/g, \\\"\\\").replace(/\\\\+/g, \\\"-\\\").replace(/\\\\//g, \\\"_\\\");\\n\\t};\\n\\tconst decodeBase64 = (encoded) => {\\n\\t\\tconst binary = atob(encoded);\\n\\t\\tconst bytes = new Uint8Array(binary.length);\\n\\t\\tfor (let i$1 = 0; i$1 < binary.length; i$1++) bytes[i$1] = binary.charCodeAt(i$1);\\n\\t\\treturn bytes;\\n\\t};\\n\\tconst decode$2 = (input) => {\\n\\t\\tlet encoded = input;\\n\\t\\tif (encoded instanceof Uint8Array) encoded = decoder.decode(encoded);\\n\\t\\tencoded = encoded.replace(/-/g, \\\"+\\\").replace(/_/g, \\\"/\\\").replace(/\\\\s/g, \\\"\\\");\\n\\t\\ttry {\\n\\t\\t\\treturn decodeBase64(encoded);\\n\\t\\t} catch {\\n\\t\\t\\tthrow new TypeError(\\\"The input to be decoded is not correctly encoded.\\\");\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/util/errors.js\\n\\tvar JOSEError = class extends Error {\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JOSE_GENERIC\\\";\\n\\t\\t}\\n\\t\\tconstructor(message$1) {\\n\\t\\t\\tsuper(message$1);\\n\\t\\t\\tthis.code = \\\"ERR_JOSE_GENERIC\\\";\\n\\t\\t\\tthis.name = this.constructor.name;\\n\\t\\t\\tError.captureStackTrace?.(this, this.constructor);\\n\\t\\t}\\n\\t};\\n\\tvar JWTClaimValidationFailed = class extends JOSEError {\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWT_CLAIM_VALIDATION_FAILED\\\";\\n\\t\\t}\\n\\t\\tconstructor(message$1, claim = \\\"unspecified\\\", reason = \\\"unspecified\\\") {\\n\\t\\t\\tsuper(message$1);\\n\\t\\t\\tthis.code = \\\"ERR_JWT_CLAIM_VALIDATION_FAILED\\\";\\n\\t\\t\\tthis.claim = claim;\\n\\t\\t\\tthis.reason = reason;\\n\\t\\t}\\n\\t};\\n\\tvar JWTExpired = class extends JOSEError {\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWT_EXPIRED\\\";\\n\\t\\t}\\n\\t\\tconstructor(message$1, claim = \\\"unspecified\\\", reason = \\\"unspecified\\\") {\\n\\t\\t\\tsuper(message$1);\\n\\t\\t\\tthis.code = \\\"ERR_JWT_EXPIRED\\\";\\n\\t\\t\\tthis.claim = claim;\\n\\t\\t\\tthis.reason = reason;\\n\\t\\t}\\n\\t};\\n\\tvar JOSEAlgNotAllowed = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JOSE_ALG_NOT_ALLOWED\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JOSE_ALG_NOT_ALLOWED\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JOSENotSupported = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JOSE_NOT_SUPPORTED\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JOSE_NOT_SUPPORTED\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWSInvalid = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWS_INVALID\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWS_INVALID\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWTInvalid = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWT_INVALID\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWT_INVALID\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWKSInvalid = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWKS_INVALID\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWKS_INVALID\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWKSNoMatchingKey = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWKS_NO_MATCHING_KEY\\\";\\n\\t\\t\\tthis.message = \\\"no applicable key found in the JSON Web Key Set\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWKS_NO_MATCHING_KEY\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWKSMultipleMatchingKeys = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWKS_MULTIPLE_MATCHING_KEYS\\\";\\n\\t\\t\\tthis.message = \\\"multiple matching keys found in the JSON Web Key Set\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWKS_MULTIPLE_MATCHING_KEYS\\\";\\n\\t\\t}\\n\\t};\\n\\tvar JWSSignatureVerificationFailed = class extends JOSEError {\\n\\t\\tconstructor() {\\n\\t\\t\\tsuper(...arguments);\\n\\t\\t\\tthis.code = \\\"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\\\";\\n\\t\\t\\tthis.message = \\\"signature verification failed\\\";\\n\\t\\t}\\n\\t\\tstatic get code() {\\n\\t\\t\\treturn \\\"ERR_JWS_SIGNATURE_VERIFICATION_FAILED\\\";\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/crypto_key.js\\n\\tfunction unusable(name, prop = \\\"algorithm.name\\\") {\\n\\t\\treturn /* @__PURE__ */ new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);\\n\\t}\\n\\tfunction isAlgorithm(algorithm, name) {\\n\\t\\treturn algorithm.name === name;\\n\\t}\\n\\tfunction getHashLength(hash) {\\n\\t\\treturn parseInt(hash.name.slice(4), 10);\\n\\t}\\n\\tfunction getNamedCurve(alg) {\\n\\t\\tswitch (alg) {\\n\\t\\t\\tcase \\\"ES256\\\": return \\\"P-256\\\";\\n\\t\\t\\tcase \\\"ES384\\\": return \\\"P-384\\\";\\n\\t\\t\\tcase \\\"ES512\\\": return \\\"P-521\\\";\\n\\t\\t\\tdefault: throw new Error(\\\"unreachable\\\");\\n\\t\\t}\\n\\t}\\n\\tfunction checkUsage(key, usages) {\\n\\t\\tif (usages.length && !usages.some((expected) => key.usages.includes(expected))) {\\n\\t\\t\\tlet msg = \\\"CryptoKey does not support this operation, its usages must include \\\";\\n\\t\\t\\tif (usages.length > 2) {\\n\\t\\t\\t\\tconst last = usages.pop();\\n\\t\\t\\t\\tmsg += `one of ${usages.join(\\\", \\\")}, or ${last}.`;\\n\\t\\t\\t} else if (usages.length === 2) msg += `one of ${usages[0]} or ${usages[1]}.`;\\n\\t\\t\\telse msg += `${usages[0]}.`;\\n\\t\\t\\tthrow new TypeError(msg);\\n\\t\\t}\\n\\t}\\n\\tfunction checkSigCryptoKey(key, alg, ...usages) {\\n\\t\\tswitch (alg) {\\n\\t\\t\\tcase \\\"HS256\\\":\\n\\t\\t\\tcase \\\"HS384\\\":\\n\\t\\t\\tcase \\\"HS512\\\": {\\n\\t\\t\\t\\tif (!isAlgorithm(key.algorithm, \\\"HMAC\\\")) throw unusable(\\\"HMAC\\\");\\n\\t\\t\\t\\tconst expected = parseInt(alg.slice(2), 10);\\n\\t\\t\\t\\tif (getHashLength(key.algorithm.hash) !== expected) throw unusable(`SHA-${expected}`, \\\"algorithm.hash\\\");\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tcase \\\"RS256\\\":\\n\\t\\t\\tcase \\\"RS384\\\":\\n\\t\\t\\tcase \\\"RS512\\\": {\\n\\t\\t\\t\\tif (!isAlgorithm(key.algorithm, \\\"RSASSA-PKCS1-v1_5\\\")) throw unusable(\\\"RSASSA-PKCS1-v1_5\\\");\\n\\t\\t\\t\\tconst expected = parseInt(alg.slice(2), 10);\\n\\t\\t\\t\\tif (getHashLength(key.algorithm.hash) !== expected) throw unusable(`SHA-${expected}`, \\\"algorithm.hash\\\");\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tcase \\\"PS256\\\":\\n\\t\\t\\tcase \\\"PS384\\\":\\n\\t\\t\\tcase \\\"PS512\\\": {\\n\\t\\t\\t\\tif (!isAlgorithm(key.algorithm, \\\"RSA-PSS\\\")) throw unusable(\\\"RSA-PSS\\\");\\n\\t\\t\\t\\tconst expected = parseInt(alg.slice(2), 10);\\n\\t\\t\\t\\tif (getHashLength(key.algorithm.hash) !== expected) throw unusable(`SHA-${expected}`, \\\"algorithm.hash\\\");\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tcase \\\"EdDSA\\\":\\n\\t\\t\\t\\tif (key.algorithm.name !== \\\"Ed25519\\\" && key.algorithm.name !== \\\"Ed448\\\") throw unusable(\\\"Ed25519 or Ed448\\\");\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"ES256\\\":\\n\\t\\t\\tcase \\\"ES384\\\":\\n\\t\\t\\tcase \\\"ES512\\\": {\\n\\t\\t\\t\\tif (!isAlgorithm(key.algorithm, \\\"ECDSA\\\")) throw unusable(\\\"ECDSA\\\");\\n\\t\\t\\t\\tconst expected = getNamedCurve(alg);\\n\\t\\t\\t\\tif (key.algorithm.namedCurve !== expected) throw unusable(expected, \\\"algorithm.namedCurve\\\");\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\t}\\n\\t\\t\\tdefault: throw new TypeError(\\\"CryptoKey does not support this operation\\\");\\n\\t\\t}\\n\\t\\tcheckUsage(key, usages);\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/invalid_key_input.js\\n\\tfunction message(msg, actual, ...types$1) {\\n\\t\\tif (types$1.length > 2) {\\n\\t\\t\\tconst last = types$1.pop();\\n\\t\\t\\tmsg += `one of type ${types$1.join(\\\", \\\")}, or ${last}.`;\\n\\t\\t} else if (types$1.length === 2) msg += `one of type ${types$1[0]} or ${types$1[1]}.`;\\n\\t\\telse msg += `of type ${types$1[0]}.`;\\n\\t\\tif (actual == null) msg += ` Received ${actual}`;\\n\\t\\telse if (typeof actual === \\\"function\\\" && actual.name) msg += ` Received function ${actual.name}`;\\n\\t\\telse if (typeof actual === \\\"object\\\" && actual != null) {\\n\\t\\t\\tif (actual.constructor && actual.constructor.name) msg += ` Received an instance of ${actual.constructor.name}`;\\n\\t\\t}\\n\\t\\treturn msg;\\n\\t}\\n\\tvar invalid_key_input_default = (actual, ...types$1) => {\\n\\t\\treturn message(\\\"Key must be \\\", actual, ...types$1);\\n\\t};\\n\\tfunction withAlg(alg, actual, ...types$1) {\\n\\t\\treturn message(`Key for the ${alg} algorithm must be `, actual, ...types$1);\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/is_key_like.js\\n\\tvar is_key_like_default = (key) => {\\n\\t\\treturn isCryptoKey(key);\\n\\t};\\n\\tconst types = [\\\"CryptoKey\\\"];\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/is_disjoint.js\\n\\tconst isDisjoint = (...headers) => {\\n\\t\\tconst sources = headers.filter(Boolean);\\n\\t\\tif (sources.length === 0 || sources.length === 1) return true;\\n\\t\\tlet acc;\\n\\t\\tfor (const header of sources) {\\n\\t\\t\\tconst parameters = Object.keys(header);\\n\\t\\t\\tif (!acc || acc.size === 0) {\\n\\t\\t\\t\\tacc = new Set(parameters);\\n\\t\\t\\t\\tcontinue;\\n\\t\\t\\t}\\n\\t\\t\\tfor (const parameter of parameters) {\\n\\t\\t\\t\\tif (acc.has(parameter)) return false;\\n\\t\\t\\t\\tacc.add(parameter);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\treturn true;\\n\\t};\\n\\tvar is_disjoint_default = isDisjoint;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/is_object.js\\n\\tfunction isObjectLike(value) {\\n\\t\\treturn typeof value === \\\"object\\\" && value !== null;\\n\\t}\\n\\tfunction isObject(input) {\\n\\t\\tif (!isObjectLike(input) || Object.prototype.toString.call(input) !== \\\"[object Object]\\\") return false;\\n\\t\\tif (Object.getPrototypeOf(input) === null) return true;\\n\\t\\tlet proto = input;\\n\\t\\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\\n\\t\\treturn Object.getPrototypeOf(input) === proto;\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/check_key_length.js\\n\\tvar check_key_length_default = (alg, key) => {\\n\\t\\tif (alg.startsWith(\\\"RS\\\") || alg.startsWith(\\\"PS\\\")) {\\n\\t\\t\\tconst { modulusLength } = key.algorithm;\\n\\t\\t\\tif (typeof modulusLength !== \\\"number\\\" || modulusLength < 2048) throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/jwk_to_key.js\\n\\tfunction subtleMapping(jwk) {\\n\\t\\tlet algorithm;\\n\\t\\tlet keyUsages;\\n\\t\\tswitch (jwk.kty) {\\n\\t\\t\\tcase \\\"RSA\\\":\\n\\t\\t\\t\\tswitch (jwk.alg) {\\n\\t\\t\\t\\t\\tcase \\\"PS256\\\":\\n\\t\\t\\t\\t\\tcase \\\"PS384\\\":\\n\\t\\t\\t\\t\\tcase \\\"PS512\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"RSA-PSS\\\",\\n\\t\\t\\t\\t\\t\\t\\thash: `SHA-${jwk.alg.slice(-3)}`\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"RS256\\\":\\n\\t\\t\\t\\t\\tcase \\\"RS384\\\":\\n\\t\\t\\t\\t\\tcase \\\"RS512\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"RSASSA-PKCS1-v1_5\\\",\\n\\t\\t\\t\\t\\t\\t\\thash: `SHA-${jwk.alg.slice(-3)}`\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"RSA-OAEP\\\":\\n\\t\\t\\t\\t\\tcase \\\"RSA-OAEP-256\\\":\\n\\t\\t\\t\\t\\tcase \\\"RSA-OAEP-384\\\":\\n\\t\\t\\t\\t\\tcase \\\"RSA-OAEP-512\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"RSA-OAEP\\\",\\n\\t\\t\\t\\t\\t\\t\\thash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"decrypt\\\", \\\"unwrapKey\\\"] : [\\\"encrypt\\\", \\\"wrapKey\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Invalid or unsupported JWK \\\\\\\"alg\\\\\\\" (Algorithm) Parameter value\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"EC\\\":\\n\\t\\t\\t\\tswitch (jwk.alg) {\\n\\t\\t\\t\\t\\tcase \\\"ES256\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"ECDSA\\\",\\n\\t\\t\\t\\t\\t\\t\\tnamedCurve: \\\"P-256\\\"\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ES384\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"ECDSA\\\",\\n\\t\\t\\t\\t\\t\\t\\tnamedCurve: \\\"P-384\\\"\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ES512\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"ECDSA\\\",\\n\\t\\t\\t\\t\\t\\t\\tnamedCurve: \\\"P-521\\\"\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A128KW\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A192KW\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A256KW\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = {\\n\\t\\t\\t\\t\\t\\t\\tname: \\\"ECDH\\\",\\n\\t\\t\\t\\t\\t\\t\\tnamedCurve: jwk.crv\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"deriveBits\\\"] : [];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Invalid or unsupported JWK \\\\\\\"alg\\\\\\\" (Algorithm) Parameter value\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"OKP\\\":\\n\\t\\t\\t\\tswitch (jwk.alg) {\\n\\t\\t\\t\\t\\tcase \\\"EdDSA\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = { name: jwk.crv };\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"sign\\\"] : [\\\"verify\\\"];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A128KW\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A192KW\\\":\\n\\t\\t\\t\\t\\tcase \\\"ECDH-ES+A256KW\\\":\\n\\t\\t\\t\\t\\t\\talgorithm = { name: jwk.crv };\\n\\t\\t\\t\\t\\t\\tkeyUsages = jwk.d ? [\\\"deriveBits\\\"] : [];\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Invalid or unsupported JWK \\\\\\\"alg\\\\\\\" (Algorithm) Parameter value\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Invalid or unsupported JWK \\\\\\\"kty\\\\\\\" (Key Type) Parameter value\\\");\\n\\t\\t}\\n\\t\\treturn {\\n\\t\\t\\talgorithm,\\n\\t\\t\\tkeyUsages\\n\\t\\t};\\n\\t}\\n\\tconst parse = async (jwk) => {\\n\\t\\tif (!jwk.alg) throw new TypeError(\\\"\\\\\\\"alg\\\\\\\" argument is required when \\\\\\\"jwk.alg\\\\\\\" is not present\\\");\\n\\t\\tconst { algorithm, keyUsages } = subtleMapping(jwk);\\n\\t\\tconst rest = [\\n\\t\\t\\talgorithm,\\n\\t\\t\\tjwk.ext ?? false,\\n\\t\\t\\tjwk.key_ops ?? keyUsages\\n\\t\\t];\\n\\t\\tconst keyData = { ...jwk };\\n\\t\\tdelete keyData.alg;\\n\\t\\tdelete keyData.use;\\n\\t\\treturn webcrypto_default.subtle.importKey(\\\"jwk\\\", keyData, ...rest);\\n\\t};\\n\\tvar jwk_to_key_default = parse;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/key/import.js\\n\\tasync function importJWK(jwk, alg) {\\n\\t\\tif (!isObject(jwk)) throw new TypeError(\\\"JWK must be an object\\\");\\n\\t\\talg || (alg = jwk.alg);\\n\\t\\tswitch (jwk.kty) {\\n\\t\\t\\tcase \\\"oct\\\":\\n\\t\\t\\t\\tif (typeof jwk.k !== \\\"string\\\" || !jwk.k) throw new TypeError(\\\"missing \\\\\\\"k\\\\\\\" (Key Value) Parameter value\\\");\\n\\t\\t\\t\\treturn decode$2(jwk.k);\\n\\t\\t\\tcase \\\"RSA\\\": if (jwk.oth !== void 0) throw new JOSENotSupported(\\\"RSA JWK \\\\\\\"oth\\\\\\\" (Other Primes Info) Parameter value is not supported\\\");\\n\\t\\t\\tcase \\\"EC\\\":\\n\\t\\t\\tcase \\\"OKP\\\": return jwk_to_key_default({\\n\\t\\t\\t\\t...jwk,\\n\\t\\t\\t\\talg\\n\\t\\t\\t});\\n\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Unsupported \\\\\\\"kty\\\\\\\" (Key Type) Parameter value\\\");\\n\\t\\t}\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/check_key_type.js\\n\\tconst symmetricTypeCheck = (alg, key) => {\\n\\t\\tif (key instanceof Uint8Array) return;\\n\\t\\tif (!is_key_like_default(key)) throw new TypeError(withAlg(alg, key, ...types, \\\"Uint8Array\\\"));\\n\\t\\tif (key.type !== \\\"secret\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for symmetric algorithms must be of type \\\"secret\\\"`);\\n\\t};\\n\\tconst asymmetricTypeCheck = (alg, key, usage) => {\\n\\t\\tif (!is_key_like_default(key)) throw new TypeError(withAlg(alg, key, ...types));\\n\\t\\tif (key.type === \\\"secret\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for asymmetric algorithms must not be of type \\\"secret\\\"`);\\n\\t\\tif (usage === \\\"sign\\\" && key.type === \\\"public\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for asymmetric algorithm signing must be of type \\\"private\\\"`);\\n\\t\\tif (usage === \\\"decrypt\\\" && key.type === \\\"public\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for asymmetric algorithm decryption must be of type \\\"private\\\"`);\\n\\t\\tif (key.algorithm && usage === \\\"verify\\\" && key.type === \\\"private\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for asymmetric algorithm verifying must be of type \\\"public\\\"`);\\n\\t\\tif (key.algorithm && usage === \\\"encrypt\\\" && key.type === \\\"private\\\") throw new TypeError(`${types.join(\\\" or \\\")} instances for asymmetric algorithm encryption must be of type \\\"public\\\"`);\\n\\t};\\n\\tconst checkKeyType = (alg, key, usage) => {\\n\\t\\tif (alg.startsWith(\\\"HS\\\") || alg === \\\"dir\\\" || alg.startsWith(\\\"PBES2\\\") || /^A\\\\d{3}(?:GCM)?KW$/.test(alg)) symmetricTypeCheck(alg, key);\\n\\t\\telse asymmetricTypeCheck(alg, key, usage);\\n\\t};\\n\\tvar check_key_type_default = checkKeyType;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/validate_crit.js\\n\\tfunction validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {\\n\\t\\tif (joseHeader.crit !== void 0 && protectedHeader.crit === void 0) throw new Err(\\\"\\\\\\\"crit\\\\\\\" (Critical) Header Parameter MUST be integrity protected\\\");\\n\\t\\tif (!protectedHeader || protectedHeader.crit === void 0) return /* @__PURE__ */ new Set();\\n\\t\\tif (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== \\\"string\\\" || input.length === 0)) throw new Err(\\\"\\\\\\\"crit\\\\\\\" (Critical) Header Parameter MUST be an array of non-empty strings when present\\\");\\n\\t\\tlet recognized;\\n\\t\\tif (recognizedOption !== void 0) recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);\\n\\t\\telse recognized = recognizedDefault;\\n\\t\\tfor (const parameter of protectedHeader.crit) {\\n\\t\\t\\tif (!recognized.has(parameter)) throw new JOSENotSupported(`Extension Header Parameter \\\"${parameter}\\\" is not recognized`);\\n\\t\\t\\tif (joseHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \\\"${parameter}\\\" is missing`);\\n\\t\\t\\telse if (recognized.get(parameter) && protectedHeader[parameter] === void 0) throw new Err(`Extension Header Parameter \\\"${parameter}\\\" MUST be integrity protected`);\\n\\t\\t}\\n\\t\\treturn new Set(protectedHeader.crit);\\n\\t}\\n\\tvar validate_crit_default = validateCrit;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/validate_algorithms.js\\n\\tconst validateAlgorithms = (option, algorithms) => {\\n\\t\\tif (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== \\\"string\\\"))) throw new TypeError(`\\\"${option}\\\" option must be an array of strings`);\\n\\t\\tif (!algorithms) return;\\n\\t\\treturn new Set(algorithms);\\n\\t};\\n\\tvar validate_algorithms_default = validateAlgorithms;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/subtle_dsa.js\\n\\tfunction subtleDsa(alg, algorithm) {\\n\\t\\tconst hash = `SHA-${alg.slice(-3)}`;\\n\\t\\tswitch (alg) {\\n\\t\\t\\tcase \\\"HS256\\\":\\n\\t\\t\\tcase \\\"HS384\\\":\\n\\t\\t\\tcase \\\"HS512\\\": return {\\n\\t\\t\\t\\thash,\\n\\t\\t\\t\\tname: \\\"HMAC\\\"\\n\\t\\t\\t};\\n\\t\\t\\tcase \\\"PS256\\\":\\n\\t\\t\\tcase \\\"PS384\\\":\\n\\t\\t\\tcase \\\"PS512\\\": return {\\n\\t\\t\\t\\thash,\\n\\t\\t\\t\\tname: \\\"RSA-PSS\\\",\\n\\t\\t\\t\\tsaltLength: alg.slice(-3) >> 3\\n\\t\\t\\t};\\n\\t\\t\\tcase \\\"RS256\\\":\\n\\t\\t\\tcase \\\"RS384\\\":\\n\\t\\t\\tcase \\\"RS512\\\": return {\\n\\t\\t\\t\\thash,\\n\\t\\t\\t\\tname: \\\"RSASSA-PKCS1-v1_5\\\"\\n\\t\\t\\t};\\n\\t\\t\\tcase \\\"ES256\\\":\\n\\t\\t\\tcase \\\"ES384\\\":\\n\\t\\t\\tcase \\\"ES512\\\": return {\\n\\t\\t\\t\\thash,\\n\\t\\t\\t\\tname: \\\"ECDSA\\\",\\n\\t\\t\\t\\tnamedCurve: algorithm.namedCurve\\n\\t\\t\\t};\\n\\t\\t\\tcase \\\"EdDSA\\\": return { name: algorithm.name };\\n\\t\\t\\tdefault: throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);\\n\\t\\t}\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/get_sign_verify_key.js\\n\\tfunction getCryptoKey(alg, key, usage) {\\n\\t\\tif (isCryptoKey(key)) {\\n\\t\\t\\tcheckSigCryptoKey(key, alg, usage);\\n\\t\\t\\treturn key;\\n\\t\\t}\\n\\t\\tif (key instanceof Uint8Array) {\\n\\t\\t\\tif (!alg.startsWith(\\\"HS\\\")) throw new TypeError(invalid_key_input_default(key, ...types));\\n\\t\\t\\treturn webcrypto_default.subtle.importKey(\\\"raw\\\", key, {\\n\\t\\t\\t\\thash: `SHA-${alg.slice(-3)}`,\\n\\t\\t\\t\\tname: \\\"HMAC\\\"\\n\\t\\t\\t}, false, [usage]);\\n\\t\\t}\\n\\t\\tthrow new TypeError(invalid_key_input_default(key, ...types, \\\"Uint8Array\\\"));\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/runtime/verify.js\\n\\tconst verify = async (alg, key, signature, data) => {\\n\\t\\tconst cryptoKey = await getCryptoKey(alg, key, \\\"verify\\\");\\n\\t\\tcheck_key_length_default(alg, cryptoKey);\\n\\t\\tconst algorithm = subtleDsa(alg, cryptoKey.algorithm);\\n\\t\\ttry {\\n\\t\\t\\treturn await webcrypto_default.subtle.verify(algorithm, cryptoKey, signature, data);\\n\\t\\t} catch {\\n\\t\\t\\treturn false;\\n\\t\\t}\\n\\t};\\n\\tvar verify_default = verify;\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/jws/flattened/verify.js\\n\\tasync function flattenedVerify(jws, key, options) {\\n\\t\\tif (!isObject(jws)) throw new JWSInvalid(\\\"Flattened JWS must be an object\\\");\\n\\t\\tif (jws.protected === void 0 && jws.header === void 0) throw new JWSInvalid(\\\"Flattened JWS must have either of the \\\\\\\"protected\\\\\\\" or \\\\\\\"header\\\\\\\" members\\\");\\n\\t\\tif (jws.protected !== void 0 && typeof jws.protected !== \\\"string\\\") throw new JWSInvalid(\\\"JWS Protected Header incorrect type\\\");\\n\\t\\tif (jws.payload === void 0) throw new JWSInvalid(\\\"JWS Payload missing\\\");\\n\\t\\tif (typeof jws.signature !== \\\"string\\\") throw new JWSInvalid(\\\"JWS Signature missing or incorrect type\\\");\\n\\t\\tif (jws.header !== void 0 && !isObject(jws.header)) throw new JWSInvalid(\\\"JWS Unprotected Header incorrect type\\\");\\n\\t\\tlet parsedProt = {};\\n\\t\\tif (jws.protected) try {\\n\\t\\t\\tconst protectedHeader = decode$2(jws.protected);\\n\\t\\t\\tparsedProt = JSON.parse(decoder.decode(protectedHeader));\\n\\t\\t} catch {\\n\\t\\t\\tthrow new JWSInvalid(\\\"JWS Protected Header is invalid\\\");\\n\\t\\t}\\n\\t\\tif (!is_disjoint_default(parsedProt, jws.header)) throw new JWSInvalid(\\\"JWS Protected and JWS Unprotected Header Parameter names must be disjoint\\\");\\n\\t\\tconst joseHeader = {\\n\\t\\t\\t...parsedProt,\\n\\t\\t\\t...jws.header\\n\\t\\t};\\n\\t\\tconst extensions = validate_crit_default(JWSInvalid, new Map([[\\\"b64\\\", true]]), options?.crit, parsedProt, joseHeader);\\n\\t\\tlet b64 = true;\\n\\t\\tif (extensions.has(\\\"b64\\\")) {\\n\\t\\t\\tb64 = parsedProt.b64;\\n\\t\\t\\tif (typeof b64 !== \\\"boolean\\\") throw new JWSInvalid(\\\"The \\\\\\\"b64\\\\\\\" (base64url-encode payload) Header Parameter must be a boolean\\\");\\n\\t\\t}\\n\\t\\tconst { alg } = joseHeader;\\n\\t\\tif (typeof alg !== \\\"string\\\" || !alg) throw new JWSInvalid(\\\"JWS \\\\\\\"alg\\\\\\\" (Algorithm) Header Parameter missing or invalid\\\");\\n\\t\\tconst algorithms = options && validate_algorithms_default(\\\"algorithms\\\", options.algorithms);\\n\\t\\tif (algorithms && !algorithms.has(alg)) throw new JOSEAlgNotAllowed(\\\"\\\\\\\"alg\\\\\\\" (Algorithm) Header Parameter value not allowed\\\");\\n\\t\\tif (b64) {\\n\\t\\t\\tif (typeof jws.payload !== \\\"string\\\") throw new JWSInvalid(\\\"JWS Payload must be a string\\\");\\n\\t\\t} else if (typeof jws.payload !== \\\"string\\\" && !(jws.payload instanceof Uint8Array)) throw new JWSInvalid(\\\"JWS Payload must be a string or an Uint8Array instance\\\");\\n\\t\\tlet resolvedKey = false;\\n\\t\\tif (typeof key === \\\"function\\\") {\\n\\t\\t\\tkey = await key(parsedProt, jws);\\n\\t\\t\\tresolvedKey = true;\\n\\t\\t}\\n\\t\\tcheck_key_type_default(alg, key, \\\"verify\\\");\\n\\t\\tconst data = concat(encoder.encode(jws.protected ?? \\\"\\\"), encoder.encode(\\\".\\\"), typeof jws.payload === \\\"string\\\" ? encoder.encode(jws.payload) : jws.payload);\\n\\t\\tlet signature;\\n\\t\\ttry {\\n\\t\\t\\tsignature = decode$2(jws.signature);\\n\\t\\t} catch {\\n\\t\\t\\tthrow new JWSInvalid(\\\"Failed to base64url decode the signature\\\");\\n\\t\\t}\\n\\t\\tif (!await verify_default(alg, key, signature, data)) throw new JWSSignatureVerificationFailed();\\n\\t\\tlet payload;\\n\\t\\tif (b64) try {\\n\\t\\t\\tpayload = decode$2(jws.payload);\\n\\t\\t} catch {\\n\\t\\t\\tthrow new JWSInvalid(\\\"Failed to base64url decode the payload\\\");\\n\\t\\t}\\n\\t\\telse if (typeof jws.payload === \\\"string\\\") payload = encoder.encode(jws.payload);\\n\\t\\telse payload = jws.payload;\\n\\t\\tconst result = { payload };\\n\\t\\tif (jws.protected !== void 0) result.protectedHeader = parsedProt;\\n\\t\\tif (jws.header !== void 0) result.unprotectedHeader = jws.header;\\n\\t\\tif (resolvedKey) return {\\n\\t\\t\\t...result,\\n\\t\\t\\tkey\\n\\t\\t};\\n\\t\\treturn result;\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/jws/compact/verify.js\\n\\tasync function compactVerify(jws, key, options) {\\n\\t\\tif (jws instanceof Uint8Array) jws = decoder.decode(jws);\\n\\t\\tif (typeof jws !== \\\"string\\\") throw new JWSInvalid(\\\"Compact JWS must be a string or Uint8Array\\\");\\n\\t\\tconst { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(\\\".\\\");\\n\\t\\tif (length !== 3) throw new JWSInvalid(\\\"Invalid Compact JWS\\\");\\n\\t\\tconst verified = await flattenedVerify({\\n\\t\\t\\tpayload,\\n\\t\\t\\tprotected: protectedHeader,\\n\\t\\t\\tsignature\\n\\t\\t}, key, options);\\n\\t\\tconst result = {\\n\\t\\t\\tpayload: verified.payload,\\n\\t\\t\\tprotectedHeader: verified.protectedHeader\\n\\t\\t};\\n\\t\\tif (typeof key === \\\"function\\\") return {\\n\\t\\t\\t...result,\\n\\t\\t\\tkey: verified.key\\n\\t\\t};\\n\\t\\treturn result;\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/epoch.js\\n\\tvar epoch_default = (date) => Math.floor(date.getTime() / 1e3);\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/secs.js\\n\\tconst minute = 60;\\n\\tconst hour = minute * 60;\\n\\tconst day = hour * 24;\\n\\tconst week = day * 7;\\n\\tconst year = day * 365.25;\\n\\tconst REGEX = /^(\\\\+|\\\\-)? ?(\\\\d+|\\\\d+\\\\.\\\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;\\n\\tvar secs_default = (str) => {\\n\\t\\tconst matched = REGEX.exec(str);\\n\\t\\tif (!matched || matched[4] && matched[1]) throw new TypeError(\\\"Invalid time period format\\\");\\n\\t\\tconst value = parseFloat(matched[2]);\\n\\t\\tconst unit = matched[3].toLowerCase();\\n\\t\\tlet numericDate;\\n\\t\\tswitch (unit) {\\n\\t\\t\\tcase \\\"sec\\\":\\n\\t\\t\\tcase \\\"secs\\\":\\n\\t\\t\\tcase \\\"second\\\":\\n\\t\\t\\tcase \\\"seconds\\\":\\n\\t\\t\\tcase \\\"s\\\":\\n\\t\\t\\t\\tnumericDate = Math.round(value);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"minute\\\":\\n\\t\\t\\tcase \\\"minutes\\\":\\n\\t\\t\\tcase \\\"min\\\":\\n\\t\\t\\tcase \\\"mins\\\":\\n\\t\\t\\tcase \\\"m\\\":\\n\\t\\t\\t\\tnumericDate = Math.round(value * minute);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"hour\\\":\\n\\t\\t\\tcase \\\"hours\\\":\\n\\t\\t\\tcase \\\"hr\\\":\\n\\t\\t\\tcase \\\"hrs\\\":\\n\\t\\t\\tcase \\\"h\\\":\\n\\t\\t\\t\\tnumericDate = Math.round(value * hour);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"day\\\":\\n\\t\\t\\tcase \\\"days\\\":\\n\\t\\t\\tcase \\\"d\\\":\\n\\t\\t\\t\\tnumericDate = Math.round(value * day);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"week\\\":\\n\\t\\t\\tcase \\\"weeks\\\":\\n\\t\\t\\tcase \\\"w\\\":\\n\\t\\t\\t\\tnumericDate = Math.round(value * week);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tdefault:\\n\\t\\t\\t\\tnumericDate = Math.round(value * year);\\n\\t\\t\\t\\tbreak;\\n\\t\\t}\\n\\t\\tif (matched[1] === \\\"-\\\" || matched[4] === \\\"ago\\\") return -numericDate;\\n\\t\\treturn numericDate;\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/lib/jwt_claims_set.js\\n\\tconst normalizeTyp = (value) => value.toLowerCase().replace(/^application\\\\//, \\\"\\\");\\n\\tconst checkAudiencePresence = (audPayload, audOption) => {\\n\\t\\tif (typeof audPayload === \\\"string\\\") return audOption.includes(audPayload);\\n\\t\\tif (Array.isArray(audPayload)) return audOption.some(Set.prototype.has.bind(new Set(audPayload)));\\n\\t\\treturn false;\\n\\t};\\n\\tvar jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {\\n\\t\\tconst { typ } = options;\\n\\t\\tif (typ && (typeof protectedHeader.typ !== \\\"string\\\" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) throw new JWTClaimValidationFailed(\\\"unexpected \\\\\\\"typ\\\\\\\" JWT header value\\\", \\\"typ\\\", \\\"check_failed\\\");\\n\\t\\tlet payload;\\n\\t\\ttry {\\n\\t\\t\\tpayload = JSON.parse(decoder.decode(encodedPayload));\\n\\t\\t} catch {}\\n\\t\\tif (!isObject(payload)) throw new JWTInvalid(\\\"JWT Claims Set must be a top-level JSON object\\\");\\n\\t\\tconst { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;\\n\\t\\tconst presenceCheck = [...requiredClaims];\\n\\t\\tif (maxTokenAge !== void 0) presenceCheck.push(\\\"iat\\\");\\n\\t\\tif (audience !== void 0) presenceCheck.push(\\\"aud\\\");\\n\\t\\tif (subject !== void 0) presenceCheck.push(\\\"sub\\\");\\n\\t\\tif (issuer !== void 0) presenceCheck.push(\\\"iss\\\");\\n\\t\\tfor (const claim of new Set(presenceCheck.reverse())) if (!(claim in payload)) throw new JWTClaimValidationFailed(`missing required \\\"${claim}\\\" claim`, claim, \\\"missing\\\");\\n\\t\\tif (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) throw new JWTClaimValidationFailed(\\\"unexpected \\\\\\\"iss\\\\\\\" claim value\\\", \\\"iss\\\", \\\"check_failed\\\");\\n\\t\\tif (subject && payload.sub !== subject) throw new JWTClaimValidationFailed(\\\"unexpected \\\\\\\"sub\\\\\\\" claim value\\\", \\\"sub\\\", \\\"check_failed\\\");\\n\\t\\tif (audience && !checkAudiencePresence(payload.aud, typeof audience === \\\"string\\\" ? [audience] : audience)) throw new JWTClaimValidationFailed(\\\"unexpected \\\\\\\"aud\\\\\\\" claim value\\\", \\\"aud\\\", \\\"check_failed\\\");\\n\\t\\tlet tolerance;\\n\\t\\tswitch (typeof options.clockTolerance) {\\n\\t\\t\\tcase \\\"string\\\":\\n\\t\\t\\t\\ttolerance = secs_default(options.clockTolerance);\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"number\\\":\\n\\t\\t\\t\\ttolerance = options.clockTolerance;\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tcase \\\"undefined\\\":\\n\\t\\t\\t\\ttolerance = 0;\\n\\t\\t\\t\\tbreak;\\n\\t\\t\\tdefault: throw new TypeError(\\\"Invalid clockTolerance option type\\\");\\n\\t\\t}\\n\\t\\tconst { currentDate } = options;\\n\\t\\tconst now = epoch_default(currentDate || /* @__PURE__ */ new Date());\\n\\t\\tif ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== \\\"number\\\") throw new JWTClaimValidationFailed(\\\"\\\\\\\"iat\\\\\\\" claim must be a number\\\", \\\"iat\\\", \\\"invalid\\\");\\n\\t\\tif (payload.nbf !== void 0) {\\n\\t\\t\\tif (typeof payload.nbf !== \\\"number\\\") throw new JWTClaimValidationFailed(\\\"\\\\\\\"nbf\\\\\\\" claim must be a number\\\", \\\"nbf\\\", \\\"invalid\\\");\\n\\t\\t\\tif (payload.nbf > now + tolerance) throw new JWTClaimValidationFailed(\\\"\\\\\\\"nbf\\\\\\\" claim timestamp check failed\\\", \\\"nbf\\\", \\\"check_failed\\\");\\n\\t\\t}\\n\\t\\tif (payload.exp !== void 0) {\\n\\t\\t\\tif (typeof payload.exp !== \\\"number\\\") throw new JWTClaimValidationFailed(\\\"\\\\\\\"exp\\\\\\\" claim must be a number\\\", \\\"exp\\\", \\\"invalid\\\");\\n\\t\\t\\tif (payload.exp <= now - tolerance) throw new JWTExpired(\\\"\\\\\\\"exp\\\\\\\" claim timestamp check failed\\\", \\\"exp\\\", \\\"check_failed\\\");\\n\\t\\t}\\n\\t\\tif (maxTokenAge) {\\n\\t\\t\\tconst age = now - payload.iat;\\n\\t\\t\\tconst max = typeof maxTokenAge === \\\"number\\\" ? maxTokenAge : secs_default(maxTokenAge);\\n\\t\\t\\tif (age - tolerance > max) throw new JWTExpired(\\\"\\\\\\\"iat\\\\\\\" claim timestamp check failed (too far in the past)\\\", \\\"iat\\\", \\\"check_failed\\\");\\n\\t\\t\\tif (age < 0 - tolerance) throw new JWTClaimValidationFailed(\\\"\\\\\\\"iat\\\\\\\" claim timestamp check failed (it should be in the past)\\\", \\\"iat\\\", \\\"check_failed\\\");\\n\\t\\t}\\n\\t\\treturn payload;\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/jwt/verify.js\\n\\tasync function jwtVerify(jwt, key, options) {\\n\\t\\tconst verified = await compactVerify(jwt, key, options);\\n\\t\\tif (verified.protectedHeader.crit?.includes(\\\"b64\\\") && verified.protectedHeader.b64 === false) throw new JWTInvalid(\\\"JWTs MUST NOT use unencoded payload\\\");\\n\\t\\tconst result = {\\n\\t\\t\\tpayload: jwt_claims_set_default(verified.protectedHeader, verified.payload, options),\\n\\t\\t\\tprotectedHeader: verified.protectedHeader\\n\\t\\t};\\n\\t\\tif (typeof key === \\\"function\\\") return {\\n\\t\\t\\t...result,\\n\\t\\t\\tkey: verified.key\\n\\t\\t};\\n\\t\\treturn result;\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/jwks/local.js\\n\\tfunction getKtyFromAlg(alg) {\\n\\t\\tswitch (typeof alg === \\\"string\\\" && alg.slice(0, 2)) {\\n\\t\\t\\tcase \\\"RS\\\":\\n\\t\\t\\tcase \\\"PS\\\": return \\\"RSA\\\";\\n\\t\\t\\tcase \\\"ES\\\": return \\\"EC\\\";\\n\\t\\t\\tcase \\\"Ed\\\": return \\\"OKP\\\";\\n\\t\\t\\tdefault: throw new JOSENotSupported(\\\"Unsupported \\\\\\\"alg\\\\\\\" value for a JSON Web Key Set\\\");\\n\\t\\t}\\n\\t}\\n\\tfunction isJWKSLike(jwks) {\\n\\t\\treturn jwks && typeof jwks === \\\"object\\\" && Array.isArray(jwks.keys) && jwks.keys.every(isJWKLike);\\n\\t}\\n\\tfunction isJWKLike(key) {\\n\\t\\treturn isObject(key);\\n\\t}\\n\\tfunction clone(obj) {\\n\\t\\tif (typeof structuredClone === \\\"function\\\") return structuredClone(obj);\\n\\t\\treturn JSON.parse(JSON.stringify(obj));\\n\\t}\\n\\tvar LocalJWKSet = class {\\n\\t\\tconstructor(jwks) {\\n\\t\\t\\tthis._cached = /* @__PURE__ */ new WeakMap();\\n\\t\\t\\tif (!isJWKSLike(jwks)) throw new JWKSInvalid(\\\"JSON Web Key Set malformed\\\");\\n\\t\\t\\tthis._jwks = clone(jwks);\\n\\t\\t}\\n\\t\\tasync getKey(protectedHeader, token) {\\n\\t\\t\\tconst { alg, kid } = {\\n\\t\\t\\t\\t...protectedHeader,\\n\\t\\t\\t\\t...token?.header\\n\\t\\t\\t};\\n\\t\\t\\tconst kty = getKtyFromAlg(alg);\\n\\t\\t\\tconst candidates = this._jwks.keys.filter((jwk$1) => {\\n\\t\\t\\t\\tlet candidate = kty === jwk$1.kty;\\n\\t\\t\\t\\tif (candidate && typeof kid === \\\"string\\\") candidate = kid === jwk$1.kid;\\n\\t\\t\\t\\tif (candidate && typeof jwk$1.alg === \\\"string\\\") candidate = alg === jwk$1.alg;\\n\\t\\t\\t\\tif (candidate && typeof jwk$1.use === \\\"string\\\") candidate = jwk$1.use === \\\"sig\\\";\\n\\t\\t\\t\\tif (candidate && Array.isArray(jwk$1.key_ops)) candidate = jwk$1.key_ops.includes(\\\"verify\\\");\\n\\t\\t\\t\\tif (candidate && alg === \\\"EdDSA\\\") candidate = jwk$1.crv === \\\"Ed25519\\\" || jwk$1.crv === \\\"Ed448\\\";\\n\\t\\t\\t\\tif (candidate) switch (alg) {\\n\\t\\t\\t\\t\\tcase \\\"ES256\\\":\\n\\t\\t\\t\\t\\t\\tcandidate = jwk$1.crv === \\\"P-256\\\";\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ES256K\\\":\\n\\t\\t\\t\\t\\t\\tcandidate = jwk$1.crv === \\\"secp256k1\\\";\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ES384\\\":\\n\\t\\t\\t\\t\\t\\tcandidate = jwk$1.crv === \\\"P-384\\\";\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"ES512\\\":\\n\\t\\t\\t\\t\\t\\tcandidate = jwk$1.crv === \\\"P-521\\\";\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn candidate;\\n\\t\\t\\t});\\n\\t\\t\\tconst { 0: jwk, length } = candidates;\\n\\t\\t\\tif (length === 0) throw new JWKSNoMatchingKey();\\n\\t\\t\\telse if (length !== 1) {\\n\\t\\t\\t\\tconst error = new JWKSMultipleMatchingKeys();\\n\\t\\t\\t\\tconst { _cached } = this;\\n\\t\\t\\t\\terror[Symbol.asyncIterator] = async function* () {\\n\\t\\t\\t\\t\\tfor (const jwk$1 of candidates) try {\\n\\t\\t\\t\\t\\t\\tyield await importWithAlgCache(_cached, jwk$1, alg);\\n\\t\\t\\t\\t\\t} catch {\\n\\t\\t\\t\\t\\t\\tcontinue;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tthrow error;\\n\\t\\t\\t}\\n\\t\\t\\treturn importWithAlgCache(this._cached, jwk, alg);\\n\\t\\t}\\n\\t};\\n\\tasync function importWithAlgCache(cache, jwk, alg) {\\n\\t\\tconst cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);\\n\\t\\tif (cached[alg] === void 0) {\\n\\t\\t\\tconst key = await importJWK({\\n\\t\\t\\t\\t...jwk,\\n\\t\\t\\t\\text: true\\n\\t\\t\\t}, alg);\\n\\t\\t\\tif (key instanceof Uint8Array || key.type !== \\\"public\\\") throw new JWKSInvalid(\\\"JSON Web Key Set members must be public keys\\\");\\n\\t\\t\\tcached[alg] = key;\\n\\t\\t}\\n\\t\\treturn cached[alg];\\n\\t}\\n\\tfunction createLocalJWKSet(jwks) {\\n\\t\\tconst set = new LocalJWKSet(jwks);\\n\\t\\treturn async function(protectedHeader, token) {\\n\\t\\t\\treturn set.getKey(protectedHeader, token);\\n\\t\\t};\\n\\t}\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/jose@5.2.0/node_modules/jose/dist/browser/util/base64url.js\\n\\tconst encode$1 = encode$2;\\n\\tconst decode$1 = decode$2;\\n\\n//#endregion\\n//#region ../javascript/src/utils/base64Encode.ts\\n/**\\n\\t* Encodes a string to standard base64 using `jose` (already a package dependency).\\n\\t*\\n\\t* `jose.base64url.encode` is environment-agnostic (browser, Node.js, Deno, Bun,\\n\\t* edge/service-worker runtimes). It produces base64url output, which is then\\n\\t* converted to standard base64 by restoring the `+`/`/` characters and adding\\n\\t* `=` padding.\\n\\t*\\n\\t* @param value - The UTF-8 string to encode.\\n\\t* @returns The standard base64-encoded string (with `+`, `/`, and `=` padding).\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* base64Encode('clientId:clientSecret'); // \\\"Y2xpZW50SWQ6Y2xpZW50U2VjcmV0\\\"\\n\\t* ```\\n\\t*/\\n\\tconst base64Encode = (value) => {\\n\\t\\tconst b64url = encode$1(new TextEncoder().encode(value));\\n\\t\\tconst rem = b64url.length % 4;\\n\\t\\treturn (rem === 0 ? b64url : b64url + \\\"=\\\".repeat(4 - rem)).replace(/-/g, \\\"+\\\").replace(/_/g, \\\"/\\\");\\n\\t};\\n\\tvar base64Encode_default = base64Encode;\\n\\n//#endregion\\n//#region ../javascript/src/utils/deepMerge.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Checks if a value is a plain object (not an array, function, date, etc.)\\n\\t*\\n\\t* @param value - The value to check\\n\\t* @returns True if the value is a plain object\\n\\t*/\\n\\tconst isPlainObject = (value) => typeof value === \\\"object\\\" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === \\\"[object Object]\\\";\\n\\t/**\\n\\t* Recursively merges the properties of source objects into a target object.\\n\\t* Similar to Lodash's merge function, this creates a deep copy and merges\\n\\t* nested objects recursively. Arrays and non-plain objects are replaced entirely.\\n\\t*\\n\\t* @param target - The target object to merge into\\n\\t* @param sources - One or more source objects to merge from\\n\\t* @returns A new object with merged properties\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* const obj1 = { a: 1, b: { x: 1, y: 2 } };\\n\\t* const obj2 = { b: { y: 3, z: 4 }, c: 3 };\\n\\t* const result = deepMerge(obj1, obj2);\\n\\t* // Result: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 3 }\\n\\t* ```\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* const config = { theme: { colors: { primary: 'blue' } } };\\n\\t* const userPrefs = { theme: { colors: { secondary: 'red' } } };\\n\\t* const merged = deepMerge(config, userPrefs);\\n\\t* // Result: { theme: { colors: { primary: 'blue', secondary: 'red' } } }\\n\\t* ```\\n\\t*/\\n\\tconst deepMerge = (target, ...sources) => {\\n\\t\\tif (!target || typeof target !== \\\"object\\\") throw new Error(\\\"Target must be an object\\\");\\n\\t\\tconst result = { ...target };\\n\\t\\tsources.forEach((source) => {\\n\\t\\t\\tif (!source || typeof source !== \\\"object\\\") return;\\n\\t\\t\\tObject.keys(source).forEach((key) => {\\n\\t\\t\\t\\tconst sourceValue = source[key];\\n\\t\\t\\t\\tconst targetValue = result[key];\\n\\t\\t\\t\\tif (isPlainObject(sourceValue) && isPlainObject(targetValue)) result[key] = deepMerge(targetValue, sourceValue);\\n\\t\\t\\t\\telse if (sourceValue !== void 0) result[key] = sourceValue;\\n\\t\\t\\t});\\n\\t\\t});\\n\\t\\treturn result;\\n\\t};\\n\\tvar deepMerge_default = deepMerge;\\n\\n//#endregion\\n//#region ../javascript/src/utils/extractPkceStorageKeyFromState.ts\\n/**\\n\\t* Extracts the PKCE key from a state parameter string.\\n\\t*\\n\\t* @param state - The state parameter string containing the request index.\\n\\t* @returns The PKCE key string in the format `pkce_code_verifier_${index}`.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* const state = \\\"request_1\\\";\\n\\t* const pkceKey = extractPkceStorageKeyFromState(state);\\n\\t* // Returns: \\\"pkce_code_verifier_1\\\"\\n\\t* ```\\n\\t*/\\n\\tconst extractPkceStorageKeyFromState = (state) => {\\n\\t\\tconst index = parseInt(state.split(\\\"request_\\\")[1], 10);\\n\\t\\treturn `${PKCEConstants_default.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants_default.Storage.StorageKeys.SEPARATOR}${index}`;\\n\\t};\\n\\tvar extractPkceStorageKeyFromState_default = extractPkceStorageKeyFromState;\\n\\n//#endregion\\n//#region ../javascript/src/utils/generatePkceStorageKey.ts\\n/**\\n\\t* Generates the next available PKCE storage key based on the current temporary data.\\n\\t*\\n\\t* The generated key will follow the format: `pkce_code_verifier_<index>`, where `<index>` is incremented\\n\\t* based on the highest existing index in the provided storage object.\\n\\t*\\n\\t* @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\\n\\t*\\n\\t* @returns A new unique PKCE storage key to store the next `code_verifier`.\\n\\t*\\n\\t* @example\\n\\t* const key = generatePkceStorageKey(sessionStorage);\\n\\t* // Returns: \\\"pkce_code_verifier_3\\\" (if existing keys are pkce_code_verifier_0 to _2)\\n\\t*/\\n\\tconst generatePkceStorageKey = (tempStore) => {\\n\\t\\tconst keys = [];\\n\\t\\tObject.keys(tempStore).forEach((key) => {\\n\\t\\t\\tif (key.startsWith(PKCEConstants_default.Storage.StorageKeys.CODE_VERIFIER)) keys.push(key);\\n\\t\\t});\\n\\t\\tconst lastKey = keys.sort().pop();\\n\\t\\tconst index = parseInt(lastKey?.split(PKCEConstants_default.Storage.StorageKeys.SEPARATOR)[1] ?? \\\"-1\\\", 10);\\n\\t\\treturn `${PKCEConstants_default.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants_default.Storage.StorageKeys.SEPARATOR}${index + 1}`;\\n\\t};\\n\\tvar generatePkceStorageKey_default = generatePkceStorageKey;\\n\\n//#endregion\\n//#region ../javascript/src/utils/generateStateParamForRequestCorrelation.ts\\n/**\\n\\t* Generates a state parameter for request correlation by combining an optional state string with a request index.\\n\\t*\\n\\t* @param pkceKey - The PKCE key containing the index (format: 'pkce_code_verifier_[index]').\\n\\t* @param state - Optional state string to prepend to the request correlation.\\n\\t* @returns A state parameter string in the format '[state_]request_[index]'.\\n\\t*\\n\\t* @example\\n\\t* const pkceKey = \\\"pkce_code_verifier_1\\\";\\n\\t* const result = generateStateParamForRequestCorrelation(pkceKey, \\\"myState\\\");\\n\\t* // Returns: \\\"myState_request_1\\\"\\n\\t*\\n\\t* const resultNoState = generateStateParamForRequestCorrelation(pkceKey);\\n\\t* // Returns: \\\"request_1\\\"\\n\\t*/\\n\\tconst generateStateParamForRequestCorrelation = (pkceKey, state) => {\\n\\t\\tconst index = parseInt(pkceKey.split(PKCEConstants_default.Storage.StorageKeys.SEPARATOR)[1], 10);\\n\\t\\treturn state ? `${state}_request_${index}` : `request_${index}`;\\n\\t};\\n\\tvar generateStateParamForRequestCorrelation_default = generateStateParamForRequestCorrelation;\\n\\n//#endregion\\n//#region ../javascript/src/utils/getAuthorizeRequestUrlParams.ts\\n/**\\n\\t* Generates a map of authorization request URL parameters for OIDC authorization requests.\\n\\t*\\n\\t* This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,\\n\\t* and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.\\n\\t*\\n\\t* @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and prompt.\\n\\t* @param pkceOptions - PKCE options, including the PKCE key for state correlation.\\n\\t* @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).\\n\\t* @returns A Map of key-value pairs representing the authorization request URL parameters.\\n\\t*\\n\\t* @throws {ThunderIDRuntimeError} If a code challenge is provided without a code challenge method.\\n\\t*\\n\\t* @example\\n\\t* const params = getAuthorizeRequestUrlParams({\\n\\t* options: {\\n\\t* redirectUri: 'https://app/callback',\\n\\t* clientId: 'client123',\\n\\t* scope: ['openid', 'profile'],\\n\\t* responseMode: 'query',\\n\\t* codeChallenge: 'abc',\\n\\t* codeChallengeMethod: 'S256',\\n\\t* prompt: 'login'\\n\\t* },\\n\\t* pkceOptions: { key: 'pkce_code_verifier_1' },\\n\\t* customParams: { foo: 'bar' }\\n\\t* });\\n\\t* // Returns a Map with all required OIDC params, PKCE, and custom params.\\n\\t*/\\n\\tconst getAuthorizeRequestUrlParams = (options, pkceOptions, customParams) => {\\n\\t\\tconst { redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt } = options;\\n\\t\\tconst authorizeRequestParams = /* @__PURE__ */ new Map();\\n\\t\\tauthorizeRequestParams.set(\\\"response_type\\\", \\\"code\\\");\\n\\t\\tauthorizeRequestParams.set(\\\"client_id\\\", clientId);\\n\\t\\tauthorizeRequestParams.set(\\\"scope\\\", scopes);\\n\\t\\tauthorizeRequestParams.set(\\\"redirect_uri\\\", redirectUri);\\n\\t\\tif (responseMode) authorizeRequestParams.set(\\\"response_mode\\\", responseMode);\\n\\t\\tconst pkceKey = pkceOptions?.key;\\n\\t\\tif (codeChallenge) {\\n\\t\\t\\tauthorizeRequestParams.set(\\\"code_challenge\\\", codeChallenge);\\n\\t\\t\\tif (codeChallengeMethod) authorizeRequestParams.set(\\\"code_challenge_method\\\", codeChallengeMethod);\\n\\t\\t\\telse throw new ThunderIDRuntimeError(\\\"Code challenge method is required when code challenge is provided.\\\", \\\"getAuthorizeRequestUrlParams-ValidationError-001\\\", \\\"javascript\\\", \\\"When PKCE is enabled, the code challenge method must be provided along with the code challenge.\\\");\\n\\t\\t}\\n\\t\\tif (prompt) authorizeRequestParams.set(\\\"prompt\\\", prompt);\\n\\t\\tif (customParams) Object.entries(customParams).forEach(([key, value]) => {\\n\\t\\t\\tif (key !== \\\"\\\" && value !== \\\"\\\" && key !== OIDCRequestConstants_default.Params.STATE) authorizeRequestParams.set(key, value.toString());\\n\\t\\t});\\n\\t\\tconst AUTH_INSTANCE_PREFIX = \\\"instance_\\\";\\n\\t\\tlet customStateValue = \\\"\\\";\\n\\t\\tif (options.instanceId) customStateValue = AUTH_INSTANCE_PREFIX + options.instanceId;\\n\\t\\telse if (customParams) customStateValue = customParams[OIDCRequestConstants_default.Params.STATE]?.toString() ?? \\\"\\\";\\n\\t\\tauthorizeRequestParams.set(OIDCRequestConstants_default.Params.STATE, generateStateParamForRequestCorrelation_default(pkceKey, customStateValue));\\n\\t\\treturn authorizeRequestParams;\\n\\t};\\n\\tvar getAuthorizeRequestUrlParams_default = getAuthorizeRequestUrlParams;\\n\\n//#endregion\\n//#region ../javascript/src/__legacy__/client.ts\\n/**\\n\\t* Default configurations.\\n\\t*/\\n\\tconst DefaultConfig = {\\n\\t\\tenablePKCE: true,\\n\\t\\tresponseMode: \\\"query\\\",\\n\\t\\tsendCookiesInRequests: true,\\n\\t\\ttokenValidation: { idToken: {\\n\\t\\t\\tclockTolerance: 300,\\n\\t\\t\\tvalidate: true,\\n\\t\\t\\tvalidateIssuer: true\\n\\t\\t} }\\n\\t};\\n\\t/**\\n\\t* This class provides the necessary methods needed to implement authentication.\\n\\t*/\\n\\tvar ThunderIDAuthClient = class ThunderIDAuthClient {\\n\\t\\tstorageManager;\\n\\t\\tconfigProvider;\\n\\t\\toidcProviderMetaDataProvider;\\n\\t\\tauthHelper;\\n\\t\\tcryptoUtils;\\n\\t\\tcryptoHelper;\\n\\t\\tinstanceIdValue;\\n\\t\\tstatic authHelperInstance;\\n\\t\\t/**\\n\\t\\t* This is the constructor method that returns an instance of the .\\n\\t\\t*\\n\\t\\t* @param store - The store object.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const _store: Store = new DataStore();\\n\\t\\t* const auth = new ThunderIDAuthClient<CustomClientConfig>(_store);\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#constructor}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tconstructor() {}\\n\\t\\t/**\\n\\t\\t*\\n\\t\\t* This method initializes the SDK with the config data.\\n\\t\\t*\\n\\t\\t* @param config - The config object to initialize with.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* const config = \\\\{\\n\\t\\t* afterSignInUrl: \\\"http://localhost:3000/sign-in\\\",\\n\\t\\t* clientId: \\\"client ID\\\",\\n\\t\\t* baseUrl: \\\"https://localhost:9443\\\"\\n\\t\\t* \\\\}\\n\\t\\t*\\n\\t\\t* await auth.initialize(config);\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#initialize}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync initialize(config, store, inputCryptoUtils, instanceID) {\\n\\t\\t\\tconst { clientId } = config;\\n\\t\\t\\tif (!this.instanceIdValue) this.instanceIdValue = 0;\\n\\t\\t\\telse this.instanceIdValue += 1;\\n\\t\\t\\tif (instanceID !== void 0) this.instanceIdValue = instanceID;\\n\\t\\t\\tif (!clientId) this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}`, store);\\n\\t\\t\\telse this.storageManager = new StorageManager_default(`instance_${this.instanceIdValue}-${clientId}`, store);\\n\\t\\t\\tthis.cryptoUtils = inputCryptoUtils;\\n\\t\\t\\tthis.cryptoHelper = new IsomorphicCrypto(inputCryptoUtils);\\n\\t\\t\\tthis.authHelper = new AuthenticationHelper$1(this.storageManager, this.cryptoHelper);\\n\\t\\t\\tthis.configProvider = async () => this.storageManager.getConfigData();\\n\\t\\t\\tthis.oidcProviderMetaDataProvider = async () => this.storageManager.loadOpenIDProviderConfiguration();\\n\\t\\t\\tThunderIDAuthClient.authHelperInstance = this.authHelper;\\n\\t\\t\\tconst { applicationId, platform, endpoints } = config;\\n\\t\\t\\tlet resolvedApplicationId = applicationId;\\n\\t\\t\\tif (applicationId) await this.storageManager.setPersistedData({ applicationId });\\n\\t\\t\\telse {\\n\\t\\t\\t\\tconst persistedData = await this.storageManager.getPersistedData();\\n\\t\\t\\t\\tif (persistedData[\\\"applicationId\\\"]) resolvedApplicationId = persistedData[\\\"applicationId\\\"];\\n\\t\\t\\t}\\n\\t\\t\\tconst resolvedEndpoints = endpoints || {};\\n\\t\\t\\tif (platform === Platform.ThunderIDV2) {\\n\\t\\t\\t\\tif (!resolvedEndpoints.wellKnown) resolvedEndpoints.wellKnown = OIDCDiscoveryConstants_default$1.Endpoints.WELL_KNOWN;\\n\\t\\t\\t}\\n\\t\\t\\tawait this.storageManager.setConfigData({\\n\\t\\t\\t\\t...DefaultConfig,\\n\\t\\t\\t\\t...config,\\n\\t\\t\\t\\tapplicationId: resolvedApplicationId,\\n\\t\\t\\t\\tendpoints: resolvedEndpoints,\\n\\t\\t\\t\\tscope: processOpenIDScopes_default(config.scopes)\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the `StorageManager` object that allows you to access authentication data.\\n\\t\\t*\\n\\t\\t* @returns - The `StorageManager` object.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const data = auth.getStorageManager();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getStorageManager}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tgetStorageManager() {\\n\\t\\t\\treturn this.storageManager;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the `instanceID` variable of the given instance.\\n\\t\\t*\\n\\t\\t* @returns - The `instanceID` number.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const instanceId = auth.getInstanceId();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tgetInstanceId() {\\n\\t\\t\\treturn this.instanceIdValue;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This is an async method that returns a Promise that resolves with the authorization URL.\\n\\t\\t*\\n\\t\\t* @param config - (Optional) A config object to force initialization and pass\\n\\t\\t* custom path parameters such as the fidp parameter.\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A promise that resolves with the authorization URL.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* auth.getSignInUrl().then((url)=>{\\n\\t\\t* // console.log(url);\\n\\t\\t* }).catch((error)=>{\\n\\t\\t* // console.error(error);\\n\\t\\t* });\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignInUrl}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getSignInUrl(requestConfig, userId) {\\n\\t\\t\\tconst authRequestConfig = { ...requestConfig };\\n\\t\\t\\tdelete authRequestConfig?.forceInit;\\n\\t\\t\\tconst buildSignInUrl = async () => {\\n\\t\\t\\t\\tconst authorizeEndpoint = await this.storageManager.getOIDCProviderMetaDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.Endpoints.AUTHORIZATION);\\n\\t\\t\\t\\tif (!authorizeEndpoint || authorizeEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-GAU-NF01\\\", \\\"No authorization endpoint found.\\\", \\\"No authorization endpoint was found in the OIDC provider meta data from the well-known endpoint or the authorization endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\t\\tconst authorizeRequest = new URL(authorizeEndpoint);\\n\\t\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\t\\tconst pkceKey = await generatePkceStorageKey_default(await this.storageManager.getTemporaryData(userId));\\n\\t\\t\\t\\tlet codeVerifier;\\n\\t\\t\\t\\tlet codeChallenge;\\n\\t\\t\\t\\tif (configData.enablePKCE) {\\n\\t\\t\\t\\t\\tcodeVerifier = this.cryptoHelper?.getCodeVerifier();\\n\\t\\t\\t\\t\\tcodeChallenge = await this.cryptoHelper?.getCodeChallenge(codeVerifier);\\n\\t\\t\\t\\t\\tawait this.storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (authRequestConfig[\\\"client_secret\\\"]) authRequestConfig[\\\"client_secret\\\"] = configData.clientSecret;\\n\\t\\t\\t\\tconst authorizeRequestParams = getAuthorizeRequestUrlParams_default({\\n\\t\\t\\t\\t\\tclientId: configData.clientId,\\n\\t\\t\\t\\t\\tcodeChallenge,\\n\\t\\t\\t\\t\\tcodeChallengeMethod: PKCEConstants_default.DEFAULT_CODE_CHALLENGE_METHOD,\\n\\t\\t\\t\\t\\tinstanceId: this.getInstanceId().toString(),\\n\\t\\t\\t\\t\\tprompt: configData.prompt,\\n\\t\\t\\t\\t\\tredirectUri: configData.afterSignInUrl,\\n\\t\\t\\t\\t\\tresponseMode: configData.responseMode,\\n\\t\\t\\t\\t\\tscopes: processOpenIDScopes_default(configData.scopes)\\n\\t\\t\\t\\t}, { key: pkceKey }, authRequestConfig);\\n\\t\\t\\t\\tArray.from(authorizeRequestParams.entries()).forEach(([paramKey, paramValue]) => {\\n\\t\\t\\t\\t\\tauthorizeRequest.searchParams.append(paramKey, paramValue);\\n\\t\\t\\t\\t});\\n\\t\\t\\t\\treturn authorizeRequest.toString();\\n\\t\\t\\t};\\n\\t\\t\\tif (await this.storageManager.getTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)) return buildSignInUrl();\\n\\t\\t\\treturn this.loadOpenIDProviderConfiguration(requestConfig?.forceInit).then(() => buildSignInUrl());\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This is an async method that sends a request to obtain the access token and returns a Promise\\n\\t\\t* that resolves with the token and other relevant data.\\n\\t\\t*\\n\\t\\t* @param authorizationCode - The authorization code.\\n\\t\\t* @param sessionState - The session state.\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the token response.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* auth.requestAccessToken(authCode, sessionState).then((token)=>{\\n\\t\\t* // console.log(token);\\n\\t\\t* }).catch((error)=>{\\n\\t\\t* // console.error(error);\\n\\t\\t* });\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestAccessToken}\\n\\t\\t*\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync requestAccessToken(authorizationCode, sessionState, state, userId, tokenRequestConfig) {\\n\\t\\t\\tif (!await this.storageManager.getTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)) await this.loadOpenIDProviderConfiguration(false);\\n\\t\\t\\tconst tokenEndpoint = (await this.oidcProviderMetaDataProvider()).token_endpoint;\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tif (!tokenEndpoint || tokenEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT1-NF01\\\", \\\"Token endpoint not found.\\\", \\\"No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tif (sessionState) await this.storageManager.setSessionDataParameter(OIDCRequestConstants_default.Params.SESSION_STATE, sessionState, userId);\\n\\t\\t\\tconst body = new URLSearchParams();\\n\\t\\t\\tbody.set(\\\"client_id\\\", configData.clientId);\\n\\t\\t\\tconst hasSecret = Boolean(configData.clientSecret && configData.clientSecret.trim().length > 0);\\n\\t\\t\\tconst tokenEndpointAuthMethod = configData.tokenRequest?.authMethod ?? (configData.platform === Platform.ThunderIDV2 ? \\\"client_secret_basic\\\" : \\\"client_secret_post\\\");\\n\\t\\t\\tif (hasSecret && tokenEndpointAuthMethod === \\\"client_secret_post\\\") body.set(\\\"client_secret\\\", configData.clientSecret);\\n\\t\\t\\tconst code$1 = authorizationCode;\\n\\t\\t\\tbody.set(\\\"code\\\", code$1);\\n\\t\\t\\tbody.set(\\\"grant_type\\\", \\\"authorization_code\\\");\\n\\t\\t\\tbody.set(\\\"redirect_uri\\\", configData.afterSignInUrl);\\n\\t\\t\\tif (tokenRequestConfig?.params) Object.entries(tokenRequestConfig.params).forEach(([key, value]) => {\\n\\t\\t\\t\\tbody.append(key, value);\\n\\t\\t\\t});\\n\\t\\t\\tif (configData.enablePKCE) {\\n\\t\\t\\t\\tbody.set(\\\"code_verifier\\\", `${await this.storageManager.getTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId)}`);\\n\\t\\t\\t\\tawait this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);\\n\\t\\t\\t}\\n\\t\\t\\tconst tokenRequestHeaders = {\\n\\t\\t\\t\\tAccept: \\\"application/json\\\",\\n\\t\\t\\t\\t\\\"Content-Type\\\": \\\"application/x-www-form-urlencoded\\\"\\n\\t\\t\\t};\\n\\t\\t\\tif (hasSecret && tokenEndpointAuthMethod === \\\"client_secret_basic\\\") tokenRequestHeaders[\\\"Authorization\\\"] = `Basic ${base64Encode_default(`${encodeURIComponent(configData.clientId)}:${encodeURIComponent(configData.clientSecret)}`)}`;\\n\\t\\t\\tlet tokenResponse;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\ttokenResponse = await fetch(tokenEndpoint, {\\n\\t\\t\\t\\t\\tbody,\\n\\t\\t\\t\\t\\tcredentials: configData.sendCookiesInRequests ? \\\"include\\\" : \\\"same-origin\\\",\\n\\t\\t\\t\\t\\theaders: tokenRequestHeaders,\\n\\t\\t\\t\\t\\tmethod: \\\"POST\\\"\\n\\t\\t\\t\\t});\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT1-NE02\\\", \\\"Requesting access token failed\\\", error ?? \\\"The request to get the access token from the server failed.\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (!tokenResponse.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT1-HE03\\\", `Requesting access token failed with ${tokenResponse.statusText}`, await tokenResponse.json());\\n\\t\\t\\treturn this.authHelper.handleTokenResponse(tokenResponse, userId);\\n\\t\\t}\\n\\t\\tasync loadOpenIDProviderConfiguration(forceInit) {\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tif (!forceInit && await this.storageManager.getTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)) return Promise.resolve();\\n\\t\\t\\tconst { wellKnownEndpoint, platform, discovery, baseUrl, endpoints } = configData;\\n\\t\\t\\tconst resolvedWellKnownEndpoint = wellKnownEndpoint || (platform === Platform.ThunderIDV2 && discovery?.wellKnown?.enabled ? `${baseUrl}${endpoints?.wellKnown ?? \\\"/.well-known/openid-configuration\\\"}` : void 0);\\n\\t\\t\\tif (resolvedWellKnownEndpoint) {\\n\\t\\t\\t\\tlet response;\\n\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\tresponse = await fetch(resolvedWellKnownEndpoint);\\n\\t\\t\\t\\t\\tif (response.status !== 200 || !response.ok) throw new Error();\\n\\t\\t\\t\\t} catch {\\n\\t\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-GOPMD-HE01\\\", \\\"Invalid well-known response\\\", \\\"The well known endpoint response has been failed with an error.\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tawait this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpoints(await response.json()));\\n\\t\\t\\t\\tawait this.storageManager.setTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED, true);\\n\\t\\t\\t\\treturn Promise.resolve();\\n\\t\\t\\t}\\n\\t\\t\\tif (configData.baseUrl) {\\n\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\tawait this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsByBaseURL());\\n\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-GOPMD-IV02\\\", \\\"Resolving endpoints failed.\\\", error ?? \\\"Resolving endpoints by base url failed.\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tawait this.storageManager.setTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED, true);\\n\\t\\t\\t\\treturn Promise.resolve();\\n\\t\\t\\t}\\n\\t\\t\\tawait this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsExplicitly());\\n\\t\\t\\tawait this.storageManager.setTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED, true);\\n\\t\\t\\treturn Promise.resolve();\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the sign-out URL.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* **This doesn't clear the authentication data.**\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the sign-out URL.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const signOutUrl = await auth.getSignOutUrl();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignOutUrl}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getSignOutUrl(userId) {\\n\\t\\t\\tconst logoutEndpoint = (await this.oidcProviderMetaDataProvider())?.end_session_endpoint;\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tif (!logoutEndpoint || logoutEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-GSOU-NF01\\\", \\\"Sign-out endpoint not found.\\\", \\\"No sign-out endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the sign-out endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tconst callbackURL = configData?.afterSignOutUrl ?? configData?.afterSignInUrl;\\n\\t\\t\\tif (!callbackURL || callbackURL.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-GSOU-NF03\\\", \\\"No sign-out redirect URL found.\\\", \\\"The sign-out redirect URL cannot be found or the URL passed to the SDK is empty. No sign-in redirect URL has been found either. \\\");\\n\\t\\t\\tconst queryParams = new URLSearchParams();\\n\\t\\t\\tqueryParams.set(\\\"post_logout_redirect_uri\\\", callbackURL);\\n\\t\\t\\tif (configData.sendIdTokenInLogoutRequest) {\\n\\t\\t\\t\\tconst idToken = (await this.storageManager.getSessionData(userId))?.id_token;\\n\\t\\t\\t\\tif (!idToken || idToken.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-GSOU-NF02\\\", \\\"ID token not found.\\\", \\\"No ID token could be found. Either the session information is lost or you have not signed in.\\\");\\n\\t\\t\\t\\tqueryParams.set(\\\"id_token_hint\\\", idToken);\\n\\t\\t\\t} else queryParams.set(\\\"client_id\\\", configData.clientId);\\n\\t\\t\\tqueryParams.set(\\\"state\\\", OIDCRequestConstants_default.Params.SIGN_OUT_SUCCESS);\\n\\t\\t\\treturn `${logoutEndpoint}?${queryParams.toString()}`;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns OIDC service endpoints that are fetched from the `.well-known` endpoint.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with an object containing the OIDC service endpoints.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const endpoints = await auth.getOpenIDProviderEndpoints();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getOpenIDProviderEndpoints}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getOpenIDProviderEndpoints() {\\n\\t\\t\\tconst oidcProviderMetaData = await this.oidcProviderMetaDataProvider();\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tauthorizationEndpoint: oidcProviderMetaData.authorization_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\tcheckSessionIframe: oidcProviderMetaData.check_session_iframe ?? \\\"\\\",\\n\\t\\t\\t\\tendSessionEndpoint: oidcProviderMetaData.end_session_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\tintrospectionEndpoint: oidcProviderMetaData.introspection_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\tissuer: oidcProviderMetaData.issuer ?? \\\"\\\",\\n\\t\\t\\t\\tjwksUri: oidcProviderMetaData.jwks_uri ?? \\\"\\\",\\n\\t\\t\\t\\tregistrationEndpoint: oidcProviderMetaData.registration_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\trevocationEndpoint: oidcProviderMetaData.revocation_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\ttokenEndpoint: oidcProviderMetaData.token_endpoint ?? \\\"\\\",\\n\\t\\t\\t\\tuserinfoEndpoint: oidcProviderMetaData.userinfo_endpoint ?? \\\"\\\"\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method decodes a given JWT token and returns the payload.\\n\\t\\t*\\n\\t\\t* @param token - The token to be decoded.\\n\\t\\t* @returns - A Promise that resolves with the decoded token payload.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const decodedToken = await auth.decodeJwtToken(token);\\n\\t\\t* ```\\n\\t\\t*/\\n\\t\\tasync decodeJwtToken(token) {\\n\\t\\t\\treturn this.cryptoHelper.decodeJwtToken(token);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method decodes the payload of the ID token and returns it.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the decoded ID token payload.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const decodedIdToken = await auth.getDecodedIdToken();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDecodedIdToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getDecodedIdToken(userId, idToken) {\\n\\t\\t\\tconst storedIdToken = (await this.storageManager.getSessionData(userId)).id_token;\\n\\t\\t\\treturn this.cryptoHelper.decodeJwtToken(storedIdToken ?? idToken);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the ID token.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the ID token.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const idToken = await auth.getIdToken();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIdToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getIdToken(userId) {\\n\\t\\t\\treturn (await this.storageManager.getSessionData(userId)).id_token;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the basic user information obtained from the ID token.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with an object containing the basic user information.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const userInfo = await auth.getUser();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getUser}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getUser(userId) {\\n\\t\\t\\tconst sessionData = await this.storageManager.getSessionData(userId);\\n\\t\\t\\tconst authenticatedUser = this.authHelper.getAuthenticatedUserInfo(sessionData?.id_token);\\n\\t\\t\\tObject.keys(authenticatedUser).forEach((key) => {\\n\\t\\t\\t\\tif (authenticatedUser[key] === void 0 || authenticatedUser[key] === \\\"\\\" || authenticatedUser[key] === null) delete authenticatedUser[key];\\n\\t\\t\\t});\\n\\t\\t\\treturn authenticatedUser;\\n\\t\\t}\\n\\t\\tasync getUserSession(userId) {\\n\\t\\t\\tconst sessionData = await this.storageManager.getSessionData(userId);\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tscopes: sessionData?.scope?.split(\\\" \\\"),\\n\\t\\t\\t\\tsessionState: sessionData?.session_state ?? \\\"\\\"\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the crypto helper object.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with a IsomorphicCrypto object.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const cryptoHelper = await auth.IsomorphicCrypto();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getCrypto}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getCrypto() {\\n\\t\\t\\treturn this.cryptoHelper;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method revokes the access token.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* **This method also clears the authentication data.**\\n\\t\\t*\\n\\t\\t* @returns - A Promise that returns the response of the revoke-access-token request.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* auth.revokeAccessToken().then((response)=>{\\n\\t\\t* // console.log(response);\\n\\t\\t* }).catch((error)=>{\\n\\t\\t* // console.error(error);\\n\\t\\t* });\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#revokeAccessToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync revokeAccessToken(userId) {\\n\\t\\t\\tconst revokeTokenEndpoint = (await this.oidcProviderMetaDataProvider()).revocation_endpoint;\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tif (!revokeTokenEndpoint || revokeTokenEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT3-NF01\\\", \\\"No revoke access token endpoint found.\\\", \\\"No revoke access token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the revoke access token endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tconst body = [];\\n\\t\\t\\tbody.push(`client_id=${configData.clientId}`);\\n\\t\\t\\tbody.push(`token=${(await this.storageManager.getSessionData(userId)).access_token}`);\\n\\t\\t\\tbody.push(\\\"token_type_hint=access_token\\\");\\n\\t\\t\\tif (configData.clientSecret && configData.clientSecret.trim().length > 0) body.push(`client_secret=${configData.clientSecret}`);\\n\\t\\t\\tlet response;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tresponse = await fetch(revokeTokenEndpoint, {\\n\\t\\t\\t\\t\\tbody: body.join(\\\"&\\\"),\\n\\t\\t\\t\\t\\tcredentials: configData.sendCookiesInRequests ? \\\"include\\\" : \\\"same-origin\\\",\\n\\t\\t\\t\\t\\theaders: {\\n\\t\\t\\t\\t\\t\\tAccept: \\\"application/json\\\",\\n\\t\\t\\t\\t\\t\\t\\\"Content-Type\\\": \\\"application/x-www-form-urlencoded\\\"\\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\tmethod: \\\"POST\\\"\\n\\t\\t\\t\\t});\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT3-NE02\\\", \\\"The request to revoke access token failed.\\\", error ?? \\\"The request sent to revoke the access token failed.\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (response.status !== 200 || !response.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT3-HE03\\\", `Invalid response status received for revoke access token request (${response.statusText}).`, await response.json());\\n\\t\\t\\tthis.authHelper.clearSession(userId);\\n\\t\\t\\treturn Promise.resolve(response);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method refreshes the access token and returns a Promise that resolves with the new access\\n\\t\\t* token and other relevant data.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the token response.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* auth.refreshAccessToken().then((response)=>{\\n\\t\\t* // console.log(response);\\n\\t\\t* }).catch((error)=>{\\n\\t\\t* // console.error(error);\\n\\t\\t* });\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#refreshAccessToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync refreshAccessToken(userId) {\\n\\t\\t\\tconst tokenEndpoint = (await this.oidcProviderMetaDataProvider()).token_endpoint;\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tconst sessionData = await this.storageManager.getSessionData(userId);\\n\\t\\t\\tif (!sessionData.refresh_token) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT2-NF01\\\", \\\"No refresh token found.\\\", \\\"There was no refresh token found. The server doesn't return a refresh token if the refresh token grant is not enabled.\\\");\\n\\t\\t\\tif (!tokenEndpoint || tokenEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT2-NF02\\\", \\\"No refresh token endpoint found.\\\", \\\"No refresh token endpoint was in the OIDC provider meta data returned by the well-known endpoint or the refresh token endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tconst body = [];\\n\\t\\t\\tbody.push(`client_id=${configData.clientId}`);\\n\\t\\t\\tbody.push(`refresh_token=${sessionData.refresh_token}`);\\n\\t\\t\\tbody.push(\\\"grant_type=refresh_token\\\");\\n\\t\\t\\tif (configData.clientSecret && configData.clientSecret.trim().length > 0) body.push(`client_secret=${configData.clientSecret}`);\\n\\t\\t\\tlet tokenResponse;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\ttokenResponse = await fetch(tokenEndpoint, {\\n\\t\\t\\t\\t\\tbody: body.join(\\\"&\\\"),\\n\\t\\t\\t\\t\\tcredentials: configData.sendCookiesInRequests ? \\\"include\\\" : \\\"same-origin\\\",\\n\\t\\t\\t\\t\\theaders: {\\n\\t\\t\\t\\t\\t\\tAccept: \\\"application/json\\\",\\n\\t\\t\\t\\t\\t\\t\\\"Content-Type\\\": \\\"application/x-www-form-urlencoded\\\"\\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\tmethod: \\\"POST\\\"\\n\\t\\t\\t\\t});\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT2-NR03\\\", \\\"Refresh access token request failed.\\\", error ?? \\\"The request to refresh the access token failed.\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (!tokenResponse.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RAT2-HE04\\\", `Refreshing access token failed with ${tokenResponse.statusText}`, await tokenResponse.json());\\n\\t\\t\\treturn this.authHelper.handleTokenResponse(tokenResponse, userId);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the access token.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the access token.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const accessToken = await auth.getAccessToken();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAccessToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getAccessToken(userId) {\\n\\t\\t\\treturn (await this.storageManager.getSessionData(userId))?.access_token;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method sends a custom-grant request and returns a Promise that resolves with the response\\n\\t\\t* depending on the config passed.\\n\\t\\t*\\n\\t\\t* @param config - A config object containing the custom grant configurations.\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the response depending\\n\\t\\t* on your configurations.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const config = {\\n\\t\\t* attachToken: false,\\n\\t\\t* data: {\\n\\t\\t* client_id: \\\"{{clientId}}\\\",\\n\\t\\t* grant_type: \\\"account_switch\\\",\\n\\t\\t* scope: \\\"{{scope}}\\\",\\n\\t\\t* token: \\\"{{token}}\\\",\\n\\t\\t* },\\n\\t\\t* id: \\\"account-switch\\\",\\n\\t\\t* returnResponse: true,\\n\\t\\t* returnsSession: true,\\n\\t\\t* signInRequired: true\\n\\t\\t* }\\n\\t\\t*\\n\\t\\t* auth.exchangeToken(config).then((response)=>{\\n\\t\\t* // console.log(response);\\n\\t\\t* }).catch((error)=>{\\n\\t\\t* // console.error(error);\\n\\t\\t* });\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#exchangeToken}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync exchangeToken(config, userId) {\\n\\t\\t\\tif (!await this.storageManager.getTemporaryDataParameter(OIDCDiscoveryConstants_default.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED)) await this.loadOpenIDProviderConfiguration(false);\\n\\t\\t\\tconst oidcProviderMetadata = await this.oidcProviderMetaDataProvider();\\n\\t\\t\\tconst configData = await this.configProvider();\\n\\t\\t\\tlet tokenEndpoint;\\n\\t\\t\\tif (config.tokenEndpoint && config.tokenEndpoint.trim().length !== 0) tokenEndpoint = config.tokenEndpoint;\\n\\t\\t\\telse tokenEndpoint = oidcProviderMetadata.token_endpoint;\\n\\t\\t\\tif (!tokenEndpoint || tokenEndpoint.trim().length === 0) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RCG-NF01\\\", \\\"Token endpoint not found.\\\", \\\"No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint or the token endpoint passed to the SDK is empty.\\\");\\n\\t\\t\\tconst data = await Promise.all(Object.entries(config.data).map(async ([key, value]) => {\\n\\t\\t\\t\\treturn `${key}=${await this.authHelper.replaceCustomGrantTemplateTags(value, userId)}`;\\n\\t\\t\\t}));\\n\\t\\t\\tlet requestHeaders = {\\n\\t\\t\\t\\tAccept: \\\"application/json\\\",\\n\\t\\t\\t\\t\\\"Content-Type\\\": \\\"application/x-www-form-urlencoded\\\"\\n\\t\\t\\t};\\n\\t\\t\\tif (config.attachToken) requestHeaders = {\\n\\t\\t\\t\\t...requestHeaders,\\n\\t\\t\\t\\tAuthorization: `Bearer ${(await this.storageManager.getSessionData(userId)).access_token}`\\n\\t\\t\\t};\\n\\t\\t\\tconst requestConfig = {\\n\\t\\t\\t\\tbody: data.join(\\\"&\\\"),\\n\\t\\t\\t\\tcredentials: configData.sendCookiesInRequests ? \\\"include\\\" : \\\"same-origin\\\",\\n\\t\\t\\t\\theaders: new Headers(requestHeaders),\\n\\t\\t\\t\\tmethod: \\\"POST\\\"\\n\\t\\t\\t};\\n\\t\\t\\tlet response;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tresponse = await fetch(tokenEndpoint, requestConfig);\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"JS-AUTH_CORE-RCG-NE02\\\", \\\"The custom grant request failed.\\\", error ?? \\\"The request sent to get the custom grant failed.\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (response.status !== 200 || !response.ok) throw new ThunderIDAuthException(\\\"JS-AUTH_CORE-RCG-HE03\\\", `Invalid response status received for the custom grant request. (${response.statusText})`, await response.json());\\n\\t\\t\\tif (config.returnsSession) return this.authHelper.handleTokenResponse(response, userId);\\n\\t\\t\\treturn Promise.resolve(await response.json());\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns if the user is authenticated or not.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with `true` if the user is authenticated, `false` otherwise.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* await auth.isSignedIn();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignedIn}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync isSignedIn(userId) {\\n\\t\\t\\tconst isAccessTokenAvailable = Boolean(await this.getAccessToken(userId));\\n\\t\\t\\tconst createdAt = (await this.storageManager.getSessionData(userId))?.created_at;\\n\\t\\t\\tconst expiresInString = (await this.storageManager.getSessionData(userId))?.expires_in;\\n\\t\\t\\tif (!expiresInString) return false;\\n\\t\\t\\tconst expiresIn = parseInt(expiresInString, 10) * 1e3;\\n\\t\\t\\tconst currentTime = (/* @__PURE__ */ new Date()).getTime();\\n\\t\\t\\tconst isAccessTokenValid = createdAt + expiresIn > currentTime;\\n\\t\\t\\treturn isAccessTokenAvailable && isAccessTokenValid;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns the PKCE code generated during the generation of the authentication URL.\\n\\t\\t*\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t* @param state - The state parameter that was passed in the authentication URL.\\n\\t\\t*\\n\\t\\t* @returns - A Promise that resolves with the PKCE code.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const pkce = await getPKCECode();\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getPKCECode}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync getPKCECode(state, userId) {\\n\\t\\t\\treturn await this.storageManager.getTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method sets the PKCE code to the data store.\\n\\t\\t*\\n\\t\\t* @param pkce - The PKCE code.\\n\\t\\t* @param state - The state parameter that was passed in the authentication URL.\\n\\t\\t* @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\\n\\t\\t* scenarios where each user should be uniquely identified.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* await auth.setPKCECode(\\\"pkce_code\\\")\\n\\t\\t* ```\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#setPKCECode}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync setPKCECode(pkce, state, userId) {\\n\\t\\t\\treturn this.storageManager.setTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), pkce, userId);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns if the sign-out is successful or not.\\n\\t\\t*\\n\\t\\t* @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\\n\\t\\t*\\n\\t\\t* **The server appends path parameters to the `afterSignOutUrl` and these path parameters\\n\\t\\t* are required for this method to function.**\\n\\t\\t*\\n\\t\\t* @returns - `true` if successful, `false` otherwise.\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignOutSuccessful}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tstatic isSignOutSuccessful(afterSignOutUrl) {\\n\\t\\t\\tconst url = new URL(afterSignOutUrl);\\n\\t\\t\\tconst stateParam = url.searchParams.get(OIDCRequestConstants_default.Params.STATE);\\n\\t\\t\\tconst error = Boolean(url.searchParams.get(\\\"error\\\"));\\n\\t\\t\\treturn stateParam ? stateParam === OIDCRequestConstants_default.Params.SIGN_OUT_SUCCESS && !error : false;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method returns if the sign-out has failed or not.\\n\\t\\t*\\n\\t\\t* @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\\n\\t\\t*\\n\\t\\t* **The server appends path parameters to the `afterSignOutUrl` and these path parameters\\n\\t\\t* are required for this method to function.**\\n\\t\\t*\\n\\t\\t* @returns - `true` if successful, `false` otherwise.\\n\\t\\t*\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#didSignOutFail}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tstatic didSignOutFail(afterSignOutUrl) {\\n\\t\\t\\tconst url = new URL(afterSignOutUrl);\\n\\t\\t\\tconst stateParam = url.searchParams.get(OIDCRequestConstants_default.Params.STATE);\\n\\t\\t\\tconst error = Boolean(url.searchParams.get(\\\"error\\\"));\\n\\t\\t\\treturn stateParam ? stateParam === OIDCRequestConstants_default.Params.SIGN_OUT_SUCCESS && error : false;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method updates the configuration that was passed into the constructor when instantiating this class.\\n\\t\\t*\\n\\t\\t* @param config - A config object to update the SDK configurations with.\\n\\t\\t*\\n\\t\\t* @example\\n\\t\\t* ```\\n\\t\\t* const config = {\\n\\t\\t* afterSignInUrl: \\\"http://localhost:3000/sign-in\\\",\\n\\t\\t* clientId: \\\"client ID\\\",\\n\\t\\t* baseUrl: \\\"https://localhost:9443\\\"\\n\\t\\t* }\\n\\t\\t*\\n\\t\\t* await auth.reInitialize(config);\\n\\t\\t* ```\\n\\t\\t* {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#reInitialize}\\n\\t\\t*\\n\\t\\t* @preserve\\n\\t\\t*/\\n\\t\\tasync reInitialize(config) {\\n\\t\\t\\tconst newConfig = deepMerge_default(this.storageManager.getConfigData(), config);\\n\\t\\t\\tawait this.storageManager.setConfigData(newConfig);\\n\\t\\t\\tawait this.loadOpenIDProviderConfiguration(true);\\n\\t\\t}\\n\\t\\tstatic async clearSession(userId) {\\n\\t\\t\\tawait this.authHelperInstance.clearSession(userId);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/utils/logger.ts\\n\\tconst PREFIX = \\\"⚡ ThunderID\\\";\\n\\t/**\\n\\t* Default logger configuration\\n\\t*/\\n\\tconst DEFAULT_CONFIG = {\\n\\t\\tlevel: \\\"info\\\",\\n\\t\\tprefix: `${PREFIX}`,\\n\\t\\tshowLevel: true,\\n\\t\\ttimestamps: true\\n\\t};\\n\\t/**\\n\\t* Environment detection utilities\\n\\t*/\\n\\tconst isBrowser = () => typeof window !== \\\"undefined\\\" && typeof window.document !== \\\"undefined\\\";\\n\\tconst isNode = () => typeof process !== \\\"undefined\\\" && process.versions && process.versions.node;\\n\\t/**\\n\\t* Color codes for terminal output (Node.js)\\n\\t*/\\n\\tconst COLORS = {\\n\\t\\tblue: \\\"\\\\x1B[34m\\\",\\n\\t\\tbright: \\\"\\\\x1B[1m\\\",\\n\\t\\tcyan: \\\"\\\\x1B[36m\\\",\\n\\t\\tdim: \\\"\\\\x1B[2m\\\",\\n\\t\\tgray: \\\"\\\\x1B[90m\\\",\\n\\t\\tgreen: \\\"\\\\x1B[32m\\\",\\n\\t\\tmagenta: \\\"\\\\x1B[35m\\\",\\n\\t\\tred: \\\"\\\\x1B[31m\\\",\\n\\t\\treset: \\\"\\\\x1B[0m\\\",\\n\\t\\twhite: \\\"\\\\x1B[37m\\\",\\n\\t\\tyellow: \\\"\\\\x1B[33m\\\"\\n\\t};\\n\\t/**\\n\\t* Browser console styling\\n\\t*/\\n\\tconst BROWSER_STYLES = {\\n\\t\\tdebug: \\\"color: #6b7280; font-weight: normal;\\\",\\n\\t\\terror: \\\"color: #dc2626; font-weight: bold;\\\",\\n\\t\\tinfo: \\\"color: #2563eb; font-weight: bold;\\\",\\n\\t\\tprefix: \\\"color: #7c3aed; font-weight: bold;\\\",\\n\\t\\ttimestamp: \\\"color: #6b7280; font-size: 0.9em;\\\",\\n\\t\\twarn: \\\"color: #d97706; font-weight: bold;\\\"\\n\\t};\\n\\tconst LOG_LEVEL_ORDER = {\\n\\t\\tdebug: 0,\\n\\t\\terror: 3,\\n\\t\\tinfo: 1,\\n\\t\\twarn: 2\\n\\t};\\n\\t/**\\n\\t* Universal logger class that works in both browser and Node.js environments\\n\\t*/\\n\\tvar Logger = class Logger {\\n\\t\\tconfig;\\n\\t\\tconstructor(config = {}) {\\n\\t\\t\\tthis.config = {\\n\\t\\t\\t\\t...DEFAULT_CONFIG,\\n\\t\\t\\t\\t...config\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Update logger configuration\\n\\t\\t*/\\n\\t\\tconfigure(config) {\\n\\t\\t\\tthis.config = {\\n\\t\\t\\t\\t...this.config,\\n\\t\\t\\t\\t...config\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Get current configuration\\n\\t\\t*/\\n\\t\\tgetConfig() {\\n\\t\\t\\treturn { ...this.config };\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Check if a log level should be output\\n\\t\\t*/\\n\\t\\tshouldLog(level) {\\n\\t\\t\\treturn LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Get timestamp string\\n\\t\\t*/\\n\\t\\tstatic getTimestamp() {\\n\\t\\t\\treturn (/* @__PURE__ */ new Date()).toISOString();\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Get log level string\\n\\t\\t*/\\n\\t\\tstatic getLevelString(level) {\\n\\t\\t\\tswitch (level) {\\n\\t\\t\\t\\tcase \\\"debug\\\": return \\\"DEBUG\\\";\\n\\t\\t\\t\\tcase \\\"info\\\": return \\\"INFO\\\";\\n\\t\\t\\t\\tcase \\\"warn\\\": return \\\"WARN\\\";\\n\\t\\t\\t\\tcase \\\"error\\\": return \\\"ERROR\\\";\\n\\t\\t\\t\\tdefault: return \\\"UNKNOWN\\\";\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Format message for Node.js terminal\\n\\t\\t*/\\n\\t\\tformatForNode(level, message$1) {\\n\\t\\t\\tconst parts = [];\\n\\t\\t\\tif (this.config.timestamps) parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);\\n\\t\\t\\tif (this.config.prefix) parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);\\n\\t\\t\\tif (this.config.showLevel) {\\n\\t\\t\\t\\tconst levelStr = Logger.getLevelString(level);\\n\\t\\t\\t\\tlet coloredLevel;\\n\\t\\t\\t\\tswitch (level) {\\n\\t\\t\\t\\t\\tcase \\\"debug\\\":\\n\\t\\t\\t\\t\\t\\tcoloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"info\\\":\\n\\t\\t\\t\\t\\t\\tcoloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"warn\\\":\\n\\t\\t\\t\\t\\t\\tcoloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"error\\\":\\n\\t\\t\\t\\t\\t\\tcoloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tdefault: coloredLevel = `[${levelStr}]`;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tparts.push(coloredLevel);\\n\\t\\t\\t}\\n\\t\\t\\tparts.push(message$1);\\n\\t\\t\\treturn parts.join(\\\" \\\");\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log message using appropriate method\\n\\t\\t*/\\n\\t\\tlogMessage(level, message$1, ...args) {\\n\\t\\t\\tif (!this.shouldLog(level)) return;\\n\\t\\t\\tif (this.config.formatter) {\\n\\t\\t\\t\\tthis.config.formatter(level, message$1, ...args);\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\tif (isBrowser()) this.logToBrowser(level, message$1, ...args);\\n\\t\\t\\telse if (isNode()) this.logToNode(level, message$1, ...args);\\n\\t\\t\\telse console.log(message$1, ...args);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log to browser console with styling\\n\\t\\t*/\\n\\t\\tlogToBrowser(level, message$1, ...args) {\\n\\t\\t\\tconst parts = [];\\n\\t\\t\\tconst styles = [];\\n\\t\\t\\tif (this.config.timestamps) {\\n\\t\\t\\t\\tparts.push(`%c[${Logger.getTimestamp()}]`);\\n\\t\\t\\t\\tstyles.push(BROWSER_STYLES.timestamp);\\n\\t\\t\\t}\\n\\t\\t\\tif (this.config.prefix) {\\n\\t\\t\\t\\tparts.push(`%c${this.config.prefix}`);\\n\\t\\t\\t\\tstyles.push(BROWSER_STYLES.prefix);\\n\\t\\t\\t}\\n\\t\\t\\tif (this.config.showLevel) {\\n\\t\\t\\t\\tconst levelStr = Logger.getLevelString(level);\\n\\t\\t\\t\\tparts.push(`%c[${levelStr}]`);\\n\\t\\t\\t\\tswitch (level) {\\n\\t\\t\\t\\t\\tcase \\\"debug\\\":\\n\\t\\t\\t\\t\\t\\tstyles.push(BROWSER_STYLES.debug);\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"info\\\":\\n\\t\\t\\t\\t\\t\\tstyles.push(BROWSER_STYLES.info);\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"warn\\\":\\n\\t\\t\\t\\t\\t\\tstyles.push(BROWSER_STYLES.warn);\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tcase \\\"error\\\":\\n\\t\\t\\t\\t\\t\\tstyles.push(BROWSER_STYLES.error);\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\tdefault: styles.push(\\\"\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tparts.push(`%c${message$1}`);\\n\\t\\t\\tstyles.push(\\\"color: inherit; font-weight: normal;\\\");\\n\\t\\t\\tconst formattedMessage = parts.join(\\\" \\\");\\n\\t\\t\\tswitch (level) {\\n\\t\\t\\t\\tcase \\\"debug\\\":\\n\\t\\t\\t\\t\\tconsole.debug(formattedMessage, ...styles, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"info\\\":\\n\\t\\t\\t\\t\\tconsole.info(formattedMessage, ...styles, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"warn\\\":\\n\\t\\t\\t\\t\\tconsole.warn(formattedMessage, ...styles, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"error\\\":\\n\\t\\t\\t\\t\\tconsole.error(formattedMessage, ...styles, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tdefault: console.log(formattedMessage, ...styles, ...args);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log to Node.js console\\n\\t\\t*/\\n\\t\\tlogToNode(level, message$1, ...args) {\\n\\t\\t\\tconst formattedMessage = this.formatForNode(level, message$1);\\n\\t\\t\\tswitch (level) {\\n\\t\\t\\t\\tcase \\\"debug\\\":\\n\\t\\t\\t\\t\\tconsole.debug(formattedMessage, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"info\\\":\\n\\t\\t\\t\\t\\tconsole.info(formattedMessage, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"warn\\\":\\n\\t\\t\\t\\t\\tconsole.warn(formattedMessage, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase \\\"error\\\":\\n\\t\\t\\t\\t\\tconsole.error(formattedMessage, ...args);\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tdefault: console.log(formattedMessage, ...args);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log debug message\\n\\t\\t*/\\n\\t\\tdebug(message$1, ...args) {\\n\\t\\t\\tthis.logMessage(\\\"debug\\\", message$1, ...args);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log info message\\n\\t\\t*/\\n\\t\\tinfo(message$1, ...args) {\\n\\t\\t\\tthis.logMessage(\\\"info\\\", message$1, ...args);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log warning message\\n\\t\\t*/\\n\\t\\twarn(message$1, ...args) {\\n\\t\\t\\tthis.logMessage(\\\"warn\\\", message$1, ...args);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Log error message\\n\\t\\t*/\\n\\t\\terror(message$1, ...args) {\\n\\t\\t\\tthis.logMessage(\\\"error\\\", message$1, ...args);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Create a child logger with additional prefix\\n\\t\\t*/\\n\\t\\tchild(prefix) {\\n\\t\\t\\tconst childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;\\n\\t\\t\\treturn new Logger({\\n\\t\\t\\t\\t...this.config,\\n\\t\\t\\t\\tprefix: childPrefix\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Set log level\\n\\t\\t*/\\n\\t\\tsetLevel(level) {\\n\\t\\t\\tthis.config.level = level;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Get current log level\\n\\t\\t*/\\n\\t\\tgetLevel() {\\n\\t\\t\\treturn this.config.level;\\n\\t\\t}\\n\\t};\\n\\t/**\\n\\t* Default logger instance\\n\\t*/\\n\\tconst logger = new Logger();\\n\\n//#endregion\\n//#region ../javascript/src/models/agent.ts\\n\\tlet AgentConfig;\\n\\t(function(_AgentConfig) {\\n\\t\\t_AgentConfig.DEFAULT_AUTHENTICATOR_NAME = \\\"Username & Password\\\";\\n\\t})(AgentConfig || (AgentConfig = {}));\\n\\n//#endregion\\n//#region ../javascript/src/utils/v2/parseFlowTemplateLiteral.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Regular expression to detect a flow template literal wrapped in double braces.\\n\\t* Matches patterns like `{{ t(key) }}`, `{{ meta(key) }}`, etc.\\n\\t*\\n\\t* Note: this regex has no `g` flag — use `new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, 'g')`\\n\\t* when global replacement is needed (e.g. in resolveFlowTemplateLiterals).\\n\\t*/\\n\\tconst FLOW_TEMPLATE_LITERAL_REGEX = /\\\\{\\\\{\\\\s*([^}]+)\\\\s*\\\\}\\\\}/;\\n\\n//#endregion\\n//#region ../javascript/src/utils/v2/resolveFlowTemplateLiterals.ts\\n/**\\n\\t* Global version of {@link FLOW_TEMPLATE_LITERAL_REGEX} for use with `String.prototype.replace`.\\n\\t*/\\n\\tconst FLOW_TEMPLATE_LITERAL_REGEX_GLOBAL = new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, \\\"g\\\");\\n\\n//#endregion\\n//#region ../javascript/src/HttpClient.ts\\n/**\\n\\t* Abstract base class for HTTP clients. Owns all handler/callback state and\\n\\t* the request lifecycle (pre-processing, transport, post-processing).\\n\\t*\\n\\t* Extend this class and implement `transport()` to plug in a custom HTTP transport.\\n\\t*\\n\\t* @example\\n\\t* ```ts\\n\\t* class MyHttpClient extends HttpClient {\\n\\t* protected async transport<T>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\\n\\t* // custom fetch logic\\n\\t* }\\n\\t* }\\n\\t* ```\\n\\t*/\\n\\tvar HttpClient = class HttpClient {\\n\\t\\tstatic DEFAULT_HANDLER_DISABLE_TIMEOUT = 1e3;\\n\\t\\trequestStartCallback = () => null;\\n\\t\\trequestSuccessCallback = () => null;\\n\\t\\trequestErrorCallback = () => null;\\n\\t\\trequestFinishCallback = () => null;\\n\\t\\tconstructor(isHandlerEnabled = true, attachToken = () => Promise.resolve()) {\\n\\t\\t\\tthis.isHandlerEnabled = isHandlerEnabled;\\n\\t\\t\\tthis.attachToken = attachToken;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Public HTTP request entry point. Applies pre/post processing around `transport()`.\\n\\t\\t*/\\n\\t\\tasync request(config) {\\n\\t\\t\\tconst processedConfig = await this.requestHandler(config);\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst response = await this.transport(processedConfig);\\n\\t\\t\\t\\treturn this.successHandler(response);\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tthis.errorHandler(error);\\n\\t\\t\\t\\tthrow error;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tenableHandler() {\\n\\t\\t\\tthis.isHandlerEnabled = true;\\n\\t\\t}\\n\\t\\tdisableHandler() {\\n\\t\\t\\tthis.isHandlerEnabled = false;\\n\\t\\t}\\n\\t\\tdisableHandlerWithTimeout(timeout = HttpClient.DEFAULT_HANDLER_DISABLE_TIMEOUT) {\\n\\t\\t\\tthis.isHandlerEnabled = false;\\n\\t\\t\\tsetTimeout(() => {\\n\\t\\t\\t\\tthis.isHandlerEnabled = true;\\n\\t\\t\\t}, timeout);\\n\\t\\t}\\n\\t\\tsetHttpRequestStartCallback(cb) {\\n\\t\\t\\tthis.requestStartCallback = cb;\\n\\t\\t}\\n\\t\\tsetHttpRequestSuccessCallback(cb) {\\n\\t\\t\\tthis.requestSuccessCallback = cb;\\n\\t\\t}\\n\\t\\tsetHttpRequestErrorCallback(cb) {\\n\\t\\t\\tthis.requestErrorCallback = cb;\\n\\t\\t}\\n\\t\\tsetHttpRequestFinishCallback(cb) {\\n\\t\\t\\tthis.requestFinishCallback = cb;\\n\\t\\t}\\n\\t\\tall(values) {\\n\\t\\t\\treturn Promise.all(values);\\n\\t\\t}\\n\\t\\tspread(callback) {\\n\\t\\t\\treturn (array) => callback(...array);\\n\\t\\t}\\n\\t\\tasync requestHandler(config) {\\n\\t\\t\\tawait this.attachToken(config);\\n\\t\\t\\tif (config.shouldEncodeToFormData && config.data) {\\n\\t\\t\\t\\tconst formData = new FormData();\\n\\t\\t\\t\\tObject.keys(config.data).forEach((key) => formData.append(key, config.data[key]));\\n\\t\\t\\t\\tconfig.data = formData;\\n\\t\\t\\t}\\n\\t\\t\\tconfig.startTimeInMs = Date.now();\\n\\t\\t\\tif (this.isHandlerEnabled && typeof this.requestStartCallback === \\\"function\\\") this.requestStartCallback(config);\\n\\t\\t\\treturn config;\\n\\t\\t}\\n\\t\\tsuccessHandler(response) {\\n\\t\\t\\tif (this.isHandlerEnabled) {\\n\\t\\t\\t\\tif (typeof this.requestSuccessCallback === \\\"function\\\") this.requestSuccessCallback(response);\\n\\t\\t\\t\\tif (typeof this.requestFinishCallback === \\\"function\\\") this.requestFinishCallback();\\n\\t\\t\\t}\\n\\t\\t\\treturn response;\\n\\t\\t}\\n\\t\\terrorHandler(error) {\\n\\t\\t\\tif (this.isHandlerEnabled) {\\n\\t\\t\\t\\tif (typeof this.requestErrorCallback === \\\"function\\\") this.requestErrorCallback(error);\\n\\t\\t\\t\\tif (typeof this.requestFinishCallback === \\\"function\\\") this.requestFinishCallback();\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../javascript/src/i18n/translations/en-US.ts\\n\\tconst en_US = {\\n\\t\\tmetadata: {\\n\\t\\t\\tlocaleCode: \\\"en-US\\\",\\n\\t\\t\\tcountryCode: \\\"US\\\",\\n\\t\\t\\tlanguageCode: \\\"en\\\",\\n\\t\\t\\tdisplayName: \\\"English (United States)\\\",\\n\\t\\t\\tdirection: \\\"ltr\\\"\\n\\t\\t},\\n\\t\\ttranslations: {\\n\\t\\t\\t\\\"elements.buttons.signin.text\\\": \\\"Sign In\\\",\\n\\t\\t\\t\\\"elements.buttons.signout.text\\\": \\\"Sign Out\\\",\\n\\t\\t\\t\\\"elements.buttons.signup.text\\\": \\\"Sign Up\\\",\\n\\t\\t\\t\\\"elements.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"elements.buttons.facebook.text\\\": \\\"Continue with Facebook\\\",\\n\\t\\t\\t\\\"elements.buttons.google.text\\\": \\\"Continue with Google\\\",\\n\\t\\t\\t\\\"elements.buttons.github.text\\\": \\\"Continue with GitHub\\\",\\n\\t\\t\\t\\\"elements.buttons.microsoft.text\\\": \\\"Continue with Microsoft\\\",\\n\\t\\t\\t\\\"elements.buttons.linkedin.text\\\": \\\"Continue with LinkedIn\\\",\\n\\t\\t\\t\\\"elements.buttons.ethereum.text\\\": \\\"Continue with Sign In Ethereum\\\",\\n\\t\\t\\t\\\"elements.buttons.smsotp.text\\\": \\\"Continue with SMS OTP\\\",\\n\\t\\t\\t\\\"elements.buttons.multi.option.text\\\": \\\"Continue with {connection}\\\",\\n\\t\\t\\t\\\"elements.buttons.social.text\\\": \\\"Continue with {connection}\\\",\\n\\t\\t\\t\\\"elements.display.divider.or_separator\\\": \\\"OR\\\",\\n\\t\\t\\t\\\"elements.display.copyable_text.copy\\\": \\\"Copy\\\",\\n\\t\\t\\t\\\"elements.display.copyable_text.copied\\\": \\\"Copied!\\\",\\n\\t\\t\\t\\\"elements.fields.generic.placeholder\\\": \\\"Enter your {field}\\\",\\n\\t\\t\\t\\\"elements.fields.username.label\\\": \\\"Username\\\",\\n\\t\\t\\t\\\"elements.fields.username.placeholder\\\": \\\"Enter your username\\\",\\n\\t\\t\\t\\\"elements.fields.password.label\\\": \\\"Password\\\",\\n\\t\\t\\t\\\"elements.fields.password.placeholder\\\": \\\"Enter your password\\\",\\n\\t\\t\\t\\\"elements.fields.first_name.label\\\": \\\"First Name\\\",\\n\\t\\t\\t\\\"elements.fields.first_name.placeholder\\\": \\\"Enter your first name\\\",\\n\\t\\t\\t\\\"elements.fields.last_name.label\\\": \\\"Last Name\\\",\\n\\t\\t\\t\\\"elements.fields.last_name.placeholder\\\": \\\"Enter your last name\\\",\\n\\t\\t\\t\\\"elements.fields.email.label\\\": \\\"Email\\\",\\n\\t\\t\\t\\\"elements.fields.email.placeholder\\\": \\\"Enter your email\\\",\\n\\t\\t\\t\\\"elements.fields.organization.name.label\\\": \\\"Organization Name\\\",\\n\\t\\t\\t\\\"elements.fields.organization.handle.label\\\": \\\"Organization Handle\\\",\\n\\t\\t\\t\\\"elements.fields.organization.description.label\\\": \\\"Organization Description\\\",\\n\\t\\t\\t\\\"elements.fields.organization.select.label\\\": \\\"Select Organization\\\",\\n\\t\\t\\t\\\"elements.fields.organization.select.placeholder\\\": \\\"Choose an organization\\\",\\n\\t\\t\\t\\\"validations.required.field.error\\\": \\\"This field is required\\\",\\n\\t\\t\\t\\\"signin.heading\\\": \\\"Sign In\\\",\\n\\t\\t\\t\\\"signin.subheading\\\": \\\"Welcome back! Please sign in to continue.\\\",\\n\\t\\t\\t\\\"signup.heading\\\": \\\"Sign Up\\\",\\n\\t\\t\\t\\\"signup.subheading\\\": \\\"Create a new account to get started.\\\",\\n\\t\\t\\t\\\"email.otp.heading\\\": \\\"OTP Verification\\\",\\n\\t\\t\\t\\\"email.otp.subheading\\\": \\\"Enter the code sent to your email address.\\\",\\n\\t\\t\\t\\\"email.otp.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"identifier.first.heading\\\": \\\"Sign In\\\",\\n\\t\\t\\t\\\"identifier.first.subheading\\\": \\\"Enter your username or email address.\\\",\\n\\t\\t\\t\\\"identifier.first.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"sms.otp.heading\\\": \\\"OTP Verification\\\",\\n\\t\\t\\t\\\"sms.otp.subheading\\\": \\\"Enter the code sent to your phone number.\\\",\\n\\t\\t\\t\\\"sms.otp.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"totp.heading\\\": \\\"Verify Your Identity\\\",\\n\\t\\t\\t\\\"totp.subheading\\\": \\\"Enter the code from your authenticator app.\\\",\\n\\t\\t\\t\\\"totp.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"username.password.heading\\\": \\\"Sign In\\\",\\n\\t\\t\\t\\\"username.password.subheading\\\": \\\"Enter your username and password to continue.\\\",\\n\\t\\t\\t\\\"username.password.buttons.submit.text\\\": \\\"Continue\\\",\\n\\t\\t\\t\\\"passkey.button.use\\\": \\\"Sign in with Passkey\\\",\\n\\t\\t\\t\\\"passkey.signin.heading\\\": \\\"Sign in with Passkey\\\",\\n\\t\\t\\t\\\"passkey.register.heading\\\": \\\"Register Passkey\\\",\\n\\t\\t\\t\\\"passkey.register.description\\\": \\\"Create a passkey to securely sign in to your account without a password.\\\",\\n\\t\\t\\t\\\"user.profile.heading\\\": \\\"Profile\\\",\\n\\t\\t\\t\\\"user.profile.update.generic.error\\\": \\\"An error occurred while updating your profile. Please try again.\\\",\\n\\t\\t\\t\\\"organization.switcher.switch.organization\\\": \\\"Switch Organization\\\",\\n\\t\\t\\t\\\"organization.switcher.loading.placeholder.organizations\\\": \\\"Loading organizations...\\\",\\n\\t\\t\\t\\\"organization.switcher.members\\\": \\\"members\\\",\\n\\t\\t\\t\\\"organization.switcher.member\\\": \\\"member\\\",\\n\\t\\t\\t\\\"organization.switcher.create.organization\\\": \\\"Create Organization\\\",\\n\\t\\t\\t\\\"organization.switcher.manage.organizations\\\": \\\"Manage Organizations\\\",\\n\\t\\t\\t\\\"organization.switcher.buttons.manage.text\\\": \\\"Manage\\\",\\n\\t\\t\\t\\\"organization.switcher.organizations.heading\\\": \\\"Organizations\\\",\\n\\t\\t\\t\\\"organization.switcher.buttons.switch.text\\\": \\\"Switch\\\",\\n\\t\\t\\t\\\"organization.switcher.no.access\\\": \\\"No Access\\\",\\n\\t\\t\\t\\\"organization.switcher.status.label\\\": \\\"Status:\\\",\\n\\t\\t\\t\\\"organization.switcher.showing.count\\\": \\\"Showing {showing} of {total} organizations\\\",\\n\\t\\t\\t\\\"organization.switcher.buttons.refresh.text\\\": \\\"Refresh\\\",\\n\\t\\t\\t\\\"organization.switcher.buttons.load_more.text\\\": \\\"Load More Organizations\\\",\\n\\t\\t\\t\\\"organization.switcher.loading.more\\\": \\\"Loading...\\\",\\n\\t\\t\\t\\\"organization.switcher.no.organizations\\\": \\\"No organizations found\\\",\\n\\t\\t\\t\\\"organization.switcher.error.prefix\\\": \\\"Error:\\\",\\n\\t\\t\\t\\\"organization.profile.heading\\\": \\\"Organization Profile\\\",\\n\\t\\t\\t\\\"organization.profile.loading\\\": \\\"Loading organization...\\\",\\n\\t\\t\\t\\\"organization.profile.error\\\": \\\"Failed to load organization\\\",\\n\\t\\t\\t\\\"organization.create.heading\\\": \\\"Create Organization\\\",\\n\\t\\t\\t\\\"organization.create.buttons.create_organization.text\\\": \\\"Create Organization\\\",\\n\\t\\t\\t\\\"organization.create.buttons.create_organization.loading.text\\\": \\\"Creating...\\\",\\n\\t\\t\\t\\\"organization.create.buttons.cancel.text\\\": \\\"Cancel\\\",\\n\\t\\t\\t\\\"messages.loading.placeholder\\\": \\\"Loading...\\\",\\n\\t\\t\\t\\\"errors.heading\\\": \\\"Error\\\",\\n\\t\\t\\t\\\"errors.signin.components.not.available\\\": \\\"Sign-in form is not available at the moment. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.initialization\\\": \\\"An error occurred while initializing. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.flow.failure\\\": \\\"An error occurred during the sign-in flow. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.flow.completion.failure\\\": \\\"An error occurred while completing the sign-in flow. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.flow.passkeys.failure\\\": \\\"An error occurred while signing in with passkeys. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.flow.passkeys.completion.failure\\\": \\\"An error occurred while completing the passkeys sign-in flow. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signin.timeout\\\": \\\"Time allowed to complete the step has expired.\\\",\\n\\t\\t\\t\\\"errors.signup.initialization\\\": \\\"An error occurred while initializing. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signup.flow.failure\\\": \\\"An error occurred during the sign-up flow. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signup.flow.initialization.failure\\\": \\\"An error occurred while initializing the sign-up flow. Please try again later.\\\",\\n\\t\\t\\t\\\"errors.signup.components.not.available\\\": \\\"Sign-up form is not available at the moment. Please try again later.\\\"\\n\\t\\t}\\n\\t};\\n\\tvar en_US_default = en_US;\\n\\n//#endregion\\n//#region ../javascript/src/i18n/constants/TranslationBundleConstants.ts\\n/**\\n\\t* Constants related to internationalization (i18n) translation bundles.\\n\\t*\\n\\t* @example\\n\\t* ```typescript\\n\\t* // Using default locale\\n\\t* const locale = TranslationBundleConstants.FALLBACK_LOCALE;\\n\\t*\\n\\t* // Using supported locales\\n\\t* const locales = TranslationBundleConstants.DEFAULT_LOCALES;\\n\\t* ```\\n\\t*/\\n\\tconst TranslationBundleConstants = {\\n\\t\\tDEFAULT_LOCALES: [en_US_default.metadata.localeCode],\\n\\t\\tFALLBACK_LOCALE: en_US_default.metadata.localeCode\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/constants/messages-types.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\tconst INIT = \\\"init\\\";\\n\\tconst SIGN_OUT = \\\"sign-out\\\";\\n\\tconst HTTP_REQUEST = \\\"http-request\\\";\\n\\tconst HTTP_REQUEST_ALL = \\\"http-request-all\\\";\\n\\tconst REQUEST_CUSTOM_GRANT = \\\"request-custom-grant\\\";\\n\\tconst REVOKE_ACCESS_TOKEN = \\\"revoke-access-token\\\";\\n\\tconst REQUEST_START = \\\"request-start\\\";\\n\\tconst REQUEST_SUCCESS = \\\"request-success\\\";\\n\\tconst REQUEST_FINISH = \\\"request-finish\\\";\\n\\tconst GET_OIDC_SERVICE_ENDPOINTS = \\\"get-oidc-service-endpoints\\\";\\n\\tconst GET_BASIC_USER_INFO = \\\"get-basic-user-info\\\";\\n\\tconst GET_DECODED_ID_TOKEN = \\\"get-decoded-id-token\\\";\\n\\tconst GET_CRYPTO_HELPER = \\\"get-crypto-helper\\\";\\n\\tconst ENABLE_HTTP_HANDLER = \\\"enable_http_handler\\\";\\n\\tconst DISABLE_HTTP_HANDLER = \\\"disable_http_handler\\\";\\n\\tconst GET_AUTH_URL = \\\"get_auth_url\\\";\\n\\tconst REQUEST_ACCESS_TOKEN = \\\"request_get_token\\\";\\n\\tconst IS_AUTHENTICATED = \\\"is_authenticated\\\";\\n\\tconst GET_SIGN_OUT_URL = \\\"get_sign_out_url\\\";\\n\\tconst REFRESH_ACCESS_TOKEN = \\\"refresh_access-token\\\";\\n\\tconst REFRESH_ACCESS_TOKEN_ERR0R = \\\"refresh-access-token-error\\\";\\n\\tconst SET_SESSION_STATE = \\\"set_session_state\\\";\\n\\tconst START_AUTO_REFRESH_TOKEN = \\\"start_auto_refresh_token\\\";\\n\\tconst UPDATE_CONFIG = \\\"update_config\\\";\\n\\tconst GET_ID_TOKEN = \\\"get_id_token\\\";\\n\\tconst CHECK_SESSION_SIGNED_IN = \\\"check_session_signed_in\\\";\\n\\tconst CHECK_SESSION_SIGNED_OUT = \\\"check_session_signed_out\\\";\\n\\tconst GET_CONFIG_DATA = \\\"get_config_data\\\";\\n\\tconst SET_SESSION_STATE_FROM_IFRAME = \\\"set_session_state_from_iframe\\\";\\n\\n//#endregion\\n//#region src/__legacy__/constants/session-management.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\tconst OP_IFRAME = \\\"opIFrame\\\";\\n\\tconst RP_IFRAME = \\\"rpIFrame\\\";\\n\\tconst PROMPT_NONE_IFRAME = \\\"promptNoneIFrame\\\";\\n\\tconst STATE = \\\"Y2hlY2tTZXNzaW9u\\\";\\n\\tconst SILENT_SIGN_IN_STATE = \\\"sign-in-silently\\\";\\n\\tconst INITIALIZED_SILENT_SIGN_IN = \\\"initialized-silent-sign-in\\\";\\n\\tconst PROMPT_NONE_REQUEST_SENT = \\\"promptNoneRequestSent\\\";\\n\\n//#endregion\\n//#region src/__legacy__/constants/parameters.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\tconst ERROR = \\\"error\\\";\\n\\tconst ERROR_DESCRIPTION = \\\"error_description\\\";\\n\\tconst CUSTOM_GRANT_CONFIG = \\\"custom_grant_config\\\";\\n\\tconst STATE_QUERY = \\\"state\\\";\\n\\n//#endregion\\n//#region src/__legacy__/constants/errors.ts\\n/**\\n\\t* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\tconst ACCESS_TOKEN_INVALID = \\\"Access token is invalid\\\";\\n\\n//#endregion\\n//#region src/__legacy__/models/storage.ts\\n/**\\n\\t* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\\n\\t*\\n\\t* WSO2 LLC. licenses this file to you under the Apache License,\\n\\t* Version 2.0 (the \\\"License\\\"); you may not use this file except\\n\\t* in compliance with the License.\\n\\t* You may obtain a copy of the License at\\n\\t*\\n\\t* http://www.apache.org/licenses/LICENSE-2.0\\n\\t*\\n\\t* Unless required by applicable law or agreed to in writing,\\n\\t* software distributed under the License is distributed on an\\n\\t* \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\\n\\t* KIND, either express or implied. See the License for the\\n\\t* specific language governing permissions and limitations\\n\\t* under the License.\\n\\t*/\\n\\t/**\\n\\t* Enum for the different storage types.\\n\\t*/\\n\\tlet BrowserStorage = /* @__PURE__ */ function(BrowserStorage$1) {\\n\\t\\t/**\\n\\t\\t* Stores the session information in the local storage\\n\\t\\t*/\\n\\t\\tBrowserStorage$1[\\\"LocalStorage\\\"] = \\\"localStorage\\\";\\n\\t\\t/**\\n\\t\\t* Store the session information in the session storage.\\n\\t\\t*/\\n\\t\\tBrowserStorage$1[\\\"SessionStorage\\\"] = \\\"sessionStorage\\\";\\n\\t\\t/**\\n\\t\\t* Store the session information in the web worker.\\n\\t\\t*/\\n\\t\\tBrowserStorage$1[\\\"WebWorker\\\"] = \\\"webWorker\\\";\\n\\t\\t/**\\n\\t\\t* Store the session information in the browser memory.\\n\\t\\t*/\\n\\t\\tBrowserStorage$1[\\\"BrowserMemory\\\"] = \\\"browserMemory\\\";\\n\\t\\treturn BrowserStorage$1;\\n\\t}({});\\n\\n//#endregion\\n//#region src/__legacy__/utils/message-utils.ts\\n\\tvar MessageUtils = class {\\n\\t\\tconstructor() {}\\n\\t\\t/**\\n\\t\\t* JSON stringifies the passed object.\\n\\t\\t*\\n\\t\\t* @param {any} data The data object.\\n\\t\\t*\\n\\t\\t* @return {ResponseMessage<string>} JSON string.\\n\\t\\t*/\\n\\t\\tstatic generateSuccessMessage(data) {\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tblob: data?.data instanceof Blob ? data?.data : null,\\n\\t\\t\\t\\tdata: JSON.stringify(data ?? \\\"\\\"),\\n\\t\\t\\t\\tsuccess: true\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* JSON stringifies the passed object.\\n\\t\\t*\\n\\t\\t* @param {any} error The error object.\\n\\t\\t*\\n\\t\\t* @return {ResponseMessage<string>} JSON string.\\n\\t\\t*/\\n\\t\\tstatic generateFailureMessage(error) {\\n\\t\\t\\tif (error?.toJSON) delete error.toJSON;\\n\\t\\t\\tlet serializedError;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tif (error instanceof Error) serializedError = JSON.stringify({\\n\\t\\t\\t\\t\\tname: error.name,\\n\\t\\t\\t\\t\\tmessage: error.message,\\n\\t\\t\\t\\t\\tstack: error.stack,\\n\\t\\t\\t\\t\\t...error\\n\\t\\t\\t\\t});\\n\\t\\t\\t\\telse if (typeof error === \\\"object\\\" && error !== null) try {\\n\\t\\t\\t\\t\\tserializedError = JSON.stringify(error);\\n\\t\\t\\t\\t} catch {\\n\\t\\t\\t\\t\\tserializedError = JSON.stringify({\\n\\t\\t\\t\\t\\t\\tmessage: error.toString ? error.toString() : \\\"Unknown error\\\",\\n\\t\\t\\t\\t\\t\\toriginalError: String(error)\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\telse serializedError = JSON.stringify(error ?? \\\"Unknown error\\\");\\n\\t\\t\\t} catch {\\n\\t\\t\\t\\tserializedError = JSON.stringify({\\n\\t\\t\\t\\t\\tmessage: \\\"Error serialization failed\\\",\\n\\t\\t\\t\\t\\toriginalError: String(error)\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t\\treturn {\\n\\t\\t\\t\\terror: serializedError,\\n\\t\\t\\t\\tsuccess: false\\n\\t\\t\\t};\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/utils/spa-utils.ts\\n\\tvar SPAUtils = class SPAUtils {\\n\\t\\tconstructor() {}\\n\\t\\tstatic removeAuthorizationCode() {\\n\\t\\t\\tconst url = location.href;\\n\\t\\t\\thistory.pushState({}, document.title, url.replace(/\\\\?code=.*$/, \\\"\\\"));\\n\\t\\t}\\n\\t\\tstatic getPKCE(pkceKey) {\\n\\t\\t\\treturn sessionStorage.getItem(pkceKey) ?? \\\"\\\";\\n\\t\\t}\\n\\t\\tstatic setPKCE(pkceKey, pkce) {\\n\\t\\t\\tsessionStorage.setItem(pkceKey, pkce);\\n\\t\\t}\\n\\t\\tstatic setSignOutURL(url, clientId, instanceId) {\\n\\t\\t\\tsessionStorage.setItem(`${OIDCRequestConstants_default.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${instanceId}-${clientId}`, url);\\n\\t\\t}\\n\\t\\tstatic getSignOutUrl(clientId, instanceId) {\\n\\t\\t\\treturn sessionStorage.getItem(`${OIDCRequestConstants_default.SignOut.Storage.StorageKeys.SIGN_OUT_URL}-instance_${instanceId}-${clientId}`) ?? \\\"\\\";\\n\\t\\t}\\n\\t\\tstatic removePKCE(pkceKey) {\\n\\t\\t\\tsessionStorage.removeItem(pkceKey);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* This method is used to discontinue the execution of the `signIn` method if `callOnlyOnRedirect` is true and\\n\\t\\t* the method is not called on being redirected from the authorization server.\\n\\t\\t*\\n\\t\\t* This method can be used to allow the `signIn` method to be called only\\n\\t\\t* on being redirected from the authorization server.\\n\\t\\t*\\n\\t\\t* @param callOnlyOnRedirect {boolean} - True if the method should only be called on redirect.\\n\\t\\t* @param authorizationCode {string} - Authorization code.\\n\\t\\t*\\n\\t\\t* @returns {boolean} - True if the method should be called.\\n\\t\\t*/\\n\\t\\tstatic canContinueSignIn(callOnlyOnRedirect, authorizationCode) {\\n\\t\\t\\tif (callOnlyOnRedirect && !SPAUtils.hasErrorInURL() && !SPAUtils.hasAuthSearchParamsInURL() && !authorizationCode) return false;\\n\\t\\t\\treturn true;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Specifies if `trySilentSignIn` has been called.\\n\\t\\t*\\n\\t\\t* @returns {boolean} True if the `trySilentSignIn` method has been called once.\\n\\t\\t*/\\n\\t\\tstatic isInitializedSilentSignIn() {\\n\\t\\t\\treturn SPAUtils.isSilentStatePresentInURL();\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Specifies if the `signIn` method has been called.\\n\\t\\t*\\n\\t\\t* @returns {boolean} True if the `signIn` has been called.\\n\\t\\t*/\\n\\t\\tstatic wasSignInCalled() {\\n\\t\\t\\tif (SPAUtils.hasErrorInURL() || SPAUtils.hasAuthSearchParamsInURL()) {\\n\\t\\t\\t\\tif (!this.isSilentStatePresentInURL()) return true;\\n\\t\\t\\t}\\n\\t\\t\\treturn false;\\n\\t\\t}\\n\\t\\tstatic wasSilentSignInCalled() {\\n\\t\\t\\tconst silentSignIsInitialized = sessionStorage.getItem(INITIALIZED_SILENT_SIGN_IN);\\n\\t\\t\\tconst isSilentSignInInitialized = silentSignIsInitialized ? JSON.parse(silentSignIsInitialized) : null;\\n\\t\\t\\treturn Boolean(isSilentSignInInitialized);\\n\\t\\t}\\n\\t\\tstatic async isSignOutSuccessful() {\\n\\t\\t\\tif (ThunderIDAuthClient.isSignOutSuccessful(window.location.href)) {\\n\\t\\t\\t\\tconst newUrl = window.location.href.split(\\\"?\\\")[0];\\n\\t\\t\\t\\thistory.pushState({}, document.title, newUrl);\\n\\t\\t\\t\\tawait ThunderIDAuthClient.clearSession();\\n\\t\\t\\t\\treturn true;\\n\\t\\t\\t}\\n\\t\\t\\treturn false;\\n\\t\\t}\\n\\t\\tstatic didSignOutFail() {\\n\\t\\t\\tif (ThunderIDAuthClient.didSignOutFail(window.location.href)) {\\n\\t\\t\\t\\tconst url = new URL(window.location.href);\\n\\t\\t\\t\\tconst error = url.searchParams.get(ERROR);\\n\\t\\t\\t\\tconst description = url.searchParams.get(ERROR_DESCRIPTION);\\n\\t\\t\\t\\tconst newUrl = window.location.href.split(\\\"?\\\")[0];\\n\\t\\t\\t\\thistory.pushState({}, document.title, newUrl);\\n\\t\\t\\t\\treturn {\\n\\t\\t\\t\\t\\tdescription: description ?? \\\"\\\",\\n\\t\\t\\t\\t\\terror: error ?? \\\"\\\"\\n\\t\\t\\t\\t};\\n\\t\\t\\t}\\n\\t\\t\\treturn false;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Checks if the URL the user agent is redirected to after an authorization request has the state parameter.\\n\\t\\t*\\n\\t\\t* @returns {boolean} True if there is a session-check state or a silent sign-in state.\\n\\t\\t*/\\n\\t\\tstatic isSilentStatePresentInURL() {\\n\\t\\t\\treturn new URL(window.location.href).searchParams.get(\\\"state\\\")?.includes(SILENT_SIGN_IN_STATE) ?? false;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Util function to test if `code` and `session_state` are available in the URL as search params.\\n\\t\\t* @since 0.2.0\\n\\t\\t* @deprecated Use `hasAuthParamsInUrl` from `@thunderid/browser` instead.\\n\\t\\t*\\n\\t\\t* @param params - Search params.\\n\\t\\t* @return {boolean}\\n\\t\\t*/\\n\\t\\tstatic hasAuthSearchParamsInURL(params = window.location.search) {\\n\\t\\t\\treturn /[?&]code=[^&]+/.test(params);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Util function to check if the URL contains an error.\\n\\t\\t*\\n\\t\\t* @param url - URL to be checked.\\n\\t\\t*\\n\\t\\t* @returns {boolean} - True if the URL contains an error.\\n\\t\\t*/\\n\\t\\tstatic hasErrorInURL(url = window.location.href) {\\n\\t\\t\\tconst urlObject = new URL(url);\\n\\t\\t\\treturn !!urlObject.searchParams.get(ERROR) && urlObject.searchParams.get(STATE_QUERY) !== OIDCRequestConstants_default.Params.SIGN_OUT_SUCCESS;\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Checks if a prompt none can be sent by checking if a request has already been sent.\\n\\t\\t*\\n\\t\\t* @since 0.2.3\\n\\t\\t*\\n\\t\\t* @returns {boolean} - True if a prompt none request has not been sent.\\n\\t\\t*/\\n\\t\\tstatic canSendPromptNoneRequest() {\\n\\t\\t\\tconst promptNoneRequestSentRaw = sessionStorage.getItem(PROMPT_NONE_REQUEST_SENT);\\n\\t\\t\\treturn !(promptNoneRequestSentRaw ? JSON.parse(promptNoneRequestSentRaw) : null);\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Sets the status of prompt none request.\\n\\t\\t*\\n\\t\\t* @since 0.2.3\\n\\t\\t*\\n\\t\\t* @param canSend {boolean} - True if a prompt none request can be sent.\\n\\t\\t*/\\n\\t\\tstatic setPromptNoneRequestSent(canSend) {\\n\\t\\t\\tsessionStorage.setItem(PROMPT_NONE_REQUEST_SENT, JSON.stringify(canSend));\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Waits for a specified amount of time to give the user agent enough time to redirect.\\n\\t\\t*\\n\\t\\t* @param time {number} - Time in seconds.\\n\\t\\t*/\\n\\t\\tstatic async waitTillPageRedirect(time) {\\n\\t\\t\\tconst timeToWait = time ?? 3e3;\\n\\t\\t\\tawait new Promise((resolve) => setTimeout(resolve, timeToWait * 1e3));\\n\\t\\t}\\n\\t\\t/**\\n\\t\\t* Waits for a condition before executing the rest of the code in non-blocking manner.\\n\\t\\t*\\n\\t\\t* @param condition {() => boolean} - Condition to be checked.\\n\\t\\t* @param timeout {number} - Time in miliseconds.\\n\\t\\t*/\\n\\t\\tstatic until = (condition, timeout = 500) => {\\n\\t\\t\\tconst poll = (done) => condition() ? done() : setTimeout(() => poll(done), timeout);\\n\\t\\t\\treturn new Promise(poll);\\n\\t\\t};\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/helpers/authentication-helper.ts\\n\\tvar AuthenticationHelper = class {\\n\\t\\t_authenticationClient;\\n\\t\\t_storageManager;\\n\\t\\t_spaHelper;\\n\\t\\t_instanceId;\\n\\t\\t_isTokenRefreshing;\\n\\t\\tconstructor(authClient, spaHelper) {\\n\\t\\t\\tthis._authenticationClient = authClient;\\n\\t\\t\\tthis._storageManager = this._authenticationClient.getStorageManager();\\n\\t\\t\\tthis._spaHelper = spaHelper;\\n\\t\\t\\tthis._instanceId = this._authenticationClient.getInstanceId();\\n\\t\\t\\tthis._isTokenRefreshing = false;\\n\\t\\t}\\n\\t\\tenableHttpHandler(httpClient) {\\n\\t\\t\\thttpClient?.enableHandler && httpClient.enableHandler();\\n\\t\\t}\\n\\t\\tdisableHttpHandler(httpClient) {\\n\\t\\t\\thttpClient?.disableHandler && httpClient.disableHandler();\\n\\t\\t}\\n\\t\\tinitializeSessionManger(config, oidcEndpoints, getSessionState, getAuthzURL, sessionManagementHelper) {\\n\\t\\t\\tsessionManagementHelper.initialize(config.clientId, oidcEndpoints.checkSessionIframe ?? \\\"\\\", getSessionState, config.checkSessionInterval ?? 3, config.sessionRefreshInterval ?? 300, config.afterSignInUrl, getAuthzURL);\\n\\t\\t}\\n\\t\\tasync exchangeToken(config, enableRetrievingSignOutURLFromSession) {\\n\\t\\t\\tconst _config = await this._storageManager.getConfigData();\\n\\t\\t\\tlet useDefaultEndpoint = true;\\n\\t\\t\\tlet matches = false;\\n\\t\\t\\tif (config?.tokenEndpoint) {\\n\\t\\t\\t\\tuseDefaultEndpoint = false;\\n\\t\\t\\t\\tif (_config.storage === BrowserStorage.WebWorker) {\\n\\t\\t\\t\\t\\tfor (const baseUrl of [..._config?.allowedExternalUrls ?? [], config.baseUrl]) if (baseUrl && config.tokenEndpoint?.startsWith(baseUrl)) {\\n\\t\\t\\t\\t\\t\\tmatches = true;\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t} else matches = true;\\n\\t\\t\\t}\\n\\t\\t\\tif (config.shouldReplayAfterRefresh) this._storageManager.setTemporaryDataParameter(CUSTOM_GRANT_CONFIG, JSON.stringify(config));\\n\\t\\t\\tif (useDefaultEndpoint || matches) return this._authenticationClient.exchangeToken(config).then(async (response) => {\\n\\t\\t\\t\\tif (enableRetrievingSignOutURLFromSession && typeof enableRetrievingSignOutURLFromSession === \\\"function\\\") enableRetrievingSignOutURLFromSession(config);\\n\\t\\t\\t\\tif (config.returnsSession) {\\n\\t\\t\\t\\t\\tthis._spaHelper.refreshAccessTokenAutomatically(this);\\n\\t\\t\\t\\t\\treturn this._authenticationClient.getUser();\\n\\t\\t\\t\\t} else return response;\\n\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t});\\n\\t\\t\\telse return Promise.reject(new ThunderIDAuthException(\\\"SPA-MAIN_THREAD_CLIENT-RCG-IV01\\\", \\\"Request to the provided endpoint is prohibited.\\\", \\\"Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified token endpoint in this request cannot be found among the `allowedExternalUrls`\\\"));\\n\\t\\t}\\n\\t\\tasync getCustomGrantConfigData() {\\n\\t\\t\\tconst configString = await this._storageManager.getTemporaryDataParameter(CUSTOM_GRANT_CONFIG);\\n\\t\\t\\tif (configString) return JSON.parse(configString);\\n\\t\\t\\telse return null;\\n\\t\\t}\\n\\t\\tasync refreshAccessToken(enableRetrievingSignOutURLFromSession) {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tawait this._authenticationClient.refreshAccessToken();\\n\\t\\t\\t\\tconst customGrantConfig = await this.getCustomGrantConfigData();\\n\\t\\t\\t\\tif (customGrantConfig) await this.exchangeToken(customGrantConfig, enableRetrievingSignOutURLFromSession);\\n\\t\\t\\t\\tthis._spaHelper.refreshAccessTokenAutomatically(this);\\n\\t\\t\\t\\treturn this._authenticationClient.getUser();\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tconst refreshTokenError = { type: REFRESH_ACCESS_TOKEN_ERR0R };\\n\\t\\t\\t\\twindow.postMessage(refreshTokenError);\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tasync retryFailedRequests(failedRequest) {\\n\\t\\t\\tconst httpClient = failedRequest.httpClient;\\n\\t\\t\\tconst requestConfig = failedRequest.requestConfig;\\n\\t\\t\\tconst isHttpHandlerEnabled = failedRequest.isHttpHandlerEnabled;\\n\\t\\t\\tconst httpErrorCallback = failedRequest.httpErrorCallback;\\n\\t\\t\\tconst httpFinishCallback = failedRequest.httpFinishCallback;\\n\\t\\t\\tawait SPAUtils.until(() => !this._isTokenRefreshing);\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst httpResponse = await httpClient.request(requestConfig);\\n\\t\\t\\t\\treturn Promise.resolve(httpResponse);\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback(error);\\n\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tasync httpRequest(httpClient, requestConfig, isHttpHandlerEnabled, httpErrorCallback, httpFinishCallback, enableRetrievingSignOutURLFromSession) {\\n\\t\\t\\tlet matches = false;\\n\\t\\t\\tconst config = await this._storageManager.getConfigData();\\n\\t\\t\\tif (config.storage === BrowserStorage.WebWorker) {\\n\\t\\t\\t\\tfor (const baseUrl of [...config?.allowedExternalUrls ?? [], config.baseUrl]) if (baseUrl && requestConfig?.url?.startsWith(baseUrl)) {\\n\\t\\t\\t\\t\\tmatches = true;\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t} else matches = true;\\n\\t\\t\\tif (matches) return httpClient.request(requestConfig).then((response) => {\\n\\t\\t\\t\\treturn Promise.resolve(response);\\n\\t\\t\\t}).catch(async (error) => {\\n\\t\\t\\t\\tif (error?.response?.status === 401 || !error?.response) {\\n\\t\\t\\t\\t\\tif (this._isTokenRefreshing) return this.retryFailedRequests({\\n\\t\\t\\t\\t\\t\\tenableRetrievingSignOutURLFromSession,\\n\\t\\t\\t\\t\\t\\thttpClient,\\n\\t\\t\\t\\t\\t\\thttpErrorCallback,\\n\\t\\t\\t\\t\\t\\thttpFinishCallback,\\n\\t\\t\\t\\t\\t\\tisHttpHandlerEnabled,\\n\\t\\t\\t\\t\\t\\trequestConfig\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tthis._isTokenRefreshing = true;\\n\\t\\t\\t\\t\\tlet refreshAccessTokenResponse;\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\trefreshAccessTokenResponse = await this.refreshAccessToken(enableRetrievingSignOutURLFromSession);\\n\\t\\t\\t\\t\\t\\tthis._isTokenRefreshing = false;\\n\\t\\t\\t\\t\\t} catch (refreshError) {\\n\\t\\t\\t\\t\\t\\tthis._isTokenRefreshing = false;\\n\\t\\t\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback({\\n\\t\\t\\t\\t\\t\\t\\t\\t...error,\\n\\t\\t\\t\\t\\t\\t\\t\\tcode: ACCESS_TOKEN_INVALID\\n\\t\\t\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-HR-SE01\\\", refreshError?.name ?? \\\"Refresh token request failed.\\\", refreshError?.message ?? \\\"An error occurred while trying to refresh the access token following a 401 response from the server.\\\");\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (refreshAccessTokenResponse) try {\\n\\t\\t\\t\\t\\t\\tconst httpResponse = await httpClient.request(requestConfig);\\n\\t\\t\\t\\t\\t\\treturn Promise.resolve(httpResponse);\\n\\t\\t\\t\\t\\t} catch (error$1) {\\n\\t\\t\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback(error$1);\\n\\t\\t\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\treturn Promise.reject(error$1);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback(error);\\n\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t});\\n\\t\\t\\telse return Promise.reject(new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-HR-IV02\\\", \\\"Request to the provided endpoint is prohibited.\\\", \\\"Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`\\\"));\\n\\t\\t}\\n\\t\\tasync httpRequestAll(requestConfigs, httpClient, isHttpHandlerEnabled, httpErrorCallback, httpFinishCallback) {\\n\\t\\t\\tlet matches = true;\\n\\t\\t\\tconst config = await this._storageManager.getConfigData();\\n\\t\\t\\tif (config.storage === BrowserStorage.WebWorker) for (const requestConfig of requestConfigs) {\\n\\t\\t\\t\\tlet urlMatches = false;\\n\\t\\t\\t\\tfor (const baseUrl of [...config?.allowedExternalUrls ?? [], config.baseUrl]) if (baseUrl && requestConfig.url?.startsWith(baseUrl)) {\\n\\t\\t\\t\\t\\turlMatches = true;\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tif (!urlMatches) {\\n\\t\\t\\t\\t\\tmatches = false;\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tconst requests = [];\\n\\t\\t\\tif (matches) {\\n\\t\\t\\t\\trequestConfigs.forEach((request) => {\\n\\t\\t\\t\\t\\trequests.push(httpClient.request(request));\\n\\t\\t\\t\\t});\\n\\t\\t\\t\\treturn httpClient?.all && httpClient.all(requests).then((responses) => {\\n\\t\\t\\t\\t\\treturn Promise.resolve(responses);\\n\\t\\t\\t\\t}).catch(async (error) => {\\n\\t\\t\\t\\t\\tif (error?.response?.status === 401 || !error?.response) {\\n\\t\\t\\t\\t\\t\\tlet refreshTokenResponse;\\n\\t\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\t\\trefreshTokenResponse = await this._authenticationClient.refreshAccessToken();\\n\\t\\t\\t\\t\\t\\t} catch (refreshError) {\\n\\t\\t\\t\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback({\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t...error,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\tcode: ACCESS_TOKEN_INVALID\\n\\t\\t\\t\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-HRA-SE01\\\", refreshError?.name ?? \\\"Refresh token request failed.\\\", refreshError?.message ?? \\\"An error occurred while trying to refresh the access token following a 401 response from the server.\\\");\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\tif (refreshTokenResponse) return httpClient.all && httpClient.all(requests).then((response) => {\\n\\t\\t\\t\\t\\t\\t\\treturn Promise.resolve(response);\\n\\t\\t\\t\\t\\t\\t}).catch(async (error$1) => {\\n\\t\\t\\t\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback(error$1);\\n\\t\\t\\t\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\treturn Promise.reject(error$1);\\n\\t\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (isHttpHandlerEnabled) {\\n\\t\\t\\t\\t\\t\\tif (typeof httpErrorCallback === \\\"function\\\") await httpErrorCallback(error);\\n\\t\\t\\t\\t\\t\\tif (typeof httpFinishCallback === \\\"function\\\") httpFinishCallback();\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t\\t});\\n\\t\\t\\t} else throw new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-HRA-IV02\\\", \\\"Request to the provided endpoint is prohibited.\\\", \\\"Requests can only be sent to resource servers specified by the `allowedExternalUrls` attribute while initializing the SDK. The specified endpoint in this request cannot be found among the `allowedExternalUrls`\\\");\\n\\t\\t}\\n\\t\\tasync requestAccessToken(authorizationCode, sessionState, checkSession, pkce, state, tokenRequestConfig) {\\n\\t\\t\\tconst config = await this._storageManager.getConfigData();\\n\\t\\t\\tif (config.storage === BrowserStorage.BrowserMemory && config.enablePKCE && sessionState) {\\n\\t\\t\\t\\tconst pkce$1 = SPAUtils.getPKCE(extractPkceStorageKeyFromState_default(sessionState));\\n\\t\\t\\t\\tawait this._authenticationClient.setPKCECode(extractPkceStorageKeyFromState_default(sessionState), pkce$1);\\n\\t\\t\\t} else if (config.storage === BrowserStorage.WebWorker && pkce) await this._authenticationClient.setPKCECode(pkce, state ?? \\\"\\\");\\n\\t\\t\\tif (authorizationCode) return this._authenticationClient.requestAccessToken(authorizationCode, sessionState ?? \\\"\\\", state ?? \\\"\\\", void 0, tokenRequestConfig).then(async () => {\\n\\t\\t\\t\\tif (config.storage !== BrowserStorage.WebWorker) {\\n\\t\\t\\t\\t\\tSPAUtils.setSignOutURL(await this._authenticationClient.getSignOutUrl(), config.clientId, this._instanceId);\\n\\t\\t\\t\\t\\tif (this._spaHelper) {\\n\\t\\t\\t\\t\\t\\tthis._spaHelper.clearRefreshTokenTimeout();\\n\\t\\t\\t\\t\\t\\tthis._spaHelper.refreshAccessTokenAutomatically(this);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (checkSession && typeof checkSession === \\\"function\\\" && config.syncSession) checkSession();\\n\\t\\t\\t\\t} else if (this._spaHelper) this._spaHelper.refreshAccessTokenAutomatically(this);\\n\\t\\t\\t\\treturn this._authenticationClient.getUser();\\n\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t});\\n\\t\\t\\treturn Promise.reject(new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-RAT1-NF01\\\", \\\"No authorization code.\\\", \\\"No authorization code was found.\\\"));\\n\\t\\t}\\n\\t\\tasync signInSilently(constructSilentSignInUrl, requestAccessToken, sessionManagementHelper, additionalParams, tokenRequestConfig) {\\n\\t\\t\\tif (SPAUtils.isInitializedSilentSignIn()) {\\n\\t\\t\\t\\tawait sessionManagementHelper.receivePromptNoneResponse();\\n\\t\\t\\t\\treturn Promise.resolve({\\n\\t\\t\\t\\t\\tallowedScopes: \\\"\\\",\\n\\t\\t\\t\\t\\tdisplayName: \\\"\\\",\\n\\t\\t\\t\\t\\temail: \\\"\\\",\\n\\t\\t\\t\\t\\tsessionState: \\\"\\\",\\n\\t\\t\\t\\t\\tsub: \\\"\\\",\\n\\t\\t\\t\\t\\ttenantDomain: \\\"\\\",\\n\\t\\t\\t\\t\\tusername: \\\"\\\"\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t\\tconst promptNoneIFrame = document.getElementById(RP_IFRAME)?.contentDocument?.getElementById(PROMPT_NONE_IFRAME);\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tpromptNoneIFrame.src = await constructSilentSignInUrl(additionalParams);\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t}\\n\\t\\t\\treturn new Promise((resolve, reject) => {\\n\\t\\t\\t\\tconst timer = setTimeout(() => {\\n\\t\\t\\t\\t\\tresolve(false);\\n\\t\\t\\t\\t}, 1e4);\\n\\t\\t\\t\\tconst listenToPromptNoneIFrame = async (e) => {\\n\\t\\t\\t\\t\\tconst data = e.data;\\n\\t\\t\\t\\t\\tif (data?.type == CHECK_SESSION_SIGNED_OUT) {\\n\\t\\t\\t\\t\\t\\twindow.removeEventListener(\\\"message\\\", listenToPromptNoneIFrame);\\n\\t\\t\\t\\t\\t\\tclearTimeout(timer);\\n\\t\\t\\t\\t\\t\\tresolve(false);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (data?.type == CHECK_SESSION_SIGNED_IN && data?.data?.code) requestAccessToken(data?.data?.code, data?.data?.sessionState, data?.data?.state, tokenRequestConfig).then((response) => {\\n\\t\\t\\t\\t\\t\\twindow.removeEventListener(\\\"message\\\", listenToPromptNoneIFrame);\\n\\t\\t\\t\\t\\t\\tresolve(response);\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\twindow.removeEventListener(\\\"message\\\", listenToPromptNoneIFrame);\\n\\t\\t\\t\\t\\t\\treject(error);\\n\\t\\t\\t\\t\\t}).finally(() => {\\n\\t\\t\\t\\t\\t\\tclearTimeout(timer);\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\twindow.addEventListener(\\\"message\\\", listenToPromptNoneIFrame);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\tasync handleSignIn(shouldStopAuthn, checkSession, tryRetrievingUserInfo) {\\n\\t\\t\\tconst config = await this._storageManager.getConfigData();\\n\\t\\t\\tif (await shouldStopAuthn()) return Promise.resolve({\\n\\t\\t\\t\\tallowedScopes: \\\"\\\",\\n\\t\\t\\t\\tdisplayName: \\\"\\\",\\n\\t\\t\\t\\temail: \\\"\\\",\\n\\t\\t\\t\\tsessionState: \\\"\\\",\\n\\t\\t\\t\\tsub: \\\"\\\",\\n\\t\\t\\t\\ttenantDomain: \\\"\\\",\\n\\t\\t\\t\\tusername: \\\"\\\"\\n\\t\\t\\t});\\n\\t\\t\\tif (config.storage !== BrowserStorage.WebWorker) {\\n\\t\\t\\t\\tif (await this._authenticationClient.isSignedIn()) {\\n\\t\\t\\t\\t\\tthis._spaHelper.clearRefreshTokenTimeout();\\n\\t\\t\\t\\t\\tthis._spaHelper.refreshAccessTokenAutomatically(this);\\n\\t\\t\\t\\t\\tif (config.syncSession) checkSession();\\n\\t\\t\\t\\t\\treturn Promise.resolve(await this._authenticationClient.getUser());\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tconst error = new URL(window.location.href).searchParams.get(ERROR);\\n\\t\\t\\tconst errorDescription = new URL(window.location.href).searchParams.get(ERROR_DESCRIPTION);\\n\\t\\t\\tif (error) {\\n\\t\\t\\t\\tconst url = new URL(window.location.href);\\n\\t\\t\\t\\turl.searchParams.delete(ERROR);\\n\\t\\t\\t\\turl.searchParams.delete(ERROR_DESCRIPTION);\\n\\t\\t\\t\\thistory.pushState(null, document.title, url.toString());\\n\\t\\t\\t\\tthrow new ThunderIDAuthException(\\\"SPA-AUTH_HELPER-SI-SE01\\\", error, errorDescription ?? \\\"\\\");\\n\\t\\t\\t}\\n\\t\\t\\tif (config.storage === BrowserStorage.WebWorker && tryRetrievingUserInfo) {\\n\\t\\t\\t\\tconst basicUserInfo = await tryRetrievingUserInfo();\\n\\t\\t\\t\\tif (basicUserInfo) return basicUserInfo;\\n\\t\\t\\t}\\n\\t\\t\\treturn Promise.resolve(void 0);\\n\\t\\t}\\n\\t\\tasync attachTokenToRequestConfig(request) {\\n\\t\\t\\tconst requestConfig = {\\n\\t\\t\\t\\tattachToken: true,\\n\\t\\t\\t\\t...request\\n\\t\\t\\t};\\n\\t\\t\\tif (requestConfig.attachToken) if (requestConfig.shouldAttachIDPAccessToken) request.headers = {\\n\\t\\t\\t\\t...request.headers,\\n\\t\\t\\t\\tAuthorization: `Bearer ${await this.getIDPAccessToken()}`\\n\\t\\t\\t};\\n\\t\\t\\telse request.headers = {\\n\\t\\t\\t\\t...request.headers,\\n\\t\\t\\t\\tAuthorization: `Bearer ${await this.getAccessToken()}`\\n\\t\\t\\t};\\n\\t\\t}\\n\\t\\tasync getUser() {\\n\\t\\t\\treturn this._authenticationClient.getUser();\\n\\t\\t}\\n\\t\\tasync getDecodedIdToken(sessionId) {\\n\\t\\t\\treturn this._authenticationClient.getDecodedIdToken(sessionId);\\n\\t\\t}\\n\\t\\tasync getDecodedIDPIDToken() {\\n\\t\\t\\treturn this._authenticationClient.getDecodedIdToken();\\n\\t\\t}\\n\\t\\tasync getCrypto() {\\n\\t\\t\\treturn this._authenticationClient.getCrypto();\\n\\t\\t}\\n\\t\\tasync getIdToken() {\\n\\t\\t\\treturn this._authenticationClient.getIdToken();\\n\\t\\t}\\n\\t\\tasync getOpenIDProviderEndpoints() {\\n\\t\\t\\treturn this._authenticationClient.getOpenIDProviderEndpoints();\\n\\t\\t}\\n\\t\\tasync getAccessToken(sessionId) {\\n\\t\\t\\treturn this._authenticationClient.getAccessToken(sessionId);\\n\\t\\t}\\n\\t\\tasync getIDPAccessToken() {\\n\\t\\t\\treturn (await this._storageManager.getSessionData())?.access_token;\\n\\t\\t}\\n\\t\\tgetStorageManager() {\\n\\t\\t\\treturn this._storageManager;\\n\\t\\t}\\n\\t\\tasync isSignedIn() {\\n\\t\\t\\treturn this._authenticationClient.isSignedIn();\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/helpers/spa-helper.ts\\n\\tvar SPAHelper = class {\\n\\t\\t_authenticationClient;\\n\\t\\t_storageManager;\\n\\t\\t_isTokenRefreshLoading = false;\\n\\t\\tconstructor(authClient) {\\n\\t\\t\\tthis._authenticationClient = authClient;\\n\\t\\t\\tthis._storageManager = this._authenticationClient.getStorageManager();\\n\\t\\t}\\n\\t\\tasync refreshAccessTokenAutomatically(authenticationHelper) {\\n\\t\\t\\tif (!((await this._storageManager.getConfigData())?.periodicTokenRefresh ?? false)) return;\\n\\t\\t\\tconst sessionData = await this._storageManager.getSessionData();\\n\\t\\t\\tif (sessionData.refresh_token) {\\n\\t\\t\\t\\tif (sessionData.created_at == null || sessionData.expires_in == null) return;\\n\\t\\t\\t\\tconst TOKEN_REFRESH_BUFFER_MS = 1e4;\\n\\t\\t\\t\\tconst expiryTime = Number(sessionData.expires_in) * 1e3;\\n\\t\\t\\t\\tconst timeUntilRefresh = sessionData.created_at + expiryTime - Date.now() - TOKEN_REFRESH_BUFFER_MS;\\n\\t\\t\\t\\tif (timeUntilRefresh <= 0) {\\n\\t\\t\\t\\t\\tif (this._isTokenRefreshLoading) return;\\n\\t\\t\\t\\t\\tthis._isTokenRefreshLoading = true;\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tawait authenticationHelper.refreshAccessToken();\\n\\t\\t\\t\\t\\t} finally {\\n\\t\\t\\t\\t\\t\\tthis._isTokenRefreshLoading = false;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\treturn;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tconst timer = setTimeout(async () => {\\n\\t\\t\\t\\t\\tif (this._isTokenRefreshLoading) return;\\n\\t\\t\\t\\t\\tthis._isTokenRefreshLoading = true;\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tawait authenticationHelper.refreshAccessToken();\\n\\t\\t\\t\\t\\t} finally {\\n\\t\\t\\t\\t\\t\\tthis._isTokenRefreshLoading = false;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}, timeUntilRefresh);\\n\\t\\t\\t\\tawait this._storageManager.setTemporaryDataParameter(TokenConstants_default.Storage.StorageKeys.REFRESH_TOKEN_TIMER, JSON.stringify(timer));\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\tasync getRefreshTimeoutTimer() {\\n\\t\\t\\tif (await this._storageManager.getTemporaryDataParameter(TokenConstants_default.Storage.StorageKeys.REFRESH_TOKEN_TIMER)) return JSON.parse(await this._storageManager.getTemporaryDataParameter(TokenConstants_default.Storage.StorageKeys.REFRESH_TOKEN_TIMER));\\n\\t\\t\\treturn -1;\\n\\t\\t}\\n\\t\\tasync clearRefreshTokenTimeout(timer) {\\n\\t\\t\\tif (timer) {\\n\\t\\t\\t\\tclearTimeout(timer);\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\tconst refreshTimer = await this.getRefreshTimeoutTimer();\\n\\t\\t\\tif (refreshTimer !== -1) clearTimeout(refreshTimer);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/helpers/session-management-helper.ts\\n\\tconst SessionManagementHelper = (() => {\\n\\t\\tlet _clientID;\\n\\t\\tlet _checkSessionEndpoint;\\n\\t\\tlet _sessionState;\\n\\t\\tlet _interval;\\n\\t\\tlet _redirectURL;\\n\\t\\tlet _sessionRefreshInterval;\\n\\t\\tlet _signOut;\\n\\t\\tlet _sessionRefreshIntervalTimeout;\\n\\t\\tlet _checkSessionIntervalTimeout;\\n\\t\\tlet _storage;\\n\\t\\tlet _setSessionState;\\n\\t\\tlet _getSignInUrl;\\n\\t\\tconst initialize = (clientId, checkSessionEndpoint, getSessionState, interval, sessionRefreshInterval, redirectURL, getSignInUrl) => {\\n\\t\\t\\t_clientID = clientId;\\n\\t\\t\\t_checkSessionEndpoint = checkSessionEndpoint;\\n\\t\\t\\t_sessionState = getSessionState;\\n\\t\\t\\t_interval = interval;\\n\\t\\t\\t_redirectURL = redirectURL;\\n\\t\\t\\t_sessionRefreshInterval = sessionRefreshInterval;\\n\\t\\t\\t_getSignInUrl = getSignInUrl;\\n\\t\\t\\tif (_interval > -1) initiateCheckSession();\\n\\t\\t\\tif (_sessionRefreshInterval > -1) sessionRefreshInterval = setInterval(() => {\\n\\t\\t\\t\\tsendPromptNoneRequest();\\n\\t\\t\\t}, _sessionRefreshInterval * 1e3);\\n\\t\\t};\\n\\t\\tconst initiateCheckSession = async () => {\\n\\t\\t\\tif (!_checkSessionEndpoint || !_clientID || !_redirectURL) return;\\n\\t\\t\\tconst OP_IFRAME$1 = \\\"opIFrame\\\";\\n\\t\\t\\tasync function checkSession() {\\n\\t\\t\\t\\tconst sessionState = await _sessionState();\\n\\t\\t\\t\\tif (Boolean(_clientID) && Boolean(sessionState)) {\\n\\t\\t\\t\\t\\tconst message$1 = `${_clientID} ${sessionState}`;\\n\\t\\t\\t\\t\\t(document.getElementById(RP_IFRAME)?.contentDocument?.getElementById(OP_IFRAME$1)).contentWindow?.postMessage(message$1, _checkSessionEndpoint);\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\tconst opIframe = document.getElementById(RP_IFRAME)?.contentDocument?.getElementById(OP_IFRAME$1);\\n\\t\\t\\topIframe.src = _checkSessionEndpoint + \\\"?client_id=\\\" + _clientID + \\\"&redirect_uri=\\\" + _redirectURL;\\n\\t\\t\\t_checkSessionIntervalTimeout = setInterval(checkSession, _interval * 1e3);\\n\\t\\t\\tlistenToResponseFromOPIFrame();\\n\\t\\t};\\n\\t\\t/**\\n\\t\\t* Destroys session intervals.\\n\\t\\t*/\\n\\t\\tconst reset = () => {\\n\\t\\t\\tclearInterval(_checkSessionIntervalTimeout);\\n\\t\\t\\tclearInterval(_sessionRefreshIntervalTimeout);\\n\\t\\t};\\n\\t\\tconst listenToResponseFromOPIFrame = () => {\\n\\t\\t\\tasync function receiveMessage(e) {\\n\\t\\t\\t\\tconst targetOrigin = _checkSessionEndpoint;\\n\\t\\t\\t\\tif (!targetOrigin || targetOrigin?.indexOf(e.origin) < 0 || e?.data?.type === SET_SESSION_STATE_FROM_IFRAME) return;\\n\\t\\t\\t\\tif (e.data === \\\"unchanged\\\") {} else if (e.data === \\\"error\\\") window.location.href = await _signOut();\\n\\t\\t\\t\\telse if (e.data === \\\"changed\\\") sendPromptNoneRequest();\\n\\t\\t\\t}\\n\\t\\t\\twindow?.addEventListener(\\\"message\\\", receiveMessage, false);\\n\\t\\t};\\n\\t\\tconst sendPromptNoneRequest = async () => {\\n\\t\\t\\tconst promptNoneIFrame = document.getElementById(RP_IFRAME)?.contentDocument?.getElementById(PROMPT_NONE_IFRAME);\\n\\t\\t\\tif (SPAUtils.canSendPromptNoneRequest()) {\\n\\t\\t\\t\\tSPAUtils.setPromptNoneRequestSent(true);\\n\\t\\t\\t\\tconst receiveMessageListener = (e) => {\\n\\t\\t\\t\\t\\tif (e?.data?.type === SET_SESSION_STATE_FROM_IFRAME) {\\n\\t\\t\\t\\t\\t\\t_setSessionState(e?.data?.data ?? \\\"\\\");\\n\\t\\t\\t\\t\\t\\twindow?.removeEventListener(\\\"message\\\", receiveMessageListener);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tif (_storage === BrowserStorage.BrowserMemory || _storage === BrowserStorage.WebWorker) window?.addEventListener(\\\"message\\\", receiveMessageListener);\\n\\t\\t\\t\\tpromptNoneIFrame.src = await _getSignInUrl({\\n\\t\\t\\t\\t\\tprompt: \\\"none\\\",\\n\\t\\t\\t\\t\\tresponse_mode: \\\"query\\\",\\n\\t\\t\\t\\t\\tstate: STATE\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\t/**\\n\\t\\t* This contains the logic to process the response of a prompt none request.\\n\\t\\t*\\n\\t\\t* @param setSessionState The method that sets the session state.\\n\\t\\t* on the output of the content of the redirect URL\\n\\t\\t*/\\n\\t\\tconst receivePromptNoneResponse = async (setSessionState) => {\\n\\t\\t\\tconst state = new URL(window.location.href).searchParams.get(STATE_QUERY);\\n\\t\\t\\tconst sessionState = new URL(window.location.href).searchParams.get(OIDCRequestConstants_default.Params.SESSION_STATE);\\n\\t\\t\\tconst parent = window.parent.parent;\\n\\t\\t\\tif (state !== null && (state.includes(STATE) || state.includes(SILENT_SIGN_IN_STATE))) {\\n\\t\\t\\t\\tconst code$1 = new URL(window.location.href).searchParams.get(\\\"code\\\");\\n\\t\\t\\t\\tif (code$1 !== null && code$1.length !== 0) {\\n\\t\\t\\t\\t\\tif (state.includes(SILENT_SIGN_IN_STATE)) {\\n\\t\\t\\t\\t\\t\\tconst message$1 = {\\n\\t\\t\\t\\t\\t\\t\\tdata: {\\n\\t\\t\\t\\t\\t\\t\\t\\tcode: code$1,\\n\\t\\t\\t\\t\\t\\t\\t\\tsessionState: sessionState ?? \\\"\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\tstate\\n\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\ttype: CHECK_SESSION_SIGNED_IN\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\tsessionStorage.setItem(INITIALIZED_SILENT_SIGN_IN, \\\"false\\\");\\n\\t\\t\\t\\t\\t\\tparent.postMessage(message$1, parent.origin);\\n\\t\\t\\t\\t\\t\\tSPAUtils.setPromptNoneRequestSent(false);\\n\\t\\t\\t\\t\\t\\twindow.location.href = \\\"about:blank\\\";\\n\\t\\t\\t\\t\\t\\tawait SPAUtils.waitTillPageRedirect();\\n\\t\\t\\t\\t\\t\\treturn true;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tconst newSessionState = new URL(window.location.href).searchParams.get(\\\"session_state\\\");\\n\\t\\t\\t\\t\\tif (_storage === BrowserStorage.LocalStorage || _storage === BrowserStorage.SessionStorage) setSessionState && await setSessionState(newSessionState);\\n\\t\\t\\t\\t\\telse {\\n\\t\\t\\t\\t\\t\\tconst message$1 = {\\n\\t\\t\\t\\t\\t\\t\\tdata: newSessionState ?? \\\"\\\",\\n\\t\\t\\t\\t\\t\\t\\ttype: SET_SESSION_STATE_FROM_IFRAME\\n\\t\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t\\twindow?.parent?.parent?.postMessage(message$1);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tSPAUtils.setPromptNoneRequestSent(false);\\n\\t\\t\\t\\t\\twindow.location.href = \\\"about:blank\\\";\\n\\t\\t\\t\\t\\tawait SPAUtils.waitTillPageRedirect();\\n\\t\\t\\t\\t\\treturn true;\\n\\t\\t\\t\\t} else {\\n\\t\\t\\t\\t\\tif (state.includes(SILENT_SIGN_IN_STATE)) {\\n\\t\\t\\t\\t\\t\\tconst message$1 = { type: CHECK_SESSION_SIGNED_OUT };\\n\\t\\t\\t\\t\\t\\twindow.parent.parent.postMessage(message$1, parent.origin);\\n\\t\\t\\t\\t\\t\\tSPAUtils.setPromptNoneRequestSent(false);\\n\\t\\t\\t\\t\\t\\twindow.location.href = \\\"about:blank\\\";\\n\\t\\t\\t\\t\\t\\tawait SPAUtils.waitTillPageRedirect();\\n\\t\\t\\t\\t\\t\\treturn true;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tSPAUtils.setPromptNoneRequestSent(false);\\n\\t\\t\\t\\t\\tconst signOutURL = await _signOut();\\n\\t\\t\\t\\t\\tawait ThunderIDAuthClient.clearSession();\\n\\t\\t\\t\\t\\tparent.location.href = signOutURL;\\n\\t\\t\\t\\t\\twindow.location.href = \\\"about:blank\\\";\\n\\t\\t\\t\\t\\tawait SPAUtils.waitTillPageRedirect();\\n\\t\\t\\t\\t\\treturn true;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\treturn false;\\n\\t\\t};\\n\\t\\treturn async (signOut, storage, setSessionState) => {\\n\\t\\t\\tlet rpIFrame = document.createElement(\\\"iframe\\\");\\n\\t\\t\\trpIFrame.setAttribute(\\\"id\\\", RP_IFRAME);\\n\\t\\t\\trpIFrame.style.display = \\\"none\\\";\\n\\t\\t\\tlet rpIframeLoaded = false;\\n\\t\\t\\trpIFrame.onload = () => {\\n\\t\\t\\t\\trpIFrame = document.getElementById(RP_IFRAME);\\n\\t\\t\\t\\tconst rpDoc = rpIFrame?.contentDocument;\\n\\t\\t\\t\\tconst opIFrame = rpDoc?.createElement(\\\"iframe\\\");\\n\\t\\t\\t\\tif (opIFrame) {\\n\\t\\t\\t\\t\\topIFrame.setAttribute(\\\"id\\\", OP_IFRAME);\\n\\t\\t\\t\\t\\topIFrame.style.display = \\\"none\\\";\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tconst promptNoneIFrame = rpDoc?.createElement(\\\"iframe\\\");\\n\\t\\t\\t\\tif (promptNoneIFrame) {\\n\\t\\t\\t\\t\\tpromptNoneIFrame.setAttribute(\\\"id\\\", PROMPT_NONE_IFRAME);\\n\\t\\t\\t\\t\\tpromptNoneIFrame.style.display = \\\"none\\\";\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\topIFrame && rpIFrame?.contentDocument?.body?.appendChild(opIFrame);\\n\\t\\t\\t\\tpromptNoneIFrame && rpIFrame?.contentDocument?.body?.appendChild(promptNoneIFrame);\\n\\t\\t\\t\\trpIframeLoaded = true;\\n\\t\\t\\t};\\n\\t\\t\\tdocument?.body?.appendChild(rpIFrame);\\n\\t\\t\\t_signOut = signOut;\\n\\t\\t\\t_storage = storage;\\n\\t\\t\\t_setSessionState = setSessionState;\\n\\t\\t\\tconst sleep = () => {\\n\\t\\t\\t\\treturn new Promise((resolve) => setTimeout(resolve, 1));\\n\\t\\t\\t};\\n\\t\\t\\twhile (rpIframeLoaded === false) await sleep();\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tinitialize,\\n\\t\\t\\t\\treceivePromptNoneResponse,\\n\\t\\t\\t\\treset\\n\\t\\t\\t};\\n\\t\\t};\\n\\t})();\\n\\n//#endregion\\n//#region src/FetchHttpClient.ts\\n/**\\n\\t* Fetch-based HTTP client. Extends `HttpClient` and implements `transport()`\\n\\t* using the native Fetch API.\\n\\t*\\n\\t* To plug in a custom HTTP transport, extend `HttpClient` from `@thunderid/javascript`\\n\\t* and override `transport()`, then pass your implementation where `FetchHttpClient`\\n\\t* is currently used.\\n\\t*/\\n\\tvar FetchHttpClient = class FetchHttpClient extends HttpClient {\\n\\t\\tstatic instances = /* @__PURE__ */ new Map();\\n\\t\\tstatic getInstance(instanceId = 0, isHandlerEnabled = true, attachToken = () => Promise.resolve()) {\\n\\t\\t\\tif (!this.instances.has(instanceId)) this.instances.set(instanceId, new FetchHttpClient(isHandlerEnabled, attachToken));\\n\\t\\t\\treturn this.instances.get(instanceId);\\n\\t\\t}\\n\\t\\tstatic destroyInstance(instanceId = 0) {\\n\\t\\t\\tthis.instances.delete(instanceId);\\n\\t\\t}\\n\\t\\tasync transport(config) {\\n\\t\\t\\tconst { attachToken, data, headers: configHeaders, method, params, shouldAttachIDPAccessToken, shouldEncodeToFormData, startTimeInMs, url: configUrl,...fetchOptions } = config;\\n\\t\\t\\tlet url = configUrl ?? \\\"\\\";\\n\\t\\t\\tif (params) {\\n\\t\\t\\t\\tconst qs = new URLSearchParams(params).toString();\\n\\t\\t\\t\\tif (qs) url = `${url}${url.includes(\\\"?\\\") ? \\\"&\\\" : \\\"?\\\"}${qs}`;\\n\\t\\t\\t}\\n\\t\\t\\tconst headers = { ...configHeaders ?? {} };\\n\\t\\t\\tlet body;\\n\\t\\t\\tif (data !== void 0) if (data instanceof FormData) body = data;\\n\\t\\t\\telse {\\n\\t\\t\\t\\tbody = JSON.stringify(data);\\n\\t\\t\\t\\tif (!headers[\\\"Content-Type\\\"] && !headers[\\\"content-type\\\"]) headers[\\\"Content-Type\\\"] = \\\"application/json\\\";\\n\\t\\t\\t}\\n\\t\\t\\tlet fetchResponse;\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tfetchResponse = await fetch(url, {\\n\\t\\t\\t\\t\\tcredentials: \\\"include\\\",\\n\\t\\t\\t\\t\\t...fetchOptions,\\n\\t\\t\\t\\t\\tbody,\\n\\t\\t\\t\\t\\theaders,\\n\\t\\t\\t\\t\\tmethod: (method ?? \\\"GET\\\").toUpperCase()\\n\\t\\t\\t\\t});\\n\\t\\t\\t} catch (networkError) {\\n\\t\\t\\t\\tthrow Object.assign(new Error(networkError.message), {\\n\\t\\t\\t\\t\\tcode: \\\"NETWORK_ERROR\\\",\\n\\t\\t\\t\\t\\tconfig\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\t\\t\\tconst responseData = (fetchResponse.headers.get(\\\"content-type\\\") ?? \\\"\\\").includes(\\\"application/json\\\") ? await fetchResponse.json() : await fetchResponse.text();\\n\\t\\t\\tconst responseHeaders = {};\\n\\t\\t\\tfetchResponse.headers.forEach((value, key) => {\\n\\t\\t\\t\\tresponseHeaders[key] = value;\\n\\t\\t\\t});\\n\\t\\t\\tif (!fetchResponse.ok) throw Object.assign(new Error(fetchResponse.statusText), {\\n\\t\\t\\t\\tconfig,\\n\\t\\t\\t\\tresponse: {\\n\\t\\t\\t\\t\\tdata: responseData,\\n\\t\\t\\t\\t\\theaders: responseHeaders,\\n\\t\\t\\t\\t\\tstatus: fetchResponse.status,\\n\\t\\t\\t\\t\\tstatusText: fetchResponse.statusText\\n\\t\\t\\t\\t}\\n\\t\\t\\t});\\n\\t\\t\\treturn {\\n\\t\\t\\t\\tconfig,\\n\\t\\t\\t\\tdata: responseData,\\n\\t\\t\\t\\theaders: responseHeaders,\\n\\t\\t\\t\\tstatus: fetchResponse.status,\\n\\t\\t\\t\\tstatusText: fetchResponse.statusText\\n\\t\\t\\t};\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/stores/memory-store.ts\\n\\tvar MemoryStore = class {\\n\\t\\t_data;\\n\\t\\tconstructor() {\\n\\t\\t\\tthis._data = /* @__PURE__ */ new Map();\\n\\t\\t}\\n\\t\\tasync setData(key, value) {\\n\\t\\t\\tthis._data.set(key, value);\\n\\t\\t}\\n\\t\\tasync getData(key) {\\n\\t\\t\\treturn this._data?.get(key) ?? \\\"{}\\\";\\n\\t\\t}\\n\\t\\tasync removeData(key) {\\n\\t\\t\\tthis._data.delete(key);\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/dist/pad-string.js\\n\\tvar require_pad_string = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/dist/pad-string.js\\\": ((exports) => {\\n\\t\\tObject.defineProperty(exports, \\\"__esModule\\\", { value: true });\\n\\t\\tfunction padString(input) {\\n\\t\\t\\tvar segmentLength = 4;\\n\\t\\t\\tvar stringLength = input.length;\\n\\t\\t\\tvar diff = stringLength % segmentLength;\\n\\t\\t\\tif (!diff) return input;\\n\\t\\t\\tvar position = stringLength;\\n\\t\\t\\tvar padLength = segmentLength - diff;\\n\\t\\t\\tvar paddedStringLength = stringLength + padLength;\\n\\t\\t\\tvar buffer$1 = Buffer.alloc(paddedStringLength);\\n\\t\\t\\tbuffer$1.write(input);\\n\\t\\t\\twhile (padLength--) buffer$1.write(\\\"=\\\", position++);\\n\\t\\t\\treturn buffer$1.toString();\\n\\t\\t}\\n\\t\\texports.default = padString;\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/dist/base64url.js\\n\\tvar require_base64url$1 = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/dist/base64url.js\\\": ((exports) => {\\n\\t\\tObject.defineProperty(exports, \\\"__esModule\\\", { value: true });\\n\\t\\tvar pad_string_1 = require_pad_string();\\n\\t\\tfunction encode(input, encoding) {\\n\\t\\t\\tif (encoding === void 0) encoding = \\\"utf8\\\";\\n\\t\\t\\tif (Buffer.isBuffer(input)) return fromBase64(input.toString(\\\"base64\\\"));\\n\\t\\t\\treturn fromBase64(Buffer.from(input, encoding).toString(\\\"base64\\\"));\\n\\t\\t}\\n\\t\\tfunction decode(base64url$2, encoding) {\\n\\t\\t\\tif (encoding === void 0) encoding = \\\"utf8\\\";\\n\\t\\t\\treturn Buffer.from(toBase64(base64url$2), \\\"base64\\\").toString(encoding);\\n\\t\\t}\\n\\t\\tfunction toBase64(base64url$2) {\\n\\t\\t\\tbase64url$2 = base64url$2.toString();\\n\\t\\t\\treturn pad_string_1.default(base64url$2).replace(/\\\\-/g, \\\"+\\\").replace(/_/g, \\\"/\\\");\\n\\t\\t}\\n\\t\\tfunction fromBase64(base64$1) {\\n\\t\\t\\treturn base64$1.replace(/=/g, \\\"\\\").replace(/\\\\+/g, \\\"-\\\").replace(/\\\\//g, \\\"_\\\");\\n\\t\\t}\\n\\t\\tfunction toBuffer(base64url$2) {\\n\\t\\t\\treturn Buffer.from(toBase64(base64url$2), \\\"base64\\\");\\n\\t\\t}\\n\\t\\tvar base64url$1 = encode;\\n\\t\\tbase64url$1.encode = encode;\\n\\t\\tbase64url$1.decode = decode;\\n\\t\\tbase64url$1.toBase64 = toBase64;\\n\\t\\tbase64url$1.fromBase64 = fromBase64;\\n\\t\\tbase64url$1.toBuffer = toBuffer;\\n\\t\\texports.default = base64url$1;\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/index.js\\n\\tvar require_base64url = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/base64url@3.0.1/node_modules/base64url/index.js\\\": ((exports, module) => {\\n\\t\\tmodule.exports = require_base64url$1().default;\\n\\t\\tmodule.exports.default = module.exports;\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/fast-sha256@1.3.0/node_modules/fast-sha256/sha256.js\\n\\tvar require_sha256 = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/fast-sha256@1.3.0/node_modules/fast-sha256/sha256.js\\\": ((exports, module) => {\\n\\t\\t(function(root, factory) {\\n\\t\\t\\tvar exports$1 = {};\\n\\t\\t\\tfactory(exports$1);\\n\\t\\t\\tvar sha256$1 = exports$1[\\\"default\\\"];\\n\\t\\t\\tfor (var k in exports$1) sha256$1[k] = exports$1[k];\\n\\t\\t\\tif (typeof module === \\\"object\\\" && typeof module.exports === \\\"object\\\") module.exports = sha256$1;\\n\\t\\t\\telse if (typeof define === \\\"function\\\" && define.amd) define(function() {\\n\\t\\t\\t\\treturn sha256$1;\\n\\t\\t\\t});\\n\\t\\t\\telse root.sha256 = sha256$1;\\n\\t\\t})(exports, function(exports$1) {\\n\\t\\t\\texports$1.__esModule = true;\\n\\t\\t\\texports$1.digestLength = 32;\\n\\t\\t\\texports$1.blockSize = 64;\\n\\t\\t\\tvar K = new Uint32Array([\\n\\t\\t\\t\\t1116352408,\\n\\t\\t\\t\\t1899447441,\\n\\t\\t\\t\\t3049323471,\\n\\t\\t\\t\\t3921009573,\\n\\t\\t\\t\\t961987163,\\n\\t\\t\\t\\t1508970993,\\n\\t\\t\\t\\t2453635748,\\n\\t\\t\\t\\t2870763221,\\n\\t\\t\\t\\t3624381080,\\n\\t\\t\\t\\t310598401,\\n\\t\\t\\t\\t607225278,\\n\\t\\t\\t\\t1426881987,\\n\\t\\t\\t\\t1925078388,\\n\\t\\t\\t\\t2162078206,\\n\\t\\t\\t\\t2614888103,\\n\\t\\t\\t\\t3248222580,\\n\\t\\t\\t\\t3835390401,\\n\\t\\t\\t\\t4022224774,\\n\\t\\t\\t\\t264347078,\\n\\t\\t\\t\\t604807628,\\n\\t\\t\\t\\t770255983,\\n\\t\\t\\t\\t1249150122,\\n\\t\\t\\t\\t1555081692,\\n\\t\\t\\t\\t1996064986,\\n\\t\\t\\t\\t2554220882,\\n\\t\\t\\t\\t2821834349,\\n\\t\\t\\t\\t2952996808,\\n\\t\\t\\t\\t3210313671,\\n\\t\\t\\t\\t3336571891,\\n\\t\\t\\t\\t3584528711,\\n\\t\\t\\t\\t113926993,\\n\\t\\t\\t\\t338241895,\\n\\t\\t\\t\\t666307205,\\n\\t\\t\\t\\t773529912,\\n\\t\\t\\t\\t1294757372,\\n\\t\\t\\t\\t1396182291,\\n\\t\\t\\t\\t1695183700,\\n\\t\\t\\t\\t1986661051,\\n\\t\\t\\t\\t2177026350,\\n\\t\\t\\t\\t2456956037,\\n\\t\\t\\t\\t2730485921,\\n\\t\\t\\t\\t2820302411,\\n\\t\\t\\t\\t3259730800,\\n\\t\\t\\t\\t3345764771,\\n\\t\\t\\t\\t3516065817,\\n\\t\\t\\t\\t3600352804,\\n\\t\\t\\t\\t4094571909,\\n\\t\\t\\t\\t275423344,\\n\\t\\t\\t\\t430227734,\\n\\t\\t\\t\\t506948616,\\n\\t\\t\\t\\t659060556,\\n\\t\\t\\t\\t883997877,\\n\\t\\t\\t\\t958139571,\\n\\t\\t\\t\\t1322822218,\\n\\t\\t\\t\\t1537002063,\\n\\t\\t\\t\\t1747873779,\\n\\t\\t\\t\\t1955562222,\\n\\t\\t\\t\\t2024104815,\\n\\t\\t\\t\\t2227730452,\\n\\t\\t\\t\\t2361852424,\\n\\t\\t\\t\\t2428436474,\\n\\t\\t\\t\\t2756734187,\\n\\t\\t\\t\\t3204031479,\\n\\t\\t\\t\\t3329325298\\n\\t\\t\\t]);\\n\\t\\t\\tfunction hashBlocks(w, v, p, pos, len$1) {\\n\\t\\t\\t\\tvar a, b, c, d, e, f, g, h, u, i$1, j, t1, t2;\\n\\t\\t\\t\\twhile (len$1 >= 64) {\\n\\t\\t\\t\\t\\ta = v[0];\\n\\t\\t\\t\\t\\tb = v[1];\\n\\t\\t\\t\\t\\tc = v[2];\\n\\t\\t\\t\\t\\td = v[3];\\n\\t\\t\\t\\t\\te = v[4];\\n\\t\\t\\t\\t\\tf = v[5];\\n\\t\\t\\t\\t\\tg = v[6];\\n\\t\\t\\t\\t\\th = v[7];\\n\\t\\t\\t\\t\\tfor (i$1 = 0; i$1 < 16; i$1++) {\\n\\t\\t\\t\\t\\t\\tj = pos + i$1 * 4;\\n\\t\\t\\t\\t\\t\\tw[i$1] = (p[j] & 255) << 24 | (p[j + 1] & 255) << 16 | (p[j + 2] & 255) << 8 | p[j + 3] & 255;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tfor (i$1 = 16; i$1 < 64; i$1++) {\\n\\t\\t\\t\\t\\t\\tu = w[i$1 - 2];\\n\\t\\t\\t\\t\\t\\tt1 = (u >>> 17 | u << 15) ^ (u >>> 19 | u << 13) ^ u >>> 10;\\n\\t\\t\\t\\t\\t\\tu = w[i$1 - 15];\\n\\t\\t\\t\\t\\t\\tt2 = (u >>> 7 | u << 25) ^ (u >>> 18 | u << 14) ^ u >>> 3;\\n\\t\\t\\t\\t\\t\\tw[i$1] = (t1 + w[i$1 - 7] | 0) + (t2 + w[i$1 - 16] | 0);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tfor (i$1 = 0; i$1 < 64; i$1++) {\\n\\t\\t\\t\\t\\t\\tt1 = (((e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7)) + (e & f ^ ~e & g) | 0) + (h + (K[i$1] + w[i$1] | 0) | 0) | 0;\\n\\t\\t\\t\\t\\t\\tt2 = ((a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10)) + (a & b ^ a & c ^ b & c) | 0;\\n\\t\\t\\t\\t\\t\\th = g;\\n\\t\\t\\t\\t\\t\\tg = f;\\n\\t\\t\\t\\t\\t\\tf = e;\\n\\t\\t\\t\\t\\t\\te = d + t1 | 0;\\n\\t\\t\\t\\t\\t\\td = c;\\n\\t\\t\\t\\t\\t\\tc = b;\\n\\t\\t\\t\\t\\t\\tb = a;\\n\\t\\t\\t\\t\\t\\ta = t1 + t2 | 0;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tv[0] += a;\\n\\t\\t\\t\\t\\tv[1] += b;\\n\\t\\t\\t\\t\\tv[2] += c;\\n\\t\\t\\t\\t\\tv[3] += d;\\n\\t\\t\\t\\t\\tv[4] += e;\\n\\t\\t\\t\\t\\tv[5] += f;\\n\\t\\t\\t\\t\\tv[6] += g;\\n\\t\\t\\t\\t\\tv[7] += h;\\n\\t\\t\\t\\t\\tpos += 64;\\n\\t\\t\\t\\t\\tlen$1 -= 64;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn pos;\\n\\t\\t\\t}\\n\\t\\t\\tvar Hash = function() {\\n\\t\\t\\t\\tfunction Hash$1() {\\n\\t\\t\\t\\t\\tthis.digestLength = exports$1.digestLength;\\n\\t\\t\\t\\t\\tthis.blockSize = exports$1.blockSize;\\n\\t\\t\\t\\t\\tthis.state = new Int32Array(8);\\n\\t\\t\\t\\t\\tthis.temp = new Int32Array(64);\\n\\t\\t\\t\\t\\tthis.buffer = new Uint8Array(128);\\n\\t\\t\\t\\t\\tthis.bufferLength = 0;\\n\\t\\t\\t\\t\\tthis.bytesHashed = 0;\\n\\t\\t\\t\\t\\tthis.finished = false;\\n\\t\\t\\t\\t\\tthis.reset();\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tHash$1.prototype.reset = function() {\\n\\t\\t\\t\\t\\tthis.state[0] = 1779033703;\\n\\t\\t\\t\\t\\tthis.state[1] = 3144134277;\\n\\t\\t\\t\\t\\tthis.state[2] = 1013904242;\\n\\t\\t\\t\\t\\tthis.state[3] = 2773480762;\\n\\t\\t\\t\\t\\tthis.state[4] = 1359893119;\\n\\t\\t\\t\\t\\tthis.state[5] = 2600822924;\\n\\t\\t\\t\\t\\tthis.state[6] = 528734635;\\n\\t\\t\\t\\t\\tthis.state[7] = 1541459225;\\n\\t\\t\\t\\t\\tthis.bufferLength = 0;\\n\\t\\t\\t\\t\\tthis.bytesHashed = 0;\\n\\t\\t\\t\\t\\tthis.finished = false;\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype.clean = function() {\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < this.buffer.length; i$1++) this.buffer[i$1] = 0;\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < this.temp.length; i$1++) this.temp[i$1] = 0;\\n\\t\\t\\t\\t\\tthis.reset();\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype.update = function(data, dataLength) {\\n\\t\\t\\t\\t\\tif (dataLength === void 0) dataLength = data.length;\\n\\t\\t\\t\\t\\tif (this.finished) throw new Error(\\\"SHA256: can't update because hash was finished.\\\");\\n\\t\\t\\t\\t\\tvar dataPos = 0;\\n\\t\\t\\t\\t\\tthis.bytesHashed += dataLength;\\n\\t\\t\\t\\t\\tif (this.bufferLength > 0) {\\n\\t\\t\\t\\t\\t\\twhile (this.bufferLength < 64 && dataLength > 0) {\\n\\t\\t\\t\\t\\t\\t\\tthis.buffer[this.bufferLength++] = data[dataPos++];\\n\\t\\t\\t\\t\\t\\t\\tdataLength--;\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\tif (this.bufferLength === 64) {\\n\\t\\t\\t\\t\\t\\t\\thashBlocks(this.temp, this.state, this.buffer, 0, 64);\\n\\t\\t\\t\\t\\t\\t\\tthis.bufferLength = 0;\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tif (dataLength >= 64) {\\n\\t\\t\\t\\t\\t\\tdataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);\\n\\t\\t\\t\\t\\t\\tdataLength %= 64;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\twhile (dataLength > 0) {\\n\\t\\t\\t\\t\\t\\tthis.buffer[this.bufferLength++] = data[dataPos++];\\n\\t\\t\\t\\t\\t\\tdataLength--;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype.finish = function(out) {\\n\\t\\t\\t\\t\\tif (!this.finished) {\\n\\t\\t\\t\\t\\t\\tvar bytesHashed = this.bytesHashed;\\n\\t\\t\\t\\t\\t\\tvar left = this.bufferLength;\\n\\t\\t\\t\\t\\t\\tvar bitLenHi = bytesHashed / 536870912 | 0;\\n\\t\\t\\t\\t\\t\\tvar bitLenLo = bytesHashed << 3;\\n\\t\\t\\t\\t\\t\\tvar padLength = bytesHashed % 64 < 56 ? 64 : 128;\\n\\t\\t\\t\\t\\t\\tthis.buffer[left] = 128;\\n\\t\\t\\t\\t\\t\\tfor (var i$1 = left + 1; i$1 < padLength - 8; i$1++) this.buffer[i$1] = 0;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 8] = bitLenHi >>> 24 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 7] = bitLenHi >>> 16 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 6] = bitLenHi >>> 8 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 5] = bitLenHi >>> 0 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 4] = bitLenLo >>> 24 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 3] = bitLenLo >>> 16 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 2] = bitLenLo >>> 8 & 255;\\n\\t\\t\\t\\t\\t\\tthis.buffer[padLength - 1] = bitLenLo >>> 0 & 255;\\n\\t\\t\\t\\t\\t\\thashBlocks(this.temp, this.state, this.buffer, 0, padLength);\\n\\t\\t\\t\\t\\t\\tthis.finished = true;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < 8; i$1++) {\\n\\t\\t\\t\\t\\t\\tout[i$1 * 4 + 0] = this.state[i$1] >>> 24 & 255;\\n\\t\\t\\t\\t\\t\\tout[i$1 * 4 + 1] = this.state[i$1] >>> 16 & 255;\\n\\t\\t\\t\\t\\t\\tout[i$1 * 4 + 2] = this.state[i$1] >>> 8 & 255;\\n\\t\\t\\t\\t\\t\\tout[i$1 * 4 + 3] = this.state[i$1] >>> 0 & 255;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype.digest = function() {\\n\\t\\t\\t\\t\\tvar out = new Uint8Array(this.digestLength);\\n\\t\\t\\t\\t\\tthis.finish(out);\\n\\t\\t\\t\\t\\treturn out;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype._saveState = function(out) {\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < this.state.length; i$1++) out[i$1] = this.state[i$1];\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHash$1.prototype._restoreState = function(from$1, bytesHashed) {\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < this.state.length; i$1++) this.state[i$1] = from$1[i$1];\\n\\t\\t\\t\\t\\tthis.bytesHashed = bytesHashed;\\n\\t\\t\\t\\t\\tthis.finished = false;\\n\\t\\t\\t\\t\\tthis.bufferLength = 0;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\treturn Hash$1;\\n\\t\\t\\t}();\\n\\t\\t\\texports$1.Hash = Hash;\\n\\t\\t\\tvar HMAC = function() {\\n\\t\\t\\t\\tfunction HMAC$1(key) {\\n\\t\\t\\t\\t\\tthis.inner = new Hash();\\n\\t\\t\\t\\t\\tthis.outer = new Hash();\\n\\t\\t\\t\\t\\tthis.blockSize = this.inner.blockSize;\\n\\t\\t\\t\\t\\tthis.digestLength = this.inner.digestLength;\\n\\t\\t\\t\\t\\tvar pad = new Uint8Array(this.blockSize);\\n\\t\\t\\t\\t\\tif (key.length > this.blockSize) new Hash().update(key).finish(pad).clean();\\n\\t\\t\\t\\t\\telse for (var i$1 = 0; i$1 < key.length; i$1++) pad[i$1] = key[i$1];\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < pad.length; i$1++) pad[i$1] ^= 54;\\n\\t\\t\\t\\t\\tthis.inner.update(pad);\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < pad.length; i$1++) pad[i$1] ^= 106;\\n\\t\\t\\t\\t\\tthis.outer.update(pad);\\n\\t\\t\\t\\t\\tthis.istate = new Uint32Array(8);\\n\\t\\t\\t\\t\\tthis.ostate = new Uint32Array(8);\\n\\t\\t\\t\\t\\tthis.inner._saveState(this.istate);\\n\\t\\t\\t\\t\\tthis.outer._saveState(this.ostate);\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < pad.length; i$1++) pad[i$1] = 0;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tHMAC$1.prototype.reset = function() {\\n\\t\\t\\t\\t\\tthis.inner._restoreState(this.istate, this.inner.blockSize);\\n\\t\\t\\t\\t\\tthis.outer._restoreState(this.ostate, this.outer.blockSize);\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHMAC$1.prototype.clean = function() {\\n\\t\\t\\t\\t\\tfor (var i$1 = 0; i$1 < this.istate.length; i$1++) this.ostate[i$1] = this.istate[i$1] = 0;\\n\\t\\t\\t\\t\\tthis.inner.clean();\\n\\t\\t\\t\\t\\tthis.outer.clean();\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHMAC$1.prototype.update = function(data) {\\n\\t\\t\\t\\t\\tthis.inner.update(data);\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHMAC$1.prototype.finish = function(out) {\\n\\t\\t\\t\\t\\tif (this.outer.finished) this.outer.finish(out);\\n\\t\\t\\t\\t\\telse {\\n\\t\\t\\t\\t\\t\\tthis.inner.finish(out);\\n\\t\\t\\t\\t\\t\\tthis.outer.update(out, this.digestLength).finish(out);\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\treturn this;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tHMAC$1.prototype.digest = function() {\\n\\t\\t\\t\\t\\tvar out = new Uint8Array(this.digestLength);\\n\\t\\t\\t\\t\\tthis.finish(out);\\n\\t\\t\\t\\t\\treturn out;\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\treturn HMAC$1;\\n\\t\\t\\t}();\\n\\t\\t\\texports$1.HMAC = HMAC;\\n\\t\\t\\tfunction hash(data) {\\n\\t\\t\\t\\tvar h = new Hash().update(data);\\n\\t\\t\\t\\tvar digest = h.digest();\\n\\t\\t\\t\\th.clean();\\n\\t\\t\\t\\treturn digest;\\n\\t\\t\\t}\\n\\t\\t\\texports$1.hash = hash;\\n\\t\\t\\texports$1[\\\"default\\\"] = hash;\\n\\t\\t\\tfunction hmac(key, data) {\\n\\t\\t\\t\\tvar h = new HMAC(key).update(data);\\n\\t\\t\\t\\tvar digest = h.digest();\\n\\t\\t\\t\\th.clean();\\n\\t\\t\\t\\treturn digest;\\n\\t\\t\\t}\\n\\t\\t\\texports$1.hmac = hmac;\\n\\t\\t\\tfunction fillBuffer(buffer$1, hmac$1, info, counter) {\\n\\t\\t\\t\\tvar num = counter[0];\\n\\t\\t\\t\\tif (num === 0) throw new Error(\\\"hkdf: cannot expand more\\\");\\n\\t\\t\\t\\thmac$1.reset();\\n\\t\\t\\t\\tif (num > 1) hmac$1.update(buffer$1);\\n\\t\\t\\t\\tif (info) hmac$1.update(info);\\n\\t\\t\\t\\thmac$1.update(counter);\\n\\t\\t\\t\\thmac$1.finish(buffer$1);\\n\\t\\t\\t\\tcounter[0]++;\\n\\t\\t\\t}\\n\\t\\t\\tvar hkdfSalt = new Uint8Array(exports$1.digestLength);\\n\\t\\t\\tfunction hkdf(key, salt, info, length) {\\n\\t\\t\\t\\tif (salt === void 0) salt = hkdfSalt;\\n\\t\\t\\t\\tif (length === void 0) length = 32;\\n\\t\\t\\t\\tvar counter = new Uint8Array([1]);\\n\\t\\t\\t\\tvar hmac_ = new HMAC(hmac(salt, key));\\n\\t\\t\\t\\tvar buffer$1 = new Uint8Array(hmac_.digestLength);\\n\\t\\t\\t\\tvar bufpos = buffer$1.length;\\n\\t\\t\\t\\tvar out = new Uint8Array(length);\\n\\t\\t\\t\\tfor (var i$1 = 0; i$1 < length; i$1++) {\\n\\t\\t\\t\\t\\tif (bufpos === buffer$1.length) {\\n\\t\\t\\t\\t\\t\\tfillBuffer(buffer$1, hmac_, info, counter);\\n\\t\\t\\t\\t\\t\\tbufpos = 0;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tout[i$1] = buffer$1[bufpos++];\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\thmac_.clean();\\n\\t\\t\\t\\tbuffer$1.fill(0);\\n\\t\\t\\t\\tcounter.fill(0);\\n\\t\\t\\t\\treturn out;\\n\\t\\t\\t}\\n\\t\\t\\texports$1.hkdf = hkdf;\\n\\t\\t\\tfunction pbkdf2(password, salt, iterations, dkLen) {\\n\\t\\t\\t\\tvar prf = new HMAC(password);\\n\\t\\t\\t\\tvar len$1 = prf.digestLength;\\n\\t\\t\\t\\tvar ctr = new Uint8Array(4);\\n\\t\\t\\t\\tvar t = new Uint8Array(len$1);\\n\\t\\t\\t\\tvar u = new Uint8Array(len$1);\\n\\t\\t\\t\\tvar dk = new Uint8Array(dkLen);\\n\\t\\t\\t\\tfor (var i$1 = 0; i$1 * len$1 < dkLen; i$1++) {\\n\\t\\t\\t\\t\\tvar c = i$1 + 1;\\n\\t\\t\\t\\t\\tctr[0] = c >>> 24 & 255;\\n\\t\\t\\t\\t\\tctr[1] = c >>> 16 & 255;\\n\\t\\t\\t\\t\\tctr[2] = c >>> 8 & 255;\\n\\t\\t\\t\\t\\tctr[3] = c >>> 0 & 255;\\n\\t\\t\\t\\t\\tprf.reset();\\n\\t\\t\\t\\t\\tprf.update(salt);\\n\\t\\t\\t\\t\\tprf.update(ctr);\\n\\t\\t\\t\\t\\tprf.finish(u);\\n\\t\\t\\t\\t\\tfor (var j = 0; j < len$1; j++) t[j] = u[j];\\n\\t\\t\\t\\t\\tfor (var j = 2; j <= iterations; j++) {\\n\\t\\t\\t\\t\\t\\tprf.reset();\\n\\t\\t\\t\\t\\t\\tprf.update(u).finish(u);\\n\\t\\t\\t\\t\\t\\tfor (var k = 0; k < len$1; k++) t[k] ^= u[k];\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tfor (var j = 0; j < len$1 && i$1 * len$1 + j < dkLen; j++) dk[i$1 * len$1 + j] = t[j];\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tfor (var i$1 = 0; i$1 < len$1; i$1++) t[i$1] = u[i$1] = 0;\\n\\t\\t\\t\\tfor (var i$1 = 0; i$1 < 4; i$1++) ctr[i$1] = 0;\\n\\t\\t\\t\\tprf.clean();\\n\\t\\t\\t\\treturn dk;\\n\\t\\t\\t}\\n\\t\\t\\texports$1.pbkdf2 = pbkdf2;\\n\\t\\t});\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js\\n\\tvar require_safe_buffer = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js\\\": ((exports, module) => {\\n\\t\\t/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\\n\\t\\tvar buffer = require_buffer();\\n\\t\\tvar Buffer$4 = buffer.Buffer;\\n\\t\\tfunction copyProps(src, dst) {\\n\\t\\t\\tfor (var key in src) dst[key] = src[key];\\n\\t\\t}\\n\\t\\tif (Buffer$4.from && Buffer$4.alloc && Buffer$4.allocUnsafe && Buffer$4.allocUnsafeSlow) module.exports = buffer;\\n\\t\\telse {\\n\\t\\t\\tcopyProps(buffer, exports);\\n\\t\\t\\texports.Buffer = SafeBuffer;\\n\\t\\t}\\n\\t\\tfunction SafeBuffer(arg, encodingOrOffset, length) {\\n\\t\\t\\treturn Buffer$4(arg, encodingOrOffset, length);\\n\\t\\t}\\n\\t\\tSafeBuffer.prototype = Object.create(Buffer$4.prototype);\\n\\t\\tcopyProps(Buffer$4, SafeBuffer);\\n\\t\\tSafeBuffer.from = function(arg, encodingOrOffset, length) {\\n\\t\\t\\tif (typeof arg === \\\"number\\\") throw new TypeError(\\\"Argument must not be a number\\\");\\n\\t\\t\\treturn Buffer$4(arg, encodingOrOffset, length);\\n\\t\\t};\\n\\t\\tSafeBuffer.alloc = function(size, fill, encoding) {\\n\\t\\t\\tif (typeof size !== \\\"number\\\") throw new TypeError(\\\"Argument must be a number\\\");\\n\\t\\t\\tvar buf = Buffer$4(size);\\n\\t\\t\\tif (fill !== void 0) if (typeof encoding === \\\"string\\\") buf.fill(fill, encoding);\\n\\t\\t\\telse buf.fill(fill);\\n\\t\\t\\telse buf.fill(0);\\n\\t\\t\\treturn buf;\\n\\t\\t};\\n\\t\\tSafeBuffer.allocUnsafe = function(size) {\\n\\t\\t\\tif (typeof size !== \\\"number\\\") throw new TypeError(\\\"Argument must be a number\\\");\\n\\t\\t\\treturn Buffer$4(size);\\n\\t\\t};\\n\\t\\tSafeBuffer.allocUnsafeSlow = function(size) {\\n\\t\\t\\tif (typeof size !== \\\"number\\\") throw new TypeError(\\\"Argument must be a number\\\");\\n\\t\\t\\treturn buffer.SlowBuffer(size);\\n\\t\\t};\\n\\t}) });\\n\\n//#endregion\\n//#region ../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js\\n\\tvar require_browser = /* @__PURE__ */ __commonJS({ \\\"../../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js\\\": ((exports, module) => {\\n\\t\\tvar MAX_BYTES = 65536;\\n\\t\\tvar MAX_UINT32 = 4294967295;\\n\\t\\tfunction oldBrowser() {\\n\\t\\t\\tthrow new Error(\\\"Secure random number generation is not supported by this browser.\\\\nUse Chrome, Firefox or Internet Explorer 11\\\");\\n\\t\\t}\\n\\t\\tvar Buffer$3 = require_safe_buffer().Buffer;\\n\\t\\tvar crypto$1 = self.crypto || self.msCrypto;\\n\\t\\tif (crypto$1 && crypto$1.getRandomValues) module.exports = randomBytes;\\n\\t\\telse module.exports = oldBrowser;\\n\\t\\tfunction randomBytes(size, cb) {\\n\\t\\t\\tif (size > MAX_UINT32) throw new RangeError(\\\"requested too many random bytes\\\");\\n\\t\\t\\tvar bytes = Buffer$3.allocUnsafe(size);\\n\\t\\t\\tif (size > 0) if (size > MAX_BYTES) for (var generated = 0; generated < size; generated += MAX_BYTES) crypto$1.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));\\n\\t\\t\\telse crypto$1.getRandomValues(bytes);\\n\\t\\t\\tif (typeof cb === \\\"function\\\") return process.nextTick(function() {\\n\\t\\t\\t\\tcb(null, bytes);\\n\\t\\t\\t});\\n\\t\\t\\treturn bytes;\\n\\t\\t}\\n\\t}) });\\n\\n//#endregion\\n//#region src/__legacy__/utils/crypto-utils.ts\\n\\tvar import_base64url = /* @__PURE__ */ __toESM(require_base64url(), 1);\\n\\tvar import_sha256 = /* @__PURE__ */ __toESM(require_sha256(), 1);\\n\\tvar import_browser = /* @__PURE__ */ __toESM(require_browser(), 1);\\n\\tvar SPACryptoUtils = class {\\n\\t\\t/**\\n\\t\\t* Get URL encoded string.\\n\\t\\t*\\n\\t\\t* @returns {string} base 64 url encoded value.\\n\\t\\t*/\\n\\t\\tbase64URLEncode(value) {\\n\\t\\t\\treturn import_base64url.default.encode(value).replace(/\\\\+/g, \\\"-\\\").replace(/\\\\//g, \\\"_\\\").replace(/=/g, \\\"\\\");\\n\\t\\t}\\n\\t\\tbase64URLDecode(value) {\\n\\t\\t\\treturn import_base64url.default.decode(value).toString();\\n\\t\\t}\\n\\t\\thashSha256(data) {\\n\\t\\t\\treturn import_buffer$1.Buffer.from((0, import_sha256.default)(new TextEncoder().encode(data)));\\n\\t\\t}\\n\\t\\tgenerateRandomBytes(length) {\\n\\t\\t\\treturn (0, import_browser.default)(length);\\n\\t\\t}\\n\\t\\tverifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer) {\\n\\t\\t\\tconst jwtVerifyOptions = {\\n\\t\\t\\t\\talgorithms,\\n\\t\\t\\t\\taudience: [clientId],\\n\\t\\t\\t\\tclockTolerance,\\n\\t\\t\\t\\tsubject\\n\\t\\t\\t};\\n\\t\\t\\tif (validateJwtIssuer ?? true) jwtVerifyOptions.issuer = issuer;\\n\\t\\t\\treturn jwtVerify(idToken, createLocalJWKSet({ keys: [jwk] }), jwtVerifyOptions).then(() => {\\n\\t\\t\\t\\treturn Promise.resolve(true);\\n\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\treturn Promise.reject(new ThunderIDAuthException(\\\"SPA-CRYPTO-UTILS-VJ-IV01\\\", error?.reason ?? JSON.stringify(error), `${error?.code} ${error?.claim}`));\\n\\t\\t\\t});\\n\\t\\t}\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/worker/worker-core.ts\\n\\tconst WebWorkerCore = async (instanceId, config, getAuthHelper) => {\\n\\t\\tconst _store = new MemoryStore();\\n\\t\\tconst _cryptoUtils = new SPACryptoUtils();\\n\\t\\tconst _authenticationClient = new ThunderIDAuthClient();\\n\\t\\tawait _authenticationClient.initialize(config, _store, _cryptoUtils, instanceId);\\n\\t\\tconst _spaHelper = new SPAHelper(_authenticationClient);\\n\\t\\tconst _authenticationHelper = getAuthHelper(_authenticationClient, _spaHelper);\\n\\t\\tconst _dataLayer = _authenticationClient.getStorageManager();\\n\\t\\tconst attachToken = async (request) => {\\n\\t\\t\\tawait _authenticationHelper.attachTokenToRequestConfig(request);\\n\\t\\t};\\n\\t\\tconst _httpClient = FetchHttpClient.getInstance(instanceId, true, attachToken);\\n\\t\\tconst setHttpRequestStartCallback = (callback) => {\\n\\t\\t\\t_httpClient?.setHttpRequestStartCallback && _httpClient.setHttpRequestStartCallback(callback);\\n\\t\\t};\\n\\t\\tconst setHttpRequestSuccessCallback = (callback) => {\\n\\t\\t\\t_httpClient?.setHttpRequestSuccessCallback && _httpClient.setHttpRequestSuccessCallback(callback);\\n\\t\\t};\\n\\t\\tconst setHttpRequestFinishCallback = (callback) => {\\n\\t\\t\\t_httpClient?.setHttpRequestFinishCallback && _httpClient.setHttpRequestFinishCallback(callback);\\n\\t\\t};\\n\\t\\tconst httpRequest = async (requestConfig) => {\\n\\t\\t\\treturn await _authenticationHelper.httpRequest(_httpClient, requestConfig);\\n\\t\\t};\\n\\t\\tconst httpRequestAll = async (requestConfigs) => {\\n\\t\\t\\treturn await _authenticationHelper.httpRequestAll(requestConfigs, _httpClient);\\n\\t\\t};\\n\\t\\tconst enableHttpHandler = () => {\\n\\t\\t\\t_authenticationHelper.enableHttpHandler(_httpClient);\\n\\t\\t};\\n\\t\\tconst disableHttpHandler = () => {\\n\\t\\t\\t_authenticationHelper.disableHttpHandler(_httpClient);\\n\\t\\t};\\n\\t\\tconst getSignInUrl = async (params) => {\\n\\t\\t\\treturn _authenticationClient.getSignInUrl(params).then(async (url) => {\\n\\t\\t\\t\\tconst state = new URL(url).searchParams.get(OIDCRequestConstants_default.Params.STATE) ?? \\\"\\\";\\n\\t\\t\\t\\treturn {\\n\\t\\t\\t\\t\\tauthorizationURL: url,\\n\\t\\t\\t\\t\\tpkce: await _authenticationClient.getPKCECode(state)\\n\\t\\t\\t\\t};\\n\\t\\t\\t}).catch((error) => Promise.reject(error));\\n\\t\\t};\\n\\t\\tconst startAutoRefreshToken = async () => {\\n\\t\\t\\t_spaHelper.clearRefreshTokenTimeout();\\n\\t\\t\\t_spaHelper.refreshAccessTokenAutomatically(_authenticationHelper);\\n\\t\\t};\\n\\t\\tconst requestAccessToken = async (authorizationCode, sessionState, pkce, state) => {\\n\\t\\t\\treturn await _authenticationHelper.requestAccessToken(authorizationCode, sessionState, void 0, pkce, state);\\n\\t\\t};\\n\\t\\tconst signOut = async () => {\\n\\t\\t\\t_spaHelper.clearRefreshTokenTimeout();\\n\\t\\t\\treturn await _authenticationClient.getSignOutUrl();\\n\\t\\t};\\n\\t\\tconst getSignOutUrl = async () => {\\n\\t\\t\\treturn await _authenticationClient.getSignOutUrl();\\n\\t\\t};\\n\\t\\tconst exchangeToken = async (config$1) => {\\n\\t\\t\\treturn await _authenticationHelper.exchangeToken(config$1);\\n\\t\\t};\\n\\t\\tconst refreshAccessToken = async () => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\treturn await _authenticationHelper.refreshAccessToken();\\n\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\treturn Promise.reject(error);\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\tconst revokeAccessToken = async () => {\\n\\t\\t\\tconst timer = await _spaHelper.getRefreshTimeoutTimer();\\n\\t\\t\\treturn _authenticationClient.revokeAccessToken().then(() => {\\n\\t\\t\\t\\t_spaHelper.clearRefreshTokenTimeout(timer);\\n\\t\\t\\t\\treturn Promise.resolve(true);\\n\\t\\t\\t}).catch((error) => Promise.reject(error));\\n\\t\\t};\\n\\t\\tconst getUser = async () => {\\n\\t\\t\\treturn _authenticationHelper.getUser();\\n\\t\\t};\\n\\t\\tconst getDecodedIdToken = async (sessionId) => {\\n\\t\\t\\treturn _authenticationHelper.getDecodedIdToken(sessionId);\\n\\t\\t};\\n\\t\\tconst getCrypto = async () => {\\n\\t\\t\\treturn _authenticationHelper.getCrypto();\\n\\t\\t};\\n\\t\\tconst getDecodedIDPIDToken = async () => {\\n\\t\\t\\treturn _authenticationHelper.getDecodedIDPIDToken();\\n\\t\\t};\\n\\t\\tconst getIdToken = async () => {\\n\\t\\t\\treturn _authenticationHelper.getIdToken();\\n\\t\\t};\\n\\t\\tconst getOpenIDProviderEndpoints = async () => {\\n\\t\\t\\treturn _authenticationHelper.getOpenIDProviderEndpoints();\\n\\t\\t};\\n\\t\\tconst getAccessToken = () => {\\n\\t\\t\\treturn _authenticationHelper.getAccessToken();\\n\\t\\t};\\n\\t\\tconst isSignedIn = () => {\\n\\t\\t\\treturn _authenticationHelper.isSignedIn();\\n\\t\\t};\\n\\t\\tconst setSessionState = async (sessionState) => {\\n\\t\\t\\tawait _dataLayer.setSessionDataParameter(OIDCRequestConstants_default.Params.SESSION_STATE, sessionState);\\n\\t\\t};\\n\\t\\tconst reInitialize = async (config$1) => {\\n\\t\\t\\tawait _authenticationClient.reInitialize(config$1);\\n\\t\\t};\\n\\t\\tconst getConfigData = async () => {\\n\\t\\t\\treturn _dataLayer.getConfigData();\\n\\t\\t};\\n\\t\\treturn {\\n\\t\\t\\tdisableHttpHandler,\\n\\t\\t\\tenableHttpHandler,\\n\\t\\t\\tgetAccessToken,\\n\\t\\t\\tgetSignInUrl,\\n\\t\\t\\tgetUser,\\n\\t\\t\\tgetConfigData,\\n\\t\\t\\tgetCrypto,\\n\\t\\t\\tgetDecodedIDPIDToken,\\n\\t\\t\\tgetDecodedIdToken,\\n\\t\\t\\tgetIdToken,\\n\\t\\t\\tgetOpenIDProviderEndpoints,\\n\\t\\t\\tgetSignOutUrl,\\n\\t\\t\\thttpRequest,\\n\\t\\t\\thttpRequestAll,\\n\\t\\t\\tisSignedIn,\\n\\t\\t\\trefreshAccessToken,\\n\\t\\t\\trequestAccessToken,\\n\\t\\t\\texchangeToken,\\n\\t\\t\\trevokeAccessToken,\\n\\t\\t\\tsetHttpRequestFinishCallback,\\n\\t\\t\\tsetHttpRequestStartCallback,\\n\\t\\t\\tsetHttpRequestSuccessCallback,\\n\\t\\t\\tsetSessionState,\\n\\t\\t\\tsignOut,\\n\\t\\t\\tstartAutoRefreshToken,\\n\\t\\t\\treInitialize\\n\\t\\t};\\n\\t};\\n\\n//#endregion\\n//#region src/__legacy__/worker/worker-receiver.ts\\n\\tconst workerReceiver = (getAuthHelper) => {\\n\\t\\tconst ctx = self;\\n\\t\\tlet webWorker;\\n\\t\\tctx.onmessage = async ({ data, ports }) => {\\n\\t\\t\\tconst port = ports[0];\\n\\t\\t\\tif (data.type !== INIT && !webWorker) {\\n\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(new ThunderIDAuthException(\\\"SPA-CLIENT_WORKER-ONMSG-NF01\\\", \\\"The web worker has not been initialized yet.\\\", \\\"The initialize method needs to be called before the specified operation can be carried out.\\\")));\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\tswitch (data.type) {\\n\\t\\t\\t\\tcase INIT:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\twebWorker = await WebWorkerCore(data.instanceId ?? 0, { ...data.data }, getAuthHelper);\\n\\t\\t\\t\\t\\t\\twebWorker.setHttpRequestFinishCallback(onRequestFinishCallback);\\n\\t\\t\\t\\t\\t\\twebWorker.setHttpRequestStartCallback(onRequestStartCallback);\\n\\t\\t\\t\\t\\t\\twebWorker.setHttpRequestSuccessCallback(onRequestSuccessCallback);\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage());\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_AUTH_URL:\\n\\t\\t\\t\\t\\twebWorker.getSignInUrl(data?.data).then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase REQUEST_ACCESS_TOKEN:\\n\\t\\t\\t\\t\\twebWorker.requestAccessToken(data?.data?.code, data?.data?.sessionState, data?.data?.pkce, data?.data?.state).then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase HTTP_REQUEST: {\\n\\t\\t\\t\\t\\tconst request = data.data;\\n\\t\\t\\t\\t\\tconst requestData = request?.data;\\n\\t\\t\\t\\t\\tif (data.data?.data?.formData === true) {\\n\\t\\t\\t\\t\\t\\tconst formData = new FormData();\\n\\t\\t\\t\\t\\t\\tfor (const key in requestData) {\\n\\t\\t\\t\\t\\t\\t\\tif (key === \\\"formData\\\") continue;\\n\\t\\t\\t\\t\\t\\t\\tformData.append(key, requestData[key]);\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\trequest.data = formData;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\twebWorker.httpRequest(request).then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tcase HTTP_REQUEST_ALL:\\n\\t\\t\\t\\t\\twebWorker.httpRequestAll(data.data).then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase SIGN_OUT:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.signOut()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase REQUEST_CUSTOM_GRANT:\\n\\t\\t\\t\\t\\twebWorker.exchangeToken(data.data).then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase REVOKE_ACCESS_TOKEN:\\n\\t\\t\\t\\t\\twebWorker.revokeAccessToken().then((response) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(response));\\n\\t\\t\\t\\t\\t}).catch((error) => {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t});\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_OIDC_SERVICE_ENDPOINTS:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getOpenIDProviderEndpoints()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_BASIC_USER_INFO:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getUser()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_DECODED_ID_TOKEN:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getDecodedIdToken()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_CRYPTO_HELPER:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getCrypto()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_ID_TOKEN:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getIdToken()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase ENABLE_HTTP_HANDLER:\\n\\t\\t\\t\\t\\twebWorker.enableHttpHandler();\\n\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage());\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase DISABLE_HTTP_HANDLER:\\n\\t\\t\\t\\t\\twebWorker.disableHttpHandler();\\n\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage());\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase IS_AUTHENTICATED:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.isSignedIn()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_SIGN_OUT_URL:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getSignOutUrl()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase REFRESH_ACCESS_TOKEN:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.refreshAccessToken()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase START_AUTO_REFRESH_TOKEN:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(webWorker.startAutoRefreshToken()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase SET_SESSION_STATE:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.setSessionState(data?.data)));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase UPDATE_CONFIG:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.reInitialize(data?.data)));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tcase GET_CONFIG_DATA:\\n\\t\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getConfigData()));\\n\\t\\t\\t\\t\\t} catch (error) {\\n\\t\\t\\t\\t\\t\\tport.postMessage(MessageUtils.generateFailureMessage(error));\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\tdefault: port?.postMessage(MessageUtils.generateFailureMessage(new ThunderIDAuthException(\\\"SPA-CLIENT_WORKER-ONMSG-IV02\\\", \\\"The message type is invalid.\\\", `The message type provided, ${data.type}, is invalid.`)));\\n\\t\\t\\t}\\n\\t\\t};\\n\\t\\tconst onRequestStartCallback = () => {\\n\\t\\t\\tctx.postMessage({ type: REQUEST_START });\\n\\t\\t};\\n\\t\\tconst onRequestSuccessCallback = (response) => {\\n\\t\\t\\tctx.postMessage({\\n\\t\\t\\t\\tdata: JSON.stringify(response ?? \\\"\\\"),\\n\\t\\t\\t\\ttype: REQUEST_SUCCESS\\n\\t\\t\\t});\\n\\t\\t};\\n\\t\\tconst onRequestFinishCallback = () => {\\n\\t\\t\\tctx.postMessage({ type: REQUEST_FINISH });\\n\\t\\t};\\n\\t};\\n\\n//#endregion\\n//#region src/web.worker.ts\\n\\tvar import_buffer = /* @__PURE__ */ __toESM(require_buffer(), 1);\\n\\tif (typeof self !== \\\"undefined\\\" && !self.Buffer) self.Buffer = import_buffer.Buffer;\\n\\tif (typeof self !== \\\"undefined\\\") {\\n\\t\\tif (!self.global) self.global = self;\\n\\t}\\n\\tworkerReceiver((authClient, spaHelper) => new AuthenticationHelper(authClient, spaHelper));\\n\\tvar web_worker_default = {};\\n\\n//#endregion\\nreturn web_worker_default;\\n})();\"], {type: 'application/javascript'});\n const url = URL.createObjectURL(blob);\n export default class extends Worker {\n constructor() { super(url); }\n }\n ","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDAuthClient,\n ThunderIDAuthException,\n AuthClientConfig,\n IsomorphicCrypto,\n TokenExchangeRequestConfig,\n StorageManager,\n IdToken,\n OIDCEndpoints,\n User,\n createPackageComponentLogger,\n HttpClient,\n} from '@thunderid/javascript';\nimport {MainThreadClient, WebWorkerClient} from './clients';\nimport {Hooks, REFRESH_ACCESS_TOKEN_ERR0R} from './constants';\nimport {AuthenticationHelper, SPAHelper} from './helpers';\nimport {\n AuthSPAClientConfig,\n LegacyConfig as Config,\n HttpRequestConfig,\n HttpResponse,\n MainThreadClientConfig,\n MainThreadClientInterface,\n SignInConfig,\n SignOutError,\n WebWorkerClientConfig,\n WebWorkerClientInterface,\n} from './models';\nimport {BrowserStorage} from './models/storage';\nimport {SPAUtils} from './utils';\nimport WorkerFile from '../web.worker';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/browser',\n 'ThunderIDSPAClient',\n);\n\n/**\n * Default configurations.\n */\nconst DefaultConfig: Partial<AuthClientConfig<Config>> = {\n autoLogoutOnTokenRefreshError: false,\n checkSessionInterval: 3,\n syncSession: false,\n periodicTokenRefresh: false,\n sessionRefreshInterval: 300,\n storage: BrowserStorage.SessionStorage,\n};\n\n/**\n * This class provides the necessary methods to implement authentication in a Single Page Application.\n * Implements a Multiton pattern to support multi-tenancy scenarios where multiple authentication\n * contexts need to coexist in the same application.\n *\n * @export\n * @class ThunderIDSPAClient\n */\nexport class ThunderIDSPAClient {\n protected static _instances: Map<number, ThunderIDSPAClient> = new Map<number, ThunderIDSPAClient>();\n protected _client: WebWorkerClientInterface | MainThreadClientInterface | undefined;\n protected _storage: BrowserStorage | undefined;\n protected _authHelper: typeof AuthenticationHelper = AuthenticationHelper;\n protected _worker: new () => Worker = WorkerFile;\n protected _initialized = false;\n protected _startedInitialize = false;\n protected _onSignInCallback: (response: User) => void = () => null;\n protected _onSignOutCallback: () => void = () => null;\n protected _onSignOutFailedCallback: (error: SignOutError) => void = () => null;\n protected _onEndUserSession: (response: any) => void = () => null;\n protected _onInitialize: (response: boolean) => void = () => null;\n protected _onCustomGrant = new Map<string, (response: any) => void>();\n protected _instanceId: number;\n\n protected constructor(id: number) {\n this._instanceId = id;\n }\n\n public instantiateAuthHelper(authHelper?: typeof AuthenticationHelper): void {\n if (authHelper) {\n this._authHelper = authHelper;\n } else {\n this._authHelper = AuthenticationHelper;\n }\n }\n\n public instantiateWorker(worker: new () => Worker): void {\n if (worker) {\n this._worker = worker;\n } else {\n this._worker = WorkerFile;\n }\n }\n\n /**\n * This method specifies if the `ThunderIDSPAClient` has been initialized or not.\n *\n * @return {Promise<boolean>} - Resolves to `true` if the client has been initialized.\n *\n * @memberof ThunderIDSPAClient\n *\n * @private\n */\n public async isInitialized(): Promise<boolean> {\n if (!this._startedInitialize) {\n return false;\n }\n\n let iterationToWait = 0;\n\n const sleep = (): Promise<any> => {\n return new Promise((resolve) => setTimeout(resolve, 1));\n };\n\n while (!this._initialized) {\n if (iterationToWait === 1e4) {\n logger.warn('It is taking longer than usual for the object to be initialized');\n }\n await sleep();\n iterationToWait++;\n }\n\n return true;\n }\n\n /**\n * This method checks if the SDK is initialized and the user is authenticated.\n *\n * @param validateAuthentication - should user's authenticated status be checked as part of validation\n *\n * @return {Promise<boolean>} - A Promise that resolves with `true` if the SDK is initialized and the\n * user is authenticated.\n *\n * @memberof ThunderIDSPAClient\n *\n * @private\n */\n private async _validateMethod(validateAuthentication = true): Promise<boolean> {\n if (!(await this.isInitialized())) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-VM-NF01',\n 'The SDK is not initialized.',\n 'The SDK must be initialized first.',\n ),\n );\n }\n\n if (validateAuthentication && !(await this.isSignedIn())) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-VM-IV02',\n 'The user is not authenticated.',\n 'The user must be authenticated first.',\n ),\n );\n }\n\n return true;\n }\n\n /**\n * This method returns the instance of the client for the specified ID.\n * Implements a Multiton pattern to support multiple authentication contexts.\n * If an ID is provided, it will return the instance with the given ID.\n * If no ID is provided, it will return the default instance (ID: 0).\n *\n * @param {number} id - Optional unique identifier for the instance.\n * @return {ThunderIDSPAClient} - Returns the instance associated with the ID.\n *\n * @example\n * ```\n * // Single tenant application (default instance)\n * const auth = ThunderIDSPAClient.getInstance();\n *\n * // Multi-instance application\n * const instance1 = ThunderIDSPAClient.getInstance(1);\n * const instance2 = ThunderIDSPAClient.getInstance(2);\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getinstance\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public static getInstance(id = 0): ThunderIDSPAClient {\n if (!this._instances.has(id)) {\n this._instances.set(id, new ThunderIDSPAClient(id));\n }\n\n return this._instances.get(id);\n }\n\n /**\n * This method checks if an instance exists for the given ID.\n *\n * @param {number} id - Optional unique identifier for the instance.\n * @return {boolean} - Returns true if an instance exists for the ID.\n *\n * @example\n * ```\n * if (ThunderIDSPAClient.hasInstance(1)) {\n * const auth = ThunderIDSPAClient.getInstance(1);\n * }\n * ```\n *\n * @memberof ThunderIDSPAClient\n */\n public static hasInstance(id = 0): boolean {\n return this._instances.has(id);\n }\n\n /**\n * This method removes and cleans up a specific instance.\n * Useful when an instance is no longer needed.\n *\n * @param {number} id - Optional unique identifier for the instance to destroy.\n * @return {boolean} - Returns true if the instance was found and removed.\n *\n * @example\n * ```\n * // Remove a specific instance\n * ThunderIDSPAClient.destroyInstance(1);\n *\n * // Remove the default instance\n * ThunderIDSPAClient.destroyInstance();\n * ```\n *\n * @memberof ThunderIDSPAClient\n */\n public static destroyInstance(id = 0): boolean {\n const instance = this._instances.get(id);\n if (instance) {\n // Clean up the instance's session data before removing it\n instance.clearSession();\n return this._instances.delete(id);\n }\n return false;\n }\n\n /**\n * This method returns all active instance IDs.\n * Useful for debugging or managing multiple instances.\n *\n * @return {number[]} - Returns an array of all active instance IDs.\n *\n * @example\n * ```\n * const activeInstances = ThunderIDSPAClient.getInstanceKeys();\n * console.log('Active instances:', activeInstances);\n * ```\n *\n * @memberof ThunderIDSPAClient\n */\n public static getInstanceKeys(): number[] {\n return Array.from(this._instances.keys());\n }\n\n /**\n * This method removes all instances.\n * Useful for cleanup in testing scenarios or application teardown.\n *\n * @example\n * ```\n * ThunderIDSPAClient.destroyAllInstances();\n * ```\n *\n * @memberof ThunderIDSPAClient\n */\n public static destroyAllInstances(): void {\n // Clean up each instance's session data before clearing\n this._instances.forEach((instance) => {\n instance.clearSession();\n });\n this._instances.clear();\n }\n\n /**\n * This method returns the instance ID for this client instance.\n *\n * @return {number} - The instance ID.\n *\n * @example\n * ```\n * const auth = ThunderIDSPAClient.getInstance(1);\n * console.log(auth.getInstanceId()); // 1\n * ```\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public getInstanceId(): number {\n return this._instanceId;\n }\n\n /**\n * This method initializes the `ThunderIDSPAClient` instance.\n *\n * @param {ConfigInterface} config The config object to initialize with.\n *\n * @return {Promise<boolean>} - Resolves to `true` if initialization is successful.\n *\n * @example\n * ```\n * auth.initialize({\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://api.asgardeo.io\"\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#initialize\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n\n public async initialize(\n config: AuthSPAClientConfig,\n authHelper?: typeof AuthenticationHelper,\n workerFile?: new () => Worker,\n ): Promise<boolean> {\n this._storage = (config.storage as BrowserStorage) ?? BrowserStorage.SessionStorage;\n this._initialized = false;\n this._startedInitialize = true;\n\n authHelper && this.instantiateAuthHelper(authHelper);\n workerFile && this.instantiateWorker(workerFile);\n\n const _config = await this._client?.getConfigData();\n\n if (!(this._storage === BrowserStorage.WebWorker)) {\n const mainThreadClientConfig = config as AuthClientConfig<MainThreadClientConfig>;\n const defaultConfig = {...DefaultConfig} as Partial<AuthClientConfig<MainThreadClientConfig>>;\n const mergedConfig: AuthClientConfig<MainThreadClientConfig> = {\n ...defaultConfig,\n ...mainThreadClientConfig,\n };\n\n // If the client is not initialized, initialize it as usual.\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n // Tracker: https://github.com/asgardeo/asgardeo-auth-react-sdk/issues/240\n if (!this._client || (this._client && (!_config || Object.keys(_config)?.length === 0))) {\n this._client = await MainThreadClient(\n this._instanceId,\n mergedConfig,\n (authClient: ThunderIDAuthClient<MainThreadClientConfig>, spaHelper: SPAHelper<MainThreadClientConfig>) => {\n return new this._authHelper(authClient, spaHelper);\n },\n );\n }\n\n this._initialized = true;\n\n if (this._onInitialize) {\n this._onInitialize(true);\n }\n\n // Do not sign out the user if the autoLogoutOnTokenRefreshError is set to false.\n if (!mergedConfig.autoLogoutOnTokenRefreshError) {\n return Promise.resolve(true);\n }\n\n window.addEventListener('message', (event) => {\n if (event?.data?.type === REFRESH_ACCESS_TOKEN_ERR0R) {\n this.signOut();\n }\n });\n\n return Promise.resolve(true);\n } else {\n // If the client is not initialized, initialize it as usual.\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n // Tracker: https://github.com/asgardeo/asgardeo-auth-react-sdk/issues/240\n if (!this._client || (this._client && (!_config || Object.keys(_config)?.length === 0))) {\n const webWorkerClientConfig = config as AuthClientConfig<WebWorkerClientConfig>;\n this._client = await WebWorkerClient(\n this._instanceId,\n {\n ...DefaultConfig,\n ...webWorkerClientConfig,\n },\n this._worker,\n (authClient: ThunderIDAuthClient<WebWorkerClientConfig>, spaHelper: SPAHelper<WebWorkerClientConfig>) => {\n return new this._authHelper(authClient, spaHelper);\n },\n );\n\n return this._client\n .initialize()\n .then(() => {\n if (this._onInitialize) {\n this._onInitialize(true);\n }\n this._initialized = true;\n\n return Promise.resolve(true);\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n }\n\n return Promise.resolve(true);\n }\n }\n\n /**\n * This method returns a Promise that resolves with the basic user information obtained from the ID token.\n *\n * @return {Promise<User>} - A promise that resolves with the user information.\n *\n * @example\n * ```\n * auth.getUser().then((response) => {\n * // console.log(response);\n * }).catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getuserinfo\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getUser(): Promise<User | undefined> {\n await this._validateMethod();\n\n return this._client?.getUser();\n }\n\n /**\n * This method initiates the authentication flow. This should be called twice.\n * 1. To initiate the authentication flow.\n * 2. To obtain the access token after getting the authorization code.\n *\n * To satisfy the second condition, one of the two strategies mentioned below can be used:\n * 1. Redirect the user back to the same login page that initiated the authentication flow.\n * 2. Call the `signIn()` method in the page the user is redirected to after authentication.\n *\n * **To fire a callback function after signing in, use the `on()` method.**\n * **To learn more about the `on()` method:**\n * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}\n *\n * @param {SignInConfig} config - The sign-in config.\n * The `SignInConfig` object has these two attributes in addition to any custom key-value pairs.\n * 1. fidp - Specifies the FIDP parameter that is used to take the user directly to an IdP login page.\n * 2. forceInit: Specifies if the OIDC Provider Meta Data should be loaded again from the `well-known`\n * endpoint.\n * 3. Any other parameters that should be appended to the authorization request.\n * @param {string} authorizationCode - The authorization code. (Optional)\n * @param {string} sessionState - The session state. (Optional)\n * @param {string} state - The state. (Optional)\n *\n * @return {Promise<User>} - A promise that resolves with the user information.\n *\n * @example\n * ```\n * auth.signIn();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#signin\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async signIn(\n config?: SignInConfig,\n authorizationCode?: string,\n sessionState?: string,\n state?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<User | undefined> {\n await this.isInitialized();\n\n // Discontinues the execution of this method if `config.callOnlyOnRedirect` is true and the `signIn` method\n // is not being called on redirect.\n if (!SPAUtils.canContinueSignIn(Boolean(config?.callOnlyOnRedirect), authorizationCode)) {\n return undefined;\n }\n\n delete config?.callOnlyOnRedirect;\n\n return this._client\n ?.signIn(config, authorizationCode, sessionState, state, tokenRequestConfig)\n .then((response: User) => {\n if (this._onSignInCallback) {\n this._onSignInCallback(response);\n }\n\n return response;\n })\n .catch((error) => {\n return Promise.reject(error);\n });\n }\n\n /**\n * This method allows you to sign in silently.\n * First, this method sends a prompt none request to see if there is an active user session in the identity server.\n * If there is one, then it requests the access token and stores it. Else, it returns false.\n *\n * If this method is to be called on page load and the `signIn` method is also to be called on page load,\n * then it is advisable to call this method after the `signIn` call.\n *\n * @return {Promise<User | boolean>} - A Promise that resolves with the user information after signing in\n * or with `false` if the user is not signed in.\n *\n * @example\n *```\n * auth.signInSilently()\n *```\n */\n public async signInSilently(\n additionalParams?: Record<string, string | boolean>,\n tokenRequestConfig?: {params: Record<string, unknown>},\n ): Promise<User | boolean | undefined> {\n await this.isInitialized();\n\n // checks if the `signIn` method has been called.\n if (SPAUtils.wasSignInCalled()) {\n return undefined;\n }\n\n return this._client?.signInSilently(additionalParams, tokenRequestConfig).then((response: User | boolean) => {\n if (this._onSignInCallback && response) {\n this._onSignInCallback(response as User);\n }\n\n return response;\n });\n }\n\n /**\n * This method initiates the sign-out flow.\n *\n * **To fire a callback function after signing out, use the `on()` method.**\n * **To learn more about the `on()` method:**\n * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}\n *\n * @return {Promise<boolean>} - Returns a promise that resolves with `true` if sign out is successful.\n *\n * @example\n * ```\n * auth.signOut();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#signout\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async signOut(): Promise<boolean> {\n await this._validateMethod(false);\n\n const signOutResponse = (await this._client?.signOut()) ?? false;\n\n return signOutResponse;\n }\n\n /**\n * This method sends an API request to a protected endpoint.\n * The access token is automatically attached to the header of the request.\n * This is the only way by which protected endpoints can be accessed\n * when the web worker is used to store session information.\n *\n * @param {HttpRequestConfig} config - The config object containing attributes necessary to send a request.\n *\n * @return {Promise<HttpResponse>} - Returns a Promise that resolves with the response to the request.\n *\n * @example\n * ```\n * const requestConfig = {\n * headers: {\n * \"Accept\": \"application/json\",\n * \"Access-Control-Allow-Origin\": \"https://api.asgardeo.io/myaccount\",\n * \"Content-Type\": \"application/scim+json\"\n * },\n * method: \"GET\",\n * url: \"https://api.asgardeo.io/scim2/me\"\n * };\n *\n * return auth.httpRequest(requestConfig)\n * .then((response) => {\n * // console.log(response);\n * })\n * .catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#httprequest\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async httpRequest(config: HttpRequestConfig): Promise<HttpResponse | undefined> {\n await this._validateMethod(false);\n\n return this._client?.httpRequest(config);\n }\n\n /**\n * This method sends multiple API requests to a protected endpoint.\n * The access token is automatically attached to the header of the request.\n * This is the only way by which multiple requests can be sent to protected endpoints\n * when the web worker is used to store session information.\n *\n * @param {HttpRequestConfig[]} config - The config object containing attributes necessary to send a request.\n *\n * @return {Promise<HttpResponse[]>} - Returns a Promise that resolves with the responses to the requests.\n *\n * @example\n * ```\n * const requestConfig = {\n * headers: {\n * \"Accept\": \"application/json\",\n * \"Content-Type\": \"application/scim+json\"\n * },\n * method: \"GET\",\n * url: \"https://api.asgardeo.io/scim2/me\"\n * };\n *\n * const requestConfig2 = {\n * headers: {\n * \"Accept\": \"application/json\",\n * \"Content-Type\": \"application/scim+json\"\n * },\n * method: \"GET\",\n * url: \"https://api.asgardeo.io/scim2/me\"\n * };\n *\n * return auth.httpRequest([requestConfig, requestConfig2])\n * .then((responses) => {\n * response.forEach((response)=>{\n * // console.log(response);\n * });\n * })\n * .catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#httprequestall\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async httpRequestAll(config: HttpRequestConfig[]): Promise<HttpResponse[] | undefined> {\n await this._validateMethod(false);\n\n return this._client?.httpRequestAll(config);\n }\n\n /**\n * This method allows you to send a request with a custom grant.\n *\n * @param {CustomGrantRequestParams} config - The request parameters.\n *\n * @return {Promise<HttpResponse<any> | SignInResponse>} - A Promise that resolves with\n * the value returned by the custom grant request.\n *\n * @example\n * ```\n * auth.customGrant({\n * attachToken: false,\n * data: {\n * client_id: \"{{clientId}}\",\n * grant_type: \"account_switch\",\n * scope: \"{{scope}}\",\n * token: \"{{token}}\",\n * },\n * id: \"account-switch\",\n * returnResponse: true,\n * returnsSession: true,\n * signInRequired: true\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#customgrant\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async exchangeToken(config: TokenExchangeRequestConfig): Promise<Response | User | undefined> {\n if (config.signInRequired) {\n await this._validateMethod();\n }\n\n if (!config.id) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-RCG-NF01',\n 'The custom grant request id not found.',\n 'The id attribute of the custom grant config object passed as an argument should have a value.',\n ),\n );\n }\n\n const customGrantResponse = await this._client?.exchangeToken(config);\n\n const customGrantCallback = this._onCustomGrant.get(config.id);\n customGrantCallback && customGrantCallback(this._onCustomGrant?.get(config.id));\n\n return customGrantResponse;\n }\n\n /**\n * This method ends a user session. The access token is revoked and the session information is destroyed.\n *\n * **To fire a callback function after ending user session, use the `on()` method.**\n * **To learn more about the `on()` method:**\n * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}\n *\n * @return {Promise<boolean>} - A promise that resolves with `true` if the process is successful.\n *\n * @example\n * ```\n * auth.endUserSession();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#endusersession\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async revokeAccessToken(): Promise<boolean | undefined> {\n await this._validateMethod();\n\n const revokeAccessToken = await this._client?.revokeAccessToken();\n this._onEndUserSession && (await this._onEndUserSession(revokeAccessToken));\n\n return revokeAccessToken;\n }\n\n /**\n * This method returns a Promise that resolves with an object containing the service endpoints.\n *\n * @return {Promise<ServiceResourcesType} - A Promise that resolves with an object containing the service endpoints.\n *\n * @example\n * ```\n * auth.getServiceEndpoints().then((endpoints) => {\n * // console.log(endpoints);\n * }).error((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getserviceendpoints\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getOpenIDProviderEndpoints(): Promise<OIDCEndpoints | undefined> {\n await this.isInitialized();\n\n return this._client?.getOpenIDProviderEndpoints();\n }\n\n /**\n * This methods returns the Axios http client.\n *\n * @return {HttpClient} - The Axios HTTP client.\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public getHttpClient(): HttpClient {\n if (this._client) {\n if (this._storage !== BrowserStorage.WebWorker) {\n const mainThreadClient = this._client as MainThreadClientInterface;\n return mainThreadClient.getHttpClient();\n }\n\n throw new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-GHC-IV01',\n 'Http client cannot be returned.',\n 'The http client cannot be returned when the storage type is set to webWorker.',\n );\n }\n\n throw new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-GHC-NF02',\n 'The SDK is not initialized.',\n 'The SDK has not been initialized yet. Initialize the SDK using the initialize method ' +\n 'before calling this method.',\n );\n }\n\n /**\n * This method decodes a JWT token payload and returns it.\n *\n * @param {string} token - The token to decode (optional).\n *\n * @return {Promise<Record<string, unknown>>} - A Promise that resolves with\n * the decoded payload of the token.\n *\n * @example\n * ```\n * auth.decodeJwtToken<T>(token).then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#decodetoken\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async decodeJwtToken<T = Record<string, unknown>>(token?: string): Promise<T | undefined> {\n return this._client?.decodeJwtToken<T>(token);\n }\n\n /**\n * This method decodes the payload of the id token and returns it.\n *\n * @return {Promise<DecodedIdTokenPayloadInterface>} - A Promise that resolves with\n * the decoded payload of the id token.\n *\n * @example\n * ```\n * auth.getDecodedIdToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getdecodedidtoken\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getDecodedIdToken(sessionId?: string): Promise<IdToken | undefined> {\n await this._validateMethod();\n\n return this._client?.getDecodedIdToken(sessionId);\n }\n\n /**\n * This method returns the IsomorphicCrypto instance.\n *\n * @return {Promise<DecodedIdTokenPayloadInterface>} - A Promise that resolves with\n * the IsomorphicCrypto instance.\n *\n * @example\n * ```\n * auth.getCrypto().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getCrypto\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getCrypto(): Promise<IsomorphicCrypto | undefined> {\n await this._validateMethod();\n\n return this._client?.getCrypto();\n }\n\n /**\n * This method return the ID token.\n *\n * @return {Promise<string>} - A Promise that resolves with the ID token.\n *\n * @example\n * ```\n * const idToken = await auth.getIdToken();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIdToken\n *\n * @memberof ThunderIDAuthClient\n *\n * @preserve\n */\n public async getIdToken(): Promise<string | undefined> {\n await this._validateMethod();\n\n return this._client?.getIdToken();\n }\n\n /**\n * This method return a Promise that resolves with the access token.\n *\n * **This method will not return the access token if the storage type is set to `webWorker`.**\n *\n * @return {Promise<string>} - A Promise that resolves with the access token.\n *\n * @example\n * ```\n * auth.getAccessToken().then((token) => {\n * // console.log(token);\n * }).catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getaccesstoken\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getAccessToken(sessionId?: string): Promise<string> {\n await this._validateMethod();\n\n if (this._storage && [(BrowserStorage.WebWorker, BrowserStorage.BrowserMemory)].includes(this._storage)) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-GAT-IV01',\n 'The access token cannot be returned.',\n 'The access token cannot be returned when the storage type is set to webWorker or browserMemory.',\n ),\n );\n }\n const mainThreadClient = this._client as MainThreadClientInterface;\n\n return mainThreadClient.getAccessToken(sessionId);\n }\n\n /**\n * This method return a Promise that resolves with the idp access token.\n *\n * **This method will not return the access token if the storage type is set to `webWorker`.**\n *\n * @return {Promise<string>} - A Promise that resolves with the idp access token.\n *\n * @example\n * ```\n * auth.getIDPAccessToken().then((token) => {\n * // console.log(token);\n * }).catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getaccesstoken\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getIDPAccessToken(): Promise<string> {\n await this._validateMethod();\n\n if (this._storage && [(BrowserStorage.WebWorker, BrowserStorage.BrowserMemory)].includes(this._storage)) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-GIAT-IV01',\n 'The access token cannot be returned.',\n 'The access token cannot be returned when the storage type is set to webWorker or browserMemory.',\n ),\n );\n }\n const mainThreadClient = this._client as MainThreadClientInterface;\n\n return mainThreadClient.getAccessToken();\n }\n\n /**\n * This method return a Promise that resolves with the data layer object.\n *\n * **This method will not return the data layer object, if the storage type is set to `webWorker`.**\n *\n * @return {Promise<string>} - A Promise that resolves with the data layer object.\n *\n * @example\n * ```\n * auth.getStorageManager().then((dataLayer) => {\n * // console.log(dataLayer);\n * }).catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getdatalayer\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getStorageManager(): Promise<StorageManager<MainThreadClientConfig>> {\n if (this._storage && [(BrowserStorage.WebWorker, BrowserStorage.BrowserMemory)].includes(this._storage)) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-GDL-IV01',\n 'The data layer cannot be returned.',\n 'The data layer cannot be returned when the storage type is set to webWorker or browserMemory.',\n ),\n );\n }\n const mainThreadClient = this._client as MainThreadClientInterface;\n\n return mainThreadClient.getStorageManager();\n }\n\n /**\n * This method return a Promise that resolves with the config data stored in the storage.\n *\n * @return - A Promise that resolves with the config data.\n *\n * @example\n * ```\n * auth.getConfigData().then((configData) => {\n * // console.log(configData);\n * }).catch((error) => {\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/main#getConfigData\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async getConfigData(): Promise<\n AuthClientConfig<MainThreadClientConfig> | AuthClientConfig<WebWorkerClientConfig> | undefined\n > {\n return this._client?.getConfigData();\n }\n\n /**\n * This method refreshes the access token.\n *\n * @return {TokenResponseInterface} - A Promise that resolves with an object containing\n * information about the refreshed access token.\n *\n * @example\n * ```\n * auth.refreshToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#refreshtoken\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async refreshAccessToken(): Promise<User | undefined> {\n await this._validateMethod(false);\n\n return this._client?.refreshAccessToken();\n }\n\n /**\n * This method specifies if the user is authenticated or not.\n *\n * @return {Promise<boolean>} - A Promise that resolves with `true` if the user is authenticated.\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async isSignedIn(): Promise<boolean | undefined> {\n await this.isInitialized();\n\n return this._client?.isSignedIn();\n }\n\n public async startAutoRefreshToken(): Promise<void> {\n await this.isInitialized();\n\n return (this._client as MainThreadClientInterface)?.startAutoRefreshToken();\n }\n\n /**\n * This method specifies if there is an active session in the browser or not.\n *\n * @return {Promise<boolean>} - A Promise that resolves with `true` if there is a session.\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async isSessionActive(): Promise<boolean | undefined> {\n await this.isInitialized();\n\n if (this._storage && [(BrowserStorage.WebWorker, BrowserStorage.BrowserMemory)].includes(this._storage)) {\n return Promise.reject(\n new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-ISA-IV01',\n 'The active session cannot be returned.',\n 'The active session cannot be returned when the storage type is set to webWorker ' + 'or browserMemory.',\n ),\n );\n }\n const mainThreadClient = this._client as MainThreadClientInterface;\n\n return mainThreadClient?.isSessionActive();\n }\n\n /**\n * This method attaches a callback function to an event hook that fires the callback when the event happens.\n *\n * @param {Hooks.CustomGrant} hook - The name of the hook.\n * @param {(response?: any) => void} callback - The callback function.\n * @param {string} id (optional) - The id of the hook. This is used when multiple custom grants are used.\n *\n * @example\n * ```\n * auth.on(\"sign-in\", (response)=>{\n * // console.log(response);\n * });\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async on(hook: Hooks.CustomGrant, callback: (response?: any) => void, id: string): Promise<void>;\n public async on(hook: Exclude<Hooks, Hooks.CustomGrant>, callback: (response?: any) => void): Promise<void>;\n public async on(hook: Hooks, callback: (response?: any) => void | Promise<void>, id?: string): Promise<void> {\n await this.isInitialized();\n if (callback && typeof callback === 'function') {\n switch (hook) {\n case Hooks.SignIn:\n this._onSignInCallback = callback;\n break;\n case Hooks.SignOut:\n this._onSignOutCallback = callback;\n if (await SPAUtils.isSignOutSuccessful()) {\n this._onSignOutCallback();\n }\n break;\n case Hooks.RevokeAccessToken:\n this._onEndUserSession = callback;\n break;\n case Hooks.Initialize:\n this._onInitialize = callback;\n break;\n case Hooks.HttpRequestError:\n this._client?.setHttpRequestErrorCallback(callback);\n break;\n case Hooks.HttpRequestFinish:\n this._client?.setHttpRequestFinishCallback(callback);\n break;\n case Hooks.HttpRequestStart:\n this._client?.setHttpRequestStartCallback(callback);\n break;\n case Hooks.HttpRequestSuccess:\n this._client?.setHttpRequestSuccessCallback(callback);\n break;\n case Hooks.CustomGrant:\n id && this._onCustomGrant.set(id, callback);\n break;\n case Hooks.SignOutFailed: {\n this._onSignOutFailedCallback = callback;\n const signOutFail: boolean | SignOutError = SPAUtils.didSignOutFail();\n\n if (signOutFail) {\n this._onSignOutFailedCallback(signOutFail as SignOutError);\n }\n break;\n }\n default:\n throw new ThunderIDAuthException('SPA-AUTH_CLIENT-ON-IV01', 'Invalid hook.', 'The provided hook is invalid.');\n }\n } else {\n throw new ThunderIDAuthException(\n 'SPA-AUTH_CLIENT-ON-IV02',\n 'Invalid callback function.',\n 'The provided callback function is invalid.',\n );\n }\n }\n\n /**\n * This method enables callback functions attached to the http client.\n *\n * @return {Promise<boolean>} - A promise that resolves with True.\n *\n * @example\n * ```\n * auth.enableHttpHandler();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#enableHttpHandler\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async enableHttpHandler(): Promise<boolean | undefined> {\n await this.isInitialized();\n\n return this._client?.enableHttpHandler();\n }\n\n /**\n * This method disables callback functions attached to the http client.\n *\n * @return {Promise<boolean>} - A promise that resolves with True.\n *\n * @example\n * ```\n * auth.disableHttpHandler();\n * ```\n *\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#disableHttpHandler\n *\n * @memberof ThunderIDSPAClient\n *\n * @preserve\n */\n public async disableHttpHandler(): Promise<boolean | undefined> {\n await this.isInitialized();\n\n return this._client?.disableHttpHandler();\n }\n\n /**\n * This method updates the configuration that was passed into the constructor when instantiating this class.\n *\n * @param {Partial<AuthClientConfig<T>>} config - A config object to update the SDK configurations with.\n *\n * @example\n * ```\n * const config = {\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://api.asgardeo.io\"\n * }\n * const auth.reInitialize(config);\n * ```\n * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master/lib#reInitialize\n *\n * @memberof ThunderIDAuthClient\n *\n * @preserve\n */\n public async reInitialize(config: Partial<AuthClientConfig<Config>>): Promise<void> {\n await this.isInitialized();\n if (this._storage === BrowserStorage.WebWorker) {\n const client = this._client as WebWorkerClientInterface;\n await client.reInitialize(config as Partial<AuthClientConfig<WebWorkerClientConfig>>);\n } else {\n const client = this._client as WebWorkerClientInterface;\n await client.reInitialize(config as Partial<AuthClientConfig<WebWorkerClientConfig>>);\n }\n\n return;\n }\n\n /**\n * This method clears the session information from the storage.\n * @param sessionId - The session ID of the session to be cleared. If not provided, the current session will be cleared.\n */\n public clearSession(sessionId?: string): void {\n ThunderIDAuthClient.clearSession(sessionId);\n }\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n AuthClientConfig,\n AuthorizeRequestUrlParams,\n User,\n IsomorphicCrypto,\n TokenExchangeRequestConfig,\n IdToken,\n OIDCEndpoints,\n} from '@thunderid/javascript';\nimport {HttpRequestConfig, HttpResponse, Message} from '.';\nimport {AuthorizationResponse, WebWorkerClientConfig} from '../..';\n\ninterface WebWorkerEvent<T> extends MessageEvent {\n data: Message<T>;\n}\n\nexport class WebWorkerClass<T> {\n onmessage: (this: Worker, event: WebWorkerEvent<T>) => any = () => null;\n postMessage: (message: Message<T>) => void = () => null;\n}\n\nexport interface WebWorkerCoreInterface {\n setHttpRequestStartCallback(callback: () => void): void;\n setHttpRequestSuccessCallback(callback: (response: HttpResponse) => void): void;\n setHttpRequestFinishCallback(callback: () => void): void;\n httpRequest(config: HttpRequestConfig): Promise<HttpResponse>;\n httpRequestAll(configs: HttpRequestConfig[]): Promise<HttpResponse[] | undefined>;\n enableHttpHandler(): void;\n disableHttpHandler(): void;\n getSignInUrl(params?: AuthorizeRequestUrlParams, afterSignInUrl?: string): Promise<AuthorizationResponse>;\n requestAccessToken(authorizationCode?: string, sessionState?: string, pkce?: string, state?: string): Promise<User>;\n signOut(afterSignOutUrl?: string): Promise<string>;\n getSignOutUrl(afterSignOutUrl?: string): Promise<string>;\n exchangeToken(config: TokenExchangeRequestConfig): Promise<User | Response>;\n refreshAccessToken(): Promise<User>;\n revokeAccessToken(): Promise<boolean>;\n getUser(): Promise<User>;\n getDecodedIdToken(sessionId?: string): Promise<IdToken>;\n getDecodedIDPIDToken(): Promise<IdToken>;\n getCrypto(): Promise<IsomorphicCrypto>;\n getIdToken(): Promise<string>;\n getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;\n getAccessToken(): Promise<string>;\n isSignedIn(): Promise<boolean>;\n startAutoRefreshToken(): Promise<void>;\n setSessionState(sessionState: string): Promise<void>;\n reInitialize(config: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void>;\n getConfigData(): Promise<AuthClientConfig<WebWorkerClientConfig>>;\n}\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDAuthClient,\n AuthClientConfig,\n AuthorizeRequestUrlParams,\n User,\n IsomorphicCrypto,\n TokenExchangeRequestConfig,\n IdToken,\n OIDCEndpoints,\n OIDCRequestConstants,\n SessionData,\n Storage,\n} from '@thunderid/javascript';\nimport {FetchHttpClient} from '../../FetchHttpClient';\nimport {AuthenticationHelper, SPAHelper} from '../helpers';\nimport {\n AuthorizationResponse,\n HttpRequestConfig,\n HttpResponse,\n WebWorkerClientConfig,\n WebWorkerCoreInterface,\n} from '../models';\nimport {MemoryStore} from '../stores';\nimport {SPACryptoUtils} from '../utils/crypto-utils';\n\nexport const WebWorkerCore = async (\n instanceId: number,\n config: AuthClientConfig<WebWorkerClientConfig>,\n getAuthHelper: (\n authClient: ThunderIDAuthClient<WebWorkerClientConfig>,\n spaHelper: SPAHelper<WebWorkerClientConfig>,\n ) => AuthenticationHelper<WebWorkerClientConfig>,\n): Promise<WebWorkerCoreInterface> => {\n const _store: Storage = new MemoryStore();\n const _cryptoUtils: SPACryptoUtils = new SPACryptoUtils();\n const _authenticationClient = new ThunderIDAuthClient<WebWorkerClientConfig>();\n await _authenticationClient.initialize(config, _store, _cryptoUtils, instanceId);\n\n const _spaHelper = new SPAHelper<WebWorkerClientConfig>(_authenticationClient);\n\n const _authenticationHelper: AuthenticationHelper<WebWorkerClientConfig> = getAuthHelper(\n _authenticationClient,\n _spaHelper,\n );\n\n const _dataLayer = _authenticationClient.getStorageManager();\n\n const attachToken = async (request: HttpRequestConfig): Promise<void> => {\n await _authenticationHelper.attachTokenToRequestConfig(request);\n };\n\n const _httpClient = FetchHttpClient.getInstance(instanceId, true, attachToken);\n\n const setHttpRequestStartCallback = (callback: () => void): void => {\n _httpClient?.setHttpRequestStartCallback && _httpClient.setHttpRequestStartCallback(callback);\n };\n\n const setHttpRequestSuccessCallback = (callback: (response: HttpResponse) => void): void => {\n _httpClient?.setHttpRequestSuccessCallback && _httpClient.setHttpRequestSuccessCallback(callback);\n };\n\n const setHttpRequestFinishCallback = (callback: () => void): void => {\n _httpClient?.setHttpRequestFinishCallback && _httpClient.setHttpRequestFinishCallback(callback);\n };\n\n const httpRequest = async (requestConfig: HttpRequestConfig): Promise<HttpResponse> => {\n return await _authenticationHelper.httpRequest(_httpClient, requestConfig);\n };\n\n const httpRequestAll = async (requestConfigs: HttpRequestConfig[]): Promise<HttpResponse[] | undefined> => {\n return await _authenticationHelper.httpRequestAll(requestConfigs, _httpClient);\n };\n\n const enableHttpHandler = (): void => {\n _authenticationHelper.enableHttpHandler(_httpClient);\n };\n\n const disableHttpHandler = (): void => {\n _authenticationHelper.disableHttpHandler(_httpClient);\n };\n\n const getSignInUrl = async (params?: AuthorizeRequestUrlParams): Promise<AuthorizationResponse> => {\n return _authenticationClient\n .getSignInUrl(params)\n .then(async (url: string) => {\n const urlObject: URL = new URL(url);\n const state: string = urlObject.searchParams.get(OIDCRequestConstants.Params.STATE) ?? '';\n const pkce: string = await _authenticationClient.getPKCECode(state);\n\n return {authorizationURL: url, pkce: pkce};\n })\n .catch((error) => Promise.reject(error));\n };\n\n const startAutoRefreshToken = async (): Promise<void> => {\n _spaHelper.clearRefreshTokenTimeout();\n _spaHelper.refreshAccessTokenAutomatically(_authenticationHelper);\n\n return;\n };\n\n const requestAccessToken = async (\n authorizationCode?: string,\n sessionState?: string,\n pkce?: string,\n state?: string,\n ): Promise<User> => {\n return await _authenticationHelper.requestAccessToken(authorizationCode, sessionState, undefined, pkce, state);\n };\n\n const signOut = async (): Promise<string> => {\n _spaHelper.clearRefreshTokenTimeout();\n\n return await _authenticationClient.getSignOutUrl();\n };\n\n const getSignOutUrl = async (): Promise<string> => {\n return await _authenticationClient.getSignOutUrl();\n };\n\n const exchangeToken = async (config: TokenExchangeRequestConfig): Promise<User | Response> => {\n return await _authenticationHelper.exchangeToken(config);\n };\n\n const refreshAccessToken = async (): Promise<User> => {\n try {\n return await _authenticationHelper.refreshAccessToken();\n } catch (error) {\n return Promise.reject(error);\n }\n };\n\n const revokeAccessToken = async (): Promise<boolean> => {\n const timer: number = await _spaHelper.getRefreshTimeoutTimer();\n\n return _authenticationClient\n .revokeAccessToken()\n .then(() => {\n _spaHelper.clearRefreshTokenTimeout(timer);\n\n return Promise.resolve(true);\n })\n .catch((error) => Promise.reject(error));\n };\n\n const getUser = async (): Promise<User> => {\n return _authenticationHelper.getUser();\n };\n\n const getDecodedIdToken = async (sessionId?: string): Promise<IdToken> => {\n return _authenticationHelper.getDecodedIdToken(sessionId);\n };\n\n const getCrypto = async (): Promise<IsomorphicCrypto> => {\n return _authenticationHelper.getCrypto();\n };\n\n const getDecodedIDPIDToken = async (): Promise<IdToken> => {\n return _authenticationHelper.getDecodedIDPIDToken();\n };\n\n const getIdToken = async (): Promise<string> => {\n return _authenticationHelper.getIdToken();\n };\n const getOpenIDProviderEndpoints = async (): Promise<OIDCEndpoints> => {\n return _authenticationHelper.getOpenIDProviderEndpoints();\n };\n\n const getAccessToken = (): Promise<string> => {\n return _authenticationHelper.getAccessToken();\n };\n\n const isSignedIn = (): Promise<boolean> => {\n return _authenticationHelper.isSignedIn();\n };\n\n const setSessionState = async (sessionState: string): Promise<void> => {\n await _dataLayer.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState,\n );\n\n return;\n };\n\n const reInitialize = async (config: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void> => {\n await _authenticationClient.reInitialize(config);\n\n return;\n };\n\n const getConfigData = async (): Promise<AuthClientConfig<WebWorkerClientConfig>> => {\n return _dataLayer.getConfigData();\n };\n\n return {\n disableHttpHandler,\n enableHttpHandler,\n getAccessToken,\n getSignInUrl,\n getUser,\n getConfigData,\n getCrypto,\n getDecodedIDPIDToken,\n getDecodedIdToken,\n getIdToken,\n getOpenIDProviderEndpoints,\n getSignOutUrl,\n httpRequest,\n httpRequestAll,\n isSignedIn,\n refreshAccessToken,\n requestAccessToken,\n exchangeToken,\n revokeAccessToken,\n setHttpRequestFinishCallback,\n setHttpRequestStartCallback,\n setHttpRequestSuccessCallback,\n setSessionState,\n signOut,\n startAutoRefreshToken,\n reInitialize,\n };\n};\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThunderIDAuthClient, ThunderIDAuthException, AuthClientConfig, User} from '@thunderid/javascript';\nimport {WebWorkerCore} from './worker-core';\nimport {\n DISABLE_HTTP_HANDLER,\n ENABLE_HTTP_HANDLER,\n GET_AUTH_URL,\n GET_BASIC_USER_INFO,\n GET_CONFIG_DATA,\n GET_CRYPTO_HELPER,\n GET_DECODED_ID_TOKEN,\n GET_ID_TOKEN,\n GET_OIDC_SERVICE_ENDPOINTS,\n GET_SIGN_OUT_URL,\n HTTP_REQUEST,\n HTTP_REQUEST_ALL,\n INIT,\n IS_AUTHENTICATED,\n REFRESH_ACCESS_TOKEN,\n REQUEST_ACCESS_TOKEN,\n REQUEST_CUSTOM_GRANT,\n REQUEST_FINISH,\n REQUEST_START,\n REQUEST_SUCCESS,\n REVOKE_ACCESS_TOKEN,\n SET_SESSION_STATE,\n SIGN_OUT,\n START_AUTO_REFRESH_TOKEN,\n UPDATE_CONFIG,\n} from '../constants';\nimport {AuthenticationHelper, SPAHelper} from '../helpers';\nimport {\n AuthorizationResponse,\n HttpResponse,\n WebWorkerClass,\n WebWorkerClientConfig,\n WebWorkerCoreInterface,\n} from '../models';\nimport {MessageUtils} from '../utils';\n\nexport const workerReceiver = (\n getAuthHelper: (\n authClient: ThunderIDAuthClient<WebWorkerClientConfig>,\n spaHelper: SPAHelper<WebWorkerClientConfig>,\n ) => AuthenticationHelper<WebWorkerClientConfig>,\n) => {\n const ctx: WebWorkerClass<any> = self as any;\n\n let webWorker: WebWorkerCoreInterface;\n\n ctx.onmessage = async ({data, ports}) => {\n const port = ports[0];\n if (data.type !== INIT && !webWorker) {\n port.postMessage(\n MessageUtils.generateFailureMessage(\n new ThunderIDAuthException(\n 'SPA-CLIENT_WORKER-ONMSG-NF01',\n 'The web worker has not been initialized yet.',\n 'The initialize method needs to be called before the specified operation can be carried out.',\n ),\n ),\n );\n\n return;\n }\n\n switch (data.type) {\n case INIT:\n try {\n const instanceId: number = data.instanceId ?? 0;\n const config: AuthClientConfig<WebWorkerClientConfig> = {...data.data};\n webWorker = await WebWorkerCore(instanceId, config, getAuthHelper);\n webWorker.setHttpRequestFinishCallback(onRequestFinishCallback);\n webWorker.setHttpRequestStartCallback(onRequestStartCallback);\n webWorker.setHttpRequestSuccessCallback(onRequestSuccessCallback);\n port.postMessage(MessageUtils.generateSuccessMessage());\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_AUTH_URL:\n webWorker\n .getSignInUrl(data?.data)\n .then((response: AuthorizationResponse) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n\n break;\n case REQUEST_ACCESS_TOKEN:\n webWorker\n .requestAccessToken(data?.data?.code, data?.data?.sessionState, data?.data?.pkce, data?.data?.state)\n .then((response: User) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n\n break;\n case HTTP_REQUEST: {\n const request = data.data;\n const requestData = request?.data;\n if (data.data?.data?.formData === true) {\n const formData = new FormData();\n for (const key in requestData) {\n if (key === 'formData') {\n continue;\n }\n formData.append(key, requestData[key]);\n }\n request.data = formData;\n }\n webWorker\n .httpRequest(request)\n .then((response) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n\n break;\n }\n case HTTP_REQUEST_ALL:\n webWorker\n .httpRequestAll(data.data)\n .then((response) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n\n break;\n case SIGN_OUT:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.signOut()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case REQUEST_CUSTOM_GRANT:\n webWorker\n .exchangeToken(data.data)\n .then((response) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n\n break;\n case REVOKE_ACCESS_TOKEN:\n webWorker\n .revokeAccessToken()\n .then((response) => {\n port.postMessage(MessageUtils.generateSuccessMessage(response));\n })\n .catch((error) => {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n });\n break;\n case GET_OIDC_SERVICE_ENDPOINTS:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getOpenIDProviderEndpoints()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_BASIC_USER_INFO:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getUser()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_DECODED_ID_TOKEN:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getDecodedIdToken()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_CRYPTO_HELPER:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getCrypto()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_ID_TOKEN:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getIdToken()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case ENABLE_HTTP_HANDLER:\n webWorker.enableHttpHandler();\n port.postMessage(MessageUtils.generateSuccessMessage());\n\n break;\n case DISABLE_HTTP_HANDLER:\n webWorker.disableHttpHandler();\n port.postMessage(MessageUtils.generateSuccessMessage());\n\n break;\n case IS_AUTHENTICATED:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.isSignedIn()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_SIGN_OUT_URL:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getSignOutUrl()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case REFRESH_ACCESS_TOKEN:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.refreshAccessToken()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case START_AUTO_REFRESH_TOKEN:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(webWorker.startAutoRefreshToken()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case SET_SESSION_STATE:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.setSessionState(data?.data)));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case UPDATE_CONFIG:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.reInitialize(data?.data)));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n case GET_CONFIG_DATA:\n try {\n port.postMessage(MessageUtils.generateSuccessMessage(await webWorker.getConfigData()));\n } catch (error) {\n port.postMessage(MessageUtils.generateFailureMessage(error));\n }\n\n break;\n default:\n port?.postMessage(\n MessageUtils.generateFailureMessage(\n new ThunderIDAuthException(\n 'SPA-CLIENT_WORKER-ONMSG-IV02',\n 'The message type is invalid.',\n `The message type provided, ${data.type}, is invalid.`,\n ),\n ),\n );\n }\n };\n\n const onRequestStartCallback = (): void => {\n ctx.postMessage({type: REQUEST_START});\n };\n\n const onRequestSuccessCallback = (response: HttpResponse): void => {\n ctx.postMessage({data: JSON.stringify(response ?? ''), type: REQUEST_SUCCESS});\n };\n\n const onRequestFinishCallback = (): void => {\n ctx.postMessage({type: REQUEST_FINISH});\n };\n};\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Utility to check if `code` and `session_state` are available in the URL as search params.\n *\n * @param params - The URL search params to check. Defaults to `window.location.search`.\n * @return `true` if the URL contains `code` and `session_state` search params, otherwise `false`.\n */\nconst hasAuthParamsInUrl = (params: string = window.location.search): boolean => {\n const MATCHER = /[?&]code=[^&]+/;\n\n return MATCHER.test(params);\n};\n\nexport default hasAuthParamsInUrl;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Utility to check if `state` is available in the URL as a search param and matches the provided instance.\n *\n * @param params - The URL search params to check. Defaults to `window.location.search`.\n * @param instanceId - The instance ID to match against the `state` param.\n * @return `true` if the URL contains a matching `state` search param, otherwise `false`.\n */\nconst hasCalledForThisInstanceInUrl = (instanceId: number, params: string = window.location.search): boolean => {\n const MATCHER = new RegExp(`[?&]state=instance_${instanceId}_[^&]+`);\n\n return MATCHER.test(params);\n};\n\nexport default hasCalledForThisInstanceInUrl;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Navigates to a new URL within the browser.\n *\n * - For same-origin URLs (relative paths or absolute URLs with the same origin),\n * uses the History API and dispatches a `popstate` event (SPA navigation).\n * - For cross-origin URLs, performs a full page load using `window.location.assign`.\n *\n * This allows seamless navigation for both SPA routes and external links.\n *\n * @param url - The target URL to navigate to. Can be a path, query, or absolute URL.\n *\n * @example\n * ```typescript\n * // SPA navigation (same origin)\n * navigate('/dashboard');\n *\n * // SPA navigation with query\n * navigate('/search?q=thunderid');\n *\n * // Cross-origin navigation (full page load)\n * navigate('https://accounts.asgardeo.io/t/dxlab/accountrecoveryendpoint/register.do');\n * ```\n */\nconst navigate = (url: string): void => {\n try {\n const targetUrl: URL = new URL(url, window.location.origin);\n if (targetUrl.origin === window.location.origin) {\n window.history.pushState(null, '', targetUrl.pathname + targetUrl.search + targetUrl.hash);\n window.dispatchEvent(new PopStateEvent('popstate', {state: null}));\n } else {\n window.location.assign(targetUrl.href);\n }\n } catch {\n // If URL constructor fails (e.g., malformed URL), fallback to location.assign\n window.location.assign(url);\n }\n};\n\nexport default navigate;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThunderIDJavaScriptClient} from '@thunderid/javascript';\nimport {ThunderIDBrowserConfig} from './models/config';\n\n/**\n * Base class for implementing ThunderID in browser-based applications.\n * This class provides the core functionality for managing user authentication and sessions.\n *\n * @typeParam T - Configuration type that extends ThunderIDBrowserConfig.\n */\nabstract class ThunderIDBrowserClient<T = ThunderIDBrowserConfig> extends ThunderIDJavaScriptClient<T> {}\n\nexport default ThunderIDBrowserClient;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {ThemeDetection, ThemeMode, createPackageComponentLogger} from '@thunderid/javascript';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/browser',\n 'ThemeDetection',\n);\n\n/**\n * Extended theme detection config that includes DOM-specific options\n */\nexport interface BrowserThemeDetection extends ThemeDetection {\n /**\n * The element to observe for class changes\n * @default document.documentElement (html element)\n */\n targetElement?: HTMLElement;\n}\n\n/**\n * Detects the current theme mode based on the specified method\n */\nexport const detectThemeMode = (mode: ThemeMode, config: BrowserThemeDetection = {}): 'light' | 'dark' => {\n const {\n darkClass = 'dark',\n lightClass = 'light',\n targetElement = typeof document !== 'undefined' ? document.documentElement : null,\n } = config;\n\n if (mode === 'light') return 'light';\n if (mode === 'dark') return 'dark';\n\n if (mode === 'system') {\n if (typeof window !== 'undefined' && window.matchMedia) {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n return 'light';\n }\n\n if (mode === 'class') {\n if (!targetElement) {\n logger.warn('ThemeDetection: targetElement is required for class-based detection, falling back to light mode');\n return 'light';\n }\n\n const {classList} = targetElement;\n\n // Check for explicit dark class first\n if (classList.contains(darkClass)) {\n return 'dark';\n }\n\n // Check for explicit light class\n if (classList.contains(lightClass)) {\n return 'light';\n }\n\n // If neither class is present, default to light\n return 'light';\n }\n\n return 'light';\n};\n\n/**\n * Creates a MutationObserver to watch for class changes on the target element\n */\nexport const createClassObserver = (\n targetElement: HTMLElement,\n callback: (isDark: boolean) => void,\n config: BrowserThemeDetection = {},\n): MutationObserver => {\n const {darkClass = 'dark', lightClass = 'light'} = config;\n\n const observer: MutationObserver = new MutationObserver((mutations: MutationRecord[]) => {\n mutations.forEach((mutation: MutationRecord) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n const {classList} = targetElement;\n\n if (classList.contains(darkClass)) {\n callback(true);\n } else if (classList.contains(lightClass)) {\n callback(false);\n }\n // If neither class is present, we don't trigger the callback\n // to avoid unnecessary re-renders\n }\n });\n });\n\n observer.observe(targetElement, {\n attributeFilter: ['class'],\n attributes: true,\n });\n\n return observer;\n};\n\n/**\n * Creates a media query listener for system theme changes\n */\nexport const createMediaQueryListener = (callback: (isDark: boolean) => void): MediaQueryList | null => {\n if (typeof window === 'undefined' || !window.matchMedia) {\n return null;\n }\n\n const mediaQuery: MediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');\n\n const handleChange = (e: MediaQueryListEvent): void => {\n callback(e.matches);\n };\n\n // Modern browsers\n if (mediaQuery.addEventListener) {\n mediaQuery.addEventListener('change', handleChange);\n } else {\n // Fallback for older browsers\n mediaQuery.addListener(handleChange);\n }\n\n return mediaQuery;\n};\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {DEFAULT_THEME, ThemeMode} from '@thunderid/javascript';\nimport {BrowserThemeDetection, detectThemeMode} from './themeDetection';\n\n/**\n * Gets the active theme based on the theme mode preference\n * @param mode - The theme mode preference ('light', 'dark', 'system', or 'class')\n * @param config - Additional configuration for theme detection\n * @returns 'light' or 'dark' based on the resolved theme\n */\nconst getActiveTheme = (mode: ThemeMode, config: BrowserThemeDetection = {}): ThemeMode => {\n if (mode === 'dark') {\n return 'dark';\n }\n\n if (mode === 'light') {\n return 'light';\n }\n\n if (mode === 'system') {\n if (typeof window !== 'undefined' && window.matchMedia) {\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n\n // Default to light mode if system detection is not available\n return DEFAULT_THEME;\n }\n\n if (mode === 'class') {\n return detectThemeMode(mode, config);\n }\n\n // Default to light mode for any unknown mode\n return DEFAULT_THEME;\n};\n\nexport default getActiveTheme;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n arrayBufferToBase64url,\n base64urlToArrayBuffer,\n ThunderIDRuntimeError,\n createPackageComponentLogger,\n} from '@thunderid/javascript';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/browser',\n 'WebAuthn',\n);\n\n/**\n * Handles WebAuthn/Passkey authentication flow for browser environments.\n *\n * This function processes a WebAuthn challenge, performs the authentication ceremony,\n * and returns the authentication response that can be sent to the server for verification.\n *\n * The function handles various aspects of WebAuthn authentication including:\n * - Browser compatibility checks for WebAuthn support\n * - HTTPS requirement validation (except for localhost development)\n * - Relying Party ID validation and domain compatibility\n * - Challenge data decoding and credential request options processing\n * - User authentication ceremony via navigator.credentials.get()\n * - Response formatting for server consumption\n *\n * @param challengeData - Base64-encoded challenge data containing WebAuthn request options.\n * This data typically includes the challenge, RP ID, allowed credentials,\n * user verification requirements, and other authentication parameters.\n *\n * @returns Promise that resolves to a JSON string containing the WebAuthn authentication response.\n * The response includes the credential ID, authenticator data, client data JSON,\n * signature, and optional user handle that can be verified by the server.\n *\n * @throws {ThunderIDRuntimeError} When WebAuthn is not supported in the current browser\n * @throws {ThunderIDRuntimeError} When the page is not served over HTTPS (except localhost)\n * @throws {ThunderIDRuntimeError} When the user cancels or times out the authentication\n * @throws {ThunderIDRuntimeError} When there's a domain/RP ID mismatch\n * @throws {ThunderIDRuntimeError} When no valid passkey is found for the account\n * @throws {ThunderIDRuntimeError} When WebAuthn is not supported on the device/browser\n * @throws {ThunderIDRuntimeError} When there's a network error during authentication\n * @throws {ThunderIDRuntimeError} For any other authentication failures\n *\n * @example\n * ```typescript\n * try {\n * const challengeData = 'eyJwdWJsaWNLZXlDcmVkZW50aWFsUmVxdWVzdE9wdGlvbnMiOi4uLn0=';\n * const authResponse = await handleWebAuthnAuthentication(challengeData);\n *\n * // Send the response to your server for verification\n * const result = await fetch('/api/verify-webauthn', {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/json' },\n * body: authResponse\n * });\n * } catch (error) {\n * if (error instanceof ThunderIDRuntimeError) {\n * console.error('WebAuthn authentication failed:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Usage in an authentication flow\n * const authenticateWithPasskey = async (challengeFromServer: string) => {\n * try {\n * const response = await handleWebAuthnAuthentication(challengeFromServer);\n * return JSON.parse(response);\n * } catch (error) {\n * // Handle specific error cases\n * if (error instanceof ThunderIDRuntimeError) {\n * switch (error.code) {\n * case 'browser-webauthn-not-supported':\n * showFallbackAuth();\n * break;\n * case 'browser-webauthn-user-cancelled':\n * showRetryOption();\n * break;\n * default:\n * showGenericError();\n * }\n * }\n * }\n * };\n * ```\n *\n * @see {@link https://webauthn.guide/} - WebAuthn specification guide\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API} - MDN WebAuthn API documentation\n */\nconst handleWebAuthnAuthentication = async (challengeData: string): Promise<string> => {\n if (!window.navigator.credentials?.get) {\n throw new ThunderIDRuntimeError(\n 'WebAuthn is not supported in this browser. Please use a modern browser or try a different authentication method.',\n 'browser-webauthn-not-supported',\n 'browser',\n 'WebAuthn/Passkey authentication requires a browser that supports the Web Authentication API.',\n );\n }\n\n if (window.location.protocol !== 'https:' && window.location.hostname !== 'localhost') {\n throw new ThunderIDRuntimeError(\n 'Passkey authentication requires a secure connection (HTTPS). Please ensure you are accessing this site over HTTPS.',\n 'browser-webauthn-insecure-connection',\n 'browser',\n 'WebAuthn authentication requires HTTPS for security reasons, except when running on localhost for development.',\n );\n }\n\n try {\n const decodedChallenge: any = JSON.parse(atob(challengeData));\n const {publicKeyCredentialRequestOptions} = decodedChallenge;\n\n const currentDomain: string = window.location.hostname;\n const challengeRpId: string = publicKeyCredentialRequestOptions.rpId;\n\n let rpIdToUse: string = challengeRpId;\n\n if (challengeRpId && !currentDomain.endsWith(challengeRpId) && challengeRpId !== currentDomain) {\n logger.warn(`RP ID mismatch detected. Challenge RP ID: ${challengeRpId}, Current domain: ${currentDomain}`);\n rpIdToUse = currentDomain;\n }\n\n const adjustedOptions: any = {\n ...publicKeyCredentialRequestOptions,\n challenge: base64urlToArrayBuffer(publicKeyCredentialRequestOptions.challenge),\n rpId: rpIdToUse,\n ...(publicKeyCredentialRequestOptions.userVerification && {\n userVerification: publicKeyCredentialRequestOptions.userVerification,\n }),\n ...(publicKeyCredentialRequestOptions.allowCredentials && {\n allowCredentials: publicKeyCredentialRequestOptions.allowCredentials.map((cred: any) => ({\n ...cred,\n id: base64urlToArrayBuffer(cred.id),\n })),\n }),\n };\n\n const credential: PublicKeyCredential = (await navigator.credentials.get({\n publicKey: adjustedOptions,\n })) as PublicKeyCredential;\n\n if (!credential) {\n throw new ThunderIDRuntimeError(\n 'No credential returned from WebAuthn authentication',\n 'browser-webauthn-no-credential',\n 'browser',\n 'The WebAuthn authentication ceremony completed but did not return a valid credential.',\n );\n }\n\n const authData: AuthenticatorAssertionResponse = credential.response as AuthenticatorAssertionResponse;\n\n const tokenResponse: {credential: any; requestId: string} = {\n credential: {\n id: credential.id,\n rawId: arrayBufferToBase64url(credential.rawId),\n response: {\n authenticatorData: arrayBufferToBase64url(authData.authenticatorData),\n clientDataJSON: arrayBufferToBase64url(authData.clientDataJSON),\n signature: arrayBufferToBase64url(authData.signature),\n ...(authData.userHandle && {\n userHandle: arrayBufferToBase64url(authData.userHandle),\n }),\n },\n type: credential.type,\n },\n requestId: decodedChallenge.requestId,\n };\n\n return JSON.stringify(tokenResponse);\n } catch (error) {\n logger.error('WebAuthn authentication failed:');\n\n if (error instanceof ThunderIDRuntimeError) {\n throw error;\n }\n\n if (error instanceof Error) {\n switch (error.name) {\n case 'NotAllowedError':\n throw new ThunderIDRuntimeError(\n 'Passkey authentication was cancelled or timed out. Please try again.',\n 'browser-webauthn-user-cancelled',\n 'browser',\n 'The user cancelled the WebAuthn authentication request or the request timed out.',\n );\n\n case 'SecurityError':\n if (error.message.includes('relying party ID') || error.message.includes('RP ID')) {\n throw new ThunderIDRuntimeError(\n 'Domain mismatch error. The passkey was registered for a different domain. Please contact support or try a different authentication method.',\n 'browser-webauthn-domain-mismatch',\n 'browser',\n 'The WebAuthn relying party ID does not match the current domain.',\n );\n }\n throw new ThunderIDRuntimeError(\n 'Passkey authentication failed due to a security error. Please ensure you are using HTTPS and that your browser supports passkeys.',\n 'browser-webauthn-security-error',\n 'browser',\n 'A security error occurred during WebAuthn authentication.',\n );\n\n case 'InvalidStateError':\n throw new ThunderIDRuntimeError(\n 'No valid passkey found for this account. Please register a passkey first or use a different authentication method.',\n 'browser-webauthn-no-passkey',\n 'browser',\n 'No registered passkey credentials were found for the current user account.',\n );\n\n case 'NotSupportedError':\n throw new ThunderIDRuntimeError(\n 'Passkey authentication is not supported on this device or browser. Please use a different authentication method.',\n 'browser-webauthn-not-supported',\n 'browser',\n 'WebAuthn is not supported on the current device or browser configuration.',\n );\n\n case 'NetworkError':\n throw new ThunderIDRuntimeError(\n 'Network error during passkey authentication. Please check your connection and try again.',\n 'browser-webauthn-network-error',\n 'browser',\n 'A network error occurred while communicating with the authenticator.',\n );\n\n case 'UnknownError':\n throw new ThunderIDRuntimeError(\n 'An unknown error occurred during passkey authentication. Please try again or use a different authentication method.',\n 'browser-webauthn-unknown-error',\n 'browser',\n 'An unidentified error occurred during the WebAuthn authentication process.',\n );\n\n default:\n throw new ThunderIDRuntimeError(\n `Passkey authentication failed: ${error.message}`,\n 'browser-webauthn-general-error',\n 'browser',\n `WebAuthn authentication failed with error: ${error.name}`,\n );\n }\n }\n\n throw new ThunderIDRuntimeError(\n 'Passkey authentication failed due to an unexpected error.',\n 'browser-webauthn-unexpected-error',\n 'browser',\n 'An unexpected error occurred during WebAuthn authentication.',\n );\n }\n};\n\nexport default handleWebAuthnAuthentication;\n","/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n// eslint-disable-next-line import/no-cycle\nimport {ThunderIDSPAClient} from '../__legacy__/client';\n\n/**\n * Creates an HTTP utility for making requests using a specific ThunderIDSPAClient instance.\n *\n * @param instanceId - Optional instance ID for multi-instance support. Defaults to 0.\n * @returns An object with request and requestAll methods bound to the specified instance.\n *\n * @remarks\n * This utility provides methods to make single or multiple HTTP requests for a specific instance.\n *\n * @example\n * ```typescript\n * // Use default instance\n * const httpClient = http();\n *\n * // Use specific instance\n * const httpInstance1 = http(1);\n * const httpInstance2 = http(2);\n * ```\n */\nexport const http = (\n instanceId = 0,\n): {\n request: typeof ThunderIDSPAClient.prototype.httpRequest;\n requestAll: typeof ThunderIDSPAClient.prototype.httpRequestAll;\n} => {\n const client: ThunderIDSPAClient = ThunderIDSPAClient.getInstance(instanceId);\n\n return {\n /**\n * Makes a single HTTP request using the ThunderIDSPAClient instance.\n *\n * @param config - The HTTP request configuration object.\n * @returns A promise resolving to the HTTP response.\n */\n request: client.httpRequest.bind(client),\n\n /**\n * Makes multiple HTTP requests in parallel using the ThunderIDSPAClient instance.\n *\n * @param configs - An array of HTTP request configuration objects.\n * @returns A promise resolving to an array of HTTP responses.\n */\n requestAll: client.httpRequestAll.bind(client),\n };\n};\n\n/**\n * Default HTTP utility using instance 0.\n * For multi-instance support, use http(instanceId) instead.\n */\nexport default http();\n","/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {extractEmojiFromUri, isEmojiUri} from '@thunderid/javascript';\n\n/**\n * Resolves `emoji:` URIs in an HTML string.\n *\n * Handles two forms:\n * - `<img src=\"emoji:🐯\" alt=\"tiger\">` → `<span role=\"img\" aria-label=\"tiger\">🐯</span>`\n * - Bare `emoji:🐯` text references → `🐯`\n *\n * @param html - The HTML string that may contain `emoji:` URIs.\n * @returns The HTML string with all `emoji:` URIs replaced.\n */\nconst resolveEmojiUrisInHtml = (html: string): string => {\n const withEmojiImages: string = html.replace(\n /<img([^>]*)src=\"(emoji:[^\"]+)\"([^>]*)\\/?>/gi,\n (_match: string, pre: string, src: string, post: string): string => {\n const emoji: string = extractEmojiFromUri(src);\n if (!emoji) {\n return _match;\n }\n const altMatch: RegExpMatchArray | null = /alt=\"([^\"]*)\"/i.exec(pre + post);\n const label: string = altMatch ? altMatch[1] : emoji;\n return `<span role=\"img\" aria-label=\"${label}\">${emoji}</span>`;\n },\n );\n return withEmojiImages.replace(/emoji:([^\\s\"<>&]+)/g, (_: string, rest: string): string =>\n isEmojiUri(`emoji:${rest}`) ? rest : `emoji:${rest}`,\n );\n};\n\nexport default resolveEmojiUrisInHtml;\n"],"x_google_ignoreList":[15,16,17,18,19],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,kBAAb,MAAa,wBAAwBA,aAAW;CAC9C,OAAe,4BAA0C,IAAI,KAA8B;CAE3F,OAAO,YACL,aAAa,GACb,mBAAmB,MACnB,oBAAkF,QAAQ,SAAS,EAClF;AACjB,MAAI,CAAC,KAAK,UAAU,IAAI,WAAW,CACjC,MAAK,UAAU,IAAI,YAAY,IAAI,gBAAgB,kBAAkB,YAAY,CAAC;AAEpF,SAAO,KAAK,UAAU,IAAI,WAAW;;CAGvC,OAAO,gBAAgB,aAAa,GAAS;AAC3C,OAAK,UAAU,OAAO,WAAW;;CAGnC,MAAgB,UAAmB,QAAqD;EACtF,MAAM,EACJ,aACA,MACA,SAAS,eACT,QACA,QACA,4BACA,wBACA,eACA,KAAK,UACL,GAAG,iBACD;EAEJ,IAAIC,QAAc,aAAa;AAE/B,MAAI,QAAQ;GACV,MAAMC,KAAa,IAAI,gBAAgB,OAAO,CAAC,UAAU;AACzD,OAAI,GACF,SAAM,GAAGC,QAAMA,MAAI,SAAS,IAAI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