g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nexports.__esModule = true;\n__export(require(\"./lib/build/\"));\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction ArrowLeftIcon(_a) {\n var color = _a.color;\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"6\", height: \"8\", viewBox: \"0 0 6 8\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: jsxRuntime.jsx(\"path\", {\n d: \"M0.372871 3.24407C-0.0875903 3.64284 -0.0875899 4.35716 0.372872 4.75593L3.84535 7.76318C4.49299 8.32406 5.5 7.864 5.5 7.00725L5.5 0.992749C5.5 0.135997 4.49299 -0.324056 3.84535 0.23682L0.372871 3.24407Z\",\n fill: \"\".concat(color),\n }),\n }\n )\n );\n}\n\nexports.ArrowLeftIcon = ArrowLeftIcon;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar uiEntry = require(\"./index2.js\");\n\nfunction AuthComponentWrapper(_a) {\n var children = _a.children,\n recipeComponentOverrides = _a.recipeComponentOverrides;\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign({ value: recipeComponentOverrides }, { children: children })\n );\n}\n\nexports.AuthComponentWrapper = AuthComponentWrapper;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normaliseAuthRecipe(config) {\n return genericComponentOverrideContext.normaliseRecipeModuleConfig(config);\n}\nfunction selectComponentsToCoverAllFirstFactors(comps, firstFactorIds) {\n if (firstFactorIds.length === 0) {\n return undefined;\n }\n var _loop_1 = function (i) {\n var c = comps[i];\n // We check what factorIds are left if we select c\n var factorIdsLeft = firstFactorIds.filter(function (id) {\n return !c.factorIds.includes(id);\n });\n if (factorIdsLeft.length === 0) {\n return { value: [c] };\n }\n // If there are other factors we need to cover, we filter down the component list to things that\n // fit the remaining factor ids. This will remove overlapping components\n // E.g.: if we just selected the emailpassword+pwless component, the emailpassword sign in/up components\n // will be removed, since emailpassword is not in factorIdsLeft\n var componentsLeft = comps.filter(function (c) {\n return c.factorIds.every(function (id) {\n return factorIdsLeft.includes(id);\n });\n });\n // if we both have components and factors left after selecting c, we recurse\n if (componentsLeft.length !== 0) {\n var nextComps = selectComponentsToCoverAllFirstFactors(componentsLeft, factorIdsLeft);\n if (nextComps !== undefined) {\n return { value: genericComponentOverrideContext.__spreadArray([c], nextComps, true) };\n }\n }\n };\n for (var i = 0; i < comps.length; ++i) {\n var state_1 = _loop_1(i);\n if (typeof state_1 === \"object\") return state_1.value;\n }\n // if we run out of components, we can't cover all factorids with this set of components\n return undefined;\n}\n\nexports.normaliseAuthRecipe = normaliseAuthRecipe;\nexports.selectComponentsToCoverAllFirstFactors = selectComponentsToCoverAllFirstFactors;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar index = require(\"./recipeModule-shared.js\");\nvar types = require(\"./multifactorauth-shared.js\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar AuthRecipe = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(AuthRecipe, _super);\n function AuthRecipe() {\n var _this = (_super !== null && _super.apply(this, arguments)) || this;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _this.getAuthRecipeDefaultRedirectionURL = function (_context) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n throw new Error(\"Should never come here\");\n });\n });\n };\n _this.signOut = function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().signOut({\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n }),\n ];\n case 1:\n return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n _this.doesSessionExist = function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().doesSessionExist({\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n }),\n ];\n case 1:\n return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n return _this;\n }\n return AuthRecipe;\n})(index.RecipeModule);\n\nexports.AuthRecipe = AuthRecipe;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction EmailLargeIcon() {\n return jsxRuntime.jsxs(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"81\", height: \"74\", viewBox: \"0 0 81 74\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: [\n jsxRuntime.jsx(\"rect\", {\n width: \"81\",\n height: \"74\",\n rx: \"12\",\n fill: \"#2D3644\",\n fillOpacity: \"0.1\",\n }),\n jsxRuntime.jsx(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M22.304 22.0647C21.4909 22.2023 20.7728 22.5533 20.1863 23.0998C18.7101 24.4753 18.6499 26.6951 20.0512 28.0797C20.366 28.3907 21.5186 29.123 29.4316 34.0394C34.3935 37.1223 38.5814 39.7052 38.7381 39.7792C39.2064 40.0002 39.6687 40.1143 40.2244 40.1458C40.8761 40.1827 41.4402 40.1043 41.985 39.9011C42.2986 39.784 44.5964 38.3819 51.3963 34.1584C56.3443 31.0851 60.5173 28.4732 60.6697 28.3541C61.6877 27.5591 62.2023 26.167 61.9144 24.9866C61.6226 23.7897 60.8986 22.9167 59.7616 22.3906C58.8649 21.9756 60.7985 22.015 40.6942 22.003C25.4606 21.9939 22.667 22.0033 22.304 22.0647ZM19.0395 30.4626C18.9759 30.522 18.9942 48.1686 19.0584 48.6611C19.1774 49.5735 19.5459 50.2964 20.1994 50.8994C20.8308 51.482 21.6026 51.8339 22.511 51.9535C22.8345 51.9961 27.7369 52.0074 40.7771 51.9956C57.6349 51.9804 58.6205 51.9745 58.9603 51.8882C60.2693 51.5556 61.3138 50.6712 61.7699 49.5095C62.0053 48.9096 62 49.1399 62 39.5359C62 32.263 61.986 30.4234 61.9309 30.4431C61.8929 30.4567 57.8079 32.987 52.8531 36.066C46.8009 39.8271 43.6631 41.747 43.2918 41.9165C42.9361 42.0787 42.4928 42.2268 42.0483 42.3318C41.4278 42.4783 41.273 42.4951 40.5284 42.4969C40.0474 42.498 39.5717 42.4714 39.3954 42.4335C38.8623 42.319 38.0528 42.0686 37.6821 41.9036C37.4845 41.8156 33.2326 39.2037 28.2334 36.0994C23.2342 32.995 19.129 30.4488 19.1107 30.4412C19.0924 30.4335 19.0604 30.4432 19.0395 30.4626Z\",\n fill: \"#2D3644\",\n }),\n ],\n }\n )\n );\n}\n\nexports.EmailLargeIcon = EmailLargeIcon;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nrequire(\"./index2.js\");\nvar translationContext = require(\"./translationContext.js\");\n\n/*\n * Component.\n */\nfunction Button(_a) {\n var type = _a.type,\n label = _a.label,\n disabled = _a.disabled,\n isLoading = _a.isLoading,\n onClick = _a.onClick;\n var t = translationContext.useTranslation();\n if (disabled === undefined) {\n disabled = false;\n }\n return jsxRuntime.jsxs(\n \"button\",\n genericComponentOverrideContext.__assign(\n { type: type, disabled: disabled, onClick: onClick, \"data-supertokens\": \"button\" },\n { children: [t(label), isLoading && \"...\"] }\n )\n );\n}\n\nexports.Button = Button;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nexports.Provider = Provider;\nexports.useContext = useContext;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar EmailPasswordWebJS = require(\"supertokens-web-js/recipe/emailpassword\");\nvar index = require(\"./authRecipe-shared2.js\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar constants = require(\"./emailpassword-shared4.js\");\nvar utils = require(\"./authRecipe-shared.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar EmailPasswordWebJS__default = /*#__PURE__*/ _interopDefault(EmailPasswordWebJS);\n\nvar getFunctionOverrides = function (onHandleEvent) {\n return function (originalImp) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), {\n submitNewPassword: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n originalImp.submitNewPassword(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n { formFields: [input.formFields[0]] }\n )\n ),\n ];\n case 1:\n response = _a.sent();\n if (response.status === \"OK\") {\n onHandleEvent({\n action: \"PASSWORD_RESET_SUCCESSFUL\",\n userContext: input.userContext,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n sendPasswordResetEmail: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.sendPasswordResetEmail(input)];\n case 1:\n response = _a.sent();\n if (response.status === \"OK\") {\n onHandleEvent({\n action: \"RESET_PASSWORD_EMAIL_SENT\",\n email: input.formFields.find(function (_a) {\n var id = _a.id;\n return id === \"email\";\n }).value,\n userContext: input.userContext,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n signUp: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var payloadBeforeCall, response, payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 1:\n payloadBeforeCall = _c.sent();\n return [3 /*break*/, 3];\n case 2:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadBeforeCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [4 /*yield*/, originalImp.signUp(input)];\n case 4:\n response = _c.sent();\n if (!(response.status === \"OK\")) return [3 /*break*/, 9];\n payloadAfterCall = void 0;\n _c.label = 5;\n case 5:\n _c.trys.push([5, 7, , 8]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 6:\n payloadAfterCall = _c.sent();\n return [3 /*break*/, 8];\n case 7:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadAfterCall = undefined;\n return [3 /*break*/, 8];\n case 8:\n onHandleEvent({\n action: \"SUCCESS\",\n isNewRecipeUser: true,\n createdNewSession:\n payloadAfterCall !== undefined &&\n (payloadBeforeCall === undefined ||\n payloadBeforeCall.sessionHandle !== payloadAfterCall.sessionHandle),\n user: response.user,\n userContext: input.userContext,\n });\n _c.label = 9;\n case 9:\n return [2 /*return*/, response];\n }\n });\n });\n },\n signIn: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var payloadBeforeCall, response, payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 1:\n payloadBeforeCall = _c.sent();\n return [3 /*break*/, 3];\n case 2:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadBeforeCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [4 /*yield*/, originalImp.signIn(input)];\n case 4:\n response = _c.sent();\n if (!(response.status === \"OK\")) return [3 /*break*/, 9];\n payloadAfterCall = void 0;\n _c.label = 5;\n case 5:\n _c.trys.push([5, 7, , 8]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 6:\n payloadAfterCall = _c.sent();\n return [3 /*break*/, 8];\n case 7:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadAfterCall = undefined;\n return [3 /*break*/, 8];\n case 8:\n onHandleEvent({\n action: \"SUCCESS\",\n isNewRecipeUser: false,\n createdNewSession:\n payloadAfterCall !== undefined &&\n (payloadBeforeCall === undefined ||\n payloadBeforeCall.sessionHandle !== payloadAfterCall.sessionHandle),\n user: response.user,\n userContext: input.userContext,\n });\n _c.label = 9;\n case 9:\n return [2 /*return*/, response];\n }\n });\n });\n },\n });\n };\n};\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * defaultEmailValidator.\n */\nfunction defaultEmailValidator(value) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var defaultEmailValidatorRegexp;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"ERROR_EMAIL_NON_STRING\"];\n }\n value = value.trim();\n defaultEmailValidatorRegexp =\n // eslint-disable-next-line no-useless-escape\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // We check if the email syntax is correct\n // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438\n // Regex from https://stackoverflow.com/a/46181/3867175\n if (value.match(defaultEmailValidatorRegexp) === null) {\n return [2 /*return*/, \"ERROR_EMAIL_INVALID\"];\n }\n return [2 /*return*/, undefined];\n });\n });\n}\n/*\n * defaultPasswordValidator.\n * min 8 characters.\n * Contains lowercase, uppercase, and numbers.\n */\nfunction defaultPasswordValidator(value) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"ERROR_PASSWORD_NON_STRING\"];\n }\n // length >= 8 && < 100\n // must have a number and a character\n // as per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438\n if (value.length < 8) {\n return [2 /*return*/, \"ERROR_PASSWORD_TOO_SHORT\"];\n }\n if (value.length >= 100) {\n return [2 /*return*/, \"ERROR_PASSWORD_TOO_LONG\"];\n }\n if (value.match(/^.*[A-Za-z]+.*$/) === null) {\n return [2 /*return*/, \"ERROR_PASSWORD_NO_ALPHA\"];\n }\n if (value.match(/^.*[0-9]+.*$/) === null) {\n return [2 /*return*/, \"ERROR_PASSWORD_NO_NUM\"];\n }\n return [2 /*return*/, undefined];\n });\n });\n}\n/*\n * defaultLoginPasswordValidator.\n * type string\n */\nfunction defaultLoginPasswordValidator(value) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"ERROR_PASSWORD_NON_STRING\"];\n }\n return [2 /*return*/, undefined];\n });\n });\n}\n/*\n * defaultValidate\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction defaultValidate(_) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [2 /*return*/, undefined];\n });\n });\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normaliseEmailPasswordConfig(config) {\n if (config === undefined) {\n config = {};\n }\n var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature);\n var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) {\n return field.id === \"password\";\n });\n var signUpEmailField = signInAndUpFeature.signUpForm.formFields.find(function (field) {\n return field.id === \"email\";\n });\n var resetPasswordUsingTokenFeature = normaliseResetPasswordUsingTokenFeature(\n signUpPasswordField.validate,\n signUpEmailField,\n config.resetPasswordUsingTokenFeature\n );\n var override = genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config.override\n );\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)),\n {\n signInAndUpFeature: signInAndUpFeature,\n resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature,\n override: override,\n }\n );\n}\nfunction normaliseSignInAndUpFeature(config) {\n if (config === undefined) {\n config = {};\n }\n var signUpForm = normaliseSignUpFormFeatureConfig(config.signUpForm);\n /*\n * Default Sign In corresponds to computed Sign Up fields filtered by email and password only.\n * i.e. If the user overrides sign Up fields, that is propagated to default sign In fields.\n * Exception made of the password validator which only verifies that the value is not empty for login\n * https://github.com/supertokens/supertokens-auth-react/issues/21\n */\n var defaultSignInFields = signUpForm.formFields.reduce(function (signInFieldsAccumulator, field) {\n if (field.id === \"email\") {\n return genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true),\n [field],\n false\n );\n }\n if (field.id === \"password\") {\n return genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true),\n [\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), {\n autoComplete: \"current-password\",\n validate: defaultLoginPasswordValidator,\n }),\n ],\n false\n );\n }\n return signInFieldsAccumulator;\n }, []);\n var signInForm = normaliseSignInFormFeatureConfig(defaultSignInFields, config.signInForm);\n return {\n signUpForm: signUpForm,\n signInForm: signInForm,\n };\n}\nfunction normaliseSignUpFormFeatureConfig(config) {\n if (config === undefined) {\n config = {};\n }\n var defaultFormFields = getDefaultFormFields();\n var userFormFields = [];\n if (config.formFields !== undefined) {\n userFormFields = config.formFields;\n }\n var formFields = mergeFormFields(defaultFormFields, userFormFields);\n var style = config.style !== undefined ? config.style : \"\";\n return {\n style: style,\n formFields: formFields,\n };\n}\nfunction normaliseSignInFormFeatureConfig(defaultFormFields, config) {\n if (config === undefined) {\n config = {};\n }\n var userFormFields = [];\n if (config.formFields !== undefined) {\n userFormFields = config.formFields\n // Filter on email and password only.\n .filter(function (field) {\n return constants.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id);\n })\n // Sign In fields are never optional.\n .map(function (field) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), {\n optional: false,\n });\n });\n }\n var formFields = mergeFormFields(defaultFormFields, userFormFields);\n var style = config.style !== undefined ? config.style : \"\";\n return {\n style: style,\n formFields: formFields,\n };\n}\nfunction getDefaultFormFields() {\n return [getDefaultEmailFormField(), getDefaultPasswordFormField()];\n}\nfunction getDefaultEmailFormField() {\n return {\n id: \"email\",\n label: \"EMAIL_PASSWORD_EMAIL_LABEL\",\n placeholder: \"EMAIL_PASSWORD_EMAIL_PLACEHOLDER\",\n validate: defaultEmailValidator,\n optional: false,\n autoComplete: \"email\",\n };\n}\nfunction getDefaultPasswordFormField() {\n return {\n id: \"password\",\n label: \"EMAIL_PASSWORD_PASSWORD_LABEL\",\n placeholder: \"EMAIL_PASSWORD_PASSWORD_PLACEHOLDER\",\n validate: defaultPasswordValidator,\n optional: false,\n autoComplete: \"new-password\",\n };\n}\nfunction normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate, signUpEmailField, config) {\n if (config === undefined) {\n config = {};\n }\n var disableDefaultUI = config.disableDefaultUI === true;\n var submitNewPasswordFormStyle =\n config.submitNewPasswordForm !== undefined && config.submitNewPasswordForm.style !== undefined\n ? config.submitNewPasswordForm.style\n : \"\";\n var submitNewPasswordForm = {\n style: submitNewPasswordFormStyle,\n formFields: [\n {\n id: \"password\",\n label: \"EMAIL_PASSWORD_NEW_PASSWORD_LABEL\",\n placeholder: \"EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER\",\n validate: signUpPasswordFieldValidate,\n optional: false,\n autoComplete: \"new-password\",\n },\n {\n id: \"confirm-password\",\n label: \"EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL\",\n placeholder: \"EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER\",\n validate: signUpPasswordFieldValidate,\n optional: false,\n autoComplete: \"new-password\",\n },\n ],\n };\n var enterEmailFormStyle =\n config.enterEmailForm !== undefined && config.enterEmailForm.style !== undefined\n ? config.enterEmailForm.style\n : \"\";\n var enterEmailForm = {\n style: enterEmailFormStyle,\n formFields: [\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, getDefaultEmailFormField()),\n { validate: signUpEmailField.validate, placeholder: \"\", autofocus: true }\n ),\n ],\n };\n return {\n disableDefaultUI: disableDefaultUI,\n submitNewPasswordForm: submitNewPasswordForm,\n enterEmailForm: enterEmailForm,\n };\n}\n/*\n * mergeFormFields by keeping the provided order, defaultFormFields or merged first, and unmerged userFormFields after.\n */\nfunction mergeFormFields(defaultFormFields, userFormFields) {\n // Create a new array with default fields.\n var mergedFormFields = defaultFormFields;\n // Loop through user provided fields.\n for (var i = 0; i < userFormFields.length; i++) {\n var userField = userFormFields[i];\n var isNewField = true;\n // Loop through the merged fields array.\n for (var j = 0; j < mergedFormFields.length; j++) {\n var mergedField = mergedFormFields[j];\n // If id is equal, merge the fields\n if (userField.id === mergedField.id) {\n // Make sure that email and password are kept mandatory.\n var optional = mergedField.optional; // Init with default value.\n // If user provided value, overwrite.\n if (userField.optional !== undefined) {\n optional = userField.optional;\n }\n // If \"email\" or \"password\", always mandatory.\n if (constants.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(userField.id)) {\n optional = false;\n }\n // Merge.\n mergedFormFields[j] = genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, mergedFormFields[j]),\n userField\n ),\n { optional: optional }\n );\n isNewField = false;\n break;\n }\n }\n // If new field, push to mergeFormFields.\n if (isNewField) {\n mergedFormFields.push(\n genericComponentOverrideContext.__assign(\n { optional: false, placeholder: userField.label, validate: defaultValidate },\n userField\n )\n );\n }\n }\n return mergedFormFields.map(function (field) {\n return getFormattedFormField(field);\n });\n}\nfunction getFormattedFormField(field) {\n var _this = this;\n // Fields with the 'nonOptionalErrorMsg' property must have a valid message defined\n if (field.optional === false && field.nonOptionalErrorMsg === \"\") {\n throw new Error(\"nonOptionalErrorMsg for field \".concat(field.id, \" cannot be an empty string\"));\n }\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), {\n validate: function (value) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // Absent or not optional empty field\n if (value === \"\" && field.optional === false) {\n if (field.nonOptionalErrorMsg !== undefined) {\n return [2 /*return*/, field.nonOptionalErrorMsg];\n }\n return [2 /*return*/, \"ERROR_NON_OPTIONAL\"];\n }\n return [4 /*yield*/, field.validate(value)];\n case 1:\n return [2 /*return*/, _a.sent()];\n }\n });\n });\n },\n });\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Class.\n */\nvar EmailPassword = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(EmailPassword, _super);\n function EmailPassword(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = EmailPasswordWebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = EmailPassword.RECIPE_ID;\n _this.firstFactorIds = [types.FactorIds.EMAILPASSWORD];\n _this.getDefaultRedirectionURL = function (context) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (context.action === \"RESET_PASSWORD\") {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.getDefaultRedirectionURLForPath(\n this.config,\n constants.DEFAULT_RESET_PASSWORD_PATH,\n context\n ),\n ];\n }\n return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)];\n });\n });\n };\n return _this;\n }\n EmailPassword.prototype.getFirstFactorsForAuthPage = function () {\n return this.firstFactorIds;\n };\n EmailPassword.init = function (config) {\n var normalisedConfig = normaliseEmailPasswordConfig(config);\n return {\n recipeID: EmailPassword.RECIPE_ID,\n authReact: function (appInfo) {\n EmailPassword.instance = new EmailPassword(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID }\n )\n );\n return EmailPassword.instance;\n },\n webJS: EmailPasswordWebJS__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n override: {\n functions: function (originalImpl, builder) {\n var functions = getFunctionOverrides(normalisedConfig.onHandleEvent);\n builder.override(functions);\n builder.override(normalisedConfig.override.functions);\n return originalImpl;\n },\n },\n }\n )\n ),\n };\n };\n EmailPassword.getInstanceOrThrow = function () {\n if (EmailPassword.instance === undefined) {\n var error =\n \"No instance of EmailPassword found. Make sure to call the EmailPassword.init method.\" +\n \"See https://supertokens.io/docs/emailpassword/quick-setup/frontend\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + genericComponentOverrideContext.SSR_ERROR;\n }\n throw Error(error);\n }\n return EmailPassword.instance;\n };\n /*\n * Tests methods.\n */\n EmailPassword.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n EmailPassword.instance = undefined;\n return;\n };\n EmailPassword.RECIPE_ID = \"emailpassword\";\n return EmailPassword;\n})(index.AuthRecipe);\n\nexports.EmailPassword = EmailPassword;\nexports.defaultValidate = defaultValidate;\n","\"use strict\";\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar MANDATORY_FORM_FIELDS_ID_ARRAY = [\"email\", \"password\"];\nvar DEFAULT_RESET_PASSWORD_PATH = \"/reset-password\";\n\nexports.DEFAULT_RESET_PASSWORD_PATH = DEFAULT_RESET_PASSWORD_PATH;\nexports.MANDATORY_FORM_FIELDS_ID_ARRAY = MANDATORY_FORM_FIELDS_ID_ARRAY;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar React = require(\"react\");\nvar STGeneralError = require(\"supertokens-web-js/utils/error\");\nvar constants = require(\"./emailpassword-shared4.js\");\nvar button = require(\"./emailpassword-shared.js\");\nrequire(\"./index2.js\");\nvar translationContext = require(\"./translationContext.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar React__default = /*#__PURE__*/ _interopDefault(React);\nvar STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError);\n\n/*\n * Component.\n */\nfunction FormRow(_a) {\n var children = _a.children,\n hasError = _a.hasError;\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": [\"formRow\", hasError ? \"hasError\" : \"\"].join(\" \") },\n { children: children }\n )\n );\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction CheckedIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"14.862\",\n height: \"12.033\",\n viewBox: \"0 0 14.862 12.033\",\n \"data-supertokens\": \"checkedIcon\",\n },\n {\n children: jsxRuntime.jsx(\"path\", {\n fill: \"rgb(var(--palette-primary))\",\n d: \"M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z\",\n transform: \"translate(0 -49)\",\n }),\n }\n )\n );\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction ErrorIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"17\",\n height: \"15\",\n viewBox: \"0 0 17 15\",\n \"data-supertokens\": \"errorIcon\",\n },\n {\n children: jsxRuntime.jsxs(\"g\", {\n children: [\n jsxRuntime.jsx(\n \"g\",\n genericComponentOverrideContext.__assign(\n { className: \"Asdf\", fill: \"rgb(var(--palette-error))\" },\n {\n children: jsxRuntime.jsx(\"path\", {\n d: \"M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z\",\n transform: \"translate(-824.894 -352.829) translate(824.894 352.829)\",\n }),\n }\n )\n ),\n jsxRuntime.jsx(\n \"text\",\n genericComponentOverrideContext.__assign(\n {\n fill: \"#fff\",\n fontSize: \"10px\",\n fontWeight: \"700\",\n transform: \"translate(-824.894 -352.829) translate(832.014 365.198)\",\n },\n {\n children: jsxRuntime.jsx(\n \"tspan\",\n genericComponentOverrideContext.__assign({ x: \"0\", y: \"0\" }, { children: \"!\" })\n ),\n }\n )\n ),\n ],\n }),\n }\n )\n );\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction ShowPasswordIcon(_a) {\n var showPassword = _a.showPassword;\n if (showPassword === true) {\n return jsxRuntime.jsx(\"div\", {\n children: jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"18.391\",\n height: \"16.276\",\n viewBox: \"0 0 18.391 16.276\",\n \"data-supertokens\": \"showPasswordIcon show\",\n },\n {\n children: jsxRuntime.jsxs(\"g\", {\n children: [\n jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"path\", {\n fill: \"rgb(var(--palette-textPrimary))\",\n d: \"M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z\",\n transform:\n \"translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)\",\n }),\n }),\n }),\n }),\n jsxRuntime.jsxs(\n \"g\",\n genericComponentOverrideContext.__assign(\n {\n fill: \"rgb(var(--palette-textPrimary))\",\n stroke: \"rgb(var(--palette-inputBackground))\",\n transform: \"translate(-822 -420.048) translate(827.164 424.055)\",\n },\n {\n children: [\n jsxRuntime.jsx(\"circle\", {\n cx: \"4.036\",\n cy: \"4.036\",\n r: \"4.036\",\n stroke: \"none\",\n }),\n jsxRuntime.jsx(\"circle\", {\n cx: \"4.036\",\n cy: \"4.036\",\n r: \"3.536\",\n fill: \"none\",\n }),\n ],\n }\n )\n ),\n jsxRuntime.jsx(\"path\", {\n fill: \"none\",\n stroke: \"#707070\",\n strokeLinecap: \"round\",\n strokeWidth: \"2.25px\",\n d: \"M11.981 0L0 11.981\",\n transform: \"translate(-822 -420.048) translate(825.084 421.639)\",\n }),\n jsxRuntime.jsx(\"path\", {\n fill: \"none\",\n stroke: \"rgb(var(--palette-inputBackground))\",\n strokeLinecap: \"round\",\n d: \"M13.978 0L0 13.978\",\n transform: \"translate(-822 -420.048) translate(825.084 421.639)\",\n }),\n ],\n }),\n }\n )\n ),\n });\n }\n return jsxRuntime.jsx(\"div\", {\n children: jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"18.281\",\n height: \"12.033\",\n viewBox: \"0 0 18.281 12.033\",\n \"data-supertokens\": \"showPasswordIcon hide\",\n },\n {\n children: jsxRuntime.jsxs(\"g\", {\n children: [\n jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"g\", {\n children: jsxRuntime.jsx(\"path\", {\n fill: \"rgb(var(--palette-textPrimary))\",\n d: \"M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z\",\n transform:\n \"translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)\",\n }),\n }),\n }),\n }),\n jsxRuntime.jsxs(\n \"g\",\n genericComponentOverrideContext.__assign(\n {\n fill: \"rgb(var(--palette-textPrimary))\",\n stroke: \"rgb(var(--palette-inputBackground))\",\n transform: \"translate(-822 -422.088) translate(827.133 424.096)\",\n },\n {\n children: [\n jsxRuntime.jsx(\"circle\", {\n cx: \"4.012\",\n cy: \"4.012\",\n r: \"4.012\",\n stroke: \"none\",\n }),\n jsxRuntime.jsx(\"circle\", {\n cx: \"4.012\",\n cy: \"4.012\",\n r: \"3.512\",\n fill: \"none\",\n }),\n ],\n }\n )\n ),\n ],\n }),\n }\n )\n ),\n });\n}\n\nvar Input = function (_a) {\n var type = _a.type,\n name = _a.name,\n hasError = _a.hasError,\n autoComplete = _a.autoComplete,\n onInputFocus = _a.onInputFocus,\n onInputBlur = _a.onInputBlur,\n onChange = _a.onChange,\n value = _a.value,\n placeholder = _a.placeholder,\n validated = _a.validated,\n autofocus = _a.autofocus;\n var t = translationContext.useTranslation();\n var _b = React.useState(false),\n showPassword = _b[0],\n setShowPassword = _b[1];\n /*\n * Method.\n */\n function handleFocus() {\n if (onInputFocus !== undefined) {\n onInputFocus(value);\n }\n }\n function handleBlur() {\n if (onInputBlur !== undefined) {\n onInputBlur(value);\n }\n }\n function handleChange(event) {\n if (onChange) {\n onChange(event.target.value);\n }\n }\n if (autoComplete === undefined) {\n autoComplete = \"off\";\n }\n var inputType = type;\n if (type === \"password\" && showPassword === true) {\n inputType = \"text\";\n }\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"inputContainer\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": [\"inputWrapper\", hasError ? \"inputError\" : \"\"].join(\" \") },\n {\n children: [\n jsxRuntime.jsx(\"input\", {\n autoFocus: autofocus,\n autoComplete: autoComplete,\n \"data-supertokens\": \"input input-\".concat(name),\n className: \"supertokens-input\",\n onFocus: handleFocus,\n onBlur: handleBlur,\n type: inputType,\n name: name,\n placeholder: t(placeholder),\n onChange: handleChange,\n value: value,\n }),\n hasError === true &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"inputAdornment inputAdornmentError\" },\n { children: jsxRuntime.jsx(ErrorIcon, {}) }\n )\n ),\n validated === true &&\n hasError === false &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"inputAdornment inputAdornmentSuccess\" },\n { children: jsxRuntime.jsx(CheckedIcon, {}) }\n )\n ),\n type === \"password\" &&\n value.length > 0 &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n onClick: function () {\n return setShowPassword(showPassword === false);\n },\n \"data-supertokens\": \"inputAdornment showPassword\",\n },\n {\n children: jsxRuntime.jsx(ShowPasswordIcon, {\n showPassword: showPassword,\n }),\n }\n )\n ),\n ],\n }\n )\n ),\n }\n )\n );\n};\n\nfunction InputError(_a) {\n var error = _a.error;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign({ \"data-supertokens\": \"inputErrorMessage\" }, { children: t(error) })\n );\n}\n\nfunction Label(_a) {\n var value = _a.value,\n showIsRequired = _a.showIsRequired;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"label\" },\n { children: [t(value), showIsRequired && value && value.trim() !== \"\" && \" *\"] }\n )\n );\n}\n\nvar fetchDefaultValue = function (field) {\n if (field.getDefaultValue !== undefined) {\n var defaultValue = field.getDefaultValue();\n if (typeof defaultValue !== \"string\") {\n throw new Error(\"getDefaultValue for \".concat(field.id, \" must return a string\"));\n } else {\n return defaultValue;\n }\n }\n return \"\";\n};\nfunction InputComponentWrapper(props) {\n var field = props.field,\n type = props.type,\n fstate = props.fstate,\n onInputFocus = props.onInputFocus,\n onInputBlur = props.onInputBlur,\n onInputChange = props.onInputChange;\n var useCallbackOnInputFocus = React.useCallback(\n function (value) {\n onInputFocus({\n id: field.id,\n value: value,\n });\n },\n [onInputFocus, field.id]\n );\n var useCallbackOnInputBlur = React.useCallback(\n function (value) {\n onInputBlur({\n id: field.id,\n value: value,\n });\n },\n [onInputBlur, field.id]\n );\n var useCallbackOnInputChange = React.useCallback(\n function (value) {\n onInputChange({\n id: field.id,\n value: value,\n });\n },\n [onInputChange, field.id]\n );\n return field.inputComponent !== undefined\n ? jsxRuntime.jsx(\n field.inputComponent,\n {\n type: type,\n name: field.id,\n validated: fstate.validated === true,\n placeholder: field.placeholder,\n value: fstate.value,\n autoComplete: field.autoComplete,\n autofocus: field.autofocus,\n onInputFocus: useCallbackOnInputFocus,\n onInputBlur: useCallbackOnInputBlur,\n onChange: useCallbackOnInputChange,\n hasError: fstate.error !== undefined,\n },\n field.id\n )\n : jsxRuntime.jsx(\n Input,\n {\n type: type,\n name: field.id,\n validated: fstate.validated === true,\n placeholder: field.placeholder,\n value: fstate.value,\n autoComplete: field.autoComplete,\n onInputFocus: useCallbackOnInputFocus,\n onInputBlur: useCallbackOnInputBlur,\n onChange: useCallbackOnInputChange,\n autofocus: field.autofocus,\n hasError: fstate.error !== undefined,\n },\n field.id\n );\n}\nvar FormBase = function (props) {\n var footer = props.footer,\n buttonLabel = props.buttonLabel,\n showLabels = props.showLabels,\n validateOnBlur = props.validateOnBlur,\n formFields = props.formFields;\n var unmounting = React.useRef(new AbortController());\n React.useEffect(\n function () {\n // We need this because in some cases this gets called multiple times\n unmounting.current = new AbortController();\n return function () {\n unmounting.current.abort();\n };\n },\n [unmounting]\n );\n var _a = React.useState(\n props.formFields.map(function (f) {\n return { id: f.id, value: fetchDefaultValue(f) };\n })\n ),\n fieldStates = _a[0],\n setFieldStates = _a[1];\n React.useEffect(\n function () {\n setFieldStates(function (fs) {\n var ret = fs;\n var fieldsWithoutState = props.formFields.filter(function (f) {\n return !fieldStates.some(function (s) {\n return f.id === s.id;\n });\n });\n // If there is a formfield missing from the states array, we fill with the default value\n if (fieldsWithoutState.length > 0) {\n fs = genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray([], fs, true),\n fieldsWithoutState.map(function (f) {\n return { id: f.id, value: fetchDefaultValue(f) };\n }),\n true\n );\n }\n // If a field has been removed from formFields, we want to remove it from the states array as well.\n if (\n fieldStates.some(function (s) {\n return !props.formFields.some(function (f) {\n return f.id === s.id;\n });\n })\n ) {\n ret = fs.filter(function (s) {\n return props.formFields.some(function (f) {\n return f.id === s.id;\n });\n });\n }\n return ret;\n });\n },\n [props.formFields, setFieldStates]\n );\n var _b = React.useState(false),\n isLoading = _b[0],\n setIsLoading = _b[1];\n var updateFieldState = React.useCallback(\n function (id, update) {\n setFieldStates(function (os) {\n var field = os.find(function (f) {\n return f.id === id;\n });\n if (field === undefined) {\n return genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray([], os, true),\n [update({ id: id, value: \"\" })],\n false\n );\n }\n return os\n .filter(function (f) {\n return f.id !== field.id;\n })\n .concat(update(field));\n });\n },\n [setFieldStates]\n );\n var onInputFocus = React.useCallback(\n function (field) {\n updateFieldState(field.id, function (os) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), {\n validated: false,\n });\n });\n },\n [updateFieldState]\n );\n var onInputBlur = React.useCallback(\n function (field) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var fieldConfig, error, _a;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!validateOnBlur) {\n return [2 /*return*/];\n }\n fieldConfig = props.formFields.find(function (f) {\n return f.id === field.id;\n });\n if (!(fieldConfig && field.value !== \"\")) return [3 /*break*/, 2];\n return [4 /*yield*/, fieldConfig.validate(field.value)];\n case 1:\n _a = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _a = undefined;\n _b.label = 3;\n case 3:\n error = _a;\n updateFieldState(field.id, function (os) {\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, os),\n { error: error, validated: error === undefined && field.value.length !== 0 }\n );\n });\n return [2 /*return*/];\n }\n });\n });\n },\n [validateOnBlur, updateFieldState, props.formFields]\n );\n var onInputChange = React.useCallback(\n function (field) {\n if (typeof field.value !== \"string\") {\n throw new Error(\"\".concat(field.id, \" value must be a string\"));\n }\n updateFieldState(field.id, function (os) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), {\n value: field.value,\n error: undefined,\n });\n });\n props.clearError();\n },\n [updateFieldState]\n );\n var onFormSubmit = React.useCallback(\n function (e) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var apiFields,\n fieldUpdates,\n result,\n generalError,\n fetchError,\n e_1,\n _loop_1,\n _i,\n formFields_1,\n field,\n errorFields_1,\n getErrorMessage_1;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // Prevent default event propagation.\n e.preventDefault();\n // Set loading state.\n setIsLoading(true);\n setFieldStates(function (os) {\n return os.map(function (fs) {\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, fs),\n { error: undefined }\n );\n });\n });\n apiFields = formFields.map(function (field) {\n var fieldState = fieldStates.find(function (fs) {\n return fs.id === field.id;\n });\n return {\n id: field.id,\n value: fieldState === undefined ? \"\" : fieldState.value,\n };\n });\n fieldUpdates = [];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, 7, 8]);\n result = void 0;\n generalError = void 0;\n fetchError = void 0;\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [\n 4 /*yield*/,\n props.callAPI(apiFields, function (id, value) {\n return fieldUpdates.push({ id: id, value: value });\n }),\n ];\n case 3:\n result = _a.sent();\n return [3 /*break*/, 5];\n case 4:\n e_1 = _a.sent();\n if (STGeneralError__default.default.isThisError(e_1)) {\n generalError = e_1;\n } else if (e_1 instanceof Response) {\n fetchError = e_1;\n } else {\n throw e_1;\n }\n return [3 /*break*/, 5];\n case 5:\n if (unmounting.current.signal.aborted) {\n return [2 /*return*/];\n }\n if (generalError !== undefined || (result !== undefined && result.status !== \"OK\")) {\n _loop_1 = function (field) {\n var update = fieldUpdates.find(function (f) {\n return f.id === field.id;\n });\n if (update || field.clearOnSubmit === true) {\n // We can do these one by one, it's almost never more than one field\n updateFieldState(field.id, function (os) {\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, os),\n { value: update ? update.value : \"\" }\n );\n });\n }\n };\n for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) {\n field = formFields_1[_i];\n _loop_1(field);\n }\n }\n if (generalError !== undefined) {\n props.onError(generalError.message);\n } else if (fetchError !== undefined) {\n if (props.onFetchError) {\n props.onFetchError(fetchError);\n } else {\n throw fetchError;\n }\n } else {\n // If successful\n if (result.status === \"OK\") {\n setIsLoading(false);\n props.clearError();\n if (props.onSuccess !== undefined) {\n props.onSuccess(result);\n }\n }\n if (unmounting.current.signal.aborted) {\n return [2 /*return*/];\n }\n // If field error.\n if (result.status === \"FIELD_ERROR\") {\n errorFields_1 = result.formFields;\n getErrorMessage_1 = function (fs) {\n var _a;\n var errorMessage =\n (_a = errorFields_1.find(function (ef) {\n return ef.id === fs.id;\n })) === null || _a === void 0\n ? void 0\n : _a.error;\n if (errorMessage === \"Field is not optional\") {\n var fieldConfigData = props.formFields.find(function (f) {\n return f.id === fs.id;\n });\n // replace non-optional server error message from nonOptionalErrorMsg\n if (\n (fieldConfigData === null || fieldConfigData === void 0\n ? void 0\n : fieldConfigData.nonOptionalErrorMsg) !== undefined\n ) {\n return fieldConfigData === null || fieldConfigData === void 0\n ? void 0\n : fieldConfigData.nonOptionalErrorMsg;\n }\n }\n return errorMessage;\n };\n setFieldStates(function (os) {\n return os.map(function (fs) {\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, fs),\n { error: getErrorMessage_1(fs) }\n );\n });\n });\n }\n }\n return [3 /*break*/, 8];\n case 6:\n _a.sent();\n props.onError(\"SOMETHING_WENT_WRONG_ERROR\");\n return [3 /*break*/, 8];\n case 7:\n setIsLoading(false);\n return [7 /*endfinally*/];\n case 8:\n return [2 /*return*/];\n }\n });\n });\n },\n [setIsLoading, setFieldStates, props, formFields, fieldStates]\n );\n return jsxRuntime.jsx(\n FormStateContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: fieldStates },\n {\n children: jsxRuntime.jsxs(\n \"form\",\n genericComponentOverrideContext.__assign(\n {\n autoComplete: \"on\",\n noValidate: true,\n onSubmit: onFormSubmit,\n \"data-supertokens\": props.formDataSupertokens,\n },\n {\n children: [\n formFields\n .filter(function (f) {\n return f.hidden !== true;\n })\n .map(function (field) {\n var type = \"text\";\n // If email or password, replace field type.\n if (constants.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) {\n type = field.id;\n }\n if (field.id === \"confirm-password\") {\n type = \"password\";\n }\n var fstate = fieldStates.find(function (s) {\n return s.id === field.id;\n }) || {\n id: field.id,\n value: fetchDefaultValue(field),\n };\n return jsxRuntime.jsx(\n FormRow,\n genericComponentOverrideContext.__assign(\n { hasError: fstate.error !== undefined },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n showLabels &&\n (field.labelComponent !== undefined\n ? field.labelComponent\n : jsxRuntime.jsx(Label, {\n value: field.label,\n showIsRequired: field.showIsRequired,\n })),\n jsxRuntime.jsx(InputComponentWrapper, {\n type: type,\n field: field,\n fstate: fstate,\n onInputFocus: onInputFocus,\n onInputBlur: onInputBlur,\n onInputChange: onInputChange,\n }),\n fstate.error &&\n jsxRuntime.jsx(InputError, { error: fstate.error }),\n ],\n }),\n }\n ),\n field.id\n );\n }),\n jsxRuntime.jsx(\n FormRow,\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n jsxRuntime.jsx(button.Button, {\n disabled: isLoading,\n isLoading: isLoading,\n type: \"submit\",\n label: buttonLabel,\n }),\n footer,\n ],\n }),\n },\n \"form-button\"\n ),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar FormStateContext = React__default.default.createContext(undefined);\nvar useFormFields = function () {\n var ctx = React.useContext(FormStateContext);\n if (ctx === undefined) {\n throw new Error(\"useFormState used outside FormBase\");\n }\n return ctx;\n};\n\nexports.ErrorIcon = ErrorIcon;\nexports.FormBase = FormBase;\nexports.FormRow = FormRow;\nexports.Label = Label;\nexports.useFormFields = useFormFields;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar componentOverrideContext = require(\"./emailpassword-shared2.js\");\nvar recipe = require(\"./emailpassword-shared3.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"supertokens-web-js/recipe/emailpassword\");\nrequire(\"./authRecipe-shared2.js\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./multifactorauth-shared.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./emailpassword-shared4.js\");\nrequire(\"./authRecipe-shared.js\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return recipe.EmailPassword.init(config);\n };\n Wrapper.signOut = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().signOut({\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n }),\n ];\n });\n });\n };\n Wrapper.submitNewPassword = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.submitNewPassword(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.sendPasswordResetEmail = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.sendPasswordResetEmail(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.signUp = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.signUp(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.signIn = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.signIn(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.doesEmailExist = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.doesEmailExist(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.getResetPasswordTokenFromURL = function (input) {\n return recipe.EmailPassword.getInstanceOrThrow().webJSRecipe.getResetPasswordTokenFromURL(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n );\n };\n Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar signOut = Wrapper.signOut;\nvar submitNewPassword = Wrapper.submitNewPassword;\nvar sendPasswordResetEmail = Wrapper.sendPasswordResetEmail;\nvar signUp = Wrapper.signUp;\nvar signIn = Wrapper.signIn;\nvar doesEmailExist = Wrapper.doesEmailExist;\nvar getResetPasswordTokenFromURL = Wrapper.getResetPasswordTokenFromURL;\nvar EmailPasswordComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider;\n\nexports.EmailPasswordComponentsOverrideProvider = EmailPasswordComponentsOverrideProvider;\nexports.default = Wrapper;\nexports.doesEmailExist = doesEmailExist;\nexports.getResetPasswordTokenFromURL = getResetPasswordTokenFromURL;\nexports.init = init;\nexports.sendPasswordResetEmail = sendPasswordResetEmail;\nexports.signIn = signIn;\nexports.signOut = signOut;\nexports.signUp = signUp;\nexports.submitNewPassword = submitNewPassword;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar uiEntry = require(\"./index2.js\");\nrequire(\"./multifactorauth.js\");\nvar componentOverrideContext = require(\"./emailpassword-shared2.js\");\nvar React = require(\"react\");\nvar translations = require(\"./emailverification-shared2.js\");\nvar translationContext = require(\"./translationContext.js\");\nvar arrowLeftIcon = require(\"./arrowLeftIcon.js\");\nvar formBase = require(\"./emailpassword-shared5.js\");\nvar STGeneralError = require(\"supertokens-web-js/utils/error\");\nvar button = require(\"./emailpassword-shared.js\");\nvar authCompWrapper = require(\"./authCompWrapper.js\");\nvar emailverification = require(\"./emailverification.js\");\nvar recipe$1 = require(\"./emailverification-shared.js\");\nvar session = require(\"./session.js\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar recipe = require(\"./emailpassword-shared3.js\");\nvar STGeneralError$1 = require(\"supertokens-web-js/lib/build/error\");\nvar constants = require(\"./emailpassword-shared4.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./multifactorauth-shared2.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\nrequire(\"./multifactorauth-shared3.js\");\nrequire(\"supertokens-web-js/recipe/emailverification\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./session-shared.js\");\nrequire(\"supertokens-web-js/recipe/emailpassword\");\nrequire(\"./authRecipe-shared2.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nfunction _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== \"default\") {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(\n n,\n k,\n d.get\n ? d\n : {\n enumerable: true,\n get: function () {\n return e[k];\n },\n }\n );\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n}\n\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar React__namespace = /*#__PURE__*/ _interopNamespace(React);\nvar STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError);\nvar STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1);\n\n/*\n * Component.\n */\nfunction BackToSignInButton(_a) {\n var onClick = _a.onClick;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"secondaryText secondaryLinkWithLeftArrow\", onClick: onClick },\n {\n children: [\n jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: \"rgb(var(--palette-secondaryText))\" }),\n t(\"EMAIL_PASSWORD_RESET_SIGN_IN_LINK\"),\n ],\n }\n )\n );\n}\n\nvar EmailPasswordResetPasswordEmail = function (props) {\n var t = translationContext.useTranslation();\n var userContext = uiEntry.useUserContext();\n var _a = React.useState(\"READY\"),\n status = _a[0],\n setStatus = _a[1];\n var _b = React.useState(\"\"),\n emailFieldValue = _b[0],\n setEmailFieldValue = _b[1];\n var onSuccess = function () {\n setStatus(\"SENT\");\n };\n var resend = function () {\n setStatus(\"READY\");\n };\n var formFields = props.formFields;\n var emailSuccessText =\n t(\"EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL\") +\n (emailFieldValue !== undefined && emailFieldValue.length > 0\n ? emailFieldValue\n : t(\"EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL\")) +\n t(\"EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL\");\n if (status === \"SENT\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"primaryText enterEmailSuccessMessage\" },\n {\n children: [\n emailSuccessText,\n jsxRuntime.jsx(\n \"span\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"link resendEmailLink\",\n onClick: resend,\n },\n { children: t(\"EMAIL_PASSWORD_RESET_RESEND_LINK\") }\n )\n ),\n ],\n }\n )\n ),\n jsxRuntime.jsx(BackToSignInButton, { onClick: props.onBackButtonClicked }),\n ],\n }\n )\n ),\n }\n )\n );\n }\n // Otherwise, return Form.\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container resetPasswordEmailForm\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle withBackButton\" },\n {\n children: [\n jsxRuntime.jsx(uiEntry.BackButton, {\n onClick: props.onBackButtonClicked,\n }),\n t(\"EMAIL_PASSWORD_RESET_HEADER_TITLE\"),\n jsxRuntime.jsx(\"span\", {\n \"data-supertokens\": \"backButtonPlaceholder backButtonCommon\",\n }),\n ],\n }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n { children: t(\"EMAIL_PASSWORD_RESET_HEADER_SUBTITLE\") }\n )\n ),\n props.error !== undefined &&\n jsxRuntime.jsx(uiEntry.GeneralError, { error: props.error }),\n jsxRuntime.jsx(formBase.FormBase, {\n clearError: props.clearError,\n onError: props.onError,\n formFields: formFields,\n buttonLabel: \"EMAIL_PASSWORD_RESET_SEND_BTN\",\n onSuccess: onSuccess,\n callAPI: function (formFields) {\n return genericComponentOverrideContext.__awaiter(\n void 0,\n void 0,\n void 0,\n function () {\n var validationErrors, emailField, resp;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.validateForm(\n formFields,\n props.config.resetPasswordUsingTokenFeature\n .enterEmailForm.formFields\n ),\n ];\n case 1:\n validationErrors = _a.sent();\n if (validationErrors.length > 0) {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: validationErrors,\n },\n ];\n }\n emailField = formFields.find(function (field) {\n return field.id === \"email\";\n });\n if (emailField !== undefined) {\n setEmailFieldValue(emailField.value);\n }\n return [\n 4 /*yield*/,\n props.recipeImplementation.sendPasswordResetEmail({\n formFields: formFields,\n userContext: userContext,\n }),\n ];\n case 2:\n resp = _a.sent();\n if (resp.status === \"PASSWORD_RESET_NOT_ALLOWED\") {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: [\n { id: \"email\", error: resp.reason },\n ],\n },\n ];\n }\n return [2 /*return*/, resp];\n }\n });\n }\n );\n },\n showLabels: true,\n validateOnBlur: true,\n }),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar ResetPasswordEmail = uiEntry.withOverride(\"EmailPasswordResetPasswordEmail\", EmailPasswordResetPasswordEmail);\n\nvar EmailPasswordSubmitNewPassword = function (props) {\n var t = translationContext.useTranslation();\n var userContext = uiEntry.useUserContext();\n var _a = React.useState(\"READY\"),\n status = _a[0],\n setStatus = _a[1];\n var onSuccess = function () {\n setStatus(\"SUCCESS\");\n };\n var formFields = props.formFields,\n onSignInClicked = props.onSignInClicked;\n if (status === \"SUCCESS\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle\" },\n { children: t(\"EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE\") }\n )\n ),\n jsxRuntime.jsx(\n formBase.FormRow,\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\":\n \"primaryText submitNewPasswordSuccessMessage\",\n },\n {\n children: t(\n \"EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC\"\n ),\n }\n )\n ),\n jsxRuntime.jsx(button.Button, {\n disabled: false,\n isLoading: false,\n type: \"button\",\n onClick: onSignInClicked,\n label: \"EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN\",\n }),\n ],\n }),\n },\n \"form-button\"\n ),\n ],\n }\n )\n ),\n }\n )\n );\n }\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container resetPasswordPasswordForm\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle\" },\n { children: t(\"EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n { children: t(\"EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE\") }\n )\n ),\n props.error !== undefined &&\n jsxRuntime.jsx(uiEntry.GeneralError, { error: props.error }),\n jsxRuntime.jsx(formBase.FormBase, {\n formFields: formFields,\n clearError: props.clearError,\n onError: props.onError,\n buttonLabel: \"EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN\",\n onSuccess: onSuccess,\n validateOnBlur: true,\n callAPI: function (fields) {\n return genericComponentOverrideContext.__awaiter(\n void 0,\n void 0,\n void 0,\n function () {\n var validationErrors, response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.validateForm(\n fields,\n props.config.resetPasswordUsingTokenFeature\n .submitNewPasswordForm.formFields\n ),\n ];\n case 1:\n validationErrors = _a.sent();\n if (validationErrors.length > 0) {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: validationErrors,\n },\n ];\n }\n // Verify that both passwords match.\n if (fields[0].value !== fields[1].value) {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: [\n {\n id: fields[1].id,\n error: \"ERROR_CONFIRM_PASSWORD_NO_MATCH\",\n },\n ],\n },\n ];\n }\n return [\n 4 /*yield*/,\n props.recipeImplementation.submitNewPassword({\n formFields: fields,\n userContext: userContext,\n }),\n ];\n case 2:\n response = _a.sent();\n if (\n response.status === \"RESET_PASSWORD_INVALID_TOKEN_ERROR\"\n ) {\n throw new STGeneralError__default.default(\n \"EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR\"\n );\n }\n return [\n 2 /*return*/,\n response.status === \"FIELD_ERROR\"\n ? response\n : {\n status: \"OK\",\n },\n ];\n }\n });\n }\n );\n },\n showLabels: true,\n }),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar SubmitNewPassword = uiEntry.withOverride(\"EmailPasswordSubmitNewPassword\", EmailPasswordSubmitNewPassword);\n\n/*\n * Component.\n */\nfunction ResetPasswordUsingTokenTheme(props) {\n /*\n * Render.\n */\n // If no token, return SubmitNewPassword.\n if (props.submitNewPasswordForm !== undefined) {\n return jsxRuntime.jsx(\n SubmitNewPassword,\n genericComponentOverrideContext.__assign({}, props.submitNewPasswordForm)\n );\n }\n // Otherwise, return EnterEmail.\n return jsxRuntime.jsx(ResetPasswordEmail, genericComponentOverrideContext.__assign({}, props.enterEmailForm));\n}\nfunction ResetPasswordUsingTokenThemeWrapper(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n var userStyles = props.submitNewPasswordForm\n ? props.config.resetPasswordUsingTokenFeature.submitNewPasswordForm.style\n : props.config.resetPasswordUsingTokenFeature.enterEmailForm.style;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n translations.ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, userStyles] },\n {\n children: jsxRuntime.jsx(\n ResetPasswordUsingTokenTheme,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n ),\n }\n )\n );\n}\n\nvar defaultTranslationsEmailPassword = {\n en: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, uiEntry.defaultTranslationsCommon.en),\n translations.defaultTranslationsEmailVerification.en\n ),\n {\n EMAIL_PASSWORD_EMAIL_LABEL: \"Email\",\n EMAIL_PASSWORD_EMAIL_PLACEHOLDER: \"Email address\",\n EMAIL_PASSWORD_PASSWORD_LABEL: \"Password\",\n EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: \"Password\",\n EMAIL_PASSWORD_SIGN_IN_FORGOT_PW_LINK: \"Forgot password?\",\n EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: \"SIGN IN\",\n EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: \"Incorrect email and password combination\",\n EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: \"SIGN UP\",\n EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: \"This email already exists. Please sign in instead\",\n EMAIL_PASSWORD_RESET_HEADER_TITLE: \"Reset your password\",\n EMAIL_PASSWORD_RESET_HEADER_SUBTITLE: \"We will send you an email to reset your password\",\n EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL: \"your account\",\n EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL: \"A password reset email has been sent to \",\n EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL: \", if it exists in our system. \",\n EMAIL_PASSWORD_RESET_RESEND_LINK: \"Resend or change email\",\n EMAIL_PASSWORD_RESET_SEND_BTN: \"Email me\",\n EMAIL_PASSWORD_RESET_SIGN_IN_LINK: \"Sign In\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE: \"Success!\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC: \"Your password has been updated successfully\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN: \"SIGN IN\",\n EMAIL_PASSWORD_NEW_PASSWORD_LABEL: \"New password\",\n EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER: \"New password\",\n EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL: \"Confirm password\",\n EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER: \"Confirm your password\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE: \"Change your password\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE: \"Enter a new password below to change your password\",\n EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN: \"CHANGE PASSWORD\",\n EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR: \"Invalid password reset token\",\n ERROR_EMAIL_NON_STRING: \"Email must be of type string\",\n ERROR_EMAIL_INVALID: \"Email is invalid\",\n ERROR_PASSWORD_NON_STRING: \"Password must be of type string\",\n ERROR_PASSWORD_TOO_SHORT: \"Password must contain at least 8 characters, including a number\",\n ERROR_PASSWORD_TOO_LONG: \"Password's length must be lesser than 100 characters\",\n ERROR_PASSWORD_NO_ALPHA: \"Password must contain at least one alphabet\",\n ERROR_PASSWORD_NO_NUM: \"Password must contain at least one number\",\n ERROR_CONFIRM_PASSWORD_NO_MATCH: \"Confirmation password doesn't match\",\n ERROR_NON_OPTIONAL: \"Field is not optional\",\n /*\n * The following are error messages from our backend SDK.\n * These are returned as full messages to preserver compatibilty, but they work just like the keys above.\n * They are shown as is by default (setting the value to undefined will display the raw translation key)\n */\n \"This email already exists. Please sign in instead.\": undefined,\n \"Field is not optional\": undefined,\n \"Password must contain at least 8 characters, including a number\": undefined,\n \"Password's length must be lesser than 100 characters\": undefined,\n \"Password must contain at least one alphabet\": undefined,\n \"Password must contain at least one number\": undefined,\n \"Email is invalid\": undefined,\n \"Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)\":\n undefined,\n \"Cannot sign up due to security reasons. Please try logging in, use a different login method or contact support. (ERR_CODE_007)\":\n undefined,\n \"Cannot sign in due to security reasons. Please try resetting your password, use a different login method or contact support. (ERR_CODE_008)\":\n undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_009)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_010)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_011)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_012)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_013)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_014)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_015)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_016)\": undefined,\n }\n ),\n};\n\nvar ResetPasswordUsingToken$1 = function (props) {\n var token = genericComponentOverrideContext.getQueryParams(\"token\");\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var _a = React__namespace.useState(),\n error = _a[0],\n setError = _a[1];\n var enterEmailFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm;\n var submitNewPasswordFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm;\n var submitNewPasswordForm =\n token === undefined || token === null\n ? undefined\n : {\n error: error,\n onError: function (error) {\n return setError(error);\n },\n clearError: function () {\n return setError(undefined);\n },\n styleFromInit: submitNewPasswordFormFeature.style,\n formFields: submitNewPasswordFormFeature.formFields,\n recipeImplementation: props.recipe.webJSRecipe,\n config: props.recipe.config,\n onSignInClicked: function () {\n void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n show: \"signin\",\n navigate: props.navigate,\n redirectBack: false,\n userContext: userContext,\n });\n },\n token: token,\n };\n var enterEmailForm = {\n onBackButtonClicked: function () {\n return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n show: \"signin\",\n navigate: props.navigate,\n redirectBack: false,\n userContext: userContext,\n });\n },\n error: error,\n onError: function (error) {\n return setError(error);\n },\n clearError: function () {\n return setError(undefined);\n },\n styleFromInit: enterEmailFormFeature.style,\n formFields: enterEmailFormFeature.formFields,\n recipeImplementation: props.recipe.webJSRecipe,\n config: props.recipe.config,\n };\n var childProps = {\n config: props.recipe.config,\n submitNewPasswordForm: submitNewPasswordForm,\n enterEmailForm: enterEmailForm,\n };\n var recipeComponentOverrides = props.useComponentOverrides();\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: defaultTranslationsEmailPassword,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n ResetPasswordUsingTokenThemeWrapper,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n ),\n }\n )\n );\n};\n\nvar SignInForm = uiEntry.withOverride(\"EmailPasswordSignInForm\", function EmailPasswordSignInForm(props) {\n var _this = this;\n var userContext = uiEntry.useUserContext();\n return jsxRuntime.jsx(formBase.FormBase, {\n formFields: props.formFields,\n clearError: props.clearError,\n onError: props.onError,\n onFetchError: props.onFetchError,\n buttonLabel: \"EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN\",\n onSuccess: props.onSuccess,\n callAPI: function (formFields) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var validationErrors, response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.validateForm(\n formFields,\n props.config.signInAndUpFeature.signInForm.formFields\n ),\n ];\n case 1:\n validationErrors = _a.sent();\n if (validationErrors.length > 0) {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: validationErrors,\n },\n ];\n }\n return [\n 4 /*yield*/,\n props.recipeImplementation.signIn({\n formFields: formFields,\n shouldTryLinkingWithSessionUser: false,\n userContext: userContext,\n }),\n ];\n case 2:\n response = _a.sent();\n if (response.status === \"WRONG_CREDENTIALS_ERROR\") {\n throw new STGeneralError__default.default(\n \"EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR\"\n );\n } else if (response.status === \"SIGN_IN_NOT_ALLOWED\") {\n throw new STGeneralError__default.default(response.reason);\n } else {\n return [2 /*return*/, response];\n }\n }\n });\n });\n },\n validateOnBlur: false,\n showLabels: true,\n footer: props.footer,\n });\n});\nfunction SignInTheme(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n var activeStyle = props.config.signInAndUpFeature.signInForm.style;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n translations.ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, activeStyle] },\n { children: jsxRuntime.jsx(SignInForm, genericComponentOverrideContext.__assign({}, props)) }\n )\n ),\n }\n )\n );\n}\n\nfunction useChildProps$1(recipe$2, onAuthSuccess, error, onError, clearError, userContext, navigate) {\n var _this = this;\n var session$1 = uiEntry.useSessionContext();\n var recipeImplementation = React.useMemo(\n function () {\n return getModifiedRecipeImplementation$1(recipe$2.webJSRecipe);\n },\n [recipe$2]\n );\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var t = translationContext.useTranslation();\n var onSignInSuccess = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 1:\n payloadAfterCall = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _b.sent();\n payloadAfterCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [\n 2 /*return*/,\n onAuthSuccess({\n createdNewUser: false,\n isNewRecipeUser: false,\n newSessionCreated:\n session$1.loading ||\n !session$1.doesSessionExist ||\n (payloadAfterCall !== undefined &&\n session$1.accessTokenPayload.sessionHandle !==\n payloadAfterCall.sessionHandle),\n recipeId: recipe.EmailPassword.RECIPE_ID,\n }).catch(rethrowInRender),\n ];\n }\n });\n });\n },\n [recipe$2, userContext, navigate]\n );\n return React.useMemo(\n function () {\n var onForgotPasswordClick = function () {\n return recipe$2.redirect(\n {\n action: \"RESET_PASSWORD\",\n tenantIdFromQueryParams: genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n navigate,\n undefined,\n userContext\n );\n };\n var signInAndUpFeature = recipe$2.config.signInAndUpFeature;\n var signInFeature = signInAndUpFeature.signInForm;\n var formFields = signInFeature.formFields.map(function (f) {\n return f.id !== \"password\"\n ? f\n : genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, f), {\n labelComponent: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"formLabelWithLinkWrapper\" },\n {\n children: [\n jsxRuntime.jsx(formBase.Label, {\n value: f.label,\n \"data-supertokens\": \"passwordInputLabel\",\n }),\n jsxRuntime.jsx(\n \"a\",\n genericComponentOverrideContext.__assign(\n {\n onClick: onForgotPasswordClick,\n \"data-supertokens\":\n \"link linkButton formLabelLinkBtn forgotPasswordLink\",\n },\n { children: t(\"EMAIL_PASSWORD_SIGN_IN_FORGOT_PW_LINK\") }\n )\n ),\n ],\n }\n )\n ),\n });\n });\n return {\n recipeImplementation: recipeImplementation,\n config: recipe$2.config,\n styleFromInit: signInFeature.style,\n formFields: formFields,\n error: error,\n clearError: clearError,\n onError: onError,\n onFetchError: function (err) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var invalidClaims, evInstance;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (\n !(\n err.status ===\n types.Session.getInstanceOrThrow().config.invalidClaimStatusCode\n )\n )\n return [3 /*break*/, 5];\n return [\n 4 /*yield*/,\n session.getInvalidClaimsFromResponse({\n response: err,\n userContext: userContext,\n }),\n ];\n case 1:\n invalidClaims = _b.sent();\n if (\n !invalidClaims.some(function (i) {\n return i.id === emailverification.EmailVerificationClaim.id;\n })\n )\n return [3 /*break*/, 5];\n _b.label = 2;\n case 2:\n _b.trys.push([2, 4, , 5]);\n evInstance = recipe$1.EmailVerification.getInstanceOrThrow();\n return [\n 4 /*yield*/,\n evInstance.redirect(\n {\n action: \"VERIFY_EMAIL\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n navigate,\n undefined,\n userContext\n ),\n ];\n case 3:\n _b.sent();\n return [2 /*return*/];\n case 4:\n _b.sent();\n return [3 /*break*/, 5];\n case 5:\n onError(\"SOMETHING_WENT_WRONG_ERROR\");\n return [2 /*return*/];\n }\n });\n });\n },\n onSuccess: onSignInSuccess,\n onForgotPasswordClick: onForgotPasswordClick,\n userContext: userContext,\n };\n },\n [recipe$2, error, userContext]\n );\n}\nvar SignInFeature = function (props) {\n var childProps = useChildProps$1(\n props.recipe,\n props.onAuthSuccess,\n props.error,\n props.onError,\n props.clearError,\n props.userContext,\n props.navigate\n );\n var recipeComponentOverrides = props.useComponentOverrides();\n return jsxRuntime.jsx(\n authCompWrapper.AuthComponentWrapper,\n genericComponentOverrideContext.__assign(\n { recipeComponentOverrides: recipeComponentOverrides },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(SignInTheme, genericComponentOverrideContext.__assign({}, childProps)),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(\n child,\n genericComponentOverrideContext.__assign({}, childProps)\n );\n }\n return child;\n }),\n ],\n }),\n }\n )\n );\n};\nvar getModifiedRecipeImplementation$1 = function (origImpl) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, origImpl), {\n signIn: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n origImpl.signIn(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n { shouldTryLinkingWithSessionUser: false }\n )\n ),\n ];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n },\n signUp: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n origImpl.signUp(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n { shouldTryLinkingWithSessionUser: false }\n )\n ),\n ];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n },\n });\n};\n\nvar SignUpForm = uiEntry.withOverride(\"EmailPasswordSignUpForm\", function EmailPasswordSignUpForm(props) {\n var _this = this;\n var userContext = uiEntry.useUserContext();\n return jsxRuntime.jsx(formBase.FormBase, {\n formFields: props.formFields,\n clearError: props.clearError,\n onError: props.onError,\n onFetchError: props.onFetchError,\n buttonLabel: \"EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN\",\n onSuccess: props.onSuccess,\n callAPI: function (formFields) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var validationErrors, res;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.validateForm(\n formFields,\n props.config.signInAndUpFeature.signUpForm.formFields\n ),\n ];\n case 1:\n validationErrors = _a.sent();\n if (validationErrors.length > 0) {\n return [\n 2 /*return*/,\n {\n status: \"FIELD_ERROR\",\n formFields: validationErrors,\n },\n ];\n }\n return [\n 4 /*yield*/,\n props.recipeImplementation.signUp({\n formFields: formFields,\n shouldTryLinkingWithSessionUser: false,\n userContext: userContext,\n }),\n ];\n case 2:\n res = _a.sent();\n if (res.status === \"SIGN_UP_NOT_ALLOWED\") {\n throw new STGeneralError__default$1.default(res.reason);\n }\n return [2 /*return*/, res];\n }\n });\n });\n },\n validateOnBlur: true,\n showLabels: true,\n footer: props.footer,\n });\n});\nfunction SignUpTheme(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n var activeStyle = props.config.signInAndUpFeature.signUpForm.style;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n translations.ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, activeStyle] },\n { children: jsxRuntime.jsx(SignUpForm, genericComponentOverrideContext.__assign({}, props)) }\n )\n ),\n }\n )\n );\n}\n\nfunction useChildProps(recipe, onAuthSuccess, error, onError, clearError, userContext, navigate) {\n var _this = this;\n var session$1 = uiEntry.useSessionContext();\n var recipeImplementation = React.useMemo(\n function () {\n return recipe && getModifiedRecipeImplementation(recipe.webJSRecipe);\n },\n [recipe]\n );\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var onSignUpSuccess = React.useCallback(\n function (result) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 1:\n payloadAfterCall = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _b.sent();\n payloadAfterCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [\n 2 /*return*/,\n onAuthSuccess({\n createdNewUser: result.user.loginMethods.length === 1,\n isNewRecipeUser: true,\n newSessionCreated:\n session$1.loading ||\n !session$1.doesSessionExist ||\n (payloadAfterCall !== undefined &&\n session$1.accessTokenPayload.sessionHandle !==\n payloadAfterCall.sessionHandle),\n recipeId: recipe.recipeID,\n }).catch(rethrowInRender),\n ];\n }\n });\n });\n },\n [recipe, userContext, navigate]\n );\n return React.useMemo(\n function () {\n var signInAndUpFeature = recipe.config.signInAndUpFeature;\n var signUpFeature = signInAndUpFeature.signUpForm;\n return {\n recipeImplementation: recipeImplementation,\n config: recipe.config,\n styleFromInit: signUpFeature.style,\n formFields: getThemeSignUpFeatureFormFields(signUpFeature.formFields, recipe, userContext),\n onFetchError: function (err) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var invalidClaims, evInstance;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (\n !(\n err.status ===\n types.Session.getInstanceOrThrow().config.invalidClaimStatusCode\n )\n )\n return [3 /*break*/, 5];\n return [\n 4 /*yield*/,\n session.getInvalidClaimsFromResponse({\n response: err,\n userContext: userContext,\n }),\n ];\n case 1:\n invalidClaims = _b.sent();\n if (\n !invalidClaims.some(function (i) {\n return i.id === emailverification.EmailVerificationClaim.id;\n })\n )\n return [3 /*break*/, 5];\n _b.label = 2;\n case 2:\n _b.trys.push([2, 4, , 5]);\n evInstance = recipe$1.EmailVerification.getInstanceOrThrow();\n return [\n 4 /*yield*/,\n evInstance.redirect(\n {\n action: \"VERIFY_EMAIL\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n navigate,\n undefined,\n userContext\n ),\n ];\n case 3:\n _b.sent();\n return [2 /*return*/];\n case 4:\n _b.sent();\n return [3 /*break*/, 5];\n case 5:\n onError(\"SOMETHING_WENT_WRONG_ERROR\");\n return [2 /*return*/];\n }\n });\n });\n },\n onSuccess: onSignUpSuccess,\n userContext: userContext,\n error: error,\n onError: onError,\n clearError: clearError,\n };\n },\n [recipe, error, userContext]\n );\n}\nvar SignUpFeature = function (props) {\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var childProps = useChildProps(\n props.recipe,\n props.onAuthSuccess,\n props.error,\n props.onError,\n props.clearError,\n userContext,\n props.navigate\n );\n var recipeComponentOverrides = props.useComponentOverrides();\n return jsxRuntime.jsx(\n authCompWrapper.AuthComponentWrapper,\n genericComponentOverrideContext.__assign(\n { recipeComponentOverrides: recipeComponentOverrides },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(SignUpTheme, genericComponentOverrideContext.__assign({}, childProps)),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(\n child,\n genericComponentOverrideContext.__assign({}, childProps)\n );\n }\n return child;\n }),\n ],\n }),\n }\n )\n );\n};\nvar getModifiedRecipeImplementation = function (origImpl) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, origImpl), {\n signIn: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n origImpl.signIn(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n { shouldTryLinkingWithSessionUser: false }\n )\n ),\n ];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n },\n signUp: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n origImpl.signUp(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n { shouldTryLinkingWithSessionUser: false }\n )\n ),\n ];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n },\n });\n};\nfunction getThemeSignUpFeatureFormFields(formFields, recipe, userContext) {\n var _this = this;\n var emailPasswordOnly = formFields.length === 2;\n return formFields.map(function (field) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), {\n showIsRequired: (function () {\n // If email and password only, do not show required indicator (*).\n if (emailPasswordOnly) {\n return false;\n }\n // Otherwise, show for all non optional fields (including email and password).\n return field.optional === false;\n })(),\n validate: (function () {\n // If field is not email, return field validate unchanged.\n if (field.id !== \"email\") {\n return field.validate;\n }\n // Otherwise, if email, use syntax validate method and check if email exists.\n return function (value) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var error, emailExists, err_1;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, field.validate(value)];\n case 1:\n error = _a.sent();\n if (error !== undefined) {\n return [2 /*return*/, error];\n }\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"GENERAL_ERROR_EMAIL_NON_STRING\"];\n }\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [\n 4 /*yield*/,\n recipe.webJSRecipe.doesEmailExist({\n email: value,\n userContext: userContext,\n }),\n ];\n case 3:\n emailExists = _a.sent().doesExist;\n if (emailExists) {\n return [2 /*return*/, \"EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS\"];\n }\n return [3 /*break*/, 5];\n case 4:\n err_1 = _a.sent();\n if (STGeneralError__default.default.isThisError(err_1)) {\n return [2 /*return*/, err_1.message];\n }\n return [3 /*break*/, 5];\n case 5:\n return [2 /*return*/, undefined];\n }\n });\n });\n };\n })(),\n });\n });\n}\n\nvar EmailPasswordPreBuiltUI = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(EmailPasswordPreBuiltUI, _super);\n function EmailPasswordPreBuiltUI(recipeInstance) {\n var _this = _super.call(this) || this;\n _this.recipeInstance = recipeInstance;\n _this.languageTranslations = defaultTranslationsEmailPassword;\n // Instance methods\n _this.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n var features = {};\n if (_this.recipeInstance.config.resetPasswordUsingTokenFeature.disableDefaultUI !== true) {\n var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath(\n new NormalisedURLPath__default.default(constants.DEFAULT_RESET_PASSWORD_PATH)\n );\n features[normalisedFullPath.getAsStringDangerous()] = {\n matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams(\n _this.recipeInstance.config.recipeId\n ),\n component: function (props) {\n return _this.getFeatureComponent(\"resetpassword\", props, useComponentOverrides);\n },\n recipeID: recipe.EmailPassword.RECIPE_ID,\n };\n }\n return features;\n };\n _this.getFeatureComponent = function (componentName, props, useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n if (componentName === \"resetpassword\") {\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n ResetPasswordUsingToken$1,\n genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, {\n useComponentOverrides: useComponentOverrides,\n })\n ),\n }\n )\n );\n } else {\n throw new Error(\"Should never come here.\");\n }\n };\n _this.requiresSignUpPage = true;\n return _this;\n }\n // Static methods\n EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () {\n if (EmailPasswordPreBuiltUI.instance === undefined) {\n var recipeInstance = recipe.EmailPassword.getInstanceOrThrow();\n EmailPasswordPreBuiltUI.instance = new EmailPasswordPreBuiltUI(recipeInstance);\n }\n return EmailPasswordPreBuiltUI.instance;\n };\n EmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides);\n };\n EmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n componentName,\n props,\n useComponentOverrides\n );\n };\n EmailPasswordPreBuiltUI.prototype.getAuthComponents = function () {\n var _this = this;\n return [\n {\n factorIds: [types.FactorIds.EMAILPASSWORD],\n displayOrder: 2,\n type: \"SIGN_UP\",\n component: function (props) {\n return jsxRuntime.jsx(\n SignUpFeature,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: componentOverrideContext.useContext,\n },\n props\n ),\n \"emailpassword-sign-up\"\n );\n },\n },\n {\n factorIds: [types.FactorIds.EMAILPASSWORD],\n displayOrder: 2,\n type: \"SIGN_IN\",\n component: function (props) {\n return jsxRuntime.jsx(\n SignInFeature,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: componentOverrideContext.useContext,\n },\n props\n ),\n \"emailpassword-sign-in\"\n );\n },\n },\n ];\n };\n // For tests\n EmailPasswordPreBuiltUI.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n EmailPasswordPreBuiltUI.instance = undefined;\n return;\n };\n EmailPasswordPreBuiltUI.ResetPasswordUsingToken = function (prop) {\n return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\"resetpassword\", prop);\n };\n EmailPasswordPreBuiltUI.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper;\n return EmailPasswordPreBuiltUI;\n})(uiEntry.RecipeRouter);\nvar ResetPasswordUsingToken = EmailPasswordPreBuiltUI.ResetPasswordUsingToken;\n\nexports.EmailPasswordPreBuiltUI = EmailPasswordPreBuiltUI;\nexports.ResetPasswordUsingToken = ResetPasswordUsingToken;\nexports.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar EmailVerificationWebJS = require(\"supertokens-web-js/recipe/emailverification\");\nvar postSuperTokensInitCallbacks = require(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nvar sessionClaimValidatorStore = require(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nvar index = require(\"./recipeModule-shared.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar EmailVerificationWebJS__default = /*#__PURE__*/ _interopDefault(EmailVerificationWebJS);\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar DEFAULT_VERIFY_EMAIL_PATH = \"/verify-email\";\n\nvar EmailVerificationClaimClass = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(EmailVerificationClaimClass, _super);\n function EmailVerificationClaimClass(getRecipeImpl, onFailureRedirection) {\n var _this = _super.call(this, getRecipeImpl) || this;\n var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators);\n var _loop_1 = function (key) {\n var validator = validatorsWithCallbacks[key];\n validatorsWithCallbacks[key] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)),\n {\n onFailureRedirection: function (args) {\n if (onFailureRedirection !== undefined) {\n return onFailureRedirection(args);\n }\n var recipe = EmailVerification.getInstanceOrThrow();\n if (recipe.config.mode === \"REQUIRED\") {\n return recipe.getRedirectUrl(\n {\n action: \"VERIFY_EMAIL\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n args.userContext\n );\n }\n return undefined;\n },\n showAccessDeniedOnFailure: false,\n }\n );\n };\n };\n for (var key in validatorsWithCallbacks) {\n _loop_1(key);\n }\n _this.validators = validatorsWithCallbacks;\n return _this;\n }\n return EmailVerificationClaimClass;\n})(EmailVerificationWebJS.EmailVerificationClaimClass);\n\nvar getFunctionOverrides = function (onHandleEvent) {\n return function (originalImp) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), {\n verifyEmail: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.verifyEmail(input)];\n case 1:\n response = _a.sent();\n if (response.status === \"OK\") {\n onHandleEvent({\n action: \"EMAIL_VERIFIED_SUCCESSFUL\",\n userContext: input.userContext,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n sendVerificationEmail: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.sendVerificationEmail(input)];\n case 1:\n response = _a.sent();\n if (response.status === \"OK\") {\n onHandleEvent({\n action: \"VERIFY_EMAIL_SENT\",\n userContext: input.userContext,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n });\n };\n};\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normaliseEmailVerificationFeature(config) {\n if (config === undefined) {\n config = {};\n }\n var disableDefaultUI = config.disableDefaultUI === true;\n var mode = config.mode === undefined ? \"REQUIRED\" : config.mode;\n var sendVerifyEmailScreenStyle =\n config.sendVerifyEmailScreen !== undefined && config.sendVerifyEmailScreen.style !== undefined\n ? config.sendVerifyEmailScreen.style\n : \"\";\n var sendVerifyEmailScreen = {\n style: sendVerifyEmailScreenStyle,\n };\n var verifyEmailLinkClickedScreenStyle =\n config.verifyEmailLinkClickedScreen !== undefined && config.verifyEmailLinkClickedScreen.style !== undefined\n ? config.verifyEmailLinkClickedScreen.style\n : \"\";\n var verifyEmailLinkClickedScreen = {\n style: verifyEmailLinkClickedScreenStyle,\n };\n var override = genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config.override\n );\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n {},\n genericComponentOverrideContext.normaliseRecipeModuleConfig(config)\n ),\n {\n disableDefaultUI: disableDefaultUI,\n mode: mode,\n sendVerifyEmailScreen: sendVerifyEmailScreen,\n verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,\n override: override,\n }\n );\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar EmailVerification = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(EmailVerification, _super);\n function EmailVerification(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = EmailVerificationWebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = EmailVerification.RECIPE_ID;\n _this.getDefaultRedirectionURL = function (context) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (context.action === \"VERIFY_EMAIL\") {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.getDefaultRedirectionURLForPath(\n this.config,\n DEFAULT_VERIFY_EMAIL_PATH,\n context\n ),\n ];\n } else {\n return [2 /*return*/, \"/\"];\n }\n });\n });\n };\n postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () {\n var isVerifiedValidator = EmailVerification.EmailVerificationClaim.validators.isVerified(10);\n sessionClaimValidatorStore.SessionClaimValidatorStore.addClaimValidatorFromOtherRecipe(isVerifiedValidator);\n });\n return _this;\n }\n EmailVerification.init = function (config) {\n var normalisedConfig = normaliseEmailVerificationFeature(config);\n return {\n recipeID: EmailVerification.RECIPE_ID,\n authReact: function (appInfo) {\n EmailVerification.instance = new EmailVerification(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: EmailVerification.RECIPE_ID }\n )\n );\n return EmailVerification.instance;\n },\n webJS: EmailVerificationWebJS__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n override: {\n functions: function (originalImpl, builder) {\n var functions = getFunctionOverrides(normalisedConfig.onHandleEvent);\n builder.override(functions);\n builder.override(normalisedConfig.override.functions);\n return originalImpl;\n },\n },\n }\n )\n ),\n };\n };\n EmailVerification.getInstanceOrThrow = function () {\n if (EmailVerification.instance === undefined) {\n var error = \"No instance of EmailVerification found. Make sure to call the EmailVerification.init method.\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + genericComponentOverrideContext.SSR_ERROR;\n }\n throw Error(error);\n }\n return EmailVerification.instance;\n };\n EmailVerification.prototype.isEmailVerified = function (userContext) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n this.webJSRecipe.isEmailVerified({\n userContext: userContext,\n }),\n ];\n case 1:\n return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n EmailVerification.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n EmailVerification.instance = undefined;\n return;\n };\n EmailVerification.RECIPE_ID = \"emailverification\";\n EmailVerification.EmailVerificationClaim = new EmailVerificationClaimClass(function () {\n return EmailVerification.getInstanceOrThrow().webJSRecipe;\n });\n return EmailVerification;\n})(index.RecipeModule);\n\nexports.DEFAULT_VERIFY_EMAIL_PATH = DEFAULT_VERIFY_EMAIL_PATH;\nexports.EmailVerification = EmailVerification;\nexports.Provider = Provider;\nexports.useContext = useContext;\n","\"use strict\";\n\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar React = require(\"react\");\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar uiEntry = require(\"./index2.js\");\n\nvar styles =\n '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\\n *\\n * This software is licensed under the Apache License, Version 2.0 (the\\n * \"License\") as published by the Apache Software Foundation.\\n *\\n * You may not use this file except in compliance with the License. You may\\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\\n * License for the specific language governing permissions and limitations\\n * under the License.\\n */\\n\\n[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n\\n/*\\n * Default styles.\\n */\\n\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n\\n/* TODO: split the link style into separate things*/\\n\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"inputContainer\"] {\\n margin-top: 6px;\\n}\\n\\n[data-supertokens~=\"inputWrapper\"] {\\n box-sizing: border-box;\\n width: 100%;\\n display: flex;\\n align-items: center;\\n background-color: rgb(var(--palette-inputBackground));\\n height: 34px;\\n border-radius: 6px;\\n border: 1px solid rgb(var(--palette-inputBorder));\\n}\\n\\n[data-supertokens~=\"inputWrapper\"][focus-within] {\\n background-color: rgba(var(--palette-inputBackground), 0.25);\\n border: 1px solid rgb(var(--palette-primary));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputWrapper\"]:focus-within {\\n background-color: rgba(var(--palette-inputBackground), 0.25);\\n border: 1px solid rgb(var(--palette-primary));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"] {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"][focus-within] {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"]:focus-within {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"input\"] {\\n box-sizing: border-box;\\n padding-left: 15px;\\n filter: none;\\n color: rgb(var(--palette-textInput));\\n background-color: transparent;\\n border-radius: 6px;\\n font-size: var(--font-size-1);\\n border: none;\\n padding-right: 25px;\\n letter-spacing: 1.2px;\\n flex: 9 1 75%;\\n width: 75%;\\n height: 32px;\\n}\\n\\n[data-supertokens~=\"input\"]:focus {\\n border: none;\\n outline: none;\\n}\\n\\n[data-supertokens~=\"input\"]:-webkit-autofill,\\n[data-supertokens~=\"input\"]:-webkit-autofill:hover,\\n[data-supertokens~=\"input\"]:-webkit-autofill:focus,\\n[data-supertokens~=\"input\"]:-webkit-autofill:active {\\n -webkit-text-fill-color: rgb(var(--palette-textInput));\\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\\n}\\n\\n[data-supertokens~=\"inputAdornment\"] {\\n justify-content: center;\\n margin-right: 5px;\\n}\\n\\n[data-supertokens~=\"showPassword\"] {\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"enterEmailSuccessMessage\"] {\\n margin-top: 15px;\\n margin-bottom: 15px;\\n word-break: break-word;\\n}\\n\\n[data-supertokens~=\"submitNewPasswordSuccessMessage\"] {\\n margin-top: 15px;\\n margin-bottom: 15px;\\n}\\n\\n[data-supertokens~=\"inputErrorMessage\"] {\\n padding-top: 5px;\\n padding-bottom: 5px;\\n color: rgb(var(--palette-error));\\n line-height: 24px;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n text-align: left;\\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\\n max-width: 330px;\\n}\\n\\n@media (max-width: 440px) {\\n [data-supertokens~=\"inputErrorMessage\"] {\\n max-width: 250px;\\n }\\n}\\n\\n[data-supertokens~=\"inputErrorSymbol\"] {\\n margin-right: 5px;\\n top: 1px;\\n position: relative;\\n left: 2px;\\n}\\n\\n[data-supertokens~=\"label\"] {\\n text-align: left;\\n font-weight: 700;\\n font-size: var(--font-size-0);\\n line-height: 24px;\\n color: rgb(var(--palette-textLabel));\\n}\\n\\n[data-supertokens~=\"formRow\"] {\\n display: flex;\\n flex-direction: column;\\n padding-top: 0px;\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"formRow\"][data-supertokens~=\"hasError\"] {\\n padding-bottom: 0;\\n}\\n\\n[data-supertokens~=\"formRow\"]:last-child {\\n padding-bottom: 0;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailIcon\"] {\\n margin-top: 11px;\\n}\\n\\n[data-supertokens~=\"primaryText\"][data-supertokens~=\"sendVerifyEmailText\"] {\\n text-align: center;\\n letter-spacing: 0.8px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n font-weight: 700;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailResend\"] {\\n margin-top: 13px;\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailResend\"]:hover {\\n text-decoration: underline;\\n}\\n\\n[data-supertokens~=\"noFormRow\"] {\\n padding-bottom: 25px;\\n}\\n\\n[data-supertokens~=\"emailVerificationButtonWrapper\"] {\\n padding-top: 25px;\\n max-width: 96px;\\n margin: 0 auto;\\n}\\n\\n[data-supertokens~=\"resendEmailLink\"] {\\n display: inline-block;\\n}\\n\\n[data-supertokens~=\"resetPasswordEmailForm\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"resetPasswordPasswordForm\"] {\\n padding-bottom: 20px;\\n}\\n';\n\nvar ThemeBase = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles, userStyles.join(\"\\n\")] })],\n });\n};\n\nvar defaultTranslationsEmailVerification = {\n en: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, uiEntry.defaultTranslationsCommon.en),\n {\n EMAIL_VERIFICATION_RESEND_SUCCESS: \"Email resent\",\n EMAIL_VERIFICATION_SEND_TITLE: \"Verify your email!\",\n EMAIL_VERIFICATION_SEND_DESC_START: \"\",\n EMAIL_VERIFICATION_SEND_DESC_STRONG: \"Please click on the link\",\n EMAIL_VERIFICATION_SEND_DESC_END: \" in the email we just sent you to confirm your email address.\",\n EMAIL_VERIFICATION_RESEND_BTN: \"Resend Email\",\n EMAIL_VERIFICATION_LOGOUT: \"Logout \",\n EMAIL_VERIFICATION_SUCCESS: \"Email verification successful!\",\n EMAIL_VERIFICATION_CONTINUE_BTN: \"CONTINUE\",\n EMAIL_VERIFICATION_CONTINUE_LINK: \"Continue\",\n EMAIL_VERIFICATION_EXPIRED: \"The email verification link has expired\",\n EMAIL_VERIFICATION_ERROR_TITLE: \"Something went wrong\",\n EMAIL_VERIFICATION_ERROR_DESC: \"We encountered an unexpected error. Please contact support for assistance\",\n EMAIL_VERIFICATION_LINK_CLICKED_HEADER: \"Verify your email address\",\n EMAIL_VERIFICATION_LINK_CLICKED_DESC: \"Please click on the button below to verify your email address\",\n EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: \"CONTINUE\",\n }\n ),\n};\n\nexports.ThemeBase = ThemeBase;\nexports.defaultTranslationsEmailVerification = defaultTranslationsEmailVerification;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar recipe = require(\"./emailverification-shared.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"supertokens-web-js/recipe/emailverification\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return recipe.EmailVerification.init(config);\n };\n Wrapper.isEmailVerified = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailVerification.getInstanceOrThrow().webJSRecipe.isEmailVerified(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.verifyEmail = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailVerification.getInstanceOrThrow().webJSRecipe.verifyEmail(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.sendVerificationEmail = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.EmailVerification.getInstanceOrThrow().webJSRecipe.sendVerificationEmail(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.getEmailVerificationTokenFromURL = function (input) {\n return recipe.EmailVerification.getInstanceOrThrow().webJSRecipe.getEmailVerificationTokenFromURL(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n );\n };\n Wrapper.EmailVerificationClaim = recipe.EmailVerification.EmailVerificationClaim;\n Wrapper.ComponentsOverrideProvider = recipe.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar isEmailVerified = Wrapper.isEmailVerified;\nvar verifyEmail = Wrapper.verifyEmail;\nvar sendVerificationEmail = Wrapper.sendVerificationEmail;\nvar getEmailVerificationTokenFromURL = Wrapper.getEmailVerificationTokenFromURL;\nvar EmailVerificationComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider;\nvar EmailVerificationClaim = recipe.EmailVerification.EmailVerificationClaim;\n\nexports.EmailVerificationClaim = EmailVerificationClaim;\nexports.EmailVerificationComponentsOverrideProvider = EmailVerificationComponentsOverrideProvider;\nexports.default = Wrapper;\nexports.getEmailVerificationTokenFromURL = getEmailVerificationTokenFromURL;\nexports.init = init;\nexports.isEmailVerified = isEmailVerified;\nexports.sendVerificationEmail = sendVerificationEmail;\nexports.verifyEmail = verifyEmail;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar uiEntry = require(\"./index2.js\");\nvar session = require(\"./session.js\");\nvar recipe = require(\"./emailverification-shared.js\");\nvar React = require(\"react\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar translations = require(\"./emailverification-shared2.js\");\nvar STGeneralError = require(\"supertokens-web-js/utils/error\");\nvar emailLargeIcon = require(\"./emailLargeIcon.js\");\nvar translationContext = require(\"./translationContext.js\");\nvar button = require(\"./emailpassword-shared.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./multifactorauth-shared2.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./session-shared.js\");\nrequire(\"supertokens-web-js/recipe/emailverification\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nfunction _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== \"default\") {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(\n n,\n k,\n d.get\n ? d\n : {\n enumerable: true,\n get: function () {\n return e[k];\n },\n }\n );\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n}\n\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar React__namespace = /*#__PURE__*/ _interopNamespace(React);\nvar STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError);\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction ArrowRightIcon(_a) {\n var color = _a.color;\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"6\", height: \"8\", viewBox: \"0 0 6 8\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: jsxRuntime.jsx(\"path\", {\n d: \"M5.62713 3.24407C6.08759 3.64284 6.08759 4.35716 5.62713 4.75593L2.15465 7.76318C1.50701 8.32406 0.5 7.864 0.5 7.00725L0.5 0.992749C0.5 0.135997 1.50701 -0.324056 2.15465 0.23682L5.62713 3.24407Z\",\n fill: \"\".concat(color),\n }),\n }\n )\n );\n}\n\nvar EmailVerificationSendVerifyEmail = function (props) {\n var t = translationContext.useTranslation();\n var userContext = uiEntry.useUserContext();\n var _a = React.useState(\"READY\"),\n status = _a[0],\n setStatus = _a[1];\n var _b = React.useState(undefined),\n errorMessage = _b[0],\n setErrorMessage = _b[1];\n var resendEmail = function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var response, e_1;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 5, , 6]);\n return [\n 4 /*yield*/,\n props.recipeImplementation.sendVerificationEmail({\n userContext: userContext,\n }),\n ];\n case 1:\n response = _a.sent();\n if (!(response.status === \"EMAIL_ALREADY_VERIFIED_ERROR\")) return [3 /*break*/, 3];\n return [4 /*yield*/, props.onEmailAlreadyVerified()];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n if (response.status === \"OK\") {\n setStatus(\"EMAIL_RESENT\");\n }\n _a.label = 4;\n case 4:\n return [3 /*break*/, 6];\n case 5:\n e_1 = _a.sent();\n if (STGeneralError__default.default.isThisError(e_1)) {\n setErrorMessage(e_1.message);\n }\n setStatus(\"ERROR\");\n return [2 /*return*/, handleSendError()];\n case 6:\n return [2 /*return*/];\n }\n });\n });\n };\n var logout = function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var e_2;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, props.signOut()];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2:\n e_2 = _a.sent();\n if (STGeneralError__default.default.isThisError(e_2)) {\n setErrorMessage(e_2.message);\n }\n setStatus(\"ERROR\");\n return [3 /*break*/, 3];\n case 3:\n return [2 /*return*/];\n }\n });\n });\n };\n var sendVerificationEmail = React.useCallback(\n function () {\n return props.recipeImplementation.sendVerificationEmail({\n userContext: userContext,\n });\n },\n [props.config, props.recipeImplementation]\n );\n var checkSendResponse = React.useCallback(\n function (response) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(response.status === \"EMAIL_ALREADY_VERIFIED_ERROR\")) return [3 /*break*/, 2];\n return [4 /*yield*/, props.onEmailAlreadyVerified()];\n case 1:\n _a.sent();\n _a.label = 2;\n case 2:\n return [2 /*return*/];\n }\n });\n });\n },\n [props.config, props.recipeImplementation, props.onEmailAlreadyVerified]\n );\n var handleSendError = React.useCallback(function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }),\n ];\n case 1:\n if (!(_a.sent() !== true)) return [3 /*break*/, 3];\n return [4 /*yield*/, props.redirectToAuth()];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n return [2 /*return*/];\n }\n });\n });\n }, []);\n genericComponentOverrideContext.useOnMountAPICall(sendVerificationEmail, checkSendResponse, handleSendError);\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n status === \"ERROR\" &&\n jsxRuntime.jsx(uiEntry.GeneralError, {\n error: errorMessage === undefined ? \"SOMETHING_WENT_WRONG_ERROR\" : errorMessage,\n }),\n status === \"EMAIL_RESENT\" &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"generalSuccess\" },\n { children: t(\"EMAIL_VERIFICATION_RESEND_SUCCESS\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"sendVerifyEmailIcon\" },\n { children: jsxRuntime.jsx(emailLargeIcon.EmailLargeIcon, {}) }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle headerTinyTitle\" },\n { children: t(\"EMAIL_VERIFICATION_SEND_TITLE\") }\n )\n ),\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"primaryText sendVerifyEmailText\" },\n {\n children: [\n t(\"EMAIL_VERIFICATION_SEND_DESC_START\"),\n jsxRuntime.jsx(\"strong\", {\n children: t(\"EMAIL_VERIFICATION_SEND_DESC_STRONG\"),\n }),\n t(\"EMAIL_VERIFICATION_SEND_DESC_END\"),\n ],\n }\n )\n ),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"buttonWithArrow\", onClick: logout },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\":\n \"secondaryText secondaryLinkWithRightArrow\",\n },\n { children: t(\"EMAIL_VERIFICATION_LOGOUT\") }\n )\n ),\n jsxRuntime.jsx(ArrowRightIcon, {\n color: \"rgb(var(--palette-textGray))\",\n }),\n ],\n }\n )\n ),\n status !== \"EMAIL_RESENT\" &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"link sendVerifyEmailResend\", onClick: resendEmail },\n { children: t(\"EMAIL_VERIFICATION_RESEND_BTN\") }\n )\n ),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar SendVerifyEmail = uiEntry.withOverride(\"EmailVerificationSendVerifyEmail\", EmailVerificationSendVerifyEmail);\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction CheckedRoundIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"33\",\n height: \"33\",\n viewBox: \"0 0 33 33\",\n \"data-supertokens\": \"checkedRoundIcon\",\n },\n {\n children: jsxRuntime.jsxs(\n \"g\",\n genericComponentOverrideContext.__assign(\n { fill: \"rgb(var(--palette-success))\", stroke: \"rgb(var(--palette-success))\" },\n {\n children: [\n jsxRuntime.jsx(\"path\", {\n d: \"M6.715 15.334a1.135 1.135 0 0 1 1.605-1.605l4.558 4.558 9.573-9.573a1.135 1.135 0 0 1 1.605 1.605L13.748 20.627a1.231 1.231 0 0 1-1.741 0z\",\n transform: \"translate(-.5 -.5) translate(1.242 1.703)\",\n }),\n jsxRuntime.jsx(\"path\", {\n fillRule: \"evenodd\",\n d: \"M17 1a16 16 0 1 0 16 16A16 16 0 0 0 17 1zM3.462 17A13.538 13.538 0 1 1 17 30.538 13.538 13.538 0 0 1 3.462 17z\",\n transform: \"translate(-.5 -.5)\",\n }),\n ],\n }\n )\n ),\n }\n )\n );\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction ErrorLargeIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"33\",\n height: \"30\",\n viewBox: \"0 0 33 30\",\n \"data-supertokens\": \"errorLargeIcon\",\n },\n {\n children: jsxRuntime.jsxs(\"g\", {\n children: [\n jsxRuntime.jsx(\n \"g\",\n genericComponentOverrideContext.__assign(\n { fill: \"rgb(var(--palette-error))\" },\n {\n children: jsxRuntime.jsx(\"path\", {\n d: \"M29.617 29.75H3.383c-.626 0-1.189-.321-1.507-.86-.318-.537-.328-1.186-.027-1.733l13.118-23.85c.312-.568.885-.907 1.533-.907.648 0 1.221.339 1.533.907l13.118 23.85c.301.547.291 1.196-.027 1.734s-.881.859-1.507.859z\",\n transform: \"translate(-824.894 -352.483) translate(824.894 352.483)\",\n }),\n }\n )\n ),\n jsxRuntime.jsx(\n \"text\",\n genericComponentOverrideContext.__assign(\n {\n fill: \"#fff\",\n \"font-family\": \"Arial-Bold, Arial\",\n \"font-size\": \"18px\",\n fontWeight: \"700\",\n transform: \"translate(-824.894 -352.483) translate(838.997 377.437)\",\n },\n {\n children: jsxRuntime.jsx(\n \"tspan\",\n genericComponentOverrideContext.__assign({ x: \"0\", y: \"0\" }, { children: \"!\" })\n ),\n }\n )\n ),\n ],\n }),\n }\n )\n );\n}\n\nvar EmailVerificationVerifyEmailLinkClicked = function (props) {\n var t = translationContext.useTranslation();\n var sessionContext = uiEntry.useSessionContext();\n var userContext = uiEntry.useUserContext();\n var _a = React.useState(\"LOADING\"),\n status = _a[0],\n setStatus = _a[1];\n var _b = React.useState(undefined),\n errorMessage = _b[0],\n setErrorMessage = _b[1];\n var _c = React.useState(false),\n verifyLoading = _c[0],\n setVerifyLoading = _c[1];\n var verifyEmailOnMount = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (sessionContext.loading === true) {\n // This callback should only be called if the session is already loaded\n throw new Error(\"Should never come here\");\n }\n // If there is no active session we know that the verification was started elsewhere, since it requires a session\n // otherwise we assume it's the same session. The main purpose of this is to prevent mail scanners\n // from accidentally validating an email address\n if (!sessionContext.doesSessionExist) {\n return [2 /*return*/, \"INTERACTION_REQUIRED\"];\n }\n return [\n 2 /*return*/,\n props.recipeImplementation.verifyEmail({\n userContext: userContext,\n }),\n ];\n });\n });\n },\n [props.recipeImplementation, sessionContext]\n );\n var handleVerifyResp = React.useCallback(\n function (response) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (response === \"INTERACTION_REQUIRED\") {\n setStatus(\"INTERACTION_REQUIRED\");\n } else if (response.status === \"EMAIL_VERIFICATION_INVALID_TOKEN_ERROR\") {\n setStatus(\"INVALID\");\n } else {\n setStatus(\"SUCCESSFUL\");\n }\n return [2 /*return*/];\n });\n });\n },\n [setStatus]\n );\n var handleError = React.useCallback(\n function (err) {\n if (STGeneralError__default.default.isThisError(err)) {\n setErrorMessage(err.message);\n }\n setStatus(\"GENERAL_ERROR\");\n },\n [setStatus, setErrorMessage]\n );\n genericComponentOverrideContext.useOnMountAPICall(\n verifyEmailOnMount,\n handleVerifyResp,\n handleError,\n sessionContext.loading === false\n );\n var onTokenInvalidRedirect = props.onTokenInvalidRedirect,\n onSuccess = props.onSuccess;\n if (status === \"LOADING\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"spinner\" },\n { children: jsxRuntime.jsx(uiEntry.SpinnerIcon, {}) }\n )\n ),\n }\n )\n ),\n }\n )\n );\n }\n if (status === \"INTERACTION_REQUIRED\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row noFormRow\" },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle\" },\n { children: t(\"EMAIL_VERIFICATION_LINK_CLICKED_HEADER\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n { children: t(\"EMAIL_VERIFICATION_LINK_CLICKED_DESC\") }\n )\n ),\n jsxRuntime.jsx(button.Button, {\n isLoading: verifyLoading,\n onClick: function () {\n return genericComponentOverrideContext.__awaiter(\n void 0,\n void 0,\n void 0,\n function () {\n var resp, err_1;\n return genericComponentOverrideContext.__generator(\n this,\n function (_a) {\n switch (_a.label) {\n case 0:\n setVerifyLoading(true);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, , 5]);\n return [\n 4 /*yield*/,\n props.recipeImplementation.verifyEmail({\n userContext: userContext,\n }),\n ];\n case 2:\n resp = _a.sent();\n return [4 /*yield*/, handleVerifyResp(resp)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n err_1 = _a.sent();\n void handleError(err_1);\n return [3 /*break*/, 5];\n case 5:\n return [2 /*return*/];\n }\n }\n );\n }\n );\n },\n type: \"button\",\n label: \"EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON\",\n }),\n ],\n }\n )\n ),\n }\n )\n );\n }\n if (status === \"SUCCESSFUL\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row noFormRow\" },\n {\n children: [\n jsxRuntime.jsx(CheckedRoundIcon, {}),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle headerTinyTitle\" },\n { children: t(\"EMAIL_VERIFICATION_SUCCESS\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"emailVerificationButtonWrapper\" },\n {\n children: jsxRuntime.jsx(button.Button, {\n isLoading: false,\n onClick: onSuccess,\n type: \"button\",\n label: \"EMAIL_VERIFICATION_CONTINUE_BTN\",\n }),\n }\n )\n ),\n ],\n }\n )\n ),\n }\n )\n );\n }\n if (status === \"INVALID\") {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row noFormRow\" },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle headerTinyTitle\" },\n { children: t(\"EMAIL_VERIFICATION_EXPIRED\") }\n )\n ),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n onClick: onTokenInvalidRedirect,\n \"data-supertokens\": \"secondaryText secondaryLinkWithArrow\",\n },\n {\n children: [\n t(\"EMAIL_VERIFICATION_CONTINUE_LINK\"),\n \" \",\n jsxRuntime.jsx(ArrowRightIcon, {\n color: \"rgb(var(--palette-textPrimary))\",\n }),\n ],\n }\n )\n ),\n ],\n }\n )\n ),\n }\n )\n );\n }\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row noFormRow\" },\n {\n children: [\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle error\" },\n {\n children: [\n jsxRuntime.jsx(ErrorLargeIcon, {}),\n t(\"EMAIL_VERIFICATION_ERROR_TITLE\"),\n ],\n }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"primaryText\" },\n {\n children: t(\n errorMessage === undefined\n ? \"EMAIL_VERIFICATION_ERROR_DESC\"\n : errorMessage\n ),\n }\n )\n ),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar VerifyEmailLinkClicked = uiEntry.withOverride(\n \"EmailVerificationVerifyEmailLinkClicked\",\n EmailVerificationVerifyEmailLinkClicked\n);\n\nfunction EmailVerificationTheme(props) {\n var sessionContext = session.useSessionContext();\n // If we have a token, return VerifyEmailLinkClicked.\n if (props.verifyEmailLinkClickedScreen !== undefined) {\n return jsxRuntime.jsx(\n VerifyEmailLinkClicked,\n genericComponentOverrideContext.__assign({}, props.verifyEmailLinkClickedScreen)\n );\n }\n // If we have an active session, we want to send the verification email\n if (sessionContext.loading === false && sessionContext.doesSessionExist === true) {\n return jsxRuntime.jsx(\n SendVerifyEmail,\n genericComponentOverrideContext.__assign({}, props.sendVerifyEmailScreen)\n );\n }\n // Otherwise, return an empty screen, waiting for the feature component to redirection to complete.\n return jsxRuntime.jsx(jsxRuntime.Fragment, {});\n}\nfunction EmailVerificationThemeWrapper(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n translations.ThemeBase,\n genericComponentOverrideContext.__assign(\n {\n userStyles: [\n rootStyle,\n props.config.recipeRootStyle,\n props.verifyEmailLinkClickedScreen === undefined\n ? props.config.sendVerifyEmailScreen.style\n : props.config.verifyEmailLinkClickedScreen.style,\n ],\n },\n {\n children: jsxRuntime.jsx(\n EmailVerificationTheme,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n ),\n }\n )\n );\n}\n\nvar EmailVerification$1 = function (props) {\n var _a;\n var sessionContext = React.useContext(uiEntry.SessionContext);\n var _b = React.useState(\"LOADING\"),\n status = _b[0],\n setStatus = _b[1];\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var recipeComponentOverrides = props.useComponentOverrides();\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var redirectToAuthWithHistory = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n uiEntry.redirectToAuth({ redirectBack: false, navigate: props.navigate }),\n ];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n },\n [props.navigate]\n );\n var modifiedRecipeImplementation = React.useMemo(\n function () {\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, props.recipe.webJSRecipe),\n {\n sendVerificationEmail: function (input) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, props.recipe.webJSRecipe.sendVerificationEmail(input)];\n case 1:\n response = _a.sent();\n genericComponentOverrideContext.clearQueryParams([\"token\"]);\n return [2 /*return*/, response];\n }\n });\n });\n },\n }\n );\n },\n [props.recipe]\n );\n var onSuccess = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow()\n .validateGlobalClaimsAndHandleSuccessRedirection(\n undefined,\n props.recipe.recipeID,\n undefined,\n userContext,\n props.navigate\n )\n .catch(rethrowInRender),\n ];\n });\n });\n },\n [props.recipe, props.navigate, userContext]\n );\n var fetchIsEmailVerified = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var token;\n var _a;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (sessionContext.loading === true) {\n // This callback should only be called if the session is already loaded\n throw new Error(\"Should never come here\");\n }\n token =\n (_a = genericComponentOverrideContext.getQueryParams(\"token\")) !== null && _a !== void 0\n ? _a\n : undefined;\n if (!(token === undefined)) return [3 /*break*/, 4];\n if (!!sessionContext.doesSessionExist) return [3 /*break*/, 2];\n return [4 /*yield*/, redirectToAuthWithHistory()];\n case 1:\n _b.sent();\n return [3 /*break*/, 4];\n case 2:\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.isEmailVerified({ userContext: userContext }),\n ];\n case 3:\n // we check if the email is already verified, and if it is, then we redirect the user\n return [2 /*return*/, _b.sent().isVerified];\n case 4:\n return [2 /*return*/, false];\n }\n });\n });\n },\n [props.recipe, sessionContext, redirectToAuthWithHistory]\n );\n var checkIsEmailVerified = React.useCallback(\n function (isVerified) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (isVerified) {\n return [2 /*return*/, onSuccess()];\n }\n setStatus(\"READY\");\n return [2 /*return*/];\n });\n });\n },\n [props.recipe, setStatus, onSuccess]\n );\n var handleError = React.useCallback(\n function (err) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }),\n ];\n case 1:\n if (!_a.sent()) return [3 /*break*/, 2];\n throw err;\n case 2:\n return [4 /*yield*/, redirectToAuthWithHistory()];\n case 3:\n _a.sent();\n _a.label = 4;\n case 4:\n return [2 /*return*/];\n }\n });\n });\n },\n [redirectToAuthWithHistory]\n );\n genericComponentOverrideContext.useOnMountAPICall(\n fetchIsEmailVerified,\n checkIsEmailVerified,\n handleError,\n sessionContext.loading === false\n );\n var signOut = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var session;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n session = types.Session.getInstanceOrThrow();\n return [4 /*yield*/, session.signOut({ userContext: userContext })];\n case 1:\n _a.sent();\n return [2 /*return*/, redirectToAuthWithHistory()];\n }\n });\n });\n },\n [redirectToAuthWithHistory, userContext]\n );\n if (status === \"LOADING\") {\n return jsxRuntime.jsx(React.Fragment, {});\n }\n var sendVerifyEmailScreenFeature = props.recipe.config.sendVerifyEmailScreen;\n var sendVerifyEmailScreen = {\n styleFromInit: sendVerifyEmailScreenFeature.style,\n recipeImplementation: modifiedRecipeImplementation,\n config: props.recipe.config,\n signOut: signOut,\n onEmailAlreadyVerified: onSuccess,\n redirectToAuth: redirectToAuthWithHistory,\n };\n var verifyEmailLinkClickedScreenFeature = props.recipe.config.verifyEmailLinkClickedScreen;\n var token =\n (_a = genericComponentOverrideContext.getQueryParams(\"token\")) !== null && _a !== void 0 ? _a : undefined;\n var verifyEmailLinkClickedScreen =\n token === undefined\n ? undefined\n : {\n styleFromInit: verifyEmailLinkClickedScreenFeature.style,\n onTokenInvalidRedirect: redirectToAuthWithHistory,\n onSuccess: onSuccess,\n recipeImplementation: modifiedRecipeImplementation,\n config: props.recipe.config,\n token: token,\n };\n var childProps = {\n config: props.recipe.config,\n sendVerifyEmailScreen: sendVerifyEmailScreen,\n verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,\n hasToken: token !== undefined,\n };\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: translations.defaultTranslationsEmailVerification,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n EmailVerificationThemeWrapper,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n ),\n }\n )\n );\n};\n\nvar EmailVerificationPreBuiltUI = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(EmailVerificationPreBuiltUI, _super);\n function EmailVerificationPreBuiltUI(recipeInstance) {\n var _this = _super.call(this) || this;\n _this.recipeInstance = recipeInstance;\n _this.languageTranslations = translations.defaultTranslationsEmailVerification;\n // Instance methods\n _this.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = recipe.useContext;\n }\n var features = {};\n if (_this.recipeInstance.config.disableDefaultUI !== true) {\n var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath(\n new NormalisedURLPath__default.default(recipe.DEFAULT_VERIFY_EMAIL_PATH)\n );\n features[normalisedFullPath.getAsStringDangerous()] = {\n matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams(\n _this.recipeInstance.config.recipeId\n ),\n component: function (props) {\n return _this.getFeatureComponent(\"emailverification\", props, useComponentOverrides);\n },\n recipeID: recipe.EmailVerification.RECIPE_ID,\n };\n }\n return features;\n };\n _this.getFeatureComponent = function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _,\n props,\n useComponentOverrides\n ) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = recipe.useContext;\n }\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n session.SessionAuth,\n genericComponentOverrideContext.__assign(\n {\n requireAuth: false,\n overrideGlobalClaimValidators: function () {\n return [];\n },\n },\n {\n children: jsxRuntime.jsx(uiEntry.UserContextContext.Consumer, {\n children: function (value) {\n return jsxRuntime.jsx(\n EmailVerification$1,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: useComponentOverrides,\n },\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, props),\n {\n // We do this to make sure it does not add another provider\n userContext: value,\n }\n )\n )\n );\n },\n }),\n }\n )\n ),\n }\n )\n );\n };\n return _this;\n }\n // Static methods\n EmailVerificationPreBuiltUI.getInstanceOrInitAndGetInstance = function () {\n if (EmailVerificationPreBuiltUI.instance === undefined) {\n var recipeInstance = recipe.EmailVerification.getInstanceOrThrow();\n EmailVerificationPreBuiltUI.instance = new EmailVerificationPreBuiltUI(recipeInstance);\n }\n return EmailVerificationPreBuiltUI.instance;\n };\n EmailVerificationPreBuiltUI.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = recipe.useContext;\n }\n return EmailVerificationPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides);\n };\n EmailVerificationPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = recipe.useContext;\n }\n return EmailVerificationPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n componentName,\n props,\n useComponentOverrides\n );\n };\n EmailVerificationPreBuiltUI.prototype.getAuthComponents = function () {\n return [];\n };\n // For tests\n EmailVerificationPreBuiltUI.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n EmailVerificationPreBuiltUI.instance = undefined;\n return;\n };\n EmailVerificationPreBuiltUI.EmailVerification = function (props) {\n return EmailVerificationPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n \"emailverification\",\n props\n );\n };\n EmailVerificationPreBuiltUI.EmailVerificationTheme = EmailVerificationTheme;\n return EmailVerificationPreBuiltUI;\n})(uiEntry.RecipeRouter);\nvar EmailVerification = EmailVerificationPreBuiltUI.EmailVerification;\n\nexports.EmailVerification = EmailVerification;\nexports.EmailVerificationPreBuiltUI = EmailVerificationPreBuiltUI;\nexports.EmailVerificationTheme = EmailVerificationTheme;\n","\"use strict\";\n\nvar SuperTokensWebJS = require(\"supertokens-web-js\");\nvar cookieHandler = require(\"supertokens-web-js/utils/cookieHandler\");\nvar postSuperTokensInitCallbacks = require(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\nvar MultitenancyWebJS = require(\"supertokens-web-js/recipe/multitenancy\");\nvar utils = require(\"supertokens-web-js/utils\");\nvar React = require(\"react\");\nvar NormalisedURLDomain = require(\"supertokens-web-js/utils/normalisedURLDomain\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar SuperTokensWebJS__default = /*#__PURE__*/ _interopDefault(SuperTokensWebJS);\nvar MultitenancyWebJS__default = /*#__PURE__*/ _interopDefault(MultitenancyWebJS);\nvar React__default = /*#__PURE__*/ _interopDefault(React);\nvar NormalisedURLDomain__default = /*#__PURE__*/ _interopDefault(NormalisedURLDomain);\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\n\n/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function (d, b) {\n extendStatics =\n Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array &&\n function (d, b) {\n d.__proto__ = b;\n }) ||\n function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());\n}\n\nexports.__assign = function () {\n exports.__assign =\n Object.assign ||\n function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return exports.__assign.apply(this, arguments);\n};\n\nfunction __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nfunction __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P\n ? value\n : new P(function (resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nfunction __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function () {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: [],\n },\n f,\n y,\n t,\n g;\n return (\n (g = { next: verb(0), throw: verb(1), return: verb(2) }),\n typeof Symbol === \"function\" &&\n (g[Symbol.iterator] = function () {\n return this;\n }),\n g\n );\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while ((g && ((g = 0), op[0] && (_ = 0)), _))\n try {\n if (\n ((f = 1),\n y &&\n (t =\n op[0] & 2\n ? y[\"return\"]\n : op[0]\n ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0)\n : y.next) &&\n !(t = t.call(y, op[1])).done)\n )\n return t;\n if (((y = 0), t)) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nfunction __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2)\n for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\ntypeof SuppressedError === \"function\"\n ? SuppressedError\n : function (error, suppressed, message) {\n var e = new Error(message);\n return (e.name = \"SuppressedError\"), (e.error = error), (e.suppressed = suppressed), e;\n };\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Consts.\n */\nvar RECIPE_ID_QUERY_PARAM = \"rid\";\nvar TENANT_ID_QUERY_PARAM = \"tenantId\";\nvar DEFAULT_API_BASE_PATH = \"/auth\";\nvar DEFAULT_WEBSITE_BASE_PATH = \"/auth\";\nvar ST_ROOT_ID = \"supertokens-root\";\nvar SSR_ERROR =\n \"\\nIf you are trying to use this method doing server-side-rendering, please make sure you move this method inside a componentDidMount method or useEffect hook.\";\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar package_version = \"0.48.0\";\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar SUPERTOKENS_DEBUG_NAMESPACE = \"com.supertokens.auth-react\";\nvar __debugLogsEnabled = false;\nfunction enableLogging() {\n __debugLogsEnabled = true;\n}\nfunction logDebugMessage(message) {\n if (__debugLogsEnabled) {\n // eslint-disable-next-line no-console\n console.log(\n \"\"\n .concat(SUPERTOKENS_DEBUG_NAMESPACE, ' {t: \"')\n .concat(new Date().toISOString(), '\", message: \"')\n .concat(message, '\", supertokens-auth-react-ver: \"')\n .concat(package_version, '\"}')\n );\n }\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * getRecipeIdFromPath\n * Input:\n * Output: The \"rid\" query param if present, null otherwise.\n */\nfunction getRecipeIdFromSearch(search) {\n var urlParams = new URLSearchParams(search);\n return urlParams.get(RECIPE_ID_QUERY_PARAM);\n}\nfunction clearQueryParams(paramNames) {\n var newURL = new URL(windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHref());\n for (var _i = 0, paramNames_1 = paramNames; _i < paramNames_1.length; _i++) {\n var param = paramNames_1[_i];\n newURL.searchParams.delete(param);\n }\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.history.replaceState(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.history.getState(),\n \"\",\n newURL.toString()\n );\n}\nfunction updateQueryParam(name, value) {\n var newURL = new URL(windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHref());\n newURL.searchParams.set(name, value);\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.history.replaceState(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.history.getState(),\n \"\",\n newURL.toString()\n );\n}\nfunction clearErrorQueryParam() {\n clearQueryParams([\"error\", \"message\"]);\n}\nfunction getQueryParams(param) {\n var urlParams = new URLSearchParams(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getSearch()\n );\n return urlParams.get(param);\n}\nfunction getURLHash() {\n // By default it is returined with the \"#\" at the beginning, we cut that off here.\n return windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHash().substr(1);\n}\nfunction getRedirectToPathFromURL() {\n var redirectToPath = getQueryParams(\"redirectToPath\");\n if (redirectToPath === null) {\n return undefined;\n } else {\n try {\n var url = void 0;\n try {\n url = new URL(redirectToPath);\n } catch (error) {\n var fakeDomain = redirectToPath.startsWith(\"/\") ? \"http://localhost\" : \"http://localhost/\";\n url = new URL(\"\".concat(fakeDomain).concat(redirectToPath));\n }\n // Prevent Open redirects by normalising path.\n var normalisedURLPath = new NormalisedURLPath__default.default(redirectToPath).getAsStringDangerous();\n var pathQueryParams = url.search || \"\"; // url.search contains the leading ?\n var pathHash = url.hash || \"\"; // url.hash contains the leading #\n var pathWithQueryParamsAndHash = normalisedURLPath + pathQueryParams + pathHash;\n // Ensure a leading \"/\" if `normalisedUrlPath` is empty but `pathWithQueryParamsAndHash` is not to ensure proper redirection.\n // Example: \"?test=1\" will not redirect the user to `/?test=1` if we don't add a leading \"/\".\n if (\n normalisedURLPath.length === 0 &&\n pathWithQueryParamsAndHash.length > 0 &&\n !pathWithQueryParamsAndHash.startsWith(\"/\")\n ) {\n return \"/\" + pathWithQueryParamsAndHash;\n }\n return pathWithQueryParamsAndHash;\n } catch (_a) {\n return undefined;\n }\n }\n}\nfunction getTenantIdFromQueryParams() {\n var _a;\n return (_a = getQueryParams(TENANT_ID_QUERY_PARAM)) !== null && _a !== void 0 ? _a : undefined;\n}\nfunction getDefaultRedirectionURLForPath(config, defaultPath, context, extraQueryParams) {\n var redirectPath = config.appInfo.websiteBasePath\n .appendPath(new NormalisedURLPath__default.default(defaultPath))\n .getAsStringDangerous();\n var queryParams = new URLSearchParams();\n if (context.tenantIdFromQueryParams !== undefined) {\n queryParams.set(TENANT_ID_QUERY_PARAM, context.tenantIdFromQueryParams);\n }\n if (extraQueryParams !== undefined) {\n Object.entries(extraQueryParams).forEach(function (_a) {\n var key = _a[0],\n value = _a[1];\n if (value !== undefined) {\n queryParams.set(key, value);\n }\n });\n }\n if (queryParams.toString() !== \"\") {\n return \"\".concat(redirectPath, \"?\").concat(queryParams.toString());\n }\n return redirectPath;\n}\n/*\n * isTest\n */\nfunction isTest() {\n try {\n return process.env.TEST_MODE === \"testing\" || process.env.REACT_APP_TEST_MODE === \"testing\";\n } catch (err) {\n // can get Uncaught ReferenceError: process is not defined error\n return false;\n }\n}\nfunction normaliseInputAppInfoOrThrowError(appInfo) {\n if (appInfo === undefined) {\n throw new Error(\"Please provide the appInfo object when calling supertokens.init\");\n }\n if (appInfo.apiDomain === undefined) {\n throw new Error(\"Please provide your apiDomain inside the appInfo object when calling supertokens.init\");\n }\n if (appInfo.appName === undefined) {\n throw new Error(\"Please provide your appName inside the appInfo object when calling supertokens.init\");\n }\n if (appInfo.websiteDomain === undefined) {\n throw new Error(\"Please provide your websiteDomain inside the appInfo object when calling supertokens.init\");\n }\n var apiGatewayPath = new NormalisedURLPath__default.default(\"\");\n if (appInfo.apiGatewayPath !== undefined) {\n apiGatewayPath = new NormalisedURLPath__default.default(appInfo.apiGatewayPath);\n }\n return {\n appName: appInfo.appName,\n apiDomain: new NormalisedURLDomain__default.default(appInfo.apiDomain),\n websiteDomain: new NormalisedURLDomain__default.default(appInfo.websiteDomain),\n apiBasePath: apiGatewayPath.appendPath(\n getNormalisedURLPathOrDefault(DEFAULT_API_BASE_PATH, appInfo.apiBasePath)\n ),\n websiteBasePath: getNormalisedURLPathOrDefault(DEFAULT_WEBSITE_BASE_PATH, appInfo.websiteBasePath),\n };\n}\nfunction getNormalisedURLPathOrDefault(defaultPath, path) {\n if (path !== undefined) {\n return new NormalisedURLPath__default.default(path);\n } else {\n return new NormalisedURLPath__default.default(defaultPath);\n }\n}\n/*\n * validateForm\n */\n// We check that the number of fields in input and config form field is the same.\n// We check that each item in the config form field is also present in the input form field\nfunction validateForm(inputs, configFormFields) {\n return __awaiter(this, void 0, void 0, function () {\n var validationErrors, _loop_1, i;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n validationErrors = [];\n if (configFormFields.length !== inputs.length) {\n throw Error(\"Are you sending too many / too few formFields?\");\n }\n _loop_1 = function (i) {\n var field, input, value, error;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n field = configFormFields[i];\n input = inputs.find(function (i) {\n return i.id === field.id;\n });\n value = input.value;\n if (input.id === \"email\") {\n value = value.trim();\n }\n return [4 /*yield*/, field.validate(value)];\n case 1:\n error = _b.sent();\n // If error, add it.\n if (error !== undefined) {\n validationErrors.push({\n error: error,\n id: field.id,\n });\n }\n return [2 /*return*/];\n }\n });\n };\n i = 0;\n _a.label = 1;\n case 1:\n if (!(i < configFormFields.length)) return [3 /*break*/, 4];\n return [5 /*yield**/, _loop_1(i)];\n case 2:\n _a.sent();\n _a.label = 3;\n case 3:\n i++;\n return [3 /*break*/, 1];\n case 4:\n return [2 /*return*/, validationErrors];\n }\n });\n });\n}\n/*\n * getCurrentNormalisedUrlPath\n */\nfunction getCurrentNormalisedUrlPath() {\n return new NormalisedURLPath__default.default(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getPathName()\n );\n}\nfunction getCurrentNormalisedUrlPathWithQueryParamsAndFragments() {\n var normalisedUrlPath = getCurrentNormalisedUrlPath().getAsStringDangerous();\n return (\n normalisedUrlPath +\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getSearch() +\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHash()\n );\n}\nfunction appendQueryParamsToURL(stringUrl, queryParams) {\n if (queryParams === undefined) {\n return stringUrl;\n }\n try {\n var url_1 = new URL(stringUrl);\n Object.entries(queryParams).forEach(function (_a) {\n var key = _a[0],\n value = _a[1];\n url_1.searchParams.set(key, value);\n });\n return url_1.href;\n } catch (e) {\n var fakeDomain = stringUrl.startsWith(\"/\") ? \"http://localhost\" : \"http://localhost/\";\n var url_2 = new URL(\"\".concat(fakeDomain).concat(stringUrl));\n Object.entries(queryParams).forEach(function (_a) {\n var key = _a[0],\n value = _a[1];\n url_2.searchParams.set(key, value);\n });\n return \"\".concat(url_2.pathname).concat(url_2.search).concat(url_2.hash);\n }\n}\nfunction appendTrailingSlashToURL(stringUrl) {\n return stringUrl.endsWith(\"/\") ? stringUrl : stringUrl + \"/\";\n}\n/*\n * Default method for matching recipe route based on query params.\n */\nfunction matchRecipeIdUsingQueryParams(recipeId) {\n return function () {\n var recipeIdFromSearch = getRecipeIdFromSearch(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getSearch()\n );\n return recipeIdFromSearch === recipeId;\n };\n}\nfunction redirectWithFullPageReload(to) {\n if (to.trim() === \"\") {\n to = \"/\";\n }\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.setHref(to);\n}\nfunction redirectWithNavigate(to, navigate) {\n if (to.trim() === \"\") {\n to = \"/\";\n }\n if (\"push\" in navigate) {\n // we are using react-router-dom that is before v6\n navigate.push(to);\n } else {\n // in react-router-dom v6, it is just navigate(to)\n navigate(to);\n }\n}\nfunction getOriginOfPage() {\n return new NormalisedURLDomain__default.default(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getOrigin()\n );\n}\nfunction getLocalStorage(key) {\n return __awaiter(this, void 0, void 0, function () {\n var res;\n return __generator(this, function (_a) {\n res = windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.localStorage.getItem(key);\n if (res === null || res === undefined) {\n return [2 /*return*/, null];\n }\n return [2 /*return*/, res];\n });\n });\n}\nfunction setLocalStorage(key, value) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.localStorage.setItem(\n key,\n value\n ),\n ];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n}\nfunction removeFromLocalStorage(key) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.localStorage.removeItem(\n key\n ),\n ];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n}\nfunction mergeObjects(obj1, obj2) {\n var res = exports.__assign({}, obj1);\n for (var key in obj2) {\n if (typeof res[key] === \"object\" && typeof obj2[key] === \"object\") {\n res[key] = mergeObjects(res[key], obj2[key]);\n } else {\n res[key] = obj2[key];\n }\n }\n return res;\n}\nfunction normaliseCookieScopeOrThrowError(cookieScope) {\n function helper(cookieScope) {\n cookieScope = cookieScope.trim().toLowerCase();\n // first we convert it to a URL so that we can use the URL class\n if (cookieScope.startsWith(\".\")) {\n cookieScope = cookieScope.substr(1);\n }\n if (!cookieScope.startsWith(\"http://\") && !cookieScope.startsWith(\"https://\")) {\n cookieScope = \"http://\" + cookieScope;\n }\n try {\n var urlObj = new URL(cookieScope);\n cookieScope = urlObj.hostname;\n // remove leading dot\n if (cookieScope.startsWith(\".\")) {\n cookieScope = cookieScope.substr(1);\n }\n return cookieScope;\n } catch (err) {\n throw new Error(\"Please provide a valid cookie scope\");\n }\n }\n function isAnIpAddress(ipaddress) {\n return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(\n ipaddress\n );\n }\n var noDotNormalised = helper(cookieScope);\n if (noDotNormalised === \"localhost\" || isAnIpAddress(noDotNormalised)) {\n return noDotNormalised;\n }\n if (cookieScope.startsWith(\".\")) {\n return \".\" + noDotNormalised;\n }\n return noDotNormalised;\n}\nfunction getDefaultCookieScope() {\n try {\n return normaliseCookieScopeOrThrowError(\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHostName()\n );\n } catch (_a) {\n return undefined;\n }\n}\nfunction getCookieValue(name) {\n return __awaiter(this, void 0, void 0, function () {\n var value, _a, parts, last, temp;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = \"; \";\n return [\n 4 /*yield*/,\n cookieHandler.CookieHandlerReference.getReferenceOrThrow().cookieHandler.getCookie(),\n ];\n case 1:\n value = _a + _b.sent();\n parts = value.split(\"; \" + name + \"=\");\n if (parts.length >= 2) {\n last = parts.pop();\n if (last !== undefined) {\n temp = last.split(\";\").shift();\n if (temp === undefined) {\n return [2 /*return*/, null];\n }\n return [2 /*return*/, temp];\n }\n }\n return [2 /*return*/, null];\n }\n });\n });\n}\n// undefined value will remove the cookie\nfunction setFrontendCookie(name, value, scope) {\n return __awaiter(this, void 0, void 0, function () {\n var expires, cookieVal;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n expires = \"Thu, 01 Jan 1970 00:00:01 GMT\";\n cookieVal = \"\";\n if (value !== undefined) {\n cookieVal = value;\n expires = undefined; // set cookie without expiry\n }\n if (\n !(\n scope === \"localhost\" ||\n scope ===\n windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHostName() ||\n scope === undefined\n )\n )\n return [3 /*break*/, 5];\n if (!(expires !== undefined)) return [3 /*break*/, 2];\n return [\n 4 /*yield*/,\n cookieHandler.CookieHandlerReference.getReferenceOrThrow().cookieHandler.setCookie(\n \"\".concat(name, \"=\").concat(cookieVal, \";expires=\").concat(expires, \";path=/;samesite=lax\")\n ),\n ];\n case 1:\n _a.sent();\n return [3 /*break*/, 4];\n case 2:\n return [\n 4 /*yield*/,\n cookieHandler.CookieHandlerReference.getReferenceOrThrow().cookieHandler.setCookie(\n \"\"\n .concat(name, \"=\")\n .concat(cookieVal, \";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;samesite=lax\")\n ),\n ];\n case 3:\n _a.sent();\n _a.label = 4;\n case 4:\n return [3 /*break*/, 9];\n case 5:\n if (!(expires !== undefined)) return [3 /*break*/, 7];\n return [\n 4 /*yield*/,\n cookieHandler.CookieHandlerReference.getReferenceOrThrow().cookieHandler.setCookie(\n \"\"\n .concat(name, \"=\")\n .concat(cookieVal, \";expires=\")\n .concat(expires, \";domain=\")\n .concat(scope, \";path=/;samesite=lax\")\n ),\n ];\n case 6:\n _a.sent();\n return [3 /*break*/, 9];\n case 7:\n return [\n 4 /*yield*/,\n cookieHandler.CookieHandlerReference.getReferenceOrThrow().cookieHandler.setCookie(\n \"\"\n .concat(name, \"=\")\n .concat(cookieVal, \";domain=\")\n .concat(scope, \";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;samesite=lax\")\n ),\n ];\n case 8:\n _a.sent();\n _a.label = 9;\n case 9:\n return [2 /*return*/];\n }\n });\n });\n}\nfunction getNormalisedUserContext(userContext) {\n return userContext === undefined ? {} : userContext;\n}\n/**\n * This function handles calling APIs that should only be called once during mount (mostly on mount of a route/feature component).\n * It's split into multiple callbacks (fetch + handleResponse/handleError) because we expect fetch to take longer and\n * and the component may be unmounted during the first fetch, in which case we want to avoid updating state/redirecting.\n * This is especially relevant for development in strict mode with React 18 (and in the future for concurrent rendering).\n *\n * @param fetch This is a callback that is only called once on mount. Mostly it's for consuming tokens/doing one time only API calls\n * @param handleResponse This is called with the result of the first (fetch) call if it succeeds.\n * @param handleError This is called with the error of the first (fetch) call if it rejects.\n * @param startLoading Will start the whole process if this is set to true (or omitted). Mostly used to wait for session loading.\n */\nvar useOnMountAPICall = function (fetch, handleResponse, handleError, startLoading) {\n if (startLoading === void 0) {\n startLoading = true;\n }\n var consumeReq = React.useRef();\n var _a = React.useState(undefined),\n error = _a[0],\n setError = _a[1];\n React.useEffect(\n function () {\n var effect = function (signal) {\n return __awaiter(void 0, void 0, void 0, function () {\n var resp, err_1, err_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 9]);\n if (consumeReq.current === undefined) {\n consumeReq.current = fetch();\n }\n return [4 /*yield*/, consumeReq.current];\n case 1:\n resp = _a.sent();\n if (!signal.aborted) {\n void handleResponse(resp);\n }\n return [3 /*break*/, 9];\n case 2:\n err_1 = _a.sent();\n if (!!signal.aborted) return [3 /*break*/, 8];\n if (!(handleError !== undefined)) return [3 /*break*/, 7];\n _a.label = 3;\n case 3:\n _a.trys.push([3, 5, , 6]);\n return [4 /*yield*/, handleError(err_1, resp)];\n case 4:\n _a.sent();\n return [3 /*break*/, 6];\n case 5:\n err_2 = _a.sent();\n setError(err_2);\n return [3 /*break*/, 6];\n case 6:\n return [3 /*break*/, 8];\n case 7:\n setError(err_1);\n _a.label = 8;\n case 8:\n return [3 /*break*/, 9];\n case 9:\n return [2 /*return*/];\n }\n });\n });\n };\n if (startLoading) {\n var ctrl_1 = new AbortController();\n void effect(ctrl_1.signal);\n return function () {\n ctrl_1.abort();\n };\n }\n return;\n },\n [setError, consumeReq, fetch, handleResponse, handleError, startLoading]\n );\n if (error) {\n throw error;\n }\n};\nfunction useRethrowInRender() {\n var _a = React.useState(undefined),\n error = _a[0],\n setError = _a[1];\n if (error) {\n throw error;\n }\n return setError;\n}\n\nvar BaseRecipeModule = /** @class */ (function () {\n /*\n * Constructor.\n */\n function BaseRecipeModule(config) {\n this.config = config;\n }\n return BaseRecipeModule;\n})();\n\nfunction normaliseRecipeModuleConfig(config) {\n var _this = this;\n if (config === undefined) {\n config = {};\n }\n var onHandleEvent = config.onHandleEvent,\n getRedirectionURL = config.getRedirectionURL,\n preAPIHook = config.preAPIHook,\n postAPIHook = config.postAPIHook;\n if (onHandleEvent === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function\n onHandleEvent = function (_) {};\n }\n if (getRedirectionURL === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getRedirectionURL = function (_) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, undefined];\n });\n });\n };\n }\n if (preAPIHook === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n preAPIHook = function (context) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, context];\n });\n });\n };\n }\n if (postAPIHook === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n postAPIHook = function () {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/];\n });\n });\n };\n }\n var rootStyle = config.style === undefined ? \"\" : config.style;\n return exports.__assign(exports.__assign({}, config), {\n getRedirectionURL: getRedirectionURL,\n onHandleEvent: onHandleEvent,\n preAPIHook: preAPIHook,\n postAPIHook: postAPIHook,\n recipeRootStyle: rootStyle,\n });\n}\n\nfunction normaliseMultitenancyConfig(config) {\n return exports.__assign(exports.__assign({}, normaliseRecipeModuleConfig(config)), {\n override: exports.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config === null || config === void 0 ? void 0 : config.override\n ),\n });\n}\nfunction hasIntersectingRecipes(tenantMethods, recipeList) {\n return tenantMethods.firstFactors.some(function (factorId) {\n return recipeList.some(function (r) {\n return r.firstFactorIds.includes(factorId);\n });\n });\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Class.\n */\nvar Multitenancy = /** @class */ (function (_super) {\n __extends(Multitenancy, _super);\n function Multitenancy(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = MultitenancyWebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = Multitenancy.RECIPE_ID;\n _this.dynamicLoginMethodsCache = {};\n return _this;\n }\n Multitenancy.prototype.getCurrentDynamicLoginMethods = function (input) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var userContext, tenantId, tenantMethods;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (SuperTokens.usesDynamicLoginMethods === false) {\n return [2 /*return*/, undefined];\n }\n userContext = utils.getNormalisedUserContext(input.userContext);\n return [4 /*yield*/, Multitenancy.getInstanceOrThrow().webJSRecipe.getTenantId()];\n case 1:\n tenantId = (_a = _b.sent()) !== null && _a !== void 0 ? _a : \"public\";\n if (this.dynamicLoginMethodsCache[tenantId] === undefined) {\n this.dynamicLoginMethodsCache[tenantId] = Multitenancy.getDynamicLoginMethods({\n tenantId: tenantId,\n userContext: userContext,\n });\n }\n return [4 /*yield*/, this.dynamicLoginMethodsCache[tenantId]];\n case 2:\n tenantMethods = _b.sent();\n if (\n !hasIntersectingRecipes(\n tenantMethods,\n SuperTokens.getInstanceOrThrow().recipeList.filter(function (recipe) {\n return \"firstFactorIds\" in recipe;\n })\n )\n ) {\n throw new Error(\n \"Initialized recipes have no overlap with core recipes or could not load login methods\"\n );\n }\n return [2 /*return*/, tenantMethods];\n }\n });\n });\n };\n Multitenancy.getDynamicLoginMethods = function (input) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, thirdParty, firstFactors;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4 /*yield*/, MultitenancyWebJS__default.default.getLoginMethods(input)];\n case 1:\n (_a = _b.sent()), (thirdParty = _a.thirdParty), (firstFactors = _a.firstFactors);\n return [\n 2 /*return*/,\n {\n thirdparty: thirdParty,\n firstFactors: firstFactors,\n },\n ];\n }\n });\n });\n };\n Multitenancy.init = function (config) {\n var normalisedConfig = normaliseMultitenancyConfig(config);\n return {\n recipeID: Multitenancy.RECIPE_ID,\n authReact: function (appInfo) {\n Multitenancy.instance = new Multitenancy(\n exports.__assign(exports.__assign({}, normalisedConfig), {\n appInfo: appInfo,\n recipeId: Multitenancy.RECIPE_ID,\n })\n );\n return Multitenancy.instance;\n },\n webJS: MultitenancyWebJS__default.default.init(exports.__assign({}, normalisedConfig)),\n };\n };\n Multitenancy.getInstanceOrThrow = function () {\n if (Multitenancy.instance === undefined) {\n var error =\n \"No instance of Multitenancy found. Make sure to call the Multitenancy.init method.\" +\n \"See https://supertokens.io/docs/multitenancy/quick-setup/frontend\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + SSR_ERROR;\n }\n throw Error(error);\n }\n return Multitenancy.instance;\n };\n /*\n * Tests methods.\n */\n Multitenancy.reset = function () {\n if (!isTest()) {\n return;\n }\n Multitenancy.instance = undefined;\n return;\n };\n Multitenancy.RECIPE_ID = \"multitenancy\";\n return Multitenancy;\n})(BaseRecipeModule);\n\nvar TranslationController = /** @class */ (function () {\n function TranslationController() {\n this.handlers = new Map();\n }\n TranslationController.prototype.emit = function (event, detail) {\n var handlerList = this.handlers.get(event) || [];\n for (var _i = 0, handlerList_1 = handlerList; _i < handlerList_1.length; _i++) {\n var h = handlerList_1[_i];\n h(event, detail);\n }\n };\n TranslationController.prototype.on = function (event, handler) {\n var handlerList = this.handlers.get(event) || [];\n this.handlers.set(event, handlerList.concat(handler));\n };\n TranslationController.prototype.off = function (event, handler) {\n var handlerList = this.handlers.get(event) || [];\n this.handlers.set(\n event,\n handlerList.filter(function (h) {\n return h !== handler;\n })\n );\n };\n return TranslationController;\n})();\nvar CURRENT_LANGUAGE_COOKIE_NAME = \"sCurrLanguage\";\nfunction saveCurrentLanguage(language, cookieDomain) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4 /*yield*/, setFrontendCookie(CURRENT_LANGUAGE_COOKIE_NAME, language, cookieDomain)];\n case 1:\n _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _b.sent();\n return [3 /*break*/, 3];\n case 3:\n return [2 /*return*/];\n }\n });\n });\n}\nfunction getCurrentLanguageFromCookie() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4 /*yield*/, getCookieValue(CURRENT_LANGUAGE_COOKIE_NAME)];\n case 1:\n return [2 /*return*/, _b.sent()];\n case 2:\n _b.sent();\n // This can throw if we are not in a browser\n // Since this is just loading a preference we can safely ignore the exception\n return [2 /*return*/, null];\n case 3:\n return [2 /*return*/];\n }\n });\n });\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Class.\n */\nvar SuperTokens = /** @class */ (function () {\n /*\n * Constructor.\n */\n function SuperTokens(config) {\n var _this = this;\n var _a, _b, _c, _d;\n this.recipeList = [];\n this.changeLanguage = function (lang) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n saveCurrentLanguage(lang, this.languageTranslations.currentLanguageCookieScope),\n ];\n case 1:\n _a.sent();\n this.languageTranslations.translationEventSource.emit(\"LanguageChange\", lang);\n return [2 /*return*/];\n }\n });\n });\n };\n this.redirectToAuth = function (options) {\n return __awaiter(_this, void 0, void 0, function () {\n var queryParams, redirectUrl;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n queryParams = options.queryParams === undefined ? {} : options.queryParams;\n if (options.show !== undefined) {\n queryParams.show = options.show;\n }\n if (options.redirectBack === true) {\n queryParams.redirectToPath = getCurrentNormalisedUrlPathWithQueryParamsAndFragments();\n }\n return [\n 4 /*yield*/,\n this.getRedirectUrl(\n {\n action: \"TO_AUTH\",\n showSignIn: options.show === \"signin\",\n tenantIdFromQueryParams: getTenantIdFromQueryParams(),\n },\n options.userContext\n ),\n ];\n case 1:\n redirectUrl = _a.sent();\n if (redirectUrl === null) {\n logDebugMessage(\"Skipping redirection because the user override returned null\");\n return [2 /*return*/];\n }\n redirectUrl = appendQueryParamsToURL(redirectUrl, queryParams);\n return [2 /*return*/, this.redirectToUrl(redirectUrl, options.navigate)];\n }\n });\n });\n };\n this.redirectToUrl = function (redirectUrl, navigate) {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n doRedirection(this.appInfo, redirectUrl, navigate);\n return [2 /*return*/];\n });\n });\n };\n this.redirect = function (context, navigate, queryParams, userContext) {\n return __awaiter(_this, void 0, void 0, function () {\n var redirectUrl;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.getRedirectUrl(context, getNormalisedUserContext(userContext))];\n case 1:\n redirectUrl = _a.sent();\n if (redirectUrl === null) {\n logDebugMessage(\n \"Skipping redirection because the user override returned null for context \".concat(\n JSON.stringify(context, null, 2)\n )\n );\n return [2 /*return*/];\n }\n redirectUrl = appendQueryParamsToURL(redirectUrl, queryParams);\n return [\n 2 /*return*/,\n SuperTokens.getInstanceOrThrow().redirectToUrl(redirectUrl, navigate),\n ];\n }\n });\n });\n };\n this.appInfo = normaliseInputAppInfoOrThrowError(config.appInfo);\n if (config.recipeList === undefined || config.recipeList.length === 0) {\n throw new Error(\n \"Please provide at least one recipe to the supertokens.init function call. See https://supertokens.io/docs/emailpassword/quick-setup/frontend\"\n );\n }\n var translationConfig = config.languageTranslations === undefined ? {} : config.languageTranslations;\n this.languageTranslations = {\n defaultLanguage: translationConfig.defaultLanguage === undefined ? \"en\" : translationConfig.defaultLanguage,\n currentLanguageCookieScope:\n translationConfig.currentLanguageCookieScope !== undefined\n ? normaliseCookieScopeOrThrowError(translationConfig.currentLanguageCookieScope)\n : getDefaultCookieScope(),\n userTranslationStore: translationConfig.translations !== undefined ? translationConfig.translations : {},\n translationEventSource: new TranslationController(),\n userTranslationFunc: translationConfig.translationFunc,\n };\n var enableDebugLogs = Boolean(config === null || config === void 0 ? void 0 : config.enableDebugLogs);\n if (enableDebugLogs) {\n enableLogging();\n }\n this.userGetRedirectionURL = config.getRedirectionURL;\n this.recipeList = config.recipeList.map(function (_a) {\n var authReact = _a.authReact;\n return authReact(_this.appInfo, enableDebugLogs);\n });\n this.rootStyle = (_a = config.style) !== null && _a !== void 0 ? _a : \"\";\n this.privacyPolicyLink = config.privacyPolicyLink;\n this.termsOfServiceLink = config.termsOfServiceLink;\n this.useShadowDom = (_b = config.useShadowDom) !== null && _b !== void 0 ? _b : true;\n this.defaultToSignUp = (_c = config.defaultToSignUp) !== null && _c !== void 0 ? _c : false;\n this.disableAuthRoute = (_d = config.disableAuthRoute) !== null && _d !== void 0 ? _d : false;\n }\n /*\n * Static Methods.\n */\n SuperTokens.init = function (config) {\n var _a;\n cookieHandler.CookieHandlerReference.init(config.cookieHandler);\n windowHandler.WindowHandlerReference.init(config.windowHandler);\n if (SuperTokens.instance !== undefined) {\n console.warn(\"SuperTokens was already initialized\");\n return;\n }\n SuperTokens.usesDynamicLoginMethods =\n (_a = config.usesDynamicLoginMethods) !== null && _a !== void 0 ? _a : false;\n var recipes =\n config.recipeList.find(function (recipe) {\n return recipe.recipeID === Multitenancy.RECIPE_ID;\n }) !== undefined\n ? config.recipeList\n : config.recipeList.concat(Multitenancy.init({}));\n SuperTokensWebJS__default.default.init(\n exports.__assign(exports.__assign({}, config), {\n recipeList: recipes.map(function (_a) {\n var webJS = _a.webJS;\n return webJS;\n }),\n })\n );\n SuperTokens.instance = new SuperTokens(exports.__assign(exports.__assign({}, config), { recipeList: recipes }));\n postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.runPostInitCallbacks();\n };\n SuperTokens.getInstanceOrThrow = function () {\n if (SuperTokens.instance === undefined) {\n var error = \"SuperTokens must be initialized before calling this method.\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + SSR_ERROR;\n }\n throw new Error(error);\n }\n return SuperTokens.instance;\n };\n SuperTokens.prototype.getRecipeOrThrow = function (recipeId) {\n var recipe = this.recipeList.find(function (recipe) {\n return recipe.config.recipeId === recipeId;\n });\n if (recipe === undefined) {\n throw new Error(\"Missing recipe: \".concat(recipeId));\n }\n return recipe;\n };\n SuperTokens.prototype.loadTranslation = function (store) {\n this.languageTranslations.translationEventSource.emit(\"TranslationLoaded\", store);\n };\n SuperTokens.prototype.getRedirectUrl = function (context, userContext) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var userRes, redirectUrl, basePath;\n var _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (!this.userGetRedirectionURL) return [3 /*break*/, 2];\n return [4 /*yield*/, this.userGetRedirectionURL(context, userContext)];\n case 1:\n userRes = _c.sent();\n if (userRes !== undefined) {\n return [2 /*return*/, userRes];\n }\n _c.label = 2;\n case 2:\n if (context.action === \"TO_AUTH\") {\n redirectUrl = this.appInfo.websiteBasePath.getAsStringDangerous();\n basePath = appendTrailingSlashToURL(redirectUrl);\n if (context.tenantIdFromQueryParams) {\n return [\n 2 /*return*/,\n appendQueryParamsToURL(\n basePath,\n ((_b = {}), (_b[TENANT_ID_QUERY_PARAM] = context.tenantIdFromQueryParams), _b)\n ),\n ];\n }\n return [2 /*return*/, basePath];\n } else if (context.action === \"SUCCESS\") {\n return [2 /*return*/, (_a = context.redirectToPath) !== null && _a !== void 0 ? _a : \"/\"];\n }\n throw new Error(\"Should never come here: unexpected redirection context\");\n }\n });\n });\n };\n /*\n * Tests methods.\n */\n SuperTokens.reset = function () {\n if (!isTest()) {\n return;\n }\n SuperTokens.instance = undefined;\n return;\n };\n SuperTokens.usesDynamicLoginMethods = false;\n return SuperTokens;\n})();\nfunction doRedirection(appInfo, redirectUrl, navigate) {\n try {\n new URL(redirectUrl); // If full URL, no error thrown, skip in app redirection.\n } catch (e) {\n // For multi tenancy, If mismatch between websiteDomain and current location, prepend URL relative path with websiteDomain.\n var origin_1 = getOriginOfPage().getAsStringDangerous();\n if (origin_1 !== appInfo.websiteDomain.getAsStringDangerous()) {\n redirectUrl = \"\".concat(appInfo.websiteDomain.getAsStringDangerous()).concat(redirectUrl);\n redirectWithFullPageReload(redirectUrl);\n return;\n }\n // If navigate was provided, use to redirect without reloading.\n if (navigate !== undefined) {\n redirectWithNavigate(redirectUrl, navigate);\n return;\n }\n }\n // Otherwise, redirect in app.\n redirectWithFullPageReload(redirectUrl);\n}\n\nvar createGenericComponentsOverrideContext = function (v) {\n if (v === void 0) {\n v = {};\n }\n var genericContext = React__default.default.createContext(v);\n var useComponentsOverrideContext = function () {\n return React__default.default.useContext(genericContext);\n };\n var Provider = function (_a) {\n var children = _a.children,\n components = _a.components;\n return jsxRuntime.jsx(genericContext.Provider, exports.__assign({ value: components }, { children: children }));\n };\n return [useComponentsOverrideContext, Provider, genericContext.Consumer];\n};\n\nexports.BaseRecipeModule = BaseRecipeModule;\nexports.Multitenancy = Multitenancy;\nexports.SSR_ERROR = SSR_ERROR;\nexports.ST_ROOT_ID = ST_ROOT_ID;\nexports.SuperTokens = SuperTokens;\nexports.__awaiter = __awaiter;\nexports.__extends = __extends;\nexports.__generator = __generator;\nexports.__rest = __rest;\nexports.__spreadArray = __spreadArray;\nexports.appendQueryParamsToURL = appendQueryParamsToURL;\nexports.clearErrorQueryParam = clearErrorQueryParam;\nexports.clearQueryParams = clearQueryParams;\nexports.createGenericComponentsOverrideContext = createGenericComponentsOverrideContext;\nexports.getCurrentLanguageFromCookie = getCurrentLanguageFromCookie;\nexports.getCurrentNormalisedUrlPath = getCurrentNormalisedUrlPath;\nexports.getCurrentNormalisedUrlPathWithQueryParamsAndFragments = getCurrentNormalisedUrlPathWithQueryParamsAndFragments;\nexports.getDefaultRedirectionURLForPath = getDefaultRedirectionURLForPath;\nexports.getLocalStorage = getLocalStorage;\nexports.getNormalisedUserContext = getNormalisedUserContext;\nexports.getQueryParams = getQueryParams;\nexports.getRedirectToPathFromURL = getRedirectToPathFromURL;\nexports.getTenantIdFromQueryParams = getTenantIdFromQueryParams;\nexports.getURLHash = getURLHash;\nexports.isTest = isTest;\nexports.logDebugMessage = logDebugMessage;\nexports.matchRecipeIdUsingQueryParams = matchRecipeIdUsingQueryParams;\nexports.mergeObjects = mergeObjects;\nexports.normaliseRecipeModuleConfig = normaliseRecipeModuleConfig;\nexports.redirectWithFullPageReload = redirectWithFullPageReload;\nexports.removeFromLocalStorage = removeFromLocalStorage;\nexports.setLocalStorage = setLocalStorage;\nexports.updateQueryParam = updateQueryParam;\nexports.useOnMountAPICall = useOnMountAPICall;\nexports.useRethrowInRender = useRethrowInRender;\nexports.validateForm = validateForm;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nrequire(\"./genericComponentOverrideContext.js\");\nvar uiEntry = require(\"./index2.js\");\nvar translationContext = require(\"./translationContext.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./multifactorauth-shared2.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./multifactorauth-shared.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\n\nexports.SuperTokensWrapper = uiEntry.SuperTokensWrapper;\nexports.changeLanguage = uiEntry.changeLanguage;\nexports.default = uiEntry.SuperTokensAPIWrapper;\nexports.init = uiEntry.init;\nexports.loadTranslation = uiEntry.loadTranslation;\nexports.redirectToAuth = uiEntry.redirectToAuth;\nexports.useUserContext = uiEntry.useUserContext;\nexports.useTranslation = translationContext.useTranslation;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar React = require(\"react\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar translationContext = require(\"./translationContext.js\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\nvar reactDom = require(\"react-dom\");\nvar componentOverrideContext = require(\"./multitenancy-shared.js\");\nvar recipe$1 = require(\"./multifactorauth-shared2.js\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar recipe = require(\"./oauth2provider-shared.js\");\nvar utils = require(\"./authRecipe-shared.js\");\nvar NormalisedURLPath$1 = require(\"supertokens-web-js/lib/build/normalisedURLPath\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar React__default = /*#__PURE__*/ _interopDefault(React);\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar NormalisedURLPath__default$1 = /*#__PURE__*/ _interopDefault(NormalisedURLPath$1);\n\nvar ComponentOverrideContext = React__default.default.createContext(\"IS_DEFAULT\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction SpinnerIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { version: \"1.1\", viewBox: \"25 25 50 50\", \"data-supertokens\": \"spinnerIcon\" },\n {\n children: jsxRuntime.jsxs(\n \"circle\",\n genericComponentOverrideContext.__assign(\n {\n cx: \"50\",\n cy: \"50\",\n r: \"20\",\n fill: \"none\",\n stroke: \"rgb(var(--palette-primary))\",\n strokeWidth: \"5\",\n strokeLinecap: \"round\",\n strokeDashoffset: \"0\",\n strokeDasharray: \"100, 200\",\n },\n {\n children: [\n jsxRuntime.jsx(\"animateTransform\", {\n attributeName: \"transform\",\n attributeType: \"XML\",\n type: \"rotate\",\n from: \"0 50 50\",\n to: \"360 50 50\",\n dur: \"4s\",\n repeatCount: \"indefinite\",\n }),\n jsxRuntime.jsx(\"animate\", {\n attributeName: \"stroke-dashoffset\",\n values: \"0;-30;-124\",\n dur: \"2s\",\n repeatCount: \"indefinite\",\n }),\n jsxRuntime.jsx(\"animate\", {\n attributeName: \"stroke-dasharray\",\n values: \"0,200;110,200;110,200\",\n dur: \"2s\",\n repeatCount: \"indefinite\",\n }),\n ],\n }\n )\n ),\n }\n )\n );\n}\n\nvar useComponentOverride = function (overrideKey) {\n var ctx = React.useContext(ComponentOverrideContext);\n if (ctx === \"IS_DEFAULT\") {\n throw new Error(\"Cannot use component override outside ComponentOverrideContext provider.\");\n }\n var OverrideComponent = ctx[overrideKey];\n return OverrideComponent === undefined ? null : OverrideComponent;\n};\n\nvar withOverride = function (overrideKey, DefaultComponent) {\n var finalKey = overrideKey + \"_Override\";\n DefaultComponent.displayName = finalKey;\n return function (props) {\n var OverrideComponent = useComponentOverride(finalKey);\n if (OverrideComponent !== null) {\n return jsxRuntime.jsx(\n OverrideComponent,\n genericComponentOverrideContext.__assign({ DefaultComponent: DefaultComponent }, props)\n );\n }\n return jsxRuntime.jsx(DefaultComponent, genericComponentOverrideContext.__assign({}, props));\n };\n};\n\nvar styles$1 =\n '[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n/*\\n * Default styles.\\n */\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n/* TODO: split the link style into separate things*/\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n';\n\nvar ThemeBase$1 = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles$1, userStyles.join(\"\\n\")] })],\n });\n};\n\nvar MultitenancyDynamicLoginMethodsSpinnerTheme = function () {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container delayedRender\" },\n {\n children: jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"spinner delayedRender\" },\n { children: jsxRuntime.jsx(SpinnerIcon, {}) }\n )\n ),\n }\n )\n ),\n }\n )\n );\n};\nvar DynamicLoginMethodsSpinnerThemeWithOverride = withOverride(\n \"MultitenancyDynamicLoginMethodsSpinnerTheme\",\n MultitenancyDynamicLoginMethodsSpinnerTheme\n);\nvar DynamicLoginMethodsSpinnerTheme = function (props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n ThemeBase$1,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle] },\n { children: jsxRuntime.jsx(DynamicLoginMethodsSpinnerThemeWithOverride, {}) }\n )\n );\n};\n\n// TODO: move this to the root components dir and rename (incl. the override)\n// This is a special \"feature\" component:\n// - it's used inside FeatureWrapper & RoutingComponent (meaning it can't use FeatureWrapper)\n// - it's not used in any specific route (multitenancy doesn't have a pre-built UI)\nvar DynamicLoginMethodsSpinner = function () {\n var recipe = genericComponentOverrideContext.Multitenancy.getInstanceOrThrow();\n var recipeComponentOverrides = componentOverrideContext.useContext();\n return jsxRuntime.jsx(\n ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n WithOrWithoutShadowDom,\n genericComponentOverrideContext.__assign(\n { useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom },\n { children: jsxRuntime.jsx(DynamicLoginMethodsSpinnerTheme, { config: recipe.config }) }\n )\n ),\n }\n )\n );\n};\n\nvar dynamicLoginMethodsContext = React__default.default.createContext(undefined);\nvar useDynamicLoginMethods = function () {\n var value = React__default.default.useContext(dynamicLoginMethodsContext);\n if (value === undefined) {\n throw new Error(\"useDynamicLoginMethods used outside of a valid provider (FeatureWrapper)\");\n }\n return value;\n};\nvar DynamicLoginMethodsProvider = function (_a) {\n var value = _a.value,\n children = _a.children;\n var contextValue = value === undefined ? { loaded: false } : { loaded: true, loginMethods: value };\n return jsxRuntime.jsx(\n dynamicLoginMethodsContext.Provider,\n genericComponentOverrideContext.__assign({ value: contextValue }, { children: children })\n );\n};\n\nvar UserContextContext = React__default.default.createContext(undefined);\nvar useUserContext = function () {\n return React__default.default.useContext(UserContextContext);\n};\nvar UserContextProvider = function (_a) {\n var children = _a.children,\n userContext = _a.userContext;\n var currentUserContext = React.useState(genericComponentOverrideContext.getNormalisedUserContext(userContext))[0];\n return jsxRuntime.jsx(\n UserContextContext.Provider,\n genericComponentOverrideContext.__assign({ value: currentUserContext }, { children: children })\n );\n};\n\nfunction FeatureWrapper(_a) {\n var children = _a.children,\n useShadowDom = _a.useShadowDom,\n defaultStore = _a.defaultStore;\n var userContext = useUserContext();\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var _b = React.useState(undefined),\n loadedDynamicLoginMethods = _b[0],\n setLoadedDynamicLoginMethods = _b[1];\n var st = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow();\n React.useEffect(\n function () {\n if (loadedDynamicLoginMethods) {\n return;\n }\n genericComponentOverrideContext.Multitenancy.getInstanceOrThrow()\n .getCurrentDynamicLoginMethods({ userContext: userContext })\n .then(\n function (loginMethods) {\n return setLoadedDynamicLoginMethods(loginMethods);\n },\n function (err) {\n return rethrowInRender(err);\n }\n );\n },\n [loadedDynamicLoginMethods, setLoadedDynamicLoginMethods]\n );\n if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods && !loadedDynamicLoginMethods) {\n return jsxRuntime.jsx(DynamicLoginMethodsSpinner, {});\n }\n return jsxRuntime.jsx(\n DynamicLoginMethodsProvider,\n genericComponentOverrideContext.__assign(\n { value: loadedDynamicLoginMethods },\n {\n children: jsxRuntime.jsx(\n translationContext.TranslationContextProvider,\n genericComponentOverrideContext.__assign(\n {\n defaultLanguage: st.languageTranslations.defaultLanguage,\n defaultStore: genericComponentOverrideContext.mergeObjects(\n defaultStore,\n st.languageTranslations.userTranslationStore\n ),\n translationControlEventSource: st.languageTranslations.translationEventSource,\n userTranslationFunc: st.languageTranslations.userTranslationFunc,\n },\n {\n children: jsxRuntime.jsx(\n WithOrWithoutShadowDom,\n genericComponentOverrideContext.__assign(\n { useShadowDom: useShadowDom },\n { children: children }\n )\n ),\n }\n )\n ),\n }\n )\n );\n}\nfunction WithShadowDom(_a) {\n var children = _a.children;\n var rootDiv = React.useRef(null);\n var _b = React.useState(),\n shadowRoot = _b[0],\n setShadowRoot = _b[1];\n React.useEffect(\n function () {\n if (rootDiv.current) {\n // defaults from react-shadow\n setShadowRoot(function (os) {\n return (\n os ||\n rootDiv.current.shadowRoot ||\n rootDiv.current.attachShadow({ mode: \"open\", delegatesFocus: false })\n );\n });\n }\n },\n [rootDiv]\n );\n // Otherwise, use shadow dom.\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { id: genericComponentOverrideContext.ST_ROOT_ID, ref: rootDiv },\n { children: shadowRoot && reactDom.createPortal(children, shadowRoot) }\n )\n );\n}\nfunction WithOrWithoutShadowDom(_a) {\n var children = _a.children,\n useShadowDom = _a.useShadowDom;\n // If explicitely specified to not use shadow dom.\n if (useShadowDom === false) {\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { id: genericComponentOverrideContext.ST_ROOT_ID },\n { children: [children, jsxRuntime.jsx(DisableAutoFillInput, {})] }\n )\n );\n }\n return jsxRuntime.jsxs(WithShadowDom, { children: [children, jsxRuntime.jsx(DisableAutoFillInput, {})] });\n}\nfunction DisableAutoFillInput() {\n /* eslint-disable react/jsx-no-literals */\n return jsxRuntime.jsx(\n \"style\",\n genericComponentOverrideContext.__assign(\n { type: \"text/css\" },\n {\n children:\n \"input.supertokens-input:-webkit-autofill,input.supertokens-input:-webkit-autofill:focus,input.supertokens-input:-webkit-autofill:hover,select:-webkit-autofill,select:-webkit-autofill:focus,select:-webkit-autofill:hover,textarea:-webkit-autofill,textarea:-webkit-autofill:focus,textarea:-webkit-autofill:hover{transition:background-color 5000s ease-in-out 0s}\",\n }\n )\n );\n /* eslint-enable react/jsx-no-literals */\n}\n\nvar defaultTranslationsCommon = {\n en: {\n AUTH_PAGE_HEADER_TITLE_SIGN_IN_AND_UP: \"Sign Up / Sign In\",\n AUTH_PAGE_HEADER_TITLE_SIGN_IN: \"Sign In\",\n AUTH_PAGE_HEADER_TITLE_SIGN_UP: \"Sign Up\",\n AUTH_PAGE_HEADER_TITLE_SIGN_IN_UP_TO_APP: \" to continue to \",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_START: \"Not registered yet?\",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_SIGN_UP_LINK: \"Sign Up\",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_END: \"\",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_START: \"Already have an account?\",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_SIGN_IN_LINK: \"Sign In\",\n AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_END: \"\",\n AUTH_PAGE_FOOTER_START: \"By continuing, you agree to our \",\n AUTH_PAGE_FOOTER_TOS: \"Terms of Service\",\n AUTH_PAGE_FOOTER_AND: \" and \",\n AUTH_PAGE_FOOTER_PP: \"Privacy Policy\",\n AUTH_PAGE_FOOTER_END: \"\",\n DIVIDER_OR: \"or\",\n BRANDING_POWERED_BY_START: \"Powered by \",\n BRANDING_POWERED_BY_END: \"\",\n SOMETHING_WENT_WRONG_ERROR: \"Something went wrong. Please try again.\",\n SOMETHING_WENT_WRONG_ERROR_RELOAD: \"Something went wrong. Please try again later or reload the page.\",\n },\n};\n\nvar SessionContext = React__default.default.createContext({\n loading: true,\n isDefault: true,\n});\n\nvar useSessionContext = function () {\n var ctx = React__default.default.useContext(SessionContext);\n if (ctx.isDefault === true) {\n throw new Error(\"Cannot use useSessionContext outside auth wrapper components.\");\n }\n return ctx;\n};\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nfunction SuperTokensBranding() {\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(\n \"a\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"superTokensBranding\",\n href: \"https://supertokens.com?utm_campaign=poweredby\",\n target: \"_blank\",\n },\n {\n children: [\n t(\"BRANDING_POWERED_BY_START\"),\n jsxRuntime.jsx(\"strong\", { children: \"SuperTokens\" }),\n t(\"BRANDING_POWERED_BY_END\"),\n ],\n }\n )\n );\n}\n\nfunction UserContextWrapper(props) {\n /**\n * If we receive a userContext as a props we should assume that the user\n * is either trying to use a theme component as standalone or that they\n * want to override an existing value for userContext.\n *\n * In this case we should always return a Provider with the value of userContext\n */\n if (props.userContext !== undefined) {\n return jsxRuntime.jsx(\n UserContextProvider,\n genericComponentOverrideContext.__assign({ userContext: props.userContext }, { children: props.children })\n );\n }\n return jsxRuntime.jsx(UserContextContext.Consumer, {\n children: function (value) {\n /**\n * value is undefined only if there is no Provider in the tree. In this case it is safe to\n * assume that the theme component is not being rendered by the SDK and that the user is not\n * using this as a child of one of the pre-built feature components.\n *\n * In this case we return a provider so that the userContext hook can be used by the children\n * of this theme component\n */\n if (value === undefined) {\n return jsxRuntime.jsx(UserContextProvider, { children: props.children });\n }\n /**\n * If value is not undefined then a provider exists in the tree. This means that this component\n * is either being rendered by the SDK or the user has added it as a child of the pre-built\n * feature components. In either case the userContext hook will be available so simply\n * return the theme component.\n */\n return props.children;\n },\n });\n}\n\nfunction GeneralError(_a) {\n var error = _a.error;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign({ \"data-supertokens\": \"generalError\" }, { children: t(error) })\n );\n}\n\nvar styles =\n '[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n/*\\n * Default styles.\\n */\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n/* TODO: split the link style into separate things*/\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n';\n\nvar ThemeBase = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles, userStyles.join(\"\\n\")] })],\n });\n};\n\nvar AuthPageComponentList = withOverride(\"AuthPageComponentList\", function AuthPageComponentList(props) {\n var t = translationContext.useTranslation();\n var list = [props.authComponents[0]];\n var _loop_1 = function (i) {\n list.push(function () {\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"dividerWithOr\" },\n {\n children: [\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"dividerText\" },\n { children: t(\"DIVIDER_OR\") }\n )\n ),\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n ],\n }\n ),\n \"divider-\".concat(i)\n );\n });\n list.push(props.authComponents[i]);\n };\n for (var i = 1; i < props.authComponents.length; ++i) {\n _loop_1(i);\n }\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"authComponentList\" },\n {\n children: list.map(function (i) {\n return i(genericComponentOverrideContext.__assign({}, props));\n }),\n }\n )\n );\n});\n\nvar AuthPageFooter = withOverride(\"AuthPageFooter\", function AuthPageFooter(_a) {\n var hasSeparateSignUpView = _a.hasSeparateSignUpView,\n isSignUp = _a.isSignUp,\n termsOfServiceLink = _a.termsOfServiceLink,\n privacyPolicyLink = _a.privacyPolicyLink;\n var t = translationContext.useTranslation();\n if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) {\n return null;\n }\n if (hasSeparateSignUpView && !isSignUp) {\n return null;\n }\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"secondaryText privacyPolicyAndTermsAndConditions\" },\n {\n children: [\n t(\"AUTH_PAGE_FOOTER_START\"),\n termsOfServiceLink !== undefined &&\n jsxRuntime.jsx(\n \"a\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"link\",\n href: termsOfServiceLink,\n target: \"_blank\",\n rel: \"noopener noreferer\",\n },\n { children: t(\"AUTH_PAGE_FOOTER_TOS\") }\n )\n ),\n termsOfServiceLink !== undefined && privacyPolicyLink !== undefined && t(\"AUTH_PAGE_FOOTER_AND\"),\n privacyPolicyLink !== undefined &&\n jsxRuntime.jsx(\n \"a\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"link\",\n href: privacyPolicyLink,\n target: \"_blank\",\n rel: \"noopener noreferer\",\n },\n { children: t(\"AUTH_PAGE_FOOTER_PP\") }\n )\n ),\n t(\"AUTH_PAGE_FOOTER_END\"),\n ],\n }\n )\n );\n});\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction HeavyArrowLeftIcon(_a) {\n var color = _a.color;\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"16\",\n height: \"13\",\n viewBox: \"0 0 16 13\",\n \"data-supertokens\": \"heavyArrowLeftIcon\",\n },\n {\n children: jsxRuntime.jsx(\"path\", {\n fill: color,\n d: \"M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z\",\n transform: \"translate(1.182 .708)\",\n }),\n }\n )\n );\n}\n\n/*\n * Component.\n */\nfunction BackButton(_a) {\n var onClick = _a.onClick;\n return jsxRuntime.jsx(\n \"button\",\n genericComponentOverrideContext.__assign(\n { onClick: onClick, \"data-supertokens\": \"backButton backButtonCommon\" },\n { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: \"rgb(var(--palette-textTitle))\" }) }\n )\n );\n}\n\nvar AuthPageHeader = withOverride(\"AuthPageHeader\", function AuthPageHeader(_a) {\n var onSignInUpSwitcherClick = _a.onSignInUpSwitcherClick,\n hasSeparateSignUpView = _a.hasSeparateSignUpView,\n isSignUp = _a.isSignUp,\n showBackButton = _a.showBackButton,\n resetFactorList = _a.resetFactorList,\n oauth2ClientInfo = _a.oauth2ClientInfo;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(React.Fragment, {\n children: [\n (oauth2ClientInfo === null || oauth2ClientInfo === void 0 ? void 0 : oauth2ClientInfo.logoUri) &&\n jsxRuntime.jsx(\"img\", {\n src: oauth2ClientInfo.logoUri,\n alt: oauth2ClientInfo.clientName,\n \"data-supertokens\": \"authPageTitleOAuthClientLogo\",\n }),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle withBackButton\" },\n {\n children: [\n showBackButton\n ? jsxRuntime.jsx(BackButton, { onClick: resetFactorList })\n : jsxRuntime.jsx(\"span\", {\n \"data-supertokens\": \"backButtonPlaceholder backButtonCommon\",\n }),\n !hasSeparateSignUpView\n ? t(\"AUTH_PAGE_HEADER_TITLE_SIGN_IN_AND_UP\")\n : isSignUp\n ? t(\"AUTH_PAGE_HEADER_TITLE_SIGN_UP\")\n : t(\"AUTH_PAGE_HEADER_TITLE_SIGN_IN\"),\n jsxRuntime.jsx(\"span\", { \"data-supertokens\": \"backButtonPlaceholder backButtonCommon\" }),\n ],\n }\n )\n ),\n oauth2ClientInfo &&\n oauth2ClientInfo.clientName !== undefined &&\n oauth2ClientInfo.clientName.length > 0 &&\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"authPageTitleOAuthClient\" },\n {\n children: [\n t(\"AUTH_PAGE_HEADER_TITLE_SIGN_IN_UP_TO_APP\"),\n oauth2ClientInfo.clientUri !== undefined\n ? jsxRuntime.jsx(\n \"a\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"authPageTitleOAuthClientUrl link\",\n href: oauth2ClientInfo.clientUri,\n },\n { children: oauth2ClientInfo.clientName }\n )\n )\n : jsxRuntime.jsx(\n \"span\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"authPageTitleOAuthClientName\" },\n { children: oauth2ClientInfo.clientName }\n )\n ),\n ],\n }\n )\n ),\n hasSeparateSignUpView &&\n (!isSignUp\n ? jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n {\n children: [\n t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_START\"),\n jsxRuntime.jsx(\n \"span\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"link\", onClick: onSignInUpSwitcherClick },\n { children: t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_SIGN_UP_LINK\") }\n )\n ),\n t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_IN_END\"),\n ],\n }\n )\n )\n : jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n {\n children: [\n t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_START\"),\n jsxRuntime.jsx(\n \"span\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"link\", onClick: onSignInUpSwitcherClick },\n { children: t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_SIGN_IN_LINK\") }\n )\n ),\n t(\"AUTH_PAGE_HEADER_SUBTITLE_SIGN_UP_END\"),\n ],\n }\n )\n )),\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n ],\n });\n});\n\nfunction AuthPageTheme(props) {\n if (props.fullPageCompWithPreloadedInfo) {\n return jsxRuntime.jsx(jsxRuntime.Fragment, {\n children: props.fullPageCompWithPreloadedInfo.component(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, props), {\n preloadInfo: props.fullPageCompWithPreloadedInfo.preloadInfo,\n })\n ),\n });\n }\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"container authPage \".concat(\n props.factorIds.length > 1 ? \"multiFactor\" : \"singleFactor\"\n ),\n },\n {\n children: [\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n jsxRuntime.jsx(AuthPageHeader, {\n factorIds: props.factorIds,\n isSignUp: props.isSignUp,\n onSignInUpSwitcherClick: props.onSignInUpSwitcherClick,\n hasSeparateSignUpView: props.hasSeparateSignUpView,\n resetFactorList: props.resetFactorList,\n showBackButton: props.showBackButton,\n oauth2ClientInfo: props.oauth2ClientInfo,\n }),\n props.error !== undefined && jsxRuntime.jsx(GeneralError, { error: props.error }),\n jsxRuntime.jsx(\n AuthPageComponentList,\n genericComponentOverrideContext.__assign({}, props)\n ),\n jsxRuntime.jsx(AuthPageFooter, {\n factorIds: props.factorIds,\n isSignUp: props.isSignUp,\n hasSeparateSignUpView: props.hasSeparateSignUpView,\n privacyPolicyLink: props.privacyPolicyLink,\n termsOfServiceLink: props.termsOfServiceLink,\n }),\n ],\n }\n )\n ),\n jsxRuntime.jsx(SuperTokensBranding, {}),\n ],\n }\n )\n );\n}\nfunction AuthPageThemeWrapper(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle] },\n { children: jsxRuntime.jsx(AuthPageTheme, genericComponentOverrideContext.__assign({}, props)) }\n )\n ),\n }\n )\n );\n}\n\nvar errorQSMap = {\n signin: \"SOMETHING_WENT_WRONG_ERROR\",\n no_email_present: \"THIRD_PARTY_ERROR_NO_EMAIL\",\n restart_link: \"ERROR_SIGN_IN_UP_LINK\",\n};\nvar AuthPageWrapper = function (props) {\n var authRecipeComponentOverrides = useContext();\n return jsxRuntime.jsx(\n UserContextProvider,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n SessionAuthWrapper,\n genericComponentOverrideContext.__assign(\n { requireAuth: false, doRedirection: false },\n {\n children: jsxRuntime.jsx(\n ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: authRecipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n AuthPageInner,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n ),\n }\n )\n ),\n }\n )\n );\n};\nvar AuthPageInner = function (props) {\n var _a, _b, _c, _d, _e;\n if (props.factors !== undefined && props.factors.length === 0) {\n throw new Error(\"The factors array cannot be empty\");\n }\n var windowHandler$1 = windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler;\n var search = new URLSearchParams(windowHandler$1.location.getSearch());\n var showStringFromQS = search.get(\"show\");\n var isSignUpFromQS =\n props.useSignUpStateFromQueryString !== true || showStringFromQS === null\n ? undefined\n : showStringFromQS === \"signup\";\n var errorFromQS =\n search.get(\"error\") !== null\n ? (_b = (_a = search.get(\"message\")) !== null && _a !== void 0 ? _a : search.get(\"error\")) !== null &&\n _b !== void 0\n ? _b\n : undefined\n : undefined;\n errorFromQS =\n errorFromQS !== undefined\n ? (_c = errorQSMap[errorFromQS]) !== null && _c !== void 0\n ? _c\n : errorFromQS\n : undefined;\n var showStringFromQSRef = React.useRef(showStringFromQS);\n var errorFromQSRef = React.useRef(errorFromQS);\n var loginChallenge = search.get(\"loginChallenge\");\n var forceFreshAuth = search.get(\"forceFreshAuth\") === \"true\";\n var sessionContext = useSessionContext();\n var userContext = useUserContext();\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var _f = React.useState(undefined),\n loadedDynamicLoginMethods = _f[0],\n setLoadedDynamicLoginMethods = _f[1];\n var _g = React.useState(undefined),\n oauth2ClientInfo = _g[0],\n setOAuth2ClientInfo = _g[1];\n var _h = React.useState(errorFromQS),\n error = _h[0],\n setError = _h[1];\n var _j = React.useState(false),\n sessionLoadedAndNotRedirecting = _j[0],\n setSessionLoadedAndNotRedirecting = _j[1];\n var st = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow();\n var _k = React.useState(props.factors),\n factorList = _k[0],\n setFactorList = _k[1];\n var _l = React.useState(\n (_e = (_d = props.isSignUp) !== null && _d !== void 0 ? _d : isSignUpFromQS) !== null && _e !== void 0\n ? _e\n : st.defaultToSignUp\n ),\n isSignUp = _l[0],\n setIsSignUp = _l[1];\n // We use this to signal that we need to update the components we show on screen\n var _m = React.useState(0),\n rebuildReqCount = _m[0],\n setRebuildReqCount = _m[1];\n var lastBuild = React.useRef({ buildReq: undefined });\n React.useEffect(function () {\n if (props.useSignUpStateFromQueryString && showStringFromQSRef.current !== showStringFromQS) {\n var isSignUpFromQS_1 =\n props.useSignUpStateFromQueryString !== true || showStringFromQS === null\n ? undefined\n : showStringFromQS === \"signup\";\n showStringFromQSRef.current = showStringFromQS;\n var newIsSignUpVal =\n isSignUpFromQS_1 !== null && isSignUpFromQS_1 !== void 0 ? isSignUpFromQS_1 : st.defaultToSignUp;\n if (isSignUp !== newIsSignUpVal) {\n setIsSignUp(newIsSignUpVal);\n setRebuildReqCount(function (v) {\n return v + 1;\n });\n }\n }\n });\n React.useEffect(function () {\n if (errorFromQSRef.current !== errorFromQS) {\n errorFromQSRef.current = errorFromQS;\n setError(errorFromQS);\n }\n });\n var onSignInUpSwitcherClick = React.useCallback(\n function () {\n if (props.useSignUpStateFromQueryString === true) {\n genericComponentOverrideContext.updateQueryParam(\"show\", isSignUp ? \"signin\" : \"signup\");\n }\n setError(undefined);\n setIsSignUp(!isSignUp);\n setRebuildReqCount(function (v) {\n return v + 1;\n });\n },\n [isSignUp, setIsSignUp, setRebuildReqCount, setError, props.useSignUpStateFromQueryString]\n );\n React.useEffect(\n function () {\n if (loadedDynamicLoginMethods) {\n return;\n }\n genericComponentOverrideContext.Multitenancy.getInstanceOrThrow()\n .getCurrentDynamicLoginMethods({ userContext: userContext })\n .then(\n function (loginMethods) {\n return setLoadedDynamicLoginMethods(loginMethods);\n },\n function (err) {\n return rethrowInRender(err);\n }\n );\n },\n [loadedDynamicLoginMethods, setLoadedDynamicLoginMethods]\n );\n genericComponentOverrideContext.useOnMountAPICall(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var oauth2Recipe;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (oauth2ClientInfo) {\n return [2 /*return*/];\n }\n oauth2Recipe = recipe.OAuth2Provider.getInstance();\n if (oauth2Recipe !== undefined && loginChallenge !== null) {\n return [\n 2 /*return*/,\n oauth2Recipe.webJSRecipe.getLoginChallengeInfo({\n loginChallenge: loginChallenge,\n userContext: userContext,\n }),\n ];\n }\n return [2 /*return*/, undefined];\n });\n });\n },\n function (info) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (info !== undefined) {\n if (info.status === \"OK\") {\n setOAuth2ClientInfo(info.info);\n } else {\n setError(\"SOMETHING_WENT_WRONG_ERROR\");\n }\n }\n return [2 /*return*/];\n });\n });\n },\n function () {\n genericComponentOverrideContext.clearQueryParams([\"loginChallenge\"]);\n setError(\"SOMETHING_WENT_WRONG_ERROR\");\n }\n );\n React.useEffect(\n function () {\n if (sessionLoadedAndNotRedirecting) {\n return;\n }\n // we want to do this just once, so we supply it with only the loading state.\n // if we supply it with props, sessionContext, then once the user signs in, then this will route the\n // user to the dashboard, as opposed to the sign up / sign in functions.\n if (sessionContext.loading === false) {\n if (sessionContext.doesSessionExist) {\n if (props.onSessionAlreadyExists !== undefined) {\n props.onSessionAlreadyExists();\n } else if (props.redirectOnSessionExists !== false && !forceFreshAuth) {\n types.Session.getInstanceOrThrow().config.onHandleEvent({\n action: \"SESSION_ALREADY_EXISTS\",\n });\n var oauth2Recipe_1 = recipe.OAuth2Provider.getInstance();\n if (loginChallenge !== null && oauth2Recipe_1 !== undefined) {\n (function () {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var frontendRedirectTo;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n oauth2Recipe_1.webJSRecipe.getRedirectURLToContinueOAuthFlow({\n loginChallenge: loginChallenge,\n userContext: userContext,\n }),\n ];\n case 1:\n frontendRedirectTo = _a.sent().frontendRedirectTo;\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection(\n {\n // We get here if the user was redirected to the auth screen with an already existing session\n // and a loginChallenge (we check the forceFreshAuth queryparam above)\n action: \"SUCCESS_OAUTH2\",\n frontendRedirectTo: frontendRedirectTo,\n // We can use these defaults, since this is not the result of a sign in/up call\n createdNewUser: false,\n isNewRecipeUser: false,\n newSessionCreated: false,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n recipeId: types.Session.RECIPE_ID,\n },\n types.Session.RECIPE_ID,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n props.navigate\n ),\n ];\n }\n });\n });\n })().catch(rethrowInRender);\n } else {\n void types.Session.getInstanceOrThrow()\n .validateGlobalClaimsAndHandleSuccessRedirection(\n undefined,\n types.Session.RECIPE_ID,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n props.navigate\n )\n .catch(rethrowInRender);\n }\n } else {\n setSessionLoadedAndNotRedirecting(true);\n }\n } else {\n setSessionLoadedAndNotRedirecting(true);\n }\n }\n },\n [sessionContext.loading]\n );\n var _o = React.useState(),\n authComponentListInfo = _o[0],\n setAuthComponentListInfo = _o[1];\n var showUseAnotherLink =\n factorList !== undefined &&\n (props.factors === undefined ||\n props.factors.some(function (id) {\n return !factorList.includes(id);\n }));\n var stInstance = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow();\n var privacyPolicyLink = stInstance.privacyPolicyLink;\n var termsOfServiceLink = stInstance.termsOfServiceLink;\n React.useEffect(\n function () {\n var abortCtl = new AbortController();\n if (lastBuild.current.buildReq === rebuildReqCount) {\n return;\n }\n if (\n sessionLoadedAndNotRedirecting &&\n (loadedDynamicLoginMethods !== undefined ||\n !genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods)\n ) {\n void buildAndSetChildProps(\n props.preBuiltUIList,\n loadedDynamicLoginMethods,\n userContext,\n factorList,\n isSignUp,\n setAuthComponentListInfo,\n abortCtl.signal\n ).then(function () {\n lastBuild.current.buildReq = rebuildReqCount;\n }, rethrowInRender);\n }\n return function () {\n abortCtl.abort();\n };\n },\n [\n sessionLoadedAndNotRedirecting,\n rebuildReqCount,\n setRebuildReqCount,\n props.preBuiltUIList,\n loadedDynamicLoginMethods,\n userContext,\n factorList,\n isSignUp,\n setAuthComponentListInfo,\n rethrowInRender,\n ]\n );\n var onAuthSuccess = React.useCallback(\n function (ctx) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var oauth2Recipe, frontendRedirectTo;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n oauth2Recipe = recipe.OAuth2Provider.getInstance();\n if (loginChallenge === null || oauth2Recipe === undefined) {\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, ctx),\n {\n action: \"SUCCESS\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n redirectToPath:\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n }\n ),\n ctx.recipeId,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n props.navigate\n ),\n ];\n }\n return [\n 4 /*yield*/,\n oauth2Recipe.webJSRecipe.getRedirectURLToContinueOAuthFlow({\n loginChallenge: loginChallenge,\n userContext: userContext,\n }),\n ];\n case 1:\n frontendRedirectTo = _a.sent().frontendRedirectTo;\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, ctx),\n {\n action: \"SUCCESS_OAUTH2\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n frontendRedirectTo: frontendRedirectTo,\n }\n ),\n ctx.recipeId,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n props.navigate\n ),\n ];\n }\n });\n });\n },\n [loginChallenge]\n );\n var childProps =\n authComponentListInfo !== undefined &&\n (loginChallenge === null || oauth2ClientInfo !== undefined || recipe.OAuth2Provider.getInstance() === undefined)\n ? genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, authComponentListInfo),\n {\n oauth2ClientInfo: oauth2ClientInfo,\n onAuthSuccess: onAuthSuccess,\n error: error,\n onError: function (err) {\n setError(err);\n },\n clearError: function () {\n return setError(undefined);\n },\n navigate: props.navigate,\n onSignInUpSwitcherClick: onSignInUpSwitcherClick,\n privacyPolicyLink: privacyPolicyLink,\n rebuildAuthPage: function () {\n return setRebuildReqCount(function (v) {\n return v + 1;\n });\n },\n setFactorList: function (factorIds) {\n setFactorList(factorIds);\n setRebuildReqCount(function (v) {\n return v + 1;\n });\n },\n resetFactorList: function () {\n setFactorList(props.factors);\n setRebuildReqCount(function (v) {\n return v + 1;\n });\n },\n showBackButton: showUseAnotherLink,\n termsOfServiceLink: termsOfServiceLink,\n userContext: userContext,\n }\n )\n : undefined;\n var mergedTranslations = React.useMemo(\n function () {\n var res = defaultTranslationsCommon;\n if (authComponentListInfo !== undefined) {\n for (var _i = 0, _a = props.preBuiltUIList; _i < _a.length; _i++) {\n var ui = _a[_i];\n res = genericComponentOverrideContext.mergeObjects(res, ui.languageTranslations);\n }\n }\n res = genericComponentOverrideContext.mergeObjects(res, st.languageTranslations.userTranslationStore);\n return res;\n },\n [st.languageTranslations.userTranslationStore, authComponentListInfo]\n );\n if (childProps === undefined) {\n return jsxRuntime.jsx(DynamicLoginMethodsSpinner, {});\n } else {\n return jsxRuntime.jsx(\n DynamicLoginMethodsProvider,\n genericComponentOverrideContext.__assign(\n { value: loadedDynamicLoginMethods },\n {\n children: jsxRuntime.jsx(\n translationContext.TranslationContextProvider,\n genericComponentOverrideContext.__assign(\n {\n defaultLanguage: st.languageTranslations.defaultLanguage,\n defaultStore: mergedTranslations,\n translationControlEventSource: st.languageTranslations.translationEventSource,\n userTranslationFunc: st.languageTranslations.userTranslationFunc,\n },\n {\n children: jsxRuntime.jsx(\n WithOrWithoutShadowDom,\n genericComponentOverrideContext.__assign(\n { useShadowDom: st.useShadowDom },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n AuthPageThemeWrapper,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__default.default.Children.map(\n props.children,\n function (child) {\n if (React__default.default.isValidElement(child)) {\n return React__default.default.cloneElement(\n child,\n childProps\n );\n }\n return child;\n }\n ),\n ],\n }),\n }\n )\n ),\n }\n )\n ),\n }\n )\n );\n }\n};\nfunction buildAndSetChildProps(\n recipeRouters,\n loadedDynamicLoginMethods,\n userContext,\n factorListState,\n isSignUpState,\n setComponentListInfo,\n abort\n) {\n var _a, _b, _c, _d, _e;\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var authRecipesInited,\n firstFactors,\n missingPreBuiltUIs,\n thirdPartyPreBuiltUI,\n hasSeparateSignUpView,\n isSignUp,\n authComps,\n _i,\n recipeRouters_1,\n ui,\n _f,\n authComps_1,\n a,\n preloadRes,\n partialAuthComps,\n selectedComponents,\n availableFactors,\n _g,\n partialAuthComps_1,\n comp,\n _h,\n _j,\n id,\n source;\n return genericComponentOverrideContext.__generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n authRecipesInited =\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().recipeList.filter(function (\n recipe\n ) {\n return \"firstFactorIds\" in recipe;\n });\n firstFactors =\n (_c =\n (_a =\n factorListState !== null && factorListState !== void 0\n ? factorListState\n : loadedDynamicLoginMethods === null || loadedDynamicLoginMethods === void 0\n ? void 0\n : loadedDynamicLoginMethods.firstFactors) !== null && _a !== void 0\n ? _a\n : (_b = recipe$1.MultiFactorAuth.getInstance()) === null || _b === void 0\n ? void 0\n : _b.config.firstFactors) !== null && _c !== void 0\n ? _c\n : authRecipesInited.reduce(function (acc, recipe) {\n return genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray([], acc, true),\n recipe.getFirstFactorsForAuthPage(),\n true\n );\n }, []);\n if (\n factorListState === undefined &&\n (loadedDynamicLoginMethods === null || loadedDynamicLoginMethods === void 0\n ? void 0\n : loadedDynamicLoginMethods.firstFactors) === undefined &&\n ((_d = recipe$1.MultiFactorAuth.getInstance()) === null || _d === void 0\n ? void 0\n : _d.config.firstFactors) === undefined\n ) {\n missingPreBuiltUIs = authRecipesInited.filter(function (recipe) {\n return !recipeRouters.some(function (router) {\n return router.recipeInstance.recipeID === recipe.recipeID;\n });\n });\n if (missingPreBuiltUIs.length > 0) {\n // In this case we'd most likely throw anyway (except in the case of EP+Pwless), but we want to provide a better error message\n throw new Error(\n \"Factor list not set but PreBuiltUI not added for \".concat(\n missingPreBuiltUIs.map(function (r) {\n return r.recipeID;\n })\n )\n );\n }\n }\n if (firstFactors.length === 0) {\n throw new Error(\"There are no enabled factors to show\");\n }\n if (firstFactors.includes(types.FactorIds.THIRDPARTY)) {\n thirdPartyPreBuiltUI = recipeRouters.find(function (r) {\n return r.recipeInstance.recipeID === types.FactorIds.THIRDPARTY;\n });\n // here we ignore if we couldn't find the necessary prebuilt UI, because we want to throw in the standard location\n if (thirdPartyPreBuiltUI !== undefined) {\n // We remove the thirdparty factor if:\n // We have no provider defined on the client side and\n // We have no provider defined for the tenant either\n if (\n thirdPartyPreBuiltUI.recipeInstance.config.signInAndUpFeature.providers.length === 0 &&\n (!genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods ||\n loadedDynamicLoginMethods.thirdparty.providers.length === 0)\n ) {\n firstFactors = firstFactors.filter(function (f) {\n return f !== types.FactorIds.THIRDPARTY;\n });\n if (firstFactors.length === 0) {\n throw new Error(\n \"The only enabled first factor is thirdparty, but no providers were defined. Please define at least one provider.\"\n );\n }\n }\n }\n }\n hasSeparateSignUpView = recipeRouters.some(function (ui) {\n return (\n ui.requiresSignUpPage &&\n ui.recipeInstance.firstFactorIds.some(function (id) {\n return firstFactors.includes(id);\n })\n );\n });\n isSignUp = hasSeparateSignUpView && isSignUpState;\n authComps = [];\n for (_i = 0, recipeRouters_1 = recipeRouters; _i < recipeRouters_1.length; _i++) {\n ui = recipeRouters_1[_i];\n authComps.push.apply(authComps, ui.getAuthComponents());\n }\n (_f = 0), (authComps_1 = authComps);\n _k.label = 1;\n case 1:\n if (!(_f < authComps_1.length)) return [3 /*break*/, 4];\n a = authComps_1[_f];\n if (!(a.type === \"FULL_PAGE\")) return [3 /*break*/, 3];\n return [4 /*yield*/, a.preloadInfoAndRunChecks(firstFactors, userContext)];\n case 2:\n preloadRes = _k.sent();\n // We skip setting if the auth page unmounted while we were checking\n // if we should show any full page comps\n if (abort.aborted) {\n return [2 /*return*/];\n }\n if (preloadRes.shouldDisplay) {\n setComponentListInfo({\n authComponents: [],\n fullPageCompWithPreloadedInfo: {\n component: a.component,\n preloadInfo: preloadRes.preloadInfo,\n },\n isSignUp: isSignUp,\n hasSeparateSignUpView: hasSeparateSignUpView,\n factorIds: firstFactors,\n });\n return [2 /*return*/];\n }\n _k.label = 3;\n case 3:\n _f++;\n return [3 /*break*/, 1];\n case 4:\n if (abort.aborted) {\n // We stop if the auth page unmounted while we were checking if we should show any full page comps\n return [2 /*return*/];\n }\n partialAuthComps = authComps.filter(function (c) {\n return (\n c.type !== \"FULL_PAGE\" &&\n c.factorIds.every(function (id) {\n return firstFactors.includes(id);\n })\n );\n });\n partialAuthComps = partialAuthComps.filter(\n function (c) {\n return (\n c.type === \"SIGN_IN_UP\" || // sign in+up components show in all cases\n (isSignUp ? c.type === \"SIGN_UP\" : c.type === \"SIGN_IN\")\n );\n } // otherwise we check if the sign up state is appropriate\n );\n // We sort the auth components by the number of factors they cover, DESC\n // This helps us choose combination components (ep+pwless) first\n partialAuthComps.sort(function (a, b) {\n return b.factorIds.length - a.factorIds.length;\n });\n selectedComponents = utils.selectComponentsToCoverAllFirstFactors(partialAuthComps, firstFactors);\n if (selectedComponents === undefined) {\n availableFactors = new Set();\n for (_g = 0, partialAuthComps_1 = partialAuthComps; _g < partialAuthComps_1.length; _g++) {\n comp = partialAuthComps_1[_g];\n for (_h = 0, _j = comp.factorIds; _h < _j.length; _h++) {\n id = _j[_h];\n availableFactors.add(id);\n }\n }\n source =\n factorListState !== undefined\n ? \"local state or props\"\n : (loadedDynamicLoginMethods === null || loadedDynamicLoginMethods === void 0\n ? void 0\n : loadedDynamicLoginMethods.firstFactors) !== undefined\n ? \"dynamic tenant configuration\"\n : ((_e = recipe$1.MultiFactorAuth.getInstance()) === null || _e === void 0\n ? void 0\n : _e.config.firstFactors) !== undefined\n ? \"the config passed to the MFA recipe\"\n : \"all recipes initialized\";\n throw new Error(\n \"Couldn't cover all first factors: \"\n .concat(firstFactors.join(\", \"), \" (from \")\n .concat(source, \"), available components: \")\n .concat(Array.from(availableFactors).join(\", \"), \".\\n\") +\n \"You may have missed adding a recipe into the list of prebuiltUIs passed to list of prebuiltUIs passed to getSuperTokensRoutesForReactRouterDom, canHandleRoute, handleRoute functions or the AuthPage component.\\n\" +\n \"Another common error is adding a non-existent factor id into the list, e.g.: passwordless instead of otp-email/phone\"\n );\n }\n setComponentListInfo({\n authComponents: selectedComponents\n .sort(function (a, b) {\n return a.displayOrder - b.displayOrder;\n })\n .map(function (w) {\n return w.component;\n }),\n factorIds: firstFactors,\n hasSeparateSignUpView: hasSeparateSignUpView,\n isSignUp: isSignUp,\n });\n return [2 /*return*/];\n }\n });\n });\n}\n\n// The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006\nvar priorityOrder = [\n {\n rid: \"thirdpartyemailpassword\",\n includes: [\"thirdparty\", \"emailpassword\"],\n factorsProvided: [types.FactorIds.THIRDPARTY, types.FactorIds.EMAILPASSWORD],\n },\n {\n rid: \"thirdpartypasswordless\",\n includes: [\"thirdparty\", \"passwordless\"],\n factorsProvided: [\n types.FactorIds.THIRDPARTY,\n types.FactorIds.OTP_PHONE,\n types.FactorIds.OTP_EMAIL,\n types.FactorIds.LINK_PHONE,\n types.FactorIds.LINK_EMAIL,\n ],\n },\n { rid: \"emailpassword\", includes: [\"emailpassword\"], factorsProvided: [types.FactorIds.EMAILPASSWORD] },\n {\n rid: \"passwordless\",\n includes: [\"passwordless\"],\n factorsProvided: [\n types.FactorIds.OTP_PHONE,\n types.FactorIds.OTP_EMAIL,\n types.FactorIds.LINK_PHONE,\n types.FactorIds.LINK_EMAIL,\n ],\n },\n { rid: \"thirdparty\", includes: [\"thirdparty\"], factorsProvided: [types.FactorIds.THIRDPARTY] },\n];\nfunction chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) {\n var fallbackRid;\n var fallbackComponent;\n var _loop_1 = function (rid, factorsProvided) {\n if (\n firstFactors.every(function (factor) {\n return factorsProvided.includes(factor);\n })\n ) {\n var matchingComp = routeComponents.find(function (comp) {\n return comp.recipeID === rid;\n });\n if (matchingComp) {\n fallbackRid = rid;\n fallbackComponent = matchingComp;\n if (firstFactors.length === factorsProvided.length) {\n genericComponentOverrideContext.logDebugMessage(\n \"Rendering \".concat(rid, \" because it matches factors: \").concat(firstFactors, \" exactly\")\n );\n return { value: matchingComp };\n }\n }\n }\n };\n // We first try to find an exact match, and fall back on something that covers all factors (but maybe more)\n /*\n Examples:\n 1. firstFactors: emailpassword, route components from: thirdparty ->\n - no matches found, throwing error\n\n 2. firstFactors: emailpassword, route components from: thirdpartyemailpassword ->\n - we find thirdpartyemailpassword covers all first factors, save it as fallback\n - we check all other recipes, bot nothing else has matching components\n - return fallback from TPEP\n\n 3. firstFactors: emailpassword, route components from: thirdpartyemailpassword, emailpassword ->\n - we find thirdpartyemailpassword covers all first factors, save it as fallback\n - we find emailpassword as an exact match and return it\n\n 4. firstFactors: otp-phone, route components from: thirdpartypasswordless, passwordless, thirdparty ->\n - we find thirdpartypasswordless covers all first factors (but more), save it as fallback\n - we find passwordless that covers all factors (but more), saving it as a fallback.\n Keep in mind, that the passwordless and thirdpartypasswordless recipe provides 4 factors, so this is not an exact match.\n - no other recipes have matching components, so we return the fallback from passwordless\n\n 5. firstFactors: thirdparty, otp-phone, route components from: thirdpartypasswordless, passwordless, thirdparty ->\n - we find thirdpartypasswordless covers all first factors (but more), save it as fallback\n this is not an exact match, because thirdpartypasswordless provides multiple passwordless factors.\n - no other recipes cover all factors, so we return the fallback from thirdpartypasswordless\n */\n for (var _i = 0, priorityOrder_1 = priorityOrder; _i < priorityOrder_1.length; _i++) {\n var _a = priorityOrder_1[_i],\n rid = _a.rid,\n factorsProvided = _a.factorsProvided;\n var state_1 = _loop_1(rid, factorsProvided);\n if (typeof state_1 === \"object\") return state_1.value;\n }\n if (fallbackComponent !== undefined) {\n genericComponentOverrideContext.logDebugMessage(\n \"Rendering \".concat(fallbackRid, \" to cover \").concat(firstFactors, \" as a fallback\")\n );\n return fallbackComponent;\n }\n // We may get here if:\n // - The backend/tenantconfig is older and didn't have the firstFactors array defined\n // - There is a configuration error\n // We choose not to throw in the configuration error case because:\n // - we can't tell these cases apart after the firstFactors array was made a requrired prop\n // - we want to maintain backwards compatbility\n // Here we replicate the old logic we had before the firstFactors array\n var enabledLoginMethods = [];\n if (firstFactors.includes(types.FactorIds.EMAILPASSWORD)) {\n enabledLoginMethods.push(\"emailpassword\");\n }\n if (firstFactors.includes(types.FactorIds.THIRDPARTY)) {\n enabledLoginMethods.push(\"thirdparty\");\n }\n if (\n [\n types.FactorIds.OTP_PHONE,\n types.FactorIds.OTP_EMAIL,\n types.FactorIds.LINK_PHONE,\n types.FactorIds.LINK_EMAIL,\n ].some(function (pwlessFactorId) {\n return firstFactors.includes(pwlessFactorId);\n })\n ) {\n enabledLoginMethods.push(\"passwordless\");\n }\n genericComponentOverrideContext.logDebugMessage(\n \"Choosing component using fallback logic w/ \".concat(enabledLoginMethods.join(\", \"), \" enabled\")\n );\n var enabledRecipeCount = enabledLoginMethods.length;\n var _loop_2 = function (rid, includes) {\n if (\n enabledRecipeCount === includes.length &&\n includes.every(function (subRId) {\n return enabledLoginMethods.includes(subRId);\n })\n ) {\n var matchingComp = routeComponents.find(function (comp) {\n return comp.recipeID === rid;\n });\n if (matchingComp) {\n return { value: matchingComp };\n }\n }\n };\n // We try and choose which component to show based on the enabled login methods\n // We first try to find an exact match (a recipe that covers all enabled login methods and nothing else)\n for (var _b = 0, priorityOrder_2 = priorityOrder; _b < priorityOrder_2.length; _b++) {\n var _c = priorityOrder_2[_b],\n rid = _c.rid,\n includes = _c.includes;\n var state_2 = _loop_2(rid, includes);\n if (typeof state_2 === \"object\") return state_2.value;\n }\n var _loop_3 = function (rid, includes) {\n if (\n includes.some(function (subRId) {\n return enabledLoginMethods.includes(subRId);\n })\n ) {\n var matchingComp = routeComponents.find(function (comp) {\n return comp.recipeID === rid;\n });\n if (matchingComp) {\n return { value: matchingComp };\n }\n }\n };\n // We try to find a partial match (so any recipe that overlaps with the enabled login methods)\n for (var _d = 0, priorityOrder_3 = priorityOrder; _d < priorityOrder_3.length; _d++) {\n var _e = priorityOrder_3[_d],\n rid = _e.rid,\n includes = _e.includes;\n var state_3 = _loop_3(rid, includes);\n if (typeof state_3 === \"object\") return state_3.value;\n }\n throw new Error(\"No enabled recipes overlap with the requested firstFactors: \" + firstFactors);\n}\nvar RecipeRouter = /** @class */ (function () {\n function RecipeRouter() {\n var _this = this;\n this.getPathsToFeatureComponentWithRecipeIdMap = function () {\n // Memoized version of the map.\n if (_this.pathsToFeatureComponentWithRecipeIdMap !== undefined) {\n return _this.pathsToFeatureComponentWithRecipeIdMap;\n }\n var pathsToFeatureComponentWithRecipeIdMap = {};\n var features = _this.getFeatures();\n var featurePaths = Object.keys(features);\n for (var j = 0; j < featurePaths.length; j++) {\n // If no components yet for this route, initialize empty array.\n var featurePath = featurePaths[j];\n if (pathsToFeatureComponentWithRecipeIdMap[featurePath] === undefined) {\n pathsToFeatureComponentWithRecipeIdMap[featurePath] = [];\n }\n pathsToFeatureComponentWithRecipeIdMap[featurePath].push(features[featurePath]);\n }\n _this.pathsToFeatureComponentWithRecipeIdMap = pathsToFeatureComponentWithRecipeIdMap;\n return _this.pathsToFeatureComponentWithRecipeIdMap;\n };\n this.requiresSignUpPage = false;\n }\n RecipeRouter.getMatchingComponentForRouteAndRecipeIdFromPreBuiltUIList = function (\n normalisedUrl,\n preBuiltUIList,\n defaultToStaticList,\n dynamicLoginMethods\n ) {\n var path = normalisedUrl.getAsStringDangerous();\n // We check if we are on the auth page to later see if we should take first factors into account.\n var isAuthPage =\n path ===\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous();\n // We get all components that can handle the current path\n var routeComponents = preBuiltUIList.reduce(function (components, c) {\n var routes = c.getPathsToFeatureComponentWithRecipeIdMap();\n var _loop_4 = function (routePath, routeComps) {\n if (\n routePath === path ||\n new RegExp(\"^\" + routePath.replace(/:\\w+/g, \"[^/]+\").replace(/\\/\\*/g, \"/[^/]+\") + \"$\").test(path)\n ) {\n components = components.concat(\n routeComps.map(function (c) {\n return { comp: c, route: routePath };\n })\n );\n }\n };\n for (var _i = 0, _a = Object.entries(routes); _i < _a.length; _i++) {\n var _b = _a[_i],\n routePath = _b[0],\n routeComps = _b[1];\n _loop_4(routePath, routeComps);\n }\n return components;\n }, []);\n // We check the query params to see if any recipe was requested by id\n var componentMatchingRid = routeComponents.find(function (c) {\n return c.comp.matches();\n });\n // We default to to one requested by id or the first in the list\n // i.e.: the first prebuilt ui in the list the user provided that can handle this route.\n var defaultComp;\n if (routeComponents.length === 0) {\n defaultComp = undefined;\n } else if (componentMatchingRid !== undefined) {\n defaultComp = componentMatchingRid.comp;\n } else {\n defaultComp = routeComponents[0].comp;\n }\n // We check if any non-auth recipe (emailverification, totp) can handle this\n // There should be no overlap between the routes handled by those and the auth recipes\n // so if there is a match we can return early\n var matchingNonAuthComponent = routeComponents.find(function (comp) {\n var ridlist = priorityOrder.map(function (a) {\n return a.rid;\n });\n return (\n !ridlist.includes(comp.comp.recipeID) ||\n comp.route !==\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous()\n );\n });\n if (matchingNonAuthComponent) {\n return matchingNonAuthComponent.comp;\n }\n // We use this option in `canHandleRoute`, because it may be called by custom UIs before\n // dynamic login methods are loaded.\n if (defaultToStaticList) {\n return defaultComp;\n }\n var mfaRecipe = recipe$1.MultiFactorAuth.getInstance();\n if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false) {\n // If we are not using dynamic login methods, we can use the rid requested by the app\n if (componentMatchingRid) {\n return componentMatchingRid.comp;\n }\n // if we have a static firstFactors config we take it into account on the auth page\n // Other pages shouldn't care about this configuration.\n // Embedded components are not affected, since this is only called by the routing component.\n if (isAuthPage && mfaRecipe && mfaRecipe.config.firstFactors !== undefined) {\n return chooseComponentBasedOnFirstFactors(\n mfaRecipe.config.firstFactors,\n routeComponents.map(function (c) {\n return c.comp;\n })\n );\n } else {\n return defaultComp;\n }\n }\n if (dynamicLoginMethods === undefined) {\n throw new Error(\n \"Should never come here: dynamic login methods info has not been loaded but recipeRouter rendered\"\n );\n }\n // If we are using dynamic login methods, we check that the requested rid belongs to an enabled recipe\n if (\n componentMatchingRid && // if we find a component matching by rid\n (!priorityOrder\n .map(function (a) {\n return a.rid;\n })\n .includes(componentMatchingRid.comp.recipeID) || // from a non-auth recipe\n priorityOrder.some(function (a) {\n return (\n a.rid === componentMatchingRid.comp.recipeID &&\n a.factorsProvided.some(function (factorId) {\n return dynamicLoginMethods.firstFactors.includes(factorId);\n })\n );\n })) // or an enabled auth recipe\n ) {\n return componentMatchingRid.comp;\n }\n // if we have a firstFactors config for the tenant we take it into account on the auth page\n // Other pages shouldn't care about this configuration.\n // Embedded components are not affected, since this is only called by the routing component.\n if (isAuthPage) {\n return chooseComponentBasedOnFirstFactors(\n dynamicLoginMethods.firstFactors,\n routeComponents.map(function (c) {\n return c.comp;\n })\n );\n }\n return undefined;\n };\n return RecipeRouter;\n})();\n\nfunction RoutingComponent(props) {\n var _a, _b;\n var userContext = useUserContext();\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var _c = React.useState(undefined),\n loadedDynamicLoginMethods = _c[0],\n setLoadedDynamicLoginMethods = _c[1];\n var navigate =\n (_a = props.getReactRouterDomWithCustomHistory()) === null || _a === void 0 ? void 0 : _a.useHistoryCustom();\n var path = props.path;\n var isAuthPage =\n path ===\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous();\n var location =\n (_b = props.getReactRouterDomWithCustomHistory()) === null || _b === void 0 ? void 0 : _b.useLocation();\n var componentToRender = React__default.default.useMemo(\n function () {\n if (isAuthPage) {\n return;\n }\n var normalizedPath = new NormalisedURLPath__default.default(path);\n // During development, this runs twice so as to warn devs of if there\n // are any side effects that happen here. So in tests, it will result in\n // the console log twice\n if (\n loadedDynamicLoginMethods !== undefined ||\n genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false\n ) {\n var result = RecipeRouter.getMatchingComponentForRouteAndRecipeIdFromPreBuiltUIList(\n normalizedPath,\n props.preBuiltUIList,\n false,\n loadedDynamicLoginMethods\n );\n if (\n result === undefined &&\n genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === true\n ) {\n void redirectToAuth({ navigate: navigate, redirectBack: false });\n }\n return result;\n }\n return undefined;\n // location dependency needs to be kept in order to get new component on url change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n },\n [path, location, loadedDynamicLoginMethods, props.preBuiltUIList]\n );\n React.useEffect(\n function () {\n if (loadedDynamicLoginMethods) {\n return;\n }\n genericComponentOverrideContext.Multitenancy.getInstanceOrThrow()\n .getCurrentDynamicLoginMethods({ userContext: userContext })\n .then(\n function (loginMethods) {\n return setLoadedDynamicLoginMethods(loginMethods);\n },\n function (err) {\n return rethrowInRender(err);\n }\n );\n },\n [loadedDynamicLoginMethods, setLoadedDynamicLoginMethods]\n );\n if (isAuthPage) {\n return jsxRuntime.jsx(AuthPageWrapper, {\n preBuiltUIList: props.preBuiltUIList,\n navigate: navigate,\n useSignUpStateFromQueryString: true,\n });\n }\n if (\n genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods &&\n loadedDynamicLoginMethods === undefined\n ) {\n return jsxRuntime.jsx(DynamicLoginMethodsSpinner, {});\n }\n if (\n componentToRender === undefined ||\n (loadedDynamicLoginMethods === undefined && genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods)\n ) {\n return null;\n }\n return jsxRuntime.jsx(componentToRender.component, { navigate: navigate });\n}\n\n/*\n * Component.\n */\nfunction getSuperTokensRoutesForReactRouterDom$1(_a) {\n var getReactRouterDomWithCustomHistory = _a.getReactRouterDomWithCustomHistory,\n recipeList = _a.recipeList,\n basePath = _a.basePath;\n var routerInfo = getReactRouterDomWithCustomHistory();\n if (routerInfo === undefined) {\n return [];\n }\n var Route = routerInfo.router.Route;\n var routes = Object.values(\n recipeList.reduce(function (routes, recipe) {\n var pathsToFeatureComponentWithRecipeIdMap = recipe.getPathsToFeatureComponentWithRecipeIdMap();\n Object.keys(pathsToFeatureComponentWithRecipeIdMap).forEach(function (path) {\n path = path === \"\" ? \"/\" : path;\n var pathForRouter = getPathForRouter$1(basePath, path);\n if (!(path in routes)) {\n routes[path] = jsxRuntime.jsx(\n Route,\n genericComponentOverrideContext.__assign(\n { exact: true, path: pathForRouter },\n {\n children: jsxRuntime.jsx(RoutingComponent, {\n getReactRouterDomWithCustomHistory: getReactRouterDomWithCustomHistory,\n preBuiltUIList: recipeList,\n path: path,\n }),\n }\n ),\n \"st-\".concat(path)\n );\n }\n });\n return routes;\n }, {})\n );\n if (\n !genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().disableAuthRoute &&\n recipeList.some(function (ui) {\n return ui.getAuthComponents().length !== 0;\n })\n ) {\n var path = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()\n .appInfo.websiteBasePath.appendPath(new NormalisedURLPath__default$1.default(\"/\"))\n .getAsStringDangerous();\n routes.push(\n jsxRuntime.jsx(\n Route,\n genericComponentOverrideContext.__assign(\n { exact: true, path: getPathForRouter$1(basePath, path) },\n {\n children: jsxRuntime.jsx(RoutingComponent, {\n getReactRouterDomWithCustomHistory: getReactRouterDomWithCustomHistory,\n preBuiltUIList: recipeList,\n path: path,\n }),\n }\n ),\n \"st-/auth\"\n )\n );\n }\n return routes;\n}\nfunction getPathForRouter$1(basePath, path) {\n var pathForRouter = path;\n if (basePath !== undefined) {\n if (pathForRouter.startsWith(basePath)) {\n pathForRouter = pathForRouter.slice(basePath.length);\n if (!pathForRouter.startsWith(\"/\")) {\n pathForRouter = \"/\" + pathForRouter;\n }\n } else {\n throw new Error(\"basePath has to be a prefix of websiteBasePath passed to SuperTokens.init\");\n }\n }\n return pathForRouter;\n}\n\n/*\n * Component.\n */\nfunction getSuperTokensRoutesForReactRouterDomV6(_a) {\n var getReactRouterDomWithCustomHistory = _a.getReactRouterDomWithCustomHistory,\n recipeList = _a.recipeList,\n basePath = _a.basePath;\n var routerInfo = getReactRouterDomWithCustomHistory();\n if (routerInfo === undefined) {\n return [];\n }\n var Route = routerInfo.router.Route;\n var routes = Object.values(\n recipeList.reduce(function (routes, recipe) {\n var pathsToFeatureComponentWithRecipeIdMap = recipe.getPathsToFeatureComponentWithRecipeIdMap();\n Object.keys(pathsToFeatureComponentWithRecipeIdMap).forEach(function (path) {\n path = path === \"\" ? \"/\" : path;\n var pathForRouter = getPathForRouter(basePath, path);\n if (!(path in routes)) {\n routes[path] = jsxRuntime.jsx(\n Route,\n {\n path: pathForRouter,\n element: jsxRuntime.jsx(RoutingComponent, {\n getReactRouterDomWithCustomHistory: getReactRouterDomWithCustomHistory,\n preBuiltUIList: recipeList,\n path: path,\n }),\n },\n \"st-\".concat(path)\n );\n }\n });\n return routes;\n }, {})\n );\n if (\n !genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().disableAuthRoute &&\n recipeList.some(function (ui) {\n return ui.getAuthComponents().length !== 0;\n })\n ) {\n var path = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()\n .appInfo.websiteBasePath.appendPath(new NormalisedURLPath__default$1.default(\"/\"))\n .getAsStringDangerous();\n routes.push(\n jsxRuntime.jsx(\n Route,\n {\n path: getPathForRouter(basePath, path),\n element: jsxRuntime.jsx(RoutingComponent, {\n getReactRouterDomWithCustomHistory: getReactRouterDomWithCustomHistory,\n preBuiltUIList: recipeList,\n path: path,\n }),\n },\n \"st-/auth\"\n )\n );\n }\n return routes;\n}\nfunction getPathForRouter(basePath, path) {\n if (basePath !== undefined) {\n if (path.startsWith(basePath)) {\n path = path.slice(basePath.length);\n if (!path.startsWith(\"/\")) {\n path = \"/\" + path;\n }\n } else {\n throw new Error(\"basePath has to be a prefix of websiteBasePath passed to SuperTokens.init\");\n }\n }\n return path;\n}\n\nvar UI = /** @class */ (function () {\n function UI() {}\n UI.getSuperTokensRoutesForReactRouterDom = function (reactRouterDom, preBuiltUiClassList, basePath) {\n if (preBuiltUiClassList === void 0) {\n preBuiltUiClassList = [];\n }\n if (reactRouterDom === undefined || preBuiltUiClassList.length === 0) {\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/quotes\n 'Please use getSuperTokensRoutesForReactRouterDom like getSuperTokensRoutesForReactRouterDom(require(\"react-router-dom\"), [EmailPasswordPreBuiltUI]) in your render function'\n );\n }\n var recipeList = preBuiltUiClassList.map(function (r) {\n return r.getInstanceOrInitAndGetInstance();\n });\n if (UI.reactRouterDomIsV6 === undefined) {\n UI.reactRouterDomIsV6 = reactRouterDom.withRouter === undefined;\n }\n if (UI.reactRouterDomIsV6) {\n if (UI.reactRouterDom === undefined) {\n // this function wraps the react-router-dom v6 useNavigate function in a way\n // that enforces that it runs within a useEffect. The reason we do this is\n // cause of https://github.com/remix-run/react-router/issues/7460\n // which gets shown when visiting a social auth callback url like\n // /auth/callback/github, without a valid code or state. This then\n // doesn't navigate the user to the auth page.\n var useNavigateHookForRRDV6 = function () {\n var navigateHook = reactRouterDom.useNavigate();\n var _a = React__default.default.useState(undefined),\n to = _a[0],\n setTo = _a[1];\n React__default.default.useEffect(\n function () {\n if (to !== undefined) {\n setTo(undefined);\n navigateHook(to);\n }\n },\n [to, navigateHook, setTo]\n );\n return setTo;\n };\n UI.reactRouterDom = {\n router: reactRouterDom,\n useHistoryCustom: useNavigateHookForRRDV6,\n useLocation: reactRouterDom.useLocation,\n };\n }\n return getSuperTokensRoutesForReactRouterDomV6({\n getReactRouterDomWithCustomHistory: UI.getReactRouterDomWithCustomHistory,\n recipeList: recipeList,\n basePath: basePath,\n });\n }\n if (UI.reactRouterDom === undefined) {\n UI.reactRouterDom = {\n router: reactRouterDom,\n useHistoryCustom: reactRouterDom.useHistory,\n useLocation: reactRouterDom.useLocation,\n };\n }\n return getSuperTokensRoutesForReactRouterDom$1({\n getReactRouterDomWithCustomHistory: UI.getReactRouterDomWithCustomHistory,\n recipeList: recipeList,\n basePath: basePath,\n });\n };\n UI.canHandleRoute = function (preBuiltUiClassList) {\n var recipeList = preBuiltUiClassList.map(function (r) {\n return r.getInstanceOrInitAndGetInstance();\n });\n var path = genericComponentOverrideContext.getCurrentNormalisedUrlPath().getAsStringDangerous();\n var isAuthPage =\n path ===\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous();\n if (isAuthPage) {\n return !genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().disableAuthRoute;\n }\n return (\n RecipeRouter.getMatchingComponentForRouteAndRecipeIdFromPreBuiltUIList(\n genericComponentOverrideContext.getCurrentNormalisedUrlPath(),\n recipeList,\n true\n ) !== undefined\n );\n };\n UI.getRoutingComponent = function (preBuiltUiClassList) {\n var recipeList = preBuiltUiClassList.map(function (r) {\n return r.getInstanceOrInitAndGetInstance();\n });\n return jsxRuntime.jsx(RoutingComponent, {\n getReactRouterDomWithCustomHistory: UI.getReactRouterDomWithCustomHistory,\n path: genericComponentOverrideContext.getCurrentNormalisedUrlPath().getAsStringDangerous(),\n preBuiltUIList: recipeList,\n });\n };\n UI.getReactRouterDomWithCustomHistory = function () {\n return UI.reactRouterDom;\n };\n UI.AuthPage = function (props) {\n return jsxRuntime.jsx(\n AuthPageWrapper,\n genericComponentOverrideContext.__assign({}, props, {\n preBuiltUIList: props.preBuiltUIList.map(function (r) {\n return r.getInstanceOrInitAndGetInstance();\n }),\n })\n );\n };\n UI.AuthPageTheme = AuthPageTheme;\n UI.AuthPageFooter = AuthPageFooter;\n UI.AuthPageHeader = AuthPageHeader;\n UI.AuthPageComponentList = AuthPageComponentList;\n UI.AuthRecipeComponentsOverrideContextProvider = Provider;\n return UI;\n})();\nvar getSuperTokensRoutesForReactRouterDom = UI.getSuperTokensRoutesForReactRouterDom;\nvar canHandleRoute = UI.canHandleRoute;\nvar getRoutingComponent = UI.getRoutingComponent;\nvar AuthPage = UI.AuthPage;\n\nvar SessionAuth = function (_a) {\n var _b;\n var children = _a.children,\n props = genericComponentOverrideContext.__rest(_a, [\"children\"]);\n var requireAuth = React.useRef(props.requireAuth);\n if (props.requireAuth !== requireAuth.current) {\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/quotes\n 'requireAuth prop should not change. If you are seeing this, it probably means that you are using SessionAuth in multiple routes with different values for requireAuth. To solve this, try adding the \"key\" prop to all uses of SessionAuth like '\n );\n }\n // Reusing the parent context was removed because it caused a redirect loop in an edge case\n // because it'd also reuse the invalid claims part until it loaded.\n var _c = React.useState({ loading: true }),\n context = _c[0],\n setContext = _c[1];\n var setContextIfChanged = React.useCallback(\n function (newValue) {\n setContext(function (oldValue) {\n // We can't do this check before re-validation because there are be validators that depend on the current time\n // Since the context is constructed by the same functions the property order should be stable, meaning that\n // a simple JSON string check should be sufficient.\n // Plus since this is just an optimization it is fine to have false positives,\n // and this method won't have false negatives (where we'd miss an update).\n if (JSON.stringify(oldValue) !== JSON.stringify(newValue)) {\n return newValue;\n }\n return oldValue;\n });\n },\n [setContext]\n );\n var session = React.useRef();\n // We store this here, to prevent the list of called hooks changing even if a navigate hook is added later to SuperTokens.\n var navigateHookRef = React.useRef(\n (_b = UI.getReactRouterDomWithCustomHistory()) === null || _b === void 0 ? void 0 : _b.useHistoryCustom\n );\n var navigate;\n try {\n if (navigateHookRef.current) {\n navigate = navigateHookRef.current();\n }\n } catch (_d) {\n // We catch and ignore errors here, because this is may throw if\n // the app is using react-router-dom but added a session auth outside of the router.\n }\n var userContext = useUserContext();\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var redirectToLogin = React.useCallback(function () {\n void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: navigate,\n userContext: userContext,\n redirectBack: true,\n });\n }, []);\n var buildContext = React.useCallback(function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var sessionExists, invalidClaims, err_1, err_2;\n var _a;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (session.current === undefined) {\n session.current = types.Session.getInstanceOrThrow();\n }\n return [\n 4 /*yield*/,\n session.current.doesSessionExist({\n userContext: userContext,\n }),\n ];\n case 1:\n sessionExists = _b.sent();\n if (sessionExists === false) {\n return [\n 2 /*return*/,\n {\n loading: false,\n doesSessionExist: false,\n accessTokenPayload: {},\n invalidClaims: [],\n userId: \"\",\n },\n ];\n }\n _b.label = 2;\n case 2:\n _b.trys.push([2, 4, , 6]);\n return [\n 4 /*yield*/,\n session.current.validateClaims({\n overrideGlobalClaimValidators: props.overrideGlobalClaimValidators,\n userContext: userContext,\n }),\n ];\n case 3:\n invalidClaims = _b.sent();\n return [3 /*break*/, 6];\n case 4:\n err_1 = _b.sent();\n return [\n 4 /*yield*/,\n session.current.doesSessionExist({\n userContext: userContext,\n }),\n ];\n case 5:\n // These errors should only come from getAccessTokenPayloadSecurely inside validateClaims if refreshing a claim cleared the session\n // Which means that the session was most likely cleared, meaning returning false is right.\n // This might also happen if the user provides an override or a custom claim validator that throws (or if we have a bug)\n // In which case the session will not be cleared so we rethrow the error\n if (_b.sent()) {\n throw err_1;\n }\n return [\n 2 /*return*/,\n {\n loading: false,\n doesSessionExist: false,\n accessTokenPayload: {},\n invalidClaims: [],\n userId: \"\",\n },\n ];\n case 6:\n _b.trys.push([6, 9, , 11]);\n _a = {\n loading: false,\n doesSessionExist: true,\n invalidClaims: invalidClaims,\n };\n return [\n 4 /*yield*/,\n session.current.getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 7:\n _a.accessTokenPayload = _b.sent();\n return [\n 4 /*yield*/,\n session.current.getUserId({\n userContext: userContext,\n }),\n ];\n case 8:\n return [2 /*return*/, ((_a.userId = _b.sent()), _a)];\n case 9:\n err_2 = _b.sent();\n return [\n 4 /*yield*/,\n session.current.doesSessionExist({\n userContext: userContext,\n }),\n ];\n case 10:\n if (_b.sent()) {\n throw err_2;\n }\n // This means that loading the access token or the userId failed\n // This may happen if the server cleared the error since the validation was done which should be extremely rare\n return [\n 2 /*return*/,\n {\n loading: false,\n doesSessionExist: false,\n accessTokenPayload: {},\n invalidClaims: [],\n userId: \"\",\n },\n ];\n case 11:\n return [2 /*return*/];\n }\n });\n });\n }, []);\n var setInitialContextAndMaybeRedirect = React.useCallback(\n function (toSetContext) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var failureRedirectInfo, err_3;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (context.loading === false) {\n return [2 /*return*/];\n }\n if (!(props.doRedirection !== false)) return [3 /*break*/, 8];\n if (!toSetContext.doesSessionExist && props.requireAuth !== false) {\n redirectToLogin();\n return [2 /*return*/];\n }\n if (!(toSetContext.invalidClaims.length !== 0)) return [3 /*break*/, 8];\n failureRedirectInfo = void 0;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 6, , 7]);\n return [\n 4 /*yield*/,\n types.getFailureRedirectionInfo({\n invalidClaims: toSetContext.invalidClaims,\n overrideGlobalClaimValidators: props.overrideGlobalClaimValidators,\n userContext: userContext,\n }),\n ];\n case 2:\n failureRedirectInfo = _a.sent();\n if (!(failureRedirectInfo.redirectPath !== undefined)) return [3 /*break*/, 5];\n if (\n !types.validateAndCompareOnFailureRedirectionURLToCurrent(\n failureRedirectInfo.redirectPath\n )\n )\n return [3 /*break*/, 3];\n setContextIfChanged(toSetContext);\n return [2 /*return*/];\n case 3:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl(\n failureRedirectInfo.redirectPath,\n navigate\n ),\n ];\n case 4:\n return [2 /*return*/, _a.sent()];\n case 5:\n return [3 /*break*/, 7];\n case 6:\n err_3 = _a.sent();\n rethrowInRender(err_3);\n throw err_3;\n case 7:\n if (\n props.accessDeniedScreen !== undefined &&\n failureRedirectInfo.failedClaim !== undefined\n ) {\n console.warn({\n message: \"Showing access denied screen because a claim validator failed\",\n claimValidationError: failureRedirectInfo.failedClaim,\n });\n return [\n 2 /*return*/,\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, toSetContext),\n { accessDeniedValidatorError: failureRedirectInfo.failedClaim }\n )\n ),\n ];\n }\n _a.label = 8;\n case 8:\n setContextIfChanged(toSetContext);\n return [2 /*return*/];\n }\n });\n });\n },\n [\n context.loading,\n props.doRedirection,\n props.requireAuth,\n props.overrideGlobalClaimValidators,\n props.accessDeniedScreen,\n redirectToLogin,\n userContext,\n navigate,\n ]\n );\n genericComponentOverrideContext.useOnMountAPICall(buildContext, setInitialContextAndMaybeRedirect);\n // subscribe to events on mount\n React.useEffect(\n function () {\n function onHandleEvent(event) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var _a, invalidClaims, failureRedirectInfo, err_4;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = event.action;\n switch (_a) {\n case \"SESSION_CREATED\":\n return [3 /*break*/, 1];\n case \"REFRESH_SESSION\":\n return [3 /*break*/, 1];\n case \"ACCESS_TOKEN_PAYLOAD_UPDATED\":\n return [3 /*break*/, 1];\n case \"API_INVALID_CLAIM\":\n return [3 /*break*/, 1];\n case \"SIGN_OUT\":\n return [3 /*break*/, 11];\n case \"UNAUTHORISED\":\n return [3 /*break*/, 12];\n }\n return [3 /*break*/, 13];\n case 1:\n return [\n 4 /*yield*/,\n session.current.validateClaims({\n overrideGlobalClaimValidators: props.overrideGlobalClaimValidators,\n userContext: userContext,\n }),\n ];\n case 2:\n invalidClaims = _b.sent();\n if (!(props.doRedirection !== false)) return [3 /*break*/, 10];\n failureRedirectInfo = void 0;\n _b.label = 3;\n case 3:\n _b.trys.push([3, 8, , 9]);\n return [\n 4 /*yield*/,\n types.getFailureRedirectionInfo({\n invalidClaims: invalidClaims,\n overrideGlobalClaimValidators: props.overrideGlobalClaimValidators,\n userContext: userContext,\n }),\n ];\n case 4:\n failureRedirectInfo = _b.sent();\n if (!failureRedirectInfo.redirectPath) return [3 /*break*/, 7];\n if (\n !types.validateAndCompareOnFailureRedirectionURLToCurrent(\n failureRedirectInfo.redirectPath\n )\n )\n return [3 /*break*/, 5];\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, event.sessionContext),\n { loading: false, invalidClaims: invalidClaims }\n )\n );\n return [3 /*break*/, 7];\n case 5:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl(\n failureRedirectInfo.redirectPath,\n navigate\n ),\n ];\n case 6:\n return [2 /*return*/, _b.sent()];\n case 7:\n return [3 /*break*/, 9];\n case 8:\n err_4 = _b.sent();\n rethrowInRender(err_4);\n throw err_4;\n case 9:\n if (\n props.accessDeniedScreen !== undefined &&\n failureRedirectInfo.failedClaim !== undefined\n ) {\n console.warn({\n message: \"Showing access denied screen because a claim validator failed\",\n claimValidationError: failureRedirectInfo.failedClaim,\n });\n return [\n 2 /*return*/,\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, event.sessionContext),\n {\n loading: false,\n invalidClaims: invalidClaims,\n accessDeniedValidatorError: failureRedirectInfo.failedClaim,\n }\n )\n ),\n ];\n }\n _b.label = 10;\n case 10:\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, event.sessionContext),\n { loading: false, invalidClaims: invalidClaims }\n )\n );\n return [2 /*return*/];\n case 11:\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, event.sessionContext),\n { loading: false, invalidClaims: [] }\n )\n );\n return [2 /*return*/];\n case 12:\n setContextIfChanged(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, event.sessionContext),\n { loading: false, invalidClaims: [] }\n )\n );\n if (props.onSessionExpired !== undefined) {\n props.onSessionExpired();\n } else if (props.requireAuth !== false && props.doRedirection !== false) {\n redirectToLogin();\n }\n return [2 /*return*/];\n case 13:\n return [2 /*return*/];\n }\n });\n });\n }\n if (session.current === undefined) {\n session.current = types.Session.getInstanceOrThrow();\n }\n if (context.loading === false) {\n // we return here cause addEventListener returns a function that removes\n // the listener, and this function will be called by useEffect when\n // onHandleEvent changes or if the component is unmounting.\n return session.current.addEventListener(onHandleEvent);\n }\n return undefined;\n },\n [props, setContextIfChanged, context.loading, userContext, navigate, redirectToLogin]\n );\n if (props.requireAuth !== false && (context.loading || !context.doesSessionExist)) {\n return null;\n }\n if (!context.loading && context.accessDeniedValidatorError && props.accessDeniedScreen) {\n return jsxRuntime.jsx(props.accessDeniedScreen, {\n userContext: userContext,\n navigate: navigate,\n validationError: context.accessDeniedValidatorError,\n });\n }\n return jsxRuntime.jsx(\n SessionContext.Provider,\n genericComponentOverrideContext.__assign({ value: context }, { children: children })\n );\n};\nvar SessionAuthWrapper = function (props) {\n return jsxRuntime.jsx(\n UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n { children: jsxRuntime.jsx(SessionAuth, genericComponentOverrideContext.__assign({}, props)) }\n )\n );\n};\n\nvar SuperTokensWrapper = function (props) {\n return jsxRuntime.jsx(\n SessionAuthWrapper,\n genericComponentOverrideContext.__assign({}, props, { requireAuth: false, doRedirection: false })\n );\n};\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * API Wrapper exposed to user.\n */\nvar SuperTokensAPIWrapper = /** @class */ (function () {\n function SuperTokensAPIWrapper() {}\n SuperTokensAPIWrapper.init = function (config) {\n genericComponentOverrideContext.SuperTokens.init(config);\n };\n SuperTokensAPIWrapper.changeLanguage = function (language) {\n return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().changeLanguage(language);\n };\n SuperTokensAPIWrapper.loadTranslation = function (store) {\n return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().loadTranslation(store);\n };\n var _a;\n _a = SuperTokensAPIWrapper;\n SuperTokensAPIWrapper.SuperTokensWrapper = SuperTokensWrapper;\n SuperTokensAPIWrapper.redirectToAuth = function (options) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var _b;\n return genericComponentOverrideContext.__generator(_a, function (_c) {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, options),\n {\n redirectBack:\n (_b = options === null || options === void 0 ? void 0 : options.redirectBack) !==\n null && _b !== void 0\n ? _b\n : true,\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n options === null || options === void 0 ? void 0 : options.userContext\n ),\n }\n )\n ),\n ];\n });\n });\n };\n SuperTokensAPIWrapper.useTranslation = translationContext.useTranslation;\n SuperTokensAPIWrapper.useUserContext = useUserContext;\n return SuperTokensAPIWrapper;\n})();\nvar init = SuperTokensAPIWrapper.init;\nvar changeLanguage = SuperTokensAPIWrapper.changeLanguage;\nvar loadTranslation = SuperTokensAPIWrapper.loadTranslation;\nvar redirectToAuth = SuperTokensAPIWrapper.redirectToAuth;\n\nexports.AuthPage = AuthPage;\nexports.AuthPageComponentList = AuthPageComponentList;\nexports.AuthPageFooter = AuthPageFooter;\nexports.AuthPageHeader = AuthPageHeader;\nexports.AuthPageTheme = AuthPageTheme;\nexports.BackButton = BackButton;\nexports.ComponentOverrideContext = ComponentOverrideContext;\nexports.DynamicLoginMethodsSpinner = DynamicLoginMethodsSpinner;\nexports.FeatureWrapper = FeatureWrapper;\nexports.GeneralError = GeneralError;\nexports.Provider = Provider;\nexports.RecipeRouter = RecipeRouter;\nexports.SessionAuthWrapper = SessionAuthWrapper;\nexports.SessionContext = SessionContext;\nexports.SpinnerIcon = SpinnerIcon;\nexports.SuperTokensAPIWrapper = SuperTokensAPIWrapper;\nexports.SuperTokensBranding = SuperTokensBranding;\nexports.SuperTokensWrapper = SuperTokensWrapper;\nexports.UI = UI;\nexports.UserContextContext = UserContextContext;\nexports.UserContextWrapper = UserContextWrapper;\nexports.canHandleRoute = canHandleRoute;\nexports.changeLanguage = changeLanguage;\nexports.defaultTranslationsCommon = defaultTranslationsCommon;\nexports.getRoutingComponent = getRoutingComponent;\nexports.getSuperTokensRoutesForReactRouterDom = getSuperTokensRoutesForReactRouterDom;\nexports.init = init;\nexports.loadTranslation = loadTranslation;\nexports.redirectToAuth = redirectToAuth;\nexports.useDynamicLoginMethods = useDynamicLoginMethods;\nexports.useSessionContext = useSessionContext;\nexports.useUserContext = useUserContext;\nexports.withOverride = withOverride;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar WebJSSessionRecipe = require(\"supertokens-web-js/recipe/session\");\nvar recipe = require(\"./oauth2provider-shared.js\");\nvar index = require(\"./recipeModule-shared.js\");\nvar utils = require(\"supertokens-web-js/utils\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar WebJSSessionRecipe__default = /*#__PURE__*/ _interopDefault(WebJSSessionRecipe);\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normaliseSessionConfig(config) {\n var _a, _b, _c;\n if (config === undefined) {\n config = {};\n }\n var accessDeniedScreenStyle =\n (_b = (_a = config.accessDeniedScreen) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0\n ? _b\n : \"\";\n var accessDeniedScreen = {\n style: accessDeniedScreenStyle,\n };\n var override = genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config.override\n );\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n {},\n genericComponentOverrideContext.normaliseRecipeModuleConfig(config)\n ),\n {\n // TODO: ideally we'd get the default (or normalized) value from supertokens-website\n invalidClaimStatusCode: (_c = config.invalidClaimStatusCode) !== null && _c !== void 0 ? _c : 403,\n accessDeniedScreen: accessDeniedScreen,\n override: override,\n }\n );\n}\nvar getFailureRedirectionInfo = function (_a) {\n var invalidClaims = _a.invalidClaims,\n overrideGlobalClaimValidators = _a.overrideGlobalClaimValidators,\n userContext = _a.userContext;\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var globalValidators, failedClaim, _loop_1, _i, globalValidators_1, validator, state_1;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n globalValidators = utils.getGlobalClaimValidators({\n overrideGlobalClaimValidators: overrideGlobalClaimValidators,\n userContext: userContext,\n });\n failedClaim = undefined;\n _loop_1 = function (validator) {\n var claim, failureCallback, redirectPath;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n claim = invalidClaims.find(function (c) {\n return c.id === validator.id;\n });\n if (!(claim !== undefined)) return [3 /*break*/, 2];\n failureCallback = validator.onFailureRedirection;\n if (!failureCallback) return [3 /*break*/, 2];\n return [\n 4 /*yield*/,\n failureCallback({ reason: claim.reason, userContext: userContext }),\n ];\n case 1:\n redirectPath = _c.sent();\n if (redirectPath !== undefined) {\n return [\n 2 /*return*/,\n {\n value: {\n redirectPath: redirectPath,\n failedClaim: claim,\n },\n },\n ];\n }\n _c.label = 2;\n case 2:\n if (validator.showAccessDeniedOnFailure !== false && failedClaim === undefined) {\n failedClaim = claim;\n }\n return [2 /*return*/];\n }\n });\n };\n (_i = 0), (globalValidators_1 = globalValidators);\n _b.label = 1;\n case 1:\n if (!(_i < globalValidators_1.length)) return [3 /*break*/, 4];\n validator = globalValidators_1[_i];\n return [5 /*yield**/, _loop_1(validator)];\n case 2:\n state_1 = _b.sent();\n if (typeof state_1 === \"object\") return [2 /*return*/, state_1.value];\n _b.label = 3;\n case 3:\n _i++;\n return [3 /*break*/, 1];\n case 4:\n return [\n 2 /*return*/,\n {\n redirectPath: undefined,\n failedClaim: failedClaim,\n },\n ];\n }\n });\n });\n};\nfunction validateAndCompareOnFailureRedirectionURLToCurrent(redirectURL) {\n var currentUrl = windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.location.getHref();\n var fullRedirectURL;\n try {\n new URL(redirectURL);\n // if the url is a full, valid url, we can use that\n fullRedirectURL = redirectURL;\n } catch (_a) {\n // If we get here, we know it's not full url\n // We check if it's an absolute path\n if (!redirectURL.startsWith(\"/\")) {\n throw new Error(\"onFailureRedirectionURL returned a relative url: \".concat(redirectURL));\n }\n var appInfo = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo;\n // otherwise we prepend the websiteDomain\n fullRedirectURL = \"\".concat(appInfo.websiteDomain.getAsStringDangerous()).concat(redirectURL);\n }\n return currentUrl === fullRedirectURL;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Session = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(Session, _super);\n function Session(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = WebJSSessionRecipe__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = Session.RECIPE_ID;\n _this.eventListeners = new Set();\n _this.getUserId = function (input) {\n return _this.webJSRecipe.getUserId(input);\n };\n _this.getAccessToken = function (input) {\n return _this.webJSRecipe.getAccessToken(input);\n };\n _this.getClaimValue = function (input) {\n return _this.webJSRecipe.getClaimValue(input);\n };\n _this.getAccessTokenPayloadSecurely = function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [2 /*return*/, this.webJSRecipe.getAccessTokenPayloadSecurely(input)];\n });\n });\n };\n _this.doesSessionExist = function (input) {\n return _this.webJSRecipe.doesSessionExist(input);\n };\n _this.signOut = function (input) {\n return _this.webJSRecipe.signOut(input);\n };\n _this.attemptRefreshingSession = function () {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [2 /*return*/, this.webJSRecipe.attemptRefreshingSession()];\n });\n });\n };\n _this.validateClaims = function (input) {\n return _this.webJSRecipe.validateClaims(input);\n };\n _this.getInvalidClaimsFromResponse = function (input) {\n return _this.webJSRecipe.getInvalidClaimsFromResponse(input);\n };\n /**\n * @returns Function to remove event listener\n */\n _this.addEventListener = function (listener) {\n _this.eventListeners.add(listener);\n return function () {\n return _this.eventListeners.delete(listener);\n };\n };\n _this.validateGlobalClaimsAndHandleSuccessRedirection = function (\n // We redefine recipeId to be a string here, because everywhere in the SDK we treat\n // it as a string (e.g.: when defining it in recipes), but we want to type it more\n // strictly in the callbacks the app provides to help integrating our SDK.\n // This is the \"meeting point\" between the two types, so we need to cast between them here.\n successRedirectContext,\n fallbackRecipeId,\n redirectToPath,\n userContext,\n navigate\n ) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var invalidClaims, jsonContext, failureRedirectInfo, successContextStr, storedContext;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n userContext = genericComponentOverrideContext.getNormalisedUserContext(userContext);\n return [4 /*yield*/, this.doesSessionExist({ userContext: userContext })];\n case 1:\n // First we check if there is an active session\n if (!_a.sent()) {\n // If there is none, we have no way of checking claims, so we redirect to the auth page\n // This can happen e.g.: if the user clicked on the email verification link in a browser without an active session\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: navigate,\n redirectBack: false,\n userContext: userContext,\n }),\n ];\n }\n return [4 /*yield*/, this.validateClaims({ userContext: userContext })];\n case 2:\n invalidClaims = _a.sent();\n if (!(invalidClaims.length > 0)) return [3 /*break*/, 6];\n if (!(successRedirectContext !== undefined)) return [3 /*break*/, 4];\n jsonContext = JSON.stringify({\n successRedirectContext: successRedirectContext,\n redirectToPath: redirectToPath,\n });\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.setLocalStorage(\n \"supertokens-success-redirection-context\",\n jsonContext\n ),\n ];\n case 3:\n _a.sent();\n _a.label = 4;\n case 4:\n return [\n 4 /*yield*/,\n getFailureRedirectionInfo({\n invalidClaims: invalidClaims,\n userContext: userContext,\n }),\n ];\n case 5:\n failureRedirectInfo = _a.sent();\n // if redirectPath is string that means failed claim had callback that returns path, we redirect there otherwise continue\n if (failureRedirectInfo.redirectPath !== undefined) {\n // the validation part can throw, but this is handled in all places where this is called,\n // since getFailureRedirectionInfo can also throw\n if (\n validateAndCompareOnFailureRedirectionURLToCurrent(failureRedirectInfo.redirectPath)\n ) {\n throw new Error(\n \"onFailureRedirectionURL returned the current URL (\".concat(\n failureRedirectInfo.redirectPath,\n \") during success redirection. This indicates that the user is in a stuck state.\"\n )\n );\n }\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl(\n failureRedirectInfo.redirectPath,\n navigate\n ),\n ];\n }\n _a.label = 6;\n case 6:\n if (!(successRedirectContext === undefined)) return [3 /*break*/, 13];\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.getLocalStorage(\n \"supertokens-success-redirection-context\"\n ),\n ];\n case 7:\n successContextStr = _a.sent();\n if (!(successContextStr !== null)) return [3 /*break*/, 12];\n _a.label = 8;\n case 8:\n _a.trys.push([8, , 9, 11]);\n storedContext = JSON.parse(successContextStr);\n successRedirectContext = storedContext.successRedirectContext;\n // if we have a redirectToPath set in the queryparams that takes priority over the stored value\n if (redirectToPath === undefined) {\n redirectToPath = storedContext.redirectToPath;\n }\n return [3 /*break*/, 11];\n case 9:\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.removeFromLocalStorage(\n \"supertokens-success-redirection-context\"\n ),\n ];\n case 10:\n _a.sent();\n return [7 /*endfinally*/];\n case 11:\n return [3 /*break*/, 13];\n case 12:\n // If there was nothing in localstorage we set a default\n // this can happen if the user visited email verification screen without an auth recipe redirecting them there\n // but already had the email verified and an active session\n successRedirectContext = {\n recipeId: fallbackRecipeId,\n action: \"SUCCESS\",\n createdNewUser: false,\n isNewRecipeUser: false,\n newSessionCreated: false,\n tenantIdFromQueryParams: genericComponentOverrideContext.getTenantIdFromQueryParams(),\n };\n _a.label = 13;\n case 13:\n if (successRedirectContext === undefined) {\n throw new Error(\"This should never happen: successRedirectContext undefined \");\n }\n if (successRedirectContext.action === \"SUCCESS_OAUTH2\") {\n return [\n 2 /*return*/,\n recipe.OAuth2Provider.getInstanceOrThrow().redirect(\n successRedirectContext,\n navigate,\n {},\n userContext\n ),\n ];\n }\n if (successRedirectContext.action === \"SUCCESS\" && redirectToPath !== undefined) {\n successRedirectContext.redirectToPath = redirectToPath;\n }\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirect(\n successRedirectContext,\n navigate,\n {},\n userContext\n ),\n ];\n }\n });\n });\n };\n /**\n * This should only get called if validateGlobalClaimsAndHandleSuccessRedirection couldn't get a redirectInfo\n * @returns \"/\"\n */\n _this.getDefaultRedirectionURL = function () {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n // We do not use the util here, since we are redirecting outside of the SDK routes\n return [2 /*return*/, \"/\"];\n });\n });\n };\n _this.notifyListeners = function (event) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var sessionContext;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, this.getSessionContext(event)];\n case 1:\n sessionContext = _a.sent();\n // We copy this.eventListeners into a new array to \"freeze\" it for the loop\n // We do this to avoid an infinite loop in case one of the listeners causes a new listener to be added (e.g.: through re-rendering)\n Array.from(this.eventListeners).forEach(function (listener) {\n return listener(\n genericComponentOverrideContext.__assign({ sessionContext: sessionContext }, event)\n );\n });\n return [2 /*return*/];\n }\n });\n });\n };\n return _this;\n }\n Session.prototype.getSessionContext = function (_a) {\n var action = _a.action,\n userContext = _a.userContext;\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var _b, userId, accessTokenPayload;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (\n !(\n action === \"SESSION_CREATED\" ||\n action === \"REFRESH_SESSION\" ||\n action === \"API_INVALID_CLAIM\" ||\n action === \"ACCESS_TOKEN_PAYLOAD_UPDATED\"\n )\n )\n return [3 /*break*/, 2];\n return [\n 4 /*yield*/,\n Promise.all([\n this.getUserId({\n userContext: userContext,\n }),\n this.getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ]),\n ];\n case 1:\n (_b = _c.sent()), (userId = _b[0]), (accessTokenPayload = _b[1]);\n return [\n 2 /*return*/,\n {\n doesSessionExist: true,\n accessTokenPayload: accessTokenPayload,\n userId: userId,\n },\n ];\n case 2:\n if (action === \"SIGN_OUT\" || action === \"UNAUTHORISED\") {\n return [\n 2 /*return*/,\n {\n doesSessionExist: false,\n accessTokenPayload: {},\n userId: \"\",\n },\n ];\n }\n throw new Error(\"Unhandled recipe event: \".concat(action));\n }\n });\n });\n };\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n Session.addAxiosInterceptors = function (axiosInstance, userContext) {\n return WebJSSessionRecipe__default.default.addAxiosInterceptors(axiosInstance, userContext);\n };\n Session.init = function (config) {\n var _this = this;\n var normalisedConfig = normaliseSessionConfig(config);\n return {\n recipeID: Session.RECIPE_ID,\n authReact: function (appInfo) {\n Session.instance = new Session(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: Session.RECIPE_ID }\n )\n );\n return Session.instance;\n },\n webJS: WebJSSessionRecipe__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n onHandleEvent: function (event) {\n if (normalisedConfig.onHandleEvent !== undefined) {\n normalisedConfig.onHandleEvent(event);\n }\n void Session.getInstanceOrThrow().notifyListeners(event);\n },\n preAPIHook: function (context) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n response = genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, context),\n {\n requestInit: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, context.requestInit),\n {\n headers: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n {},\n context.requestInit.headers\n ),\n { rid: Session.RECIPE_ID }\n ),\n }\n ),\n }\n );\n if (normalisedConfig.preAPIHook === undefined) {\n return [2 /*return*/, response];\n } else {\n return [2 /*return*/, normalisedConfig.preAPIHook(context)];\n }\n });\n });\n },\n }\n )\n ),\n };\n };\n Session.getInstanceOrThrow = function () {\n if (Session.instance === undefined) {\n throw Error(\n \"No instance of Session found. Make sure to call the Session.init method. See https://supertokens.io/docs/emailpassword/quick-setup/frontend\"\n );\n }\n return Session.instance;\n };\n Session.getInstance = function () {\n return Session.instance;\n };\n Session.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n Session.instance = undefined;\n return;\n };\n Session.RECIPE_ID = \"session\";\n return Session;\n})(index.RecipeModule);\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar FactorIds = {\n EMAILPASSWORD: \"emailpassword\",\n OTP_EMAIL: \"otp-email\",\n OTP_PHONE: \"otp-phone\",\n LINK_EMAIL: \"link-email\",\n LINK_PHONE: \"link-phone\",\n THIRDPARTY: \"thirdparty\",\n TOTP: \"totp\",\n};\n\nexports.FactorIds = FactorIds;\nexports.Session = Session;\nexports.getFailureRedirectionInfo = getFailureRedirectionInfo;\nexports.validateAndCompareOnFailureRedirectionURLToCurrent = validateAndCompareOnFailureRedirectionURLToCurrent;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar MultiFactorAuthWebJS = require(\"supertokens-web-js/recipe/multifactorauth\");\nvar utils = require(\"supertokens-web-js/utils\");\nvar postSuperTokensInitCallbacks = require(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nvar sessionClaimValidatorStore = require(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\nvar index = require(\"./recipeModule-shared.js\");\nvar types = require(\"./multifactorauth-shared.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar MultiFactorAuthWebJS__default = /*#__PURE__*/ _interopDefault(MultiFactorAuthWebJS);\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar DEFAULT_FACTOR_CHOOSER_PATH = \"/mfa\";\nvar MFA_INFO_CACHE_KEY = \"st-mfa-info-cache\";\n\n// This is a simple in-memory lock using a promise\n// We do not need anything more complex than this, since the cache we are locking is in sessionStorage anyway.\nvar lockProm = undefined;\nvar getFunctionOverrides = function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _onHandleEvent\n) {\n return function (originalImp) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), {\n resyncSessionAndFetchMFAInfo: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var stWindow, stored, parsed, unlock, stored_1, parsed, val;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n stWindow = windowHandler.WindowHandlerReference.getReferenceOrThrow();\n // If someone is refreshing from the server we wait for it to finish.\n return [4 /*yield*/, lockProm];\n case 1:\n // If someone is refreshing from the server we wait for it to finish.\n _a.sent();\n return [4 /*yield*/, stWindow.windowHandler.sessionStorage.getItem(MFA_INFO_CACHE_KEY)];\n case 2:\n stored = _a.sent();\n if (stored !== null) {\n parsed = JSON.parse(stored);\n if (parsed.t > Date.now() - 1000) {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, parsed.v),\n {\n // Adding a fake response is not great, but we do want to add something and this way it's detectable by the app\n // so they could even add specific handling for it if they preferred.\n fetchResponse: new Response(null, { status: 304 }),\n }\n ),\n ];\n }\n }\n _a.label = 3;\n case 3:\n if (!(lockProm !== undefined)) return [3 /*break*/, 5];\n return [4 /*yield*/, lockProm];\n case 4:\n _a.sent();\n return [3 /*break*/, 3];\n case 5:\n lockProm = new Promise(function (res) {\n return (unlock = res);\n });\n _a.label = 6;\n case 6:\n _a.trys.push([6, , 11, 12]);\n return [4 /*yield*/, stWindow.windowHandler.sessionStorage.getItem(MFA_INFO_CACHE_KEY)];\n case 7:\n stored_1 = _a.sent();\n if (stored_1 !== null) {\n parsed = JSON.parse(stored_1);\n if (parsed.t > Date.now() - 1000) {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, parsed.v),\n {\n // Adding a fake response is not great, but we do want to add something and this way it's detectable by the app\n // so they could even add specific handling for it if they preferred.\n fetchResponse: new Response(null, { status: 304 }),\n }\n ),\n ];\n }\n }\n return [4 /*yield*/, originalImp.resyncSessionAndFetchMFAInfo(input)];\n case 8:\n val = _a.sent();\n if (!(val.status === \"OK\")) return [3 /*break*/, 10];\n // We are not storing the fetchResponse\n return [\n 4 /*yield*/,\n stWindow.windowHandler.sessionStorage.setItem(\n MFA_INFO_CACHE_KEY,\n JSON.stringify({\n t: Date.now(),\n v: {\n emails: val.emails,\n phoneNumbers: val.phoneNumbers,\n factors: val.factors,\n status: val.status,\n },\n })\n ),\n ];\n case 9:\n // We are not storing the fetchResponse\n _a.sent();\n _a.label = 10;\n case 10:\n return [2 /*return*/, val];\n case 11:\n // Release the lock\n lockProm = undefined;\n unlock();\n return [7 /*endfinally*/];\n case 12:\n return [2 /*return*/];\n }\n });\n });\n },\n });\n };\n};\n\nvar MultiFactorAuthClaimClass = /** @class */ (function () {\n function MultiFactorAuthClaimClass(getRecipe, getRedirectURL, onFailureRedirection) {\n var _this = this;\n this.webJSClaim = new MultiFactorAuthWebJS.MultiFactorAuthClaimClass(function () {\n return getRecipe().webJSRecipe;\n });\n this.refresh = this.webJSClaim.refresh;\n this.getLastFetchedTime = this.webJSClaim.getLastFetchedTime;\n this.getValueFromPayload = this.webJSClaim.getValueFromPayload;\n this.id = this.webJSClaim.id;\n var defaultOnFailureRedirection = function (_a) {\n var reason = _a.reason,\n userContext = _a.userContext;\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var recipe, nextFactorOptions, availableFactors, mfaInfo_1, availableFactors;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n recipe = getRecipe();\n nextFactorOptions =\n reason.oneOf ||\n reason.allOfInAnyOrder ||\n (reason.factorId !== undefined ? [reason.factorId] : undefined);\n if (!(nextFactorOptions !== undefined)) return [3 /*break*/, 1];\n genericComponentOverrideContext.logDebugMessage(\n \"Redirecting to MFA on next array from validation failure: \" +\n nextFactorOptions.join(\", \")\n );\n availableFactors = recipe\n .getSecondaryFactors(userContext)\n .filter(function (v) {\n return nextFactorOptions.factors.next.includes(v.id);\n })\n .map(function (v) {\n return v.id;\n });\n // In this case we got here from a validator that defined the list of validators\n if (availableFactors.length === 1) {\n return [\n 2 /*return*/,\n getRedirectURL(\n { action: \"GO_TO_FACTOR\", factorId: availableFactors[0] },\n userContext\n ),\n ];\n } else {\n return [\n 2 /*return*/,\n getRedirectURL(\n { action: \"FACTOR_CHOOSER\", nextFactorOptions: nextFactorOptions },\n userContext\n ),\n ];\n }\n case 1:\n return [\n 4 /*yield*/,\n recipe.webJSRecipe.resyncSessionAndFetchMFAInfo({ userContext: userContext }),\n ];\n case 2:\n mfaInfo_1 = _b.sent();\n availableFactors = recipe\n .getSecondaryFactors(userContext)\n .filter(function (v) {\n return mfaInfo_1.factors.next.includes(v.id);\n })\n .map(function (v) {\n return v.id;\n });\n genericComponentOverrideContext.logDebugMessage(\n \"Redirecting to MFA on next array from backend: \" + availableFactors.join(\", \")\n );\n if (availableFactors.length === 1) {\n return [\n 2 /*return*/,\n getRedirectURL(\n { action: \"GO_TO_FACTOR\", factorId: availableFactors[0] },\n userContext\n ),\n ];\n } else {\n return [2 /*return*/, getRedirectURL({ action: \"FACTOR_CHOOSER\" }, userContext)];\n }\n case 3:\n // If this happens the user can't complete sign-in (the claim validator fails, but there is no valid next factor for us)\n // Returning undefined here will make SessionAuth render an access denied screen.\n return [2 /*return*/, undefined];\n }\n });\n });\n };\n this.validators = genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, this.webJSClaim.validators),\n {\n hasCompletedMFARequirementsForAuth: function (doRedirection, showAccessDeniedOnFailure) {\n if (doRedirection === void 0) {\n doRedirection = true;\n }\n if (showAccessDeniedOnFailure === void 0) {\n showAccessDeniedOnFailure = true;\n }\n var orig = _this.webJSClaim.validators.hasCompletedMFARequirementsForAuth();\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, orig),\n {\n showAccessDeniedOnFailure: showAccessDeniedOnFailure,\n onFailureRedirection:\n onFailureRedirection !== null && onFailureRedirection !== void 0\n ? onFailureRedirection\n : function (_a) {\n var reason = _a.reason,\n userContext = _a.userContext;\n return doRedirection\n ? defaultOnFailureRedirection({\n reason: reason,\n userContext: userContext,\n })\n : undefined;\n },\n }\n );\n },\n hasCompletedFactors: function (requirements, doRedirection, showAccessDeniedOnFailure) {\n if (doRedirection === void 0) {\n doRedirection = true;\n }\n if (showAccessDeniedOnFailure === void 0) {\n showAccessDeniedOnFailure = true;\n }\n var orig = _this.webJSClaim.validators.hasCompletedFactors(requirements);\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, orig),\n {\n showAccessDeniedOnFailure: showAccessDeniedOnFailure,\n onFailureRedirection:\n onFailureRedirection !== null && onFailureRedirection !== void 0\n ? onFailureRedirection\n : function (_a) {\n var reason = _a.reason,\n userContext = _a.userContext;\n return doRedirection\n ? defaultOnFailureRedirection({\n reason: reason,\n userContext: userContext,\n })\n : undefined;\n },\n }\n );\n },\n }\n );\n }\n return MultiFactorAuthClaimClass;\n})();\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normaliseMultiFactorAuthFeature(config) {\n var _a;\n if (config === undefined) {\n config = {};\n }\n var disableDefaultUI = config.disableDefaultUI === true;\n var override = genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config.override\n );\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n {},\n genericComponentOverrideContext.normaliseRecipeModuleConfig(config)\n ),\n {\n disableDefaultUI: disableDefaultUI,\n firstFactors: config === null || config === void 0 ? void 0 : config.firstFactors,\n getSecondaryFactorInfo: function (orig) {\n return orig;\n },\n factorChooserScreen: (_a = config.factorChooserScreen) !== null && _a !== void 0 ? _a : {},\n override: override,\n }\n );\n}\nfunction getAvailableFactors(factors, nextArrayQueryParam, recipe, userContext) {\n genericComponentOverrideContext.logDebugMessage(\n \"getAvailableFactors: allowed to setup: \".concat(factors.allowedToSetup)\n );\n genericComponentOverrideContext.logDebugMessage(\n \"getAvailableFactors: already setup: \".concat(factors.alreadySetup)\n );\n genericComponentOverrideContext.logDebugMessage(\"getAvailableFactors: next from factorInfo: \".concat(factors.next));\n genericComponentOverrideContext.logDebugMessage(\n \"getAvailableFactors: nextArrayQueryParam: \".concat(nextArrayQueryParam)\n );\n genericComponentOverrideContext.logDebugMessage(\n \"getAvailableFactors: secondary factors: \".concat(\n recipe.getSecondaryFactors(userContext).map(function (f) {\n return f.id;\n })\n )\n );\n // There are 3 cases here:\n // 1. The app provided an array of factors to show (nextArrayQueryParam) -> we show whatever is in the array\n // 2. no app provided list and validator passed -> we show all factors available to set up or complete\n // 3. no app provided list and validator failing -> we show whatever the BE tells us to (this is already filtered by allowedToSetup&alreadySetup on the BE)\n var nextArr = nextArrayQueryParam !== undefined ? nextArrayQueryParam.split(\",\") : factors.next;\n var availableFactors = recipe.getSecondaryFactors(userContext).filter(function (_a) {\n var id = _a.id;\n return nextArr.length === 0\n ? factors.allowedToSetup.includes(id) || factors.alreadySetup.includes(id)\n : nextArr.includes(id);\n });\n return availableFactors;\n}\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar MultiFactorAuth = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(MultiFactorAuth, _super);\n function MultiFactorAuth(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = MultiFactorAuthWebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = MultiFactorAuth.RECIPE_ID;\n _this.secondaryFactors = [];\n _this.getDefaultRedirectionURL = function (context, userContext) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var nParam, redirectInfo;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n if (context.action === \"FACTOR_CHOOSER\") {\n nParam =\n context.nextFactorOptions && context.nextFactorOptions.length > 0\n ? context.nextFactorOptions.join(\",\")\n : undefined;\n return [\n 2 /*return*/,\n genericComponentOverrideContext.getDefaultRedirectionURLForPath(\n this.config,\n DEFAULT_FACTOR_CHOOSER_PATH,\n context,\n {\n n: nParam,\n stepUp: context.stepUp ? \"true\" : undefined,\n }\n ),\n ];\n } else if (context.action === \"GO_TO_FACTOR\") {\n redirectInfo = this.getSecondaryFactors(userContext).find(function (f) {\n return f.id === context.factorId;\n });\n if (redirectInfo !== undefined) {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.getDefaultRedirectionURLForPath(\n this.config,\n redirectInfo.path,\n context,\n {\n setup: context.forceSetup ? \"true\" : undefined,\n stepUp: context.stepUp ? \"true\" : undefined,\n }\n ),\n ];\n }\n throw new Error(\"Requested redirect to unknown factor id: \" + context.factorId);\n } else {\n return [2 /*return*/, \"/\"];\n }\n });\n });\n };\n postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () {\n var defaultFactorsValidator =\n MultiFactorAuth.MultiFactorAuthClaim.validators.hasCompletedMFARequirementsForAuth();\n sessionClaimValidatorStore.SessionClaimValidatorStore.addClaimValidatorFromOtherRecipe(\n defaultFactorsValidator\n );\n types.Session.getInstanceOrThrow().addEventListener(function () {\n // We clear the cache if the session updated, since that may mean that the MFA info has changed\n var stWindow = windowHandler.WindowHandlerReference.getReferenceOrThrow();\n stWindow.windowHandler.sessionStorage.removeItemSync(MFA_INFO_CACHE_KEY);\n });\n });\n return _this;\n }\n MultiFactorAuth.init = function (config) {\n var normalisedConfig = normaliseMultiFactorAuthFeature(config);\n return {\n recipeID: MultiFactorAuth.RECIPE_ID,\n authReact: function (appInfo) {\n MultiFactorAuth.instance = new MultiFactorAuth(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: MultiFactorAuth.RECIPE_ID }\n )\n );\n return MultiFactorAuth.instance;\n },\n webJS: MultiFactorAuthWebJS__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n override: {\n functions: function (originalImpl, builder) {\n var functions = getFunctionOverrides(normalisedConfig.onHandleEvent);\n builder.override(functions);\n builder.override(normalisedConfig.override.functions);\n return originalImpl;\n },\n },\n }\n )\n ),\n };\n };\n MultiFactorAuth.getInstance = function () {\n return MultiFactorAuth.instance;\n };\n MultiFactorAuth.getInstanceOrThrow = function () {\n if (MultiFactorAuth.instance === undefined) {\n var error = \"No instance of MultiFactorAuth found. Make sure to call the MultiFactorAuth.init method.\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + genericComponentOverrideContext.SSR_ERROR;\n }\n throw Error(error);\n }\n return MultiFactorAuth.instance;\n };\n MultiFactorAuth.prototype.addMFAFactors = function (secondaryFactors) {\n this.secondaryFactors = genericComponentOverrideContext.__spreadArray(\n genericComponentOverrideContext.__spreadArray(\n [],\n this.secondaryFactors.filter(function (factor) {\n return secondaryFactors.every(function (newFactor) {\n return factor.id !== newFactor.id;\n });\n }),\n true\n ),\n secondaryFactors,\n true\n );\n };\n MultiFactorAuth.prototype.isFirstFactorEnabledOnClient = function (factorId) {\n return this.config.firstFactors === undefined || this.config.firstFactors.includes(factorId);\n };\n MultiFactorAuth.prototype.getSecondaryFactors = function (userContext) {\n return this.config.getSecondaryFactorInfo(this.secondaryFactors, userContext);\n };\n MultiFactorAuth.prototype.redirectToFactor = function (_b) {\n var factorId = _b.factorId,\n forceSetup = _b.forceSetup,\n stepUp = _b.stepUp,\n redirectBack = _b.redirectBack,\n navigate = _b.navigate,\n userContext = _b.userContext;\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var url, redirectUrl, redirectUrl;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n return [\n 4 /*yield*/,\n this.getRedirectUrl(\n {\n action: \"GO_TO_FACTOR\",\n forceSetup: forceSetup,\n stepUp: stepUp,\n factorId: factorId,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n utils.getNormalisedUserContext(userContext)\n ),\n ];\n case 1:\n url = _c.sent();\n if (url === null) {\n return [2 /*return*/];\n }\n // If redirectBack was set to true we always set redirectToPath to that value\n // otherwise we try and get it from the query params, finally falling back to not setting it.\n // Example:\n // 1. If the app calls this on pathX and with redirectBack=false, we redirect to /auth/mfa/factor-id\n // 2. If the app calls this on pathX and with redirectBack=true, we redirect to /auth/mfa/factor-id?redirectToPath=pathX\n // 3. If:\n // - the app redirects to the factor chooser with redirectBack=true from path=X, they end up on /auth/mfa?redirectToPath=pathX\n // - the factor chooser screen then calls this with redirectBack=false, then they end up on /auth/mfa/factor-id?redirectToPath=pathX\n // 4. In the unlikely case that the app itself uses a `redirectToPath` query param internally\n // and is on a custom path that has a redirectToPath set to pathX when calling this function,\n // then we keep that in the query params if redirectBack is set to false.\n if (redirectBack) {\n redirectUrl =\n genericComponentOverrideContext.getCurrentNormalisedUrlPathWithQueryParamsAndFragments();\n url = genericComponentOverrideContext.appendQueryParamsToURL(url, {\n redirectToPath: redirectUrl,\n });\n } else {\n redirectUrl = genericComponentOverrideContext.getRedirectToPathFromURL();\n if (redirectUrl) {\n url = genericComponentOverrideContext.appendQueryParamsToURL(url, {\n redirectToPath: redirectUrl,\n });\n }\n }\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl(\n url,\n navigate\n ),\n ];\n }\n });\n });\n };\n MultiFactorAuth.prototype.redirectToFactorChooser = function (_b) {\n var _c = _b.redirectBack,\n redirectBack = _c === void 0 ? false : _c,\n _d = _b.nextFactorOptions,\n nextFactorOptions = _d === void 0 ? [] : _d,\n stepUp = _b.stepUp,\n navigate = _b.navigate,\n userContext = _b.userContext;\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var url, redirectUrl, redirectUrl;\n return genericComponentOverrideContext.__generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n return [\n 4 /*yield*/,\n this.getRedirectUrl(\n {\n action: \"FACTOR_CHOOSER\",\n nextFactorOptions: nextFactorOptions,\n stepUp: stepUp,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n utils.getNormalisedUserContext(userContext)\n ),\n ];\n case 1:\n url = _e.sent();\n if (url === null) {\n return [2 /*return*/];\n }\n if (redirectBack) {\n redirectUrl =\n genericComponentOverrideContext.getCurrentNormalisedUrlPathWithQueryParamsAndFragments();\n url = genericComponentOverrideContext.appendQueryParamsToURL(url, {\n redirectToPath: redirectUrl,\n });\n } else {\n redirectUrl = genericComponentOverrideContext.getRedirectToPathFromURL();\n if (redirectUrl) {\n url = genericComponentOverrideContext.appendQueryParamsToURL(url, {\n redirectToPath: redirectUrl,\n });\n }\n }\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl(\n url,\n navigate\n ),\n ];\n }\n });\n });\n };\n /*\n * Tests methods.\n */\n MultiFactorAuth.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n MultiFactorAuth.instance = undefined;\n return;\n };\n var _a;\n _a = MultiFactorAuth;\n MultiFactorAuth.RECIPE_ID = \"multifactorauth\";\n MultiFactorAuth.MultiFactorAuthClaim = new MultiFactorAuthClaimClass(\n function () {\n return MultiFactorAuth.getInstanceOrThrow();\n },\n function (context, userContext) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(_a, function (_b) {\n switch (_b.label) {\n case 0:\n return [\n 4 /*yield*/,\n this.getInstanceOrThrow().getRedirectUrl(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, context),\n {\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n }\n ),\n userContext\n ),\n ];\n case 1:\n return [2 /*return*/, _b.sent() || undefined];\n }\n });\n });\n }\n );\n return MultiFactorAuth;\n})(index.RecipeModule);\n\nexports.DEFAULT_FACTOR_CHOOSER_PATH = DEFAULT_FACTOR_CHOOSER_PATH;\nexports.MultiFactorAuth = MultiFactorAuth;\nexports.getAvailableFactors = getAvailableFactors;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nexports.Provider = Provider;\nexports.useContext = useContext;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar componentOverrideContext = require(\"./multifactorauth-shared3.js\");\nvar recipe = require(\"./multifactorauth-shared2.js\");\nvar types = require(\"./multifactorauth-shared.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return recipe.MultiFactorAuth.init(config);\n };\n Wrapper.resyncSessionAndFetchMFAInfo = function (input) {\n return recipe.MultiFactorAuth.getInstanceOrThrow().webJSRecipe.resyncSessionAndFetchMFAInfo(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n );\n };\n Wrapper.redirectToFactor = function (input) {\n var _a, _b, _c;\n return recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactor({\n factorId: input.factorId,\n forceSetup: (_a = input.forceSetup) !== null && _a !== void 0 ? _a : false,\n redirectBack: (_b = input.redirectBack) !== null && _b !== void 0 ? _b : true,\n stepUp: (_c = input.stepUp) !== null && _c !== void 0 ? _c : false,\n navigate: input.navigate,\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n });\n };\n Wrapper.redirectToFactorChooser = function (input) {\n var _a, _b, _c;\n return recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser({\n nextFactorOptions: (_a = input.nextFactorOptions) !== null && _a !== void 0 ? _a : [],\n redirectBack: (_b = input.redirectBack) !== null && _b !== void 0 ? _b : true,\n stepUp: (_c = input.stepUp) !== null && _c !== void 0 ? _c : false,\n navigate: input.navigate,\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n });\n };\n Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim;\n Wrapper.FactorIds = types.FactorIds;\n Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar resyncSessionAndFetchMFAInfo = Wrapper.resyncSessionAndFetchMFAInfo;\nvar redirectToFactor = Wrapper.redirectToFactor;\nvar redirectToFactorChooser = Wrapper.redirectToFactorChooser;\nvar MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider;\nvar MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim;\n\nexports.FactorIds = types.FactorIds;\nexports.MultiFactorAuthClaim = MultiFactorAuthClaim;\nexports.MultiFactorAuthComponentsOverrideProvider = MultiFactorAuthComponentsOverrideProvider;\nexports.default = Wrapper;\nexports.init = init;\nexports.redirectToFactor = redirectToFactor;\nexports.redirectToFactorChooser = redirectToFactorChooser;\nexports.resyncSessionAndFetchMFAInfo = resyncSessionAndFetchMFAInfo;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar uiEntry = require(\"./index2.js\");\nvar session = require(\"./session.js\");\nvar componentOverrideContext = require(\"./multifactorauth-shared3.js\");\nvar React = require(\"react\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar recipe = require(\"./multifactorauth-shared2.js\");\nvar translationContext = require(\"./translationContext.js\");\nvar sessionprebuiltui = require(\"./sessionprebuiltui.js\");\nvar arrowLeftIcon = require(\"./arrowLeftIcon.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./session-shared.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nfunction _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== \"default\") {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(\n n,\n k,\n d.get\n ? d\n : {\n enumerable: true,\n get: function () {\n return e[k];\n },\n }\n );\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n}\n\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar React__namespace = /*#__PURE__*/ _interopNamespace(React);\n\nvar styles =\n '[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n/*\\n * Default styles.\\n */\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n/* TODO: split the link style into separate things*/\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n[data-supertokens~=\"mfa\"][data-supertokens~=\"container\"] {\\n padding-top: 34px;\\n}\\n[data-supertokens~=\"mfa\"] [data-supertokens~=\"row\"] {\\n padding-top: 6px;\\n padding-bottom: 6px;\\n}\\n[data-supertokens~=\"mfa\"] [data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-3);\\n font-weight: 600;\\n line-height: 30px;\\n}\\n[data-supertokens~=\"mfa\"] [data-supertokens~=\"factorChooserList\"] {\\n margin-bottom: 12px;\\n}\\n[data-supertokens~=\"factorChooserOption\"] {\\n display: flex;\\n flex-direction: row;\\n border-radius: 6px;\\n border: 1px solid rgb(var(--palette-inputBorder));\\n padding: 20px 16px;\\n cursor: pointer;\\n margin-top: 12px;\\n}\\n[data-supertokens~=\"factorChooserOption\"]:hover {\\n border: 1px solid rgba(var(--palette-primary), 0.6);\\n}\\n[data-supertokens~=\"factorOptionText\"] {\\n flex-grow: 1;\\n display: flex;\\n flex-direction: column;\\n align-items: start;\\n text-align: left;\\n}\\n[data-supertokens~=\"factorLogo\"] {\\n flex-grow: 0;\\n min-width: 30px;\\n text-align: left;\\n margin-top: 6px;\\n}\\n[data-supertokens~=\"totp\"] [data-supertokens~=\"factorLogo\"] {\\n margin-top: 3px;\\n margin-left: -1px;\\n}\\n[data-supertokens~=\"factorName\"] {\\n color: rgb(var(--palette-primary));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 4px;\\n}\\n[data-supertokens~=\"factorDescription\"] {\\n color: rgb(var(--palette-textPrimary));\\n font-size: var(--font-size-0);\\n margin: 4px;\\n}\\n[data-supertokens~=\"mfa\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n margin-bottom: 26px;\\n text-align: right;\\n}\\n';\n\nvar ThemeBase = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles, userStyles.join(\"\\n\")] })],\n });\n};\n\nvar FactorChooserFooter = uiEntry.withOverride(\"MFAFactorChooserFooter\", function MFAChooserFooter(_a) {\n var logout = _a.logout;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row factorChooserFooter\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"secondaryText secondaryLinkWithLeftArrow\", onClick: logout },\n {\n children: [\n jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, {\n color: \"rgb(var(--palette-textPrimary))\",\n }),\n t(\"MULTI_FACTOR_AUTH_LOGOUT\"),\n ],\n }\n )\n ),\n }\n )\n );\n});\n\nvar FactorChooserHeader = uiEntry.withOverride(\"MFAFactorChooserHeader\", function MFAFactorChooserHeader(props) {\n var t = translationContext.useTranslation();\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row factorChooserHeader\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle withBackButton\" },\n {\n children: [\n props.showBackButton\n ? jsxRuntime.jsx(uiEntry.BackButton, { onClick: props.onBackButtonClicked })\n : jsxRuntime.jsx(\"span\", {\n \"data-supertokens\": \"backButtonPlaceholder backButtonCommon\",\n }),\n t(\"MULTI_FACTOR_CHOOSER_HEADER_TITLE\"),\n jsxRuntime.jsx(\"span\", {\n \"data-supertokens\": \"backButtonPlaceholder backButtonCommon\",\n }),\n ],\n }\n )\n ),\n }\n )\n );\n});\n\nvar FactorOption = uiEntry.withOverride(\"MFAFactorOption\", function MFAFactorOption(_a) {\n var onClick = _a.onClick,\n id = _a.id,\n name = _a.name,\n description = _a.description,\n logo = _a.logo;\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(\n \"a\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"factorChooserOption \".concat(id), onClick: onClick },\n {\n children: [\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"factorLogo\" },\n { children: [\" \", logo({})] }\n )\n ),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"factorOptionText\" },\n {\n children: [\n jsxRuntime.jsx(\n \"h6\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"factorName\" },\n { children: t(name) }\n )\n ),\n jsxRuntime.jsx(\n \"p\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"factorDescription\" },\n { children: t(description) }\n )\n ),\n ],\n }\n )\n ),\n ],\n }\n )\n );\n});\n\nvar FactorList = uiEntry.withOverride(\"MFAFactorList\", function MFAFactorList(_a) {\n var availableFactors = _a.availableFactors,\n navigateToFactor = _a.navigateToFactor;\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row factorChooserList\" },\n {\n children: availableFactors.map(function (factor) {\n return jsxRuntime.jsx(\n FactorOption,\n {\n id: factor.id,\n name: factor.name,\n description: factor.description,\n logo: factor.logo,\n onClick: function () {\n return navigateToFactor(factor.id);\n },\n },\n factor.id\n );\n }),\n }\n )\n );\n});\n\nfunction FactorChooserTheme(props) {\n var t = translationContext.useTranslation();\n if (props.availableFactors.length === 0) {\n return jsxRuntime.jsx(sessionprebuiltui.AccessDeniedScreen, {\n useShadowDom: false /* We set this to false, because we are already inside a shadowDom (if required) */,\n error: props.showBackButton ? t(\"MFA_NO_AVAILABLE_OPTIONS\") : t(\"MFA_NO_AVAILABLE_OPTIONS_LOGIN\"),\n });\n }\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container mfa\" },\n {\n children: [\n jsxRuntime.jsx(FactorChooserHeader, {\n onBackButtonClicked: props.onBackButtonClicked,\n showBackButton: props.showBackButton,\n }),\n jsxRuntime.jsx(FactorList, {\n availableFactors: props.availableFactors,\n navigateToFactor: props.navigateToFactor,\n }),\n jsxRuntime.jsx(FactorChooserFooter, { logout: props.onLogoutClicked }),\n jsxRuntime.jsx(uiEntry.SuperTokensBranding, {}),\n ],\n }\n )\n );\n}\nfunction FactorChooserThemeWrapper(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n {\n userStyles: [\n rootStyle,\n props.config.recipeRootStyle,\n props.config.factorChooserScreen.style,\n ],\n },\n {\n children: jsxRuntime.jsx(\n FactorChooserTheme,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n ),\n }\n )\n );\n}\n\nvar defaultTranslationsMultiFactorAuth = {\n en: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, uiEntry.defaultTranslationsCommon.en),\n {\n MULTI_FACTOR_CHOOSER_HEADER_TITLE: \"Please select a factor\",\n MULTI_FACTOR_AUTH_LOGOUT: \"Log out\",\n PWLESS_MFA_OTP_PHONE_NAME: \"SMS based OTP\",\n PWLESS_MFA_OTP_PHONE_DESCRIPTION: \"Get an OTP code on your phone to complete the authentication request\",\n PWLESS_MFA_OTP_EMAIL_NAME: \"Email based OTP\",\n PWLESS_MFA_OTP_EMAIL_DESCRIPTION:\n \"Get an OTP code on your email address to complete the authentication request\",\n TOTP_MFA_NAME: \"TOTP\",\n TOTP_MFA_DESCRIPTION: \"Use an authenticator app to complete the authentication request\",\n MFA_NO_AVAILABLE_OPTIONS: \"You have no available secondary factors.\",\n MFA_NO_AVAILABLE_OPTIONS_LOGIN:\n \"You have no available secondary factors and cannot complete the sign-in process. Please contact support.\",\n }\n ),\n};\n\nvar FactorChooser$1 = function (props) {\n var _a;\n var sessionContext = React.useContext(uiEntry.SessionContext);\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var _b = React.useState(undefined),\n mfaInfo = _b[0],\n setMFAInfo = _b[1];\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var recipeComponentOverrides = props.useComponentOverrides();\n var nextQueryParam =\n (_a = genericComponentOverrideContext.getQueryParams(\"n\")) !== null && _a !== void 0 ? _a : undefined;\n var stepUpQueryParam = genericComponentOverrideContext.getQueryParams(\"stepUp\");\n var redirectToAuthWithHistory = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n uiEntry.redirectToAuth({ redirectBack: false, navigate: props.navigate }),\n ];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n },\n [props.navigate]\n );\n var fetchMFAInfo = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n props.recipe.webJSRecipe.resyncSessionAndFetchMFAInfo({ userContext: userContext }),\n ];\n });\n });\n },\n [props.recipe, userContext]\n );\n var checkMFAInfo = React.useCallback(\n function (mfaInfo) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (mfaInfo.factors.next.length === 0 && stepUpQueryParam !== \"true\") {\n void types.Session.getInstanceOrThrow()\n .validateGlobalClaimsAndHandleSuccessRedirection(\n undefined,\n recipe.MultiFactorAuth.RECIPE_ID,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n props.navigate\n )\n .catch(rethrowInRender);\n } else {\n setMFAInfo({\n factors: mfaInfo.factors,\n phoneNumbers: mfaInfo.phoneNumbers,\n emails: mfaInfo.emails,\n });\n }\n return [2 /*return*/];\n });\n });\n },\n [setMFAInfo, nextQueryParam, userContext]\n );\n var handleError = React.useCallback(\n function (err) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }),\n ];\n case 1:\n if (!_a.sent()) return [3 /*break*/, 2];\n throw err;\n case 2:\n return [4 /*yield*/, redirectToAuthWithHistory()];\n case 3:\n _a.sent();\n _a.label = 4;\n case 4:\n return [2 /*return*/];\n }\n });\n });\n },\n [redirectToAuthWithHistory]\n );\n genericComponentOverrideContext.useOnMountAPICall(\n fetchMFAInfo,\n checkMFAInfo,\n handleError,\n sessionContext.loading === false\n );\n var navigateToFactor = React.useCallback(\n function (factorId) {\n props.recipe.config.onHandleEvent({\n action: \"FACTOR_CHOOSEN\",\n factorId: factorId,\n });\n return props.recipe.redirectToFactor({\n factorId: factorId,\n forceSetup: false,\n stepUp: stepUpQueryParam === \"true\",\n redirectBack: false,\n navigate: props.navigate,\n userContext: props.userContext,\n });\n },\n [props.recipe]\n );\n var signOut = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var session;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n session = types.Session.getInstanceOrThrow();\n return [4 /*yield*/, session.signOut({ userContext: userContext })];\n case 1:\n _a.sent();\n return [2 /*return*/, redirectToAuthWithHistory()];\n }\n });\n });\n },\n [props.recipe, redirectToAuthWithHistory]\n );\n var onBackButtonClicked = React.useCallback(\n function () {\n // If we don't have navigate available this would mean we are not using react-router-dom, so we use window's history\n if (props.navigate === undefined) {\n return windowHandler.WindowHandlerReference.getReferenceOrThrow()\n .windowHandler.getWindowUnsafe()\n .history.back();\n }\n // If we do have navigate and goBack function on it this means we are using react-router-dom v5 or lower\n if (\"goBack\" in props.navigate) {\n return props.navigate.goBack();\n }\n // If we reach this code this means we are using react-router-dom v6\n return props.navigate(-1);\n },\n [props.navigate]\n );\n if (mfaInfo === undefined) {\n return null;\n }\n var availableFactors = recipe.getAvailableFactors(mfaInfo.factors, nextQueryParam, props.recipe, userContext);\n var childProps = {\n config: props.recipe.config,\n onBackButtonClicked: onBackButtonClicked,\n // if the next array is empty, it means the user has logged in fully and has come here (from a settings page for example).\n // So we show the back button. In case the next array is not empty, it means we are still signing in, and\n // there is no where to go back to, other than logout, which is a different button in the UI.\n showBackButton: mfaInfo.factors.next.length === 0,\n mfaInfo: mfaInfo,\n availableFactors: availableFactors,\n onLogoutClicked: signOut,\n navigateToFactor: navigateToFactor,\n };\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: defaultTranslationsMultiFactorAuth,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n FactorChooserThemeWrapper,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n ),\n }\n )\n );\n};\n\nvar MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(MultiFactorAuthPreBuiltUI, _super);\n function MultiFactorAuthPreBuiltUI(recipeInstance) {\n var _this = _super.call(this) || this;\n _this.recipeInstance = recipeInstance;\n _this.languageTranslations = defaultTranslationsMultiFactorAuth;\n // Instance methods\n _this.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n var features = {};\n if (_this.recipeInstance.config.disableDefaultUI !== true) {\n var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath(\n new NormalisedURLPath__default.default(recipe.DEFAULT_FACTOR_CHOOSER_PATH)\n );\n features[normalisedFullPath.getAsStringDangerous()] = {\n matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams(\n _this.recipeInstance.config.recipeId\n ),\n component: function (props) {\n return _this.getFeatureComponent(\"factorchooser\", props, useComponentOverrides);\n },\n recipeID: recipe.MultiFactorAuth.RECIPE_ID,\n };\n }\n return features;\n };\n _this.getFeatureComponent = function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _,\n props,\n useComponentOverrides\n ) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n session.SessionAuth,\n genericComponentOverrideContext.__assign(\n {\n overrideGlobalClaimValidators: function () {\n return [];\n },\n },\n {\n children: jsxRuntime.jsx(\n FactorChooser$1,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: useComponentOverrides,\n },\n props\n )\n ),\n }\n )\n ),\n }\n )\n );\n };\n return _this;\n }\n // Static methods\n MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance = function () {\n if (MultiFactorAuthPreBuiltUI.instance === undefined) {\n var recipeInstance = recipe.MultiFactorAuth.getInstanceOrThrow();\n MultiFactorAuthPreBuiltUI.instance = new MultiFactorAuthPreBuiltUI(recipeInstance);\n }\n return MultiFactorAuthPreBuiltUI.instance;\n };\n MultiFactorAuthPreBuiltUI.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides);\n };\n MultiFactorAuthPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n componentName,\n props,\n useComponentOverrides\n );\n };\n MultiFactorAuthPreBuiltUI.prototype.getAuthComponents = function () {\n return [];\n };\n // For tests\n MultiFactorAuthPreBuiltUI.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n MultiFactorAuthPreBuiltUI.instance = undefined;\n return;\n };\n MultiFactorAuthPreBuiltUI.FactorChooser = function (props) {\n return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\"factorchooser\", props);\n };\n MultiFactorAuthPreBuiltUI.FactorChooserTheme = FactorChooserThemeWrapper;\n return MultiFactorAuthPreBuiltUI;\n})(uiEntry.RecipeRouter);\nvar FactorChooser = MultiFactorAuthPreBuiltUI.FactorChooser;\n\nexports.FactorChooser = FactorChooser;\nexports.FactorChooserTheme = FactorChooserThemeWrapper;\nexports.MultiFactorAuthPreBuiltUI = MultiFactorAuthPreBuiltUI;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nexports.Provider = Provider;\nexports.useContext = useContext;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar MultitenancyWebJS = require(\"supertokens-web-js/recipe/multitenancy\");\nvar componentOverrideContext = require(\"./multitenancy-shared.js\");\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return genericComponentOverrideContext.Multitenancy.init(config);\n };\n Wrapper.AllowedDomainsClaim = MultitenancyWebJS.AllowedDomainsClaim;\n Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar MultitenancyComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider;\n\nObject.defineProperty(exports, \"AllowedDomainsClaim\", {\n enumerable: true,\n get: function () {\n return MultitenancyWebJS.AllowedDomainsClaim;\n },\n});\nexports.MultitenancyComponentsOverrideProvider = MultitenancyComponentsOverrideProvider;\nexports.default = Wrapper;\nexports.init = init;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar OAuth2WebJS = require(\"supertokens-web-js/recipe/oauth2provider\");\nvar index = require(\"./recipeModule-shared.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar OAuth2WebJS__default = /*#__PURE__*/ _interopDefault(OAuth2WebJS);\n\nvar getFunctionOverrides = function (onHandleEvent) {\n return function (originalImp) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), {\n getLoginChallengeInfo: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.getLoginChallengeInfo(input)];\n case 1:\n response = _a.sent();\n onHandleEvent({\n action: \"LOADED_LOGIN_CHALLENGE\",\n loginChallenge: input.loginChallenge,\n loginInfo: response.info,\n userContext: input.userContext,\n });\n return [2 /*return*/, response];\n }\n });\n });\n },\n logOut: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.logOut(input)];\n case 1:\n response = _a.sent();\n onHandleEvent({\n action: \"OAUTH2_LOGOUT_SUCCESS\",\n frontendRedirectTo: response.frontendRedirectTo,\n userContext: input.userContext,\n });\n return [2 /*return*/, response];\n }\n });\n });\n },\n });\n };\n};\n\nfunction normaliseOAuth2Config(config) {\n var _a;\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign(\n {},\n genericComponentOverrideContext.normaliseRecipeModuleConfig(config)\n ),\n {\n disableDefaultUI:\n (_a = config === null || config === void 0 ? void 0 : config.disableDefaultUI) !== null && _a !== void 0\n ? _a\n : false,\n tryRefreshPage: genericComponentOverrideContext.__assign(\n { disableDefaultUI: false },\n config === null || config === void 0 ? void 0 : config.tryRefreshPage\n ),\n oauth2LogoutScreen: genericComponentOverrideContext.__assign(\n { disableDefaultUI: false, style: \"\" },\n config === null || config === void 0 ? void 0 : config.oauth2LogoutScreen\n ),\n override: genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config === null || config === void 0 ? void 0 : config.override\n ),\n }\n );\n}\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Class.\n */\nvar OAuth2Provider = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(OAuth2Provider, _super);\n function OAuth2Provider(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = OAuth2WebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = OAuth2Provider.RECIPE_ID;\n return _this;\n }\n OAuth2Provider.init = function (config) {\n var normalisedConfig = normaliseOAuth2Config(config);\n return {\n recipeID: OAuth2Provider.RECIPE_ID,\n authReact: function (appInfo) {\n OAuth2Provider.instance = new OAuth2Provider(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: OAuth2Provider.RECIPE_ID }\n )\n );\n return OAuth2Provider.instance;\n },\n webJS: OAuth2WebJS__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n override: {\n functions: function (originalImpl, builder) {\n var functions = getFunctionOverrides(normalisedConfig.onHandleEvent);\n builder.override(functions);\n builder.override(normalisedConfig.override.functions);\n return originalImpl;\n },\n },\n }\n )\n ),\n };\n };\n OAuth2Provider.getInstanceOrThrow = function () {\n if (OAuth2Provider.instance === undefined) {\n var error =\n \"No instance of OAuth2Provider found. Make sure to call the OAuth2Provider.init method.\" +\n \"See https://supertokens.io/docs/oauth2/quick-setup/frontend\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + genericComponentOverrideContext.SSR_ERROR;\n }\n throw Error(error);\n }\n return OAuth2Provider.instance;\n };\n OAuth2Provider.getInstance = function () {\n return OAuth2Provider.instance;\n };\n OAuth2Provider.prototype.getDefaultRedirectionURL = function (ctx) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n // We do not use the util here, because we are likely redirecting across domains here.\n if (\n ctx.action === \"SUCCESS_OAUTH2\" ||\n ctx.action === \"CONTINUE_OAUTH2_AFTER_REFRESH\" ||\n ctx.action === \"POST_OAUTH2_LOGOUT_REDIRECT\"\n ) {\n return [2 /*return*/, ctx.frontendRedirectTo];\n } else {\n throw new Error(\n \"Should never come here: unknown action in OAuth2Provider.getDefaultRedirectionURL\"\n );\n }\n });\n });\n };\n /*\n * Tests methods.\n */\n OAuth2Provider.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n OAuth2Provider.instance = undefined;\n return;\n };\n OAuth2Provider.RECIPE_ID = \"oauth2provider\";\n return OAuth2Provider;\n})(index.RecipeModule);\n\nexports.OAuth2Provider = OAuth2Provider;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nexports.Provider = Provider;\nexports.useContext = useContext;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar componentOverrideContext = require(\"./oauth2provider-shared2.js\");\nvar recipe = require(\"./oauth2provider-shared.js\");\nrequire(\"./genericComponentOverrideContext.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./recipeModule-shared.js\");\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return recipe.OAuth2Provider.init(config);\n };\n /**\n * Returns information about an OAuth login in progress\n *\n * @param loginChallenge The login challenge from the url\n *\n * @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation}\n *\n * @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks)\n *\n * @returns `{status: \"OK\", info: LoginInfo}`\n *\n * @throws STGeneralError if the API exposed by the backend SDKs returns `status: \"GENERAL_ERROR\"`\n */\n Wrapper.getLoginChallengeInfo = function (input) {\n return recipe.OAuth2Provider.getInstanceOrThrow().webJSRecipe.getLoginChallengeInfo(input);\n };\n /**\n * Accepts the OAuth2 Login request and returns the redirect URL to continue the OAuth flow.\n *\n * @param loginChallenge The login challenge from the url\n *\n * @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation}\n *\n * @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks)\n *\n * @returns `{status: \"OK\", frontendRedirectTo: string}`\n *\n * @throws STGeneralError if the API exposed by the backend SDKs returns `status: \"GENERAL_ERROR\"`\n */\n Wrapper.getRedirectURLToContinueOAuthFlow = function (input) {\n return recipe.OAuth2Provider.getInstanceOrThrow().webJSRecipe.getRedirectURLToContinueOAuthFlow(input);\n };\n /**\n * Accepts the OAuth2 Logout request, clears the SuperTokens session and returns post logout redirect URL.\n *\n * @param logoutChallenge The logout challenge from the url\n *\n * @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation}\n *\n * @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks)\n *\n * @returns `{status: \"OK\", frontendRedirectTo: string}`\n *\n * @throws STGeneralError if the API exposed by the backend SDKs returns `status: \"GENERAL_ERROR\"`\n */\n Wrapper.logOut = function (input) {\n return recipe.OAuth2Provider.getInstanceOrThrow().webJSRecipe.logOut(input);\n };\n Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar getLoginChallengeInfo = Wrapper.getLoginChallengeInfo;\nvar logOut = Wrapper.logOut;\n\nexports.RecipeComponentsOverrideContextProvider = componentOverrideContext.Provider;\nexports.default = Wrapper;\nexports.getLoginChallengeInfo = getLoginChallengeInfo;\nexports.init = init;\nexports.logOut = logOut;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar uiEntry = require(\"./index2.js\");\nvar session = require(\"./session.js\");\nvar componentOverrideContext = require(\"./oauth2provider-shared2.js\");\nvar React = require(\"react\");\nvar recipe = require(\"./oauth2provider-shared.js\");\nvar translationContext = require(\"./translationContext.js\");\nvar button = require(\"./emailpassword-shared.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./multifactorauth-shared2.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./multifactorauth-shared.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\nrequire(\"./session-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nfunction _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== \"default\") {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(\n n,\n k,\n d.get\n ? d\n : {\n enumerable: true,\n get: function () {\n return e[k];\n },\n }\n );\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n}\n\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar React__namespace = /*#__PURE__*/ _interopNamespace(React);\n\nvar styles =\n '/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\\n *\\n * This software is licensed under the Apache License, Version 2.0 (the\\n * \"License\") as published by the Apache Software Foundation.\\n *\\n * You may not use this file except in compliance with the License. You may\\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\\n * License for the specific language governing permissions and limitations\\n * under the License.\\n */\\n\\n[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n\\n/*\\n * Default styles.\\n */\\n\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n\\n/* TODO: split the link style into separate things*/\\n\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"logoutIcon\"] {\\n padding: 18px 20px 18px 24px;\\n background-color: rgba(var(--palette-textGray), 0.1);\\n border-radius: 12px;\\n}\\n\\n[data-supertokens~=\"oauth2Logout\"] [data-supertokens~=\"headerTitle\"] {\\n margin-top: 24px;\\n margin-bottom: 24px;\\n}\\n\\n[data-supertokens~=\"oauth2Logout\"] [data-supertokens~=\"button\"] {\\n margin-bottom: 24px;\\n}\\n';\n\nvar ThemeBase = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles, userStyles.join(\"\\n\")] })],\n });\n};\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction LogoutIcon() {\n return jsxRuntime.jsx(\n \"svg\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"logoutIcon\",\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"40\",\n height: \"38\",\n fill: \"none\",\n },\n {\n children: jsxRuntime.jsx(\"path\", {\n fill: \"rgb(var(--palette-textGray))\",\n fillRule: \"evenodd\",\n d: \"M2.972.022a.874.874 0 0 1-.23.062c-.234.042-.926.362-1.148.53a4.638 4.638 0 0 0-.656.63c-.178.228-.415.681-.495.948l-.116.378C.272 2.742.27 32.075.326 32.251l.111.37c.165.559.636 1.207 1.133 1.558a3.9 3.9 0 0 1 .195.145c.048.046.368.206.588.292l.196.08c.036.016.183.063.326.105.144.042.295.093.337.113.041.02.11.037.154.037s.098.015.12.034c.023.019.218.087.434.15.215.065.43.133.478.153.048.019.254.085.457.146.204.06.404.128.446.148.041.021.11.038.154.038s.098.015.12.034c.023.02.16.069.303.11.144.041.295.092.337.112.041.02.11.037.154.037s.098.015.12.034c.023.018.218.086.434.15.215.065.43.133.478.152.048.02.254.086.457.148.204.062.404.129.446.148a.45.45 0 0 0 .163.037c.048 0 .088.018.088.041 0 .023.034.043.076.043.042 0 .213.048.38.104.168.057.34.104.381.104.042 0 .076.02.076.042 0 .023.04.042.088.042.048 0 .122.017.163.038.042.02.193.07.337.11.274.076.366.106.544.176.06.024.285.096.5.16.216.064.41.132.433.15a.224.224 0 0 0 .12.035.4.4 0 0 1 .155.04c.042.02.193.07.337.108.144.038.3.084.348.103.178.07.613.125.954.122.365-.004.908-.078.965-.133a.16.16 0 0 1 .096-.031c.08 0 .707-.291.784-.364.032-.03.073-.054.09-.054.053 0 .632-.55.748-.71.195-.27.432-.71.432-.803 0-.04.02-.083.044-.097.024-.014.043-.077.043-.14 0-.063.023-.137.05-.163.034-.033.059-.404.077-1.148l.026-1.1 2.894-.023c2.31-.02 2.939-.037 3.119-.084.123-.033.24-.074.257-.091.018-.017.077-.031.132-.031.054 0 .11-.02.125-.042.015-.023.055-.042.089-.042.19 0 1.14-.54 1.493-.849.456-.398.898-.926 1.095-1.304a.916.916 0 0 1 .088-.147c.02-.018.06-.104.219-.48.02-.047.059-.16.088-.252.029-.091.069-.214.09-.271.125-.356.146-.97.146-4.265 0-3.563-.003-3.626-.205-3.987-.204-.364-.756-.78-1.036-.78-.045 0-.093-.019-.108-.042-.035-.054-.661-.054-.696 0-.015.023-.066.042-.113.042-.256 0-.85.449-1.002.757-.253.514-.256.568-.256 4.24v3.287l-.11.222c-.06.123-.186.306-.28.408-.171.188-.551.41-.7.41-.044 0-.092.02-.107.042-.018.027-.943.042-2.635.042h-2.608l-.011-12.165c-.01-9.665-.023-12.176-.066-12.218a.236.236 0 0 1-.055-.149.426.426 0 0 0-.039-.169 4.357 4.357 0 0 1-.118-.26c-.201-.477-.692-1.057-1.127-1.332a2.216 2.216 0 0 1-.196-.134c-.054-.058-.664-.307-.848-.346-.048-.01 1.66-.021 3.795-.024 2.546-.003 3.89.01 3.908.037.015.023.064.042.11.042.19 0 .646.313.82.561.274.39.267.31.267 3.032 0 2.402.02 2.851.14 3.139.245.59.71.966 1.318 1.068.33.055.642.012.979-.134.242-.105.696-.489.696-.588 0-.03.015-.054.033-.054.042 0 .166-.305.213-.522.058-.272.046-5.251-.015-5.666a4.778 4.778 0 0 0-.27-1.066 9.014 9.014 0 0 0-.397-.773 2.902 2.902 0 0 1-.161-.23 3.223 3.223 0 0 0-.298-.377 7.831 7.831 0 0 1-.23-.25c-.149-.175-.564-.502-.91-.717a5.197 5.197 0 0 0-.38-.224c-.011 0-.133-.05-.271-.11a4.346 4.346 0 0 0-.98-.319C22.442.018 3.025-.029 2.973.022Zm28.17 7.903c-.364.092-.514.172-.764.407-.225.21-.38.445-.487.737-.04.11-.054.77-.055 2.645v2.498h-3.457c-2.258 0-3.467.015-3.485.042-.014.023-.063.042-.107.042-.138 0-.449.18-.655.379-.194.187-.38.497-.474.794-.06.187-.062.653-.004.687.024.015.044.06.044.102 0 .17.198.495.443.724.141.132.285.24.32.24.035 0 .063.02.063.042 0 .023.036.042.08.042.044 0 .094.014.111.03.125.12.504.134 3.78.136l3.34.001.014 2.52c.015 2.39.032 2.79.122 2.79.021 0 .039.038.039.084 0 .046.02.084.043.084.024 0 .044.026.044.058 0 .073.476.527.552.527.032 0 .057.016.057.036 0 .02.108.069.24.109.35.106 1.009.076 1.305-.059.175-.08.895-.75 3.656-3.406 1.89-1.82 3.487-3.373 3.548-3.454.278-.37.388-.944.256-1.342-.15-.456-.165-.47-3.737-3.915-1.915-1.846-3.511-3.356-3.547-3.356-.037 0-.067-.014-.067-.031 0-.074-.636-.261-.87-.256-.06.001-.217.03-.349.063Z\",\n clipRule: \"evenodd\",\n }),\n }\n )\n );\n}\n\nvar OAuth2LogoutScreenInner = uiEntry.withOverride(\"OAuth2LogoutScreenInner\", function OAuth2LogoutScreenInner(props) {\n var t = translationContext.useTranslation();\n return jsxRuntime.jsxs(jsxRuntime.Fragment, {\n children: [\n jsxRuntime.jsx(LogoutIcon, {}),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle\" },\n { children: t(\"LOGGING_OUT\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle\" },\n { children: t(\"LOGOUT_CONFIRMATION\") }\n )\n ),\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n jsxRuntime.jsx(button.Button, {\n disabled: props.isLoggingOut,\n isLoading: props.isLoggingOut,\n type: \"button\",\n label: t(\"LOGOUT\"),\n onClick: props.onLogoutClicked,\n }),\n ],\n });\n});\n\nvar OAuth2LogoutScreen$1 = function (props) {\n if (props.showSpinner) {\n return jsxRuntime.jsx(uiEntry.DynamicLoginMethodsSpinner, {});\n }\n return jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"oauth2Logout container\" },\n {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: jsxRuntime.jsx(OAuth2LogoutScreenInner, {\n isLoggingOut: props.isLoggingOut,\n onLogoutClicked: props.onLogoutClicked,\n }),\n }\n )\n ),\n jsxRuntime.jsx(uiEntry.SuperTokensBranding, {}),\n ],\n }\n )\n );\n};\nvar OAuth2LogoutScreenTheme = function (props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, props.config.oauth2LogoutScreen.style] },\n { children: jsxRuntime.jsx(OAuth2LogoutScreen$1, genericComponentOverrideContext.__assign({}, props)) }\n )\n );\n};\n\nvar defaultTranslationsOAuth2Provider = {\n en: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, uiEntry.defaultTranslationsCommon.en),\n { LOGGING_OUT: \"Logging Out\", LOGOUT_CONFIRMATION: \"Are you sure you want to log out?\", LOGOUT: \"LOG OUT\" }\n ),\n};\n\nvar OAuth2LogoutScreen = function (props) {\n var _a, _b, _c;\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var sessionContext = React__namespace.useContext(uiEntry.SessionContext);\n var _d = React__namespace.useState(false),\n isLoggingOut = _d[0],\n setIsLoggingOut = _d[1];\n var recipeComponentOverrides = props.useComponentOverrides();\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var logoutChallenge =\n (_a = genericComponentOverrideContext.getQueryParams(\"logoutChallenge\")) !== null && _a !== void 0\n ? _a\n : undefined;\n var navigate =\n (_b = props.navigate) !== null && _b !== void 0\n ? _b\n : (_c = uiEntry.UI.getReactRouterDomWithCustomHistory()) === null || _c === void 0\n ? void 0\n : _c.useHistoryCustom();\n var onLogout = React__namespace.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var frontendRedirectTo, err_1;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (logoutChallenge === undefined) {\n return [2 /*return*/];\n }\n setIsLoggingOut(true);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, , 6]);\n return [\n 4 /*yield*/,\n recipe.OAuth2Provider.getInstanceOrThrow().webJSRecipe.logOut({\n logoutChallenge: logoutChallenge,\n userContext: userContext,\n }),\n ];\n case 2:\n frontendRedirectTo = _a.sent().frontendRedirectTo;\n return [\n 4 /*yield*/,\n props.recipe.redirect(\n {\n recipeId: \"oauth2provider\",\n action: \"POST_OAUTH2_LOGOUT_REDIRECT\",\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n frontendRedirectTo: frontendRedirectTo,\n },\n navigate,\n {},\n userContext\n ),\n ];\n case 3:\n _a.sent();\n return [3 /*break*/, 6];\n case 4:\n err_1 = _a.sent();\n return [4 /*yield*/, session.doesSessionExist(userContext)];\n case 5:\n if (!_a.sent()) {\n void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()\n .redirectToAuth({\n userContext: userContext,\n redirectBack: false,\n })\n .catch(rethrowInRender);\n } else {\n rethrowInRender(err_1);\n }\n return [3 /*break*/, 6];\n case 6:\n return [2 /*return*/];\n }\n });\n });\n },\n [logoutChallenge, navigate, props.recipe, userContext, rethrowInRender]\n );\n React__namespace.useEffect(\n function () {\n // We wait for session loading to finish\n if (sessionContext.loading === false) {\n // Redirect to the auth page if there is no logoutChallenge\n if (logoutChallenge === undefined) {\n void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()\n .redirectToAuth({\n userContext: userContext,\n redirectBack: false,\n })\n .catch(rethrowInRender);\n } else {\n // Call logOut directly if there is no session\n if (sessionContext.doesSessionExist === false) {\n void onLogout();\n }\n }\n }\n },\n [userContext, logoutChallenge, sessionContext, onLogout]\n );\n var childProps = {\n config: props.recipe.config,\n showSpinner: sessionContext.loading || sessionContext.doesSessionExist === false,\n onLogoutClicked: onLogout,\n isLoggingOut: isLoggingOut,\n };\n if (logoutChallenge === undefined) {\n return null;\n }\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: defaultTranslationsOAuth2Provider,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n OAuth2LogoutScreenTheme,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n ),\n }\n )\n );\n};\n\nvar TryRefreshPage$1 = function (props) {\n var _a;\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var sessionContext = React.useContext(uiEntry.SessionContext);\n var loginChallenge =\n (_a = genericComponentOverrideContext.getQueryParams(\"loginChallenge\")) !== null && _a !== void 0\n ? _a\n : undefined;\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n React__namespace.useEffect(\n function () {\n if (sessionContext.loading === false) {\n if (loginChallenge) {\n (function () {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var frontendRedirectTo;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.getRedirectURLToContinueOAuthFlow({\n loginChallenge: loginChallenge,\n userContext: userContext,\n }),\n ];\n case 1:\n frontendRedirectTo = _a.sent().frontendRedirectTo;\n return [\n 2 /*return*/,\n props.recipe.redirect(\n {\n action: \"CONTINUE_OAUTH2_AFTER_REFRESH\",\n frontendRedirectTo: frontendRedirectTo,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n recipeId: \"oauth2provider\",\n },\n props.navigate,\n {},\n userContext\n ),\n ];\n }\n });\n });\n })().catch(rethrowInRender);\n } else {\n void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()\n .redirectToAuth({\n userContext: userContext,\n redirectBack: false,\n })\n .catch(rethrowInRender);\n }\n }\n },\n [loginChallenge, props.recipe, props.navigate, userContext, sessionContext]\n );\n var childProps = {\n config: props.recipe.config,\n };\n return jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: defaultTranslationsOAuth2Provider,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined && jsxRuntime.jsx(uiEntry.DynamicLoginMethodsSpinner, {}),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n );\n};\n\n/* Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar DEFAULT_TRY_REFRESH_PATH = \"/try-refresh\";\nvar DEFAULT_OAUTH2_LOGOUT_PATH = \"/oauth/logout\";\n\nvar OAuth2ProviderPreBuiltUI = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(OAuth2ProviderPreBuiltUI, _super);\n function OAuth2ProviderPreBuiltUI(recipeInstance) {\n var _this = _super.call(this) || this;\n _this.recipeInstance = recipeInstance;\n _this.languageTranslations = defaultTranslationsOAuth2Provider;\n // Instance methods\n _this.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n if (_this.recipeInstance.config.disableDefaultUI) {\n return {};\n }\n var features = {};\n if (_this.recipeInstance.config.tryRefreshPage.disableDefaultUI !== true) {\n var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath(\n new NormalisedURLPath__default.default(DEFAULT_TRY_REFRESH_PATH)\n );\n features[normalisedFullPath.getAsStringDangerous()] = {\n matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams(\n _this.recipeInstance.config.recipeId\n ),\n component: function (props) {\n return _this.getFeatureComponent(\"try-refresh-page\", props, useComponentOverrides);\n },\n recipeID: recipe.OAuth2Provider.RECIPE_ID,\n };\n }\n if (_this.recipeInstance.config.oauth2LogoutScreen.disableDefaultUI !== true) {\n var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath(\n new NormalisedURLPath__default.default(DEFAULT_OAUTH2_LOGOUT_PATH)\n );\n features[normalisedFullPath.getAsStringDangerous()] = {\n matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams(\n _this.recipeInstance.config.recipeId\n ),\n component: function (props) {\n return _this.getFeatureComponent(\"oauth2-logout-screen\", props, useComponentOverrides);\n },\n recipeID: recipe.OAuth2Provider.RECIPE_ID,\n };\n }\n return features;\n };\n _this.getFeatureComponent = function (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n componentName,\n props,\n useComponentOverrides\n ) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n if (componentName === \"try-refresh-page\") {\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n session.SessionAuth,\n genericComponentOverrideContext.__assign(\n {\n requireAuth: false,\n overrideGlobalClaimValidators: function () {\n return [];\n },\n },\n {\n children: jsxRuntime.jsx(\n TryRefreshPage$1,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: useComponentOverrides,\n },\n props\n )\n ),\n }\n )\n ),\n }\n )\n );\n } else if (componentName === \"oauth2-logout-screen\") {\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n session.SessionAuth,\n genericComponentOverrideContext.__assign(\n {\n requireAuth: false,\n overrideGlobalClaimValidators: function () {\n return [];\n },\n },\n {\n children: jsxRuntime.jsx(\n OAuth2LogoutScreen,\n genericComponentOverrideContext.__assign(\n {\n recipe: _this.recipeInstance,\n useComponentOverrides: useComponentOverrides,\n },\n props\n )\n ),\n }\n )\n ),\n }\n )\n );\n }\n throw new Error(\"Should never come here.\");\n };\n return _this;\n }\n // Static methods\n OAuth2ProviderPreBuiltUI.getInstanceOrInitAndGetInstance = function () {\n if (OAuth2ProviderPreBuiltUI.instance === undefined) {\n var recipeInstance = recipe.OAuth2Provider.getInstanceOrThrow();\n OAuth2ProviderPreBuiltUI.instance = new OAuth2ProviderPreBuiltUI(recipeInstance);\n }\n return OAuth2ProviderPreBuiltUI.instance;\n };\n OAuth2ProviderPreBuiltUI.getFeatures = function (useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return OAuth2ProviderPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides);\n };\n OAuth2ProviderPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) {\n if (useComponentOverrides === void 0) {\n useComponentOverrides = componentOverrideContext.useContext;\n }\n return OAuth2ProviderPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n componentName,\n props,\n useComponentOverrides\n );\n };\n OAuth2ProviderPreBuiltUI.prototype.getAuthComponents = function () {\n return [];\n };\n // For tests\n OAuth2ProviderPreBuiltUI.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n OAuth2ProviderPreBuiltUI.instance = undefined;\n return;\n };\n OAuth2ProviderPreBuiltUI.TryRefreshPage = function (props) {\n return OAuth2ProviderPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n \"try-refresh-page\",\n props\n );\n };\n OAuth2ProviderPreBuiltUI.OAuth2LogoutScreen = function (props) {\n return OAuth2ProviderPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent(\n \"oauth2-logout-screen\",\n props\n );\n };\n return OAuth2ProviderPreBuiltUI;\n})(uiEntry.RecipeRouter);\nvar TryRefreshPage = OAuth2ProviderPreBuiltUI.TryRefreshPage;\n\nexports.OAuth2ProviderPreBuiltUI = OAuth2ProviderPreBuiltUI;\nexports.TryRefreshPage = TryRefreshPage;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar PasswordlessWebJS = require(\"supertokens-web-js/recipe/passwordless\");\nvar postSuperTokensInitCallbacks = require(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar index = require(\"./authRecipe-shared2.js\");\nvar recipe = require(\"./multifactorauth-shared2.js\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar utils = require(\"./authRecipe-shared.js\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nvar PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS);\n\nvar _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(),\n useContext = _a[0],\n Provider = _a[1];\n\nvar OTPEmailIcon = function () {\n return jsxRuntime.jsxs(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"17\", height: \"15\", viewBox: \"0 0 17 15\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: [\n jsxRuntime.jsx(\"path\", {\n id: \"image 414 (Traced)\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M2.01513 0.0546421C1.19571 0.195435 0.393224 0.877322 0.143564 1.64496C0.0564841 1.9127 -0.00197242 1.84636 0.659082 2.22993C0.91105 2.37612 1.64082 2.80042 2.28084 3.17276C2.92086 3.54514 3.96809 4.1544 4.60811 4.52674C5.24813 4.89905 6.37321 5.55428 7.10833 5.98278C7.84346 6.41131 8.46401 6.7689 8.48736 6.77743C8.52111 6.78982 10.4367 5.69077 12.6253 4.40341C12.7865 4.30852 13.8173 3.70613 14.9159 3.06475L16.9133 1.89856L16.903 1.78079C16.8974 1.71603 16.8178 1.51568 16.7262 1.3356C16.3776 0.650318 15.6775 0.156143 14.8905 0.039982C14.4716 -0.0218423 2.38016 -0.00809191 2.01513 0.0546421ZM6.60933e-06 6.62054C0.000739608 10.251 -0.00834948 10.1158 0.27063 10.655C0.659815 11.4073 1.39721 11.8833 2.30408 11.9675C2.77169 12.0109 14.2345 12.0108 14.7024 11.9673C15.3604 11.9062 15.8152 11.7008 16.2911 11.2498C16.5236 11.0295 16.619 10.9066 16.7395 10.6725C17.0173 10.133 17.0065 10.3025 16.996 6.65494L16.9866 3.40211L15.8322 4.07294C15.1972 4.44186 13.9767 5.15156 13.1201 5.65004C11.2459 6.74049 10.2603 7.31342 9.46206 7.77628C8.76656 8.17962 8.59368 8.23389 8.2745 8.14908C8.14446 8.11454 7.64668 7.84559 6.81451 7.36034C4.15032 5.80665 0.097862 3.44588 0.0268711 3.40617C0.0117346 3.39774 -0.00032324 4.84419 6.60933e-06 6.62054Z\",\n fill: \"url(#paint0_linear_4445_310)\",\n }),\n jsxRuntime.jsx(\"defs\", {\n children: jsxRuntime.jsxs(\n \"linearGradient\",\n genericComponentOverrideContext.__assign(\n {\n id: \"paint0_linear_4445_310\",\n x1: \"8.5\",\n y1: \"0\",\n x2: \"8.5\",\n y2: \"12\",\n gradientUnits: \"userSpaceOnUse\",\n },\n {\n children: [\n jsxRuntime.jsx(\"stop\", { stopColor: \"#1C222A\" }),\n jsxRuntime.jsx(\"stop\", { offset: \"1\", stopColor: \"#1C222A\" }),\n ],\n }\n )\n ),\n }),\n ],\n }\n )\n );\n};\n\nvar OTPSMSIcon = function () {\n return jsxRuntime.jsxs(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"17\", height: \"15\", viewBox: \"0 0 17 15\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: [\n jsxRuntime.jsx(\"path\", {\n id: \"image 412 (Traced)\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M2.23143 0.0484105C1.11677 0.26606 0.230705 1.14148 0.0548812 2.19882C0.0207171 2.40417 -0.000319148 3.89779 3.66265e-06 6.09367C0.000595481 10.0175 0.00446909 10.0713 0.330507 10.706C0.544477 11.1223 1.03692 11.597 1.49058 11.8243C1.9253 12.042 2.4213 12.1389 3.10571 12.14L3.65718 12.1409L3.65739 13.3581C3.65755 14.4585 3.66729 14.5903 3.75859 14.733C3.88347 14.9281 4.1338 15.0332 4.37209 14.9906C4.50192 14.9674 5.03536 14.5737 6.32332 13.5507L8.09582 12.1427L11.2701 12.1409C14.8062 12.1389 14.8922 12.1322 15.5441 11.8059C15.9514 11.602 16.4058 11.1868 16.6406 10.8041C16.7198 10.6748 16.8331 10.3886 16.8923 10.1681C16.9951 9.78536 17 9.6 17 6.0949C17 3.67866 16.98 2.31864 16.9417 2.11857C16.7993 1.37604 16.1965 0.620747 15.4792 0.286303C15.2652 0.186472 14.9464 0.0801328 14.7708 0.049999C14.3886 -0.0156495 2.5671 -0.0171356 2.23143 0.0484105ZM5.24433 4.97226C5.37743 5.00736 5.55471 5.1197 5.70901 5.26668C6.20818 5.74216 6.20834 6.40218 5.70933 6.86336C5.19445 7.3393 4.53167 7.33945 4.03228 6.86382C3.54451 6.3992 3.53069 5.75907 3.99822 5.28943C4.33561 4.95053 4.75602 4.84352 5.24433 4.97226ZM8.87594 4.96544C9.55686 5.14589 9.9071 5.95945 9.57246 6.58313C9.13161 7.40469 7.91806 7.41591 7.45342 6.60271C7.32215 6.37302 7.3066 6.29861 7.32494 5.98907C7.34211 5.69977 7.37455 5.59794 7.50653 5.41904C7.804 5.01592 8.36509 4.83005 8.87594 4.96544ZM12.7023 5.05815C13.4409 5.4257 13.5612 6.36097 12.94 6.90635C12.6706 7.14291 12.3468 7.24567 12.0095 7.20164C11.0115 7.07132 10.59 5.99614 11.2623 5.29563C11.6485 4.89313 12.1909 4.80365 12.7023 5.05815Z\",\n fill: \"url(#paint0_linear_4445_316)\",\n }),\n jsxRuntime.jsx(\"defs\", {\n children: jsxRuntime.jsxs(\n \"linearGradient\",\n genericComponentOverrideContext.__assign(\n {\n id: \"paint0_linear_4445_316\",\n x1: \"8.5\",\n y1: \"0\",\n x2: \"8.5\",\n y2: \"15\",\n gradientUnits: \"userSpaceOnUse\",\n },\n {\n children: [\n jsxRuntime.jsx(\"stop\", { stopColor: \"#1C222A\" }),\n jsxRuntime.jsx(\"stop\", { offset: \"1\", stopColor: \"#1C222A\" }),\n ],\n }\n )\n ),\n }),\n ],\n }\n )\n );\n};\n\nvar getFunctionOverrides = function (onHandleEvent) {\n return function (originalImp) {\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), {\n createCode: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.createCode(input)];\n case 1:\n response = _a.sent();\n if (response.status === \"OK\") {\n onHandleEvent({\n action: \"PASSWORDLESS_CODE_SENT\",\n isResend: false,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n resendCode: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var response;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImp.resendCode(input)];\n case 1:\n response = _a.sent();\n if (response.status === \"RESTART_FLOW_ERROR\") {\n onHandleEvent({\n action: \"PASSWORDLESS_RESTART_FLOW\",\n });\n } else if (response.status === \"OK\") {\n onHandleEvent({\n action: \"PASSWORDLESS_CODE_SENT\",\n isResend: true,\n });\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n consumeCode: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var payloadBeforeCall, response, payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 1:\n payloadBeforeCall = _c.sent();\n return [3 /*break*/, 3];\n case 2:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadBeforeCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [4 /*yield*/, originalImp.consumeCode(input)];\n case 4:\n response = _c.sent();\n if (!(response.status === \"RESTART_FLOW_ERROR\")) return [3 /*break*/, 5];\n onHandleEvent({\n action: \"PASSWORDLESS_RESTART_FLOW\",\n });\n return [3 /*break*/, 10];\n case 5:\n if (!(response.status === \"OK\")) return [3 /*break*/, 10];\n payloadAfterCall = void 0;\n _c.label = 6;\n case 6:\n _c.trys.push([6, 8, , 9]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: input.userContext,\n }),\n ];\n case 7:\n payloadAfterCall = _c.sent();\n return [3 /*break*/, 9];\n case 8:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadAfterCall = undefined;\n return [3 /*break*/, 9];\n case 9:\n onHandleEvent({\n action: \"SUCCESS\",\n isNewRecipeUser: response.createdNewRecipeUser,\n user: response.user,\n createdNewSession:\n payloadAfterCall !== undefined &&\n (payloadBeforeCall === undefined ||\n payloadBeforeCall.sessionHandle !== payloadAfterCall.sessionHandle),\n });\n _c.label = 10;\n case 10:\n return [2 /*return*/, response];\n }\n });\n });\n },\n setLoginAttemptInfo: function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n originalImp.setLoginAttemptInfo(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input),\n {\n attemptInfo: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, input.attemptInfo),\n input.userContext.additionalAttemptInfo\n ),\n }\n )\n ),\n ];\n });\n });\n },\n });\n };\n};\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction defaultEmailValidator(value) {\n if (typeof value !== \"string\") {\n return \"GENERAL_ERROR_EMAIL_NON_STRING\";\n }\n value = value.trim();\n var defaultEmailValidatorRegexp =\n // eslint-disable-next-line no-useless-escape\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // We check if the email syntax is correct\n // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438\n // Regex from https://stackoverflow.com/a/46181/3867175\n if (value.match(defaultEmailValidatorRegexp) === null) {\n return \"GENERAL_ERROR_EMAIL_INVALID\";\n }\n return undefined;\n}\nfunction userInputCodeValidate(value) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"GENERAL_ERROR_OTP_NON_STRING\"];\n }\n if (value.length === 0) {\n return [2 /*return*/, \"GENERAL_ERROR_OTP_EMPTY\"];\n }\n return [2 /*return*/, undefined];\n });\n });\n}\n/*\n * defaultValidate\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction defaultValidate(_) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [2 /*return*/, undefined];\n });\n });\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nfunction normalisePasswordlessConfig(config) {\n if (config === undefined) {\n throw new Error(\"Passwordless config should not be empty\");\n }\n if (![\"EMAIL\", \"PHONE\", \"EMAIL_OR_PHONE\"].includes(config.contactMethod)) {\n throw new Error(\"Please pass one of 'PHONE', 'EMAIL' or 'EMAIL_OR_PHONE' as the contactMethod\");\n }\n var signInUpFeature = normalizeSignInUpFeatureConfig(config.signInUpFeature, config);\n var override = genericComponentOverrideContext.__assign(\n {\n functions: function (originalImplementation) {\n return originalImplementation;\n },\n },\n config.override\n );\n var validateEmailAddress = defaultEmailValidator;\n if (\n (config.contactMethod === \"EMAIL\" || config.contactMethod === \"EMAIL_OR_PHONE\") &&\n config.validateEmailAddress !== undefined\n ) {\n validateEmailAddress = config.validateEmailAddress;\n }\n var validatePhoneNumber = undefined;\n if (\n (config.contactMethod === \"PHONE\" || config.contactMethod === \"EMAIL_OR_PHONE\") &&\n config.validatePhoneNumber !== undefined\n ) {\n validatePhoneNumber = config.validatePhoneNumber;\n }\n return genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)),\n {\n validateEmailAddress: validateEmailAddress,\n validatePhoneNumber: validatePhoneNumber,\n signInUpFeature: signInUpFeature,\n linkClickedScreenFeature: normalisePasswordlessBaseConfig(config.linkClickedScreenFeature),\n mfaFeature: normalisePasswordlessBaseConfig(config.mfaFeature),\n contactMethod: config.contactMethod,\n override: override,\n }\n );\n}\nfunction normalizeSignInUpFeatureConfig(signInUpInput, config) {\n if (\n (signInUpInput === null || signInUpInput === void 0 ? void 0 : signInUpInput.resendEmailOrSMSGapInSeconds) !==\n undefined &&\n signInUpInput.resendEmailOrSMSGapInSeconds <= 0\n ) {\n throw new Error(\"Please pass a positive number as resendEmailOrSMSGapInSeconds\");\n }\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, signInUpInput), {\n resendEmailOrSMSGapInSeconds:\n (signInUpInput === null || signInUpInput === void 0\n ? void 0\n : signInUpInput.resendEmailOrSMSGapInSeconds) === undefined\n ? 15\n : signInUpInput.resendEmailOrSMSGapInSeconds,\n emailOrPhoneFormStyle:\n (signInUpInput === null || signInUpInput === void 0 ? void 0 : signInUpInput.emailOrPhoneFormStyle) !==\n undefined\n ? signInUpInput.emailOrPhoneFormStyle\n : \"\",\n linkSentScreenStyle:\n (signInUpInput === null || signInUpInput === void 0 ? void 0 : signInUpInput.linkSentScreenStyle) !==\n undefined\n ? signInUpInput.linkSentScreenStyle\n : \"\",\n userInputCodeFormStyle:\n (signInUpInput === null || signInUpInput === void 0 ? void 0 : signInUpInput.userInputCodeFormStyle) !==\n undefined\n ? signInUpInput.userInputCodeFormStyle\n : \"\",\n defaultCountry:\n [\"PHONE\", \"EMAIL_OR_PHONE\"].includes(config.contactMethod) &&\n signInUpInput !== undefined &&\n \"defaultCountry\" in signInUpInput\n ? signInUpInput.defaultCountry\n : undefined,\n defaultToEmail:\n signInUpInput !== undefined &&\n \"defaultToEmail\" in signInUpInput &&\n signInUpInput.defaultToEmail !== undefined\n ? signInUpInput.defaultToEmail\n : true,\n });\n}\nfunction normalisePasswordlessBaseConfig(config) {\n var style = config && config.style !== undefined ? config.style : \"\";\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, config), {\n style: style,\n });\n}\nfunction checkAdditionalLoginAttemptInfoProperties(loginAttemptInfo) {\n if (\n loginAttemptInfo.contactInfo === undefined ||\n loginAttemptInfo.contactMethod === undefined ||\n loginAttemptInfo.lastResend === undefined\n ) {\n return false;\n }\n return true;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar otpPhoneFactor = {\n id: types.FactorIds.OTP_PHONE,\n name: \"PWLESS_MFA_OTP_PHONE_NAME\",\n description: \"PWLESS_MFA_OTP_PHONE_DESCRIPTION\",\n path: \"/mfa/otp-phone\",\n logo: OTPSMSIcon,\n};\nvar otpEmailFactor = {\n id: types.FactorIds.OTP_EMAIL,\n name: \"PWLESS_MFA_OTP_EMAIL_NAME\",\n description: \"PWLESS_MFA_OTP_EMAIL_DESCRIPTION\",\n path: \"/mfa/otp-email\",\n logo: OTPEmailIcon,\n};\n/*\n * Class.\n */\nvar Passwordless = /** @class */ (function (_super) {\n genericComponentOverrideContext.__extends(Passwordless, _super);\n function Passwordless(config, webJSRecipe) {\n if (webJSRecipe === void 0) {\n webJSRecipe = PasswordlessWebJS__default.default;\n }\n var _this = _super.call(this, config) || this;\n _this.webJSRecipe = webJSRecipe;\n _this.recipeID = Passwordless.RECIPE_ID;\n _this.firstFactorIds = [\n types.FactorIds.OTP_EMAIL,\n types.FactorIds.OTP_PHONE,\n types.FactorIds.LINK_EMAIL,\n types.FactorIds.LINK_PHONE,\n ];\n _this.getDefaultRedirectionURL = function (context) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)];\n });\n });\n };\n _this.recipeID = config.recipeId;\n postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () {\n var mfa = recipe.MultiFactorAuth.getInstance();\n if (mfa !== undefined) {\n mfa.addMFAFactors([otpPhoneFactor, otpEmailFactor]);\n }\n });\n return _this;\n }\n Passwordless.prototype.getFirstFactorsForAuthPage = function () {\n if (this.config.contactMethod === \"EMAIL\") {\n return [types.FactorIds.OTP_EMAIL, types.FactorIds.LINK_EMAIL];\n }\n if (this.config.contactMethod === \"PHONE\") {\n return [types.FactorIds.OTP_PHONE, types.FactorIds.LINK_PHONE];\n }\n return this.firstFactorIds;\n };\n Passwordless.init = function (config) {\n var normalisedConfig = normalisePasswordlessConfig(config);\n return {\n recipeID: Passwordless.RECIPE_ID,\n authReact: function (appInfo) {\n Passwordless.instance = new Passwordless(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n { appInfo: appInfo, recipeId: Passwordless.RECIPE_ID }\n )\n );\n return Passwordless.instance;\n },\n webJS: PasswordlessWebJS__default.default.init(\n genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, normalisedConfig),\n {\n override: {\n functions: function (originalImpl, builder) {\n var functions = getFunctionOverrides(normalisedConfig.onHandleEvent);\n builder.override(functions);\n builder.override(normalisedConfig.override.functions);\n return originalImpl;\n },\n },\n }\n )\n ),\n };\n };\n Passwordless.getInstanceOrThrow = function () {\n if (Passwordless.instance === undefined) {\n var error =\n \"No instance of Passwordless found. Make sure to call the Passwordless.init method.\" +\n \"See https://supertokens.io/docs/passwordless/quick-setup/frontend\";\n // eslint-disable-next-line supertokens-auth-react/no-direct-window-object\n if (typeof window === \"undefined\") {\n error = error + genericComponentOverrideContext.SSR_ERROR;\n }\n throw Error(error);\n }\n return Passwordless.instance;\n };\n /*\n * Tests methods.\n */\n Passwordless.reset = function () {\n if (!genericComponentOverrideContext.isTest()) {\n return;\n }\n Passwordless.instance = undefined;\n return;\n };\n Passwordless.RECIPE_ID = \"passwordless\";\n return Passwordless;\n})(index.AuthRecipe);\n\nexports.Passwordless = Passwordless;\nexports.Provider = Provider;\nexports.checkAdditionalLoginAttemptInfoProperties = checkAdditionalLoginAttemptInfoProperties;\nexports.defaultValidate = defaultValidate;\nexports.useContext = useContext;\nexports.userInputCodeValidate = userInputCodeValidate;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar recipe = require(\"./passwordless-shared.js\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/utils/windowHandler\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"react\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"supertokens-web-js/utils/normalisedURLPath\");\nrequire(\"react/jsx-runtime\");\nrequire(\"supertokens-web-js/recipe/passwordless\");\nrequire(\"./authRecipe-shared2.js\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./multifactorauth-shared.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./multifactorauth-shared2.js\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"./authRecipe-shared.js\");\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\nvar Wrapper = /** @class */ (function () {\n function Wrapper() {}\n Wrapper.init = function (config) {\n return recipe.Passwordless.init(config);\n };\n Wrapper.signOut = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().signOut({\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n }),\n ];\n });\n });\n };\n Wrapper.createCode = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.createCode(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.resendCode = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.resendCode(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.consumeCode = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.consumeCode(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.getLinkCodeFromURL = function (input) {\n return recipe.Passwordless.getInstanceOrThrow().webJSRecipe.getLinkCodeFromURL(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n );\n };\n Wrapper.getPreAuthSessionIdFromURL = function (input) {\n return recipe.Passwordless.getInstanceOrThrow().webJSRecipe.getPreAuthSessionIdFromURL(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n );\n };\n Wrapper.doesEmailExist = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.doesEmailExist(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.doesPhoneNumberExist = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.doesPhoneNumberExist(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.getLoginAttemptInfo = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.getLoginAttemptInfo(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.setLoginAttemptInfo = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.setLoginAttemptInfo(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(input.userContext),\n })\n ),\n ];\n });\n });\n };\n Wrapper.clearLoginAttemptInfo = function (input) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n return [\n 2 /*return*/,\n recipe.Passwordless.getInstanceOrThrow().webJSRecipe.clearLoginAttemptInfo(\n genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), {\n userContext: genericComponentOverrideContext.getNormalisedUserContext(\n input === null || input === void 0 ? void 0 : input.userContext\n ),\n })\n ),\n ];\n });\n });\n };\n Wrapper.ComponentsOverrideProvider = recipe.Provider;\n return Wrapper;\n})();\nvar init = Wrapper.init;\nvar createCode = Wrapper.createCode;\nvar resendCode = Wrapper.resendCode;\nvar consumeCode = Wrapper.consumeCode;\nvar getLinkCodeFromURL = Wrapper.getLinkCodeFromURL;\nvar getPreAuthSessionIdFromURL = Wrapper.getPreAuthSessionIdFromURL;\nvar doesEmailExist = Wrapper.doesEmailExist;\nvar doesPhoneNumberExist = Wrapper.doesPhoneNumberExist;\nvar getLoginAttemptInfo = Wrapper.getLoginAttemptInfo;\nvar setLoginAttemptInfo = Wrapper.setLoginAttemptInfo;\nvar clearLoginAttemptInfo = Wrapper.clearLoginAttemptInfo;\nvar signOut = Wrapper.signOut;\nvar PasswordlessComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider;\n\nexports.PasswordlessComponentsOverrideProvider = PasswordlessComponentsOverrideProvider;\nexports.clearLoginAttemptInfo = clearLoginAttemptInfo;\nexports.consumeCode = consumeCode;\nexports.createCode = createCode;\nexports.default = Wrapper;\nexports.doesEmailExist = doesEmailExist;\nexports.doesPhoneNumberExist = doesPhoneNumberExist;\nexports.getLinkCodeFromURL = getLinkCodeFromURL;\nexports.getLoginAttemptInfo = getLoginAttemptInfo;\nexports.getPreAuthSessionIdFromURL = getPreAuthSessionIdFromURL;\nexports.init = init;\nexports.resendCode = resendCode;\nexports.setLoginAttemptInfo = setLoginAttemptInfo;\nexports.signOut = signOut;\n","\"use strict\";\n\nvar genericComponentOverrideContext = require(\"./genericComponentOverrideContext.js\");\nvar React = require(\"react\");\nvar jsxRuntime = require(\"react/jsx-runtime\");\nvar NormalisedURLPath = require(\"supertokens-web-js/utils/normalisedURLPath\");\nvar uiEntry = require(\"./index2.js\");\nvar recipe$1 = require(\"./emailpassword-shared3.js\");\nrequire(\"./multifactorauth.js\");\nvar session = require(\"./session.js\");\nvar recipe$2 = require(\"./passwordless-shared.js\");\nvar authCompWrapper = require(\"./authCompWrapper.js\");\nvar button = require(\"./emailpassword-shared.js\");\nvar translationContext = require(\"./translationContext.js\");\nvar STGeneralError = require(\"supertokens-web-js/utils/error\");\nvar types = require(\"./multifactorauth-shared.js\");\nvar emailverification = require(\"./emailverification.js\");\nvar recipe = require(\"./emailverification-shared.js\");\nvar arrowLeftIcon = require(\"./arrowLeftIcon.js\");\nvar emailLargeIcon = require(\"./emailLargeIcon.js\");\nvar windowHandler = require(\"supertokens-web-js/utils/windowHandler\");\nvar recipe$3 = require(\"./multifactorauth-shared2.js\");\nvar sessionprebuiltui = require(\"./sessionprebuiltui.js\");\nvar formBase = require(\"./emailpassword-shared5.js\");\nvar STGeneralError$1 = require(\"supertokens-web-js/lib/build/error\");\nrequire(\"supertokens-web-js\");\nrequire(\"supertokens-web-js/utils/cookieHandler\");\nrequire(\"supertokens-web-js/utils/postSuperTokensInitCallbacks\");\nrequire(\"supertokens-web-js/recipe/multitenancy\");\nrequire(\"supertokens-web-js/utils\");\nrequire(\"supertokens-web-js/utils/normalisedURLDomain\");\nrequire(\"react-dom\");\nrequire(\"./multitenancy-shared.js\");\nrequire(\"./oauth2provider-shared.js\");\nrequire(\"supertokens-web-js/recipe/oauth2provider\");\nrequire(\"./recipeModule-shared.js\");\nrequire(\"./authRecipe-shared.js\");\nrequire(\"supertokens-web-js/lib/build/normalisedURLPath\");\nrequire(\"supertokens-web-js/recipe/emailpassword\");\nrequire(\"./authRecipe-shared2.js\");\nrequire(\"./emailpassword-shared4.js\");\nrequire(\"./multifactorauth-shared3.js\");\nrequire(\"supertokens-web-js/recipe/session\");\nrequire(\"./session-shared.js\");\nrequire(\"supertokens-web-js/recipe/passwordless\");\nrequire(\"supertokens-web-js/recipe/emailverification\");\nrequire(\"supertokens-web-js/utils/sessionClaimValidatorStore\");\nrequire(\"supertokens-web-js/recipe/multifactorauth\");\n\nfunction _interopDefault(e) {\n return e && e.__esModule ? e : { default: e };\n}\n\nfunction _interopNamespace(e) {\n if (e && e.__esModule) return e;\n var n = Object.create(null);\n if (e) {\n Object.keys(e).forEach(function (k) {\n if (k !== \"default\") {\n var d = Object.getOwnPropertyDescriptor(e, k);\n Object.defineProperty(\n n,\n k,\n d.get\n ? d\n : {\n enumerable: true,\n get: function () {\n return e[k];\n },\n }\n );\n }\n });\n }\n n.default = e;\n return Object.freeze(n);\n}\n\nvar React__namespace = /*#__PURE__*/ _interopNamespace(React);\nvar NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath);\nvar STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError);\nvar STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1);\n\nvar styles =\n '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\\n *\\n * This software is licensed under the Apache License, Version 2.0 (the\\n * \"License\") as published by the Apache Software Foundation.\\n *\\n * You may not use this file except in compliance with the License. You may\\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\\n * License for the specific language governing permissions and limitations\\n * under the License.\\n */\\n\\n[data-supertokens~=\"container\"] {\\n --palette-background: 255, 255, 255;\\n --palette-inputBackground: 250, 250, 250;\\n --palette-inputBorder: 224, 224, 224;\\n --palette-primary: 28, 34, 42;\\n --palette-primaryBorder: 45, 54, 68;\\n --palette-success: 65, 167, 0;\\n --palette-successBackground: 217, 255, 191;\\n --palette-error: 255, 23, 23;\\n --palette-errorBackground: 255, 241, 235;\\n --palette-textTitle: 0, 0, 0;\\n --palette-textLabel: 0, 0, 0;\\n --palette-textInput: 0, 0, 0;\\n --palette-textPrimary: 128, 128, 128;\\n --palette-textLink: 0, 122, 255;\\n --palette-buttonText: 255, 255, 255;\\n --palette-textGray: 54, 54, 54;\\n --palette-superTokensBrandingBackground: 242, 245, 246;\\n --palette-superTokensBrandingText: 173, 189, 196;\\n\\n --font-size-0: 12px;\\n --font-size-1: 14px;\\n --font-size-2: 16px;\\n --font-size-3: 19px;\\n --font-size-4: 24px;\\n --font-size-5: 28px;\\n}\\n\\n/*\\n * Default styles.\\n */\\n\\n@keyframes slideTop {\\n 0% {\\n transform: translateY(-5px);\\n }\\n 100% {\\n transform: translateY(0px);\\n }\\n}\\n\\n@keyframes swing-in-top-fwd {\\n 0% {\\n transform: rotateX(-100deg);\\n transform-origin: top;\\n opacity: 0;\\n }\\n 100% {\\n transform: rotateX(0deg);\\n transform-origin: top;\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"container\"] {\\n font-family: \"Arial\", sans-serif;\\n margin: 12px auto;\\n margin-top: 26px;\\n margin-bottom: 26px;\\n width: 420px;\\n text-align: center;\\n border-radius: 8px;\\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\\n background-color: rgb(var(--palette-background));\\n}\\n\\n@media (max-width: 440px) {\\n [data-supertokens~=\"container\"] {\\n width: 95vw;\\n }\\n}\\n\\n[data-supertokens~=\"row\"] {\\n margin: 0 auto;\\n width: 76%;\\n padding-top: 30px;\\n padding-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"superTokensBranding\"] {\\n display: block;\\n margin: 10px auto 0;\\n background: rgb(var(--palette-superTokensBrandingBackground));\\n color: rgb(var(--palette-superTokensBrandingText));\\n text-decoration: none;\\n width: -webkit-fit-content;\\n width: -moz-fit-content;\\n width: fit-content;\\n border-radius: 6px 6px 0 0;\\n padding: 4px 9px;\\n font-weight: 400;\\n font-size: var(--font-size-0);\\n letter-spacing: 0.4px;\\n}\\n\\n[data-supertokens~=\"generalError\"] {\\n background: rgb(var(--palette-errorBackground));\\n padding-top: 10px;\\n padding-bottom: 10px;\\n margin-bottom: 10px;\\n margin-top: 24px;\\n padding-left: 18px;\\n padding-right: 18px;\\n letter-spacing: 0.2px;\\n font-size: var(--font-size-1);\\n border-radius: 8px;\\n color: rgb(var(--palette-error));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n word-wrap: break-word;\\n}\\n\\n[data-supertokens~=\"headerTitle\"] {\\n font-size: var(--font-size-4);\\n line-height: 27.6px;\\n letter-spacing: 0.58px;\\n font-weight: 700;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"] {\\n font-weight: 400;\\n color: rgb(var(--palette-textGray));\\n margin-bottom: 21px;\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"][data-supertokens~=\"secondaryText\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] {\\n max-width: 300px;\\n margin-top: 10px;\\n}\\n\\n[data-supertokens~=\"privacyPolicyAndTermsAndConditions\"] a {\\n line-height: 21px;\\n}\\n\\n/* TODO: split the link style into separate things*/\\n\\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\\n\\n[data-supertokens~=\"link\"] {\\n padding-left: 3px;\\n padding-right: 3px;\\n color: rgb(var(--palette-textLink));\\n font-size: var(--font-size-1);\\n cursor: pointer;\\n letter-spacing: 0.16px;\\n line-height: 26px;\\n}\\n\\n[data-supertokens~=\"primaryText\"] {\\n font-size: var(--font-size-2);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n line-height: 21px;\\n color: rgb(var(--palette-textLabel));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] {\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n letter-spacing: 0.4px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"secondaryText\"] strong {\\n font-weight: 600;\\n}\\n\\n[data-supertokens~=\"divider\"] {\\n margin-top: 1.5em;\\n margin-bottom: 1.5em;\\n border-bottom: 0.3px solid #dddddd;\\n align-items: center;\\n padding-bottom: 5px;\\n flex: 3 3;\\n}\\n\\n[data-supertokens~=\"headerTinyTitle\"] {\\n margin-top: 24px;\\n font-size: var(--font-size-5);\\n letter-spacing: 1.1px;\\n font-weight: 700;\\n line-height: 28px;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"]:hover {\\n position: relative;\\n left: 2px;\\n word-spacing: 4px;\\n}\\n\\n[data-supertokens~=\"generalSuccess\"] {\\n color: rgb(var(--palette-success));\\n font-size: var(--font-size-1);\\n background: rgb(var(--palette-successBackground));\\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\\n padding: 9px 15px 9px 15px;\\n border-radius: 6px;\\n display: inline-block;\\n}\\n\\n[data-supertokens~=\"spinner\"] {\\n width: 80px;\\n height: auto;\\n padding-top: 20px;\\n padding-bottom: 40px;\\n margin: 0 auto;\\n}\\n\\n[data-supertokens~=\"error\"] {\\n color: rgb(var(--palette-error));\\n}\\n\\n[data-supertokens~=\"linkButton\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: transparent;\\n border: 0;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n color: rgb(var(--palette-textGray));\\n font-weight: 400;\\n margin-top: 10px;\\n margin-bottom: 40px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n margin-right: 0.3em;\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithLeftArrow\"]:hover svg {\\n position: relative;\\n left: -4px;\\n}\\n\\n[data-supertokens~=\"button\"] {\\n font-family: \"Arial\", sans-serif;\\n background-color: rgb(var(--palette-primary));\\n color: rgb(var(--palette-buttonText));\\n width: 100%;\\n height: 34px;\\n font-weight: 600;\\n border-width: 1px;\\n border-style: solid;\\n border-radius: 6px;\\n border-color: rgb(var(--palette-primaryBorder));\\n background-position: center;\\n transition: all 0.4s;\\n background-size: 12000%;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"button\"]:disabled {\\n border: none;\\n cursor: no-drop;\\n}\\n\\n[data-supertokens~=\"button\"]:active {\\n outline: none;\\n transition: all 0s;\\n background-size: 100%;\\n filter: brightness(0.85);\\n}\\n\\n[data-supertokens~=\"button\"]:focus {\\n outline: none;\\n}\\n\\n[data-supertokens~=\"backButtonCommon\"] {\\n width: 16px;\\n height: 13px;\\n}\\n\\n[data-supertokens~=\"backButton\"] {\\n cursor: pointer;\\n border: none;\\n background-color: transparent;\\n padding: 0px;\\n}\\n\\n[data-supertokens~=\"backButtonPlaceholder\"] {\\n display: block;\\n}\\n\\n[data-supertokens~=\"delayedRender\"] {\\n animation-duration: 0.1s;\\n animation-name: animate-fade;\\n animation-delay: 0.2s;\\n animation-fill-mode: backwards;\\n}\\n\\n@keyframes animate-fade {\\n 0% {\\n opacity: 0;\\n }\\n 100% {\\n opacity: 1;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] {\\n display: flex;\\n flex-direction: column;\\n margin-top: 10px;\\n gap: 24px;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] > div {\\n cursor: pointer;\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n font-weight: 400;\\n position: relative;\\n left: -6px; /* half the width of the left arrow */\\n}\\n\\n@media (max-width: 360px) {\\n [data-supertokens~=\"footerLinkGroupVert\"] {\\n flex-direction: column;\\n }\\n [data-supertokens~=\"footerLinkGroupVert\"] > div {\\n margin: 0 auto;\\n }\\n}\\n\\n[data-supertokens~=\"footerLinkGroupVert\"] div:only-child {\\n margin-left: auto;\\n margin-right: auto;\\n margin-top: 14px;\\n}\\n\\n[data-supertokens~=\"withBackButton\"] {\\n position: relative;\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"dividerWithOr\"] {\\n padding-top: 5px;\\n display: flex;\\n flex-direction: row;\\n justify-content: space-between;\\n align-items: center;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"dividerText\"] {\\n flex: 1 1;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n}\\n\\n[data-supertokens~=\"formLabelWithLinkWrapper\"] {\\n display: flex;\\n justify-content: space-between;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"] {\\n width: auto;\\n margin-top: 0;\\n line-height: 24px;\\n font-size: var(--font-size-0);\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:hover {\\n text-decoration: underline;\\n}\\n\\n[data-supertokens~=\"formLabelLinkBtn\"]:disabled {\\n color: rgb(var(--palette-textPrimary));\\n cursor: default;\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authComponentList\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] {\\n color: rgb(var(--palette-textGray));\\n font-size: var(--font-size-1);\\n font-weight: 400;\\n margin: 10px 0 25px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientUrl\"] {\\n text-decoration: none;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClientLogo\"] {\\n width: 44px;\\n height: 44px;\\n margin-bottom: 10px;\\n}\\n\\n[data-supertokens~=\"authPageTitleOAuthClient\"] [data-supertokens~=\"authPageTitleOAuthClientName\"] {\\n color: rgb(var(--palette-textTitle));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] {\\n border-radius: 6px;\\n border: 1px solid #d0d5dd;\\n width: 100%;\\n color: rgb(var(--palette-textGray));\\n display: flex;\\n justify-content: center;\\n align-items: center;\\n gap: 5px;\\n margin: 24px 0;\\n min-height: 48px;\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover {\\n background-color: rgb(var(--palette-inputBackground));\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryText\"] {\\n font-weight: 700;\\n font-size: var(--font-size-2);\\n color: rgb(var(--palette-textGray));\\n margin: 0;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithRightArrow\"] ~ svg {\\n position: relative;\\n left: 2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"]:hover [data-supertokens~=\"secondaryLinkWithLeftArrow\"] svg {\\n position: relative;\\n left: -2px;\\n}\\n\\n[data-supertokens~=\"buttonWithArrow\"] [data-supertokens~=\"secondaryLinkWithLeftArrow\"] {\\n display: flex;\\n align-items: center;\\n}\\n\\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\\n *\\n * This software is licensed under the Apache License, Version 2.0 (the\\n * \"License\") as published by the Apache Software Foundation.\\n *\\n * You may not use this file except in compliance with the License. You may\\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\\n * License for the specific language governing permissions and limitations\\n * under the License.\\n */\\n\\n[data-supertokens~=\"inputContainer\"] {\\n margin-top: 6px;\\n}\\n\\n[data-supertokens~=\"inputWrapper\"] {\\n box-sizing: border-box;\\n width: 100%;\\n display: flex;\\n align-items: center;\\n background-color: rgb(var(--palette-inputBackground));\\n height: 34px;\\n border-radius: 6px;\\n border: 1px solid rgb(var(--palette-inputBorder));\\n}\\n\\n[data-supertokens~=\"inputWrapper\"][focus-within] {\\n background-color: rgba(var(--palette-inputBackground), 0.25);\\n border: 1px solid rgb(var(--palette-primary));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputWrapper\"]:focus-within {\\n background-color: rgba(var(--palette-inputBackground), 0.25);\\n border: 1px solid rgb(var(--palette-primary));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"] {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"][focus-within] {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"inputError\"]:focus-within {\\n border: 1px solid rgb(var(--palette-error));\\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\\n outline: none;\\n}\\n\\n[data-supertokens~=\"input\"] {\\n box-sizing: border-box;\\n padding-left: 15px;\\n filter: none;\\n color: rgb(var(--palette-textInput));\\n background-color: transparent;\\n border-radius: 6px;\\n font-size: var(--font-size-1);\\n border: none;\\n padding-right: 25px;\\n letter-spacing: 1.2px;\\n flex: 9 1 75%;\\n width: 75%;\\n height: 32px;\\n}\\n\\n[data-supertokens~=\"input\"]:focus {\\n border: none;\\n outline: none;\\n}\\n\\n[data-supertokens~=\"input\"]:-webkit-autofill,\\n[data-supertokens~=\"input\"]:-webkit-autofill:hover,\\n[data-supertokens~=\"input\"]:-webkit-autofill:focus,\\n[data-supertokens~=\"input\"]:-webkit-autofill:active {\\n -webkit-text-fill-color: rgb(var(--palette-textInput));\\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\\n}\\n\\n[data-supertokens~=\"inputAdornment\"] {\\n justify-content: center;\\n margin-right: 5px;\\n}\\n\\n[data-supertokens~=\"showPassword\"] {\\n cursor: pointer;\\n}\\n\\n[data-supertokens~=\"enterEmailSuccessMessage\"] {\\n margin-top: 15px;\\n margin-bottom: 15px;\\n word-break: break-word;\\n}\\n\\n[data-supertokens~=\"submitNewPasswordSuccessMessage\"] {\\n margin-top: 15px;\\n margin-bottom: 15px;\\n}\\n\\n[data-supertokens~=\"inputErrorMessage\"] {\\n padding-top: 5px;\\n padding-bottom: 5px;\\n color: rgb(var(--palette-error));\\n line-height: 24px;\\n font-weight: 400;\\n font-size: var(--font-size-1);\\n text-align: left;\\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\\n max-width: 330px;\\n}\\n\\n@media (max-width: 440px) {\\n [data-supertokens~=\"inputErrorMessage\"] {\\n max-width: 250px;\\n }\\n}\\n\\n[data-supertokens~=\"inputErrorSymbol\"] {\\n margin-right: 5px;\\n top: 1px;\\n position: relative;\\n left: 2px;\\n}\\n\\n[data-supertokens~=\"label\"] {\\n text-align: left;\\n font-weight: 700;\\n font-size: var(--font-size-0);\\n line-height: 24px;\\n color: rgb(var(--palette-textLabel));\\n}\\n\\n[data-supertokens~=\"formRow\"] {\\n display: flex;\\n flex-direction: column;\\n padding-top: 0px;\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"formRow\"][data-supertokens~=\"hasError\"] {\\n padding-bottom: 0;\\n}\\n\\n[data-supertokens~=\"formRow\"]:last-child {\\n padding-bottom: 0;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailIcon\"] {\\n margin-top: 11px;\\n}\\n\\n[data-supertokens~=\"primaryText\"][data-supertokens~=\"sendVerifyEmailText\"] {\\n text-align: center;\\n letter-spacing: 0.8px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"secondaryLinkWithArrow\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n cursor: pointer;\\n font-weight: 700;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailResend\"] {\\n margin-top: 13px;\\n font-weight: 400;\\n}\\n\\n[data-supertokens~=\"sendVerifyEmailResend\"]:hover {\\n text-decoration: underline;\\n}\\n\\n[data-supertokens~=\"noFormRow\"] {\\n padding-bottom: 25px;\\n}\\n\\n[data-supertokens~=\"emailVerificationButtonWrapper\"] {\\n padding-top: 25px;\\n max-width: 96px;\\n margin: 0 auto;\\n}\\n\\n[data-supertokens~=\"resendEmailLink\"] {\\n display: inline-block;\\n}\\n\\n[data-supertokens~=\"resetPasswordEmailForm\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"resetPasswordPasswordForm\"] {\\n padding-bottom: 20px;\\n}\\n\\n[data-supertokens~=\"generalSuccess\"] {\\n margin-bottom: 20px;\\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\\n}\\n\\n[data-supertokens~=\"headerSubtitle\"] strong {\\n max-width: 100%;\\n display: inline-block;\\n vertical-align: bottom;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n}\\n\\n[data-supertokens~=\"primaryText\"][data-supertokens~=\"sendCodeText\"] {\\n margin-top: 15px;\\n margin-bottom: 20px;\\n color: rgb(var(--palette-textPrimary));\\n}\\n\\n[data-supertokens~=\"sendCodeText\"] strong {\\n max-width: 100%;\\n display: inline-block;\\n vertical-align: bottom;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n}\\n\\n[data-supertokens~=\"phoneInputLibRoot\"] {\\n display: flex;\\n align-items: center;\\n}\\n\\n[data-supertokens~=\"phoneInputWrapper\"] {\\n display: flex;\\n align-items: center;\\n}\\n\\ninput[type=\"tel\"][data-supertokens~=\"input-phoneNumber\"] {\\n padding-left: 15px;\\n}\\n\\n[data-supertokens~=\"phoneInputWrapper\"] .iti {\\n flex: 1 1;\\n min-width: 0;\\n width: 100%;\\n background: transparent;\\n border: none;\\n color: inherit;\\n outline: none;\\n}\\n\\n[data-supertokens~=\"continueButtonWrapper\"] {\\n margin-top: 10px;\\n margin-bottom: 30px;\\n}\\n\\n.iti__country-list {\\n border: 0;\\n top: 40px;\\n width: min(72.2vw, 320px);\\n border-radius: 6;\\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\\n}\\n\\n.iti__country {\\n display: flex;\\n align-items: center;\\n height: 34px;\\n cursor: pointer;\\n\\n padding: 0 8px;\\n}\\n\\n.iti__country-name {\\n color: var(--palette-textLabel);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n margin: \"0 16px\";\\n}\\n\\n[data-supertokens~=\"continueWithPasswordlessButtonWrapper\"] {\\n margin: 9px 0;\\n}\\n\\n[data-supertokens~=\"continueWithPasswordlessLink\"] {\\n margin-top: 9px;\\n}\\n';\n\nvar ThemeBase = function (_a) {\n var children = _a.children,\n userStyles = _a.userStyles;\n return jsxRuntime.jsxs(React.Fragment, {\n children: [children, jsxRuntime.jsxs(\"style\", { children: [styles, userStyles.join(\"\\n\")] })],\n });\n};\n\nvar ContinueWithPasswordless = function (props) {\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"continueWithPasswordlessButtonWrapper\" },\n {\n children: jsxRuntime.jsx(button.Button, {\n isLoading: false,\n onClick: function () {\n props.continueWithPasswordlessClicked();\n },\n type: \"button\",\n label: \"PWLESS_COMBO_CONTINUE_WITH_PASSWORDLESS_BUTTON\",\n }),\n }\n )\n );\n};\nvar ContinueWithPasswordlessWithOverride = uiEntry.withOverride(\n \"PasswordlessContinueWithPasswordless\",\n ContinueWithPasswordless\n);\nvar ContinueWithPasswordlessTheme = function (props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle] },\n {\n children: jsxRuntime.jsx(\n ContinueWithPasswordlessWithOverride,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n );\n};\n\nvar ContinueWithPasswordlessFeature = function (props) {\n var recipeComponentOverrides = props.useComponentOverrides();\n return jsxRuntime.jsx(\n authCompWrapper.AuthComponentWrapper,\n genericComponentOverrideContext.__assign(\n { recipeComponentOverrides: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n ContinueWithPasswordlessTheme,\n genericComponentOverrideContext.__assign({}, props, {\n continueWithPasswordlessClicked: function () {\n return props.setFactorList(props.factorIds);\n },\n config: props.recipe.config,\n })\n ),\n }\n )\n );\n};\n\nvar PasswordlessLinkClickedScreen = function (props) {\n var t = translationContext.useTranslation();\n var _a = React.useState(false),\n loading = _a[0],\n setLoading = _a[1];\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children:\n props.requireUserInteraction === true\n ? jsxRuntime.jsxs(React__namespace.default.Fragment, {\n children: [\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle\" },\n { children: t(\"PWLESS_LINK_CLICKED_CONTINUE_HEADER\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerSubtitle secondaryText\" },\n { children: t(\"PWLESS_LINK_CLICKED_CONTINUE_DESC\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"continueButtonWrapper\" },\n {\n children: jsxRuntime.jsx(button.Button, {\n isLoading: loading,\n onClick: function () {\n setLoading(true);\n props.consumeCode();\n },\n type: \"button\",\n label: \"PWLESS_LINK_CLICKED_CONTINUE_BUTTON\",\n }),\n }\n )\n ),\n ],\n })\n : jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"spinner\" },\n { children: jsxRuntime.jsx(uiEntry.SpinnerIcon, {}) }\n )\n ),\n }\n )\n ),\n }\n )\n );\n};\nvar LinkClickedScreenWithOverride = uiEntry.withOverride(\n \"PasswordlessLinkClickedScreen\",\n PasswordlessLinkClickedScreen\n);\nvar LinkClickedScreen$1 = function (props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n return jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, props.config.linkClickedScreenFeature.style] },\n {\n children: jsxRuntime.jsx(\n LinkClickedScreenWithOverride,\n genericComponentOverrideContext.__assign({}, props)\n ),\n }\n )\n );\n};\n\nvar defaultTranslationsPasswordless = {\n en: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, uiEntry.defaultTranslationsCommon.en),\n {\n GENERAL_ERROR_EMAIL_UNDEFINED: \"Please set your email\",\n GENERAL_ERROR_EMAIL_NON_STRING: \"Email must be of type string\",\n GENERAL_ERROR_EMAIL_INVALID: \"Email is invalid\",\n GENERAL_ERROR_PHONE_UNDEFINED: \"Please set your phone number\",\n GENERAL_ERROR_PHONE_NON_STRING: \"Phone number must be of type string\",\n GENERAL_ERROR_PHONE_INVALID: \"Phone number is invalid\",\n GENERAL_ERROR_OTP_UNDEFINED: \"Please fill your OTP\",\n GENERAL_ERROR_OTP_INVALID: \"Invalid OTP\",\n GENERAL_ERROR_OTP_EXPIRED: \"Expired OTP.\",\n GENERAL_ERROR_OTP_NON_STRING: \"OTP must be of type string\",\n GENERAL_ERROR_OTP_EMPTY: \"OTP cannot be empty\",\n ERROR_SIGN_IN_UP_LINK: \"Invalid magic link. Please try again.\",\n ERROR_SIGN_IN_UP_RESEND_RESTART_FLOW: \"Login timed out. Please try again.\",\n ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW: \"Login unsuccessful. Please try again.\",\n PWLESS_SIGN_IN_UP_EMAIL_LABEL: \"Email\",\n PWLESS_SIGN_IN_UP_PHONE_LABEL: \"Phone Number\",\n PWLESS_SIGN_IN_UP_SWITCH_TO_PHONE: \"Use a Phone number\",\n PWLESS_SIGN_IN_UP_SWITCH_TO_EMAIL: \"Use an Email\",\n PWLESS_SIGN_IN_UP_CONTINUE_BUTTON: \"CONTINUE\",\n PWLESS_COMBO_CONTINUE_WITH_PASSWORDLESS_LINK: \"Continue with passwordless\",\n PWLESS_COMBO_CONTINUE_WITH_PASSWORDLESS_BUTTON: \"CONTINUE WITH PASSWORDLESS\",\n PWLESS_COMBO_PASSWORD_LABEL: \"Password\",\n PWLESS_COMBO_FORGOT_PW_LINK: \"Forgot password?\",\n PWLESS_LINK_SENT_RESEND_SUCCESS: \"Link resent\",\n PWLESS_LINK_SENT_RESEND_TITLE: \"Link sent!\",\n PWLESS_LINK_SENT_RESEND_DESC_START_EMAIL: \"We sent a link to \",\n PWLESS_LINK_SENT_RESEND_DESC_START_PHONE: \"We sent a link to your phone number \",\n PWLESS_LINK_SENT_RESEND_DESC_END_EMAIL: \". Click the link to login or sign up\",\n PWLESS_LINK_SENT_RESEND_DESC_END_PHONE: \"\",\n PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL: \"Change email\",\n PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE: \"Change phone number\",\n PWLESS_LINK_CLICKED_CONTINUE_HEADER: \"Sign Up or Log In\",\n PWLESS_LINK_CLICKED_CONTINUE_DESC: \"Click the button below to log in on this device\",\n PWLESS_LINK_CLICKED_CONTINUE_BUTTON: \"CONTINUE\",\n PWLESS_RESEND_SUCCESS_EMAIL: \"Email resent\",\n PWLESS_RESEND_SUCCESS_PHONE: \"SMS resent\",\n PWLESS_RESEND_BTN_DISABLED_START: \"Resend in \",\n PWLESS_RESEND_BTN_DISABLED_END: \"\",\n PWLESS_RESEND_BTN_EMAIL: \"Resend Email\",\n PWLESS_RESEND_BTN_PHONE: \"Resend SMS\",\n PWLESS_USER_INPUT_CODE_HEADER_TITLE: \"Enter OTP\",\n PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE: \"An OTP was sent to you at\",\n PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK: \"An OTP and a magic link was sent to you at\",\n PWLESS_USER_INPUT_CODE_INPUT_LABEL: \"OTP\",\n PWLESS_MFA_HEADER_TITLE_PHONE: \"SMS based OTP\",\n PWLESS_MFA_HEADER_TITLE_EMAIL: \"Email based OTP\",\n PWLESS_MFA_FOOTER_LOGOUT: \"Logout\",\n /*\n * The following are error messages from our backend SDK.\n * These are returned as full messages to preserver compatibilty, but they work just like the keys above.\n * They are shown as is by default (setting the value to undefined will display the raw translation key)\n */\n \"Failed to generate a one time code. Please try again\": undefined,\n \"Phone number is invalid\": undefined,\n \"Email is invalid\": undefined,\n \"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_002)\":\n undefined,\n \"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_003)\":\n undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_017)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_018)\": undefined,\n \"Cannot sign in / up due to security reasons. Please contact support. (ERR_CODE_019)\": undefined,\n }\n ),\n};\n\nvar LinkClickedScreen = function (props) {\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n var userContext = uiEntry.useUserContext();\n if (props.userContext !== undefined) {\n userContext = props.userContext;\n }\n var _a = React.useState(false),\n requireUserInteraction = _a[0],\n setRequireUserInteraction = _a[1];\n var consumeCodeAtMount = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var preAuthSessionId, linkCode, loginAttemptInfo, payloadBeforeCall;\n var _b;\n return genericComponentOverrideContext.__generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n preAuthSessionId = genericComponentOverrideContext.getQueryParams(\"preAuthSessionId\");\n linkCode = genericComponentOverrideContext.getURLHash();\n if (!(preAuthSessionId === null || preAuthSessionId.length === 0 || linkCode.length === 0))\n return [3 /*break*/, 2];\n return [\n 4 /*yield*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: props.navigate,\n queryParams: {\n error: \"signin\",\n },\n redirectBack: false,\n userContext: userContext,\n }),\n ];\n case 1:\n _c.sent();\n return [2 /*return*/, \"REDIRECTING\"];\n case 2:\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.getLoginAttemptInfo({ userContext: userContext }),\n ];\n case 3:\n loginAttemptInfo = _c.sent();\n if (\n (loginAttemptInfo === null || loginAttemptInfo === void 0\n ? void 0\n : loginAttemptInfo.preAuthSessionId) !== preAuthSessionId\n ) {\n return [2 /*return*/, \"REQUIRES_INTERACTION\"];\n }\n _c.label = 4;\n case 4:\n _c.trys.push([4, 6, , 7]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 5:\n payloadBeforeCall = _c.sent();\n return [3 /*break*/, 7];\n case 6:\n _c.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadBeforeCall = undefined;\n return [3 /*break*/, 7];\n case 7:\n _b = {\n payloadBeforeCall: payloadBeforeCall,\n };\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.consumeCode({\n userContext: userContext,\n }),\n ];\n case 8:\n return [2 /*return*/, ((_b.response = _c.sent()), _b)];\n }\n });\n });\n },\n [props.recipe, props.navigate, userContext]\n );\n var handleConsumeResp = React.useCallback(\n function (consumeRes) {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var response, payloadBeforeCall, payloadAfterCall, loginAttemptInfo;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (consumeRes === \"REQUIRES_INTERACTION\") {\n // We set this here, to make sure it's set after a possible remount\n setRequireUserInteraction(true);\n }\n if (typeof consumeRes === \"string\") {\n // In this case we are already redirecting or showing the continue button\n return [2 /*return*/];\n }\n (response = consumeRes.response), (payloadBeforeCall = consumeRes.payloadBeforeCall);\n if (response.status === \"RESTART_FLOW_ERROR\") {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: props.navigate,\n queryParams: {\n error: \"restart_link\",\n },\n redirectBack: false,\n userContext: userContext,\n }),\n ];\n }\n if (response.status === \"SIGN_IN_UP_NOT_ALLOWED\") {\n return [\n 2 /*return*/,\n genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: props.navigate,\n queryParams: {\n error: response.reason,\n },\n redirectBack: false,\n userContext: userContext,\n }),\n ];\n }\n if (!(response.status === \"OK\")) return [3 /*break*/, 7];\n payloadAfterCall = void 0;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 2:\n payloadAfterCall = _b.sent();\n return [3 /*break*/, 4];\n case 3:\n _b.sent();\n payloadAfterCall = undefined;\n return [3 /*break*/, 4];\n case 4:\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.getLoginAttemptInfo({\n userContext: userContext,\n }),\n ];\n case 5:\n loginAttemptInfo = _b.sent();\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.clearLoginAttemptInfo({\n userContext: userContext,\n }),\n ];\n case 6:\n _b.sent();\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow()\n .validateGlobalClaimsAndHandleSuccessRedirection(\n {\n action: \"SUCCESS\",\n createdNewUser:\n response.createdNewRecipeUser &&\n response.user.loginMethods.length === 1,\n isNewRecipeUser: response.createdNewRecipeUser,\n newSessionCreated:\n payloadAfterCall !== undefined &&\n (payloadBeforeCall === undefined ||\n payloadBeforeCall.sessionHandle !== payloadAfterCall.sessionHandle),\n recipeId: props.recipe.recipeID,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n props.recipe.recipeID,\n loginAttemptInfo === null || loginAttemptInfo === void 0\n ? void 0\n : loginAttemptInfo.redirectToPath,\n userContext,\n props.navigate\n )\n .catch(rethrowInRender),\n ];\n case 7:\n return [2 /*return*/];\n }\n });\n });\n },\n [props.navigate, props.recipe, userContext]\n );\n var handleConsumeError = React.useCallback(\n function (err) {\n if (STGeneralError__default.default.isThisError(err)) {\n return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: props.navigate,\n queryParams: {\n error: \"custom\",\n message: err.message,\n },\n redirectBack: false,\n userContext: userContext,\n });\n } else {\n return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({\n navigate: props.navigate,\n queryParams: {\n error: \"signin\",\n },\n redirectBack: false,\n userContext: userContext,\n });\n }\n },\n [props.navigate, userContext]\n );\n genericComponentOverrideContext.useOnMountAPICall(consumeCodeAtMount, handleConsumeResp, handleConsumeError);\n var recipeComponentOverrides = props.useComponentOverrides();\n var childProps = {\n recipeImplementation: props.recipe.webJSRecipe,\n config: props.recipe.config,\n requireUserInteraction: requireUserInteraction,\n consumeCode: function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var payloadBeforeCall, consumeResp, err_1;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 7, , 8]);\n payloadBeforeCall = void 0;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 2:\n payloadBeforeCall = _b.sent();\n return [3 /*break*/, 4];\n case 3:\n _b.sent();\n // If getAccessTokenPayloadSecurely threw, that generally means we have no active session\n payloadBeforeCall = undefined;\n return [3 /*break*/, 4];\n case 4:\n return [\n 4 /*yield*/,\n props.recipe.webJSRecipe.consumeCode({\n userContext: userContext,\n }),\n ];\n case 5:\n consumeResp = _b.sent();\n return [\n 4 /*yield*/,\n handleConsumeResp({ response: consumeResp, payloadBeforeCall: payloadBeforeCall }),\n ];\n case 6:\n _b.sent();\n return [3 /*break*/, 8];\n case 7:\n err_1 = _b.sent();\n void handleConsumeError(err_1);\n return [3 /*break*/, 8];\n case 8:\n return [2 /*return*/];\n }\n });\n });\n },\n };\n return jsxRuntime.jsx(\n uiEntry.ComponentOverrideContext.Provider,\n genericComponentOverrideContext.__assign(\n { value: recipeComponentOverrides },\n {\n children: jsxRuntime.jsx(\n uiEntry.FeatureWrapper,\n genericComponentOverrideContext.__assign(\n {\n useShadowDom: genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().useShadowDom,\n defaultStore: defaultTranslationsPasswordless,\n },\n {\n children: jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n LinkClickedScreen$1,\n genericComponentOverrideContext.__assign({}, childProps)\n ),\n props.children &&\n React__namespace.default.Children.map(props.children, function (child) {\n if (React__namespace.default.isValidElement(child)) {\n return React__namespace.default.cloneElement(child, childProps);\n }\n return child;\n }),\n ],\n }),\n }\n )\n ),\n }\n )\n );\n};\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * \"License\") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http=\"//www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/*\n * Imports.\n */\n/*\n * Component.\n */\nfunction SMSLargeIcon() {\n return jsxRuntime.jsxs(\n \"svg\",\n genericComponentOverrideContext.__assign(\n { width: \"81\", height: \"74\", viewBox: \"0 0 81 74\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\" },\n {\n children: [\n jsxRuntime.jsx(\"rect\", {\n width: \"81\",\n height: \"74\",\n rx: \"12\",\n fill: \"#2D3644\",\n \"fill-opacity\": \"0.1\",\n }),\n jsxRuntime.jsx(\"path\", {\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n d: \"M24.2791 18.0721C23.4556 18.2346 22.8383 18.5501 22.2521 19.1081C21.8207 19.5187 21.386 20.2086 21.202 20.7749C20.9933 21.4174 21 21.014 21 32.9399C21 44.8055 20.9953 44.5105 21.1962 45.0802C21.6287 46.3063 22.5027 47.2275 23.6138 47.6284C24.2239 47.8485 24.5957 47.8781 26.7622 47.879L28.7938 47.8799L28.7945 51.3361C28.7953 54.928 28.797 54.9609 28.9957 55.3449C29.2026 55.7447 29.7368 56.0357 30.1914 55.9964C30.557 55.9648 30.7792 55.8285 31.6485 55.1029C32.0817 54.7413 32.5179 54.3786 32.6179 54.2969C32.718 54.2151 32.8782 54.0813 32.9739 53.9995C33.0696 53.9178 33.2293 53.784 33.3288 53.7022C33.6246 53.4593 35.3203 52.0426 35.4235 51.9522C35.476 51.9063 35.6683 51.7462 35.851 51.5963C36.0337 51.4464 36.2261 51.2867 36.2785 51.2414C36.3609 51.1702 37.0269 50.6141 38.5123 49.3762C38.7214 49.2019 38.9673 48.9969 39.0588 48.9205C39.1503 48.8442 39.4689 48.5788 39.7668 48.3308L40.3085 47.8799H48.2834C53.8058 47.8799 56.3722 47.8632 56.6286 47.8256C58.2358 47.59 59.5022 46.4036 59.9294 44.7333C60.0239 44.364 60.0233 21.5127 59.9288 21.1466C59.5021 19.493 58.3008 18.3427 56.7137 18.0678C56.1756 17.9746 24.7519 17.9788 24.2791 18.0721ZM51.4173 28.981C52.2557 29.3855 52.4751 30.4017 51.8772 31.1101C51.7556 31.254 51.5818 31.3895 51.4269 31.4609L51.1745 31.5773H40.5392C28.8194 31.5773 29.681 31.6007 29.2987 31.2721C28.9166 30.9437 28.7361 30.438 28.8355 29.9747C28.9464 29.458 29.3009 29.0629 29.7764 28.9262C29.9644 28.8722 31.912 28.8618 40.6033 28.8685L51.201 28.8767L51.4173 28.981ZM41.0193 34.419C41.3249 34.5599 41.6353 34.9094 41.7403 35.2309C41.9512 35.8762 41.6712 36.5538 41.0654 36.8639L40.7934 37.0032L35.4708 37.0186C31.645 37.0297 30.0783 37.0183 29.8996 36.9781C29.5714 36.9043 29.4061 36.814 29.1927 36.5921C28.6448 36.0224 28.6929 35.1284 29.2996 34.607C29.6628 34.2948 29.3424 34.3108 35.315 34.3065L40.767 34.3026L41.0193 34.419Z\",\n fill: \"#2D3644\",\n }),\n ],\n }\n )\n );\n}\n\nvar ResendButton = uiEntry.withOverride(\"PasswordlessResendButton\", function PasswordlessResendButton(_a) {\n var loginAttemptInfo = _a.loginAttemptInfo,\n resendEmailOrSMSGapInSeconds = _a.resendEmailOrSMSGapInSeconds,\n onClick = _a.onClick;\n var t = translationContext.useTranslation();\n var getTimeLeft = React.useCallback(\n function () {\n var timeLeft = loginAttemptInfo.lastResend + resendEmailOrSMSGapInSeconds * 1000 - Date.now();\n return timeLeft < 0 ? undefined : Math.ceil(timeLeft / 1000);\n },\n [loginAttemptInfo, resendEmailOrSMSGapInSeconds]\n );\n var _b = React.useState(getTimeLeft()),\n secsUntilResend = _b[0],\n setSecsUntilResend = _b[1];\n React.useEffect(\n function () {\n // This runs every time the loginAttemptInfo updates, so after every resend\n var interval = setInterval(function () {\n var timeLeft = getTimeLeft();\n if (timeLeft === undefined) {\n clearInterval(interval);\n }\n setSecsUntilResend(timeLeft);\n }, 500);\n return function () {\n // This can safely run twice\n clearInterval(interval);\n };\n },\n [getTimeLeft, setSecsUntilResend]\n );\n return jsxRuntime.jsx(\n \"button\",\n genericComponentOverrideContext.__assign(\n {\n type: \"button\",\n disabled: secsUntilResend !== undefined,\n onClick: onClick,\n \"data-supertokens\": \"link linkButton formLabelLinkBtn resendCodeBtn\",\n },\n {\n children:\n secsUntilResend !== undefined\n ? jsxRuntime.jsxs(React__namespace.default.Fragment, {\n children: [\n t(\"PWLESS_RESEND_BTN_DISABLED_START\"),\n jsxRuntime.jsxs(\"strong\", {\n children: [\n Math.floor(secsUntilResend / 60)\n .toString()\n .padStart(2, \"0\"),\n \":\",\n (secsUntilResend % 60).toString().padStart(2, \"0\"),\n ],\n }),\n t(\"PWLESS_RESEND_BTN_DISABLED_END\"),\n ],\n })\n : loginAttemptInfo.contactMethod === \"EMAIL\"\n ? t(\"PWLESS_RESEND_BTN_EMAIL\")\n : t(\"PWLESS_RESEND_BTN_PHONE\"),\n }\n )\n );\n});\n\nvar PasswordlessLinkSent = function (props) {\n var t = translationContext.useTranslation();\n var userContext = uiEntry.useUserContext();\n var _a = React.useState(props.error !== undefined ? \"ERROR\" : \"READY\"),\n status = _a[0],\n setStatus = _a[1];\n // Any because node types are included here, messing with return type of setTimeout\n var resendNotifTimeout = React.useRef();\n React.useEffect(function () {\n return function () {\n // This can safely run even if it was cleared before\n if (resendNotifTimeout.current) {\n clearTimeout(resendNotifTimeout.current);\n }\n };\n }, []);\n var resendEmail = React.useCallback(\n function () {\n return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () {\n var response, generalError, e_1;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 5, , 6]);\n props.clearError();\n response = void 0;\n generalError = void 0;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [\n 4 /*yield*/,\n props.recipeImplementation.resendCode({\n userContext: userContext,\n }),\n ];\n case 2:\n response = _a.sent();\n return [3 /*break*/, 4];\n case 3:\n e_1 = _a.sent();\n if (STGeneralError__default.default.isThisError(e_1)) {\n generalError = e_1;\n } else {\n throw e_1;\n }\n return [3 /*break*/, 4];\n case 4:\n if (response !== undefined && response.status === \"OK\") {\n setStatus(\"LINK_RESENT\");\n resendNotifTimeout.current = setTimeout(function () {\n setStatus(function (status) {\n return status === \"LINK_RESENT\" ? \"READY\" : status;\n });\n resendNotifTimeout.current = undefined;\n }, 2000);\n } else {\n setStatus(\"ERROR\");\n if (generalError !== undefined) {\n props.onError(generalError.message);\n }\n }\n return [3 /*break*/, 6];\n case 5:\n _a.sent();\n setStatus(\"ERROR\");\n return [3 /*break*/, 6];\n case 6:\n return [2 /*return*/];\n }\n });\n });\n },\n [props.recipeImplementation, props.loginAttemptInfo, props.config, setStatus]\n );\n var resendActive = status === \"LINK_RESENT\";\n return jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"container\" },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"row\" },\n {\n children: [\n status === \"ERROR\" &&\n jsxRuntime.jsx(uiEntry.GeneralError, {\n error: props.error === undefined ? \"SOMETHING_WENT_WRONG_ERROR\" : props.error,\n }),\n resendActive &&\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"generalSuccess\" },\n { children: t(\"PWLESS_LINK_SENT_RESEND_SUCCESS\") }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"sendCodeIcon\" },\n {\n children:\n props.loginAttemptInfo.contactMethod === \"EMAIL\"\n ? jsxRuntime.jsx(emailLargeIcon.EmailLargeIcon, {})\n : jsxRuntime.jsx(SMSLargeIcon, {}),\n }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"headerTitle headerTinyTitle\" },\n { children: t(\"PWLESS_LINK_SENT_RESEND_TITLE\") }\n )\n ),\n jsxRuntime.jsx(\"div\", { \"data-supertokens\": \"divider\" }),\n jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"primaryText sendCodeText\" },\n {\n children: [\n props.loginAttemptInfo.contactMethod === \"EMAIL\"\n ? t(\"PWLESS_LINK_SENT_RESEND_DESC_START_EMAIL\")\n : t(\"PWLESS_LINK_SENT_RESEND_DESC_START_PHONE\"),\n jsxRuntime.jsx(\"strong\", {\n children: props.loginAttemptInfo.contactInfo,\n }),\n props.loginAttemptInfo.contactMethod === \"EMAIL\"\n ? t(\"PWLESS_LINK_SENT_RESEND_DESC_END_EMAIL\")\n : t(\"PWLESS_LINK_SENT_RESEND_DESC_END_PHONE\"),\n ],\n }\n )\n ),\n jsxRuntime.jsx(\n \"div\",\n genericComponentOverrideContext.__assign(\n {\n \"data-supertokens\": \"buttonWithArrow\",\n onClick: function () {\n return props.recipeImplementation.clearLoginAttemptInfo({\n userContext: userContext,\n });\n },\n },\n {\n children: jsxRuntime.jsxs(\n \"div\",\n genericComponentOverrideContext.__assign(\n { \"data-supertokens\": \"secondaryText secondaryLinkWithLeftArrow\" },\n {\n children: [\n jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, {\n color: \"rgb(var(--palette-textGray))\",\n }),\n jsxRuntime.jsx(\"span\", {\n children:\n props.loginAttemptInfo.contactMethod === \"EMAIL\"\n ? t(\n \"PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL\"\n )\n : t(\n \"PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE\"\n ),\n }),\n ],\n }\n )\n ),\n }\n )\n ),\n jsxRuntime.jsx(ResendButton, {\n loginAttemptInfo: props.loginAttemptInfo,\n resendEmailOrSMSGapInSeconds:\n props.config.signInUpFeature.resendEmailOrSMSGapInSeconds,\n onClick: resendEmail,\n }),\n ],\n }\n )\n ),\n }\n )\n );\n};\nvar LinkSent = uiEntry.withOverride(\"PasswordlessLinkSent\", PasswordlessLinkSent);\nfunction LinkSentWrapper(props) {\n var rootStyle = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().rootStyle;\n var activeStyle = props.config.signInUpFeature.linkSentScreenStyle;\n return jsxRuntime.jsx(\n uiEntry.UserContextWrapper,\n genericComponentOverrideContext.__assign(\n { userContext: props.userContext },\n {\n children: jsxRuntime.jsx(\n ThemeBase,\n genericComponentOverrideContext.__assign(\n { userStyles: [rootStyle, props.config.recipeRootStyle, activeStyle] },\n { children: jsxRuntime.jsx(LinkSent, genericComponentOverrideContext.__assign({}, props)) }\n )\n ),\n }\n )\n );\n}\n\nfunction useChildProps$4(\n recipe$1,\n loginAttemptInfo,\n error,\n onError,\n clearError,\n rebuildAuthPage,\n userContext,\n navigate\n) {\n var _this = this;\n var session$1 = uiEntry.useSessionContext();\n var recipeImplementation = React__namespace.useMemo(\n function () {\n return getModifiedRecipeImplementation$4(recipe$1.webJSRecipe, onError, rebuildAuthPage);\n },\n [recipe$1, onError, rebuildAuthPage]\n );\n var rethrowInRender = genericComponentOverrideContext.useRethrowInRender();\n return React.useMemo(\n function () {\n return {\n userContext: userContext,\n onSuccess: function (result) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var payloadAfterCall;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [\n 4 /*yield*/,\n types.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({\n userContext: userContext,\n }),\n ];\n case 1:\n payloadAfterCall = _b.sent();\n return [3 /*break*/, 3];\n case 2:\n _b.sent();\n payloadAfterCall = undefined;\n return [3 /*break*/, 3];\n case 3:\n return [\n 2 /*return*/,\n types.Session.getInstanceOrThrow()\n .validateGlobalClaimsAndHandleSuccessRedirection(\n {\n action: \"SUCCESS\",\n createdNewUser:\n result.createdNewRecipeUser &&\n result.user.loginMethods.length === 1,\n isNewRecipeUser: result.createdNewRecipeUser,\n newSessionCreated:\n session$1.loading ||\n !session$1.doesSessionExist ||\n (payloadAfterCall !== undefined &&\n session$1.accessTokenPayload.sessionHandle !==\n payloadAfterCall.sessionHandle),\n recipeId: recipe$1.recipeID,\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n },\n recipe$1.recipeID,\n genericComponentOverrideContext.getRedirectToPathFromURL(),\n userContext,\n navigate\n )\n .catch(rethrowInRender),\n ];\n }\n });\n });\n },\n onFetchError: function (err) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var invalidClaims, evInstance;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (\n !(\n err.status ===\n types.Session.getInstanceOrThrow().config.invalidClaimStatusCode\n )\n )\n return [3 /*break*/, 5];\n return [\n 4 /*yield*/,\n session.getInvalidClaimsFromResponse({\n response: err,\n userContext: userContext,\n }),\n ];\n case 1:\n invalidClaims = _b.sent();\n if (\n !invalidClaims.some(function (i) {\n return i.id === emailverification.EmailVerificationClaim.id;\n })\n )\n return [3 /*break*/, 5];\n _b.label = 2;\n case 2:\n _b.trys.push([2, 4, , 5]);\n evInstance = recipe.EmailVerification.getInstanceOrThrow();\n return [\n 4 /*yield*/,\n evInstance.redirect(\n {\n tenantIdFromQueryParams:\n genericComponentOverrideContext.getTenantIdFromQueryParams(),\n action: \"VERIFY_EMAIL\",\n },\n navigate,\n undefined,\n userContext\n ),\n ];\n case 3:\n _b.sent();\n return [2 /*return*/];\n case 4:\n _b.sent();\n return [3 /*break*/, 5];\n case 5:\n onError(\"SOMETHING_WENT_WRONG_ERROR\");\n return [2 /*return*/];\n }\n });\n });\n },\n loginAttemptInfo: loginAttemptInfo,\n error: error,\n onError: onError,\n clearError: clearError,\n recipeImplementation: recipeImplementation,\n config: recipe$1.config,\n };\n },\n [error, recipeImplementation]\n );\n}\nvar LinkSentFeatureInner = function (props) {\n var childProps = useChildProps$4(\n props.recipe,\n props.loginAttemptInfo,\n props.error,\n props.onError,\n props.clearError,\n props.rebuildAuthPage,\n props.userContext,\n props.navigate\n );\n return jsxRuntime.jsxs(React.Fragment, {\n children: [\n props.children === undefined &&\n jsxRuntime.jsx(\n LinkSentWrapper,\n genericComponentOverrideContext.__assign({}, childProps, { userContext: props.userContext })\n ),\n props.children &&\n React__namespace.Children.map(props.children, function (child) {\n if (React__namespace.isValidElement(child)) {\n return React__namespace.cloneElement(\n child,\n genericComponentOverrideContext.__assign({}, childProps)\n );\n }\n return child;\n }),\n ],\n });\n};\nvar LinkSentFeature = function (props) {\n var recipeComponentOverrides = props.useComponentOverrides();\n return jsxRuntime.jsx(\n authCompWrapper.AuthComponentWrapper,\n genericComponentOverrideContext.__assign(\n { recipeComponentOverrides: recipeComponentOverrides },\n { children: jsxRuntime.jsx(LinkSentFeatureInner, genericComponentOverrideContext.__assign({}, props)) }\n )\n );\n};\nfunction getModifiedRecipeImplementation$4(originalImpl, setError, rebuildAuthPage) {\n var _this = this;\n return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImpl), {\n resendCode: function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var res, loginAttemptInfo, timestamp;\n var _a;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4 /*yield*/, originalImpl.resendCode(input)];\n case 1:\n res = _b.sent();\n if (!(res.status === \"OK\")) return [3 /*break*/, 5];\n return [\n 4 /*yield*/,\n originalImpl.getLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 2:\n loginAttemptInfo = _b.sent();\n if (!(loginAttemptInfo !== undefined)) return [3 /*break*/, 4];\n timestamp = Date.now();\n return [\n 4 /*yield*/,\n originalImpl.setLoginAttemptInfo({\n userContext: input.userContext,\n attemptInfo: genericComponentOverrideContext.__assign(\n genericComponentOverrideContext.__assign({}, loginAttemptInfo),\n {\n shouldTryLinkingWithSessionUser:\n (_a = loginAttemptInfo.shouldTryLinkingWithSessionUser) !== null &&\n _a !== void 0\n ? _a\n : false,\n lastResend: timestamp,\n }\n ),\n }),\n ];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n return [3 /*break*/, 7];\n case 5:\n if (!(res.status === \"RESTART_FLOW_ERROR\")) return [3 /*break*/, 7];\n return [\n 4 /*yield*/,\n originalImpl.clearLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 6:\n _b.sent();\n setError(\"ERROR_SIGN_IN_UP_RESEND_RESTART_FLOW\");\n rebuildAuthPage();\n _b.label = 7;\n case 7:\n return [2 /*return*/, res];\n }\n });\n });\n },\n consumeCode: function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var res;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, originalImpl.consumeCode(input)];\n case 1:\n res = _a.sent();\n if (!(res.status === \"RESTART_FLOW_ERROR\")) return [3 /*break*/, 3];\n return [\n 4 /*yield*/,\n originalImpl.clearLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 2:\n _a.sent();\n setError(\"ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW\");\n rebuildAuthPage();\n return [3 /*break*/, 7];\n case 3:\n if (!(res.status === \"SIGN_IN_UP_NOT_ALLOWED\")) return [3 /*break*/, 5];\n return [\n 4 /*yield*/,\n originalImpl.clearLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 4:\n _a.sent();\n setError(res.reason);\n rebuildAuthPage();\n return [3 /*break*/, 7];\n case 5:\n if (!(res.status === \"OK\")) return [3 /*break*/, 7];\n return [\n 4 /*yield*/,\n originalImpl.clearLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 6:\n _a.sent();\n _a.label = 7;\n case 7:\n return [2 /*return*/, res];\n }\n });\n });\n },\n clearLoginAttemptInfo: function (input) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [\n 4 /*yield*/,\n originalImpl.clearLoginAttemptInfo({\n userContext: input.userContext,\n }),\n ];\n case 1:\n _a.sent();\n genericComponentOverrideContext.clearErrorQueryParam();\n rebuildAuthPage();\n return [2 /*return*/];\n }\n });\n });\n },\n });\n}\n\nvar phoneNumberUtilsImport;\nfunction getPhoneNumberUtils() {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var global;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4 /*yield*/, preloadPhoneNumberUtils()];\n case 1:\n _a.sent();\n global = windowHandler.WindowHandlerReference.getReferenceOrThrow().windowHandler.getWindowUnsafe();\n return [2 /*return*/, global.intlTelInputUtils];\n }\n });\n });\n}\nfunction preloadPhoneNumberUtils() {\n if (phoneNumberUtilsImport === undefined) {\n /* eslint-disable @typescript-eslint/ban-ts-comment */\n // @ts-ignore: We need to disable no implicit any here, otherwise we'd need to add types for this module\n phoneNumberUtilsImport = Promise.resolve().then(function () {\n return require(\"./utils.js\");\n });\n /* eslint-enable @typescript-eslint/ban-ts-comment */\n }\n return phoneNumberUtilsImport;\n}\n\n// This was moved to a separate file to make tree-shaking more effective, since we do not want to include the phoneNumberUtils\n// in the base pwless recipe because it increases the bundle size by a lot\nfunction defaultPhoneNumberValidator(value) {\n return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () {\n var intlTelInputUtils;\n return genericComponentOverrideContext.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (typeof value !== \"string\") {\n return [2 /*return*/, \"GENERAL_ERROR_PHONE_NON_STRING\"];\n }\n value = value.trim();\n return [4 /*yield*/, getPhoneNumberUtils()];\n case 1:\n intlTelInputUtils = _a.sent();\n if (!intlTelInputUtils.isValidNumber(value, undefined)) {\n return [2 /*return*/, \"GENERAL_ERROR_PHONE_INVALID\"];\n }\n return [2 /*return*/, undefined];\n }\n });\n });\n}\n\nvar EmailForm = uiEntry.withOverride(\"PasswordlessEmailForm\", function PasswordlessEmailForm(props) {\n var _this = this;\n var userContext = uiEntry.useUserContext();\n return jsxRuntime.jsx(formBase.FormBase, {\n clearError: props.clearError,\n onFetchError: props.onFetchError,\n onError: props.onError,\n formFields: [\n {\n id: \"email\",\n label: \"PWLESS_SIGN_IN_UP_EMAIL_LABEL\",\n optional: false,\n autofocus: true,\n placeholder: \"\",\n autoComplete: \"email\",\n // We are using the default validator that allows any string\n validate: recipe$1.defaultValidate,\n },\n ],\n buttonLabel: \"PWLESS_SIGN_IN_UP_CONTINUE_BUTTON\",\n onSuccess: props.onSuccess,\n callAPI: function (formFields) {\n return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () {\n var email, validationRes, response;\n var _a;\n return genericComponentOverrideContext.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n email =\n (_a = formFields.find(function (field) {\n return field.id === \"email\";\n })) === null || _a === void 0\n ? void 0\n : _a.value;\n if (email === undefined) {\n throw new STGeneralError__default.default(\"GENERAL_ERROR_EMAIL_UNDEFINED\");\n }\n return [4 /*yield*/, props.config.validateEmailAddress(email)];\n case 1:\n validationRes = _b.sent();\n if (validationRes !== undefined) {\n throw new STGeneralError__default.default(validationRes);\n }\n return [\n 4 /*yield*/,\n props.recipeImplementation.createCode({\n email: email,\n // shouldTryLinkingWithSessionUser is set by the fn override\n userContext: userContext,\n }),\n ];\n case 2:\n response = _b.sent();\n if (response.status === \"SIGN_IN_UP_NOT_ALLOWED\") {\n throw new STGeneralError__default.default(response.reason);\n }\n return [2 /*return*/, response];\n }\n });\n });\n },\n validateOnBlur: false,\n showLabels: true,\n footer: props.footer,\n });\n});\n\nfunction getDefaultExportFromCjs(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \"default\") ? x[\"default\"] : x;\n}\n\nvar intlTelInputExports$1 = {};\nvar intlTelInput$2 = {\n get exports() {\n return intlTelInputExports$1;\n },\n set exports(v) {\n intlTelInputExports$1 = v;\n },\n};\n\nvar intlTelInputExports = {};\nvar intlTelInput$1 = {\n get exports() {\n return intlTelInputExports;\n },\n set exports(v) {\n intlTelInputExports = v;\n },\n};\n\n/*\n * International Telephone Input v17.0.21\n * https://github.com/jackocnr/intl-tel-input.git\n * Licensed under the MIT license\n */\n\n(function (module) {\n // wrap in UMD\n (function (factory) {\n if (module.exports) module.exports = factory();\n else window.intlTelInput = factory();\n })(function (undefined$1) {\n return (function () {\n // Array of country objects for the flag dropdown.\n // Here is the criteria for the plugin to support a given country/territory\n // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\n // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes\n // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png\n // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml\n // Each country array has the following information:\n // [\n // Country name,\n // iso2 code,\n // International dial code,\n // Order (if >1 country with same dial code),\n // Area codes\n // ]\n var allCountries = [\n [\"Afghanistan (افغانستان)\", \"af\", \"93\"],\n [\"Albania (Shqipëri)\", \"al\", \"355\"],\n [\"Algeria (الجزائر)\", \"dz\", \"213\"],\n [\"American Samoa\", \"as\", \"1\", 5, [\"684\"]],\n [\"Andorra\", \"ad\", \"376\"],\n [\"Angola\", \"ao\", \"244\"],\n [\"Anguilla\", \"ai\", \"1\", 6, [\"264\"]],\n [\"Antigua and Barbuda\", \"ag\", \"1\", 7, [\"268\"]],\n [\"Argentina\", \"ar\", \"54\"],\n [\"Armenia (Հայաստան)\", \"am\", \"374\"],\n [\"Aruba\", \"aw\", \"297\"],\n [\"Ascension Island\", \"ac\", \"247\"],\n [\"Australia\", \"au\", \"61\", 0],\n [\"Austria (Österreich)\", \"at\", \"43\"],\n [\"Azerbaijan (Azərbaycan)\", \"az\", \"994\"],\n [\"Bahamas\", \"bs\", \"1\", 8, [\"242\"]],\n [\"Bahrain (البحرين)\", \"bh\", \"973\"],\n [\"Bangladesh (বাংলাদেশ)\", \"bd\", \"880\"],\n [\"Barbados\", \"bb\", \"1\", 9, [\"246\"]],\n [\"Belarus (Беларусь)\", \"by\", \"375\"],\n [\"Belgium (België)\", \"be\", \"32\"],\n [\"Belize\", \"bz\", \"501\"],\n [\"Benin (Bénin)\", \"bj\", \"229\"],\n [\"Bermuda\", \"bm\", \"1\", 10, [\"441\"]],\n [\"Bhutan (འབྲུག)\", \"bt\", \"975\"],\n [\"Bolivia\", \"bo\", \"591\"],\n [\"Bosnia and Herzegovina (Босна и Херцеговина)\", \"ba\", \"387\"],\n [\"Botswana\", \"bw\", \"267\"],\n [\"Brazil (Brasil)\", \"br\", \"55\"],\n [\"British Indian Ocean Territory\", \"io\", \"246\"],\n [\"British Virgin Islands\", \"vg\", \"1\", 11, [\"284\"]],\n [\"Brunei\", \"bn\", \"673\"],\n [\"Bulgaria (България)\", \"bg\", \"359\"],\n [\"Burkina Faso\", \"bf\", \"226\"],\n [\"Burundi (Uburundi)\", \"bi\", \"257\"],\n [\"Cambodia (កម្ពុជា)\", \"kh\", \"855\"],\n [\"Cameroon (Cameroun)\", \"cm\", \"237\"],\n [\n \"Canada\",\n \"ca\",\n \"1\",\n 1,\n [\n \"204\",\n \"226\",\n \"236\",\n \"249\",\n \"250\",\n \"289\",\n \"306\",\n \"343\",\n \"365\",\n \"387\",\n \"403\",\n \"416\",\n \"418\",\n \"431\",\n \"437\",\n \"438\",\n \"450\",\n \"506\",\n \"514\",\n \"519\",\n \"548\",\n \"579\",\n \"581\",\n \"587\",\n \"604\",\n \"613\",\n \"639\",\n \"647\",\n \"672\",\n \"705\",\n \"709\",\n \"742\",\n \"778\",\n \"780\",\n \"782\",\n \"807\",\n \"819\",\n \"825\",\n \"867\",\n \"873\",\n \"902\",\n \"905\",\n ],\n ],\n [\"Cape Verde (Kabu Verdi)\", \"cv\", \"238\"],\n [\"Caribbean Netherlands\", \"bq\", \"599\", 1, [\"3\", \"4\", \"7\"]],\n [\"Cayman Islands\", \"ky\", \"1\", 12, [\"345\"]],\n [\"Central African Republic (République centrafricaine)\", \"cf\", \"236\"],\n [\"Chad (Tchad)\", \"td\", \"235\"],\n [\"Chile\", \"cl\", \"56\"],\n [\"China (中国)\", \"cn\", \"86\"],\n [\"Christmas Island\", \"cx\", \"61\", 2, [\"89164\"]],\n [\"Cocos (Keeling) Islands\", \"cc\", \"61\", 1, [\"89162\"]],\n [\"Colombia\", \"co\", \"57\"],\n [\"Comoros (جزر القمر)\", \"km\", \"269\"],\n [\"Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)\", \"cd\", \"243\"],\n [\"Congo (Republic) (Congo-Brazzaville)\", \"cg\", \"242\"],\n [\"Cook Islands\", \"ck\", \"682\"],\n [\"Costa Rica\", \"cr\", \"506\"],\n [\"Côte d’Ivoire\", \"ci\", \"225\"],\n [\"Croatia (Hrvatska)\", \"hr\", \"385\"],\n [\"Cuba\", \"cu\", \"53\"],\n [\"Curaçao\", \"cw\", \"599\", 0],\n [\"Cyprus (Κύπρος)\", \"cy\", \"357\"],\n [\"Czech Republic (Česká republika)\", \"cz\", \"420\"],\n [\"Denmark (Danmark)\", \"dk\", \"45\"],\n [\"Djibouti\", \"dj\", \"253\"],\n [\"Dominica\", \"dm\", \"1\", 13, [\"767\"]],\n [\"Dominican Republic (República Dominicana)\", \"do\", \"1\", 2, [\"809\", \"829\", \"849\"]],\n [\"Ecuador\", \"ec\", \"593\"],\n [\"Egypt (مصر)\", \"eg\", \"20\"],\n [\"El Salvador\", \"sv\", \"503\"],\n [\"Equatorial Guinea (Guinea Ecuatorial)\", \"gq\", \"240\"],\n [\"Eritrea\", \"er\", \"291\"],\n [\"Estonia (Eesti)\", \"ee\", \"372\"],\n [\"Eswatini\", \"sz\", \"268\"],\n [\"Ethiopia\", \"et\", \"251\"],\n [\"Falkland Islands (Islas Malvinas)\", \"fk\", \"500\"],\n [\"Faroe Islands (Føroyar)\", \"fo\", \"298\"],\n [\"Fiji\", \"fj\", \"679\"],\n [\"Finland (Suomi)\", \"fi\", \"358\", 0],\n [\"France\", \"fr\", \"33\"],\n [\"French Guiana (Guyane française)\", \"gf\", \"594\"],\n [\"French Polynesia (Polynésie française)\", \"pf\", \"689\"],\n [\"Gabon\", \"ga\", \"241\"],\n [\"Gambia\", \"gm\", \"220\"],\n [\"Georgia (საქართველო)\", \"ge\", \"995\"],\n [\"Germany (Deutschland)\", \"de\", \"49\"],\n [\"Ghana (Gaana)\", \"gh\", \"233\"],\n [\"Gibraltar\", \"gi\", \"350\"],\n [\"Greece (Ελλάδα)\", \"gr\", \"30\"],\n [\"Greenland (Kalaallit Nunaat)\", \"gl\", \"299\"],\n [\"Grenada\", \"gd\", \"1\", 14, [\"473\"]],\n [\"Guadeloupe\", \"gp\", \"590\", 0],\n [\"Guam\", \"gu\", \"1\", 15, [\"671\"]],\n [\"Guatemala\", \"gt\", \"502\"],\n [\"Guernsey\", \"gg\", \"44\", 1, [\"1481\", \"7781\", \"7839\", \"7911\"]],\n [\"Guinea (Guinée)\", \"gn\", \"224\"],\n [\"Guinea-Bissau (Guiné Bissau)\", \"gw\", \"245\"],\n [\"Guyana\", \"gy\", \"592\"],\n [\"Haiti\", \"ht\", \"509\"],\n [\"Honduras\", \"hn\", \"504\"],\n [\"Hong Kong (香港)\", \"hk\", \"852\"],\n [\"Hungary (Magyarország)\", \"hu\", \"36\"],\n [\"Iceland (Ísland)\", \"is\", \"354\"],\n [\"India (भारत)\", \"in\", \"91\"],\n [\"Indonesia\", \"id\", \"62\"],\n [\"Iran (ایران)\", \"ir\", \"98\"],\n [\"Iraq (العراق)\", \"iq\", \"964\"],\n [\"Ireland\", \"ie\", \"353\"],\n [\"Isle of Man\", \"im\", \"44\", 2, [\"1624\", \"74576\", \"7524\", \"7924\", \"7624\"]],\n [\"Israel (ישראל)\", \"il\", \"972\"],\n [\"Italy (Italia)\", \"it\", \"39\", 0],\n [\"Jamaica\", \"jm\", \"1\", 4, [\"876\", \"658\"]],\n [\"Japan (日本)\", \"jp\", \"81\"],\n [\"Jersey\", \"je\", \"44\", 3, [\"1534\", \"7509\", \"7700\", \"7797\", \"7829\", \"7937\"]],\n [\"Jordan (الأردن)\", \"jo\", \"962\"],\n [\"Kazakhstan (Казахстан)\", \"kz\", \"7\", 1, [\"33\", \"7\"]],\n [\"Kenya\", \"ke\", \"254\"],\n [\"Kiribati\", \"ki\", \"686\"],\n [\"Kosovo\", \"xk\", \"383\"],\n [\"Kuwait (الكويت)\", \"kw\", \"965\"],\n [\"Kyrgyzstan (Кыргызстан)\", \"kg\", \"996\"],\n [\"Laos (ລາວ)\", \"la\", \"856\"],\n [\"Latvia (Latvija)\", \"lv\", \"371\"],\n [\"Lebanon (لبنان)\", \"lb\", \"961\"],\n [\"Lesotho\", \"ls\", \"266\"],\n [\"Liberia\", \"lr\", \"231\"],\n [\"Libya (ليبيا)\", \"ly\", \"218\"],\n [\"Liechtenstein\", \"li\", \"423\"],\n [\"Lithuania (Lietuva)\", \"lt\", \"370\"],\n [\"Luxembourg\", \"lu\", \"352\"],\n [\"Macau (澳門)\", \"mo\", \"853\"],\n [\"Madagascar (Madagasikara)\", \"mg\", \"261\"],\n [\"Malawi\", \"mw\", \"265\"],\n [\"Malaysia\", \"my\", \"60\"],\n [\"Maldives\", \"mv\", \"960\"],\n [\"Mali\", \"ml\", \"223\"],\n [\"Malta\", \"mt\", \"356\"],\n [\"Marshall Islands\", \"mh\", \"692\"],\n [\"Martinique\", \"mq\", \"596\"],\n [\"Mauritania (موريتانيا)\", \"mr\", \"222\"],\n [\"Mauritius (Moris)\", \"mu\", \"230\"],\n [\"Mayotte\", \"yt\", \"262\", 1, [\"269\", \"639\"]],\n [\"Mexico (México)\", \"mx\", \"52\"],\n [\"Micronesia\", \"fm\", \"691\"],\n [\"Moldova (Republica Moldova)\", \"md\", \"373\"],\n [\"Monaco\", \"mc\", \"377\"],\n [\"Mongolia (Монгол)\", \"mn\", \"976\"],\n [\"Montenegro (Crna Gora)\", \"me\", \"382\"],\n [\"Montserrat\", \"ms\", \"1\", 16, [\"664\"]],\n [\"Morocco (المغرب)\", \"ma\", \"212\", 0],\n [\"Mozambique (Moçambique)\", \"mz\", \"258\"],\n [\"Myanmar (Burma) (မြန်မာ)\", \"mm\", \"95\"],\n [\"Namibia (Namibië)\", \"na\", \"264\"],\n [\"Nauru\", \"nr\", \"674\"],\n [\"Nepal (नेपाल)\", \"np\", \"977\"],\n [\"Netherlands (Nederland)\", \"nl\", \"31\"],\n [\"New Caledonia (Nouvelle-Calédonie)\", \"nc\", \"687\"],\n [\"New Zealand\", \"nz\", \"64\"],\n [\"Nicaragua\", \"ni\", \"505\"],\n [\"Niger (Nijar)\", \"ne\", \"227\"],\n [\"Nigeria\", \"ng\", \"234\"],\n [\"Niue\", \"nu\", \"683\"],\n [\"Norfolk Island\", \"nf\", \"672\"],\n [\"North Korea (조선 민주주의 인민 공화국)\", \"kp\", \"850\"],\n [\"North Macedonia (Северна Македонија)\", \"mk\", \"389\"],\n [\"Northern Mariana Islands\", \"mp\", \"1\", 17, [\"670\"]],\n [\"Norway (Norge)\", \"no\", \"47\", 0],\n [\"Oman (عُمان)\", \"om\", \"968\"],\n [\"Pakistan (پاکستان)\", \"pk\", \"92\"],\n [\"Palau\", \"pw\", \"680\"],\n [\"Palestine (فلسطين)\", \"ps\", \"970\"],\n [\"Panama (Panamá)\", \"pa\", \"507\"],\n [\"Papua New Guinea\", \"pg\", \"675\"],\n [\"Paraguay\", \"py\", \"595\"],\n [\"Peru (Perú)\", \"pe\", \"51\"],\n [\"Philippines\", \"ph\", \"63\"],\n [\"Poland (Polska)\", \"pl\", \"48\"],\n [\"Portugal\", \"pt\", \"351\"],\n [\"Puerto Rico\", \"pr\", \"1\", 3, [\"787\", \"939\"]],\n [\"Qatar (قطر)\", \"qa\", \"974\"],\n [\"Réunion (La Réunion)\", \"re\", \"262\", 0],\n [\"Romania (România)\", \"ro\", \"40\"],\n [\"Russia (Россия)\", \"ru\", \"7\", 0],\n [\"Rwanda\", \"rw\", \"250\"],\n [\"Saint Barthélemy\", \"bl\", \"590\", 1],\n [\"Saint Helena\", \"sh\", \"290\"],\n [\"Saint Kitts and Nevis\", \"kn\", \"1\", 18, [\"869\"]],\n [\"Saint Lucia\", \"lc\", \"1\", 19, [\"758\"]],\n [\"Saint Martin (Saint-Martin (partie française))\", \"mf\", \"590\", 2],\n [\"Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)\", \"pm\", \"508\"],\n [\"Saint Vincent and the Grenadines\", \"vc\", \"1\", 20, [\"784\"]],\n [\"Samoa\", \"ws\", \"685\"],\n [\"San Marino\", \"sm\", \"378\"],\n [\"São Tomé and Príncipe (São Tomé e Príncipe)\", \"st\", \"239\"],\n [\"Saudi Arabia (المملكة العربية السعودية)\", \"sa\", \"966\"],\n [\"Senegal (Sénégal)\", \"sn\", \"221\"],\n [\"Serbia (Србија)\", \"rs\", \"381\"],\n [\"Seychelles\", \"sc\", \"248\"],\n [\"Sierra Leone\", \"sl\", \"232\"],\n [\"Singapore\", \"sg\", \"65\"],\n [\"Sint Maarten\", \"sx\", \"1\", 21, [\"721\"]],\n [\"Slovakia (Slovensko)\", \"sk\", \"421\"],\n [\"Slovenia (Slovenija)\", \"si\", \"386\"],\n [\"Solomon Islands\", \"sb\", \"677\"],\n [\"Somalia (Soomaaliya)\", \"so\", \"252\"],\n [\"South Africa\", \"za\", \"27\"],\n [\"South Korea (대한민국)\", \"kr\", \"82\"],\n [\"South Sudan (جنوب السودان)\", \"ss\", \"211\"],\n [\"Spain (España)\", \"es\", \"34\"],\n [\"Sri Lanka (ශ්රී ලංකාව)\", \"lk\", \"94\"],\n [\"Sudan (السودان)\", \"sd\", \"249\"],\n [\"Suriname\", \"sr\", \"597\"],\n [\"Svalbard and Jan Mayen\", \"sj\", \"47\", 1, [\"79\"]],\n [\"Sweden (Sverige)\", \"se\", \"46\"],\n [\"Switzerland (Schweiz)\", \"ch\", \"41\"],\n [\"Syria (سوريا)\", \"sy\", \"963\"],\n [\"Taiwan (台灣)\", \"tw\", \"886\"],\n [\"Tajikistan\", \"tj\", \"992\"],\n [\"Tanzania\", \"tz\", \"255\"],\n [\"Thailand (ไทย)\", \"th\", \"66\"],\n [\"Timor-Leste\", \"tl\", \"670\"],\n [\"Togo\", \"tg\", \"228\"],\n [\"Tokelau\", \"tk\", \"690\"],\n [\"Tonga\", \"to\", \"676\"],\n [\"Trinidad and Tobago\", \"tt\", \"1\", 22, [\"868\"]],\n [\"Tunisia (تونس)\", \"tn\", \"216\"],\n [\"Turkey (Türkiye)\", \"tr\", \"90\"],\n [\"Turkmenistan\", \"tm\", \"993\"],\n [\"Turks and Caicos Islands\", \"tc\", \"1\", 23, [\"649\"]],\n [\"Tuvalu\", \"tv\", \"688\"],\n [\"U.S. Virgin Islands\", \"vi\", \"1\", 24, [\"340\"]],\n [\"Uganda\", \"ug\", \"256\"],\n [\"Ukraine (Україна)\", \"ua\", \"380\"],\n [\"United Arab Emirates (الإمارات العربية المتحدة)\", \"ae\", \"971\"],\n [\"United Kingdom\", \"gb\", \"44\", 0],\n [\"United States\", \"us\", \"1\", 0],\n [\"Uruguay\", \"uy\", \"598\"],\n [\"Uzbekistan (Oʻzbekiston)\", \"uz\", \"998\"],\n [\"Vanuatu\", \"vu\", \"678\"],\n [\"Vatican City (Città del Vaticano)\", \"va\", \"39\", 1, [\"06698\"]],\n [\"Venezuela\", \"ve\", \"58\"],\n [\"Vietnam (Việt Nam)\", \"vn\", \"84\"],\n [\"Wallis and Futuna (Wallis-et-Futuna)\", \"wf\", \"681\"],\n [\"Western Sahara (الصحراء الغربية)\", \"eh\", \"212\", 1, [\"5288\", \"5289\"]],\n [\"Yemen (اليمن)\", \"ye\", \"967\"],\n [\"Zambia\", \"zm\", \"260\"],\n [\"Zimbabwe\", \"zw\", \"263\"],\n [\"Åland Islands\", \"ax\", \"358\", 1, [\"18\"]],\n ];\n // loop over all of the countries above, restructuring the data to be objects with named keys\n for (var i = 0; i < allCountries.length; i++) {\n var c = allCountries[i];\n allCountries[i] = {\n name: c[0],\n iso2: c[1],\n dialCode: c[2],\n priority: c[3] || 0,\n areaCodes: c[4] || null,\n };\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n var intlTelInputGlobals = {\n getInstance: function getInstance(input) {\n var id = input.getAttribute(\"data-intl-tel-input-id\");\n return window.intlTelInputGlobals.instances[id];\n },\n instances: {},\n // using a global like this allows us to mock it in the tests\n documentReady: function documentReady() {\n return document.readyState === \"complete\";\n },\n };\n if (typeof window === \"object\") window.intlTelInputGlobals = intlTelInputGlobals;\n // these vars persist through all instances of the plugin\n var id = 0;\n var defaults = {\n // whether or not to allow the dropdown\n allowDropdown: true,\n // if there is just a dial code in the input: remove it on blur\n autoHideDialCode: true,\n // add a placeholder in the input with an example number for the selected country\n autoPlaceholder: \"polite\",\n // modify the parentClass\n customContainer: \"\",\n // modify the auto placeholder\n customPlaceholder: null,\n // append menu to specified element\n dropdownContainer: null,\n // don't display these countries\n excludeCountries: [],\n // format the input value during initialisation and on setNumber\n formatOnDisplay: true,\n // geoIp lookup function\n geoIpLookup: null,\n // inject a hidden input with this name, and on submit, populate it with the result of getNumber\n hiddenInput: \"\",\n // initial country\n initialCountry: \"\",\n // localized country names e.g. { 'de': 'Deutschland' }\n localizedCountries: null,\n // don't insert international dial codes\n nationalMode: true,\n // display only these countries\n onlyCountries: [],\n // number type to use for placeholders\n placeholderNumberType: \"MOBILE\",\n // the countries at the top of the list. defaults to united states and united kingdom\n preferredCountries: [\"us\", \"gb\"],\n // display the country dial code next to the selected flag so it's not part of the typed number\n separateDialCode: false,\n // specify the path to the libphonenumber script to enable validation/formatting\n utilsScript: \"\",\n };\n // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes\n var regionlessNanpNumbers = [\n \"800\",\n \"822\",\n \"833\",\n \"844\",\n \"855\",\n \"866\",\n \"877\",\n \"880\",\n \"881\",\n \"882\",\n \"883\",\n \"884\",\n \"885\",\n \"886\",\n \"887\",\n \"888\",\n \"889\",\n ];\n // utility function to iterate over an object. can't use Object.entries or native forEach because\n // of IE11\n var forEachProp = function forEachProp(obj, callback) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n callback(keys[i], obj[keys[i]]);\n }\n };\n // run a method on each instance of the plugin\n var forEachInstance = function forEachInstance(method) {\n forEachProp(window.intlTelInputGlobals.instances, function (key) {\n window.intlTelInputGlobals.instances[key][method]();\n });\n };\n // this is our plugin class that we will create an instance of\n // eslint-disable-next-line no-unused-vars\n var Iti =\n /*#__PURE__*/\n (function () {\n function Iti(input, options) {\n var _this = this;\n _classCallCheck(this, Iti);\n this.id = id++;\n this.telInput = input;\n this.activeItem = null;\n this.highlightedItem = null;\n // process specified options / defaults\n // alternative to Object.assign, which isn't supported by IE11\n var customOptions = options || {};\n this.options = {};\n forEachProp(defaults, function (key, value) {\n _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;\n });\n this.hadInitialPlaceholder = Boolean(input.getAttribute(\"placeholder\"));\n }\n _createClass(Iti, [\n {\n key: \"_init\",\n value: function _init() {\n var _this2 = this;\n // if in nationalMode, disable options relating to dial codes\n if (this.options.nationalMode) this.options.autoHideDialCode = false;\n // if separateDialCode then doesn't make sense to A) insert dial code into input\n // (autoHideDialCode), and B) display national numbers (because we're displaying the country\n // dial code next to them)\n if (this.options.separateDialCode) {\n this.options.autoHideDialCode = this.options.nationalMode = false;\n }\n // we cannot just test screen size as some smartphones/website meta tags will report desktop\n // resolutions\n // Note: for some reason jasmine breaks if you put this in the main Plugin function with the\n // rest of these declarations\n // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'\n this.isMobile =\n /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent\n );\n if (this.isMobile) {\n // trigger the mobile dropdown css\n document.body.classList.add(\"iti-mobile\");\n // on mobile, we want a full screen dropdown, so we must append it to the body\n if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body;\n }\n // these promises get resolved when their individual requests complete\n // this way the dev can do something like iti.promise.then(...) to know when all requests are\n // complete\n if (typeof Promise !== \"undefined\") {\n var autoCountryPromise = new Promise(function (resolve, reject) {\n _this2.resolveAutoCountryPromise = resolve;\n _this2.rejectAutoCountryPromise = reject;\n });\n var utilsScriptPromise = new Promise(function (resolve, reject) {\n _this2.resolveUtilsScriptPromise = resolve;\n _this2.rejectUtilsScriptPromise = reject;\n });\n this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]);\n } else {\n // prevent errors when Promise doesn't exist\n this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function () {};\n this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function () {};\n }\n // in various situations there could be no country selected initially, but we need to be able\n // to assume this variable exists\n this.selectedCountryData = {};\n // process all the data: onlyCountries, excludeCountries, preferredCountries etc\n this._processCountryData();\n // generate the markup\n this._generateMarkup();\n // set the initial state of the input value and the selected flag\n this._setInitialState();\n // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click\n this._initListeners();\n // utils script, and auto country\n this._initRequests();\n },\n },\n {\n key: \"_processCountryData\",\n value: function _processCountryData() {\n // process onlyCountries or excludeCountries array if present\n this._processAllCountries();\n // process the countryCodes map\n this._processCountryCodes();\n // process the preferredCountries\n this._processPreferredCountries();\n // translate countries according to localizedCountries option\n if (this.options.localizedCountries) this._translateCountriesByLocale();\n // sort countries by name\n if (this.options.onlyCountries.length || this.options.localizedCountries) {\n this.countries.sort(this._countryNameSort);\n }\n },\n },\n {\n key: \"_addCountryCode\",\n value: function _addCountryCode(iso2, countryCode, priority) {\n if (countryCode.length > this.countryCodeMaxLen) {\n this.countryCodeMaxLen = countryCode.length;\n }\n if (!this.countryCodes.hasOwnProperty(countryCode)) {\n this.countryCodes[countryCode] = [];\n }\n // bail if we already have this country for this countryCode\n for (var i = 0; i < this.countryCodes[countryCode].length; i++) {\n if (this.countryCodes[countryCode][i] === iso2) return;\n }\n // check for undefined as 0 is falsy\n var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;\n this.countryCodes[countryCode][index] = iso2;\n },\n },\n {\n key: \"_processAllCountries\",\n value: function _processAllCountries() {\n if (this.options.onlyCountries.length) {\n var lowerCaseOnlyCountries = this.options.onlyCountries.map(function (country) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function (country) {\n return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;\n });\n } else if (this.options.excludeCountries.length) {\n var lowerCaseExcludeCountries = this.options.excludeCountries.map(function (\n country\n ) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function (country) {\n return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;\n });\n } else {\n this.countries = allCountries;\n }\n },\n },\n {\n key: \"_translateCountriesByLocale\",\n value: function _translateCountriesByLocale() {\n for (var i = 0; i < this.countries.length; i++) {\n var iso = this.countries[i].iso2.toLowerCase();\n if (this.options.localizedCountries.hasOwnProperty(iso)) {\n this.countries[i].name = this.options.localizedCountries[iso];\n }\n }\n },\n },\n {\n key: \"_countryNameSort\",\n value: function _countryNameSort(a, b) {\n return a.name.localeCompare(b.name);\n },\n },\n {\n key: \"_processCountryCodes\",\n value: function _processCountryCodes() {\n this.countryCodeMaxLen = 0;\n // here we store just dial codes\n this.dialCodes = {};\n // here we store \"country codes\" (both dial codes and their area codes)\n this.countryCodes = {};\n // first: add dial codes\n for (var i = 0; i < this.countries.length; i++) {\n var c = this.countries[i];\n if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true;\n this._addCountryCode(c.iso2, c.dialCode, c.priority);\n }\n // next: add area codes\n // this is a second loop over countries, to make sure we have all of the \"root\" countries\n // already in the map, so that we can access them, as each time we add an area code substring\n // to the map, we also need to include the \"root\" country's code, as that also matches\n for (var _i = 0; _i < this.countries.length; _i++) {\n var _c = this.countries[_i];\n // area codes\n if (_c.areaCodes) {\n var rootCountryCode = this.countryCodes[_c.dialCode][0];\n // for each area code\n for (var j = 0; j < _c.areaCodes.length; j++) {\n var areaCode = _c.areaCodes[j];\n // for each digit in the area code to add all partial matches as well\n for (var k = 1; k < areaCode.length; k++) {\n var partialDialCode = _c.dialCode + areaCode.substr(0, k);\n // start with the root country, as that also matches this dial code\n this._addCountryCode(rootCountryCode, partialDialCode);\n this._addCountryCode(_c.iso2, partialDialCode);\n }\n // add the full area code\n this._addCountryCode(_c.iso2, _c.dialCode + areaCode);\n }\n }\n }\n },\n },\n {\n key: \"_processPreferredCountries\",\n value: function _processPreferredCountries() {\n this.preferredCountries = [];\n for (var i = 0; i < this.options.preferredCountries.length; i++) {\n var countryCode = this.options.preferredCountries[i].toLowerCase();\n var countryData = this._getCountryData(countryCode, false, true);\n if (countryData) this.preferredCountries.push(countryData);\n }\n },\n },\n {\n key: \"_createEl\",\n value: function _createEl(name, attrs, container) {\n var el = document.createElement(name);\n if (attrs)\n forEachProp(attrs, function (key, value) {\n return el.setAttribute(key, value);\n });\n if (container) container.appendChild(el);\n return el;\n },\n },\n {\n key: \"_generateMarkup\",\n value: function _generateMarkup() {\n // if autocomplete does not exist on the element and its form, then\n // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can\n // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the\n // autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode)\n if (\n !this.telInput.hasAttribute(\"autocomplete\") &&\n !(this.telInput.form && this.telInput.form.hasAttribute(\"autocomplete\"))\n ) {\n this.telInput.setAttribute(\"autocomplete\", \"off\");\n }\n // containers (mostly for positioning)\n var parentClass = \"iti\";\n if (this.options.allowDropdown) parentClass += \" iti--allow-dropdown\";\n if (this.options.separateDialCode) parentClass += \" iti--separate-dial-code\";\n if (this.options.customContainer) {\n parentClass += \" \";\n parentClass += this.options.customContainer;\n }\n var wrapper = this._createEl(\"div\", {\n class: parentClass,\n });\n this.telInput.parentNode.insertBefore(wrapper, this.telInput);\n this.flagsContainer = this._createEl(\n \"div\",\n {\n class: \"iti__flag-container\",\n },\n wrapper\n );\n wrapper.appendChild(this.telInput);\n // selected flag (displayed to left of input)\n this.selectedFlag = this._createEl(\n \"div\",\n {\n class: \"iti__selected-flag\",\n role: \"combobox\",\n \"aria-controls\": \"iti-\".concat(this.id, \"__country-listbox\"),\n \"aria-owns\": \"iti-\".concat(this.id, \"__country-listbox\"),\n \"aria-expanded\": \"false\",\n },\n this.flagsContainer\n );\n this.selectedFlagInner = this._createEl(\n \"div\",\n {\n class: \"iti__flag\",\n },\n this.selectedFlag\n );\n if (this.options.separateDialCode) {\n this.selectedDialCode = this._createEl(\n \"div\",\n {\n class: \"iti__selected-dial-code\",\n },\n this.selectedFlag\n );\n }\n if (this.options.allowDropdown) {\n // make element focusable and tab navigable\n this.selectedFlag.setAttribute(\"tabindex\", \"0\");\n this.dropdownArrow = this._createEl(\n \"div\",\n {\n class: \"iti__arrow\",\n },\n this.selectedFlag\n );\n // country dropdown: preferred countries, then divider, then all countries\n this.countryList = this._createEl(\"ul\", {\n class: \"iti__country-list iti__hide\",\n id: \"iti-\".concat(this.id, \"__country-listbox\"),\n role: \"listbox\",\n \"aria-label\": \"List of countries\",\n });\n if (this.preferredCountries.length) {\n this._appendListItems(this.preferredCountries, \"iti__preferred\", true);\n this._createEl(\n \"li\",\n {\n class: \"iti__divider\",\n role: \"separator\",\n \"aria-disabled\": \"true\",\n },\n this.countryList\n );\n }\n this._appendListItems(this.countries, \"iti__standard\");\n // create dropdownContainer markup\n if (this.options.dropdownContainer) {\n this.dropdown = this._createEl(\"div\", {\n class: \"iti iti--container\",\n });\n this.dropdown.appendChild(this.countryList);\n } else {\n this.flagsContainer.appendChild(this.countryList);\n }\n }\n if (this.options.hiddenInput) {\n var hiddenInputName = this.options.hiddenInput;\n var name = this.telInput.getAttribute(\"name\");\n if (name) {\n var i = name.lastIndexOf(\"[\");\n // if input name contains square brackets, then give the hidden input the same name,\n // replacing the contents of the last set of brackets with the given hiddenInput name\n if (i !== -1)\n hiddenInputName = \"\"\n .concat(name.substr(0, i), \"[\")\n .concat(hiddenInputName, \"]\");\n }\n this.hiddenInput = this._createEl(\"input\", {\n type: \"hidden\",\n name: hiddenInputName,\n });\n wrapper.appendChild(this.hiddenInput);\n }\n },\n },\n {\n key: \"_appendListItems\",\n value: function _appendListItems(countries, className, preferred) {\n // we create so many DOM elements, it is faster to build a temp string\n // and then add everything to the DOM in one go at the end\n var tmp = \"\";\n // for each country\n for (var i = 0; i < countries.length; i++) {\n var c = countries[i];\n var idSuffix = preferred ? \"-preferred\" : \"\";\n // open the list item\n tmp += \"\");\n // add the flag\n tmp += \"\"\n );\n // and the country name and dial code\n tmp += \"\".concat(c.name, \"\");\n tmp += \"+\".concat(c.dialCode, \"\");\n // close the list item\n tmp += \"\";\n }\n this.countryList.insertAdjacentHTML(\"beforeend\", tmp);\n },\n },\n {\n key: \"_setInitialState\",\n value: function _setInitialState() {\n // fix firefox bug: when first load page (with input with value set to number with intl dial\n // code) and initialising plugin removes the dial code from the input, then refresh page,\n // and we try to init plugin again but this time on number without dial code so get grey flag\n var attributeValue = this.telInput.getAttribute(\"value\");\n var inputValue = this.telInput.value;\n var useAttribute =\n attributeValue &&\n attributeValue.charAt(0) === \"+\" &&\n (!inputValue || inputValue.charAt(0) !== \"+\");\n var val = useAttribute ? attributeValue : inputValue;\n var dialCode = this._getDialCode(val);\n var isRegionlessNanp = this._isRegionlessNanp(val);\n var _this$options = this.options,\n initialCountry = _this$options.initialCountry,\n nationalMode = _this$options.nationalMode,\n autoHideDialCode = _this$options.autoHideDialCode,\n separateDialCode = _this$options.separateDialCode;\n // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the\n // flag, else fall back to the default country\n if (dialCode && !isRegionlessNanp) {\n this._updateFlagFromNumber(val);\n } else if (initialCountry !== \"auto\") {\n // see if we should select a flag\n if (initialCountry) {\n this._setFlag(initialCountry.toLowerCase());\n } else {\n if (dialCode && isRegionlessNanp) {\n // has intl dial code, is regionless nanp, and no initialCountry, so default to US\n this._setFlag(\"us\");\n } else {\n // no dial code and no initialCountry, so default to first in list\n this.defaultCountry = this.preferredCountries.length\n ? this.preferredCountries[0].iso2\n : this.countries[0].iso2;\n if (!val) {\n this._setFlag(this.defaultCountry);\n }\n }\n }\n // if empty and no nationalMode and no autoHideDialCode then insert the default dial code\n if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) {\n this.telInput.value = \"+\".concat(this.selectedCountryData.dialCode);\n }\n }\n // NOTE: if initialCountry is set to auto, that will be handled separately\n // format - note this wont be run after _updateDialCode as that's only called if no val\n if (val) this._updateValFromNumber(val);\n },\n },\n {\n key: \"_initListeners\",\n value: function _initListeners() {\n this._initKeyListeners();\n if (this.options.autoHideDialCode) this._initBlurListeners();\n if (this.options.allowDropdown) this._initDropdownListeners();\n if (this.hiddenInput) this._initHiddenInputListener();\n },\n },\n {\n key: \"_initHiddenInputListener\",\n value: function _initHiddenInputListener() {\n var _this3 = this;\n this._handleHiddenInputSubmit = function () {\n _this3.hiddenInput.value = _this3.getNumber();\n };\n if (this.telInput.form)\n this.telInput.form.addEventListener(\"submit\", this._handleHiddenInputSubmit);\n },\n },\n {\n key: \"_getClosestLabel\",\n value: function _getClosestLabel() {\n var el = this.telInput;\n while (el && el.tagName !== \"LABEL\") {\n el = el.parentNode;\n }\n return el;\n },\n },\n {\n key: \"_initDropdownListeners\",\n value: function _initDropdownListeners() {\n var _this4 = this;\n // hack for input nested inside label (which is valid markup): clicking the selected-flag to\n // open the dropdown would then automatically trigger a 2nd click on the input which would\n // close it again\n this._handleLabelClick = function (e) {\n // if the dropdown is closed, then focus the input, else ignore the click\n if (_this4.countryList.classList.contains(\"iti__hide\")) _this4.telInput.focus();\n else e.preventDefault();\n };\n var label = this._getClosestLabel();\n if (label) label.addEventListener(\"click\", this._handleLabelClick);\n // toggle country dropdown on click\n this._handleClickSelectedFlag = function () {\n // only intercept this event if we're opening the dropdown\n // else let it bubble up to the top (\"click-off-to-close\" listener)\n // we cannot just stopPropagation as it may be needed to close another instance\n if (\n _this4.countryList.classList.contains(\"iti__hide\") &&\n !_this4.telInput.disabled &&\n !_this4.telInput.readOnly\n ) {\n _this4._showDropdown();\n }\n };\n this.selectedFlag.addEventListener(\"click\", this._handleClickSelectedFlag);\n // open dropdown list if currently focused\n this._handleFlagsContainerKeydown = function (e) {\n var isDropdownHidden = _this4.countryList.classList.contains(\"iti__hide\");\n if (\n isDropdownHidden &&\n [\"ArrowUp\", \"Up\", \"ArrowDown\", \"Down\", \" \", \"Enter\"].indexOf(e.key) !== -1\n ) {\n // prevent form from being submitted if \"ENTER\" was pressed\n e.preventDefault();\n // prevent event from being handled again by document\n e.stopPropagation();\n _this4._showDropdown();\n }\n // allow navigation from dropdown to input on TAB\n if (e.key === \"Tab\") _this4._closeDropdown();\n };\n this.flagsContainer.addEventListener(\"keydown\", this._handleFlagsContainerKeydown);\n },\n },\n {\n key: \"_initRequests\",\n value: function _initRequests() {\n var _this5 = this;\n // if the user has specified the path to the utils script, fetch it on window.load, else resolve\n if (this.options.utilsScript && !window.intlTelInputUtils) {\n // if the plugin is being initialised after the window.load event has already been fired\n if (window.intlTelInputGlobals.documentReady()) {\n window.intlTelInputGlobals.loadUtils(this.options.utilsScript);\n } else {\n // wait until the load event so we don't block any other requests e.g. the flags image\n window.addEventListener(\"load\", function () {\n window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);\n });\n }\n } else this.resolveUtilsScriptPromise();\n if (this.options.initialCountry === \"auto\") this._loadAutoCountry();\n else this.resolveAutoCountryPromise();\n },\n },\n {\n key: \"_loadAutoCountry\",\n value: function _loadAutoCountry() {\n // 3 options:\n // 1) already loaded (we're done)\n // 2) not already started loading (start)\n // 3) already started loading (do nothing - just wait for loading callback to fire)\n if (window.intlTelInputGlobals.autoCountry) {\n this.handleAutoCountry();\n } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {\n // don't do this twice!\n window.intlTelInputGlobals.startedLoadingAutoCountry = true;\n if (typeof this.options.geoIpLookup === \"function\") {\n this.options.geoIpLookup(\n function (countryCode) {\n window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();\n // tell all instances the auto country is ready\n // TODO: this should just be the current instances\n // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight\n // away (e.g. if they have already done the geo ip lookup somewhere else). Using\n // setTimeout means that the current thread of execution will finish before executing\n // this, which allows the plugin to finish initialising.\n setTimeout(function () {\n return forEachInstance(\"handleAutoCountry\");\n });\n },\n function () {\n return forEachInstance(\"rejectAutoCountryPromise\");\n }\n );\n }\n }\n },\n },\n {\n key: \"_initKeyListeners\",\n value: function _initKeyListeners() {\n var _this6 = this;\n // update flag on keyup\n this._handleKeyupEvent = function () {\n if (_this6._updateFlagFromNumber(_this6.telInput.value)) {\n _this6._triggerCountryChange();\n }\n };\n this.telInput.addEventListener(\"keyup\", this._handleKeyupEvent);\n // update flag on cut/paste events (now supported in all major browsers)\n this._handleClipboardEvent = function () {\n // hack because \"paste\" event is fired before input is updated\n setTimeout(_this6._handleKeyupEvent);\n };\n this.telInput.addEventListener(\"cut\", this._handleClipboardEvent);\n this.telInput.addEventListener(\"paste\", this._handleClipboardEvent);\n },\n },\n {\n key: \"_cap\",\n value: function _cap(number) {\n var max = this.telInput.getAttribute(\"maxlength\");\n return max && number.length > max ? number.substr(0, max) : number;\n },\n },\n {\n key: \"_initBlurListeners\",\n value: function _initBlurListeners() {\n var _this7 = this;\n // on blur or form submit: if just a dial code then remove it\n this._handleSubmitOrBlurEvent = function () {\n _this7._removeEmptyDialCode();\n };\n if (this.telInput.form)\n this.telInput.form.addEventListener(\"submit\", this._handleSubmitOrBlurEvent);\n this.telInput.addEventListener(\"blur\", this._handleSubmitOrBlurEvent);\n },\n },\n {\n key: \"_removeEmptyDialCode\",\n value: function _removeEmptyDialCode() {\n if (this.telInput.value.charAt(0) === \"+\") {\n var numeric = this._getNumeric(this.telInput.value);\n // if just a plus, or if just a dial code\n if (!numeric || this.selectedCountryData.dialCode === numeric) {\n this.telInput.value = \"\";\n }\n }\n },\n },\n {\n key: \"_getNumeric\",\n value: function _getNumeric(s) {\n return s.replace(/\\D/g, \"\");\n },\n },\n {\n key: \"_trigger\",\n value: function _trigger(name) {\n // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n // can bubble, and is cancellable\n this.telInput.dispatchEvent(e);\n },\n },\n {\n key: \"_showDropdown\",\n value: function _showDropdown() {\n this.countryList.classList.remove(\"iti__hide\");\n this.selectedFlag.setAttribute(\"aria-expanded\", \"true\");\n this._setDropdownPosition();\n // update highlighting and scroll to active list item\n if (this.activeItem) {\n this._highlightListItem(this.activeItem, false);\n this._scrollTo(this.activeItem, true);\n }\n // bind all the dropdown-related listeners: mouseover, click, click-off, keydown\n this._bindDropdownListeners();\n // update the arrow\n this.dropdownArrow.classList.add(\"iti__arrow--up\");\n this._trigger(\"open:countrydropdown\");\n },\n },\n {\n key: \"_toggleClass\",\n value: function _toggleClass(el, className, shouldHaveClass) {\n if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className);\n else if (!shouldHaveClass && el.classList.contains(className))\n el.classList.remove(className);\n },\n },\n {\n key: \"_setDropdownPosition\",\n value: function _setDropdownPosition() {\n var _this8 = this;\n if (this.options.dropdownContainer) {\n this.options.dropdownContainer.appendChild(this.dropdown);\n }\n if (!this.isMobile) {\n var pos = this.telInput.getBoundingClientRect();\n // windowTop from https://stackoverflow.com/a/14384091/217866\n var windowTop = window.pageYOffset || document.documentElement.scrollTop;\n var inputTop = pos.top + windowTop;\n var dropdownHeight = this.countryList.offsetHeight;\n // dropdownFitsBelow = (dropdownBottom < windowBottom)\n var dropdownFitsBelow =\n inputTop + this.telInput.offsetHeight + dropdownHeight <\n windowTop + window.innerHeight;\n var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;\n // by default, the dropdown will be below the input. If we want to position it above the\n // input, we add the dropup class.\n this._toggleClass(\n this.countryList,\n \"iti__country-list--dropup\",\n !dropdownFitsBelow && dropdownFitsAbove\n );\n // if dropdownContainer is enabled, calculate postion\n if (this.options.dropdownContainer) {\n // by default the dropdown will be directly over the input because it's not in the flow.\n // If we want to position it below, we need to add some extra top value.\n var extraTop =\n !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight;\n // calculate placement\n this.dropdown.style.top = \"\".concat(inputTop + extraTop, \"px\");\n this.dropdown.style.left = \"\".concat(pos.left + document.body.scrollLeft, \"px\");\n // close menu on window scroll\n this._handleWindowScroll = function () {\n return _this8._closeDropdown();\n };\n window.addEventListener(\"scroll\", this._handleWindowScroll);\n }\n }\n },\n },\n {\n key: \"_getClosestListItem\",\n value: function _getClosestListItem(target) {\n var el = target;\n while (el && el !== this.countryList && !el.classList.contains(\"iti__country\")) {\n el = el.parentNode;\n }\n // if we reached the countryList element, then return null\n return el === this.countryList ? null : el;\n },\n },\n {\n key: \"_bindDropdownListeners\",\n value: function _bindDropdownListeners() {\n var _this9 = this;\n // when mouse over a list item, just highlight that one\n // we add the class \"highlight\", so if they hit \"enter\" we know which one to select\n this._handleMouseoverCountryList = function (e) {\n // handle event delegation, as we're listening for this event on the countryList\n var listItem = _this9._getClosestListItem(e.target);\n if (listItem) _this9._highlightListItem(listItem, false);\n };\n this.countryList.addEventListener(\"mouseover\", this._handleMouseoverCountryList);\n // listen for country selection\n this._handleClickCountryList = function (e) {\n var listItem = _this9._getClosestListItem(e.target);\n if (listItem) _this9._selectListItem(listItem);\n };\n this.countryList.addEventListener(\"click\", this._handleClickCountryList);\n // click off to close\n // (except when this initial opening click is bubbling up)\n // we cannot just stopPropagation as it may be needed to close another instance\n var isOpening = true;\n this._handleClickOffToClose = function () {\n if (!isOpening) _this9._closeDropdown();\n isOpening = false;\n };\n document.documentElement.addEventListener(\"click\", this._handleClickOffToClose);\n // listen for up/down scrolling, enter to select, or letters to jump to country name.\n // use keydown as keypress doesn't fire for non-char keys and we want to catch if they\n // just hit down and hold it to scroll down (no keyup event).\n // listen on the document because that's where key events are triggered if no input has focus\n var query = \"\";\n var queryTimer = null;\n this._handleKeydownOnDropdown = function (e) {\n // prevent down key from scrolling the whole page,\n // and enter key from submitting a form etc\n e.preventDefault();\n // up and down to navigate\n if (\n e.key === \"ArrowUp\" ||\n e.key === \"Up\" ||\n e.key === \"ArrowDown\" ||\n e.key === \"Down\"\n )\n _this9._handleUpDownKey(e.key);\n else if (e.key === \"Enter\") _this9._handleEnterKey();\n else if (e.key === \"Escape\") _this9._closeDropdown();\n else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {\n // jump to countries that start with the query string\n if (queryTimer) clearTimeout(queryTimer);\n query += e.key.toLowerCase();\n _this9._searchForCountry(query);\n // if the timer hits 1 second, reset the query\n queryTimer = setTimeout(function () {\n query = \"\";\n }, 1e3);\n }\n };\n document.addEventListener(\"keydown\", this._handleKeydownOnDropdown);\n },\n },\n {\n key: \"_handleUpDownKey\",\n value: function _handleUpDownKey(key) {\n var next =\n key === \"ArrowUp\" || key === \"Up\"\n ? this.highlightedItem.previousElementSibling\n : this.highlightedItem.nextElementSibling;\n if (next) {\n // skip the divider\n if (next.classList.contains(\"iti__divider\")) {\n next =\n key === \"ArrowUp\" || key === \"Up\"\n ? next.previousElementSibling\n : next.nextElementSibling;\n }\n this._highlightListItem(next, true);\n }\n },\n },\n {\n key: \"_handleEnterKey\",\n value: function _handleEnterKey() {\n if (this.highlightedItem) this._selectListItem(this.highlightedItem);\n },\n },\n {\n key: \"_searchForCountry\",\n value: function _searchForCountry(query) {\n for (var i = 0; i < this.countries.length; i++) {\n if (this._startsWith(this.countries[i].name, query)) {\n var listItem = this.countryList.querySelector(\n \"#iti-\".concat(this.id, \"__item-\").concat(this.countries[i].iso2)\n );\n // update highlighting and scroll\n this._highlightListItem(listItem, false);\n this._scrollTo(listItem, true);\n break;\n }\n }\n },\n },\n {\n key: \"_startsWith\",\n value: function _startsWith(a, b) {\n return a.substr(0, b.length).toLowerCase() === b;\n },\n },\n {\n key: \"_updateValFromNumber\",\n value: function _updateValFromNumber(originalNumber) {\n var number = originalNumber;\n if (\n this.options.formatOnDisplay &&\n window.intlTelInputUtils &&\n this.selectedCountryData\n ) {\n var useNational =\n !this.options.separateDialCode &&\n (this.options.nationalMode || number.charAt(0) !== \"+\");\n var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat,\n NATIONAL = _intlTelInputUtils$nu.NATIONAL,\n INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;\n var format = useNational ? NATIONAL : INTERNATIONAL;\n number = intlTelInputUtils.formatNumber(\n number,\n this.selectedCountryData.iso2,\n format\n );\n }\n number = this._beforeSetNumber(number);\n this.telInput.value = number;\n },\n },\n {\n key: \"_updateFlagFromNumber\",\n value: function _updateFlagFromNumber(originalNumber) {\n // if we're in nationalMode and we already have US/Canada selected, make sure the number starts\n // with a +1 so _getDialCode will be able to extract the area code\n // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag\n // from the number), that means we're initialising the plugin with a number that already has a\n // dial code, so fine to ignore this bit\n var number = originalNumber;\n var selectedDialCode = this.selectedCountryData.dialCode;\n var isNanp = selectedDialCode === \"1\";\n if (number && this.options.nationalMode && isNanp && number.charAt(0) !== \"+\") {\n if (number.charAt(0) !== \"1\") number = \"1\".concat(number);\n number = \"+\".concat(number);\n }\n // update flag if user types area code for another country\n if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== \"+\") {\n number = \"+\".concat(selectedDialCode).concat(number);\n }\n // try and extract valid dial code from input\n var dialCode = this._getDialCode(number, true);\n var numeric = this._getNumeric(number);\n var countryCode = null;\n if (dialCode) {\n var countryCodes = this.countryCodes[this._getNumeric(dialCode)];\n // check if the right country is already selected. this should be false if the number is\n // longer than the matched dial code because in this case we need to make sure that if\n // there are multiple country matches, that the first one is selected (note: we could\n // just check that here, but it requires the same loop that we already have later)\n var alreadySelected =\n countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 &&\n numeric.length <= dialCode.length - 1;\n var isRegionlessNanpNumber =\n selectedDialCode === \"1\" && this._isRegionlessNanp(numeric);\n // only update the flag if:\n // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)\n // AND\n // B) the right country is not already selected\n if (!isRegionlessNanpNumber && !alreadySelected) {\n // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first\n // non-empty index\n for (var j = 0; j < countryCodes.length; j++) {\n if (countryCodes[j]) {\n countryCode = countryCodes[j];\n break;\n }\n }\n }\n } else if (number.charAt(0) === \"+\" && numeric.length) {\n // invalid dial code, so empty\n // Note: use getNumeric here because the number has not been formatted yet, so could contain\n // bad chars\n countryCode = \"\";\n } else if (!number || number === \"+\") {\n // empty, or just a plus, so default\n countryCode = this.defaultCountry;\n }\n if (countryCode !== null) {\n return this._setFlag(countryCode);\n }\n return false;\n },\n },\n {\n key: \"_isRegionlessNanp\",\n value: function _isRegionlessNanp(number) {\n var numeric = this._getNumeric(number);\n if (numeric.charAt(0) === \"1\") {\n var areaCode = numeric.substr(1, 3);\n return regionlessNanpNumbers.indexOf(areaCode) !== -1;\n }\n return false;\n },\n },\n {\n key: \"_highlightListItem\",\n value: function _highlightListItem(listItem, shouldFocus) {\n var prevItem = this.highlightedItem;\n if (prevItem) prevItem.classList.remove(\"iti__highlight\");\n this.highlightedItem = listItem;\n this.highlightedItem.classList.add(\"iti__highlight\");\n if (shouldFocus) this.highlightedItem.focus();\n },\n },\n {\n key: \"_getCountryData\",\n value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {\n var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;\n for (var i = 0; i < countryList.length; i++) {\n if (countryList[i].iso2 === countryCode) {\n return countryList[i];\n }\n }\n if (allowFail) {\n return null;\n }\n throw new Error(\"No country data for '\".concat(countryCode, \"'\"));\n },\n },\n {\n key: \"_setFlag\",\n value: function _setFlag(countryCode) {\n var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};\n // do this first as it will throw an error and stop if countryCode is invalid\n this.selectedCountryData = countryCode\n ? this._getCountryData(countryCode, false, false)\n : {};\n // update the defaultCountry - we only need the iso2 from now on, so just store that\n if (this.selectedCountryData.iso2) {\n this.defaultCountry = this.selectedCountryData.iso2;\n }\n this.selectedFlagInner.setAttribute(\"class\", \"iti__flag iti__\".concat(countryCode));\n // update the selected country's title attribute\n var title = countryCode\n ? \"\"\n .concat(this.selectedCountryData.name, \": +\")\n .concat(this.selectedCountryData.dialCode)\n : \"Unknown\";\n this.selectedFlag.setAttribute(\"title\", title);\n if (this.options.separateDialCode) {\n var dialCode = this.selectedCountryData.dialCode\n ? \"+\".concat(this.selectedCountryData.dialCode)\n : \"\";\n this.selectedDialCode.innerHTML = dialCode;\n // offsetWidth is zero if input is in a hidden container during initialisation\n var selectedFlagWidth =\n this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();\n // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css\n this.telInput.style.paddingLeft = \"\".concat(selectedFlagWidth + 6, \"px\");\n }\n // and the input's placeholder\n this._updatePlaceholder();\n // update the active list item\n if (this.options.allowDropdown) {\n var prevItem = this.activeItem;\n if (prevItem) {\n prevItem.classList.remove(\"iti__active\");\n prevItem.setAttribute(\"aria-selected\", \"false\");\n }\n if (countryCode) {\n // check if there is a preferred item first, else fall back to standard\n var nextItem =\n this.countryList.querySelector(\n \"#iti-\".concat(this.id, \"__item-\").concat(countryCode, \"-preferred\")\n ) ||\n this.countryList.querySelector(\n \"#iti-\".concat(this.id, \"__item-\").concat(countryCode)\n );\n nextItem.setAttribute(\"aria-selected\", \"true\");\n nextItem.classList.add(\"iti__active\");\n this.activeItem = nextItem;\n this.selectedFlag.setAttribute(\n \"aria-activedescendant\",\n nextItem.getAttribute(\"id\")\n );\n }\n }\n // return if the flag has changed or not\n return prevCountry.iso2 !== countryCode;\n },\n },\n {\n key: \"_getHiddenSelectedFlagWidth\",\n value: function _getHiddenSelectedFlagWidth() {\n // to get the right styling to apply, all we need is a shallow clone of the container,\n // and then to inject a deep clone of the selectedFlag element\n var containerClone = this.telInput.parentNode.cloneNode();\n containerClone.style.visibility = \"hidden\";\n document.body.appendChild(containerClone);\n var flagsContainerClone = this.flagsContainer.cloneNode();\n containerClone.appendChild(flagsContainerClone);\n var selectedFlagClone = this.selectedFlag.cloneNode(true);\n flagsContainerClone.appendChild(selectedFlagClone);\n var width = selectedFlagClone.offsetWidth;\n containerClone.parentNode.removeChild(containerClone);\n return width;\n },\n },\n {\n key: \"_updatePlaceholder\",\n value: function _updatePlaceholder() {\n var shouldSetPlaceholder =\n this.options.autoPlaceholder === \"aggressive\" ||\n (!this.hadInitialPlaceholder && this.options.autoPlaceholder === \"polite\");\n if (window.intlTelInputUtils && shouldSetPlaceholder) {\n var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];\n var placeholder = this.selectedCountryData.iso2\n ? intlTelInputUtils.getExampleNumber(\n this.selectedCountryData.iso2,\n this.options.nationalMode,\n numberType\n )\n : \"\";\n placeholder = this._beforeSetNumber(placeholder);\n if (typeof this.options.customPlaceholder === \"function\") {\n placeholder = this.options.customPlaceholder(\n placeholder,\n this.selectedCountryData\n );\n }\n this.telInput.setAttribute(\"placeholder\", placeholder);\n }\n },\n },\n {\n key: \"_selectListItem\",\n value: function _selectListItem(listItem) {\n // update selected flag and active list item\n var flagChanged = this._setFlag(listItem.getAttribute(\"data-country-code\"));\n this._closeDropdown();\n this._updateDialCode(listItem.getAttribute(\"data-dial-code\"), true);\n // focus the input\n this.telInput.focus();\n // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto\n // inserting dial code), who try to put the cursor at the beginning the first time\n var len = this.telInput.value.length;\n this.telInput.setSelectionRange(len, len);\n if (flagChanged) {\n this._triggerCountryChange();\n }\n },\n },\n {\n key: \"_closeDropdown\",\n value: function _closeDropdown() {\n this.countryList.classList.add(\"iti__hide\");\n this.selectedFlag.setAttribute(\"aria-expanded\", \"false\");\n // update the arrow\n this.dropdownArrow.classList.remove(\"iti__arrow--up\");\n // unbind key events\n document.removeEventListener(\"keydown\", this._handleKeydownOnDropdown);\n document.documentElement.removeEventListener(\"click\", this._handleClickOffToClose);\n this.countryList.removeEventListener(\"mouseover\", this._handleMouseoverCountryList);\n this.countryList.removeEventListener(\"click\", this._handleClickCountryList);\n // remove menu from container\n if (this.options.dropdownContainer) {\n if (!this.isMobile) window.removeEventListener(\"scroll\", this._handleWindowScroll);\n if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown);\n }\n this._trigger(\"close:countrydropdown\");\n },\n },\n {\n key: \"_scrollTo\",\n value: function _scrollTo(element, middle) {\n var container = this.countryList;\n // windowTop from https://stackoverflow.com/a/14384091/217866\n var windowTop = window.pageYOffset || document.documentElement.scrollTop;\n var containerHeight = container.offsetHeight;\n var containerTop = container.getBoundingClientRect().top + windowTop;\n var containerBottom = containerTop + containerHeight;\n var elementHeight = element.offsetHeight;\n var elementTop = element.getBoundingClientRect().top + windowTop;\n var elementBottom = elementTop + elementHeight;\n var newScrollTop = elementTop - containerTop + container.scrollTop;\n var middleOffset = containerHeight / 2 - elementHeight / 2;\n if (elementTop < containerTop) {\n // scroll up\n if (middle) newScrollTop -= middleOffset;\n container.scrollTop = newScrollTop;\n } else if (elementBottom > containerBottom) {\n // scroll down\n if (middle) newScrollTop += middleOffset;\n var heightDifference = containerHeight - elementHeight;\n container.scrollTop = newScrollTop - heightDifference;\n }\n },\n },\n {\n key: \"_updateDialCode\",\n value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) {\n var inputVal = this.telInput.value;\n // save having to pass this every time\n var newDialCode = \"+\".concat(newDialCodeBare);\n var newNumber;\n if (inputVal.charAt(0) === \"+\") {\n // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)\n var prevDialCode = this._getDialCode(inputVal);\n if (prevDialCode) {\n // current number contains a valid dial code, so replace it\n newNumber = inputVal.replace(prevDialCode, newDialCode);\n } else {\n // current number contains an invalid dial code, so ditch it\n // (no way to determine where the invalid dial code ends and the rest of the number begins)\n newNumber = newDialCode;\n }\n } else if (this.options.nationalMode || this.options.separateDialCode) {\n // don't do anything\n return;\n } else {\n // nationalMode is disabled\n if (inputVal) {\n // there is an existing value with no dial code: prefix the new dial code\n newNumber = newDialCode + inputVal;\n } else if (hasSelectedListItem || !this.options.autoHideDialCode) {\n // no existing value and either they've just selected a list item, or autoHideDialCode is\n // disabled: insert new dial code\n newNumber = newDialCode;\n } else {\n return;\n }\n }\n this.telInput.value = newNumber;\n },\n },\n {\n key: \"_getDialCode\",\n value: function _getDialCode(number, includeAreaCode) {\n var dialCode = \"\";\n // only interested in international numbers (starting with a plus)\n if (number.charAt(0) === \"+\") {\n var numericChars = \"\";\n // iterate over chars\n for (var i = 0; i < number.length; i++) {\n var c = number.charAt(i);\n // if char is number (https://stackoverflow.com/a/8935649/217866)\n if (!isNaN(parseInt(c, 10))) {\n numericChars += c;\n // if current numericChars make a valid dial code\n if (includeAreaCode) {\n if (this.countryCodes[numericChars]) {\n // store the actual raw string (useful for matching later)\n dialCode = number.substr(0, i + 1);\n }\n } else {\n if (this.dialCodes[numericChars]) {\n dialCode = number.substr(0, i + 1);\n // if we're just looking for a dial code, we can break as soon as we find one\n break;\n }\n }\n // stop searching as soon as we can - in this case when we hit max len\n if (numericChars.length === this.countryCodeMaxLen) {\n break;\n }\n }\n }\n }\n return dialCode;\n },\n },\n {\n key: \"_getFullNumber\",\n value: function _getFullNumber() {\n var val = this.telInput.value.trim();\n var dialCode = this.selectedCountryData.dialCode;\n var prefix;\n var numericVal = this._getNumeric(val);\n if (this.options.separateDialCode && val.charAt(0) !== \"+\" && dialCode && numericVal) {\n // when using separateDialCode, it is visible so is effectively part of the typed number\n prefix = \"+\".concat(dialCode);\n } else {\n prefix = \"\";\n }\n return prefix + val;\n },\n },\n {\n key: \"_beforeSetNumber\",\n value: function _beforeSetNumber(originalNumber) {\n var number = originalNumber;\n if (this.options.separateDialCode) {\n var dialCode = this._getDialCode(number);\n // if there is a valid dial code\n if (dialCode) {\n // in case _getDialCode returned an area code as well\n dialCode = \"+\".concat(this.selectedCountryData.dialCode);\n // a lot of numbers will have a space separating the dial code and the main number, and\n // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get\n // rid of it\n // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc\n var start =\n number[dialCode.length] === \" \" || number[dialCode.length] === \"-\"\n ? dialCode.length + 1\n : dialCode.length;\n number = number.substr(start);\n }\n }\n return this._cap(number);\n },\n },\n {\n key: \"_triggerCountryChange\",\n value: function _triggerCountryChange() {\n this._trigger(\"countrychange\");\n },\n },\n {\n key: \"handleAutoCountry\",\n value: function handleAutoCountry() {\n if (this.options.initialCountry === \"auto\") {\n // we must set this even if there is an initial val in the input: in case the initial val is\n // invalid and they delete it - they should see their auto country\n this.defaultCountry = window.intlTelInputGlobals.autoCountry;\n // if there's no initial value in the input, then update the flag\n if (!this.telInput.value) {\n this.setCountry(this.defaultCountry);\n }\n this.resolveAutoCountryPromise();\n }\n },\n },\n {\n key: \"handleUtils\",\n value: function handleUtils() {\n // if the request was successful\n if (window.intlTelInputUtils) {\n // if there's an initial value in the input, then format it\n if (this.telInput.value) {\n this._updateValFromNumber(this.telInput.value);\n }\n this._updatePlaceholder();\n }\n this.resolveUtilsScriptPromise();\n },\n },\n {\n key: \"destroy\",\n value: function destroy() {\n var form = this.telInput.form;\n if (this.options.allowDropdown) {\n // make sure the dropdown is closed (and unbind listeners)\n this._closeDropdown();\n this.selectedFlag.removeEventListener(\"click\", this._handleClickSelectedFlag);\n this.flagsContainer.removeEventListener(\n \"keydown\",\n this._handleFlagsContainerKeydown\n );\n // label click hack\n var label = this._getClosestLabel();\n if (label) label.removeEventListener(\"click\", this._handleLabelClick);\n }\n // unbind hiddenInput listeners\n if (this.hiddenInput && form)\n form.removeEventListener(\"submit\", this._handleHiddenInputSubmit);\n // unbind autoHideDialCode listeners\n if (this.options.autoHideDialCode) {\n if (form) form.removeEventListener(\"submit\", this._handleSubmitOrBlurEvent);\n this.telInput.removeEventListener(\"blur\", this._handleSubmitOrBlurEvent);\n }\n // unbind key events, and cut/paste events\n this.telInput.removeEventListener(\"keyup\", this._handleKeyupEvent);\n this.telInput.removeEventListener(\"cut\", this._handleClipboardEvent);\n this.telInput.removeEventListener(\"paste\", this._handleClipboardEvent);\n // remove attribute of id instance: data-intl-tel-input-id\n this.telInput.removeAttribute(\"data-intl-tel-input-id\");\n // remove markup (but leave the original input)\n var wrapper = this.telInput.parentNode;\n wrapper.parentNode.insertBefore(this.telInput, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n delete window.intlTelInputGlobals.instances[this.id];\n },\n },\n {\n key: \"getExtension\",\n value: function getExtension() {\n if (window.intlTelInputUtils) {\n return intlTelInputUtils.getExtension(\n this._getFullNumber(),\n this.selectedCountryData.iso2\n );\n }\n return \"\";\n },\n },\n {\n key: \"getNumber\",\n value: function getNumber(format) {\n if (window.intlTelInputUtils) {\n var iso2 = this.selectedCountryData.iso2;\n return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);\n }\n return \"\";\n },\n },\n {\n key: \"getNumberType\",\n value: function getNumberType() {\n if (window.intlTelInputUtils) {\n return intlTelInputUtils.getNumberType(\n this._getFullNumber(),\n this.selectedCountryData.iso2\n );\n }\n return -99;\n },\n },\n {\n key: \"getSelectedCountryData\",\n value: function getSelectedCountryData() {\n return this.selectedCountryData;\n },\n },\n {\n key: \"getValidationError\",\n value: function getValidationError() {\n if (window.intlTelInputUtils) {\n var iso2 = this.selectedCountryData.iso2;\n return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);\n }\n return -99;\n },\n },\n {\n key: \"isValidNumber\",\n value: function isValidNumber() {\n var val = this._getFullNumber().trim();\n var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : \"\";\n return window.intlTelInputUtils\n ? intlTelInputUtils.isValidNumber(val, countryCode)\n : null;\n },\n },\n {\n key: \"setCountry\",\n value: function setCountry(originalCountryCode) {\n var countryCode = originalCountryCode.toLowerCase();\n // check if already selected\n if (!this.selectedFlagInner.classList.contains(\"iti__\".concat(countryCode))) {\n this._setFlag(countryCode);\n this._updateDialCode(this.selectedCountryData.dialCode, false);\n this._triggerCountryChange();\n }\n },\n },\n {\n key: \"setNumber\",\n value: function setNumber(number) {\n // we must update the flag first, which updates this.selectedCountryData, which is used for\n // formatting the number before displaying it\n var flagChanged = this._updateFlagFromNumber(number);\n this._updateValFromNumber(number);\n if (flagChanged) {\n this._triggerCountryChange();\n }\n },\n },\n {\n key: \"setPlaceholderNumberType\",\n value: function setPlaceholderNumberType(type) {\n this.options.placeholderNumberType = type;\n this._updatePlaceholder();\n },\n },\n ]);\n return Iti;\n })();\n /********************\n * STATIC METHODS\n ********************/\n // get the country data object\n intlTelInputGlobals.getCountryData = function () {\n return allCountries;\n };\n // inject a