@frontegg/js 6.50.0 → 6.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return xk},AdminPortalRenderer:function(){return Wk},AppHolder:function(){return T},CheckoutDialog:function(){return Vk},FronteggApp:function(){return $k},HostedLogin:function(){return Fk},LoginBoxRenderer:function(){return Bk},defaultTheme:function(){return Kk},getThemeAdminByName:function(){return jk},getThemeByName:function(){return Gk},initialize:function(){return tT}});var e={};n.r(e),n.d(e,{Delete:function(){return Ho},Get:function(){return Go},Patch:function(){return zo},Post:function(){return Bo},PostDownload:function(){return Jo},Put:function(){return qo},getBaseUrl:function(){return Wo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Ea},getSubTenantsAsTree:function(){return wa},getTenants:function(){return Oa},switchTenant:function(){return La}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return er},SocialLoginProviders:function(){return Za},acceptInvitation:function(){return br},activateAccount:function(){return Sr},bulkCreateIPRestriction:function(){return Ha},changePhoneNumber:function(){return as},changePhoneNumberWithVerification:function(){return is},checkIfAllowToRememberMfaDevice:function(){return Rl},createDomainRestriction:function(){return Wa},createIPRestriction:function(){return qa},createOrUpdateSessionConfigrations:function(){return kl},createSSOConfiguration:function(){return $l},createSSOConfigurationByMetadata:function(){return Vl},createSSODomain:function(){return Wl},createSSOGroup:function(){return ql},createSamlGroup:function(){return sl},deleteAllSessionsForUser:function(){return Pl},deleteDomainRestriction:function(){return Ga},deleteIPRestriction:function(){return Ya},deleteSSOConfiguration:function(){return xl},deleteSSODomain:function(){return Kl},deleteSSOGroup:function(){return Jl},deleteSamlGroup:function(){return ul},deleteSessionForUser:function(){return Tl},deleteTenantApiToken:function(){return wl},deleteUserApiToken:function(){return Cl},disableMFAAuthenticatorApp:function(){return $r},disableMFASMS:function(){return xr},disableMFAWebAuthn:function(){return jr},disableMfa:function(){return Nr},enrollMFAAuthenticatorApp:function(){return Cr},enrollMFAAuthenticatorAppForLogin:function(){return Gr},enrollMFASMS:function(){return Rr},enrollMFASMSForLogin:function(){return qr},enrollMFAWebAuthn:function(){return Ur},enrollMFAWebAuthnForLogin:function(){return Qr},enrollMfa:function(){return Er},exchangeOAuthTokens:function(){return Zl},forgotPassword:function(){return Pr},generateLoginResponse:function(){return lr},generateLoginResponseFromOAuthResponse:function(){return cr},generateLoginResponseV2:function(){return sr},getActivateAccountStrategy:function(){return vr},getCaptchaPolicy:function(){return Na},getCurrentUserSession:function(){return ml},getCurrentUserSessions:function(){return hl},getDomainRestrictions:function(){return Va},getDomainRestrictionsConfig:function(){return ja},getGlobalSecurityPolicy:function(){return Ca},getIPRestrictions:function(){return Ba},getIPRestrictionsConfig:function(){return za},getLockoutPolicy:function(){return Ua},getMFADevices:function(){return Wr},getMFAStrategiesConfig:function(){return ds},getMfaPolicy:function(){return Da},getOidcConfiguration:function(){return dl},getPasswordConfigPolicy:function(){return xa},getPasswordHistoryPolicy:function(){return $a},getSSOConfigurations:function(){return Nl},getSSODefaultRoles:function(){return Bl},getSSOGroups:function(){return Yl},getSSOPublicConfiguration:function(){return yl},getSamlConfiguration:function(){return el},getSamlRoles:function(){return al},getSamlRolesGroups:function(){return rl},getSamlVendorConfiguration:function(){return nl},getSessionConfigurations:function(){return Al},getSocialLoginProviders:function(){return fl},getSocialLoginProvidersV2:function(){return gl},getTenantApiTokensData:function(){return Ll},getUserApiTokensData:function(){return Il},getUserById:function(){return Dl},getVendorConfig:function(){return Sl},getVendorMfaPolicy:function(){return Ra},getVendorPublicAuthStrategiesConfig:function(){return us},loadPasswordConfig:function(){return Lr},login:function(){return gr},loginViaSocialLogin:function(){return pl},loginWithMfa:function(){return pr},logout:function(){return Tr},oidcPostLogin:function(){return fr},oidcPostLoginV2:function(){return Xl},passwordlessPostLogin:function(){return Ul},passwordlessPreLogin:function(){return _l},postLogin:function(){return yr},preDisableMFASMS:function(){return Fr},preDisableMFAWebAuthn:function(){return Vr},preEnrollMFAAuthenticatorApp:function(){return wr},preEnrollMFAAuthenticatorAppForLogin:function(){return Kr},preEnrollMFASMS:function(){return Dr},preEnrollMFASMSForLogin:function(){return zr},preEnrollMFAWebAuthn:function(){return _r},preEnrollMFAWebAuthnForLogin:function(){return Yr},preLogin:function(){return ur},preLoginV2:function(){return Ql},preLoginWithIdpType:function(){return dr},preVerifyMFASMSForLogin:function(){return Hr},preVerifyMFAWebAuthnForLogin:function(){return Xr},recoverMfaToken:function(){return Or},refreshToken:function(){return Ar},refreshTokenV2:function(){return kr},resendActivationEmail:function(){return hr},resendInvitationEmail:function(){return mr},resetPassword:function(){return Ir},resetPhoneNumber:function(){return ts},revokeSessionsForUser:function(){return bl},saveLockoutPolicy:function(){return Ma},saveMfaPolicy:function(){return _a},savePasswordHistoryPolicy:function(){return Fa},setSSODefaultRoles:function(){return zl},signUpUser:function(){return vl},silentOAuthRefreshToken:function(){return es},testCurrentIp:function(){return Qa},testCurrentIpInAllowList:function(){return Xa},updateDomainRestrictionConfig:function(){return Ka},updateIPRestrictionConfig:function(){return Ja},updateSSOConfiguration:function(){return Fl},updateSSOConfigurationByMetadata:function(){return jl},updateSSOGroup:function(){return Hl},updateSamlConfiguration:function(){return tl},updateSamlGroup:function(){return cl},updateSamlRoles:function(){return ll},updateSamlVendorMetadata:function(){return il},updateTenantApiTokensData:function(){return El},updateUserApiTokensData:function(){return Ol},validateSSODomain:function(){return Gl},validateSamlDomain:function(){return ol},verifyChangePhoneNumber:function(){return os},verifyInviteToken:function(){return Ml},verifyMFAAuthenticatorAppForLogin:function(){return Br},verifyMFASMSForLogin:function(){return Jr},verifyMFAWebAuthnForLogin:function(){return Zr},verifyMfa:function(){return Mr},verifyNewDeviceSession:function(){return cs},verifyResetPhoneNumber:function(){return ns},webAuthnCreateNewDeviceSession:function(){return ss},webAuthnPostLogin:function(){return ls},webAuthnPreLogin:function(){return rs}});var a={};n.r(a),n.d(a,{addUser:function(){return vs},changePassword:function(){return ps},createInviteUserLink:function(){return bs},deleteInviteUserLink:function(){return ks},deleteUser:function(){return hs},getInviteLinkConfiguration:function(){return Ps},getInviteUserLink:function(){return Ts},getProfile:function(){return ys},loadAvailablePermissions:function(){return Ls},loadAvailableRoles:function(){return Is},loadStats:function(){return Os},loadUsers:function(){return Ss},resendActivationLink:function(){return Es},resendInvitationLink:function(){return ws},resendInvitationLinkToAllTenants:function(){return Cs},updateInviteUserLink:function(){return As},updateProfile:function(){return fs},updateProfileImage:function(){return gs},updateUser:function(){return ms}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Ms},getCurrentUserIpMetadata:function(){return Rs},getIpAdressMetadata:function(){return Ns},getNotificationsMetadata:function(){return _s},getSamlMetadata:function(){return Us}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Gs},getReport:function(){return js},getReports:function(){return Vs},renderReport:function(){return Ws},scheduleReport:function(){return Ks},sendReport:function(){return Bs}});var s={};n.r(s),n.d(s,{getNotifications:function(){return zs},markAllAsRead:function(){return Js},updateNotificationIsPinned:function(){return Hs},updateNotificationStatus:function(){return qs}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Zs},getAudits:function(){return Qs},getAuditsStats:function(){return Xs}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return fc},deleteEmailSubscriptions:function(){return dc},deleteSMSConfiguration:function(){return mc},deleteSMSSubscriptions:function(){return vc},deleteSlackConfiguration:function(){return rc},deleteWebhooksConfiguration:function(){return kc},getCategories:function(){return Lc},getChannelMaps:function(){return Oc},getEmailConfiguration:function(){return sc},getSMSConfiguration:function(){return gc},getSlackChannels:function(){return oc},getSlackConfiguration:function(){return nc},getSlackScope:function(){return ic},getWebhookLog:function(){return Tc},getWebhooksConfigurations:function(){return bc},patchEmailConfiguration:function(){return uc},patchSMSConfiguration:function(){return Sc},postEmailConfiguration:function(){return cc},postSMSConfiguration:function(){return pc},postSlackCode:function(){return lc},postSlackConfiguration:function(){return ac},postWebhookRetry:function(){return Ic},postWebhookTest:function(){return Pc},postWebhooksConfiguration:function(){return Ac},putEmailSubscriptions:function(){return yc},putSMSSubscriptions:function(){return hc}});var d={};n.r(d),n.d(d,{getSettings:function(){return wc},updateSettings:function(){return Ec}});var y={};n.r(y),n.d(y,{addRole:function(){return Uc},attachPermissionToRoles:function(){return xc},attachPermissionsToRole:function(){return $c},deleteRole:function(){return Mc},getPermissionCategories:function(){return Vc},getPermissions:function(){return Fc},getRoles:function(){return _c},updateRole:function(){return Nc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return hu},ISubscriptionStatus:function(){return Su},PaymentMethodType:function(){return vu},ProviderType:function(){return mu},TenantCreatedAction:function(){return Au},TrialEndAction:function(){return bu},cancelManagedSubscription:function(){return Hc},cancelSubscription:function(){return Kc},createStripeCustomer:function(){return su},createStripePaymentMethodSetupIntentSecret:function(){return uu},createSubscription:function(){return ru},createTenantConfiguration:function(){return fu},getManagedSubscription:function(){return zc},getManagedSubscriptions:function(){return qc},getPaymentMethod:function(){return ou},getPaymentMethods:function(){return iu},getPaymentProviders:function(){return gu},getStripeCustomer:function(){return lu},getStripePaymentProviderConfiguration:function(){return cu},getSubscription:function(){return Wc},getSubscriptionInvoice:function(){return eu},getSubscriptionInvoicePdf:function(){return tu},getSubscriptionInvoices:function(){return Zc},getSubscriptionPlan:function(){return Xc},getSubscriptionPlans:function(){return Qc},getSubscriptionSummaries:function(){return du},getSubscriptions:function(){return jc},getTenantConfiguration:function(){return yu},getVendorPublicConfigurations:function(){return pu},renewManagedSubscription:function(){return Jc},renewSubscription:function(){return Gc},updateManagedSubscription:function(){return Yc},updatePaymentMethodBillingDetails:function(){return au},updateSubscription:function(){return Bc}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Ou}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Du},addUserToTenantAndSubTenants:function(){return wu},loadAllUsers:function(){return Eu},removeUserFromTenantAndSubTenants:function(){return Cu},removeUserRolesFromSubTenants:function(){return Ru},setUserRolesForSubTenants:function(){return _u}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Uu}});var v={};n.r(v),n.d(v,{createConfiguration:function(){return $u},deleteConfiguration:function(){return Fu},getConfigs:function(){return Mu},updateConfiguration:function(){return Nu}});var h={};n.r(h),n.d(h,{AuthStrategyEnum:function(){return er},ContextHolder:function(){return xo},FronteggApiError:function(){return jo},FronteggContext:function(){return Vo},ISubscriptionCancellationPolicy:function(){return hu},ISubscriptionStatus:function(){return Su},MFAStrategyEnum:function(){return Pu},PaymentMethodType:function(){return vu},ProviderType:function(){return mu},RestrictionType:function(){return Rn},ScimConnectionSource:function(){return Gu},SecondaryAuthStrategy:function(){return ku},SocialLoginProviders:function(){return Za},TenantType:function(){return Lu},UserManagedByEnum:function(){return Iu},WebAuthnDeviceType:function(){return Tu},api:function(){return Bu},createConfiguration:function(){return $u},default:function(){return zu},deleteConfiguration:function(){return Fu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return xu},fronteggRefreshTokenUrl:function(){return Vu},fronteggSilentRefreshTokenUrl:function(){return ju},fronteggTenantsUrl:function(){return Ku},fronteggUsersUrl:function(){return Wu},getConfigs:function(){return Mu},loadFeatureFlags:function(){return Uu},updateConfiguration:function(){return Nu}});var m={};function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function k(e,t,n){return t&&A(e.prototype,t),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(m),n.d(m,{AccountPageFields:function(){return Ek},DomainRestrictionsTabFields:function(){return _k},GeneralSettingsTabFields:function(){return Dk},InviteUserModalFields:function(){return Ok},IpRestrictionsTabFields:function(){return Rk},Metadata:function(){return bk},PrivacyPageFields:function(){return Lk},ProfilePageFields:function(){return Ik},SecurityPageTabs:function(){return wk},SessionManagementTabFields:function(){return Ck},fieldAppearance:function(){return Uk},tabAppearance:function(){return Mk}});var T=function(){function e(){b(this,e)}return k(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function P(){return P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},P.apply(this,arguments)}function I(e,t,n,i,o,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,o)}function L(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){I(a,i,o,r,l,"next",e)}function l(e){I(a,i,o,r,l,"throw",e)}r(void 0)}))}}T._apps={};var O=n(841),E=n.n(O);function w(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function C(e){return!!e&&!!e[Se]}function D(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===ve}(e)||Array.isArray(e)||!!e[pe]||!!e.constructor[pe]||$(e)||F(e))}function R(e,t,n){void 0===n&&(n=!1),0===_(e)?(n?Object.keys:he)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function _(e){var t=e[Se];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:$(e)?2:F(e)?3:0}function U(e,t){return 2===_(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function M(e,t,n){var i=_(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function N(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function $(e){return de&&e instanceof Map}function F(e){return ye&&e instanceof Set}function x(e){return e.o||e.t}function V(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=me(e);delete t[Se];for(var n=he(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function j(e,t){return void 0===t&&(t=!1),K(e)||C(e)||!D(e)||(_(e)>1&&(e.set=e.add=e.clear=e.delete=W),Object.freeze(e),t&&R(e,(function(e,t){return j(t,!0)}),!0)),e}function W(){w(2)}function K(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function G(e){var t=be[e];return t||w(18,e),t}function B(){return ce}function z(e,t){t&&(G("Patches"),e.u=[],e.s=[],e.v=t)}function q(e){H(e),e.p.forEach(Y),e.p=null}function H(e){e===ce&&(ce=e.l)}function J(e){return ce={p:[],l:ce,h:e,m:!0,_:0}}function Y(e){var t=e[Se];0===t.i||1===t.i?t.j():t.O=!0}function Q(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||G("ES5").S(t,e,i),i?(n[Se].P&&(q(t),w(4)),D(e)&&(e=X(t,e),t.l||ee(t,e)),t.u&&G("Patches").M(n[Se].t,e,t.u,t.s)):e=X(t,n,[]),q(t),t.u&&t.v(t.u,t.s),e!==ge?e:void 0}function X(e,t,n){if(K(t))return t;var i=t[Se];if(!i)return R(t,(function(o,a){return Z(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ee(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=V(i.k):i.o;R(3===i.i?new Set(o):o,(function(t,a){return Z(e,i,o,t,a,n)})),ee(e,o,!1),n&&e.u&&G("Patches").R(i,n,e.u,e.s)}return i.o}function Z(e,t,n,i,o,a){if(C(o)){var r=X(e,o,a&&t&&3!==t.i&&!U(t.D,i)?a.concat(i):void 0);if(M(n,i,r),!C(r))return;e.m=!1}if(D(o)&&!K(o)){if(!e.h.F&&e._<1)return;X(e,o),t&&t.A.l||ee(e,o)}}function ee(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&j(t,n)}function te(e,t){var n=e[Se];return(n?x(n):e)[t]}function ne(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function ie(e){e.P||(e.P=!0,e.l&&ie(e.l))}function oe(e){e.o||(e.o=V(e.t))}function ae(e,t,n){var i=$(t)?G("MapSet").N(t,n):F(t)?G("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:B(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ae;n&&(o=[i],a=ke);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):G("ES5").J(t,n);return(n?n.A:B()).p.push(i),i}function re(e){return C(e)||w(22,e),function e(t){if(!D(t))return t;var n,i=t[Se],o=_(t);if(i){if(!i.P&&(i.i<4||!G("ES5").K(i)))return i.t;i.I=!0,n=le(t,o),i.I=!1}else n=le(t,o);return R(n,(function(t,o){i&&function(e,t){return 2===_(e)?e.get(t):e[t]}(i.t,t)===o||M(n,t,e(o))})),3===o?new Set(n):n}(e)}function le(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return V(e)}var se,ce,ue="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),de="undefined"!=typeof Map,ye="undefined"!=typeof Set,fe="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ge=ue?Symbol.for("immer-nothing"):((se={})["immer-nothing"]=!0,se),pe=ue?Symbol.for("immer-draftable"):"__$immer_draftable",Se=ue?Symbol.for("immer-state"):"__$immer_state",ve=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),he="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,me=Object.getOwnPropertyDescriptors||function(e){var t={};return he(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},be={},Ae={get:function(e,t){if(t===Se)return e;var n=x(e);if(!U(n,t))return function(e,t,n){var i,o=ne(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!D(i)?i:i===te(e.t,t)?(oe(e),e.o[t]=ae(e.A.h,i,e)):i},has:function(e,t){return t in x(e)},ownKeys:function(e){return Reflect.ownKeys(x(e))},set:function(e,t,n){var i=ne(x(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=te(x(e),t),a=null==o?void 0:o[Se];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(N(n,o)&&(void 0!==n||U(e.t,t)))return!0;oe(e),ie(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==te(e.t,t)||t in e.t?(e.D[t]=!1,oe(e),ie(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=x(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){w(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){w(12)}},ke={};R(Ae,(function(e,t){ke[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ke.deleteProperty=function(e,t){return ke.set.call(this,e,t,void 0)},ke.set=function(e,t,n){return Ae.set.call(this,e[0],t,n,e[0])};var Te=function(){function e(e){var t=this;this.g=fe,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&w(6),void 0!==i&&"function"!=typeof i&&w(7),D(e)){var l=J(t),s=ae(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?q(l):H(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(l,i),Q(e,l)}),(function(e){throw q(l),e})):(z(l,i),Q(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ge&&(r=void 0),t.F&&j(r,!0),i){var u=[],d=[];G("Patches").M(e,r,u,d),i(u,d)}return r}w(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){D(e)||w(8),C(e)&&(e=re(e));var t=J(this),n=ae(this,e,void 0);return n[Se].C=!0,H(t),n},t.finishDraft=function(e,t){var n=(e&&e[Se]).A;return z(n,t),Q(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!fe&&w(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=G("Patches").$;return C(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Pe=new Te,Ie=Pe.produce,Le=(Pe.produceWithPatches.bind(Pe),Pe.setAutoFreeze.bind(Pe),Pe.setUseProxies.bind(Pe),Pe.applyPatches.bind(Pe),Pe.createDraft.bind(Pe),Pe.finishDraft.bind(Pe),Ie);function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function we(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var De="function"==typeof Symbol&&Symbol.observable||"@@observable",Re=function(){return Math.random().toString(36).substring(7).split("").join(".")},_e={INIT:"@@redux/INIT"+Re(),REPLACE:"@@redux/REPLACE"+Re(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Re()}};function Ue(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Me(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ce(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ce(1));return n(Me)(e,t)}if("function"!=typeof e)throw new Error(Ce(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ce(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ce(4));if(s)throw new Error(Ce(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ce(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ue(e))throw new Error(Ce(7));if(void 0===e.type)throw new Error(Ce(8));if(s)throw new Error(Ce(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ce(10));o=e,y({type:_e.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ce(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[De]=function(){return this},e}return y({type:_e.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[De]=g,i}function Ne(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:_e.INIT}))throw new Error(Ce(12));if(void 0===n(void 0,{type:_e.PROBE_UNKNOWN_ACTION()}))throw new Error(Ce(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ce(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function $e(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ce(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=$e.apply(void 0,a)(n.dispatch),we(we({},n),{},{dispatch:i})}}}function xe(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ve=xe();Ve.withExtraArgument=xe;var je,We=Ve,Ke=(je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},je(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}je(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ge=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Be=Object.defineProperty,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),qe=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Je=function(e,t,n){return t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ye=function(e,t){for(var n in t||(t={}))qe.call(t,n)&&Je(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],He.call(t,n)&&Je(e,n,t[n]);return e},Qe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?$e:$e.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Xe=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ke(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Ge([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ge([void 0],e.concat(this))))},t}(Array);function Ze(e){return D(e)?Le(e,(function(){})):e}function et(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Xe);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(We):i.push(We.withExtraArgument(n.extraArgument))),i}function tt(e){var t,n=function(e){return et(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ne(a)}var g=l;"function"==typeof g&&(g=g(n));var p=Fe.apply(void 0,g),S=$e;c&&(S=Qe(Ye({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ge([p],f):"function"==typeof f&&(v=f(v)),Me(t,d,S.apply(void 0,v))}function nt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Ye(Ye({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function it(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ot(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:Ze(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?it(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Ye(Ye({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?it(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return Ze(e())};else{var c=Ze(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ge([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var i;if(C(e))return void 0===(i=n(e,t))?e:i;if(D(e))return Le(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=i?nt(c,i):nt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var at="listenerMiddleware";nt(at+"/add"),nt(at+"/removeAll"),nt(at+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Se];return Ae.get(t,e)},set:function(t){var n=this[Se];Ae.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Se];if(!o.P)switch(o.i){case 5:i(o)&&ie(o);break;case 4:n(o)&&ie(o)}}}function n(e){for(var t=e.t,n=e.k,i=he(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Se){var r=t[a];if(void 0===r&&!U(t,a))return!0;var l=n[a],s=l&&l[Se];if(s?s.t!==r:!N(l,r))return!0}}var c=!!t[Se];return i.length!==he(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){be[e]||(be[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=me(n);delete a[Se];for(var r=he(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:B(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Se,{value:a,writable:!0}),o},S:function(e,n,o){o?C(n)&&n[Se].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Se];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)R(a,(function(t){t!==Se&&(void 0!==o[t]||U(o,t)?r[t]||e(a[t]):(r[t]=!0,ie(n)))})),R(o,(function(e){void 0!==a[e]||U(a,e)||(r[e]=!1,ie(n))}));else if(5===l){if(i(n)&&(ie(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const rt=(e,t)=>n=>P({},n,{[e]:t[e]}),lt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>P({},t,{[e]:P({},t[e],n)})}),st=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return P({},n,{[e]:P({},n[e],{[t]:P({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return P({},t,{[e]:P({},t[e],{loaders:P({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return P({},t,{[e]:P({},t[e],{errors:P({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),dt=(e=500)=>new Promise((t=>setTimeout(t,e))),yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ft=new Uint8Array(256);for(let e=0;e<yt.length;e++)ft[yt.charCodeAt(e)]=e;const gt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=ft[e.charCodeAt(i)],a=ft[e.charCodeAt(i+1)],r=ft[e.charCodeAt(i+2)],l=ft[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=yt[t[i]>>2],o+=yt[(3&t[i])<<4|t[i+1]>>4],o+=yt[(15&t[i+1])<<2|t[i+2]>>6],o+=yt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=pt(e[n]);return t}return e};let St,vt,ht;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor"}(St||(St={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(vt||(vt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(ht||(ht={}));const mt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",bt="HOSTED_LOGIN_VERIFIER_KEY",At="auth",kt="connectivity",Tt="auditLogs",Pt="vendor",It={flow:vt.Login,step:St.preLogin,loading:!1,email:"",tenants:[]},Lt={setLoginState:lt("loginState"),resetLoginState:rt("loginState",{loginState:It})},Ot={requestAuthorize:nt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:nt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:nt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:nt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:nt("auth/afterAuthNavigation"),preLogin:nt("auth/preLogin",(e=>({payload:e}))),postLogin:nt("auth/postLogin",(e=>({payload:e}))),login:nt("auth/login",(e=>({payload:e}))),loginWithMfa:nt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:nt("auth/recoverMfa",(e=>({payload:e}))),logout:nt("auth/logout",(e=>({payload:e}))),silentLogout:nt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:nt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:nt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:nt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:nt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:nt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:nt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:nt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:nt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:nt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:nt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:nt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:nt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:nt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:nt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:nt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:nt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:nt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:nt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:nt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:nt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:nt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Et;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Et||(Et={}));const wt={step:Et.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Ct={setActivateState:lt("activateState"),resetActivateState:rt("activateState",{activateState:wt}),setActivateStrategyState:st("activateState","activationStrategy")},Dt={activateAccount:nt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:nt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:nt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:nt("auth/resendActivationEmail",(e=>({payload:e})))};let Rt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Rt||(Rt={}));const _t={step:Rt.validate},Ut={setAcceptInvitationState:lt("acceptInvitationState"),resetAcceptInvitationState:rt("acceptInvitationState",{acceptInvitationState:_t})},Mt={acceptInvitation:nt("auth/acceptInvitation",(e=>({payload:e})))};let Nt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Nt||(Nt={}));const $t={step:Nt.forgotPassword,loading:!1,email:"",passwordConfig:null},Ft={setForgotPasswordState:lt("forgotPasswordState"),resetForgotPasswordState:rt("forgotPasswordState",{forgotPasswordState:$t})},xt={forgotPassword:nt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:nt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:nt("auth/loadPasswordConfig",(e=>({payload:e})))};let Vt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Vt||(Vt={}));const jt={step:Vt.ResetPhoneNumber,loading:!1},Wt={setResetPhoneNumberState:lt("resetPhoneNumberState"),resetResetPhoneNumberState:rt("resetPhoneNumberState",{resetPhoneNumberState:jt})},Kt={resetPhoneNumber:nt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:nt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:nt("auth/changePhoneNumber",(e=>({payload:e})))},Gt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Bt={setSSOLoader:ct("ssoState"),setSSOError:ut("ssoState"),setSSOState:lt("ssoState"),resetSSOState:rt("ssoState",{ssoState:Gt})},zt={loadSSOConfigurationsV2:nt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:nt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:nt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:nt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:nt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:nt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:nt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:nt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:nt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:nt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:nt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:nt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:nt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:nt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:nt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:nt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:nt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:nt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:nt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:nt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:nt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:nt("auth/oidcPostlogin",(e=>({payload:e})))},qt={loading:!1,error:null},Ht={setProfileState:lt("profileState"),resetProfileState:rt("profileState",{profileState:qt})},Jt={loadProfile:nt("auth/loadProfile"),saveProfile:nt("auth/saveProfile",(e=>({payload:e}))),changePassword:nt("auth/changePassword",(e=>({payload:e})))};let Yt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Yt||(Yt={}));const Qt={step:Yt.verify,loading:!1,saving:!1},Xt={setMfaState:lt("mfaState"),resetMfaState:rt("mfaState",{mfaState:Qt})},Zt={enrollMfa:nt("auth/enrollMfa"),getMFADevices:nt("auth/getMFADevices"),getMFAStrategies:nt("auth/getMFAStrategies"),verifyMfa:nt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:nt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:nt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:nt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:nt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:nt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:nt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:nt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:nt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:nt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:nt("auth/disableMfaWebAuthn",(e=>({payload:e})))},en={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},tn={setTeamLoader:ct("teamState"),setTeamError:ut("teamState"),setTeamState:lt("teamState"),resetTeamState:rt("teamState",{teamState:en})},nn={loadUsers:nt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:nt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:nt("auth/loadRoles",(e=>({payload:e}))),addUser:nt("auth/addUser",(e=>({payload:e}))),addUsersBulk:nt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:nt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:nt("auth/updateUser",(e=>({payload:e}))),deleteUser:nt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:nt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:nt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:nt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:nt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:nt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:nt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:nt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:nt("auth/getInvitationLink"),createInvitationLink:nt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:nt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:nt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:nt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:nt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:nt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:nt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:nt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:nt("auth/closeLockUserDialog",(e=>({payload:e})))},on={firstLoad:!0,loading:!1,error:""},an={setSocialLoginsState:lt("socialLoginState"),resetSocialLoginsState:rt("socialLoginState",{socialLoginState:on})},rn={loadSocialLoginsConfiguration:nt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:nt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:nt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:nt("auth/setSocialLoginError",(e=>({payload:e})))};let ln;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(ln||(ln={}));const sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:ln.SignUp},cn={setSignUpState:lt("signUpState"),resetSignUpState:rt("signUpState",{signUpState:sn})},un={signUpUser:nt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:nt("auth/resetSignUpStateSoft")},dn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},yn={setApiTokensLoader:ct("apiTokensState"),setApiTokensError:ut("apiTokensState"),setApiTokensState:lt("apiTokensState"),resetApiTokensState:rt("apiTokensState",{apiTokensState:dn})},fn={loadApiTokens:nt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:nt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:nt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:nt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:nt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:nt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:nt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:nt("auth/deleteTenantApiToken",(e=>({payload:e})))},gn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},pn={setSecurityPolicyState:lt("securityPolicyState"),setSecurityPolicyGlobalState:st("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:st("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:st("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:st("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:st("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:st("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:st("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:st("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:st("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:rt("securityPolicyState",{securityPolicyState:gn})},Sn={loadSecurityPolicy:nt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:nt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:nt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:nt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:nt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:nt("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:nt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:nt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:nt("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:nt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:nt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:nt("auth/loadPublicAuthStrategiesPolicy")},vn={loading:!1},hn={setAccountSettingsState:lt("accountSettingsState"),resetAccountSettingsState:rt("accountSettingsState",{accountSettingsState:vn})},mn={loadAccountSettings:nt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:nt("auth/saveAccountSettings",(e=>({payload:e})))},bn={tenants:[],subTenants:[],loading:!0,tenantTree:null},An={setTenantsState:lt("tenantsState"),resetTenantsState:rt("tenantsState",{tenantsState:bn})},kn={switchTenant:nt("auth/switchTenant",(e=>({payload:e}))),loadTenants:nt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:nt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:nt("auth/loadSubTenantsTree",(e=>({payload:e})))},Tn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Pn={setRolesState:lt("rolesState"),resetRolesState:rt("rolesState",{rolesState:Tn})},In={loadRolesAndPermissions:nt("auth/loadRoles",(e=>({payload:e}))),addRole:nt("auth/addRole",(e=>({payload:e}))),updateRole:nt("auth/updateRole",(e=>({payload:e}))),deleteRole:nt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:nt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:nt("auth/attachPermissionToRoles",(e=>({payload:e})))},Ln={loading:!1,sessions:[]},On={setSessionsState:lt("sessionsState"),resetSessionsState:rt("sessionsState",{sessionsState:Ln})},En={loadUserSessions:nt("auth/loadUserSessions"),loadCurrentUserSession:nt("auth/loadCurrentUserSession"),deleteUserSession:nt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:nt("auth/deleteAllUserSessions"),revokeUserSessions:nt("auth/revokeUserSessions",(e=>({payload:e})))},wn={loading:!1,configurations:{}},Cn={setSessionsPolicyState:lt("sessionsPolicyState"),resetSessionsPolicyState:rt("sessionsPolicyState",{sessionsPolicyState:wn})},Dn={loadSessionsPolicy:nt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:nt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Rn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Rn||(Rn={}));const _n={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Rn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Un={setRestrictionsState:lt("restrictionsState"),setIpRestrictionsState:st("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:st("restrictionsState","emailDomainRestrictions")},Mn={checkIfUserIpValid:nt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:nt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:nt("auth/loadIpRestrictions"),saveIpRestriction:nt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:nt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:nt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:nt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:nt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:nt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:nt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Nn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:sn,loginState:It,activateState:wt,acceptInvitationState:_t,forgotPasswordState:$t,ssoState:Gt,profileState:qt,mfaState:Qt,teamState:en,socialLoginState:on,apiTokensState:dn,securityPolicyState:gn,accountSettingsState:vn,tenantsState:bn,rolesState:Tn,resetPhoneNumberState:jt,sessionsState:Ln,sessionsPolicyState:wn,restrictionsState:_n},$n=P({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Nn),{reducer:Fn,actions:xn}=ot({name:At,initialState:$n,reducers:P({resetState:e=>P({},e,Nn),setState:(e,{payload:t})=>P({},e,t),setUser:("user",(e,{payload:t})=>P({},e,{user:t}))},Lt,an,Ct,Ut,Ft,Wt,cn,Ht,Bt,Xt,tn,yn,pn,hn,An,Pn,On,Cn,Un)});const Vn=P({},xn,Ot,rn,Dt,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,En,Dn,Mn);var jn=function(e){return"@@redux-saga/"+e},Wn=jn("CANCEL_PROMISE"),Kn=jn("CHANNEL_END"),Gn=jn("IO"),Bn=jn("MATCH"),zn=jn("MULTICAST"),qn=jn("SAGA_ACTION"),Hn=jn("SELF_CANCELLATION"),Jn=jn("TASK"),Yn=jn("TASK_CANCEL"),Qn=jn("TERMINATE"),Xn=jn("LOCATION");function Zn(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var ei=function(e){return null==e},ti=function(e){return null!=e},ni=function(e){return"function"==typeof e},ii=function(e){return"string"==typeof e},oi=Array.isArray,ai=function(e){return e&&ni(e.then)},ri=function(e){return e&&ni(e.next)&&ni(e.throw)},li=function e(t){return t&&(ii(t)||ui(t)||ni(t)||oi(t)&&t.every(e))},si=function(e){return e&&ni(e.take)&&ni(e.close)},ci=function(e){return ni(e)&&e.hasOwnProperty("toString")},ui=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},di=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Wn]=function(){clearTimeout(n)},i},yi=function(e){return function(){return e}},fi=yi(!0),gi=function(){},pi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Si=function(e,t){P(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function vi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var hi=function(e){throw e},mi=function(e){return{value:e,done:!0}};function bi(e,t,n){void 0===t&&(t=hi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:mi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ai(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ki=function(e){return Array.apply(null,new Array(e))},Ti=function(e){return function(t){return e(Object.defineProperty(t,qn,{value:!0}))}},Pi=function(e){return e===Qn},Ii=function(e){return e===Yn},Li=function(e){return Pi(e)||Ii(e)};function Oi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=oi(e)?ki(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Li(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=gi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ei(e){return{name:e.name||"anonymous",location:wi(e)}}function wi(e){return e[Xn]}var Ci=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Di="TAKE",Ri="CALL",_i="FORK",Ui="SELECT",Mi=function(e,t){var n;return(n={})[Gn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ni(e,t){return void 0===e&&(e="*"),li(e)?(ti(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Mi(Di,{pattern:e})):si(n=e)&&n[zn]&&ti(t)&&li(t)?Mi(Di,{channel:e,pattern:t}):si(e)?(ti(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Mi(Di,{channel:e})):void 0;var n}function $i(e,t){return ei(t)&&(t=e,e=void 0),Mi("PUT",{channel:e,action:t})}function Fi(e){var t=Mi("ALL",e);return t.combinator=!0,t}function xi(e,t){var n,i=null;return ni(e)?n=e:(oi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ii(n)&&ni(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Vi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Mi(Ri,xi(e,n))}function ji(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Mi(_i,xi(e,n))}function Wi(e){return void 0===e&&(e=Hn),Mi("CANCEL",e)}function Ki(e){void 0===e&&(e=pi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Mi(Ui,{selector:e,args:n})}var Gi=Vi.bind(null,di);var Bi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},zi=[],qi=0;function Hi(e){try{Qi(),e()}finally{Xi()}}function Ji(e){zi.push(e),qi||(Qi(),Zi())}function Yi(e){try{return Qi(),e()}finally{Zi()}}function Qi(){qi++}function Xi(){qi--}function Zi(){var e;for(Xi();!qi&&void 0!==(e=zi.shift());)Hi(e)}var eo=function(e){return function(t){return e.some((function(e){return ao(e)(t)}))}},to=function(e){return function(t){return e(t)}},no=function(e){return function(t){return t.type===String(e)}},io=function(e){return function(t){return t.type===e}},oo=function(){return fi};function ao(e){var t="*"===e?oo:ii(e)?no:oi(e)?eo:ci(e)?no:ni(e)?to:ui(e)?io:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ro={type:Kn},lo=function(e){return e&&e.type===Kn};function so(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(ro)}))},(e={})[zn]=!0,e.put=function(e){if(!t)if(lo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Bn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=oo),t?e(ro):(e[Bn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),vi(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[qn]?l(e):Ji((function(){l(e)}))},r}function co(e,t){var n=e[Wn];ni(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var uo,yo=0,fo=function(){return++yo};function go(e){e.isRunning()&&e.cancel()}var po=((uo={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!lo(e)||r?n(e):n(Qn)};try{o.take(l,ti(a)?ao(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},uo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Ji((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&ai(t)?co(t,n):n(t)}))},uo.ALL=function(e,t,n,i){var o=i.digestEffect,a=yo,r=Object.keys(t);if(0!==r.length){var l=Oi(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(oi(t)?[]:{})},uo.RACE=function(e,t,n,i){var o=i.digestEffect,a=yo,r=Object.keys(t),l=oi(t)?ki(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Li(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=gi,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},uo.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(ai(s))return void co(s,n);if(ri(s))return void Io(e,s,l.context,yo,Ei(a),!1,n);n(s)}catch(e){n(e,!0)}},uo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){ei(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},uo.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(ri(o))return o;var a=!1;return bi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ai(o)})}))}catch(e){return bi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ei(t)}(c,a);Yi((function(){var t=Io(e,c,s.context,yo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},uo.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&vi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(oi(t)){if(0===t.length)return void n([]);var r=Oi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},uo.CANCEL=function(e,t,n,i){var o=i.task;t===Hn?go(o):oi(t)?t.forEach(go):go(t),n()},uo.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},uo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ci());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ro):e.isEmpty()?(n.push(i),i.cancel=function(){vi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(ro):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(ro)}}}}(t.buffer),a=ao(i),r=function t(n){lo(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},uo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},uo.FLUSH=function(e,t,n){t.flush(n)},uo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},uo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Si(o.context,t),n()},uo);function So(e,t){return e+"?"+t}function vo(e){var t=e.name,n=e.location;return n?t+" "+So(n.fileName,n.lineNumber):t}function ho(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var mo=null,bo=[],Ao=function(e){e.crashedEffect=mo,bo.push(e)},ko=function(){mo=null,bo.length=0},To=function(){var e,t,n=bo[0],i=bo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=wi(e))?t.code+" "+So(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+vo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+vo(e.meta)})),[ho(bo)]).join("\n")};function Po(e,t,n,i,o,a,r){var l;void 0===r&&(r=gi);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(vi(o,t),t.cont=gi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=gi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Ao({meta:o,cancelledTasks:y}),S.isRoot){var i=To();ko(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Yn?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[Jn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(Yn,!1))},l.cont=r,l.end=p,l.setContext=function(e){Si(f,e)},l.toPromise=function(){return d||(d=Bi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function Io(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){ai(t)?co(t,i):ri(t)?Io(e,t,c.context,n,o,!1,i):t&&t[Gn]?(0,po[t.type])(e,t.payload,i,u):i(t)}));d.cancel=gi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(Yn))},status:0},c=Po(e,s,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),ko()):Ii(e)?(s.status=1,d.cancel(),o=ni(t.return)?t.return(Yn):{done:!0,value:Yn}):o=Pi(e)?ni(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=fo();function s(n,o){a||(a=!0,i.cancel=gi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){mo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=gi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=gi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Lo(e,t){for(var n=e.channel,i=void 0===n?so():n,o=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ai:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=fo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||gi,s.effectTriggered=s.effectTriggered||gi,s.effectResolved=s.effectResolved||gi,s.effectRejected=s.effectRejected||gi,s.effectCancelled=s.effectCancelled||gi,s.actionDispatched=s.actionDispatched||gi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=$e.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=pi;var m={channel:i,dispatch:Ti(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return Yi((function(){var e=Io(m,S,l,v,Ei(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Oo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?so():a,l=n.sagaMonitor,s=Zn(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Lo.bind(null,P({},s,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Si(o,e)},c},Eo=function(e){return{done:!0,value:e}},wo={};function Co(e){return si(e)?"channel":ci(e)?String(e):ni(e)?e.name:String(e)}function Do(e,t,n){var i,o,a,r=t;function l(t,n){if(r===wo)return Eo(t);if(n&&!o)throw r=wo,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===wo?Eo(t):a}return bi(l,(function(e){return l(null,e)}),n)}function Ro(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Ni(e)},l=function(e){return{done:!1,value:ji.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Do({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Co(e)+", "+t.name+")")}function _o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Ni(e)},s=function(e){return{done:!1,value:ji.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Wi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Do({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Co(e)+", "+t.name+")")}function Uo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Ni(e)},l=function(e){return{done:!1,value:Vi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Do({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Co(e)+", "+t.name+")")}function Mo(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var l={done:!1,value:Vi.apply(void 0,[n].concat(a))},s={done:!1,value:Gi(t)};return Do({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:wo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ji.apply(void 0,[Ro,e,t].concat(i))}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ji.apply(void 0,[_o,e,t].concat(i))}function Fo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ji.apply(void 0,[Uo,e,t].concat(i))}class xo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return xo.instance||(xo.instance=new xo),xo.instance}static setContext(e){xo.getInstance().context=e}static setAccessToken(e){xo.getInstance().accessToken=e}static setUser(e){xo.getInstance().user=e}static setOnRedirectTo(e){xo.getInstance().onRedirectTo=e}static setLogout(e,t){xo.getInstance().logout=n=>{n?e(n):xo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=xo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return xo.getInstance().accessToken}static getUser(){return xo.getInstance().user}static onRedirectTo(e,t){return xo.getInstance().onRedirectTo(e,t)}static logout(e){return xo.getInstance().logout(e)}}xo.instance=void 0;const Vo={getContext:()=>xo.getContext(),getAccessToken:()=>xo.getAccessToken(),getUser:()=>xo.getUser(),onRedirectTo:(e,t)=>xo.onRedirectTo(e,t),logout:e=>xo.logout(e)};class jo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Wo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const Ko=async e=>{var t,n,i;const o=xo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:xo.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=Wo(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:P({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new jo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new jo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Go=async(e,t,n)=>Ko(P({url:e,method:"GET",contentType:"application/json",params:t},n)),Bo=async(e,t,n)=>Ko(P({url:e,method:"POST",contentType:"application/json",body:t},n)),zo=async(e,t,n)=>Ko(P({url:e,method:"PATCH",contentType:"application/json",body:t},n)),qo=async(e,t,n)=>Ko(P({url:e,method:"PUT",contentType:"application/json",body:t},n)),Ho=async(e,t,n)=>Ko(P({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Jo=async(e,t,n,i)=>Ko(P({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Yo={v1:"/identity/resources/users/webauthn/v1/devices"},Qo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Xo={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},Zo={v1:"/identity/resources/configurations/v1"},ea={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ta={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},na={v1:"/identity/resources/permissions/v1"},ia={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}}},oa={v1:"/identity/resources/roles/v1"},aa={v1:"/identity/resources/sub-tenants/users/v1"},ra={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},la={v1:"/team/resources/members/v1"},sa={v1:"/team/resources/roles/v1"},ca={v1:"/team/resources/stats/v1"},ua={v1:"/team/resources/profile"},da={v1:"/tenants/resources/account-settings/v1"},ya={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},fa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},ga={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},pa={v1:"/subscriptions/resources/payment-providers/v1"},Sa={v1:"/subscriptions/resources/subscriptions/v1"},va={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},ha={v1:"/reports/engine/resources/triggers/v1"},ma="/notification",ba="/audits",Aa={v1:"/event/resources/configurations/v1"},ka="/webhook",Ta="/oauth",Pa="/flags",Ia="/directory/resources/v1/configurations/scim2";async function La(e){return qo(`${Xo.v1}/tenant`,e)}async function Oa(){return Go(`${Xo.v2}/me/tenants`)}async function Ea(){return Go(ya.v1)}async function wa(){return Go(ya.tree.v1)}async function Ca(){return Go(Zo.v1)}async function Da(){return Go(`${Zo.v1}/mfa-policy`)}async function Ra(){return Go(`${Zo.v1}/mfa-policy/vendor`)}async function _a(e){return e.id?zo(`${Zo.v1}/mfa-policy`,e):Bo(`${Zo.v1}/mfa-policy`,e)}async function Ua(){return Go(`${Zo.v1}/lockout-policy`)}async function Ma(e){return e.id?zo(`${Zo.v1}/lockout-policy`,e):Bo(`${Zo.v1}/lockout-policy`,e)}async function Na(){try{return await Go(`${Zo.v1}/captcha-policy/public`)}catch{return null}}async function $a(){return Go(`${Zo.v1}/password-history-policy`)}async function Fa(e){return e.id?zo(`${Zo.v1}/password-history-policy`,e):Bo(`${Zo.v1}/password-history-policy`,e)}async function xa(){return Go(`${Zo.v1}/password`)}async function Va(){return Go(`${ea.emailDomain.v1}`)}async function ja(){return Go(`${ea.emailDomain.v1}/config`)}async function Wa(e){return Bo(`${ea.emailDomain.v1}`,e)}async function Ka(e){return Bo(`${ea.emailDomain.v1}/config`,e)}async function Ga(e){return Ho(`${ea.emailDomain.v1}/${e}`)}async function Ba(e){return Go(`${ea.ip.v1}`,e)}async function za(){return Go(`${ea.ip.v1}/config`)}async function qa(e){return Bo(`${ea.ip.v1}`,e)}async function Ha(e){return Bo(`${ea.ip.v1}/bulk`,e)}async function Ja(e){return Bo(`${ea.ip.v1}/config`,e)}async function Ya(e){return Ho(`${ea.ip.v1}/${e}`)}async function Qa(){return Bo(`${ea.ip.v1}/verify`)}async function Xa(){return Bo(`${ea.ip.v1}/verify/allow`)}let Za,er;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack"}(Za||(Za={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(er||(er={}));class tr extends Error{constructor(e){super(e)}}const nr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new tr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class ir extends Error{constructor(e){super(e)}}const or=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(nr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return nr(t)}})(e.split(".")[n]))}catch(e){throw new ir("Invalid token specified: "+e.message)}},ar=["type"],rr=["type"];async function lr(e){if(!e.accessToken)return e;xo.setAccessToken(e.accessToken);const t=await Go(`${Xo.v2}/me`),n=P({},e,e.accessToken?or(e.accessToken):{},t);return xo.setUser(n),n}async function sr(e){if(!e.accessToken)return{user:e};xo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Go(`${Xo.v2}/me`),Oa()]),i=P({},e,e.accessToken?or(e.accessToken):{},t);return xo.setUser(i),{user:i,tenants:n}}async function cr(e){xo.setAccessToken(e.id_token);const t=await Go(`${Xo.v2}/me`),n=e.id_token?or(e.id_token):{},i=P({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return xo.setUser(i),i}async function ur(e){try{const{address:t}=await Bo(`${Qo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function dr(e){return Bo(`${Qo.v1}/user/saml/prelogin`,e)}async function yr(e){return lr(await Bo(`${Qo.v1}/user/saml/postlogin`,e))}async function fr(e){return lr(await Bo(`${Qo.v1}/user/oidc/postlogin`,e))}async function gr(e){return lr(await Bo(`${Qo.v1}/user`,e))}async function pr(e){return lr(await Bo(`${Qo.v1}/user/mfa/verify`,e))}async function Sr(e){return Bo(`${Xo.v1}/activate`,e)}async function vr(e){return Go(`${Xo.v1}/activate/strategy`,e)}async function hr(e){return Bo(`${Xo.v1}/activate/reset`,e)}async function mr(e){return Bo(`${Xo.v1}/invitation/reset`,e)}async function br(e){return Bo(`${Xo.v1}/invitation/accept`,e)}async function Ar(){return lr(await Bo(`${Qo.v1}/user/token/refresh`))}async function kr(){return sr(await Bo(`${Qo.v1}/user/token/refresh`))}async function Tr(){return Bo(`${Qo.v1}/logout`)}async function Pr(e){return Bo(`${Xo.v1}/passwords/reset`,e)}async function Ir(e){return Bo(`${Xo.v1}/passwords/reset/verify`,e)}async function Lr(e){return Go(`${Xo.v1}/passwords/config`,e)}async function Or(e){return Bo(`${Qo.v1}/user/mfa/recover`,e)}async function Er(){return Bo(`${Xo.v1}/mfa/enroll`)}async function wr(){return Bo(`${Xo.v1}/mfa/authenticator/enroll`)}async function Cr(e){return Bo(`${Xo.v1}/mfa/authenticator/enroll/verify`,e)}async function Dr(e){return Bo(`${Xo.v1}/mfa/sms/enroll`,e)}async function Rr(e){return Bo(`${Xo.v1}/mfa/sms/enroll/verify`,e)}async function _r(){return Bo(`${Xo.v1}/mfa/webauthn/enroll`)}async function Ur(e){return Bo(`${Xo.v1}/mfa/webauthn/enroll/verify`,e)}async function Mr(e){return Bo(`${Xo.v1}/mfa/enroll/verify`,e)}async function Nr(e){return Bo(`${Xo.v1}/mfa/disable`,e)}async function $r(e,t){return Bo(`${Xo.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Fr(e){return Bo(`${Xo.v1}/mfa/sms/${e}/disable`)}async function xr(e,t){return Bo(`${Xo.v1}/mfa/sms/${e}/disable/verify`,t)}async function Vr(e){return Bo(`${Xo.v1}/mfa/webauthn/${e}/disable`)}async function jr(e,t){return Bo(`${Xo.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Wr(){return Go(`${Xo.v1}/mfa/devices`)}async function Kr(e){return Bo(`${Qo.v1}/user/mfa/authenticator/enroll`,e)}async function Gr(e){return Bo(`${Qo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Br(e,t){return Bo(`${Qo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function zr(e){return Bo(`${Qo.v1}/user/mfa/sms/enroll`,e)}async function qr(e){return Bo(`${Qo.v1}/user/mfa/sms/enroll/verify`,e)}async function Hr(e,t){return Bo(`${Qo.v1}/user/mfa/sms/${e}`,t)}async function Jr(e,t){return Bo(`${Qo.v1}/user/mfa/sms/${e}/verify`,t)}async function Yr(e){return Bo(`${Qo.v1}/user/mfa/webauthn/enroll`,e)}async function Qr(e){return Bo(`${Qo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Xr(e,t){return Bo(`${Qo.v1}/user/mfa/webauthn/${e}`,t)}async function Zr(e,t){return Bo(`${Qo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function el(){return Go(`${ra.v1}/saml/configurations`)}async function tl(e){return Bo(`${ra.v1}/saml/configurations`,e)}async function nl(){return Go(`${ra.v1}/saml/configurations/vendor-config`)}async function il(e){return qo(`${ra.v1}/saml/configurations/metadata`,e)}async function ol(){return qo(`${ra.v1}/saml/validations/domain`)}async function al(){return Go(`${ra.v1}/saml/configurations/roles/default`)}async function rl(){return Go(`${ra.v2}/saml/configurations/groups`)}async function ll({roleIds:e}){return Bo(`${ra.v1}/saml/configurations/roles/default`,{roleIds:e})}async function sl({roleIds:e,group:t}){return Bo(`${ra.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function cl({roleIds:e,group:t,id:n}){return zo(`${ra.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function ul({id:e}){return Ho(`${ra.v2}/saml/configurations/groups/${e}`)}async function dl(){return Go(`${ra.v1}/oidc/configurations`)}async function yl(){return Go(`${ra.v2}/configurations/public`)}async function fl(){return Go(ta.v1)}async function gl(){return Go(ta.v2)}async function pl({provider:e,code:t,redirectUri:n,codeVerifier:i,metadata:o,invitationToken:a,state:r}){const l={code:t};return n&&(l.redirectUri=n),i&&(l.code_verifier=i),r&&(l.state=r),Bo(`${Qo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:a},{params:l})}async function Sl(){return Go(`${Zo.v1}/public`)}async function vl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Bo(`${Xo.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await lr(n):void 0,userId:i,tenantId:o}}async function hl(){return Go(Xo.sessions.currentUser.v1)}async function ml(){return Go(`${Xo.sessions.currentUser.v1}/current`)}async function bl(e){return Bo(`${Xo.sessions.v1}/revoke`,{userId:e})}async function Al(){return Go(Xo.sessions.configurations.v1)}async function kl(e){await Bo(Xo.sessions.configurations.v1,e)}async function Tl(e){await Ho(`${Xo.sessions.currentUser.v1}/${e}`)}async function Pl(){await Ho(`${Xo.sessions.currentUser.v1}/all`)}async function Il(){return Go(Xo.apiTokens.v1)}async function Ll(){return Go(ia.apiTokens.v1)}async function Ol(e){return Bo(Xo.apiTokens.v1,e)}async function El(e){return Bo(ia.apiTokens.v2,e)}async function wl({tokenId:e}){return Ho(`${ia.apiTokens.v1}/${e}`)}async function Cl({tokenId:e}){return Ho(`${Xo.apiTokens.v1}/${e}`)}async function Dl({userId:e}){return Go(`${Xo.v1}/${e}`)}async function Rl(e){return Go(`${Zo.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function _l(e){let{type:t}=e,n=Zn(e,ar);return Bo(`${Qo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Ul(e){let{type:t}=e,n=Zn(e,rr);return Bo(`${Qo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ml({token:e}){return Bo(ia.invites.verify.v1,{token:e})}async function Nl(){return Go(`${ra.v1}/configurations`)}async function $l(e){return Bo(`${ra.v1}/configurations`,e)}async function Fl(e,t){return zo(`${ra.v1}/configurations/${e}`,t)}async function xl(e){return Ho(`${ra.v1}/configurations/${e}`)}async function Vl(e){return Bo(`${ra.v1}/configurations/metadata`,e)}async function jl(e,t){return qo(`${ra.v1}/configurations/${e}/metadata`,t)}async function Wl(e,t){return Bo(`${ra.v1}/configurations/${e}/domains`,t)}async function Kl(e,t){return Ho(`${ra.v1}/configurations/${e}/domains/${t}`)}async function Gl(e,t){return qo(`${ra.v1}/configurations/${e}/domains/${t}/validate`)}async function Bl(e){return Go(`${ra.v1}/configurations/${e}/roles`)}async function zl(e,t){return qo(`${ra.v1}/configurations/${e}/roles`,t)}async function ql(e,t){return Bo(`${ra.v1}/configurations/${e}/groups`,t)}async function Hl(e,{roleIds:t,group:n,id:i}){return zo(`${ra.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Jl(e,t){return Ho(`${ra.v1}/configurations/${e}/groups/${t}`)}async function Yl(e){return Go(`${ra.v1}/configurations/${e}/groups`)}async function Ql(e){return Bo(`${Qo.v2}/user/sso/prelogin`,e)}async function Xl(e){return lr(await Bo(`${Qo.v2}/user/oidc/postlogin`,e))}async function Zl(e){return cr(await Bo(`${Ta}/token`,e))}async function es(){return cr(await Bo(`${Ta}/authorize/silent`))}async function ts(e){return Bo(`${Xo.v1}/phone/reset`,e)}async function ns(e){return Bo(`${Xo.v1}/phone/reset/verify`,e)}async function is(e){return Bo(`${Xo.v1}/phone`,e)}async function os(e){return Bo(`${Xo.v1}/phone/verify`,e)}async function as(e){return qo(`${Xo.v1}/phone/change`,e)}async function rs(e){return Bo(`${Qo.v1}/webauthn/prelogin`,e)}async function ls(e){return Bo(`${Qo.v1}/webauthn/postlogin`,e)}async function ss(){return Bo(Yo.v1)}async function cs(e){return Bo(`${Yo.v1}/verify`,e)}async function us(){return Go(`${Zo.v1}/auth/strategies/public`)}async function ds(){return Go(`${Zo.v1}/mfa/strategies`)}async function ys(e){return Go(`${Xo.v2}/me`,null!=e?e:{addRoles:!0})}async function fs(e){return qo(`${Xo.v2}/me`,e)}async function gs(e){return qo(`${ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ps(e){return Bo(`${Xo.v1}/passwords/change`,e)}async function Ss(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>P({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Go(la.v1,P({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function vs(e){return Bo(Xo.v2,P({},e,{provider:"local"}))}async function hs(e){return Ho(`${la.v1}/${e.userId}`)}async function ms(e){return qo(la.v1,e)}async function bs(e){return Bo(ia.invites.user.v1,P({},e))}async function As(e){return zo(ia.invites.user.v1,P({},e))}async function ks(){return Ho(ia.invites.user.v1)}async function Ts(){return Go(ia.invites.user.v1)}async function Ps(){return Go(ia.invites.configuration.v1)}async function Is(){return Go(sa.v1)}async function Ls(){return Go(na.v1)}async function Os(){return Go(`${ca.v1}/members`)}async function Es(e){return Bo(`${la.v1}/${e.userId}/resendActivationEmail`,{})}async function ws(e){return Bo(Xo.v2,P({},e,{provider:"local"}))}async function Cs(e){return Bo(Xo.invitation.resendAll.v1,P({},e))}async function Ds(e){var t,n;const i=await Go("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Rs(){const e=await Go("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const _s=async()=>Ds({entityName:"notifications"}),Us=async()=>Ds({entityName:"saml"}),Ms=async()=>Ds({entityName:"audits"}),Ns=async e=>async function(e){const t=await Go(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),$s=["dataFilters"],Fs=["templateId","dataFilters"],xs=["dataFilters"];async function Vs(e){return Go(`${va.v2}/tenant-reports`,e)}async function js(e){return Go(`${va.v2}/${e.id}/tenant-reports`)}async function Ws(e){let{dataFilters:t}=e,n=Zn(e,$s);return{html:await Go(`${ha.v1}/preview-report`,P({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ks(e){let{templateId:t,dataFilters:n}=e,i=Zn(e,Fs);return Bo(`${va.v2}/${t}/tenant-reports`,P({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Gs(e){let{dataFilters:t}=e,n=Zn(e,xs);const i=await Go(`${ha.v1}/preview-report`,P({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Bs(e){return Bo(`${ha.v1}/tenant-reports`,e)}async function zs(e){return Go(ma,{params:e})}async function qs(e){return qo(`${ma}/status`,{params:e})}async function Hs(e){const{notificationId:t,pinStatus:n}=e;return qo(`${ma}/${n}`,{notificationId:t})}async function Js(){return Bo(`${ma}/status/mark-all-read`)}const Ys=["endpoint","headerProps"];async function Qs(e){return Go(ba,e)}async function Xs(e){return Go(`${ba}/stats`,e)}async function Zs(e){const{endpoint:t,headerProps:n}=e,i=Zn(e,Ys);return Jo(`${ba}/export/${t}`,{properties:n},i)}const ec=["eventKey"],tc=["eventKey"],nc=()=>Go(`${fa.v1}/slack`),ic=()=>Go(`${fa.v1}/slack/applications`),oc=()=>Go(`${fa.v1}/slack/channels`),ac=e=>e.id?zo(`${fa.v1}/slack/subscription/${e.id}`,e):Bo(`${fa.v1}/slack/subscriptions`,e),rc=e=>Ho(`${fa.v1}/slack/subscriptions/${e.id}`),lc=e=>Bo(`${fa.v1}/slack/applications/registrations`,{code:e}),sc=()=>Go(`${fa.v1}/emails`),cc=e=>{let{eventKey:t}=e,n=Zn(e,ec);return Bo(`${fa.v1}/emails/${t}`,n)},uc=({eventKey:e,enabled:t})=>zo(`${fa.v1}/emails/${e}`,{enabled:t}),dc=(e,t)=>Ho(`${fa.v1}/emails/${e}/subscriptions/${t}`),yc=(e,t,n)=>qo(`${fa.v1}/emails/${t}/subscriptions/${e}`,n),fc=e=>Ho(`${fa.v1}/emails/${e}`),gc=()=>Go(`${fa.v2}/sms`),pc=e=>{let{eventKey:t}=e,n=Zn(e,tc);return Bo(`${fa.v2}/sms/${t}`,n)},Sc=({eventKey:e,enabled:t})=>zo(`${fa.v2}/sms/${e}`,{enabled:t}),vc=(e,t)=>Ho(`${fa.v2}/sms/${e}/subscriptions/${t}`),hc=(e,t,n)=>qo(`${fa.v2}/sms/${t}/subscriptions/${e}`,n),mc=e=>Ho(`${fa.v2}/sms/${e}`),bc=()=>Go(ka),Ac=e=>e._id?zo(`${ka}/${e._id}`,e):Bo(`${ka}/custom`,e),kc=e=>Ho(`${ka}/${e}`),Tc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Go(`${ka}/logs/?${i.toString()}`)},Pc=e=>Bo(`${ka}/test`,e),Ic=e=>Bo(`${ka}/logs/${e}/retries`),Lc=()=>Go(`${Aa.v1}/categories`),Oc=e=>Go(Aa.v1,{channels:e});async function Ec(e){return qo(da.v1,e)}async function wc(){return Go(da.v1)}const Cc=["roleId"],Dc=["roleId"],Rc=["permissionId"];async function _c(){return Go(oa.v1)}async function Uc(e){return Bo(oa.v1,e)}async function Mc({roleId:e}){return Ho(`${oa.v1}/${e}`)}async function Nc(e){let{roleId:t}=e,n=Zn(e,Cc);return zo(`${oa.v1}/${t}`,n)}async function $c(e){let{roleId:t}=e,n=Zn(e,Dc);return qo(`${oa.v1}/${t}/permissions`,n)}async function Fc(){return Go(na.v1)}async function xc(e){let{permissionId:t}=e,n=Zn(e,Rc);return qo(`${na.v1}/${t}/roles`,n)}async function Vc(){return Go(`${na.v1}/categories`)}async function jc(){return Go(ga.subscriptions.v1)}async function Wc(e){return Go(`${ga.subscriptions.v1}/${e}`)}async function Kc(e){return qo(`${ga.subscriptions.v1}/${e}/cancellations/`,{})}async function Gc(e){return qo(`${ga.subscriptions.v1}/${e}/renewals/`,{})}async function Bc(e,{paymentMethodId:t,planId:n}){return qo(`${ga.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function zc(e){return Go(`${Sa.v1}/${e}`)}async function qc(){return Go(`${Sa.v1}`)}async function Hc(e){return qo(`${Sa.v1}/${e}/cancellations/`,{})}async function Jc(e){return qo(`${Sa.v1}/${e}/renewals/`,{})}async function Yc(e,{paymentMethodId:t,planId:n}){return qo(`${Sa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Qc(){return Go(ga.plans.v1)}async function Xc(e){return Go(`${ga.plans.v1}/${e}`)}async function Zc(){return Go(ga.invoices.v1)}async function eu(e){return Go(`${ga.invoices.v1}/${e}`)}async function tu(e,t){return Go(`${ga.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const nu=["email"];async function iu(){return Go(ga.paymentMethods.v1)}async function ou(e){return Go(`${ga.paymentMethods.v1}/${e}`)}async function au(e,t){let{email:n}=t,i=Zn(t,nu);return zo(`${ga.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function ru(e){return Bo(ga.paymentProviders.stripe.subscriptions.v1,e)}async function lu(e){return Go(`${ga.paymentProviders.stripe.customers.v1}/${e}`)}async function su(e){return Bo(`${ga.paymentProviders.stripe.customers.v1}`,e)}async function cu(){return Go(`${ga.paymentProviders.stripe.publicConfigurations.v1}`)}async function uu(e){return Bo(`${ga.paymentProviders.stripe.setupIntents.v1}`,e)}async function du(e){return Go(`${ga.summaries.v1}/${e}`)}async function yu(e){return Go(`${ga.tenantConfiguration.v1}/${e}`)}async function fu(e){return Bo(`${ga.tenantConfiguration.v1}`,e)}async function gu(){return Go(pa.v1)}async function pu(){return Go(`${ga.configurations.vendorPublicConfigurations.v1}`)}let Su,vu,hu,mu,bu,Au,ku,Tu,Pu,Iu,Lu;async function Ou(){return Go("/vendors/public")}async function Eu(e){return Go(aa.v1,e)}async function wu(e){return Bo(aa.v1,e)}async function Cu(e){return Ho(aa.v1,e)}async function Du(e,t){return Bo(`${aa.v1}/${e}/roles`,t)}async function Ru(e,t){return Ho(`${aa.v1}/${e}/roles`,t)}async function _u(e,t){return zo(`${aa.v1}/${e}/roles`,t)}async function Uu(){return Go(Pa)}async function Mu(){return Go(`${Ia}`)}async function Nu(e,t){return zo(`${Ia}/${e}`,t)}async function $u(e){return Bo(`${Ia}`,e)}async function Fu(e){return Ho(`${Ia}/${e}`)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Su||(Su={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(vu||(vu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hu||(hu={})),(mu||(mu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(bu||(bu={})),function(e){e.CREATE="create_customer"}(Au||(Au={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(ku||(ku={})),function(e){e.Android="Android",e.USBKey="USBKey",e.TouchID="TouchID"}(Tu||(Tu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthn="WebAuthn",e.SMS="SMS"}(Pu||(Pu={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Iu||(Iu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Lu||(Lu={}));const xu=[`${Qo.v1}/logout`,`${Qo.v1}/user/saml/postlogin`,`${Qo.v2}/user/oidc/postlogin`,`${Qo.v1}/user`,`${Qo.v1}/user/mfa/verify`,`${Qo.v1}/user/token/refresh`,`${Xo.v1}`,`${Xo.v1}/signUp`,`${Qo.v1}/passwordless/magiclink/postlogin`,`${Qo.v1}/passwordless/code/postlogin`,`${Qo.v1}/passwordless/smscode/postlogin`,`${Xo.v1}/activate`,`${Xo.v1}/invitation/accept`,`${Ta}/token`,`${Ta}/authorize/silent`],Vu=`${Qo.v1}/user/token/refresh`,ju=`${Ta}/authorize/silent`,Wu=`${Xo.v2}/me`,Ku=`${Xo.v2}/me/tenants`;let Gu;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Gu||(Gu={}));const Bu={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v};var zu={fetch:e,ContextHolder:xo,FronteggContext:Vo,api:Bu,FronteggApiError:jo,AuthStrategyEnum:er,SocialLoginProviders:Za,ISubscriptionCancellationPolicy:hu,ISubscriptionStatus:Su,PaymentMethodType:vu,ProviderType:mu};let qu,Hu;function Ju(e,t){const n=P({},e);return t.forEach((e=>{delete n[e]})),n}async function Yu(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Qu(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(qu||(qu={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Hu||(Hu={}));const Xu=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Zu={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ed=P({},Zu,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),td={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},nd=P({},td,{accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTY5YmY0Zi02YmI5LTQ5NGMtOGNkZS05MDc4NDQ0NWY4MDciLCJuYW1lIjoiRHVtbXkgVXNlciIsImVtYWlsIjoiZHVtbXlAZnJvbnRlZ2cuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm1ldGFkYXRhIjp7fSwicm9sZXMiOlsiYWRtaW4iXSwicGVybWlzc2lvbnMiOlsiZmUuKiJdLCJ0ZW5hbnRJZCI6Im15LXRlbmFudC1pZCIsInRlbmFudElkcyI6WyJteS10ZW5hbnQtaWQiXSwicHJvZmlsZVBpY3R1cmVVcmwiOiJodHRwczovL3d3dy5ncmF2YXRhci5jb20vYXZhdGFyLzQyYjJhZDJiYWQ2ZmM5YjlkYjUwODZkZmNmODA3MmFjP2Q9aHR0cHM6Ly91aS1hdmF0YXJzLmNvbS9hcGkvZmUvMTI4L3JhbmRvbT90PTE2MTcyNjE4OTA4NzU_dD0xNjE3MjYxOTE3NDM0IiwidHlwZSI6InVzZXJUb2tlbiIsImlhdCI6MTYxNzkwNjMyNCwiZXhwIjoxNjE3OTkyNzI0LCJpc3MiOiJmcm9udGVnZyJ9.paaXLkpWEWbQmUtoK2P8IwXCxK4WJp7XhXonvzF8g1I",expiresIn:86400,mfaRequired:!1,refreshToken:"refresh-token-dummy-de39dc9c-9d22-4852-b7f5-c3c0aa613b58",type:"userToken",iat:1617906324,exp:1617992724,iss:"frontegg",email_verified:!0}),id={loading:!1,error:void 0,saving:!0,profile:td},od={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date,allowOverrideEnforcePasswordHistory:!0,allowOverridePasswordComplexity:!1,allowOverridePasswordExpiration:!1,allowSignups:!0,apiTokensEnabled:!0,cookieSameSite:"cookieSameSite",defaultRefreshTokenExpiration:0,defaultTokenExpiration:1,publicKey:"publicKey"},ad={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:er.EmailAndPassword},rd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},ld={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},sd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},cd={enabled:!0,domain:"domain",validated:!0,generatedVerification:"generatedVerification",ssoEndpoint:"ssoEndpoint",publicCertificate:"publicCertificate",signRequest:!0,createdAt:new Date,updatedAt:new Date,acsUrl:void 0,spEntityId:void 0,oidcClientId:void 0,oidcSecret:void 0,type:void 0},ud={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},dd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],yd={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:cd,roles:dd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},fd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],gd={id:"id2",email:"demo-user2@frontegg.com",name:"Demo User Name2",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,verified:!1,createdAt:(new Date).toISOString(),customData:void 0,lastLogin:void 0,mfaEnabled:void 0,roles:[]},pd={id:"id",email:"demo-user@frontegg.com",name:"Demo User Name",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,createdAt:new Date(2022,4,1).toISOString(),verified:!0,customData:void 0,lastLogin:new Date(2022,5,25).toISOString(),mfaEnabled:void 0,roles:[]},Sd={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},vd=[pd,gd],hd=[Sd],md=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],bd=[{id:"laptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date,ipAddress:"190.194.88.251",current:!0},{id:"iphone",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1",createdAt:new Date(Date.now()-1e4),ipAddress:"191.49.203.21"},{id:"tablet",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",createdAt:new Date(Date.now()-3e4),ipAddress:"130.19.196.136"},{id:"anotherlaptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date(Date.now()-1002232300),ipAddress:"2.228.163.92"}],Ad={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},kd={isActive:!0,strategy:Rn.ALLOW},Td=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Rn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Rn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Rn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Rn.BLOCK,description:"IP 4"}];let Pd,Id,Ld;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Pd||(Pd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Id||(Id={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription"}(Ld||(Ld={})),Ld.profile,Ld.privacy,Ld.personalApiTokens,Ld.account,Ld.users,Ld.security,Ld.sso,Ld.audits,Ld.webhooks,Ld.apiTokens,Ld.roles,Ld.subscriptions;const Od=["events","url"];function*Ed(){yield $i(Vn.setSignUpState({loading:!0}));try{const e=yield Vi(Bu.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield $i(Vn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield $i(Vn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*wd(e){let{payload:{events:t,url:n}}=e,i=Zn(e.payload,Od);yield $i(Vn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Ki((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Vi(Bu.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Id.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(xo.setAccessToken(null==l?void 0:l.accessToken),xo.setUser(l),!r&&l&&$y(l)){const t=yield Vy(l);yield $i(Vn.setState(t)),a(e.loginUrl)}else yield $i(Vn.setSignUpState({loading:!1,shouldActivate:r,stage:ln.SignUpSuccess})),yield $i(Vn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield $i(Vn.loadTenants()))}catch(e){xo.setAccessToken(null),xo.setUser(null),yield $i(Vn.setSignUpState({loading:!1,error:e.message}))}yield $i(Vn.setSignUpState({loading:!1}))}function*Cd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ki((e=>e.auth.signUpState));yield $i(Vn.resetSignUpState()),yield $i(Vn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Dd(){yield Fo(Vn.signUpUser,wd),yield Fo(Vn.resetSignUpStateSoft,Cd)}const Rd={setVendorState:(e,{payload:t})=>P({},e,t)},_d={loadVendorPublicInfo:nt("vendor/loadVendorPublicInfo")},Ud={loading:!1},{reducer:Md,actions:Nd}=ot({name:Pt,initialState:Ud,reducers:P({},Rd)}),$d=P({},Nd,_d);function*Fd(){yield $i($d.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Bu.vendor.getVendorPublicInfo();yield $i($d.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield $i($d.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const xd=["callback"],Vd=["callback"],jd=["callback"],Wd=["callback"],Kd=["callback"],Gd=["callback"];function*Bd(){yield $i(Vn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getGlobalSecurityPolicy);yield $i(Vn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield $i(Vn.loadSecurityPolicyMfa()),yield $i(Vn.loadSecurityPolicyVendorMfa()),yield $i(Vn.loadSecurityPolicyLockout()),yield $i(Vn.loadSecurityPolicyCaptcha()),yield $i(Vn.loadPublicAuthStrategiesPolicy())}function*zd(){yield $i(Vn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getVendorConfig);yield $i(Vn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*qd(){yield $i(Vn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getVendorPublicAuthStrategiesConfig);yield $i(Vn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Hd(){yield $i(Vn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getMfaPolicy);yield $i(Vn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Jd(){yield $i(Vn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getVendorMfaPolicy);yield $i(Vn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Yd(e){let{payload:{callback:t}}=e,n=Zn(e.payload,xd);yield $i(Vn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Vi(Bu.auth.saveMfaPolicy,n);yield $i(Vn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qd(){yield $i(Vn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getLockoutPolicy);yield $i(Vn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Xd(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Vd);yield $i(Vn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Vi(Bu.auth.saveLockoutPolicy,n);yield $i(Vn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Zd(){yield $i(Vn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getCaptchaPolicy);yield $i(Vn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*ey(){yield $i(Vn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getPasswordHistoryPolicy);yield $i(Vn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*ty(e){let{payload:{callback:t}}=e,n=Zn(e.payload,jd);yield $i(Vn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Vi(Bu.auth.savePasswordHistoryPolicy,n);yield $i(Vn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ny(){yield $i(Vn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getPasswordConfigPolicy);yield $i(Vn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*iy(){yield Fo(Vn.loadSecurityPolicy,Bd),yield No(Vn.saveSecurityPolicyMfa,Yd),yield No(Vn.loadSecurityPolicyMfa,Hd),yield No(Vn.loadSecurityPolicyVendorMfa,Jd),yield No(Vn.saveSecurityPolicyLockout,Xd),yield No(Vn.loadSecurityPolicyLockout,Qd),yield No(Vn.loadSecurityPolicyCaptcha,Zd),yield No(Vn.saveSecurityPolicyPasswordHistory,ty),yield No(Vn.loadSecurityPolicyPasswordHistory,ey),yield No(Vn.loadVendorPasswordConfig,ny),yield No(Vn.loadPublicSecurityPolicy,zd),yield No(Vn.loadPublicAuthStrategiesPolicy,qd)}function*oy(){yield $i(Vn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield $i(Vn.setSecurityPolicyPublicState({policy:ad,loading:!1}))}catch(e){yield $i(Vn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ay(){yield $i(Vn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyGlobalState({policy:od,loading:!1})),yield $i(Vn.loadSecurityPolicyMfa()),yield $i(Vn.loadSecurityPolicyVendorMfa()),yield $i(Vn.loadSecurityPolicyLockout()),yield $i(Vn.loadSecurityPolicyCaptcha())}function*ry(){yield $i(Vn.setSecurityPolicyMfaState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyMfaState({policy:rd,loading:!1}))}function*ly(){yield $i(Vn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyVendorMfaState({policy:rd,loading:!1}))}function*sy(e){var t;let{payload:{callback:n}}=e,i=Zn(e.payload,Wd);yield $i(Vn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=P({},ld,{id:null!=(t=i.id)?t:ld.id,enforceMFAType:i.enforceMFAType});yield dt(),yield $i(Vn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*cy(){yield $i(Vn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyLockoutState({policy:ld,loading:!1}))}function*uy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Kd);yield $i(Vn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield dt();const i=P({},n,ld,{id:n.id?n.id:ld.id});null==t||t(i),yield $i(Vn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*dy(){yield $i(Vn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyLockoutState({policy:ld,loading:!1}))}function*yy(){yield $i(Vn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield dt(),yield $i(Vn.setSecurityPolicyPasswordHistoryState({policy:sd,loading:!1}))}function*fy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Gd);yield $i(Vn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield dt();const i=P({},n,sd,{id:n.id?n.id:sd.id});null==t||t(i),yield $i(Vn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*gy(){yield Fo(Vn.loadSecurityPolicy,ay),yield No(Vn.loadPublicSecurityPolicy,oy),yield No(Vn.saveSecurityPolicyMfa,sy),yield No(Vn.loadSecurityPolicyMfa,ry),yield No(Vn.loadSecurityPolicyVendorMfa,ly),yield No(Vn.saveSecurityPolicyLockout,uy),yield No(Vn.loadSecurityPolicyLockout,cy),yield No(Vn.loadSecurityPolicyCaptcha,dy),yield No(Vn.saveSecurityPolicyPasswordHistory,fy),yield No(Vn.loadSecurityPolicyPasswordHistory,yy)}const py=["callback"],Sy=["callback"],vy=["callback"],hy=["callback"],my=["callback","events"],by=["callback"],Ay=["callback"],ky=["callback"],Ty=["callback"],Py=["callback"],Iy=["callback"],Ly=["callback"],Oy=["callback"],Ey=["callback"],wy=["callback","deviceId"],Cy=["callback","deviceId"],Dy=["callback","deviceId"],Ry=["callback","deviceId"],_y={[er.Code]:St.loginWithOtc,[er.EmailAndPassword]:St.loginWithPassword,[er.MagicLink]:St.magicLinkPreLoginSuccess,[er.SmsCode]:St.loginWithSmsOtc};function*Uy(){var e;const t=xo.onRedirectTo,{routes:n,includeQueryParam:i}=yield Ki((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(mt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(mt),yield Gi(200),$i(Vn.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*My(){let e;try{var t;const n=yield Vi(Bu.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield $i(Vn.setState({ssoACS:e}))}function*Ny(){try{const{isActive:e}=yield Vi(Bu.auth.getSSOPublicConfiguration);yield $i(Vn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const $y=e=>e.mfaRequired&&e.mfaToken?(xo.setAccessToken(null),xo.setUser(null),!0):(xo.setAccessToken(e.accessToken),xo.setUser(e),!1),Fy=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Yt.authenticatorApp;if(t)return Yt.smsVerifyCode}return Yt.verify},xy=e=>{if(1===e.length){const[t]=e;if(t===Pu.AuthenticatorApp)return Yt.authenticatorApp;if(t===Pu.SMS)return Yt.smsSetPhoneNumber}return Yt.verify};function*Vy(e){let t=St.loginWithTwoFactor,n={};const{loginState:i}=yield Ki((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Vi(Bu.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Fy(e.mfaDevices)}:(n={step:xy(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=St.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:vt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:P({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*jy(){const{hostedLoginBox:e}=yield Ki((e=>e.auth));e?yield Vi(Wy):yield Vi(Ky)}function*Wy(){const{user:e}=yield Ki((e=>e.auth));if(null==e||!e.refreshToken)return xo.setAccessToken(null),xo.setUser(null),void(yield $i(Vn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Vi(Bu.auth.exchangeOAuthTokens,t);yield $i(Vn.setState({user:n,isAuthenticated:!0})),yield $i(Vn.loadTenants())}catch(e){xo.setAccessToken(null),xo.setUser(null),yield $i(Vn.setState({user:null,isAuthenticated:!1}))}}function*Ky(){try{const n=xo.onRedirectTo,{routes:i,loginState:o}=yield Ki((e=>e.auth)),{user:a,tenants:r}=yield Vi(Bu.auth.refreshTokenV2);if($y(a)){const e=yield Vy(a);yield $i(Vn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else{var e,t;a.id&&localStorage.setItem("userId",a.id);const l=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,s=l&&"true"!==localStorage.getItem(`${a.id}-${l}`)&&!window.location.pathname.endsWith(i.logoutUrl);yield $i(Vn.setTenantsState({tenants:r,loading:!1})),yield $i(Vn.setState({user:a,isAuthenticated:!0,loginState:P({},o,{quickLoginToRegister:l,flow:s?vt.RegisterQuickLogin:vt.Login})}));const c=new URL(null==(t=window)?void 0:t.location.href).searchParams.get("invitationToken"),u=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];c||u.push(i.loginUrl,i.signUpUrl),s?n(i.loginUrl):u.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?n(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield Uy())}}catch(e){xo.setAccessToken(null),xo.setUser(null),yield $i(Vn.setState({user:void 0,isAuthenticated:!1}))}}function*Gy({payload:{callback:e}}){try{const{ip:t}=yield Vi(Bu.metadata.getCurrentUserIpMetadata);yield $i(Vn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*By({payload:e}){const t=[];e&&(yield $i(Vn.setState({isLoading:!0})),yield $i(Vn.loadSocialLoginsConfigurationV2()),t.push(Vi(Ed)),t.push(Vi(qd)),t.push(Vi(Ny)),t.push(Vi(Fd)),t.push(Vi(My))),t.push(Vi(jy)),yield Fi(t),yield $i(Vn.setState({isLoading:!1}))}function*zy({accessToken:e,user:t}){if(!e)return void(yield $i(Vn.setState({user:void 0,isAuthenticated:!1})));const n=xo.onRedirectTo,{routes:i}=yield Ki((e=>e.auth));if($y(t)){const e=yield Vy(t);yield $i(Vn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*qy({payload:e}){const t=[];yield $i(Vn.loadSocialLoginsConfigurationV2()),t.push(Vi(Ed)),t.push(Vi(Ny)),t.push(Vi(Fd)),t.push(Vi(My)),t.push(Vi(zy,e)),yield Fi(t)}function*Hy({payload:e}){const{disableSilentRefresh:t}=yield Ki((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Vi(Bu.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield $i(Vn.setState({user:e,isAuthenticated:!0})),yield $i(Vn.loadTenants()),yield $i(Vn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Ki((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;let e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield $i(Vn.setState({isLoading:!0}));const a=Qu(),r=Qu(),l=yield Vi(Yu,r);localStorage.setItem(bt,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${Wo(n,"/oauth/authorize")}/oauth/authorize`,u=P({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*Jy({payload:e}){const t=localStorage.getItem(bt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Ki((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Vi(Bu.auth.exchangeOAuthTokens,a);yield $i(Vn.setState({user:e,isAuthenticated:!0})),yield $i(Vn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Uy()}}function*Yy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,py);try{yield $i(Vn.setLoginState({loading:!0}));const e=yield Vi(Bu.auth.changePhoneNumberWithVerification,n);yield $i(Vn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:St.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1}))}}function*Qy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Sy);try{yield $i(Vn.setLoginState({loading:!0})),yield Vi(Bu.auth.verifyChangePhoneNumber,n),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1}))}}function*Xy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,vy);try{yield $i(Vn.setLoginState({loading:!0}));const e=yield Vi(Bu.auth.passwordlessPreLogin,P({},n,{type:er.SmsCode}));yield $i(Vn.setLoginState({step:St.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Zy(e){let{payload:{callback:t}}=e,n=Zn(e.payload,hy);try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $i(Vn.setLoginState({loading:!0}));const o=yield Vi(Bu.auth.passwordlessPreLogin,n),a=_y[n.type];if(a===St.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield $i(Vn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Vt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield $i(Vn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*ef(e){let{payload:{callback:t,events:n}}=e,i=Zn(e.payload,my);try{yield $i(Vn.setLoginState({loading:!0}));const e=yield Vi(Bu.auth.passwordlessPostLogin,i),a=xo.onRedirectTo,{routes:r}=yield Ki((e=>e.auth));if($y(e)){const t=yield Vy(e);yield $i(Vn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ki((e=>e.auth)),l=yield Vi(Bu.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:Pd.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield $i(Vn.setState({user:l,isAuthenticated:!0})),yield $i(Vn.setLoginState({error:void 0})),yield $i(Vn.loadTenants()),i.flow===vt.Login?yield Uy():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield $i(Vn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*tf({payload:e}){try{yield $i(Vn.setLoginState({loading:!0}));const{name:t}=yield Vi(Bu.auth.verifyInviteToken,e);yield $i(Vn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield $i(Vn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*nf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield $i(Vn.setLoginState({loading:!0}));try{const o=yield Ki((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Vi(Bu.auth.preLoginV2,{email:e});if(a){if(r===Hu.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ki((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield $i(Vn.setLoginState({step:St.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield of({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield of({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*of(e){let{callback:t}=e,n=Zn(e,by);const i=yield Ki((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield $i(Vn.setLoginState({step:St.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===er.EmailAndPassword?(yield $i(Vn.setLoginState({step:St.loginWithPassword,loading:!1})),null==t||t()):[er.MagicLink,er.Code,er.SmsCode].includes(null==i?void 0:i.authStrategy)?yield $i(Vn.passwordlessPreLogin(P({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield $i(Vn.setLoginState({step:St.loginWithPassword,loading:!1})),null==t||t())}function*af({payload:{callback:e}}){try{yield $i(Vn.setLoginState({loading:!0}));const{options:t}=yield Vi(Bu.auth.webAuthnCreateNewDeviceSession);t.user.id=gt(t.user.id),t.challenge=gt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield $i(Vn.setLoginState({error:t.message})),null==e||e(null)}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*rf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Ay);try{yield $i(Vn.setLoginState({loading:!0}));const e=pt(n.publicKey);yield Vi(Bu.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({error:e.message})),null==t||t(null)}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*lf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,ky);try{var i;yield $i(Vn.setLoginState({loading:!0}));const{options:e}=yield Vi(Bu.auth.webAuthnPreLogin,n);e.challenge=gt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)}))),yield $i(Vn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield $i(Vn.setLoginState({error:e.message})),null==t||t(null)}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*sf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Ty);try{var i;yield $i(Vn.setLoginState({loading:!0}));const e=pt(n.publicKey),o=yield Vi(Bu.auth.webAuthnPostLogin,P({},e,{response:P({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if($y(o)){const e=xo.onRedirectTo,{routes:t}=yield Ki((e=>e.auth)),n=yield Vy(o);yield $i(Vn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Vi(Bu.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield $i(Vn.loadTenants()),yield $i(Vn.setState({user:e,isAuthenticated:!0})),yield $i(Vn.setLoginState({error:void 0})),yield Uy(),null==t||t(!0)}}catch(e){yield $i(Vn.setLoginState({error:e.message})),null==t||t(null)}finally{yield $i(Vn.setLoginState({loading:!1}))}}function*cf({payload:e}){const{onRedirectTo:t,routes:n}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield $i(Vn.setLoginState({loading:!0}));try{const t=yield Vi(Bu.auth.postLogin,e);xo.setAccessToken(t.accessToken),xo.setUser(t),yield $i(Vn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Uy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield $i(Vn.setLoginState({step:St.loginWithSSOFailed,loading:!1}))}}function*uf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield $i(Vn.setLoginState({loading:!0}));try{const a=yield Vi(Bu.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});xo.setAccessToken(a.accessToken),xo.setUser(a);const r=xo.onRedirectTo,{routes:l}=yield Ki((e=>e.auth));if($y(a)){const e=yield Vy(a);yield $i(Vn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ki((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield $i(Vn.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===vt.Login?St.success:t.step,tenants:[],tenantsLoading:!0}})),yield $i(Vn.loadTenants()),n&&t.flow===vt.Login&&(yield Uy())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){xo.setAccessToken(null),xo.setUser(null),yield $i(Vn.setLoginState({email:e,error:t.message,loading:!1}))}}function*df({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield $i(Vn.setLoginState({loading:!0}));try{const o=yield Vi(Bu.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Ki((e=>e.auth)),r=a.flow===vt.Login?St.success:a.step;yield $i(Vn.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield $i(Vn.loadTenants()),yield $i(Vn.setLoginState({error:void 0,loading:!1})),a.flow===vt.Login&&(yield Uy()),null==i||i(!0)}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*yf({payload:e}){yield $i(Vn.setLoginState({loading:!0}));try{yield Vi(Bu.auth.recoverMfaToken,e),yield $i(Vn.setLoginState({loading:!1,error:void 0,step:St.preLogin})),yield $i(Vn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield $i(Vn.setLoginState({error:e.message,loading:!1}))}}function*ff({payload:e}){yield $i(Vn.setState({isLoading:!0}));try{yield Vi(Bu.auth.logout)}catch{}yield $i(Vn.resetState()),yield $i(Vn.requestAuthorize(!0)),null==e||e()}function*gf({payload:e}){var t;try{yield Vi(Bu.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*pf({user:e,tenants:t}){const n={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield $i(Vn.setMfaState(n)),yield $i(Vn.setUser(e)),yield $i(Vn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Sf({user:e,tenants:t}){const{loginState:n}=yield Ki((e=>e.auth));yield $i(Vn.setUser(e)),yield $i(Vn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===vt.Login&&(yield Uy()),yield $i(Vn.setState({isAuthenticated:!0}))}function*vf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Py);yield $i(Vn.setLoginState({loading:!0}));try{const e=yield Vi(Bu.auth.preEnrollMFASMSForLogin,n);yield $i(Vn.setMfaState({otcToken:e.otcToken,step:Yt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*hf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Iy);yield $i(Vn.setLoginState({loading:!0}));try{const e=yield Vi(Bu.auth.enrollMFASMSForLogin,n),i=yield Vi(Bu.auth.generateLoginResponseV2,e);yield pf(i),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*mf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Ly);yield $i(Vn.setLoginState({loading:!0}));try{var i;const e=yield Vi(Bu.auth.preEnrollMFAWebAuthnForLogin,n),o=P({},e.options,{challenge:gt(e.options.challenge),user:P({},e.options.user,{id:gt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)})))});yield $i(Vn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*bf(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Oy);yield $i(Vn.setLoginState({loading:!0}));try{const e=pt(n.publicKey),i=yield Vi(Bu.auth.enrollMFAWebAuthnForLogin,P({},n,{options:e})),o=yield Vi(Bu.auth.generateLoginResponseV2,i);yield pf(o),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Af(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Ey);yield $i(Vn.setLoginState({loading:!0}));try{const e=yield Vi(Bu.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Vi(Bu.auth.generateLoginResponseV2,e);yield pf(i),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*kf(e){let{payload:{callback:t,deviceId:n}}=e,i=Zn(e.payload,wy);yield $i(Vn.setLoginState({loading:!0}));try{const e=yield Vi(Bu.auth.preVerifyMFASMSForLogin,n,i);yield $i(Vn.setMfaState({otcToken:e.otcToken,step:Yt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tf(e){let{payload:{callback:t,deviceId:n}}=e,i=Zn(e.payload,Cy);yield $i(Vn.setLoginState({loading:!0}));try{const e=yield Vi(Bu.auth.verifyMFASMSForLogin,n,i),o=yield Vi(Bu.auth.generateLoginResponseV2,e);yield Sf(o),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pf(e){let{payload:{callback:t,deviceId:n}}=e,i=Zn(e.payload,Dy);yield $i(Vn.setLoginState({loading:!0}));try{var o;const e=yield Vi(Bu.auth.preVerifyMFAWebAuthnForLogin,n,i),a=P({},e.options,{challenge:gt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>P({},e,{id:gt(e.id)})))});yield $i(Vn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*If(e){let{payload:{callback:t,deviceId:n}}=e,i=Zn(e.payload,Ry);yield $i(Vn.setLoginState({loading:!0}));try{const e=pt(i.publicKey),o=yield Vi(Bu.auth.verifyMFAWebAuthnForLogin,n,P({},i,{options:e})),a=yield Vi(Bu.auth.generateLoginResponseV2,o);yield Sf(a),yield $i(Vn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lf(){yield Fo(Vn.requestAuthorize,By),yield Fo(Vn.requestAuthorizeSSR,qy),yield Fo(Vn.requestHostedLoginAuthorize,Hy),yield Fo(Vn.handleHostedLoginCallback,Jy),yield Fo(Vn.preLogin,nf),yield Fo(Vn.postLogin,cf),yield Fo(Vn.login,uf),yield Fo(Vn.logout,ff),yield Fo(Vn.silentLogout,gf),yield Fo(Vn.loginWithMfa,df),yield Fo(Vn.recoverMfa,yf),yield Fo(Vn.quickSmsPasswordlessPreLogin,Xy),yield Fo(Vn.changePhoneNumberWithVerification,Yy),yield Fo(Vn.verifyChangePhoneNumber,Qy),yield Fo(Vn.passwordlessPreLogin,Zy),yield Fo(Vn.passwordlessPostLogin,ef),yield Fo(Vn.verifyInviteToken,tf),yield Fo(Vn.webAuthnPrelogin,lf),yield Fo(Vn.webAuthnPostLogin,sf),yield Fo(Vn.webAuthnCreateNewDeviceSession,af),yield Fo(Vn.webAuthnVerifyNewDeviceSession,rf),yield Fo(Vn.afterAuthNavigation,Uy),yield Fo(Vn.getUserIP,Gy),yield Fo(Vn.preEnrollMFASMSForLogin,vf),yield Fo(Vn.enrollMFASMSForLogin,hf),yield Fo(Vn.preEnrollMFAWebAuthnForLogin,mf),yield Fo(Vn.enrollMFAWebAuthnForLogin,bf),yield Fo(Vn.enrollMFAAuthenticatorAppForLogin,Af),yield Fo(Vn.preVerifyMFASMSForLogin,kf),yield Fo(Vn.verifyMFASMSForLogin,Tf),yield Fo(Vn.preVerifyMFAWebAuthnForLogin,Pf),yield Fo(Vn.verifyMFAWebAuthnForLogin,If)}function*Of({payload:e}){e&&(yield $i(Vn.setState({isLoading:!0})));const t=nd;yield $i(Vn.loadTenants()),yield $i(Vn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Ef({payload:{callback:e}}){try{const{ip:t}=Td[0];yield $i(Vn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*wf(){yield Fo(Vn.requestAuthorize,Of),yield Fo(Vn.afterAuthNavigation,Uy),yield Fo(Vn.getUserIP,Ef)}const Cf=["callback","samlVendor"],Df=["callback","samlVendor"];function*Rf(){try{var e,t;yield $i(Vn.setSSOState({loading:!0}));const n=yield Vi(Bu.auth.getSamlConfiguration),i=yield Vi(Bu.auth.getOidcConfiguration),o=yield Vi(Bu.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield $i(Vn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield $i(Vn.setSSOState({error:e.message,loading:!1}))}}function*_f({payload:e}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield $i(Vn.setSSOState({error:void 0,[n]:!0}));try{const i=yield Xu(e[0]),o=yield Vi(Bu.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield $i(Vn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield $i(Vn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Uf({payload:e}){const{configFile:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield $i(Vn.setSSOState({error:void 0,[o]:!0}));try{const e=yield Xu(t),a=yield Vi(Bu.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield $i(Vn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield $i(Vn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Mf({payload:e}){const{callback:t,samlVendor:n}=e,i=Zn(e,Cf),o=yield Ki((e=>e.auth.ssoState.samlConfiguration)),a=P({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield $i(Vn.setSSOState({samlConfiguration:P({},o,a)})));if(yield $i(Vn.setSSOState({error:void 0,[r]:!0})),e.type===Hu.Saml){var l,s;const e=yield Vi(Bu.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const i=Ju(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Vi(Bu.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield $i(Vn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Nf({payload:{callback:e}={}}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration));try{yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield Vi(Bu.auth.validateSamlDomain),yield $i(Vn.setSSOState({samlConfiguration:P({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield $i(Vn.setSSOState({samlConfiguration:P({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*$f(){try{const e=yield Vi(Bu.auth.getSamlRoles),t=yield Vi(Bu.auth.getSamlRolesGroups);yield $i(Vn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield $i(Vn.setSSOState({error:e.message}))}}function*Ff({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield Vi(Bu.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Fi(e.map((e=>Vi(Bu.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield $i(Vn.setSSOState({error:e.message}))}}(n)),yield $f(),yield $i(Vn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $i(Vn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*xf({payload:{callback:e,id:t}}){try{yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield Vi(Bu.auth.deleteSamlGroup,{id:t}),yield $f(),yield $i(Vn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield $i(Vn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Vf({payload:{group:e,roleIds:t,callback:n}}){try{yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield Vi(Bu.auth.createSamlGroup,{group:e,roleIds:t}),yield $f(),yield $i(Vn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield $i(Vn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*jf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield $i(Vn.setSSOState({loading:!0})),yield Vi(Bu.auth.oidcPostLoginV2,t),yield Vi(jy),yield $i(Vn.setSSOState({loading:!1}))}catch(e){var n;yield $i(Vn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Wf(){yield No(Vn.loadSSOConfigurations,Rf),yield No(Vn.saveSSOConfigurations,Mf),yield No(Vn.saveSSOConfigurationsFile,_f),yield No(Vn.saveSSOConfigurationsFileWithCallback,Uf),yield No(Vn.validateSSODomain,Nf),yield No(Vn.loadSSOAuthorizationRoles,$f),yield No(Vn.updateSSOAuthorizationRoles,Ff),yield No(Vn.deleteSamlGroup,xf),yield No(Vn.createSamlGroup,Vf),yield No(Vn.oidcPostlogin,jf)}function*Kf(){yield $i(Vn.setSSOState({loading:!0})),yield dt(),yield $i(Vn.setSSOState({samlConfiguration:cd,loading:!1,firstLoad:!1}))}function*Gf({payload:e}){const t="saving";yield $i(Vn.setSSOState({error:void 0,[t]:!0}));const n=P({},yield Ki((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield $i(Vn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Bf({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Zn(e,Df),r=yd.samlConfiguration,l=P({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield $i(Vn.setSSOState({samlConfiguration:P({},r,l)})));yield $i(Vn.setSSOState({error:void 0,[s]:!0})),yield dt(),l.acsUrl=null==ud||null==(t=ud.configuration)?void 0:t.acsUrl,l.spEntityId=null==ud||null==(n=ud.configuration)?void 0:n.spEntityId;const c=Ju(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield dt(),yield $i(Vn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*zf({payload:{callback:e}={}}){const t=yd.samlConfiguration;yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield dt(),yield $i(Vn.setSSOState({samlConfiguration:P({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*qf(){yield dt(),yield $i(Vn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Hf({payload:{callback:e,authorizationRoles:t}}){yield $i(Vn.setSSOState({error:void 0,saving:!0})),yield dt(),yield $i(Vn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Jf(){yield No(Vn.loadSSOConfigurations,Kf),yield No(Vn.saveSSOConfigurations,Bf),yield No(Vn.saveSSOConfigurationsFile,Gf),yield No(Vn.validateSSODomain,zf),yield No(Vn.loadSSOAuthorizationRoles,qf),yield No(Vn.updateSSOAuthorizationRoles,Hf)}const Yf=["callback"],Qf=["callback","ssoConfigId"],Xf=["callback","ssoConfigId"];function*Zf(){try{return yield Vi(Bu.auth.getOidcConfiguration)}catch(e){return null}}function*eg(){try{return yield Vi(Bu.metadata.getSamlMetadata)}catch(e){return null}}function*tg(){try{yield $i(Vn.setSSOLoader({key:qu.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Fi([Vi(Zf),Vi(eg)]),n=yield Vi(Bu.auth.getSSOConfigurations);yield $i(Vn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield $i(Vn.setSSOError({key:qu.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield $i(Vn.setSSOLoader({key:qu.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*ng({payload:e}){yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Zn(e,Yf),i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Vi(Bu.auth.createSSOConfiguration,P({},n,{enabled:null!=(o=n.enabled)&&o}));yield $i(Vn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield $i(Vn.setSSOError({key:qu.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_CONFIGURATION,value:!1}))}}function*ig({payload:e}){yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xu(t),o=yield Vi(Bu.auth.createSSOConfigurationByMetadata,{metadata:e});yield $i(Vn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield $i(Vn.setSSOError({key:qu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*og({payload:e}){yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Zn(e,Qf),o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vi(Bu.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield $i(Vn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $i(Vn.setSSOError({key:qu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ag({payload:e}){yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Xu(i),a=yield Vi(Bu.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield $i(Vn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield $i(Vn.setSSOError({key:qu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*rg({payload:e}){yield $i(Vn.setSSOLoader({key:qu.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield Vi(Bu.auth.deleteSSOConfiguration,t),yield $i(Vn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield $i(Vn.setSSOError({key:qu.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.DELETE_SSO_CONFIGURATION,value:!1}))}}function*lg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Zn(e,Xf);yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vi(Bu.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?P({},t,{domains:[...t.domains,e]}):t));yield $i(Vn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield $i(Vn.setSSOError({key:qu.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_DOMAIN,value:!1}))}}function*sg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield $i(Vn.setSSOLoader({key:qu.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield Vi(Bu.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?P({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield $i(Vn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield $i(Vn.setSSOError({key:qu.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.DELETE_SSO_DOMAIN,value:!1}))}}function*cg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield $i(Vn.setSSOLoader({key:qu.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield Vi(Bu.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?P({},e,{domains:e.domains.map((e=>e.id===n?P({},e,{validated:!0}):e))}):e));yield $i(Vn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield $i(Vn.setSSOError({key:qu.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.VALIDATE_SSO_DOMAIN,value:!1}))}}function*ug({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield Vi(Bu.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?P({},e,{roleIds:n}):e));yield $i(Vn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield $i(Vn.setSSOError({key:qu.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield $i(Vn.setSSOLoader({key:qu.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*dg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_GROUPS,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield Fi(t.map((e=>Vi(Bu.auth.deleteSSOGroup,n,e)))),yield Fi(e.map((e=>Vi(Bu.auth.createSSOGroup,n,e))));const a=yield Vi(Bu.auth.getSSOGroups,n),r=o.map((e=>e.id===n?P({},e,{groups:a}):e));yield $i(Vn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield $i(Vn.setSSOError({key:qu.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_GROUPS,value:!1}))}}function*yg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Fi(t.map((t=>Vi(Bu.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield $i(Vn.setSSOError({key:qu.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield $i(Vn.setSSOLoader({key:qu.SAVE_SSO_GROUPS,value:!1}))}}function*fg(){yield No(Vn.loadSSOConfigurationsV2,tg),yield No(Vn.saveSSOConfigurationV2,ng),yield No(Vn.saveSSODomain,lg),yield No(Vn.deleteSSODomain,sg),yield No(Vn.validateSSODomainV2,cg),yield No(Vn.updateSSOConfiguration,og),yield No(Vn.deleteSSOConfiguration,rg),yield No(Vn.setSSOGroups,dg),yield No(Vn.updateSSOGroups,yg),yield No(Vn.setSSODefaultRoles,ug),yield No(Vn.saveSSOConfigurationByMetadata,ig),yield No(Vn.updateSSOConfigurationByMetadata,ag)}const gg=["callback","profilePictureUrl"],pg=["callback","profilePictureUrl"];function*Sg(){yield $i(Vn.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Vi.apply(void 0,[Mo,e,t,n].concat(o))}(3,2e3,Bu.teams.getProfile),t=yield Ki((e=>e.auth.user));Vn.setUser(P({},t,e)),yield $i(Vn.setProfileState({profile:e,loading:!1}))}catch(e){yield $i(Vn.setProfileState({loading:!1,error:e.message}))}}function*vg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Zn(e.payload,gg);yield $i(Vn.setProfileState({saving:!0,error:null}));try{const e=yield Ki((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Vi(Bu.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=P({},e,i,{profilePictureUrl:o}),r=yield Vi(Bu.teams.updateProfile,a),l=yield Ki((e=>e.auth.user));yield $i(Vn.setUser(P({},l,r))),yield $i(Vn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield $i(Vn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*hg({payload:e}){yield $i(Vn.setProfileState({loading:!0}));try{var t;yield Vi(Bu.teams.changePassword,e),yield $i(Vn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*mg(){yield Fo(Vn.loadProfile,Sg),yield No(Vn.saveProfile,vg),yield No(Vn.changePassword,hg)}function*bg(){yield $i(Vn.setProfileState({loading:!0})),yield dt(),yield $i(Vn.setUser(P({},nd,td))),yield $i(Vn.setProfileState({loading:!1,profile:td}))}function*Ag(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Zn(e.payload,pg);yield $i(Vn.setProfileState({saving:!0,error:null}));const o=id;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=P({},o.profile,i,{profilePictureUrl:a}),l=nd;yield dt(),yield $i(Vn.setUser(P({},l,r))),yield $i(Vn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*kg({payload:e}){var t;yield $i(Vn.setProfileState({loading:!0})),yield dt(),yield $i(Vn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Tg(){yield Fo(Vn.loadProfile,bg),yield No(Vn.saveProfile,Ag),yield No(Vn.changePassword,kg)}const Pg=["callback"],Ig=["callback"],Lg=["callback"],Og=["deviceId","callback"],Eg=["deviceId","callback"],wg=["callback"],Cg=["deviceId"],Dg=["deviceId"],Rg=["callback"];function*_g(e){const{step:t}=yield Ki((e=>e.auth.mfaState));return{step:e.recoveryCode?Yt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Ug(){yield $i(Vn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Vi(Bu.auth.enrollMfa);yield $i(Vn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message}))}}function*Mg(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Pg);yield $i(Vn.setMfaState({saving:!0}));try{const e=yield Ki((e=>e.auth.user)),i=yield Vi(Bu.auth.verifyMfa,n),o=yield Vi(Bu.auth.getMFADevices),a=yield _g(i);yield $i(Vn.setMfaState(P({},a,{mfaDevices:o}))),yield $i(Vn.setUser(P({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ng(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Ig);yield $i(Vn.setMfaState({loading:!0}));try{const e=yield Vi(Bu.auth.loginWithMfa,n),i={step:Yt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield $i(Vn.setMfaState(i)),yield $i(Vn.setState({user:e})),yield $i(Vn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield $i(Vn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*$g({payload:e}){yield $i(Vn.setMfaState({saving:!0}));try{var t;yield Vi(Bu.auth.disableMfa,e);const n=yield Vi(Bu.auth.getMFADevices);yield $i(Vn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Fg({payload:e}){yield $i(Vn.setMfaState({saving:!0}));try{var t,n;const i=yield Vi(Bu.auth.preEnrollMFAWebAuthn),o=P({},i.options,{challenge:gt(i.options.challenge),user:P({},i.options.user,{id:gt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>P({},e,{id:gt(e.id)})))});yield $i(Vn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield $i(Vn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*xg(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Lg);yield $i(Vn.setMfaState({saving:!0}));try{const e=pt(n.publicKey),i=yield Vi(Bu.auth.enrollMFAWebAuthn,P({},n,{options:e})),o=yield Vi(Bu.auth.getMFADevices),a=yield _g(i);yield $i(Vn.setMfaState(P({},a,{mfaDevices:o}))),console.log(t,a.recoveryCode),null==t||t(a.recoveryCode)}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Vg(e){let{payload:{deviceId:t,callback:n}}=e;Zn(e.payload,Og),yield $i(Vn.setMfaState({saving:!0}));try{var i;const e=yield Vi(Bu.auth.preDisableMFAWebAuthn,t),o=P({},e.options,{challenge:gt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)})))});yield $i(Vn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*jg(e){let{payload:{deviceId:t,callback:n}}=e,i=Zn(e.payload,Eg);yield $i(Vn.setMfaState({saving:!0}));try{const e=pt(i.publicKey);yield Vi(Bu.auth.disableMFAWebAuthn,t,P({},i,{options:e}));const o=yield Vi(Bu.auth.getMFADevices);yield $i(Vn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*Wg({payload:e}){yield $i(Vn.setMfaState({saving:!0}));try{var t;const n=yield Vi(Bu.auth.preEnrollMFASMS,e);yield $i(Vn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Kg(e){let{payload:{callback:t}}=e,n=Zn(e.payload,wg);yield $i(Vn.setMfaState({saving:!0}));try{const e=yield Vi(Bu.auth.enrollMFASMS,n),i=yield Vi(Bu.auth.getMFADevices),o=yield _g(e);yield $i(Vn.setMfaState(P({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Gg(e){let{payload:{deviceId:t}}=e,n=Zn(e.payload,Cg);yield $i(Vn.setMfaState({saving:!0}));try{var i;const e=yield Ki((e=>e.auth.user)),o=yield Vi(Bu.auth.preDisableMFASMS,t);yield $i(Vn.setMfaState({saving:!1,error:void 0,otcToken:o.otcToken,phoneNumber:o.phoneNumber})),yield $i(Vn.setUser(P({},e,{mfaEnrolled:!1}))),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Bg(e){let{payload:{deviceId:t}}=e,n=Zn(e.payload,Dg);yield $i(Vn.setMfaState({saving:!0}));try{var i;const e=yield Ki((e=>e.auth.user));yield Vi(Bu.auth.disableMFASMS,t,n);const o=yield Vi(Bu.auth.getMFADevices);yield $i(Vn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),yield $i(Vn.setUser(P({},e,{mfaEnrolled:!1}))),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield $i(Vn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*zg(){yield $i(Vn.setMfaState({loading:!0}));try{yield Ki((e=>e.auth.user));const e=yield Vi(Bu.auth.getMFADevices);yield $i(Vn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield $i(Vn.setMfaState({loading:!1,error:e.message}))}}function*qg(){yield $i(Vn.setMfaState({loading:!0}));try{const e=(yield Vi(Bu.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield $i(Vn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield $i(Vn.setMfaState({loading:!1,error:e.message}))}}function*Hg(){yield No(Vn.enrollMfa,Ug),yield No(Vn.getMFADevices,zg),yield No(Vn.getMFAStrategies,qg),yield No(Vn.verifyMfa,Mg),yield No(Vn.disableMfa,$g),yield No(Vn.verifyMfaAfterForce,Ng),yield No(Vn.preDisableMfaSms,Gg),yield No(Vn.disableMfaSms,Bg),yield No(Vn.preEnrollMfaSms,Wg),yield No(Vn.enrollMfaSms,Kg),yield No(Vn.preEnrollMfaWebAuthn,Fg),yield No(Vn.enrollMfaWebAuthn,xg),yield No(Vn.preDisableMfaWebAuthn,Vg),yield No(Vn.disableMfaWebAuthn,jg)}function*Jg(){yield $i(Vn.setMfaState({loading:!0})),yield $i(Vn.setMfaState({loading:!1,error:void 0,qrCode:"test"}))}function*Yg({payload:{callback:e}}){yield $i(Vn.setMfaState({loading:!0})),yield dt();const t={token:"token",recoveryCode:"recoveryCode"},n={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=t&&t.recoveryCode&&(n.recoveryCode=t.recoveryCode),yield $i(Vn.setMfaState(n)),yield $i(Vn.setUser(P({},nd,{mfaEnrolled:!0}))),null==e||e(n.recoveryCode)}function*Qg(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Rg);yield $i(Vn.setMfaState({loading:!0})),yield dt();const i=P({},n,{recoveryCode:"recoveryCode"}),o={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield $i(Vn.setMfaState(o)),yield dt(),yield $i(Vn.setUser(P({},nd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Xg({payload:e}){var t;yield $i(Vn.setMfaState({loading:!0})),yield dt(),yield $i(Vn.setMfaState({loading:!1,error:void 0})),yield $i(Vn.setUser(P({},nd,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}function*Zg(){yield No(Vn.enrollMfa,Jg),yield No(Vn.verifyMfa,Yg),yield No(Vn.disableMfa,Xg),yield No(Vn.verifyMfaAfterForce,Qg)}const ep=["callback"];function*tp({payload:e}){yield $i(Vn.setForgotPasswordState({loading:!0}));try{yield Vi(Bu.auth.forgotPassword,e),yield $i(Vn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success}))}catch(e){yield $i(Vn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*np(e){let{payload:{callback:t}}=e,n=Zn(e.payload,ep);yield $i(Vn.setForgotPasswordState({loading:!0}));try{yield Vi(Bu.auth.resetPassword,n),yield $i(Vn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success})),null==t||t(!0)}catch(e){yield $i(Vn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*ip({payload:e}){yield $i(Vn.setForgotPasswordState({loading:!0}));try{const t=yield Vi(Bu.auth.loadPasswordConfig,e);yield $i(Vn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield $i(Vn.setForgotPasswordState({loading:!1,error:e.message}))}}function*op(){yield Fo(Vn.forgotPassword,tp),yield Fo(Vn.resetPassword,np),yield Fo(Vn.loadPasswordConfig,ip)}let ap;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(ap||(ap={}));const rp=["callback","events"],lp=["callback"],sp=["callback"];function*cp({payload:{userId:e,token:t}}){yield $i(Vn.setActivateState({loading:!0,step:Et.activating}));try{const{isAuthenticated:n}=yield Ki((e=>e.auth));n&&(yield $i(Vn.silentLogout()));const i=yield Vi(Bu.auth.getActivateAccountStrategy,{userId:e,token:t});yield $i(Vn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield $i(Vn.setActivateState({loading:!1,step:Et.activatingForm})))}catch(e){yield $i(Vn.setActivateState({loading:!1,error:e.message}))}}function*up(e){let{payload:{callback:t,events:n}}=e,i=Zn(e.payload,rp);yield $i(Vn.setActivateState({loading:!0}));try{const e=xo.onRedirectTo,{routes:a}=yield Ki((e=>e.auth)),r=yield Vi(Bu.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if($y(r)){yield $i(Vn.setActivateState({step:Et.success}));const t=yield Vy(r);yield $i(Vn.setState(t)),yield Gi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield $i(Vn.setActivateState({step:Et.success}));const{user:e,tenants:t}=yield Vi(Bu.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:Pd.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield $i(Vn.setTenantsState({tenants:t,loading:!1})),yield $i(Vn.setState({user:e,isAuthenticated:!0})),yield Gi(1e3),yield Uy(),yield $i(Vn.resetActivateState())}null==t||t(!0)}catch(e){yield $i(Vn.setActivateState({loading:!1,error:e.message}))}}function*dp({payload:e}){const{callback:t}=e,n=Zn(e,lp);yield $i(Vn.setActivateStrategyState({loading:!0}));try{const e=yield Vi(Bu.auth.getActivateAccountStrategy,n);yield $i(Vn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield $i(Vn.setActivateStrategyState({loading:!1,error:e.message}))}}function*yp({payload:e}){const{callback:t}=e,n=Zn(e,sp);yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:n.email})),yield $i(Vn.setActivateState({loading:!0}));try{yield Vi(Bu.auth.resendActivationEmail,n),yield $i(Vn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield $i(Vn.setActivateState({loading:!1,error:e.message})),yield $i(Vn.setTeamError({key:ap.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:!1}))}function*fp(){yield Fo(Vn.activateAccount,up),yield Fo(Vn.preActivateAccount,cp),yield Fo(Vn.getActivateAccountStrategy,dp),yield Fo(Vn.resendActivationEmail,yp)}function*gp({payload:e}){if(e.token&&e.userId)try{yield $i(Vn.setAcceptInvitationState({error:void 0,step:Rt.pending})),yield Vi(Bu.auth.acceptInvitation,e),yield $i(Vn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Rt.success}}))}catch(e){yield $i(Vn.setAcceptInvitationState({step:Rt.failed,error:e.message}))}else yield $i(Vn.setAcceptInvitationState({error:void 0,step:Rt.invalid}))}function*pp(){yield Fo(Vn.acceptInvitation,gp)}var Sp,vp=new Uint8Array(16);function hp(){if(!Sp&&!(Sp="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Sp(vp)}for(var mp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,bp=function(e){return"string"==typeof e&&mp.test(e)},Ap=[],kp=0;kp<256;++kp)Ap.push((kp+256).toString(16).substr(1));var Tp=function(e,t,n){var i=(e=e||{}).random||(e.rng||hp)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ap[e[t+0]]+Ap[e[t+1]]+Ap[e[t+2]]+Ap[e[t+3]]+"-"+Ap[e[t+4]]+Ap[e[t+5]]+"-"+Ap[e[t+6]]+Ap[e[t+7]]+"-"+Ap[e[t+8]]+Ap[e[t+9]]+"-"+Ap[e[t+10]]+Ap[e[t+11]]+Ap[e[t+12]]+Ap[e[t+13]]+Ap[e[t+14]]+Ap[e[t+15]]).toLowerCase();if(!bp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Pp=["callback"],Ip=["roles"],Lp=["roles"],Op=["callback"],Ep=["callback","profileImage"],wp=["callback"],Cp=["callback","userId"],Dp=["callback"],Rp=["callback"],_p=["callback"],Up=["callback"],Mp=["callback"],Np=["callback"],$p=["callback"],Fp=["callback","profileImage"],xp=["callback"],Vp=["callback"],jp=["callback"],Wp=["callback"],Kp=["callback"],Gp=["callback"],Bp=()=>Ki((e=>e.auth.teamState));function*zp({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield Bp(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield $i(Vn.setTeamLoader({key:ap.USERS,value:!a})),yield $i(Vn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Fi([Vi(Bu.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Vi(Bu.teams.loadAvailableRoles),Vi(Bu.teams.loadAvailablePermissions)]);yield $i(Vn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield $i(Vn.setTeamError({key:ap.USERS,value:e.message})),yield $i(Vn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield $i(Vn.setTeamLoader({key:ap.USERS,value:!1}))}function*qp({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield Bp(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield $i(Vn.setTeamLoader({key:ap.USERS,value:!r})),yield $i(Vn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Fi([Vi(Bu.subTenants.loadAllUsers,P({},c)),Vi(Bu.teams.loadAvailableRoles),Vi(Bu.teams.loadAvailablePermissions)]);yield $i(Vn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield $i(Vn.setTeamError({key:ap.USERS,value:e.message})),yield $i(Vn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield $i(Vn.setTeamLoader({key:ap.USERS,value:!1}))}function*Hp({payload:e}){yield $i(Vn.setTeamLoader({key:ap.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Fi([Vi(Bu.teams.loadAvailableRoles),Vi(Bu.teams.loadAvailablePermissions)]);yield $i(Vn.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield $i(Vn.setTeamError({key:ap.ROLES_AND_PERMISSIONS,value:t.message}))}yield $i(Vn.setTeamLoader({key:ap.ROLES_AND_PERMISSIONS,value:!0}))}function*Jp({payload:e}){const{callback:t}=e,n=Zn(e,Pp),i=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})}));try{const e=yield Vi(Bu.teams.addUser,n),{roles:o}=e,a=P({},Zn(e,Ip),{roleIds:o.map((e=>e.id))});null==t||t(a),yield $i(Vn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Yp({payload:e}){const{callback:t}=e,n=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},n.addUserDialogState,{loading:!0})}));try{const i=e.emails.map((t=>({email:t,roleIds:e.roleIds}))),o=yield Fi(i.map((e=>Vi(Bu.teams.addUser,e))));let a=[];o.forEach((e=>{const{roles:t}=e,n=P({},Zn(e,Lp),{roleIds:t.map((e=>e.id))});a.push(n)}));let r=a.concat(...n.users);yield $i(Vn.setTeamState({users:r,addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield $i(Vn.setTeamState({addUserDialogState:P({},n.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Qp({payload:e}){const{callback:t}=e,n=Zn(e,Op),i=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})}));try{yield Vi(Bu.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Vi(Bu.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield $i(Vn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Xp({payload:e}){const{callback:t}=e,n=Zn(e,Ep),{id:i}=n,o=yield Bp(),a=o.users.find((e=>e.id===n.id));yield $i(Vn.setTeamLoader({key:ap.UPDATE_USER,value:i||""})),yield $i(Vn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0})})),yield $i(Vn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?P({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Vi(Bu.teams.updateUser,n);null==t||t(e),yield $i(Vn.setTeamState({users:o.users.map((t=>t.id===e.id?P({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield $i(Vn.setTeamLoader({key:ap.UPDATE_USER,value:!1}))}catch(e){yield $i(Vn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?P({},e,a):e))})),yield $i(Vn.setTeamLoader({key:ap.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Zp({payload:e}){const{callback:t}=e,n=Zn(e,wp),i=yield Bp();yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})}));try{yield Vi(Bu.teams.deleteUser,n),null==t||t(!0),yield $i(Vn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*eS({payload:e}){const{callback:t,userId:n}=e,i=Zn(e,Cp),o=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0})}));try{yield Vi(Bu.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return P({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield $i(Vn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[P({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield $i(Vn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*tS({payload:e}){const{callback:t}=e,n=Zn(e,Dp),i=yield Bp();yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})}));try{yield Vi(Bu.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield $i(Vn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*nS({payload:e}){const{callback:t}=e,n=Zn(e,Rp);yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Vi(Bu.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield $i(Vn.setTeamError({key:ap.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:!1}))}function*iS({payload:e}){const{callback:t}=e,n=Zn(e,_p);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Vi(Bu.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield $i(Vn.setTeamError({key:ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*oS({payload:e}){const{callback:t}=e,n=Zn(e,Up);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Vi(Bu.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield $i(Vn.setTeamError({key:ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*aS({payload:e}){const{callback:t}=e,n=Zn(e,Mp);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Vi(Bu.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield $i(Vn.setTeamError({key:ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*rS(){yield $i(Vn.setTeamError({key:ap.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Vi(Bu.teams.getInviteLinkConfiguration);yield $i(Vn.setTeamState({inviteTokenState:P({},e)}))}catch(e){yield $i(Vn.setTeamError({key:ap.CONFIG_TOKEN_LINK,value:e.message}))}}function*lS(){yield $i(Vn.setTeamError({key:ap.GET_TOKEN_LINK,value:!1}));try{yield Vi(rS);const e=yield Vi(Bu.teams.getInviteUserLink),{inviteTokenState:t}=yield Bp();yield $i(Vn.setTeamState({inviteTokenState:P({},t,e)}))}catch(e){yield $i(Vn.setTeamError({key:ap.GET_TOKEN_LINK,value:e.message}))}}function*sS({payload:{callback:e}}){yield $i(Vn.setTeamError({key:ap.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Bp();try{const n=yield Vi(Bu.teams.createInviteUserLink,{expiresInMinutes:43200});yield $i(Vn.setTeamState({inviteTokenState:P({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield $i(Vn.setTeamError({key:ap.CREATE_TOKEN_LINK,value:t.message}))}}function*cS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Bp();yield $i(Vn.setTeamError({key:ap.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Vi(Bu.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield $i(Vn.setTeamState({inviteTokenState:P({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield $i(Vn.setTeamError({key:ap.UPDATE_TOKEN_LINK,value:t.message}))}}function*uS({payload:e}){const{callback:t}=null!=e?e:{};yield $i(Vn.setTeamError({key:ap.DELETE_TOKEN_LINK,value:!1}));try{yield Vi(Bu.teams.deleteInviteUserLink),yield $i(Vn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield $i(Vn.setTeamError({key:ap.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*dS({payload:e}){yield $i(Vn.setTeamState({addUserDialogState:P({open:!0,loading:!1,error:!1},e)}))}function*yS({payload:e}){const t=yield Bp(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield $i(Vn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*fS({payload:e}){yield $i(Vn.setTeamState({deleteUserDialogState:P({open:!0,loading:!1,error:!1},e)}))}function*gS({payload:e}){const t=yield Bp(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield $i(Vn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*pS(){yield $o(Vn.loadUsers,zp),yield $o(Vn.loadAllSubTenantsUsers,qp),yield $o(Vn.loadRoles,Hp),yield No(Vn.addUser,Jp),yield No(Vn.addUsersBulk,Yp),yield No(Vn.addUserToSubTenants,Qp),yield No(Vn.updateUser,Xp),yield No(Vn.setUserRolesForSubTenants,eS),yield No(Vn.deleteUser,Zp),yield No(Vn.deleteUserFromSubTenants,tS),yield No(Vn.resendActivationLink,nS),yield No(Vn.resendInvitationLink,iS),yield No(Vn.resendInvitationEmail,oS),yield No(Vn.resendInvitationLinkToAllSubTenants,aS),yield No(Vn.getInvitationLink,lS),yield No(Vn.createInvitationLink,sS),yield No(Vn.updateInvitationLink,cS),yield No(Vn.deleteInvitationLink,uS),yield No(Vn.openAddUserDialog,dS),yield No(Vn.closeAddUserDialog,yS),yield No(Vn.openDeleteUserDialog,fS),yield No(Vn.closeDeleteUserDialog,gS)}function*SS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield Bp(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield $i(Vn.setTeamLoader({key:ap.USERS,value:!a})),yield $i(Vn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield dt(),yield $i(Vn.setTeamState({users:vd,totalPages:2,totalItems:10,roles:dd,permissions:fd})),yield $i(Vn.setTeamLoader({key:ap.USERS,value:!1})),null==r||r(vd)}function*vS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield Bp(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield $i(Vn.setTeamLoader({key:ap.USERS,value:!r})),yield $i(Vn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield dt(),yield $i(Vn.setTeamState({allUsers:hd,totalPages:2,totalItems:10,roles:dd,permissions:fd})),yield $i(Vn.setTeamLoader({key:ap.USERS,value:!1})),null==l||l(hd)}function*hS({payload:e}){var t;yield $i(Vn.setTeamLoader({key:ap.ROLES_AND_PERMISSIONS,value:!0})),yield dt(),yield $i(Vn.setTeamState({roles:dd,permissions:fd})),yield $i(Vn.setTeamLoader({key:ap.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:dd,permissions:fd})}function*mS({payload:e}){const{callback:t}=e,n=Zn(e,Np),i=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})})),yield dt();const o=P({},pd,n,{id:`${Tp()}`});null==t||t(o),yield $i(Vn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*bS({payload:e}){const{callback:t}=e,n=Zn(e,$p),i=yield Bp();yield $i(Vn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})})),yield dt();const o=P({},pd,n,{id:`${Tp()}`});yield $i(Vn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*AS({payload:e}){var t;const{callback:n}=e,i=Zn(e,Fp),{id:o}=i,a=yield Bp(),r=a.users.find((e=>e.id===i.id));yield $i(Vn.setTeamLoader({key:ap.UPDATE_USER,value:o||""})),yield $i(Vn.setTeamState({addUserDialogState:P({},a.addUserDialogState,{loading:!0})})),yield $i(Vn.setTeamState({addUserDialogState:P({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?P({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield dt();const l=P({},r,i);null==n||n(l),yield $i(Vn.setTeamState({users:a.users.map((e=>e.id===l.id?P({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield $i(Vn.setTeamLoader({key:ap.UPDATE_USER,value:!1}))}function*kS({payload:e}){const{callback:t}=e,n=Zn(e,xp),i=yield Bp();yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*TS({payload:e}){const{callback:t}=e,n=Zn(e,Vp),i=yield Bp();yield $i(Vn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*PS({payload:e}){const{callback:t}=e,n=Zn(e,jp);yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:n.userId})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamLoader({key:ap.RESEND_ACTIVATE_LINK,value:!1}))}function*IS({payload:e}){const{callback:t}=e,n=Zn(e,Wp);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*LS({payload:e}){const{callback:t}=e,n=Zn(e,Kp);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*OS({payload:e}){const{callback:t}=e,n=Zn(e,Gp);yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield $i(Vn.setTeamLoader({key:ap.RESEND_INVITATION_LINK,value:!1}))}function*ES(){yield $o(Vn.loadUsers,SS),yield $o(Vn.loadAllSubTenantsUsers,vS),yield $o(Vn.loadRoles,hS),yield No(Vn.addUser,mS),yield No(Vn.addUserToSubTenants,bS),yield No(Vn.updateUser,AS),yield No(Vn.deleteUser,kS),yield No(Vn.deleteUserFromSubTenants,TS),yield No(Vn.resendActivationLink,PS),yield No(Vn.resendInvitationLink,IS),yield No(Vn.resendInvitationEmail,LS),yield No(Vn.resendInvitationLinkToAllSubTenants,OS),yield No(Vn.openAddUserDialog,dS),yield No(Vn.closeAddUserDialog,yS),yield No(Vn.openDeleteUserDialog,fS),yield No(Vn.closeDeleteUserDialog,gS)}const wS=["authorizationUrl"],CS=["events","url"];function*DS(){try{yield $i(Vn.setSocialLoginsState({loading:!0}));const e=yield Vi(Bu.auth.getSocialLoginProviders);yield $i(Vn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield $i(Vn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*RS(){try{const e=yield Ki((e=>e.root.context));yield $i(Vn.setSocialLoginsState({loading:!0}));const t=(yield Vi(Bu.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=Zn(t,wS);const o=Wo(e,null!=n?n:"");return P({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield $i(Vn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield $i(Vn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*_S(e){let{payload:{events:t,url:n}}=e,i=Zn(e.payload,CS);try{yield $i(Vn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Vi(Bu.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Id.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Pd.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield $i(Vn.setLoginState({email:e,isNewUser:r})),yield jy(),localStorage.removeItem("register-quick-login"),yield $i(Vn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield $i(Vn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*US({payload:e}){yield $i(Vn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*MS(){yield Fo(Vn.loadSocialLoginsConfiguration,DS),yield Fo(Vn.loadSocialLoginsConfigurationV2,RS),yield Fo(Vn.loginViaSocialLogin,_S),yield $o(Vn.setSocialLoginError,US)}let NS;function*$S({payload:e}){yield $i(Vn.setApiTokensState({apiTokenType:e}));try{if(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Vi(Bu.auth.getUserApiTokensData);yield $i(Vn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Vi(Bu.auth.getTenantApiTokensData),{items:t}=yield Vi(Bu.teams.loadAvailableRoles),{items:n}=yield Vi(Bu.teams.loadAvailablePermissions);yield $i(Vn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1}))}catch(e){yield $i(Vn.setApiTokensError({key:NS.LOAD_API_TOKENS,value:e.message})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1}))}}function*FS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield Ki((e=>e.auth.apiTokensState));try{yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!0}));const e=yield Vi(Bu.auth.updateUserApiTokensData,{description:t});yield $i(Vn.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield $i(Vn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield $i(Vn.setApiTokensError({key:NS.ADD_API_TOKEN,value:e.message})),yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*xS({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState));try{yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!0}));const e=yield Vi(Bu.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield $i(Vn.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield $i(Vn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield $i(Vn.setApiTokensError({key:NS.ADD_API_TOKEN,value:e.message})),yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*VS({payload:e}){const{apiTokensDataUser:t}=yield Ki((e=>e.auth.apiTokensState));try{yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!0})),yield Vi(Bu.auth.deleteUserApiToken,{tokenId:e}),yield $i(Vn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!1}))}catch(e){yield $i(Vn.setApiTokensError({key:NS.DELETE_API_TOKEN,value:e.message})),yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!1}))}}function*jS({payload:e}){const{apiTokensDataTenant:t}=yield Ki((e=>e.auth.apiTokensState));try{yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!0})),yield Vi(Bu.auth.deleteTenantApiToken,{tokenId:e}),yield $i(Vn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!1}))}catch(e){yield $i(Vn.setApiTokensError({key:NS.DELETE_API_TOKEN,value:e.message})),yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!1}))}}function*WS({payload:e}){null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Fi([Vi(Bu.auth.getUserApiTokensData),Vi(Bu.auth.getTenantApiTokensData)]);yield $i(Vn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setApiTokensError({key:NS.LOAD_API_TOKENS,value:t.message})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*KS({payload:e}){null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Vi(Bu.auth.getUserApiTokensData);yield $i(Vn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setApiTokensError({key:NS.LOAD_API_TOKENS,value:t.message})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*GS({payload:e}){null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Vi(Bu.auth.getTenantApiTokensData);yield $i(Vn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setApiTokensError({key:NS.LOAD_API_TOKENS,value:t.message})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*BS(){yield Fo(Vn.loadApiTokens,WS),yield Fo(Vn.loadUserApiTokens,KS),yield Fo(Vn.loadTenantApiTokens,GS),yield Fo(Vn.initApiTokensData,$S),yield No(Vn.addUserApiToken,FS),yield No(Vn.addTenantApiToken,xS),yield $o(Vn.deleteTenantApiToken,jS),yield $o(Vn.deleteUserApiToken,VS)}function*zS({payload:e}){if(yield $i(Vn.setApiTokensState({apiTokenType:e})),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})),"user"===e){yield Gi(200);const e=[Zu];yield $i(Vn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Gi(200),yield $i(Vn.setApiTokensState({apiTokensDataTenant:null!=(t=[ed])?t:[],roles:null!=dd?dd:[],permissions:null!=fd?fd:[]}))}yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1}))}function*qS({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState)),a=P({},ed,{description:t,roleIds:n,clientId:`CLIENT_ID_${Tp()}`});yield $i(Vn.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield $i(Vn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Gi(200),yield $i(Vn.setApiTokensLoader({key:NS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*HS({payload:e}){yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!0})),yield Gi(200);const t=[ed];yield $i(Vn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield $i(Vn.setApiTokensLoader({key:NS.DELETE_API_TOKEN,value:!1}))}function*JS({payload:e}){var t;null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));const n=[Zu],i=[ed];yield $i(Vn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Gi(200),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*YS({payload:e}){var t;null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));const n=[Zu];yield $i(Vn.setApiTokensState({apiTokensDataUser:n})),yield Gi(200),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*QS({payload:e}){var t;null!=e&&e.silentLoading||(yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!0})));const n=[ed];yield $i(Vn.setApiTokensState({apiTokensDataTenant:n})),yield Gi(200),yield $i(Vn.setApiTokensLoader({key:NS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*XS(){yield Fo(Vn.loadApiTokens,JS),yield Fo(Vn.loadUserApiTokens,YS),yield Fo(Vn.loadTenantApiTokens,QS),yield Fo(Vn.initApiTokensData,zS),yield No(Vn.addTenantApiToken,qS),yield $o(Vn.deleteTenantApiToken,HS)}function*ZS({payload:e}){try{var t;yield $i(Vn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ki((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Vi(Bu.accountSettings.updateSettings,P({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield $i(Vn.setAccountSettingsState(P({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield $i(Vn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*ev({payload:e}){yield $i(Vn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Vi(Bu.accountSettings.getSettings);yield $i(Vn.setAccountSettingsState(P({},e,{loading:!1})))}catch(e){yield $i(Vn.setAccountSettingsState({loading:!1,error:e.message}))}}function*tv(){yield Fo(Vn.saveAccountSettings,ZS),yield Fo(Vn.loadAccountSettings,ev)}function*nv({payload:e}){var t;yield $i(Vn.setAccountSettingsState({loading:!0})),yield dt();const{accountSettingsState:n}=yield Ki((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=P({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield $i(Vn.setAccountSettingsState(P({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*iv({payload:e}){yield $i(Vn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield dt(),yield $i(Vn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*ov(){yield Fo(Vn.saveAccountSettings,nv),yield Fo(Vn.loadAccountSettings,iv)}function*av({payload:{tenantId:e,callback:t}}){yield $i(Vn.setState({isLoading:!0}));try{yield Vi(Bu.tenants.switchTenant,{tenantId:e}),yield Vi(jy),(null==t?void 0:t(!0))||(yield $i(Vn.setState({isLoading:!1})))}catch(e){yield $i(Vn.setState({isLoading:!1})),null==t||t(!1,e)}}function*rv({payload:e}){yield $i(Vn.setTenantsState({loading:!0}));try{var t;const n=yield Vi(Bu.tenants.getTenants);yield $i(Vn.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield $i(Vn.setTenantsState({loading:!1}))}}function*lv({payload:e}){yield $i(Vn.setTenantsState({loading:!0}));try{var t;const n=yield Vi(Bu.tenants.getSubTenants);yield $i(Vn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sv({payload:e}){yield $i(Vn.setTenantsState({loading:!0}));try{var t;const n=yield Vi(Bu.tenants.getSubTenantsAsTree);yield $i(Vn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield $i(Vn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cv(){yield No(Vn.loadTenants,rv),yield No(Vn.loadSubTenants,lv),yield No(Vn.switchTenant,av),yield No(Vn.loadSubTenantsTree,sv)}function*uv(){yield $i(Vn.setTenantsState({loading:!0})),yield dt(),yield $i(Vn.setTenantsState({tenants:md,loading:!1}))}function*dv(){yield No(Vn.loadTenants,uv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(NS||(NS={}));const yv=["callback"],fv=["callback"],gv=["callback"],pv=["callback"],Sv=["callback"];function*vv({payload:e}){var t;yield $i(Vn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Fi([Vi(Bu.roles.getRoles),Vi(Bu.roles.getPermissions),Vi(Bu.roles.getPermissionCategories)]),[t,n,i]=e;yield $i(Vn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield $i(Vn.setRolesState({error:e.message,loading:!1}))}}function*hv(e){let{payload:{callback:t}}=e,n=Zn(e.payload,yv);yield $i(Vn.setRolesState({saving:!0}));try{const e=yield Vi(Bu.roles.addRole,n),i=yield Vi(Bu.roles.getRoles);yield $i(Vn.loadRolesAndPermissions({silentLoading:!0})),yield $i(Vn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*mv(e){let{payload:{callback:t}}=e,n=Zn(e.payload,fv);yield $i(Vn.setRolesState({saving:!0}));try{yield Vi(Bu.roles.deleteRole,n),yield $i(Vn.loadRolesAndPermissions({silentLoading:!0})),yield $i(Vn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*bv(e){let{payload:{callback:t}}=e,n=Zn(e.payload,gv);yield $i(Vn.setRolesState({saving:!0}));try{const e=yield Vi(Bu.roles.updateRole,n);yield $i(Vn.loadRolesAndPermissions({silentLoading:!0})),yield $i(Vn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Av(e){let{payload:{callback:t}}=e,n=Zn(e.payload,pv);yield $i(Vn.setRolesState({saving:!0}));try{const e=yield Vi(Bu.roles.attachPermissionsToRole,n);yield $i(Vn.loadRolesAndPermissions({silentLoading:!0})),yield $i(Vn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*kv(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Sv);yield $i(Vn.setRolesState({saving:!0}));try{const e=yield Vi(Bu.roles.attachPermissionToRoles,n);yield $i(Vn.loadRolesAndPermissions({silentLoading:!0})),yield $i(Vn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield $i(Vn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Tv(){yield Fo(Vn.loadRolesAndPermissions,vv),yield No(Vn.addRole,hv),yield No(Vn.deleteRole,mv),yield No(Vn.updateRole,bv),yield No(Vn.attachPermissionsToRole,Av),yield No(Vn.attachPermissionToRoles,kv)}const Pv=["callback"],Iv=["callback"],Lv=["callback"];function*Ov(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Pv);yield $i(Vn.setResetPhoneNumberState({loading:!0}));try{const e=yield Vi(Bu.auth.resetPhoneNumber,n);yield $i(Vn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Vt.VerifyResetPhoneNumber})),yield $i(Vn.setLoginState({email:n.email}))}catch(e){yield $i(Vn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Ev(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Iv);yield $i(Vn.setResetPhoneNumberState({loading:!0}));try{const e=yield Vi(Bu.auth.verifyResetPhoneNumber,n);yield $i(Vn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Vt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield $i(Vn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*wv(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Lv);yield $i(Vn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Vi(Bu.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield $i(Vn.setLoginState({step:St.loginWithSmsOtc})),yield $i(Vn.passwordlessPreLogin({type:er.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield $i(Vn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Cv(){yield Fo(Vn.resetPhoneNumber,Ov),yield Fo(Vn.verifyResetPhoneNumber,Ev),yield Fo(Vn.changePhoneNumber,wv)}function*Dv(){yield $i(Vn.setSessionsState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getCurrentUserSessions);yield $i(Vn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield $i(Vn.setSessionsState({error:e,loading:!1}))}}function*Rv(){yield $i(Vn.setSessionsState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getCurrentUserSession);yield $i(Vn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield $i(Vn.setSessionsState({error:e,loading:!1}))}}function*_v({payload:{id:e}}){yield $i(Vn.setSessionsState({loading:!0,error:null}));try{yield Vi(Bu.auth.deleteSessionForUser,e),yield $i(Vn.loadUserSessions())}catch(e){yield $i(Vn.setSessionsState({error:e,loading:!1}))}}function*Uv({payload:{callback:e,userId:t}}){yield $i(Vn.setSessionsState({loading:!0,error:null}));try{yield Vi(Bu.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield $i(Vn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Mv(){yield $i(Vn.setSessionsState({loading:!0,error:null}));try{yield Vi(Bu.auth.deleteAllSessionsForUser),yield $i(Vn.loadUserSessions())}catch(e){yield $i(Vn.setSessionsState({error:e,loading:!1}))}}function*Nv(){yield $o(Vn.loadUserSessions,Dv),yield $o(Vn.deleteUserSession,_v),yield $o(Vn.deleteAllUserSessions,Mv),yield $o(Vn.loadCurrentUserSession,Rv),yield No(Vn.revokeUserSessions,Uv)}function*$v(){yield $i(Vn.setSessionsState({loading:!0,error:null})),yield $i(Vn.setSessionsState({sessions:bd,loading:!1}))}function*Fv({payload:{id:e}}){yield $i(Vn.setSessionsState({loading:!0,error:null}));const t=(yield Ki((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield $i(Vn.setSessionsState({sessions:t,loading:!1}))}function*xv(){yield $i(Vn.setSessionsState({loading:!0,error:null}));const e=bd.filter((e=>e.current));yield $i(Vn.setSessionsState({sessions:e,loading:!1}))}function*Vv(){yield $o(Vn.loadUserSessions,$v),yield $o(Vn.deleteUserSession,Fv),yield $o(Vn.deleteAllUserSessions,xv)}const jv=["callback"],Wv=["callback"];function*Kv(){yield $i(Vn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getSessionConfigurations);yield $i(Vn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield $i(Vn.setSessionsState({error:e,loading:!1}))}}function*Gv({payload:e}){yield $i(Vn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Zn(e,jv);yield Vi(Bu.auth.createOrUpdateSessionConfigrations,n),yield $i(Vn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield $i(Vn.setSessionsPolicyState({error:e,loading:!1}))}}function*Bv(){yield Fo(Vn.loadSessionsPolicy,Kv),yield $o(Vn.createOrUpdateSessionsPolicy,Gv)}function*zv(){yield $i(Vn.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ki((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Ad}));yield $i(Vn.setSessionsPolicyState(P({},e,{loading:!1})))}function*qv({payload:e}){yield $i(Vn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Zn(e,Wv);null==t||t(!0),yield $i(Vn.setSessionsPolicyState({configurations:n,loading:!1}))}function*Hv(){yield Fo(Vn.loadSessionsPolicy,zv),yield $o(Vn.createOrUpdateSessionsPolicy,qv)}const Jv=["callback"],Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback"],eh=["callback"],th=["callback"],nh=["callback"],ih=()=>Ki((e=>e.auth.restrictionsState.ipRestrictions)),oh=()=>Ki((e=>e.auth.restrictionsState.emailDomainRestrictions));function*ah(){yield $i(Vn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Vi(Bu.auth.getDomainRestrictionsConfig),t=(yield Vi(Bu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $i(Vn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield $i(Vn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*rh(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Jv);yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield oh();try{var o;yield Vi(Bu.auth.createDomainRestriction,n);const e=(yield Vi(Bu.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield $i(Vn.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*lh(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Yv);yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Vi(Bu.auth.updateDomainRestrictionConfig,n),i=(yield Vi(Bu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield $i(Vn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*sh({payload:{id:e}}){yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield oh();try{var n;yield Vi(Bu.auth.deleteDomainRestriction,e);const i=(yield Vi(Bu.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield $i(Vn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Rn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield $i(Vn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const ch=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Rn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*uh(){yield $i(Vn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield ih(),t=yield Vi(Bu.auth.getIPRestrictionsConfig),n=ch({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Vi(Bu.auth.getIPRestrictions,n);yield $i(Vn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield $i(Vn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*dh(){try{const{valid:e}=yield Vi(Bu.auth.testCurrentIpInAllowList);yield $i(Vn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield $i(Vn.setIpRestrictionsState({error:e.message}))}}function*yh({payload:{callback:e}}){yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ki((e=>e.auth.userIp));yield Fi([Vi(Bu.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Rn.ALLOW}),Vi(Bu.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield ih(),i=ch(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Vi(Bu.auth.getIPRestrictions,i);yield $i(Vn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Rn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield $i(Vn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*fh(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Qv);yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));const i=yield ih();try{var o,a;yield Vi(Bu.auth.createIPRestriction,n);const e=yield ih(),r=ch(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Vi(Bu.auth.getIPRestrictions,r);yield dh(),yield $i(Vn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Rn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*gh(e){let{payload:{callback:t}}=e,n=Zn(e.payload,Xv);yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));try{yield Vi(Bu.auth.updateIPRestrictionConfig,n);const e=yield ih(),i=yield Vi(Bu.auth.getIPRestrictionsConfig),o=ch(P({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Vi(Bu.auth.getIPRestrictions,o);yield dh(),yield $i(Vn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ph({payload:{id:e,callback:t}}){yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));const n=yield ih();try{var i;yield Vi(Bu.auth.deleteIPRestriction,e);const o=yield ih(),a=ch(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Vi(Bu.auth.getIPRestrictions,a);yield dh(),yield $i(Vn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Rn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield $i(Vn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Sh(){yield Fo(Vn.loadIpRestrictions,uh),yield Fo(Vn.loadEmailDomainRestrictions,ah),yield No(Vn.saveIpRestriction,fh),yield No(Vn.saveIpRestrictionsConfig,gh),yield No(Vn.deleteIpRestriction,ph),yield No(Vn.checkIfUserIpValid,dh),yield No(Vn.addCurrentUserIpAndActivate,yh),yield No(Vn.saveEmailDomainRestriction,rh),yield No(Vn.saveEmailDomainRestrictionsConfig,lh),yield No(Vn.deleteEmailDomainRestriction,sh)}function*vh(){yield $i(Vn.setIpRestrictionsState({loading:!0,error:null})),yield $i(Vn.setIpRestrictionsState({data:{restrictions:Td.filter((e=>e.strategy===kd.strategy)),config:kd},totalPages:1,pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*hh(){yield $i(Vn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield ih(),t=Td[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield $i(Vn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield $i(Vn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*mh(e){var t,n;let{payload:{callback:i}}=e,o=Zn(e.payload,Zv);yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));const a=yield ih();yield $i(Vn.setIpRestrictionsState({data:{config:null!=(t=null==(n=a.data)?void 0:n.config)?t:{isActive:!1,strategy:Rn.ALLOW},restrictions:[...a.data.restrictions,P({},o,{createdAt:new Date,updatedAt:new Date,id:"123",isActive:!0,strategy:a.data.config.strategy})]},totalPages:1,pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*bh(e){let{payload:{callback:t}}=e,n=Zn(e.payload,eh);yield $i(Vn.setIpRestrictionsState({saving:!0,error:null})),yield $i(Vn.setIpRestrictionsState({data:{config:n,restrictions:Td.filter((e=>e.strategy===n.strategy))},pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield $i(Vn.setIpRestrictionsState({saving:!1,error:null})),null==t||t(!0)}function*Ah({payload:{id:e}}){var t;yield $i(Vn.setIpRestrictionsState({saving:!0,error:null}));const n=yield ih();yield $i(Vn.setIpRestrictionsState({data:{config:(null==(t=n.data)?void 0:t.config)||{isActive:!1,strategy:Rn.ALLOW},restrictions:n.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1}))}function*kh(){yield $i(Vn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield dt(),yield $i(Vn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Rn.ALLOW}],config:{active:!0,listType:Rn.ALLOW,blockPublicDomains:!1}}}))}function*Th(e){var t,n;let{payload:{callback:i}}=e,o=Zn(e.payload,th);const a=yield oh();yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),null==i||i(!0),yield $i(Vn.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],P({},o,{id:Date.now().toString()})]},saving:!1}))}function*Ph(e){var t;let{payload:{callback:n}}=e,i=Zn(e.payload,nh);const o=yield oh();yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),null==n||n(!0),yield $i(Vn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Rn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Ih({payload:{id:e}}){var t,n;const i=yield oh();yield $i(Vn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),yield $i(Vn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Rn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Lh(){yield Fo(Vn.loadIpRestrictions,vh),yield Fo(Vn.loadEmailDomainRestrictions,kh),yield No(Vn.saveIpRestriction,mh),yield No(Vn.saveIpRestrictionsConfig,bh),yield No(Vn.deleteIpRestriction,Ah),yield No(Vn.checkIfUserIpValid,hh),yield No(Vn.saveEmailDomainRestriction,Th),yield No(Vn.saveEmailDomainRestrictionsConfig,Ph),yield No(Vn.deleteEmailDomainRestriction,Ih)}var Oh={sagas:function*(){yield Fi([Vi(Lf),Vi(fp),Vi(pp),Vi(op),Vi(Cv),Vi(Wf),Vi(fg),Vi(mg),Vi(Hg),Vi(pS),Vi(MS),Vi(Dd),Vi(BS),Vi(iy),Vi(tv),Vi(cv),Vi(Tv),Vi(Nv),Vi(Bv),Vi(Sh)])},mockSagas:function*(){yield Fi([Vi(wf),Vi(Jf),Vi(Tg),Vi(Zg),Vi(ES),Vi(XS),Vi(gy),Vi(Vv),Vi(ov),Vi(dv),Vi(Hv),Vi(Lh)])},storeName:At,initialState:$n,reducer:Fn,actions:Vn};const Eh=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>P({},t,{[e]:P({},t[e],n)})}),wh={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Ch={setAuditLogsState:Eh("auditLogsState"),resetAuditLogsState:e=>P({},e,{auditLogsState:wh})},Dh={exportAuditsCsv:nt("auditLogs/exportAuditsCsv"),loadAuditLogs:nt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Rh={loading:!0},_h={setAuditsMetadataState:Eh("auditsMetadataState"),resetAuditsMetadataState:e=>P({},e,{auditsMetadataState:Rh})},Uh={loadAuditsMetadata:nt("auditLogs/loadAuditsMetadata")},Mh={auditLogsState:wh,auditsMetadataState:Rh},{reducer:Nh,actions:$h}=ot({name:Tt,initialState:Mh,reducers:P({resetState:e=>P({},e,Mh),setState:(e,{payload:t})=>P({},e,t)},Ch,_h)}),Fh=P({},$h,Dh,Uh),xh=e=>"createdAt"!==e.id,Vh={total:20,data:Array.from(Array(5).keys()).map((e=>P({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},jh={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},Wh=()=>Ki((e=>e.auditLogs.auditLogsState)),Kh=()=>Ki((e=>e.auditLogs.auditsMetadataState));function*Gh(){const e=yield Wh(),{columns:t}=yield Kh();try{const n=e.filter,i=e.sort.reduce(((e,t)=>P({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>P({},e,{[t.id]:t.value})),{});yield $i(Fh.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Bu.audits.exportAudits(P({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield $i(Fh.setAuditLogsState({isDownloadingCsv:!1}))}function*Bh({payload:e}){yield $i(Fh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Wh(),{columns:n}=yield Kh();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield $i(Fh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>P({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>P({},e,{[t.id]:t.value})),{});n||(yield $i(Fh.loadAuditsMetadata()));const{data:g,total:p}=yield Vi(Bu.audits.getAudits,P({offset:c,count:s},y,f));yield $i(Fh.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield $i(Fh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*zh(){yield No(Fh.exportAuditsCsv,Gh),yield No(Fh.loadAuditLogs,Bh)}function*qh({payload:e}){yield $i(Fh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Wh(),{columns:n}=yield Kh();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield $i(Fh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield $i(Fh.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Vh;let i=n.filter((e=>t=>e.filter(xh).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield $i(Fh.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield $i(Fh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Hh(){yield No(Fh.loadAuditLogs,qh)}function*Jh(){yield $i(Fh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Vi(Bu.metadata.getAuditsMetadata);yield $i(Fh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $i(Fh.setAuditsMetadataState({error:e,loading:!1}))}}function*Yh(){yield No(Fh.loadAuditsMetadata,Jh)}function*Qh(){yield $i(Fh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=jh;yield $i(Fh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield $i(Fh.setAuditsMetadataState({error:e,loading:!1}))}}function*Xh(){yield No(Fh.loadAuditsMetadata,Qh)}var Zh={sagas:function*(){yield Fi([Vi(zh),Vi(Yh)])},mockSagas:function*(){yield Fi([Vi(Hh),Vi(Xh)])},storeName:Tt,initialState:Mh,reducer:Nh,actions:Fh};const em={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:tm,actions:nm,reducer:im}=ot({name:"audits",initialState:em,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=P({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),om=P({},nm,{initData:nt(`${tm}/initData`),loadAudits:nt(`${tm}/loadAudits`),removeFilter:nt(`${tm}/removeFilter`),filterData:nt(`${tm}/filterData`),exportCSV:nt(`${tm}/exportCSV`),deleteAudits:nt(`${tm}/deleteAudits`)}),am=()=>Ki((e=>e[tm]));function*rm(){const{sortBy:e,sortDirection:t}=yield am();try{const n=yield Vi(Bu.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield $i(om.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield $i(om.loadItemFailedAction(t))}}function*lm(){try{const e=yield Vi(Bu.metadata.getAuditsMetadata);yield $i(om.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield $i(om.loadItemFailedAction(t))}}const sm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*cm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield am(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield am():{rowsData:[]};try{const e=sm(t),{data:l,total:d}=yield Vi(Bu.audits.getAudits,P({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield $i(om.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield $i(om.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield $i(om.loadItemFailedAction(t))}}function*um(){yield $i(om.startLoading()),yield Fi([rm(),lm(),cm({payload:{onlyOneLoad:!1},type:""})]),yield $i(om.finishLoading())}function*dm({payload:e}){const{filters:t}=yield am(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield $i(om.setFilterData(i))}function*ym({payload:e}){const{filters:t}=yield am();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield $i(om.setFilterData(i))}function*fm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield am(),a=sm(e);yield $i(om.startDownloadingCsv());try{yield Bu.audits.exportAudits(P({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield $i(om.stopDownloadingCsv())}}function*gm(){yield $o(om.initData,um),yield $o(om.removeFilter,dm),yield $o(om.filterData,ym),yield $o([om.loadAudits,om.textSearch,om.onPageChange],cm),yield $o([om.setFilterData,om.setDataSorting,om.startRefresh],(()=>cm({payload:{appendMode:!1},type:""}))),yield $o(om.exportCSV,fm)}const pm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Sm={initData:()=>P({},pm),setConnectivityState:(e,{payload:t})=>P({},e,t),cleanWebhookTestData:e=>P({},e,{testResult:void 0}),cleanWebhookLogsData:e=>P({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return P({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>P({},e,{error:void 0}),cleanSlackData:e=>P({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>P({},e,{retryResult:P({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>P({},e,{retryResult:P({},e.retryResult,t)})}},vm={loadSlackActions:nt("connectivity/loadSlackActions"),loadDataAction:nt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:nt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:nt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:nt("connectivity/loadScope"),deleteWebhookConfigAction:nt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:nt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:nt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},hm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:mm,actions:bm}=ot({name:kt,initialState:hm,reducers:P({},Sm)}),Am=P({},bm,vm),km={slack:Bu.connectivity.getSlackConfiguration,email:Bu.connectivity.getEmailConfiguration,sms:Bu.connectivity.getSMSConfiguration,webhook:Bu.connectivity.getWebhooksConfigurations,categories:Bu.connectivity.getCategories,channelMap:Bu.connectivity.getChannelMaps},Tm={slack:Bu.connectivity.postSlackConfiguration,email:Bu.connectivity.postEmailConfiguration,sms:Bu.connectivity.postSMSConfiguration,webhook:Bu.connectivity.postWebhooksConfiguration},Pm=["email","slack","sms","webhook"],Im={sms:{title:"connectivity.sms",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"sms"},email:{title:"common.email",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"email"},slack:{title:"connectivity.slack",events:e=>{var t;return(null==e||null==(t=e.slackSubscriptions)?void 0:t.length)||0},isActive:e=>{var t;return null!=(t=!(null==e||!e.slackSubscriptions.some((({isActive:e})=>e))))&&t},image:"slack"},webhook:{title:"connectivity.webhook",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({isActive:e})=>e)))&&t},image:"webhook"}},Lm=["id"],Om=["id","enabled"],Em=["categories","channelMap"];function*wm(e){return yield Vi(Dm,{payload:{api:e},type:""})}function*Cm({payload:e=Pm}){yield $i(Am.setConnectivityState({isLoading:!0}));try{const t=yield Fi([...e.map(wm),yield Dm({payload:{api:"categories"},type:""}),yield function*(){return(yield Fi(e.map((function*(e){return yield Dm({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>P({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Dm({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?P({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Im[e[o]].events(i),active:Im[e[o]].isActive(i),platform:Im[e[o]].title,image:Im[e[o]].image}]}):n:P({},n,{[`${Em[o-e.length]}`]:i})),{list:[],webhook:n});yield $i(Am.setConnectivityState(P({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield $i(Am.setConnectivityState({isLoading:!1}))}}function*Dm({payload:{api:e,params:t}}){try{return yield Vi(km[e],t)}catch(e){return}}function*Rm(){try{yield $i(Am.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Vi(Bu.connectivity.getSlackChannels);yield $i(Am.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield $i(Am.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*_m(e,t){const{connectivity:{list:n}}=yield Ki(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Im[e].isActive(t);o!==i.active&&(yield $i(Am.setConnectivityState({list:n.map((t=>t.key===e?P({},t,{active:o}):t))})))}function*Um({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ki((e=>e.connectivity));try{if(yield $i(Am.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ki();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Fi([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Zn(e,Lm);return n===t.id&&JSON.stringify(P({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Vi(Tm.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Vi(Bu.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ki(),{processIds:i}=yield Ki((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Fi([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Vi("email"===t?Bu.connectivity.postEmailConfiguration:Bu.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,l=Zn(o,Om);return yield Fi([yield Vi("email"===t?Bu.connectivity.patchEmailConfiguration:Bu.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Vi("email"===t?Bu.connectivity.putEmailSubscriptions:Bu.connectivity.putSMSSubscriptions,a,i,P({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Vi("email"===t?Bu.connectivity.deleteEmailSubscriptions:Bu.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Dm({payload:{api:t},type:""});yield $i(Am.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield _m(t,e)}else yield $i(Am.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Vi(Tm[e],t),!["sms","email"].includes(e)){const o=yield Dm({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield $i(Am.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield _m(e,o),null==n||n(!0)}}catch(e){var o;yield $i(Am.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Mm({payload:e}){try{yield Bu.connectivity.postSlackCode(e)}catch{}yield $i(Am.setConnectivityState({error:void 0,isSaving:!1}))}function*Nm(){const{slackChannels:e}=yield Ki((e=>e.connectivity));try{yield $i(Am.setConnectivityState({slackChannels:P({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Vi(Bu.connectivity.getSlackScope);yield $i(Am.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield $i(Am.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*$m({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ki((e=>e.connectivity));try{yield $i(Am.setConnectivityState({isSaving:!0})),yield Vi(Bu.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Dm({payload:{api:"webhook"},type:""});o&&(yield $i(Am.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Fm({payload:e}){try{yield $i(Am.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Vi(Bu.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield $i(Am.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield $i(Am.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield $i(Am.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*xm({payload:e}){try{const{statusCode:t}=yield Vi(Bu.connectivity.postWebhookRetry,e);yield $i(Am.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield $i(Am.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Vm({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ki((e=>e.connectivity));try{yield $i(Am.setConnectivityState({webhookLogs:P({},i,{isLoading:!0})}));const o=yield Vi(Bu.connectivity.getWebhookLog,e,n,t);yield $i(Am.setConnectivityState({error:void 0,webhookLogs:P({isLoading:!1},o)}))}catch(e){yield $i(Am.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var jm={sagas:function*(){yield No(Am.loadDataAction,Cm),yield $o(Am.loadSlackActions,Rm),yield No(Am.postDataAction,Um),yield No(Am.postCodeAction,Mm),yield No(Am.loadScope,Nm),yield No(Am.deleteWebhookConfigAction,$m),yield No(Am.postWebhookTestAction,Fm),yield No(Am.postWebhookRetryAction,xm),yield $o(Am.loadWebhookLogsAction,Vm)},storeName:kt,initialState:hm,reducer:mm,actions:Am};function Wm(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,t.payload)}}}function Km(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>P({},n,{[e]:t(n[e],i)})}}function Gm(e){return Km(e,((e,t)=>P({},e,{loading:t.payload})))}function Bm(e){return Km(e,((e,t)=>P({},e,{error:t.payload,loading:!1})))}const zm={loading:!1,error:null,fetching:!0,plans:[]},{actions:qm,reducer:Hm,name:Jm}=ot({name:"subscriptions/plans",initialState:zm,reducers:P({},Wm())}),Ym=P({loadPlans:nt(`${Jm}/loadPlans`)},qm),Qm={loading:!1,error:null,fetching:!0,config:null},Xm=P({},Wm()),{actions:Zm,reducer:eb,name:tb}=ot({name:"subscriptions/config",initialState:Qm,reducers:Xm}),nb=P({loadPaymentConfiguration:nt(`${tb}/loadPaymentConfiguration`)},Zm),ib={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},ob=P({},Wm(),{setCancellationLoading:Gm("cancellation"),setCancellationError:Bm("cancellation"),setRenewalLoading:Gm("renewal"),setRenewalError:Bm("renewal")}),{reducer:ab,actions:rb,name:lb}=ot({name:"subscriptions/billing/subscription",initialState:ib,reducers:ob}),sb=P({load:nt(`${lb}/loadSubscription`),cancelSubscription:nt(`${lb}/cancelSubscription`),renewSubscription:nt(`${lb}/renewSubscription`)},rb),cb={loading:!1,error:null,fetching:!0},ub=P({},Wm()),{reducer:db,actions:yb,name:fb}=ot({name:"subscriptions/billing/information",initialState:cb,reducers:ub}),gb=P({loadBillingInformation:nt(`${fb}/loadBillingInformation`),cancelSubscription:sb.cancelSubscription,renewSubscription:sb.renewSubscription},yb),pb={loading:!1,error:null,fetching:!0},Sb=P({},Wm(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,t.payload)}}),{reducer:vb,actions:hb,name:mb}=ot({name:"subscriptions/billing/payment",initialState:pb,reducers:Sb}),bb=P({loadPaymentMethod:nt(`${mb}/loadPaymentMethod`),submitPaymentMethod:nt(`${mb}/submitPaymentMethod`),submitPaymentMethodError:nt(`${mb}/submitPaymentMethodError`),submitPaymentMethodSuccess:nt(`${mb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:nt(`${mb}/updateBillingDetails`,(e=>({payload:e})))},hb),Ab={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},kb=P({},Wm(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{invoiceDownload:P({},e.invoiceDownload,t.payload)})}}),{reducer:Tb,actions:Pb,name:Ib}=ot({name:"subscriptions/billing/invoices",initialState:Ab,reducers:kb}),Lb=P({loadInvoices:nt(`${Ib}/loadInvoices`),downloadInvoice:nt(`${Ib}/downloadInvoice`,(e=>({payload:e})))},Pb),Ob={information:cb,invoices:Ab,paymentMethod:pb,subscription:ib},Eb={invoices:Lb,information:gb,paymentMethod:bb,subscription:sb},wb=Ne({invoices:Tb,information:db,paymentMethod:vb,subscription:ab}),Cb={fetching:!0,loading:!1,error:null,confirmed:!1},Db=P({},Wm()),{actions:Rb,reducer:_b,name:Ub}=ot({name:"subscriptions/checkout",initialState:Cb,reducers:Db}),Mb=P({loadCheckout:nt(`${Ub}/loadCheckout`),resetCheckout:nt(`${Ub}/resetCheckout`),submitCheckout:nt(`${Ub}/submitCheckout`),confirmCheckout:nt(`${Ub}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:nt(`${Ub}/errorCheckout`,(e=>({payload:e})))},Rb),Nb={loading:!1,error:null,cardSetupIntentSecret:null},$b=P({},Wm()),{reducer:Fb,actions:xb,name:Vb}=ot({name:"subscriptions/stripe",initialState:Nb,reducers:$b}),jb=P({loadCustomer:nt(`${Vb}/loadCustomer`),createCardSetupIntentSecret:nt(`${Vb}/createCardSetupIntentSecret`)},xb),Wb={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Kb,reducer:Gb,name:Bb}=ot({name:"subscriptions/vendorPublicConfig",initialState:Wb,reducers:P({},Wm())}),zb=P({loadVendorPublicConfiguration:nt(`${Bb}/loadVendorPublicConfiguration`)},Kb),qb={config:Qm,plans:zm,checkout:Cb,billing:Ob,stripe:Nb,vendorPublicConfig:Wb},Hb={config:nb,billing:Eb,plans:Ym,checkout:Mb,stripe:jb,vendorPublicConfig:zb},Jb=Ne({config:eb,billing:wb,plans:Hm,checkout:_b,stripe:Fb,vendorPublicConfig:Gb});let Yb,Qb,Xb;function Zb({policy:e}){return{policy:Xb.AT_PERIOD_END}}function eA(e){switch(e){case Su.ACTIVE:return Qb.ACTIVE;case Su.INCOMPLETE:return Qb.INCOMPLETE;case Su.CANCELED:return Qb.CANCELED;case Su.EXPIRED:return Qb.EXPIRED;case Su.TRIALING:return Qb.TRIALING;default:return Qb.EXPIRED}}!function(e){e.STRIPE="Stripe"}(Yb||(Yb={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(Qb||(Qb={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Xb||(Xb={}));const tA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Su.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},nA=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],iA=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],oA=[{id:"id",externalId:"externalId",type:vu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],aA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*rA(){yield No(sb.load,lA),yield No(sb.cancelSubscription,cA),yield No(sb.renewSubscription,uA)}function*lA(){const e=yield Ki((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield pA(e)}function*sA(){yield $i(sb.setLoading(!0));try{const[e]=yield Vi(Bu.subscriptions.getManagedSubscriptions);yield $i(sb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield $i(sb.setError(e))}}function*cA(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $i(sb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $i(sb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Su.ACTIVE)try{yield $i(sb.setCancellationLoading(!0)),yield Vi(Bu.subscriptions.cancelManagedSubscription,t),yield sA(),yield $i(sb.setCancellationLoading(!1))}catch(e){yield $i(sb.setCancellationError(e.message))}}function*uA(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield $i(sb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield $i(sb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===hu.AT_PERIOD_END)try{yield $i(sb.setRenewalLoading(!0)),yield Vi(Bu.subscriptions.renewManagedSubscription,t),yield sA(),yield $i(sb.setRenewalLoading(!1))}catch(e){yield $i(sb.setCancellationError(e.message))}}function*dA(){yield $i(sb.setLoading(!0)),yield Gi(500),yield $i(sb.setState({subscription:tA,fetching:!1,loading:!1,error:null}))}function*yA(){yield No(sb.load,dA)}function*fA(){yield No(gb.loadBillingInformation,gA)}function*gA(){yield function*(e){const t=yield Ki((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ki((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield pA(n,!1):yield $i(gb.setError(t?"Not authorized":"Internal feature failure"))}()}function*pA(e,t){yield $i(gb.setLoading(!0));try{var n,i;const o=yield Vi(Bu.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Vi(Bu.subscriptions.getSubscriptionPlan,a):([,l]=yield Fi([Vi(sA),Vi(Bu.subscriptions.getSubscriptionPlan,a)]),s=yield Ki((e=>e.subscriptions.billing.subscription.subscription||null))),yield $i(gb.setState(P({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?Qb.ACTIVE:eA(s.status),cancellation:s.cancellation&&Zb(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield $i(gb.setError(e.message))}}function*SA(){yield function*(){var e,t;yield $i(gb.setLoading(!0)),yield Gi(500),yield $i(gb.setState({loading:!1,fetching:!1,summary:{subscriptionId:tA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:mu.Stripe,externallyManaged:!1,currentPlanId:nA[0].id,defaultPlanId:nA[0].id},plan:P({},nA[0],{price:null==(e=nA[0].price)?void 0:e.amount,currency:null==(t=nA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*vA(){yield No(gb.loadBillingInformation,SA)}function*hA(){yield No(bb.loadPaymentMethod,mA),yield No(bb.submitPaymentMethod,AA),yield No(bb.submitPaymentMethodError,kA),yield No(bb.submitPaymentMethodSuccess,TA),yield No(bb.updatePaymentMethodBillingDetails,bA)}function*mA(){yield $i(bb.setLoading(!0));try{const e=(yield Vi(Bu.subscriptions.getPaymentMethods))[0];yield $i(bb.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield $i(bb.setError(e.message))}}function*bA({payload:e}){yield $i(bb.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Vi(Bu.subscriptions.updatePaymentMethodBillingDetails,t,P({email:n},i)),yield Vi(mA),null==o||o(!0)}catch(e){yield $i(bb.setError(e.message)),null==o||o(!1)}yield $i(bb.setLoading(!1))}function*AA(){yield $i(bb.setLoading(!0))}function*kA({payload:e}){yield $i(bb.setError(e))}function*TA(){yield $i(bb.loadPaymentMethod())}function*PA(){yield $i(bb.setLoading(!0)),yield Gi(500);const e=oA[0];yield $i(bb.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*IA(){yield No(bb.loadPaymentMethod,PA)}function*LA(){yield No(Lb.loadInvoices,OA),yield No(Lb.downloadInvoice,EA)}function*OA(){yield $i(Lb.setLoading(!0));try{const e=(yield Vi(Bu.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield $i(Lb.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield $i(Lb.setError(e.message))}}function*EA({payload:e}){yield $i(Lb.setInvoiceDownloadState({loading:!0,error:null}));try{yield Vi(Bu.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield $i(Lb.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield $i(Lb.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*wA(){yield $i(Lb.setLoading(!0)),yield Gi(500),yield $i(Lb.setState({loading:!1,fetching:!1,invoices:iA.map((e=>P({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield $i(Lb.setLoading(!1))}function*CA(){yield No(Lb.loadInvoices,wA)}function*DA(){yield Fi([Vi(fA),Vi(hA),Vi(LA),Vi(rA)])}function*RA(){yield Fi([Vi(vA),Vi(IA),Vi(CA),Vi(yA)])}function*_A(){yield No(Mb.loadCheckout,UA),yield No(Mb.resetCheckout,MA),yield No(Mb.submitCheckout,NA),yield No(Mb.confirmCheckout,$A),yield No(Mb.errorCheckout,xA)}function*UA(){yield $i(Mb.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*MA(){yield $i(Mb.setState({loading:!1,error:null,confirmed:!1}))}function*NA(){yield $i(Mb.setState({loading:!0,error:null}))}function*$A({payload:{paymentMethodId:e,planId:t}}){const n=yield Ki((e=>e.subscriptions.billing.subscription.subscription)),i=yield Ki((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Su.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield $i(Mb.setState({loading:!0,error:null})),o&&a)return yield FA(),void(yield $i(sb.setState({subscription:P({},n,{status:Su.ACTIVE})})));try{yield Vi(Bu.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Fi([gA(),mA(),OA()]),yield FA()}catch(e){yield $i(Mb.setState({loading:!1,error:e.message}))}}else yield $i(Mb.setState({loading:!1,error:"Subscription not found"}))}function*FA(){yield $i(Mb.setState({loading:!1,error:null,confirmed:!0}))}function*xA({payload:e}){yield $i(Mb.setState({loading:!1,error:e}))}function*VA(){yield No(Mb.resetCheckout,MA)}function*jA(){yield No(Ym.loadPlans,WA)}function*WA(){yield $i(Ym.setLoading(!0));try{const e=(yield Vi(Bu.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield $i(Ym.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield $i(Ym.setError(e.message))}}function*KA(){yield $i(Ym.setLoading(!0)),yield Gi(500),yield $i(Ym.setState({fetching:!1,loading:!1,plans:nA.map((e=>{var t,n;return P({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*GA(){yield No(Ym.loadPlans,KA)}function*BA(){yield No(nb.loadPaymentConfiguration,zA)}function*zA(){yield $i(nb.setLoading(!0));try{(yield Vi(Bu.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===mu.Stripe))?yield function*(){yield $i(nb.setLoading(!0));try{const e=yield Vi(Bu.subscriptions.getStripePaymentProviderConfiguration);yield $i(nb.setState({loading:!1,fetching:!1,config:{paymentProvider:Yb.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield $i(nb.setError(e.message))}}():yield $i(nb.setError("Payment provider not configured"))}catch(e){yield $i(nb.setError(e.message))}}function*qA(){yield $i(nb.setLoading(!0)),yield Gi(500),yield $i(nb.setState({loading:!1,fetching:!1,config:{paymentProvider:Yb.STRIPE,apiKey:""}}))}function*HA(){yield No(nb.loadPaymentConfiguration,qA)}function*JA(){yield No(jb.createCardSetupIntentSecret,YA)}function*YA({payload:e}){yield $i(jb.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Vi(Bu.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield $i(jb.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield $i(jb.setError(e.message))}}function*QA(){yield No(zb.loadVendorPublicConfiguration,XA)}function*XA(){yield $i(zb.setLoading(!0));try{const e=yield Vi(Bu.subscriptions.getVendorPublicConfigurations);yield $i(zb.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield $i(zb.setError(e.message))}}function*ZA(){yield $i(zb.setLoading(!0)),yield Gi(500),yield $i(zb.setState({fetching:!1,loading:!1,vendorPublicConfig:aA}))}function*ek(){yield No(zb.loadVendorPublicConfiguration,ZA)}var tk={sagas:function*(){yield Fi([Vi(DA),Vi(_A),Vi(jA),Vi(BA),Vi(JA),Vi(QA)])},mockSagas:function*(){yield Fi([Vi(RA),Vi(VA),Vi(GA),Vi(HA),Vi(ek)])},reducer:Jb,actions:Hb,initialState:qb,storeName:"subscriptions"},nk={sagas:function*(){yield No($d.loadVendorPublicInfo,Fd)},storeName:Pt,initialState:Ud,reducer:Md,actions:$d};const{reducer:ik}=ot({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(xo.setContext(t),P({},e,{context:t}))}}}),ok=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||xo.setContext(e.context);const t=Oo(),h=[...et({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=tt({middleware:h,preloadedState:{root:P({},e,{previewMode:n,urlStrategy:r}),[Oh.storeName]:P({},Oh.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:P({},Oh.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Zh.storeName]:P({},Zh.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:P({},Zh.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:P({},Zh.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[tm]:P({},em,null!=(v=null==o?void 0:o.audits)?v:{}),[jm.storeName]:jm.initialState,[tk.storeName]:tk.initialState,[nk.storeName]:nk.initialState},reducer:Ne({root:ik,[Oh.storeName]:Oh.reducer,[Zh.storeName]:Zh.reducer,[tm]:im,[jm.storeName]:jm.reducer,[tk.storeName]:tk.reducer,[nk.storeName]:nk.reducer})});const m=function*(){yield Fi([Vi(Oh.sagas),Vi(Zh.sagas),Vi(gm),Vi(jm.sagas),Vi(tk.sagas),Vi(nk.sagas)])},b=function*(){yield Fi([Vi(Oh.mockSagas),Vi(Zh.mockSagas),Vi(tk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Vn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var ak=n(714),rk=n.n(ak);function lk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function sk(e){if(e.type)return e;if("#"===e.charAt(0))return sk(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function ck(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function uk(e){if(0===e.indexOf("#"))return e;const{values:t}=sk(e);return`#${t.map(((e,t)=>function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(3===t?Math.round(255*e):e))).join("")}`}function dk(e,t){if(e=sk(e),t=lk(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return ck(e)}function yk(e,t){if(e=sk(e),t=lk(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return ck(e)}const fk=e=>{if(e)return{main:e,light:uk(yk(e,.4)),dark:uk(dk(e,.15)),hover:uk(dk(e,.15)),active:uk(dk(e,.2))}},gk=e=>{if(e)return{main:e,light:yk(e,.7),dark:dk(e,.2)}},pk=(e,t)=>{var n,i,o,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?P({},t,{palette:{primary:P({},fk(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:P({},fk(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:P({},fk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:P({},gk(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:P({},gk(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:P({},gk(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:P({},gk(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Sk={},vk={},hk={},mk={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class bk{constructor(){this._theme=Sk,this._themeV2=vk,this._navigation=mk,this._localizations=hk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new bk;return n.set(e),bk._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,l;this._navigation=rk().all([null!=(t=mk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=rk().all([null!=(i=Sk)?i:{},pk(null==e?void 0:e.theme,Sk)]),this._themeV2=rk().all([null!=(o=vk)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=rk().all([null!=(r=hk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=mk,this._theme=Sk,this._themeV2=vk,this._localizations=hk}}}bk._instances={};var Ak={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on"},kk=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},Tk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},Pk=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let Ik,Lk,Ok,Ek,wk,Ck,Dk,Rk,_k;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(Ik||(Ik={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Lk||(Lk={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Ok||(Ok={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Ek||(Ek={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(wk||(wk={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Ck||(Ck={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(Dk||(Dk={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(Rk||(Rk={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(_k||(_k={}));const Uk={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},Mk={hidden:"hidden",edit:"edit"};var Nk="6.50.0",$k=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];b(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(Nk),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=L(E().mark((function e(){var t,n,i,o,a;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Go,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:bk.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=Ak,e.next=13;break;case 4:return e.prev=4,e.next=7,Uu();case 7:l.flags=e.sent,e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 13:case"end":return e.stop()}}),e,null,[[4,10]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=kk(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=P({},t,{contextOptions:P({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?P({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:ok({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),T.setInstance(c,this)}var t,n,i,o;return k(e,[{key:"initContainers",value:(o=L(E().mark((function e(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;bk.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:h,FronteggTypes:m})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=L(E().mark((function e(){var t;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=L(E().mark((function e(t){var n;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,P({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),Fk=function(){function e(){b(this,e)}return k(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=T.getInstance(i);e&&t?(xo.setAccessToken(t),xo.setUser(P({},n,{accessToken:t})),o.store.dispatch(Vn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Vn.loadTenants())):(xo.setAccessToken(null),xo.setUser(null),o.store.dispatch(Vn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),xk=function(){function e(){b(this,e)}return k(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).hideAdminPortal()}}]),e}(),Vk=function(){function e(){b(this,e)}return k(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";T.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).hideCheckoutDialog()}}]),e}(),jk=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},Wk=function(){function e(t,n,i,o){b(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:ok({context:a},this,!0,void 0,void 0,!0),this.options=P({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new $k(this.options,t,!0),bk.set({},t)}var t;return k(e,[{key:"render",value:(t=L(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,Pk(this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setStaticRoute",value:function(e){var t;null==(t=this.setRoute)||t.call(this,e)}},{key:"unmount",value:function(){try{var e;null==(e=this.app.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin Portal renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}}]),e}(),Kk="modern",Gk=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[Kk]},Bk=function(){function e(t,n,i,o){b(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:ok({context:a},this,!0,void 0,void 0,!0),this.options=P({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new $k(this.options,t,!0),bk.set({},t)}var t;return k(e,[{key:"render",value:(t=L(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,Pk(this);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"unmount",value:function(){try{var e;null==(e=this.app.loginBoxRenderer)||e.unmount()}catch(e){console.error("Failed to unmount login box renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}},{key:"setStaticRoute",value:function(e){var t;this.setRoute||console.warn("this.setRoute is not defined yet"),null==(t=this.setRoute)||t.call(this,e)}},{key:"setStore",value:function(e){this.store.dispatch({type:"auth/setState",payload:e})}}]),e}();function zk(e,t){return zk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zk(e,t)}function qk(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zk(e,t)}function Hk(e){return Hk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hk(e)}function Jk(e,t){if(t&&("object"===Hk(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Yk(e){return Yk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yk(e)}function Qk(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Xk(e,t,n){return Xk=Qk()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&zk(o,n.prototype),o},Xk.apply(null,arguments)}function Zk(e){var t="function"==typeof Map?new Map:void 0;return Zk=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Xk(e,arguments,Yk(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),zk(n,e)},Zk(e)}function eT(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=Yk(e);if(t){var o=Yk(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return Jk(this,n)}}var tT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new $k(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){qk(n,e);var t=eT(n);function n(){var e;b(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return k(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=T.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=Tk(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=Tk(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=Tk(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=Tk(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=Tk(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=Tk(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(Zk(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return Zk},AdminPortalRenderer:function(){return nT},AppHolder:function(){return T},CheckoutDialog:function(){return eT},FronteggApp:function(){return Qk},HostedLogin:function(){return Xk},LoginBoxRenderer:function(){return aT},defaultTheme:function(){return iT},getThemeAdminByName:function(){return tT},getThemeByName:function(){return oT},initialize:function(){return pT}});var e={};n.r(e),n.d(e,{Delete:function(){return Qo},Get:function(){return qo},Patch:function(){return Jo},Post:function(){return Ho},PostDownload:function(){return Xo},Put:function(){return Yo},getBaseUrl:function(){return Bo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Ra},getSubTenantsAsTree:function(){return _a},getTenants:function(){return Da},switchTenant:function(){return Ca}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return or},SocialLoginProviders:function(){return ir},acceptInvitation:function(){return Pr},activateAccount:function(){return br},bulkCreateIPRestriction:function(){return Xa},changePhoneNumber:function(){return cs},changePhoneNumberWithVerification:function(){return ls},checkIfAllowToRememberMfaDevice:function(){return Nl},createDomainRestriction:function(){return za},createIPRestriction:function(){return Qa},createOrUpdateSessionConfigrations:function(){return Ll},createSSOConfiguration:function(){return jl},createSSOConfigurationByMetadata:function(){return Gl},createSSODomain:function(){return zl},createSSOGroup:function(){return Ql},createSamlGroup:function(){return yl},deleteAllSessionsForUser:function(){return El},deleteDomainRestriction:function(){return Ha},deleteIPRestriction:function(){return er},deleteSSOConfiguration:function(){return Kl},deleteSSODomain:function(){return ql},deleteSSOGroup:function(){return Zl},deleteSamlGroup:function(){return gl},deleteSessionForUser:function(){return Ol},deleteTenantApiToken:function(){return _l},deleteUserApiToken:function(){return Ul},disableMFAAuthenticatorApp:function(){return jr},disableMFASMS:function(){return Kr},disableMFAWebAuthn:function(){return Br},disableMfa:function(){return Vr},enrollMFAAuthenticatorApp:function(){return Ur},enrollMFAAuthenticatorAppForLogin:function(){return Hr},enrollMFASMS:function(){return Nr},enrollMFASMSForLogin:function(){return Qr},enrollMFAWebAuthn:function(){return Fr},enrollMFAWebAuthnForLogin:function(){return tl},enrollMfa:function(){return Rr},exchangeOAuthTokens:function(){return is},forgotPassword:function(){return Er},generateLoginResponse:function(){return dr},generateLoginResponseFromOAuthResponse:function(){return fr},generateLoginResponseV2:function(){return yr},getActivateAccountStrategy:function(){return Ar},getCaptchaPolicy:function(){return Va},getCurrentUserSession:function(){return Tl},getCurrentUserSessions:function(){return kl},getDomainRestrictions:function(){return Ga},getDomainRestrictionsConfig:function(){return Ba},getGlobalSecurityPolicy:function(){return Ua},getIPRestrictions:function(){return Ja},getIPRestrictionsConfig:function(){return Ya},getLockoutPolicy:function(){return Fa},getMFADevices:function(){return zr},getMFAStrategiesConfig:function(){return ps},getMfaPolicy:function(){return Ma},getOidcConfiguration:function(){return pl},getPasswordConfigPolicy:function(){return Ka},getPasswordHistoryPolicy:function(){return ja},getSSOConfigurations:function(){return Vl},getSSODefaultRoles:function(){return Jl},getSSOGroups:function(){return es},getSSOPublicConfiguration:function(){return Sl},getSamlConfiguration:function(){return ol},getSamlRoles:function(){return cl},getSamlRolesGroups:function(){return ul},getSamlVendorConfiguration:function(){return rl},getSessionConfigurations:function(){return Il},getSocialLoginProviders:function(){return vl},getSocialLoginProvidersV2:function(){return hl},getTenantApiTokensData:function(){return Cl},getUserApiTokensData:function(){return wl},getUserById:function(){return Ml},getVendorConfig:function(){return bl},getVendorMfaPolicy:function(){return Na},getVendorPublicAuthStrategiesConfig:function(){return gs},loadPasswordConfig:function(){return Cr},login:function(){return hr},loginViaSocialLogin:function(){return ml},loginWithMfa:function(){return mr},logout:function(){return Or},oidcPostLogin:function(){return vr},oidcPostLoginV2:function(){return ns},passwordlessPostLogin:function(){return Fl},passwordlessPreLogin:function(){return $l},postLogin:function(){return Sr},preDisableMFASMS:function(){return Wr},preDisableMFAWebAuthn:function(){return Gr},preEnrollMFAAuthenticatorApp:function(){return _r},preEnrollMFAAuthenticatorAppForLogin:function(){return qr},preEnrollMFASMS:function(){return Mr},preEnrollMFASMSForLogin:function(){return Yr},preEnrollMFAWebAuthn:function(){return $r},preEnrollMFAWebAuthnForLogin:function(){return el},preLogin:function(){return gr},preLoginV2:function(){return ts},preLoginWithIdpType:function(){return pr},preVerifyMFASMSForLogin:function(){return Xr},preVerifyMFAWebAuthnForLogin:function(){return nl},recoverMfaToken:function(){return Dr},refreshToken:function(){return Ir},refreshTokenV2:function(){return Lr},resendActivationEmail:function(){return kr},resendInvitationEmail:function(){return Tr},resetPassword:function(){return wr},resetPhoneNumber:function(){return as},revokeSessionsForUser:function(){return Pl},saveLockoutPolicy:function(){return xa},saveMfaPolicy:function(){return $a},savePasswordHistoryPolicy:function(){return Wa},setSSODefaultRoles:function(){return Yl},signUpUser:function(){return Al},silentOAuthRefreshToken:function(){return os},testCurrentIp:function(){return tr},testCurrentIpInAllowList:function(){return nr},updateDomainRestrictionConfig:function(){return qa},updateIPRestrictionConfig:function(){return Za},updateSSOConfiguration:function(){return Wl},updateSSOConfigurationByMetadata:function(){return Bl},updateSSOGroup:function(){return Xl},updateSamlConfiguration:function(){return al},updateSamlGroup:function(){return fl},updateSamlRoles:function(){return dl},updateSamlVendorMetadata:function(){return ll},updateTenantApiTokensData:function(){return Rl},updateUserApiTokensData:function(){return Dl},validateSSODomain:function(){return Hl},validateSamlDomain:function(){return sl},verifyChangePhoneNumber:function(){return ss},verifyInviteToken:function(){return xl},verifyMFAAuthenticatorAppForLogin:function(){return Jr},verifyMFASMSForLogin:function(){return Zr},verifyMFAWebAuthnForLogin:function(){return il},verifyMfa:function(){return xr},verifyNewDeviceSession:function(){return fs},verifyResetPhoneNumber:function(){return rs},webAuthnCreateNewDeviceSession:function(){return ys},webAuthnPostLogin:function(){return ds},webAuthnPreLogin:function(){return us}});var a={};n.r(a),n.d(a,{addUser:function(){return As},changePassword:function(){return ms},createInviteUserLink:function(){return Ps},deleteInviteUserLink:function(){return Ls},deleteUser:function(){return ks},getInviteLinkConfiguration:function(){return Es},getInviteUserLink:function(){return Os},getProfile:function(){return Ss},loadAvailablePermissions:function(){return Cs},loadAvailableRoles:function(){return ws},loadStats:function(){return Ds},loadUsers:function(){return bs},resendActivationLink:function(){return Rs},resendInvitationLink:function(){return _s},resendInvitationLinkToAllTenants:function(){return Us},updateInviteUserLink:function(){return Is},updateProfile:function(){return vs},updateProfileImage:function(){return hs},updateUser:function(){return Ts}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return xs},getCurrentUserIpMetadata:function(){return Ns},getIpAdressMetadata:function(){return Vs},getNotificationsMetadata:function(){return $s},getSamlMetadata:function(){return Fs}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Hs},getReport:function(){return Bs},getReports:function(){return Gs},renderReport:function(){return zs},scheduleReport:function(){return qs},sendReport:function(){return Js}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Ys},markAllAsRead:function(){return Zs},updateNotificationIsPinned:function(){return Xs},updateNotificationStatus:function(){return Qs}});var c={};n.r(c),n.d(c,{exportAudits:function(){return ic},getAudits:function(){return tc},getAuditsStats:function(){return nc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return vc},deleteEmailSubscriptions:function(){return pc},deleteSMSConfiguration:function(){return Tc},deleteSMSSubscriptions:function(){return Ac},deleteSlackConfiguration:function(){return uc},deleteWebhooksConfiguration:function(){return Lc},getCategories:function(){return Cc},getChannelMaps:function(){return Dc},getEmailConfiguration:function(){return yc},getSMSConfiguration:function(){return hc},getSlackChannels:function(){return sc},getSlackConfiguration:function(){return rc},getSlackScope:function(){return lc},getWebhookLog:function(){return Oc},getWebhooksConfigurations:function(){return Pc},patchEmailConfiguration:function(){return gc},patchSMSConfiguration:function(){return bc},postEmailConfiguration:function(){return fc},postSMSConfiguration:function(){return mc},postSlackCode:function(){return dc},postSlackConfiguration:function(){return cc},postWebhookRetry:function(){return wc},postWebhookTest:function(){return Ec},postWebhooksConfiguration:function(){return Ic},putEmailSubscriptions:function(){return Sc},putSMSSubscriptions:function(){return kc}});var d={};n.r(d),n.d(d,{getSettings:function(){return _c},updateSettings:function(){return Rc}});var y={};n.r(y),n.d(y,{addRole:function(){return Fc},attachPermissionToRoles:function(){return Kc},attachPermissionsToRole:function(){return jc},deleteRole:function(){return xc},getPermissionCategories:function(){return Gc},getPermissions:function(){return Wc},getRoles:function(){return $c},updateRole:function(){return Vc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return ku},ISubscriptionStatus:function(){return bu},PaymentMethodType:function(){return Au},ProviderType:function(){return Tu},TenantCreatedAction:function(){return Iu},TrialEndAction:function(){return Pu},cancelManagedSubscription:function(){return Xc},cancelSubscription:function(){return qc},createStripeCustomer:function(){return yu},createStripePaymentMethodSetupIntentSecret:function(){return gu},createSubscription:function(){return uu},createTenantConfiguration:function(){return vu},getManagedSubscription:function(){return Yc},getManagedSubscriptions:function(){return Qc},getPaymentMethod:function(){return su},getPaymentMethods:function(){return lu},getPaymentProviders:function(){return hu},getStripeCustomer:function(){return du},getStripePaymentProviderConfiguration:function(){return fu},getSubscription:function(){return zc},getSubscriptionInvoice:function(){return ou},getSubscriptionInvoicePdf:function(){return au},getSubscriptionInvoices:function(){return iu},getSubscriptionPlan:function(){return nu},getSubscriptionPlans:function(){return tu},getSubscriptionSummaries:function(){return pu},getSubscriptions:function(){return Bc},getTenantConfiguration:function(){return Su},getVendorPublicConfigurations:function(){return mu},renewManagedSubscription:function(){return Zc},renewSubscription:function(){return Hc},updateManagedSubscription:function(){return eu},updatePaymentMethodBillingDetails:function(){return cu},updateSubscription:function(){return Jc}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Du}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Mu},addUserToTenantAndSubTenants:function(){return _u},loadAllUsers:function(){return Ru},removeUserFromTenantAndSubTenants:function(){return Uu},removeUserRolesFromSubTenants:function(){return Nu},setUserRolesForSubTenants:function(){return $u}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Fu}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Ku},createConfiguration:function(){return ju},deleteConfiguration:function(){return Wu},getConfigs:function(){return xu},updateConfiguration:function(){return Vu}});var h={};n.r(h),n.d(h,{AuthStrategyEnum:function(){return or},ContextHolder:function(){return Wo},FronteggApiError:function(){return Go},FronteggContext:function(){return Ko},ISubscriptionCancellationPolicy:function(){return ku},ISubscriptionStatus:function(){return bu},MFAStrategyEnum:function(){return Eu},PaymentMethodType:function(){return Au},ProviderType:function(){return Tu},RestrictionType:function(){return Rn},ScimConnectionSource:function(){return Ju},SecondaryAuthStrategy:function(){return Lu},SocialLoginProviders:function(){return ir},TenantType:function(){return Cu},UserManagedByEnum:function(){return wu},WebAuthnDeviceType:function(){return Ou},api:function(){return Yu},countConfigurationUsers:function(){return Ku},createConfiguration:function(){return ju},default:function(){return Qu},deleteConfiguration:function(){return Wu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Gu},fronteggRefreshTokenUrl:function(){return Bu},fronteggSilentRefreshTokenUrl:function(){return zu},fronteggTenantsUrl:function(){return Hu},fronteggUsersUrl:function(){return qu},getConfigs:function(){return xu},loadFeatureFlags:function(){return Fu},updateConfiguration:function(){return Vu}});var m={};function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function k(e,t,n){return t&&A(e.prototype,t),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(m),n.d(m,{AccountPageFields:function(){return jk},DomainRestrictionsTabFields:function(){return zk},GeneralSettingsTabFields:function(){return Gk},InviteUserModalFields:function(){return Vk},IpRestrictionsTabFields:function(){return Bk},Metadata:function(){return _k},PrivacyPageFields:function(){return xk},ProfilePageFields:function(){return Fk},SecurityPageTabs:function(){return Wk},SessionManagementTabFields:function(){return Kk},SsoPageTabs:function(){return qk},fieldAppearance:function(){return Hk},tabAppearance:function(){return Jk}});var T=function(){function e(){b(this,e)}return k(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function P(){return P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},P.apply(this,arguments)}function I(e,t,n,i,o,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,o)}function L(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){I(a,i,o,r,l,"next",e)}function l(e){I(a,i,o,r,l,"throw",e)}r(void 0)}))}}T._apps={};var O=n(841),E=n.n(O);function w(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function C(e){return!!e&&!!e[Se]}function D(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===ve}(e)||Array.isArray(e)||!!e[pe]||!!e.constructor[pe]||$(e)||F(e))}function R(e,t,n){void 0===n&&(n=!1),0===_(e)?(n?Object.keys:he)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function _(e){var t=e[Se];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:$(e)?2:F(e)?3:0}function U(e,t){return 2===_(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function M(e,t,n){var i=_(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function N(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function $(e){return de&&e instanceof Map}function F(e){return ye&&e instanceof Set}function x(e){return e.o||e.t}function V(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=me(e);delete t[Se];for(var n=he(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function j(e,t){return void 0===t&&(t=!1),K(e)||C(e)||!D(e)||(_(e)>1&&(e.set=e.add=e.clear=e.delete=W),Object.freeze(e),t&&R(e,(function(e,t){return j(t,!0)}),!0)),e}function W(){w(2)}function K(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function G(e){var t=be[e];return t||w(18,e),t}function B(){return ce}function z(e,t){t&&(G("Patches"),e.u=[],e.s=[],e.v=t)}function q(e){H(e),e.p.forEach(Y),e.p=null}function H(e){e===ce&&(ce=e.l)}function J(e){return ce={p:[],l:ce,h:e,m:!0,_:0}}function Y(e){var t=e[Se];0===t.i||1===t.i?t.j():t.O=!0}function Q(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||G("ES5").S(t,e,i),i?(n[Se].P&&(q(t),w(4)),D(e)&&(e=X(t,e),t.l||ee(t,e)),t.u&&G("Patches").M(n[Se].t,e,t.u,t.s)):e=X(t,n,[]),q(t),t.u&&t.v(t.u,t.s),e!==ge?e:void 0}function X(e,t,n){if(K(t))return t;var i=t[Se];if(!i)return R(t,(function(o,a){return Z(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ee(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=V(i.k):i.o;R(3===i.i?new Set(o):o,(function(t,a){return Z(e,i,o,t,a,n)})),ee(e,o,!1),n&&e.u&&G("Patches").R(i,n,e.u,e.s)}return i.o}function Z(e,t,n,i,o,a){if(C(o)){var r=X(e,o,a&&t&&3!==t.i&&!U(t.D,i)?a.concat(i):void 0);if(M(n,i,r),!C(r))return;e.m=!1}if(D(o)&&!K(o)){if(!e.h.F&&e._<1)return;X(e,o),t&&t.A.l||ee(e,o)}}function ee(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&j(t,n)}function te(e,t){var n=e[Se];return(n?x(n):e)[t]}function ne(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function ie(e){e.P||(e.P=!0,e.l&&ie(e.l))}function oe(e){e.o||(e.o=V(e.t))}function ae(e,t,n){var i=$(t)?G("MapSet").N(t,n):F(t)?G("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:B(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ae;n&&(o=[i],a=ke);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):G("ES5").J(t,n);return(n?n.A:B()).p.push(i),i}function re(e){return C(e)||w(22,e),function e(t){if(!D(t))return t;var n,i=t[Se],o=_(t);if(i){if(!i.P&&(i.i<4||!G("ES5").K(i)))return i.t;i.I=!0,n=le(t,o),i.I=!1}else n=le(t,o);return R(n,(function(t,o){i&&function(e,t){return 2===_(e)?e.get(t):e[t]}(i.t,t)===o||M(n,t,e(o))})),3===o?new Set(n):n}(e)}function le(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return V(e)}var se,ce,ue="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),de="undefined"!=typeof Map,ye="undefined"!=typeof Set,fe="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ge=ue?Symbol.for("immer-nothing"):((se={})["immer-nothing"]=!0,se),pe=ue?Symbol.for("immer-draftable"):"__$immer_draftable",Se=ue?Symbol.for("immer-state"):"__$immer_state",ve=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),he="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,me=Object.getOwnPropertyDescriptors||function(e){var t={};return he(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},be={},Ae={get:function(e,t){if(t===Se)return e;var n=x(e);if(!U(n,t))return function(e,t,n){var i,o=ne(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!D(i)?i:i===te(e.t,t)?(oe(e),e.o[t]=ae(e.A.h,i,e)):i},has:function(e,t){return t in x(e)},ownKeys:function(e){return Reflect.ownKeys(x(e))},set:function(e,t,n){var i=ne(x(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=te(x(e),t),a=null==o?void 0:o[Se];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(N(n,o)&&(void 0!==n||U(e.t,t)))return!0;oe(e),ie(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==te(e.t,t)||t in e.t?(e.D[t]=!1,oe(e),ie(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=x(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){w(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){w(12)}},ke={};R(Ae,(function(e,t){ke[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ke.deleteProperty=function(e,t){return ke.set.call(this,e,t,void 0)},ke.set=function(e,t,n){return Ae.set.call(this,e[0],t,n,e[0])};var Te=function(){function e(e){var t=this;this.g=fe,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&w(6),void 0!==i&&"function"!=typeof i&&w(7),D(e)){var l=J(t),s=ae(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?q(l):H(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(l,i),Q(e,l)}),(function(e){throw q(l),e})):(z(l,i),Q(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ge&&(r=void 0),t.F&&j(r,!0),i){var u=[],d=[];G("Patches").M(e,r,u,d),i(u,d)}return r}w(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){D(e)||w(8),C(e)&&(e=re(e));var t=J(this),n=ae(this,e,void 0);return n[Se].C=!0,H(t),n},t.finishDraft=function(e,t){var n=(e&&e[Se]).A;return z(n,t),Q(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!fe&&w(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=G("Patches").$;return C(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Pe=new Te,Ie=Pe.produce,Le=(Pe.produceWithPatches.bind(Pe),Pe.setAutoFreeze.bind(Pe),Pe.setUseProxies.bind(Pe),Pe.applyPatches.bind(Pe),Pe.createDraft.bind(Pe),Pe.finishDraft.bind(Pe),Ie);function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function we(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var De="function"==typeof Symbol&&Symbol.observable||"@@observable",Re=function(){return Math.random().toString(36).substring(7).split("").join(".")},_e={INIT:"@@redux/INIT"+Re(),REPLACE:"@@redux/REPLACE"+Re(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Re()}};function Ue(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Me(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ce(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ce(1));return n(Me)(e,t)}if("function"!=typeof e)throw new Error(Ce(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Ce(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ce(4));if(s)throw new Error(Ce(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ce(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ue(e))throw new Error(Ce(7));if(void 0===e.type)throw new Error(Ce(8));if(s)throw new Error(Ce(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ce(10));o=e,y({type:_e.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ce(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[De]=function(){return this},e}return y({type:_e.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[De]=g,i}function Ne(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:_e.INIT}))throw new Error(Ce(12));if(void 0===n(void 0,{type:_e.PROBE_UNKNOWN_ACTION()}))throw new Error(Ce(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ce(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function $e(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ce(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=$e.apply(void 0,a)(n.dispatch),we(we({},n),{},{dispatch:i})}}}function xe(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ve=xe();Ve.withExtraArgument=xe;var je,We=Ve,Ke=(je=function(e,t){return je=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},je(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}je(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ge=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Be=Object.defineProperty,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),qe=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Je=function(e,t,n){return t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ye=function(e,t){for(var n in t||(t={}))qe.call(t,n)&&Je(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],He.call(t,n)&&Je(e,n,t[n]);return e},Qe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?$e:$e.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Xe=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ke(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Ge([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ge([void 0],e.concat(this))))},t}(Array);function Ze(e){return D(e)?Le(e,(function(){})):e}function et(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Xe);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(We):i.push(We.withExtraArgument(n.extraArgument))),i}function tt(e){var t,n=function(e){return et(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ne(a)}var g=l;"function"==typeof g&&(g=g(n));var p=Fe.apply(void 0,g),S=$e;c&&(S=Qe(Ye({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ge([p],f):"function"==typeof f&&(v=f(v)),Me(t,d,S.apply(void 0,v))}function nt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Ye(Ye({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function it(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ot(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:Ze(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?it(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Ye(Ye({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?it(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return Ze(e())};else{var c=Ze(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ge([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var i;if(C(e))return void 0===(i=n(e,t))?e:i;if(D(e))return Le(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=i?nt(c,i):nt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var at="listenerMiddleware";nt(at+"/add"),nt(at+"/removeAll"),nt(at+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Se];return Ae.get(t,e)},set:function(t){var n=this[Se];Ae.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Se];if(!o.P)switch(o.i){case 5:i(o)&&ie(o);break;case 4:n(o)&&ie(o)}}}function n(e){for(var t=e.t,n=e.k,i=he(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Se){var r=t[a];if(void 0===r&&!U(t,a))return!0;var l=n[a],s=l&&l[Se];if(s?s.t!==r:!N(l,r))return!0}}var c=!!t[Se];return i.length!==he(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){be[e]||(be[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=me(n);delete a[Se];for(var r=he(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:B(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Se,{value:a,writable:!0}),o},S:function(e,n,o){o?C(n)&&n[Se].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Se];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)R(a,(function(t){t!==Se&&(void 0!==o[t]||U(o,t)?r[t]||e(a[t]):(r[t]=!0,ie(n)))})),R(o,(function(e){void 0!==a[e]||U(a,e)||(r[e]=!1,ie(n))}));else if(5===l){if(i(n)&&(ie(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const rt=(e,t)=>n=>P({},n,{[e]:t[e]}),lt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>P({},t,{[e]:P({},t[e],n)})}),st=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return P({},n,{[e]:P({},n[e],{[t]:P({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return P({},t,{[e]:P({},t[e],{loaders:P({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return P({},t,{[e]:P({},t[e],{errors:P({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),dt=(e=500)=>new Promise((t=>setTimeout(t,e))),yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ft=new Uint8Array(256);for(let e=0;e<yt.length;e++)ft[yt.charCodeAt(e)]=e;const gt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=ft[e.charCodeAt(i)],a=ft[e.charCodeAt(i+1)],r=ft[e.charCodeAt(i+2)],l=ft[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=yt[t[i]>>2],o+=yt[(3&t[i])<<4|t[i+1]>>4],o+=yt[(15&t[i+1])<<2|t[i+2]>>6],o+=yt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=pt(e[n]);return t}return e};let St,vt,ht;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor"}(St||(St={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(vt||(vt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(ht||(ht={}));const mt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",bt="HOSTED_LOGIN_VERIFIER_KEY",At="auth",kt="connectivity",Tt="auditLogs",Pt="vendor",It={flow:vt.Login,step:St.preLogin,loading:!1,email:"",tenants:[]},Lt={setLoginState:lt("loginState"),resetLoginState:rt("loginState",{loginState:It})},Ot={requestAuthorize:nt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:nt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:nt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:nt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:nt("auth/afterAuthNavigation"),preLogin:nt("auth/preLogin",(e=>({payload:e}))),postLogin:nt("auth/postLogin",(e=>({payload:e}))),login:nt("auth/login",(e=>({payload:e}))),loginWithMfa:nt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:nt("auth/recoverMfa",(e=>({payload:e}))),logout:nt("auth/logout",(e=>({payload:e}))),silentLogout:nt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:nt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:nt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:nt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:nt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:nt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:nt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:nt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:nt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:nt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:nt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:nt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:nt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:nt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:nt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:nt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:nt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:nt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:nt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:nt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:nt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:nt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Et;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Et||(Et={}));const wt={step:Et.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Ct={setActivateState:lt("activateState"),resetActivateState:rt("activateState",{activateState:wt}),setActivateStrategyState:st("activateState","activationStrategy")},Dt={activateAccount:nt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:nt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:nt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:nt("auth/resendActivationEmail",(e=>({payload:e})))};let Rt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Rt||(Rt={}));const _t={step:Rt.validate},Ut={setAcceptInvitationState:lt("acceptInvitationState"),resetAcceptInvitationState:rt("acceptInvitationState",{acceptInvitationState:_t})},Mt={acceptInvitation:nt("auth/acceptInvitation",(e=>({payload:e})))};let Nt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Nt||(Nt={}));const $t={step:Nt.forgotPassword,loading:!1,email:"",passwordConfig:null},Ft={setForgotPasswordState:lt("forgotPasswordState"),resetForgotPasswordState:rt("forgotPasswordState",{forgotPasswordState:$t})},xt={forgotPassword:nt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:nt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:nt("auth/loadPasswordConfig",(e=>({payload:e})))};let Vt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Vt||(Vt={}));const jt={step:Vt.ResetPhoneNumber,loading:!1},Wt={setResetPhoneNumberState:lt("resetPhoneNumberState"),resetResetPhoneNumberState:rt("resetPhoneNumberState",{resetPhoneNumberState:jt})},Kt={resetPhoneNumber:nt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:nt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:nt("auth/changePhoneNumber",(e=>({payload:e})))},Gt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Bt={setSSOLoader:ct("ssoState"),setSSOError:ut("ssoState"),setSSOState:lt("ssoState"),resetSSOState:rt("ssoState",{ssoState:Gt})},zt={loadSSOConfigurationsV2:nt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:nt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:nt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:nt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:nt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:nt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:nt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:nt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:nt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:nt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:nt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:nt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:nt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:nt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:nt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:nt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:nt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:nt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:nt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:nt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:nt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:nt("auth/oidcPostlogin",(e=>({payload:e})))},qt={loading:!1,error:null},Ht={setProfileState:lt("profileState"),resetProfileState:rt("profileState",{profileState:qt})},Jt={loadProfile:nt("auth/loadProfile"),saveProfile:nt("auth/saveProfile",(e=>({payload:e}))),changePassword:nt("auth/changePassword",(e=>({payload:e})))};let Yt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Yt||(Yt={}));const Qt={step:Yt.verify,loading:!1,saving:!1},Xt={setMfaState:lt("mfaState"),resetMfaState:rt("mfaState",{mfaState:Qt})},Zt={enrollMfa:nt("auth/enrollMfa"),getMFADevices:nt("auth/getMFADevices"),getMFAStrategies:nt("auth/getMFAStrategies"),verifyMfa:nt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:nt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:nt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:nt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:nt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:nt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:nt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:nt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:nt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:nt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:nt("auth/disableMfaWebAuthn",(e=>({payload:e})))},en={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},tn={setTeamLoader:ct("teamState"),setTeamError:ut("teamState"),setTeamState:lt("teamState"),resetTeamState:rt("teamState",{teamState:en})},nn={loadUsers:nt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:nt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:nt("auth/loadRoles",(e=>({payload:e}))),addUser:nt("auth/addUser",(e=>({payload:e}))),addUsersBulk:nt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:nt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:nt("auth/updateUser",(e=>({payload:e}))),deleteUser:nt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:nt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:nt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:nt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:nt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:nt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:nt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:nt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:nt("auth/getInvitationLink"),createInvitationLink:nt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:nt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:nt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:nt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:nt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:nt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:nt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:nt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:nt("auth/closeLockUserDialog",(e=>({payload:e})))},on={firstLoad:!0,loading:!1,error:""},an={setSocialLoginsState:lt("socialLoginState"),resetSocialLoginsState:rt("socialLoginState",{socialLoginState:on})},rn={loadSocialLoginsConfiguration:nt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:nt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:nt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:nt("auth/setSocialLoginError",(e=>({payload:e})))};let ln;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(ln||(ln={}));const sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:ln.SignUp},cn={setSignUpState:lt("signUpState"),resetSignUpState:rt("signUpState",{signUpState:sn})},un={signUpUser:nt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:nt("auth/resetSignUpStateSoft")},dn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},yn={setApiTokensLoader:ct("apiTokensState"),setApiTokensError:ut("apiTokensState"),setApiTokensState:lt("apiTokensState"),resetApiTokensState:rt("apiTokensState",{apiTokensState:dn})},fn={loadApiTokens:nt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:nt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:nt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:nt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:nt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:nt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:nt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:nt("auth/deleteTenantApiToken",(e=>({payload:e})))},gn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},pn={setSecurityPolicyState:lt("securityPolicyState"),setSecurityPolicyGlobalState:st("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:st("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:st("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:st("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:st("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:st("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:st("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:st("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:st("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:rt("securityPolicyState",{securityPolicyState:gn})},Sn={loadSecurityPolicy:nt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:nt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:nt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:nt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:nt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:nt("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:nt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:nt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:nt("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:nt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:nt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:nt("auth/loadPublicAuthStrategiesPolicy")},vn={loading:!1},hn={setAccountSettingsState:lt("accountSettingsState"),resetAccountSettingsState:rt("accountSettingsState",{accountSettingsState:vn})},mn={loadAccountSettings:nt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:nt("auth/saveAccountSettings",(e=>({payload:e})))},bn={tenants:[],subTenants:[],loading:!0,tenantTree:null},An={setTenantsState:lt("tenantsState"),resetTenantsState:rt("tenantsState",{tenantsState:bn})},kn={switchTenant:nt("auth/switchTenant",(e=>({payload:e}))),loadTenants:nt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:nt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:nt("auth/loadSubTenantsTree",(e=>({payload:e})))},Tn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Pn={setRolesState:lt("rolesState"),resetRolesState:rt("rolesState",{rolesState:Tn})},In={loadRolesAndPermissions:nt("auth/loadRoles",(e=>({payload:e}))),addRole:nt("auth/addRole",(e=>({payload:e}))),updateRole:nt("auth/updateRole",(e=>({payload:e}))),deleteRole:nt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:nt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:nt("auth/attachPermissionToRoles",(e=>({payload:e})))},Ln={loading:!1,sessions:[]},On={setSessionsState:lt("sessionsState"),resetSessionsState:rt("sessionsState",{sessionsState:Ln})},En={loadUserSessions:nt("auth/loadUserSessions"),loadCurrentUserSession:nt("auth/loadCurrentUserSession"),deleteUserSession:nt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:nt("auth/deleteAllUserSessions"),revokeUserSessions:nt("auth/revokeUserSessions",(e=>({payload:e})))},wn={loading:!1,configurations:{}},Cn={setSessionsPolicyState:lt("sessionsPolicyState"),resetSessionsPolicyState:rt("sessionsPolicyState",{sessionsPolicyState:wn})},Dn={loadSessionsPolicy:nt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:nt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Rn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Rn||(Rn={}));const _n={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Rn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Un={setRestrictionsState:lt("restrictionsState"),setIpRestrictionsState:st("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:st("restrictionsState","emailDomainRestrictions")},Mn={checkIfUserIpValid:nt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:nt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:nt("auth/loadIpRestrictions"),saveIpRestriction:nt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:nt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:nt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:nt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:nt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:nt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:nt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Nn={loading:!1},$n={setProvisioningState:lt("provisioningState"),resetProvisioningState:rt("provisioningState",{provisioningState:Nn})},Fn={loadProvisionConnections:nt("auth/loadProvisionConnections"),createProvisionConnection:nt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:nt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:nt("auth/updateProvisionConnection",(e=>({payload:e})))},xn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:sn,loginState:It,activateState:wt,acceptInvitationState:_t,forgotPasswordState:$t,ssoState:Gt,profileState:qt,mfaState:Qt,teamState:en,socialLoginState:on,apiTokensState:dn,securityPolicyState:gn,accountSettingsState:vn,tenantsState:bn,rolesState:Tn,resetPhoneNumberState:jt,sessionsState:Ln,sessionsPolicyState:wn,restrictionsState:_n,provisioningState:Nn},Vn=P({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},xn),{reducer:jn,actions:Wn}=ot({name:At,initialState:Vn,reducers:P({resetState:e=>P({},e,xn),setState:(e,{payload:t})=>P({},e,t),setUser:("user",(e,{payload:t})=>P({},e,{user:t}))},Lt,an,Ct,Ut,Ft,Wt,cn,Ht,Bt,Xt,tn,yn,pn,hn,An,Pn,On,Cn,Un,$n)});const Kn=P({},Wn,Ot,rn,Dt,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,En,Dn,Mn,Fn);var Gn=function(e){return"@@redux-saga/"+e},Bn=Gn("CANCEL_PROMISE"),zn=Gn("CHANNEL_END"),qn=Gn("IO"),Hn=Gn("MATCH"),Jn=Gn("MULTICAST"),Yn=Gn("SAGA_ACTION"),Qn=Gn("SELF_CANCELLATION"),Xn=Gn("TASK"),Zn=Gn("TASK_CANCEL"),ei=Gn("TERMINATE"),ti=Gn("LOCATION");function ni(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var ii=function(e){return null==e},oi=function(e){return null!=e},ai=function(e){return"function"==typeof e},ri=function(e){return"string"==typeof e},li=Array.isArray,si=function(e){return e&&ai(e.then)},ci=function(e){return e&&ai(e.next)&&ai(e.throw)},ui=function e(t){return t&&(ri(t)||fi(t)||ai(t)||li(t)&&t.every(e))},di=function(e){return e&&ai(e.take)&&ai(e.close)},yi=function(e){return ai(e)&&e.hasOwnProperty("toString")},fi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},gi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Bn]=function(){clearTimeout(n)},i},pi=function(e){return function(){return e}},Si=pi(!0),vi=function(){},hi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var mi=function(e,t){P(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function bi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ai=function(e){throw e},ki=function(e){return{value:e,done:!0}};function Ti(e,t,n){void 0===t&&(t=Ai),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:ki,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Pi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ii=function(e){return Array.apply(null,new Array(e))},Li=function(e){return function(t){return e(Object.defineProperty(t,Yn,{value:!0}))}},Oi=function(e){return e===ei},Ei=function(e){return e===Zn},wi=function(e){return Oi(e)||Ei(e)};function Ci(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=li(e)?Ii(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||wi(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=vi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Di(e){return{name:e.name||"anonymous",location:Ri(e)}}function Ri(e){return e[ti]}var _i=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Ui="TAKE",Mi="CALL",Ni="FORK",$i="SELECT",Fi=function(e,t){var n;return(n={})[qn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function xi(e,t){return void 0===e&&(e="*"),ui(e)?(oi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Fi(Ui,{pattern:e})):di(n=e)&&n[Jn]&&oi(t)&&ui(t)?Fi(Ui,{channel:e,pattern:t}):di(e)?(oi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Fi(Ui,{channel:e})):void 0;var n}function Vi(e,t){return ii(t)&&(t=e,e=void 0),Fi("PUT",{channel:e,action:t})}function ji(e){var t=Fi("ALL",e);return t.combinator=!0,t}function Wi(e,t){var n,i=null;return ai(e)?n=e:(li(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ri(n)&&ai(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Ki(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fi(Mi,Wi(e,n))}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fi(Ni,Wi(e,n))}function Bi(e){return void 0===e&&(e=Qn),Fi("CANCEL",e)}function zi(e){void 0===e&&(e=hi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Fi($i,{selector:e,args:n})}var qi=Ki.bind(null,gi);var Hi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ji=[],Yi=0;function Qi(e){try{eo(),e()}finally{to()}}function Xi(e){Ji.push(e),Yi||(eo(),no())}function Zi(e){try{return eo(),e()}finally{no()}}function eo(){Yi++}function to(){Yi--}function no(){var e;for(to();!Yi&&void 0!==(e=Ji.shift());)Qi(e)}var io=function(e){return function(t){return e.some((function(e){return so(e)(t)}))}},oo=function(e){return function(t){return e(t)}},ao=function(e){return function(t){return t.type===String(e)}},ro=function(e){return function(t){return t.type===e}},lo=function(){return Si};function so(e){var t="*"===e?lo:ri(e)?ao:li(e)?io:yi(e)?ao:ai(e)?oo:fi(e)?ro:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var co={type:zn},uo=function(e){return e&&e.type===zn};function yo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(co)}))},(e={})[Jn]=!0,e.put=function(e){if(!t)if(uo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Hn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=lo),t?e(co):(e[Hn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),bi(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Yn]?l(e):Xi((function(){l(e)}))},r}function fo(e,t){var n=e[Bn];ai(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var go,po=0,So=function(){return++po};function vo(e){e.isRunning()&&e.cancel()}var ho=((go={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!uo(e)||r?n(e):n(ei)};try{o.take(l,oi(a)?so(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},go.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Xi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&si(t)?fo(t,n):n(t)}))},go.ALL=function(e,t,n,i){var o=i.digestEffect,a=po,r=Object.keys(t);if(0!==r.length){var l=Ci(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(li(t)?[]:{})},go.RACE=function(e,t,n,i){var o=i.digestEffect,a=po,r=Object.keys(t),l=li(t)?Ii(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||wi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=vi,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},go.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(si(s))return void fo(s,n);if(ci(s))return void Eo(e,s,l.context,po,Di(a),!1,n);n(s)}catch(e){n(e,!0)}},go.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){ii(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},go.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(ci(o))return o;var a=!1;return Ti((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!si(o)})}))}catch(e){return Ti((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Di(t)}(c,a);Zi((function(){var t=Eo(e,c,s.context,po,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},go.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&bi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(li(t)){if(0===t.length)return void n([]);var r=Ci(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},go.CANCEL=function(e,t,n,i){var o=i.task;t===Qn?vo(o):li(t)?t.forEach(vo):vo(t),n()},go.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},go.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=_i());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(co):e.isEmpty()?(n.push(i),i.cancel=function(){bi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(co):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(co)}}}}(t.buffer),a=so(i),r=function t(n){uo(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},go.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},go.FLUSH=function(e,t,n){t.flush(n)},go.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},go.SET_CONTEXT=function(e,t,n,i){var o=i.task;mi(o.context,t),n()},go);function mo(e,t){return e+"?"+t}function bo(e){var t=e.name,n=e.location;return n?t+" "+mo(n.fileName,n.lineNumber):t}function Ao(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var ko=null,To=[],Po=function(e){e.crashedEffect=ko,To.push(e)},Io=function(){ko=null,To.length=0},Lo=function(){var e,t,n=To[0],i=To.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Ri(e))?t.code+" "+mo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+bo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+bo(e.meta)})),[Ao(To)]).join("\n")};function Oo(e,t,n,i,o,a,r){var l;void 0===r&&(r=vi);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(bi(o,t),t.cont=vi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=vi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Po({meta:o,cancelledTasks:y}),S.isRoot){var i=Lo();Io(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Zn?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[Xn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(Zn,!1))},l.cont=r,l.end=p,l.setContext=function(e){mi(f,e)},l.toPromise=function(){return d||(d=Hi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function Eo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){si(t)?fo(t,i):ci(t)?Eo(e,t,c.context,n,o,!1,i):t&&t[qn]?(0,ho[t.type])(e,t.payload,i,u):i(t)}));d.cancel=vi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(Zn))},status:0},c=Oo(e,s,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Io()):Ei(e)?(s.status=1,d.cancel(),o=ai(t.return)?t.return(Zn):{done:!0,value:Zn}):o=Oi(e)?ai(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=So();function s(n,o){a||(a=!0,i.cancel=vi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ko=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=vi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=vi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function wo(e,t){for(var n=e.channel,i=void 0===n?yo():n,o=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Pi:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=So();if(s&&(s.rootSagaStarted=s.rootSagaStarted||vi,s.effectTriggered=s.effectTriggered||vi,s.effectResolved=s.effectResolved||vi,s.effectRejected=s.effectRejected||vi,s.effectCancelled=s.effectCancelled||vi,s.actionDispatched=s.actionDispatched||vi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=$e.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=hi;var m={channel:i,dispatch:Li(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return Zi((function(){var e=Eo(m,S,l,v,Di(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Co=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?yo():a,l=n.sagaMonitor,s=ni(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=wo.bind(null,P({},s,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){mi(o,e)},c},Do=function(e){return{done:!0,value:e}},Ro={};function _o(e){return di(e)?"channel":yi(e)?String(e):ai(e)?e.name:String(e)}function Uo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===Ro)return Do(t);if(n&&!o)throw r=Ro,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===Ro?Do(t):a}return Ti(l,(function(e){return l(null,e)}),n)}function Mo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:xi(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Uo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+_o(e)+", "+t.name+")")}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:xi(e)},s=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Bi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Uo({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+_o(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:xi(e)},l=function(e){return{done:!1,value:Ki.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Uo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+_o(e)+", "+t.name+")")}function Fo(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var l={done:!1,value:Ki.apply(void 0,[n].concat(a))},s={done:!1,value:qi(t)};return Uo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Ro}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function xo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Gi.apply(void 0,[Mo,e,t].concat(i))}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Gi.apply(void 0,[No,e,t].concat(i))}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Gi.apply(void 0,[$o,e,t].concat(i))}class Wo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Wo.instance||(Wo.instance=new Wo),Wo.instance}static setContext(e){Wo.getInstance().context=e}static setAccessToken(e){Wo.getInstance().accessToken=e}static setUser(e){Wo.getInstance().user=e}static setOnRedirectTo(e){Wo.getInstance().onRedirectTo=e}static setLogout(e,t){Wo.getInstance().logout=n=>{n?e(n):Wo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Wo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Wo.getInstance().accessToken}static getUser(){return Wo.getInstance().user}static onRedirectTo(e,t){return Wo.getInstance().onRedirectTo(e,t)}static logout(e){return Wo.getInstance().logout(e)}}Wo.instance=void 0;const Ko={getContext:()=>Wo.getContext(),getAccessToken:()=>Wo.getAccessToken(),getUser:()=>Wo.getUser(),onRedirectTo:(e,t)=>Wo.onRedirectTo(e,t),logout:e=>Wo.logout(e)};class Go extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Bo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const zo=async e=>{var t,n,i;const o=Wo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Wo.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=Bo(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:P({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Go("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Go(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},qo=async(e,t,n)=>zo(P({url:e,method:"GET",contentType:"application/json",params:t},n)),Ho=async(e,t,n)=>zo(P({url:e,method:"POST",contentType:"application/json",body:t},n)),Jo=async(e,t,n)=>zo(P({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Yo=async(e,t,n)=>zo(P({url:e,method:"PUT",contentType:"application/json",body:t},n)),Qo=async(e,t,n)=>zo(P({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Xo=async(e,t,n,i)=>zo(P({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Zo={v1:"/identity/resources/users/webauthn/v1/devices"},ea={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ta={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},na={v1:"/identity/resources/configurations/v1"},ia={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},oa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},aa={v1:"/identity/resources/permissions/v1"},ra={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}}},la={v1:"/identity/resources/roles/v1"},sa={v1:"/identity/resources/sub-tenants/users/v1"},ca={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ua={v1:"/team/resources/members/v1"},da={v1:"/team/resources/roles/v1"},ya={v1:"/team/resources/stats/v1"},fa={v1:"/team/resources/profile"},ga={v1:"/tenants/resources/account-settings/v1"},pa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Sa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},va={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},ha={v1:"/subscriptions/resources/payment-providers/v1"},ma={v1:"/subscriptions/resources/subscriptions/v1"},ba={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Aa={v1:"/reports/engine/resources/triggers/v1"},ka="/notification",Ta="/audits",Pa={v1:"/event/resources/configurations/v1"},Ia="/webhook",La="/oauth",Oa="/flags",Ea="/directory/resources/v1/configurations/scim2",wa="/directory/resources/scim/temp";async function Ca(e){return Yo(`${ta.v1}/tenant`,e)}async function Da(){return qo(`${ta.v2}/me/tenants`)}async function Ra(){return qo(pa.v1)}async function _a(){return qo(pa.tree.v1)}async function Ua(){return qo(na.v1)}async function Ma(){return qo(`${na.v1}/mfa-policy`)}async function Na(){return qo(`${na.v1}/mfa-policy/vendor`)}async function $a(e){return e.id?Jo(`${na.v1}/mfa-policy`,e):Ho(`${na.v1}/mfa-policy`,e)}async function Fa(){return qo(`${na.v1}/lockout-policy`)}async function xa(e){return e.id?Jo(`${na.v1}/lockout-policy`,e):Ho(`${na.v1}/lockout-policy`,e)}async function Va(){try{return await qo(`${na.v1}/captcha-policy/public`)}catch{return null}}async function ja(){return qo(`${na.v1}/password-history-policy`)}async function Wa(e){return e.id?Jo(`${na.v1}/password-history-policy`,e):Ho(`${na.v1}/password-history-policy`,e)}async function Ka(){return qo(`${na.v1}/password`)}async function Ga(){return qo(`${ia.emailDomain.v1}`)}async function Ba(){return qo(`${ia.emailDomain.v1}/config`)}async function za(e){return Ho(`${ia.emailDomain.v1}`,e)}async function qa(e){return Ho(`${ia.emailDomain.v1}/config`,e)}async function Ha(e){return Qo(`${ia.emailDomain.v1}/${e}`)}async function Ja(e){return qo(`${ia.ip.v1}`,e)}async function Ya(){return qo(`${ia.ip.v1}/config`)}async function Qa(e){return Ho(`${ia.ip.v1}`,e)}async function Xa(e){return Ho(`${ia.ip.v1}/bulk`,e)}async function Za(e){return Ho(`${ia.ip.v1}/config`,e)}async function er(e){return Qo(`${ia.ip.v1}/${e}`)}async function tr(){return Ho(`${ia.ip.v1}/verify`)}async function nr(){return Ho(`${ia.ip.v1}/verify/allow`)}let ir,or;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack"}(ir||(ir={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(or||(or={}));class ar extends Error{constructor(e){super(e)}}const rr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ar("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class lr extends Error{constructor(e){super(e)}}const sr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(rr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return rr(t)}})(e.split(".")[n]))}catch(e){throw new lr("Invalid token specified: "+e.message)}},cr=["type"],ur=["type"];async function dr(e){if(!e.accessToken)return e;Wo.setAccessToken(e.accessToken);const t=await qo(`${ta.v2}/me`),n=P({},e,e.accessToken?sr(e.accessToken):{},t);return Wo.setUser(n),n}async function yr(e){if(!e.accessToken)return{user:e};Wo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([qo(`${ta.v2}/me`),Da()]),i=P({},e,e.accessToken?sr(e.accessToken):{},t);return Wo.setUser(i),{user:i,tenants:n}}async function fr(e){Wo.setAccessToken(e.id_token);const t=await qo(`${ta.v2}/me`),n=e.id_token?sr(e.id_token):{},i=P({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return Wo.setUser(i),i}async function gr(e){try{const{address:t}=await Ho(`${ea.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function pr(e){return Ho(`${ea.v1}/user/saml/prelogin`,e)}async function Sr(e){return dr(await Ho(`${ea.v1}/user/saml/postlogin`,e))}async function vr(e){return dr(await Ho(`${ea.v1}/user/oidc/postlogin`,e))}async function hr(e){return dr(await Ho(`${ea.v1}/user`,e))}async function mr(e){return dr(await Ho(`${ea.v1}/user/mfa/verify`,e))}async function br(e){return Ho(`${ta.v1}/activate`,e)}async function Ar(e){return qo(`${ta.v1}/activate/strategy`,e)}async function kr(e){return Ho(`${ta.v1}/activate/reset`,e)}async function Tr(e){return Ho(`${ta.v1}/invitation/reset`,e)}async function Pr(e){return Ho(`${ta.v1}/invitation/accept`,e)}async function Ir(){return dr(await Ho(`${ea.v1}/user/token/refresh`))}async function Lr(){return yr(await Ho(`${ea.v1}/user/token/refresh`))}async function Or(){return Ho(`${ea.v1}/logout`)}async function Er(e){return Ho(`${ta.v1}/passwords/reset`,e)}async function wr(e){return Ho(`${ta.v1}/passwords/reset/verify`,e)}async function Cr(e){return qo(`${ta.v1}/passwords/config`,e)}async function Dr(e){return Ho(`${ea.v1}/user/mfa/recover`,e)}async function Rr(){return Ho(`${ta.v1}/mfa/enroll`)}async function _r(){return Ho(`${ta.v1}/mfa/authenticator/enroll`)}async function Ur(e){return Ho(`${ta.v1}/mfa/authenticator/enroll/verify`,e)}async function Mr(e){return Ho(`${ta.v1}/mfa/sms/enroll`,e)}async function Nr(e){return Ho(`${ta.v1}/mfa/sms/enroll/verify`,e)}async function $r(){return Ho(`${ta.v1}/mfa/webauthn/enroll`)}async function Fr(e){return Ho(`${ta.v1}/mfa/webauthn/enroll/verify`,e)}async function xr(e){return Ho(`${ta.v1}/mfa/enroll/verify`,e)}async function Vr(e){return Ho(`${ta.v1}/mfa/disable`,e)}async function jr(e,t){return Ho(`${ta.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Wr(e){return Ho(`${ta.v1}/mfa/sms/${e}/disable`)}async function Kr(e,t){return Ho(`${ta.v1}/mfa/sms/${e}/disable/verify`,t)}async function Gr(e){return Ho(`${ta.v1}/mfa/webauthn/${e}/disable`)}async function Br(e,t){return Ho(`${ta.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function zr(){return qo(`${ta.v1}/mfa/devices`)}async function qr(e){return Ho(`${ea.v1}/user/mfa/authenticator/enroll`,e)}async function Hr(e){return Ho(`${ea.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Jr(e,t){return Ho(`${ea.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Yr(e){return Ho(`${ea.v1}/user/mfa/sms/enroll`,e)}async function Qr(e){return Ho(`${ea.v1}/user/mfa/sms/enroll/verify`,e)}async function Xr(e,t){return Ho(`${ea.v1}/user/mfa/sms/${e}`,t)}async function Zr(e,t){return Ho(`${ea.v1}/user/mfa/sms/${e}/verify`,t)}async function el(e){return Ho(`${ea.v1}/user/mfa/webauthn/enroll`,e)}async function tl(e){return Ho(`${ea.v1}/user/mfa/webauthn/enroll/verify`,e)}async function nl(e,t){return Ho(`${ea.v1}/user/mfa/webauthn/${e}`,t)}async function il(e,t){return Ho(`${ea.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ol(){return qo(`${ca.v1}/saml/configurations`)}async function al(e){return Ho(`${ca.v1}/saml/configurations`,e)}async function rl(){return qo(`${ca.v1}/saml/configurations/vendor-config`)}async function ll(e){return Yo(`${ca.v1}/saml/configurations/metadata`,e)}async function sl(){return Yo(`${ca.v1}/saml/validations/domain`)}async function cl(){return qo(`${ca.v1}/saml/configurations/roles/default`)}async function ul(){return qo(`${ca.v2}/saml/configurations/groups`)}async function dl({roleIds:e}){return Ho(`${ca.v1}/saml/configurations/roles/default`,{roleIds:e})}async function yl({roleIds:e,group:t}){return Ho(`${ca.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function fl({roleIds:e,group:t,id:n}){return Jo(`${ca.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function gl({id:e}){return Qo(`${ca.v2}/saml/configurations/groups/${e}`)}async function pl(){return qo(`${ca.v1}/oidc/configurations`)}async function Sl(){return qo(`${ca.v2}/configurations/public`)}async function vl(){return qo(oa.v1)}async function hl(){return qo(oa.v2)}async function ml({provider:e,code:t,redirectUri:n,codeVerifier:i,metadata:o,invitationToken:a,state:r}){const l={code:t};return n&&(l.redirectUri=n),i&&(l.code_verifier=i),r&&(l.state=r),Ho(`${ea.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:a},{params:l})}async function bl(){return qo(`${na.v1}/public`)}async function Al(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Ho(`${ta.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await dr(n):void 0,userId:i,tenantId:o}}async function kl(){return qo(ta.sessions.currentUser.v1)}async function Tl(){return qo(`${ta.sessions.currentUser.v1}/current`)}async function Pl(e){return Ho(`${ta.sessions.v1}/revoke`,{userId:e})}async function Il(){return qo(ta.sessions.configurations.v1)}async function Ll(e){await Ho(ta.sessions.configurations.v1,e)}async function Ol(e){await Qo(`${ta.sessions.currentUser.v1}/${e}`)}async function El(){await Qo(`${ta.sessions.currentUser.v1}/all`)}async function wl(){return qo(ta.apiTokens.v1)}async function Cl(){return qo(ra.apiTokens.v1)}async function Dl(e){return Ho(ta.apiTokens.v1,e)}async function Rl(e){return Ho(ra.apiTokens.v2,e)}async function _l({tokenId:e}){return Qo(`${ra.apiTokens.v1}/${e}`)}async function Ul({tokenId:e}){return Qo(`${ta.apiTokens.v1}/${e}`)}async function Ml({userId:e}){return qo(`${ta.v1}/${e}`)}async function Nl(e){return qo(`${na.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function $l(e){let{type:t}=e,n=ni(e,cr);return Ho(`${ea.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Fl(e){let{type:t}=e,n=ni(e,ur);return Ho(`${ea.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function xl({token:e}){return Ho(ra.invites.verify.v1,{token:e})}async function Vl(){return qo(`${ca.v1}/configurations`)}async function jl(e){return Ho(`${ca.v1}/configurations`,e)}async function Wl(e,t){return Jo(`${ca.v1}/configurations/${e}`,t)}async function Kl(e){return Qo(`${ca.v1}/configurations/${e}`)}async function Gl(e){return Ho(`${ca.v1}/configurations/metadata`,e)}async function Bl(e,t){return Yo(`${ca.v1}/configurations/${e}/metadata`,t)}async function zl(e,t){return Ho(`${ca.v1}/configurations/${e}/domains`,t)}async function ql(e,t){return Qo(`${ca.v1}/configurations/${e}/domains/${t}`)}async function Hl(e,t){return Yo(`${ca.v1}/configurations/${e}/domains/${t}/validate`)}async function Jl(e){return qo(`${ca.v1}/configurations/${e}/roles`)}async function Yl(e,t){return Yo(`${ca.v1}/configurations/${e}/roles`,t)}async function Ql(e,t){return Ho(`${ca.v1}/configurations/${e}/groups`,t)}async function Xl(e,{roleIds:t,group:n,id:i}){return Jo(`${ca.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Zl(e,t){return Qo(`${ca.v1}/configurations/${e}/groups/${t}`)}async function es(e){return qo(`${ca.v1}/configurations/${e}/groups`)}async function ts(e){return Ho(`${ea.v2}/user/sso/prelogin`,e)}async function ns(e){return dr(await Ho(`${ea.v2}/user/oidc/postlogin`,e))}async function is(e){return fr(await Ho(`${La}/token`,e))}async function os(){return fr(await Ho(`${La}/authorize/silent`))}async function as(e){return Ho(`${ta.v1}/phone/reset`,e)}async function rs(e){return Ho(`${ta.v1}/phone/reset/verify`,e)}async function ls(e){return Ho(`${ta.v1}/phone`,e)}async function ss(e){return Ho(`${ta.v1}/phone/verify`,e)}async function cs(e){return Yo(`${ta.v1}/phone/change`,e)}async function us(e){return Ho(`${ea.v1}/webauthn/prelogin`,e)}async function ds(e){return Ho(`${ea.v1}/webauthn/postlogin`,e)}async function ys(){return Ho(Zo.v1)}async function fs(e){return Ho(`${Zo.v1}/verify`,e)}async function gs(){return qo(`${na.v1}/auth/strategies/public`)}async function ps(){return qo(`${na.v1}/mfa/strategies`)}async function Ss(e){return qo(`${ta.v2}/me`,null!=e?e:{addRoles:!0})}async function vs(e){return Yo(`${ta.v2}/me`,e)}async function hs(e){return Yo(`${fa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ms(e){return Ho(`${ta.v1}/passwords/change`,e)}async function bs(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>P({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return qo(ua.v1,P({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function As(e){return Ho(ta.v2,P({},e,{provider:"local"}))}async function ks(e){return Qo(`${ua.v1}/${e.userId}`)}async function Ts(e){return Yo(ua.v1,e)}async function Ps(e){return Ho(ra.invites.user.v1,P({},e))}async function Is(e){return Jo(ra.invites.user.v1,P({},e))}async function Ls(){return Qo(ra.invites.user.v1)}async function Os(){return qo(ra.invites.user.v1)}async function Es(){return qo(ra.invites.configuration.v1)}async function ws(){return qo(da.v1)}async function Cs(){return qo(aa.v1)}async function Ds(){return qo(`${ya.v1}/members`)}async function Rs(e){return Ho(`${ua.v1}/${e.userId}/resendActivationEmail`,{})}async function _s(e){return Ho(ta.v2,P({},e,{provider:"local"}))}async function Us(e){return Ho(ta.invitation.resendAll.v1,P({},e))}async function Ms(e){var t,n;const i=await qo("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Ns(){const e=await qo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const $s=async()=>Ms({entityName:"notifications"}),Fs=async()=>Ms({entityName:"saml"}),xs=async()=>Ms({entityName:"audits"}),Vs=async e=>async function(e){const t=await qo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),js=["dataFilters"],Ws=["templateId","dataFilters"],Ks=["dataFilters"];async function Gs(e){return qo(`${ba.v2}/tenant-reports`,e)}async function Bs(e){return qo(`${ba.v2}/${e.id}/tenant-reports`)}async function zs(e){let{dataFilters:t}=e,n=ni(e,js);return{html:await qo(`${Aa.v1}/preview-report`,P({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function qs(e){let{templateId:t,dataFilters:n}=e,i=ni(e,Ws);return Ho(`${ba.v2}/${t}/tenant-reports`,P({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Hs(e){let{dataFilters:t}=e,n=ni(e,Ks);const i=await qo(`${Aa.v1}/preview-report`,P({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Js(e){return Ho(`${Aa.v1}/tenant-reports`,e)}async function Ys(e){return qo(ka,{params:e})}async function Qs(e){return Yo(`${ka}/status`,{params:e})}async function Xs(e){const{notificationId:t,pinStatus:n}=e;return Yo(`${ka}/${n}`,{notificationId:t})}async function Zs(){return Ho(`${ka}/status/mark-all-read`)}const ec=["endpoint","headerProps"];async function tc(e){return qo(Ta,e)}async function nc(e){return qo(`${Ta}/stats`,e)}async function ic(e){const{endpoint:t,headerProps:n}=e,i=ni(e,ec);return Xo(`${Ta}/export/${t}`,{properties:n},i)}const oc=["eventKey"],ac=["eventKey"],rc=()=>qo(`${Sa.v1}/slack`),lc=()=>qo(`${Sa.v1}/slack/applications`),sc=()=>qo(`${Sa.v1}/slack/channels`),cc=e=>e.id?Jo(`${Sa.v1}/slack/subscription/${e.id}`,e):Ho(`${Sa.v1}/slack/subscriptions`,e),uc=e=>Qo(`${Sa.v1}/slack/subscriptions/${e.id}`),dc=e=>Ho(`${Sa.v1}/slack/applications/registrations`,{code:e}),yc=()=>qo(`${Sa.v1}/emails`),fc=e=>{let{eventKey:t}=e,n=ni(e,oc);return Ho(`${Sa.v1}/emails/${t}`,n)},gc=({eventKey:e,enabled:t})=>Jo(`${Sa.v1}/emails/${e}`,{enabled:t}),pc=(e,t)=>Qo(`${Sa.v1}/emails/${e}/subscriptions/${t}`),Sc=(e,t,n)=>Yo(`${Sa.v1}/emails/${t}/subscriptions/${e}`,n),vc=e=>Qo(`${Sa.v1}/emails/${e}`),hc=()=>qo(`${Sa.v2}/sms`),mc=e=>{let{eventKey:t}=e,n=ni(e,ac);return Ho(`${Sa.v2}/sms/${t}`,n)},bc=({eventKey:e,enabled:t})=>Jo(`${Sa.v2}/sms/${e}`,{enabled:t}),Ac=(e,t)=>Qo(`${Sa.v2}/sms/${e}/subscriptions/${t}`),kc=(e,t,n)=>Yo(`${Sa.v2}/sms/${t}/subscriptions/${e}`,n),Tc=e=>Qo(`${Sa.v2}/sms/${e}`),Pc=()=>qo(Ia),Ic=e=>e._id?Jo(`${Ia}/${e._id}`,e):Ho(`${Ia}/custom`,e),Lc=e=>Qo(`${Ia}/${e}`),Oc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return qo(`${Ia}/logs/?${i.toString()}`)},Ec=e=>Ho(`${Ia}/test`,e),wc=e=>Ho(`${Ia}/logs/${e}/retries`),Cc=()=>qo(`${Pa.v1}/categories`),Dc=e=>qo(Pa.v1,{channels:e});async function Rc(e){return Yo(ga.v1,e)}async function _c(){return qo(ga.v1)}const Uc=["roleId"],Mc=["roleId"],Nc=["permissionId"];async function $c(){return qo(la.v1)}async function Fc(e){return Ho(la.v1,e)}async function xc({roleId:e}){return Qo(`${la.v1}/${e}`)}async function Vc(e){let{roleId:t}=e,n=ni(e,Uc);return Jo(`${la.v1}/${t}`,n)}async function jc(e){let{roleId:t}=e,n=ni(e,Mc);return Yo(`${la.v1}/${t}/permissions`,n)}async function Wc(){return qo(aa.v1)}async function Kc(e){let{permissionId:t}=e,n=ni(e,Nc);return Yo(`${aa.v1}/${t}/roles`,n)}async function Gc(){return qo(`${aa.v1}/categories`)}async function Bc(){return qo(va.subscriptions.v1)}async function zc(e){return qo(`${va.subscriptions.v1}/${e}`)}async function qc(e){return Yo(`${va.subscriptions.v1}/${e}/cancellations/`,{})}async function Hc(e){return Yo(`${va.subscriptions.v1}/${e}/renewals/`,{})}async function Jc(e,{paymentMethodId:t,planId:n}){return Yo(`${va.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Yc(e){return qo(`${ma.v1}/${e}`)}async function Qc(){return qo(`${ma.v1}`)}async function Xc(e){return Yo(`${ma.v1}/${e}/cancellations/`,{})}async function Zc(e){return Yo(`${ma.v1}/${e}/renewals/`,{})}async function eu(e,{paymentMethodId:t,planId:n}){return Yo(`${ma.v1}/${e}`,{paymentMethodId:t,planId:n})}async function tu(){return qo(va.plans.v1)}async function nu(e){return qo(`${va.plans.v1}/${e}`)}async function iu(){return qo(va.invoices.v1)}async function ou(e){return qo(`${va.invoices.v1}/${e}`)}async function au(e,t){return qo(`${va.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const ru=["email"];async function lu(){return qo(va.paymentMethods.v1)}async function su(e){return qo(`${va.paymentMethods.v1}/${e}`)}async function cu(e,t){let{email:n}=t,i=ni(t,ru);return Jo(`${va.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function uu(e){return Ho(va.paymentProviders.stripe.subscriptions.v1,e)}async function du(e){return qo(`${va.paymentProviders.stripe.customers.v1}/${e}`)}async function yu(e){return Ho(`${va.paymentProviders.stripe.customers.v1}`,e)}async function fu(){return qo(`${va.paymentProviders.stripe.publicConfigurations.v1}`)}async function gu(e){return Ho(`${va.paymentProviders.stripe.setupIntents.v1}`,e)}async function pu(e){return qo(`${va.summaries.v1}/${e}`)}async function Su(e){return qo(`${va.tenantConfiguration.v1}/${e}`)}async function vu(e){return Ho(`${va.tenantConfiguration.v1}`,e)}async function hu(){return qo(ha.v1)}async function mu(){return qo(`${va.configurations.vendorPublicConfigurations.v1}`)}let bu,Au,ku,Tu,Pu,Iu,Lu,Ou,Eu,wu,Cu;async function Du(){return qo("/vendors/public")}async function Ru(e){return qo(sa.v1,e)}async function _u(e){return Ho(sa.v1,e)}async function Uu(e){return Qo(sa.v1,e)}async function Mu(e,t){return Ho(`${sa.v1}/${e}/roles`,t)}async function Nu(e,t){return Qo(`${sa.v1}/${e}/roles`,t)}async function $u(e,t){return Jo(`${sa.v1}/${e}/roles`,t)}async function Fu(){return qo(Oa)}async function xu(){return qo(`${Ea}`)}async function Vu(e,t){return Jo(`${Ea}/${e}`,t)}async function ju(e){return Ho(`${Ea}`,e)}async function Wu(e){return Qo(`${Ea}/${e}`)}async function Ku(e){return qo(`${wa}/${e}/Users/count`)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(bu||(bu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Au||(Au={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(ku||(ku={})),(Tu||(Tu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Pu||(Pu={})),function(e){e.CREATE="create_customer"}(Iu||(Iu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(Lu||(Lu={})),function(e){e.Android="Android",e.USBKey="USBKey",e.TouchID="TouchID"}(Ou||(Ou={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthn="WebAuthn",e.SMS="SMS"}(Eu||(Eu={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(wu||(wu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Cu||(Cu={}));const Gu=[`${ea.v1}/logout`,`${ea.v1}/user/saml/postlogin`,`${ea.v2}/user/oidc/postlogin`,`${ea.v1}/user`,`${ea.v1}/user/mfa/verify`,`${ea.v1}/user/token/refresh`,`${ta.v1}`,`${ta.v1}/signUp`,`${ea.v1}/passwordless/magiclink/postlogin`,`${ea.v1}/passwordless/code/postlogin`,`${ea.v1}/passwordless/smscode/postlogin`,`${ta.v1}/activate`,`${ta.v1}/invitation/accept`,`${La}/token`,`${La}/authorize/silent`],Bu=`${ea.v1}/user/token/refresh`,zu=`${La}/authorize/silent`,qu=`${ta.v2}/me`,Hu=`${ta.v2}/me/tenants`;let Ju;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Ju||(Ju={}));const Yu={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v};var Qu={fetch:e,ContextHolder:Wo,FronteggContext:Ko,api:Yu,FronteggApiError:Go,AuthStrategyEnum:or,SocialLoginProviders:ir,ISubscriptionCancellationPolicy:ku,ISubscriptionStatus:bu,PaymentMethodType:Au,ProviderType:Tu};let Xu,Zu;function ed(e,t){const n=P({},e);return t.forEach((e=>{delete n[e]})),n}async function td(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function nd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(Xu||(Xu={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Zu||(Zu={}));const id=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),od={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ad=P({},od,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),rd={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},ld=P({},rd,{accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTY5YmY0Zi02YmI5LTQ5NGMtOGNkZS05MDc4NDQ0NWY4MDciLCJuYW1lIjoiRHVtbXkgVXNlciIsImVtYWlsIjoiZHVtbXlAZnJvbnRlZ2cuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm1ldGFkYXRhIjp7fSwicm9sZXMiOlsiYWRtaW4iXSwicGVybWlzc2lvbnMiOlsiZmUuKiJdLCJ0ZW5hbnRJZCI6Im15LXRlbmFudC1pZCIsInRlbmFudElkcyI6WyJteS10ZW5hbnQtaWQiXSwicHJvZmlsZVBpY3R1cmVVcmwiOiJodHRwczovL3d3dy5ncmF2YXRhci5jb20vYXZhdGFyLzQyYjJhZDJiYWQ2ZmM5YjlkYjUwODZkZmNmODA3MmFjP2Q9aHR0cHM6Ly91aS1hdmF0YXJzLmNvbS9hcGkvZmUvMTI4L3JhbmRvbT90PTE2MTcyNjE4OTA4NzU_dD0xNjE3MjYxOTE3NDM0IiwidHlwZSI6InVzZXJUb2tlbiIsImlhdCI6MTYxNzkwNjMyNCwiZXhwIjoxNjE3OTkyNzI0LCJpc3MiOiJmcm9udGVnZyJ9.paaXLkpWEWbQmUtoK2P8IwXCxK4WJp7XhXonvzF8g1I",expiresIn:86400,mfaRequired:!1,refreshToken:"refresh-token-dummy-de39dc9c-9d22-4852-b7f5-c3c0aa613b58",type:"userToken",iat:1617906324,exp:1617992724,iss:"frontegg",email_verified:!0}),sd={loading:!1,error:void 0,saving:!0,profile:rd},cd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date,allowOverrideEnforcePasswordHistory:!0,allowOverridePasswordComplexity:!1,allowOverridePasswordExpiration:!1,allowSignups:!0,apiTokensEnabled:!0,cookieSameSite:"cookieSameSite",defaultRefreshTokenExpiration:0,defaultTokenExpiration:1,publicKey:"publicKey"},ud={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:or.EmailAndPassword},dd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},yd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},fd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},gd={enabled:!0,domain:"domain",validated:!0,generatedVerification:"generatedVerification",ssoEndpoint:"ssoEndpoint",publicCertificate:"publicCertificate",signRequest:!0,createdAt:new Date,updatedAt:new Date,acsUrl:void 0,spEntityId:void 0,oidcClientId:void 0,oidcSecret:void 0,type:void 0},pd={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Sd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],vd={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:gd,roles:Sd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},hd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],md={id:"id2",email:"demo-user2@frontegg.com",name:"Demo User Name2",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,verified:!1,createdAt:(new Date).toISOString(),customData:void 0,lastLogin:void 0,mfaEnabled:void 0,roles:[]},bd={id:"id",email:"demo-user@frontegg.com",name:"Demo User Name",phone:void 0,profileImage:void 0,profileImageUrl:void 0,tenantId:"tenantId",vendorId:"vendorId",roleIds:[],activatedForTenant:!0,createdAt:new Date(2022,4,1).toISOString(),verified:!0,customData:void 0,lastLogin:new Date(2022,5,25).toISOString(),mfaEnabled:void 0,roles:[]},Ad={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},kd=[bd,md],Td=[Ad],Pd=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],Id=[{id:"laptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date,ipAddress:"190.194.88.251",current:!0},{id:"iphone",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1",createdAt:new Date(Date.now()-1e4),ipAddress:"191.49.203.21"},{id:"tablet",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; SGP771 Build/32.2.A.0.253; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36",createdAt:new Date(Date.now()-3e4),ipAddress:"130.19.196.136"},{id:"anotherlaptop",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15",createdAt:new Date(Date.now()-1002232300),ipAddress:"2.228.163.92"}],Ld={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Od={isActive:!0,strategy:Rn.ALLOW},Ed=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Rn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Rn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Rn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Rn.BLOCK,description:"IP 4"}];let wd,Cd,Dd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(wd||(wd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Cd||(Cd={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription"}(Dd||(Dd={})),Dd.profile,Dd.privacy,Dd.personalApiTokens,Dd.account,Dd.users,Dd.security,Dd.sso,Dd.audits,Dd.webhooks,Dd.apiTokens,Dd.roles,Dd.subscriptions;const Rd=["events","url"];function*_d(){yield Vi(Kn.setSignUpState({loading:!0}));try{const e=yield Ki(Yu.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield Vi(Kn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield Vi(Kn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Ud(e){let{payload:{events:t,url:n}}=e,i=ni(e.payload,Rd);yield Vi(Kn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield zi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Ki(Yu.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Cd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Wo.setAccessToken(null==l?void 0:l.accessToken),Wo.setUser(l),!r&&l&&Wy(l)){const t=yield By(l);yield Vi(Kn.setState(t)),a(e.loginUrl)}else yield Vi(Kn.setSignUpState({loading:!1,shouldActivate:r,stage:ln.SignUpSuccess})),yield Vi(Kn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield Vi(Kn.loadTenants()))}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield Vi(Kn.setSignUpState({loading:!1,error:e.message}))}yield Vi(Kn.setSignUpState({loading:!1}))}function*Md(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield zi((e=>e.auth.signUpState));yield Vi(Kn.resetSignUpState()),yield Vi(Kn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Nd(){yield jo(Kn.signUpUser,Ud),yield jo(Kn.resetSignUpStateSoft,Md)}const $d={setVendorState:(e,{payload:t})=>P({},e,t)},Fd={loadVendorPublicInfo:nt("vendor/loadVendorPublicInfo")},xd={loading:!1},{reducer:Vd,actions:jd}=ot({name:Pt,initialState:xd,reducers:P({},$d)}),Wd=P({},jd,Fd);function*Kd(){yield Vi(Wd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Yu.vendor.getVendorPublicInfo();yield Vi(Wd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Vi(Wd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Gd=["callback"],Bd=["callback"],zd=["callback"],qd=["callback"],Hd=["callback"],Jd=["callback"];function*Yd(){yield Vi(Kn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getGlobalSecurityPolicy);yield Vi(Kn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Vi(Kn.loadSecurityPolicyMfa()),yield Vi(Kn.loadSecurityPolicyVendorMfa()),yield Vi(Kn.loadSecurityPolicyLockout()),yield Vi(Kn.loadSecurityPolicyCaptcha()),yield Vi(Kn.loadPublicAuthStrategiesPolicy())}function*Qd(){yield Vi(Kn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getVendorConfig);yield Vi(Kn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Xd(){yield Vi(Kn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getVendorPublicAuthStrategiesConfig);yield Vi(Kn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Zd(){yield Vi(Kn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getMfaPolicy);yield Vi(Kn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*ey(){yield Vi(Kn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getVendorMfaPolicy);yield Vi(Kn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*ty(e){let{payload:{callback:t}}=e,n=ni(e.payload,Gd);yield Vi(Kn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ki(Yu.auth.saveMfaPolicy,n);yield Vi(Kn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ny(){yield Vi(Kn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getLockoutPolicy);yield Vi(Kn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*iy(e){let{payload:{callback:t}}=e,n=ni(e.payload,Bd);yield Vi(Kn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ki(Yu.auth.saveLockoutPolicy,n);yield Vi(Kn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*oy(){yield Vi(Kn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getCaptchaPolicy);yield Vi(Kn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*ay(){yield Vi(Kn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getPasswordHistoryPolicy);yield Vi(Kn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*ry(e){let{payload:{callback:t}}=e,n=ni(e.payload,zd);yield Vi(Kn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ki(Yu.auth.savePasswordHistoryPolicy,n);yield Vi(Kn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ly(){yield Vi(Kn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getPasswordConfigPolicy);yield Vi(Kn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*sy(){yield jo(Kn.loadSecurityPolicy,Yd),yield xo(Kn.saveSecurityPolicyMfa,ty),yield xo(Kn.loadSecurityPolicyMfa,Zd),yield xo(Kn.loadSecurityPolicyVendorMfa,ey),yield xo(Kn.saveSecurityPolicyLockout,iy),yield xo(Kn.loadSecurityPolicyLockout,ny),yield xo(Kn.loadSecurityPolicyCaptcha,oy),yield xo(Kn.saveSecurityPolicyPasswordHistory,ry),yield xo(Kn.loadSecurityPolicyPasswordHistory,ay),yield xo(Kn.loadVendorPasswordConfig,ly),yield xo(Kn.loadPublicSecurityPolicy,Qd),yield xo(Kn.loadPublicAuthStrategiesPolicy,Xd)}function*cy(){yield Vi(Kn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Vi(Kn.setSecurityPolicyPublicState({policy:ud,loading:!1}))}catch(e){yield Vi(Kn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*uy(){yield Vi(Kn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyGlobalState({policy:cd,loading:!1})),yield Vi(Kn.loadSecurityPolicyMfa()),yield Vi(Kn.loadSecurityPolicyVendorMfa()),yield Vi(Kn.loadSecurityPolicyLockout()),yield Vi(Kn.loadSecurityPolicyCaptcha())}function*dy(){yield Vi(Kn.setSecurityPolicyMfaState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyMfaState({policy:dd,loading:!1}))}function*yy(){yield Vi(Kn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyVendorMfaState({policy:dd,loading:!1}))}function*fy(e){var t;let{payload:{callback:n}}=e,i=ni(e.payload,qd);yield Vi(Kn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=P({},yd,{id:null!=(t=i.id)?t:yd.id,enforceMFAType:i.enforceMFAType});yield dt(),yield Vi(Kn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*gy(){yield Vi(Kn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyLockoutState({policy:yd,loading:!1}))}function*py(e){let{payload:{callback:t}}=e,n=ni(e.payload,Hd);yield Vi(Kn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield dt();const i=P({},n,yd,{id:n.id?n.id:yd.id});null==t||t(i),yield Vi(Kn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Sy(){yield Vi(Kn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyLockoutState({policy:yd,loading:!1}))}function*vy(){yield Vi(Kn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield dt(),yield Vi(Kn.setSecurityPolicyPasswordHistoryState({policy:fd,loading:!1}))}function*hy(e){let{payload:{callback:t}}=e,n=ni(e.payload,Jd);yield Vi(Kn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield dt();const i=P({},n,fd,{id:n.id?n.id:fd.id});null==t||t(i),yield Vi(Kn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*my(){yield jo(Kn.loadSecurityPolicy,uy),yield xo(Kn.loadPublicSecurityPolicy,cy),yield xo(Kn.saveSecurityPolicyMfa,fy),yield xo(Kn.loadSecurityPolicyMfa,dy),yield xo(Kn.loadSecurityPolicyVendorMfa,yy),yield xo(Kn.saveSecurityPolicyLockout,py),yield xo(Kn.loadSecurityPolicyLockout,gy),yield xo(Kn.loadSecurityPolicyCaptcha,Sy),yield xo(Kn.saveSecurityPolicyPasswordHistory,hy),yield xo(Kn.loadSecurityPolicyPasswordHistory,vy)}const by=["callback"],Ay=["callback"],ky=["callback"],Ty=["callback"],Py=["callback","events"],Iy=["callback"],Ly=["callback"],Oy=["callback"],Ey=["callback"],wy=["callback"],Cy=["callback"],Dy=["callback"],Ry=["callback"],_y=["callback"],Uy=["callback","deviceId"],My=["callback","deviceId"],Ny=["callback","deviceId"],$y=["callback","deviceId"],Fy={[or.Code]:St.loginWithOtc,[or.EmailAndPassword]:St.loginWithPassword,[or.MagicLink]:St.magicLinkPreLoginSuccess,[or.SmsCode]:St.loginWithSmsOtc};function*xy(){var e;const t=Wo.onRedirectTo,{routes:n,includeQueryParam:i}=yield zi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(mt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(mt),yield qi(200),Vi(Kn.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*Vy(){let e;try{var t;const n=yield Ki(Yu.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Vi(Kn.setState({ssoACS:e}))}function*jy(){try{const{isActive:e}=yield Ki(Yu.auth.getSSOPublicConfiguration);yield Vi(Kn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Wy=e=>e.mfaRequired&&e.mfaToken?(Wo.setAccessToken(null),Wo.setUser(null),!0):(Wo.setAccessToken(e.accessToken),Wo.setUser(e),!1),Ky=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Yt.authenticatorApp;if(t)return Yt.smsVerifyCode}return Yt.verify},Gy=e=>{if(1===e.length){const[t]=e;if(t===Eu.AuthenticatorApp)return Yt.authenticatorApp;if(t===Eu.SMS)return Yt.smsSetPhoneNumber}return Yt.verify};function*By(e){let t=St.loginWithTwoFactor,n={};const{loginState:i}=yield zi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Ki(Yu.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Ky(e.mfaDevices)}:(n={step:Gy(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=St.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:vt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:P({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*zy(){const{hostedLoginBox:e}=yield zi((e=>e.auth));e?yield Ki(qy):yield Ki(Hy)}function*qy(){const{user:e}=yield zi((e=>e.auth));if(null==e||!e.refreshToken)return Wo.setAccessToken(null),Wo.setUser(null),void(yield Vi(Kn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ki(Yu.auth.exchangeOAuthTokens,t);yield Vi(Kn.setState({user:n,isAuthenticated:!0})),yield Vi(Kn.loadTenants())}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield Vi(Kn.setState({user:null,isAuthenticated:!1}))}}function*Hy(){try{const n=Wo.onRedirectTo,{routes:i,loginState:o}=yield zi((e=>e.auth)),{user:a,tenants:r}=yield Ki(Yu.auth.refreshTokenV2);if(Wy(a)){const e=yield By(a);yield Vi(Kn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else{var e,t;a.id&&localStorage.setItem("userId",a.id);const l=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,s=l&&"true"!==localStorage.getItem(`${a.id}-${l}`)&&!window.location.pathname.endsWith(i.logoutUrl);yield Vi(Kn.setTenantsState({tenants:r,loading:!1})),yield Vi(Kn.setState({user:a,isAuthenticated:!0,loginState:P({},o,{quickLoginToRegister:l,flow:s?vt.RegisterQuickLogin:vt.Login})}));const c=new URL(null==(t=window)?void 0:t.location.href).searchParams.get("invitationToken"),u=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];c||u.push(i.loginUrl,i.signUpUrl),s?n(i.loginUrl):u.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?n(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield xy())}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield Vi(Kn.setState({user:void 0,isAuthenticated:!1}))}}function*Jy({payload:{callback:e}}){try{const{ip:t}=yield Ki(Yu.metadata.getCurrentUserIpMetadata);yield Vi(Kn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Yy({payload:e}){const t=[];e&&(yield Vi(Kn.setState({isLoading:!0})),yield Vi(Kn.loadSocialLoginsConfigurationV2()),t.push(Ki(_d)),t.push(Ki(Xd)),t.push(Ki(jy)),t.push(Ki(Kd)),t.push(Ki(Vy))),t.push(Ki(zy)),yield ji(t),yield Vi(Kn.setState({isLoading:!1}))}function*Qy({accessToken:e,user:t}){if(!e)return void(yield Vi(Kn.setState({user:void 0,isAuthenticated:!1})));const n=Wo.onRedirectTo,{routes:i}=yield zi((e=>e.auth));if(Wy(t)){const e=yield By(t);yield Vi(Kn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Xy({payload:e}){const t=[];yield Vi(Kn.loadSocialLoginsConfigurationV2()),t.push(Ki(_d)),t.push(Ki(jy)),t.push(Ki(Kd)),t.push(Ki(Vy)),t.push(Ki(Qy,e)),yield ji(t)}function*Zy({payload:e}){const{disableSilentRefresh:t}=yield zi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Ki(Yu.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield Vi(Kn.setState({user:e,isAuthenticated:!0})),yield Vi(Kn.loadTenants()),yield Vi(Kn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield zi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;let e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Vi(Kn.setState({isLoading:!0}));const a=nd(),r=nd(),l=yield Ki(td,r);localStorage.setItem(bt,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${Bo(n,"/oauth/authorize")}/oauth/authorize`,u=P({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*ef({payload:e}){const t=localStorage.getItem(bt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield zi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Ki(Yu.auth.exchangeOAuthTokens,a);yield Vi(Kn.setState({user:e,isAuthenticated:!0})),yield Vi(Kn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield xy()}}function*tf(e){let{payload:{callback:t}}=e,n=ni(e.payload,by);try{yield Vi(Kn.setLoginState({loading:!0}));const e=yield Ki(Yu.auth.changePhoneNumberWithVerification,n);yield Vi(Kn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:St.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1}))}}function*nf(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ay);try{yield Vi(Kn.setLoginState({loading:!0})),yield Ki(Yu.auth.verifyChangePhoneNumber,n),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=ni(e.payload,ky);try{yield Vi(Kn.setLoginState({loading:!0}));const e=yield Ki(Yu.auth.passwordlessPreLogin,P({},n,{type:or.SmsCode}));yield Vi(Kn.setLoginState({step:St.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*af(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ty);try{const{onRedirectTo:e,routes:i}=yield zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Vi(Kn.setLoginState({loading:!0}));const o=yield Ki(Yu.auth.passwordlessPreLogin,n),a=Fy[n.type];if(a===St.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield Vi(Kn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Vt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield Vi(Kn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*rf(e){let{payload:{callback:t,events:n}}=e,i=ni(e.payload,Py);try{yield Vi(Kn.setLoginState({loading:!0}));const e=yield Ki(Yu.auth.passwordlessPostLogin,i),a=Wo.onRedirectTo,{routes:r}=yield zi((e=>e.auth));if(Wy(e)){const t=yield By(e);yield Vi(Kn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield zi((e=>e.auth)),l=yield Ki(Yu.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:wd.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield Vi(Kn.setState({user:l,isAuthenticated:!0})),yield Vi(Kn.setLoginState({error:void 0})),yield Vi(Kn.loadTenants()),i.flow===vt.Login?yield xy():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield Vi(Kn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*lf({payload:e}){try{yield Vi(Kn.setLoginState({loading:!0}));const{name:t}=yield Ki(Yu.auth.verifyInviteToken,e);yield Vi(Kn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield Vi(Kn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*sf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Vi(Kn.setLoginState({loading:!0}));try{const o=yield zi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Ki(Yu.auth.preLoginV2,{email:e});if(a){if(r===Zu.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield zi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield Vi(Kn.setLoginState({step:St.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield cf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield cf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*cf(e){let{callback:t}=e,n=ni(e,Iy);const i=yield zi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Vi(Kn.setLoginState({step:St.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===or.EmailAndPassword?(yield Vi(Kn.setLoginState({step:St.loginWithPassword,loading:!1})),null==t||t()):[or.MagicLink,or.Code,or.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Vi(Kn.passwordlessPreLogin(P({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Vi(Kn.setLoginState({step:St.loginWithPassword,loading:!1})),null==t||t())}function*uf({payload:{callback:e}}){try{yield Vi(Kn.setLoginState({loading:!0}));const{options:t}=yield Ki(Yu.auth.webAuthnCreateNewDeviceSession);t.user.id=gt(t.user.id),t.challenge=gt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Vi(Kn.setLoginState({error:t.message})),null==e||e(null)}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*df(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ly);try{yield Vi(Kn.setLoginState({loading:!0}));const e=pt(n.publicKey);yield Ki(Yu.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*yf(e){let{payload:{callback:t}}=e,n=ni(e.payload,Oy);try{var i;yield Vi(Kn.setLoginState({loading:!0}));const{options:e}=yield Ki(Yu.auth.webAuthnPreLogin,n);e.challenge=gt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)}))),yield Vi(Kn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Vi(Kn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*ff(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ey);try{var i;yield Vi(Kn.setLoginState({loading:!0}));const e=pt(n.publicKey),o=yield Ki(Yu.auth.webAuthnPostLogin,P({},e,{response:P({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Wy(o)){const e=Wo.onRedirectTo,{routes:t}=yield zi((e=>e.auth)),n=yield By(o);yield Vi(Kn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Ki(Yu.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield Vi(Kn.loadTenants()),yield Vi(Kn.setState({user:e,isAuthenticated:!0})),yield Vi(Kn.setLoginState({error:void 0})),yield xy(),null==t||t(!0)}}catch(e){yield Vi(Kn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Vi(Kn.setLoginState({loading:!1}))}}function*gf({payload:e}){const{onRedirectTo:t,routes:n}=yield zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Vi(Kn.setLoginState({loading:!0}));try{const t=yield Ki(Yu.auth.postLogin,e);Wo.setAccessToken(t.accessToken),Wo.setUser(t),yield Vi(Kn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield xy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Vi(Kn.setLoginState({step:St.loginWithSSOFailed,loading:!1}))}}function*pf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Vi(Kn.setLoginState({loading:!0}));try{const a=yield Ki(Yu.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Wo.setAccessToken(a.accessToken),Wo.setUser(a);const r=Wo.onRedirectTo,{routes:l}=yield zi((e=>e.auth));if(Wy(a)){const e=yield By(a);yield Vi(Kn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield zi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Vi(Kn.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===vt.Login?St.success:t.step,tenants:[],tenantsLoading:!0}})),yield Vi(Kn.loadTenants()),n&&t.flow===vt.Login&&(yield xy())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Wo.setAccessToken(null),Wo.setUser(null),yield Vi(Kn.setLoginState({email:e,error:t.message,loading:!1}))}}function*Sf({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Vi(Kn.setLoginState({loading:!0}));try{const o=yield Ki(Yu.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield zi((e=>e.auth)),r=a.flow===vt.Login?St.success:a.step;yield Vi(Kn.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield Vi(Kn.loadTenants()),yield Vi(Kn.setLoginState({error:void 0,loading:!1})),a.flow===vt.Login&&(yield xy()),null==i||i(!0)}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*vf({payload:e}){yield Vi(Kn.setLoginState({loading:!0}));try{yield Ki(Yu.auth.recoverMfaToken,e),yield Vi(Kn.setLoginState({loading:!1,error:void 0,step:St.preLogin})),yield Vi(Kn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield Vi(Kn.setLoginState({error:e.message,loading:!1}))}}function*hf({payload:e}){yield Vi(Kn.setState({isLoading:!0}));try{yield Ki(Yu.auth.logout)}catch{}yield Vi(Kn.resetState()),yield Vi(Kn.requestAuthorize(!0)),null==e||e()}function*mf({payload:e}){var t;try{yield Ki(Yu.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*bf({user:e,tenants:t}){const n={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield Vi(Kn.setMfaState(n)),yield Vi(Kn.setUser(e)),yield Vi(Kn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Af({user:e,tenants:t}){const{loginState:n}=yield zi((e=>e.auth));yield Vi(Kn.setUser(e)),yield Vi(Kn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===vt.Login&&(yield xy()),yield Vi(Kn.setState({isAuthenticated:!0}))}function*kf(e){let{payload:{callback:t}}=e,n=ni(e.payload,wy);yield Vi(Kn.setLoginState({loading:!0}));try{const e=yield Ki(Yu.auth.preEnrollMFASMSForLogin,n);yield Vi(Kn.setMfaState({otcToken:e.otcToken,step:Yt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tf(e){let{payload:{callback:t}}=e,n=ni(e.payload,Cy);yield Vi(Kn.setLoginState({loading:!0}));try{const e=yield Ki(Yu.auth.enrollMFASMSForLogin,n),i=yield Ki(Yu.auth.generateLoginResponseV2,e);yield bf(i),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pf(e){let{payload:{callback:t}}=e,n=ni(e.payload,Dy);yield Vi(Kn.setLoginState({loading:!0}));try{var i;const e=yield Ki(Yu.auth.preEnrollMFAWebAuthnForLogin,n),o=P({},e.options,{challenge:gt(e.options.challenge),user:P({},e.options.user,{id:gt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)})))});yield Vi(Kn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*If(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ry);yield Vi(Kn.setLoginState({loading:!0}));try{const e=pt(n.publicKey),i=yield Ki(Yu.auth.enrollMFAWebAuthnForLogin,P({},n,{options:e})),o=yield Ki(Yu.auth.generateLoginResponseV2,i);yield bf(o),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lf(e){let{payload:{callback:t}}=e,n=ni(e.payload,_y);yield Vi(Kn.setLoginState({loading:!0}));try{const e=yield Ki(Yu.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Ki(Yu.auth.generateLoginResponseV2,e);yield bf(i),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Of(e){let{payload:{callback:t,deviceId:n}}=e,i=ni(e.payload,Uy);yield Vi(Kn.setLoginState({loading:!0}));try{const e=yield Ki(Yu.auth.preVerifyMFASMSForLogin,n,i);yield Vi(Kn.setMfaState({otcToken:e.otcToken,step:Yt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ef(e){let{payload:{callback:t,deviceId:n}}=e,i=ni(e.payload,My);yield Vi(Kn.setLoginState({loading:!0}));try{const e=yield Ki(Yu.auth.verifyMFASMSForLogin,n,i),o=yield Ki(Yu.auth.generateLoginResponseV2,e);yield Af(o),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wf(e){let{payload:{callback:t,deviceId:n}}=e,i=ni(e.payload,Ny);yield Vi(Kn.setLoginState({loading:!0}));try{var o;const e=yield Ki(Yu.auth.preVerifyMFAWebAuthnForLogin,n,i),a=P({},e.options,{challenge:gt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>P({},e,{id:gt(e.id)})))});yield Vi(Kn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cf(e){let{payload:{callback:t,deviceId:n}}=e,i=ni(e.payload,$y);yield Vi(Kn.setLoginState({loading:!0}));try{const e=pt(i.publicKey),o=yield Ki(Yu.auth.verifyMFAWebAuthnForLogin,n,P({},i,{options:e})),a=yield Ki(Yu.auth.generateLoginResponseV2,o);yield Af(a),yield Vi(Kn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Df(){yield jo(Kn.requestAuthorize,Yy),yield jo(Kn.requestAuthorizeSSR,Xy),yield jo(Kn.requestHostedLoginAuthorize,Zy),yield jo(Kn.handleHostedLoginCallback,ef),yield jo(Kn.preLogin,sf),yield jo(Kn.postLogin,gf),yield jo(Kn.login,pf),yield jo(Kn.logout,hf),yield jo(Kn.silentLogout,mf),yield jo(Kn.loginWithMfa,Sf),yield jo(Kn.recoverMfa,vf),yield jo(Kn.quickSmsPasswordlessPreLogin,of),yield jo(Kn.changePhoneNumberWithVerification,tf),yield jo(Kn.verifyChangePhoneNumber,nf),yield jo(Kn.passwordlessPreLogin,af),yield jo(Kn.passwordlessPostLogin,rf),yield jo(Kn.verifyInviteToken,lf),yield jo(Kn.webAuthnPrelogin,yf),yield jo(Kn.webAuthnPostLogin,ff),yield jo(Kn.webAuthnCreateNewDeviceSession,uf),yield jo(Kn.webAuthnVerifyNewDeviceSession,df),yield jo(Kn.afterAuthNavigation,xy),yield jo(Kn.getUserIP,Jy),yield jo(Kn.preEnrollMFASMSForLogin,kf),yield jo(Kn.enrollMFASMSForLogin,Tf),yield jo(Kn.preEnrollMFAWebAuthnForLogin,Pf),yield jo(Kn.enrollMFAWebAuthnForLogin,If),yield jo(Kn.enrollMFAAuthenticatorAppForLogin,Lf),yield jo(Kn.preVerifyMFASMSForLogin,Of),yield jo(Kn.verifyMFASMSForLogin,Ef),yield jo(Kn.preVerifyMFAWebAuthnForLogin,wf),yield jo(Kn.verifyMFAWebAuthnForLogin,Cf)}function*Rf({payload:e}){e&&(yield Vi(Kn.setState({isLoading:!0})));const t=ld;yield Vi(Kn.loadTenants()),yield Vi(Kn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*_f({payload:{callback:e}}){try{const{ip:t}=Ed[0];yield Vi(Kn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Uf(){yield jo(Kn.requestAuthorize,Rf),yield jo(Kn.afterAuthNavigation,xy),yield jo(Kn.getUserIP,_f)}const Mf=["callback","samlVendor"],Nf=["callback","samlVendor"];function*$f(){try{var e,t;yield Vi(Kn.setSSOState({loading:!0}));const n=yield Ki(Yu.auth.getSamlConfiguration),i=yield Ki(Yu.auth.getOidcConfiguration),o=yield Ki(Yu.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield Vi(Kn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Vi(Kn.setSSOState({error:e.message,loading:!1}))}}function*Ff({payload:e}){const t=yield zi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Vi(Kn.setSSOState({error:void 0,[n]:!0}));try{const i=yield id(e[0]),o=yield Ki(Yu.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Vi(Kn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Vi(Kn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*xf({payload:e}){const{configFile:t,callback:n}=e,i=yield zi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Vi(Kn.setSSOState({error:void 0,[o]:!0}));try{const e=yield id(t),a=yield Ki(Yu.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Vi(Kn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Vi(Kn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Vf({payload:e}){const{callback:t,samlVendor:n}=e,i=ni(e,Mf),o=yield zi((e=>e.auth.ssoState.samlConfiguration)),a=P({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Vi(Kn.setSSOState({samlConfiguration:P({},o,a)})));if(yield Vi(Kn.setSSOState({error:void 0,[r]:!0})),e.type===Zu.Saml){var l,s;const e=yield Ki(Yu.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const i=ed(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Ki(Yu.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Vi(Kn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*jf({payload:{callback:e}={}}){const t=yield zi((e=>e.auth.ssoState.samlConfiguration));try{yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield Ki(Yu.auth.validateSamlDomain),yield Vi(Kn.setSSOState({samlConfiguration:P({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Vi(Kn.setSSOState({samlConfiguration:P({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Wf(){try{const e=yield Ki(Yu.auth.getSamlRoles),t=yield Ki(Yu.auth.getSamlRolesGroups);yield Vi(Kn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Vi(Kn.setSSOState({error:e.message}))}}function*Kf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield Ki(Yu.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ji(e.map((e=>Ki(Yu.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Vi(Kn.setSSOState({error:e.message}))}}(n)),yield Wf(),yield Vi(Kn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Vi(Kn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Gf({payload:{callback:e,id:t}}){try{yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield Ki(Yu.auth.deleteSamlGroup,{id:t}),yield Wf(),yield Vi(Kn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Vi(Kn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Bf({payload:{group:e,roleIds:t,callback:n}}){try{yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield Ki(Yu.auth.createSamlGroup,{group:e,roleIds:t}),yield Wf(),yield Vi(Kn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Vi(Kn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*zf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Vi(Kn.setSSOState({loading:!0})),yield Ki(Yu.auth.oidcPostLoginV2,t),yield Ki(zy),yield Vi(Kn.setSSOState({loading:!1}))}catch(e){var n;yield Vi(Kn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*qf(){yield xo(Kn.loadSSOConfigurations,$f),yield xo(Kn.saveSSOConfigurations,Vf),yield xo(Kn.saveSSOConfigurationsFile,Ff),yield xo(Kn.saveSSOConfigurationsFileWithCallback,xf),yield xo(Kn.validateSSODomain,jf),yield xo(Kn.loadSSOAuthorizationRoles,Wf),yield xo(Kn.updateSSOAuthorizationRoles,Kf),yield xo(Kn.deleteSamlGroup,Gf),yield xo(Kn.createSamlGroup,Bf),yield xo(Kn.oidcPostlogin,zf)}function*Hf(){yield Vi(Kn.setSSOState({loading:!0})),yield dt(),yield Vi(Kn.setSSOState({samlConfiguration:gd,loading:!1,firstLoad:!1}))}function*Jf({payload:e}){const t="saving";yield Vi(Kn.setSSOState({error:void 0,[t]:!0}));const n=P({},yield zi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Vi(Kn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Yf({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=ni(e,Nf),r=vd.samlConfiguration,l=P({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Vi(Kn.setSSOState({samlConfiguration:P({},r,l)})));yield Vi(Kn.setSSOState({error:void 0,[s]:!0})),yield dt(),l.acsUrl=null==pd||null==(t=pd.configuration)?void 0:t.acsUrl,l.spEntityId=null==pd||null==(n=pd.configuration)?void 0:n.spEntityId;const c=ed(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield dt(),yield Vi(Kn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*Qf({payload:{callback:e}={}}){const t=vd.samlConfiguration;yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield dt(),yield Vi(Kn.setSSOState({samlConfiguration:P({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Xf(){yield dt(),yield Vi(Kn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Zf({payload:{callback:e,authorizationRoles:t}}){yield Vi(Kn.setSSOState({error:void 0,saving:!0})),yield dt(),yield Vi(Kn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*eg(){yield xo(Kn.loadSSOConfigurations,Hf),yield xo(Kn.saveSSOConfigurations,Yf),yield xo(Kn.saveSSOConfigurationsFile,Jf),yield xo(Kn.validateSSODomain,Qf),yield xo(Kn.loadSSOAuthorizationRoles,Xf),yield xo(Kn.updateSSOAuthorizationRoles,Zf)}const tg=["callback"],ng=["callback","ssoConfigId"],ig=["callback","ssoConfigId"];function*og(){try{return yield Ki(Yu.auth.getOidcConfiguration)}catch(e){return null}}function*ag(){try{return yield Ki(Yu.metadata.getSamlMetadata)}catch(e){return null}}function*rg(){try{yield Vi(Kn.setSSOLoader({key:Xu.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ji([Ki(og),Ki(ag)]),n=yield Ki(Yu.auth.getSSOConfigurations);yield Vi(Kn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Vi(Kn.setSSOError({key:Xu.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Vi(Kn.setSSOLoader({key:Xu.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*lg({payload:e}){yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ni(e,tg),i=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Ki(Yu.auth.createSSOConfiguration,P({},n,{enabled:null!=(o=n.enabled)&&o}));yield Vi(Kn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Vi(Kn.setSSOError({key:Xu.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_CONFIGURATION,value:!1}))}}function*sg({payload:e}){yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield id(t),o=yield Ki(Yu.auth.createSSOConfigurationByMetadata,{metadata:e});yield Vi(Kn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Vi(Kn.setSSOError({key:Xu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*cg({payload:e}){yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ni(e,ng),o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ki(Yu.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Vi(Kn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Vi(Kn.setSSOError({key:Xu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ug({payload:e}){yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield id(i),a=yield Ki(Yu.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Vi(Kn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Vi(Kn.setSSOError({key:Xu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*dg({payload:e}){yield Vi(Kn.setSSOLoader({key:Xu.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ki(Yu.auth.deleteSSOConfiguration,t),yield Vi(Kn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Vi(Kn.setSSOError({key:Xu.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.DELETE_SSO_CONFIGURATION,value:!1}))}}function*yg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ni(e,ig);yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_DOMAIN,value:!0}));const o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ki(Yu.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?P({},t,{domains:[...t.domains,e]}):t));yield Vi(Kn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Vi(Kn.setSSOError({key:Xu.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_DOMAIN,value:!1}))}}function*fg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Vi(Kn.setSSOLoader({key:Xu.DELETE_SSO_DOMAIN,value:!0}));const o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ki(Yu.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?P({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Vi(Kn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Vi(Kn.setSSOError({key:Xu.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.DELETE_SSO_DOMAIN,value:!1}))}}function*gg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Vi(Kn.setSSOLoader({key:Xu.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ki(Yu.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?P({},e,{domains:e.domains.map((e=>e.id===n?P({},e,{validated:!0}):e))}):e));yield Vi(Kn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Vi(Kn.setSSOError({key:Xu.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.VALIDATE_SSO_DOMAIN,value:!1}))}}function*pg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ki(Yu.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?P({},e,{roleIds:n}):e));yield Vi(Kn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Vi(Kn.setSSOError({key:Xu.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Vi(Kn.setSSOLoader({key:Xu.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Sg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_GROUPS,value:!0}));const o=yield zi((e=>e.auth.ssoState.ssoConfigurations));try{yield ji(t.map((e=>Ki(Yu.auth.deleteSSOGroup,n,e)))),yield ji(e.map((e=>Ki(Yu.auth.createSSOGroup,n,e))));const a=yield Ki(Yu.auth.getSSOGroups,n),r=o.map((e=>e.id===n?P({},e,{groups:a}):e));yield Vi(Kn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Vi(Kn.setSSOError({key:Xu.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_GROUPS,value:!1}))}}function*vg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ji(t.map((t=>Ki(Yu.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Vi(Kn.setSSOError({key:Xu.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Vi(Kn.setSSOLoader({key:Xu.SAVE_SSO_GROUPS,value:!1}))}}function*hg(){yield xo(Kn.loadSSOConfigurationsV2,rg),yield xo(Kn.saveSSOConfigurationV2,lg),yield xo(Kn.saveSSODomain,yg),yield xo(Kn.deleteSSODomain,fg),yield xo(Kn.validateSSODomainV2,gg),yield xo(Kn.updateSSOConfiguration,cg),yield xo(Kn.deleteSSOConfiguration,dg),yield xo(Kn.setSSOGroups,Sg),yield xo(Kn.updateSSOGroups,vg),yield xo(Kn.setSSODefaultRoles,pg),yield xo(Kn.saveSSOConfigurationByMetadata,sg),yield xo(Kn.updateSSOConfigurationByMetadata,ug)}const mg=["callback","profilePictureUrl"],bg=["callback","profilePictureUrl"];function*Ag(){yield Vi(Kn.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Ki.apply(void 0,[Fo,e,t,n].concat(o))}(3,2e3,Yu.teams.getProfile),t=yield zi((e=>e.auth.user));Kn.setUser(P({},t,e)),yield Vi(Kn.setProfileState({profile:e,loading:!1}))}catch(e){yield Vi(Kn.setProfileState({loading:!1,error:e.message}))}}function*kg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ni(e.payload,mg);yield Vi(Kn.setProfileState({saving:!0,error:null}));try{const e=yield zi((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Ki(Yu.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=P({},e,i,{profilePictureUrl:o}),r=yield Ki(Yu.teams.updateProfile,a),l=yield zi((e=>e.auth.user));yield Vi(Kn.setUser(P({},l,r))),yield Vi(Kn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield Vi(Kn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tg({payload:e}){yield Vi(Kn.setProfileState({loading:!0}));try{var t;yield Ki(Yu.teams.changePassword,e),yield Vi(Kn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Pg(){yield jo(Kn.loadProfile,Ag),yield xo(Kn.saveProfile,kg),yield xo(Kn.changePassword,Tg)}function*Ig(){yield Vi(Kn.setProfileState({loading:!0})),yield dt(),yield Vi(Kn.setUser(P({},ld,rd))),yield Vi(Kn.setProfileState({loading:!1,profile:rd}))}function*Lg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ni(e.payload,bg);yield Vi(Kn.setProfileState({saving:!0,error:null}));const o=sd;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=P({},o.profile,i,{profilePictureUrl:a}),l=ld;yield dt(),yield Vi(Kn.setUser(P({},l,r))),yield Vi(Kn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Og({payload:e}){var t;yield Vi(Kn.setProfileState({loading:!0})),yield dt(),yield Vi(Kn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Eg(){yield jo(Kn.loadProfile,Ig),yield xo(Kn.saveProfile,Lg),yield xo(Kn.changePassword,Og)}const wg=["callback"],Cg=["callback"],Dg=["callback"],Rg=["deviceId","callback"],_g=["deviceId","callback"],Ug=["callback"],Mg=["deviceId"],Ng=["deviceId"],$g=["callback"];function*Fg(e){const{step:t}=yield zi((e=>e.auth.mfaState));return{step:e.recoveryCode?Yt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*xg(){yield Vi(Kn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ki(Yu.auth.enrollMfa);yield Vi(Kn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message}))}}function*Vg(e){let{payload:{callback:t}}=e,n=ni(e.payload,wg);yield Vi(Kn.setMfaState({saving:!0}));try{const e=yield zi((e=>e.auth.user)),i=yield Ki(Yu.auth.verifyMfa,n),o=yield Ki(Yu.auth.getMFADevices),a=yield Fg(i);yield Vi(Kn.setMfaState(P({},a,{mfaDevices:o}))),yield Vi(Kn.setUser(P({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*jg(e){let{payload:{callback:t}}=e,n=ni(e.payload,Cg);yield Vi(Kn.setMfaState({loading:!0}));try{const e=yield Ki(Yu.auth.loginWithMfa,n),i={step:Yt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Vi(Kn.setMfaState(i)),yield Vi(Kn.setState({user:e})),yield Vi(Kn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield Vi(Kn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Wg({payload:e}){yield Vi(Kn.setMfaState({saving:!0}));try{var t;yield Ki(Yu.auth.disableMfa,e);const n=yield Ki(Yu.auth.getMFADevices);yield Vi(Kn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Kg({payload:e}){yield Vi(Kn.setMfaState({saving:!0}));try{var t,n;const i=yield Ki(Yu.auth.preEnrollMFAWebAuthn),o=P({},i.options,{challenge:gt(i.options.challenge),user:P({},i.options.user,{id:gt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>P({},e,{id:gt(e.id)})))});yield Vi(Kn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Vi(Kn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*Gg(e){let{payload:{callback:t}}=e,n=ni(e.payload,Dg);yield Vi(Kn.setMfaState({saving:!0}));try{const e=pt(n.publicKey),i=yield Ki(Yu.auth.enrollMFAWebAuthn,P({},n,{options:e})),o=yield Ki(Yu.auth.getMFADevices),a=yield Fg(i);yield Vi(Kn.setMfaState(P({},a,{mfaDevices:o}))),console.log(t,a.recoveryCode),null==t||t(a.recoveryCode)}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bg(e){let{payload:{deviceId:t,callback:n}}=e;ni(e.payload,Rg),yield Vi(Kn.setMfaState({saving:!0}));try{var i;const e=yield Ki(Yu.auth.preDisableMFAWebAuthn,t),o=P({},e.options,{challenge:gt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>P({},e,{id:gt(e.id)})))});yield Vi(Kn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*zg(e){let{payload:{deviceId:t,callback:n}}=e,i=ni(e.payload,_g);yield Vi(Kn.setMfaState({saving:!0}));try{const e=pt(i.publicKey);yield Ki(Yu.auth.disableMFAWebAuthn,t,P({},i,{options:e}));const o=yield Ki(Yu.auth.getMFADevices);yield Vi(Kn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*qg({payload:e}){yield Vi(Kn.setMfaState({saving:!0}));try{var t;const n=yield Ki(Yu.auth.preEnrollMFASMS,e);yield Vi(Kn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Hg(e){let{payload:{callback:t}}=e,n=ni(e.payload,Ug);yield Vi(Kn.setMfaState({saving:!0}));try{const e=yield Ki(Yu.auth.enrollMFASMS,n),i=yield Ki(Yu.auth.getMFADevices),o=yield Fg(e);yield Vi(Kn.setMfaState(P({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Jg(e){let{payload:{deviceId:t}}=e,n=ni(e.payload,Mg);yield Vi(Kn.setMfaState({saving:!0}));try{var i;const e=yield zi((e=>e.auth.user)),o=yield Ki(Yu.auth.preDisableMFASMS,t);yield Vi(Kn.setMfaState({saving:!1,error:void 0,otcToken:o.otcToken,phoneNumber:o.phoneNumber})),yield Vi(Kn.setUser(P({},e,{mfaEnrolled:!1}))),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Yg(e){let{payload:{deviceId:t}}=e,n=ni(e.payload,Ng);yield Vi(Kn.setMfaState({saving:!0}));try{var i;const e=yield zi((e=>e.auth.user));yield Ki(Yu.auth.disableMFASMS,t,n);const o=yield Ki(Yu.auth.getMFADevices);yield Vi(Kn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),yield Vi(Kn.setUser(P({},e,{mfaEnrolled:!1}))),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Vi(Kn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Qg(){yield Vi(Kn.setMfaState({loading:!0}));try{yield zi((e=>e.auth.user));const e=yield Ki(Yu.auth.getMFADevices);yield Vi(Kn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Vi(Kn.setMfaState({loading:!1,error:e.message}))}}function*Xg(){yield Vi(Kn.setMfaState({loading:!0}));try{const e=(yield Ki(Yu.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Vi(Kn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Vi(Kn.setMfaState({loading:!1,error:e.message}))}}function*Zg(){yield xo(Kn.enrollMfa,xg),yield xo(Kn.getMFADevices,Qg),yield xo(Kn.getMFAStrategies,Xg),yield xo(Kn.verifyMfa,Vg),yield xo(Kn.disableMfa,Wg),yield xo(Kn.verifyMfaAfterForce,jg),yield xo(Kn.preDisableMfaSms,Jg),yield xo(Kn.disableMfaSms,Yg),yield xo(Kn.preEnrollMfaSms,qg),yield xo(Kn.enrollMfaSms,Hg),yield xo(Kn.preEnrollMfaWebAuthn,Kg),yield xo(Kn.enrollMfaWebAuthn,Gg),yield xo(Kn.preDisableMfaWebAuthn,Bg),yield xo(Kn.disableMfaWebAuthn,zg)}function*ep(){yield Vi(Kn.setMfaState({loading:!0})),yield Vi(Kn.setMfaState({loading:!1,error:void 0,qrCode:"test"}))}function*tp({payload:{callback:e}}){yield Vi(Kn.setMfaState({loading:!0})),yield dt();const t={token:"token",recoveryCode:"recoveryCode"},n={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=t&&t.recoveryCode&&(n.recoveryCode=t.recoveryCode),yield Vi(Kn.setMfaState(n)),yield Vi(Kn.setUser(P({},ld,{mfaEnrolled:!0}))),null==e||e(n.recoveryCode)}function*np(e){let{payload:{callback:t}}=e,n=ni(e.payload,$g);yield Vi(Kn.setMfaState({loading:!0})),yield dt();const i=P({},n,{recoveryCode:"recoveryCode"}),o={step:Yt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Vi(Kn.setMfaState(o)),yield dt(),yield Vi(Kn.setUser(P({},ld,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*ip({payload:e}){var t;yield Vi(Kn.setMfaState({loading:!0})),yield dt(),yield Vi(Kn.setMfaState({loading:!1,error:void 0})),yield Vi(Kn.setUser(P({},ld,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}function*op(){yield xo(Kn.enrollMfa,ep),yield xo(Kn.verifyMfa,tp),yield xo(Kn.disableMfa,ip),yield xo(Kn.verifyMfaAfterForce,np)}const ap=["callback"];function*rp({payload:e}){yield Vi(Kn.setForgotPasswordState({loading:!0}));try{yield Ki(Yu.auth.forgotPassword,e),yield Vi(Kn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success}))}catch(e){yield Vi(Kn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*lp(e){let{payload:{callback:t}}=e,n=ni(e.payload,ap);yield Vi(Kn.setForgotPasswordState({loading:!0}));try{yield Ki(Yu.auth.resetPassword,n),yield Vi(Kn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success})),null==t||t(!0)}catch(e){yield Vi(Kn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*sp({payload:e}){yield Vi(Kn.setForgotPasswordState({loading:!0}));try{const t=yield Ki(Yu.auth.loadPasswordConfig,e);yield Vi(Kn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Vi(Kn.setForgotPasswordState({loading:!1,error:e.message}))}}function*cp(){yield jo(Kn.forgotPassword,rp),yield jo(Kn.resetPassword,lp),yield jo(Kn.loadPasswordConfig,sp)}let up;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(up||(up={}));const dp=["callback","events"],yp=["callback"],fp=["callback"];function*gp({payload:{userId:e,token:t}}){yield Vi(Kn.setActivateState({loading:!0,step:Et.activating}));try{const{isAuthenticated:n}=yield zi((e=>e.auth));n&&(yield Vi(Kn.silentLogout()));const i=yield Ki(Yu.auth.getActivateAccountStrategy,{userId:e,token:t});yield Vi(Kn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Vi(Kn.setActivateState({loading:!1,step:Et.activatingForm})))}catch(e){yield Vi(Kn.setActivateState({loading:!1,error:e.message}))}}function*pp(e){let{payload:{callback:t,events:n}}=e,i=ni(e.payload,dp);yield Vi(Kn.setActivateState({loading:!0}));try{const e=Wo.onRedirectTo,{routes:a}=yield zi((e=>e.auth)),r=yield Ki(Yu.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Wy(r)){yield Vi(Kn.setActivateState({step:Et.success}));const t=yield By(r);yield Vi(Kn.setState(t)),yield qi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Vi(Kn.setActivateState({step:Et.success}));const{user:e,tenants:t}=yield Ki(Yu.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:wd.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield Vi(Kn.setTenantsState({tenants:t,loading:!1})),yield Vi(Kn.setState({user:e,isAuthenticated:!0})),yield qi(1e3),yield xy(),yield Vi(Kn.resetActivateState())}null==t||t(!0)}catch(e){yield Vi(Kn.setActivateState({loading:!1,error:e.message}))}}function*Sp({payload:e}){const{callback:t}=e,n=ni(e,yp);yield Vi(Kn.setActivateStrategyState({loading:!0}));try{const e=yield Ki(Yu.auth.getActivateAccountStrategy,n);yield Vi(Kn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Vi(Kn.setActivateStrategyState({loading:!1,error:e.message}))}}function*vp({payload:e}){const{callback:t}=e,n=ni(e,fp);yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:n.email})),yield Vi(Kn.setActivateState({loading:!0}));try{yield Ki(Yu.auth.resendActivationEmail,n),yield Vi(Kn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Vi(Kn.setActivateState({loading:!1,error:e.message})),yield Vi(Kn.setTeamError({key:up.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:!1}))}function*hp(){yield jo(Kn.activateAccount,pp),yield jo(Kn.preActivateAccount,gp),yield jo(Kn.getActivateAccountStrategy,Sp),yield jo(Kn.resendActivationEmail,vp)}function*mp({payload:e}){if(e.token&&e.userId)try{yield Vi(Kn.setAcceptInvitationState({error:void 0,step:Rt.pending})),yield Ki(Yu.auth.acceptInvitation,e),yield Vi(Kn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Rt.success}}))}catch(e){yield Vi(Kn.setAcceptInvitationState({step:Rt.failed,error:e.message}))}else yield Vi(Kn.setAcceptInvitationState({error:void 0,step:Rt.invalid}))}function*bp(){yield jo(Kn.acceptInvitation,mp)}var Ap,kp=new Uint8Array(16);function Tp(){if(!Ap&&!(Ap="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ap(kp)}for(var Pp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ip=function(e){return"string"==typeof e&&Pp.test(e)},Lp=[],Op=0;Op<256;++Op)Lp.push((Op+256).toString(16).substr(1));var Ep=function(e,t,n){var i=(e=e||{}).random||(e.rng||Tp)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Lp[e[t+0]]+Lp[e[t+1]]+Lp[e[t+2]]+Lp[e[t+3]]+"-"+Lp[e[t+4]]+Lp[e[t+5]]+"-"+Lp[e[t+6]]+Lp[e[t+7]]+"-"+Lp[e[t+8]]+Lp[e[t+9]]+"-"+Lp[e[t+10]]+Lp[e[t+11]]+Lp[e[t+12]]+Lp[e[t+13]]+Lp[e[t+14]]+Lp[e[t+15]]).toLowerCase();if(!Ip(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const wp=["callback"],Cp=["roles"],Dp=["roles"],Rp=["callback"],_p=["callback","profileImage"],Up=["callback"],Mp=["callback","userId"],Np=["callback"],$p=["callback"],Fp=["callback"],xp=["callback"],Vp=["callback"],jp=["callback"],Wp=["callback"],Kp=["callback","profileImage"],Gp=["callback"],Bp=["callback"],zp=["callback"],qp=["callback"],Hp=["callback"],Jp=["callback"],Yp=()=>zi((e=>e.auth.teamState));function*Qp({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield Yp(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield Vi(Kn.setTeamLoader({key:up.USERS,value:!a})),yield Vi(Kn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield ji([Ki(Yu.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ki(Yu.teams.loadAvailableRoles),Ki(Yu.teams.loadAvailablePermissions)]);yield Vi(Kn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Vi(Kn.setTeamError({key:up.USERS,value:e.message})),yield Vi(Kn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Vi(Kn.setTeamLoader({key:up.USERS,value:!1}))}function*Xp({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield Yp(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield Vi(Kn.setTeamLoader({key:up.USERS,value:!r})),yield Vi(Kn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield ji([Ki(Yu.subTenants.loadAllUsers,P({},c)),Ki(Yu.teams.loadAvailableRoles),Ki(Yu.teams.loadAvailablePermissions)]);yield Vi(Kn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield Vi(Kn.setTeamError({key:up.USERS,value:e.message})),yield Vi(Kn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Vi(Kn.setTeamLoader({key:up.USERS,value:!1}))}function*Zp({payload:e}){yield Vi(Kn.setTeamLoader({key:up.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield ji([Ki(Yu.teams.loadAvailableRoles),Ki(Yu.teams.loadAvailablePermissions)]);yield Vi(Kn.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Vi(Kn.setTeamError({key:up.ROLES_AND_PERMISSIONS,value:t.message}))}yield Vi(Kn.setTeamLoader({key:up.ROLES_AND_PERMISSIONS,value:!0}))}function*eS({payload:e}){const{callback:t}=e,n=ni(e,wp),i=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})}));try{const e=yield Ki(Yu.teams.addUser,n),{roles:o}=e,a=P({},ni(e,Cp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield Vi(Kn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*tS({payload:e}){const{callback:t}=e,n=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},n.addUserDialogState,{loading:!0})}));try{const i=e.emails.map((t=>({email:t,roleIds:e.roleIds}))),o=yield ji(i.map((e=>Ki(Yu.teams.addUser,e))));let a=[];o.forEach((e=>{const{roles:t}=e,n=P({},ni(e,Dp),{roleIds:t.map((e=>e.id))});a.push(n)}));let r=a.concat(...n.users);yield Vi(Kn.setTeamState({users:r,addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamState({addUserDialogState:P({},n.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*nS({payload:e}){const{callback:t}=e,n=ni(e,Rp),i=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})}));try{yield Ki(Yu.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Ki(Yu.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Vi(Kn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*iS({payload:e}){const{callback:t}=e,n=ni(e,_p),{id:i}=n,o=yield Yp(),a=o.users.find((e=>e.id===n.id));yield Vi(Kn.setTeamLoader({key:up.UPDATE_USER,value:i||""})),yield Vi(Kn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0})})),yield Vi(Kn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?P({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Ki(Yu.teams.updateUser,n);null==t||t(e),yield Vi(Kn.setTeamState({users:o.users.map((t=>t.id===e.id?P({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Vi(Kn.setTeamLoader({key:up.UPDATE_USER,value:!1}))}catch(e){yield Vi(Kn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?P({},e,a):e))})),yield Vi(Kn.setTeamLoader({key:up.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*oS({payload:e}){const{callback:t}=e,n=ni(e,Up),i=yield Yp();yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})}));try{yield Ki(Yu.teams.deleteUser,n),null==t||t(!0),yield Vi(Kn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*aS({payload:e}){const{callback:t,userId:n}=e,i=ni(e,Mp),o=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!0})}));try{yield Ki(Yu.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return P({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Vi(Kn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[P({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamState({addUserDialogState:P({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*rS({payload:e}){const{callback:t}=e,n=ni(e,Np),i=yield Yp();yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})}));try{yield Ki(Yu.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Vi(Kn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*lS({payload:e}){const{callback:t}=e,n=ni(e,$p);yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ki(Yu.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamError({key:up.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:!1}))}function*sS({payload:e}){const{callback:t}=e,n=ni(e,Fp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email}));try{yield Ki(Yu.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamError({key:up.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*cS({payload:e}){const{callback:t}=e,n=ni(e,xp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email}));try{yield Ki(Yu.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamError({key:up.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*uS({payload:e}){const{callback:t}=e,n=ni(e,Vp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email}));try{yield Ki(Yu.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamError({key:up.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*dS(){yield Vi(Kn.setTeamError({key:up.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ki(Yu.teams.getInviteLinkConfiguration);yield Vi(Kn.setTeamState({inviteTokenState:P({},e)}))}catch(e){yield Vi(Kn.setTeamError({key:up.CONFIG_TOKEN_LINK,value:e.message}))}}function*yS(){yield Vi(Kn.setTeamError({key:up.GET_TOKEN_LINK,value:!1}));try{yield Ki(dS);const e=yield Ki(Yu.teams.getInviteUserLink),{inviteTokenState:t}=yield Yp();yield Vi(Kn.setTeamState({inviteTokenState:P({},t,e)}))}catch(e){yield Vi(Kn.setTeamError({key:up.GET_TOKEN_LINK,value:e.message}))}}function*fS({payload:{callback:e}}){yield Vi(Kn.setTeamError({key:up.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Yp();try{const n=yield Ki(Yu.teams.createInviteUserLink,{expiresInMinutes:43200});yield Vi(Kn.setTeamState({inviteTokenState:P({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield Vi(Kn.setTeamError({key:up.CREATE_TOKEN_LINK,value:t.message}))}}function*gS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Yp();yield Vi(Kn.setTeamError({key:up.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Ki(Yu.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Vi(Kn.setTeamState({inviteTokenState:P({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield Vi(Kn.setTeamError({key:up.UPDATE_TOKEN_LINK,value:t.message}))}}function*pS({payload:e}){const{callback:t}=null!=e?e:{};yield Vi(Kn.setTeamError({key:up.DELETE_TOKEN_LINK,value:!1}));try{yield Ki(Yu.teams.deleteInviteUserLink),yield Vi(Kn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Vi(Kn.setTeamError({key:up.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*SS({payload:e}){yield Vi(Kn.setTeamState({addUserDialogState:P({open:!0,loading:!1,error:!1},e)}))}function*vS({payload:e}){const t=yield Yp(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Vi(Kn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*hS({payload:e}){yield Vi(Kn.setTeamState({deleteUserDialogState:P({open:!0,loading:!1,error:!1},e)}))}function*mS({payload:e}){const t=yield Yp(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Vi(Kn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*bS(){yield Vo(Kn.loadUsers,Qp),yield Vo(Kn.loadAllSubTenantsUsers,Xp),yield Vo(Kn.loadRoles,Zp),yield xo(Kn.addUser,eS),yield xo(Kn.addUsersBulk,tS),yield xo(Kn.addUserToSubTenants,nS),yield xo(Kn.updateUser,iS),yield xo(Kn.setUserRolesForSubTenants,aS),yield xo(Kn.deleteUser,oS),yield xo(Kn.deleteUserFromSubTenants,rS),yield xo(Kn.resendActivationLink,lS),yield xo(Kn.resendInvitationLink,sS),yield xo(Kn.resendInvitationEmail,cS),yield xo(Kn.resendInvitationLinkToAllSubTenants,uS),yield xo(Kn.getInvitationLink,yS),yield xo(Kn.createInvitationLink,fS),yield xo(Kn.updateInvitationLink,gS),yield xo(Kn.deleteInvitationLink,pS),yield xo(Kn.openAddUserDialog,SS),yield xo(Kn.closeAddUserDialog,vS),yield xo(Kn.openDeleteUserDialog,hS),yield xo(Kn.closeDeleteUserDialog,mS)}function*AS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield Yp(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield Vi(Kn.setTeamLoader({key:up.USERS,value:!a})),yield Vi(Kn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield dt(),yield Vi(Kn.setTeamState({users:kd,totalPages:2,totalItems:10,roles:Sd,permissions:hd})),yield Vi(Kn.setTeamLoader({key:up.USERS,value:!1})),null==r||r(kd)}function*kS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield Yp(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield Vi(Kn.setTeamLoader({key:up.USERS,value:!r})),yield Vi(Kn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield dt(),yield Vi(Kn.setTeamState({allUsers:Td,totalPages:2,totalItems:10,roles:Sd,permissions:hd})),yield Vi(Kn.setTeamLoader({key:up.USERS,value:!1})),null==l||l(Td)}function*TS({payload:e}){var t;yield Vi(Kn.setTeamLoader({key:up.ROLES_AND_PERMISSIONS,value:!0})),yield dt(),yield Vi(Kn.setTeamState({roles:Sd,permissions:hd})),yield Vi(Kn.setTeamLoader({key:up.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Sd,permissions:hd})}function*PS({payload:e}){const{callback:t}=e,n=ni(e,jp),i=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})})),yield dt();const o=P({},bd,n,{id:`${Ep()}`});null==t||t(o),yield Vi(Kn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*IS({payload:e}){const{callback:t}=e,n=ni(e,Wp),i=yield Yp();yield Vi(Kn.setTeamState({addUserDialogState:P({},i.addUserDialogState,{loading:!0})})),yield dt();const o=P({},bd,n,{id:`${Ep()}`});yield Vi(Kn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*LS({payload:e}){var t;const{callback:n}=e,i=ni(e,Kp),{id:o}=i,a=yield Yp(),r=a.users.find((e=>e.id===i.id));yield Vi(Kn.setTeamLoader({key:up.UPDATE_USER,value:o||""})),yield Vi(Kn.setTeamState({addUserDialogState:P({},a.addUserDialogState,{loading:!0})})),yield Vi(Kn.setTeamState({addUserDialogState:P({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?P({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield dt();const l=P({},r,i);null==n||n(l),yield Vi(Kn.setTeamState({users:a.users.map((e=>e.id===l.id?P({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Vi(Kn.setTeamLoader({key:up.UPDATE_USER,value:!1}))}function*OS({payload:e}){const{callback:t}=e,n=ni(e,Gp),i=yield Yp();yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ES({payload:e}){const{callback:t}=e,n=ni(e,Bp),i=yield Yp();yield Vi(Kn.setTeamState({deleteUserDialogState:P({},i.deleteUserDialogState,{loading:!0})})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*wS({payload:e}){const{callback:t}=e,n=ni(e,zp);yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:n.userId})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamLoader({key:up.RESEND_ACTIVATE_LINK,value:!1}))}function*CS({payload:e}){const{callback:t}=e,n=ni(e,qp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*DS({payload:e}){const{callback:t}=e,n=ni(e,Hp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*RS({payload:e}){const{callback:t}=e,n=ni(e,Jp);yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:n.email})),yield dt(),null==t||t(!0),yield Vi(Kn.setTeamLoader({key:up.RESEND_INVITATION_LINK,value:!1}))}function*_S(){yield Vo(Kn.loadUsers,AS),yield Vo(Kn.loadAllSubTenantsUsers,kS),yield Vo(Kn.loadRoles,TS),yield xo(Kn.addUser,PS),yield xo(Kn.addUserToSubTenants,IS),yield xo(Kn.updateUser,LS),yield xo(Kn.deleteUser,OS),yield xo(Kn.deleteUserFromSubTenants,ES),yield xo(Kn.resendActivationLink,wS),yield xo(Kn.resendInvitationLink,CS),yield xo(Kn.resendInvitationEmail,DS),yield xo(Kn.resendInvitationLinkToAllSubTenants,RS),yield xo(Kn.openAddUserDialog,SS),yield xo(Kn.closeAddUserDialog,vS),yield xo(Kn.openDeleteUserDialog,hS),yield xo(Kn.closeDeleteUserDialog,mS)}const US=["authorizationUrl"],MS=["events","url"];function*NS(){try{yield Vi(Kn.setSocialLoginsState({loading:!0}));const e=yield Ki(Yu.auth.getSocialLoginProviders);yield Vi(Kn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Vi(Kn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*$S(){try{const e=yield zi((e=>e.root.context));yield Vi(Kn.setSocialLoginsState({loading:!0}));const t=(yield Ki(Yu.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=ni(t,US);const o=Bo(e,null!=n?n:"");return P({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Vi(Kn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield Vi(Kn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*FS(e){let{payload:{events:t,url:n}}=e,i=ni(e.payload,MS);try{yield Vi(Kn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ki(Yu.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Cd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:wd.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Vi(Kn.setLoginState({email:e,isNewUser:r})),yield zy(),localStorage.removeItem("register-quick-login"),yield Vi(Kn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield Vi(Kn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*xS({payload:e}){yield Vi(Kn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*VS(){yield jo(Kn.loadSocialLoginsConfiguration,NS),yield jo(Kn.loadSocialLoginsConfigurationV2,$S),yield jo(Kn.loginViaSocialLogin,FS),yield Vo(Kn.setSocialLoginError,xS)}let jS;function*WS({payload:e}){yield Vi(Kn.setApiTokensState({apiTokenType:e}));try{if(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Ki(Yu.auth.getUserApiTokensData);yield Vi(Kn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Ki(Yu.auth.getTenantApiTokensData),{items:t}=yield Ki(Yu.teams.loadAvailableRoles),{items:n}=yield Ki(Yu.teams.loadAvailablePermissions);yield Vi(Kn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1}))}catch(e){yield Vi(Kn.setApiTokensError({key:jS.LOAD_API_TOKENS,value:e.message})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1}))}}function*KS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield zi((e=>e.auth.apiTokensState));try{yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!0}));const e=yield Ki(Yu.auth.updateUserApiTokensData,{description:t});yield Vi(Kn.setApiTokensState({showAddTokenDialog:!1})),yield qi(200),yield Vi(Kn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield Vi(Kn.setApiTokensError({key:jS.ADD_API_TOKEN,value:e.message})),yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*GS({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield zi((e=>e.auth.apiTokensState));try{yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!0}));const e=yield Ki(Yu.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield Vi(Kn.setApiTokensState({showAddTokenDialog:!1})),yield qi(200),yield Vi(Kn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Vi(Kn.setApiTokensError({key:jS.ADD_API_TOKEN,value:e.message})),yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*BS({payload:e}){const{apiTokensDataUser:t}=yield zi((e=>e.auth.apiTokensState));try{yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!0})),yield Ki(Yu.auth.deleteUserApiToken,{tokenId:e}),yield Vi(Kn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!1}))}catch(e){yield Vi(Kn.setApiTokensError({key:jS.DELETE_API_TOKEN,value:e.message})),yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!1}))}}function*zS({payload:e}){const{apiTokensDataTenant:t}=yield zi((e=>e.auth.apiTokensState));try{yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!0})),yield Ki(Yu.auth.deleteTenantApiToken,{tokenId:e}),yield Vi(Kn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!1}))}catch(e){yield Vi(Kn.setApiTokensError({key:jS.DELETE_API_TOKEN,value:e.message})),yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!1}))}}function*qS({payload:e}){null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield ji([Ki(Yu.auth.getUserApiTokensData),Ki(Yu.auth.getTenantApiTokensData)]);yield Vi(Kn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setApiTokensError({key:jS.LOAD_API_TOKENS,value:t.message})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*HS({payload:e}){null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Ki(Yu.auth.getUserApiTokensData);yield Vi(Kn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setApiTokensError({key:jS.LOAD_API_TOKENS,value:t.message})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*JS({payload:e}){null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Ki(Yu.auth.getTenantApiTokensData);yield Vi(Kn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setApiTokensError({key:jS.LOAD_API_TOKENS,value:t.message})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*YS(){yield jo(Kn.loadApiTokens,qS),yield jo(Kn.loadUserApiTokens,HS),yield jo(Kn.loadTenantApiTokens,JS),yield jo(Kn.initApiTokensData,WS),yield xo(Kn.addUserApiToken,KS),yield xo(Kn.addTenantApiToken,GS),yield Vo(Kn.deleteTenantApiToken,zS),yield Vo(Kn.deleteUserApiToken,BS)}function*QS({payload:e}){if(yield Vi(Kn.setApiTokensState({apiTokenType:e})),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})),"user"===e){yield qi(200);const e=[od];yield Vi(Kn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield qi(200),yield Vi(Kn.setApiTokensState({apiTokensDataTenant:null!=(t=[ad])?t:[],roles:null!=Sd?Sd:[],permissions:null!=hd?hd:[]}))}yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1}))}function*XS({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield zi((e=>e.auth.apiTokensState)),a=P({},ad,{description:t,roleIds:n,clientId:`CLIENT_ID_${Ep()}`});yield Vi(Kn.setApiTokensState({showAddTokenDialog:!1})),yield qi(200),yield Vi(Kn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield qi(200),yield Vi(Kn.setApiTokensLoader({key:jS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*ZS({payload:e}){yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!0})),yield qi(200);const t=[ad];yield Vi(Kn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Vi(Kn.setApiTokensLoader({key:jS.DELETE_API_TOKEN,value:!1}))}function*ev({payload:e}){var t;null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));const n=[od],i=[ad];yield Vi(Kn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield qi(200),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*tv({payload:e}){var t;null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));const n=[od];yield Vi(Kn.setApiTokensState({apiTokensDataUser:n})),yield qi(200),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*nv({payload:e}){var t;null!=e&&e.silentLoading||(yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!0})));const n=[ad];yield Vi(Kn.setApiTokensState({apiTokensDataTenant:n})),yield qi(200),yield Vi(Kn.setApiTokensLoader({key:jS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*iv(){yield jo(Kn.loadApiTokens,ev),yield jo(Kn.loadUserApiTokens,tv),yield jo(Kn.loadTenantApiTokens,nv),yield jo(Kn.initApiTokensData,QS),yield xo(Kn.addTenantApiToken,XS),yield Vo(Kn.deleteTenantApiToken,ZS)}function*ov({payload:e}){try{var t;yield Vi(Kn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield zi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Ki(Yu.accountSettings.updateSettings,P({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Vi(Kn.setAccountSettingsState(P({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Vi(Kn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*av({payload:e}){yield Vi(Kn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ki(Yu.accountSettings.getSettings);yield Vi(Kn.setAccountSettingsState(P({},e,{loading:!1})))}catch(e){yield Vi(Kn.setAccountSettingsState({loading:!1,error:e.message}))}}function*rv(){yield jo(Kn.saveAccountSettings,ov),yield jo(Kn.loadAccountSettings,av)}function*lv({payload:e}){var t;yield Vi(Kn.setAccountSettingsState({loading:!0})),yield dt();const{accountSettingsState:n}=yield zi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=P({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Vi(Kn.setAccountSettingsState(P({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*sv({payload:e}){yield Vi(Kn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield dt(),yield Vi(Kn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*cv(){yield jo(Kn.saveAccountSettings,lv),yield jo(Kn.loadAccountSettings,sv)}function*uv({payload:{tenantId:e,callback:t}}){yield Vi(Kn.setState({isLoading:!0}));try{yield Ki(Yu.tenants.switchTenant,{tenantId:e}),yield Ki(zy),(null==t?void 0:t(!0))||(yield Vi(Kn.setState({isLoading:!1})))}catch(e){yield Vi(Kn.setState({isLoading:!1})),null==t||t(!1,e)}}function*dv({payload:e}){yield Vi(Kn.setTenantsState({loading:!0}));try{var t;const n=yield Ki(Yu.tenants.getTenants);yield Vi(Kn.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield Vi(Kn.setTenantsState({loading:!1}))}}function*yv({payload:e}){yield Vi(Kn.setTenantsState({loading:!0}));try{var t;const n=yield Ki(Yu.tenants.getSubTenants);yield Vi(Kn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*fv({payload:e}){yield Vi(Kn.setTenantsState({loading:!0}));try{var t;const n=yield Ki(Yu.tenants.getSubTenantsAsTree);yield Vi(Kn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vi(Kn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*gv(){yield xo(Kn.loadTenants,dv),yield xo(Kn.loadSubTenants,yv),yield xo(Kn.switchTenant,uv),yield xo(Kn.loadSubTenantsTree,fv)}function*pv(){yield Vi(Kn.setTenantsState({loading:!0})),yield dt(),yield Vi(Kn.setTenantsState({tenants:Pd,loading:!1}))}function*Sv(){yield xo(Kn.loadTenants,pv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(jS||(jS={}));const vv=["callback"],hv=["callback"],mv=["callback"],bv=["callback"],Av=["callback"];function*kv({payload:e}){var t;yield Vi(Kn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield ji([Ki(Yu.roles.getRoles),Ki(Yu.roles.getPermissions),Ki(Yu.roles.getPermissionCategories)]),[t,n,i]=e;yield Vi(Kn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Vi(Kn.setRolesState({error:e.message,loading:!1}))}}function*Tv(e){let{payload:{callback:t}}=e,n=ni(e.payload,vv);yield Vi(Kn.setRolesState({saving:!0}));try{const e=yield Ki(Yu.roles.addRole,n),i=yield Ki(Yu.roles.getRoles);yield Vi(Kn.loadRolesAndPermissions({silentLoading:!0})),yield Vi(Kn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Pv(e){let{payload:{callback:t}}=e,n=ni(e.payload,hv);yield Vi(Kn.setRolesState({saving:!0}));try{yield Ki(Yu.roles.deleteRole,n),yield Vi(Kn.loadRolesAndPermissions({silentLoading:!0})),yield Vi(Kn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Iv(e){let{payload:{callback:t}}=e,n=ni(e.payload,mv);yield Vi(Kn.setRolesState({saving:!0}));try{const e=yield Ki(Yu.roles.updateRole,n);yield Vi(Kn.loadRolesAndPermissions({silentLoading:!0})),yield Vi(Kn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Lv(e){let{payload:{callback:t}}=e,n=ni(e.payload,bv);yield Vi(Kn.setRolesState({saving:!0}));try{const e=yield Ki(Yu.roles.attachPermissionsToRole,n);yield Vi(Kn.loadRolesAndPermissions({silentLoading:!0})),yield Vi(Kn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Ov(e){let{payload:{callback:t}}=e,n=ni(e.payload,Av);yield Vi(Kn.setRolesState({saving:!0}));try{const e=yield Ki(Yu.roles.attachPermissionToRoles,n);yield Vi(Kn.loadRolesAndPermissions({silentLoading:!0})),yield Vi(Kn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Ev(){yield jo(Kn.loadRolesAndPermissions,kv),yield xo(Kn.addRole,Tv),yield xo(Kn.deleteRole,Pv),yield xo(Kn.updateRole,Iv),yield xo(Kn.attachPermissionsToRole,Lv),yield xo(Kn.attachPermissionToRoles,Ov)}const wv=["callback"],Cv=["callback"],Dv=["callback"];function*Rv(e){let{payload:{callback:t}}=e,n=ni(e.payload,wv);yield Vi(Kn.setResetPhoneNumberState({loading:!0}));try{const e=yield Ki(Yu.auth.resetPhoneNumber,n);yield Vi(Kn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Vt.VerifyResetPhoneNumber})),yield Vi(Kn.setLoginState({email:n.email}))}catch(e){yield Vi(Kn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*_v(e){let{payload:{callback:t}}=e,n=ni(e.payload,Cv);yield Vi(Kn.setResetPhoneNumberState({loading:!0}));try{const e=yield Ki(Yu.auth.verifyResetPhoneNumber,n);yield Vi(Kn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Vt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Vi(Kn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Uv(e){let{payload:{callback:t}}=e,n=ni(e.payload,Dv);yield Vi(Kn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ki(Yu.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Vi(Kn.setLoginState({step:St.loginWithSmsOtc})),yield Vi(Kn.passwordlessPreLogin({type:or.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Vi(Kn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Mv(){yield jo(Kn.resetPhoneNumber,Rv),yield jo(Kn.verifyResetPhoneNumber,_v),yield jo(Kn.changePhoneNumber,Uv)}function*Nv(){yield Vi(Kn.setSessionsState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getCurrentUserSessions);yield Vi(Kn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Vi(Kn.setSessionsState({error:e,loading:!1}))}}function*$v(){yield Vi(Kn.setSessionsState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getCurrentUserSession);yield Vi(Kn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Vi(Kn.setSessionsState({error:e,loading:!1}))}}function*Fv({payload:{id:e}}){yield Vi(Kn.setSessionsState({loading:!0,error:null}));try{yield Ki(Yu.auth.deleteSessionForUser,e),yield Vi(Kn.loadUserSessions())}catch(e){yield Vi(Kn.setSessionsState({error:e,loading:!1}))}}function*xv({payload:{callback:e,userId:t}}){yield Vi(Kn.setSessionsState({loading:!0,error:null}));try{yield Ki(Yu.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Vi(Kn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Vv(){yield Vi(Kn.setSessionsState({loading:!0,error:null}));try{yield Ki(Yu.auth.deleteAllSessionsForUser),yield Vi(Kn.loadUserSessions())}catch(e){yield Vi(Kn.setSessionsState({error:e,loading:!1}))}}function*jv(){yield Vo(Kn.loadUserSessions,Nv),yield Vo(Kn.deleteUserSession,Fv),yield Vo(Kn.deleteAllUserSessions,Vv),yield Vo(Kn.loadCurrentUserSession,$v),yield xo(Kn.revokeUserSessions,xv)}function*Wv(){yield Vi(Kn.setSessionsState({loading:!0,error:null})),yield Vi(Kn.setSessionsState({sessions:Id,loading:!1}))}function*Kv({payload:{id:e}}){yield Vi(Kn.setSessionsState({loading:!0,error:null}));const t=(yield zi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Vi(Kn.setSessionsState({sessions:t,loading:!1}))}function*Gv(){yield Vi(Kn.setSessionsState({loading:!0,error:null}));const e=Id.filter((e=>e.current));yield Vi(Kn.setSessionsState({sessions:e,loading:!1}))}function*Bv(){yield Vo(Kn.loadUserSessions,Wv),yield Vo(Kn.deleteUserSession,Kv),yield Vo(Kn.deleteAllUserSessions,Gv)}const zv=["callback"],qv=["callback"];function*Hv(){yield Vi(Kn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getSessionConfigurations);yield Vi(Kn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Vi(Kn.setSessionsState({error:e,loading:!1}))}}function*Jv({payload:e}){yield Vi(Kn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ni(e,zv);yield Ki(Yu.auth.createOrUpdateSessionConfigrations,n),yield Vi(Kn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Vi(Kn.setSessionsPolicyState({error:e,loading:!1}))}}function*Yv(){yield jo(Kn.loadSessionsPolicy,Hv),yield Vo(Kn.createOrUpdateSessionsPolicy,Jv)}function*Qv(){yield Vi(Kn.setSessionsPolicyState({loading:!0,error:null}));const e=yield zi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Ld}));yield Vi(Kn.setSessionsPolicyState(P({},e,{loading:!1})))}function*Xv({payload:e}){yield Vi(Kn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ni(e,qv);null==t||t(!0),yield Vi(Kn.setSessionsPolicyState({configurations:n,loading:!1}))}function*Zv(){yield jo(Kn.loadSessionsPolicy,Qv),yield Vo(Kn.createOrUpdateSessionsPolicy,Xv)}const eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=["callback"],lh=["callback"],sh=()=>zi((e=>e.auth.restrictionsState.ipRestrictions)),ch=()=>zi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*uh(){yield Vi(Kn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ki(Yu.auth.getDomainRestrictionsConfig),t=(yield Ki(Yu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Vi(Kn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Vi(Kn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*dh(e){let{payload:{callback:t}}=e,n=ni(e.payload,eh);yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield ch();try{var o;yield Ki(Yu.auth.createDomainRestriction,n);const e=(yield Ki(Yu.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*yh(e){let{payload:{callback:t}}=e,n=ni(e.payload,th);yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ki(Yu.auth.updateDomainRestrictionConfig,n),i=(yield Ki(Yu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*fh({payload:{id:e}}){yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield ch();try{var n;yield Ki(Yu.auth.deleteDomainRestriction,e);const i=(yield Ki(Yu.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Rn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Vi(Kn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const gh=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Rn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*ph(){yield Vi(Kn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield sh(),t=yield Ki(Yu.auth.getIPRestrictionsConfig),n=gh({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Ki(Yu.auth.getIPRestrictions,n);yield Vi(Kn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Vi(Kn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Sh(){try{const{valid:e}=yield Ki(Yu.auth.testCurrentIpInAllowList);yield Vi(Kn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Vi(Kn.setIpRestrictionsState({error:e.message}))}}function*vh({payload:{callback:e}}){yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield zi((e=>e.auth.userIp));yield ji([Ki(Yu.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Rn.ALLOW}),Ki(Yu.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield sh(),i=gh(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Ki(Yu.auth.getIPRestrictions,i);yield Vi(Kn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Rn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Vi(Kn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*hh(e){let{payload:{callback:t}}=e,n=ni(e.payload,nh);yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));const i=yield sh();try{var o,a;yield Ki(Yu.auth.createIPRestriction,n);const e=yield sh(),r=gh(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ki(Yu.auth.getIPRestrictions,r);yield Sh(),yield Vi(Kn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Rn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mh(e){let{payload:{callback:t}}=e,n=ni(e.payload,ih);yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));try{yield Ki(Yu.auth.updateIPRestrictionConfig,n);const e=yield sh(),i=yield Ki(Yu.auth.getIPRestrictionsConfig),o=gh(P({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ki(Yu.auth.getIPRestrictions,o);yield Sh(),yield Vi(Kn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*bh({payload:{id:e,callback:t}}){yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));const n=yield sh();try{var i;yield Ki(Yu.auth.deleteIPRestriction,e);const o=yield sh(),a=gh(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Ki(Yu.auth.getIPRestrictions,a);yield Sh(),yield Vi(Kn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Rn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ah(){yield jo(Kn.loadIpRestrictions,ph),yield jo(Kn.loadEmailDomainRestrictions,uh),yield xo(Kn.saveIpRestriction,hh),yield xo(Kn.saveIpRestrictionsConfig,mh),yield xo(Kn.deleteIpRestriction,bh),yield xo(Kn.checkIfUserIpValid,Sh),yield xo(Kn.addCurrentUserIpAndActivate,vh),yield xo(Kn.saveEmailDomainRestriction,dh),yield xo(Kn.saveEmailDomainRestrictionsConfig,yh),yield xo(Kn.deleteEmailDomainRestriction,fh)}function*kh(){yield Vi(Kn.setIpRestrictionsState({loading:!0,error:null})),yield Vi(Kn.setIpRestrictionsState({data:{restrictions:Ed.filter((e=>e.strategy===Od.strategy)),config:Od},totalPages:1,pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Th(){yield Vi(Kn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield sh(),t=Ed[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Vi(Kn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Vi(Kn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Ph(e){var t,n,i;let{payload:{callback:o}}=e,a=ni(e.payload,oh);yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));const r=yield sh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Vi(Kn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Rn.ALLOW},restrictions:[...l,P({},a,{createdAt:new Date,updatedAt:new Date,id:Ep(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Ih(e){var t,n,i;let{payload:{callback:o}}=e,a=ni(e.payload,ah);const r=yield sh();yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null})),yield Vi(Kn.setIpRestrictionsState({data:{config:P({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Vi(Kn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Lh({payload:{id:e,callback:t}}){var n;yield Vi(Kn.setIpRestrictionsState({saving:!0,error:null}));const i=yield sh();yield Vi(Kn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Rn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Rn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Oh(){yield Vi(Kn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Vi(Kn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Rn.ALLOW}],config:{active:!0,listType:Rn.ALLOW,blockPublicDomains:!1}}}))}function*Eh(e){var t,n;let{payload:{callback:i}}=e,o=ni(e.payload,rh);const a=yield ch();yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),null==i||i(!0),yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],P({},o,{id:Date.now().toString()})]},saving:!1}))}function*wh(e){var t;let{payload:{callback:n}}=e,i=ni(e.payload,lh);const o=yield ch();yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),null==n||n(!0),yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Rn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Ch({payload:{id:e}}){var t,n;const i=yield ch();yield Vi(Kn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield dt(),yield Vi(Kn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Rn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Dh(){yield jo(Kn.loadIpRestrictions,kh),yield jo(Kn.loadEmailDomainRestrictions,Oh),yield xo(Kn.saveIpRestriction,Ph),yield xo(Kn.saveIpRestrictionsConfig,Ih),yield xo(Kn.deleteIpRestriction,Lh),yield xo(Kn.checkIfUserIpValid,Th),yield xo(Kn.saveEmailDomainRestriction,Eh),yield xo(Kn.saveEmailDomainRestrictionsConfig,wh),yield xo(Kn.deleteEmailDomainRestriction,Ch)}const Rh=["callback"],_h=["id"];function*Uh(e){const{count:t}=yield Ki(Yu.directory.countConfigurationUsers,e.id);return P({},e,{count:t})}function*Mh(){yield Vi(Kn.setProvisioningState({loading:!0,error:null}));try{const e=yield Ki(Yu.directory.getConfigs),t=yield ji(e.map((e=>Uh(e))));yield Vi(Kn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Vi(Kn.setProvisioningState({error:e.message,loading:!1}))}}function*Nh(e){let{payload:{callback:t}}=e,n=ni(e.payload,Rh);yield Vi(Kn.setProvisioningState({loading:!0,error:null}));try{const e=yield Ki(Yu.directory.createConfiguration,n),i=yield Ki(Yu.directory.getConfigs),o=yield ji(i.map((e=>Uh(e))));yield Vi(Kn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Vi(Kn.setProvisioningState({error:e.message,loading:!1}))}}function*$h(e){let{payload:{id:t}}=e,n=ni(e.payload,_h);yield Vi(Kn.setProvisioningState({loading:!0,error:null}));try{yield Ki(Yu.directory.updateConfiguration,t,n);const e=yield Ki(Yu.directory.getConfigs),i=yield ji(e.map((e=>Uh(e))));yield Vi(Kn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Vi(Kn.setProvisioningState({error:e.message,loading:!1}))}}function*Fh({payload:{id:e,callback:t}}){yield Vi(Kn.setProvisioningState({loading:!0,error:null}));try{yield Ki(Yu.directory.deleteConfiguration,e);const n=yield Ki(Yu.directory.getConfigs),i=yield ji(n.map((e=>Uh(e))));yield Vi(Kn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Vi(Kn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*xh(){yield jo(Kn.loadProvisionConnections,Mh),yield xo(Kn.createProvisionConnection,Nh),yield xo(Kn.deleteProvisionConnection,Fh),yield xo(Kn.updateProvisionConnection,$h)}var Vh={sagas:function*(){yield ji([Ki(Df),Ki(hp),Ki(bp),Ki(cp),Ki(Mv),Ki(qf),Ki(hg),Ki(Pg),Ki(Zg),Ki(bS),Ki(VS),Ki(Nd),Ki(YS),Ki(sy),Ki(rv),Ki(gv),Ki(Ev),Ki(jv),Ki(Yv),Ki(Ah),Ki(xh)])},mockSagas:function*(){yield ji([Ki(Uf),Ki(eg),Ki(Eg),Ki(op),Ki(_S),Ki(iv),Ki(my),Ki(Bv),Ki(cv),Ki(Sv),Ki(Zv),Ki(Dh)])},storeName:At,initialState:Vn,reducer:jn,actions:Kn};const jh=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>P({},t,{[e]:P({},t[e],n)})}),Wh={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Kh={setAuditLogsState:jh("auditLogsState"),resetAuditLogsState:e=>P({},e,{auditLogsState:Wh})},Gh={exportAuditsCsv:nt("auditLogs/exportAuditsCsv"),loadAuditLogs:nt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Bh={loading:!0},zh={setAuditsMetadataState:jh("auditsMetadataState"),resetAuditsMetadataState:e=>P({},e,{auditsMetadataState:Bh})},qh={loadAuditsMetadata:nt("auditLogs/loadAuditsMetadata")},Hh={auditLogsState:Wh,auditsMetadataState:Bh},{reducer:Jh,actions:Yh}=ot({name:Tt,initialState:Hh,reducers:P({resetState:e=>P({},e,Hh),setState:(e,{payload:t})=>P({},e,t)},Kh,zh)}),Qh=P({},Yh,Gh,qh),Xh=e=>"createdAt"!==e.id,Zh={total:20,data:Array.from(Array(5).keys()).map((e=>P({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},em={properties:[{showInTable:!0,name:"createdAt",displayName:"Time",type:"Timestamp",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!1},{showInTable:!0,name:"email",displayName:"User",type:"Email",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"action",displayName:"Action",type:"AlphaNumeric",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!0,name:"description",type:"AlphaNumeric",sortable:!1,filterable:!1,displayName:"Description",isPredefined:!0,chosen:!1,selected:!1},{showInTable:!0,name:"ip",displayName:"IP Address",type:"IpAddress",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"severity",displayName:"Severity",type:"Severity",sortable:!0,filterable:!0,showInMoreInfo:"Always",chosen:!1,selected:!1,isPredefined:!0},{showInTable:!1,name:"userAgent",displayName:"User Agent",type:"AlphaNumeric",filterable:!0,sortable:!0,isPredefined:!0,chosen:!1,selected:!1},{showInTable:!1,name:"json",type:"Json",sortable:!0,filterable:!0,displayName:"Json Data",showInMoreInfo:"Always",isPredefined:!1}]},tm=()=>zi((e=>e.auditLogs.auditLogsState)),nm=()=>zi((e=>e.auditLogs.auditsMetadataState));function*im(){const e=yield tm(),{columns:t}=yield nm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>P({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>P({},e,{[t.id]:t.value})),{});yield Vi(Qh.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Yu.audits.exportAudits(P({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Vi(Qh.setAuditLogsState({isDownloadingCsv:!1}))}function*om({payload:e}){yield Vi(Qh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield tm(),{columns:n}=yield nm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Vi(Qh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>P({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>P({},e,{[t.id]:t.value})),{});n||(yield Vi(Qh.loadAuditsMetadata()));const{data:g,total:p}=yield Ki(Yu.audits.getAudits,P({offset:c,count:s},y,f));yield Vi(Qh.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Vi(Qh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*am(){yield xo(Qh.exportAuditsCsv,im),yield xo(Qh.loadAuditLogs,om)}function*rm({payload:e}){yield Vi(Qh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield tm(),{columns:n}=yield nm();try{var i,o,a,r,l;const s=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Vi(Qh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Vi(Qh.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Zh;let i=n.filter((e=>t=>e.filter(Xh).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield Vi(Qh.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Vi(Qh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*lm(){yield xo(Qh.loadAuditLogs,rm)}function*sm(){yield Vi(Qh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ki(Yu.metadata.getAuditsMetadata);yield Vi(Qh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Vi(Qh.setAuditsMetadataState({error:e,loading:!1}))}}function*cm(){yield xo(Qh.loadAuditsMetadata,sm)}function*um(){yield Vi(Qh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=em;yield Vi(Qh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Vi(Qh.setAuditsMetadataState({error:e,loading:!1}))}}function*dm(){yield xo(Qh.loadAuditsMetadata,um)}var ym={sagas:function*(){yield ji([Ki(am),Ki(cm)])},mockSagas:function*(){yield ji([Ki(lm),Ki(dm)])},storeName:Tt,initialState:Hh,reducer:Jh,actions:Qh};const fm={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:gm,actions:pm,reducer:Sm}=ot({name:"audits",initialState:fm,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=P({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),vm=P({},pm,{initData:nt(`${gm}/initData`),loadAudits:nt(`${gm}/loadAudits`),removeFilter:nt(`${gm}/removeFilter`),filterData:nt(`${gm}/filterData`),exportCSV:nt(`${gm}/exportCSV`),deleteAudits:nt(`${gm}/deleteAudits`)}),hm=()=>zi((e=>e[gm]));function*mm(){const{sortBy:e,sortDirection:t}=yield hm();try{const n=yield Ki(Yu.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Vi(vm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Vi(vm.loadItemFailedAction(t))}}function*bm(){try{const e=yield Ki(Yu.metadata.getAuditsMetadata);yield Vi(vm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Vi(vm.loadItemFailedAction(t))}}const Am=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*km({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield hm(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield hm():{rowsData:[]};try{const e=Am(t),{data:l,total:d}=yield Ki(Yu.audits.getAudits,P({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Vi(vm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Vi(vm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Vi(vm.loadItemFailedAction(t))}}function*Tm(){yield Vi(vm.startLoading()),yield ji([mm(),bm(),km({payload:{onlyOneLoad:!1},type:""})]),yield Vi(vm.finishLoading())}function*Pm({payload:e}){const{filters:t}=yield hm(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Vi(vm.setFilterData(i))}function*Im({payload:e}){const{filters:t}=yield hm();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield Vi(vm.setFilterData(i))}function*Lm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield hm(),a=Am(e);yield Vi(vm.startDownloadingCsv());try{yield Yu.audits.exportAudits(P({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Vi(vm.stopDownloadingCsv())}}function*Om(){yield Vo(vm.initData,Tm),yield Vo(vm.removeFilter,Pm),yield Vo(vm.filterData,Im),yield Vo([vm.loadAudits,vm.textSearch,vm.onPageChange],km),yield Vo([vm.setFilterData,vm.setDataSorting,vm.startRefresh],(()=>km({payload:{appendMode:!1},type:""}))),yield Vo(vm.exportCSV,Lm)}const Em={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},wm={initData:()=>P({},Em),setConnectivityState:(e,{payload:t})=>P({},e,t),cleanWebhookTestData:e=>P({},e,{testResult:void 0}),cleanWebhookLogsData:e=>P({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return P({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>P({},e,{error:void 0}),cleanSlackData:e=>P({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>P({},e,{retryResult:P({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>P({},e,{retryResult:P({},e.retryResult,t)})}},Cm={loadSlackActions:nt("connectivity/loadSlackActions"),loadDataAction:nt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:nt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:nt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:nt("connectivity/loadScope"),deleteWebhookConfigAction:nt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:nt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:nt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Dm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Rm,actions:_m}=ot({name:kt,initialState:Dm,reducers:P({},wm)}),Um=P({},_m,Cm),Mm={slack:Yu.connectivity.getSlackConfiguration,email:Yu.connectivity.getEmailConfiguration,sms:Yu.connectivity.getSMSConfiguration,webhook:Yu.connectivity.getWebhooksConfigurations,categories:Yu.connectivity.getCategories,channelMap:Yu.connectivity.getChannelMaps},Nm={slack:Yu.connectivity.postSlackConfiguration,email:Yu.connectivity.postEmailConfiguration,sms:Yu.connectivity.postSMSConfiguration,webhook:Yu.connectivity.postWebhooksConfiguration},$m=["email","slack","sms","webhook"],Fm={sms:{title:"connectivity.sms",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"sms"},email:{title:"common.email",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({enabled:e})=>e)))&&t},image:"email"},slack:{title:"connectivity.slack",events:e=>{var t;return(null==e||null==(t=e.slackSubscriptions)?void 0:t.length)||0},isActive:e=>{var t;return null!=(t=!(null==e||!e.slackSubscriptions.some((({isActive:e})=>e))))&&t},image:"slack"},webhook:{title:"connectivity.webhook",events:e=>(null==e?void 0:e.length)||0,isActive:e=>{var t;return null!=(t=null==e?void 0:e.some((({isActive:e})=>e)))&&t},image:"webhook"}},xm=["id"],Vm=["id","enabled"],jm=["categories","channelMap"];function*Wm(e){return yield Ki(Gm,{payload:{api:e},type:""})}function*Km({payload:e=$m}){yield Vi(Um.setConnectivityState({isLoading:!0}));try{const t=yield ji([...e.map(Wm),yield Gm({payload:{api:"categories"},type:""}),yield function*(){return(yield ji(e.map((function*(e){return yield Gm({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>P({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Gm({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?P({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Fm[e[o]].events(i),active:Fm[e[o]].isActive(i),platform:Fm[e[o]].title,image:Fm[e[o]].image}]}):n:P({},n,{[`${jm[o-e.length]}`]:i})),{list:[],webhook:n});yield Vi(Um.setConnectivityState(P({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Vi(Um.setConnectivityState({isLoading:!1}))}}function*Gm({payload:{api:e,params:t}}){try{return yield Ki(Mm[e],t)}catch(e){return}}function*Bm(){try{yield Vi(Um.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ki(Yu.connectivity.getSlackChannels);yield Vi(Um.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Vi(Um.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*zm(e,t){const{connectivity:{list:n}}=yield zi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Fm[e].isActive(t);o!==i.active&&(yield Vi(Um.setConnectivityState({list:n.map((t=>t.key===e?P({},t,{active:o}):t))})))}function*qm({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield zi((e=>e.connectivity));try{if(yield Vi(Um.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield zi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield ji([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=ni(e,xm);return n===t.id&&JSON.stringify(P({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Ki(Nm.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ki(Yu.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield zi(),{processIds:i}=yield zi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield ji([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Ki("email"===t?Yu.connectivity.postEmailConfiguration:Yu.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,l=ni(o,Vm);return yield ji([yield Ki("email"===t?Yu.connectivity.patchEmailConfiguration:Yu.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Ki("email"===t?Yu.connectivity.putEmailSubscriptions:Yu.connectivity.putSMSSubscriptions,a,i,P({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Ki("email"===t?Yu.connectivity.deleteEmailSubscriptions:Yu.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Gm({payload:{api:t},type:""});yield Vi(Um.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield zm(t,e)}else yield Vi(Um.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Ki(Nm[e],t),!["sms","email"].includes(e)){const o=yield Gm({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Vi(Um.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield zm(e,o),null==n||n(!0)}}catch(e){var o;yield Vi(Um.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Hm({payload:e}){try{yield Yu.connectivity.postSlackCode(e)}catch{}yield Vi(Um.setConnectivityState({error:void 0,isSaving:!1}))}function*Jm(){const{slackChannels:e}=yield zi((e=>e.connectivity));try{yield Vi(Um.setConnectivityState({slackChannels:P({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ki(Yu.connectivity.getSlackScope);yield Vi(Um.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Vi(Um.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Ym({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield zi((e=>e.connectivity));try{yield Vi(Um.setConnectivityState({isSaving:!0})),yield Ki(Yu.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Gm({payload:{api:"webhook"},type:""});o&&(yield Vi(Um.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Qm({payload:e}){try{yield Vi(Um.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ki(Yu.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Vi(Um.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Vi(Um.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Vi(Um.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Xm({payload:e}){try{const{statusCode:t}=yield Ki(Yu.connectivity.postWebhookRetry,e);yield Vi(Um.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Vi(Um.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Zm({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield zi((e=>e.connectivity));try{yield Vi(Um.setConnectivityState({webhookLogs:P({},i,{isLoading:!0})}));const o=yield Ki(Yu.connectivity.getWebhookLog,e,n,t);yield Vi(Um.setConnectivityState({error:void 0,webhookLogs:P({isLoading:!1},o)}))}catch(e){yield Vi(Um.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var eb={sagas:function*(){yield xo(Um.loadDataAction,Km),yield Vo(Um.loadSlackActions,Bm),yield xo(Um.postDataAction,qm),yield xo(Um.postCodeAction,Hm),yield xo(Um.loadScope,Jm),yield xo(Um.deleteWebhookConfigAction,Ym),yield xo(Um.postWebhookTestAction,Qm),yield xo(Um.postWebhookRetryAction,Xm),yield Vo(Um.loadWebhookLogsAction,Zm)},storeName:kt,initialState:Dm,reducer:Rm,actions:Um};function tb(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,t.payload)}}}function nb(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>P({},n,{[e]:t(n[e],i)})}}function ib(e){return nb(e,((e,t)=>P({},e,{loading:t.payload})))}function ob(e){return nb(e,((e,t)=>P({},e,{error:t.payload,loading:!1})))}const ab={loading:!1,error:null,fetching:!0,plans:[]},{actions:rb,reducer:lb,name:sb}=ot({name:"subscriptions/plans",initialState:ab,reducers:P({},tb())}),cb=P({loadPlans:nt(`${sb}/loadPlans`)},rb),ub={loading:!1,error:null,fetching:!0,config:null},db=P({},tb()),{actions:yb,reducer:fb,name:gb}=ot({name:"subscriptions/config",initialState:ub,reducers:db}),pb=P({loadPaymentConfiguration:nt(`${gb}/loadPaymentConfiguration`)},yb),Sb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},vb=P({},tb(),{setCancellationLoading:ib("cancellation"),setCancellationError:ob("cancellation"),setRenewalLoading:ib("renewal"),setRenewalError:ob("renewal")}),{reducer:hb,actions:mb,name:bb}=ot({name:"subscriptions/billing/subscription",initialState:Sb,reducers:vb}),Ab=P({load:nt(`${bb}/loadSubscription`),cancelSubscription:nt(`${bb}/cancelSubscription`),renewSubscription:nt(`${bb}/renewSubscription`)},mb),kb={loading:!1,error:null,fetching:!0},Tb=P({},tb()),{reducer:Pb,actions:Ib,name:Lb}=ot({name:"subscriptions/billing/information",initialState:kb,reducers:Tb}),Ob=P({loadBillingInformation:nt(`${Lb}/loadBillingInformation`),cancelSubscription:Ab.cancelSubscription,renewSubscription:Ab.renewSubscription},Ib),Eb={loading:!1,error:null,fetching:!0},wb=P({},tb(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,t.payload)}}),{reducer:Cb,actions:Db,name:Rb}=ot({name:"subscriptions/billing/payment",initialState:Eb,reducers:wb}),_b=P({loadPaymentMethod:nt(`${Rb}/loadPaymentMethod`),submitPaymentMethod:nt(`${Rb}/submitPaymentMethod`),submitPaymentMethodError:nt(`${Rb}/submitPaymentMethodError`),submitPaymentMethodSuccess:nt(`${Rb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:nt(`${Rb}/updateBillingDetails`,(e=>({payload:e})))},Db),Ub={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Mb=P({},tb(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>P({},e,{invoiceDownload:P({},e.invoiceDownload,t.payload)})}}),{reducer:Nb,actions:$b,name:Fb}=ot({name:"subscriptions/billing/invoices",initialState:Ub,reducers:Mb}),xb=P({loadInvoices:nt(`${Fb}/loadInvoices`),downloadInvoice:nt(`${Fb}/downloadInvoice`,(e=>({payload:e})))},$b),Vb={information:kb,invoices:Ub,paymentMethod:Eb,subscription:Sb},jb={invoices:xb,information:Ob,paymentMethod:_b,subscription:Ab},Wb=Ne({invoices:Nb,information:Pb,paymentMethod:Cb,subscription:hb}),Kb={fetching:!0,loading:!1,error:null,confirmed:!1},Gb=P({},tb()),{actions:Bb,reducer:zb,name:qb}=ot({name:"subscriptions/checkout",initialState:Kb,reducers:Gb}),Hb=P({loadCheckout:nt(`${qb}/loadCheckout`),resetCheckout:nt(`${qb}/resetCheckout`),submitCheckout:nt(`${qb}/submitCheckout`),confirmCheckout:nt(`${qb}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:nt(`${qb}/errorCheckout`,(e=>({payload:e})))},Bb),Jb={loading:!1,error:null,cardSetupIntentSecret:null},Yb=P({},tb()),{reducer:Qb,actions:Xb,name:Zb}=ot({name:"subscriptions/stripe",initialState:Jb,reducers:Yb}),eA=P({loadCustomer:nt(`${Zb}/loadCustomer`),createCardSetupIntentSecret:nt(`${Zb}/createCardSetupIntentSecret`)},Xb),tA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:nA,reducer:iA,name:oA}=ot({name:"subscriptions/vendorPublicConfig",initialState:tA,reducers:P({},tb())}),aA=P({loadVendorPublicConfiguration:nt(`${oA}/loadVendorPublicConfiguration`)},nA),rA={config:ub,plans:ab,checkout:Kb,billing:Vb,stripe:Jb,vendorPublicConfig:tA},lA={config:pb,billing:jb,plans:cb,checkout:Hb,stripe:eA,vendorPublicConfig:aA},sA=Ne({config:fb,billing:Wb,plans:lb,checkout:zb,stripe:Qb,vendorPublicConfig:iA});let cA,uA,dA;function yA({policy:e}){return{policy:dA.AT_PERIOD_END}}function fA(e){switch(e){case bu.ACTIVE:return uA.ACTIVE;case bu.INCOMPLETE:return uA.INCOMPLETE;case bu.CANCELED:return uA.CANCELED;case bu.EXPIRED:return uA.EXPIRED;case bu.TRIALING:return uA.TRIALING;default:return uA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(cA||(cA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(uA||(uA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(dA||(dA={}));const gA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:bu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},pA=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],SA=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],vA=[{id:"id",externalId:"externalId",type:Au.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],hA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*mA(){yield xo(Ab.load,bA),yield xo(Ab.cancelSubscription,kA),yield xo(Ab.renewSubscription,TA)}function*bA(){const e=yield zi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield EA(e)}function*AA(){yield Vi(Ab.setLoading(!0));try{const[e]=yield Ki(Yu.subscriptions.getManagedSubscriptions);yield Vi(Ab.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Vi(Ab.setError(e))}}function*kA(){const{subscription:e}=yield zi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Vi(Ab.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Vi(Ab.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===bu.ACTIVE)try{yield Vi(Ab.setCancellationLoading(!0)),yield Ki(Yu.subscriptions.cancelManagedSubscription,t),yield AA(),yield Vi(Ab.setCancellationLoading(!1))}catch(e){yield Vi(Ab.setCancellationError(e.message))}}function*TA(){const{subscription:e}=yield zi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Vi(Ab.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Vi(Ab.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===ku.AT_PERIOD_END)try{yield Vi(Ab.setRenewalLoading(!0)),yield Ki(Yu.subscriptions.renewManagedSubscription,t),yield AA(),yield Vi(Ab.setRenewalLoading(!1))}catch(e){yield Vi(Ab.setCancellationError(e.message))}}function*PA(){yield Vi(Ab.setLoading(!0)),yield qi(500),yield Vi(Ab.setState({subscription:gA,fetching:!1,loading:!1,error:null}))}function*IA(){yield xo(Ab.load,PA)}function*LA(){yield xo(Ob.loadBillingInformation,OA)}function*OA(){yield function*(e){const t=yield zi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield zi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield EA(n,!1):yield Vi(Ob.setError(t?"Not authorized":"Internal feature failure"))}()}function*EA(e,t){yield Vi(Ob.setLoading(!0));try{var n,i;const o=yield Ki(Yu.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Ki(Yu.subscriptions.getSubscriptionPlan,a):([,l]=yield ji([Ki(AA),Ki(Yu.subscriptions.getSubscriptionPlan,a)]),s=yield zi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Vi(Ob.setState(P({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?uA.ACTIVE:fA(s.status),cancellation:s.cancellation&&yA(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield Vi(Ob.setError(e.message))}}function*wA(){yield function*(){var e,t;yield Vi(Ob.setLoading(!0)),yield qi(500),yield Vi(Ob.setState({loading:!1,fetching:!1,summary:{subscriptionId:gA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Tu.Stripe,externallyManaged:!1,currentPlanId:pA[0].id,defaultPlanId:pA[0].id},plan:P({},pA[0],{price:null==(e=pA[0].price)?void 0:e.amount,currency:null==(t=pA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*CA(){yield xo(Ob.loadBillingInformation,wA)}function*DA(){yield xo(_b.loadPaymentMethod,RA),yield xo(_b.submitPaymentMethod,UA),yield xo(_b.submitPaymentMethodError,MA),yield xo(_b.submitPaymentMethodSuccess,NA),yield xo(_b.updatePaymentMethodBillingDetails,_A)}function*RA(){yield Vi(_b.setLoading(!0));try{const e=(yield Ki(Yu.subscriptions.getPaymentMethods))[0];yield Vi(_b.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Vi(_b.setError(e.message))}}function*_A({payload:e}){yield Vi(_b.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Ki(Yu.subscriptions.updatePaymentMethodBillingDetails,t,P({email:n},i)),yield Ki(RA),null==o||o(!0)}catch(e){yield Vi(_b.setError(e.message)),null==o||o(!1)}yield Vi(_b.setLoading(!1))}function*UA(){yield Vi(_b.setLoading(!0))}function*MA({payload:e}){yield Vi(_b.setError(e))}function*NA(){yield Vi(_b.loadPaymentMethod())}function*$A(){yield Vi(_b.setLoading(!0)),yield qi(500);const e=vA[0];yield Vi(_b.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*FA(){yield xo(_b.loadPaymentMethod,$A)}function*xA(){yield xo(xb.loadInvoices,VA),yield xo(xb.downloadInvoice,jA)}function*VA(){yield Vi(xb.setLoading(!0));try{const e=(yield Ki(Yu.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield Vi(xb.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Vi(xb.setError(e.message))}}function*jA({payload:e}){yield Vi(xb.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ki(Yu.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Vi(xb.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Vi(xb.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*WA(){yield Vi(xb.setLoading(!0)),yield qi(500),yield Vi(xb.setState({loading:!1,fetching:!1,invoices:SA.map((e=>P({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Vi(xb.setLoading(!1))}function*KA(){yield xo(xb.loadInvoices,WA)}function*GA(){yield ji([Ki(LA),Ki(DA),Ki(xA),Ki(mA)])}function*BA(){yield ji([Ki(CA),Ki(FA),Ki(KA),Ki(IA)])}function*zA(){yield xo(Hb.loadCheckout,qA),yield xo(Hb.resetCheckout,HA),yield xo(Hb.submitCheckout,JA),yield xo(Hb.confirmCheckout,YA),yield xo(Hb.errorCheckout,XA)}function*qA(){yield Vi(Hb.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*HA(){yield Vi(Hb.setState({loading:!1,error:null,confirmed:!1}))}function*JA(){yield Vi(Hb.setState({loading:!0,error:null}))}function*YA({payload:{paymentMethodId:e,planId:t}}){const n=yield zi((e=>e.subscriptions.billing.subscription.subscription)),i=yield zi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===bu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Vi(Hb.setState({loading:!0,error:null})),o&&a)return yield QA(),void(yield Vi(Ab.setState({subscription:P({},n,{status:bu.ACTIVE})})));try{yield Ki(Yu.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ji([OA(),RA(),VA()]),yield QA()}catch(e){yield Vi(Hb.setState({loading:!1,error:e.message}))}}else yield Vi(Hb.setState({loading:!1,error:"Subscription not found"}))}function*QA(){yield Vi(Hb.setState({loading:!1,error:null,confirmed:!0}))}function*XA({payload:e}){yield Vi(Hb.setState({loading:!1,error:e}))}function*ZA(){yield xo(Hb.resetCheckout,HA)}function*ek(){yield xo(cb.loadPlans,tk)}function*tk(){yield Vi(cb.setLoading(!0));try{const e=(yield Ki(Yu.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield Vi(cb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Vi(cb.setError(e.message))}}function*nk(){yield Vi(cb.setLoading(!0)),yield qi(500),yield Vi(cb.setState({fetching:!1,loading:!1,plans:pA.map((e=>{var t,n;return P({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*ik(){yield xo(cb.loadPlans,nk)}function*ok(){yield xo(pb.loadPaymentConfiguration,ak)}function*ak(){yield Vi(pb.setLoading(!0));try{(yield Ki(Yu.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Tu.Stripe))?yield function*(){yield Vi(pb.setLoading(!0));try{const e=yield Ki(Yu.subscriptions.getStripePaymentProviderConfiguration);yield Vi(pb.setState({loading:!1,fetching:!1,config:{paymentProvider:cA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Vi(pb.setError(e.message))}}():yield Vi(pb.setError("Payment provider not configured"))}catch(e){yield Vi(pb.setError(e.message))}}function*rk(){yield Vi(pb.setLoading(!0)),yield qi(500),yield Vi(pb.setState({loading:!1,fetching:!1,config:{paymentProvider:cA.STRIPE,apiKey:""}}))}function*lk(){yield xo(pb.loadPaymentConfiguration,rk)}function*sk(){yield xo(eA.createCardSetupIntentSecret,ck)}function*ck({payload:e}){yield Vi(eA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ki(Yu.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Vi(eA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Vi(eA.setError(e.message))}}function*uk(){yield xo(aA.loadVendorPublicConfiguration,dk)}function*dk(){yield Vi(aA.setLoading(!0));try{const e=yield Ki(Yu.subscriptions.getVendorPublicConfigurations);yield Vi(aA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Vi(aA.setError(e.message))}}function*yk(){yield Vi(aA.setLoading(!0)),yield qi(500),yield Vi(aA.setState({fetching:!1,loading:!1,vendorPublicConfig:hA}))}function*fk(){yield xo(aA.loadVendorPublicConfiguration,yk)}var gk={sagas:function*(){yield ji([Ki(GA),Ki(zA),Ki(ek),Ki(ok),Ki(sk),Ki(uk)])},mockSagas:function*(){yield ji([Ki(BA),Ki(ZA),Ki(ik),Ki(lk),Ki(fk)])},reducer:sA,actions:lA,initialState:rA,storeName:"subscriptions"},pk={sagas:function*(){yield xo(Wd.loadVendorPublicInfo,Kd)},storeName:Pt,initialState:xd,reducer:Vd,actions:Wd};const{reducer:Sk}=ot({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Wo.setContext(t),P({},e,{context:t}))}}}),vk=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||Wo.setContext(e.context);const t=Co(),h=[...et({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=tt({middleware:h,preloadedState:{root:P({},e,{previewMode:n,urlStrategy:r}),[Vh.storeName]:P({},Vh.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:P({},Vh.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[ym.storeName]:P({},ym.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:P({},ym.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:P({},ym.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[gm]:P({},fm,null!=(v=null==o?void 0:o.audits)?v:{}),[eb.storeName]:eb.initialState,[gk.storeName]:gk.initialState,[pk.storeName]:pk.initialState},reducer:Ne({root:Sk,[Vh.storeName]:Vh.reducer,[ym.storeName]:ym.reducer,[gm]:Sm,[eb.storeName]:eb.reducer,[gk.storeName]:gk.reducer,[pk.storeName]:pk.reducer})});const m=function*(){yield ji([Ki(Vh.sagas),Ki(ym.sagas),Ki(Om),Ki(eb.sagas),Ki(gk.sagas),Ki(pk.sagas)])},b=function*(){yield ji([Ki(Vh.mockSagas),Ki(ym.mockSagas),Ki(gk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Kn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var hk=n(714),mk=n.n(hk);function bk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Ak(e){if(e.type)return e;if("#"===e.charAt(0))return Ak(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function kk(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function Tk(e){if(0===e.indexOf("#"))return e;const{values:t}=Ak(e);return`#${t.map(((e,t)=>function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(3===t?Math.round(255*e):e))).join("")}`}function Pk(e,t){if(e=Ak(e),t=bk(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return kk(e)}function Ik(e,t){if(e=Ak(e),t=bk(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(-1!==e.type.indexOf("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return kk(e)}const Lk=e=>{if(e)return{main:e,light:Tk(Ik(e,.4)),dark:Tk(Pk(e,.15)),hover:Tk(Pk(e,.15)),active:Tk(Pk(e,.2))}},Ok=e=>{if(e)return{main:e,light:Ik(e,.7),dark:Pk(e,.2)}},Ek=(e,t)=>{var n,i,o,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?P({},t,{palette:{primary:P({},Lk(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:P({},Lk(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:P({},Lk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:P({},Ok(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:P({},Ok(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:P({},Ok(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:P({},Ok(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},wk={},Ck={},Dk={},Rk={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class _k{constructor(){this._theme=wk,this._themeV2=Ck,this._navigation=Rk,this._localizations=Dk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _k;return n.set(e),_k._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,l;this._navigation=mk().all([null!=(t=Rk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=mk().all([null!=(i=wk)?i:{},Ek(null==e?void 0:e.theme,wk)]),this._themeV2=mk().all([null!=(o=Ck)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=mk().all([null!=(r=Dk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=Rk,this._theme=wk,this._themeV2=Ck,this._localizations=Dk}}}_k._instances={};var Uk={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on"},Mk=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},Nk=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},$k=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let Fk,xk,Vk,jk,Wk,Kk,Gk,Bk,zk,qk;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(Fk||(Fk={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(xk||(xk={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Vk||(Vk={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(jk||(jk={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(Wk||(Wk={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Kk||(Kk={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(Gk||(Gk={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(Bk||(Bk={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(zk||(zk={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(qk||(qk={}));const Hk={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},Jk={hidden:"hidden",edit:"edit"};var Yk="6.51.0",Qk=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];b(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(Yk),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=L(E().mark((function e(){var t,n,i,o,a;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=qo,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:_k.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=Uk,e.next=13;break;case 4:return e.prev=4,e.next=7,Fu();case 7:l.flags=e.sent,e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 13:case"end":return e.stop()}}),e,null,[[4,10]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=Mk(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=P({},t,{contextOptions:P({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?P({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:vk({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),T.setInstance(c,this)}var t,n,i,o;return k(e,[{key:"initContainers",value:(o=L(E().mark((function e(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;_k.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:h,FronteggTypes:m})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=L(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=L(E().mark((function e(){var t;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=L(E().mark((function e(t){var n;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,P({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),Xk=function(){function e(){b(this,e)}return k(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=T.getInstance(i);e&&t?(Wo.setAccessToken(t),Wo.setUser(P({},n,{accessToken:t})),o.store.dispatch(Kn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Kn.loadTenants())):(Wo.setAccessToken(null),Wo.setUser(null),o.store.dispatch(Kn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),Zk=function(){function e(){b(this,e)}return k(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).hideAdminPortal()}}]),e}(),eT=function(){function e(){b(this,e)}return k(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";T.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";T.getInstance(e).hideCheckoutDialog()}}]),e}(),tT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},nT=function(){function e(t,n,i,o){b(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:vk({context:a},this,!0,void 0,void 0,!0),this.options=P({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new Qk(this.options,t,!0),_k.set({},t)}var t;return k(e,[{key:"render",value:(t=L(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,$k(this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setStaticRoute",value:function(e){var t;null==(t=this.setRoute)||t.call(this,e)}},{key:"unmount",value:function(){try{var e;null==(e=this.app.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin Portal renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}}]),e}(),iT="modern",oT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[iT]},aT=function(){function e(t,n,i,o){b(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:vk({context:a},this,!0,void 0,void 0,!0),this.options=P({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new Qk(this.options,t,!0),_k.set({},t)}var t;return k(e,[{key:"render",value:(t=L(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,$k(this);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"unmount",value:function(){try{var e;null==(e=this.app.loginBoxRenderer)||e.unmount()}catch(e){console.error("Failed to unmount login box renderer",e)}}},{key:"setTheme",value:function(e){var t;this.themeOptions=e,this.themeSetter||console.warn("this.themeSetter is not defined yet"),null==(t=this.themeSetter)||t.call(this,this.themeOptions)}},{key:"setStaticRoute",value:function(e){var t;this.setRoute||console.warn("this.setRoute is not defined yet"),null==(t=this.setRoute)||t.call(this,e)}},{key:"setStore",value:function(e){this.store.dispatch({type:"auth/setState",payload:e})}}]),e}();function rT(e,t){return rT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},rT(e,t)}function lT(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rT(e,t)}function sT(e){return sT="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sT(e)}function cT(e,t){if(t&&("object"===sT(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function uT(e){return uT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uT(e)}function dT(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function yT(e,t,n){return yT=dT()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&rT(o,n.prototype),o},yT.apply(null,arguments)}function fT(e){var t="function"==typeof Map?new Map:void 0;return fT=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return yT(e,arguments,uT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),rT(n,e)},fT(e)}function gT(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=uT(e);if(t){var o=uT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return cT(this,n)}}var pT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new Qk(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){lT(n,e);var t=gT(n);function n(){var e;b(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return k(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=T.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=Nk(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=Nk(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=Nk(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=Nk(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=Nk(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=Nk(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(fT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));