@frontegg/js 6.46.0-alpha.2 → 6.46.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.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +54 -28
- package/umd/frontegg.production.min.js +1 -1
- package/version.js +1 -1
|
@@ -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 p?t:p,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 p(){}function g(){}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=p.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 g.prototype=S,u(b,"constructor",S),u(S,"constructor",g),g.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"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 YA},AdminPortalRenderer:function(){return ZA},AppHolder:function(){return k},CheckoutDialog:function(){return QA},FronteggApp:function(){return HA},HostedLogin:function(){return JA},LoginBoxRenderer:function(){return nk},defaultTheme:function(){return ek},getThemeAdminByName:function(){return XA},getThemeByName:function(){return tk},initialize:function(){return yk}});var e={};n.r(e),n.d(e,{Delete:function(){return qo},Get:function(){return Wo},Patch:function(){return zo},Post:function(){return Go},PostDownload:function(){return Ho},Put:function(){return Bo},getBaseUrl:function(){return jo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return La},getSubTenantsAsTree:function(){return Oa},getTenants:function(){return Ia},switchTenant:function(){return Pa}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return Xa},SocialLoginProviders:function(){return Qa},acceptInvitation:function(){return hr},activateAccount:function(){return pr},bulkCreateIPRestriction:function(){return Ba},changePhoneNumber:function(){return zl},changePhoneNumberWithVerification:function(){return Wl},checkIfAllowToRememberMfaDevice:function(){return hl},createDomainRestriction:function(){return Va},createIPRestriction:function(){return za},createOrUpdateSessionConfigrations:function(){return sl},createSSOConfiguration:function(){return Tl},createSSOConfigurationByMetadata:function(){return Ll},createSSODomain:function(){return El},createSSOGroup:function(){return _l},createSamlGroup:function(){return Hr},deleteAllSessionsForUser:function(){return ul},deleteDomainRestriction:function(){return Ka},deleteIPRestriction:function(){return Ha},deleteSSOConfiguration:function(){return Il},deleteSSODomain:function(){return wl},deleteSSOGroup:function(){return Nl},deleteSamlGroup:function(){return Yr},deleteSessionForUser:function(){return cl},deleteTenantApiToken:function(){return gl},deleteUserApiToken:function(){return Sl},disableMfa:function(){return Er},enrollMFAAuthenticatorAppForLogin:function(){return Cr},enrollMFASMSForLogin:function(){return _r},enrollMFAWebAuthnForLogin:function(){return $r},enrollMfa:function(){return Lr},exchangeOAuthTokens:function(){return xl},forgotPassword:function(){return kr},generateLoginResponse:function(){return ar},generateLoginResponseFromOAuthResponse:function(){return lr},generateLoginResponseV2:function(){return rr},getActivateAccountStrategy:function(){return gr},getCaptchaPolicy:function(){return Ua},getCurrentUserSession:function(){return al},getCurrentUserSessions:function(){return ol},getDomainRestrictions:function(){return Fa},getDomainRestrictionsConfig:function(){return xa},getGlobalSecurityPolicy:function(){return Ea},getIPRestrictions:function(){return Wa},getIPRestrictionsConfig:function(){return Ga},getLockoutPolicy:function(){return Ra},getMfaPolicy:function(){return wa},getOidcConfiguration:function(){return Qr},getPasswordConfigPolicy:function(){return $a},getPasswordHistoryPolicy:function(){return Na},getSSOConfigurations:function(){return kl},getSSODefaultRoles:function(){return Dl},getSSOGroups:function(){return Ml},getSSOPublicConfiguration:function(){return Xr},getSamlConfiguration:function(){return Vr},getSamlRoles:function(){return zr},getSamlRolesGroups:function(){return Br},getSamlVendorConfiguration:function(){return Kr},getSessionConfigurations:function(){return ll},getSocialLoginProviders:function(){return Zr},getSocialLoginProvidersV2:function(){return el},getTenantApiTokensData:function(){return yl},getUserApiTokensData:function(){return dl},getUserById:function(){return vl},getVendorConfig:function(){return nl},getVendorMfaPolicy:function(){return Ca},getVendorPublicAuthStrategiesConfig:function(){return Yl},loadPasswordConfig:function(){return Pr},login:function(){return yr},loginViaSocialLogin:function(){return tl},loginWithMfa:function(){return fr},logout:function(){return Ar},oidcPostLogin:function(){return dr},oidcPostLoginV2:function(){return Fl},passwordlessPostLogin:function(){return bl},passwordlessPreLogin:function(){return ml},postLogin:function(){return ur},preEnrollMFAAuthenticatorAppForLogin:function(){return wr},preEnrollMFASMSForLogin:function(){return Rr},preEnrollMFAWebAuthnForLogin:function(){return Mr},preLogin:function(){return sr},preLoginV2:function(){return $l},preLoginWithIdpType:function(){return cr},preVerifyMFASMSForLogin:function(){return Ur},preVerifyMFAWebAuthnForLogin:function(){return Fr},recoverMfaToken:function(){return Ir},refreshToken:function(){return mr},refreshTokenV2:function(){return br},resendActivationEmail:function(){return Sr},resendInvitationEmail:function(){return vr},resetPassword:function(){return Tr},resetPhoneNumber:function(){return jl},revokeSessionsForUser:function(){return rl},saveLockoutPolicy:function(){return _a},saveMfaPolicy:function(){return Da},savePasswordHistoryPolicy:function(){return Ma},setSSODefaultRoles:function(){return Rl},signUpUser:function(){return il},silentOAuthRefreshToken:function(){return Vl},testCurrentIp:function(){return Ja},testCurrentIpInAllowList:function(){return Ya},updateDomainRestrictionConfig:function(){return ja},updateIPRestrictionConfig:function(){return qa},updateSSOConfiguration:function(){return Pl},updateSSOConfigurationByMetadata:function(){return Ol},updateSSOGroup:function(){return Ul},updateSamlConfiguration:function(){return jr},updateSamlGroup:function(){return Jr},updateSamlRoles:function(){return qr},updateSamlVendorMetadata:function(){return Wr},updateTenantApiTokensData:function(){return pl},updateUserApiTokensData:function(){return fl},validateSSODomain:function(){return Cl},validateSamlDomain:function(){return Gr},verifyChangePhoneNumber:function(){return Gl},verifyInviteToken:function(){return Al},verifyMFAAuthenticatorAppForLogin:function(){return Dr},verifyMFASMSForLogin:function(){return Nr},verifyMFAWebAuthnForLogin:function(){return xr},verifyMfa:function(){return Or},verifyNewDeviceSession:function(){return Jl},verifyResetPhoneNumber:function(){return Kl},webAuthnCreateNewDeviceSession:function(){return Hl},webAuthnPostLogin:function(){return ql},webAuthnPreLogin:function(){return Bl}});var a={};n.r(a),n.d(a,{addUser:function(){return ns},changePassword:function(){return es},createInviteUserLink:function(){return as},deleteInviteUserLink:function(){return ls},deleteUser:function(){return is},getInviteLinkConfiguration:function(){return cs},getInviteUserLink:function(){return ss},getProfile:function(){return Ql},loadAvailablePermissions:function(){return ds},loadAvailableRoles:function(){return us},loadStats:function(){return ys},loadUsers:function(){return ts},resendActivationLink:function(){return fs},resendInvitationLink:function(){return ps},resendInvitationLinkToAllTenants:function(){return gs},updateInviteUserLink:function(){return rs},updateProfile:function(){return Xl},updateProfileImage:function(){return Zl},updateUser:function(){return os}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return bs},getCurrentUserIpMetadata:function(){return vs},getIpAdressMetadata:function(){return As},getNotificationsMetadata:function(){return hs},getSamlMetadata:function(){return ms}});var l={};n.r(l),n.d(l,{downloadReport:function(){return ws},getReport:function(){return Ls},getReports:function(){return Is},renderReport:function(){return Os},scheduleReport:function(){return Es},sendReport:function(){return Cs}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Ds},markAllAsRead:function(){return Us},updateNotificationIsPinned:function(){return _s},updateNotificationStatus:function(){return Rs}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Fs},getAudits:function(){return Ms},getAuditsStats:function(){return $s}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Xs},deleteEmailSubscriptions:function(){return Ys},deleteSMSConfiguration:function(){return oc},deleteSMSSubscriptions:function(){return nc},deleteSlackConfiguration:function(){return zs},deleteWebhooksConfiguration:function(){return lc},getCategories:function(){return dc},getChannelMaps:function(){return yc},getEmailConfiguration:function(){return qs},getSMSConfiguration:function(){return Zs},getSlackChannels:function(){return Ws},getSlackConfiguration:function(){return js},getSlackScope:function(){return Ks},getWebhookLog:function(){return sc},getWebhooksConfigurations:function(){return ac},patchEmailConfiguration:function(){return Js},patchSMSConfiguration:function(){return tc},postEmailConfiguration:function(){return Hs},postSMSConfiguration:function(){return ec},postSlackCode:function(){return Bs},postSlackConfiguration:function(){return Gs},postWebhookRetry:function(){return uc},postWebhookTest:function(){return cc},postWebhooksConfiguration:function(){return rc},putEmailSubscriptions:function(){return Qs},putSMSSubscriptions:function(){return ic}});var d={};n.r(d),n.d(d,{getSettings:function(){return pc},updateSettings:function(){return fc}});var y={};n.r(y),n.d(y,{addRole:function(){return mc},attachPermissionToRoles:function(){return Pc},attachPermissionsToRole:function(){return kc},deleteRole:function(){return bc},getPermissionCategories:function(){return Ic},getPermissions:function(){return Tc},getRoles:function(){return hc},updateRole:function(){return Ac}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return iu},ISubscriptionStatus:function(){return tu},PaymentMethodType:function(){return nu},ProviderType:function(){return ou},TenantCreatedAction:function(){return ru},TrialEndAction:function(){return au},cancelManagedSubscription:function(){return _c},cancelSubscription:function(){return Ec},createStripeCustomer:function(){return qc},createStripePaymentMethodSetupIntentSecret:function(){return Jc},createSubscription:function(){return zc},createTenantConfiguration:function(){return Xc},getManagedSubscription:function(){return Dc},getManagedSubscriptions:function(){return Rc},getPaymentMethod:function(){return Wc},getPaymentMethods:function(){return Kc},getPaymentProviders:function(){return Zc},getStripeCustomer:function(){return Bc},getStripePaymentProviderConfiguration:function(){return Hc},getSubscription:function(){return Oc},getSubscriptionInvoice:function(){return xc},getSubscriptionInvoicePdf:function(){return Vc},getSubscriptionInvoices:function(){return Fc},getSubscriptionPlan:function(){return $c},getSubscriptionPlans:function(){return Mc},getSubscriptionSummaries:function(){return Yc},getSubscriptions:function(){return Lc},getTenantConfiguration:function(){return Qc},getVendorPublicConfigurations:function(){return eu},renewManagedSubscription:function(){return Uc},renewSubscription:function(){return wc},updateManagedSubscription:function(){return Nc},updatePaymentMethodBillingDetails:function(){return Gc},updateSubscription:function(){return Cc}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return du}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return gu},addUserToTenantAndSubTenants:function(){return fu},loadAllUsers:function(){return yu},removeUserFromTenantAndSubTenants:function(){return pu},removeUserRolesFromSubTenants:function(){return Su},setUserRolesForSubTenants:function(){return vu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return hu}});var v={};n.r(v),n.d(v,{AuthStrategyEnum:function(){return Xa},ContextHolder:function(){return Fo},FronteggApiError:function(){return Vo},FronteggContext:function(){return xo},ISubscriptionCancellationPolicy:function(){return iu},ISubscriptionStatus:function(){return tu},MFAStrategyEnum:function(){return cu},PaymentMethodType:function(){return nu},ProviderType:function(){return ou},RestrictionType:function(){return Dn},SecondaryAuthStrategy:function(){return lu},SocialLoginProviders:function(){return Qa},TenantType:function(){return uu},WebAuthnDeviceType:function(){return su},api:function(){return ku},default:function(){return Tu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return mu},fronteggRefreshTokenUrl:function(){return bu},fronteggSilentRefreshTokenUrl:function(){return Au},loadFeatureFlags:function(){return hu}});var h={};function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 A(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(h),n.d(h,{AccountPageFields:function(){return xA},GeneralSettingsTabFields:function(){return KA},LoginRestrictionsTabFields:function(){return WA},Metadata:function(){return RA},PrivacyPageFields:function(){return FA},ProfilePageFields:function(){return $A},SecurityPageTabs:function(){return VA},SessionManagementTabFields:function(){return jA},SignupRestrictionsTabFields:function(){return GA},fieldAppearance:function(){return zA},tabAppearance:function(){return BA}});var k=function(){function e(){m(this,e)}return A(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 T(){return T=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},T.apply(this,arguments)}function P(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 I(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){P(a,i,o,r,l,"next",e)}function l(e){P(a,i,o,r,l,"throw",e)}r(void 0)}))}}k._apps={};var L=n(841),O=n.n(L);function E(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 w(e){return!!e&&!!e[ge]}function C(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)===Se}(e)||Array.isArray(e)||!!e[pe]||!!e.constructor[pe]||M(e)||$(e))}function D(e,t,n){void 0===n&&(n=!1),0===R(e)?(n?Object.keys:ve)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function R(e){var t=e[ge];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:M(e)?2:$(e)?3:0}function _(e,t){return 2===R(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function U(e,t,n){var i=R(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 M(e){return ue&&e instanceof Map}function $(e){return de&&e instanceof Set}function F(e){return e.o||e.t}function x(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=he(e);delete t[ge];for(var n=ve(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 V(e,t){return void 0===t&&(t=!1),K(e)||w(e)||!C(e)||(R(e)>1&&(e.set=e.add=e.clear=e.delete=j),Object.freeze(e),t&&D(e,(function(e,t){return V(t,!0)}),!0)),e}function j(){E(2)}function K(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function W(e){var t=me[e];return t||E(18,e),t}function G(){return se}function z(e,t){t&&(W("Patches"),e.u=[],e.s=[],e.v=t)}function B(e){q(e),e.p.forEach(J),e.p=null}function q(e){e===se&&(se=e.l)}function H(e){return se={p:[],l:se,h:e,m:!0,_:0}}function J(e){var t=e[ge];0===t.i||1===t.i?t.j():t.O=!0}function Y(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||W("ES5").S(t,e,i),i?(n[ge].P&&(B(t),E(4)),C(e)&&(e=Q(t,e),t.l||Z(t,e)),t.u&&W("Patches").M(n[ge].t,e,t.u,t.s)):e=Q(t,n,[]),B(t),t.u&&t.v(t.u,t.s),e!==fe?e:void 0}function Q(e,t,n){if(K(t))return t;var i=t[ge];if(!i)return D(t,(function(o,a){return X(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return Z(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=x(i.k):i.o;D(3===i.i?new Set(o):o,(function(t,a){return X(e,i,o,t,a,n)})),Z(e,o,!1),n&&e.u&&W("Patches").R(i,n,e.u,e.s)}return i.o}function X(e,t,n,i,o,a){if(w(o)){var r=Q(e,o,a&&t&&3!==t.i&&!_(t.D,i)?a.concat(i):void 0);if(U(n,i,r),!w(r))return;e.m=!1}if(C(o)&&!K(o)){if(!e.h.F&&e._<1)return;Q(e,o),t&&t.A.l||Z(e,o)}}function Z(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&V(t,n)}function ee(e,t){var n=e[ge];return(n?F(n):e)[t]}function te(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 ne(e){e.P||(e.P=!0,e.l&&ne(e.l))}function ie(e){e.o||(e.o=x(e.t))}function oe(e,t,n){var i=M(t)?W("MapSet").N(t,n):$(t)?W("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:G(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=be;n&&(o=[i],a=Ae);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):W("ES5").J(t,n);return(n?n.A:G()).p.push(i),i}function ae(e){return w(e)||E(22,e),function e(t){if(!C(t))return t;var n,i=t[ge],o=R(t);if(i){if(!i.P&&(i.i<4||!W("ES5").K(i)))return i.t;i.I=!0,n=re(t,o),i.I=!1}else n=re(t,o);return D(n,(function(t,o){i&&function(e,t){return 2===R(e)?e.get(t):e[t]}(i.t,t)===o||U(n,t,e(o))})),3===o?new Set(n):n}(e)}function re(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return x(e)}var le,se,ce="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ue="undefined"!=typeof Map,de="undefined"!=typeof Set,ye="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,fe=ce?Symbol.for("immer-nothing"):((le={})["immer-nothing"]=!0,le),pe=ce?Symbol.for("immer-draftable"):"__$immer_draftable",ge=ce?Symbol.for("immer-state"):"__$immer_state",Se=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ve="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,he=Object.getOwnPropertyDescriptors||function(e){var t={};return ve(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},me={},be={get:function(e,t){if(t===ge)return e;var n=F(e);if(!_(n,t))return function(e,t,n){var i,o=te(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||!C(i)?i:i===ee(e.t,t)?(ie(e),e.o[t]=oe(e.A.h,i,e)):i},has:function(e,t){return t in F(e)},ownKeys:function(e){return Reflect.ownKeys(F(e))},set:function(e,t,n){var i=te(F(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ee(F(e),t),a=null==o?void 0:o[ge];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(N(n,o)&&(void 0!==n||_(e.t,t)))return!0;ie(e),ne(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!==ee(e.t,t)||t in e.t?(e.D[t]=!1,ie(e),ne(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=F(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(){E(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){E(12)}},Ae={};D(be,(function(e,t){Ae[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ae.deleteProperty=function(e,t){return Ae.set.call(this,e,t,void 0)},Ae.set=function(e,t,n){return be.set.call(this,e[0],t,n,e[0])};var ke=function(){function e(e){var t=this;this.g=ye,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&&E(6),void 0!==i&&"function"!=typeof i&&E(7),C(e)){var l=H(t),s=oe(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?B(l):q(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(l,i),Y(e,l)}),(function(e){throw B(l),e})):(z(l,i),Y(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===fe&&(r=void 0),t.F&&V(r,!0),i){var u=[],d=[];W("Patches").M(e,r,u,d),i(u,d)}return r}E(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){C(e)||E(8),w(e)&&(e=ae(e));var t=H(this),n=oe(this,e,void 0);return n[ge].C=!0,q(t),n},t.finishDraft=function(e,t){var n=(e&&e[ge]).A;return z(n,t),Y(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ye&&E(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=W("Patches").$;return w(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Te=new ke,Pe=Te.produce,Ie=(Te.produceWithPatches.bind(Te),Te.setAutoFreeze.bind(Te),Te.setUseProxies.bind(Te),Te.applyPatches.bind(Te),Te.createDraft.bind(Te),Te.finishDraft.bind(Te),Pe);function Le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oe(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 Ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(n),!0).forEach((function(t){Le(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function we(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 Ce="function"==typeof Symbol&&Symbol.observable||"@@observable",De=function(){return Math.random().toString(36).substring(7).split("").join(".")},Re={INIT:"@@redux/INIT"+De(),REPLACE:"@@redux/REPLACE"+De(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+De()}};function _e(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 Ue(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(we(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(we(1));return n(Ue)(e,t)}if("function"!=typeof e)throw new Error(we(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(we(3));return a}function d(e){if("function"!=typeof e)throw new Error(we(4));if(s)throw new Error(we(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(we(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!_e(e))throw new Error(we(7));if(void 0===e.type)throw new Error(we(8));if(s)throw new Error(we(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(we(10));o=e,y({type:Re.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(we(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ce]=function(){return this},e}return y({type:Re.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ce]=p,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:Re.INIT}))throw new Error(we(12));if(void 0===n(void 0,{type:Re.PROBE_UNKNOWN_ACTION()}))throw new Error(we(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(we(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Me(){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 $e(){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(we(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Me.apply(void 0,a)(n.dispatch),Ee(Ee({},n),{},{dispatch:i})}}}function Fe(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 xe=Fe();xe.withExtraArgument=Fe;var Ve,je=xe,Ke=(Ve=function(e,t){return Ve=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])},Ve(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}Ve(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),We=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Ge=Object.defineProperty,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Be=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,He=function(e,t,n){return t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Je=function(e,t){for(var n in t||(t={}))Be.call(t,n)&&He(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],qe.call(t,n)&&He(e,n,t[n]);return e},Ye="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Me:Me.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Qe=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,We([void 0],e[0].concat(this)))):new(t.bind.apply(t,We([void 0],e.concat(this))))},t}(Array);function Xe(e){return C(e)?Ie(e,(function(){})):e}function Ze(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Qe);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(je):i.push(je.withExtraArgument(n.extraArgument))),i}function et(e){var t,n=function(e){return Ze(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 p=l;"function"==typeof p&&(p=p(n));var g=$e.apply(void 0,p),S=Me;c&&(S=Ye(Je({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=We([g],f):"function"==typeof f&&(v=f(v)),Ue(t,d,S.apply(void 0,v))}function tt(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 Je(Je({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 nt(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 it(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:Xe(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?nt(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=Je(Je({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?nt(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return Xe(e())};else{var c=Xe(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=We([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(w(e))return void 0===(i=n(e,t))?e:i;if(C(e))return Ie(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?tt(c,i):tt(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 ot="listenerMiddleware";tt(ot+"/add"),tt(ot+"/removeAll"),tt(ot+"/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[ge];return be.get(t,e)},set:function(t){var n=this[ge];be.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ge];if(!o.P)switch(o.i){case 5:i(o)&&ne(o);break;case 4:n(o)&&ne(o)}}}function n(e){for(var t=e.t,n=e.k,i=ve(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ge){var r=t[a];if(void 0===r&&!_(t,a))return!0;var l=n[a],s=l&&l[ge];if(s?s.t!==r:!N(l,r))return!0}}var c=!!t[ge];return i.length!==ve(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){me[e]||(me[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=he(n);delete a[ge];for(var r=ve(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:G(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ge,{value:a,writable:!0}),o},S:function(e,n,o){o?w(n)&&n[ge].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ge];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)D(a,(function(t){t!==ge&&(void 0!==o[t]||_(o,t)?r[t]||e(a[t]):(r[t]=!0,ne(n)))})),D(o,(function(e){void 0!==a[e]||_(a,e)||(r[e]=!1,ne(n))}));else if(5===l){if(i(n)&&(ne(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 at=(e,t)=>n=>T({},n,{[e]:t[e]}),rt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>T({},t,{[e]:T({},t[e],n)})}),lt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return T({},n,{[e]:T({},n[e],{[t]:T({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return T({},t,{[e]:T({},t[e],{loaders:T({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return T({},t,{[e]:T({},t[e],{errors:T({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),ut=(e=500)=>new Promise((t=>setTimeout(t,e))),dt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",yt=new Uint8Array(256);for(let e=0;e<dt.length;e++)yt[dt.charCodeAt(e)]=e;const ft=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=yt[e.charCodeAt(i)],a=yt[e.charCodeAt(i+1)],r=yt[e.charCodeAt(i+2)],l=yt[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+=dt[t[i]>>2],o+=dt[(3&t[i])<<4|t[i+1]>>4],o+=dt[(15&t[i+1])<<2|t[i+2]>>6],o+=dt[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 gt,St,vt;!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"}(gt||(gt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(St||(St={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(vt||(vt={}));const ht="FRONTEGG_AFTER_AUTH_REDIRECT_URL",mt="HOSTED_LOGIN_VERIFIER_KEY",bt="auth",At="connectivity",kt="auditLogs",Tt="vendor",Pt={flow:St.Login,step:gt.preLogin,loading:!1,email:"",tenants:[]},It={setLoginState:rt("loginState"),resetLoginState:at("loginState",{loginState:Pt})},Lt={requestAuthorize:tt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:tt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:tt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:tt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:tt("auth/afterAuthNavigation"),preLogin:tt("auth/preLogin",(e=>({payload:e}))),postLogin:tt("auth/postLogin",(e=>({payload:e}))),login:tt("auth/login",(e=>({payload:e}))),loginWithMfa:tt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:tt("auth/recoverMfa",(e=>({payload:e}))),logout:tt("auth/logout",(e=>({payload:e}))),silentLogout:tt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:tt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:tt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:tt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:tt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:tt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:tt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:tt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:tt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:tt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:tt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:tt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:tt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:tt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:tt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:tt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:tt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:tt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:tt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:tt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:tt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:tt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Ot;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ot||(Ot={}));const Et={step:Ot.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},wt={setActivateState:rt("activateState"),resetActivateState:at("activateState",{activateState:Et}),setActivateStrategyState:lt("activateState","activationStrategy")},Ct={activateAccount:tt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:tt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:tt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:tt("auth/resendActivationEmail",(e=>({payload:e})))};let Dt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Dt||(Dt={}));const Rt={step:Dt.validate},_t={setAcceptInvitationState:rt("acceptInvitationState"),resetAcceptInvitationState:at("acceptInvitationState",{acceptInvitationState:Rt})},Ut={acceptInvitation:tt("auth/acceptInvitation",(e=>({payload:e})))};let Nt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Nt||(Nt={}));const Mt={step:Nt.forgotPassword,loading:!1,email:"",passwordConfig:null},$t={setForgotPasswordState:rt("forgotPasswordState"),resetForgotPasswordState:at("forgotPasswordState",{forgotPasswordState:Mt})},Ft={forgotPassword:tt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:tt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:tt("auth/loadPasswordConfig",(e=>({payload:e})))};let xt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(xt||(xt={}));const Vt={step:xt.ResetPhoneNumber,loading:!1},jt={setResetPhoneNumberState:rt("resetPhoneNumberState"),resetResetPhoneNumberState:at("resetPhoneNumberState",{resetPhoneNumberState:Vt})},Kt={resetPhoneNumber:tt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:tt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:tt("auth/changePhoneNumber",(e=>({payload:e})))},Wt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Gt={setSSOLoader:st("ssoState"),setSSOError:ct("ssoState"),setSSOState:rt("ssoState"),resetSSOState:at("ssoState",{ssoState:Wt})},zt={loadSSOConfigurationsV2:tt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:tt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:tt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:tt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:tt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:tt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:tt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:tt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:tt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:tt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:tt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:tt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:tt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:tt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:tt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:tt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:tt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:tt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:tt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:tt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:tt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:tt("auth/oidcPostlogin",(e=>({payload:e})))},Bt={loading:!1,error:null},qt={setProfileState:rt("profileState"),resetProfileState:at("profileState",{profileState:Bt})},Ht={loadProfile:tt("auth/loadProfile"),saveProfile:tt("auth/saveProfile",(e=>({payload:e}))),changePassword:tt("auth/changePassword",(e=>({payload:e})))};let Jt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Jt||(Jt={}));const Yt={step:Jt.verify,loading:!1},Qt={setMfaState:rt("mfaState"),resetMfaState:at("mfaState",{mfaState:Yt})},Xt={enrollMfa:tt("auth/enrollMfa"),verifyMfa:tt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:tt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:tt("auth/disableMfa",(e=>({payload:e})))},Zt={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}},en={setTeamLoader:st("teamState"),setTeamError:ct("teamState"),setTeamState:rt("teamState"),resetTeamState:at("teamState",{teamState:Zt})},tn={loadUsers:tt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:tt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:tt("auth/loadRoles",(e=>({payload:e}))),addUser:tt("auth/addUser",(e=>({payload:e}))),addUserToSubTenants:tt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:tt("auth/updateUser",(e=>({payload:e}))),deleteUser:tt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:tt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:tt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:tt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:tt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:tt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:tt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:tt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:tt("auth/getInvitationLink"),createInvitationLink:tt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:tt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:tt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:tt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:tt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:tt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:tt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:tt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:tt("auth/closeLockUserDialog",(e=>({payload:e})))},nn={firstLoad:!0,loading:!1,error:""},on={setSocialLoginsState:rt("socialLoginState"),resetSocialLoginsState:at("socialLoginState",{socialLoginState:nn})},an={loadSocialLoginsConfiguration:tt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:tt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:tt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:tt("auth/setSocialLoginError",(e=>({payload:e})))};let rn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(rn||(rn={}));const ln={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:rn.SignUp},sn={setSignUpState:rt("signUpState"),resetSignUpState:at("signUpState",{signUpState:ln})},cn={signUpUser:tt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:tt("auth/resetSignUpStateSoft")},un={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},dn={setApiTokensLoader:st("apiTokensState"),setApiTokensError:ct("apiTokensState"),setApiTokensState:rt("apiTokensState"),resetApiTokensState:at("apiTokensState",{apiTokensState:un})},yn={loadApiTokens:tt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:tt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:tt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:tt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:tt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:tt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:tt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:tt("auth/deleteTenantApiToken",(e=>({payload:e})))},fn={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:rt("securityPolicyState"),setSecurityPolicyGlobalState:lt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:lt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:lt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:lt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:lt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:lt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:lt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:lt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:lt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:at("securityPolicyState",{securityPolicyState:fn})},gn={loadSecurityPolicy:tt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:tt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:tt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:tt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:tt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:tt("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:tt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:tt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:tt("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:tt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:tt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:tt("auth/loadPublicAuthStrategiesPolicy")},Sn={loading:!1},vn={setAccountSettingsState:rt("accountSettingsState"),resetAccountSettingsState:at("accountSettingsState",{accountSettingsState:Sn})},hn={loadAccountSettings:tt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:tt("auth/saveAccountSettings",(e=>({payload:e})))},mn={tenants:[],subTenants:[],loading:!0,tenantTree:null},bn={setTenantsState:rt("tenantsState"),resetTenantsState:at("tenantsState",{tenantsState:mn})},An={switchTenant:tt("auth/switchTenant",(e=>({payload:e}))),loadTenants:tt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:tt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:tt("auth/loadSubTenantsTree",(e=>({payload:e})))},kn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Tn={setRolesState:rt("rolesState"),resetRolesState:at("rolesState",{rolesState:kn})},Pn={loadRolesAndPermissions:tt("auth/loadRoles",(e=>({payload:e}))),addRole:tt("auth/addRole",(e=>({payload:e}))),updateRole:tt("auth/updateRole",(e=>({payload:e}))),deleteRole:tt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:tt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:tt("auth/attachPermissionToRoles",(e=>({payload:e})))},In={loading:!1,sessions:[]},Ln={setSessionsState:rt("sessionsState"),resetSessionsState:at("sessionsState",{sessionsState:In})},On={loadUserSessions:tt("auth/loadUserSessions"),loadCurrentUserSession:tt("auth/loadCurrentUserSession"),deleteUserSession:tt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:tt("auth/deleteAllUserSessions"),revokeUserSessions:tt("auth/revokeUserSessions",(e=>({payload:e})))},En={loading:!1,configurations:{}},wn={setSessionsPolicyState:rt("sessionsPolicyState"),resetSessionsPolicyState:at("sessionsPolicyState",{sessionsPolicyState:En})},Cn={loadSessionsPolicy:tt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:tt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Dn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Dn||(Dn={}));const Rn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Dn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},_n={setRestrictionsState:rt("restrictionsState"),setIpRestrictionsState:lt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:lt("restrictionsState","emailDomainRestrictions")},Un={checkIfUserIpValid:tt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:tt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:tt("auth/loadIpRestrictions"),saveIpRestriction:tt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:tt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:tt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:tt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:tt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:tt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:tt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Nn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:ln,loginState:Pt,activateState:Et,acceptInvitationState:Rt,forgotPasswordState:Mt,ssoState:Wt,profileState:Bt,mfaState:Yt,teamState:Zt,socialLoginState:nn,apiTokensState:un,securityPolicyState:fn,accountSettingsState:Sn,tenantsState:mn,rolesState:kn,resetPhoneNumberState:Vt,sessionsState:In,sessionsPolicyState:En,restrictionsState:Rn},Mn=T({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:$n,actions:Fn}=it({name:bt,initialState:Mn,reducers:T({resetState:e=>T({},e,Nn),setState:(e,{payload:t})=>T({},e,t),setUser:("user",(e,{payload:t})=>T({},e,{user:t}))},It,on,wt,_t,$t,jt,sn,qt,Gt,Qt,en,dn,pn,vn,bn,Tn,Ln,wn,_n)});const xn=T({},Fn,Lt,an,Ct,Ut,Ft,Kt,cn,Ht,zt,Xt,tn,yn,gn,hn,An,Pn,On,Cn,Un);var Vn=function(e){return"@@redux-saga/"+e},jn=Vn("CANCEL_PROMISE"),Kn=Vn("CHANNEL_END"),Wn=Vn("IO"),Gn=Vn("MATCH"),zn=Vn("MULTICAST"),Bn=Vn("SAGA_ACTION"),qn=Vn("SELF_CANCELLATION"),Hn=Vn("TASK"),Jn=Vn("TASK_CANCEL"),Yn=Vn("TERMINATE"),Qn=Vn("LOCATION");function Xn(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 Zn=function(e){return null==e},ei=function(e){return null!=e},ti=function(e){return"function"==typeof e},ni=function(e){return"string"==typeof e},ii=Array.isArray,oi=function(e){return e&&ti(e.then)},ai=function(e){return e&&ti(e.next)&&ti(e.throw)},ri=function e(t){return t&&(ni(t)||ci(t)||ti(t)||ii(t)&&t.every(e))},li=function(e){return e&&ti(e.take)&&ti(e.close)},si=function(e){return ti(e)&&e.hasOwnProperty("toString")},ci=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},ui=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[jn]=function(){clearTimeout(n)},i},di=function(e){return function(){return e}},yi=di(!0),fi=function(){},pi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var gi=function(e,t){T(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Si(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var vi=function(e){throw e},hi=function(e){return{value:e,done:!0}};function mi(e,t,n){void 0===t&&(t=vi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:hi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function bi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ai=function(e){return Array.apply(null,new Array(e))},ki=function(e){return function(t){return e(Object.defineProperty(t,Bn,{value:!0}))}},Ti=function(e){return e===Yn},Pi=function(e){return e===Jn},Ii=function(e){return Ti(e)||Pi(e)};function Li(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ii(e)?Ai(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ii(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=fi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Oi(e){return{name:e.name||"anonymous",location:Ei(e)}}function Ei(e){return e[Qn]}var wi=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)},Ci="TAKE",Di="CALL",Ri="FORK",_i="SELECT",Ui=function(e,t){var n;return(n={})[Wn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ni(e,t){return void 0===e&&(e="*"),ri(e)?(ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ui(Ci,{pattern:e})):li(n=e)&&n[zn]&&ei(t)&&ri(t)?Ui(Ci,{channel:e,pattern:t}):li(e)?(ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ui(Ci,{channel:e})):void 0;var n}function Mi(e,t){return Zn(t)&&(t=e,e=void 0),Ui("PUT",{channel:e,action:t})}function $i(e){var t=Ui("ALL",e);return t.combinator=!0,t}function Fi(e,t){var n,i=null;return ti(e)?n=e:(ii(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ni(n)&&ti(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function xi(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 Ui(Di,Fi(e,n))}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 Ui(Ri,Fi(e,n))}function ji(e){return void 0===e&&(e=qn),Ui("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 Ui(_i,{selector:e,args:n})}var Wi=xi.bind(null,ui);var Gi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},zi=[],Bi=0;function qi(e){try{Yi(),e()}finally{Qi()}}function Hi(e){zi.push(e),Bi||(Yi(),Xi())}function Ji(e){try{return Yi(),e()}finally{Xi()}}function Yi(){Bi++}function Qi(){Bi--}function Xi(){var e;for(Qi();!Bi&&void 0!==(e=zi.shift());)qi(e)}var Zi=function(e){return function(t){return e.some((function(e){return oo(e)(t)}))}},eo=function(e){return function(t){return e(t)}},to=function(e){return function(t){return t.type===String(e)}},no=function(e){return function(t){return t.type===e}},io=function(){return yi};function oo(e){var t="*"===e?io:ni(e)?to:ii(e)?Zi:si(e)?to:ti(e)?eo:ci(e)?no:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ao={type:Kn},ro=function(e){return e&&e.type===Kn};function lo(){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(ao)}))},(e={})[zn]=!0,e.put=function(e){if(!t)if(ro(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Gn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=io),t?e(ao):(e[Gn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Si(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Bn]?l(e):Hi((function(){l(e)}))},r}function so(e,t){var n=e[jn];ti(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var co,uo=0,yo=function(){return++uo};function fo(e){e.isRunning()&&e.cancel()}var po=((co={}).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):!ro(e)||r?n(e):n(Yn)};try{o.take(l,ei(a)?oo(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},co.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Hi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&oi(t)?so(t,n):n(t)}))},co.ALL=function(e,t,n,i){var o=i.digestEffect,a=uo,r=Object.keys(t);if(0!==r.length){var l=Li(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(ii(t)?[]:{})},co.RACE=function(e,t,n,i){var o=i.digestEffect,a=uo,r=Object.keys(t),l=ii(t)?Ai(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ii(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=fi,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)}))},co.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(oi(s))return void so(s,n);if(ai(s))return void Po(e,s,l.context,uo,Oi(a),!1,n);n(s)}catch(e){n(e,!0)}},co.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Zn(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},co.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(ai(o))return o;var a=!1;return mi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!oi(o)})}))}catch(e){return mi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Oi(t)}(c,a);Ji((function(){var t=Po(e,c,s.context,uo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},co.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()&&Si(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ii(t)){if(0===t.length)return void n([]);var r=Li(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},co.CANCEL=function(e,t,n,i){var o=i.task;t===qn?fo(o):ii(t)?t.forEach(fo):fo(t),n()},co.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)}},co.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=wi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ao):e.isEmpty()?(n.push(i),i.cancel=function(){Si(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(ao):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])(ao)}}}}(t.buffer),a=oo(i),r=function t(n){ro(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)},co.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},co.FLUSH=function(e,t,n){t.flush(n)},co.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},co.SET_CONTEXT=function(e,t,n,i){var o=i.task;gi(o.context,t),n()},co);function go(e,t){return e+"?"+t}function So(e){var t=e.name,n=e.location;return n?t+" "+go(n.fileName,n.lineNumber):t}function vo(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 ho=null,mo=[],bo=function(e){e.crashedEffect=ho,mo.push(e)},Ao=function(){ho=null,mo.length=0},ko=function(){var e,t,n=mo[0],i=mo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Ei(e))?t.code+" "+go(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+So(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+So(e.meta)})),[vo(mo)]).join("\n")};function To(e,t,n,i,o,a,r){var l;void 0===r&&(r=fi);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Si(o,t),t.cont=fi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=fi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,bo({meta:o,cancelledTasks:y}),S.isRoot){var i=ko();Ao(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Jn?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={})[Hn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Jn,!1))},l.cont=r,l.end=g,l.setContext=function(e){gi(f,e)},l.toPromise=function(){return d||(d=Gi(),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 Po(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){oi(t)?so(t,i):ai(t)?Po(e,t,c.context,n,o,!1,i):t&&t[Wn]?(0,po[t.type])(e,t.payload,i,u):i(t)}));d.cancel=fi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(Jn))},status:0},c=To(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),Ao()):Pi(e)?(s.status=1,d.cancel(),o=ti(t.return)?t.return(Jn):{done:!0,value:Jn}):o=Ti(e)?ti(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=yo();function s(n,o){a||(a=!0,i.cancel=fi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ho=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=fi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=fi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Io(e,t){for(var n=e.channel,i=void 0===n?lo():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?bi:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=yo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||fi,s.effectTriggered=s.effectTriggered||fi,s.effectResolved=s.effectResolved||fi,s.effectRejected=s.effectRejected||fi,s.effectCancelled=s.effectCancelled||fi,s.actionDispatched=s.actionDispatched||fi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Me.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=pi;var m={channel:i,dispatch:ki(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Ji((function(){var e=Po(m,S,l,v,Oi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Lo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?lo():a,l=n.sagaMonitor,s=Xn(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Io.bind(null,T({},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){gi(o,e)},c},Oo=function(e){return{done:!0,value:e}},Eo={};function wo(e){return li(e)?"channel":si(e)?String(e):ti(e)?e.name:String(e)}function Co(e,t,n){var i,o,a,r=t;function l(t,n){if(r===Eo)return Oo(t);if(n&&!o)throw r=Eo,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===Eo?Oo(t):a}return mi(l,(function(e){return l(null,e)}),n)}function Do(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 Co({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+wo(e)+", "+t.name+")")}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,l={done:!1,value:Ni(e)},s=function(e){return{done:!1,value:Vi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:ji(e)}},u=function(e){return a=e},d=function(e){return r=e};return Co({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("+wo(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:Ni(e)},l=function(e){return{done:!1,value:xi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Co({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+wo(e)+", "+t.name+")")}function Uo(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:xi.apply(void 0,[n].concat(a))},s={done:!1,value:Wi(t)};return Co({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Eo}},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 Vi.apply(void 0,[Do,e,t].concat(i))}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];return Vi.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 Vi.apply(void 0,[_o,e,t].concat(i))}class Fo{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 Fo.instance||(Fo.instance=new Fo),Fo.instance}static setContext(e){Fo.getInstance().context=e}static setAccessToken(e){Fo.getInstance().accessToken=e}static setUser(e){Fo.getInstance().user=e}static setOnRedirectTo(e){Fo.getInstance().onRedirectTo=e}static setLogout(e,t){Fo.getInstance().logout=n=>{n?e(n):Fo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Fo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Fo.getInstance().accessToken}static getUser(){return Fo.getInstance().user}static onRedirectTo(e,t){return Fo.getInstance().onRedirectTo(e,t)}static logout(e){return Fo.getInstance().logout(e)}}Fo.instance=void 0;const xo={getContext:()=>Fo.getContext(),getAccessToken:()=>Fo.getAccessToken(),getUser:()=>Fo.getUser(),onRedirectTo:(e,t)=>Fo.onRedirectTo(e,t),logout:e=>Fo.logout(e)};class Vo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function jo(e,t){let n;n="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg";return n.endsWith("/")||(n+="/"),n.endsWith(i)||(n+=i),n}const Ko=async e=>{var t,n,i;const o=Fo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Fo.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=jo(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:T({},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 Vo("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 Vo(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{}}},Wo=async(e,t,n)=>Ko(T({url:e,method:"GET",contentType:"application/json",params:t},n)),Go=async(e,t,n)=>Ko(T({url:e,method:"POST",contentType:"application/json",body:t},n)),zo=async(e,t,n)=>Ko(T({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Bo=async(e,t,n)=>Ko(T({url:e,method:"PUT",contentType:"application/json",body:t},n)),qo=async(e,t,n)=>Ko(T({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ho=async(e,t,n,i)=>Ko(T({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Jo={v1:"/identity/resources/users/webauthn/v1/devices"},Yo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Qo={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"}}},Xo={v1:"/identity/resources/configurations/v1"},Zo={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ea={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ta={v1:"/identity/resources/permissions/v1"},na={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"}}},ia={v1:"/identity/resources/roles/v1"},oa={v1:"/identity/resources/sub-tenants/users/v1"},aa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ra={v1:"/team/resources/members/v1"},la={v1:"/team/resources/roles/v1"},sa={v1:"/team/resources/stats/v1"},ca={v1:"/team/resources/profile"},ua={v1:"/tenants/resources/account-settings/v1"},da={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ya={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},fa={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"},ga={v1:"/subscriptions/resources/subscriptions/v1"},Sa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},va={v1:"/reports/engine/resources/triggers/v1"},ha="/notification",ma="/audits",ba={v1:"/event/resources/configurations/v1"},Aa="/webhook",ka="/oauth",Ta="/flags";async function Pa(e){return Bo(`${Qo.v1}/tenant`,e)}async function Ia(){return Wo(`${Qo.v2}/me/tenants`)}async function La(){return Wo(da.v1)}async function Oa(){return Wo(da.tree.v1)}async function Ea(){return Wo(Xo.v1)}async function wa(){return Wo(`${Xo.v1}/mfa-policy`)}async function Ca(){return Wo(`${Xo.v1}/mfa-policy/vendor`)}async function Da(e){return e.id?zo(`${Xo.v1}/mfa-policy`,e):Go(`${Xo.v1}/mfa-policy`,e)}async function Ra(){return Wo(`${Xo.v1}/lockout-policy`)}async function _a(e){return e.id?zo(`${Xo.v1}/lockout-policy`,e):Go(`${Xo.v1}/lockout-policy`,e)}async function Ua(){try{return await Wo(`${Xo.v1}/captcha-policy/public`)}catch{return null}}async function Na(){return Wo(`${Xo.v1}/password-history-policy`)}async function Ma(e){return e.id?zo(`${Xo.v1}/password-history-policy`,e):Go(`${Xo.v1}/password-history-policy`,e)}async function $a(){return Wo(`${Xo.v1}/password`)}async function Fa(){return Wo(`${Zo.emailDomain.v1}`)}async function xa(){return Wo(`${Zo.emailDomain.v1}/config`)}async function Va(e){return Go(`${Zo.emailDomain.v1}`,e)}async function ja(e){return Go(`${Zo.emailDomain.v1}/config`,e)}async function Ka(e){return qo(`${Zo.emailDomain.v1}/${e}`)}async function Wa(e){return Wo(`${Zo.ip.v1}`,e)}async function Ga(){return Wo(`${Zo.ip.v1}/config`)}async function za(e){return Go(`${Zo.ip.v1}`,e)}async function Ba(e){return Go(`${Zo.ip.v1}/bulk`,e)}async function qa(e){return Go(`${Zo.ip.v1}/config`,e)}async function Ha(e){return qo(`${Zo.ip.v1}/${e}`)}async function Ja(){return Go(`${Zo.ip.v1}/verify`)}async function Ya(){return Go(`${Zo.ip.v1}/verify/allow`)}let Qa,Xa;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack"}(Qa||(Qa={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Xa||(Xa={}));class Za extends Error{constructor(e){super(e)}}const er="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Za("'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 tr extends Error{constructor(e){super(e)}}const nr=(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(er(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 er(t)}})(e.split(".")[n]))}catch(e){throw new tr("Invalid token specified: "+e.message)}},ir=["type"],or=["type"];async function ar(e){if(!e.accessToken)return e;Fo.setAccessToken(e.accessToken);const t=await Wo(`${Qo.v2}/me`),n=T({},e,e.accessToken?nr(e.accessToken):{},t);return Fo.setUser(n),n}async function rr(e){if(!e.accessToken)return{user:e};Fo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Wo(`${Qo.v2}/me`),Ia()]),i=T({},e,e.accessToken?nr(e.accessToken):{},t);return Fo.setUser(i),{user:i,tenants:n}}async function lr(e){Fo.setAccessToken(e.id_token);const t=await Wo(`${Qo.v2}/me`),n=e.id_token?nr(e.id_token):{},i=T({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 Fo.setUser(i),i}async function sr(e){try{const{address:t}=await Go(`${Yo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function cr(e){return Go(`${Yo.v1}/user/saml/prelogin`,e)}async function ur(e){return ar(await Go(`${Yo.v1}/user/saml/postlogin`,e))}async function dr(e){return ar(await Go(`${Yo.v1}/user/oidc/postlogin`,e))}async function yr(e){return ar(await Go(`${Yo.v1}/user`,e))}async function fr(e){return ar(await Go(`${Yo.v1}/user/mfa/verify`,e))}async function pr(e){return Go(`${Qo.v1}/activate`,e)}async function gr(e){return Wo(`${Qo.v1}/activate/strategy`,e)}async function Sr(e){return Go(`${Qo.v1}/activate/reset`,e)}async function vr(e){return Go(`${Qo.v1}/invitation/reset`,e)}async function hr(e){return Go(`${Qo.v1}/invitation/accept`,e)}async function mr(){return ar(await Go(`${Yo.v1}/user/token/refresh`))}async function br(){return rr(await Go(`${Yo.v1}/user/token/refresh`))}async function Ar(){return Go(`${Yo.v1}/logout`)}async function kr(e){return Go(`${Qo.v1}/passwords/reset`,e)}async function Tr(e){return Go(`${Qo.v1}/passwords/reset/verify`,e)}async function Pr(e){return Wo(`${Qo.v1}/passwords/config`,e)}async function Ir(e){return Go(`${Yo.v1}/user/mfa/recover`,e)}async function Lr(){return Go(`${Qo.v1}/mfa/enroll`)}async function Or(e){return Go(`${Qo.v1}/mfa/enroll/verify`,e)}async function Er(e){return Go(`${Qo.v1}/mfa/disable`,e)}async function wr(e){return Go(`${Yo.v1}/user/mfa/authenticator/enroll`,e)}async function Cr(e){return Go(`${Yo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Dr(e,t){return Go(`${Yo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Rr(e){return Go(`${Yo.v1}/user/mfa/sms/enroll`,e)}async function _r(e){return Go(`${Yo.v1}/user/mfa/sms/enroll/verify`,e)}async function Ur(e,t){return Go(`${Yo.v1}/user/mfa/sms/${e}`,t)}async function Nr(e,t){return Go(`${Yo.v1}/user/mfa/sms/${e}/verify`,t)}async function Mr(e){return Go(`${Yo.v1}/user/mfa/webauthn/enroll`,e)}async function $r(e){return Go(`${Yo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Fr(e,t){return Go(`${Yo.v1}/user/mfa/webauthn/${e}`,t)}async function xr(e,t){return Go(`${Yo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Vr(){return Wo(`${aa.v1}/saml/configurations`)}async function jr(e){return Go(`${aa.v1}/saml/configurations`,e)}async function Kr(){return Wo(`${aa.v1}/saml/configurations/vendor-config`)}async function Wr(e){return Bo(`${aa.v1}/saml/configurations/metadata`,e)}async function Gr(){return Bo(`${aa.v1}/saml/validations/domain`)}async function zr(){return Wo(`${aa.v1}/saml/configurations/roles/default`)}async function Br(){return Wo(`${aa.v2}/saml/configurations/groups`)}async function qr({roleIds:e}){return Go(`${aa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Hr({roleIds:e,group:t}){return Go(`${aa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Jr({roleIds:e,group:t,id:n}){return zo(`${aa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Yr({id:e}){return qo(`${aa.v2}/saml/configurations/groups/${e}`)}async function Qr(){return Wo(`${aa.v1}/oidc/configurations`)}async function Xr(){return Wo(`${aa.v2}/configurations/public`)}async function Zr(){return Wo(ea.v1)}async function el(){return Wo(ea.v2)}async function tl({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),Go(`${Yo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:a},{params:l})}async function nl(){return Wo(`${Xo.v1}/public`)}async function il(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Go(`${Qo.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await ar(n):void 0,userId:i,tenantId:o}}async function ol(){return Wo(Qo.sessions.currentUser.v1)}async function al(){return Wo(`${Qo.sessions.currentUser.v1}/current`)}async function rl(e){return Go(`${Qo.sessions.v1}/revoke`,{userId:e})}async function ll(){return Wo(Qo.sessions.configurations.v1)}async function sl(e){await Go(Qo.sessions.configurations.v1,e)}async function cl(e){await qo(`${Qo.sessions.currentUser.v1}/${e}`)}async function ul(){await qo(`${Qo.sessions.currentUser.v1}/all`)}async function dl(){return Wo(Qo.apiTokens.v1)}async function yl(){return Wo(na.apiTokens.v1)}async function fl(e){return Go(Qo.apiTokens.v1,e)}async function pl(e){return Go(na.apiTokens.v2,e)}async function gl({tokenId:e}){return qo(`${na.apiTokens.v1}/${e}`)}async function Sl({tokenId:e}){return qo(`${Qo.apiTokens.v1}/${e}`)}async function vl({userId:e}){return Wo(`${Qo.v1}/${e}`)}async function hl(e){return Wo(`${Xo.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ml(e){let{type:t}=e,n=Xn(e,ir);return Go(`${Yo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function bl(e){let{type:t}=e,n=Xn(e,or);return Go(`${Yo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Al({token:e}){return Go(na.invites.verify.v1,{token:e})}async function kl(){return Wo(`${aa.v1}/configurations`)}async function Tl(e){return Go(`${aa.v1}/configurations`,e)}async function Pl(e,t){return zo(`${aa.v1}/configurations/${e}`,t)}async function Il(e){return qo(`${aa.v1}/configurations/${e}`)}async function Ll(e){return Go(`${aa.v1}/configurations/metadata`,e)}async function Ol(e,t){return Bo(`${aa.v1}/configurations/${e}/metadata`,t)}async function El(e,t){return Go(`${aa.v1}/configurations/${e}/domains`,t)}async function wl(e,t){return qo(`${aa.v1}/configurations/${e}/domains/${t}`)}async function Cl(e,t){return Bo(`${aa.v1}/configurations/${e}/domains/${t}/validate`)}async function Dl(e){return Wo(`${aa.v1}/configurations/${e}/roles`)}async function Rl(e,t){return Bo(`${aa.v1}/configurations/${e}/roles`,t)}async function _l(e,t){return Go(`${aa.v1}/configurations/${e}/groups`,t)}async function Ul(e,{roleIds:t,group:n,id:i}){return zo(`${aa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Nl(e,t){return qo(`${aa.v1}/configurations/${e}/groups/${t}`)}async function Ml(e){return Wo(`${aa.v1}/configurations/${e}/groups`)}async function $l(e){return Go(`${Yo.v2}/user/sso/prelogin`,e)}async function Fl(e){return ar(await Go(`${Yo.v2}/user/oidc/postlogin`,e))}async function xl(e){return lr(await Go(`${ka}/token`,e))}async function Vl(){return lr(await Go(`${ka}/authorize/silent`))}async function jl(e){return Go(`${Qo.v1}/phone/reset`,e)}async function Kl(e){return Go(`${Qo.v1}/phone/reset/verify`,e)}async function Wl(e){return Go(`${Qo.v1}/phone`,e)}async function Gl(e){return Go(`${Qo.v1}/phone/verify`,e)}async function zl(e){return Bo(`${Qo.v1}/phone/change`,e)}async function Bl(e){return Go(`${Yo.v1}/webauthn/prelogin`,e)}async function ql(e){return Go(`${Yo.v1}/webauthn/postlogin`,e)}async function Hl(){return Go(Jo.v1)}async function Jl(e){return Go(`${Jo.v1}/verify`,e)}async function Yl(){return Wo(`${Xo.v1}/auth/strategies/public`)}async function Ql(e){return Wo(`${Qo.v2}/me`,null!=e?e:{addRoles:!0})}async function Xl(e){return Bo(`${Qo.v2}/me`,e)}async function Zl(e){return Bo(`${ca.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function es(e){return Go(`${Qo.v1}/passwords/change`,e)}async function ts(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>T({},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 Wo(ra.v1,T({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function ns(e){return Go(Qo.v2,T({},e,{provider:"local"}))}async function is(e){return qo(`${ra.v1}/${e.userId}`)}async function os(e){return Bo(ra.v1,e)}async function as(e){return Go(na.invites.user.v1,T({},e))}async function rs(e){return zo(na.invites.user.v1,T({},e))}async function ls(){return qo(na.invites.user.v1)}async function ss(){return Wo(na.invites.user.v1)}async function cs(){return Wo(na.invites.configuration.v1)}async function us(){return Wo(la.v1)}async function ds(){return Wo(ta.v1)}async function ys(){return Wo(`${sa.v1}/members`)}async function fs(e){return Go(`${ra.v1}/${e.userId}/resendActivationEmail`,{})}async function ps(e){return Go(Qo.v2,T({},e,{provider:"local"}))}async function gs(e){return Go(Qo.invitation.resendAll.v1,T({},e))}async function Ss(e){var t,n;const i=await Wo("/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 vs(){const e=await Wo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const hs=async()=>Ss({entityName:"notifications"}),ms=async()=>Ss({entityName:"saml"}),bs=async()=>Ss({entityName:"audits"}),As=async e=>async function(e){const t=await Wo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),ks=["dataFilters"],Ts=["templateId","dataFilters"],Ps=["dataFilters"];async function Is(e){return Wo(`${Sa.v2}/tenant-reports`,e)}async function Ls(e){return Wo(`${Sa.v2}/${e.id}/tenant-reports`)}async function Os(e){let{dataFilters:t}=e,n=Xn(e,ks);return{html:await Wo(`${va.v1}/preview-report`,T({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Es(e){let{templateId:t,dataFilters:n}=e,i=Xn(e,Ts);return Go(`${Sa.v2}/${t}/tenant-reports`,T({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ws(e){let{dataFilters:t}=e,n=Xn(e,Ps);const i=await Wo(`${va.v1}/preview-report`,T({},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 Cs(e){return Go(`${va.v1}/tenant-reports`,e)}async function Ds(e){return Wo(ha,{params:e})}async function Rs(e){return Bo(`${ha}/status`,{params:e})}async function _s(e){const{notificationId:t,pinStatus:n}=e;return Bo(`${ha}/${n}`,{notificationId:t})}async function Us(){return Go(`${ha}/status/mark-all-read`)}const Ns=["endpoint","headerProps"];async function Ms(e){return Wo(ma,e)}async function $s(e){return Wo(`${ma}/stats`,e)}async function Fs(e){const{endpoint:t,headerProps:n}=e,i=Xn(e,Ns);return Ho(`${ma}/export/${t}`,{properties:n},i)}const xs=["eventKey"],Vs=["eventKey"],js=()=>Wo(`${ya.v1}/slack`),Ks=()=>Wo(`${ya.v1}/slack/applications`),Ws=()=>Wo(`${ya.v1}/slack/channels`),Gs=e=>e.id?zo(`${ya.v1}/slack/subscription/${e.id}`,e):Go(`${ya.v1}/slack/subscriptions`,e),zs=e=>qo(`${ya.v1}/slack/subscriptions/${e.id}`),Bs=e=>Go(`${ya.v1}/slack/applications/registrations`,{code:e}),qs=()=>Wo(`${ya.v1}/emails`),Hs=e=>{let{eventKey:t}=e,n=Xn(e,xs);return Go(`${ya.v1}/emails/${t}`,n)},Js=({eventKey:e,enabled:t})=>zo(`${ya.v1}/emails/${e}`,{enabled:t}),Ys=(e,t)=>qo(`${ya.v1}/emails/${e}/subscriptions/${t}`),Qs=(e,t,n)=>Bo(`${ya.v1}/emails/${t}/subscriptions/${e}`,n),Xs=e=>qo(`${ya.v1}/emails/${e}`),Zs=()=>Wo(`${ya.v2}/sms`),ec=e=>{let{eventKey:t}=e,n=Xn(e,Vs);return Go(`${ya.v2}/sms/${t}`,n)},tc=({eventKey:e,enabled:t})=>zo(`${ya.v2}/sms/${e}`,{enabled:t}),nc=(e,t)=>qo(`${ya.v2}/sms/${e}/subscriptions/${t}`),ic=(e,t,n)=>Bo(`${ya.v2}/sms/${t}/subscriptions/${e}`,n),oc=e=>qo(`${ya.v2}/sms/${e}`),ac=()=>Wo(Aa),rc=e=>e._id?zo(`${Aa}/${e._id}`,e):Go(`${Aa}/custom`,e),lc=e=>qo(`${Aa}/${e}`),sc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Wo(`${Aa}/logs/?${i.toString()}`)},cc=e=>Go(`${Aa}/test`,e),uc=e=>Go(`${Aa}/logs/${e}/retries`),dc=()=>Wo(`${ba.v1}/categories`),yc=e=>Wo(ba.v1,{channels:e});async function fc(e){return Bo(ua.v1,e)}async function pc(){return Wo(ua.v1)}const gc=["roleId"],Sc=["roleId"],vc=["permissionId"];async function hc(){return Wo(ia.v1)}async function mc(e){return Go(ia.v1,e)}async function bc({roleId:e}){return qo(`${ia.v1}/${e}`)}async function Ac(e){let{roleId:t}=e,n=Xn(e,gc);return zo(`${ia.v1}/${t}`,n)}async function kc(e){let{roleId:t}=e,n=Xn(e,Sc);return Bo(`${ia.v1}/${t}/permissions`,n)}async function Tc(){return Wo(ta.v1)}async function Pc(e){let{permissionId:t}=e,n=Xn(e,vc);return Bo(`${ta.v1}/${t}/roles`,n)}async function Ic(){return Wo(`${ta.v1}/categories`)}async function Lc(){return Wo(fa.subscriptions.v1)}async function Oc(e){return Wo(`${fa.subscriptions.v1}/${e}`)}async function Ec(e){return Bo(`${fa.subscriptions.v1}/${e}/cancellations/`,{})}async function wc(e){return Bo(`${fa.subscriptions.v1}/${e}/renewals/`,{})}async function Cc(e,{paymentMethodId:t,planId:n}){return Bo(`${fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Dc(e){return Wo(`${ga.v1}/${e}`)}async function Rc(){return Wo(`${ga.v1}`)}async function _c(e){return Bo(`${ga.v1}/${e}/cancellations/`,{})}async function Uc(e){return Bo(`${ga.v1}/${e}/renewals/`,{})}async function Nc(e,{paymentMethodId:t,planId:n}){return Bo(`${ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Mc(){return Wo(fa.plans.v1)}async function $c(e){return Wo(`${fa.plans.v1}/${e}`)}async function Fc(){return Wo(fa.invoices.v1)}async function xc(e){return Wo(`${fa.invoices.v1}/${e}`)}async function Vc(e,t){return Wo(`${fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const jc=["email"];async function Kc(){return Wo(fa.paymentMethods.v1)}async function Wc(e){return Wo(`${fa.paymentMethods.v1}/${e}`)}async function Gc(e,t){let{email:n}=t,i=Xn(t,jc);return zo(`${fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function zc(e){return Go(fa.paymentProviders.stripe.subscriptions.v1,e)}async function Bc(e){return Wo(`${fa.paymentProviders.stripe.customers.v1}/${e}`)}async function qc(e){return Go(`${fa.paymentProviders.stripe.customers.v1}`,e)}async function Hc(){return Wo(`${fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function Jc(e){return Go(`${fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Yc(e){return Wo(`${fa.summaries.v1}/${e}`)}async function Qc(e){return Wo(`${fa.tenantConfiguration.v1}/${e}`)}async function Xc(e){return Go(`${fa.tenantConfiguration.v1}`,e)}async function Zc(){return Wo(pa.v1)}async function eu(){return Wo(`${fa.configurations.vendorPublicConfigurations.v1}`)}let tu,nu,iu,ou,au,ru,lu,su,cu,uu;async function du(){return Wo("/vendors/public")}async function yu(e){return Wo(oa.v1,e)}async function fu(e){return Go(oa.v1,e)}async function pu(e){return qo(oa.v1,e)}async function gu(e,t){return Go(`${oa.v1}/${e}/roles`,t)}async function Su(e,t){return qo(`${oa.v1}/${e}/roles`,t)}async function vu(e,t){return zo(`${oa.v1}/${e}/roles`,t)}async function hu(){return Wo(Ta)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(tu||(tu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(nu||(nu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(iu||(iu={})),(ou||(ou={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(au||(au={})),function(e){e.CREATE="create_customer"}(ru||(ru={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(lu||(lu={})),function(e){e.Android="Android",e.USBKey="USBKey",e.TouchID="TouchID"}(su||(su={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthn="WebAuthn",e.SMS="SMS"}(cu||(cu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(uu||(uu={}));const mu=[`${Yo.v1}/logout`,`${Yo.v1}/user/saml/postlogin`,`${Yo.v2}/user/oidc/postlogin`,`${Yo.v1}/user`,`${Yo.v1}/user/mfa/verify`,`${Yo.v1}/user/token/refresh`,`${Qo.v1}`,`${Qo.v1}/signUp`,`${Yo.v1}/passwordless/magiclink/postlogin`,`${Yo.v1}/passwordless/code/postlogin`,`${Yo.v1}/passwordless/smscode/postlogin`,`${Qo.v1}/activate`,`${Qo.v1}/invitation/accept`,`${ka}/token`,`${ka}/authorize/silent`],bu=`${Yo.v1}/user/token/refresh`,Au=`${ka}/authorize/silent`,ku={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S};var Tu={fetch:e,ContextHolder:Fo,FronteggContext:xo,api:ku,FronteggApiError:Vo,AuthStrategyEnum:Xa,SocialLoginProviders:Qa,ISubscriptionCancellationPolicy:iu,ISubscriptionStatus:tu,PaymentMethodType:nu,ProviderType:ou};let Pu,Iu;function Lu(e,t){const n=T({},e);return t.forEach((e=>{delete n[e]})),n}async function Ou(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 Eu(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"}(Pu||(Pu={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Iu||(Iu={}));const wu=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Cu={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Du=T({},Cu,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Ru={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},_u=T({},Ru,{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}),Uu={loading:!1,error:void 0,saving:!0,profile:Ru},Nu={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"},Mu={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Xa.EmailAndPassword},$u={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Fu={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},xu={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Vu={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},ju={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Ku=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Wu={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Vu,roles:Ku,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Gu=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],zu={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:[]},Bu={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:[]},qu={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Hu=[Bu,zu],Ju=[qu],Yu=[{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}],Qu=[{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"}],Xu={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Zu={isActive:!0,strategy:Dn.ALLOW},ed=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Dn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Dn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Dn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Dn.BLOCK,description:"IP 4"}];let td,nd,id;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(td||(td={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(nd||(nd={})),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"}(id||(id={})),id.profile,id.privacy,id.personalApiTokens,id.account,id.users,id.security,id.sso,id.audits,id.webhooks,id.apiTokens,id.roles,id.subscriptions;const od=["events","url"];function*ad(){yield Mi(xn.setSignUpState({loading:!0}));try{const e=yield xi(ku.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield Mi(xn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield Mi(xn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*rd(e){let{payload:{events:t,url:n}}=e,i=Xn(e.payload,od);yield Mi(xn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Ki((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield xi(ku.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:nd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Fo.setAccessToken(null==l?void 0:l.accessToken),Fo.setUser(l),!r&&l&&py(l)){const t=yield vy(l);yield Mi(xn.setState(t)),a(e.loginUrl)}else yield Mi(xn.setSignUpState({loading:!1,shouldActivate:r,stage:rn.SignUpSuccess})),yield Mi(xn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield Mi(xn.loadTenants()))}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setSignUpState({loading:!1,error:e.message}))}yield Mi(xn.setSignUpState({loading:!1}))}function*ld(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ki((e=>e.auth.signUpState));yield Mi(xn.resetSignUpState()),yield Mi(xn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*sd(){yield $o(xn.signUpUser,rd),yield $o(xn.resetSignUpStateSoft,ld)}const cd={setVendorState:(e,{payload:t})=>T({},e,t)},ud={loadVendorPublicInfo:tt("vendor/loadVendorPublicInfo")},dd={loading:!1},{reducer:yd,actions:fd}=it({name:Tt,initialState:dd,reducers:T({},cd)}),pd=T({},fd,ud);function*gd(){yield Mi(pd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield ku.vendor.getVendorPublicInfo();yield Mi(pd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Mi(pd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Sd=["callback"],vd=["callback"],hd=["callback"],md=["callback"],bd=["callback"],Ad=["callback"];function*kd(){yield Mi(xn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getGlobalSecurityPolicy);yield Mi(xn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Mi(xn.loadSecurityPolicyMfa()),yield Mi(xn.loadSecurityPolicyVendorMfa()),yield Mi(xn.loadSecurityPolicyLockout()),yield Mi(xn.loadSecurityPolicyCaptcha()),yield Mi(xn.loadPublicAuthStrategiesPolicy())}function*Td(){yield Mi(xn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getVendorConfig);yield Mi(xn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Pd(){yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getVendorPublicAuthStrategiesConfig);yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Id(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getMfaPolicy);yield Mi(xn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Ld(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getVendorMfaPolicy);yield Mi(xn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Od(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Sd);yield Mi(xn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield xi(ku.auth.saveMfaPolicy,n);yield Mi(xn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ed(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getLockoutPolicy);yield Mi(xn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*wd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,vd);yield Mi(xn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield xi(ku.auth.saveLockoutPolicy,n);yield Mi(xn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Cd(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getCaptchaPolicy);yield Mi(xn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Dd(){yield Mi(xn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getPasswordHistoryPolicy);yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Rd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,hd);yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield xi(ku.auth.savePasswordHistoryPolicy,n);yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_d(){yield Mi(xn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getPasswordConfigPolicy);yield Mi(xn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Ud(){yield $o(xn.loadSecurityPolicy,kd),yield No(xn.saveSecurityPolicyMfa,Od),yield No(xn.loadSecurityPolicyMfa,Id),yield No(xn.loadSecurityPolicyVendorMfa,Ld),yield No(xn.saveSecurityPolicyLockout,wd),yield No(xn.loadSecurityPolicyLockout,Ed),yield No(xn.loadSecurityPolicyCaptcha,Cd),yield No(xn.saveSecurityPolicyPasswordHistory,Rd),yield No(xn.loadSecurityPolicyPasswordHistory,Dd),yield No(xn.loadVendorPasswordConfig,_d),yield No(xn.loadPublicSecurityPolicy,Td),yield No(xn.loadPublicAuthStrategiesPolicy,Pd)}function*Nd(){yield Mi(xn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Mi(xn.setSecurityPolicyPublicState({policy:Mu,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Md(){yield Mi(xn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyGlobalState({policy:Nu,loading:!1})),yield Mi(xn.loadSecurityPolicyMfa()),yield Mi(xn.loadSecurityPolicyVendorMfa()),yield Mi(xn.loadSecurityPolicyLockout()),yield Mi(xn.loadSecurityPolicyCaptcha())}function*$d(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyMfaState({policy:$u,loading:!1}))}function*Fd(){yield Mi(xn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyVendorMfaState({policy:$u,loading:!1}))}function*xd(e){var t;let{payload:{callback:n}}=e,i=Xn(e.payload,md);yield Mi(xn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=T({},Fu,{id:null!=(t=i.id)?t:Fu.id,enforceMFAType:i.enforceMFAType});yield ut(),yield Mi(xn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Vd(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyLockoutState({policy:Fu,loading:!1}))}function*jd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,bd);yield Mi(xn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield ut();const i=T({},n,Fu,{id:n.id?n.id:Fu.id});null==t||t(i),yield Mi(xn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Kd(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyLockoutState({policy:Fu,loading:!1}))}function*Wd(){yield Mi(xn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:xu,loading:!1}))}function*Gd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Ad);yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield ut();const i=T({},n,xu,{id:n.id?n.id:xu.id});null==t||t(i),yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*zd(){yield $o(xn.loadSecurityPolicy,Md),yield No(xn.loadPublicSecurityPolicy,Nd),yield No(xn.saveSecurityPolicyMfa,xd),yield No(xn.loadSecurityPolicyMfa,$d),yield No(xn.loadSecurityPolicyVendorMfa,Fd),yield No(xn.saveSecurityPolicyLockout,jd),yield No(xn.loadSecurityPolicyLockout,Vd),yield No(xn.loadSecurityPolicyCaptcha,Kd),yield No(xn.saveSecurityPolicyPasswordHistory,Gd),yield No(xn.loadSecurityPolicyPasswordHistory,Wd)}const Bd=["callback"],qd=["callback"],Hd=["callback"],Jd=["callback"],Yd=["callback","events"],Qd=["callback"],Xd=["callback"],Zd=["callback"],ey=["callback"],ty=["callback"],ny=["callback"],iy=["callback"],oy=["callback"],ay=["callback"],ry=["callback","deviceId"],ly=["callback","deviceId"],sy=["callback","deviceId"],cy=["callback","deviceId"],uy={[Xa.Code]:gt.loginWithOtc,[Xa.EmailAndPassword]:gt.loginWithPassword,[Xa.MagicLink]:gt.magicLinkPreLoginSuccess,[Xa.SmsCode]:gt.loginWithSmsOtc};function*dy(){var e;const t=Fo.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(ht);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(ht),yield Wi(200),Mi(xn.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*yy(){let e;try{var t;const n=yield xi(ku.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Mi(xn.setState({ssoACS:e}))}function*fy(){try{const{isActive:e}=yield xi(ku.auth.getSSOPublicConfiguration);yield Mi(xn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const py=e=>e.mfaRequired&&e.mfaToken?(Fo.setAccessToken(null),Fo.setUser(null),!0):(Fo.setAccessToken(e.accessToken),Fo.setUser(e),!1),gy=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=e.webauthn.length,n=e.phones.length,i=e.authenticators.length;return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Jt.authenticatorApp;if(t)return Jt.smsVerifyCode}return Jt.verify},Sy=e=>{if(1===e.length){const[t]=e;return t===cu.AuthenticatorApp?Jt.authenticatorApp:t===cu.SMS?Jt.smsSetPhoneNumber:Jt.verify}};function*vy(e){let t=gt.loginWithTwoFactor,n={};const{loginState:i}=yield Ki((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield xi(ku.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:gy(e.mfaDevices)}:(n={step:Sy(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=gt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:St.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:T({},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*hy(){const{hostedLoginBox:e}=yield Ki((e=>e.auth));e?yield xi(my):yield xi(by)}function*my(){const{user:e}=yield Ki((e=>e.auth));if(null==e||!e.refreshToken)return Fo.setAccessToken(null),Fo.setUser(null),void(yield Mi(xn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield xi(ku.auth.exchangeOAuthTokens,t);yield Mi(xn.setState({user:n,isAuthenticated:!0})),yield Mi(xn.loadTenants())}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:null,isAuthenticated:!1}))}}function*by(){try{const n=Fo.onRedirectTo,{routes:i,loginState:o}=yield Ki((e=>e.auth)),{user:a,tenants:r}=yield xi(ku.auth.refreshTokenV2);if(py(a)){const e=yield vy(a);yield Mi(xn.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 Mi(xn.setTenantsState({tenants:r,loading:!1})),yield Mi(xn.setState({user:a,isAuthenticated:!0,loginState:T({},o,{quickLoginToRegister:l,flow:s?St.RegisterQuickLogin:St.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 dy())}}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}}function*Ay({payload:{callback:e}}){try{const{ip:t}=yield xi(ku.metadata.getCurrentUserIpMetadata);yield Mi(xn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ky({payload:e}){const t=[];e&&(yield Mi(xn.setState({isLoading:!0})),yield Mi(xn.loadSocialLoginsConfigurationV2()),t.push(xi(ad)),t.push(xi(Pd)),t.push(xi(fy)),t.push(xi(gd)),t.push(xi(yy))),t.push(xi(hy)),yield $i(t),yield Mi(xn.setState({isLoading:!1}))}function*Ty({accessToken:e,refreshToken:t}){if(!e)return Fo.setAccessToken(null),Fo.setUser(null),void(yield Mi(xn.setState({user:void 0,isAuthenticated:!1})));try{const n=Fo.onRedirectTo,{routes:i}=yield Ki((e=>e.auth)),{user:o,tenants:a}=yield xi(ku.auth.generateLoginResponseV2,{accessToken:e});if(py(o)){const e=yield vy(o);yield Mi(xn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else yield Mi(xn.setTenantsState({tenants:a,loading:!1})),yield Mi(xn.setState({user:T({},o,{refreshToken:t}),isAuthenticated:!0}))}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}}function*Py({payload:e}){const t=[];yield Mi(xn.setState({isLoading:!0})),yield Mi(xn.loadSocialLoginsConfigurationV2()),t.push(xi(ad)),t.push(xi(fy)),t.push(xi(gd)),t.push(xi(yy)),t.push(xi(Ty,e)),yield $i(t),yield Mi(xn.setState({isLoading:!1}))}function*Iy({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 xi(ku.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.loadTenants()),yield Mi(xn.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 Mi(xn.setState({isLoading:!0}));const a=Eu(),r=Eu(),l=yield xi(Ou,r);localStorage.setItem(mt,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${jo(n,"/oauth/authorize")}/oauth/authorize`,u=T({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*Ly({payload:e}){const t=localStorage.getItem(mt)||"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 xi(ku.auth.exchangeOAuthTokens,a);yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield dy()}}function*Oy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Bd);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(ku.auth.changePhoneNumberWithVerification,n);yield Mi(xn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:gt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*Ey(e){let{payload:{callback:t}}=e,n=Xn(e.payload,qd);try{yield Mi(xn.setLoginState({loading:!0})),yield xi(ku.auth.verifyChangePhoneNumber,n),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*wy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Hd);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(ku.auth.passwordlessPreLogin,T({},n,{type:Xa.SmsCode}));yield Mi(xn.setLoginState({step:gt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Cy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Jd);try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mi(xn.setLoginState({loading:!0}));const o=yield xi(ku.auth.passwordlessPreLogin,n),a=uy[n.type];if(a===gt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield Mi(xn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:xt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield Mi(xn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Dy(e){let{payload:{callback:t,events:n}}=e,i=Xn(e.payload,Yd);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(ku.auth.passwordlessPostLogin,i),a=Fo.onRedirectTo,{routes:r}=yield Ki((e=>e.auth));if(py(e)){const t=yield vy(e);yield Mi(xn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ki((e=>e.auth)),l=yield xi(ku.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:td.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield Mi(xn.setState({user:l,isAuthenticated:!0})),yield Mi(xn.setLoginState({error:void 0})),yield Mi(xn.loadTenants()),i.flow===St.Login?yield dy():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield Mi(xn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Ry({payload:e}){try{yield Mi(xn.setLoginState({loading:!0}));const{name:t}=yield xi(ku.auth.verifyInviteToken,e);yield Mi(xn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield Mi(xn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*_y({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Mi(xn.setLoginState({loading:!0}));try{const o=yield Ki((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield xi(ku.auth.preLoginV2,{email:e});if(a){if(r===Iu.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ki((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield Mi(xn.setLoginState({step:gt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield Uy({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Uy({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Uy(e){let{callback:t}=e,n=Xn(e,Qd);const i=yield Ki((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Xa.EmailAndPassword?(yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),null==t||t()):[Xa.MagicLink,Xa.Code,Xa.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Mi(xn.passwordlessPreLogin(T({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),null==t||t())}function*Ny({payload:{callback:e}}){try{yield Mi(xn.setLoginState({loading:!0}));const{options:t}=yield xi(ku.auth.webAuthnCreateNewDeviceSession);t.user.id=ft(t.user.id),t.challenge=ft(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Mi(xn.setLoginState({error:t.message})),null==e||e(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*My(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Xd);try{yield Mi(xn.setLoginState({loading:!0}));const e=pt(n.publicKey);yield xi(ku.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*$y(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Zd);try{var i;yield Mi(xn.setLoginState({loading:!0}));const{options:e}=yield xi(ku.auth.webAuthnPreLogin,n);e.challenge=ft(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>T({},e,{id:ft(e.id)}))),yield Mi(xn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Fy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ey);try{var i;yield Mi(xn.setLoginState({loading:!0}));const e=pt(n.publicKey),o=yield xi(ku.auth.webAuthnPostLogin,T({},e,{response:T({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(py(o)){const e=Fo.onRedirectTo,{routes:t}=yield Ki((e=>e.auth)),n=yield vy(o);yield Mi(xn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield xi(ku.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield Mi(xn.loadTenants()),yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.setLoginState({error:void 0})),yield dy(),null==t||t(!0)}}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*xy({payload:e}){const{onRedirectTo:t,routes:n}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mi(xn.setLoginState({loading:!0}));try{const t=yield xi(ku.auth.postLogin,e);Fo.setAccessToken(t.accessToken),Fo.setUser(t),yield Mi(xn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield dy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Mi(xn.setLoginState({step:gt.loginWithSSOFailed,loading:!1}))}}function*Vy({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Mi(xn.setLoginState({loading:!0}));try{const a=yield xi(ku.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Fo.setAccessToken(a.accessToken),Fo.setUser(a);const r=Fo.onRedirectTo,{routes:l}=yield Ki((e=>e.auth));if(py(a)){const e=yield vy(a);yield Mi(xn.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 Mi(xn.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===St.Login?gt.success:t.step,tenants:[],tenantsLoading:!0}})),yield Mi(xn.loadTenants()),n&&t.flow===St.Login&&(yield dy())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setLoginState({email:e,error:t.message,loading:!1}))}}function*jy({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Mi(xn.setLoginState({loading:!0}));try{const o=yield xi(ku.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Ki((e=>e.auth)),r=a.flow===St.Login?gt.success:a.step;yield Mi(xn.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 Mi(xn.loadTenants()),yield Mi(xn.setLoginState({error:void 0,loading:!1})),a.flow===St.Login&&(yield dy()),null==i||i(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Ky({payload:e}){yield Mi(xn.setLoginState({loading:!0}));try{yield xi(ku.auth.recoverMfaToken,e),yield Mi(xn.setLoginState({loading:!1,error:void 0,step:gt.preLogin})),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*Wy({payload:e}){yield Mi(xn.setState({isLoading:!0}));try{yield xi(ku.auth.logout)}catch{}yield Mi(xn.resetState()),yield Mi(xn.requestAuthorize(!0)),null==e||e()}function*Gy({payload:e}){var t;try{yield xi(ku.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*zy({user:e,tenants:t}){const n={step:Jt.recoveryCode,loading:!1,error:void 0};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield Mi(xn.setMfaState(n)),yield Mi(xn.setUser(e)),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*By({user:e,tenants:t}){const{loginState:n}=yield Ki((e=>e.auth));yield Mi(xn.setUser(e)),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===St.Login&&(yield dy()),yield Mi(xn.setState({isAuthenticated:!0}))}function*qy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ty);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(ku.auth.preEnrollMFASMSForLogin,n);yield Mi(xn.setMfaState({otcToken:e.otcToken,step:Jt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Hy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ny);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(ku.auth.enrollMFASMSForLogin,n),i=yield xi(ku.auth.generateLoginResponseV2,e);yield zy(i),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Jy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,iy);yield Mi(xn.setLoginState({loading:!0}));try{var i;const e=yield xi(ku.auth.preEnrollMFAWebAuthnForLogin,n),o=T({},e.options,{challenge:ft(e.options.challenge),user:T({},e.options.user,{id:ft(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>T({},e,{id:ft(e.id)})))});yield Mi(xn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Yy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,oy);yield Mi(xn.setLoginState({loading:!0}));try{const e=pt(n.publicKey),i=yield xi(ku.auth.enrollMFAWebAuthnForLogin,T({},n,{options:e})),o=yield xi(ku.auth.generateLoginResponseV2,i);yield zy(o),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Qy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ay);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(ku.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield xi(ku.auth.generateLoginResponseV2,e);yield zy(i),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Xy(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,ry);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(ku.auth.preVerifyMFASMSForLogin,n,i);yield Mi(xn.setMfaState({otcToken:e.otcToken,step:Jt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Zy(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,ly);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(ku.auth.verifyMFASMSForLogin,n,i),o=yield xi(ku.auth.generateLoginResponseV2,e);yield By(o),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*ef(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,sy);yield Mi(xn.setLoginState({loading:!0}));try{var o;const e=yield xi(ku.auth.preVerifyMFAWebAuthnForLogin,n,i),a=T({},e.options,{challenge:ft(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>T({},e,{id:ft(e.id)})))});yield Mi(xn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*tf(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,cy);yield Mi(xn.setLoginState({loading:!0}));try{const{loginState:e}=yield Ki((e=>e.auth)),o=pt(i.publicKey),a=yield xi(ku.auth.verifyMFAWebAuthnForLogin,n,T({},i,{options:o})),r=yield xi(ku.auth.generateLoginResponseV2,a);yield By(r),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*nf(){yield $o(xn.requestAuthorize,ky),yield $o(xn.requestAuthorizeSSR,Py),yield $o(xn.requestHostedLoginAuthorize,Iy),yield $o(xn.handleHostedLoginCallback,Ly),yield $o(xn.preLogin,_y),yield $o(xn.postLogin,xy),yield $o(xn.login,Vy),yield $o(xn.logout,Wy),yield $o(xn.silentLogout,Gy),yield $o(xn.loginWithMfa,jy),yield $o(xn.recoverMfa,Ky),yield $o(xn.quickSmsPasswordlessPreLogin,wy),yield $o(xn.changePhoneNumberWithVerification,Oy),yield $o(xn.verifyChangePhoneNumber,Ey),yield $o(xn.passwordlessPreLogin,Cy),yield $o(xn.passwordlessPostLogin,Dy),yield $o(xn.verifyInviteToken,Ry),yield $o(xn.webAuthnPrelogin,$y),yield $o(xn.webAuthnPostLogin,Fy),yield $o(xn.webAuthnCreateNewDeviceSession,Ny),yield $o(xn.webAuthnVerifyNewDeviceSession,My),yield $o(xn.afterAuthNavigation,dy),yield $o(xn.getUserIP,Ay),yield $o(xn.preEnrollMFASMSForLogin,qy),yield $o(xn.enrollMFASMSForLogin,Hy),yield $o(xn.preEnrollMFAWebAuthnForLogin,Jy),yield $o(xn.enrollMFAWebAuthnForLogin,Yy),yield $o(xn.enrollMFAAuthenticatorAppForLogin,Qy),yield $o(xn.preVerifyMFASMSForLogin,Xy),yield $o(xn.verifyMFASMSForLogin,Zy),yield $o(xn.preVerifyMFAWebAuthnForLogin,ef),yield $o(xn.verifyMFAWebAuthnForLogin,tf)}function*of({payload:e}){e&&(yield Mi(xn.setState({isLoading:!0})));const t=_u;yield Mi(xn.loadTenants()),yield Mi(xn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*af({payload:{callback:e}}){try{const{ip:t}=ed[0];yield Mi(xn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*rf(){yield $o(xn.requestAuthorize,of),yield $o(xn.afterAuthNavigation,dy),yield $o(xn.getUserIP,af)}const lf=["callback","samlVendor"],sf=["callback","samlVendor"];function*cf(){try{var e,t;yield Mi(xn.setSSOState({loading:!0}));const n=yield xi(ku.auth.getSamlConfiguration),i=yield xi(ku.auth.getOidcConfiguration),o=yield xi(ku.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 Mi(xn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSSOState({error:e.message,loading:!1}))}}function*uf({payload:e}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Mi(xn.setSSOState({error:void 0,[n]:!0}));try{const i=yield wu(e[0]),o=yield xi(ku.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Mi(xn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*df({payload:e}){const{configFile:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Mi(xn.setSSOState({error:void 0,[o]:!0}));try{const e=yield wu(t),a=yield xi(ku.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*yf({payload:e}){const{callback:t,samlVendor:n}=e,i=Xn(e,lf),o=yield Ki((e=>e.auth.ssoState.samlConfiguration)),a=T({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Mi(xn.setSSOState({samlConfiguration:T({},o,a)})));if(yield Mi(xn.setSSOState({error:void 0,[r]:!0})),e.type===Iu.Saml){var l,s;const e=yield xi(ku.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=Lu(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 xi(ku.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*ff({payload:{callback:e}={}}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration));try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(ku.auth.validateSamlDomain),yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*pf(){try{const e=yield xi(ku.auth.getSamlRoles),t=yield xi(ku.auth.getSamlRolesGroups);yield Mi(xn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Mi(xn.setSSOState({error:e.message}))}}function*gf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(ku.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield $i(e.map((e=>xi(ku.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Mi(xn.setSSOState({error:e.message}))}}(n)),yield pf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Sf({payload:{callback:e,id:t}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(ku.auth.deleteSamlGroup,{id:t}),yield pf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*vf({payload:{group:e,roleIds:t,callback:n}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(ku.auth.createSamlGroup,{group:e,roleIds:t}),yield pf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*hf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Mi(xn.setSSOState({loading:!0})),yield xi(ku.auth.oidcPostLoginV2,t),yield xi(hy),yield Mi(xn.setSSOState({loading:!1}))}catch(e){var n;yield Mi(xn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*mf(){yield No(xn.loadSSOConfigurations,cf),yield No(xn.saveSSOConfigurations,yf),yield No(xn.saveSSOConfigurationsFile,uf),yield No(xn.saveSSOConfigurationsFileWithCallback,df),yield No(xn.validateSSODomain,ff),yield No(xn.loadSSOAuthorizationRoles,pf),yield No(xn.updateSSOAuthorizationRoles,gf),yield No(xn.deleteSamlGroup,Sf),yield No(xn.createSamlGroup,vf),yield No(xn.oidcPostlogin,hf)}function*bf(){yield Mi(xn.setSSOState({loading:!0})),yield ut(),yield Mi(xn.setSSOState({samlConfiguration:Vu,loading:!1,firstLoad:!1}))}function*Af({payload:e}){const t="saving";yield Mi(xn.setSSOState({error:void 0,[t]:!0}));const n=T({},yield Ki((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Mi(xn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*kf({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Xn(e,sf),r=Wu.samlConfiguration,l=T({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Mi(xn.setSSOState({samlConfiguration:T({},r,l)})));yield Mi(xn.setSSOState({error:void 0,[s]:!0})),yield ut(),l.acsUrl=null==ju||null==(t=ju.configuration)?void 0:t.acsUrl,l.spEntityId=null==ju||null==(n=ju.configuration)?void 0:n.spEntityId;const c=Lu(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 ut(),yield Mi(xn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*Tf({payload:{callback:e}={}}){const t=Wu.samlConfiguration;yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield ut(),yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Pf(){yield ut(),yield Mi(xn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*If({payload:{callback:e,authorizationRoles:t}}){yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield ut(),yield Mi(xn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Lf(){yield No(xn.loadSSOConfigurations,bf),yield No(xn.saveSSOConfigurations,kf),yield No(xn.saveSSOConfigurationsFile,Af),yield No(xn.validateSSODomain,Tf),yield No(xn.loadSSOAuthorizationRoles,Pf),yield No(xn.updateSSOAuthorizationRoles,If)}const Of=["callback"],Ef=["callback","ssoConfigId"],wf=["callback","ssoConfigId"];function*Cf(){try{return yield xi(ku.auth.getOidcConfiguration)}catch(e){return null}}function*Df(){try{return yield xi(ku.metadata.getSamlMetadata)}catch(e){return null}}function*Rf(){try{yield Mi(xn.setSSOLoader({key:Pu.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield $i([xi(Cf),xi(Df)]),n=yield xi(ku.auth.getSSOConfigurations);yield Mi(xn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Mi(xn.setSSOError({key:Pu.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Mi(xn.setSSOLoader({key:Pu.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*_f({payload:e}){yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Xn(e,Of),i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield xi(ku.auth.createSSOConfiguration,T({},n,{enabled:null!=(o=n.enabled)&&o}));yield Mi(xn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Pu.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Uf({payload:e}){yield Mi(xn.setSSOLoader({key:Pu.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 wu(t),o=yield xi(ku.auth.createSSOConfigurationByMetadata,{metadata:e});yield Mi(xn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Mi(xn.setSSOError({key:Pu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Nf({payload:e}){yield Mi(xn.setSSOLoader({key:Pu.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Xn(e,Ef),o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield xi(ku.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Mi(xn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Pu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Mf({payload:e}){yield Mi(xn.setSSOLoader({key:Pu.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 wu(i),a=yield xi(ku.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Mi(xn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Mi(xn.setSSOError({key:Pu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*$f({payload:e}){yield Mi(xn.setSSOLoader({key:Pu.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(ku.auth.deleteSSOConfiguration,t),yield Mi(xn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOError({key:Pu.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ff({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Xn(e,wf);yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield xi(ku.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?T({},t,{domains:[...t.domains,e]}):t));yield Mi(xn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Pu.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_DOMAIN,value:!1}))}}function*xf({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Mi(xn.setSSOLoader({key:Pu.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(ku.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?T({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Mi(xn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Mi(xn.setSSOError({key:Pu.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.DELETE_SSO_DOMAIN,value:!1}))}}function*Vf({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Mi(xn.setSSOLoader({key:Pu.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(ku.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?T({},e,{domains:e.domains.map((e=>e.id===n?T({},e,{validated:!0}):e))}):e));yield Mi(xn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Mi(xn.setSSOError({key:Pu.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.VALIDATE_SSO_DOMAIN,value:!1}))}}function*jf({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Mi(xn.setSSOLoader({key:Pu.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(ku.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?T({},e,{roleIds:n}):e));yield Mi(xn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOError({key:Pu.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Mi(xn.setSSOLoader({key:Pu.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Kf({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_GROUPS,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield $i(t.map((e=>xi(ku.auth.deleteSSOGroup,n,e)))),yield $i(e.map((e=>xi(ku.auth.createSSOGroup,n,e))));const a=yield xi(ku.auth.getSSOGroups,n),r=o.map((e=>e.id===n?T({},e,{groups:a}):e));yield Mi(xn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Mi(xn.setSSOError({key:Pu.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_GROUPS,value:!1}))}}function*Wf({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield $i(t.map((t=>xi(ku.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Mi(xn.setSSOError({key:Pu.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Pu.SAVE_SSO_GROUPS,value:!1}))}}function*Gf(){yield No(xn.loadSSOConfigurationsV2,Rf),yield No(xn.saveSSOConfigurationV2,_f),yield No(xn.saveSSODomain,Ff),yield No(xn.deleteSSODomain,xf),yield No(xn.validateSSODomainV2,Vf),yield No(xn.updateSSOConfiguration,Nf),yield No(xn.deleteSSOConfiguration,$f),yield No(xn.setSSOGroups,Kf),yield No(xn.updateSSOGroups,Wf),yield No(xn.setSSODefaultRoles,jf),yield No(xn.saveSSOConfigurationByMetadata,Uf),yield No(xn.updateSSOConfigurationByMetadata,Mf)}const zf=["callback","profilePictureUrl"],Bf=["callback","profilePictureUrl"];function*qf(){yield Mi(xn.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 xi.apply(void 0,[Uo,e,t,n].concat(o))}(3,2e3,ku.teams.getProfile),t=yield Ki((e=>e.auth.user));xn.setUser(T({},t,e)),yield Mi(xn.setProfileState({profile:e,loading:!1}))}catch(e){yield Mi(xn.setProfileState({loading:!1,error:e.message}))}}function*Hf(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xn(e.payload,zf);yield Mi(xn.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 xi(ku.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=T({},e,i,{profilePictureUrl:o}),r=yield xi(ku.teams.updateProfile,a),l=yield Ki((e=>e.auth.user));yield Mi(xn.setUser(T({},l,r))),yield Mi(xn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield Mi(xn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Jf({payload:e}){yield Mi(xn.setProfileState({loading:!0}));try{var t;yield xi(ku.teams.changePassword,e),yield Mi(xn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Yf(){yield $o(xn.loadProfile,qf),yield No(xn.saveProfile,Hf),yield No(xn.changePassword,Jf)}function*Qf(){yield Mi(xn.setProfileState({loading:!0})),yield ut(),yield Mi(xn.setUser(T({},_u,Ru))),yield Mi(xn.setProfileState({loading:!1,profile:Ru}))}function*Xf(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xn(e.payload,Bf);yield Mi(xn.setProfileState({saving:!0,error:null}));const o=Uu;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=T({},o.profile,i,{profilePictureUrl:a}),l=_u;yield ut(),yield Mi(xn.setUser(T({},l,r))),yield Mi(xn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Zf({payload:e}){var t;yield Mi(xn.setProfileState({loading:!0})),yield ut(),yield Mi(xn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*ep(){yield $o(xn.loadProfile,Qf),yield No(xn.saveProfile,Xf),yield No(xn.changePassword,Zf)}const tp=["callback"],np=["callback"],ip=["callback"];function*op(){yield Mi(xn.setMfaState({loading:!0}));try{const{qrCode:e}=yield xi(ku.auth.enrollMfa);yield Mi(xn.setMfaState({loading:!1,error:void 0,qrCode:e}))}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message}))}}function*ap(e){let{payload:{callback:t}}=e,n=Xn(e.payload,tp);yield Mi(xn.setMfaState({loading:!0}));try{const e=yield Ki((e=>e.auth.user)),i=yield xi(ku.auth.verifyMfa,n),o={step:Jt.recoveryCode,loading:!1,error:void 0};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mi(xn.setMfaState(o)),yield Mi(xn.setUser(T({},e,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*rp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,np);yield Mi(xn.setMfaState({loading:!0}));try{const e=yield xi(ku.auth.loginWithMfa,n),i={step:Jt.recoveryCode,loading:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Mi(xn.setMfaState(i)),yield Mi(xn.setState({user:e})),yield Mi(xn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*lp({payload:e}){yield Mi(xn.setMfaState({loading:!0}));try{var t;const n=yield Ki((e=>e.auth.user));yield xi(ku.auth.disableMfa,e),yield Mi(xn.setMfaState({loading:!1,error:void 0})),yield Mi(xn.setUser(T({},n,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setMfaState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*sp(){yield No(xn.enrollMfa,op),yield No(xn.verifyMfa,ap),yield No(xn.disableMfa,lp),yield No(xn.verifyMfaAfterForce,rp)}function*cp(){yield Mi(xn.setMfaState({loading:!0})),yield Mi(xn.setMfaState({loading:!1,error:void 0,qrCode:"test"}))}function*up({payload:{callback:e}}){yield Mi(xn.setMfaState({loading:!0})),yield ut();const t={token:"token",recoveryCode:"recoveryCode"},n={step:Jt.recoveryCode,loading:!1,error:void 0};null!=t&&t.recoveryCode&&(n.recoveryCode=t.recoveryCode),yield Mi(xn.setMfaState(n)),yield Mi(xn.setUser(T({},_u,{mfaEnrolled:!0}))),null==e||e(n.recoveryCode)}function*dp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ip);yield Mi(xn.setMfaState({loading:!0})),yield ut();const i=T({},n,{recoveryCode:"recoveryCode"}),o={step:Jt.recoveryCode,loading:!1,error:void 0};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mi(xn.setMfaState(o)),yield ut(),yield Mi(xn.setUser(T({},_u,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*yp({payload:e}){var t;yield Mi(xn.setMfaState({loading:!0})),yield ut(),yield Mi(xn.setMfaState({loading:!1,error:void 0})),yield Mi(xn.setUser(T({},_u,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}function*fp(){yield No(xn.enrollMfa,cp),yield No(xn.verifyMfa,up),yield No(xn.disableMfa,yp),yield No(xn.verifyMfaAfterForce,dp)}const pp=["callback"];function*gp({payload:e}){yield Mi(xn.setForgotPasswordState({loading:!0}));try{yield xi(ku.auth.forgotPassword,e),yield Mi(xn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success}))}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*Sp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,pp);yield Mi(xn.setForgotPasswordState({loading:!0}));try{yield xi(ku.auth.resetPassword,n),yield Mi(xn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success})),null==t||t(!0)}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*vp({payload:e}){yield Mi(xn.setForgotPasswordState({loading:!0}));try{const t=yield xi(ku.auth.loadPasswordConfig,e);yield Mi(xn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message}))}}function*hp(){yield $o(xn.forgotPassword,gp),yield $o(xn.resetPassword,Sp),yield $o(xn.loadPasswordConfig,vp)}let mp;!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"}(mp||(mp={}));const bp=["callback","events"],Ap=["callback"],kp=["callback"];function*Tp({payload:{userId:e,token:t}}){yield Mi(xn.setActivateState({loading:!0,step:Ot.activating}));try{const{isAuthenticated:n}=yield Ki((e=>e.auth));n&&(yield Mi(xn.silentLogout()));const i=yield xi(ku.auth.getActivateAccountStrategy,{userId:e,token:t});yield Mi(xn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Mi(xn.setActivateState({loading:!1,step:Ot.activatingForm})))}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message}))}}function*Pp(e){let{payload:{callback:t,events:n}}=e,i=Xn(e.payload,bp);yield Mi(xn.setActivateState({loading:!0}));try{const e=Fo.onRedirectTo,{routes:a}=yield Ki((e=>e.auth)),r=yield xi(ku.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(py(r)){yield Mi(xn.setActivateState({step:Ot.success}));const t=yield vy(r);yield Mi(xn.setState(t)),yield Wi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Mi(xn.setActivateState({step:Ot.success}));const{user:e,tenants:t}=yield xi(ku.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:td.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Wi(1e3),yield dy(),yield Mi(xn.resetActivateState())}null==t||t(!0)}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message}))}}function*Ip({payload:e}){const{callback:t}=e,n=Xn(e,Ap);yield Mi(xn.setActivateStrategyState({loading:!0}));try{const e=yield xi(ku.auth.getActivateAccountStrategy,n);yield Mi(xn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Mi(xn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Lp({payload:e}){const{callback:t}=e,n=Xn(e,kp);yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:n.email})),yield Mi(xn.setActivateState({loading:!0}));try{yield xi(ku.auth.resendActivationEmail,n),yield Mi(xn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message})),yield Mi(xn.setTeamError({key:mp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:!1}))}function*Op(){yield $o(xn.activateAccount,Pp),yield $o(xn.preActivateAccount,Tp),yield $o(xn.getActivateAccountStrategy,Ip),yield $o(xn.resendActivationEmail,Lp)}function*Ep({payload:e}){if(e.token&&e.userId)try{yield Mi(xn.setAcceptInvitationState({error:void 0,step:Dt.pending})),yield xi(ku.auth.acceptInvitation,e),yield Mi(xn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Dt.success}}))}catch(e){yield Mi(xn.setAcceptInvitationState({step:Dt.failed,error:e.message}))}else yield Mi(xn.setAcceptInvitationState({error:void 0,step:Dt.invalid}))}function*wp(){yield $o(xn.acceptInvitation,Ep)}var Cp,Dp=new Uint8Array(16);function Rp(){if(!Cp&&!(Cp="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 Cp(Dp)}for(var _p=/^(?:[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,Up=function(e){return"string"==typeof e&&_p.test(e)},Np=[],Mp=0;Mp<256;++Mp)Np.push((Mp+256).toString(16).substr(1));var $p=function(e,t,n){var i=(e=e||{}).random||(e.rng||Rp)();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=(Np[e[t+0]]+Np[e[t+1]]+Np[e[t+2]]+Np[e[t+3]]+"-"+Np[e[t+4]]+Np[e[t+5]]+"-"+Np[e[t+6]]+Np[e[t+7]]+"-"+Np[e[t+8]]+Np[e[t+9]]+"-"+Np[e[t+10]]+Np[e[t+11]]+Np[e[t+12]]+Np[e[t+13]]+Np[e[t+14]]+Np[e[t+15]]).toLowerCase();if(!Up(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Fp=["callback"],xp=["roles"],Vp=["callback"],jp=["callback","profileImage"],Kp=["callback"],Wp=["callback","userId"],Gp=["callback"],zp=["callback"],Bp=["callback"],qp=["callback"],Hp=["callback"],Jp=["callback"],Yp=["callback"],Qp=["callback","profileImage"],Xp=["callback"],Zp=["callback"],eg=["callback"],tg=["callback"],ng=["callback"],ig=["callback"],og=()=>Ki((e=>e.auth.teamState));function*ag({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield og(),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 Mi(xn.setTeamLoader({key:mp.USERS,value:!a})),yield Mi(xn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield $i([xi(ku.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),xi(ku.teams.loadAvailableRoles),xi(ku.teams.loadAvailablePermissions)]);yield Mi(xn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Mi(xn.setTeamError({key:mp.USERS,value:e.message})),yield Mi(xn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Mi(xn.setTeamLoader({key:mp.USERS,value:!1}))}function*rg({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield og(),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 Mi(xn.setTeamLoader({key:mp.USERS,value:!r})),yield Mi(xn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield $i([xi(ku.subTenants.loadAllUsers,T({},c)),xi(ku.teams.loadAvailableRoles),xi(ku.teams.loadAvailablePermissions)]);yield Mi(xn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield Mi(xn.setTeamError({key:mp.USERS,value:e.message})),yield Mi(xn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Mi(xn.setTeamLoader({key:mp.USERS,value:!1}))}function*lg({payload:e}){yield Mi(xn.setTeamLoader({key:mp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield $i([xi(ku.teams.loadAvailableRoles),xi(ku.teams.loadAvailablePermissions)]);yield Mi(xn.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 Mi(xn.setTeamError({key:mp.ROLES_AND_PERMISSIONS,value:t.message}))}yield Mi(xn.setTeamLoader({key:mp.ROLES_AND_PERMISSIONS,value:!0}))}function*sg({payload:e}){const{callback:t}=e,n=Xn(e,Fp),i=yield og();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})}));try{const e=yield xi(ku.teams.addUser,n),{roles:o}=e,a=T({},Xn(e,xp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield Mi(xn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*cg({payload:e}){const{callback:t}=e,n=Xn(e,Vp),i=yield og();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})}));try{yield xi(ku.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield xi(ku.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Mi(xn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*ug({payload:e}){const{callback:t}=e,n=Xn(e,jp),{id:i}=n,o=yield og(),a=o.users.find((e=>e.id===n.id));yield Mi(xn.setTeamLoader({key:mp.UPDATE_USER,value:i||""})),yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0})})),yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?T({},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 xi(ku.teams.updateUser,n);null==t||t(e),yield Mi(xn.setTeamState({users:o.users.map((t=>t.id===e.id?T({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Mi(xn.setTeamLoader({key:mp.UPDATE_USER,value:!1}))}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?T({},e,a):e))})),yield Mi(xn.setTeamLoader({key:mp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*dg({payload:e}){const{callback:t}=e,n=Xn(e,Kp),i=yield og();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})}));try{yield xi(ku.teams.deleteUser,n),null==t||t(!0),yield Mi(xn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yg({payload:e}){const{callback:t,userId:n}=e,i=Xn(e,Wp),o=yield og();yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0})}));try{yield xi(ku.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return T({},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 Mi(xn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[T({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*fg({payload:e}){const{callback:t}=e,n=Xn(e,Gp),i=yield og();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})}));try{yield xi(ku.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Mi(xn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*pg({payload:e}){const{callback:t}=e,n=Xn(e,zp);yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield xi(ku.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:mp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:!1}))}function*gg({payload:e}){const{callback:t}=e,n=Xn(e,Bp);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(ku.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:mp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*Sg({payload:e}){const{callback:t}=e,n=Xn(e,qp);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(ku.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:mp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*vg({payload:e}){const{callback:t}=e,n=Xn(e,Hp);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(ku.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:mp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*hg(){yield Mi(xn.setTeamError({key:mp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield xi(ku.teams.getInviteLinkConfiguration);yield Mi(xn.setTeamState({inviteTokenState:T({},e)}))}catch(e){yield Mi(xn.setTeamError({key:mp.CONFIG_TOKEN_LINK,value:e.message}))}}function*mg(){yield Mi(xn.setTeamError({key:mp.GET_TOKEN_LINK,value:!1}));try{yield xi(hg);const e=yield xi(ku.teams.getInviteUserLink),{inviteTokenState:t}=yield og();yield Mi(xn.setTeamState({inviteTokenState:T({},t,e)}))}catch(e){yield Mi(xn.setTeamError({key:mp.GET_TOKEN_LINK,value:e.message}))}}function*bg({payload:{callback:e}}){yield Mi(xn.setTeamError({key:mp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield og();try{const n=yield xi(ku.teams.createInviteUserLink,{expiresInMinutes:43200});yield Mi(xn.setTeamState({inviteTokenState:T({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield Mi(xn.setTeamError({key:mp.CREATE_TOKEN_LINK,value:t.message}))}}function*Ag({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield og();yield Mi(xn.setTeamError({key:mp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield xi(ku.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Mi(xn.setTeamState({inviteTokenState:T({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield Mi(xn.setTeamError({key:mp.UPDATE_TOKEN_LINK,value:t.message}))}}function*kg({payload:e}){const{callback:t}=null!=e?e:{};yield Mi(xn.setTeamError({key:mp.DELETE_TOKEN_LINK,value:!1}));try{yield xi(ku.teams.deleteInviteUserLink),yield Mi(xn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:mp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Tg({payload:e}){yield Mi(xn.setTeamState({addUserDialogState:T({open:!0,loading:!1,error:!1},e)}))}function*Pg({payload:e}){const t=yield og(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mi(xn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Ig({payload:e}){yield Mi(xn.setTeamState({deleteUserDialogState:T({open:!0,loading:!1,error:!1},e)}))}function*Lg({payload:e}){const t=yield og(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mi(xn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Og(){yield Mo(xn.loadUsers,ag),yield Mo(xn.loadAllSubTenantsUsers,rg),yield Mo(xn.loadRoles,lg),yield No(xn.addUser,sg),yield No(xn.addUserToSubTenants,cg),yield No(xn.updateUser,ug),yield No(xn.setUserRolesForSubTenants,yg),yield No(xn.deleteUser,dg),yield No(xn.deleteUserFromSubTenants,fg),yield No(xn.resendActivationLink,pg),yield No(xn.resendInvitationLink,gg),yield No(xn.resendInvitationEmail,Sg),yield No(xn.resendInvitationLinkToAllSubTenants,vg),yield No(xn.getInvitationLink,mg),yield No(xn.createInvitationLink,bg),yield No(xn.updateInvitationLink,Ag),yield No(xn.deleteInvitationLink,kg),yield No(xn.openAddUserDialog,Tg),yield No(xn.closeAddUserDialog,Pg),yield No(xn.openDeleteUserDialog,Ig),yield No(xn.closeDeleteUserDialog,Lg)}function*Eg({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield og(),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 Mi(xn.setTeamLoader({key:mp.USERS,value:!a})),yield Mi(xn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield ut(),yield Mi(xn.setTeamState({users:Hu,totalPages:2,totalItems:10,roles:Ku,permissions:Gu})),yield Mi(xn.setTeamLoader({key:mp.USERS,value:!1})),null==r||r(Hu)}function*wg({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield og(),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 Mi(xn.setTeamLoader({key:mp.USERS,value:!r})),yield Mi(xn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield ut(),yield Mi(xn.setTeamState({allUsers:Ju,totalPages:2,totalItems:10,roles:Ku,permissions:Gu})),yield Mi(xn.setTeamLoader({key:mp.USERS,value:!1})),null==l||l(Ju)}function*Cg({payload:e}){var t;yield Mi(xn.setTeamLoader({key:mp.ROLES_AND_PERMISSIONS,value:!0})),yield ut(),yield Mi(xn.setTeamState({roles:Ku,permissions:Gu})),yield Mi(xn.setTeamLoader({key:mp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Ku,permissions:Gu})}function*Dg({payload:e}){const{callback:t}=e,n=Xn(e,Jp),i=yield og();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})})),yield ut();const o=T({},Bu,n,{id:`${$p()}`});null==t||t(o),yield Mi(xn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Rg({payload:e}){const{callback:t}=e,n=Xn(e,Yp),i=yield og();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})})),yield ut();const o=T({},Bu,n,{id:`${$p()}`});yield Mi(xn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*_g({payload:e}){var t;const{callback:n}=e,i=Xn(e,Qp),{id:o}=i,a=yield og(),r=a.users.find((e=>e.id===i.id));yield Mi(xn.setTeamLoader({key:mp.UPDATE_USER,value:o||""})),yield Mi(xn.setTeamState({addUserDialogState:T({},a.addUserDialogState,{loading:!0})})),yield Mi(xn.setTeamState({addUserDialogState:T({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?T({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield ut();const l=T({},r,i);null==n||n(l),yield Mi(xn.setTeamState({users:a.users.map((e=>e.id===l.id?T({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Mi(xn.setTeamLoader({key:mp.UPDATE_USER,value:!1}))}function*Ug({payload:e}){const{callback:t}=e,n=Xn(e,Xp),i=yield og();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Ng({payload:e}){const{callback:t}=e,n=Xn(e,Zp),i=yield og();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Mg({payload:e}){const{callback:t}=e,n=Xn(e,eg);yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:n.userId})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:mp.RESEND_ACTIVATE_LINK,value:!1}))}function*$g({payload:e}){const{callback:t}=e,n=Xn(e,tg);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*Fg({payload:e}){const{callback:t}=e,n=Xn(e,ng);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*xg({payload:e}){const{callback:t}=e,n=Xn(e,ig);yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:mp.RESEND_INVITATION_LINK,value:!1}))}function*Vg(){yield Mo(xn.loadUsers,Eg),yield Mo(xn.loadAllSubTenantsUsers,wg),yield Mo(xn.loadRoles,Cg),yield No(xn.addUser,Dg),yield No(xn.addUserToSubTenants,Rg),yield No(xn.updateUser,_g),yield No(xn.deleteUser,Ug),yield No(xn.deleteUserFromSubTenants,Ng),yield No(xn.resendActivationLink,Mg),yield No(xn.resendInvitationLink,$g),yield No(xn.resendInvitationEmail,Fg),yield No(xn.resendInvitationLinkToAllSubTenants,xg),yield No(xn.openAddUserDialog,Tg),yield No(xn.closeAddUserDialog,Pg),yield No(xn.openDeleteUserDialog,Ig),yield No(xn.closeDeleteUserDialog,Lg)}const jg=["authorizationUrl"],Kg=["events","url"];function*Wg(){try{yield Mi(xn.setSocialLoginsState({loading:!0}));const e=yield xi(ku.auth.getSocialLoginProviders);yield Mi(xn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Gg(){try{const e=yield Ki((e=>e.root.context));yield Mi(xn.setSocialLoginsState({loading:!0}));const t=(yield xi(ku.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=Xn(t,jg);const o=jo(e,null!=n?n:"");return T({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Mi(xn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*zg(e){let{payload:{events:t,url:n}}=e,i=Xn(e.payload,Kg);try{yield Mi(xn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield xi(ku.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:nd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:td.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Mi(xn.setLoginState({email:e,isNewUser:r})),yield hy(),localStorage.removeItem("register-quick-login"),yield Mi(xn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield Mi(xn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Bg({payload:e}){yield Mi(xn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*qg(){yield $o(xn.loadSocialLoginsConfiguration,Wg),yield $o(xn.loadSocialLoginsConfigurationV2,Gg),yield $o(xn.loginViaSocialLogin,zg),yield Mo(xn.setSocialLoginError,Bg)}let Hg;function*Jg({payload:e}){yield Mi(xn.setApiTokensState({apiTokenType:e}));try{if(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield xi(ku.auth.getUserApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield xi(ku.auth.getTenantApiTokensData),{items:t}=yield xi(ku.teams.loadAvailableRoles),{items:n}=yield xi(ku.teams.loadAvailablePermissions);yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:Hg.LOAD_API_TOKENS,value:e.message})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1}))}}function*Yg({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!0}));const e=yield xi(ku.auth.updateUserApiTokensData,{description:t});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield Mi(xn.setApiTokensError({key:Hg.ADD_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*Qg({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!0}));const e=yield xi(ku.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Mi(xn.setApiTokensError({key:Hg.ADD_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Xg({payload:e}){const{apiTokensDataUser:t}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!0})),yield xi(ku.auth.deleteUserApiToken,{tokenId:e}),yield Mi(xn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:Hg.DELETE_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!1}))}}function*Zg({payload:e}){const{apiTokensDataTenant:t}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!0})),yield xi(ku.auth.deleteTenantApiToken,{tokenId:e}),yield Mi(xn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:Hg.DELETE_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!1}))}}function*eS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield $i([xi(ku.auth.getUserApiTokensData),xi(ku.auth.getTenantApiTokensData)]);yield Mi(xn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:Hg.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*tS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield xi(ku.auth.getUserApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:Hg.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*nS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield xi(ku.auth.getTenantApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:Hg.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*iS(){yield $o(xn.loadApiTokens,eS),yield $o(xn.loadUserApiTokens,tS),yield $o(xn.loadTenantApiTokens,nS),yield $o(xn.initApiTokensData,Jg),yield No(xn.addUserApiToken,Yg),yield No(xn.addTenantApiToken,Qg),yield Mo(xn.deleteTenantApiToken,Zg),yield Mo(xn.deleteUserApiToken,Xg)}function*oS({payload:e}){if(yield Mi(xn.setApiTokensState({apiTokenType:e})),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})),"user"===e){yield Wi(200);const e=[Cu];yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=(t=[Du])?t:[],roles:null!=Ku?Ku:[],permissions:null!=Gu?Gu:[]}))}yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1}))}function*aS({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState)),a=T({},Du,{description:t,roleIds:n,clientId:`CLIENT_ID_${$p()}`});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:Hg.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*rS({payload:e}){yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!0})),yield Wi(200);const t=[Du];yield Mi(xn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:Hg.DELETE_API_TOKEN,value:!1}))}function*lS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));const n=[Cu],i=[Du];yield Mi(xn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*sS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));const n=[Cu];yield Mi(xn.setApiTokensState({apiTokensDataUser:n})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*cS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!0})));const n=[Du];yield Mi(xn.setApiTokensState({apiTokensDataTenant:n})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:Hg.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*uS(){yield $o(xn.loadApiTokens,lS),yield $o(xn.loadUserApiTokens,sS),yield $o(xn.loadTenantApiTokens,cS),yield $o(xn.initApiTokensData,oS),yield No(xn.addTenantApiToken,aS),yield Mo(xn.deleteTenantApiToken,rS)}function*dS({payload:e}){try{var t;yield Mi(xn.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 xi(ku.accountSettings.updateSettings,T({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Mi(xn.setAccountSettingsState(T({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Mi(xn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*yS({payload:e}){yield Mi(xn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield xi(ku.accountSettings.getSettings);yield Mi(xn.setAccountSettingsState(T({},e,{loading:!1})))}catch(e){yield Mi(xn.setAccountSettingsState({loading:!1,error:e.message}))}}function*fS(){yield $o(xn.saveAccountSettings,dS),yield $o(xn.loadAccountSettings,yS)}function*pS({payload:e}){var t;yield Mi(xn.setAccountSettingsState({loading:!0})),yield ut();const{accountSettingsState:n}=yield Ki((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=T({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Mi(xn.setAccountSettingsState(T({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*gS({payload:e}){yield Mi(xn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield ut(),yield Mi(xn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*SS(){yield $o(xn.saveAccountSettings,pS),yield $o(xn.loadAccountSettings,gS)}function*vS({payload:{tenantId:e,callback:t}}){yield Mi(xn.setState({isLoading:!0}));try{yield xi(ku.tenants.switchTenant,{tenantId:e}),yield xi(hy),(null==t?void 0:t(!0))||(yield Mi(xn.setState({isLoading:!1})))}catch(e){yield Mi(xn.setState({isLoading:!1})),null==t||t(!1,e)}}function*hS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(ku.tenants.getTenants);yield Mi(xn.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 Mi(xn.setTenantsState({loading:!1}))}}function*mS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(ku.tenants.getSubTenants);yield Mi(xn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*bS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(ku.tenants.getSubTenantsAsTree);yield Mi(xn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*AS(){yield No(xn.loadTenants,hS),yield No(xn.loadSubTenants,mS),yield No(xn.switchTenant,vS),yield No(xn.loadSubTenantsTree,bS)}function*kS(){yield Mi(xn.setTenantsState({loading:!0})),yield ut(),yield Mi(xn.setTenantsState({tenants:Yu,loading:!1}))}function*TS(){yield No(xn.loadTenants,kS)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Hg||(Hg={}));const PS=["callback"],IS=["callback"],LS=["callback"],OS=["callback"],ES=["callback"];function*wS({payload:e}){var t;yield Mi(xn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield $i([xi(ku.roles.getRoles),xi(ku.roles.getPermissions),xi(ku.roles.getPermissionCategories)]),[t,n,i]=e;yield Mi(xn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Mi(xn.setRolesState({error:e.message,loading:!1}))}}function*CS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,PS);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(ku.roles.addRole,n),i=yield xi(ku.roles.getRoles);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*DS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,IS);yield Mi(xn.setRolesState({saving:!0}));try{yield xi(ku.roles.deleteRole,n),yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*RS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,LS);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(ku.roles.updateRole,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*_S(e){let{payload:{callback:t}}=e,n=Xn(e.payload,OS);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(ku.roles.attachPermissionsToRole,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*US(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ES);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(ku.roles.attachPermissionToRoles,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*NS(){yield $o(xn.loadRolesAndPermissions,wS),yield No(xn.addRole,CS),yield No(xn.deleteRole,DS),yield No(xn.updateRole,RS),yield No(xn.attachPermissionsToRole,_S),yield No(xn.attachPermissionToRoles,US)}const MS=["callback"],$S=["callback"],FS=["callback"];function*xS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,MS);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const e=yield xi(ku.auth.resetPhoneNumber,n);yield Mi(xn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:xt.VerifyResetPhoneNumber})),yield Mi(xn.setLoginState({email:n.email}))}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*VS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,$S);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const e=yield xi(ku.auth.verifyResetPhoneNumber,n);yield Mi(xn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*jS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,FS);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield xi(ku.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Mi(xn.setLoginState({step:gt.loginWithSmsOtc})),yield Mi(xn.passwordlessPreLogin({type:Xa.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Mi(xn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*KS(){yield $o(xn.resetPhoneNumber,xS),yield $o(xn.verifyResetPhoneNumber,VS),yield $o(xn.changePhoneNumber,jS)}function*WS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getCurrentUserSessions);yield Mi(xn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*GS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getCurrentUserSession);yield Mi(xn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*zS({payload:{id:e}}){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(ku.auth.deleteSessionForUser,e),yield Mi(xn.loadUserSessions())}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*BS({payload:{callback:e,userId:t}}){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(ku.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Mi(xn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*qS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(ku.auth.deleteAllSessionsForUser),yield Mi(xn.loadUserSessions())}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*HS(){yield Mo(xn.loadUserSessions,WS),yield Mo(xn.deleteUserSession,zS),yield Mo(xn.deleteAllUserSessions,qS),yield Mo(xn.loadCurrentUserSession,GS),yield No(xn.revokeUserSessions,BS)}function*JS(){yield Mi(xn.setSessionsState({loading:!0,error:null})),yield Mi(xn.setSessionsState({sessions:Qu,loading:!1}))}function*YS({payload:{id:e}}){yield Mi(xn.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 Mi(xn.setSessionsState({sessions:t,loading:!1}))}function*QS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));const e=Qu.filter((e=>e.current));yield Mi(xn.setSessionsState({sessions:e,loading:!1}))}function*XS(){yield Mo(xn.loadUserSessions,JS),yield Mo(xn.deleteUserSession,YS),yield Mo(xn.deleteAllUserSessions,QS)}const ZS=["callback"],ev=["callback"];function*tv(){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getSessionConfigurations);yield Mi(xn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*nv({payload:e}){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Xn(e,ZS);yield xi(ku.auth.createOrUpdateSessionConfigrations,n),yield Mi(xn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Mi(xn.setSessionsPolicyState({error:e,loading:!1}))}}function*iv(){yield $o(xn.loadSessionsPolicy,tv),yield Mo(xn.createOrUpdateSessionsPolicy,nv)}function*ov(){yield Mi(xn.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:Xu}));yield Mi(xn.setSessionsPolicyState(T({},e,{loading:!1})))}function*av({payload:e}){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Xn(e,ev);null==t||t(!0),yield Mi(xn.setSessionsPolicyState({configurations:n,loading:!1}))}function*rv(){yield $o(xn.loadSessionsPolicy,ov),yield Mo(xn.createOrUpdateSessionsPolicy,av)}const lv=["callback"],sv=["callback"],cv=["callback"],uv=["callback"],dv=["callback"],yv=["callback"],fv=["callback"],pv=["callback"],gv=()=>Ki((e=>e.auth.restrictionsState.ipRestrictions)),Sv=()=>Ki((e=>e.auth.restrictionsState.emailDomainRestrictions));function*vv(){yield Mi(xn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield xi(ku.auth.getDomainRestrictionsConfig),t=(yield xi(ku.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mi(xn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*hv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,lv);yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Sv();try{var o;yield xi(ku.auth.createDomainRestriction,n);const e=(yield xi(ku.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Mi(xn.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 Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,sv);yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield xi(ku.auth.updateDomainRestrictionConfig,n),i=(yield xi(ku.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mi(xn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*bv({payload:{id:e}}){yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Sv();try{var n;yield xi(ku.auth.deleteDomainRestriction,e);const i=(yield xi(ku.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Mi(xn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Dn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Av=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Dn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*kv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield gv(),t=yield xi(ku.auth.getIPRestrictionsConfig),n=Av({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield xi(ku.auth.getIPRestrictions,n);yield Mi(xn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Tv(){try{const{valid:e}=yield xi(ku.auth.testCurrentIpInAllowList);yield Mi(xn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message}))}}function*Pv({payload:{callback:e}}){yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ki((e=>e.auth.userIp));yield $i([xi(ku.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Dn.ALLOW}),xi(ku.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield gv(),i=Av(n.pagination),{items:o,_metadata:{totalPages:a}}=yield xi(ku.auth.getIPRestrictions,i);yield Mi(xn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Dn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Iv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,cv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const i=yield gv();try{var o,a;yield xi(ku.auth.createIPRestriction,n);const e=yield gv(),r=Av(e.pagination),{items:l,_metadata:{totalPages:s}}=yield xi(ku.auth.getIPRestrictions,r);yield Tv(),yield Mi(xn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Dn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Lv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,uv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));try{yield xi(ku.auth.updateIPRestrictionConfig,n);const e=yield gv(),i=yield xi(ku.auth.getIPRestrictionsConfig),o=Av(T({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield xi(ku.auth.getIPRestrictions,o);yield Tv(),yield Mi(xn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ov({payload:{id:e,callback:t}}){yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const n=yield gv();try{var i;yield xi(ku.auth.deleteIPRestriction,e);const o=yield gv(),a=Av(o.pagination),{items:r,_metadata:{totalPages:l}}=yield xi(ku.auth.getIPRestrictions,a);yield Tv(),yield Mi(xn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Dn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ev(){yield $o(xn.loadIpRestrictions,kv),yield $o(xn.loadEmailDomainRestrictions,vv),yield No(xn.saveIpRestriction,Iv),yield No(xn.saveIpRestrictionsConfig,Lv),yield No(xn.deleteIpRestriction,Ov),yield No(xn.checkIfUserIpValid,Tv),yield No(xn.addCurrentUserIpAndActivate,Pv),yield No(xn.saveEmailDomainRestriction,hv),yield No(xn.saveEmailDomainRestrictionsConfig,mv),yield No(xn.deleteEmailDomainRestriction,bv)}function*wv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null})),yield Mi(xn.setIpRestrictionsState({data:{restrictions:ed.filter((e=>e.strategy===Zu.strategy)),config:Zu},totalPages:1,pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Cv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield gv(),t=ed[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Mi(xn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Dv(e){var t,n;let{payload:{callback:i}}=e,o=Xn(e.payload,dv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const a=yield gv();yield Mi(xn.setIpRestrictionsState({data:{config:null!=(t=null==(n=a.data)?void 0:n.config)?t:{isActive:!1,strategy:Dn.ALLOW},restrictions:[...a.data.restrictions,T({},o,{createdAt:new Date,updatedAt:new Date,id:"123",isActive:!0,strategy:a.data.config.strategy})]},totalPages:1,pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*Rv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,yv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null})),yield Mi(xn.setIpRestrictionsState({data:{config:n,restrictions:ed.filter((e=>e.strategy===n.strategy))},pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Mi(xn.setIpRestrictionsState({saving:!1,error:null})),null==t||t(!0)}function*_v({payload:{id:e}}){var t;yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const n=yield gv();yield Mi(xn.setIpRestrictionsState({data:{config:(null==(t=n.data)?void 0:t.config)||{isActive:!1,strategy:Dn.ALLOW},restrictions:n.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1}))}function*Uv(){yield Mi(xn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ut(),yield Mi(xn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Dn.ALLOW}],config:{active:!0,listType:Dn.ALLOW,blockPublicDomains:!1}}}))}function*Nv(e){var t,n;let{payload:{callback:i}}=e,o=Xn(e.payload,fv);const a=yield Sv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),null==i||i(!0),yield Mi(xn.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)||[],T({},o,{id:Date.now().toString()})]},saving:!1}))}function*Mv(e){var t;let{payload:{callback:n}}=e,i=Xn(e.payload,pv);const o=yield Sv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),null==n||n(!0),yield Mi(xn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Dn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*$v({payload:{id:e}}){var t,n;const i=yield Sv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),yield Mi(xn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Dn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Fv(){yield $o(xn.loadIpRestrictions,wv),yield $o(xn.loadEmailDomainRestrictions,Uv),yield No(xn.saveIpRestriction,Dv),yield No(xn.saveIpRestrictionsConfig,Rv),yield No(xn.deleteIpRestriction,_v),yield No(xn.checkIfUserIpValid,Cv),yield No(xn.saveEmailDomainRestriction,Nv),yield No(xn.saveEmailDomainRestrictionsConfig,Mv),yield No(xn.deleteEmailDomainRestriction,$v)}var xv={sagas:function*(){yield $i([xi(nf),xi(Op),xi(wp),xi(hp),xi(KS),xi(mf),xi(Gf),xi(Yf),xi(sp),xi(Og),xi(qg),xi(sd),xi(iS),xi(Ud),xi(fS),xi(AS),xi(NS),xi(HS),xi(iv),xi(Ev)])},mockSagas:function*(){yield $i([xi(rf),xi(Lf),xi(ep),xi(fp),xi(Vg),xi(uS),xi(zd),xi(XS),xi(SS),xi(TS),xi(rv),xi(Fv)])},storeName:bt,initialState:Mn,reducer:$n,actions:xn};const Vv=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>T({},t,{[e]:T({},t[e],n)})}),jv={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Kv={setAuditLogsState:Vv("auditLogsState"),resetAuditLogsState:e=>T({},e,{auditLogsState:jv})},Wv={exportAuditsCsv:tt("auditLogs/exportAuditsCsv"),loadAuditLogs:tt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Gv={loading:!0},zv={setAuditsMetadataState:Vv("auditsMetadataState"),resetAuditsMetadataState:e=>T({},e,{auditsMetadataState:Gv})},Bv={loadAuditsMetadata:tt("auditLogs/loadAuditsMetadata")},qv={auditLogsState:jv,auditsMetadataState:Gv},{reducer:Hv,actions:Jv}=it({name:kt,initialState:qv,reducers:T({resetState:e=>T({},e,qv),setState:(e,{payload:t})=>T({},e,t)},Kv,zv)}),Yv=T({},Jv,Wv,Bv),Qv=e=>"createdAt"!==e.id,Xv={total:20,data:Array.from(Array(5).keys()).map((e=>T({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`})))},Zv={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}]},eh=()=>Ki((e=>e.auditLogs.auditLogsState)),th=()=>Ki((e=>e.auditLogs.auditsMetadataState));function*nh(){const e=yield eh(),{columns:t}=yield th();try{const n=e.filter,i=e.sort.reduce(((e,t)=>T({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>T({},e,{[t.id]:t.value})),{});yield Mi(Yv.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield ku.audits.exportAudits(T({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Mi(Yv.setAuditLogsState({isDownloadingCsv:!1}))}function*ih({payload:e}){yield Mi(Yv.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eh(),{columns:n}=yield th();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 Mi(Yv.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>T({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>T({},e,{[t.id]:t.value})),{});n||(yield Mi(Yv.loadAuditsMetadata()));const{data:p,total:g}=yield xi(ku.audits.getAudits,T({offset:c,count:s},y,f));yield Mi(Yv.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Mi(Yv.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*oh(){yield No(Yv.exportAuditsCsv,nh),yield No(Yv.loadAuditLogs,ih)}function*ah({payload:e}){yield Mi(Yv.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eh(),{columns:n}=yield th();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 Mi(Yv.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Mi(Yv.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Xv;let i=n.filter((e=>t=>e.filter(Qv).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 Mi(Yv.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 Mi(Yv.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*rh(){yield No(Yv.loadAuditLogs,ah)}function*lh(){yield Mi(Yv.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield xi(ku.metadata.getAuditsMetadata);yield Mi(Yv.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mi(Yv.setAuditsMetadataState({error:e,loading:!1}))}}function*sh(){yield No(Yv.loadAuditsMetadata,lh)}function*ch(){yield Mi(Yv.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Zv;yield Mi(Yv.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mi(Yv.setAuditsMetadataState({error:e,loading:!1}))}}function*uh(){yield No(Yv.loadAuditsMetadata,ch)}var dh={sagas:function*(){yield $i([xi(oh),xi(sh)])},mockSagas:function*(){yield $i([xi(rh),xi(uh)])},storeName:kt,initialState:qv,reducer:Hv,actions:Yv};const yh={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:fh,actions:ph,reducer:gh}=it({name:"audits",initialState:yh,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=T({},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]})))}}}),Sh=T({},ph,{initData:tt(`${fh}/initData`),loadAudits:tt(`${fh}/loadAudits`),removeFilter:tt(`${fh}/removeFilter`),filterData:tt(`${fh}/filterData`),exportCSV:tt(`${fh}/exportCSV`),deleteAudits:tt(`${fh}/deleteAudits`)}),vh=()=>Ki((e=>e[fh]));function*hh(){const{sortBy:e,sortDirection:t}=yield vh();try{const n=yield xi(ku.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Mi(Sh.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Mi(Sh.loadItemFailedAction(t))}}function*mh(){try{const e=yield xi(ku.metadata.getAuditsMetadata);yield Mi(Sh.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Mi(Sh.loadItemFailedAction(t))}}const bh=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Ah({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield vh(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield vh():{rowsData:[]};try{const e=bh(t),{data:l,total:d}=yield xi(ku.audits.getAudits,T({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Mi(Sh.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Mi(Sh.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Mi(Sh.loadItemFailedAction(t))}}function*kh(){yield Mi(Sh.startLoading()),yield $i([hh(),mh(),Ah({payload:{onlyOneLoad:!1},type:""})]),yield Mi(Sh.finishLoading())}function*Th({payload:e}){const{filters:t}=yield vh(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Mi(Sh.setFilterData(i))}function*Ph({payload:e}){const{filters:t}=yield vh();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 Mi(Sh.setFilterData(i))}function*Ih(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield vh(),a=bh(e);yield Mi(Sh.startDownloadingCsv());try{yield ku.audits.exportAudits(T({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 Mi(Sh.stopDownloadingCsv())}}function*Lh(){yield Mo(Sh.initData,kh),yield Mo(Sh.removeFilter,Th),yield Mo(Sh.filterData,Ph),yield Mo([Sh.loadAudits,Sh.textSearch,Sh.onPageChange],Ah),yield Mo([Sh.setFilterData,Sh.setDataSorting,Sh.startRefresh],(()=>Ah({payload:{appendMode:!1},type:""}))),yield Mo(Sh.exportCSV,Ih)}const Oh={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Eh={initData:()=>T({},Oh),setConnectivityState:(e,{payload:t})=>T({},e,t),cleanWebhookTestData:e=>T({},e,{testResult:void 0}),cleanWebhookLogsData:e=>T({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return T({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>T({},e,{error:void 0}),cleanSlackData:e=>T({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>T({},e,{retryResult:T({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>T({},e,{retryResult:T({},e.retryResult,t)})}},wh={loadSlackActions:tt("connectivity/loadSlackActions"),loadDataAction:tt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:tt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:tt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:tt("connectivity/loadScope"),deleteWebhookConfigAction:tt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:tt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:tt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ch={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Dh,actions:Rh}=it({name:At,initialState:Ch,reducers:T({},Eh)}),_h=T({},Rh,wh),Uh={slack:ku.connectivity.getSlackConfiguration,email:ku.connectivity.getEmailConfiguration,sms:ku.connectivity.getSMSConfiguration,webhook:ku.connectivity.getWebhooksConfigurations,categories:ku.connectivity.getCategories,channelMap:ku.connectivity.getChannelMaps},Nh={slack:ku.connectivity.postSlackConfiguration,email:ku.connectivity.postEmailConfiguration,sms:ku.connectivity.postSMSConfiguration,webhook:ku.connectivity.postWebhooksConfiguration},Mh=["email","slack","sms","webhook"],$h={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"}},Fh=["id"],xh=["id","enabled"],Vh=["categories","channelMap"];function*jh(e){return yield xi(Wh,{payload:{api:e},type:""})}function*Kh({payload:e=Mh}){yield Mi(_h.setConnectivityState({isLoading:!0}));try{const t=yield $i([...e.map(jh),yield Wh({payload:{api:"categories"},type:""}),yield function*(){return(yield $i(e.map((function*(e){return yield Wh({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>T({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Wh({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?T({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:$h[e[o]].events(i),active:$h[e[o]].isActive(i),platform:$h[e[o]].title,image:$h[e[o]].image}]}):n:T({},n,{[`${Vh[o-e.length]}`]:i})),{list:[],webhook:n});yield Mi(_h.setConnectivityState(T({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Mi(_h.setConnectivityState({isLoading:!1}))}}function*Wh({payload:{api:e,params:t}}){try{return yield xi(Uh[e],t)}catch(e){return}}function*Gh(){try{yield Mi(_h.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield xi(ku.connectivity.getSlackChannels);yield Mi(_h.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Mi(_h.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*zh(e,t){const{connectivity:{list:n}}=yield Ki(),i=n.find((({key:t})=>t===e));if(!i)return;const o=$h[e].isActive(t);o!==i.active&&(yield Mi(_h.setConnectivityState({list:n.map((t=>t.key===e?T({},t,{active:o}):t))})))}function*Bh({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ki((e=>e.connectivity));try{if(yield Mi(_h.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 $i([...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=Xn(e,Fh);return n===t.id&&JSON.stringify(T({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield xi(Nh.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield xi(ku.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 $i([...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 xi("email"===t?ku.connectivity.postEmailConfiguration:ku.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=Xn(o,xh);return yield $i([yield xi("email"===t?ku.connectivity.patchEmailConfiguration:ku.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield xi("email"===t?ku.connectivity.putEmailSubscriptions:ku.connectivity.putSMSSubscriptions,a,i,T({},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 xi("email"===t?ku.connectivity.deleteEmailSubscriptions:ku.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Wh({payload:{api:t},type:""});yield Mi(_h.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield zh(t,e)}else yield Mi(_h.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield xi(Nh[e],t),!["sms","email"].includes(e)){const o=yield Wh({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Mi(_h.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield zh(e,o),null==n||n(!0)}}catch(e){var o;yield Mi(_h.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*qh({payload:e}){try{yield ku.connectivity.postSlackCode(e)}catch{}yield Mi(_h.setConnectivityState({error:void 0,isSaving:!1}))}function*Hh(){const{slackChannels:e}=yield Ki((e=>e.connectivity));try{yield Mi(_h.setConnectivityState({slackChannels:T({},e,{isLoadingScope:!0})}));const{clientId:t}=yield xi(ku.connectivity.getSlackScope);yield Mi(_h.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Mi(_h.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Jh({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ki((e=>e.connectivity));try{yield Mi(_h.setConnectivityState({isSaving:!0})),yield xi(ku.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Wh({payload:{api:"webhook"},type:""});o&&(yield Mi(_h.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Yh({payload:e}){try{yield Mi(_h.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield xi(ku.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Mi(_h.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Mi(_h.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Mi(_h.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Qh({payload:e}){try{const{statusCode:t}=yield xi(ku.connectivity.postWebhookRetry,e);yield Mi(_h.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Mi(_h.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Xh({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ki((e=>e.connectivity));try{yield Mi(_h.setConnectivityState({webhookLogs:T({},i,{isLoading:!0})}));const o=yield xi(ku.connectivity.getWebhookLog,e,n,t);yield Mi(_h.setConnectivityState({error:void 0,webhookLogs:T({isLoading:!1},o)}))}catch(e){yield Mi(_h.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Zh={sagas:function*(){yield No(_h.loadDataAction,Kh),yield Mo(_h.loadSlackActions,Gh),yield No(_h.postDataAction,Bh),yield No(_h.postCodeAction,qh),yield No(_h.loadScope,Hh),yield No(_h.deleteWebhookConfigAction,Jh),yield No(_h.postWebhookTestAction,Yh),yield No(_h.postWebhookRetryAction,Qh),yield Mo(_h.loadWebhookLogsAction,Xh)},storeName:At,initialState:Ch,reducer:Dh,actions:_h};function em(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,t.payload)}}}function tm(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>T({},n,{[e]:t(n[e],i)})}}function nm(e){return tm(e,((e,t)=>T({},e,{loading:t.payload})))}function im(e){return tm(e,((e,t)=>T({},e,{error:t.payload,loading:!1})))}const om={loading:!1,error:null,fetching:!0,plans:[]},{actions:am,reducer:rm,name:lm}=it({name:"subscriptions/plans",initialState:om,reducers:T({},em())}),sm=T({loadPlans:tt(`${lm}/loadPlans`)},am),cm={loading:!1,error:null,fetching:!0,config:null},um=T({},em()),{actions:dm,reducer:ym,name:fm}=it({name:"subscriptions/config",initialState:cm,reducers:um}),pm=T({loadPaymentConfiguration:tt(`${fm}/loadPaymentConfiguration`)},dm),gm={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Sm=T({},em(),{setCancellationLoading:nm("cancellation"),setCancellationError:im("cancellation"),setRenewalLoading:nm("renewal"),setRenewalError:im("renewal")}),{reducer:vm,actions:hm,name:mm}=it({name:"subscriptions/billing/subscription",initialState:gm,reducers:Sm}),bm=T({load:tt(`${mm}/loadSubscription`),cancelSubscription:tt(`${mm}/cancelSubscription`),renewSubscription:tt(`${mm}/renewSubscription`)},hm),Am={loading:!1,error:null,fetching:!0},km=T({},em()),{reducer:Tm,actions:Pm,name:Im}=it({name:"subscriptions/billing/information",initialState:Am,reducers:km}),Lm=T({loadBillingInformation:tt(`${Im}/loadBillingInformation`),cancelSubscription:bm.cancelSubscription,renewSubscription:bm.renewSubscription},Pm),Om={loading:!1,error:null,fetching:!0},Em=T({},em(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,t.payload)}}),{reducer:wm,actions:Cm,name:Dm}=it({name:"subscriptions/billing/payment",initialState:Om,reducers:Em}),Rm=T({loadPaymentMethod:tt(`${Dm}/loadPaymentMethod`),submitPaymentMethod:tt(`${Dm}/submitPaymentMethod`),submitPaymentMethodError:tt(`${Dm}/submitPaymentMethodError`),submitPaymentMethodSuccess:tt(`${Dm}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:tt(`${Dm}/updateBillingDetails`,(e=>({payload:e})))},Cm),_m={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Um=T({},em(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{invoiceDownload:T({},e.invoiceDownload,t.payload)})}}),{reducer:Nm,actions:Mm,name:$m}=it({name:"subscriptions/billing/invoices",initialState:_m,reducers:Um}),Fm=T({loadInvoices:tt(`${$m}/loadInvoices`),downloadInvoice:tt(`${$m}/downloadInvoice`,(e=>({payload:e})))},Mm),xm={information:Am,invoices:_m,paymentMethod:Om,subscription:gm},Vm={invoices:Fm,information:Lm,paymentMethod:Rm,subscription:bm},jm=Ne({invoices:Nm,information:Tm,paymentMethod:wm,subscription:vm}),Km={fetching:!0,loading:!1,error:null,confirmed:!1},Wm=T({},em()),{actions:Gm,reducer:zm,name:Bm}=it({name:"subscriptions/checkout",initialState:Km,reducers:Wm}),qm=T({loadCheckout:tt(`${Bm}/loadCheckout`),resetCheckout:tt(`${Bm}/resetCheckout`),submitCheckout:tt(`${Bm}/submitCheckout`),confirmCheckout:tt(`${Bm}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:tt(`${Bm}/errorCheckout`,(e=>({payload:e})))},Gm),Hm={loading:!1,error:null,cardSetupIntentSecret:null},Jm=T({},em()),{reducer:Ym,actions:Qm,name:Xm}=it({name:"subscriptions/stripe",initialState:Hm,reducers:Jm}),Zm=T({loadCustomer:tt(`${Xm}/loadCustomer`),createCardSetupIntentSecret:tt(`${Xm}/createCardSetupIntentSecret`)},Qm),eb={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:tb,reducer:nb,name:ib}=it({name:"subscriptions/vendorPublicConfig",initialState:eb,reducers:T({},em())}),ob=T({loadVendorPublicConfiguration:tt(`${ib}/loadVendorPublicConfiguration`)},tb),ab={config:cm,plans:om,checkout:Km,billing:xm,stripe:Hm,vendorPublicConfig:eb},rb={config:pm,billing:Vm,plans:sm,checkout:qm,stripe:Zm,vendorPublicConfig:ob},lb=Ne({config:ym,billing:jm,plans:rm,checkout:zm,stripe:Ym,vendorPublicConfig:nb});let sb,cb,ub;function db({policy:e}){return{policy:ub.AT_PERIOD_END}}function yb(e){switch(e){case tu.ACTIVE:return cb.ACTIVE;case tu.INCOMPLETE:return cb.INCOMPLETE;case tu.CANCELED:return cb.CANCELED;case tu.EXPIRED:return cb.EXPIRED;case tu.TRIALING:return cb.TRIALING;default:return cb.EXPIRED}}!function(e){e.STRIPE="Stripe"}(sb||(sb={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(cb||(cb={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(ub||(ub={}));const fb={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:tu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},pb=[{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"}],gb=[{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:""}],Sb=[{id:"id",externalId:"externalId",type:nu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],vb={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*hb(){yield No(bm.load,mb),yield No(bm.cancelSubscription,Ab),yield No(bm.renewSubscription,kb)}function*mb(){const e=yield Ki((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield Ob(e)}function*bb(){yield Mi(bm.setLoading(!0));try{const[e]=yield xi(ku.subscriptions.getManagedSubscriptions);yield Mi(bm.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Mi(bm.setError(e))}}function*Ab(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mi(bm.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mi(bm.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===tu.ACTIVE)try{yield Mi(bm.setCancellationLoading(!0)),yield xi(ku.subscriptions.cancelManagedSubscription,t),yield bb(),yield Mi(bm.setCancellationLoading(!1))}catch(e){yield Mi(bm.setCancellationError(e.message))}}function*kb(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mi(bm.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mi(bm.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===iu.AT_PERIOD_END)try{yield Mi(bm.setRenewalLoading(!0)),yield xi(ku.subscriptions.renewManagedSubscription,t),yield bb(),yield Mi(bm.setRenewalLoading(!1))}catch(e){yield Mi(bm.setCancellationError(e.message))}}function*Tb(){yield Mi(bm.setLoading(!0)),yield Wi(500),yield Mi(bm.setState({subscription:fb,fetching:!1,loading:!1,error:null}))}function*Pb(){yield No(bm.load,Tb)}function*Ib(){yield No(Lm.loadBillingInformation,Lb)}function*Lb(){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 Ob(n,!1):yield Mi(Lm.setError(t?"Not authorized":"Internal feature failure"))}()}function*Ob(e,t){yield Mi(Lm.setLoading(!0));try{var n,i;const o=yield xi(ku.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield xi(ku.subscriptions.getSubscriptionPlan,a):([,l]=yield $i([xi(bb),xi(ku.subscriptions.getSubscriptionPlan,a)]),s=yield Ki((e=>e.subscriptions.billing.subscription.subscription||null))),yield Mi(Lm.setState(T({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?cb.ACTIVE:yb(s.status),cancellation:s.cancellation&&db(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 Mi(Lm.setError(e.message))}}function*Eb(){yield function*(){var e,t;yield Mi(Lm.setLoading(!0)),yield Wi(500),yield Mi(Lm.setState({loading:!1,fetching:!1,summary:{subscriptionId:fb.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ou.Stripe,externallyManaged:!1,currentPlanId:pb[0].id,defaultPlanId:pb[0].id},plan:T({},pb[0],{price:null==(e=pb[0].price)?void 0:e.amount,currency:null==(t=pb[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*wb(){yield No(Lm.loadBillingInformation,Eb)}function*Cb(){yield No(Rm.loadPaymentMethod,Db),yield No(Rm.submitPaymentMethod,_b),yield No(Rm.submitPaymentMethodError,Ub),yield No(Rm.submitPaymentMethodSuccess,Nb),yield No(Rm.updatePaymentMethodBillingDetails,Rb)}function*Db(){yield Mi(Rm.setLoading(!0));try{const e=(yield xi(ku.subscriptions.getPaymentMethods))[0];yield Mi(Rm.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Mi(Rm.setError(e.message))}}function*Rb({payload:e}){yield Mi(Rm.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield xi(ku.subscriptions.updatePaymentMethodBillingDetails,t,T({email:n},i)),yield xi(Db),null==o||o(!0)}catch(e){yield Mi(Rm.setError(e.message)),null==o||o(!1)}yield Mi(Rm.setLoading(!1))}function*_b(){yield Mi(Rm.setLoading(!0))}function*Ub({payload:e}){yield Mi(Rm.setError(e))}function*Nb(){yield Mi(Rm.loadPaymentMethod())}function*Mb(){yield Mi(Rm.setLoading(!0)),yield Wi(500);const e=Sb[0];yield Mi(Rm.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*$b(){yield No(Rm.loadPaymentMethod,Mb)}function*Fb(){yield No(Fm.loadInvoices,xb),yield No(Fm.downloadInvoice,Vb)}function*xb(){yield Mi(Fm.setLoading(!0));try{const e=(yield xi(ku.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 Mi(Fm.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Mi(Fm.setError(e.message))}}function*Vb({payload:e}){yield Mi(Fm.setInvoiceDownloadState({loading:!0,error:null}));try{yield xi(ku.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Mi(Fm.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Mi(Fm.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*jb(){yield Mi(Fm.setLoading(!0)),yield Wi(500),yield Mi(Fm.setState({loading:!1,fetching:!1,invoices:gb.map((e=>T({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Mi(Fm.setLoading(!1))}function*Kb(){yield No(Fm.loadInvoices,jb)}function*Wb(){yield $i([xi(Ib),xi(Cb),xi(Fb),xi(hb)])}function*Gb(){yield $i([xi(wb),xi($b),xi(Kb),xi(Pb)])}function*zb(){yield No(qm.loadCheckout,Bb),yield No(qm.resetCheckout,qb),yield No(qm.submitCheckout,Hb),yield No(qm.confirmCheckout,Jb),yield No(qm.errorCheckout,Qb)}function*Bb(){yield Mi(qm.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*qb(){yield Mi(qm.setState({loading:!1,error:null,confirmed:!1}))}function*Hb(){yield Mi(qm.setState({loading:!0,error:null}))}function*Jb({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)===tu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Mi(qm.setState({loading:!0,error:null})),o&&a)return yield Yb(),void(yield Mi(bm.setState({subscription:T({},n,{status:tu.ACTIVE})})));try{yield xi(ku.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield $i([Lb(),Db(),xb()]),yield Yb()}catch(e){yield Mi(qm.setState({loading:!1,error:e.message}))}}else yield Mi(qm.setState({loading:!1,error:"Subscription not found"}))}function*Yb(){yield Mi(qm.setState({loading:!1,error:null,confirmed:!0}))}function*Qb({payload:e}){yield Mi(qm.setState({loading:!1,error:e}))}function*Xb(){yield No(qm.resetCheckout,qb)}function*Zb(){yield No(sm.loadPlans,eA)}function*eA(){yield Mi(sm.setLoading(!0));try{const e=(yield xi(ku.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 Mi(sm.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Mi(sm.setError(e.message))}}function*tA(){yield Mi(sm.setLoading(!0)),yield Wi(500),yield Mi(sm.setState({fetching:!1,loading:!1,plans:pb.map((e=>{var t,n;return T({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*nA(){yield No(sm.loadPlans,tA)}function*iA(){yield No(pm.loadPaymentConfiguration,oA)}function*oA(){yield Mi(pm.setLoading(!0));try{(yield xi(ku.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ou.Stripe))?yield function*(){yield Mi(pm.setLoading(!0));try{const e=yield xi(ku.subscriptions.getStripePaymentProviderConfiguration);yield Mi(pm.setState({loading:!1,fetching:!1,config:{paymentProvider:sb.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Mi(pm.setError(e.message))}}():yield Mi(pm.setError("Payment provider not configured"))}catch(e){yield Mi(pm.setError(e.message))}}function*aA(){yield Mi(pm.setLoading(!0)),yield Wi(500),yield Mi(pm.setState({loading:!1,fetching:!1,config:{paymentProvider:sb.STRIPE,apiKey:""}}))}function*rA(){yield No(pm.loadPaymentConfiguration,aA)}function*lA(){yield No(Zm.createCardSetupIntentSecret,sA)}function*sA({payload:e}){yield Mi(Zm.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield xi(ku.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Mi(Zm.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Mi(Zm.setError(e.message))}}function*cA(){yield No(ob.loadVendorPublicConfiguration,uA)}function*uA(){yield Mi(ob.setLoading(!0));try{const e=yield xi(ku.subscriptions.getVendorPublicConfigurations);yield Mi(ob.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Mi(ob.setError(e.message))}}function*dA(){yield Mi(ob.setLoading(!0)),yield Wi(500),yield Mi(ob.setState({fetching:!1,loading:!1,vendorPublicConfig:vb}))}function*yA(){yield No(ob.loadVendorPublicConfiguration,dA)}var fA={sagas:function*(){yield $i([xi(Wb),xi(zb),xi(Zb),xi(iA),xi(lA),xi(cA)])},mockSagas:function*(){yield $i([xi(Gb),xi(Xb),xi(nA),xi(rA),xi(yA)])},reducer:lb,actions:rb,initialState:ab,storeName:"subscriptions"},pA={sagas:function*(){yield No(pd.loadVendorPublicInfo,gd)},storeName:Tt,initialState:dd,reducer:yd,actions:pd};const{reducer:gA}=it({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Fo.setContext(t),T({},e,{context:t}))}}}),SA=(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,p,g,S,v;n||a||Fo.setContext(e.context);const t=Lo(),h=[...Ze({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=et({middleware:h,preloadedState:{root:T({},e,{previewMode:n,urlStrategy:r}),[xv.storeName]:T({},xv.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:T({},xv.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[dh.storeName]:T({},dh.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:T({},dh.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:T({},dh.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[fh]:T({},yh,null!=(v=null==o?void 0:o.audits)?v:{}),[Zh.storeName]:Zh.initialState,[fA.storeName]:fA.initialState,[pA.storeName]:pA.initialState},reducer:Ne({root:gA,[xv.storeName]:xv.reducer,[dh.storeName]:dh.reducer,[fh]:gh,[Zh.storeName]:Zh.reducer,[fA.storeName]:fA.reducer,[pA.storeName]:pA.reducer})});const m=function*(){yield $i([xi(xv.sagas),xi(dh.sagas),xi(Lh),xi(Zh.sagas),xi(fA.sagas),xi(pA.sagas)])},b=function*(){yield $i([xi(xv.mockSagas),xi(dh.mockSagas),xi(fA.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(xn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var vA=n(714),hA=n.n(vA);function mA(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function bA(e){if(e.type)return e;if("#"===e.charAt(0))return bA(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 AA(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 kA(e){if(0===e.indexOf("#"))return e;const{values:t}=bA(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 TA(e,t){if(e=bA(e),t=mA(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 AA(e)}function PA(e,t){if(e=bA(e),t=mA(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 AA(e)}const IA=e=>{if(e)return{main:e,light:kA(PA(e,.4)),dark:kA(TA(e,.15)),hover:kA(TA(e,.15)),active:kA(TA(e,.2))}},LA=e=>{if(e)return{main:e,light:PA(e,.7),dark:TA(e,.2)}},OA=(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)?T({},t,{palette:{primary:T({},IA(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:T({},IA(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:T({},IA(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:T({},LA(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:T({},LA(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:T({},LA(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:T({},LA(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},EA={},wA={},CA={},DA={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 RA{constructor(){this._theme=EA,this._themeV2=wA,this._navigation=DA,this._localizations=CA}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new RA;return n.set(e),RA._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=hA().all([null!=(t=DA)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=hA().all([null!=(i=EA)?i:{},OA(null==e?void 0:e.theme,EA)]),this._themeV2=hA().all([null!=(o=wA)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=hA().all([null!=(r=CA)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=DA,this._theme=EA,this._themeV2=wA,this._localizations=CA}}}RA._instances={};var _A={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on"},UA=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},NA=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},MA=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 $A,FA,xA,VA,jA,KA,WA,GA;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}($A||($A={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(FA||(FA={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(xA||(xA={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.LoginRestrictions="loginRestrictions",e.SignupRestrictions="signupRestrictions"}(VA||(VA={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(jA||(jA={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(KA||(KA={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(WA||(WA={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(GA||(GA={}));const zA={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},BA={hidden:"hidden",edit:"edit"};var qA="6.46.0-alpha.2",HA=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];m(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(qA),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=I(O().mark((function e(){var t,n,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Wo,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:RA.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=I(O().mark((function e(){return O().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=I(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=_A,e.next=13;break;case 4:return e.prev=4,e.next=7,hu();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=UA(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=T({},t,{contextOptions:T({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?T({},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:SA({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),k.setInstance(c,this)}var t,n,i,o;return A(e,[{key:"initContainers",value:(o=I(O().mark((function e(t){return O().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;RA.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:v,FronteggTypes:h})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=I(O().mark((function e(){return O().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=I(O().mark((function e(){var t;return O().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=I(O().mark((function e(t){var n;return O().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,T({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}(),JA=function(){function e(){m(this,e)}return A(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=k.getInstance(i);e&&t?(Fo.setAccessToken(t),Fo.setUser(T({},n,{accessToken:t})),o.store.dispatch(xn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(xn.loadTenants())):(Fo.setAccessToken(null),Fo.setUser(null),o.store.dispatch(xn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),YA=function(){function e(){m(this,e)}return A(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).hideAdminPortal()}}]),e}(),QA=function(){function e(){m(this,e)}return A(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";k.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).hideCheckoutDialog()}}]),e}(),XA=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},ZA=function(){function e(t,n,i,o){m(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:SA({context:a},this,!0,void 0,void 0,!0),this.options=T({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new HA(this.options,t,!0),RA.set({},t)}var t;return A(e,[{key:"render",value:(t=I(O().mark((function e(t){var n,i,o,a,r=this;return O().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,MA(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}(),ek="modern",tk=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[ek]},nk=function(){function e(t,n,i,o){m(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:SA({context:a},this,!0,void 0,void 0,!0),this.options=T({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new HA(this.options,t,!0),RA.set({},t)}var t;return A(e,[{key:"render",value:(t=I(O().mark((function e(t){var n,i,o,a,r=this;return O().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,MA(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 ik(e,t){return ik=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ik(e,t)}function ok(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&&ik(e,t)}function ak(e){return ak="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},ak(e)}function rk(e,t){if(t&&("object"===ak(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 lk(e){return lk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lk(e)}function sk(){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 ck(e,t,n){return ck=sk()?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&&ik(o,n.prototype),o},ck.apply(null,arguments)}function uk(e){var t="function"==typeof Map?new Map:void 0;return uk=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 ck(e,arguments,lk(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ik(n,e)},uk(e)}function dk(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=lk(e);if(t){var o=lk(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return rk(this,n)}}var yk=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new HA(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){ok(n,e);var t=dk(n);function n(){var e;m(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 A(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=k.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=NA(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=NA(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=NA(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=NA(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=NA(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=NA(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}(uk(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 p?t:p,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 p(){}function g(){}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=p.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:w}}function w(){return{value:void 0,done:!0}}return g.prototype=S,u(b,"constructor",S),u(S,"constructor",g),g.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"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 ik},AdminPortalRenderer:function(){return rk},AppHolder:function(){return k},CheckoutDialog:function(){return ok},FronteggApp:function(){return tk},HostedLogin:function(){return nk},LoginBoxRenderer:function(){return ck},defaultTheme:function(){return lk},getThemeAdminByName:function(){return ak},getThemeByName:function(){return sk},initialize:function(){return mk}});var e={};n.r(e),n.d(e,{Delete:function(){return qo},Get:function(){return Wo},Patch:function(){return zo},Post:function(){return Go},PostDownload:function(){return Ho},Put:function(){return Bo},getBaseUrl:function(){return jo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return La},getSubTenantsAsTree:function(){return Oa},getTenants:function(){return Ia},switchTenant:function(){return Pa}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return Xa},SocialLoginProviders:function(){return Qa},acceptInvitation:function(){return hr},activateAccount:function(){return pr},bulkCreateIPRestriction:function(){return Ba},changePhoneNumber:function(){return Ql},changePhoneNumberWithVerification:function(){return Jl},checkIfAllowToRememberMfaDevice:function(){return Pl},createDomainRestriction:function(){return Va},createIPRestriction:function(){return za},createOrUpdateSessionConfigrations:function(){return pl},createSSOConfiguration:function(){return El},createSSOConfigurationByMetadata:function(){return Rl},createSSODomain:function(){return Ul},createSSOGroup:function(){return xl},createSamlGroup:function(){return el},deleteAllSessionsForUser:function(){return Sl},deleteDomainRestriction:function(){return Ka},deleteIPRestriction:function(){return Ha},deleteSSOConfiguration:function(){return Dl},deleteSSODomain:function(){return Nl},deleteSSOGroup:function(){return jl},deleteSamlGroup:function(){return nl},deleteSessionForUser:function(){return gl},deleteTenantApiToken:function(){return Al},deleteUserApiToken:function(){return kl},disableMFAAuthenticatorApp:function(){return Er},disableMFASMS:function(){return Dr},disableMFAWebAuthn:function(){return _r},disableMfa:function(){return wr},enrollMFAAuthenticatorAppForLogin:function(){return Mr},enrollMFASMSForLogin:function(){return xr},enrollMFAWebAuthnForLogin:function(){return Wr},enrollMfa:function(){return Lr},exchangeOAuthTokens:function(){return zl},forgotPassword:function(){return kr},generateLoginResponse:function(){return ar},generateLoginResponseFromOAuthResponse:function(){return lr},generateLoginResponseV2:function(){return rr},getActivateAccountStrategy:function(){return gr},getCaptchaPolicy:function(){return Ua},getCurrentUserSession:function(){return dl},getCurrentUserSessions:function(){return ul},getDomainRestrictions:function(){return Fa},getDomainRestrictionsConfig:function(){return xa},getGlobalSecurityPolicy:function(){return wa},getIPRestrictions:function(){return Wa},getIPRestrictionsConfig:function(){return Ga},getLockoutPolicy:function(){return Ra},getMFADevices:function(){return Ur},getMfaPolicy:function(){return Ea},getOidcConfiguration:function(){return il},getPasswordConfigPolicy:function(){return $a},getPasswordHistoryPolicy:function(){return Na},getSSOConfigurations:function(){return wl},getSSODefaultRoles:function(){return $l},getSSOGroups:function(){return Kl},getSSOPublicConfiguration:function(){return ol},getSamlConfiguration:function(){return Br},getSamlRoles:function(){return Qr},getSamlRolesGroups:function(){return Xr},getSamlVendorConfiguration:function(){return Hr},getSessionConfigurations:function(){return fl},getSocialLoginProviders:function(){return al},getSocialLoginProvidersV2:function(){return rl},getTenantApiTokensData:function(){return hl},getUserApiTokensData:function(){return vl},getUserById:function(){return Tl},getVendorConfig:function(){return sl},getVendorMfaPolicy:function(){return Ca},getVendorPublicAuthStrategiesConfig:function(){return ns},loadPasswordConfig:function(){return Pr},login:function(){return yr},loginViaSocialLogin:function(){return ll},loginWithMfa:function(){return fr},logout:function(){return Ar},oidcPostLogin:function(){return dr},oidcPostLoginV2:function(){return Gl},passwordlessPostLogin:function(){return Ll},passwordlessPreLogin:function(){return Il},postLogin:function(){return ur},preDisableMFASMS:function(){return Cr},preDisableMFAWebAuthn:function(){return Rr},preEnrollMFAAuthenticatorAppForLogin:function(){return Nr},preEnrollMFASMSForLogin:function(){return Fr},preEnrollMFAWebAuthnForLogin:function(){return Kr},preLogin:function(){return sr},preLoginV2:function(){return Wl},preLoginWithIdpType:function(){return cr},preVerifyMFASMSForLogin:function(){return Vr},preVerifyMFAWebAuthnForLogin:function(){return Gr},recoverMfaToken:function(){return Ir},refreshToken:function(){return mr},refreshTokenV2:function(){return br},resendActivationEmail:function(){return Sr},resendInvitationEmail:function(){return vr},resetPassword:function(){return Tr},resetPhoneNumber:function(){return ql},revokeSessionsForUser:function(){return yl},saveLockoutPolicy:function(){return _a},saveMfaPolicy:function(){return Da},savePasswordHistoryPolicy:function(){return Ma},setSSODefaultRoles:function(){return Fl},signUpUser:function(){return cl},silentOAuthRefreshToken:function(){return Bl},testCurrentIp:function(){return Ja},testCurrentIpInAllowList:function(){return Ya},updateDomainRestrictionConfig:function(){return ja},updateIPRestrictionConfig:function(){return qa},updateSSOConfiguration:function(){return Cl},updateSSOConfigurationByMetadata:function(){return _l},updateSSOGroup:function(){return Vl},updateSamlConfiguration:function(){return qr},updateSamlGroup:function(){return tl},updateSamlRoles:function(){return Zr},updateSamlVendorMetadata:function(){return Jr},updateTenantApiTokensData:function(){return bl},updateUserApiTokensData:function(){return ml},validateSSODomain:function(){return Ml},validateSamlDomain:function(){return Yr},verifyChangePhoneNumber:function(){return Yl},verifyInviteToken:function(){return Ol},verifyMFAAuthenticatorAppForLogin:function(){return $r},verifyMFASMSForLogin:function(){return jr},verifyMFAWebAuthnForLogin:function(){return zr},verifyMfa:function(){return Or},verifyNewDeviceSession:function(){return ts},verifyResetPhoneNumber:function(){return Hl},webAuthnCreateNewDeviceSession:function(){return es},webAuthnPostLogin:function(){return Zl},webAuthnPreLogin:function(){return Xl}});var a={};n.r(a),n.d(a,{addUser:function(){return ss},changePassword:function(){return rs},createInviteUserLink:function(){return ds},deleteInviteUserLink:function(){return fs},deleteUser:function(){return cs},getInviteLinkConfiguration:function(){return gs},getInviteUserLink:function(){return ps},getProfile:function(){return is},loadAvailablePermissions:function(){return vs},loadAvailableRoles:function(){return Ss},loadStats:function(){return hs},loadUsers:function(){return ls},resendActivationLink:function(){return ms},resendInvitationLink:function(){return bs},resendInvitationLinkToAllTenants:function(){return As},updateInviteUserLink:function(){return ys},updateProfile:function(){return os},updateProfileImage:function(){return as},updateUser:function(){return us}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Ls},getCurrentUserIpMetadata:function(){return Ts},getIpAdressMetadata:function(){return Os},getNotificationsMetadata:function(){return Ps},getSamlMetadata:function(){return Is}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Ns},getReport:function(){return Rs},getReports:function(){return Ds},renderReport:function(){return _s},scheduleReport:function(){return Us},sendReport:function(){return Ms}});var s={};n.r(s),n.d(s,{getNotifications:function(){return $s},markAllAsRead:function(){return Vs},updateNotificationIsPinned:function(){return xs},updateNotificationStatus:function(){return Fs}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Gs},getAudits:function(){return Ks},getAuditsStats:function(){return Ws}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return oc},deleteEmailSubscriptions:function(){return nc},deleteSMSConfiguration:function(){return uc},deleteSMSSubscriptions:function(){return sc},deleteSlackConfiguration:function(){return Qs},deleteWebhooksConfiguration:function(){return fc},getCategories:function(){return vc},getChannelMaps:function(){return hc},getEmailConfiguration:function(){return Zs},getSMSConfiguration:function(){return ac},getSlackChannels:function(){return Js},getSlackConfiguration:function(){return qs},getSlackScope:function(){return Hs},getWebhookLog:function(){return pc},getWebhooksConfigurations:function(){return dc},patchEmailConfiguration:function(){return tc},patchSMSConfiguration:function(){return lc},postEmailConfiguration:function(){return ec},postSMSConfiguration:function(){return rc},postSlackCode:function(){return Xs},postSlackConfiguration:function(){return Ys},postWebhookRetry:function(){return Sc},postWebhookTest:function(){return gc},postWebhooksConfiguration:function(){return yc},putEmailSubscriptions:function(){return ic},putSMSSubscriptions:function(){return cc}});var d={};n.r(d),n.d(d,{getSettings:function(){return bc},updateSettings:function(){return mc}});var y={};n.r(y),n.d(y,{addRole:function(){return Ic},attachPermissionToRoles:function(){return Cc},attachPermissionsToRole:function(){return wc},deleteRole:function(){return Lc},getPermissionCategories:function(){return Dc},getPermissions:function(){return Ec},getRoles:function(){return Pc},updateRole:function(){return Oc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return cu},ISubscriptionStatus:function(){return lu},PaymentMethodType:function(){return su},ProviderType:function(){return uu},TenantCreatedAction:function(){return yu},TrialEndAction:function(){return du},cancelManagedSubscription:function(){return xc},cancelSubscription:function(){return Uc},createStripeCustomer:function(){return Zc},createStripePaymentMethodSetupIntentSecret:function(){return tu},createSubscription:function(){return Qc},createTenantConfiguration:function(){return ou},getManagedSubscription:function(){return $c},getManagedSubscriptions:function(){return Fc},getPaymentMethod:function(){return Jc},getPaymentMethods:function(){return Hc},getPaymentProviders:function(){return au},getStripeCustomer:function(){return Xc},getStripePaymentProviderConfiguration:function(){return eu},getSubscription:function(){return _c},getSubscriptionInvoice:function(){return zc},getSubscriptionInvoicePdf:function(){return Bc},getSubscriptionInvoices:function(){return Gc},getSubscriptionPlan:function(){return Wc},getSubscriptionPlans:function(){return Kc},getSubscriptionSummaries:function(){return nu},getSubscriptions:function(){return Rc},getTenantConfiguration:function(){return iu},getVendorPublicConfigurations:function(){return ru},renewManagedSubscription:function(){return Vc},renewSubscription:function(){return Nc},updateManagedSubscription:function(){return jc},updatePaymentMethodBillingDetails:function(){return Yc},updateSubscription:function(){return Mc}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return vu}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return Au},addUserToTenantAndSubTenants:function(){return mu},loadAllUsers:function(){return hu},removeUserFromTenantAndSubTenants:function(){return bu},removeUserRolesFromSubTenants:function(){return ku},setUserRolesForSubTenants:function(){return Tu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Pu}});var v={};n.r(v),n.d(v,{AuthStrategyEnum:function(){return Xa},ContextHolder:function(){return Fo},FronteggApiError:function(){return Vo},FronteggContext:function(){return xo},ISubscriptionCancellationPolicy:function(){return cu},ISubscriptionStatus:function(){return lu},MFAStrategyEnum:function(){return gu},PaymentMethodType:function(){return su},ProviderType:function(){return uu},RestrictionType:function(){return Dn},SecondaryAuthStrategy:function(){return fu},SocialLoginProviders:function(){return Qa},TenantType:function(){return Su},WebAuthnDeviceType:function(){return pu},api:function(){return wu},default:function(){return Eu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Iu},fronteggRefreshTokenUrl:function(){return Lu},fronteggSilentRefreshTokenUrl:function(){return Ou},loadFeatureFlags:function(){return Pu}});var h={};function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 A(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(h),n.d(h,{AccountPageFields:function(){return BA},DomainRestrictionsTabFields:function(){return QA},GeneralSettingsTabFields:function(){return JA},InviteUserModalFields:function(){return zA},IpRestrictionsTabFields:function(){return YA},Metadata:function(){return FA},PrivacyPageFields:function(){return GA},ProfilePageFields:function(){return WA},SecurityPageTabs:function(){return qA},SessionManagementTabFields:function(){return HA},fieldAppearance:function(){return XA},tabAppearance:function(){return ZA}});var k=function(){function e(){m(this,e)}return A(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 T(){return T=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},T.apply(this,arguments)}function P(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 I(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){P(a,i,o,r,l,"next",e)}function l(e){P(a,i,o,r,l,"throw",e)}r(void 0)}))}}k._apps={};var L=n(841),O=n.n(L);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 E(e){return!!e&&!!e[ge]}function C(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)===Se}(e)||Array.isArray(e)||!!e[pe]||!!e.constructor[pe]||M(e)||$(e))}function D(e,t,n){void 0===n&&(n=!1),0===R(e)?(n?Object.keys:ve)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function R(e){var t=e[ge];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:M(e)?2:$(e)?3:0}function _(e,t){return 2===R(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function U(e,t,n){var i=R(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 M(e){return ue&&e instanceof Map}function $(e){return de&&e instanceof Set}function F(e){return e.o||e.t}function x(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=he(e);delete t[ge];for(var n=ve(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 V(e,t){return void 0===t&&(t=!1),K(e)||E(e)||!C(e)||(R(e)>1&&(e.set=e.add=e.clear=e.delete=j),Object.freeze(e),t&&D(e,(function(e,t){return V(t,!0)}),!0)),e}function j(){w(2)}function K(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function W(e){var t=me[e];return t||w(18,e),t}function G(){return se}function z(e,t){t&&(W("Patches"),e.u=[],e.s=[],e.v=t)}function B(e){q(e),e.p.forEach(J),e.p=null}function q(e){e===se&&(se=e.l)}function H(e){return se={p:[],l:se,h:e,m:!0,_:0}}function J(e){var t=e[ge];0===t.i||1===t.i?t.j():t.O=!0}function Y(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||W("ES5").S(t,e,i),i?(n[ge].P&&(B(t),w(4)),C(e)&&(e=Q(t,e),t.l||Z(t,e)),t.u&&W("Patches").M(n[ge].t,e,t.u,t.s)):e=Q(t,n,[]),B(t),t.u&&t.v(t.u,t.s),e!==fe?e:void 0}function Q(e,t,n){if(K(t))return t;var i=t[ge];if(!i)return D(t,(function(o,a){return X(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return Z(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=x(i.k):i.o;D(3===i.i?new Set(o):o,(function(t,a){return X(e,i,o,t,a,n)})),Z(e,o,!1),n&&e.u&&W("Patches").R(i,n,e.u,e.s)}return i.o}function X(e,t,n,i,o,a){if(E(o)){var r=Q(e,o,a&&t&&3!==t.i&&!_(t.D,i)?a.concat(i):void 0);if(U(n,i,r),!E(r))return;e.m=!1}if(C(o)&&!K(o)){if(!e.h.F&&e._<1)return;Q(e,o),t&&t.A.l||Z(e,o)}}function Z(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&V(t,n)}function ee(e,t){var n=e[ge];return(n?F(n):e)[t]}function te(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 ne(e){e.P||(e.P=!0,e.l&&ne(e.l))}function ie(e){e.o||(e.o=x(e.t))}function oe(e,t,n){var i=M(t)?W("MapSet").N(t,n):$(t)?W("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:G(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=be;n&&(o=[i],a=Ae);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):W("ES5").J(t,n);return(n?n.A:G()).p.push(i),i}function ae(e){return E(e)||w(22,e),function e(t){if(!C(t))return t;var n,i=t[ge],o=R(t);if(i){if(!i.P&&(i.i<4||!W("ES5").K(i)))return i.t;i.I=!0,n=re(t,o),i.I=!1}else n=re(t,o);return D(n,(function(t,o){i&&function(e,t){return 2===R(e)?e.get(t):e[t]}(i.t,t)===o||U(n,t,e(o))})),3===o?new Set(n):n}(e)}function re(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return x(e)}var le,se,ce="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ue="undefined"!=typeof Map,de="undefined"!=typeof Set,ye="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,fe=ce?Symbol.for("immer-nothing"):((le={})["immer-nothing"]=!0,le),pe=ce?Symbol.for("immer-draftable"):"__$immer_draftable",ge=ce?Symbol.for("immer-state"):"__$immer_state",Se=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ve="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,he=Object.getOwnPropertyDescriptors||function(e){var t={};return ve(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},me={},be={get:function(e,t){if(t===ge)return e;var n=F(e);if(!_(n,t))return function(e,t,n){var i,o=te(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||!C(i)?i:i===ee(e.t,t)?(ie(e),e.o[t]=oe(e.A.h,i,e)):i},has:function(e,t){return t in F(e)},ownKeys:function(e){return Reflect.ownKeys(F(e))},set:function(e,t,n){var i=te(F(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ee(F(e),t),a=null==o?void 0:o[ge];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(N(n,o)&&(void 0!==n||_(e.t,t)))return!0;ie(e),ne(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!==ee(e.t,t)||t in e.t?(e.D[t]=!1,ie(e),ne(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=F(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)}},Ae={};D(be,(function(e,t){Ae[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ae.deleteProperty=function(e,t){return Ae.set.call(this,e,t,void 0)},Ae.set=function(e,t,n){return be.set.call(this,e[0],t,n,e[0])};var ke=function(){function e(e){var t=this;this.g=ye,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),C(e)){var l=H(t),s=oe(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?B(l):q(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(l,i),Y(e,l)}),(function(e){throw B(l),e})):(z(l,i),Y(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===fe&&(r=void 0),t.F&&V(r,!0),i){var u=[],d=[];W("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){C(e)||w(8),E(e)&&(e=ae(e));var t=H(this),n=oe(this,e,void 0);return n[ge].C=!0,q(t),n},t.finishDraft=function(e,t){var n=(e&&e[ge]).A;return z(n,t),Y(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ye&&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=W("Patches").$;return E(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Te=new ke,Pe=Te.produce,Ie=(Te.produceWithPatches.bind(Te),Te.setAutoFreeze.bind(Te),Te.setUseProxies.bind(Te),Te.applyPatches.bind(Te),Te.createDraft.bind(Te),Te.finishDraft.bind(Te),Pe);function Le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oe(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?Oe(Object(n),!0).forEach((function(t){Le(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ee(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 Ce="function"==typeof Symbol&&Symbol.observable||"@@observable",De=function(){return Math.random().toString(36).substring(7).split("").join(".")},Re={INIT:"@@redux/INIT"+De(),REPLACE:"@@redux/REPLACE"+De(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+De()}};function _e(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 Ue(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ee(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ee(1));return n(Ue)(e,t)}if("function"!=typeof e)throw new Error(Ee(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(Ee(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ee(4));if(s)throw new Error(Ee(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ee(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!_e(e))throw new Error(Ee(7));if(void 0===e.type)throw new Error(Ee(8));if(s)throw new Error(Ee(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(Ee(10));o=e,y({type:Re.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ee(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ce]=function(){return this},e}return y({type:Re.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ce]=p,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:Re.INIT}))throw new Error(Ee(12));if(void 0===n(void 0,{type:Re.PROBE_UNKNOWN_ACTION()}))throw new Error(Ee(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(Ee(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Me(){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 $e(){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(Ee(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Me.apply(void 0,a)(n.dispatch),we(we({},n),{},{dispatch:i})}}}function Fe(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 xe=Fe();xe.withExtraArgument=Fe;var Ve,je=xe,Ke=(Ve=function(e,t){return Ve=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])},Ve(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}Ve(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),We=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Ge=Object.defineProperty,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Be=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,He=function(e,t,n){return t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Je=function(e,t){for(var n in t||(t={}))Be.call(t,n)&&He(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],qe.call(t,n)&&He(e,n,t[n]);return e},Ye="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Me:Me.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Qe=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,We([void 0],e[0].concat(this)))):new(t.bind.apply(t,We([void 0],e.concat(this))))},t}(Array);function Xe(e){return C(e)?Ie(e,(function(){})):e}function Ze(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Qe);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(je):i.push(je.withExtraArgument(n.extraArgument))),i}function et(e){var t,n=function(e){return Ze(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 p=l;"function"==typeof p&&(p=p(n));var g=$e.apply(void 0,p),S=Me;c&&(S=Ye(Je({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=We([g],f):"function"==typeof f&&(v=f(v)),Ue(t,d,S.apply(void 0,v))}function tt(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 Je(Je({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 nt(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 it(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:Xe(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?nt(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=Je(Je({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?nt(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return Xe(e())};else{var c=Xe(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=We([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(E(e))return void 0===(i=n(e,t))?e:i;if(C(e))return Ie(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?tt(c,i):tt(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 ot="listenerMiddleware";tt(ot+"/add"),tt(ot+"/removeAll"),tt(ot+"/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[ge];return be.get(t,e)},set:function(t){var n=this[ge];be.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ge];if(!o.P)switch(o.i){case 5:i(o)&&ne(o);break;case 4:n(o)&&ne(o)}}}function n(e){for(var t=e.t,n=e.k,i=ve(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ge){var r=t[a];if(void 0===r&&!_(t,a))return!0;var l=n[a],s=l&&l[ge];if(s?s.t!==r:!N(l,r))return!0}}var c=!!t[ge];return i.length!==ve(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){me[e]||(me[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=he(n);delete a[ge];for(var r=ve(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:G(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ge,{value:a,writable:!0}),o},S:function(e,n,o){o?E(n)&&n[ge].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ge];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)D(a,(function(t){t!==ge&&(void 0!==o[t]||_(o,t)?r[t]||e(a[t]):(r[t]=!0,ne(n)))})),D(o,(function(e){void 0!==a[e]||_(a,e)||(r[e]=!1,ne(n))}));else if(5===l){if(i(n)&&(ne(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 at=(e,t)=>n=>T({},n,{[e]:t[e]}),rt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>T({},t,{[e]:T({},t[e],n)})}),lt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return T({},n,{[e]:T({},n[e],{[t]:T({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return T({},t,{[e]:T({},t[e],{loaders:T({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return T({},t,{[e]:T({},t[e],{errors:T({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),ut=(e=500)=>new Promise((t=>setTimeout(t,e))),dt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",yt=new Uint8Array(256);for(let e=0;e<dt.length;e++)yt[dt.charCodeAt(e)]=e;const ft=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=yt[e.charCodeAt(i)],a=yt[e.charCodeAt(i+1)],r=yt[e.charCodeAt(i+2)],l=yt[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+=dt[t[i]>>2],o+=dt[(3&t[i])<<4|t[i+1]>>4],o+=dt[(15&t[i+1])<<2|t[i+2]>>6],o+=dt[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 gt,St,vt;!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"}(gt||(gt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(St||(St={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(vt||(vt={}));const ht="FRONTEGG_AFTER_AUTH_REDIRECT_URL",mt="HOSTED_LOGIN_VERIFIER_KEY",bt="auth",At="connectivity",kt="auditLogs",Tt="vendor",Pt={flow:St.Login,step:gt.preLogin,loading:!1,email:"",tenants:[]},It={setLoginState:rt("loginState"),resetLoginState:at("loginState",{loginState:Pt})},Lt={requestAuthorize:tt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:tt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:tt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:tt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:tt("auth/afterAuthNavigation"),preLogin:tt("auth/preLogin",(e=>({payload:e}))),postLogin:tt("auth/postLogin",(e=>({payload:e}))),login:tt("auth/login",(e=>({payload:e}))),loginWithMfa:tt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:tt("auth/recoverMfa",(e=>({payload:e}))),logout:tt("auth/logout",(e=>({payload:e}))),silentLogout:tt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:tt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:tt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:tt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:tt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:tt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:tt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:tt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:tt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:tt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:tt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:tt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:tt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:tt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:tt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:tt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:tt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:tt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:tt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:tt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:tt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:tt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Ot;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ot||(Ot={}));const wt={step:Ot.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Et={setActivateState:rt("activateState"),resetActivateState:at("activateState",{activateState:wt}),setActivateStrategyState:lt("activateState","activationStrategy")},Ct={activateAccount:tt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:tt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:tt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:tt("auth/resendActivationEmail",(e=>({payload:e})))};let Dt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Dt||(Dt={}));const Rt={step:Dt.validate},_t={setAcceptInvitationState:rt("acceptInvitationState"),resetAcceptInvitationState:at("acceptInvitationState",{acceptInvitationState:Rt})},Ut={acceptInvitation:tt("auth/acceptInvitation",(e=>({payload:e})))};let Nt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Nt||(Nt={}));const Mt={step:Nt.forgotPassword,loading:!1,email:"",passwordConfig:null},$t={setForgotPasswordState:rt("forgotPasswordState"),resetForgotPasswordState:at("forgotPasswordState",{forgotPasswordState:Mt})},Ft={forgotPassword:tt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:tt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:tt("auth/loadPasswordConfig",(e=>({payload:e})))};let xt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(xt||(xt={}));const Vt={step:xt.ResetPhoneNumber,loading:!1},jt={setResetPhoneNumberState:rt("resetPhoneNumberState"),resetResetPhoneNumberState:at("resetPhoneNumberState",{resetPhoneNumberState:Vt})},Kt={resetPhoneNumber:tt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:tt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:tt("auth/changePhoneNumber",(e=>({payload:e})))},Wt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Gt={setSSOLoader:st("ssoState"),setSSOError:ct("ssoState"),setSSOState:rt("ssoState"),resetSSOState:at("ssoState",{ssoState:Wt})},zt={loadSSOConfigurationsV2:tt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:tt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:tt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:tt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:tt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:tt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:tt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:tt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:tt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:tt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:tt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:tt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:tt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:tt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:tt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:tt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:tt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:tt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:tt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:tt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:tt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:tt("auth/oidcPostlogin",(e=>({payload:e})))},Bt={loading:!1,error:null},qt={setProfileState:rt("profileState"),resetProfileState:at("profileState",{profileState:Bt})},Ht={loadProfile:tt("auth/loadProfile"),saveProfile:tt("auth/saveProfile",(e=>({payload:e}))),changePassword:tt("auth/changePassword",(e=>({payload:e})))};let Jt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Jt||(Jt={}));const Yt={step:Jt.verify,loading:!1},Qt={setMfaState:rt("mfaState"),resetMfaState:at("mfaState",{mfaState:Yt})},Xt={enrollMfa:tt("auth/enrollMfa"),verifyMfa:tt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:tt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:tt("auth/disableMfa",(e=>({payload:e})))},Zt={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}},en={setTeamLoader:st("teamState"),setTeamError:ct("teamState"),setTeamState:rt("teamState"),resetTeamState:at("teamState",{teamState:Zt})},tn={loadUsers:tt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:tt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:tt("auth/loadRoles",(e=>({payload:e}))),addUser:tt("auth/addUser",(e=>({payload:e}))),addUserToSubTenants:tt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:tt("auth/updateUser",(e=>({payload:e}))),deleteUser:tt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:tt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:tt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:tt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:tt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:tt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:tt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:tt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:tt("auth/getInvitationLink"),createInvitationLink:tt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:tt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:tt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:tt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:tt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:tt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:tt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:tt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:tt("auth/closeLockUserDialog",(e=>({payload:e})))},nn={firstLoad:!0,loading:!1,error:""},on={setSocialLoginsState:rt("socialLoginState"),resetSocialLoginsState:at("socialLoginState",{socialLoginState:nn})},an={loadSocialLoginsConfiguration:tt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:tt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:tt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:tt("auth/setSocialLoginError",(e=>({payload:e})))};let rn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(rn||(rn={}));const ln={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:rn.SignUp},sn={setSignUpState:rt("signUpState"),resetSignUpState:at("signUpState",{signUpState:ln})},cn={signUpUser:tt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:tt("auth/resetSignUpStateSoft")},un={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},dn={setApiTokensLoader:st("apiTokensState"),setApiTokensError:ct("apiTokensState"),setApiTokensState:rt("apiTokensState"),resetApiTokensState:at("apiTokensState",{apiTokensState:un})},yn={loadApiTokens:tt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:tt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:tt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:tt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:tt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:tt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:tt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:tt("auth/deleteTenantApiToken",(e=>({payload:e})))},fn={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:rt("securityPolicyState"),setSecurityPolicyGlobalState:lt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:lt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:lt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:lt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:lt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyLockoutState:lt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:lt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:lt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:lt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:at("securityPolicyState",{securityPolicyState:fn})},gn={loadSecurityPolicy:tt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:tt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:tt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:tt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:tt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:tt("auth/loadSecurityPolicyLockout"),saveSecurityPolicyLockout:tt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:tt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:tt("auth/loadSecurityPolicyPasswordHistory"),saveSecurityPolicyPasswordHistory:tt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:tt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:tt("auth/loadPublicAuthStrategiesPolicy")},Sn={loading:!1},vn={setAccountSettingsState:rt("accountSettingsState"),resetAccountSettingsState:at("accountSettingsState",{accountSettingsState:Sn})},hn={loadAccountSettings:tt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:tt("auth/saveAccountSettings",(e=>({payload:e})))},mn={tenants:[],subTenants:[],loading:!0,tenantTree:null},bn={setTenantsState:rt("tenantsState"),resetTenantsState:at("tenantsState",{tenantsState:mn})},An={switchTenant:tt("auth/switchTenant",(e=>({payload:e}))),loadTenants:tt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:tt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:tt("auth/loadSubTenantsTree",(e=>({payload:e})))},kn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Tn={setRolesState:rt("rolesState"),resetRolesState:at("rolesState",{rolesState:kn})},Pn={loadRolesAndPermissions:tt("auth/loadRoles",(e=>({payload:e}))),addRole:tt("auth/addRole",(e=>({payload:e}))),updateRole:tt("auth/updateRole",(e=>({payload:e}))),deleteRole:tt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:tt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:tt("auth/attachPermissionToRoles",(e=>({payload:e})))},In={loading:!1,sessions:[]},Ln={setSessionsState:rt("sessionsState"),resetSessionsState:at("sessionsState",{sessionsState:In})},On={loadUserSessions:tt("auth/loadUserSessions"),loadCurrentUserSession:tt("auth/loadCurrentUserSession"),deleteUserSession:tt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:tt("auth/deleteAllUserSessions"),revokeUserSessions:tt("auth/revokeUserSessions",(e=>({payload:e})))},wn={loading:!1,configurations:{}},En={setSessionsPolicyState:rt("sessionsPolicyState"),resetSessionsPolicyState:at("sessionsPolicyState",{sessionsPolicyState:wn})},Cn={loadSessionsPolicy:tt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:tt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Dn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Dn||(Dn={}));const Rn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Dn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},_n={setRestrictionsState:rt("restrictionsState"),setIpRestrictionsState:lt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:lt("restrictionsState","emailDomainRestrictions")},Un={checkIfUserIpValid:tt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:tt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:tt("auth/loadIpRestrictions"),saveIpRestriction:tt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:tt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:tt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:tt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:tt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:tt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:tt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Nn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:ln,loginState:Pt,activateState:wt,acceptInvitationState:Rt,forgotPasswordState:Mt,ssoState:Wt,profileState:Bt,mfaState:Yt,teamState:Zt,socialLoginState:nn,apiTokensState:un,securityPolicyState:fn,accountSettingsState:Sn,tenantsState:mn,rolesState:kn,resetPhoneNumberState:Vt,sessionsState:In,sessionsPolicyState:wn,restrictionsState:Rn},Mn=T({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:$n,actions:Fn}=it({name:bt,initialState:Mn,reducers:T({resetState:e=>T({},e,Nn),setState:(e,{payload:t})=>T({},e,t),setUser:("user",(e,{payload:t})=>T({},e,{user:t}))},It,on,Et,_t,$t,jt,sn,qt,Gt,Qt,en,dn,pn,vn,bn,Tn,Ln,En,_n)});const xn=T({},Fn,Lt,an,Ct,Ut,Ft,Kt,cn,Ht,zt,Xt,tn,yn,gn,hn,An,Pn,On,Cn,Un);var Vn=function(e){return"@@redux-saga/"+e},jn=Vn("CANCEL_PROMISE"),Kn=Vn("CHANNEL_END"),Wn=Vn("IO"),Gn=Vn("MATCH"),zn=Vn("MULTICAST"),Bn=Vn("SAGA_ACTION"),qn=Vn("SELF_CANCELLATION"),Hn=Vn("TASK"),Jn=Vn("TASK_CANCEL"),Yn=Vn("TERMINATE"),Qn=Vn("LOCATION");function Xn(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 Zn=function(e){return null==e},ei=function(e){return null!=e},ti=function(e){return"function"==typeof e},ni=function(e){return"string"==typeof e},ii=Array.isArray,oi=function(e){return e&&ti(e.then)},ai=function(e){return e&&ti(e.next)&&ti(e.throw)},ri=function e(t){return t&&(ni(t)||ci(t)||ti(t)||ii(t)&&t.every(e))},li=function(e){return e&&ti(e.take)&&ti(e.close)},si=function(e){return ti(e)&&e.hasOwnProperty("toString")},ci=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},ui=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[jn]=function(){clearTimeout(n)},i},di=function(e){return function(){return e}},yi=di(!0),fi=function(){},pi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var gi=function(e,t){T(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Si(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var vi=function(e){throw e},hi=function(e){return{value:e,done:!0}};function mi(e,t,n){void 0===t&&(t=vi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:hi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function bi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ai=function(e){return Array.apply(null,new Array(e))},ki=function(e){return function(t){return e(Object.defineProperty(t,Bn,{value:!0}))}},Ti=function(e){return e===Yn},Pi=function(e){return e===Jn},Ii=function(e){return Ti(e)||Pi(e)};function Li(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ii(e)?Ai(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ii(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=fi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Oi(e){return{name:e.name||"anonymous",location:wi(e)}}function wi(e){return e[Qn]}var Ei=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)},Ci="TAKE",Di="CALL",Ri="FORK",_i="SELECT",Ui=function(e,t){var n;return(n={})[Wn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ni(e,t){return void 0===e&&(e="*"),ri(e)?(ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ui(Ci,{pattern:e})):li(n=e)&&n[zn]&&ei(t)&&ri(t)?Ui(Ci,{channel:e,pattern:t}):li(e)?(ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ui(Ci,{channel:e})):void 0;var n}function Mi(e,t){return Zn(t)&&(t=e,e=void 0),Ui("PUT",{channel:e,action:t})}function $i(e){var t=Ui("ALL",e);return t.combinator=!0,t}function Fi(e,t){var n,i=null;return ti(e)?n=e:(ii(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ni(n)&&ti(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function xi(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 Ui(Di,Fi(e,n))}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 Ui(Ri,Fi(e,n))}function ji(e){return void 0===e&&(e=qn),Ui("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 Ui(_i,{selector:e,args:n})}var Wi=xi.bind(null,ui);var Gi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},zi=[],Bi=0;function qi(e){try{Yi(),e()}finally{Qi()}}function Hi(e){zi.push(e),Bi||(Yi(),Xi())}function Ji(e){try{return Yi(),e()}finally{Xi()}}function Yi(){Bi++}function Qi(){Bi--}function Xi(){var e;for(Qi();!Bi&&void 0!==(e=zi.shift());)qi(e)}var Zi=function(e){return function(t){return e.some((function(e){return oo(e)(t)}))}},eo=function(e){return function(t){return e(t)}},to=function(e){return function(t){return t.type===String(e)}},no=function(e){return function(t){return t.type===e}},io=function(){return yi};function oo(e){var t="*"===e?io:ni(e)?to:ii(e)?Zi:si(e)?to:ti(e)?eo:ci(e)?no:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ao={type:Kn},ro=function(e){return e&&e.type===Kn};function lo(){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(ao)}))},(e={})[zn]=!0,e.put=function(e){if(!t)if(ro(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Gn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=io),t?e(ao):(e[Gn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Si(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Bn]?l(e):Hi((function(){l(e)}))},r}function so(e,t){var n=e[jn];ti(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var co,uo=0,yo=function(){return++uo};function fo(e){e.isRunning()&&e.cancel()}var po=((co={}).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):!ro(e)||r?n(e):n(Yn)};try{o.take(l,ei(a)?oo(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},co.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Hi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&oi(t)?so(t,n):n(t)}))},co.ALL=function(e,t,n,i){var o=i.digestEffect,a=uo,r=Object.keys(t);if(0!==r.length){var l=Li(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(ii(t)?[]:{})},co.RACE=function(e,t,n,i){var o=i.digestEffect,a=uo,r=Object.keys(t),l=ii(t)?Ai(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ii(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=fi,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)}))},co.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(oi(s))return void so(s,n);if(ai(s))return void Po(e,s,l.context,uo,Oi(a),!1,n);n(s)}catch(e){n(e,!0)}},co.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Zn(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},co.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(ai(o))return o;var a=!1;return mi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!oi(o)})}))}catch(e){return mi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Oi(t)}(c,a);Ji((function(){var t=Po(e,c,s.context,uo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},co.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()&&Si(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ii(t)){if(0===t.length)return void n([]);var r=Li(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},co.CANCEL=function(e,t,n,i){var o=i.task;t===qn?fo(o):ii(t)?t.forEach(fo):fo(t),n()},co.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)}},co.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ei());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ao):e.isEmpty()?(n.push(i),i.cancel=function(){Si(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(ao):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])(ao)}}}}(t.buffer),a=oo(i),r=function t(n){ro(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)},co.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},co.FLUSH=function(e,t,n){t.flush(n)},co.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},co.SET_CONTEXT=function(e,t,n,i){var o=i.task;gi(o.context,t),n()},co);function go(e,t){return e+"?"+t}function So(e){var t=e.name,n=e.location;return n?t+" "+go(n.fileName,n.lineNumber):t}function vo(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 ho=null,mo=[],bo=function(e){e.crashedEffect=ho,mo.push(e)},Ao=function(){ho=null,mo.length=0},ko=function(){var e,t,n=mo[0],i=mo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=wi(e))?t.code+" "+go(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+So(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+So(e.meta)})),[vo(mo)]).join("\n")};function To(e,t,n,i,o,a,r){var l;void 0===r&&(r=fi);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Si(o,t),t.cont=fi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=fi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,bo({meta:o,cancelledTasks:y}),S.isRoot){var i=ko();Ao(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Jn?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={})[Hn]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Jn,!1))},l.cont=r,l.end=g,l.setContext=function(e){gi(f,e)},l.toPromise=function(){return d||(d=Gi(),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 Po(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){oi(t)?so(t,i):ai(t)?Po(e,t,c.context,n,o,!1,i):t&&t[Wn]?(0,po[t.type])(e,t.payload,i,u):i(t)}));d.cancel=fi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(Jn))},status:0},c=To(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),Ao()):Pi(e)?(s.status=1,d.cancel(),o=ti(t.return)?t.return(Jn):{done:!0,value:Jn}):o=Ti(e)?ti(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=yo();function s(n,o){a||(a=!0,i.cancel=fi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ho=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=fi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=fi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Io(e,t){for(var n=e.channel,i=void 0===n?lo():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?bi:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=yo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||fi,s.effectTriggered=s.effectTriggered||fi,s.effectResolved=s.effectResolved||fi,s.effectRejected=s.effectRejected||fi,s.effectCancelled=s.effectCancelled||fi,s.actionDispatched=s.actionDispatched||fi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Me.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=pi;var m={channel:i,dispatch:ki(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Ji((function(){var e=Po(m,S,l,v,Oi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Lo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?lo():a,l=n.sagaMonitor,s=Xn(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Io.bind(null,T({},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){gi(o,e)},c},Oo=function(e){return{done:!0,value:e}},wo={};function Eo(e){return li(e)?"channel":si(e)?String(e):ti(e)?e.name:String(e)}function Co(e,t,n){var i,o,a,r=t;function l(t,n){if(r===wo)return Oo(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?Oo(t):a}return mi(l,(function(e){return l(null,e)}),n)}function Do(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 Co({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Eo(e)+", "+t.name+")")}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,l={done:!1,value:Ni(e)},s=function(e){return{done:!1,value:Vi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:ji(e)}},u=function(e){return a=e},d=function(e){return r=e};return Co({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("+Eo(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:Ni(e)},l=function(e){return{done:!1,value:xi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Co({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Eo(e)+", "+t.name+")")}function Uo(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:xi.apply(void 0,[n].concat(a))},s={done:!1,value:Wi(t)};return Co({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 Vi.apply(void 0,[Do,e,t].concat(i))}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];return Vi.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 Vi.apply(void 0,[_o,e,t].concat(i))}class Fo{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 Fo.instance||(Fo.instance=new Fo),Fo.instance}static setContext(e){Fo.getInstance().context=e}static setAccessToken(e){Fo.getInstance().accessToken=e}static setUser(e){Fo.getInstance().user=e}static setOnRedirectTo(e){Fo.getInstance().onRedirectTo=e}static setLogout(e,t){Fo.getInstance().logout=n=>{n?e(n):Fo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Fo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Fo.getInstance().accessToken}static getUser(){return Fo.getInstance().user}static onRedirectTo(e,t){return Fo.getInstance().onRedirectTo(e,t)}static logout(e){return Fo.getInstance().logout(e)}}Fo.instance=void 0;const xo={getContext:()=>Fo.getContext(),getAccessToken:()=>Fo.getAccessToken(),getUser:()=>Fo.getUser(),onRedirectTo:(e,t)=>Fo.onRedirectTo(e,t),logout:e=>Fo.logout(e)};class Vo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function jo(e,t){let n;n="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg";return n.endsWith("/")||(n+="/"),n.endsWith(i)||(n+=i),n}const Ko=async e=>{var t,n,i;const o=Fo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Fo.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=jo(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:T({},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 Vo("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 Vo(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{}}},Wo=async(e,t,n)=>Ko(T({url:e,method:"GET",contentType:"application/json",params:t},n)),Go=async(e,t,n)=>Ko(T({url:e,method:"POST",contentType:"application/json",body:t},n)),zo=async(e,t,n)=>Ko(T({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Bo=async(e,t,n)=>Ko(T({url:e,method:"PUT",contentType:"application/json",body:t},n)),qo=async(e,t,n)=>Ko(T({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ho=async(e,t,n,i)=>Ko(T({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Jo={v1:"/identity/resources/users/webauthn/v1/devices"},Yo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Qo={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"}}},Xo={v1:"/identity/resources/configurations/v1"},Zo={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ea={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ta={v1:"/identity/resources/permissions/v1"},na={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"}}},ia={v1:"/identity/resources/roles/v1"},oa={v1:"/identity/resources/sub-tenants/users/v1"},aa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ra={v1:"/team/resources/members/v1"},la={v1:"/team/resources/roles/v1"},sa={v1:"/team/resources/stats/v1"},ca={v1:"/team/resources/profile"},ua={v1:"/tenants/resources/account-settings/v1"},da={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ya={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},fa={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"},ga={v1:"/subscriptions/resources/subscriptions/v1"},Sa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},va={v1:"/reports/engine/resources/triggers/v1"},ha="/notification",ma="/audits",ba={v1:"/event/resources/configurations/v1"},Aa="/webhook",ka="/oauth",Ta="/flags";async function Pa(e){return Bo(`${Qo.v1}/tenant`,e)}async function Ia(){return Wo(`${Qo.v2}/me/tenants`)}async function La(){return Wo(da.v1)}async function Oa(){return Wo(da.tree.v1)}async function wa(){return Wo(Xo.v1)}async function Ea(){return Wo(`${Xo.v1}/mfa-policy`)}async function Ca(){return Wo(`${Xo.v1}/mfa-policy/vendor`)}async function Da(e){return e.id?zo(`${Xo.v1}/mfa-policy`,e):Go(`${Xo.v1}/mfa-policy`,e)}async function Ra(){return Wo(`${Xo.v1}/lockout-policy`)}async function _a(e){return e.id?zo(`${Xo.v1}/lockout-policy`,e):Go(`${Xo.v1}/lockout-policy`,e)}async function Ua(){try{return await Wo(`${Xo.v1}/captcha-policy/public`)}catch{return null}}async function Na(){return Wo(`${Xo.v1}/password-history-policy`)}async function Ma(e){return e.id?zo(`${Xo.v1}/password-history-policy`,e):Go(`${Xo.v1}/password-history-policy`,e)}async function $a(){return Wo(`${Xo.v1}/password`)}async function Fa(){return Wo(`${Zo.emailDomain.v1}`)}async function xa(){return Wo(`${Zo.emailDomain.v1}/config`)}async function Va(e){return Go(`${Zo.emailDomain.v1}`,e)}async function ja(e){return Go(`${Zo.emailDomain.v1}/config`,e)}async function Ka(e){return qo(`${Zo.emailDomain.v1}/${e}`)}async function Wa(e){return Wo(`${Zo.ip.v1}`,e)}async function Ga(){return Wo(`${Zo.ip.v1}/config`)}async function za(e){return Go(`${Zo.ip.v1}`,e)}async function Ba(e){return Go(`${Zo.ip.v1}/bulk`,e)}async function qa(e){return Go(`${Zo.ip.v1}/config`,e)}async function Ha(e){return qo(`${Zo.ip.v1}/${e}`)}async function Ja(){return Go(`${Zo.ip.v1}/verify`)}async function Ya(){return Go(`${Zo.ip.v1}/verify/allow`)}let Qa,Xa;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack"}(Qa||(Qa={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Xa||(Xa={}));class Za extends Error{constructor(e){super(e)}}const er="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Za("'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 tr extends Error{constructor(e){super(e)}}const nr=(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(er(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 er(t)}})(e.split(".")[n]))}catch(e){throw new tr("Invalid token specified: "+e.message)}},ir=["type"],or=["type"];async function ar(e){if(!e.accessToken)return e;Fo.setAccessToken(e.accessToken);const t=await Wo(`${Qo.v2}/me`),n=T({},e,e.accessToken?nr(e.accessToken):{},t);return Fo.setUser(n),n}async function rr(e){if(!e.accessToken)return{user:e};Fo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Wo(`${Qo.v2}/me`),Ia()]),i=T({},e,e.accessToken?nr(e.accessToken):{},t);return Fo.setUser(i),{user:i,tenants:n}}async function lr(e){Fo.setAccessToken(e.id_token);const t=await Wo(`${Qo.v2}/me`),n=e.id_token?nr(e.id_token):{},i=T({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 Fo.setUser(i),i}async function sr(e){try{const{address:t}=await Go(`${Yo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function cr(e){return Go(`${Yo.v1}/user/saml/prelogin`,e)}async function ur(e){return ar(await Go(`${Yo.v1}/user/saml/postlogin`,e))}async function dr(e){return ar(await Go(`${Yo.v1}/user/oidc/postlogin`,e))}async function yr(e){return ar(await Go(`${Yo.v1}/user`,e))}async function fr(e){return ar(await Go(`${Yo.v1}/user/mfa/verify`,e))}async function pr(e){return Go(`${Qo.v1}/activate`,e)}async function gr(e){return Wo(`${Qo.v1}/activate/strategy`,e)}async function Sr(e){return Go(`${Qo.v1}/activate/reset`,e)}async function vr(e){return Go(`${Qo.v1}/invitation/reset`,e)}async function hr(e){return Go(`${Qo.v1}/invitation/accept`,e)}async function mr(){return ar(await Go(`${Yo.v1}/user/token/refresh`))}async function br(){return rr(await Go(`${Yo.v1}/user/token/refresh`))}async function Ar(){return Go(`${Yo.v1}/logout`)}async function kr(e){return Go(`${Qo.v1}/passwords/reset`,e)}async function Tr(e){return Go(`${Qo.v1}/passwords/reset/verify`,e)}async function Pr(e){return Wo(`${Qo.v1}/passwords/config`,e)}async function Ir(e){return Go(`${Yo.v1}/user/mfa/recover`,e)}async function Lr(){return Go(`${Qo.v1}/mfa/enroll`)}async function Or(e){return Go(`${Qo.v1}/mfa/enroll/verify`,e)}async function wr(e){return Go(`${Qo.v1}/mfa/disable`,e)}async function Er(e,t){return Go(`${Qo.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Cr(e){return Go(`${Qo.v1}/mfa/sms/${e}/disable`)}async function Dr(e,t){return Go(`${Qo.v1}/mfa/sms/${e}/disable/verify`,t)}async function Rr(e){return Go(`${Qo.v1}/mfa/webauthn/${e}/disable`)}async function _r(e,t){return Go(`${Qo.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ur(){return Wo(`${Qo.v1}/mfa/devices`)}async function Nr(e){return Go(`${Yo.v1}/user/mfa/authenticator/enroll`,e)}async function Mr(e){return Go(`${Yo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function $r(e,t){return Go(`${Yo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Fr(e){return Go(`${Yo.v1}/user/mfa/sms/enroll`,e)}async function xr(e){return Go(`${Yo.v1}/user/mfa/sms/enroll/verify`,e)}async function Vr(e,t){return Go(`${Yo.v1}/user/mfa/sms/${e}`,t)}async function jr(e,t){return Go(`${Yo.v1}/user/mfa/sms/${e}/verify`,t)}async function Kr(e){return Go(`${Yo.v1}/user/mfa/webauthn/enroll`,e)}async function Wr(e){return Go(`${Yo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Gr(e,t){return Go(`${Yo.v1}/user/mfa/webauthn/${e}`,t)}async function zr(e,t){return Go(`${Yo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Br(){return Wo(`${aa.v1}/saml/configurations`)}async function qr(e){return Go(`${aa.v1}/saml/configurations`,e)}async function Hr(){return Wo(`${aa.v1}/saml/configurations/vendor-config`)}async function Jr(e){return Bo(`${aa.v1}/saml/configurations/metadata`,e)}async function Yr(){return Bo(`${aa.v1}/saml/validations/domain`)}async function Qr(){return Wo(`${aa.v1}/saml/configurations/roles/default`)}async function Xr(){return Wo(`${aa.v2}/saml/configurations/groups`)}async function Zr({roleIds:e}){return Go(`${aa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function el({roleIds:e,group:t}){return Go(`${aa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function tl({roleIds:e,group:t,id:n}){return zo(`${aa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function nl({id:e}){return qo(`${aa.v2}/saml/configurations/groups/${e}`)}async function il(){return Wo(`${aa.v1}/oidc/configurations`)}async function ol(){return Wo(`${aa.v2}/configurations/public`)}async function al(){return Wo(ea.v1)}async function rl(){return Wo(ea.v2)}async function ll({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),Go(`${Yo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:a},{params:l})}async function sl(){return Wo(`${Xo.v1}/public`)}async function cl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Go(`${Qo.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await ar(n):void 0,userId:i,tenantId:o}}async function ul(){return Wo(Qo.sessions.currentUser.v1)}async function dl(){return Wo(`${Qo.sessions.currentUser.v1}/current`)}async function yl(e){return Go(`${Qo.sessions.v1}/revoke`,{userId:e})}async function fl(){return Wo(Qo.sessions.configurations.v1)}async function pl(e){await Go(Qo.sessions.configurations.v1,e)}async function gl(e){await qo(`${Qo.sessions.currentUser.v1}/${e}`)}async function Sl(){await qo(`${Qo.sessions.currentUser.v1}/all`)}async function vl(){return Wo(Qo.apiTokens.v1)}async function hl(){return Wo(na.apiTokens.v1)}async function ml(e){return Go(Qo.apiTokens.v1,e)}async function bl(e){return Go(na.apiTokens.v2,e)}async function Al({tokenId:e}){return qo(`${na.apiTokens.v1}/${e}`)}async function kl({tokenId:e}){return qo(`${Qo.apiTokens.v1}/${e}`)}async function Tl({userId:e}){return Wo(`${Qo.v1}/${e}`)}async function Pl(e){return Wo(`${Xo.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Il(e){let{type:t}=e,n=Xn(e,ir);return Go(`${Yo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Ll(e){let{type:t}=e,n=Xn(e,or);return Go(`${Yo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ol({token:e}){return Go(na.invites.verify.v1,{token:e})}async function wl(){return Wo(`${aa.v1}/configurations`)}async function El(e){return Go(`${aa.v1}/configurations`,e)}async function Cl(e,t){return zo(`${aa.v1}/configurations/${e}`,t)}async function Dl(e){return qo(`${aa.v1}/configurations/${e}`)}async function Rl(e){return Go(`${aa.v1}/configurations/metadata`,e)}async function _l(e,t){return Bo(`${aa.v1}/configurations/${e}/metadata`,t)}async function Ul(e,t){return Go(`${aa.v1}/configurations/${e}/domains`,t)}async function Nl(e,t){return qo(`${aa.v1}/configurations/${e}/domains/${t}`)}async function Ml(e,t){return Bo(`${aa.v1}/configurations/${e}/domains/${t}/validate`)}async function $l(e){return Wo(`${aa.v1}/configurations/${e}/roles`)}async function Fl(e,t){return Bo(`${aa.v1}/configurations/${e}/roles`,t)}async function xl(e,t){return Go(`${aa.v1}/configurations/${e}/groups`,t)}async function Vl(e,{roleIds:t,group:n,id:i}){return zo(`${aa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function jl(e,t){return qo(`${aa.v1}/configurations/${e}/groups/${t}`)}async function Kl(e){return Wo(`${aa.v1}/configurations/${e}/groups`)}async function Wl(e){return Go(`${Yo.v2}/user/sso/prelogin`,e)}async function Gl(e){return ar(await Go(`${Yo.v2}/user/oidc/postlogin`,e))}async function zl(e){return lr(await Go(`${ka}/token`,e))}async function Bl(){return lr(await Go(`${ka}/authorize/silent`))}async function ql(e){return Go(`${Qo.v1}/phone/reset`,e)}async function Hl(e){return Go(`${Qo.v1}/phone/reset/verify`,e)}async function Jl(e){return Go(`${Qo.v1}/phone`,e)}async function Yl(e){return Go(`${Qo.v1}/phone/verify`,e)}async function Ql(e){return Bo(`${Qo.v1}/phone/change`,e)}async function Xl(e){return Go(`${Yo.v1}/webauthn/prelogin`,e)}async function Zl(e){return Go(`${Yo.v1}/webauthn/postlogin`,e)}async function es(){return Go(Jo.v1)}async function ts(e){return Go(`${Jo.v1}/verify`,e)}async function ns(){return Wo(`${Xo.v1}/auth/strategies/public`)}async function is(e){return Wo(`${Qo.v2}/me`,null!=e?e:{addRoles:!0})}async function os(e){return Bo(`${Qo.v2}/me`,e)}async function as(e){return Bo(`${ca.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function rs(e){return Go(`${Qo.v1}/passwords/change`,e)}async function ls(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>T({},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 Wo(ra.v1,T({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function ss(e){return Go(Qo.v2,T({},e,{provider:"local"}))}async function cs(e){return qo(`${ra.v1}/${e.userId}`)}async function us(e){return Bo(ra.v1,e)}async function ds(e){return Go(na.invites.user.v1,T({},e))}async function ys(e){return zo(na.invites.user.v1,T({},e))}async function fs(){return qo(na.invites.user.v1)}async function ps(){return Wo(na.invites.user.v1)}async function gs(){return Wo(na.invites.configuration.v1)}async function Ss(){return Wo(la.v1)}async function vs(){return Wo(ta.v1)}async function hs(){return Wo(`${sa.v1}/members`)}async function ms(e){return Go(`${ra.v1}/${e.userId}/resendActivationEmail`,{})}async function bs(e){return Go(Qo.v2,T({},e,{provider:"local"}))}async function As(e){return Go(Qo.invitation.resendAll.v1,T({},e))}async function ks(e){var t,n;const i=await Wo("/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 Ts(){const e=await Wo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Ps=async()=>ks({entityName:"notifications"}),Is=async()=>ks({entityName:"saml"}),Ls=async()=>ks({entityName:"audits"}),Os=async e=>async function(e){const t=await Wo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),ws=["dataFilters"],Es=["templateId","dataFilters"],Cs=["dataFilters"];async function Ds(e){return Wo(`${Sa.v2}/tenant-reports`,e)}async function Rs(e){return Wo(`${Sa.v2}/${e.id}/tenant-reports`)}async function _s(e){let{dataFilters:t}=e,n=Xn(e,ws);return{html:await Wo(`${va.v1}/preview-report`,T({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Us(e){let{templateId:t,dataFilters:n}=e,i=Xn(e,Es);return Go(`${Sa.v2}/${t}/tenant-reports`,T({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Ns(e){let{dataFilters:t}=e,n=Xn(e,Cs);const i=await Wo(`${va.v1}/preview-report`,T({},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 Ms(e){return Go(`${va.v1}/tenant-reports`,e)}async function $s(e){return Wo(ha,{params:e})}async function Fs(e){return Bo(`${ha}/status`,{params:e})}async function xs(e){const{notificationId:t,pinStatus:n}=e;return Bo(`${ha}/${n}`,{notificationId:t})}async function Vs(){return Go(`${ha}/status/mark-all-read`)}const js=["endpoint","headerProps"];async function Ks(e){return Wo(ma,e)}async function Ws(e){return Wo(`${ma}/stats`,e)}async function Gs(e){const{endpoint:t,headerProps:n}=e,i=Xn(e,js);return Ho(`${ma}/export/${t}`,{properties:n},i)}const zs=["eventKey"],Bs=["eventKey"],qs=()=>Wo(`${ya.v1}/slack`),Hs=()=>Wo(`${ya.v1}/slack/applications`),Js=()=>Wo(`${ya.v1}/slack/channels`),Ys=e=>e.id?zo(`${ya.v1}/slack/subscription/${e.id}`,e):Go(`${ya.v1}/slack/subscriptions`,e),Qs=e=>qo(`${ya.v1}/slack/subscriptions/${e.id}`),Xs=e=>Go(`${ya.v1}/slack/applications/registrations`,{code:e}),Zs=()=>Wo(`${ya.v1}/emails`),ec=e=>{let{eventKey:t}=e,n=Xn(e,zs);return Go(`${ya.v1}/emails/${t}`,n)},tc=({eventKey:e,enabled:t})=>zo(`${ya.v1}/emails/${e}`,{enabled:t}),nc=(e,t)=>qo(`${ya.v1}/emails/${e}/subscriptions/${t}`),ic=(e,t,n)=>Bo(`${ya.v1}/emails/${t}/subscriptions/${e}`,n),oc=e=>qo(`${ya.v1}/emails/${e}`),ac=()=>Wo(`${ya.v2}/sms`),rc=e=>{let{eventKey:t}=e,n=Xn(e,Bs);return Go(`${ya.v2}/sms/${t}`,n)},lc=({eventKey:e,enabled:t})=>zo(`${ya.v2}/sms/${e}`,{enabled:t}),sc=(e,t)=>qo(`${ya.v2}/sms/${e}/subscriptions/${t}`),cc=(e,t,n)=>Bo(`${ya.v2}/sms/${t}/subscriptions/${e}`,n),uc=e=>qo(`${ya.v2}/sms/${e}`),dc=()=>Wo(Aa),yc=e=>e._id?zo(`${Aa}/${e._id}`,e):Go(`${Aa}/custom`,e),fc=e=>qo(`${Aa}/${e}`),pc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Wo(`${Aa}/logs/?${i.toString()}`)},gc=e=>Go(`${Aa}/test`,e),Sc=e=>Go(`${Aa}/logs/${e}/retries`),vc=()=>Wo(`${ba.v1}/categories`),hc=e=>Wo(ba.v1,{channels:e});async function mc(e){return Bo(ua.v1,e)}async function bc(){return Wo(ua.v1)}const Ac=["roleId"],kc=["roleId"],Tc=["permissionId"];async function Pc(){return Wo(ia.v1)}async function Ic(e){return Go(ia.v1,e)}async function Lc({roleId:e}){return qo(`${ia.v1}/${e}`)}async function Oc(e){let{roleId:t}=e,n=Xn(e,Ac);return zo(`${ia.v1}/${t}`,n)}async function wc(e){let{roleId:t}=e,n=Xn(e,kc);return Bo(`${ia.v1}/${t}/permissions`,n)}async function Ec(){return Wo(ta.v1)}async function Cc(e){let{permissionId:t}=e,n=Xn(e,Tc);return Bo(`${ta.v1}/${t}/roles`,n)}async function Dc(){return Wo(`${ta.v1}/categories`)}async function Rc(){return Wo(fa.subscriptions.v1)}async function _c(e){return Wo(`${fa.subscriptions.v1}/${e}`)}async function Uc(e){return Bo(`${fa.subscriptions.v1}/${e}/cancellations/`,{})}async function Nc(e){return Bo(`${fa.subscriptions.v1}/${e}/renewals/`,{})}async function Mc(e,{paymentMethodId:t,planId:n}){return Bo(`${fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function $c(e){return Wo(`${ga.v1}/${e}`)}async function Fc(){return Wo(`${ga.v1}`)}async function xc(e){return Bo(`${ga.v1}/${e}/cancellations/`,{})}async function Vc(e){return Bo(`${ga.v1}/${e}/renewals/`,{})}async function jc(e,{paymentMethodId:t,planId:n}){return Bo(`${ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Kc(){return Wo(fa.plans.v1)}async function Wc(e){return Wo(`${fa.plans.v1}/${e}`)}async function Gc(){return Wo(fa.invoices.v1)}async function zc(e){return Wo(`${fa.invoices.v1}/${e}`)}async function Bc(e,t){return Wo(`${fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const qc=["email"];async function Hc(){return Wo(fa.paymentMethods.v1)}async function Jc(e){return Wo(`${fa.paymentMethods.v1}/${e}`)}async function Yc(e,t){let{email:n}=t,i=Xn(t,qc);return zo(`${fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Qc(e){return Go(fa.paymentProviders.stripe.subscriptions.v1,e)}async function Xc(e){return Wo(`${fa.paymentProviders.stripe.customers.v1}/${e}`)}async function Zc(e){return Go(`${fa.paymentProviders.stripe.customers.v1}`,e)}async function eu(){return Wo(`${fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function tu(e){return Go(`${fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function nu(e){return Wo(`${fa.summaries.v1}/${e}`)}async function iu(e){return Wo(`${fa.tenantConfiguration.v1}/${e}`)}async function ou(e){return Go(`${fa.tenantConfiguration.v1}`,e)}async function au(){return Wo(pa.v1)}async function ru(){return Wo(`${fa.configurations.vendorPublicConfigurations.v1}`)}let lu,su,cu,uu,du,yu,fu,pu,gu,Su;async function vu(){return Wo("/vendors/public")}async function hu(e){return Wo(oa.v1,e)}async function mu(e){return Go(oa.v1,e)}async function bu(e){return qo(oa.v1,e)}async function Au(e,t){return Go(`${oa.v1}/${e}/roles`,t)}async function ku(e,t){return qo(`${oa.v1}/${e}/roles`,t)}async function Tu(e,t){return zo(`${oa.v1}/${e}/roles`,t)}async function Pu(){return Wo(Ta)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(lu||(lu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(su||(su={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(cu||(cu={})),(uu||(uu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(du||(du={})),function(e){e.CREATE="create_customer"}(yu||(yu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(fu||(fu={})),function(e){e.Android="Android",e.USBKey="USBKey",e.TouchID="TouchID"}(pu||(pu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthn="WebAuthn",e.SMS="SMS"}(gu||(gu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Su||(Su={}));const Iu=[`${Yo.v1}/logout`,`${Yo.v1}/user/saml/postlogin`,`${Yo.v2}/user/oidc/postlogin`,`${Yo.v1}/user`,`${Yo.v1}/user/mfa/verify`,`${Yo.v1}/user/token/refresh`,`${Qo.v1}`,`${Qo.v1}/signUp`,`${Yo.v1}/passwordless/magiclink/postlogin`,`${Yo.v1}/passwordless/code/postlogin`,`${Yo.v1}/passwordless/smscode/postlogin`,`${Qo.v1}/activate`,`${Qo.v1}/invitation/accept`,`${ka}/token`,`${ka}/authorize/silent`],Lu=`${Yo.v1}/user/token/refresh`,Ou=`${ka}/authorize/silent`,wu={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S};var Eu={fetch:e,ContextHolder:Fo,FronteggContext:xo,api:wu,FronteggApiError:Vo,AuthStrategyEnum:Xa,SocialLoginProviders:Qa,ISubscriptionCancellationPolicy:cu,ISubscriptionStatus:lu,PaymentMethodType:su,ProviderType:uu};let Cu,Du;function Ru(e,t){const n=T({},e);return t.forEach((e=>{delete n[e]})),n}async function _u(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 Uu(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"}(Cu||(Cu={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Du||(Du={}));const Nu=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Mu={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},$u=T({},Mu,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Fu={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},xu=T({},Fu,{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}),Vu={loading:!1,error:void 0,saving:!0,profile:Fu},ju={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"},Ku={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Xa.EmailAndPassword},Wu={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Gu={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},zu={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Bu={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},qu={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Hu=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ju={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Bu,roles:Hu,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Yu=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Qu={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:[]},Xu={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:[]},Zu={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},ed=[Xu,Qu],td=[Zu],nd=[{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"}],od={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},ad={isActive:!0,strategy:Dn.ALLOW},rd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Dn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Dn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Dn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Dn.BLOCK,description:"IP 4"}];let ld,sd,cd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(ld||(ld={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(sd||(sd={})),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"}(cd||(cd={})),cd.profile,cd.privacy,cd.personalApiTokens,cd.account,cd.users,cd.security,cd.sso,cd.audits,cd.webhooks,cd.apiTokens,cd.roles,cd.subscriptions;const ud=["events","url"];function*dd(){yield Mi(xn.setSignUpState({loading:!0}));try{const e=yield xi(wu.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield Mi(xn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield Mi(xn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*yd(e){let{payload:{events:t,url:n}}=e,i=Xn(e.payload,ud);yield Mi(xn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Ki((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield xi(wu.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:sd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Fo.setAccessToken(null==l?void 0:l.accessToken),Fo.setUser(l),!r&&l&&by(l)){const t=yield Ty(l);yield Mi(xn.setState(t)),a(e.loginUrl)}else yield Mi(xn.setSignUpState({loading:!1,shouldActivate:r,stage:rn.SignUpSuccess})),yield Mi(xn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield Mi(xn.loadTenants()))}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setSignUpState({loading:!1,error:e.message}))}yield Mi(xn.setSignUpState({loading:!1}))}function*fd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ki((e=>e.auth.signUpState));yield Mi(xn.resetSignUpState()),yield Mi(xn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*pd(){yield $o(xn.signUpUser,yd),yield $o(xn.resetSignUpStateSoft,fd)}const gd={setVendorState:(e,{payload:t})=>T({},e,t)},Sd={loadVendorPublicInfo:tt("vendor/loadVendorPublicInfo")},vd={loading:!1},{reducer:hd,actions:md}=it({name:Tt,initialState:vd,reducers:T({},gd)}),bd=T({},md,Sd);function*Ad(){yield Mi(bd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield wu.vendor.getVendorPublicInfo();yield Mi(bd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Mi(bd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const kd=["callback"],Td=["callback"],Pd=["callback"],Id=["callback"],Ld=["callback"],Od=["callback"];function*wd(){yield Mi(xn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getGlobalSecurityPolicy);yield Mi(xn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Mi(xn.loadSecurityPolicyMfa()),yield Mi(xn.loadSecurityPolicyVendorMfa()),yield Mi(xn.loadSecurityPolicyLockout()),yield Mi(xn.loadSecurityPolicyCaptcha()),yield Mi(xn.loadPublicAuthStrategiesPolicy())}function*Ed(){yield Mi(xn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getVendorConfig);yield Mi(xn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Cd(){yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getVendorPublicAuthStrategiesConfig);yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Dd(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getMfaPolicy);yield Mi(xn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Rd(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getVendorMfaPolicy);yield Mi(xn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*_d(e){let{payload:{callback:t}}=e,n=Xn(e.payload,kd);yield Mi(xn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield xi(wu.auth.saveMfaPolicy,n);yield Mi(xn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ud(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getLockoutPolicy);yield Mi(xn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Nd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Td);yield Mi(xn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield xi(wu.auth.saveLockoutPolicy,n);yield Mi(xn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Md(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getCaptchaPolicy);yield Mi(xn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*$d(){yield Mi(xn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getPasswordHistoryPolicy);yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Fd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Pd);yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield xi(wu.auth.savePasswordHistoryPolicy,n);yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xd(){yield Mi(xn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getPasswordConfigPolicy);yield Mi(xn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Vd(){yield $o(xn.loadSecurityPolicy,wd),yield No(xn.saveSecurityPolicyMfa,_d),yield No(xn.loadSecurityPolicyMfa,Dd),yield No(xn.loadSecurityPolicyVendorMfa,Rd),yield No(xn.saveSecurityPolicyLockout,Nd),yield No(xn.loadSecurityPolicyLockout,Ud),yield No(xn.loadSecurityPolicyCaptcha,Md),yield No(xn.saveSecurityPolicyPasswordHistory,Fd),yield No(xn.loadSecurityPolicyPasswordHistory,$d),yield No(xn.loadVendorPasswordConfig,xd),yield No(xn.loadPublicSecurityPolicy,Ed),yield No(xn.loadPublicAuthStrategiesPolicy,Cd)}function*jd(){yield Mi(xn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Mi(xn.setSecurityPolicyPublicState({policy:Ku,loading:!1}))}catch(e){yield Mi(xn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Kd(){yield Mi(xn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyGlobalState({policy:ju,loading:!1})),yield Mi(xn.loadSecurityPolicyMfa()),yield Mi(xn.loadSecurityPolicyVendorMfa()),yield Mi(xn.loadSecurityPolicyLockout()),yield Mi(xn.loadSecurityPolicyCaptcha())}function*Wd(){yield Mi(xn.setSecurityPolicyMfaState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyMfaState({policy:Wu,loading:!1}))}function*Gd(){yield Mi(xn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyVendorMfaState({policy:Wu,loading:!1}))}function*zd(e){var t;let{payload:{callback:n}}=e,i=Xn(e.payload,Id);yield Mi(xn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=T({},Gu,{id:null!=(t=i.id)?t:Gu.id,enforceMFAType:i.enforceMFAType});yield ut(),yield Mi(xn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Bd(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyLockoutState({policy:Gu,loading:!1}))}function*qd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Ld);yield Mi(xn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield ut();const i=T({},n,Gu,{id:n.id?n.id:Gu.id});null==t||t(i),yield Mi(xn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Hd(){yield Mi(xn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyLockoutState({policy:Gu,loading:!1}))}function*Jd(){yield Mi(xn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield ut(),yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:zu,loading:!1}))}function*Yd(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Od);yield Mi(xn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield ut();const i=T({},n,zu,{id:n.id?n.id:zu.id});null==t||t(i),yield Mi(xn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Qd(){yield $o(xn.loadSecurityPolicy,Kd),yield No(xn.loadPublicSecurityPolicy,jd),yield No(xn.saveSecurityPolicyMfa,zd),yield No(xn.loadSecurityPolicyMfa,Wd),yield No(xn.loadSecurityPolicyVendorMfa,Gd),yield No(xn.saveSecurityPolicyLockout,qd),yield No(xn.loadSecurityPolicyLockout,Bd),yield No(xn.loadSecurityPolicyCaptcha,Hd),yield No(xn.saveSecurityPolicyPasswordHistory,Yd),yield No(xn.loadSecurityPolicyPasswordHistory,Jd)}const Xd=["callback"],Zd=["callback"],ey=["callback"],ty=["callback"],ny=["callback","events"],iy=["callback"],oy=["callback"],ay=["callback"],ry=["callback"],ly=["callback"],sy=["callback"],cy=["callback"],uy=["callback"],dy=["callback"],yy=["callback","deviceId"],fy=["callback","deviceId"],py=["callback","deviceId"],gy=["callback","deviceId"],Sy={[Xa.Code]:gt.loginWithOtc,[Xa.EmailAndPassword]:gt.loginWithPassword,[Xa.MagicLink]:gt.magicLinkPreLoginSuccess,[Xa.SmsCode]:gt.loginWithSmsOtc};function*vy(){var e;const t=Fo.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(ht);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(ht),yield Wi(200),Mi(xn.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*hy(){let e;try{var t;const n=yield xi(wu.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Mi(xn.setState({ssoACS:e}))}function*my(){try{const{isActive:e}=yield xi(wu.auth.getSSOPublicConfiguration);yield Mi(xn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const by=e=>e.mfaRequired&&e.mfaToken?(Fo.setAccessToken(null),Fo.setUser(null),!0):(Fo.setAccessToken(e.accessToken),Fo.setUser(e),!1),Ay=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=e.webauthn.length,n=e.phones.length,i=e.authenticators.length;return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Jt.authenticatorApp;if(t)return Jt.smsVerifyCode}return Jt.verify},ky=e=>{if(1===e.length){const[t]=e;return t===gu.AuthenticatorApp?Jt.authenticatorApp:t===gu.SMS?Jt.smsSetPhoneNumber:Jt.verify}};function*Ty(e){let t=gt.loginWithTwoFactor,n={};const{loginState:i}=yield Ki((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield xi(wu.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Ay(e.mfaDevices)}:(n={step:ky(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=gt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:St.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:T({},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*Py(){const{hostedLoginBox:e}=yield Ki((e=>e.auth));e?yield xi(Iy):yield xi(Ly)}function*Iy(){const{user:e}=yield Ki((e=>e.auth));if(null==e||!e.refreshToken)return Fo.setAccessToken(null),Fo.setUser(null),void(yield Mi(xn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield xi(wu.auth.exchangeOAuthTokens,t);yield Mi(xn.setState({user:n,isAuthenticated:!0})),yield Mi(xn.loadTenants())}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:null,isAuthenticated:!1}))}}function*Ly(){try{const n=Fo.onRedirectTo,{routes:i,loginState:o}=yield Ki((e=>e.auth)),{user:a,tenants:r}=yield xi(wu.auth.refreshTokenV2);if(by(a)){const e=yield Ty(a);yield Mi(xn.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 Mi(xn.setTenantsState({tenants:r,loading:!1})),yield Mi(xn.setState({user:a,isAuthenticated:!0,loginState:T({},o,{quickLoginToRegister:l,flow:s?St.RegisterQuickLogin:St.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 vy())}}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}}function*Oy({payload:{callback:e}}){try{const{ip:t}=yield xi(wu.metadata.getCurrentUserIpMetadata);yield Mi(xn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*wy({payload:e}){const t=[];e&&(yield Mi(xn.setState({isLoading:!0})),yield Mi(xn.loadSocialLoginsConfigurationV2()),t.push(xi(dd)),t.push(xi(Cd)),t.push(xi(my)),t.push(xi(Ad)),t.push(xi(hy))),t.push(xi(Py)),yield $i(t),yield Mi(xn.setState({isLoading:!1}))}function*Ey({accessToken:e,refreshToken:t}){if(!e)return Fo.setAccessToken(null),Fo.setUser(null),void(yield Mi(xn.setState({user:void 0,isAuthenticated:!1})));try{const n=Fo.onRedirectTo,{routes:i}=yield Ki((e=>e.auth)),{user:o,tenants:a}=yield xi(wu.auth.generateLoginResponseV2,{accessToken:e});if(by(o)){const e=yield Ty(o);yield Mi(xn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}else yield Mi(xn.setTenantsState({tenants:a,loading:!1})),yield Mi(xn.setState({user:T({},o,{refreshToken:t}),isAuthenticated:!0}))}catch(e){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}}function*Cy({payload:e}){const t=[];yield Mi(xn.setState({isLoading:!0})),yield Mi(xn.loadSocialLoginsConfigurationV2()),t.push(xi(dd)),t.push(xi(my)),t.push(xi(Ad)),t.push(xi(hy)),t.push(xi(Ey,e)),yield $i(t),yield Mi(xn.setState({isLoading:!1}))}function*Dy({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 xi(wu.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.loadTenants()),yield Mi(xn.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 Mi(xn.setState({isLoading:!0}));const a=Uu(),r=Uu(),l=yield xi(_u,r);localStorage.setItem(mt,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${jo(n,"/oauth/authorize")}/oauth/authorize`,u=T({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*Ry({payload:e}){const t=localStorage.getItem(mt)||"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 xi(wu.auth.exchangeOAuthTokens,a);yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield vy()}}function*_y(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Xd);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(wu.auth.changePhoneNumberWithVerification,n);yield Mi(xn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:gt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*Uy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Zd);try{yield Mi(xn.setLoginState({loading:!0})),yield xi(wu.auth.verifyChangePhoneNumber,n),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*Ny(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ey);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(wu.auth.passwordlessPreLogin,T({},n,{type:Xa.SmsCode}));yield Mi(xn.setLoginState({step:gt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*My(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ty);try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mi(xn.setLoginState({loading:!0}));const o=yield xi(wu.auth.passwordlessPreLogin,n),a=Sy[n.type];if(a===gt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield Mi(xn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:xt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield Mi(xn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*$y(e){let{payload:{callback:t,events:n}}=e,i=Xn(e.payload,ny);try{yield Mi(xn.setLoginState({loading:!0}));const e=yield xi(wu.auth.passwordlessPostLogin,i),a=Fo.onRedirectTo,{routes:r}=yield Ki((e=>e.auth));if(by(e)){const t=yield Ty(e);yield Mi(xn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ki((e=>e.auth)),l=yield xi(wu.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:ld.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield Mi(xn.setState({user:l,isAuthenticated:!0})),yield Mi(xn.setLoginState({error:void 0})),yield Mi(xn.loadTenants()),i.flow===St.Login?yield vy():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield Mi(xn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Fy({payload:e}){try{yield Mi(xn.setLoginState({loading:!0}));const{name:t}=yield xi(wu.auth.verifyInviteToken,e);yield Mi(xn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield Mi(xn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*xy({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Mi(xn.setLoginState({loading:!0}));try{const o=yield Ki((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield xi(wu.auth.preLoginV2,{email:e});if(a){if(r===Du.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ki((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield Mi(xn.setLoginState({step:gt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield Vy({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Vy({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Vy(e){let{callback:t}=e,n=Xn(e,iy);const i=yield Ki((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Xa.EmailAndPassword?(yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),null==t||t()):[Xa.MagicLink,Xa.Code,Xa.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Mi(xn.passwordlessPreLogin(T({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Mi(xn.setLoginState({step:gt.loginWithPassword,loading:!1})),null==t||t())}function*jy({payload:{callback:e}}){try{yield Mi(xn.setLoginState({loading:!0}));const{options:t}=yield xi(wu.auth.webAuthnCreateNewDeviceSession);t.user.id=ft(t.user.id),t.challenge=ft(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Mi(xn.setLoginState({error:t.message})),null==e||e(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Ky(e){let{payload:{callback:t}}=e,n=Xn(e.payload,oy);try{yield Mi(xn.setLoginState({loading:!0}));const e=pt(n.publicKey);yield xi(wu.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Wy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ay);try{var i;yield Mi(xn.setLoginState({loading:!0}));const{options:e}=yield xi(wu.auth.webAuthnPreLogin,n);e.challenge=ft(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>T({},e,{id:ft(e.id)}))),yield Mi(xn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*Gy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ry);try{var i;yield Mi(xn.setLoginState({loading:!0}));const e=pt(n.publicKey),o=yield xi(wu.auth.webAuthnPostLogin,T({},e,{response:T({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(by(o)){const e=Fo.onRedirectTo,{routes:t}=yield Ki((e=>e.auth)),n=yield Ty(o);yield Mi(xn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield xi(wu.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield Mi(xn.loadTenants()),yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Mi(xn.setLoginState({error:void 0})),yield vy(),null==t||t(!0)}}catch(e){yield Mi(xn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Mi(xn.setLoginState({loading:!1}))}}function*zy({payload:e}){const{onRedirectTo:t,routes:n}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Mi(xn.setLoginState({loading:!0}));try{const t=yield xi(wu.auth.postLogin,e);Fo.setAccessToken(t.accessToken),Fo.setUser(t),yield Mi(xn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield vy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Mi(xn.setLoginState({step:gt.loginWithSSOFailed,loading:!1}))}}function*By({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Mi(xn.setLoginState({loading:!0}));try{const a=yield xi(wu.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Fo.setAccessToken(a.accessToken),Fo.setUser(a);const r=Fo.onRedirectTo,{routes:l}=yield Ki((e=>e.auth));if(by(a)){const e=yield Ty(a);yield Mi(xn.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 Mi(xn.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===St.Login?gt.success:t.step,tenants:[],tenantsLoading:!0}})),yield Mi(xn.loadTenants()),n&&t.flow===St.Login&&(yield vy())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Fo.setAccessToken(null),Fo.setUser(null),yield Mi(xn.setLoginState({email:e,error:t.message,loading:!1}))}}function*qy({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Mi(xn.setLoginState({loading:!0}));try{const o=yield xi(wu.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Ki((e=>e.auth)),r=a.flow===St.Login?gt.success:a.step;yield Mi(xn.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 Mi(xn.loadTenants()),yield Mi(xn.setLoginState({error:void 0,loading:!1})),a.flow===St.Login&&(yield vy()),null==i||i(!0)}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Hy({payload:e}){yield Mi(xn.setLoginState({loading:!0}));try{yield xi(wu.auth.recoverMfaToken,e),yield Mi(xn.setLoginState({loading:!1,error:void 0,step:gt.preLogin})),yield Mi(xn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield Mi(xn.setLoginState({error:e.message,loading:!1}))}}function*Jy({payload:e}){yield Mi(xn.setState({isLoading:!0}));try{yield xi(wu.auth.logout)}catch{}yield Mi(xn.resetState()),yield Mi(xn.requestAuthorize(!0)),null==e||e()}function*Yy({payload:e}){var t;try{yield xi(wu.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*Qy({user:e,tenants:t}){const n={step:Jt.recoveryCode,loading:!1,error:void 0};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield Mi(xn.setMfaState(n)),yield Mi(xn.setUser(e)),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Xy({user:e,tenants:t}){const{loginState:n}=yield Ki((e=>e.auth));yield Mi(xn.setUser(e)),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===St.Login&&(yield vy()),yield Mi(xn.setState({isAuthenticated:!0}))}function*Zy(e){let{payload:{callback:t}}=e,n=Xn(e.payload,ly);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(wu.auth.preEnrollMFASMSForLogin,n);yield Mi(xn.setMfaState({otcToken:e.otcToken,step:Jt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*ef(e){let{payload:{callback:t}}=e,n=Xn(e.payload,sy);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(wu.auth.enrollMFASMSForLogin,n),i=yield xi(wu.auth.generateLoginResponseV2,e);yield Qy(i),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*tf(e){let{payload:{callback:t}}=e,n=Xn(e.payload,cy);yield Mi(xn.setLoginState({loading:!0}));try{var i;const e=yield xi(wu.auth.preEnrollMFAWebAuthnForLogin,n),o=T({},e.options,{challenge:ft(e.options.challenge),user:T({},e.options.user,{id:ft(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>T({},e,{id:ft(e.id)})))});yield Mi(xn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*nf(e){let{payload:{callback:t}}=e,n=Xn(e.payload,uy);yield Mi(xn.setLoginState({loading:!0}));try{const e=pt(n.publicKey),i=yield xi(wu.auth.enrollMFAWebAuthnForLogin,T({},n,{options:e})),o=yield xi(wu.auth.generateLoginResponseV2,i);yield Qy(o),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*of(e){let{payload:{callback:t}}=e,n=Xn(e.payload,dy);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(wu.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield xi(wu.auth.generateLoginResponseV2,e);yield Qy(i),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*af(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,yy);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(wu.auth.preVerifyMFASMSForLogin,n,i);yield Mi(xn.setMfaState({otcToken:e.otcToken,step:Jt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*rf(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,fy);yield Mi(xn.setLoginState({loading:!0}));try{const e=yield xi(wu.auth.verifyMFASMSForLogin,n,i),o=yield xi(wu.auth.generateLoginResponseV2,e);yield Xy(o),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*lf(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,py);yield Mi(xn.setLoginState({loading:!0}));try{var o;const e=yield xi(wu.auth.preVerifyMFAWebAuthnForLogin,n,i),a=T({},e.options,{challenge:ft(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>T({},e,{id:ft(e.id)})))});yield Mi(xn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*sf(e){let{payload:{callback:t,deviceId:n}}=e,i=Xn(e.payload,gy);yield Mi(xn.setLoginState({loading:!0}));try{const{loginState:e}=yield Ki((e=>e.auth)),o=pt(i.publicKey),a=yield xi(wu.auth.verifyMFAWebAuthnForLogin,n,T({},i,{options:o})),r=yield xi(wu.auth.generateLoginResponseV2,a);yield Xy(r),yield Mi(xn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*cf(){yield $o(xn.requestAuthorize,wy),yield $o(xn.requestAuthorizeSSR,Cy),yield $o(xn.requestHostedLoginAuthorize,Dy),yield $o(xn.handleHostedLoginCallback,Ry),yield $o(xn.preLogin,xy),yield $o(xn.postLogin,zy),yield $o(xn.login,By),yield $o(xn.logout,Jy),yield $o(xn.silentLogout,Yy),yield $o(xn.loginWithMfa,qy),yield $o(xn.recoverMfa,Hy),yield $o(xn.quickSmsPasswordlessPreLogin,Ny),yield $o(xn.changePhoneNumberWithVerification,_y),yield $o(xn.verifyChangePhoneNumber,Uy),yield $o(xn.passwordlessPreLogin,My),yield $o(xn.passwordlessPostLogin,$y),yield $o(xn.verifyInviteToken,Fy),yield $o(xn.webAuthnPrelogin,Wy),yield $o(xn.webAuthnPostLogin,Gy),yield $o(xn.webAuthnCreateNewDeviceSession,jy),yield $o(xn.webAuthnVerifyNewDeviceSession,Ky),yield $o(xn.afterAuthNavigation,vy),yield $o(xn.getUserIP,Oy),yield $o(xn.preEnrollMFASMSForLogin,Zy),yield $o(xn.enrollMFASMSForLogin,ef),yield $o(xn.preEnrollMFAWebAuthnForLogin,tf),yield $o(xn.enrollMFAWebAuthnForLogin,nf),yield $o(xn.enrollMFAAuthenticatorAppForLogin,of),yield $o(xn.preVerifyMFASMSForLogin,af),yield $o(xn.verifyMFASMSForLogin,rf),yield $o(xn.preVerifyMFAWebAuthnForLogin,lf),yield $o(xn.verifyMFAWebAuthnForLogin,sf)}function*uf({payload:e}){e&&(yield Mi(xn.setState({isLoading:!0})));const t=xu;yield Mi(xn.loadTenants()),yield Mi(xn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*df({payload:{callback:e}}){try{const{ip:t}=rd[0];yield Mi(xn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*yf(){yield $o(xn.requestAuthorize,uf),yield $o(xn.afterAuthNavigation,vy),yield $o(xn.getUserIP,df)}const ff=["callback","samlVendor"],pf=["callback","samlVendor"];function*gf(){try{var e,t;yield Mi(xn.setSSOState({loading:!0}));const n=yield xi(wu.auth.getSamlConfiguration),i=yield xi(wu.auth.getOidcConfiguration),o=yield xi(wu.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 Mi(xn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSSOState({error:e.message,loading:!1}))}}function*Sf({payload:e}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Mi(xn.setSSOState({error:void 0,[n]:!0}));try{const i=yield Nu(e[0]),o=yield xi(wu.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Mi(xn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*vf({payload:e}){const{configFile:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Mi(xn.setSSOState({error:void 0,[o]:!0}));try{const e=yield Nu(t),a=yield xi(wu.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*hf({payload:e}){const{callback:t,samlVendor:n}=e,i=Xn(e,ff),o=yield Ki((e=>e.auth.ssoState.samlConfiguration)),a=T({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Mi(xn.setSSOState({samlConfiguration:T({},o,a)})));if(yield Mi(xn.setSSOState({error:void 0,[r]:!0})),e.type===Du.Saml){var l,s;const e=yield xi(wu.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=Ru(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 xi(wu.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Mi(xn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*mf({payload:{callback:e}={}}){const t=yield Ki((e=>e.auth.ssoState.samlConfiguration));try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(wu.auth.validateSamlDomain),yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*bf(){try{const e=yield xi(wu.auth.getSamlRoles),t=yield xi(wu.auth.getSamlRolesGroups);yield Mi(xn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Mi(xn.setSSOState({error:e.message}))}}function*Af({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(wu.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield $i(e.map((e=>xi(wu.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Mi(xn.setSSOState({error:e.message}))}}(n)),yield bf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*kf({payload:{callback:e,id:t}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(wu.auth.deleteSamlGroup,{id:t}),yield bf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Tf({payload:{group:e,roleIds:t,callback:n}}){try{yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield xi(wu.auth.createSamlGroup,{group:e,roleIds:t}),yield bf(),yield Mi(xn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Pf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Mi(xn.setSSOState({loading:!0})),yield xi(wu.auth.oidcPostLoginV2,t),yield xi(Py),yield Mi(xn.setSSOState({loading:!1}))}catch(e){var n;yield Mi(xn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*If(){yield No(xn.loadSSOConfigurations,gf),yield No(xn.saveSSOConfigurations,hf),yield No(xn.saveSSOConfigurationsFile,Sf),yield No(xn.saveSSOConfigurationsFileWithCallback,vf),yield No(xn.validateSSODomain,mf),yield No(xn.loadSSOAuthorizationRoles,bf),yield No(xn.updateSSOAuthorizationRoles,Af),yield No(xn.deleteSamlGroup,kf),yield No(xn.createSamlGroup,Tf),yield No(xn.oidcPostlogin,Pf)}function*Lf(){yield Mi(xn.setSSOState({loading:!0})),yield ut(),yield Mi(xn.setSSOState({samlConfiguration:Bu,loading:!1,firstLoad:!1}))}function*Of({payload:e}){const t="saving";yield Mi(xn.setSSOState({error:void 0,[t]:!0}));const n=T({},yield Ki((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Mi(xn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*wf({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Xn(e,pf),r=Ju.samlConfiguration,l=T({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Mi(xn.setSSOState({samlConfiguration:T({},r,l)})));yield Mi(xn.setSSOState({error:void 0,[s]:!0})),yield ut(),l.acsUrl=null==qu||null==(t=qu.configuration)?void 0:t.acsUrl,l.spEntityId=null==qu||null==(n=qu.configuration)?void 0:n.spEntityId;const c=Ru(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 ut(),yield Mi(xn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*Ef({payload:{callback:e}={}}){const t=Ju.samlConfiguration;yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield ut(),yield Mi(xn.setSSOState({samlConfiguration:T({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Cf(){yield ut(),yield Mi(xn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Df({payload:{callback:e,authorizationRoles:t}}){yield Mi(xn.setSSOState({error:void 0,saving:!0})),yield ut(),yield Mi(xn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Rf(){yield No(xn.loadSSOConfigurations,Lf),yield No(xn.saveSSOConfigurations,wf),yield No(xn.saveSSOConfigurationsFile,Of),yield No(xn.validateSSODomain,Ef),yield No(xn.loadSSOAuthorizationRoles,Cf),yield No(xn.updateSSOAuthorizationRoles,Df)}const _f=["callback"],Uf=["callback","ssoConfigId"],Nf=["callback","ssoConfigId"];function*Mf(){try{return yield xi(wu.auth.getOidcConfiguration)}catch(e){return null}}function*$f(){try{return yield xi(wu.metadata.getSamlMetadata)}catch(e){return null}}function*Ff(){try{yield Mi(xn.setSSOLoader({key:Cu.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield $i([xi(Mf),xi($f)]),n=yield xi(wu.auth.getSSOConfigurations);yield Mi(xn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Mi(xn.setSSOError({key:Cu.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Mi(xn.setSSOLoader({key:Cu.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*xf({payload:e}){yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Xn(e,_f),i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield xi(wu.auth.createSSOConfiguration,T({},n,{enabled:null!=(o=n.enabled)&&o}));yield Mi(xn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Cu.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Vf({payload:e}){yield Mi(xn.setSSOLoader({key:Cu.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 Nu(t),o=yield xi(wu.auth.createSSOConfigurationByMetadata,{metadata:e});yield Mi(xn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Mi(xn.setSSOError({key:Cu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*jf({payload:e}){yield Mi(xn.setSSOLoader({key:Cu.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Xn(e,Uf),o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield xi(wu.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Mi(xn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Cu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Kf({payload:e}){yield Mi(xn.setSSOLoader({key:Cu.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 Nu(i),a=yield xi(wu.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Mi(xn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Mi(xn.setSSOError({key:Cu.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Wf({payload:e}){yield Mi(xn.setSSOLoader({key:Cu.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(wu.auth.deleteSSOConfiguration,t),yield Mi(xn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Mi(xn.setSSOError({key:Cu.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Gf({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Xn(e,Nf);yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield xi(wu.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?T({},t,{domains:[...t.domains,e]}):t));yield Mi(xn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Mi(xn.setSSOError({key:Cu.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_DOMAIN,value:!1}))}}function*zf({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Mi(xn.setSSOLoader({key:Cu.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(wu.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?T({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Mi(xn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Mi(xn.setSSOError({key:Cu.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.DELETE_SSO_DOMAIN,value:!1}))}}function*Bf({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Mi(xn.setSSOLoader({key:Cu.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(wu.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?T({},e,{domains:e.domains.map((e=>e.id===n?T({},e,{validated:!0}):e))}):e));yield Mi(xn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Mi(xn.setSSOError({key:Cu.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.VALIDATE_SSO_DOMAIN,value:!1}))}}function*qf({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Mi(xn.setSSOLoader({key:Cu.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield xi(wu.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?T({},e,{roleIds:n}):e));yield Mi(xn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Mi(xn.setSSOError({key:Cu.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Mi(xn.setSSOLoader({key:Cu.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Hf({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_GROUPS,value:!0}));const o=yield Ki((e=>e.auth.ssoState.ssoConfigurations));try{yield $i(t.map((e=>xi(wu.auth.deleteSSOGroup,n,e)))),yield $i(e.map((e=>xi(wu.auth.createSSOGroup,n,e))));const a=yield xi(wu.auth.getSSOGroups,n),r=o.map((e=>e.id===n?T({},e,{groups:a}):e));yield Mi(xn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Mi(xn.setSSOError({key:Cu.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_GROUPS,value:!1}))}}function*Jf({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield $i(t.map((t=>xi(wu.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Mi(xn.setSSOError({key:Cu.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Mi(xn.setSSOLoader({key:Cu.SAVE_SSO_GROUPS,value:!1}))}}function*Yf(){yield No(xn.loadSSOConfigurationsV2,Ff),yield No(xn.saveSSOConfigurationV2,xf),yield No(xn.saveSSODomain,Gf),yield No(xn.deleteSSODomain,zf),yield No(xn.validateSSODomainV2,Bf),yield No(xn.updateSSOConfiguration,jf),yield No(xn.deleteSSOConfiguration,Wf),yield No(xn.setSSOGroups,Hf),yield No(xn.updateSSOGroups,Jf),yield No(xn.setSSODefaultRoles,qf),yield No(xn.saveSSOConfigurationByMetadata,Vf),yield No(xn.updateSSOConfigurationByMetadata,Kf)}const Qf=["callback","profilePictureUrl"],Xf=["callback","profilePictureUrl"];function*Zf(){yield Mi(xn.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 xi.apply(void 0,[Uo,e,t,n].concat(o))}(3,2e3,wu.teams.getProfile),t=yield Ki((e=>e.auth.user));xn.setUser(T({},t,e)),yield Mi(xn.setProfileState({profile:e,loading:!1}))}catch(e){yield Mi(xn.setProfileState({loading:!1,error:e.message}))}}function*ep(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xn(e.payload,Qf);yield Mi(xn.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 xi(wu.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=T({},e,i,{profilePictureUrl:o}),r=yield xi(wu.teams.updateProfile,a),l=yield Ki((e=>e.auth.user));yield Mi(xn.setUser(T({},l,r))),yield Mi(xn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield Mi(xn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tp({payload:e}){yield Mi(xn.setProfileState({loading:!0}));try{var t;yield xi(wu.teams.changePassword,e),yield Mi(xn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*np(){yield $o(xn.loadProfile,Zf),yield No(xn.saveProfile,ep),yield No(xn.changePassword,tp)}function*ip(){yield Mi(xn.setProfileState({loading:!0})),yield ut(),yield Mi(xn.setUser(T({},xu,Fu))),yield Mi(xn.setProfileState({loading:!1,profile:Fu}))}function*op(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Xn(e.payload,Xf);yield Mi(xn.setProfileState({saving:!0,error:null}));const o=Vu;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=T({},o.profile,i,{profilePictureUrl:a}),l=xu;yield ut(),yield Mi(xn.setUser(T({},l,r))),yield Mi(xn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*ap({payload:e}){var t;yield Mi(xn.setProfileState({loading:!0})),yield ut(),yield Mi(xn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*rp(){yield $o(xn.loadProfile,ip),yield No(xn.saveProfile,op),yield No(xn.changePassword,ap)}const lp=["callback"],sp=["callback"],cp=["callback"];function*up(){yield Mi(xn.setMfaState({loading:!0}));try{const{qrCode:e}=yield xi(wu.auth.enrollMfa);yield Mi(xn.setMfaState({loading:!1,error:void 0,qrCode:e}))}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message}))}}function*dp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,lp);yield Mi(xn.setMfaState({loading:!0}));try{const e=yield Ki((e=>e.auth.user)),i=yield xi(wu.auth.verifyMfa,n),o={step:Jt.recoveryCode,loading:!1,error:void 0};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mi(xn.setMfaState(o)),yield Mi(xn.setUser(T({},e,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*yp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,sp);yield Mi(xn.setMfaState({loading:!0}));try{const e=yield xi(wu.auth.loginWithMfa,n),i={step:Jt.recoveryCode,loading:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Mi(xn.setMfaState(i)),yield Mi(xn.setState({user:e})),yield Mi(xn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield Mi(xn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*fp({payload:e}){yield Mi(xn.setMfaState({loading:!0}));try{var t;const n=yield Ki((e=>e.auth.user));yield xi(wu.auth.disableMfa,e),yield Mi(xn.setMfaState({loading:!1,error:void 0})),yield Mi(xn.setUser(T({},n,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setMfaState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*pp(){yield No(xn.enrollMfa,up),yield No(xn.verifyMfa,dp),yield No(xn.disableMfa,fp),yield No(xn.verifyMfaAfterForce,yp)}function*gp(){yield Mi(xn.setMfaState({loading:!0})),yield Mi(xn.setMfaState({loading:!1,error:void 0,qrCode:"test"}))}function*Sp({payload:{callback:e}}){yield Mi(xn.setMfaState({loading:!0})),yield ut();const t={token:"token",recoveryCode:"recoveryCode"},n={step:Jt.recoveryCode,loading:!1,error:void 0};null!=t&&t.recoveryCode&&(n.recoveryCode=t.recoveryCode),yield Mi(xn.setMfaState(n)),yield Mi(xn.setUser(T({},xu,{mfaEnrolled:!0}))),null==e||e(n.recoveryCode)}function*vp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,cp);yield Mi(xn.setMfaState({loading:!0})),yield ut();const i=T({},n,{recoveryCode:"recoveryCode"}),o={step:Jt.recoveryCode,loading:!1,error:void 0};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Mi(xn.setMfaState(o)),yield ut(),yield Mi(xn.setUser(T({},xu,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*hp({payload:e}){var t;yield Mi(xn.setMfaState({loading:!0})),yield ut(),yield Mi(xn.setMfaState({loading:!1,error:void 0})),yield Mi(xn.setUser(T({},xu,{mfaEnrolled:!1}))),null==(t=e.callback)||t.call(e,!0)}function*mp(){yield No(xn.enrollMfa,gp),yield No(xn.verifyMfa,Sp),yield No(xn.disableMfa,hp),yield No(xn.verifyMfaAfterForce,vp)}const bp=["callback"];function*Ap({payload:e}){yield Mi(xn.setForgotPasswordState({loading:!0}));try{yield xi(wu.auth.forgotPassword,e),yield Mi(xn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success}))}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*kp(e){let{payload:{callback:t}}=e,n=Xn(e.payload,bp);yield Mi(xn.setForgotPasswordState({loading:!0}));try{yield xi(wu.auth.resetPassword,n),yield Mi(xn.setForgotPasswordState({loading:!1,error:void 0,step:Nt.success})),null==t||t(!0)}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*Tp({payload:e}){yield Mi(xn.setForgotPasswordState({loading:!0}));try{const t=yield xi(wu.auth.loadPasswordConfig,e);yield Mi(xn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Mi(xn.setForgotPasswordState({loading:!1,error:e.message}))}}function*Pp(){yield $o(xn.forgotPassword,Ap),yield $o(xn.resetPassword,kp),yield $o(xn.loadPasswordConfig,Tp)}let Ip;!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"}(Ip||(Ip={}));const Lp=["callback","events"],Op=["callback"],wp=["callback"];function*Ep({payload:{userId:e,token:t}}){yield Mi(xn.setActivateState({loading:!0,step:Ot.activating}));try{const{isAuthenticated:n}=yield Ki((e=>e.auth));n&&(yield Mi(xn.silentLogout()));const i=yield xi(wu.auth.getActivateAccountStrategy,{userId:e,token:t});yield Mi(xn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Mi(xn.setActivateState({loading:!1,step:Ot.activatingForm})))}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message}))}}function*Cp(e){let{payload:{callback:t,events:n}}=e,i=Xn(e.payload,Lp);yield Mi(xn.setActivateState({loading:!0}));try{const e=Fo.onRedirectTo,{routes:a}=yield Ki((e=>e.auth)),r=yield xi(wu.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(by(r)){yield Mi(xn.setActivateState({step:Ot.success}));const t=yield Ty(r);yield Mi(xn.setState(t)),yield Wi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Mi(xn.setActivateState({step:Ot.success}));const{user:e,tenants:t}=yield xi(wu.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:ld.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield Mi(xn.setTenantsState({tenants:t,loading:!1})),yield Mi(xn.setState({user:e,isAuthenticated:!0})),yield Wi(1e3),yield vy(),yield Mi(xn.resetActivateState())}null==t||t(!0)}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message}))}}function*Dp({payload:e}){const{callback:t}=e,n=Xn(e,Op);yield Mi(xn.setActivateStrategyState({loading:!0}));try{const e=yield xi(wu.auth.getActivateAccountStrategy,n);yield Mi(xn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Mi(xn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Rp({payload:e}){const{callback:t}=e,n=Xn(e,wp);yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.email})),yield Mi(xn.setActivateState({loading:!0}));try{yield xi(wu.auth.resendActivationEmail,n),yield Mi(xn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Mi(xn.setActivateState({loading:!1,error:e.message})),yield Mi(xn.setTeamError({key:Ip.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*_p(){yield $o(xn.activateAccount,Cp),yield $o(xn.preActivateAccount,Ep),yield $o(xn.getActivateAccountStrategy,Dp),yield $o(xn.resendActivationEmail,Rp)}function*Up({payload:e}){if(e.token&&e.userId)try{yield Mi(xn.setAcceptInvitationState({error:void 0,step:Dt.pending})),yield xi(wu.auth.acceptInvitation,e),yield Mi(xn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Dt.success}}))}catch(e){yield Mi(xn.setAcceptInvitationState({step:Dt.failed,error:e.message}))}else yield Mi(xn.setAcceptInvitationState({error:void 0,step:Dt.invalid}))}function*Np(){yield $o(xn.acceptInvitation,Up)}var Mp,$p=new Uint8Array(16);function Fp(){if(!Mp&&!(Mp="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 Mp($p)}for(var xp=/^(?:[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,Vp=function(e){return"string"==typeof e&&xp.test(e)},jp=[],Kp=0;Kp<256;++Kp)jp.push((Kp+256).toString(16).substr(1));var Wp=function(e,t,n){var i=(e=e||{}).random||(e.rng||Fp)();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=(jp[e[t+0]]+jp[e[t+1]]+jp[e[t+2]]+jp[e[t+3]]+"-"+jp[e[t+4]]+jp[e[t+5]]+"-"+jp[e[t+6]]+jp[e[t+7]]+"-"+jp[e[t+8]]+jp[e[t+9]]+"-"+jp[e[t+10]]+jp[e[t+11]]+jp[e[t+12]]+jp[e[t+13]]+jp[e[t+14]]+jp[e[t+15]]).toLowerCase();if(!Vp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Gp=["callback"],zp=["roles"],Bp=["callback"],qp=["callback","profileImage"],Hp=["callback"],Jp=["callback","userId"],Yp=["callback"],Qp=["callback"],Xp=["callback"],Zp=["callback"],eg=["callback"],tg=["callback"],ng=["callback"],ig=["callback","profileImage"],og=["callback"],ag=["callback"],rg=["callback"],lg=["callback"],sg=["callback"],cg=["callback"],ug=()=>Ki((e=>e.auth.teamState));function*dg({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield ug(),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 Mi(xn.setTeamLoader({key:Ip.USERS,value:!a})),yield Mi(xn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield $i([xi(wu.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),xi(wu.teams.loadAvailableRoles),xi(wu.teams.loadAvailablePermissions)]);yield Mi(xn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Mi(xn.setTeamError({key:Ip.USERS,value:e.message})),yield Mi(xn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Mi(xn.setTeamLoader({key:Ip.USERS,value:!1}))}function*yg({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield ug(),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 Mi(xn.setTeamLoader({key:Ip.USERS,value:!r})),yield Mi(xn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield $i([xi(wu.subTenants.loadAllUsers,T({},c)),xi(wu.teams.loadAvailableRoles),xi(wu.teams.loadAvailablePermissions)]);yield Mi(xn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield Mi(xn.setTeamError({key:Ip.USERS,value:e.message})),yield Mi(xn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Mi(xn.setTeamLoader({key:Ip.USERS,value:!1}))}function*fg({payload:e}){yield Mi(xn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield $i([xi(wu.teams.loadAvailableRoles),xi(wu.teams.loadAvailablePermissions)]);yield Mi(xn.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 Mi(xn.setTeamError({key:Ip.ROLES_AND_PERMISSIONS,value:t.message}))}yield Mi(xn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0}))}function*pg({payload:e}){const{callback:t}=e,n=Xn(e,Gp),i=yield ug();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})}));try{const e=yield xi(wu.teams.addUser,n),{roles:o}=e,a=T({},Xn(e,zp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield Mi(xn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gg({payload:e}){const{callback:t}=e,n=Xn(e,Bp),i=yield ug();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})}));try{yield xi(wu.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield xi(wu.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Mi(xn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Sg({payload:e}){const{callback:t}=e,n=Xn(e,qp),{id:i}=n,o=yield ug(),a=o.users.find((e=>e.id===n.id));yield Mi(xn.setTeamLoader({key:Ip.UPDATE_USER,value:i||""})),yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0})})),yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?T({},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 xi(wu.teams.updateUser,n);null==t||t(e),yield Mi(xn.setTeamState({users:o.users.map((t=>t.id===e.id?T({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Mi(xn.setTeamLoader({key:Ip.UPDATE_USER,value:!1}))}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?T({},e,a):e))})),yield Mi(xn.setTeamLoader({key:Ip.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*vg({payload:e}){const{callback:t}=e,n=Xn(e,Hp),i=yield ug();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})}));try{yield xi(wu.teams.deleteUser,n),null==t||t(!0),yield Mi(xn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*hg({payload:e}){const{callback:t,userId:n}=e,i=Xn(e,Jp),o=yield ug();yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!0})}));try{yield xi(wu.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return T({},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 Mi(xn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[T({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Mi(xn.setTeamState({addUserDialogState:T({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*mg({payload:e}){const{callback:t}=e,n=Xn(e,Yp),i=yield ug();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})}));try{yield xi(wu.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Mi(xn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*bg({payload:e}){const{callback:t}=e,n=Xn(e,Qp);yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield xi(wu.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:Ip.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*Ag({payload:e}){const{callback:t}=e,n=Xn(e,Xp);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(wu.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*kg({payload:e}){const{callback:t}=e,n=Xn(e,Zp);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(wu.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*Tg({payload:e}){const{callback:t}=e,n=Xn(e,eg);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield xi(wu.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*Pg(){yield Mi(xn.setTeamError({key:Ip.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield xi(wu.teams.getInviteLinkConfiguration);yield Mi(xn.setTeamState({inviteTokenState:T({},e)}))}catch(e){yield Mi(xn.setTeamError({key:Ip.CONFIG_TOKEN_LINK,value:e.message}))}}function*Ig(){yield Mi(xn.setTeamError({key:Ip.GET_TOKEN_LINK,value:!1}));try{yield xi(Pg);const e=yield xi(wu.teams.getInviteUserLink),{inviteTokenState:t}=yield ug();yield Mi(xn.setTeamState({inviteTokenState:T({},t,e)}))}catch(e){yield Mi(xn.setTeamError({key:Ip.GET_TOKEN_LINK,value:e.message}))}}function*Lg({payload:{callback:e}}){yield Mi(xn.setTeamError({key:Ip.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield ug();try{const n=yield xi(wu.teams.createInviteUserLink,{expiresInMinutes:43200});yield Mi(xn.setTeamState({inviteTokenState:T({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield Mi(xn.setTeamError({key:Ip.CREATE_TOKEN_LINK,value:t.message}))}}function*Og({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield ug();yield Mi(xn.setTeamError({key:Ip.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield xi(wu.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Mi(xn.setTeamState({inviteTokenState:T({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield Mi(xn.setTeamError({key:Ip.UPDATE_TOKEN_LINK,value:t.message}))}}function*wg({payload:e}){const{callback:t}=null!=e?e:{};yield Mi(xn.setTeamError({key:Ip.DELETE_TOKEN_LINK,value:!1}));try{yield xi(wu.teams.deleteInviteUserLink),yield Mi(xn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Mi(xn.setTeamError({key:Ip.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Eg({payload:e}){yield Mi(xn.setTeamState({addUserDialogState:T({open:!0,loading:!1,error:!1},e)}))}function*Cg({payload:e}){const t=yield ug(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mi(xn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Dg({payload:e}){yield Mi(xn.setTeamState({deleteUserDialogState:T({open:!0,loading:!1,error:!1},e)}))}function*Rg({payload:e}){const t=yield ug(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Mi(xn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_g(){yield Mo(xn.loadUsers,dg),yield Mo(xn.loadAllSubTenantsUsers,yg),yield Mo(xn.loadRoles,fg),yield No(xn.addUser,pg),yield No(xn.addUserToSubTenants,gg),yield No(xn.updateUser,Sg),yield No(xn.setUserRolesForSubTenants,hg),yield No(xn.deleteUser,vg),yield No(xn.deleteUserFromSubTenants,mg),yield No(xn.resendActivationLink,bg),yield No(xn.resendInvitationLink,Ag),yield No(xn.resendInvitationEmail,kg),yield No(xn.resendInvitationLinkToAllSubTenants,Tg),yield No(xn.getInvitationLink,Ig),yield No(xn.createInvitationLink,Lg),yield No(xn.updateInvitationLink,Og),yield No(xn.deleteInvitationLink,wg),yield No(xn.openAddUserDialog,Eg),yield No(xn.closeAddUserDialog,Cg),yield No(xn.openDeleteUserDialog,Dg),yield No(xn.closeDeleteUserDialog,Rg)}function*Ug({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield ug(),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 Mi(xn.setTeamLoader({key:Ip.USERS,value:!a})),yield Mi(xn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield ut(),yield Mi(xn.setTeamState({users:ed,totalPages:2,totalItems:10,roles:Hu,permissions:Yu})),yield Mi(xn.setTeamLoader({key:Ip.USERS,value:!1})),null==r||r(ed)}function*Ng({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield ug(),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 Mi(xn.setTeamLoader({key:Ip.USERS,value:!r})),yield Mi(xn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield ut(),yield Mi(xn.setTeamState({allUsers:td,totalPages:2,totalItems:10,roles:Hu,permissions:Yu})),yield Mi(xn.setTeamLoader({key:Ip.USERS,value:!1})),null==l||l(td)}function*Mg({payload:e}){var t;yield Mi(xn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0})),yield ut(),yield Mi(xn.setTeamState({roles:Hu,permissions:Yu})),yield Mi(xn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Hu,permissions:Yu})}function*$g({payload:e}){const{callback:t}=e,n=Xn(e,tg),i=yield ug();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})})),yield ut();const o=T({},Xu,n,{id:`${Wp()}`});null==t||t(o),yield Mi(xn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Fg({payload:e}){const{callback:t}=e,n=Xn(e,ng),i=yield ug();yield Mi(xn.setTeamState({addUserDialogState:T({},i.addUserDialogState,{loading:!0})})),yield ut();const o=T({},Xu,n,{id:`${Wp()}`});yield Mi(xn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*xg({payload:e}){var t;const{callback:n}=e,i=Xn(e,ig),{id:o}=i,a=yield ug(),r=a.users.find((e=>e.id===i.id));yield Mi(xn.setTeamLoader({key:Ip.UPDATE_USER,value:o||""})),yield Mi(xn.setTeamState({addUserDialogState:T({},a.addUserDialogState,{loading:!0})})),yield Mi(xn.setTeamState({addUserDialogState:T({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?T({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield ut();const l=T({},r,i);null==n||n(l),yield Mi(xn.setTeamState({users:a.users.map((e=>e.id===l.id?T({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Mi(xn.setTeamLoader({key:Ip.UPDATE_USER,value:!1}))}function*Vg({payload:e}){const{callback:t}=e,n=Xn(e,og),i=yield ug();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*jg({payload:e}){const{callback:t}=e,n=Xn(e,ag),i=yield ug();yield Mi(xn.setTeamState({deleteUserDialogState:T({},i.deleteUserDialogState,{loading:!0})})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Kg({payload:e}){const{callback:t}=e,n=Xn(e,rg);yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.userId})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*Wg({payload:e}){const{callback:t}=e,n=Xn(e,lg);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*Gg({payload:e}){const{callback:t}=e,n=Xn(e,sg);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*zg({payload:e}){const{callback:t}=e,n=Xn(e,cg);yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield ut(),null==t||t(!0),yield Mi(xn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*Bg(){yield Mo(xn.loadUsers,Ug),yield Mo(xn.loadAllSubTenantsUsers,Ng),yield Mo(xn.loadRoles,Mg),yield No(xn.addUser,$g),yield No(xn.addUserToSubTenants,Fg),yield No(xn.updateUser,xg),yield No(xn.deleteUser,Vg),yield No(xn.deleteUserFromSubTenants,jg),yield No(xn.resendActivationLink,Kg),yield No(xn.resendInvitationLink,Wg),yield No(xn.resendInvitationEmail,Gg),yield No(xn.resendInvitationLinkToAllSubTenants,zg),yield No(xn.openAddUserDialog,Eg),yield No(xn.closeAddUserDialog,Cg),yield No(xn.openDeleteUserDialog,Dg),yield No(xn.closeDeleteUserDialog,Rg)}const qg=["authorizationUrl"],Hg=["events","url"];function*Jg(){try{yield Mi(xn.setSocialLoginsState({loading:!0}));const e=yield xi(wu.auth.getSocialLoginProviders);yield Mi(xn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Yg(){try{const e=yield Ki((e=>e.root.context));yield Mi(xn.setSocialLoginsState({loading:!0}));const t=(yield xi(wu.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=Xn(t,qg);const o=jo(e,null!=n?n:"");return T({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Mi(xn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield Mi(xn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Qg(e){let{payload:{events:t,url:n}}=e,i=Xn(e.payload,Hg);try{yield Mi(xn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield xi(wu.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:sd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:ld.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Mi(xn.setLoginState({email:e,isNewUser:r})),yield Py(),localStorage.removeItem("register-quick-login"),yield Mi(xn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield Mi(xn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Xg({payload:e}){yield Mi(xn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Zg(){yield $o(xn.loadSocialLoginsConfiguration,Jg),yield $o(xn.loadSocialLoginsConfigurationV2,Yg),yield $o(xn.loginViaSocialLogin,Qg),yield Mo(xn.setSocialLoginError,Xg)}let eS;function*tS({payload:e}){yield Mi(xn.setApiTokensState({apiTokenType:e}));try{if(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield xi(wu.auth.getUserApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield xi(wu.auth.getTenantApiTokensData),{items:t}=yield xi(wu.teams.loadAvailableRoles),{items:n}=yield xi(wu.teams.loadAvailablePermissions);yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:eS.LOAD_API_TOKENS,value:e.message})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1}))}}function*nS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!0}));const e=yield xi(wu.auth.updateUserApiTokensData,{description:t});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield Mi(xn.setApiTokensError({key:eS.ADD_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*iS({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!0}));const e=yield xi(wu.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Mi(xn.setApiTokensError({key:eS.ADD_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*oS({payload:e}){const{apiTokensDataUser:t}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!0})),yield xi(wu.auth.deleteUserApiToken,{tokenId:e}),yield Mi(xn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:eS.DELETE_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!1}))}}function*aS({payload:e}){const{apiTokensDataTenant:t}=yield Ki((e=>e.auth.apiTokensState));try{yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!0})),yield xi(wu.auth.deleteTenantApiToken,{tokenId:e}),yield Mi(xn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!1}))}catch(e){yield Mi(xn.setApiTokensError({key:eS.DELETE_API_TOKEN,value:e.message})),yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!1}))}}function*rS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield $i([xi(wu.auth.getUserApiTokensData),xi(wu.auth.getTenantApiTokensData)]);yield Mi(xn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:eS.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield xi(wu.auth.getUserApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:eS.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sS({payload:e}){null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield xi(wu.auth.getTenantApiTokensData);yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setApiTokensError({key:eS.LOAD_API_TOKENS,value:t.message})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cS(){yield $o(xn.loadApiTokens,rS),yield $o(xn.loadUserApiTokens,lS),yield $o(xn.loadTenantApiTokens,sS),yield $o(xn.initApiTokensData,tS),yield No(xn.addUserApiToken,nS),yield No(xn.addTenantApiToken,iS),yield Mo(xn.deleteTenantApiToken,aS),yield Mo(xn.deleteUserApiToken,oS)}function*uS({payload:e}){if(yield Mi(xn.setApiTokensState({apiTokenType:e})),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})),"user"===e){yield Wi(200);const e=[Mu];yield Mi(xn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:null!=(t=[$u])?t:[],roles:null!=Hu?Hu:[],permissions:null!=Yu?Yu:[]}))}yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1}))}function*dS({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ki((e=>e.auth.apiTokensState)),a=T({},$u,{description:t,roleIds:n,clientId:`CLIENT_ID_${Wp()}`});yield Mi(xn.setApiTokensState({showAddTokenDialog:!1})),yield Wi(200),yield Mi(xn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:eS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*yS({payload:e}){yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!0})),yield Wi(200);const t=[$u];yield Mi(xn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Mi(xn.setApiTokensLoader({key:eS.DELETE_API_TOKEN,value:!1}))}function*fS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));const n=[Mu],i=[$u];yield Mi(xn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*pS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));const n=[Mu];yield Mi(xn.setApiTokensState({apiTokensDataUser:n})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*gS({payload:e}){var t;null!=e&&e.silentLoading||(yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!0})));const n=[$u];yield Mi(xn.setApiTokensState({apiTokensDataTenant:n})),yield Wi(200),yield Mi(xn.setApiTokensLoader({key:eS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*SS(){yield $o(xn.loadApiTokens,fS),yield $o(xn.loadUserApiTokens,pS),yield $o(xn.loadTenantApiTokens,gS),yield $o(xn.initApiTokensData,uS),yield No(xn.addTenantApiToken,dS),yield Mo(xn.deleteTenantApiToken,yS)}function*vS({payload:e}){try{var t;yield Mi(xn.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 xi(wu.accountSettings.updateSettings,T({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Mi(xn.setAccountSettingsState(T({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Mi(xn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*hS({payload:e}){yield Mi(xn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield xi(wu.accountSettings.getSettings);yield Mi(xn.setAccountSettingsState(T({},e,{loading:!1})))}catch(e){yield Mi(xn.setAccountSettingsState({loading:!1,error:e.message}))}}function*mS(){yield $o(xn.saveAccountSettings,vS),yield $o(xn.loadAccountSettings,hS)}function*bS({payload:e}){var t;yield Mi(xn.setAccountSettingsState({loading:!0})),yield ut();const{accountSettingsState:n}=yield Ki((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=T({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Mi(xn.setAccountSettingsState(T({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*AS({payload:e}){yield Mi(xn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield ut(),yield Mi(xn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*kS(){yield $o(xn.saveAccountSettings,bS),yield $o(xn.loadAccountSettings,AS)}function*TS({payload:{tenantId:e,callback:t}}){yield Mi(xn.setState({isLoading:!0}));try{yield xi(wu.tenants.switchTenant,{tenantId:e}),yield xi(Py),(null==t?void 0:t(!0))||(yield Mi(xn.setState({isLoading:!1})))}catch(e){yield Mi(xn.setState({isLoading:!1})),null==t||t(!1,e)}}function*PS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(wu.tenants.getTenants);yield Mi(xn.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 Mi(xn.setTenantsState({loading:!1}))}}function*IS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(wu.tenants.getSubTenants);yield Mi(xn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*LS({payload:e}){yield Mi(xn.setTenantsState({loading:!0}));try{var t;const n=yield xi(wu.tenants.getSubTenantsAsTree);yield Mi(xn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Mi(xn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*OS(){yield No(xn.loadTenants,PS),yield No(xn.loadSubTenants,IS),yield No(xn.switchTenant,TS),yield No(xn.loadSubTenantsTree,LS)}function*wS(){yield Mi(xn.setTenantsState({loading:!0})),yield ut(),yield Mi(xn.setTenantsState({tenants:nd,loading:!1}))}function*ES(){yield No(xn.loadTenants,wS)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(eS||(eS={}));const CS=["callback"],DS=["callback"],RS=["callback"],_S=["callback"],US=["callback"];function*NS({payload:e}){var t;yield Mi(xn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield $i([xi(wu.roles.getRoles),xi(wu.roles.getPermissions),xi(wu.roles.getPermissionCategories)]),[t,n,i]=e;yield Mi(xn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Mi(xn.setRolesState({error:e.message,loading:!1}))}}function*MS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,CS);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(wu.roles.addRole,n),i=yield xi(wu.roles.getRoles);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$S(e){let{payload:{callback:t}}=e,n=Xn(e.payload,DS);yield Mi(xn.setRolesState({saving:!0}));try{yield xi(wu.roles.deleteRole,n),yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*FS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,RS);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(wu.roles.updateRole,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*xS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,_S);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(wu.roles.attachPermissionsToRole,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*VS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,US);yield Mi(xn.setRolesState({saving:!0}));try{const e=yield xi(wu.roles.attachPermissionToRoles,n);yield Mi(xn.loadRolesAndPermissions({silentLoading:!0})),yield Mi(xn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Mi(xn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*jS(){yield $o(xn.loadRolesAndPermissions,NS),yield No(xn.addRole,MS),yield No(xn.deleteRole,$S),yield No(xn.updateRole,FS),yield No(xn.attachPermissionsToRole,xS),yield No(xn.attachPermissionToRoles,VS)}const KS=["callback"],WS=["callback"],GS=["callback"];function*zS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,KS);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const e=yield xi(wu.auth.resetPhoneNumber,n);yield Mi(xn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:xt.VerifyResetPhoneNumber})),yield Mi(xn.setLoginState({email:n.email}))}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*BS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,WS);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const e=yield xi(wu.auth.verifyResetPhoneNumber,n);yield Mi(xn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:xt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qS(e){let{payload:{callback:t}}=e,n=Xn(e.payload,GS);yield Mi(xn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ki((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield xi(wu.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Mi(xn.setLoginState({step:gt.loginWithSmsOtc})),yield Mi(xn.passwordlessPreLogin({type:Xa.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Mi(xn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*HS(){yield $o(xn.resetPhoneNumber,zS),yield $o(xn.verifyResetPhoneNumber,BS),yield $o(xn.changePhoneNumber,qS)}function*JS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getCurrentUserSessions);yield Mi(xn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*YS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getCurrentUserSession);yield Mi(xn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*QS({payload:{id:e}}){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(wu.auth.deleteSessionForUser,e),yield Mi(xn.loadUserSessions())}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*XS({payload:{callback:e,userId:t}}){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(wu.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Mi(xn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*ZS(){yield Mi(xn.setSessionsState({loading:!0,error:null}));try{yield xi(wu.auth.deleteAllSessionsForUser),yield Mi(xn.loadUserSessions())}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*ev(){yield Mo(xn.loadUserSessions,JS),yield Mo(xn.deleteUserSession,QS),yield Mo(xn.deleteAllUserSessions,ZS),yield Mo(xn.loadCurrentUserSession,YS),yield No(xn.revokeUserSessions,XS)}function*tv(){yield Mi(xn.setSessionsState({loading:!0,error:null})),yield Mi(xn.setSessionsState({sessions:id,loading:!1}))}function*nv({payload:{id:e}}){yield Mi(xn.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 Mi(xn.setSessionsState({sessions:t,loading:!1}))}function*iv(){yield Mi(xn.setSessionsState({loading:!0,error:null}));const e=id.filter((e=>e.current));yield Mi(xn.setSessionsState({sessions:e,loading:!1}))}function*ov(){yield Mo(xn.loadUserSessions,tv),yield Mo(xn.deleteUserSession,nv),yield Mo(xn.deleteAllUserSessions,iv)}const av=["callback"],rv=["callback"];function*lv(){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getSessionConfigurations);yield Mi(xn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Mi(xn.setSessionsState({error:e,loading:!1}))}}function*sv({payload:e}){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Xn(e,av);yield xi(wu.auth.createOrUpdateSessionConfigrations,n),yield Mi(xn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Mi(xn.setSessionsPolicyState({error:e,loading:!1}))}}function*cv(){yield $o(xn.loadSessionsPolicy,lv),yield Mo(xn.createOrUpdateSessionsPolicy,sv)}function*uv(){yield Mi(xn.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:od}));yield Mi(xn.setSessionsPolicyState(T({},e,{loading:!1})))}function*dv({payload:e}){yield Mi(xn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Xn(e,rv);null==t||t(!0),yield Mi(xn.setSessionsPolicyState({configurations:n,loading:!1}))}function*yv(){yield $o(xn.loadSessionsPolicy,uv),yield Mo(xn.createOrUpdateSessionsPolicy,dv)}const fv=["callback"],pv=["callback"],gv=["callback"],Sv=["callback"],vv=["callback"],hv=["callback"],mv=["callback"],bv=["callback"],Av=()=>Ki((e=>e.auth.restrictionsState.ipRestrictions)),kv=()=>Ki((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Tv(){yield Mi(xn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield xi(wu.auth.getDomainRestrictionsConfig),t=(yield xi(wu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mi(xn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Pv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,fv);yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield kv();try{var o;yield xi(wu.auth.createDomainRestriction,n);const e=(yield xi(wu.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Mi(xn.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 Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Iv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,pv);yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield xi(wu.auth.updateDomainRestrictionConfig,n),i=(yield xi(wu.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Mi(xn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Lv({payload:{id:e}}){yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield kv();try{var n;yield xi(wu.auth.deleteDomainRestriction,e);const i=(yield xi(wu.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Mi(xn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Dn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Mi(xn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Ov=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Dn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*wv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Av(),t=yield xi(wu.auth.getIPRestrictionsConfig),n=Ov({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield xi(wu.auth.getIPRestrictions,n);yield Mi(xn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Ev(){try{const{valid:e}=yield xi(wu.auth.testCurrentIpInAllowList);yield Mi(xn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message}))}}function*Cv({payload:{callback:e}}){yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ki((e=>e.auth.userIp));yield $i([xi(wu.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Dn.ALLOW}),xi(wu.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Av(),i=Ov(n.pagination),{items:o,_metadata:{totalPages:a}}=yield xi(wu.auth.getIPRestrictions,i);yield Mi(xn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Dn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Mi(xn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Dv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,gv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Av();try{var o,a;yield xi(wu.auth.createIPRestriction,n);const e=yield Av(),r=Ov(e.pagination),{items:l,_metadata:{totalPages:s}}=yield xi(wu.auth.getIPRestrictions,r);yield Ev(),yield Mi(xn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Dn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,Sv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));try{yield xi(wu.auth.updateIPRestrictionConfig,n);const e=yield Av(),i=yield xi(wu.auth.getIPRestrictionsConfig),o=Ov(T({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield xi(wu.auth.getIPRestrictions,o);yield Ev(),yield Mi(xn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_v({payload:{id:e,callback:t}}){yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Av();try{var i;yield xi(wu.auth.deleteIPRestriction,e);const o=yield Av(),a=Ov(o.pagination),{items:r,_metadata:{totalPages:l}}=yield xi(wu.auth.getIPRestrictions,a);yield Ev(),yield Mi(xn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Dn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Mi(xn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Uv(){yield $o(xn.loadIpRestrictions,wv),yield $o(xn.loadEmailDomainRestrictions,Tv),yield No(xn.saveIpRestriction,Dv),yield No(xn.saveIpRestrictionsConfig,Rv),yield No(xn.deleteIpRestriction,_v),yield No(xn.checkIfUserIpValid,Ev),yield No(xn.addCurrentUserIpAndActivate,Cv),yield No(xn.saveEmailDomainRestriction,Pv),yield No(xn.saveEmailDomainRestrictionsConfig,Iv),yield No(xn.deleteEmailDomainRestriction,Lv)}function*Nv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null})),yield Mi(xn.setIpRestrictionsState({data:{restrictions:rd.filter((e=>e.strategy===ad.strategy)),config:ad},totalPages:1,pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Mv(){yield Mi(xn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Av(),t=rd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Mi(xn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Mi(xn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*$v(e){var t,n;let{payload:{callback:i}}=e,o=Xn(e.payload,vv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const a=yield Av();yield Mi(xn.setIpRestrictionsState({data:{config:null!=(t=null==(n=a.data)?void 0:n.config)?t:{isActive:!1,strategy:Dn.ALLOW},restrictions:[...a.data.restrictions,T({},o,{createdAt:new Date,updatedAt:new Date,id:"123",isActive:!0,strategy:a.data.config.strategy})]},totalPages:1,pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*Fv(e){let{payload:{callback:t}}=e,n=Xn(e.payload,hv);yield Mi(xn.setIpRestrictionsState({saving:!0,error:null})),yield Mi(xn.setIpRestrictionsState({data:{config:n,restrictions:rd.filter((e=>e.strategy===n.strategy))},pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Mi(xn.setIpRestrictionsState({saving:!1,error:null})),null==t||t(!0)}function*xv({payload:{id:e}}){var t;yield Mi(xn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Av();yield Mi(xn.setIpRestrictionsState({data:{config:(null==(t=n.data)?void 0:t.config)||{isActive:!1,strategy:Dn.ALLOW},restrictions:n.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Dn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1}))}function*Vv(){yield Mi(xn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ut(),yield Mi(xn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Dn.ALLOW}],config:{active:!0,listType:Dn.ALLOW,blockPublicDomains:!1}}}))}function*jv(e){var t,n;let{payload:{callback:i}}=e,o=Xn(e.payload,mv);const a=yield kv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),null==i||i(!0),yield Mi(xn.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)||[],T({},o,{id:Date.now().toString()})]},saving:!1}))}function*Kv(e){var t;let{payload:{callback:n}}=e,i=Xn(e.payload,bv);const o=yield kv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),null==n||n(!0),yield Mi(xn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Dn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Wv({payload:{id:e}}){var t,n;const i=yield kv();yield Mi(xn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ut(),yield Mi(xn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Dn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Gv(){yield $o(xn.loadIpRestrictions,Nv),yield $o(xn.loadEmailDomainRestrictions,Vv),yield No(xn.saveIpRestriction,$v),yield No(xn.saveIpRestrictionsConfig,Fv),yield No(xn.deleteIpRestriction,xv),yield No(xn.checkIfUserIpValid,Mv),yield No(xn.saveEmailDomainRestriction,jv),yield No(xn.saveEmailDomainRestrictionsConfig,Kv),yield No(xn.deleteEmailDomainRestriction,Wv)}var zv={sagas:function*(){yield $i([xi(cf),xi(_p),xi(Np),xi(Pp),xi(HS),xi(If),xi(Yf),xi(np),xi(pp),xi(_g),xi(Zg),xi(pd),xi(cS),xi(Vd),xi(mS),xi(OS),xi(jS),xi(ev),xi(cv),xi(Uv)])},mockSagas:function*(){yield $i([xi(yf),xi(Rf),xi(rp),xi(mp),xi(Bg),xi(SS),xi(Qd),xi(ov),xi(kS),xi(ES),xi(yv),xi(Gv)])},storeName:bt,initialState:Mn,reducer:$n,actions:xn};const Bv=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>T({},t,{[e]:T({},t[e],n)})}),qv={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Hv={setAuditLogsState:Bv("auditLogsState"),resetAuditLogsState:e=>T({},e,{auditLogsState:qv})},Jv={exportAuditsCsv:tt("auditLogs/exportAuditsCsv"),loadAuditLogs:tt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Yv={loading:!0},Qv={setAuditsMetadataState:Bv("auditsMetadataState"),resetAuditsMetadataState:e=>T({},e,{auditsMetadataState:Yv})},Xv={loadAuditsMetadata:tt("auditLogs/loadAuditsMetadata")},Zv={auditLogsState:qv,auditsMetadataState:Yv},{reducer:eh,actions:th}=it({name:kt,initialState:Zv,reducers:T({resetState:e=>T({},e,Zv),setState:(e,{payload:t})=>T({},e,t)},Hv,Qv)}),nh=T({},th,Jv,Xv),ih=e=>"createdAt"!==e.id,oh={total:20,data:Array.from(Array(5).keys()).map((e=>T({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`})))},ah={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}]},rh=()=>Ki((e=>e.auditLogs.auditLogsState)),lh=()=>Ki((e=>e.auditLogs.auditsMetadataState));function*sh(){const e=yield rh(),{columns:t}=yield lh();try{const n=e.filter,i=e.sort.reduce(((e,t)=>T({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>T({},e,{[t.id]:t.value})),{});yield Mi(nh.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield wu.audits.exportAudits(T({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Mi(nh.setAuditLogsState({isDownloadingCsv:!1}))}function*ch({payload:e}){yield Mi(nh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield rh(),{columns:n}=yield lh();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 Mi(nh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>T({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>T({},e,{[t.id]:t.value})),{});n||(yield Mi(nh.loadAuditsMetadata()));const{data:p,total:g}=yield xi(wu.audits.getAudits,T({offset:c,count:s},y,f));yield Mi(nh.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Mi(nh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*uh(){yield No(nh.exportAuditsCsv,sh),yield No(nh.loadAuditLogs,ch)}function*dh({payload:e}){yield Mi(nh.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield rh(),{columns:n}=yield lh();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 Mi(nh.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Mi(nh.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=oh;let i=n.filter((e=>t=>e.filter(ih).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 Mi(nh.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 Mi(nh.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*yh(){yield No(nh.loadAuditLogs,dh)}function*fh(){yield Mi(nh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield xi(wu.metadata.getAuditsMetadata);yield Mi(nh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mi(nh.setAuditsMetadataState({error:e,loading:!1}))}}function*ph(){yield No(nh.loadAuditsMetadata,fh)}function*gh(){yield Mi(nh.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=ah;yield Mi(nh.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Mi(nh.setAuditsMetadataState({error:e,loading:!1}))}}function*Sh(){yield No(nh.loadAuditsMetadata,gh)}var vh={sagas:function*(){yield $i([xi(uh),xi(ph)])},mockSagas:function*(){yield $i([xi(yh),xi(Sh)])},storeName:kt,initialState:Zv,reducer:eh,actions:nh};const hh={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:mh,actions:bh,reducer:Ah}=it({name:"audits",initialState:hh,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=T({},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]})))}}}),kh=T({},bh,{initData:tt(`${mh}/initData`),loadAudits:tt(`${mh}/loadAudits`),removeFilter:tt(`${mh}/removeFilter`),filterData:tt(`${mh}/filterData`),exportCSV:tt(`${mh}/exportCSV`),deleteAudits:tt(`${mh}/deleteAudits`)}),Th=()=>Ki((e=>e[mh]));function*Ph(){const{sortBy:e,sortDirection:t}=yield Th();try{const n=yield xi(wu.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Mi(kh.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Mi(kh.loadItemFailedAction(t))}}function*Ih(){try{const e=yield xi(wu.metadata.getAuditsMetadata);yield Mi(kh.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Mi(kh.loadItemFailedAction(t))}}const Lh=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Oh({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Th(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Th():{rowsData:[]};try{const e=Lh(t),{data:l,total:d}=yield xi(wu.audits.getAudits,T({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Mi(kh.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Mi(kh.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Mi(kh.loadItemFailedAction(t))}}function*wh(){yield Mi(kh.startLoading()),yield $i([Ph(),Ih(),Oh({payload:{onlyOneLoad:!1},type:""})]),yield Mi(kh.finishLoading())}function*Eh({payload:e}){const{filters:t}=yield Th(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Mi(kh.setFilterData(i))}function*Ch({payload:e}){const{filters:t}=yield Th();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 Mi(kh.setFilterData(i))}function*Dh(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Th(),a=Lh(e);yield Mi(kh.startDownloadingCsv());try{yield wu.audits.exportAudits(T({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 Mi(kh.stopDownloadingCsv())}}function*Rh(){yield Mo(kh.initData,wh),yield Mo(kh.removeFilter,Eh),yield Mo(kh.filterData,Ch),yield Mo([kh.loadAudits,kh.textSearch,kh.onPageChange],Oh),yield Mo([kh.setFilterData,kh.setDataSorting,kh.startRefresh],(()=>Oh({payload:{appendMode:!1},type:""}))),yield Mo(kh.exportCSV,Dh)}const _h={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Uh={initData:()=>T({},_h),setConnectivityState:(e,{payload:t})=>T({},e,t),cleanWebhookTestData:e=>T({},e,{testResult:void 0}),cleanWebhookLogsData:e=>T({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return T({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>T({},e,{error:void 0}),cleanSlackData:e=>T({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>T({},e,{retryResult:T({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>T({},e,{retryResult:T({},e.retryResult,t)})}},Nh={loadSlackActions:tt("connectivity/loadSlackActions"),loadDataAction:tt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:tt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:tt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:tt("connectivity/loadScope"),deleteWebhookConfigAction:tt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:tt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:tt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Mh={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:$h,actions:Fh}=it({name:At,initialState:Mh,reducers:T({},Uh)}),xh=T({},Fh,Nh),Vh={slack:wu.connectivity.getSlackConfiguration,email:wu.connectivity.getEmailConfiguration,sms:wu.connectivity.getSMSConfiguration,webhook:wu.connectivity.getWebhooksConfigurations,categories:wu.connectivity.getCategories,channelMap:wu.connectivity.getChannelMaps},jh={slack:wu.connectivity.postSlackConfiguration,email:wu.connectivity.postEmailConfiguration,sms:wu.connectivity.postSMSConfiguration,webhook:wu.connectivity.postWebhooksConfiguration},Kh=["email","slack","sms","webhook"],Wh={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"}},Gh=["id"],zh=["id","enabled"],Bh=["categories","channelMap"];function*qh(e){return yield xi(Jh,{payload:{api:e},type:""})}function*Hh({payload:e=Kh}){yield Mi(xh.setConnectivityState({isLoading:!0}));try{const t=yield $i([...e.map(qh),yield Jh({payload:{api:"categories"},type:""}),yield function*(){return(yield $i(e.map((function*(e){return yield Jh({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>T({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Jh({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?T({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Wh[e[o]].events(i),active:Wh[e[o]].isActive(i),platform:Wh[e[o]].title,image:Wh[e[o]].image}]}):n:T({},n,{[`${Bh[o-e.length]}`]:i})),{list:[],webhook:n});yield Mi(xh.setConnectivityState(T({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Mi(xh.setConnectivityState({isLoading:!1}))}}function*Jh({payload:{api:e,params:t}}){try{return yield xi(Vh[e],t)}catch(e){return}}function*Yh(){try{yield Mi(xh.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield xi(wu.connectivity.getSlackChannels);yield Mi(xh.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Mi(xh.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Qh(e,t){const{connectivity:{list:n}}=yield Ki(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Wh[e].isActive(t);o!==i.active&&(yield Mi(xh.setConnectivityState({list:n.map((t=>t.key===e?T({},t,{active:o}):t))})))}function*Xh({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ki((e=>e.connectivity));try{if(yield Mi(xh.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 $i([...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=Xn(e,Gh);return n===t.id&&JSON.stringify(T({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield xi(jh.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield xi(wu.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 $i([...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 xi("email"===t?wu.connectivity.postEmailConfiguration:wu.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=Xn(o,zh);return yield $i([yield xi("email"===t?wu.connectivity.patchEmailConfiguration:wu.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield xi("email"===t?wu.connectivity.putEmailSubscriptions:wu.connectivity.putSMSSubscriptions,a,i,T({},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 xi("email"===t?wu.connectivity.deleteEmailSubscriptions:wu.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Jh({payload:{api:t},type:""});yield Mi(xh.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Qh(t,e)}else yield Mi(xh.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield xi(jh[e],t),!["sms","email"].includes(e)){const o=yield Jh({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Mi(xh.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Qh(e,o),null==n||n(!0)}}catch(e){var o;yield Mi(xh.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Zh({payload:e}){try{yield wu.connectivity.postSlackCode(e)}catch{}yield Mi(xh.setConnectivityState({error:void 0,isSaving:!1}))}function*em(){const{slackChannels:e}=yield Ki((e=>e.connectivity));try{yield Mi(xh.setConnectivityState({slackChannels:T({},e,{isLoadingScope:!0})}));const{clientId:t}=yield xi(wu.connectivity.getSlackScope);yield Mi(xh.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Mi(xh.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*tm({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ki((e=>e.connectivity));try{yield Mi(xh.setConnectivityState({isSaving:!0})),yield xi(wu.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Jh({payload:{api:"webhook"},type:""});o&&(yield Mi(xh.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*nm({payload:e}){try{yield Mi(xh.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield xi(wu.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Mi(xh.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Mi(xh.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Mi(xh.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*im({payload:e}){try{const{statusCode:t}=yield xi(wu.connectivity.postWebhookRetry,e);yield Mi(xh.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Mi(xh.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*om({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ki((e=>e.connectivity));try{yield Mi(xh.setConnectivityState({webhookLogs:T({},i,{isLoading:!0})}));const o=yield xi(wu.connectivity.getWebhookLog,e,n,t);yield Mi(xh.setConnectivityState({error:void 0,webhookLogs:T({isLoading:!1},o)}))}catch(e){yield Mi(xh.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var am={sagas:function*(){yield No(xh.loadDataAction,Hh),yield Mo(xh.loadSlackActions,Yh),yield No(xh.postDataAction,Xh),yield No(xh.postCodeAction,Zh),yield No(xh.loadScope,em),yield No(xh.deleteWebhookConfigAction,tm),yield No(xh.postWebhookTestAction,nm),yield No(xh.postWebhookRetryAction,im),yield Mo(xh.loadWebhookLogsAction,om)},storeName:At,initialState:Mh,reducer:$h,actions:xh};function rm(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,t.payload)}}}function lm(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>T({},n,{[e]:t(n[e],i)})}}function sm(e){return lm(e,((e,t)=>T({},e,{loading:t.payload})))}function cm(e){return lm(e,((e,t)=>T({},e,{error:t.payload,loading:!1})))}const um={loading:!1,error:null,fetching:!0,plans:[]},{actions:dm,reducer:ym,name:fm}=it({name:"subscriptions/plans",initialState:um,reducers:T({},rm())}),pm=T({loadPlans:tt(`${fm}/loadPlans`)},dm),gm={loading:!1,error:null,fetching:!0,config:null},Sm=T({},rm()),{actions:vm,reducer:hm,name:mm}=it({name:"subscriptions/config",initialState:gm,reducers:Sm}),bm=T({loadPaymentConfiguration:tt(`${mm}/loadPaymentConfiguration`)},vm),Am={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},km=T({},rm(),{setCancellationLoading:sm("cancellation"),setCancellationError:cm("cancellation"),setRenewalLoading:sm("renewal"),setRenewalError:cm("renewal")}),{reducer:Tm,actions:Pm,name:Im}=it({name:"subscriptions/billing/subscription",initialState:Am,reducers:km}),Lm=T({load:tt(`${Im}/loadSubscription`),cancelSubscription:tt(`${Im}/cancelSubscription`),renewSubscription:tt(`${Im}/renewSubscription`)},Pm),Om={loading:!1,error:null,fetching:!0},wm=T({},rm()),{reducer:Em,actions:Cm,name:Dm}=it({name:"subscriptions/billing/information",initialState:Om,reducers:wm}),Rm=T({loadBillingInformation:tt(`${Dm}/loadBillingInformation`),cancelSubscription:Lm.cancelSubscription,renewSubscription:Lm.renewSubscription},Cm),_m={loading:!1,error:null,fetching:!0},Um=T({},rm(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,t.payload)}}),{reducer:Nm,actions:Mm,name:$m}=it({name:"subscriptions/billing/payment",initialState:_m,reducers:Um}),Fm=T({loadPaymentMethod:tt(`${$m}/loadPaymentMethod`),submitPaymentMethod:tt(`${$m}/submitPaymentMethod`),submitPaymentMethodError:tt(`${$m}/submitPaymentMethodError`),submitPaymentMethodSuccess:tt(`${$m}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:tt(`${$m}/updateBillingDetails`,(e=>({payload:e})))},Mm),xm={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Vm=T({},rm(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>T({},e,{invoiceDownload:T({},e.invoiceDownload,t.payload)})}}),{reducer:jm,actions:Km,name:Wm}=it({name:"subscriptions/billing/invoices",initialState:xm,reducers:Vm}),Gm=T({loadInvoices:tt(`${Wm}/loadInvoices`),downloadInvoice:tt(`${Wm}/downloadInvoice`,(e=>({payload:e})))},Km),zm={information:Om,invoices:xm,paymentMethod:_m,subscription:Am},Bm={invoices:Gm,information:Rm,paymentMethod:Fm,subscription:Lm},qm=Ne({invoices:jm,information:Em,paymentMethod:Nm,subscription:Tm}),Hm={fetching:!0,loading:!1,error:null,confirmed:!1},Jm=T({},rm()),{actions:Ym,reducer:Qm,name:Xm}=it({name:"subscriptions/checkout",initialState:Hm,reducers:Jm}),Zm=T({loadCheckout:tt(`${Xm}/loadCheckout`),resetCheckout:tt(`${Xm}/resetCheckout`),submitCheckout:tt(`${Xm}/submitCheckout`),confirmCheckout:tt(`${Xm}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:tt(`${Xm}/errorCheckout`,(e=>({payload:e})))},Ym),eb={loading:!1,error:null,cardSetupIntentSecret:null},tb=T({},rm()),{reducer:nb,actions:ib,name:ob}=it({name:"subscriptions/stripe",initialState:eb,reducers:tb}),ab=T({loadCustomer:tt(`${ob}/loadCustomer`),createCardSetupIntentSecret:tt(`${ob}/createCardSetupIntentSecret`)},ib),rb={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:lb,reducer:sb,name:cb}=it({name:"subscriptions/vendorPublicConfig",initialState:rb,reducers:T({},rm())}),ub=T({loadVendorPublicConfiguration:tt(`${cb}/loadVendorPublicConfiguration`)},lb),db={config:gm,plans:um,checkout:Hm,billing:zm,stripe:eb,vendorPublicConfig:rb},yb={config:bm,billing:Bm,plans:pm,checkout:Zm,stripe:ab,vendorPublicConfig:ub},fb=Ne({config:hm,billing:qm,plans:ym,checkout:Qm,stripe:nb,vendorPublicConfig:sb});let pb,gb,Sb;function vb({policy:e}){return{policy:Sb.AT_PERIOD_END}}function hb(e){switch(e){case lu.ACTIVE:return gb.ACTIVE;case lu.INCOMPLETE:return gb.INCOMPLETE;case lu.CANCELED:return gb.CANCELED;case lu.EXPIRED:return gb.EXPIRED;case lu.TRIALING:return gb.TRIALING;default:return gb.EXPIRED}}!function(e){e.STRIPE="Stripe"}(pb||(pb={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(gb||(gb={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Sb||(Sb={}));const mb={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:lu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},bb=[{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"}],Ab=[{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:""}],kb=[{id:"id",externalId:"externalId",type:su.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],Tb={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*Pb(){yield No(Lm.load,Ib),yield No(Lm.cancelSubscription,Ob),yield No(Lm.renewSubscription,wb)}function*Ib(){const e=yield Ki((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield _b(e)}function*Lb(){yield Mi(Lm.setLoading(!0));try{const[e]=yield xi(wu.subscriptions.getManagedSubscriptions);yield Mi(Lm.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Mi(Lm.setError(e))}}function*Ob(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mi(Lm.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mi(Lm.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===lu.ACTIVE)try{yield Mi(Lm.setCancellationLoading(!0)),yield xi(wu.subscriptions.cancelManagedSubscription,t),yield Lb(),yield Mi(Lm.setCancellationLoading(!1))}catch(e){yield Mi(Lm.setCancellationError(e.message))}}function*wb(){const{subscription:e}=yield Ki((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Mi(Lm.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Mi(Lm.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===cu.AT_PERIOD_END)try{yield Mi(Lm.setRenewalLoading(!0)),yield xi(wu.subscriptions.renewManagedSubscription,t),yield Lb(),yield Mi(Lm.setRenewalLoading(!1))}catch(e){yield Mi(Lm.setCancellationError(e.message))}}function*Eb(){yield Mi(Lm.setLoading(!0)),yield Wi(500),yield Mi(Lm.setState({subscription:mb,fetching:!1,loading:!1,error:null}))}function*Cb(){yield No(Lm.load,Eb)}function*Db(){yield No(Rm.loadBillingInformation,Rb)}function*Rb(){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 _b(n,!1):yield Mi(Rm.setError(t?"Not authorized":"Internal feature failure"))}()}function*_b(e,t){yield Mi(Rm.setLoading(!0));try{var n,i;const o=yield xi(wu.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield xi(wu.subscriptions.getSubscriptionPlan,a):([,l]=yield $i([xi(Lb),xi(wu.subscriptions.getSubscriptionPlan,a)]),s=yield Ki((e=>e.subscriptions.billing.subscription.subscription||null))),yield Mi(Rm.setState(T({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?gb.ACTIVE:hb(s.status),cancellation:s.cancellation&&vb(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 Mi(Rm.setError(e.message))}}function*Ub(){yield function*(){var e,t;yield Mi(Rm.setLoading(!0)),yield Wi(500),yield Mi(Rm.setState({loading:!1,fetching:!1,summary:{subscriptionId:mb.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:uu.Stripe,externallyManaged:!1,currentPlanId:bb[0].id,defaultPlanId:bb[0].id},plan:T({},bb[0],{price:null==(e=bb[0].price)?void 0:e.amount,currency:null==(t=bb[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*Nb(){yield No(Rm.loadBillingInformation,Ub)}function*Mb(){yield No(Fm.loadPaymentMethod,$b),yield No(Fm.submitPaymentMethod,xb),yield No(Fm.submitPaymentMethodError,Vb),yield No(Fm.submitPaymentMethodSuccess,jb),yield No(Fm.updatePaymentMethodBillingDetails,Fb)}function*$b(){yield Mi(Fm.setLoading(!0));try{const e=(yield xi(wu.subscriptions.getPaymentMethods))[0];yield Mi(Fm.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Mi(Fm.setError(e.message))}}function*Fb({payload:e}){yield Mi(Fm.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield xi(wu.subscriptions.updatePaymentMethodBillingDetails,t,T({email:n},i)),yield xi($b),null==o||o(!0)}catch(e){yield Mi(Fm.setError(e.message)),null==o||o(!1)}yield Mi(Fm.setLoading(!1))}function*xb(){yield Mi(Fm.setLoading(!0))}function*Vb({payload:e}){yield Mi(Fm.setError(e))}function*jb(){yield Mi(Fm.loadPaymentMethod())}function*Kb(){yield Mi(Fm.setLoading(!0)),yield Wi(500);const e=kb[0];yield Mi(Fm.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*Wb(){yield No(Fm.loadPaymentMethod,Kb)}function*Gb(){yield No(Gm.loadInvoices,zb),yield No(Gm.downloadInvoice,Bb)}function*zb(){yield Mi(Gm.setLoading(!0));try{const e=(yield xi(wu.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 Mi(Gm.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Mi(Gm.setError(e.message))}}function*Bb({payload:e}){yield Mi(Gm.setInvoiceDownloadState({loading:!0,error:null}));try{yield xi(wu.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Mi(Gm.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Mi(Gm.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*qb(){yield Mi(Gm.setLoading(!0)),yield Wi(500),yield Mi(Gm.setState({loading:!1,fetching:!1,invoices:Ab.map((e=>T({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Mi(Gm.setLoading(!1))}function*Hb(){yield No(Gm.loadInvoices,qb)}function*Jb(){yield $i([xi(Db),xi(Mb),xi(Gb),xi(Pb)])}function*Yb(){yield $i([xi(Nb),xi(Wb),xi(Hb),xi(Cb)])}function*Qb(){yield No(Zm.loadCheckout,Xb),yield No(Zm.resetCheckout,Zb),yield No(Zm.submitCheckout,eA),yield No(Zm.confirmCheckout,tA),yield No(Zm.errorCheckout,iA)}function*Xb(){yield Mi(Zm.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Zb(){yield Mi(Zm.setState({loading:!1,error:null,confirmed:!1}))}function*eA(){yield Mi(Zm.setState({loading:!0,error:null}))}function*tA({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)===lu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Mi(Zm.setState({loading:!0,error:null})),o&&a)return yield nA(),void(yield Mi(Lm.setState({subscription:T({},n,{status:lu.ACTIVE})})));try{yield xi(wu.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield $i([Rb(),$b(),zb()]),yield nA()}catch(e){yield Mi(Zm.setState({loading:!1,error:e.message}))}}else yield Mi(Zm.setState({loading:!1,error:"Subscription not found"}))}function*nA(){yield Mi(Zm.setState({loading:!1,error:null,confirmed:!0}))}function*iA({payload:e}){yield Mi(Zm.setState({loading:!1,error:e}))}function*oA(){yield No(Zm.resetCheckout,Zb)}function*aA(){yield No(pm.loadPlans,rA)}function*rA(){yield Mi(pm.setLoading(!0));try{const e=(yield xi(wu.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 Mi(pm.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Mi(pm.setError(e.message))}}function*lA(){yield Mi(pm.setLoading(!0)),yield Wi(500),yield Mi(pm.setState({fetching:!1,loading:!1,plans:bb.map((e=>{var t,n;return T({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*sA(){yield No(pm.loadPlans,lA)}function*cA(){yield No(bm.loadPaymentConfiguration,uA)}function*uA(){yield Mi(bm.setLoading(!0));try{(yield xi(wu.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===uu.Stripe))?yield function*(){yield Mi(bm.setLoading(!0));try{const e=yield xi(wu.subscriptions.getStripePaymentProviderConfiguration);yield Mi(bm.setState({loading:!1,fetching:!1,config:{paymentProvider:pb.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Mi(bm.setError(e.message))}}():yield Mi(bm.setError("Payment provider not configured"))}catch(e){yield Mi(bm.setError(e.message))}}function*dA(){yield Mi(bm.setLoading(!0)),yield Wi(500),yield Mi(bm.setState({loading:!1,fetching:!1,config:{paymentProvider:pb.STRIPE,apiKey:""}}))}function*yA(){yield No(bm.loadPaymentConfiguration,dA)}function*fA(){yield No(ab.createCardSetupIntentSecret,pA)}function*pA({payload:e}){yield Mi(ab.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield xi(wu.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Mi(ab.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Mi(ab.setError(e.message))}}function*gA(){yield No(ub.loadVendorPublicConfiguration,SA)}function*SA(){yield Mi(ub.setLoading(!0));try{const e=yield xi(wu.subscriptions.getVendorPublicConfigurations);yield Mi(ub.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Mi(ub.setError(e.message))}}function*vA(){yield Mi(ub.setLoading(!0)),yield Wi(500),yield Mi(ub.setState({fetching:!1,loading:!1,vendorPublicConfig:Tb}))}function*hA(){yield No(ub.loadVendorPublicConfiguration,vA)}var mA={sagas:function*(){yield $i([xi(Jb),xi(Qb),xi(aA),xi(cA),xi(fA),xi(gA)])},mockSagas:function*(){yield $i([xi(Yb),xi(oA),xi(sA),xi(yA),xi(hA)])},reducer:fb,actions:yb,initialState:db,storeName:"subscriptions"},bA={sagas:function*(){yield No(bd.loadVendorPublicInfo,Ad)},storeName:Tt,initialState:vd,reducer:hd,actions:bd};const{reducer:AA}=it({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Fo.setContext(t),T({},e,{context:t}))}}}),kA=(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,p,g,S,v;n||a||Fo.setContext(e.context);const t=Lo(),h=[...Ze({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=et({middleware:h,preloadedState:{root:T({},e,{previewMode:n,urlStrategy:r}),[zv.storeName]:T({},zv.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:T({},zv.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[vh.storeName]:T({},vh.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:T({},vh.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:T({},vh.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[mh]:T({},hh,null!=(v=null==o?void 0:o.audits)?v:{}),[am.storeName]:am.initialState,[mA.storeName]:mA.initialState,[bA.storeName]:bA.initialState},reducer:Ne({root:AA,[zv.storeName]:zv.reducer,[vh.storeName]:vh.reducer,[mh]:Ah,[am.storeName]:am.reducer,[mA.storeName]:mA.reducer,[bA.storeName]:bA.reducer})});const m=function*(){yield $i([xi(zv.sagas),xi(vh.sagas),xi(Rh),xi(am.sagas),xi(mA.sagas),xi(bA.sagas)])},b=function*(){yield $i([xi(zv.mockSagas),xi(vh.mockSagas),xi(mA.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(xn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var TA=n(714),PA=n.n(TA);function IA(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function LA(e){if(e.type)return e;if("#"===e.charAt(0))return LA(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 OA(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 wA(e){if(0===e.indexOf("#"))return e;const{values:t}=LA(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 EA(e,t){if(e=LA(e),t=IA(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 OA(e)}function CA(e,t){if(e=LA(e),t=IA(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 OA(e)}const DA=e=>{if(e)return{main:e,light:wA(CA(e,.4)),dark:wA(EA(e,.15)),hover:wA(EA(e,.15)),active:wA(EA(e,.2))}},RA=e=>{if(e)return{main:e,light:CA(e,.7),dark:EA(e,.2)}},_A=(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)?T({},t,{palette:{primary:T({},DA(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:T({},DA(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:T({},DA(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:T({},RA(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:T({},RA(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:T({},RA(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:T({},RA(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},UA={},NA={},MA={},$A={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 FA{constructor(){this._theme=UA,this._themeV2=NA,this._navigation=$A,this._localizations=MA}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new FA;return n.set(e),FA._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=PA().all([null!=(t=$A)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=PA().all([null!=(i=UA)?i:{},_A(null==e?void 0:e.theme,UA)]),this._themeV2=PA().all([null!=(o=NA)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=PA().all([null!=(r=MA)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=$A,this._theme=UA,this._themeV2=NA,this._localizations=MA}}}FA._instances={};var xA={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on"},VA=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},jA=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},KA=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 WA,GA,zA,BA,qA,HA,JA,YA,QA;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(WA||(WA={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(GA||(GA={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(zA||(zA={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(BA||(BA={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(qA||(qA={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(HA||(HA={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(JA||(JA={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(YA||(YA={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(QA||(QA={}));const XA={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},ZA={hidden:"hidden",edit:"edit"};var ek="6.46.0",tk=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];m(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(ek),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=I(O().mark((function e(){var t,n,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Wo,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:FA.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=I(O().mark((function e(){return O().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=I(O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=xA,e.next=13;break;case 4:return e.prev=4,e.next=7,Pu();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=VA(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=T({},t,{contextOptions:T({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?T({},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:kA({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),k.setInstance(c,this)}var t,n,i,o;return A(e,[{key:"initContainers",value:(o=I(O().mark((function e(t){return O().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;FA.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:v,FronteggTypes:h})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=I(O().mark((function e(){return O().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=I(O().mark((function e(){var t;return O().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=I(O().mark((function e(t){var n;return O().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,T({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}(),nk=function(){function e(){m(this,e)}return A(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=k.getInstance(i);e&&t?(Fo.setAccessToken(t),Fo.setUser(T({},n,{accessToken:t})),o.store.dispatch(xn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(xn.loadTenants())):(Fo.setAccessToken(null),Fo.setUser(null),o.store.dispatch(xn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),ik=function(){function e(){m(this,e)}return A(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).hideAdminPortal()}}]),e}(),ok=function(){function e(){m(this,e)}return A(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";k.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";k.getInstance(e).hideCheckoutDialog()}}]),e}(),ak=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},rk=function(){function e(t,n,i,o){m(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:kA({context:a},this,!0,void 0,void 0,!0),this.options=T({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new tk(this.options,t,!0),FA.set({},t)}var t;return A(e,[{key:"render",value:(t=I(O().mark((function e(t){var n,i,o,a,r=this;return O().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,KA(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}(),lk="modern",sk=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[lk]},ck=function(){function e(t,n,i,o){m(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:kA({context:a},this,!0,void 0,void 0,!0),this.options=T({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new tk(this.options,t,!0),FA.set({},t)}var t;return A(e,[{key:"render",value:(t=I(O().mark((function e(t){var n,i,o,a,r=this;return O().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,KA(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 uk(e,t){return uk=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},uk(e,t)}function dk(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&&uk(e,t)}function yk(e){return yk="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},yk(e)}function fk(e,t){if(t&&("object"===yk(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 pk(e){return pk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pk(e)}function gk(){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 Sk(e,t,n){return Sk=gk()?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&&uk(o,n.prototype),o},Sk.apply(null,arguments)}function vk(e){var t="function"==typeof Map?new Map:void 0;return vk=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 Sk(e,arguments,pk(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),uk(n,e)},vk(e)}function hk(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=pk(e);if(t){var o=pk(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return fk(this,n)}}var mk=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new tk(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){dk(n,e);var t=hk(n);function n(){var e;m(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 A(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=k.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=jA(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=jA(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=jA(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=jA(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=jA(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=jA(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}(vk(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}()}));
|