@frontegg/js 6.68.0 → 6.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(w([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function w(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:O}}function O(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=w,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:w(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 DT},AdminPortalRenderer:function(){return UT},AppHolder:function(){return P},CheckoutDialog:function(){return RT},FronteggApp:function(){return ET},HostedLogin:function(){return CT},LoginBoxRenderer:function(){return $T},defaultTheme:function(){return MT},getThemeAdminByName:function(){return _T},getThemeByName:function(){return NT},initialize:function(){return qT}});var e={};n.r(e),n.d(e,{Delete:function(){return na},Get:function(){return Xo},Patch:function(){return ea},Post:function(){return Zo},PostDownload:function(){return ia},Put:function(){return ta},getBaseUrl:function(){return Yo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Fa},getSubTenantsAsTree:function(){return xa},getTenants:function(){return $a},switchTenant:function(){return Na}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return yr},OAuthLogout:function(){return Nr},SocialLoginProviders:function(){return dr},acceptInvitation:function(){return Rr},activateAccount:function(){return Or},bulkCreateIPRestriction:function(){return rr},changePhoneNumber:function(){return Ps},changePhoneNumberWithVerification:function(){return ks},checkIfAllowToRememberMfaDevice:function(){return Ql},createDomainRestriction:function(){return er},createIPRestriction:function(){return ar},createOrUpdateSessionConfigrations:function(){return Ml},createSSOConfiguration:function(){return ns},createSSOConfigurationByMetadata:function(){return as},createSSODomain:function(){return ls},createSSOGroup:function(){return ys},createSamlGroup:function(){return Al},createTenantAccessToken:function(){return Kl},createUserAccessToken:function(){return Wl},deleteAllSessionsForUser:function(){return $l},deleteDomainRestriction:function(){return nr},deleteIPRestriction:function(){return sr},deleteSSOConfiguration:function(){return os},deleteSSODomain:function(){return ss},deleteSSOGroup:function(){return gs},deleteSamlGroup:function(){return Tl},deleteSessionForUser:function(){return Nl},deleteTenantAccessToken:function(){return Vl},deleteTenantApiToken:function(){return Hl},deleteUserAccessToken:function(){return jl},deleteUserApiToken:function(){return Jl},disableMFAAuthenticatorApp:function(){return Yr},disableMFASMS:function(){return Xr},disableMFAWebAuthn:function(){return el},disableMfa:function(){return Jr},enrollMFAAuthenticatorApp:function(){return Kr},enrollMFAAuthenticatorAppForLogin:function(){return il},enrollMFASMS:function(){return Br},enrollMFASMSForLogin:function(){return rl},enrollMFAWebAuthn:function(){return qr},enrollMFAWebAuthnForLogin:function(){return ul},enrollMfa:function(){return jr},exchangeOAuthTokens:function(){return hs},forgotPassword:function(){return $r},generateLoginResponse:function(){return mr},generateLoginResponseFromOAuthResponse:function(){return Ar},generateLoginResponseV2:function(){return br},getActivateAccountStrategy:function(){return Er},getCaptchaPolicy:function(){return qa},getCurrentUserSession:function(){return Rl},getCurrentUserSessions:function(){return Dl},getDomainRestrictions:function(){return Xa},getDomainRestrictionsConfig:function(){return Za},getGlobalSecurityPolicy:function(){return Va},getIPRestrictions:function(){return ir},getIPRestrictionsConfig:function(){return or},getLockoutPolicy:function(){return Ga},getMFADevices:function(){return tl},getMFAStrategiesConfig:function(){return Cs},getMfaPolicy:function(){return ja},getOidcConfiguration:function(){return Pl},getPasswordConfigPolicy:function(){return Qa},getPasswordHistoryPolicy:function(){return Ha},getSSOConfigurations:function(){return ts},getSSODefaultRoles:function(){return us},getSSOGroups:function(){return ps},getSSOPublicConfiguration:function(){return Il},getSamlConfiguration:function(){return fl},getSamlRoles:function(){return hl},getSamlRolesGroups:function(){return ml},getSamlVendorConfiguration:function(){return pl},getSessionConfigurations:function(){return Ul},getSocialLoginProviders:function(){return Ll},getSocialLoginProvidersV2:function(){return wl},getTenantAccessTokensData:function(){return xl},getTenantApiTokensData:function(){return Bl},getUserAccessTokensData:function(){return Fl},getUserApiTokensData:function(){return Gl},getUserById:function(){return Yl},getVendorConfig:function(){return El},getVendorLockoutPolicy:function(){return Ba},getVendorMfaPolicy:function(){return Wa},getVendorPasswordHistoryPolicy:function(){return Ja},getVendorPublicAuthStrategiesConfig:function(){return Es},loadPasswordConfig:function(){return xr},login:function(){return Lr},loginViaSocialLogin:function(){return Ol},loginWithMfa:function(){return wr},logout:function(){return Mr},oidcPostLogin:function(){return Ir},oidcPostLoginV2:function(){return vs},passwordlessPostLogin:function(){return Zl},passwordlessPreLogin:function(){return Xl},postLogin:function(){return Pr},preDisableMFASMS:function(){return Qr},preDisableMFAWebAuthn:function(){return Zr},preEnrollMFAAuthenticatorApp:function(){return Wr},preEnrollMFAAuthenticatorAppForLogin:function(){return nl},preEnrollMFASMS:function(){return Gr},preEnrollMFASMSForLogin:function(){return al},preEnrollMFAWebAuthn:function(){return zr},preEnrollMFAWebAuthnForLogin:function(){return cl},preLogin:function(){return kr},preLoginV2:function(){return Ss},preLoginWithIdpType:function(){return Tr},preVerifyMFASMSForLogin:function(){return ll},preVerifyMFAWebAuthnForLogin:function(){return dl},recoverMfaToken:function(){return Vr},refreshToken:function(){return _r},refreshTokenV2:function(){return Ur},resendActivationEmail:function(){return Cr},resendInvitationEmail:function(){return Dr},resetPassword:function(){return Fr},resetPhoneNumber:function(){return bs},revokeSessionsForUser:function(){return _l},saveLockoutPolicy:function(){return za},saveMfaPolicy:function(){return Ka},savePasswordHistoryPolicy:function(){return Ya},setSSODefaultRoles:function(){return ds},signUpUser:function(){return Cl},silentOAuthRefreshToken:function(){return ms},testCurrentIp:function(){return cr},testCurrentIpInAllowList:function(){return ur},updateDomainRestrictionConfig:function(){return tr},updateIPRestrictionConfig:function(){return lr},updateSSOConfiguration:function(){return is},updateSSOConfigurationByMetadata:function(){return rs},updateSSOGroup:function(){return fs},updateSamlConfiguration:function(){return gl},updateSamlGroup:function(){return kl},updateSamlRoles:function(){return bl},updateSamlVendorMetadata:function(){return Sl},updateTenantApiTokensData:function(){return ql},updateUserApiTokensData:function(){return zl},validateSSODomain:function(){return cs},validateSamlDomain:function(){return vl},verifyChangePhoneNumber:function(){return Ts},verifyInviteToken:function(){return es},verifyMFAAuthenticatorAppForLogin:function(){return ol},verifyMFASMSForLogin:function(){return sl},verifyMFAWebAuthnForLogin:function(){return yl},verifyMfa:function(){return Hr},verifyNewDeviceSession:function(){return Os},verifyResetPhoneNumber:function(){return As},webAuthnCreateNewDeviceSession:function(){return ws},webAuthnPostLogin:function(){return Ls},webAuthnPreLogin:function(){return Is}});var a={};n.r(a),n.d(a,{addUser:function(){return Ns},changePassword:function(){return Us},createInviteUserLink:function(){return xs},deleteInviteUserLink:function(){return js},deleteUser:function(){return $s},getInviteLinkConfiguration:function(){return Ks},getInviteUserLink:function(){return Ws},getProfile:function(){return Ds},loadAvailablePermissions:function(){return Bs},loadAvailableRoles:function(){return Gs},loadStats:function(){return zs},loadUsers:function(){return Ms},resendActivationLink:function(){return qs},resendInvitationLink:function(){return Hs},resendInvitationLinkToAllTenants:function(){return Js},updateInviteUserLink:function(){return Vs},updateProfile:function(){return Rs},updateProfileImage:function(){return _s},updateUser:function(){return Fs}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return ec},getCurrentUserIpMetadata:function(){return Qs},getIpAdressMetadata:function(){return tc},getNotificationsMetadata:function(){return Xs},getSamlMetadata:function(){return Zs}});var l={};n.r(l),n.d(l,{downloadReport:function(){return cc},getReport:function(){return rc},getReports:function(){return ac},renderReport:function(){return lc},scheduleReport:function(){return sc},sendReport:function(){return uc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return dc},markAllAsRead:function(){return gc},updateNotificationIsPinned:function(){return fc},updateNotificationStatus:function(){return yc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return hc},getAudits:function(){return Sc},getAuditsStats:function(){return vc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Rc},deleteEmailSubscriptions:function(){return Cc},deleteSMSConfiguration:function(){return Fc},deleteSMSSubscriptions:function(){return Nc},deleteSlackConfiguration:function(){return Ic},deleteWebhooksConfiguration:function(){return jc},getCategories:function(){return Bc},getChannelMaps:function(){return zc},getEmailConfiguration:function(){return wc},getSMSConfiguration:function(){return _c},getSlackChannels:function(){return Tc},getSlackConfiguration:function(){return Ac},getSlackScope:function(){return kc},getWebhookLog:function(){return Wc},getWebhooksConfigurations:function(){return xc},patchEmailConfiguration:function(){return Ec},patchSMSConfiguration:function(){return Mc},postEmailConfiguration:function(){return Oc},postSMSConfiguration:function(){return Uc},postSlackCode:function(){return Lc},postSlackConfiguration:function(){return Pc},postWebhookRetry:function(){return Gc},postWebhookTest:function(){return Kc},postWebhooksConfiguration:function(){return Vc},putEmailSubscriptions:function(){return Dc},putSMSSubscriptions:function(){return $c}});var d={};n.r(d),n.d(d,{getSettings:function(){return Hc},updateSettings:function(){return qc}});var y={};n.r(y),n.d(y,{addRole:function(){return Zc},attachPermissionToRoles:function(){return ou},attachPermissionsToRole:function(){return nu},deleteRole:function(){return eu},getPermissionCategories:function(){return au},getPermissions:function(){return iu},getRoles:function(){return Xc},updateRole:function(){return tu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return $u},ISubscriptionStatus:function(){return Mu},PaymentMethodType:function(){return Nu},ProviderType:function(){return Fu},TenantCreatedAction:function(){return Vu},TrialEndAction:function(){return xu},cancelManagedSubscription:function(){return fu},cancelSubscription:function(){return su},createStripeCustomer:function(){return wu},createStripePaymentMethodSetupIntentSecret:function(){return Eu},createSubscription:function(){return Iu},createTenantConfiguration:function(){return Ru},getManagedSubscription:function(){return du},getManagedSubscriptions:function(){return yu},getPaymentMethod:function(){return Tu},getPaymentMethods:function(){return ku},getPaymentProviders:function(){return _u},getStripeCustomer:function(){return Lu},getStripePaymentProviderConfiguration:function(){return Ou},getSubscription:function(){return lu},getSubscriptionInvoice:function(){return mu},getSubscriptionInvoicePdf:function(){return bu},getSubscriptionInvoices:function(){return hu},getSubscriptionPlan:function(){return vu},getSubscriptionPlans:function(){return Su},getSubscriptionSummaries:function(){return Cu},getSubscriptions:function(){return ru},getTenantConfiguration:function(){return Du},getVendorPublicConfigurations:function(){return Uu},renewManagedSubscription:function(){return gu},renewSubscription:function(){return cu},updateManagedSubscription:function(){return pu},updatePaymentMethodBillingDetails:function(){return Pu},updateSubscription:function(){return uu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return zu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Yu},addUserToTenantAndSubTenants:function(){return Hu},loadAllUsers:function(){return qu},removeUserFromTenantAndSubTenants:function(){return Ju},removeUserRolesFromSubTenants:function(){return Qu},setUserRolesForSubTenants:function(){return Xu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Zu}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return od},createConfiguration:function(){return nd},deleteConfiguration:function(){return id},getConfigs:function(){return ed},updateConfiguration:function(){return td}});var h={};n.r(h),n.d(h,{impersonate:function(){return ad}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return yr},ContextHolder:function(){return qo},FronteggApiError:function(){return Jo},FronteggContext:function(){return Ho},ISubscriptionCancellationPolicy:function(){return $u},ISubscriptionStatus:function(){return Mu},MFAStrategyEnum:function(){return Ku},PaymentMethodType:function(){return Nu},ProviderType:function(){return Fu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return yd},SecondaryAuthStrategy:function(){return ju},SocialLoginProviders:function(){return dr},TenantType:function(){return Bu},UserManagedByEnum:function(){return Gu},WebAuthnDeviceType:function(){return Wu},api:function(){return fd},countConfigurationUsers:function(){return od},createConfiguration:function(){return nd},default:function(){return gd},deleteConfiguration:function(){return id},fetch:function(){return e},fronteggAuthApiRoutes:function(){return ld},fronteggLogoutApiRoutes:function(){return rd},fronteggRefreshTokenUrl:function(){return sd},fronteggSilentRefreshTokenUrl:function(){return cd},fronteggTenantsUrl:function(){return dd},fronteggUsersUrl:function(){return ud},getConfigs:function(){return ed},loadFeatureFlags:function(){return Zu},updateConfiguration:function(){return td}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(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 T(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return vT},ApiTokensMethods:function(){return IT},DomainRestrictionsTabFields:function(){return TT},GeneralSettingsTabFields:function(){return AT},InviteUserModalFields:function(){return ST},IpRestrictionsTabFields:function(){return kT},Metadata:function(){return cT},PrivacyPageFields:function(){return pT},ProfilePageFields:function(){return gT},SecurityPageTabs:function(){return mT},SessionManagementTabFields:function(){return bT},SsoPageTabs:function(){return PT},SubscriptionsPageFields:function(){return hT},fieldAppearance:function(){return LT},tabAppearance:function(){return wT}});var P=function(){function e(){A(this,e)}return T(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 I(){return I=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},I.apply(this,arguments)}function L(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 w(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){L(a,i,o,r,l,"next",e)}function l(e){L(a,i,o,r,l,"throw",e)}r(void 0)}))}}P._apps={};var O=n(841),E=n.n(O);function C(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 D(e){return!!e&&!!e[ve]}function R(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)===he}(e)||Array.isArray(e)||!!e[Se]||!!e.constructor[Se]||F(e)||x(e))}function _(e,t,n){void 0===n&&(n=!1),0===U(e)?(n?Object.keys:me)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function U(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:F(e)?2:x(e)?3:0}function M(e,t){return 2===U(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(e,t,n){var i=U(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function F(e){return ye&&e instanceof Map}function x(e){return fe&&e instanceof Set}function V(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=be(e);delete t[ve];for(var n=me(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 W(e,t){return void 0===t&&(t=!1),G(e)||D(e)||!R(e)||(U(e)>1&&(e.set=e.add=e.clear=e.delete=K),Object.freeze(e),t&&_(e,(function(e,t){return W(t,!0)}),!0)),e}function K(){C(2)}function G(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function B(e){var t=Ae[e];return t||C(18,e),t}function z(){return ue}function q(e,t){t&&(B("Patches"),e.u=[],e.s=[],e.v=t)}function H(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===ue&&(ue=e.l)}function Y(e){return ue={p:[],l:ue,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function X(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||B("ES5").S(t,e,i),i?(n[ve].P&&(H(t),C(4)),R(e)&&(e=Z(t,e),t.l||te(t,e)),t.u&&B("Patches").M(n[ve].t,e,t.u,t.s)):e=Z(t,n,[]),H(t),t.u&&t.v(t.u,t.s),e!==pe?e:void 0}function Z(e,t,n){if(G(t))return t;var i=t[ve];if(!i)return _(t,(function(o,a){return ee(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return te(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;_(3===i.i?new Set(o):o,(function(t,a){return ee(e,i,o,t,a,n)})),te(e,o,!1),n&&e.u&&B("Patches").R(i,n,e.u,e.s)}return i.o}function ee(e,t,n,i,o,a){if(D(o)){var r=Z(e,o,a&&t&&3!==t.i&&!M(t.D,i)?a.concat(i):void 0);if(N(n,i,r),!D(r))return;e.m=!1}if(R(o)&&!G(o)){if(!e.h.F&&e._<1)return;Z(e,o),t&&t.A.l||te(e,o)}}function te(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ne(e,t){var n=e[ve];return(n?V(n):e)[t]}function ie(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 oe(e){e.P||(e.P=!0,e.l&&oe(e.l))}function ae(e){e.o||(e.o=j(e.t))}function re(e,t,n){var i=F(t)?B("MapSet").N(t,n):x(t)?B("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=ke;n&&(o=[i],a=Te);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):B("ES5").J(t,n);return(n?n.A:z()).p.push(i),i}function le(e){return D(e)||C(22,e),function e(t){if(!R(t))return t;var n,i=t[ve],o=U(t);if(i){if(!i.P&&(i.i<4||!B("ES5").K(i)))return i.t;i.I=!0,n=se(t,o),i.I=!1}else n=se(t,o);return _(n,(function(t,o){i&&function(e,t){return 2===U(e)?e.get(t):e[t]}(i.t,t)===o||N(n,t,e(o))})),3===o?new Set(n):n}(e)}function se(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var ce,ue,de="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ye="undefined"!=typeof Map,fe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,pe=de?Symbol.for("immer-nothing"):((ce={})["immer-nothing"]=!0,ce),Se=de?Symbol.for("immer-draftable"):"__$immer_draftable",ve=de?Symbol.for("immer-state"):"__$immer_state",he=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),me="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,be=Object.getOwnPropertyDescriptors||function(e){var t={};return me(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},ke={get:function(e,t){if(t===ve)return e;var n=V(e);if(!M(n,t))return function(e,t,n){var i,o=ie(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||!R(i)?i:i===ne(e.t,t)?(ae(e),e.o[t]=re(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=ie(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ne(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||M(e.t,t)))return!0;ae(e),oe(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!==ne(e.t,t)||t in e.t?(e.D[t]=!1,ae(e),oe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(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(){C(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){C(12)}},Te={};_(ke,(function(e,t){Te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Te.deleteProperty=function(e,t){return Te.set.call(this,e,t,void 0)},Te.set=function(e,t,n){return ke.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,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&&C(6),void 0!==i&&"function"!=typeof i&&C(7),R(e)){var l=Y(t),s=re(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?H(l):J(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return q(l,i),X(e,l)}),(function(e){throw H(l),e})):(q(l,i),X(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===pe&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];B("Patches").M(e,r,u,d),i(u,d)}return r}C(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){R(e)||C(8),D(e)&&(e=le(e));var t=Y(this),n=re(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return q(n,t),X(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&C(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=B("Patches").$;return D(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ie=new Pe,Le=Ie.produce,we=(Ie.produceWithPatches.bind(Ie),Ie.setAutoFreeze.bind(Ie),Ie.setUseProxies.bind(Ie),Ie.applyPatches.bind(Ie),Ie.createDraft.bind(Ie),Ie.finishDraft.bind(Ie),Le);function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function De(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 Re="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ue={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function Me(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 Ne(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(De(1));return n(Ne)(e,t)}if("function"!=typeof e)throw new Error(De(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(De(3));return a}function d(e){if("function"!=typeof e)throw new Error(De(4));if(s)throw new Error(De(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(De(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Me(e))throw new Error(De(7));if(void 0===e.type)throw new Error(De(8));if(s)throw new Error(De(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(De(10));o=e,y({type:Ue.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(De(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Re]=function(){return this},e}return y({type:Ue.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Re]=g,i}function $e(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:Ue.INIT}))throw new Error(De(12));if(void 0===n(void 0,{type:Ue.PROBE_UNKNOWN_ACTION()}))throw new Error(De(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(De(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Fe(){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 xe(){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(De(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Fe.apply(void 0,a)(n.dispatch),Ce(Ce({},n),{},{dispatch:i})}}}function Ve(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 je=Ve();je.withExtraArgument=Ve;var We,Ke=je,Ge=(We=function(e,t){return We=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])},We(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}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Be=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},ze=Object.defineProperty,qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),He=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))He.call(t,n)&&Ye(e,n,t[n]);if(qe)for(var i=0,o=qe(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Xe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Ze=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 Ge(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,Be([void 0],e[0].concat(this)))):new(t.bind.apply(t,Be([void 0],e.concat(this))))},t}(Array);function et(e){return R(e)?we(e,(function(){})):e}function tt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Ze);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Ke):i.push(Ke.withExtraArgument(n.extraArgument))),i}function nt(e){var t,n=function(e){return tt(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=$e(a)}var g=l;"function"==typeof g&&(g=g(n));var p=xe.apply(void 0,g),S=Fe;c&&(S=Xe(Qe({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Be([p],f):"function"==typeof f&&(v=f(v)),Ne(t,d,S.apply(void 0,v))}function it(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 Qe(Qe({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 ot(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 at(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:et(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ot(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=Qe(Qe({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ot(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return et(e())};else{var c=et(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Be([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(D(e))return void 0===(i=n(e,t))?e:i;if(R(e))return we(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?it(c,i):it(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 rt="listenerMiddleware";it(rt+"/add"),it(rt+"/removeAll"),it(rt+"/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[ve];return ke.get(t,e)},set:function(t){var n=this[ve];ke.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&oe(o);break;case 4:n(o)&&oe(o)}}}function n(e){for(var t=e.t,n=e.k,i=me(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!M(t,a))return!0;var l=n[a],s=l&&l[ve];if(s?s.t!==r:!$(l,r))return!0}}var c=!!t[ve];return i.length!==me(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){Ae[e]||(Ae[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=be(n);delete a[ve];for(var r=me(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:z(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?D(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)_(a,(function(t){t!==ve&&(void 0!==o[t]||M(o,t)?r[t]||e(a[t]):(r[t]=!0,oe(n)))})),_(o,(function(e){void 0!==a[e]||M(a,e)||(r[e]=!1,oe(n))}));else if(5===l){if(i(n)&&(oe(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 lt=(e,t)=>n=>I({},n,{[e]:t[e]}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),ct=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return I({},n,{[e]:I({},n[e],{[t]:I({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{loaders:I({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{errors:I({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),yt=(e=500)=>new Promise((t=>setTimeout(t,e))),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",gt=new Uint8Array(256);for(let e=0;e<ft.length;e++)gt[ft.charCodeAt(e)]=e;const pt=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=gt[e.charCodeAt(i)],a=gt[e.charCodeAt(i+1)],r=gt[e.charCodeAt(i+2)],l=gt[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},St=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(St(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+=ft[t[i]>>2],o+=ft[(3&t[i])<<4|t[i+1]>>4],o+=ft[(15&t[i+1])<<2|t[i+2]>>6],o+=ft[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]=St(e[n]);return t}return e};let vt,ht,mt;!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"}(vt||(vt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(ht||(ht={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(mt||(mt={}));const bt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",At="HOSTED_LOGIN_VERIFIER_KEY",kt="auth",Tt="connectivity",Pt="auditLogs",It="vendor",Lt={flow:ht.Login,step:vt.preLogin,loading:!1,email:"",tenants:[]},wt={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},Ot={requestAuthorize:it("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:it("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:it("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:it("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:it("auth/afterAuthNavigation"),preLogin:it("auth/preLogin",(e=>({payload:e}))),postLogin:it("auth/postLogin",(e=>({payload:e}))),login:it("auth/login",(e=>({payload:e}))),loginWithMfa:it("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:it("auth/recoverMfa",(e=>({payload:e}))),logout:it("auth/logout",(e=>({payload:e}))),silentLogout:it("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:it("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:it("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:it("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:it("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:it("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:it("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:it("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:it("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:it("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:it("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:it("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:it("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:it("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:it("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:it("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:it("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:it("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:it("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:it("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:it("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:it("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Et;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Et||(Et={}));const Ct={step:Et.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Dt={setActivateState:st("activateState"),resetActivateState:lt("activateState",{activateState:Ct}),setActivateStrategyState:ct("activateState","activationStrategy")},Rt={activateAccount:it("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:it("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:it("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:it("auth/resendActivationEmail",(e=>({payload:e})))};let _t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(_t||(_t={}));const Ut={step:_t.validate},Mt={setAcceptInvitationState:st("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ut})},Nt={acceptInvitation:it("auth/acceptInvitation",(e=>({payload:e})))};let $t;!function(e){e.forgotPassword="forgotPassword",e.success="success"}($t||($t={}));const Ft={step:$t.forgotPassword,loading:!1,email:"",passwordConfig:null},xt={setForgotPasswordState:st("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Ft})},Vt={forgotPassword:it("auth/forgotPassword",(e=>({payload:e}))),resetPassword:it("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:it("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Wt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:st("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Wt})},Gt={resetPhoneNumber:it("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:it("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:it("auth/changePhoneNumber",(e=>({payload:e})))},Bt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},zt={setSSOLoader:ut("ssoState"),setSSOError:dt("ssoState"),setSSOState:st("ssoState"),resetSSOState:lt("ssoState",{ssoState:Bt})},qt={loadSSOConfigurationsV2:it("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:it("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:it("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:it("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:it("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:it("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:it("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:it("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:it("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:it("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:it("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:it("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:it("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:it("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:it("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:it("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:it("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:it("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:it("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:it("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:it("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:it("auth/oidcPostlogin",(e=>({payload:e})))},Ht={loading:!1,error:null},Jt={setProfileState:st("profileState"),resetProfileState:lt("profileState",{profileState:Ht})},Yt={loadProfile:it("auth/loadProfile"),saveProfile:it("auth/saveProfile",(e=>({payload:e}))),changePassword:it("auth/changePassword",(e=>({payload:e})))};let Qt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Qt||(Qt={}));const Xt={step:Qt.verify,loading:!1,saving:!1},Zt={setMfaState:st("mfaState"),resetMfaState:lt("mfaState",{mfaState:Xt})},en={enrollMfa:it("auth/enrollMfa"),getMFADevices:it("auth/getMFADevices"),getMFAStrategies:it("auth/getMFAStrategies"),verifyMfa:it("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:it("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:it("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:it("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:it("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:it("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:it("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:it("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:it("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:it("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:it("auth/disableMfaWebAuthn",(e=>({payload:e})))},tn={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}},nn={setTeamLoader:ut("teamState"),setTeamError:dt("teamState"),setTeamState:st("teamState"),resetTeamState:lt("teamState",{teamState:tn})},on={loadUsers:it("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:it("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:it("auth/loadRoles",(e=>({payload:e}))),addUser:it("auth/addUser",(e=>({payload:e}))),addUsersBulk:it("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:it("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:it("auth/updateUser",(e=>({payload:e}))),deleteUser:it("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:it("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:it("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:it("auth/lockUser",(e=>({payload:e}))),resendActivationLink:it("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:it("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:it("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:it("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:it("auth/getInvitationLink"),createInvitationLink:it("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:it("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:it("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:it("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:it("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:it("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:it("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:it("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:it("auth/closeLockUserDialog",(e=>({payload:e})))},an={firstLoad:!0,loading:!1,error:""},rn={setSocialLoginsState:st("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:an})},ln={loadSocialLoginsConfiguration:it("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:it("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:it("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:it("auth/setSocialLoginError",(e=>({payload:e})))};let sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(sn||(sn={}));const cn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:sn.SignUp},un={setSignUpState:st("signUpState"),resetSignUpState:lt("signUpState",{signUpState:cn})},dn={signUpUser:it("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:it("auth/resetSignUpStateSoft")},yn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},fn={setApiTokensLoader:ut("apiTokensState"),setApiTokensError:dt("apiTokensState"),setApiTokensState:st("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:yn})},gn={loadApiTokens:it("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:it("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:it("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:it("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:it("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:it("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:it("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:it("auth/deleteTenantApiToken",(e=>({payload:e})))},pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Sn={setSecurityPolicyState:st("securityPolicyState"),setSecurityPolicyGlobalState:ct("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ct("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ct("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ct("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ct("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ct("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ct("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ct("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ct("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ct("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ct("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:pn})},vn={loadSecurityPolicy:it("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:it("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:it("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:it("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:it("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:it("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:it("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:it("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:it("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:it("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:it("auth/loadPublicAuthStrategiesPolicy")},hn={loading:!1},mn={setAccountSettingsState:st("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:hn})},bn={loadAccountSettings:it("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:it("auth/saveAccountSettings",(e=>({payload:e})))},An={tenants:[],subTenants:[],loading:!0,tenantTree:null},kn={setTenantsState:st("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:An})},Tn={switchTenant:it("auth/switchTenant",(e=>({payload:e}))),loadTenants:it("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:it("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:it("auth/loadSubTenantsTree",(e=>({payload:e})))},Pn={loading:!1,roles:[],permissions:[],permissionCategories:[]},In={setRolesState:st("rolesState"),resetRolesState:lt("rolesState",{rolesState:Pn})},Ln={loadRolesAndPermissions:it("auth/loadRoles",(e=>({payload:e}))),addRole:it("auth/addRole",(e=>({payload:e}))),updateRole:it("auth/updateRole",(e=>({payload:e}))),deleteRole:it("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:it("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:it("auth/attachPermissionToRoles",(e=>({payload:e})))},wn={loading:!1,sessions:[]},On={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:wn})},En={loadUserSessions:it("auth/loadUserSessions"),loadCurrentUserSession:it("auth/loadCurrentUserSession"),deleteUserSession:it("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:it("auth/deleteAllUserSessions"),revokeUserSessions:it("auth/revokeUserSessions",(e=>({payload:e})))},Cn={loading:!1,configurations:{}},Dn={setSessionsPolicyState:st("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Cn})},Rn={loadSessionsPolicy:it("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:it("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let _n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(_n||(_n={}));const Un={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:_n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Mn={setRestrictionsState:st("restrictionsState"),setIpRestrictionsState:ct("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ct("restrictionsState","emailDomainRestrictions")},Nn={checkIfUserIpValid:it("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:it("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:it("auth/loadIpRestrictions"),saveIpRestriction:it("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:it("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:it("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:it("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:it("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:it("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:it("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},$n={loading:!1},Fn={setProvisioningState:st("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:$n})},xn={loadProvisionConnections:it("auth/loadProvisionConnections"),createProvisionConnection:it("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:it("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:it("auth/updateProvisionConnection",(e=>({payload:e})))},Vn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:cn,loginState:Lt,activateState:Ct,acceptInvitationState:Ut,forgotPasswordState:Ft,ssoState:Bt,profileState:Ht,mfaState:Xt,teamState:tn,socialLoginState:an,apiTokensState:yn,securityPolicyState:pn,accountSettingsState:hn,tenantsState:An,rolesState:Pn,resetPhoneNumberState:Wt,sessionsState:wn,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",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:()=>{}},Vn);let Wn;!function(e){e.impersonating="impersonating",e.success="success"}(Wn||(Wn={}));const Kn={step:Wn.impersonating,loading:!1},Gn={setImpersonateState:st("impersonateState"),resetImpersonateState:lt("impersonateState",{impersonateState:Kn})},Bn={impersonate:it("impersonation/impersonate",(e=>({payload:e})))},{reducer:zn,actions:qn}=at({name:kt,initialState:jn,reducers:I({resetState:e=>I({},e,Vn),setState:(e,{payload:t})=>I({},e,t),setUser:("user",(e,{payload:t})=>I({},e,{user:t}))},wt,rn,Dt,Gn,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,On,Dn,Mn,Fn)});const Hn=I({},qn,Ot,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,En,Rn,Nn,xn,Bn);var Jn=function(e){return"@@redux-saga/"+e},Yn=Jn("CANCEL_PROMISE"),Qn=Jn("CHANNEL_END"),Xn=Jn("IO"),Zn=Jn("MATCH"),ei=Jn("MULTICAST"),ti=Jn("SAGA_ACTION"),ni=Jn("SELF_CANCELLATION"),ii=Jn("TASK"),oi=Jn("TASK_CANCEL"),ai=Jn("TERMINATE"),ri=Jn("LOCATION");function li(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 si=function(e){return null==e},ci=function(e){return null!=e},ui=function(e){return"function"==typeof e},di=function(e){return"string"==typeof e},yi=Array.isArray,fi=function(e){return e&&ui(e.then)},gi=function(e){return e&&ui(e.next)&&ui(e.throw)},pi=function e(t){return t&&(di(t)||hi(t)||ui(t)||yi(t)&&t.every(e))},Si=function(e){return e&&ui(e.take)&&ui(e.close)},vi=function(e){return ui(e)&&e.hasOwnProperty("toString")},hi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},mi=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[Yn]=function(){clearTimeout(n)},i},bi=function(e){return function(){return e}},Ai=bi(!0),ki=function(){},Ti=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Pi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ii(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Li=function(e){throw e},wi=function(e){return{value:e,done:!0}};function Oi(e,t,n){void 0===t&&(t=Li),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:wi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ei(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ci=function(e){return Array.apply(null,new Array(e))},Di=function(e){return function(t){return e(Object.defineProperty(t,ti,{value:!0}))}},Ri=function(e){return e===ai},_i=function(e){return e===oi},Ui=function(e){return Ri(e)||_i(e)};function Mi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=yi(e)?Ci(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ui(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=ki,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ni(e){return{name:e.name||"anonymous",location:$i(e)}}function $i(e){return e[ri]}var Fi=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)},xi="TAKE",Vi="CALL",ji="FORK",Wi="SELECT",Ki=function(e,t){var n;return(n={})[Xn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Gi(e,t){return void 0===e&&(e="*"),pi(e)?(ci(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ki(xi,{pattern:e})):Si(n=e)&&n[ei]&&ci(t)&&pi(t)?Ki(xi,{channel:e,pattern:t}):Si(e)?(ci(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ki(xi,{channel:e})):void 0;var n}function Bi(e,t){return si(t)&&(t=e,e=void 0),Ki("PUT",{channel:e,action:t})}function zi(e){var t=Ki("ALL",e);return t.combinator=!0,t}function qi(e,t){var n,i=null;return ui(e)?n=e:(yi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&di(n)&&ui(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Hi(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 Ki(Vi,qi(e,n))}function Ji(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(ji,qi(e,n))}function Yi(e){return void 0===e&&(e=ni),Ki("CANCEL",e)}function Qi(e){void 0===e&&(e=Ti);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(Wi,{selector:e,args:n})}var Xi=Hi.bind(null,mi);var Zi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},eo=[],to=0;function no(e){try{ao(),e()}finally{ro()}}function io(e){eo.push(e),to||(ao(),lo())}function oo(e){try{return ao(),e()}finally{lo()}}function ao(){to++}function ro(){to--}function lo(){var e;for(ro();!to&&void 0!==(e=eo.shift());)no(e)}var so=function(e){return function(t){return e.some((function(e){return go(e)(t)}))}},co=function(e){return function(t){return e(t)}},uo=function(e){return function(t){return t.type===String(e)}},yo=function(e){return function(t){return t.type===e}},fo=function(){return Ai};function go(e){var t="*"===e?fo:di(e)?uo:yi(e)?so:vi(e)?uo:ui(e)?co:hi(e)?yo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var po={type:Qn},So=function(e){return e&&e.type===Qn};function vo(){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(po)}))},(e={})[ei]=!0,e.put=function(e){if(!t)if(So(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Zn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=fo),t?e(po):(e[Zn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ii(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[ti]?l(e):io((function(){l(e)}))},r}function ho(e,t){var n=e[Yn];ui(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var mo,bo=0,Ao=function(){return++bo};function ko(e){e.isRunning()&&e.cancel()}var To=((mo={}).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):!So(e)||r?n(e):n(ai)};try{o.take(l,ci(a)?go(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},mo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;io((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&fi(t)?ho(t,n):n(t)}))},mo.ALL=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t);if(0!==r.length){var l=Mi(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(yi(t)?[]:{})},mo.RACE=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t),l=yi(t)?Ci(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ui(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=ki,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)}))},mo.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(fi(s))return void ho(s,n);if(gi(s))return void _o(e,s,l.context,bo,Ni(a),!1,n);n(s)}catch(e){n(e,!0)}},mo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){si(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},mo.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(gi(o))return o;var a=!1;return Oi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!fi(o)})}))}catch(e){return Oi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ni(t)}(c,a);oo((function(){var t=_o(e,c,s.context,bo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},mo.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()&&Ii(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(yi(t)){if(0===t.length)return void n([]);var r=Mi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},mo.CANCEL=function(e,t,n,i){var o=i.task;t===ni?ko(o):yi(t)?t.forEach(ko):ko(t),n()},mo.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)}},mo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Fi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(po):e.isEmpty()?(n.push(i),i.cancel=function(){Ii(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(po):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])(po)}}}}(t.buffer),a=go(i),r=function t(n){So(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)},mo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},mo.FLUSH=function(e,t,n){t.flush(n)},mo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},mo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Pi(o.context,t),n()},mo);function Po(e,t){return e+"?"+t}function Io(e){var t=e.name,n=e.location;return n?t+" "+Po(n.fileName,n.lineNumber):t}function Lo(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 wo=null,Oo=[],Eo=function(e){e.crashedEffect=wo,Oo.push(e)},Co=function(){wo=null,Oo.length=0},Do=function(){var e,t,n=Oo[0],i=Oo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=$i(e))?t.code+" "+Po(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Io(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Io(e.meta)})),[Lo(Oo)]).join("\n")};function Ro(e,t,n,i,o,a,r){var l;void 0===r&&(r=ki);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Ii(o,t),t.cont=ki,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=ki,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Eo({meta:o,cancelledTasks:y}),S.isRoot){var i=Do();Co(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===oi?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={})[ii]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(oi,!1))},l.cont=r,l.end=p,l.setContext=function(e){Pi(f,e)},l.toPromise=function(){return d||(d=Zi(),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 _o(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){fi(t)?ho(t,i):gi(t)?_o(e,t,c.context,n,o,!1,i):t&&t[Xn]?(0,To[t.type])(e,t.payload,i,u):i(t)}));d.cancel=ki;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(oi))},status:0},c=Ro(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),Co()):_i(e)?(s.status=1,d.cancel(),o=ui(t.return)?t.return(oi):{done:!0,value:oi}):o=Ri(e)?ui(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=Ao();function s(n,o){a||(a=!0,i.cancel=ki,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){wo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=ki,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=ki,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Uo(e,t){for(var n=e.channel,i=void 0===n?vo():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?Ei:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Ao();if(s&&(s.rootSagaStarted=s.rootSagaStarted||ki,s.effectTriggered=s.effectTriggered||ki,s.effectResolved=s.effectResolved||ki,s.effectRejected=s.effectRejected||ki,s.effectCancelled=s.effectCancelled||ki,s.actionDispatched=s.actionDispatched||ki,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Fe.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Ti;var m={channel:i,dispatch:Di(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return oo((function(){var e=_o(m,S,l,v,Ni(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Mo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?vo():a,l=n.sagaMonitor,s=li(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Uo.bind(null,I({},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){Pi(o,e)},c},No=function(e){return{done:!0,value:e}},$o={};function Fo(e){return Si(e)?"channel":vi(e)?String(e):ui(e)?e.name:String(e)}function xo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===$o)return No(t);if(n&&!o)throw r=$o,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===$o?No(t):a}return Oi(l,(function(e){return l(null,e)}),n)}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Gi(e)},l=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Fo(e)+", "+t.name+")")}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Gi(e)},s=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Yi(e)}},u=function(e){return a=e},d=function(e){return r=e};return xo({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("+Fo(e)+", "+t.name+")")}function Wo(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:Gi(e)},l=function(e){return{done:!1,value:Hi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Fo(e)+", "+t.name+")")}function Ko(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:Hi.apply(void 0,[n].concat(a))},s={done:!1,value:Xi(t)};return xo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:$o}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Go(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Vo,e,t].concat(i))}function Bo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[jo,e,t].concat(i))}function zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Wo,e,t].concat(i))}class qo{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 qo.instance||(qo.instance=new qo),qo.instance}static setContext(e){qo.getInstance().context=e}static setAccessToken(e){qo.getInstance().accessToken=e}static setUser(e){qo.getInstance().user=e}static setOnRedirectTo(e){qo.getInstance().onRedirectTo=e}static setLogout(e,t){qo.getInstance().logout=n=>{n?e(n):qo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=qo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return qo.getInstance().accessToken}static getUser(){return qo.getInstance().user}static onRedirectTo(e,t){return qo.getInstance().onRedirectTo(e,t)}static logout(e){return qo.getInstance().logout(e)}}qo.instance=void 0;const Ho={getContext:()=>qo.getContext(),getAccessToken:()=>qo.getAccessToken(),getUser:()=>qo.getUser(),onRedirectTo:(e,t)=>qo.onRedirectTo(e,t),logout:e=>qo.logout(e)};class Jo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Yo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const Qo=async e=>{var t,n,i;const o=qo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:qo.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=Yo(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:I({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Jo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Jo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Xo=async(e,t,n)=>Qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Zo=async(e,t,n)=>Qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),ea=async(e,t,n)=>Qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ta=async(e,t,n)=>Qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),na=async(e,t,n)=>Qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),ia=async(e,t,n,i)=>Qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),oa={v1:"/identity/resources/users/webauthn/v1/devices"},aa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ra={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-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"}}},la={v1:"/identity/resources/configurations/v1"},sa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ca={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ua={v1:"/identity/resources/permissions/v1"},da={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},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"}}},ya={v1:"/identity/resources/roles/v1"},fa={v1:"/identity/resources/sub-tenants/users/v1"},ga={v1:"/identity/resources/impersonation/v1"},pa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Sa={v1:"/team/resources/members/v1"},va={v1:"/team/resources/roles/v1"},ha={v1:"/team/resources/stats/v1"},ma={v1:"/team/resources/profile"},ba={v1:"/tenants/resources/account-settings/v1"},Aa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ka={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ta={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"},Ia={v1:"/subscriptions/resources/subscriptions/v1"},La={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},wa={v1:"/reports/engine/resources/triggers/v1"},Oa="/notification",Ea="/audits",Ca={v1:"/event/resources/configurations/v1"},Da="/webhook",Ra="/oauth",_a="/flags",Ua="/directory/resources/v1/configurations/scim2",Ma="/directory/resources/scim/temp";async function Na(e){return ta(`${ra.v1}/tenant`,e)}async function $a(){return Xo(`${ra.v2}/me/tenants`)}async function Fa(){return Xo(Aa.v1)}async function xa(){return Xo(Aa.tree.v1)}async function Va(){return Xo(la.v1)}async function ja(){return Xo(`${la.v1}/mfa-policy`)}async function Wa(){return Xo(`${la.v1}/mfa-policy/vendor`)}async function Ka(e){return e.id?ea(`${la.v1}/mfa-policy`,e):Zo(`${la.v1}/mfa-policy`,e)}async function Ga(){return Xo(`${la.v1}/lockout-policy`)}async function Ba(){return Xo(`${la.v1}/lockout-policy/vendor`)}async function za(e){return e.id?ea(`${la.v1}/lockout-policy`,e):Zo(`${la.v1}/lockout-policy`,e)}async function qa(){try{return await Xo(`${la.v1}/captcha-policy/public`)}catch{return null}}async function Ha(){return Xo(`${la.v1}/password-history-policy`)}async function Ja(){return Xo(`${la.v1}/password-history-policy/vendor`)}async function Ya(e){return e.id?ea(`${la.v1}/password-history-policy`,e):Zo(`${la.v1}/password-history-policy`,e)}async function Qa(){return Xo(`${la.v1}/password`)}async function Xa(){return Xo(`${sa.emailDomain.v1}`)}async function Za(){return Xo(`${sa.emailDomain.v1}/config`)}async function er(e){return Zo(`${sa.emailDomain.v1}`,e)}async function tr(e){return Zo(`${sa.emailDomain.v1}/config`,e)}async function nr(e){return na(`${sa.emailDomain.v1}/${e}`)}async function ir(e){return Xo(`${sa.ip.v1}`,e)}async function or(){return Xo(`${sa.ip.v1}/config`)}async function ar(e){return Zo(`${sa.ip.v1}`,e)}async function rr(e){return Zo(`${sa.ip.v1}/bulk`,e)}async function lr(e){return Zo(`${sa.ip.v1}/config`,e)}async function sr(e){return na(`${sa.ip.v1}/${e}`)}async function cr(){return Zo(`${sa.ip.v1}/verify`)}async function ur(){return Zo(`${sa.ip.v1}/verify/allow`)}let dr,yr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(dr||(dr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(yr||(yr={}));class fr extends Error{constructor(e){super(e)}}const gr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new fr("'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 pr extends Error{constructor(e){super(e)}}const Sr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(gr(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 gr(t)}})(e.split(".")[n]))}catch(e){throw new pr("Invalid token specified: "+e.message)}},vr=["type"],hr=["type"];async function mr(e){if(!e.accessToken)return e;qo.setAccessToken(e.accessToken);const t=await Xo(`${ra.v2}/me`),n=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(n),n}async function br(e){if(!e.accessToken)return{user:e};qo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Xo(`${ra.v2}/me`),$a()]),i=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(i),{user:i,tenants:n}}async function Ar(e){qo.setAccessToken(e.id_token);const t=await Xo(`${ra.v2}/me`),n=e.id_token?Sr(e.id_token):{},i=I({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 qo.setUser(i),i}async function kr(e){try{const{address:t}=await Zo(`${aa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Tr(e){return Zo(`${aa.v1}/user/saml/prelogin`,e)}async function Pr(e){return mr(await Zo(`${aa.v1}/user/saml/postlogin`,e))}async function Ir(e){return mr(await Zo(`${aa.v1}/user/oidc/postlogin`,e))}async function Lr(e){return mr(await Zo(`${aa.v1}/user`,e))}async function wr(e){return mr(await Zo(`${aa.v1}/user/mfa/verify`,e))}async function Or(e){return Zo(`${ra.v1}/activate`,e)}async function Er(e){return Xo(`${ra.v1}/activate/strategy`,e)}async function Cr(e){return Zo(`${ra.v1}/activate/reset`,e)}async function Dr(e){return Zo(`${ra.v1}/invitation/reset`,e)}async function Rr(e){return Zo(`${ra.v1}/invitation/accept`,e)}async function _r(){return mr(await Zo(`${aa.v1}/user/token/refresh`))}async function Ur(){return br(await Zo(`${aa.v1}/user/token/refresh`))}async function Mr(){return Zo(`${aa.v1}/logout`)}async function Nr(e){return Xo(`${Ra}/logout`,e)}async function $r(e){return Zo(`${ra.v1}/passwords/reset`,e)}async function Fr(e){return Zo(`${ra.v1}/passwords/reset/verify`,e)}async function xr(e){return Xo(`${ra.v1}/passwords/config`,e)}async function Vr(e){return Zo(`${aa.v1}/user/mfa/recover`,e)}async function jr(){return Zo(`${ra.v1}/mfa/enroll`)}async function Wr(){return Zo(`${ra.v1}/mfa/authenticator/enroll`)}async function Kr(e){return Zo(`${ra.v1}/mfa/authenticator/enroll/verify`,e)}async function Gr(e){return Zo(`${ra.v1}/mfa/sms/enroll`,e)}async function Br(e){return Zo(`${ra.v1}/mfa/sms/enroll/verify`,e)}async function zr(){return Zo(`${ra.v1}/mfa/webauthn/enroll`)}async function qr(e){return Zo(`${ra.v1}/mfa/webauthn/enroll/verify`,e)}async function Hr(e){return Zo(`${ra.v1}/mfa/enroll/verify`,e)}async function Jr(e){return Zo(`${ra.v1}/mfa/disable`,e)}async function Yr(e,t){return Zo(`${ra.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Qr(e){return Zo(`${ra.v1}/mfa/sms/${e}/disable`)}async function Xr(e,t){return Zo(`${ra.v1}/mfa/sms/${e}/disable/verify`,t)}async function Zr(e){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable`)}async function el(e,t){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function tl(){return Xo(`${ra.v1}/mfa/devices`)}async function nl(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll`,e)}async function il(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ol(e,t){return Zo(`${aa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function al(e){return Zo(`${aa.v1}/user/mfa/sms/enroll`,e)}async function rl(e){return Zo(`${aa.v1}/user/mfa/sms/enroll/verify`,e)}async function ll(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}`,t)}async function sl(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}/verify`,t)}async function cl(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll`,e)}async function ul(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function dl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}`,t)}async function yl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function fl(){return Xo(`${pa.v1}/saml/configurations`)}async function gl(e){return Zo(`${pa.v1}/saml/configurations`,e)}async function pl(){return Xo(`${pa.v1}/saml/configurations/vendor-config`)}async function Sl(e){return ta(`${pa.v1}/saml/configurations/metadata`,e)}async function vl(){return ta(`${pa.v1}/saml/validations/domain`)}async function hl(){return Xo(`${pa.v1}/saml/configurations/roles/default`)}async function ml(){return Xo(`${pa.v2}/saml/configurations/groups`)}async function bl({roleIds:e}){return Zo(`${pa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Al({roleIds:e,group:t}){return Zo(`${pa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function kl({roleIds:e,group:t,id:n}){return ea(`${pa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Tl({id:e}){return na(`${pa.v2}/saml/configurations/groups/${e}`)}async function Pl(){return Xo(`${pa.v1}/oidc/configurations`)}async function Il(){return Xo(`${pa.v2}/configurations/public`)}async function Ll(){return Xo(ca.v1)}async function wl(){return Xo(ca.v2)}async function Ol({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),Zo(`${aa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function El(){return Xo(`${la.v1}/public`)}async function Cl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Zo(`${ra.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await mr(n):void 0,userId:i,tenantId:o}}async function Dl(){return Xo(ra.sessions.currentUser.v1)}async function Rl(){return Xo(`${ra.sessions.currentUser.v1}/current`)}async function _l(e){return Zo(`${ra.sessions.v1}/revoke`,{userId:e})}async function Ul(){return Xo(ra.sessions.configurations.v1)}async function Ml(e){await Zo(ra.sessions.configurations.v1,e)}async function Nl(e){await na(`${ra.sessions.currentUser.v1}/${e}`)}async function $l(){await na(`${ra.sessions.currentUser.v1}/all`)}async function Fl(){return Xo(ra.accessTokens.v1)}async function xl(){return Xo(da.accessTokens.v1)}async function Vl({id:e}){return na(`${da.accessTokens.v1}/${e}`)}async function jl({id:e}){return na(`${ra.accessTokens.v1}/${e}`)}async function Wl(e){return Zo(ra.accessTokens.v1,e)}async function Kl(e){return Zo(da.accessTokens.v1,e)}async function Gl(){return Xo(ra.apiTokens.v1)}async function Bl(){return Xo(da.apiTokens.v1)}async function zl(e){return Zo(ra.apiTokens.v1,e)}async function ql(e){return Zo(da.apiTokens.v2,e)}async function Hl({tokenId:e}){return na(`${da.apiTokens.v1}/${e}`)}async function Jl({tokenId:e}){return na(`${ra.apiTokens.v1}/${e}`)}async function Yl({userId:e}){return Xo(`${ra.v1}/${e}`)}async function Ql(e){return Xo(`${la.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Xl(e){let{type:t}=e,n=li(e,vr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Zl(e){let{type:t}=e,n=li(e,hr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function es({token:e}){return Zo(da.invites.verify.v1,{token:e})}async function ts(){return Xo(`${pa.v1}/configurations`)}async function ns(e){return Zo(`${pa.v1}/configurations`,e)}async function is(e,t){return ea(`${pa.v1}/configurations/${e}`,t)}async function os(e){return na(`${pa.v1}/configurations/${e}`)}async function as(e){return Zo(`${pa.v1}/configurations/metadata`,e)}async function rs(e,t){return ta(`${pa.v1}/configurations/${e}/metadata`,t)}async function ls(e,t){return Zo(`${pa.v1}/configurations/${e}/domains`,t)}async function ss(e,t){return na(`${pa.v1}/configurations/${e}/domains/${t}`)}async function cs(e,t){return ta(`${pa.v1}/configurations/${e}/domains/${t}/validate`)}async function us(e){return Xo(`${pa.v1}/configurations/${e}/roles`)}async function ds(e,t){return ta(`${pa.v1}/configurations/${e}/roles`,t)}async function ys(e,t){return Zo(`${pa.v1}/configurations/${e}/groups`,t)}async function fs(e,{roleIds:t,group:n,id:i}){return ea(`${pa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function gs(e,t){return na(`${pa.v1}/configurations/${e}/groups/${t}`)}async function ps(e){return Xo(`${pa.v1}/configurations/${e}/groups`)}async function Ss(e){return Zo(`${aa.v2}/user/sso/prelogin`,e)}async function vs(e){return mr(await Zo(`${aa.v2}/user/oidc/postlogin`,e))}async function hs(e){return Ar(await Zo(`${Ra}/token`,e))}async function ms(){return Ar(await Zo(`${Ra}/authorize/silent`))}async function bs(e){return Zo(`${ra.v1}/phone/reset`,e)}async function As(e){return Zo(`${ra.v1}/phone/reset/verify`,e)}async function ks(e){return Zo(`${ra.v1}/phone`,e)}async function Ts(e){return Zo(`${ra.v1}/phone/verify`,e)}async function Ps(e){return ta(`${ra.v1}/phone/change`,e)}async function Is(e){return Zo(`${aa.v1}/webauthn/prelogin`,e)}async function Ls(e){return Zo(`${aa.v1}/webauthn/postlogin`,e)}async function ws(){return Zo(oa.v1)}async function Os(e){return Zo(`${oa.v1}/verify`,e)}async function Es(){return Xo(`${la.v1}/auth/strategies/public`)}async function Cs(){return Xo(`${la.v1}/mfa/strategies`)}async function Ds(e){return Xo(`${ra.v2}/me`,null!=e?e:{addRoles:!0})}async function Rs(e){return ta(`${ra.v2}/me`,e)}async function _s(e){return ta(`${ma.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Us(e){return Zo(`${ra.v1}/passwords/change`,e)}async function Ms(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>I({},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 Xo(Sa.v1,I({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ns(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function $s(e){return na(`${Sa.v1}/${e.userId}`)}async function Fs(e){return ta(Sa.v1,e)}async function xs(e){return Zo(da.invites.user.v1,I({},e))}async function Vs(e){return ea(da.invites.user.v1,I({},e))}async function js(){return na(da.invites.user.v1)}async function Ws(){return Xo(da.invites.user.v1)}async function Ks(){return Xo(da.invites.configuration.v1)}async function Gs(){return Xo(va.v1)}async function Bs(){return Xo(ua.v1)}async function zs(){return Xo(`${ha.v1}/members`)}async function qs(e){return Zo(`${Sa.v1}/${e.userId}/resendActivationEmail`,{})}async function Hs(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function Js(e){return Zo(ra.invitation.resendAll.v1,I({},e))}async function Ys(e){var t,n;const i=await Xo("/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 Qs(){const e=await Xo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Xs=async()=>Ys({entityName:"notifications"}),Zs=async()=>Ys({entityName:"saml"}),ec=async()=>Ys({entityName:"audits"}),tc=async e=>async function(e){const t=await Xo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),nc=["dataFilters"],ic=["templateId","dataFilters"],oc=["dataFilters"];async function ac(e){return Xo(`${La.v2}/tenant-reports`,e)}async function rc(e){return Xo(`${La.v2}/${e.id}/tenant-reports`)}async function lc(e){let{dataFilters:t}=e,n=li(e,nc);return{html:await Xo(`${wa.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function sc(e){let{templateId:t,dataFilters:n}=e,i=li(e,ic);return Zo(`${La.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function cc(e){let{dataFilters:t}=e,n=li(e,oc);const i=await Xo(`${wa.v1}/preview-report`,I({},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 uc(e){return Zo(`${wa.v1}/tenant-reports`,e)}async function dc(e){return Xo(Oa,{params:e})}async function yc(e){return ta(`${Oa}/status`,{params:e})}async function fc(e){const{notificationId:t,pinStatus:n}=e;return ta(`${Oa}/${n}`,{notificationId:t})}async function gc(){return Zo(`${Oa}/status/mark-all-read`)}const pc=["endpoint","headerProps"];async function Sc(e){return Xo(Ea,e)}async function vc(e){return Xo(`${Ea}/stats`,e)}async function hc(e){const{endpoint:t,headerProps:n}=e,i=li(e,pc);return ia(`${Ea}/export/${t}`,{properties:n},i)}const mc=["eventKey"],bc=["eventKey"],Ac=()=>Xo(`${ka.v1}/slack`),kc=()=>Xo(`${ka.v1}/slack/applications`),Tc=()=>Xo(`${ka.v1}/slack/channels`),Pc=e=>e.id?ea(`${ka.v1}/slack/subscription/${e.id}`,e):Zo(`${ka.v1}/slack/subscriptions`,e),Ic=e=>na(`${ka.v1}/slack/subscriptions/${e.id}`),Lc=e=>Zo(`${ka.v1}/slack/applications/registrations`,{code:e}),wc=()=>Xo(`${ka.v1}/emails`),Oc=e=>{let{eventKey:t}=e,n=li(e,mc);return Zo(`${ka.v1}/emails/${t}`,n)},Ec=({eventKey:e,enabled:t})=>ea(`${ka.v1}/emails/${e}`,{enabled:t}),Cc=(e,t)=>na(`${ka.v1}/emails/${e}/subscriptions/${t}`),Dc=(e,t,n)=>ta(`${ka.v1}/emails/${t}/subscriptions/${e}`,n),Rc=e=>na(`${ka.v1}/emails/${e}`),_c=()=>Xo(`${ka.v2}/sms`),Uc=e=>{let{eventKey:t}=e,n=li(e,bc);return Zo(`${ka.v2}/sms/${t}`,n)},Mc=({eventKey:e,enabled:t})=>ea(`${ka.v2}/sms/${e}`,{enabled:t}),Nc=(e,t)=>na(`${ka.v2}/sms/${e}/subscriptions/${t}`),$c=(e,t,n)=>ta(`${ka.v2}/sms/${t}/subscriptions/${e}`,n),Fc=e=>na(`${ka.v2}/sms/${e}`),xc=()=>Xo(Da),Vc=e=>e._id?ea(`${Da}/${e._id}`,e):Zo(`${Da}/custom`,e),jc=e=>na(`${Da}/${e}`),Wc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Xo(`${Da}/logs/?${i.toString()}`)},Kc=e=>Zo(`${Da}/test`,e),Gc=e=>Zo(`${Da}/logs/${e}/retries`),Bc=()=>Xo(`${Ca.v1}/categories`),zc=e=>Xo(Ca.v1,{channels:e});async function qc(e){return ta(ba.v1,e)}async function Hc(){return Xo(ba.v1)}const Jc=["roleId"],Yc=["roleId"],Qc=["permissionId"];async function Xc(){return Xo(ya.v1)}async function Zc(e){return Zo(ya.v1,e)}async function eu({roleId:e}){return na(`${ya.v1}/${e}`)}async function tu(e){let{roleId:t}=e,n=li(e,Jc);return ea(`${ya.v1}/${t}`,n)}async function nu(e){let{roleId:t}=e,n=li(e,Yc);return ta(`${ya.v1}/${t}/permissions`,n)}async function iu(){return Xo(ua.v1)}async function ou(e){let{permissionId:t}=e,n=li(e,Qc);return ta(`${ua.v1}/${t}/roles`,n)}async function au(){return Xo(`${ua.v1}/categories`)}async function ru(){return Xo(Ta.subscriptions.v1)}async function lu(e){return Xo(`${Ta.subscriptions.v1}/${e}`)}async function su(e){return ta(`${Ta.subscriptions.v1}/${e}/cancellations/`,{})}async function cu(e){return ta(`${Ta.subscriptions.v1}/${e}/renewals/`,{})}async function uu(e,{paymentMethodId:t,planId:n}){return ta(`${Ta.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function du(e){return Xo(`${Ia.v1}/${e}`)}async function yu(){return Xo(`${Ia.v1}`)}async function fu(e){return ta(`${Ia.v1}/${e}/cancellations/`,{})}async function gu(e){return ta(`${Ia.v1}/${e}/renewals/`,{})}async function pu(e,{paymentMethodId:t,planId:n}){return ta(`${Ia.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Su(){return Xo(Ta.plans.v1)}async function vu(e){return Xo(`${Ta.plans.v1}/${e}`)}async function hu(){return Xo(Ta.invoices.v1)}async function mu(e){return Xo(`${Ta.invoices.v1}/${e}`)}async function bu(e,t){return Xo(`${Ta.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Au=["email"];async function ku(){return Xo(Ta.paymentMethods.v1)}async function Tu(e){return Xo(`${Ta.paymentMethods.v1}/${e}`)}async function Pu(e,t){let{email:n}=t,i=li(t,Au);return ea(`${Ta.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Iu(e){return Zo(Ta.paymentProviders.stripe.subscriptions.v1,e)}async function Lu(e){return Xo(`${Ta.paymentProviders.stripe.customers.v1}/${e}`)}async function wu(e){return Zo(`${Ta.paymentProviders.stripe.customers.v1}`,e)}async function Ou(){return Xo(`${Ta.paymentProviders.stripe.publicConfigurations.v1}`)}async function Eu(e){return Zo(`${Ta.paymentProviders.stripe.setupIntents.v1}`,e)}async function Cu(e){return Xo(`${Ta.summaries.v1}/${e}`)}async function Du(e){return Xo(`${Ta.tenantConfiguration.v1}/${e}`)}async function Ru(e){return Zo(`${Ta.tenantConfiguration.v1}`,e)}async function _u(){return Xo(Pa.v1)}async function Uu(){return Xo(`${Ta.configurations.vendorPublicConfigurations.v1}`)}let Mu,Nu,$u,Fu,xu,Vu,ju,Wu,Ku,Gu,Bu;async function zu(){return Xo("/vendors/public")}async function qu(e){return Xo(fa.v1,e)}async function Hu(e){return Zo(fa.v1,e)}async function Ju(e){return na(fa.v1,e)}async function Yu(e,t){return Zo(`${fa.v1}/${e}/roles`,t)}async function Qu(e,t){return na(`${fa.v1}/${e}/roles`,t)}async function Xu(e,t){return ea(`${fa.v1}/${e}/roles`,t)}async function Zu(){return Xo(_a)}async function ed(){return Xo(`${Ua}`)}async function td(e,t){return ea(`${Ua}/${e}`,t)}async function nd(e){return Zo(`${Ua}`,e)}async function id(e){return na(`${Ua}/${e}`)}async function od(e){return Xo(`${Ma}/${e}/Users/count`)}async function ad(e){return Zo(`${ga.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Mu||(Mu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Nu||(Nu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}($u||($u={})),(Fu||(Fu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(xu||(xu={})),function(e){e.CREATE="create_customer"}(Vu||(Vu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(ju||(ju={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Wu||(Wu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ku||(Ku={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Gu||(Gu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Bu||(Bu={}));const rd=[`${aa.v1}/logout`,`${Ra}/logout`],ld=[...rd,`${aa.v1}/user/saml/postlogin`,`${aa.v2}/user/oidc/postlogin`,`${aa.v1}/user`,`${aa.v1}/user/mfa/verify`,`${aa.v1}/user/token/refresh`,`${ra.v1}`,`${ra.v1}/signUp`,`${aa.v1}/passwordless/magiclink/postlogin`,`${aa.v1}/passwordless/code/postlogin`,`${aa.v1}/passwordless/smscode/postlogin`,`${ra.v1}/activate`,`${ra.v1}/invitation/accept`,`${Ra}/token`,`${Ra}/authorize/silent`],sd=`${aa.v1}/user/token/refresh`,cd=`${Ra}/authorize/silent`,ud=`${ra.v2}/me`,dd=`${ra.v2}/me/tenants`;let yd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(yd||(yd={}));const fd={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h};var gd={fetch:e,ContextHolder:qo,FronteggContext:Ho,api:fd,FronteggApiError:Jo,AuthStrategyEnum:yr,SocialLoginProviders:dr,ISubscriptionCancellationPolicy:$u,ISubscriptionStatus:Mu,PaymentMethodType:Nu,ProviderType:Fu};let pd,Sd;function vd(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function hd(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 md(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"}(pd||(pd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Sd||(Sd={}));const bd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Ad={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},kd=I({},Ad,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Td=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],Pd={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},Id=I({},Pd,{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}),Ld={loading:!1,error:void 0,saving:!0,profile:Pd},wd={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"},Od={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:yr.EmailAndPassword},Ed={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Cd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Dd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Rd={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},_d={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Ud=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Md={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Rd,roles:Ud,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Nd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],$d={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:[Td[0]]},Fd={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:[Td[1]]},xd={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Vd=[Fd,$d],jd=[xd],Wd=[{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}],Kd=[{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"}],Gd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Bd={isActive:!0,strategy:_n.ALLOW},zd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:_n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:_n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 4"}];let qd,Hd,Jd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(qd||(qd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Hd||(Hd={})),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"}(Jd||(Jd={})),Jd.profile,Jd.privacy,Jd.personalApiTokens,Jd.account,Jd.users,Jd.security,Jd.sso,Jd.audits,Jd.webhooks,Jd.apiTokens,Jd.roles,Jd.subscriptions;const Yd=["events","url"];function*Qd(){yield Bi(Hn.setSignUpState({loading:!0}));try{const e=yield Hi(fd.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield Bi(Hn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Xd(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,Yd);yield Bi(Hn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Qi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Hi(fd.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:Hd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(qo.setAccessToken(null==l?void 0:l.accessToken),qo.setUser(l),!r&&l&&df(l)){const t=yield gf(l);yield Bi(Hn.setState(t)),a(e.loginUrl)}else yield Bi(Hn.setSignUpState({loading:!1,shouldActivate:r,stage:sn.SignUpSuccess})),yield Bi(Hn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield Bi(Hn.loadTenants()))}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setSignUpState({loading:!1,error:e.message}))}yield Bi(Hn.setSignUpState({loading:!1}))}function*Zd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Qi((e=>e.auth.signUpState));yield Bi(Hn.resetSignUpState()),yield Bi(Hn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*ey(){yield zo(Hn.signUpUser,Xd),yield zo(Hn.resetSignUpStateSoft,Zd)}const ty={setVendorState:(e,{payload:t})=>I({},e,t)},ny={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},iy={loading:!1},{reducer:oy,actions:ay}=at({name:It,initialState:iy,reducers:I({},ty)}),ry=I({},ay,ny);function*ly(){yield Bi(ry.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield fd.vendor.getVendorPublicInfo();yield Bi(ry.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Bi(ry.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const sy=["callback"],cy=["callback"],uy=["callback"],dy=["callback"],yy=["callback"],fy=["callback"];function*gy(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getGlobalSecurityPolicy);yield Bi(Hn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha()),yield Bi(Hn.loadPublicAuthStrategiesPolicy())}function*py(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorConfig);yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Sy(){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorPublicAuthStrategiesConfig);yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*vy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getMfaPolicy);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*hy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorMfaPolicy);yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*my(e){let{payload:{callback:t}}=e,n=li(e.payload,sy);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.saveMfaPolicy,n);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*by(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getLockoutPolicy);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Ay(e){let{payload:{callback:t}}=e,n=li(e.payload,cy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.saveLockoutPolicy,n);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ky(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorLockoutPolicy);yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Ty(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCaptchaPolicy);yield Bi(Hn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Py(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Iy(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Ly(e){let{payload:{callback:t}}=e,n=li(e.payload,uy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.savePasswordHistoryPolicy,n);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wy(){yield Bi(Hn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getPasswordConfigPolicy);yield Bi(Hn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Oy(){yield zo(Hn.loadSecurityPolicy,gy),yield Go(Hn.saveSecurityPolicyMfa,my),yield Go(Hn.loadSecurityPolicyMfa,vy),yield Go(Hn.loadSecurityPolicyVendorMfa,hy),yield Go(Hn.saveSecurityPolicyLockout,Ay),yield Go(Hn.loadSecurityPolicyLockout,by),yield Go(Hn.loadSecurityPolicyVendorLockout,ky),yield Go(Hn.loadSecurityPolicyCaptcha,Ty),yield Go(Hn.saveSecurityPolicyPasswordHistory,Ly),yield Go(Hn.loadSecurityPolicyPasswordHistory,Py),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,Iy),yield Go(Hn.loadVendorPasswordConfig,wy),yield Go(Hn.loadPublicSecurityPolicy,py),yield Go(Hn.loadPublicAuthStrategiesPolicy,Sy)}function*Ey(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Bi(Hn.setSecurityPolicyPublicState({policy:Od,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Cy(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyGlobalState({policy:wd,loading:!1})),yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyPasswordHistory()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha())}function*Dy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:Ed,loading:!1}))}function*Ry(){yield Bi(Hn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:Ed,loading:!1}))}function*_y(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,dy);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Cd,{id:null!=(t=i.id)?t:Cd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Uy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Cd,loading:!1}))}function*My(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:Cd,loading:!1}))}function*Ny(e){let{payload:{callback:t}}=e,n=li(e.payload,yy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},Cd,n,{id:n.id?n.id:Cd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*$y(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Cd,loading:!1}))}function*Fy(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:Dd,loading:!1}))}function*xy(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:Dd,loading:!1}))}function*Vy(e){let{payload:{callback:t}}=e,n=li(e.payload,fy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},Dd,n,{id:n.id?n.id:Dd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*jy(){yield zo(Hn.loadSecurityPolicy,Cy),yield Go(Hn.loadPublicSecurityPolicy,Ey),yield Go(Hn.saveSecurityPolicyMfa,_y),yield Go(Hn.loadSecurityPolicyMfa,Dy),yield Go(Hn.loadSecurityPolicyVendorMfa,Ry),yield Go(Hn.saveSecurityPolicyLockout,Ny),yield Go(Hn.loadSecurityPolicyLockout,Uy),yield Go(Hn.loadSecurityPolicyVendorLockout,My),yield Go(Hn.loadSecurityPolicyCaptcha,$y),yield Go(Hn.saveSecurityPolicyPasswordHistory,Vy),yield Go(Hn.loadSecurityPolicyPasswordHistory,Fy),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,xy)}const Wy=["callback"],Ky=["callback"],Gy=["callback"],By=["callback"],zy=["callback","events"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback"],Qy=["callback"],Xy=["callback"],Zy=["callback"],ef=["callback"],tf=["callback"],nf=["callback","deviceId"],of=["callback","deviceId"],af=["callback","deviceId"],rf=["callback","deviceId"],lf={[yr.Code]:vt.loginWithOtc,[yr.EmailAndPassword]:vt.loginWithPassword,[yr.MagicLink]:vt.magicLinkPreLoginSuccess,[yr.SmsCode]:vt.loginWithSmsOtc};function*sf(){var e;const t=qo.onRedirectTo,{routes:n,includeQueryParam:i}=yield Qi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(bt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(bt),yield Xi(200),Bi(Hn.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*cf(){let e;try{var t;const n=yield Hi(fd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Bi(Hn.setState({ssoACS:e}))}function*uf(){try{const{isActive:e}=yield Hi(fd.auth.getSSOPublicConfiguration);yield Bi(Hn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const df=e=>e.mfaRequired&&e.mfaToken?(qo.setAccessToken(null),qo.setUser(null),!0):(qo.setAccessToken(e.accessToken),qo.setUser(e),!1),yf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Qt.authenticatorApp;if(t)return Qt.smsVerifyCode}return Qt.verify},ff=e=>{if(1===e.length){const[t]=e;if(t===Ku.AuthenticatorApp)return Qt.authenticatorApp;if(t===Ku.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*gf(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield Qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Hi(fd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:yf(e.mfaDevices)}:(n={step:ff(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=vt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:ht.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:I({},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*pf(){const{hostedLoginBox:e}=yield Qi((e=>e.auth));e?yield Hi(Sf):yield Hi(vf)}function*Sf(){const{user:e}=yield Qi((e=>e.auth));if(null==e||!e.refreshToken)return qo.setAccessToken(null),qo.setUser(null),void(yield Bi(Hn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Hi(fd.auth.exchangeOAuthTokens,t);yield Bi(Hn.setState({user:n,isAuthenticated:!0})),yield Bi(Hn.loadTenants())}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:null,isAuthenticated:!1}))}}function*vf(){try{const n=qo.onRedirectTo,{routes:i,loginState:o}=yield Qi((e=>e.auth)),{user:a,tenants:r}=yield Hi(fd.auth.refreshTokenV2);if(df(a)){const e=yield gf(a);yield Bi(Hn.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 Bi(Hn.setTenantsState({tenants:r,loading:!1})),yield Bi(Hn.setState({user:a,isAuthenticated:!0,loginState:I({},o,{quickLoginToRegister:l,flow:s?ht.RegisterQuickLogin:ht.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 sf())}}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}}function*hf({payload:{callback:e}}){try{const{ip:t}=yield Hi(fd.metadata.getCurrentUserIpMetadata);yield Bi(Hn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*mf({payload:e}){const t=[];e&&(yield Bi(Hn.setState({isLoading:!0})),yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Qd)),t.push(Hi(Sy)),t.push(Hi(uf)),t.push(Hi(ly)),t.push(Hi(cf))),t.push(Hi(pf)),yield zi(t),yield Bi(Hn.setState({isLoading:!1}))}function*bf({accessToken:e,user:t}){if(!e)return void(yield Bi(Hn.setState({user:void 0,isAuthenticated:!1})));const n=qo.onRedirectTo,{routes:i}=yield Qi((e=>e.auth));if(df(t)){const e=yield gf(t);yield Bi(Hn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Af({payload:e}){const t=[];yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Qd)),t.push(Hi(uf)),t.push(Hi(ly)),t.push(Hi(cf)),t.push(Hi(bf,e)),yield zi(t)}function*kf({payload:e}){const{disableSilentRefresh:t}=yield Qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Hi(fd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Qi((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 Bi(Hn.setState({isLoading:!0}));const a=md(),r=md(),l=yield Hi(hd,r);localStorage.setItem(At,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${Yo(n,"/oauth/authorize")}/oauth/authorize`,u=I({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*Tf({payload:e}){const t=localStorage.getItem(At)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Qi((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 Hi(fd.auth.exchangeOAuthTokens,a);yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield sf()}}function*Pf(e){let{payload:{callback:t}}=e,n=li(e.payload,Wy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.changePhoneNumberWithVerification,n);yield Bi(Hn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:vt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*If(e){let{payload:{callback:t}}=e,n=li(e.payload,Ky);try{yield Bi(Hn.setLoginState({loading:!0})),yield Hi(fd.auth.verifyChangePhoneNumber,n),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*Lf(e){let{payload:{callback:t}}=e,n=li(e.payload,Gy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.passwordlessPreLogin,I({},n,{type:yr.SmsCode}));yield Bi(Hn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*wf(e){let{payload:{callback:t}}=e,n=li(e.payload,By);try{const{onRedirectTo:e,routes:i}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bi(Hn.setLoginState({loading:!0}));const o=yield Hi(fd.auth.passwordlessPreLogin,n),a=lf[n.type];if(a===vt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield Bi(Hn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield Bi(Hn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Of(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,zy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.passwordlessPostLogin,i),a=qo.onRedirectTo,{routes:r}=yield Qi((e=>e.auth));if(df(e)){const t=yield gf(e);yield Bi(Hn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Qi((e=>e.auth)),l=yield Hi(fd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:qd.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield Bi(Hn.setState({user:l,isAuthenticated:!0})),yield Bi(Hn.setLoginState({error:void 0})),yield Bi(Hn.loadTenants()),i.flow===ht.Login?yield sf():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield Bi(Hn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Ef({payload:e}){try{yield Bi(Hn.setLoginState({loading:!0}));const{name:t}=yield Hi(fd.auth.verifyInviteToken,e);yield Bi(Hn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield Bi(Hn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Cf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Qi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Hi(fd.auth.preLoginV2,{email:e});if(a){if(r===Sd.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Qi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield Bi(Hn.setLoginState({step:vt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield Df({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Df({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Df(e){let{callback:t}=e,n=li(e,qy);const i=yield Qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===yr.EmailAndPassword?(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[yr.MagicLink,yr.Code,yr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Bi(Hn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*Rf({payload:{callback:e}}){try{yield Bi(Hn.setLoginState({loading:!0}));const{options:t}=yield Hi(fd.auth.webAuthnCreateNewDeviceSession);t.user.id=pt(t.user.id),t.challenge=pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Bi(Hn.setLoginState({error:t.message})),null==e||e(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*_f(e){let{payload:{callback:t}}=e,n=li(e.payload,Hy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Hi(fd.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Uf(e){let{payload:{callback:t}}=e,n=li(e.payload,Jy);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const{options:e}=yield Hi(fd.auth.webAuthnPreLogin,n);e.challenge=pt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)}))),yield Bi(Hn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Mf(e){let{payload:{callback:t}}=e,n=li(e.payload,Yy);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Hi(fd.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(df(o)){const e=qo.onRedirectTo,{routes:t}=yield Qi((e=>e.auth)),n=yield gf(o);yield Bi(Hn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Hi(fd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.setLoginState({error:void 0})),yield sf(),null==t||t(!0)}}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Nf({payload:e}){const{onRedirectTo:t,routes:n}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bi(Hn.setLoginState({loading:!0}));try{const t=yield Hi(fd.auth.postLogin,e);qo.setAccessToken(t.accessToken),qo.setUser(t),yield Bi(Hn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield sf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Bi(Hn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*$f({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Bi(Hn.setLoginState({loading:!0}));try{const a=yield Hi(fd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});qo.setAccessToken(a.accessToken),qo.setUser(a);const r=qo.onRedirectTo,{routes:l}=yield Qi((e=>e.auth));if(df(a)){const e=yield gf(a);yield Bi(Hn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Qi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Bi(Hn.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===ht.Login?vt.success:t.step,tenants:[],tenantsLoading:!0}})),yield Bi(Hn.loadTenants()),n&&t.flow===ht.Login&&(yield sf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ff({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Hi(fd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Qi((e=>e.auth)),r=a.flow===ht.Login?vt.success:a.step;yield Bi(Hn.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 Bi(Hn.loadTenants()),yield Bi(Hn.setLoginState({error:void 0,loading:!1})),a.flow===ht.Login&&(yield sf()),null==i||i(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*xf({payload:e}){yield Bi(Hn.setLoginState({loading:!0}));try{yield Hi(fd.auth.recoverMfaToken,e),yield Bi(Hn.setLoginState({loading:!1,error:void 0,step:vt.preLogin})),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*Vf({payload:e}){const{hostedLoginBox:t}=yield Qi((e=>e.auth));yield Bi(Hn.setState({isLoading:!0}));try{t?yield Hi(fd.auth.OAuthLogout):yield Hi(fd.auth.logout)}catch{}yield Bi(Hn.resetState()),yield Bi(Hn.requestAuthorize(!0)),null==e||e()}function*jf({payload:e}){var t;try{yield Hi(fd.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*Wf({user:e,tenants:t}){const n={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield Bi(Hn.setMfaState(n)),yield Bi(Hn.setUser(e)),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Kf({user:e,tenants:t}){const{loginState:n}=yield Qi((e=>e.auth));yield Bi(Hn.setUser(e)),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===ht.Login&&(yield sf()),yield Bi(Hn.setState({isAuthenticated:!0}))}function*Gf(e){let{payload:{callback:t}}=e,n=li(e.payload,Qy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.preEnrollMFASMSForLogin,n);yield Bi(Hn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Bf(e){let{payload:{callback:t}}=e,n=li(e.payload,Xy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.enrollMFASMSForLogin,n),i=yield Hi(fd.auth.generateLoginResponseV2,e);yield Wf(i),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*zf(e){let{payload:{callback:t}}=e,n=li(e.payload,Zy);yield Bi(Hn.setLoginState({loading:!0}));try{var i;const e=yield Hi(fd.auth.preEnrollMFAWebAuthnForLogin,n),o=I({},e.options,{challenge:pt(e.options.challenge),user:I({},e.options.user,{id:pt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*qf(e){let{payload:{callback:t}}=e,n=li(e.payload,ef);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Hi(fd.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Hi(fd.auth.generateLoginResponseV2,i);yield Wf(o),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Hf(e){let{payload:{callback:t}}=e,n=li(e.payload,tf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Hi(fd.auth.generateLoginResponseV2,e);yield Wf(i),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Jf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,nf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.preVerifyMFASMSForLogin,n,i);yield Bi(Hn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Yf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,of);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.verifyMFASMSForLogin,n,i),o=yield Hi(fd.auth.generateLoginResponseV2,e);yield Kf(o),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Qf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,af);yield Bi(Hn.setLoginState({loading:!0}));try{var o;const e=yield Hi(fd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Xf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,rf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Hi(fd.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Hi(fd.auth.generateLoginResponseV2,o);yield Kf(a),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Zf(){yield zo(Hn.requestAuthorize,mf),yield zo(Hn.requestAuthorizeSSR,Af),yield zo(Hn.requestHostedLoginAuthorize,kf),yield zo(Hn.handleHostedLoginCallback,Tf),yield zo(Hn.preLogin,Cf),yield zo(Hn.postLogin,Nf),yield zo(Hn.login,$f),yield zo(Hn.logout,Vf),yield zo(Hn.silentLogout,jf),yield zo(Hn.loginWithMfa,Ff),yield zo(Hn.recoverMfa,xf),yield zo(Hn.quickSmsPasswordlessPreLogin,Lf),yield zo(Hn.changePhoneNumberWithVerification,Pf),yield zo(Hn.verifyChangePhoneNumber,If),yield zo(Hn.passwordlessPreLogin,wf),yield zo(Hn.passwordlessPostLogin,Of),yield zo(Hn.verifyInviteToken,Ef),yield zo(Hn.webAuthnPrelogin,Uf),yield zo(Hn.webAuthnPostLogin,Mf),yield zo(Hn.webAuthnCreateNewDeviceSession,Rf),yield zo(Hn.webAuthnVerifyNewDeviceSession,_f),yield zo(Hn.afterAuthNavigation,sf),yield zo(Hn.getUserIP,hf),yield zo(Hn.preEnrollMFASMSForLogin,Gf),yield zo(Hn.enrollMFASMSForLogin,Bf),yield zo(Hn.preEnrollMFAWebAuthnForLogin,zf),yield zo(Hn.enrollMFAWebAuthnForLogin,qf),yield zo(Hn.enrollMFAAuthenticatorAppForLogin,Hf),yield zo(Hn.preVerifyMFASMSForLogin,Jf),yield zo(Hn.verifyMFASMSForLogin,Yf),yield zo(Hn.preVerifyMFAWebAuthnForLogin,Qf),yield zo(Hn.verifyMFAWebAuthnForLogin,Xf)}function*eg({payload:e}){e&&(yield Bi(Hn.setState({isLoading:!0})));const t=Id;yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*tg({payload:{callback:e}}){try{const{ip:t}=zd[0];yield Bi(Hn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*ng(){yield zo(Hn.requestAuthorize,eg),yield zo(Hn.afterAuthNavigation,sf),yield zo(Hn.getUserIP,tg)}const ig=["callback","samlVendor"],og=["callback","samlVendor"];function*ag(){try{var e,t;yield Bi(Hn.setSSOState({loading:!0}));const n=yield Hi(fd.auth.getSamlConfiguration),i=yield Hi(fd.auth.getOidcConfiguration),o=yield Hi(fd.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 Bi(Hn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSSOState({error:e.message,loading:!1}))}}function*rg({payload:e}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Bi(Hn.setSSOState({error:void 0,[n]:!0}));try{const i=yield bd(e[0]),o=yield Hi(fd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*lg({payload:e}){const{configFile:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Bi(Hn.setSSOState({error:void 0,[o]:!0}));try{const e=yield bd(t),a=yield Hi(fd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*sg({payload:e}){const{callback:t,samlVendor:n}=e,i=li(e,ig),o=yield Qi((e=>e.auth.ssoState.samlConfiguration)),a=I({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Bi(Hn.setSSOState({samlConfiguration:I({},o,a)})));if(yield Bi(Hn.setSSOState({error:void 0,[r]:!0})),e.type===Sd.Saml){var l,s;const e=yield Hi(fd.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=vd(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 Hi(fd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*cg({payload:{callback:e}={}}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration));try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.validateSamlDomain),yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*ug(){try{const e=yield Hi(fd.auth.getSamlRoles),t=yield Hi(fd.auth.getSamlRolesGroups);yield Bi(Hn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}function*dg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield zi(e.map((e=>Hi(fd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}(n)),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*yg({payload:{callback:e,id:t}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.deleteSamlGroup,{id:t}),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*fg({payload:{group:e,roleIds:t,callback:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.createSamlGroup,{group:e,roleIds:t}),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*gg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Bi(Hn.setSSOState({loading:!0})),yield Hi(fd.auth.oidcPostLoginV2,t),yield Hi(pf),yield Bi(Hn.setSSOState({loading:!1}))}catch(e){var n;yield Bi(Hn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*pg(){yield Go(Hn.loadSSOConfigurations,ag),yield Go(Hn.saveSSOConfigurations,sg),yield Go(Hn.saveSSOConfigurationsFile,rg),yield Go(Hn.saveSSOConfigurationsFileWithCallback,lg),yield Go(Hn.validateSSODomain,cg),yield Go(Hn.loadSSOAuthorizationRoles,ug),yield Go(Hn.updateSSOAuthorizationRoles,dg),yield Go(Hn.deleteSamlGroup,yg),yield Go(Hn.createSamlGroup,fg),yield Go(Hn.oidcPostlogin,gg)}function*Sg(){yield Bi(Hn.setSSOState({loading:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:Rd,loading:!1,firstLoad:!1}))}function*vg({payload:e}){const t="saving";yield Bi(Hn.setSSOState({error:void 0,[t]:!0}));const n=I({},yield Qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Bi(Hn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*hg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=li(e,og),r=Md.samlConfiguration,l=I({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Bi(Hn.setSSOState({samlConfiguration:I({},r,l)})));yield Bi(Hn.setSSOState({error:void 0,[s]:!0})),yield yt(),l.acsUrl=null==_d||null==(t=_d.configuration)?void 0:t.acsUrl,l.spEntityId=null==_d||null==(n=_d.configuration)?void 0:n.spEntityId;const c=vd(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 yt(),yield Bi(Hn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*mg({payload:{callback:e}={}}){const t=Md.samlConfiguration;yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*bg(){yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Ag({payload:{callback:e,authorizationRoles:t}}){yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*kg(){yield Go(Hn.loadSSOConfigurations,Sg),yield Go(Hn.saveSSOConfigurations,hg),yield Go(Hn.saveSSOConfigurationsFile,vg),yield Go(Hn.validateSSODomain,mg),yield Go(Hn.loadSSOAuthorizationRoles,bg),yield Go(Hn.updateSSOAuthorizationRoles,Ag)}const Tg=["callback"],Pg=["callback","ssoConfigId"],Ig=["callback","ssoConfigId"];function*Lg(){try{return yield Hi(fd.auth.getOidcConfiguration)}catch(e){return null}}function*wg(){try{return yield Hi(fd.metadata.getSamlMetadata)}catch(e){return null}}function*Og(){try{yield Bi(Hn.setSSOLoader({key:pd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield zi([Hi(Lg),Hi(wg)]),n=yield Hi(fd.auth.getSSOConfigurations);yield Bi(Hn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Bi(Hn.setSSOError({key:pd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Bi(Hn.setSSOLoader({key:pd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Eg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=li(e,Tg),i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Hi(fd.auth.createSSOConfiguration,I({},n,{enabled:null!=(o=n.enabled)&&o}));yield Bi(Hn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Cg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bd(t),o=yield Hi(fd.auth.createSSOConfigurationByMetadata,{metadata:e});yield Bi(Hn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Dg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=li(e,Pg),o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(fd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Bi(Hn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Rg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bd(i),a=yield Hi(fd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Bi(Hn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*_g({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.deleteSSOConfiguration,t),yield Bi(Hn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ug({payload:e}){const{callback:t,ssoConfigId:n}=e,i=li(e,Ig);yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(fd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?I({},t,{domains:[...t.domains,e]}):t));yield Bi(Hn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_DOMAIN,value:!1}))}}function*Mg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?I({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Bi(Hn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_DOMAIN,value:!1}))}}function*Ng({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Bi(Hn.setSSOLoader({key:pd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?I({},e,{domains:e.domains.map((e=>e.id===n?I({},e,{validated:!0}):e))}):e));yield Bi(Hn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*$g({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?I({},e,{roleIds:n}):e));yield Bi(Hn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Fg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(t.map((e=>Hi(fd.auth.deleteSSOGroup,n,e)))),yield zi(e.map((e=>Hi(fd.auth.createSSOGroup,n,e))));const a=yield Hi(fd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?I({},e,{groups:a}):e));yield Bi(Hn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!1}))}}function*xg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield zi(t.map((t=>Hi(fd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!1}))}}function*Vg(){yield Go(Hn.loadSSOConfigurationsV2,Og),yield Go(Hn.saveSSOConfigurationV2,Eg),yield Go(Hn.saveSSODomain,Ug),yield Go(Hn.deleteSSODomain,Mg),yield Go(Hn.validateSSODomainV2,Ng),yield Go(Hn.updateSSOConfiguration,Dg),yield Go(Hn.deleteSSOConfiguration,_g),yield Go(Hn.setSSOGroups,Fg),yield Go(Hn.updateSSOGroups,xg),yield Go(Hn.setSSODefaultRoles,$g),yield Go(Hn.saveSSOConfigurationByMetadata,Cg),yield Go(Hn.updateSSOConfigurationByMetadata,Rg)}const jg=["callback","profilePictureUrl"],Wg=["callback","profilePictureUrl"];function*Kg(){yield Bi(Hn.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 Hi.apply(void 0,[Ko,e,t,n].concat(o))}(3,2e3,fd.teams.getProfile),t=yield Qi((e=>e.auth.user));Hn.setUser(I({},t,e)),yield Bi(Hn.setProfileState({profile:e,loading:!1}))}catch(e){yield Bi(Hn.setProfileState({loading:!1,error:e.message}))}}function*Gg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,jg);yield Bi(Hn.setProfileState({saving:!0,error:null}));try{const e=yield Qi((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 Hi(fd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=I({},e,i,{profilePictureUrl:o}),r=yield Hi(fd.teams.updateProfile,a),l=yield Qi((e=>e.auth.user));yield Bi(Hn.setUser(I({},l,r))),yield Bi(Hn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield Bi(Hn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bg({payload:e}){yield Bi(Hn.setProfileState({loading:!0}));try{var t;yield Hi(fd.teams.changePassword,e),yield Bi(Hn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*zg(){yield zo(Hn.loadProfile,Kg),yield Go(Hn.saveProfile,Gg),yield Go(Hn.changePassword,Bg)}function*qg(){yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setUser(I({},Id,Pd))),yield Bi(Hn.setProfileState({loading:!1,profile:Pd}))}function*Hg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,Wg);yield Bi(Hn.setProfileState({saving:!0,error:null}));const o=Ld;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=I({},o.profile,i,{profilePictureUrl:a}),l=Id;yield yt(),yield Bi(Hn.setUser(I({},l,r))),yield Bi(Hn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Jg({payload:e}){var t;yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Yg(){yield zo(Hn.loadProfile,qg),yield Go(Hn.saveProfile,Hg),yield Go(Hn.changePassword,Jg)}const Qg=["callback"],Xg=["callback"],Zg=["callback"],ep=["deviceId","callback"],tp=["deviceId","callback"],np=["callback"],ip=["deviceId"],op=["deviceId"],ap=["callback"],rp=["deviceId"],lp=["callback"];function*sp(e){const{step:t}=yield Qi((e=>e.auth.mfaState));return{step:e.recoveryCode?Qt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*cp(){yield Bi(Hn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Hi(fd.auth.enrollMfa);yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message}))}}function*up(e){let{payload:{callback:t}}=e,n=li(e.payload,Qg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Qi((e=>e.auth.user)),i=yield Hi(fd.auth.verifyMfa,n),o=yield Hi(fd.auth.getMFADevices),a=yield sp(i);yield Bi(Hn.setMfaState(I({},a,{mfaDevices:o}))),yield Bi(Hn.setUser(I({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*dp(e){let{payload:{callback:t}}=e,n=li(e.payload,Xg);yield Bi(Hn.setMfaState({loading:!0}));try{const e=yield Hi(fd.auth.loginWithMfa,n),i={step:Qt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Bi(Hn.setMfaState(i)),yield Bi(Hn.setState({user:e})),yield Bi(Hn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*yp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;yield Hi(fd.auth.disableMfa,e);const n=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*fp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t,n;const i=yield Hi(fd.auth.preEnrollMFAWebAuthn),o=I({},i.options,{challenge:pt(i.options.challenge),user:I({},i.options.user,{id:pt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*gp(e){let{payload:{callback:t}}=e,n=li(e.payload,Zg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Hi(fd.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Hi(fd.auth.getMFADevices),a=yield sp(i);yield Bi(Hn.setMfaState(I({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*pp(e){let{payload:{deviceId:t,callback:n}}=e;li(e.payload,ep),yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(fd.auth.preDisableMFAWebAuthn,t),o=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Sp(e){let{payload:{deviceId:t,callback:n}}=e,i=li(e.payload,tp);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Hi(fd.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*vp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;const n=yield Hi(fd.auth.preEnrollMFASMS,e);yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*hp(e){let{payload:{callback:t}}=e,n=li(e.payload,np);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Hi(fd.auth.enrollMFASMS,n),i=yield Hi(fd.auth.getMFADevices),o=yield sp(e);yield Bi(Hn.setMfaState(I({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,ip);yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(fd.auth.preDisableMFASMS,t);yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*bp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,op);yield Bi(Hn.setMfaState({saving:!0}));try{var i;yield Hi(fd.auth.disableMFASMS,t,n);const e=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Ap(){yield Bi(Hn.setMfaState({loading:!0}));try{yield Qi((e=>e.auth.user));const e=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message}))}}function*kp(){yield Bi(Hn.setMfaState({loading:!0}));try{const e=(yield Hi(fd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message}))}}function*Tp(){yield Go(Hn.enrollMfa,cp),yield Go(Hn.getMFADevices,Ap),yield Go(Hn.getMFAStrategies,kp),yield Go(Hn.verifyMfa,up),yield Go(Hn.disableMfa,yp),yield Go(Hn.verifyMfaAfterForce,dp),yield Go(Hn.preDisableMfaSms,mp),yield Go(Hn.disableMfaSms,bp),yield Go(Hn.preEnrollMfaSms,vp),yield Go(Hn.enrollMfaSms,hp),yield Go(Hn.preEnrollMfaWebAuthn,fp),yield Go(Hn.enrollMfaWebAuthn,gp),yield Go(Hn.preDisableMfaWebAuthn,pp),yield Go(Hn.disableMfaWebAuthn,Sp)}function*Pp(){yield Bi(Hn.setMfaState({saving:!0})),yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Ip({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield Bi(Hn.setMfaState(i)),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Lp(e){let{payload:{callback:t}}=e,n=li(e.payload,ap);yield Bi(Hn.setMfaState({loading:!0})),yield yt();const i=I({},n,{recoveryCode:"recoveryCode"}),o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Bi(Hn.setMfaState(o)),yield yt(),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*wp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:I({},n,{authenticators:[]})})),yield Bi(Hn.setUser(I({},Id))),null==(t=e.callback)||t.call(e,!0)}function*Op(e){let{}=e,t=li(e.payload,rp);yield Bi(Hn.setMfaState({saving:!0}));try{var n;yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*Ep({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaDevices:I({},n,{phones:[]})})),yield Bi(Hn.setUser(I({},Id))),null==(t=e.callback)||t.call(e,!0)}function*Cp({payload:e}){var t;yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Dp(e){let{payload:{callback:t}}=e;li(e.payload,lp);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Bi(Hn.setMfaState(o)),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Rp(){yield Go(Hn.enrollMfa,Pp),yield Go(Hn.verifyMfa,Ip),yield Go(Hn.disableMfa,wp),yield Go(Hn.verifyMfaAfterForce,Lp),yield Go(Hn.preDisableMfaSms,Op),yield Go(Hn.disableMfaSms,Ep),yield Go(Hn.preEnrollMfaSms,Cp),yield Go(Hn.enrollMfaSms,Dp)}const _p=["callback"];function*Up({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(fd.auth.forgotPassword,e),yield Bi(Hn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*Mp(e){let{payload:{callback:t}}=e,n=li(e.payload,_p);yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(fd.auth.resetPassword,n),yield Bi(Hn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success})),null==t||t(!0)}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*Np({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{const t=yield Hi(fd.auth.loadPasswordConfig,e);yield Bi(Hn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message}))}}function*$p(){yield zo(Hn.forgotPassword,Up),yield zo(Hn.resetPassword,Mp),yield zo(Hn.loadPasswordConfig,Np)}let Fp;!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"}(Fp||(Fp={}));const xp=["callback","events"],Vp=["callback"],jp=["callback"];function*Wp({payload:{userId:e,token:t}}){yield Bi(Hn.setActivateState({loading:!0,step:Et.activating}));try{const{isAuthenticated:n}=yield Qi((e=>e.auth));n&&(yield Bi(Hn.silentLogout()));const i=yield Hi(fd.auth.getActivateAccountStrategy,{userId:e,token:t});yield Bi(Hn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Bi(Hn.setActivateState({loading:!1,step:Et.activatingForm})))}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Kp(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,xp);yield Bi(Hn.setActivateState({loading:!0}));try{const e=qo.onRedirectTo,{routes:a}=yield Qi((e=>e.auth)),r=yield Hi(fd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(df(r)){yield Bi(Hn.setActivateState({step:Et.success}));const t=yield gf(r);yield Bi(Hn.setState(t)),yield Xi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Bi(Hn.setActivateState({step:Et.success}));const{user:e,tenants:t}=yield Hi(fd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:qd.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Xi(1e3),yield sf(),yield Bi(Hn.resetActivateState())}null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Gp({payload:e}){const{callback:t}=e,n=li(e,Vp);yield Bi(Hn.setActivateStrategyState({loading:!0}));try{const e=yield Hi(fd.auth.getActivateAccountStrategy,n);yield Bi(Hn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Bi(Hn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Bp({payload:e}){const{callback:t}=e,n=li(e,jp);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.email})),yield Bi(Hn.setActivateState({loading:!0}));try{yield Hi(fd.auth.resendActivationEmail,n),yield Bi(Hn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message})),yield Bi(Hn.setTeamError({key:Fp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*zp(){yield zo(Hn.activateAccount,Kp),yield zo(Hn.preActivateAccount,Wp),yield zo(Hn.getActivateAccountStrategy,Gp),yield zo(Hn.resendActivationEmail,Bp)}function*qp({payload:e}){if(e.token&&e.userId)try{yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Hi(fd.auth.acceptInvitation,e),yield Bi(Hn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:_t.success}}))}catch(e){yield Bi(Hn.setAcceptInvitationState({step:_t.failed,error:e.message}))}else yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.invalid}))}function*Hp(){yield zo(Hn.acceptInvitation,qp)}var Jp,Yp=new Uint8Array(16);function Qp(){if(!Jp&&!(Jp="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 Jp(Yp)}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,Zp=function(e){return"string"==typeof e&&Xp.test(e)},eS=[],tS=0;tS<256;++tS)eS.push((tS+256).toString(16).substr(1));var nS=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qp)();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=(eS[e[t+0]]+eS[e[t+1]]+eS[e[t+2]]+eS[e[t+3]]+"-"+eS[e[t+4]]+eS[e[t+5]]+"-"+eS[e[t+6]]+eS[e[t+7]]+"-"+eS[e[t+8]]+eS[e[t+9]]+"-"+eS[e[t+10]]+eS[e[t+11]]+eS[e[t+12]]+eS[e[t+13]]+eS[e[t+14]]+eS[e[t+15]]).toLowerCase();if(!Zp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const iS=["callback"],oS=["roles"],aS=["callback"],rS=["callback","profileImage"],lS=["callback"],sS=["callback","userId"],cS=["callback"],uS=["callback"],dS=["callback"],yS=["callback"],fS=["callback"],gS=["callback"],pS=["callback"],SS=["callback","profileImage"],vS=["callback"],hS=["callback"],mS=["callback"],bS=["callback"],AS=["callback"],kS=["callback"],TS=()=>Qi((e=>e.auth.teamState));function*PS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield zi([Hi(fd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Bi(Hn.setTeamError({key:Fp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1}))}function*IS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!r})),yield Bi(Hn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield zi([Hi(fd.subTenants.loadAllUsers,I({},c)),Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield Bi(Hn.setTeamError({key:Fp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1}))}function*LS({payload:e}){yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield zi([Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.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 Bi(Hn.setTeamError({key:Fp.ROLES_AND_PERMISSIONS,value:t.message}))}yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0}))}function*wS({payload:e}){const{callback:t}=e,n=li(e,iS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Hi(fd.teams.addUser,n),{roles:o}=e,a=I({},li(e,oS),{roleIds:o.map((e=>e.id))});null==t||t(a),yield Bi(Hn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*OS({payload:e}){const{callback:t}=e,n=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Bi(Hn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Hi(fd.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield Bi(Hn.loadUsers(r)),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*ES({payload:e}){const{callback:t}=e,n=li(e,aS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Hi(fd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Bi(Hn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*CS({payload:e}){const{callback:t}=e,n=li(e,rS),{id:i}=n,o=yield TS(),a=o.users.find((e=>e.id===n.id));yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:i||""})),yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})})),yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?I({},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 Hi(fd.teams.updateUser,n);null==t||t(e),yield Bi(Hn.setTeamState({users:o.users.map((t=>t.id===e.id?I({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1}))}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?I({},e,a):e))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*DS({payload:e}){const{callback:t}=e,n=li(e,lS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(fd.teams.deleteUser,n),null==t||t(!0),yield Bi(Hn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*RS({payload:e}){const{callback:t,userId:n}=e,i=li(e,sS),o=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return I({},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 Bi(Hn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[I({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*_S({payload:e}){const{callback:t}=e,n=li(e,cS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Bi(Hn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*US({payload:e}){const{callback:t}=e,n=li(e,uS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Hi(fd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*MS({payload:e}){const{callback:t}=e,n=li(e,dS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*NS({payload:e}){const{callback:t}=e,n=li(e,yS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*$S({payload:e}){const{callback:t}=e,n=li(e,fS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*FS(){yield Bi(Hn.setTeamError({key:Fp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Hi(fd.teams.getInviteLinkConfiguration);yield Bi(Hn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield Bi(Hn.setTeamError({key:Fp.CONFIG_TOKEN_LINK,value:e.message}))}}function*xS(){yield Bi(Hn.setTeamError({key:Fp.GET_TOKEN_LINK,value:!1}));try{yield Hi(FS);const e=yield Hi(fd.teams.getInviteUserLink),{inviteTokenState:t}=yield TS();yield Bi(Hn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield Bi(Hn.setTeamError({key:Fp.GET_TOKEN_LINK,value:e.message}))}}function*VS({payload:{callback:e}}){yield Bi(Hn.setTeamError({key:Fp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield TS();try{const n=yield Hi(fd.teams.createInviteUserLink,{expiresInMinutes:43200});yield Bi(Hn.setTeamState({inviteTokenState:I({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield Bi(Hn.setTeamError({key:Fp.CREATE_TOKEN_LINK,value:t.message}))}}function*jS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield TS();yield Bi(Hn.setTeamError({key:Fp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Hi(fd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Bi(Hn.setTeamState({inviteTokenState:I({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield Bi(Hn.setTeamError({key:Fp.UPDATE_TOKEN_LINK,value:t.message}))}}function*WS({payload:e}){const{callback:t}=null!=e?e:{};yield Bi(Hn.setTeamError({key:Fp.DELETE_TOKEN_LINK,value:!1}));try{yield Hi(fd.teams.deleteInviteUserLink),yield Bi(Hn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*KS({payload:e}){yield Bi(Hn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*GS({payload:e}){const t=yield TS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*BS({payload:e}){yield Bi(Hn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*zS({payload:e}){const t=yield TS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*qS(){yield Bo(Hn.loadUsers,PS),yield Bo(Hn.loadAllSubTenantsUsers,IS),yield Bo(Hn.loadRoles,LS),yield Go(Hn.addUser,wS),yield Go(Hn.addUsersBulk,OS),yield Go(Hn.addUserToSubTenants,ES),yield Go(Hn.updateUser,CS),yield Go(Hn.setUserRolesForSubTenants,RS),yield Go(Hn.deleteUser,DS),yield Go(Hn.deleteUserFromSubTenants,_S),yield Go(Hn.resendActivationLink,US),yield Go(Hn.resendInvitationLink,MS),yield Go(Hn.resendInvitationEmail,NS),yield Go(Hn.resendInvitationLinkToAllSubTenants,$S),yield Go(Hn.getInvitationLink,xS),yield Go(Hn.createInvitationLink,VS),yield Go(Hn.updateInvitationLink,jS),yield Go(Hn.deleteInvitationLink,WS),yield Go(Hn.openAddUserDialog,KS),yield Go(Hn.closeAddUserDialog,GS),yield Go(Hn.openDeleteUserDialog,BS),yield Go(Hn.closeDeleteUserDialog,zS)}function*HS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield Bi(Hn.setTeamState({users:Vd,totalPages:2,totalItems:10,roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1})),null==r||r(Vd)}function*JS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!r})),yield Bi(Hn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield yt(),yield Bi(Hn.setTeamState({allUsers:jd,totalPages:2,totalItems:10,roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1})),null==l||l(jd)}function*YS({payload:e}){var t;yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield Bi(Hn.setTeamState({roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Ud,permissions:Nd})}function*QS({payload:e}){const{callback:t}=e,n=li(e,gS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Fd,n,{id:`${nS()}`});null==t||t(o),yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*XS({payload:e}){const{callback:t}=e,n=li(e,pS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Fd,n,{id:`${nS()}`});yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*ZS({payload:e}){var t;const{callback:n}=e,i=li(e,SS),{id:o}=i,a=yield TS(),r=a.users.find((e=>e.id===i.id));yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:o||""})),yield Bi(Hn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0})})),yield Bi(Hn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?I({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield yt();const l=I({},r,i);null==n||n(l),yield Bi(Hn.setTeamState({users:a.users.map((e=>e.id===l.id?I({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1}))}function*ev({payload:e}){const{callback:t}=e,n=li(e,vS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*tv({payload:e}){const{callback:t}=e,n=li(e,hS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*nv({payload:e}){const{callback:t}=e,n=li(e,mS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*iv({payload:e}){const{callback:t}=e,n=li(e,bS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*ov({payload:e}){const{callback:t}=e,n=li(e,AS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*av({payload:e}){const{callback:t}=e,n=li(e,kS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*rv(){yield Bo(Hn.loadUsers,HS),yield Bo(Hn.loadAllSubTenantsUsers,JS),yield Bo(Hn.loadRoles,YS),yield Go(Hn.addUser,QS),yield Go(Hn.addUserToSubTenants,XS),yield Go(Hn.updateUser,ZS),yield Go(Hn.deleteUser,ev),yield Go(Hn.deleteUserFromSubTenants,tv),yield Go(Hn.resendActivationLink,nv),yield Go(Hn.resendInvitationLink,iv),yield Go(Hn.resendInvitationEmail,ov),yield Go(Hn.resendInvitationLinkToAllSubTenants,av),yield Go(Hn.openAddUserDialog,KS),yield Go(Hn.closeAddUserDialog,GS),yield Go(Hn.openDeleteUserDialog,BS),yield Go(Hn.closeDeleteUserDialog,zS)}const lv=["authorizationUrl"],sv=["events","url"];function*cv(){try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const e=yield Hi(fd.auth.getSocialLoginProviders);yield Bi(Hn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*uv(){try{const e=yield Qi((e=>e.root.context));yield Bi(Hn.setSocialLoginsState({loading:!0}));const t=(yield Hi(fd.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=li(t,lv);const o=Yo(e,null!=n?n:"");return I({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Bi(Hn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*dv(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,sv);try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Hi(fd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Hd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:qd.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Bi(Hn.setLoginState({email:e,isNewUser:r})),yield pf(),localStorage.removeItem("register-quick-login"),yield Bi(Hn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield Bi(Hn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*yv({payload:e}){yield Bi(Hn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*fv(){yield zo(Hn.loadSocialLoginsConfiguration,cv),yield zo(Hn.loadSocialLoginsConfigurationV2,uv),yield zo(Hn.loginViaSocialLogin,dv),yield Bo(Hn.setSocialLoginError,yv)}let gv;function*pv({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Qi((e=>e.auth.apiTokensState));try{let e,a;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Hi(fd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Hi(fd.auth.updateUserApiTokensData,{description:t}),yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0!==n?e.clientId:void 0}})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Bi(Hn.setApiTokensError({key:gv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Sv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Qi((e=>e.auth.apiTokensState));try{let e,r;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield Hi(fd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Hi(fd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0!==i?e.clientId:void 0}})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Bi(Hn.setApiTokensError({key:gv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*vv({payload:e}){const{apiTokensDataUser:t}=yield Qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),n?(yield Hi(fd.auth.deleteUserAccessToken,{id:e}),yield Bi(Hn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Hi(fd.auth.deleteUserApiToken,{tokenId:e}),yield Bi(Hn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:gv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}}function*hv({payload:e}){const{apiTokensDataTenant:t}=yield Qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),n?(yield Hi(fd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Hi(fd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:gv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}}function*mv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield zi([Hi(fd.auth.getUserApiTokensData),Hi(fd.auth.getTenantApiTokensData)]);yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*bv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Hi(fd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Hi(fd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Av({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Hi(fd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Hi(fd.auth.getTenantAccessTokensData))?n:[],l=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*kv(){yield zo(Hn.loadApiTokens,mv),yield zo(Hn.loadUserApiTokens,bv),yield zo(Hn.loadTenantApiTokens,Av),yield Go(Hn.addUserApiToken,pv),yield Go(Hn.addTenantApiToken,Sv),yield Bo(Hn.deleteTenantApiToken,hv),yield Bo(Hn.deleteUserApiToken,vv)}function*Tv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState)),a=I({},kd,{description:t,roleIds:n,clientId:`CLIENT_ID_${nS()}`});yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Pv({payload:e}){yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),yield Xi(200);const t=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}function*Iv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[Ad],i=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Lv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[Ad];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*wv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Ov(){yield zo(Hn.loadApiTokens,Iv),yield zo(Hn.loadUserApiTokens,Lv),yield zo(Hn.loadTenantApiTokens,wv),yield Go(Hn.addTenantApiToken,Tv),yield Bo(Hn.deleteTenantApiToken,Pv)}function*Ev({payload:e}){try{var t;yield Bi(Hn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Hi(fd.accountSettings.updateSettings,I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Bi(Hn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Bi(Hn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Cv({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Hi(fd.accountSettings.getSettings);yield Bi(Hn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield Bi(Hn.setAccountSettingsState({loading:!1,error:e.message}))}}function*Dv(){yield zo(Hn.saveAccountSettings,Ev),yield zo(Hn.loadAccountSettings,Cv)}function*Rv({payload:e}){var t;yield Bi(Hn.setAccountSettingsState({loading:!0})),yield yt();const{accountSettingsState:n}=yield Qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Bi(Hn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*_v({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield yt(),yield Bi(Hn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Uv(){yield zo(Hn.saveAccountSettings,Rv),yield zo(Hn.loadAccountSettings,_v)}function*Mv({payload:{tenantId:e,callback:t}}){yield Bi(Hn.setState({isLoading:!0}));try{yield Hi(fd.tenants.switchTenant,{tenantId:e}),yield Hi(pf),(null==t?void 0:t(!0))||(yield Bi(Hn.setState({isLoading:!1})))}catch(e){yield Bi(Hn.setState({isLoading:!1})),null==t||t(!1,e)}}function*Nv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getTenants);yield Bi(Hn.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 Bi(Hn.setTenantsState({loading:!1}))}}function*$v({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getSubTenants);yield Bi(Hn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Fv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getSubTenantsAsTree);yield Bi(Hn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*xv(){yield Go(Hn.loadTenants,Nv),yield Go(Hn.loadSubTenants,$v),yield Go(Hn.switchTenant,Mv),yield Go(Hn.loadSubTenantsTree,Fv)}function*Vv(){yield Bi(Hn.setTenantsState({loading:!0})),yield yt(),yield Bi(Hn.setTenantsState({tenants:Wd,loading:!1}))}function*jv(){yield Go(Hn.loadTenants,Vv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(gv||(gv={}));const Wv=["callback"],Kv=["callback"],Gv=["callback"],Bv=["callback"],zv=["callback"];function*qv({payload:e}){var t;yield Bi(Hn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield zi([Hi(fd.roles.getRoles),Hi(fd.roles.getPermissions),Hi(fd.roles.getPermissionCategories)]),[t,n,i]=e;yield Bi(Hn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*Hv(e){let{payload:{callback:t}}=e,n=li(e.payload,Wv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.addRole,n),i=yield Hi(fd.roles.getRoles);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Jv(e){let{payload:{callback:t}}=e,n=li(e.payload,Kv);yield Bi(Hn.setRolesState({saving:!0}));try{yield Hi(fd.roles.deleteRole,n),yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Yv(e){let{payload:{callback:t}}=e,n=li(e.payload,Gv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.updateRole,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Qv(e){let{payload:{callback:t}}=e,n=li(e.payload,Bv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.attachPermissionsToRole,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Xv(e){let{payload:{callback:t}}=e,n=li(e.payload,zv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.attachPermissionToRoles,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Zv(){yield zo(Hn.loadRolesAndPermissions,qv),yield Go(Hn.addRole,Hv),yield Go(Hn.deleteRole,Jv),yield Go(Hn.updateRole,Yv),yield Go(Hn.attachPermissionsToRole,Qv),yield Go(Hn.attachPermissionToRoles,Xv)}function*eh({payload:e}){var t;yield Bi(Hn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Bi(Hn.setRolesState({roles:Td,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*th(){yield zo(Hn.loadRolesAndPermissions,eh)}const nh=["callback"],ih=["callback"],oh=["callback"];function*ah(e){let{payload:{callback:t}}=e,n=li(e.payload,nh);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(fd.auth.resetPhoneNumber,n);yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield Bi(Hn.setLoginState({email:n.email}))}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*rh(e){let{payload:{callback:t}}=e,n=li(e.payload,ih);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(fd.auth.verifyResetPhoneNumber,n);yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*lh(e){let{payload:{callback:t}}=e,n=li(e.payload,oh);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Hi(fd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Bi(Hn.setLoginState({step:vt.loginWithSmsOtc})),yield Bi(Hn.passwordlessPreLogin({type:yr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Bi(Hn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*sh(){yield zo(Hn.resetPhoneNumber,ah),yield zo(Hn.verifyResetPhoneNumber,rh),yield zo(Hn.changePhoneNumber,lh)}function*ch(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCurrentUserSessions);yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*uh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCurrentUserSession);yield Bi(Hn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*dh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.deleteSessionForUser,e),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*yh({payload:{callback:e,userId:t}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Bi(Hn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*fh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.deleteAllSessionsForUser),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*gh(){yield Bo(Hn.loadUserSessions,ch),yield Bo(Hn.deleteUserSession,dh),yield Bo(Hn.deleteAllUserSessions,fh),yield Bo(Hn.loadCurrentUserSession,uh),yield Go(Hn.revokeUserSessions,yh)}function*ph(){yield Bi(Hn.setSessionsState({loading:!0,error:null})),yield Bi(Hn.setSessionsState({sessions:Kd,loading:!1}))}function*Sh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const t=(yield Qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Bi(Hn.setSessionsState({sessions:t,loading:!1}))}function*vh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const e=Kd.filter((e=>e.current));yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}function*hh(){yield Bo(Hn.loadUserSessions,ph),yield Bo(Hn.deleteUserSession,Sh),yield Bo(Hn.deleteAllUserSessions,vh)}const mh=["callback"],bh=["callback"];function*Ah(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getSessionConfigurations);yield Bi(Hn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*kh({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=li(e,mh);yield Hi(fd.auth.createOrUpdateSessionConfigrations,n),yield Bi(Hn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Bi(Hn.setSessionsPolicyState({error:e,loading:!1}))}}function*Th(){yield zo(Hn.loadSessionsPolicy,Ah),yield Bo(Hn.createOrUpdateSessionsPolicy,kh)}function*Ph(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const e=yield Qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Gd}));yield Bi(Hn.setSessionsPolicyState(I({},e,{loading:!1})))}function*Ih({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=li(e,bh);null==t||t(!0),yield Bi(Hn.setSessionsPolicyState({configurations:n,loading:!1}))}function*Lh(){yield zo(Hn.loadSessionsPolicy,Ph),yield Bo(Hn.createOrUpdateSessionsPolicy,Ih)}const wh=["callback"],Oh=["callback"],Eh=["callback"],Ch=["callback"],Dh=["callback"],Rh=["callback"],_h=["callback"],Uh=["callback"],Mh=()=>Qi((e=>e.auth.restrictionsState.ipRestrictions)),Nh=()=>Qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*$h(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getDomainRestrictionsConfig),t=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Bi(Hn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Fh(e){let{payload:{callback:t}}=e,n=li(e.payload,wh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Nh();try{var o;yield Hi(fd.auth.createDomainRestriction,n);const e=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Bi(Hn.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 Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xh(e){let{payload:{callback:t}}=e,n=li(e.payload,Oh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.updateDomainRestrictionConfig,n),i=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Vh({payload:{id:e}}){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Nh();try{var n;yield Hi(fd.auth.deleteDomainRestriction,e);const i=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const jh=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:_n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Wh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Mh(),t=yield Hi(fd.auth.getIPRestrictionsConfig),n=jh({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Hi(fd.auth.getIPRestrictions,n);yield Bi(Hn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Kh(){try{const{valid:e}=yield Hi(fd.auth.testCurrentIpInAllowList);yield Bi(Hn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message}))}}function*Gh({payload:{callback:e}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Qi((e=>e.auth.userIp));yield zi([Hi(fd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Hi(fd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Mh(),i=jh(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Hi(fd.auth.getIPRestrictions,i);yield Bi(Hn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:_n.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Bh(e){let{payload:{callback:t}}=e,n=li(e.payload,Eh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Mh();try{var o,a;yield Hi(fd.auth.createIPRestriction,n);const e=yield Mh(),r=jh(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Hi(fd.auth.getIPRestrictions,r);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:_n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zh(e){let{payload:{callback:t}}=e,n=li(e.payload,Ch);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{yield Hi(fd.auth.updateIPRestrictionConfig,n);const e=yield Mh(),i=yield Hi(fd.auth.getIPRestrictionsConfig),o=jh(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Hi(fd.auth.getIPRestrictions,o);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qh({payload:{id:e,callback:t}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Mh();try{var i;yield Hi(fd.auth.deleteIPRestriction,e);const o=yield Mh(),a=jh(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Hi(fd.auth.getIPRestrictions,a);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hh(){yield zo(Hn.loadIpRestrictions,Wh),yield zo(Hn.loadEmailDomainRestrictions,$h),yield Go(Hn.saveIpRestriction,Bh),yield Go(Hn.saveIpRestrictionsConfig,zh),yield Go(Hn.deleteIpRestriction,qh),yield Go(Hn.checkIfUserIpValid,Kh),yield Go(Hn.addCurrentUserIpAndActivate,Gh),yield Go(Hn.saveEmailDomainRestriction,Fh),yield Go(Hn.saveEmailDomainRestrictionsConfig,xh),yield Go(Hn.deleteEmailDomainRestriction,Vh)}function*Jh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{restrictions:zd.filter((e=>e.strategy===Bd.strategy)),config:Bd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Yh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Mh(),t=zd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Bi(Hn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Qh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Dh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const r=yield Mh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Bi(Hn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:_n.ALLOW},restrictions:[...l,I({},a,{createdAt:new Date,updatedAt:new Date,id:nS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Xh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Rh);const r=yield Mh();yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{config:I({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Bi(Hn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Zh({payload:{id:e,callback:t}}){var n;yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Mh();yield Bi(Hn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*em(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:_n.ALLOW}],config:{active:!0,listType:_n.ALLOW,blockPublicDomains:!1}}}))}function*tm(e){var t,n;let{payload:{callback:i}}=e,o=li(e.payload,_h);const a=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==i||i(!0),yield Bi(Hn.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)||[],I({},o,{id:Date.now().toString()})]},saving:!1}))}function*nm(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,Uh);const o=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==n||n(!0),yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||_n.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*im({payload:{id:e}}){var t,n;const i=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*om(){yield zo(Hn.loadIpRestrictions,Jh),yield zo(Hn.loadEmailDomainRestrictions,em),yield Go(Hn.saveIpRestriction,Qh),yield Go(Hn.saveIpRestrictionsConfig,Xh),yield Go(Hn.deleteIpRestriction,Zh),yield Go(Hn.checkIfUserIpValid,Yh),yield Go(Hn.saveEmailDomainRestriction,tm),yield Go(Hn.saveEmailDomainRestrictionsConfig,nm),yield Go(Hn.deleteEmailDomainRestriction,im)}const am=["callback"],rm=["id"];function*lm(e){const{count:t}=yield Hi(fd.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*sm(){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(fd.directory.getConfigs),t=yield zi(e.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*cm(e){let{payload:{callback:t}}=e,n=li(e.payload,am);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(fd.directory.createConfiguration,n),i=yield Hi(fd.directory.getConfigs),o=yield zi(i.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*um(e){let{payload:{id:t}}=e,n=li(e.payload,rm);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(fd.directory.updateConfiguration,t,n);const e=yield Hi(fd.directory.getConfigs),i=yield zi(e.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*dm({payload:{id:e,callback:t}}){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(fd.directory.deleteConfiguration,e);const n=yield Hi(fd.directory.getConfigs),i=yield zi(n.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*ym(){yield zo(Hn.loadProvisionConnections,sm),yield Go(Hn.createProvisionConnection,cm),yield Go(Hn.deleteProvisionConnection,dm),yield Go(Hn.updateProvisionConnection,um)}const fm=["callback","events"];function*gm(e){let{payload:{callback:t}}=e,n=li(e.payload,fm);yield Bi(Hn.setImpersonateState({loading:!0}));try{yield Hi(fd.impersonate.impersonate,n),yield Bi(Hn.setImpersonateState({step:Wn.success})),yield Bi(Hn.resetImpersonateState()),null==t||t(!0)}catch(e){yield Bi(Hn.setImpersonateState({loading:!1,error:e.message}))}}function*pm(){yield zo(Hn.impersonate,gm)}var Sm={sagas:function*(){yield zi([Hi(Zf),Hi(zp),Hi(Hp),Hi($p),Hi(sh),Hi(pg),Hi(Vg),Hi(zg),Hi(Tp),Hi(qS),Hi(fv),Hi(ey),Hi(kv),Hi(Oy),Hi(Dv),Hi(xv),Hi(Zv),Hi(gh),Hi(Th),Hi(Hh),Hi(ym),Hi(pm)])},mockSagas:function*(){yield zi([Hi(ng),Hi(kg),Hi(Yg),Hi(Rp),Hi(rv),Hi(Ov),Hi(jy),Hi(hh),Hi(Uv),Hi(jv),Hi(Lh),Hi(om),Hi(th)])},storeName:kt,initialState:jn,reducer:zn,actions:Hn};const vm=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),hm={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},mm={setAuditLogsState:vm("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:hm})},bm={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},Am={loading:!0},km={setAuditsMetadataState:vm("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:Am})},Tm={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},Pm={auditLogsState:hm,auditsMetadataState:Am},{reducer:Im,actions:Lm}=at({name:Pt,initialState:Pm,reducers:I({resetState:e=>I({},e,Pm),setState:(e,{payload:t})=>I({},e,t)},mm,km)}),wm=I({},Lm,bm,Tm),Om=e=>"createdAt"!==e.id,Em={total:20,data:Array.from(Array(5).keys()).map((e=>I({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`})))},Cm={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}]},Dm=()=>Qi((e=>e.auditLogs.auditLogsState)),Rm=()=>Qi((e=>e.auditLogs.auditsMetadataState));function*_m(){const e=yield Dm(),{columns:t}=yield Rm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});yield Bi(wm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield fd.audits.exportAudits(I({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Bi(wm.setAuditLogsState({isDownloadingCsv:!1}))}function*Um({payload:e}){yield Bi(wm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dm(),{columns:n}=yield Rm();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 Bi(wm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});n||(yield Bi(wm.loadAuditsMetadata()));const{data:g,total:p}=yield Hi(fd.audits.getAudits,I({offset:c,count:s},y,f));yield Bi(wm.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Bi(wm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Mm(){yield Go(wm.exportAuditsCsv,_m),yield Go(wm.loadAuditLogs,Um)}function*Nm({payload:e}){yield Bi(wm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dm(),{columns:n}=yield Rm();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 Bi(wm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Bi(wm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Em;let i=n.filter((e=>t=>e.filter(Om).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 Bi(wm.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 Bi(wm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*$m(){yield Go(wm.loadAuditLogs,Nm)}function*Fm(){yield Bi(wm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Hi(fd.metadata.getAuditsMetadata);yield Bi(wm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(wm.setAuditsMetadataState({error:e,loading:!1}))}}function*xm(){yield Go(wm.loadAuditsMetadata,Fm)}function*Vm(){yield Bi(wm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Cm;yield Bi(wm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(wm.setAuditsMetadataState({error:e,loading:!1}))}}function*jm(){yield Go(wm.loadAuditsMetadata,Vm)}var Wm={sagas:function*(){yield zi([Hi(Mm),Hi(xm)])},mockSagas:function*(){yield zi([Hi($m),Hi(jm)])},storeName:Pt,initialState:Pm,reducer:Im,actions:wm};const Km={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:Gm,actions:Bm,reducer:zm}=at({name:"audits",initialState:Km,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=I({},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]})))}}}),qm=I({},Bm,{initData:it(`${Gm}/initData`),loadAudits:it(`${Gm}/loadAudits`),removeFilter:it(`${Gm}/removeFilter`),filterData:it(`${Gm}/filterData`),exportCSV:it(`${Gm}/exportCSV`),deleteAudits:it(`${Gm}/deleteAudits`)}),Hm=()=>Qi((e=>e[Gm]));function*Jm(){const{sortBy:e,sortDirection:t}=yield Hm();try{const n=yield Hi(fd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Bi(qm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Bi(qm.loadItemFailedAction(t))}}function*Ym(){try{const e=yield Hi(fd.metadata.getAuditsMetadata);yield Bi(qm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Bi(qm.loadItemFailedAction(t))}}const Qm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Xm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Hm(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Hm():{rowsData:[]};try{const e=Qm(t),{data:l,total:d}=yield Hi(fd.audits.getAudits,I({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Bi(qm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Bi(qm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Bi(qm.loadItemFailedAction(t))}}function*Zm(){yield Bi(qm.startLoading()),yield zi([Jm(),Ym(),Xm({payload:{onlyOneLoad:!1},type:""})]),yield Bi(qm.finishLoading())}function*eb({payload:e}){const{filters:t}=yield Hm(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Bi(qm.setFilterData(i))}function*tb({payload:e}){const{filters:t}=yield Hm();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield Bi(qm.setFilterData(i))}function*nb(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Hm(),a=Qm(e);yield Bi(qm.startDownloadingCsv());try{yield fd.audits.exportAudits(I({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 Bi(qm.stopDownloadingCsv())}}function*ib(){yield Bo(qm.initData,Zm),yield Bo(qm.removeFilter,eb),yield Bo(qm.filterData,tb),yield Bo([qm.loadAudits,qm.textSearch,qm.onPageChange],Xm),yield Bo([qm.setFilterData,qm.setDataSorting,qm.startRefresh],(()=>Xm({payload:{appendMode:!1},type:""}))),yield Bo(qm.exportCSV,nb)}const ob={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},ab={initData:()=>I({},ob),setConnectivityState:(e,{payload:t})=>I({},e,t),cleanWebhookTestData:e=>I({},e,{testResult:void 0}),cleanWebhookLogsData:e=>I({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return I({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>I({},e,{error:void 0}),cleanSlackData:e=>I({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,t)})}},rb={loadSlackActions:it("connectivity/loadSlackActions"),loadDataAction:it("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:it("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:it("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:it("connectivity/loadScope"),deleteWebhookConfigAction:it("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:it("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:it("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},lb={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:sb,actions:cb}=at({name:Tt,initialState:lb,reducers:I({},ab)}),ub=I({},cb,rb),db={slack:fd.connectivity.getSlackConfiguration,email:fd.connectivity.getEmailConfiguration,sms:fd.connectivity.getSMSConfiguration,webhook:fd.connectivity.getWebhooksConfigurations,categories:fd.connectivity.getCategories,channelMap:fd.connectivity.getChannelMaps},yb={slack:fd.connectivity.postSlackConfiguration,email:fd.connectivity.postEmailConfiguration,sms:fd.connectivity.postSMSConfiguration,webhook:fd.connectivity.postWebhooksConfiguration},fb=["email","slack","sms","webhook"],gb={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"}},pb=["id"],Sb=["id","enabled"],vb=["categories","channelMap"];function*hb(e){return yield Hi(bb,{payload:{api:e},type:""})}function*mb({payload:e=fb}){yield Bi(ub.setConnectivityState({isLoading:!0}));try{const t=yield zi([...e.map(hb),yield bb({payload:{api:"categories"},type:""}),yield function*(){return(yield zi(e.map((function*(e){return yield bb({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield bb({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?I({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:gb[e[o]].events(i),active:gb[e[o]].isActive(i),platform:gb[e[o]].title,image:gb[e[o]].image}]}):n:I({},n,{[`${vb[o-e.length]}`]:i})),{list:[],webhook:n});yield Bi(ub.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Bi(ub.setConnectivityState({isLoading:!1}))}}function*bb({payload:{api:e,params:t}}){try{return yield Hi(db[e],t)}catch(e){return}}function*Ab(){try{yield Bi(ub.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Hi(fd.connectivity.getSlackChannels);yield Bi(ub.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Bi(ub.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*kb(e,t){const{connectivity:{list:n}}=yield Qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=gb[e].isActive(t);o!==i.active&&(yield Bi(ub.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*Tb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Qi((e=>e.connectivity));try{if(yield Bi(ub.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield zi([...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=li(e,pb);return n===t.id&&JSON.stringify(I({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Hi(yb.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Hi(fd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Qi(),{processIds:i}=yield Qi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield zi([...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 Hi("email"===t?fd.connectivity.postEmailConfiguration:fd.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=li(o,Sb);return yield zi([yield Hi("email"===t?fd.connectivity.patchEmailConfiguration:fd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Hi("email"===t?fd.connectivity.putEmailSubscriptions:fd.connectivity.putSMSSubscriptions,a,i,I({},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 Hi("email"===t?fd.connectivity.deleteEmailSubscriptions:fd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield bb({payload:{api:t},type:""});yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield kb(t,e)}else yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Hi(yb[e],t),!["sms","email"].includes(e)){const o=yield bb({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield kb(e,o),null==n||n(!0)}}catch(e){var o;yield Bi(ub.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Pb({payload:e}){try{yield fd.connectivity.postSlackCode(e)}catch{}yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1}))}function*Ib(){const{slackChannels:e}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Hi(fd.connectivity.getSlackScope);yield Bi(ub.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Bi(ub.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Lb({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({isSaving:!0})),yield Hi(fd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield bb({payload:{api:"webhook"},type:""});o&&(yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*wb({payload:e}){try{yield Bi(ub.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Hi(fd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Ob({payload:e}){try{const{statusCode:t}=yield Hi(fd.connectivity.postWebhookRetry,e);yield Bi(ub.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Bi(ub.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Eb({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Hi(fd.connectivity.getWebhookLog,e,n,t);yield Bi(ub.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield Bi(ub.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Cb={sagas:function*(){yield Go(ub.loadDataAction,mb),yield Bo(ub.loadSlackActions,Ab),yield Go(ub.postDataAction,Tb),yield Go(ub.postCodeAction,Pb),yield Go(ub.loadScope,Ib),yield Go(ub.deleteWebhookConfigAction,Lb),yield Go(ub.postWebhookTestAction,wb),yield Go(ub.postWebhookRetryAction,Ob),yield Bo(ub.loadWebhookLogsAction,Eb)},storeName:Tt,initialState:lb,reducer:sb,actions:ub};function Db(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}}function Rb(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function _b(e){return Rb(e,((e,t)=>I({},e,{loading:t.payload})))}function Ub(e){return Rb(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const Mb={loading:!1,error:null,fetching:!0,plans:[]},{actions:Nb,reducer:$b,name:Fb}=at({name:"subscriptions/plans",initialState:Mb,reducers:I({},Db())}),xb=I({loadPlans:it(`${Fb}/loadPlans`)},Nb),Vb={loading:!1,error:null,fetching:!0,config:null},jb=I({},Db()),{actions:Wb,reducer:Kb,name:Gb}=at({name:"subscriptions/config",initialState:Vb,reducers:jb}),Bb=I({loadPaymentConfiguration:it(`${Gb}/loadPaymentConfiguration`)},Wb),zb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},qb=I({},Db(),{setCancellationLoading:_b("cancellation"),setCancellationError:Ub("cancellation"),setRenewalLoading:_b("renewal"),setRenewalError:Ub("renewal")}),{reducer:Hb,actions:Jb,name:Yb}=at({name:"subscriptions/billing/subscription",initialState:zb,reducers:qb}),Qb=I({load:it(`${Yb}/loadSubscription`),cancelSubscription:it(`${Yb}/cancelSubscription`),renewSubscription:it(`${Yb}/renewSubscription`)},Jb),Xb={loading:!1,error:null,fetching:!0},Zb=I({},Db()),{reducer:eA,actions:tA,name:nA}=at({name:"subscriptions/billing/information",initialState:Xb,reducers:Zb}),iA=I({loadBillingInformation:it(`${nA}/loadBillingInformation`),cancelSubscription:Qb.cancelSubscription,renewSubscription:Qb.renewSubscription},tA),oA={loading:!1,error:null,fetching:!0},aA=I({},Db(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:rA,actions:lA,name:sA}=at({name:"subscriptions/billing/payment",initialState:oA,reducers:aA}),cA=I({loadPaymentMethod:it(`${sA}/loadPaymentMethod`),submitPaymentMethod:it(`${sA}/submitPaymentMethod`),submitPaymentMethodError:it(`${sA}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${sA}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${sA}/updateBillingDetails`,(e=>({payload:e})))},lA),uA={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},dA=I({},Db(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:yA,actions:fA,name:gA}=at({name:"subscriptions/billing/invoices",initialState:uA,reducers:dA}),pA=I({loadInvoices:it(`${gA}/loadInvoices`),downloadInvoice:it(`${gA}/downloadInvoice`,(e=>({payload:e})))},fA),SA={information:Xb,invoices:uA,paymentMethod:oA,subscription:zb},vA={invoices:pA,information:iA,paymentMethod:cA,subscription:Qb},hA=$e({invoices:yA,information:eA,paymentMethod:rA,subscription:Hb}),mA={fetching:!0,loading:!1,error:null,confirmed:!1},bA=I({},Db()),{actions:AA,reducer:kA,name:TA}=at({name:"subscriptions/checkout",initialState:mA,reducers:bA}),PA=I({loadCheckout:it(`${TA}/loadCheckout`),resetCheckout:it(`${TA}/resetCheckout`),submitCheckout:it(`${TA}/submitCheckout`),confirmCheckout:it(`${TA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${TA}/errorCheckout`,(e=>({payload:e})))},AA),IA={loading:!1,error:null,cardSetupIntentSecret:null},LA=I({},Db()),{reducer:wA,actions:OA,name:EA}=at({name:"subscriptions/stripe",initialState:IA,reducers:LA}),CA=I({loadCustomer:it(`${EA}/loadCustomer`),createCardSetupIntentSecret:it(`${EA}/createCardSetupIntentSecret`)},OA),DA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:RA,reducer:_A,name:UA}=at({name:"subscriptions/vendorPublicConfig",initialState:DA,reducers:I({},Db())}),MA=I({loadVendorPublicConfiguration:it(`${UA}/loadVendorPublicConfiguration`)},RA),NA={config:Vb,plans:Mb,checkout:mA,billing:SA,stripe:IA,vendorPublicConfig:DA},$A={config:Bb,billing:vA,plans:xb,checkout:PA,stripe:CA,vendorPublicConfig:MA},FA=$e({config:Kb,billing:hA,plans:$b,checkout:kA,stripe:wA,vendorPublicConfig:_A});let xA,VA,jA;function WA({policy:e}){return{policy:jA.AT_PERIOD_END}}function KA(e){switch(e){case Mu.ACTIVE:return VA.ACTIVE;case Mu.INCOMPLETE:return VA.INCOMPLETE;case Mu.CANCELED:return VA.CANCELED;case Mu.EXPIRED:return VA.EXPIRED;case Mu.TRIALING:return VA.TRIALING;default:return VA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(xA||(xA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(VA||(VA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(jA||(jA={}));const GA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Mu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},BA=[{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"}],zA=[{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:""}],qA=[{id:"id",externalId:"externalId",type:Nu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],HA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*JA(){yield Go(Qb.load,YA),yield Go(Qb.cancelSubscription,XA),yield Go(Qb.renewSubscription,ZA)}function*YA(){const e=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield ok(e)}function*QA(){yield Bi(Qb.setLoading(!0));try{const[e]=yield Hi(fd.subscriptions.getManagedSubscriptions);yield Bi(Qb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Bi(Qb.setError(e))}}function*XA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Qb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Mu.ACTIVE)try{yield Bi(Qb.setCancellationLoading(!0)),yield Hi(fd.subscriptions.cancelManagedSubscription,t),yield QA(),yield Bi(Qb.setCancellationLoading(!1))}catch(e){yield Bi(Qb.setCancellationError(e.message))}}function*ZA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Qb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===$u.AT_PERIOD_END)try{yield Bi(Qb.setRenewalLoading(!0)),yield Hi(fd.subscriptions.renewManagedSubscription,t),yield QA(),yield Bi(Qb.setRenewalLoading(!1))}catch(e){yield Bi(Qb.setCancellationError(e.message))}}function*ek(){yield Bi(Qb.setLoading(!0)),yield Xi(500),yield Bi(Qb.setState({subscription:GA,fetching:!1,loading:!1,error:null}))}function*tk(){yield Go(Qb.load,ek)}function*nk(){yield Go(iA.loadBillingInformation,ik)}function*ik(){yield function*(e){const t=yield Qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield ok(n,!1):yield Bi(iA.setError(t?"Not authorized":"Internal feature failure"))}()}function*ok(e,t){yield Bi(iA.setLoading(!0));try{var n,i;const o=yield Hi(fd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Hi(fd.subscriptions.getSubscriptionPlan,a):([,l]=yield zi([Hi(QA),Hi(fd.subscriptions.getSubscriptionPlan,a)]),s=yield Qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Bi(iA.setState(I({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?VA.ACTIVE:KA(s.status),cancellation:s.cancellation&&WA(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 Bi(iA.setError(e.message))}}function*ak(){yield function*(){var e,t;yield Bi(iA.setLoading(!0)),yield Xi(500),yield Bi(iA.setState({loading:!1,fetching:!1,summary:{subscriptionId:GA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Fu.Stripe,externallyManaged:!1,currentPlanId:BA[0].id,defaultPlanId:BA[0].id},plan:I({},BA[0],{price:null==(e=BA[0].price)?void 0:e.amount,currency:null==(t=BA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*rk(){yield Go(iA.loadBillingInformation,ak)}function*lk(){yield Go(cA.loadPaymentMethod,sk),yield Go(cA.submitPaymentMethod,uk),yield Go(cA.submitPaymentMethodError,dk),yield Go(cA.submitPaymentMethodSuccess,yk),yield Go(cA.updatePaymentMethodBillingDetails,ck)}function*sk(){yield Bi(cA.setLoading(!0));try{const e=(yield Hi(fd.subscriptions.getPaymentMethods))[0];yield Bi(cA.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Bi(cA.setError(e.message))}}function*ck({payload:e}){yield Bi(cA.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Hi(fd.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Hi(sk),null==o||o(!0)}catch(e){yield Bi(cA.setError(e.message)),null==o||o(!1)}yield Bi(cA.setLoading(!1))}function*uk(){yield Bi(cA.setLoading(!0))}function*dk({payload:e}){yield Bi(cA.setError(e))}function*yk(){yield Bi(cA.loadPaymentMethod())}function*fk(){yield Bi(cA.setLoading(!0)),yield Xi(500);const e=qA[0];yield Bi(cA.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*gk(){yield Go(cA.loadPaymentMethod,fk)}function*pk(){yield Go(pA.loadInvoices,Sk),yield Go(pA.downloadInvoice,vk)}function*Sk(){yield Bi(pA.setLoading(!0));try{const e=(yield Hi(fd.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 Bi(pA.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Bi(pA.setError(e.message))}}function*vk({payload:e}){yield Bi(pA.setInvoiceDownloadState({loading:!0,error:null}));try{yield Hi(fd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Bi(pA.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Bi(pA.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*hk(){yield Bi(pA.setLoading(!0)),yield Xi(500),yield Bi(pA.setState({loading:!1,fetching:!1,invoices:zA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Bi(pA.setLoading(!1))}function*mk(){yield Go(pA.loadInvoices,hk)}function*bk(){yield zi([Hi(nk),Hi(lk),Hi(pk),Hi(JA)])}function*Ak(){yield zi([Hi(rk),Hi(gk),Hi(mk),Hi(tk)])}function*kk(){yield Go(PA.loadCheckout,Tk),yield Go(PA.resetCheckout,Pk),yield Go(PA.submitCheckout,Ik),yield Go(PA.confirmCheckout,Lk),yield Go(PA.errorCheckout,Ok)}function*Tk(){yield Bi(PA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Pk(){yield Bi(PA.setState({loading:!1,error:null,confirmed:!1}))}function*Ik(){yield Bi(PA.setState({loading:!0,error:null}))}function*Lk({payload:{paymentMethodId:e,planId:t}}){const n=yield Qi((e=>e.subscriptions.billing.subscription.subscription)),i=yield Qi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Mu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Bi(PA.setState({loading:!0,error:null})),o&&a)return yield wk(),void(yield Bi(Qb.setState({subscription:I({},n,{status:Mu.ACTIVE})})));try{yield Hi(fd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield zi([ik(),sk(),Sk()]),yield wk()}catch(e){yield Bi(PA.setState({loading:!1,error:e.message}))}}else yield Bi(PA.setState({loading:!1,error:"Subscription not found"}))}function*wk(){yield Bi(PA.setState({loading:!1,error:null,confirmed:!0}))}function*Ok({payload:e}){yield Bi(PA.setState({loading:!1,error:e}))}function*Ek(){yield Go(PA.resetCheckout,Pk)}function*Ck(){yield Go(xb.loadPlans,Dk)}function*Dk(){yield Bi(xb.setLoading(!0));try{const e=(yield Hi(fd.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 Bi(xb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Bi(xb.setError(e.message))}}function*Rk(){yield Bi(xb.setLoading(!0)),yield Xi(500),yield Bi(xb.setState({fetching:!1,loading:!1,plans:BA.map((e=>{var t,n;return I({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*_k(){yield Go(xb.loadPlans,Rk)}function*Uk(){yield Go(Bb.loadPaymentConfiguration,Mk)}function*Mk(){yield Bi(Bb.setLoading(!0));try{(yield Hi(fd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Fu.Stripe))?yield function*(){yield Bi(Bb.setLoading(!0));try{const e=yield Hi(fd.subscriptions.getStripePaymentProviderConfiguration);yield Bi(Bb.setState({loading:!1,fetching:!1,config:{paymentProvider:xA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Bi(Bb.setError(e.message))}}():yield Bi(Bb.setError("Payment provider not configured"))}catch(e){yield Bi(Bb.setError(e.message))}}function*Nk(){yield Bi(Bb.setLoading(!0)),yield Xi(500),yield Bi(Bb.setState({loading:!1,fetching:!1,config:{paymentProvider:xA.STRIPE,apiKey:""}}))}function*$k(){yield Go(Bb.loadPaymentConfiguration,Nk)}function*Fk(){yield Go(CA.createCardSetupIntentSecret,xk)}function*xk({payload:e}){yield Bi(CA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Hi(fd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Bi(CA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Bi(CA.setError(e.message))}}function*Vk(){yield Go(MA.loadVendorPublicConfiguration,jk)}function*jk(){yield Bi(MA.setLoading(!0));try{const e=yield Hi(fd.subscriptions.getVendorPublicConfigurations);yield Bi(MA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Bi(MA.setError(e.message))}}function*Wk(){yield Bi(MA.setLoading(!0)),yield Xi(500),yield Bi(MA.setState({fetching:!1,loading:!1,vendorPublicConfig:HA}))}function*Kk(){yield Go(MA.loadVendorPublicConfiguration,Wk)}var Gk={sagas:function*(){yield zi([Hi(bk),Hi(kk),Hi(Ck),Hi(Uk),Hi(Fk),Hi(Vk)])},mockSagas:function*(){yield zi([Hi(Ak),Hi(Ek),Hi(_k),Hi($k),Hi(Kk)])},reducer:FA,actions:$A,initialState:NA,storeName:"subscriptions"},Bk={sagas:function*(){yield Go(ry.loadVendorPublicInfo,ly)},storeName:It,initialState:iy,reducer:oy,actions:ry};const{reducer:zk}=at({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(qo.setContext(t),I({},e,{context:t}))}}}),qk=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||qo.setContext(e.context);const t=Mo(),h=[...tt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=nt({middleware:h,preloadedState:{root:I({},e,{previewMode:n,urlStrategy:r}),[Sm.storeName]:I({},Sm.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},Sm.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Wm.storeName]:I({},Wm.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Wm.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Wm.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Gm]:I({},Km,null!=(v=null==o?void 0:o.audits)?v:{}),[Cb.storeName]:Cb.initialState,[Gk.storeName]:Gk.initialState,[Bk.storeName]:Bk.initialState},reducer:$e({root:zk,[Sm.storeName]:Sm.reducer,[Wm.storeName]:Wm.reducer,[Gm]:zm,[Cb.storeName]:Cb.reducer,[Gk.storeName]:Gk.reducer,[Bk.storeName]:Bk.reducer})});const m=function*(){yield zi([Hi(Sm.sagas),Hi(Wm.sagas),Hi(ib),Hi(Cb.sagas),Hi(Gk.sagas),Hi(Bk.sagas)])},b=function*(){yield zi([Hi(Sm.mockSagas),Hi(Wm.mockSagas),Hi(Gk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Hn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var Hk=n(714),Jk=n.n(Hk);function Yk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Qk(e){if(e.type)return e;if("#"===e.charAt(0))return Qk(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 Xk(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 Zk(e){if(0===e.indexOf("#"))return e;const{values:t}=Qk(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 eT(e,t){if(e=Qk(e),t=Yk(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 Xk(e)}function tT(e,t){if(e=Qk(e),t=Yk(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 Xk(e)}const nT=e=>{if(e)return{main:e,light:Zk(tT(e,.4)),dark:Zk(eT(e,.15)),hover:Zk(eT(e,.15)),active:Zk(eT(e,.2))}},iT=e=>{if(e)return{main:e,light:tT(e,.7),dark:eT(e,.2)}},oT=(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)?I({},t,{palette:{primary:I({},nT(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:I({},nT(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:I({},nT(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},iT(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},iT(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},iT(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},iT(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},aT={},rT={},lT={},sT={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 cT{constructor(){this._theme=aT,this._themeV2=rT,this._navigation=sT,this._localizations=lT}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new cT;return n.set(e),cT._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=Jk().all([null!=(t=sT)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Jk().all([null!=(i=aT)?i:{},oT(null==e?void 0:e.theme,aT)]),this._themeV2=Jk().all([null!=(o=rT)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Jk().all([null!=(r=lT)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=sT,this._theme=aT,this._themeV2=rT,this._localizations=lT}}}cT._instances={};var uT={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},dT=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},yT=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},fT=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 gT,pT,ST,vT,hT,mT,bT,AT,kT,TT,PT,IT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(gT||(gT={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(pT||(pT={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(ST||(ST={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(vT||(vT={})),function(e){e.Invoices="invoices"}(hT||(hT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(mT||(mT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(bT||(bT={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(AT||(AT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(kT||(kT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(TT||(TT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(PT||(PT={})),function(e){e.CLIENT_CREDENTIALS="clientCredentials",e.ACCESS_TOKEN="accessToken"}(IT||(IT={}));const LT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},wT={hidden:"hidden",edit:"edit"};var OT="6.68.0",ET=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(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(OT),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=w(E().mark((function e(){var t,n,i,o,a;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Xo,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:cT.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=uT,e.next=13;break;case 4:return e.prev=4,e.next=7,Zu();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=dT(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=I({},t,{contextOptions:I({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?I({},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:qk({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),P.setInstance(c,this)}var t,n,i,o;return T(e,[{key:"initContainers",value:(o=w(E().mark((function e(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;cT.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:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=w(E().mark((function e(){var t;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=w(E().mark((function e(t){var n;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,I({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}(),CT=function(){function e(){A(this,e)}return T(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(qo.setAccessToken(t),qo.setUser(I({},n,{accessToken:t})),o.store.dispatch(Hn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Hn.loadTenants())):(qo.setAccessToken(null),qo.setUser(null),o.store.dispatch(Hn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),DT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),RT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),_T=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},UT=function(){function e(t,n,i,o){A(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:qk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new ET(this.options,t,!0),cT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,fT(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}(),MT="modern",NT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[MT]},$T=function(){function e(t,n,i,o){A(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:qk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new ET(this.options,t,!0),cT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,fT(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 FT(e,t){return FT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},FT(e,t)}function xT(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&&FT(e,t)}function VT(e){return VT="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},VT(e)}function jT(e,t){if(t&&("object"===VT(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 WT(e){return WT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WT(e)}function KT(){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 GT(e,t,n){return GT=KT()?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&&FT(o,n.prototype),o},GT.apply(null,arguments)}function BT(e){var t="function"==typeof Map?new Map:void 0;return BT=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 GT(e,arguments,WT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),FT(n,e)},BT(e)}function zT(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=WT(e);if(t){var o=WT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return jT(this,n)}}var qT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new ET(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){xT(n,e);var t=zT(n);function n(){var e;A(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 T(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=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=yT(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=yT(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=yT(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=yT(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=yT(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=yT(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}(BT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(w([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function w(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:O}}function O(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=w,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:w(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 DT},AdminPortalRenderer:function(){return UT},AppHolder:function(){return P},CheckoutDialog:function(){return RT},FronteggApp:function(){return ET},HostedLogin:function(){return CT},LoginBoxRenderer:function(){return $T},defaultTheme:function(){return MT},getThemeAdminByName:function(){return _T},getThemeByName:function(){return NT},initialize:function(){return qT}});var e={};n.r(e),n.d(e,{Delete:function(){return na},Get:function(){return Xo},Patch:function(){return ea},Post:function(){return Zo},PostDownload:function(){return ia},Put:function(){return ta},getBaseUrl:function(){return Yo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Fa},getSubTenantsAsTree:function(){return xa},getTenants:function(){return $a},switchTenant:function(){return Na}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return yr},OAuthLogout:function(){return Nr},SocialLoginProviders:function(){return dr},acceptInvitation:function(){return Rr},activateAccount:function(){return Or},bulkCreateIPRestriction:function(){return rr},changePhoneNumber:function(){return Ps},changePhoneNumberWithVerification:function(){return ks},checkIfAllowToRememberMfaDevice:function(){return Ql},createDomainRestriction:function(){return er},createIPRestriction:function(){return ar},createOrUpdateSessionConfigrations:function(){return Ml},createSSOConfiguration:function(){return ns},createSSOConfigurationByMetadata:function(){return as},createSSODomain:function(){return ls},createSSOGroup:function(){return ys},createSamlGroup:function(){return Al},createTenantAccessToken:function(){return Kl},createUserAccessToken:function(){return Wl},deleteAllSessionsForUser:function(){return $l},deleteDomainRestriction:function(){return nr},deleteIPRestriction:function(){return sr},deleteSSOConfiguration:function(){return os},deleteSSODomain:function(){return ss},deleteSSOGroup:function(){return gs},deleteSamlGroup:function(){return Tl},deleteSessionForUser:function(){return Nl},deleteTenantAccessToken:function(){return Vl},deleteTenantApiToken:function(){return Hl},deleteUserAccessToken:function(){return jl},deleteUserApiToken:function(){return Jl},disableMFAAuthenticatorApp:function(){return Yr},disableMFASMS:function(){return Xr},disableMFAWebAuthn:function(){return el},disableMfa:function(){return Jr},enrollMFAAuthenticatorApp:function(){return Kr},enrollMFAAuthenticatorAppForLogin:function(){return il},enrollMFASMS:function(){return Br},enrollMFASMSForLogin:function(){return rl},enrollMFAWebAuthn:function(){return qr},enrollMFAWebAuthnForLogin:function(){return ul},enrollMfa:function(){return jr},exchangeOAuthTokens:function(){return hs},forgotPassword:function(){return $r},generateLoginResponse:function(){return mr},generateLoginResponseFromOAuthResponse:function(){return Ar},generateLoginResponseV2:function(){return br},getActivateAccountStrategy:function(){return Er},getCaptchaPolicy:function(){return qa},getCurrentUserSession:function(){return Rl},getCurrentUserSessions:function(){return Dl},getDomainRestrictions:function(){return Xa},getDomainRestrictionsConfig:function(){return Za},getGlobalSecurityPolicy:function(){return Va},getIPRestrictions:function(){return ir},getIPRestrictionsConfig:function(){return or},getLockoutPolicy:function(){return Ga},getMFADevices:function(){return tl},getMFAStrategiesConfig:function(){return Cs},getMfaPolicy:function(){return ja},getOidcConfiguration:function(){return Pl},getPasswordConfigPolicy:function(){return Qa},getPasswordHistoryPolicy:function(){return Ha},getSSOConfigurations:function(){return ts},getSSODefaultRoles:function(){return us},getSSOGroups:function(){return ps},getSSOPublicConfiguration:function(){return Il},getSamlConfiguration:function(){return fl},getSamlRoles:function(){return hl},getSamlRolesGroups:function(){return ml},getSamlVendorConfiguration:function(){return pl},getSessionConfigurations:function(){return Ul},getSocialLoginProviders:function(){return Ll},getSocialLoginProvidersV2:function(){return wl},getTenantAccessTokensData:function(){return xl},getTenantApiTokensData:function(){return Bl},getUserAccessTokensData:function(){return Fl},getUserApiTokensData:function(){return Gl},getUserById:function(){return Yl},getVendorConfig:function(){return El},getVendorLockoutPolicy:function(){return Ba},getVendorMfaPolicy:function(){return Wa},getVendorPasswordHistoryPolicy:function(){return Ja},getVendorPublicAuthStrategiesConfig:function(){return Es},loadPasswordConfig:function(){return xr},login:function(){return Lr},loginViaSocialLogin:function(){return Ol},loginWithMfa:function(){return wr},logout:function(){return Mr},oidcPostLogin:function(){return Ir},oidcPostLoginV2:function(){return vs},passwordlessPostLogin:function(){return Zl},passwordlessPreLogin:function(){return Xl},postLogin:function(){return Pr},preDisableMFASMS:function(){return Qr},preDisableMFAWebAuthn:function(){return Zr},preEnrollMFAAuthenticatorApp:function(){return Wr},preEnrollMFAAuthenticatorAppForLogin:function(){return nl},preEnrollMFASMS:function(){return Gr},preEnrollMFASMSForLogin:function(){return al},preEnrollMFAWebAuthn:function(){return zr},preEnrollMFAWebAuthnForLogin:function(){return cl},preLogin:function(){return kr},preLoginV2:function(){return Ss},preLoginWithIdpType:function(){return Tr},preVerifyMFASMSForLogin:function(){return ll},preVerifyMFAWebAuthnForLogin:function(){return dl},recoverMfaToken:function(){return Vr},refreshToken:function(){return _r},refreshTokenV2:function(){return Ur},resendActivationEmail:function(){return Cr},resendInvitationEmail:function(){return Dr},resetPassword:function(){return Fr},resetPhoneNumber:function(){return bs},revokeSessionsForUser:function(){return _l},saveLockoutPolicy:function(){return za},saveMfaPolicy:function(){return Ka},savePasswordHistoryPolicy:function(){return Ya},setSSODefaultRoles:function(){return ds},signUpUser:function(){return Cl},silentOAuthRefreshToken:function(){return ms},testCurrentIp:function(){return cr},testCurrentIpInAllowList:function(){return ur},updateDomainRestrictionConfig:function(){return tr},updateIPRestrictionConfig:function(){return lr},updateSSOConfiguration:function(){return is},updateSSOConfigurationByMetadata:function(){return rs},updateSSOGroup:function(){return fs},updateSamlConfiguration:function(){return gl},updateSamlGroup:function(){return kl},updateSamlRoles:function(){return bl},updateSamlVendorMetadata:function(){return Sl},updateTenantApiTokensData:function(){return ql},updateUserApiTokensData:function(){return zl},validateSSODomain:function(){return cs},validateSamlDomain:function(){return vl},verifyChangePhoneNumber:function(){return Ts},verifyInviteToken:function(){return es},verifyMFAAuthenticatorAppForLogin:function(){return ol},verifyMFASMSForLogin:function(){return sl},verifyMFAWebAuthnForLogin:function(){return yl},verifyMfa:function(){return Hr},verifyNewDeviceSession:function(){return Os},verifyResetPhoneNumber:function(){return As},webAuthnCreateNewDeviceSession:function(){return ws},webAuthnPostLogin:function(){return Ls},webAuthnPreLogin:function(){return Is}});var a={};n.r(a),n.d(a,{addUser:function(){return Ns},changePassword:function(){return Us},createInviteUserLink:function(){return xs},deleteInviteUserLink:function(){return js},deleteUser:function(){return $s},getInviteLinkConfiguration:function(){return Ks},getInviteUserLink:function(){return Ws},getProfile:function(){return Ds},loadAvailablePermissions:function(){return Bs},loadAvailableRoles:function(){return Gs},loadStats:function(){return zs},loadUsers:function(){return Ms},resendActivationLink:function(){return qs},resendInvitationLink:function(){return Hs},resendInvitationLinkToAllTenants:function(){return Js},updateInviteUserLink:function(){return Vs},updateProfile:function(){return Rs},updateProfileImage:function(){return _s},updateUser:function(){return Fs}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return ec},getCurrentUserIpMetadata:function(){return Qs},getIpAdressMetadata:function(){return tc},getNotificationsMetadata:function(){return Xs},getSamlMetadata:function(){return Zs}});var l={};n.r(l),n.d(l,{downloadReport:function(){return cc},getReport:function(){return rc},getReports:function(){return ac},renderReport:function(){return lc},scheduleReport:function(){return sc},sendReport:function(){return uc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return dc},markAllAsRead:function(){return gc},updateNotificationIsPinned:function(){return fc},updateNotificationStatus:function(){return yc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return hc},getAudits:function(){return Sc},getAuditsStats:function(){return vc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Rc},deleteEmailSubscriptions:function(){return Cc},deleteSMSConfiguration:function(){return Fc},deleteSMSSubscriptions:function(){return Nc},deleteSlackConfiguration:function(){return Ic},deleteWebhooksConfiguration:function(){return jc},getCategories:function(){return Bc},getChannelMaps:function(){return zc},getEmailConfiguration:function(){return wc},getSMSConfiguration:function(){return _c},getSlackChannels:function(){return Tc},getSlackConfiguration:function(){return Ac},getSlackScope:function(){return kc},getWebhookLog:function(){return Wc},getWebhooksConfigurations:function(){return xc},patchEmailConfiguration:function(){return Ec},patchSMSConfiguration:function(){return Mc},postEmailConfiguration:function(){return Oc},postSMSConfiguration:function(){return Uc},postSlackCode:function(){return Lc},postSlackConfiguration:function(){return Pc},postWebhookRetry:function(){return Gc},postWebhookTest:function(){return Kc},postWebhooksConfiguration:function(){return Vc},putEmailSubscriptions:function(){return Dc},putSMSSubscriptions:function(){return $c}});var d={};n.r(d),n.d(d,{getSettings:function(){return Hc},updateSettings:function(){return qc}});var y={};n.r(y),n.d(y,{addRole:function(){return Zc},attachPermissionToRoles:function(){return ou},attachPermissionsToRole:function(){return nu},deleteRole:function(){return eu},getPermissionCategories:function(){return au},getPermissions:function(){return iu},getRoles:function(){return Xc},updateRole:function(){return tu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return $u},ISubscriptionStatus:function(){return Mu},PaymentMethodType:function(){return Nu},ProviderType:function(){return Fu},TenantCreatedAction:function(){return Vu},TrialEndAction:function(){return xu},cancelManagedSubscription:function(){return fu},cancelSubscription:function(){return su},createStripeCustomer:function(){return wu},createStripePaymentMethodSetupIntentSecret:function(){return Eu},createSubscription:function(){return Iu},createTenantConfiguration:function(){return Ru},getManagedSubscription:function(){return du},getManagedSubscriptions:function(){return yu},getPaymentMethod:function(){return Tu},getPaymentMethods:function(){return ku},getPaymentProviders:function(){return _u},getStripeCustomer:function(){return Lu},getStripePaymentProviderConfiguration:function(){return Ou},getSubscription:function(){return lu},getSubscriptionInvoice:function(){return mu},getSubscriptionInvoicePdf:function(){return bu},getSubscriptionInvoices:function(){return hu},getSubscriptionPlan:function(){return vu},getSubscriptionPlans:function(){return Su},getSubscriptionSummaries:function(){return Cu},getSubscriptions:function(){return ru},getTenantConfiguration:function(){return Du},getVendorPublicConfigurations:function(){return Uu},renewManagedSubscription:function(){return gu},renewSubscription:function(){return cu},updateManagedSubscription:function(){return pu},updatePaymentMethodBillingDetails:function(){return Pu},updateSubscription:function(){return uu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return zu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Yu},addUserToTenantAndSubTenants:function(){return Hu},loadAllUsers:function(){return qu},removeUserFromTenantAndSubTenants:function(){return Ju},removeUserRolesFromSubTenants:function(){return Qu},setUserRolesForSubTenants:function(){return Xu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Zu}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return od},createConfiguration:function(){return nd},deleteConfiguration:function(){return id},getConfigs:function(){return ed},updateConfiguration:function(){return td}});var h={};n.r(h),n.d(h,{impersonate:function(){return ad}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return yr},ContextHolder:function(){return qo},FronteggApiError:function(){return Jo},FronteggContext:function(){return Ho},ISubscriptionCancellationPolicy:function(){return $u},ISubscriptionStatus:function(){return Mu},MFAStrategyEnum:function(){return Ku},PaymentMethodType:function(){return Nu},ProviderType:function(){return Fu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return yd},SecondaryAuthStrategy:function(){return ju},SocialLoginProviders:function(){return dr},TenantType:function(){return Bu},UserManagedByEnum:function(){return Gu},WebAuthnDeviceType:function(){return Wu},api:function(){return fd},countConfigurationUsers:function(){return od},createConfiguration:function(){return nd},default:function(){return gd},deleteConfiguration:function(){return id},fetch:function(){return e},fronteggAuthApiRoutes:function(){return ld},fronteggLogoutApiRoutes:function(){return rd},fronteggRefreshTokenUrl:function(){return sd},fronteggSilentRefreshTokenUrl:function(){return cd},fronteggTenantsUrl:function(){return dd},fronteggUsersUrl:function(){return ud},getConfigs:function(){return ed},loadFeatureFlags:function(){return Zu},updateConfiguration:function(){return td}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(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 T(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return vT},ApiTokensMethods:function(){return IT},DomainRestrictionsTabFields:function(){return TT},GeneralSettingsTabFields:function(){return AT},InviteUserModalFields:function(){return ST},IpRestrictionsTabFields:function(){return kT},Metadata:function(){return cT},PrivacyPageFields:function(){return pT},ProfilePageFields:function(){return gT},SecurityPageTabs:function(){return mT},SessionManagementTabFields:function(){return bT},SsoPageTabs:function(){return PT},SubscriptionsPageFields:function(){return hT},fieldAppearance:function(){return LT},tabAppearance:function(){return wT}});var P=function(){function e(){A(this,e)}return T(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 I(){return I=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},I.apply(this,arguments)}function L(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 w(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){L(a,i,o,r,l,"next",e)}function l(e){L(a,i,o,r,l,"throw",e)}r(void 0)}))}}P._apps={};var O=n(841),E=n.n(O);function C(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 D(e){return!!e&&!!e[ve]}function R(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)===he}(e)||Array.isArray(e)||!!e[Se]||!!e.constructor[Se]||F(e)||x(e))}function _(e,t,n){void 0===n&&(n=!1),0===U(e)?(n?Object.keys:me)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function U(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:F(e)?2:x(e)?3:0}function M(e,t){return 2===U(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(e,t,n){var i=U(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function F(e){return ye&&e instanceof Map}function x(e){return fe&&e instanceof Set}function V(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=be(e);delete t[ve];for(var n=me(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 W(e,t){return void 0===t&&(t=!1),G(e)||D(e)||!R(e)||(U(e)>1&&(e.set=e.add=e.clear=e.delete=K),Object.freeze(e),t&&_(e,(function(e,t){return W(t,!0)}),!0)),e}function K(){C(2)}function G(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function B(e){var t=Ae[e];return t||C(18,e),t}function z(){return ue}function q(e,t){t&&(B("Patches"),e.u=[],e.s=[],e.v=t)}function H(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===ue&&(ue=e.l)}function Y(e){return ue={p:[],l:ue,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function X(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||B("ES5").S(t,e,i),i?(n[ve].P&&(H(t),C(4)),R(e)&&(e=Z(t,e),t.l||te(t,e)),t.u&&B("Patches").M(n[ve].t,e,t.u,t.s)):e=Z(t,n,[]),H(t),t.u&&t.v(t.u,t.s),e!==pe?e:void 0}function Z(e,t,n){if(G(t))return t;var i=t[ve];if(!i)return _(t,(function(o,a){return ee(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return te(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;_(3===i.i?new Set(o):o,(function(t,a){return ee(e,i,o,t,a,n)})),te(e,o,!1),n&&e.u&&B("Patches").R(i,n,e.u,e.s)}return i.o}function ee(e,t,n,i,o,a){if(D(o)){var r=Z(e,o,a&&t&&3!==t.i&&!M(t.D,i)?a.concat(i):void 0);if(N(n,i,r),!D(r))return;e.m=!1}if(R(o)&&!G(o)){if(!e.h.F&&e._<1)return;Z(e,o),t&&t.A.l||te(e,o)}}function te(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ne(e,t){var n=e[ve];return(n?V(n):e)[t]}function ie(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 oe(e){e.P||(e.P=!0,e.l&&oe(e.l))}function ae(e){e.o||(e.o=j(e.t))}function re(e,t,n){var i=F(t)?B("MapSet").N(t,n):x(t)?B("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=ke;n&&(o=[i],a=Te);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):B("ES5").J(t,n);return(n?n.A:z()).p.push(i),i}function le(e){return D(e)||C(22,e),function e(t){if(!R(t))return t;var n,i=t[ve],o=U(t);if(i){if(!i.P&&(i.i<4||!B("ES5").K(i)))return i.t;i.I=!0,n=se(t,o),i.I=!1}else n=se(t,o);return _(n,(function(t,o){i&&function(e,t){return 2===U(e)?e.get(t):e[t]}(i.t,t)===o||N(n,t,e(o))})),3===o?new Set(n):n}(e)}function se(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var ce,ue,de="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ye="undefined"!=typeof Map,fe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,pe=de?Symbol.for("immer-nothing"):((ce={})["immer-nothing"]=!0,ce),Se=de?Symbol.for("immer-draftable"):"__$immer_draftable",ve=de?Symbol.for("immer-state"):"__$immer_state",he=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),me="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,be=Object.getOwnPropertyDescriptors||function(e){var t={};return me(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},ke={get:function(e,t){if(t===ve)return e;var n=V(e);if(!M(n,t))return function(e,t,n){var i,o=ie(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||!R(i)?i:i===ne(e.t,t)?(ae(e),e.o[t]=re(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=ie(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ne(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||M(e.t,t)))return!0;ae(e),oe(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!==ne(e.t,t)||t in e.t?(e.D[t]=!1,ae(e),oe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(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(){C(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){C(12)}},Te={};_(ke,(function(e,t){Te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Te.deleteProperty=function(e,t){return Te.set.call(this,e,t,void 0)},Te.set=function(e,t,n){return ke.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,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&&C(6),void 0!==i&&"function"!=typeof i&&C(7),R(e)){var l=Y(t),s=re(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?H(l):J(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return q(l,i),X(e,l)}),(function(e){throw H(l),e})):(q(l,i),X(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===pe&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];B("Patches").M(e,r,u,d),i(u,d)}return r}C(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){R(e)||C(8),D(e)&&(e=le(e));var t=Y(this),n=re(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return q(n,t),X(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&C(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=B("Patches").$;return D(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ie=new Pe,Le=Ie.produce,we=(Ie.produceWithPatches.bind(Ie),Ie.setAutoFreeze.bind(Ie),Ie.setUseProxies.bind(Ie),Ie.applyPatches.bind(Ie),Ie.createDraft.bind(Ie),Ie.finishDraft.bind(Ie),Le);function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function De(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 Re="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ue={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function Me(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 Ne(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(De(1));return n(Ne)(e,t)}if("function"!=typeof e)throw new Error(De(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(De(3));return a}function d(e){if("function"!=typeof e)throw new Error(De(4));if(s)throw new Error(De(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(De(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Me(e))throw new Error(De(7));if(void 0===e.type)throw new Error(De(8));if(s)throw new Error(De(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(De(10));o=e,y({type:Ue.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(De(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Re]=function(){return this},e}return y({type:Ue.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Re]=g,i}function $e(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:Ue.INIT}))throw new Error(De(12));if(void 0===n(void 0,{type:Ue.PROBE_UNKNOWN_ACTION()}))throw new Error(De(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(De(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Fe(){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 xe(){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(De(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Fe.apply(void 0,a)(n.dispatch),Ce(Ce({},n),{},{dispatch:i})}}}function Ve(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 je=Ve();je.withExtraArgument=Ve;var We,Ke=je,Ge=(We=function(e,t){return We=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])},We(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}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Be=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},ze=Object.defineProperty,qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),He=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))He.call(t,n)&&Ye(e,n,t[n]);if(qe)for(var i=0,o=qe(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Xe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Ze=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 Ge(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,Be([void 0],e[0].concat(this)))):new(t.bind.apply(t,Be([void 0],e.concat(this))))},t}(Array);function et(e){return R(e)?we(e,(function(){})):e}function tt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Ze);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Ke):i.push(Ke.withExtraArgument(n.extraArgument))),i}function nt(e){var t,n=function(e){return tt(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=$e(a)}var g=l;"function"==typeof g&&(g=g(n));var p=xe.apply(void 0,g),S=Fe;c&&(S=Xe(Qe({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Be([p],f):"function"==typeof f&&(v=f(v)),Ne(t,d,S.apply(void 0,v))}function it(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 Qe(Qe({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 ot(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 at(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:et(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ot(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=Qe(Qe({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ot(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return et(e())};else{var c=et(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Be([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(D(e))return void 0===(i=n(e,t))?e:i;if(R(e))return we(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?it(c,i):it(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 rt="listenerMiddleware";it(rt+"/add"),it(rt+"/removeAll"),it(rt+"/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[ve];return ke.get(t,e)},set:function(t){var n=this[ve];ke.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&oe(o);break;case 4:n(o)&&oe(o)}}}function n(e){for(var t=e.t,n=e.k,i=me(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!M(t,a))return!0;var l=n[a],s=l&&l[ve];if(s?s.t!==r:!$(l,r))return!0}}var c=!!t[ve];return i.length!==me(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){Ae[e]||(Ae[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=be(n);delete a[ve];for(var r=me(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:z(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?D(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)_(a,(function(t){t!==ve&&(void 0!==o[t]||M(o,t)?r[t]||e(a[t]):(r[t]=!0,oe(n)))})),_(o,(function(e){void 0!==a[e]||M(a,e)||(r[e]=!1,oe(n))}));else if(5===l){if(i(n)&&(oe(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 lt=(e,t)=>n=>I({},n,{[e]:t[e]}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),ct=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return I({},n,{[e]:I({},n[e],{[t]:I({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{loaders:I({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{errors:I({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),yt=(e=500)=>new Promise((t=>setTimeout(t,e))),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",gt=new Uint8Array(256);for(let e=0;e<ft.length;e++)gt[ft.charCodeAt(e)]=e;const pt=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=gt[e.charCodeAt(i)],a=gt[e.charCodeAt(i+1)],r=gt[e.charCodeAt(i+2)],l=gt[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},St=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(St(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+=ft[t[i]>>2],o+=ft[(3&t[i])<<4|t[i+1]>>4],o+=ft[(15&t[i+1])<<2|t[i+2]>>6],o+=ft[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]=St(e[n]);return t}return e};let vt,ht,mt;!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"}(vt||(vt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(ht||(ht={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(mt||(mt={}));const bt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",At="HOSTED_LOGIN_VERIFIER_KEY",kt="auth",Tt="connectivity",Pt="auditLogs",It="vendor",Lt={flow:ht.Login,step:vt.preLogin,loading:!1,email:"",tenants:[]},wt={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},Ot={requestAuthorize:it("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:it("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:it("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:it("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:it("auth/afterAuthNavigation"),preLogin:it("auth/preLogin",(e=>({payload:e}))),postLogin:it("auth/postLogin",(e=>({payload:e}))),login:it("auth/login",(e=>({payload:e}))),loginWithMfa:it("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:it("auth/recoverMfa",(e=>({payload:e}))),logout:it("auth/logout",(e=>({payload:e}))),silentLogout:it("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:it("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:it("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:it("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:it("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:it("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:it("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:it("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:it("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:it("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:it("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:it("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:it("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:it("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:it("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:it("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:it("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:it("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:it("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:it("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:it("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:it("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Et;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Et||(Et={}));const Ct={step:Et.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Dt={setActivateState:st("activateState"),resetActivateState:lt("activateState",{activateState:Ct}),setActivateStrategyState:ct("activateState","activationStrategy")},Rt={activateAccount:it("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:it("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:it("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:it("auth/resendActivationEmail",(e=>({payload:e})))};let _t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(_t||(_t={}));const Ut={step:_t.validate},Mt={setAcceptInvitationState:st("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ut})},Nt={acceptInvitation:it("auth/acceptInvitation",(e=>({payload:e})))};let $t;!function(e){e.forgotPassword="forgotPassword",e.success="success"}($t||($t={}));const Ft={step:$t.forgotPassword,loading:!1,email:"",passwordConfig:null},xt={setForgotPasswordState:st("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Ft})},Vt={forgotPassword:it("auth/forgotPassword",(e=>({payload:e}))),resetPassword:it("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:it("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Wt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:st("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Wt})},Gt={resetPhoneNumber:it("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:it("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:it("auth/changePhoneNumber",(e=>({payload:e})))},Bt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},zt={setSSOLoader:ut("ssoState"),setSSOError:dt("ssoState"),setSSOState:st("ssoState"),resetSSOState:lt("ssoState",{ssoState:Bt})},qt={loadSSOConfigurationsV2:it("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:it("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:it("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:it("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:it("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:it("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:it("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:it("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:it("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:it("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:it("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:it("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:it("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:it("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:it("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:it("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:it("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:it("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:it("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:it("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:it("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:it("auth/oidcPostlogin",(e=>({payload:e})))},Ht={loading:!1,error:null},Jt={setProfileState:st("profileState"),resetProfileState:lt("profileState",{profileState:Ht})},Yt={loadProfile:it("auth/loadProfile"),saveProfile:it("auth/saveProfile",(e=>({payload:e}))),changePassword:it("auth/changePassword",(e=>({payload:e})))};let Qt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Qt||(Qt={}));const Xt={step:Qt.verify,loading:!1,saving:!1},Zt={setMfaState:st("mfaState"),resetMfaState:lt("mfaState",{mfaState:Xt})},en={enrollMfa:it("auth/enrollMfa"),getMFADevices:it("auth/getMFADevices"),getMFAStrategies:it("auth/getMFAStrategies"),verifyMfa:it("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:it("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:it("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:it("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:it("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:it("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:it("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:it("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:it("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:it("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:it("auth/disableMfaWebAuthn",(e=>({payload:e})))},tn={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}},nn={setTeamLoader:ut("teamState"),setTeamError:dt("teamState"),setTeamState:st("teamState"),resetTeamState:lt("teamState",{teamState:tn})},on={loadUsers:it("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:it("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:it("auth/loadRoles",(e=>({payload:e}))),addUser:it("auth/addUser",(e=>({payload:e}))),addUsersBulk:it("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:it("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:it("auth/updateUser",(e=>({payload:e}))),deleteUser:it("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:it("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:it("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:it("auth/lockUser",(e=>({payload:e}))),resendActivationLink:it("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:it("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:it("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:it("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:it("auth/getInvitationLink"),createInvitationLink:it("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:it("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:it("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:it("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:it("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:it("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:it("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:it("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:it("auth/closeLockUserDialog",(e=>({payload:e})))},an={firstLoad:!0,loading:!1,error:""},rn={setSocialLoginsState:st("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:an})},ln={loadSocialLoginsConfiguration:it("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:it("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:it("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:it("auth/setSocialLoginError",(e=>({payload:e})))};let sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(sn||(sn={}));const cn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:sn.SignUp},un={setSignUpState:st("signUpState"),resetSignUpState:lt("signUpState",{signUpState:cn})},dn={signUpUser:it("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:it("auth/resetSignUpStateSoft")},yn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},fn={setApiTokensLoader:ut("apiTokensState"),setApiTokensError:dt("apiTokensState"),setApiTokensState:st("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:yn})},gn={loadApiTokens:it("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:it("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:it("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:it("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:it("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:it("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:it("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:it("auth/deleteTenantApiToken",(e=>({payload:e})))},pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Sn={setSecurityPolicyState:st("securityPolicyState"),setSecurityPolicyGlobalState:ct("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ct("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ct("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ct("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ct("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ct("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ct("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ct("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ct("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ct("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ct("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:pn})},vn={loadSecurityPolicy:it("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:it("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:it("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:it("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:it("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:it("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:it("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:it("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:it("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:it("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:it("auth/loadPublicAuthStrategiesPolicy")},hn={loading:!1},mn={setAccountSettingsState:st("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:hn})},bn={loadAccountSettings:it("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:it("auth/saveAccountSettings",(e=>({payload:e})))},An={tenants:[],subTenants:[],loading:!0,tenantTree:null},kn={setTenantsState:st("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:An})},Tn={switchTenant:it("auth/switchTenant",(e=>({payload:e}))),loadTenants:it("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:it("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:it("auth/loadSubTenantsTree",(e=>({payload:e})))},Pn={loading:!1,roles:[],permissions:[],permissionCategories:[]},In={setRolesState:st("rolesState"),resetRolesState:lt("rolesState",{rolesState:Pn})},Ln={loadRolesAndPermissions:it("auth/loadRoles",(e=>({payload:e}))),addRole:it("auth/addRole",(e=>({payload:e}))),updateRole:it("auth/updateRole",(e=>({payload:e}))),deleteRole:it("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:it("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:it("auth/attachPermissionToRoles",(e=>({payload:e})))},wn={loading:!1,sessions:[]},On={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:wn})},En={loadUserSessions:it("auth/loadUserSessions"),loadCurrentUserSession:it("auth/loadCurrentUserSession"),deleteUserSession:it("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:it("auth/deleteAllUserSessions"),revokeUserSessions:it("auth/revokeUserSessions",(e=>({payload:e})))},Cn={loading:!1,configurations:{}},Dn={setSessionsPolicyState:st("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Cn})},Rn={loadSessionsPolicy:it("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:it("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let _n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(_n||(_n={}));const Un={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:_n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Mn={setRestrictionsState:st("restrictionsState"),setIpRestrictionsState:ct("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ct("restrictionsState","emailDomainRestrictions")},Nn={checkIfUserIpValid:it("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:it("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:it("auth/loadIpRestrictions"),saveIpRestriction:it("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:it("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:it("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:it("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:it("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:it("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:it("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},$n={loading:!1},Fn={setProvisioningState:st("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:$n})},xn={loadProvisionConnections:it("auth/loadProvisionConnections"),createProvisionConnection:it("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:it("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:it("auth/updateProvisionConnection",(e=>({payload:e})))},Vn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:cn,loginState:Lt,activateState:Ct,acceptInvitationState:Ut,forgotPasswordState:Ft,ssoState:Bt,profileState:Ht,mfaState:Xt,teamState:tn,socialLoginState:an,apiTokensState:yn,securityPolicyState:pn,accountSettingsState:hn,tenantsState:An,rolesState:Pn,resetPhoneNumberState:Wt,sessionsState:wn,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",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:()=>{}},Vn);let Wn;!function(e){e.impersonating="impersonating",e.success="success"}(Wn||(Wn={}));const Kn={step:Wn.impersonating,loading:!1},Gn={setImpersonateState:st("impersonateState"),resetImpersonateState:lt("impersonateState",{impersonateState:Kn})},Bn={impersonate:it("impersonation/impersonate",(e=>({payload:e})))},{reducer:zn,actions:qn}=at({name:kt,initialState:jn,reducers:I({resetState:e=>I({},e,Vn),setState:(e,{payload:t})=>I({},e,t),setUser:("user",(e,{payload:t})=>I({},e,{user:t}))},wt,rn,Dt,Gn,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,On,Dn,Mn,Fn)});const Hn=I({},qn,Ot,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,En,Rn,Nn,xn,Bn);var Jn=function(e){return"@@redux-saga/"+e},Yn=Jn("CANCEL_PROMISE"),Qn=Jn("CHANNEL_END"),Xn=Jn("IO"),Zn=Jn("MATCH"),ei=Jn("MULTICAST"),ti=Jn("SAGA_ACTION"),ni=Jn("SELF_CANCELLATION"),ii=Jn("TASK"),oi=Jn("TASK_CANCEL"),ai=Jn("TERMINATE"),ri=Jn("LOCATION");function li(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 si=function(e){return null==e},ci=function(e){return null!=e},ui=function(e){return"function"==typeof e},di=function(e){return"string"==typeof e},yi=Array.isArray,fi=function(e){return e&&ui(e.then)},gi=function(e){return e&&ui(e.next)&&ui(e.throw)},pi=function e(t){return t&&(di(t)||hi(t)||ui(t)||yi(t)&&t.every(e))},Si=function(e){return e&&ui(e.take)&&ui(e.close)},vi=function(e){return ui(e)&&e.hasOwnProperty("toString")},hi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},mi=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[Yn]=function(){clearTimeout(n)},i},bi=function(e){return function(){return e}},Ai=bi(!0),ki=function(){},Ti=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Pi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ii(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Li=function(e){throw e},wi=function(e){return{value:e,done:!0}};function Oi(e,t,n){void 0===t&&(t=Li),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:wi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ei(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ci=function(e){return Array.apply(null,new Array(e))},Di=function(e){return function(t){return e(Object.defineProperty(t,ti,{value:!0}))}},Ri=function(e){return e===ai},_i=function(e){return e===oi},Ui=function(e){return Ri(e)||_i(e)};function Mi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=yi(e)?Ci(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ui(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=ki,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ni(e){return{name:e.name||"anonymous",location:$i(e)}}function $i(e){return e[ri]}var Fi=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)},xi="TAKE",Vi="CALL",ji="FORK",Wi="SELECT",Ki=function(e,t){var n;return(n={})[Xn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Gi(e,t){return void 0===e&&(e="*"),pi(e)?(ci(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ki(xi,{pattern:e})):Si(n=e)&&n[ei]&&ci(t)&&pi(t)?Ki(xi,{channel:e,pattern:t}):Si(e)?(ci(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ki(xi,{channel:e})):void 0;var n}function Bi(e,t){return si(t)&&(t=e,e=void 0),Ki("PUT",{channel:e,action:t})}function zi(e){var t=Ki("ALL",e);return t.combinator=!0,t}function qi(e,t){var n,i=null;return ui(e)?n=e:(yi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&di(n)&&ui(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Hi(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 Ki(Vi,qi(e,n))}function Ji(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(ji,qi(e,n))}function Yi(e){return void 0===e&&(e=ni),Ki("CANCEL",e)}function Qi(e){void 0===e&&(e=Ti);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(Wi,{selector:e,args:n})}var Xi=Hi.bind(null,mi);var Zi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},eo=[],to=0;function no(e){try{ao(),e()}finally{ro()}}function io(e){eo.push(e),to||(ao(),lo())}function oo(e){try{return ao(),e()}finally{lo()}}function ao(){to++}function ro(){to--}function lo(){var e;for(ro();!to&&void 0!==(e=eo.shift());)no(e)}var so=function(e){return function(t){return e.some((function(e){return go(e)(t)}))}},co=function(e){return function(t){return e(t)}},uo=function(e){return function(t){return t.type===String(e)}},yo=function(e){return function(t){return t.type===e}},fo=function(){return Ai};function go(e){var t="*"===e?fo:di(e)?uo:yi(e)?so:vi(e)?uo:ui(e)?co:hi(e)?yo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var po={type:Qn},So=function(e){return e&&e.type===Qn};function vo(){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(po)}))},(e={})[ei]=!0,e.put=function(e){if(!t)if(So(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Zn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=fo),t?e(po):(e[Zn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ii(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[ti]?l(e):io((function(){l(e)}))},r}function ho(e,t){var n=e[Yn];ui(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var mo,bo=0,Ao=function(){return++bo};function ko(e){e.isRunning()&&e.cancel()}var To=((mo={}).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):!So(e)||r?n(e):n(ai)};try{o.take(l,ci(a)?go(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},mo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;io((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&fi(t)?ho(t,n):n(t)}))},mo.ALL=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t);if(0!==r.length){var l=Mi(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(yi(t)?[]:{})},mo.RACE=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t),l=yi(t)?Ci(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ui(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=ki,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)}))},mo.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(fi(s))return void ho(s,n);if(gi(s))return void _o(e,s,l.context,bo,Ni(a),!1,n);n(s)}catch(e){n(e,!0)}},mo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){si(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},mo.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(gi(o))return o;var a=!1;return Oi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!fi(o)})}))}catch(e){return Oi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ni(t)}(c,a);oo((function(){var t=_o(e,c,s.context,bo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},mo.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()&&Ii(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(yi(t)){if(0===t.length)return void n([]);var r=Mi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},mo.CANCEL=function(e,t,n,i){var o=i.task;t===ni?ko(o):yi(t)?t.forEach(ko):ko(t),n()},mo.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)}},mo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Fi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(po):e.isEmpty()?(n.push(i),i.cancel=function(){Ii(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(po):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])(po)}}}}(t.buffer),a=go(i),r=function t(n){So(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)},mo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},mo.FLUSH=function(e,t,n){t.flush(n)},mo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},mo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Pi(o.context,t),n()},mo);function Po(e,t){return e+"?"+t}function Io(e){var t=e.name,n=e.location;return n?t+" "+Po(n.fileName,n.lineNumber):t}function Lo(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 wo=null,Oo=[],Eo=function(e){e.crashedEffect=wo,Oo.push(e)},Co=function(){wo=null,Oo.length=0},Do=function(){var e,t,n=Oo[0],i=Oo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=$i(e))?t.code+" "+Po(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Io(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Io(e.meta)})),[Lo(Oo)]).join("\n")};function Ro(e,t,n,i,o,a,r){var l;void 0===r&&(r=ki);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Ii(o,t),t.cont=ki,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=ki,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Eo({meta:o,cancelledTasks:y}),S.isRoot){var i=Do();Co(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===oi?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={})[ii]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(oi,!1))},l.cont=r,l.end=p,l.setContext=function(e){Pi(f,e)},l.toPromise=function(){return d||(d=Zi(),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 _o(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){fi(t)?ho(t,i):gi(t)?_o(e,t,c.context,n,o,!1,i):t&&t[Xn]?(0,To[t.type])(e,t.payload,i,u):i(t)}));d.cancel=ki;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(oi))},status:0},c=Ro(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),Co()):_i(e)?(s.status=1,d.cancel(),o=ui(t.return)?t.return(oi):{done:!0,value:oi}):o=Ri(e)?ui(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=Ao();function s(n,o){a||(a=!0,i.cancel=ki,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){wo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=ki,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=ki,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Uo(e,t){for(var n=e.channel,i=void 0===n?vo():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?Ei:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Ao();if(s&&(s.rootSagaStarted=s.rootSagaStarted||ki,s.effectTriggered=s.effectTriggered||ki,s.effectResolved=s.effectResolved||ki,s.effectRejected=s.effectRejected||ki,s.effectCancelled=s.effectCancelled||ki,s.actionDispatched=s.actionDispatched||ki,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Fe.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Ti;var m={channel:i,dispatch:Di(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return oo((function(){var e=_o(m,S,l,v,Ni(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Mo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?vo():a,l=n.sagaMonitor,s=li(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Uo.bind(null,I({},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){Pi(o,e)},c},No=function(e){return{done:!0,value:e}},$o={};function Fo(e){return Si(e)?"channel":vi(e)?String(e):ui(e)?e.name:String(e)}function xo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===$o)return No(t);if(n&&!o)throw r=$o,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===$o?No(t):a}return Oi(l,(function(e){return l(null,e)}),n)}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Gi(e)},l=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Fo(e)+", "+t.name+")")}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Gi(e)},s=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Yi(e)}},u=function(e){return a=e},d=function(e){return r=e};return xo({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("+Fo(e)+", "+t.name+")")}function Wo(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:Gi(e)},l=function(e){return{done:!1,value:Hi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Fo(e)+", "+t.name+")")}function Ko(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:Hi.apply(void 0,[n].concat(a))},s={done:!1,value:Xi(t)};return xo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:$o}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Go(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Vo,e,t].concat(i))}function Bo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[jo,e,t].concat(i))}function zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Wo,e,t].concat(i))}class qo{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 qo.instance||(qo.instance=new qo),qo.instance}static setContext(e){qo.getInstance().context=e}static setAccessToken(e){qo.getInstance().accessToken=e}static setUser(e){qo.getInstance().user=e}static setOnRedirectTo(e){qo.getInstance().onRedirectTo=e}static setLogout(e,t){qo.getInstance().logout=n=>{n?e(n):qo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=qo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return qo.getInstance().accessToken}static getUser(){return qo.getInstance().user}static onRedirectTo(e,t){return qo.getInstance().onRedirectTo(e,t)}static logout(e){return qo.getInstance().logout(e)}}qo.instance=void 0;const Ho={getContext:()=>qo.getContext(),getAccessToken:()=>qo.getAccessToken(),getUser:()=>qo.getUser(),onRedirectTo:(e,t)=>qo.onRedirectTo(e,t),logout:e=>qo.logout(e)};class Jo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Yo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const Qo=async e=>{var t,n,i;const o=qo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:qo.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=Yo(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:I({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Jo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Jo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Xo=async(e,t,n)=>Qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Zo=async(e,t,n)=>Qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),ea=async(e,t,n)=>Qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ta=async(e,t,n)=>Qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),na=async(e,t,n)=>Qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),ia=async(e,t,n,i)=>Qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),oa={v1:"/identity/resources/users/webauthn/v1/devices"},aa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ra={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-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"}}},la={v1:"/identity/resources/configurations/v1"},sa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ca={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ua={v1:"/identity/resources/permissions/v1"},da={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},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"}}},ya={v1:"/identity/resources/roles/v1"},fa={v1:"/identity/resources/sub-tenants/users/v1"},ga={v1:"/identity/resources/impersonation/v1"},pa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Sa={v1:"/team/resources/members/v1"},va={v1:"/team/resources/roles/v1"},ha={v1:"/team/resources/stats/v1"},ma={v1:"/team/resources/profile"},ba={v1:"/tenants/resources/account-settings/v1"},Aa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ka={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ta={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"},Ia={v1:"/subscriptions/resources/subscriptions/v1"},La={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},wa={v1:"/reports/engine/resources/triggers/v1"},Oa="/notification",Ea="/audits",Ca={v1:"/event/resources/configurations/v1"},Da="/webhook",Ra="/oauth",_a="/flags",Ua="/directory/resources/v1/configurations/scim2",Ma="/directory/resources/scim/temp";async function Na(e){return ta(`${ra.v1}/tenant`,e)}async function $a(){return Xo(`${ra.v2}/me/tenants`)}async function Fa(){return Xo(Aa.v1)}async function xa(){return Xo(Aa.tree.v1)}async function Va(){return Xo(la.v1)}async function ja(){return Xo(`${la.v1}/mfa-policy`)}async function Wa(){return Xo(`${la.v1}/mfa-policy/vendor`)}async function Ka(e){return e.id?ea(`${la.v1}/mfa-policy`,e):Zo(`${la.v1}/mfa-policy`,e)}async function Ga(){return Xo(`${la.v1}/lockout-policy`)}async function Ba(){return Xo(`${la.v1}/lockout-policy/vendor`)}async function za(e){return e.id?ea(`${la.v1}/lockout-policy`,e):Zo(`${la.v1}/lockout-policy`,e)}async function qa(){try{return await Xo(`${la.v1}/captcha-policy/public`)}catch{return null}}async function Ha(){return Xo(`${la.v1}/password-history-policy`)}async function Ja(){return Xo(`${la.v1}/password-history-policy/vendor`)}async function Ya(e){return e.id?ea(`${la.v1}/password-history-policy`,e):Zo(`${la.v1}/password-history-policy`,e)}async function Qa(){return Xo(`${la.v1}/password`)}async function Xa(){return Xo(`${sa.emailDomain.v1}`)}async function Za(){return Xo(`${sa.emailDomain.v1}/config`)}async function er(e){return Zo(`${sa.emailDomain.v1}`,e)}async function tr(e){return Zo(`${sa.emailDomain.v1}/config`,e)}async function nr(e){return na(`${sa.emailDomain.v1}/${e}`)}async function ir(e){return Xo(`${sa.ip.v1}`,e)}async function or(){return Xo(`${sa.ip.v1}/config`)}async function ar(e){return Zo(`${sa.ip.v1}`,e)}async function rr(e){return Zo(`${sa.ip.v1}/bulk`,e)}async function lr(e){return Zo(`${sa.ip.v1}/config`,e)}async function sr(e){return na(`${sa.ip.v1}/${e}`)}async function cr(){return Zo(`${sa.ip.v1}/verify`)}async function ur(){return Zo(`${sa.ip.v1}/verify/allow`)}let dr,yr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(dr||(dr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(yr||(yr={}));class fr extends Error{constructor(e){super(e)}}const gr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new fr("'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 pr extends Error{constructor(e){super(e)}}const Sr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(gr(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 gr(t)}})(e.split(".")[n]))}catch(e){throw new pr("Invalid token specified: "+e.message)}},vr=["type"],hr=["type"];async function mr(e){if(!e.accessToken)return e;qo.setAccessToken(e.accessToken);const t=await Xo(`${ra.v2}/me`),n=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(n),n}async function br(e){if(!e.accessToken)return{user:e};qo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Xo(`${ra.v2}/me`),$a()]),i=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(i),{user:i,tenants:n}}async function Ar(e){qo.setAccessToken(e.id_token);const t=await Xo(`${ra.v2}/me`),n=e.id_token?Sr(e.id_token):{},i=I({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 qo.setUser(i),i}async function kr(e){try{const{address:t}=await Zo(`${aa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Tr(e){return Zo(`${aa.v1}/user/saml/prelogin`,e)}async function Pr(e){return mr(await Zo(`${aa.v1}/user/saml/postlogin`,e))}async function Ir(e){return mr(await Zo(`${aa.v1}/user/oidc/postlogin`,e))}async function Lr(e){return mr(await Zo(`${aa.v1}/user`,e))}async function wr(e){return mr(await Zo(`${aa.v1}/user/mfa/verify`,e))}async function Or(e){return Zo(`${ra.v1}/activate`,e)}async function Er(e){return Xo(`${ra.v1}/activate/strategy`,e)}async function Cr(e){return Zo(`${ra.v1}/activate/reset`,e)}async function Dr(e){return Zo(`${ra.v1}/invitation/reset`,e)}async function Rr(e){return Zo(`${ra.v1}/invitation/accept`,e)}async function _r(){return mr(await Zo(`${aa.v1}/user/token/refresh`))}async function Ur(){return br(await Zo(`${aa.v1}/user/token/refresh`))}async function Mr(){return Zo(`${aa.v1}/logout`)}async function Nr(e){return Xo(`${Ra}/logout`,e)}async function $r(e){return Zo(`${ra.v1}/passwords/reset`,e)}async function Fr(e){return Zo(`${ra.v1}/passwords/reset/verify`,e)}async function xr(e){return Xo(`${ra.v1}/passwords/config`,e)}async function Vr(e){return Zo(`${aa.v1}/user/mfa/recover`,e)}async function jr(){return Zo(`${ra.v1}/mfa/enroll`)}async function Wr(){return Zo(`${ra.v1}/mfa/authenticator/enroll`)}async function Kr(e){return Zo(`${ra.v1}/mfa/authenticator/enroll/verify`,e)}async function Gr(e){return Zo(`${ra.v1}/mfa/sms/enroll`,e)}async function Br(e){return Zo(`${ra.v1}/mfa/sms/enroll/verify`,e)}async function zr(){return Zo(`${ra.v1}/mfa/webauthn/enroll`)}async function qr(e){return Zo(`${ra.v1}/mfa/webauthn/enroll/verify`,e)}async function Hr(e){return Zo(`${ra.v1}/mfa/enroll/verify`,e)}async function Jr(e){return Zo(`${ra.v1}/mfa/disable`,e)}async function Yr(e,t){return Zo(`${ra.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Qr(e){return Zo(`${ra.v1}/mfa/sms/${e}/disable`)}async function Xr(e,t){return Zo(`${ra.v1}/mfa/sms/${e}/disable/verify`,t)}async function Zr(e){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable`)}async function el(e,t){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function tl(){return Xo(`${ra.v1}/mfa/devices`)}async function nl(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll`,e)}async function il(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ol(e,t){return Zo(`${aa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function al(e){return Zo(`${aa.v1}/user/mfa/sms/enroll`,e)}async function rl(e){return Zo(`${aa.v1}/user/mfa/sms/enroll/verify`,e)}async function ll(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}`,t)}async function sl(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}/verify`,t)}async function cl(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll`,e)}async function ul(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function dl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}`,t)}async function yl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function fl(){return Xo(`${pa.v1}/saml/configurations`)}async function gl(e){return Zo(`${pa.v1}/saml/configurations`,e)}async function pl(){return Xo(`${pa.v1}/saml/configurations/vendor-config`)}async function Sl(e){return ta(`${pa.v1}/saml/configurations/metadata`,e)}async function vl(){return ta(`${pa.v1}/saml/validations/domain`)}async function hl(){return Xo(`${pa.v1}/saml/configurations/roles/default`)}async function ml(){return Xo(`${pa.v2}/saml/configurations/groups`)}async function bl({roleIds:e}){return Zo(`${pa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Al({roleIds:e,group:t}){return Zo(`${pa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function kl({roleIds:e,group:t,id:n}){return ea(`${pa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Tl({id:e}){return na(`${pa.v2}/saml/configurations/groups/${e}`)}async function Pl(){return Xo(`${pa.v1}/oidc/configurations`)}async function Il(){return Xo(`${pa.v2}/configurations/public`)}async function Ll(){return Xo(ca.v1)}async function wl(){return Xo(ca.v2)}async function Ol({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),Zo(`${aa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function El(){return Xo(`${la.v1}/public`)}async function Cl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Zo(`${ra.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await mr(n):void 0,userId:i,tenantId:o}}async function Dl(){return Xo(ra.sessions.currentUser.v1)}async function Rl(){return Xo(`${ra.sessions.currentUser.v1}/current`)}async function _l(e){return Zo(`${ra.sessions.v1}/revoke`,{userId:e})}async function Ul(){return Xo(ra.sessions.configurations.v1)}async function Ml(e){await Zo(ra.sessions.configurations.v1,e)}async function Nl(e){await na(`${ra.sessions.currentUser.v1}/${e}`)}async function $l(){await na(`${ra.sessions.currentUser.v1}/all`)}async function Fl(){return Xo(ra.accessTokens.v1)}async function xl(){return Xo(da.accessTokens.v1)}async function Vl({id:e}){return na(`${da.accessTokens.v1}/${e}`)}async function jl({id:e}){return na(`${ra.accessTokens.v1}/${e}`)}async function Wl(e){return Zo(ra.accessTokens.v1,e)}async function Kl(e){return Zo(da.accessTokens.v1,e)}async function Gl(){return Xo(ra.apiTokens.v1)}async function Bl(){return Xo(da.apiTokens.v1)}async function zl(e){return Zo(ra.apiTokens.v1,e)}async function ql(e){return Zo(da.apiTokens.v2,e)}async function Hl({tokenId:e}){return na(`${da.apiTokens.v1}/${e}`)}async function Jl({tokenId:e}){return na(`${ra.apiTokens.v1}/${e}`)}async function Yl({userId:e}){return Xo(`${ra.v1}/${e}`)}async function Ql(e){return Xo(`${la.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Xl(e){let{type:t}=e,n=li(e,vr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Zl(e){let{type:t}=e,n=li(e,hr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function es({token:e}){return Zo(da.invites.verify.v1,{token:e})}async function ts(){return Xo(`${pa.v1}/configurations`)}async function ns(e){return Zo(`${pa.v1}/configurations`,e)}async function is(e,t){return ea(`${pa.v1}/configurations/${e}`,t)}async function os(e){return na(`${pa.v1}/configurations/${e}`)}async function as(e){return Zo(`${pa.v1}/configurations/metadata`,e)}async function rs(e,t){return ta(`${pa.v1}/configurations/${e}/metadata`,t)}async function ls(e,t){return Zo(`${pa.v1}/configurations/${e}/domains`,t)}async function ss(e,t){return na(`${pa.v1}/configurations/${e}/domains/${t}`)}async function cs(e,t){return ta(`${pa.v1}/configurations/${e}/domains/${t}/validate`)}async function us(e){return Xo(`${pa.v1}/configurations/${e}/roles`)}async function ds(e,t){return ta(`${pa.v1}/configurations/${e}/roles`,t)}async function ys(e,t){return Zo(`${pa.v1}/configurations/${e}/groups`,t)}async function fs(e,{roleIds:t,group:n,id:i}){return ea(`${pa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function gs(e,t){return na(`${pa.v1}/configurations/${e}/groups/${t}`)}async function ps(e){return Xo(`${pa.v1}/configurations/${e}/groups`)}async function Ss(e){return Zo(`${aa.v2}/user/sso/prelogin`,e)}async function vs(e){return mr(await Zo(`${aa.v2}/user/oidc/postlogin`,e))}async function hs(e){return Ar(await Zo(`${Ra}/token`,e))}async function ms(){return Ar(await Zo(`${Ra}/authorize/silent`))}async function bs(e){return Zo(`${ra.v1}/phone/reset`,e)}async function As(e){return Zo(`${ra.v1}/phone/reset/verify`,e)}async function ks(e){return Zo(`${ra.v1}/phone`,e)}async function Ts(e){return Zo(`${ra.v1}/phone/verify`,e)}async function Ps(e){return ta(`${ra.v1}/phone/change`,e)}async function Is(e){return Zo(`${aa.v1}/webauthn/prelogin`,e)}async function Ls(e){return Zo(`${aa.v1}/webauthn/postlogin`,e)}async function ws(){return Zo(oa.v1)}async function Os(e){return Zo(`${oa.v1}/verify`,e)}async function Es(){return Xo(`${la.v1}/auth/strategies/public`)}async function Cs(){return Xo(`${la.v1}/mfa/strategies`)}async function Ds(e){return Xo(`${ra.v2}/me`,null!=e?e:{addRoles:!0})}async function Rs(e){return ta(`${ra.v2}/me`,e)}async function _s(e){return ta(`${ma.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Us(e){return Zo(`${ra.v1}/passwords/change`,e)}async function Ms(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>I({},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 Xo(Sa.v1,I({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ns(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function $s(e){return na(`${Sa.v1}/${e.userId}`)}async function Fs(e){return ta(Sa.v1,e)}async function xs(e){return Zo(da.invites.user.v1,I({},e))}async function Vs(e){return ea(da.invites.user.v1,I({},e))}async function js(){return na(da.invites.user.v1)}async function Ws(){return Xo(da.invites.user.v1)}async function Ks(){return Xo(da.invites.configuration.v1)}async function Gs(){return Xo(va.v1)}async function Bs(){return Xo(ua.v1)}async function zs(){return Xo(`${ha.v1}/members`)}async function qs(e){return Zo(`${Sa.v1}/${e.userId}/resendActivationEmail`,{})}async function Hs(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function Js(e){return Zo(ra.invitation.resendAll.v1,I({},e))}async function Ys(e){var t,n;const i=await Xo("/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 Qs(){const e=await Xo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Xs=async()=>Ys({entityName:"notifications"}),Zs=async()=>Ys({entityName:"saml"}),ec=async()=>Ys({entityName:"audits"}),tc=async e=>async function(e){const t=await Xo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),nc=["dataFilters"],ic=["templateId","dataFilters"],oc=["dataFilters"];async function ac(e){return Xo(`${La.v2}/tenant-reports`,e)}async function rc(e){return Xo(`${La.v2}/${e.id}/tenant-reports`)}async function lc(e){let{dataFilters:t}=e,n=li(e,nc);return{html:await Xo(`${wa.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function sc(e){let{templateId:t,dataFilters:n}=e,i=li(e,ic);return Zo(`${La.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function cc(e){let{dataFilters:t}=e,n=li(e,oc);const i=await Xo(`${wa.v1}/preview-report`,I({},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 uc(e){return Zo(`${wa.v1}/tenant-reports`,e)}async function dc(e){return Xo(Oa,{params:e})}async function yc(e){return ta(`${Oa}/status`,{params:e})}async function fc(e){const{notificationId:t,pinStatus:n}=e;return ta(`${Oa}/${n}`,{notificationId:t})}async function gc(){return Zo(`${Oa}/status/mark-all-read`)}const pc=["endpoint","headerProps"];async function Sc(e){return Xo(Ea,e)}async function vc(e){return Xo(`${Ea}/stats`,e)}async function hc(e){const{endpoint:t,headerProps:n}=e,i=li(e,pc);return ia(`${Ea}/export/${t}`,{properties:n},i)}const mc=["eventKey"],bc=["eventKey"],Ac=()=>Xo(`${ka.v1}/slack`),kc=()=>Xo(`${ka.v1}/slack/applications`),Tc=()=>Xo(`${ka.v1}/slack/channels`),Pc=e=>e.id?ea(`${ka.v1}/slack/subscription/${e.id}`,e):Zo(`${ka.v1}/slack/subscriptions`,e),Ic=e=>na(`${ka.v1}/slack/subscriptions/${e.id}`),Lc=e=>Zo(`${ka.v1}/slack/applications/registrations`,{code:e}),wc=()=>Xo(`${ka.v1}/emails`),Oc=e=>{let{eventKey:t}=e,n=li(e,mc);return Zo(`${ka.v1}/emails/${t}`,n)},Ec=({eventKey:e,enabled:t})=>ea(`${ka.v1}/emails/${e}`,{enabled:t}),Cc=(e,t)=>na(`${ka.v1}/emails/${e}/subscriptions/${t}`),Dc=(e,t,n)=>ta(`${ka.v1}/emails/${t}/subscriptions/${e}`,n),Rc=e=>na(`${ka.v1}/emails/${e}`),_c=()=>Xo(`${ka.v2}/sms`),Uc=e=>{let{eventKey:t}=e,n=li(e,bc);return Zo(`${ka.v2}/sms/${t}`,n)},Mc=({eventKey:e,enabled:t})=>ea(`${ka.v2}/sms/${e}`,{enabled:t}),Nc=(e,t)=>na(`${ka.v2}/sms/${e}/subscriptions/${t}`),$c=(e,t,n)=>ta(`${ka.v2}/sms/${t}/subscriptions/${e}`,n),Fc=e=>na(`${ka.v2}/sms/${e}`),xc=()=>Xo(Da),Vc=e=>e._id?ea(`${Da}/${e._id}`,e):Zo(`${Da}/custom`,e),jc=e=>na(`${Da}/${e}`),Wc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Xo(`${Da}/logs/?${i.toString()}`)},Kc=e=>Zo(`${Da}/test`,e),Gc=e=>Zo(`${Da}/logs/${e}/retries`),Bc=()=>Xo(`${Ca.v1}/categories`),zc=e=>Xo(Ca.v1,{channels:e});async function qc(e){return ta(ba.v1,e)}async function Hc(){return Xo(ba.v1)}const Jc=["roleId"],Yc=["roleId"],Qc=["permissionId"];async function Xc(){return Xo(ya.v1)}async function Zc(e){return Zo(ya.v1,e)}async function eu({roleId:e}){return na(`${ya.v1}/${e}`)}async function tu(e){let{roleId:t}=e,n=li(e,Jc);return ea(`${ya.v1}/${t}`,n)}async function nu(e){let{roleId:t}=e,n=li(e,Yc);return ta(`${ya.v1}/${t}/permissions`,n)}async function iu(){return Xo(ua.v1)}async function ou(e){let{permissionId:t}=e,n=li(e,Qc);return ta(`${ua.v1}/${t}/roles`,n)}async function au(){return Xo(`${ua.v1}/categories`)}async function ru(){return Xo(Ta.subscriptions.v1)}async function lu(e){return Xo(`${Ta.subscriptions.v1}/${e}`)}async function su(e){return ta(`${Ta.subscriptions.v1}/${e}/cancellations/`,{})}async function cu(e){return ta(`${Ta.subscriptions.v1}/${e}/renewals/`,{})}async function uu(e,{paymentMethodId:t,planId:n}){return ta(`${Ta.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function du(e){return Xo(`${Ia.v1}/${e}`)}async function yu(){return Xo(`${Ia.v1}`)}async function fu(e){return ta(`${Ia.v1}/${e}/cancellations/`,{})}async function gu(e){return ta(`${Ia.v1}/${e}/renewals/`,{})}async function pu(e,{paymentMethodId:t,planId:n}){return ta(`${Ia.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Su(){return Xo(Ta.plans.v1)}async function vu(e){return Xo(`${Ta.plans.v1}/${e}`)}async function hu(){return Xo(Ta.invoices.v1)}async function mu(e){return Xo(`${Ta.invoices.v1}/${e}`)}async function bu(e,t){return Xo(`${Ta.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Au=["email"];async function ku(){return Xo(Ta.paymentMethods.v1)}async function Tu(e){return Xo(`${Ta.paymentMethods.v1}/${e}`)}async function Pu(e,t){let{email:n}=t,i=li(t,Au);return ea(`${Ta.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Iu(e){return Zo(Ta.paymentProviders.stripe.subscriptions.v1,e)}async function Lu(e){return Xo(`${Ta.paymentProviders.stripe.customers.v1}/${e}`)}async function wu(e){return Zo(`${Ta.paymentProviders.stripe.customers.v1}`,e)}async function Ou(){return Xo(`${Ta.paymentProviders.stripe.publicConfigurations.v1}`)}async function Eu(e){return Zo(`${Ta.paymentProviders.stripe.setupIntents.v1}`,e)}async function Cu(e){return Xo(`${Ta.summaries.v1}/${e}`)}async function Du(e){return Xo(`${Ta.tenantConfiguration.v1}/${e}`)}async function Ru(e){return Zo(`${Ta.tenantConfiguration.v1}`,e)}async function _u(){return Xo(Pa.v1)}async function Uu(){return Xo(`${Ta.configurations.vendorPublicConfigurations.v1}`)}let Mu,Nu,$u,Fu,xu,Vu,ju,Wu,Ku,Gu,Bu;async function zu(){return Xo("/vendors/public")}async function qu(e){return Xo(fa.v1,e)}async function Hu(e){return Zo(fa.v1,e)}async function Ju(e){return na(fa.v1,e)}async function Yu(e,t){return Zo(`${fa.v1}/${e}/roles`,t)}async function Qu(e,t){return na(`${fa.v1}/${e}/roles`,t)}async function Xu(e,t){return ea(`${fa.v1}/${e}/roles`,t)}async function Zu(){return Xo(_a)}async function ed(){return Xo(`${Ua}`)}async function td(e,t){return ea(`${Ua}/${e}`,t)}async function nd(e){return Zo(`${Ua}`,e)}async function id(e){return na(`${Ua}/${e}`)}async function od(e){return Xo(`${Ma}/${e}/Users/count`)}async function ad(e){return Zo(`${ga.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Mu||(Mu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Nu||(Nu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}($u||($u={})),(Fu||(Fu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(xu||(xu={})),function(e){e.CREATE="create_customer"}(Vu||(Vu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(ju||(ju={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Wu||(Wu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ku||(Ku={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Gu||(Gu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Bu||(Bu={}));const rd=[`${aa.v1}/logout`,`${Ra}/logout`],ld=[...rd,`${aa.v1}/user/saml/postlogin`,`${aa.v2}/user/oidc/postlogin`,`${aa.v1}/user`,`${aa.v1}/user/mfa/verify`,`${aa.v1}/user/token/refresh`,`${ra.v1}`,`${ra.v1}/signUp`,`${aa.v1}/passwordless/magiclink/postlogin`,`${aa.v1}/passwordless/code/postlogin`,`${aa.v1}/passwordless/smscode/postlogin`,`${ra.v1}/activate`,`${ra.v1}/invitation/accept`,`${Ra}/token`,`${Ra}/authorize/silent`],sd=`${aa.v1}/user/token/refresh`,cd=`${Ra}/authorize/silent`,ud=`${ra.v2}/me`,dd=`${ra.v2}/me/tenants`;let yd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(yd||(yd={}));const fd={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h};var gd={fetch:e,ContextHolder:qo,FronteggContext:Ho,api:fd,FronteggApiError:Jo,AuthStrategyEnum:yr,SocialLoginProviders:dr,ISubscriptionCancellationPolicy:$u,ISubscriptionStatus:Mu,PaymentMethodType:Nu,ProviderType:Fu};let pd,Sd;function vd(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function hd(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 md(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"}(pd||(pd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Sd||(Sd={}));const bd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Ad={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},kd=I({},Ad,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Td=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],Pd={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},Id=I({},Pd,{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}),Ld={loading:!1,error:void 0,saving:!0,profile:Pd},wd={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"},Od={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:yr.EmailAndPassword},Ed={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Cd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Dd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Rd={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},_d={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Ud=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Md={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Rd,roles:Ud,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Nd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],$d={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:[Td[0]]},Fd={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:[Td[1]]},xd={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Vd=[Fd,$d],jd=[xd],Wd=[{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}],Kd=[{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"}],Gd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Bd={isActive:!0,strategy:_n.ALLOW},zd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:_n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:_n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:_n.BLOCK,description:"IP 4"}];let qd,Hd,Jd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(qd||(qd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Hd||(Hd={})),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"}(Jd||(Jd={})),Jd.profile,Jd.privacy,Jd.personalApiTokens,Jd.account,Jd.users,Jd.security,Jd.sso,Jd.audits,Jd.webhooks,Jd.apiTokens,Jd.roles,Jd.subscriptions;const Yd=["events","url"];function*Qd(){yield Bi(Hn.setSignUpState({loading:!0}));try{const e=yield Hi(fd.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield Bi(Hn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Xd(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,Yd);yield Bi(Hn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Qi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Hi(fd.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:Hd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(qo.setAccessToken(null==l?void 0:l.accessToken),qo.setUser(l),!r&&l&&df(l)){const t=yield gf(l);yield Bi(Hn.setState(t)),a(e.loginUrl)}else yield Bi(Hn.setSignUpState({loading:!1,shouldActivate:r,stage:sn.SignUpSuccess})),yield Bi(Hn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield Bi(Hn.loadTenants()))}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setSignUpState({loading:!1,error:e.message}))}yield Bi(Hn.setSignUpState({loading:!1}))}function*Zd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Qi((e=>e.auth.signUpState));yield Bi(Hn.resetSignUpState()),yield Bi(Hn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*ey(){yield zo(Hn.signUpUser,Xd),yield zo(Hn.resetSignUpStateSoft,Zd)}const ty={setVendorState:(e,{payload:t})=>I({},e,t)},ny={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},iy={loading:!1},{reducer:oy,actions:ay}=at({name:It,initialState:iy,reducers:I({},ty)}),ry=I({},ay,ny);function*ly(){yield Bi(ry.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield fd.vendor.getVendorPublicInfo();yield Bi(ry.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Bi(ry.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const sy=["callback"],cy=["callback"],uy=["callback"],dy=["callback"],yy=["callback"],fy=["callback"];function*gy(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getGlobalSecurityPolicy);yield Bi(Hn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha()),yield Bi(Hn.loadPublicAuthStrategiesPolicy())}function*py(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorConfig);yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Sy(){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorPublicAuthStrategiesConfig);yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*vy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getMfaPolicy);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*hy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorMfaPolicy);yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*my(e){let{payload:{callback:t}}=e,n=li(e.payload,sy);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.saveMfaPolicy,n);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*by(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getLockoutPolicy);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Ay(e){let{payload:{callback:t}}=e,n=li(e.payload,cy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.saveLockoutPolicy,n);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ky(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorLockoutPolicy);yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Ty(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCaptchaPolicy);yield Bi(Hn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Py(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Iy(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getVendorPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Ly(e){let{payload:{callback:t}}=e,n=li(e.payload,uy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.savePasswordHistoryPolicy,n);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wy(){yield Bi(Hn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getPasswordConfigPolicy);yield Bi(Hn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Oy(){yield zo(Hn.loadSecurityPolicy,gy),yield Go(Hn.saveSecurityPolicyMfa,my),yield Go(Hn.loadSecurityPolicyMfa,vy),yield Go(Hn.loadSecurityPolicyVendorMfa,hy),yield Go(Hn.saveSecurityPolicyLockout,Ay),yield Go(Hn.loadSecurityPolicyLockout,by),yield Go(Hn.loadSecurityPolicyVendorLockout,ky),yield Go(Hn.loadSecurityPolicyCaptcha,Ty),yield Go(Hn.saveSecurityPolicyPasswordHistory,Ly),yield Go(Hn.loadSecurityPolicyPasswordHistory,Py),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,Iy),yield Go(Hn.loadVendorPasswordConfig,wy),yield Go(Hn.loadPublicSecurityPolicy,py),yield Go(Hn.loadPublicAuthStrategiesPolicy,Sy)}function*Ey(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Bi(Hn.setSecurityPolicyPublicState({policy:Od,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Cy(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyGlobalState({policy:wd,loading:!1})),yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyPasswordHistory()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha())}function*Dy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:Ed,loading:!1}))}function*Ry(){yield Bi(Hn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:Ed,loading:!1}))}function*_y(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,dy);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Cd,{id:null!=(t=i.id)?t:Cd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Uy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Cd,loading:!1}))}function*My(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:Cd,loading:!1}))}function*Ny(e){let{payload:{callback:t}}=e,n=li(e.payload,yy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},Cd,n,{id:n.id?n.id:Cd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*$y(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Cd,loading:!1}))}function*Fy(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:Dd,loading:!1}))}function*xy(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:Dd,loading:!1}))}function*Vy(e){let{payload:{callback:t}}=e,n=li(e.payload,fy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},Dd,n,{id:n.id?n.id:Dd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*jy(){yield zo(Hn.loadSecurityPolicy,Cy),yield Go(Hn.loadPublicSecurityPolicy,Ey),yield Go(Hn.saveSecurityPolicyMfa,_y),yield Go(Hn.loadSecurityPolicyMfa,Dy),yield Go(Hn.loadSecurityPolicyVendorMfa,Ry),yield Go(Hn.saveSecurityPolicyLockout,Ny),yield Go(Hn.loadSecurityPolicyLockout,Uy),yield Go(Hn.loadSecurityPolicyVendorLockout,My),yield Go(Hn.loadSecurityPolicyCaptcha,$y),yield Go(Hn.saveSecurityPolicyPasswordHistory,Vy),yield Go(Hn.loadSecurityPolicyPasswordHistory,Fy),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,xy)}const Wy=["callback"],Ky=["callback"],Gy=["callback"],By=["callback"],zy=["callback","events"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback"],Qy=["callback"],Xy=["callback"],Zy=["callback"],ef=["callback"],tf=["callback"],nf=["callback","deviceId"],of=["callback","deviceId"],af=["callback","deviceId"],rf=["callback","deviceId"],lf={[yr.Code]:vt.loginWithOtc,[yr.EmailAndPassword]:vt.loginWithPassword,[yr.MagicLink]:vt.magicLinkPreLoginSuccess,[yr.SmsCode]:vt.loginWithSmsOtc};function*sf(){var e;const t=qo.onRedirectTo,{routes:n,includeQueryParam:i}=yield Qi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(bt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(bt),yield Xi(200),Bi(Hn.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*cf(){let e;try{var t;const n=yield Hi(fd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Bi(Hn.setState({ssoACS:e}))}function*uf(){try{const{isActive:e}=yield Hi(fd.auth.getSSOPublicConfiguration);yield Bi(Hn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const df=e=>e.mfaRequired&&e.mfaToken?(qo.setAccessToken(null),qo.setUser(null),!0):(qo.setAccessToken(e.accessToken),qo.setUser(e),!1),yf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return Qt.authenticatorApp;if(t)return Qt.smsVerifyCode}return Qt.verify},ff=e=>{if(1===e.length){const[t]=e;if(t===Ku.AuthenticatorApp)return Qt.authenticatorApp;if(t===Ku.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*gf(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield Qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Hi(fd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:yf(e.mfaDevices)}:(n={step:ff(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=vt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:ht.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:I({},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*pf(){const{hostedLoginBox:e}=yield Qi((e=>e.auth));e?yield Hi(Sf):yield Hi(vf)}function*Sf(){const{user:e}=yield Qi((e=>e.auth));if(null==e||!e.refreshToken)return qo.setAccessToken(null),qo.setUser(null),void(yield Bi(Hn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Hi(fd.auth.exchangeOAuthTokens,t);yield Bi(Hn.setState({user:n,isAuthenticated:!0})),yield Bi(Hn.loadTenants())}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:null,isAuthenticated:!1}))}}function*vf(){try{const n=qo.onRedirectTo,{routes:i,loginState:o}=yield Qi((e=>e.auth)),{user:a,tenants:r}=yield Hi(fd.auth.refreshTokenV2);if(df(a)){const e=yield gf(a);yield Bi(Hn.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 Bi(Hn.setTenantsState({tenants:r,loading:!1})),yield Bi(Hn.setState({user:a,isAuthenticated:!0,loginState:I({},o,{quickLoginToRegister:l,flow:s?ht.RegisterQuickLogin:ht.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 sf())}}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}}function*hf({payload:{callback:e}}){try{const{ip:t}=yield Hi(fd.metadata.getCurrentUserIpMetadata);yield Bi(Hn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*mf({payload:e}){const t=[];e&&(yield Bi(Hn.setState({isLoading:!0})),yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Qd)),t.push(Hi(Sy)),t.push(Hi(uf)),t.push(Hi(ly)),t.push(Hi(cf))),t.push(Hi(pf)),yield zi(t),yield Bi(Hn.setState({isLoading:!1}))}function*bf({accessToken:e,user:t}){if(!e)return void(yield Bi(Hn.setState({user:void 0,isAuthenticated:!1})));const n=qo.onRedirectTo,{routes:i}=yield Qi((e=>e.auth));if(df(t)){const e=yield gf(t);yield Bi(Hn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Af({payload:e}){const t=[];yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Qd)),t.push(Hi(uf)),t.push(Hi(ly)),t.push(Hi(cf)),t.push(Hi(bf,e)),yield zi(t)}function*kf({payload:e}){const{disableSilentRefresh:t}=yield Qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Hi(fd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Qi((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 Bi(Hn.setState({isLoading:!0}));const a=md(),r=md(),l=yield Hi(hd,r);localStorage.setItem(At,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${Yo(n,"/oauth/authorize")}/oauth/authorize`,u=I({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*Tf({payload:e}){const t=localStorage.getItem(At)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Qi((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 Hi(fd.auth.exchangeOAuthTokens,a);yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield sf()}}function*Pf(e){let{payload:{callback:t}}=e,n=li(e.payload,Wy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.changePhoneNumberWithVerification,n);yield Bi(Hn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:vt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*If(e){let{payload:{callback:t}}=e,n=li(e.payload,Ky);try{yield Bi(Hn.setLoginState({loading:!0})),yield Hi(fd.auth.verifyChangePhoneNumber,n),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*Lf(e){let{payload:{callback:t}}=e,n=li(e.payload,Gy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.passwordlessPreLogin,I({},n,{type:yr.SmsCode}));yield Bi(Hn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*wf(e){let{payload:{callback:t}}=e,n=li(e.payload,By);try{const{onRedirectTo:e,routes:i}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bi(Hn.setLoginState({loading:!0}));const o=yield Hi(fd.auth.passwordlessPreLogin,n),a=lf[n.type];if(a===vt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield Bi(Hn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield Bi(Hn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Of(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,zy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(fd.auth.passwordlessPostLogin,i),a=qo.onRedirectTo,{routes:r}=yield Qi((e=>e.auth));if(df(e)){const t=yield gf(e);yield Bi(Hn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Qi((e=>e.auth)),l=yield Hi(fd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:qd.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield Bi(Hn.setState({user:l,isAuthenticated:!0})),yield Bi(Hn.setLoginState({error:void 0})),yield Bi(Hn.loadTenants()),i.flow===ht.Login?yield sf():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield Bi(Hn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Ef({payload:e}){try{yield Bi(Hn.setLoginState({loading:!0}));const{name:t}=yield Hi(fd.auth.verifyInviteToken,e);yield Bi(Hn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield Bi(Hn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Cf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Qi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Hi(fd.auth.preLoginV2,{email:e});if(a){if(r===Sd.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Qi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield Bi(Hn.setLoginState({step:vt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield Df({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Df({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Df(e){let{callback:t}=e,n=li(e,qy);const i=yield Qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===yr.EmailAndPassword?(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[yr.MagicLink,yr.Code,yr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Bi(Hn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*Rf({payload:{callback:e}}){try{yield Bi(Hn.setLoginState({loading:!0}));const{options:t}=yield Hi(fd.auth.webAuthnCreateNewDeviceSession);t.user.id=pt(t.user.id),t.challenge=pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Bi(Hn.setLoginState({error:t.message})),null==e||e(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*_f(e){let{payload:{callback:t}}=e,n=li(e.payload,Hy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Hi(fd.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Uf(e){let{payload:{callback:t}}=e,n=li(e.payload,Jy);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const{options:e}=yield Hi(fd.auth.webAuthnPreLogin,n);e.challenge=pt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)}))),yield Bi(Hn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Mf(e){let{payload:{callback:t}}=e,n=li(e.payload,Yy);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Hi(fd.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(df(o)){const e=qo.onRedirectTo,{routes:t}=yield Qi((e=>e.auth)),n=yield gf(o);yield Bi(Hn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Hi(fd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Bi(Hn.setLoginState({error:void 0})),yield sf(),null==t||t(!0)}}catch(e){yield Bi(Hn.setLoginState({error:e.message})),null==t||t(null)}finally{yield Bi(Hn.setLoginState({loading:!1}))}}function*Nf({payload:e}){const{onRedirectTo:t,routes:n}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bi(Hn.setLoginState({loading:!0}));try{const t=yield Hi(fd.auth.postLogin,e);qo.setAccessToken(t.accessToken),qo.setUser(t),yield Bi(Hn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield sf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Bi(Hn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*$f({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Bi(Hn.setLoginState({loading:!0}));try{const a=yield Hi(fd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});qo.setAccessToken(a.accessToken),qo.setUser(a);const r=qo.onRedirectTo,{routes:l}=yield Qi((e=>e.auth));if(df(a)){const e=yield gf(a);yield Bi(Hn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Qi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Bi(Hn.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===ht.Login?vt.success:t.step,tenants:[],tenantsLoading:!0}})),yield Bi(Hn.loadTenants()),n&&t.flow===ht.Login&&(yield sf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ff({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Hi(fd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Qi((e=>e.auth)),r=a.flow===ht.Login?vt.success:a.step;yield Bi(Hn.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 Bi(Hn.loadTenants()),yield Bi(Hn.setLoginState({error:void 0,loading:!1})),a.flow===ht.Login&&(yield sf()),null==i||i(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*xf({payload:e}){yield Bi(Hn.setLoginState({loading:!0}));try{yield Hi(fd.auth.recoverMfaToken,e),yield Bi(Hn.setLoginState({loading:!1,error:void 0,step:vt.preLogin})),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1}))}}function*Vf({payload:e}){const{hostedLoginBox:t}=yield Qi((e=>e.auth));yield Bi(Hn.setState({isLoading:!0}));try{t?yield Hi(fd.auth.OAuthLogout):yield Hi(fd.auth.logout)}catch{}yield Bi(Hn.resetState()),yield Bi(Hn.requestAuthorize(!0)),null==e||e()}function*jf({payload:e}){var t;try{yield Hi(fd.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*Wf({user:e,tenants:t}){const n={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield Bi(Hn.setMfaState(n)),yield Bi(Hn.setUser(e)),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Kf({user:e,tenants:t}){const{loginState:n}=yield Qi((e=>e.auth));yield Bi(Hn.setUser(e)),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===ht.Login&&(yield sf()),yield Bi(Hn.setState({isAuthenticated:!0}))}function*Gf(e){let{payload:{callback:t}}=e,n=li(e.payload,Qy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.preEnrollMFASMSForLogin,n);yield Bi(Hn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Bf(e){let{payload:{callback:t}}=e,n=li(e.payload,Xy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.enrollMFASMSForLogin,n),i=yield Hi(fd.auth.generateLoginResponseV2,e);yield Wf(i),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*zf(e){let{payload:{callback:t}}=e,n=li(e.payload,Zy);yield Bi(Hn.setLoginState({loading:!0}));try{var i;const e=yield Hi(fd.auth.preEnrollMFAWebAuthnForLogin,n),o=I({},e.options,{challenge:pt(e.options.challenge),user:I({},e.options.user,{id:pt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*qf(e){let{payload:{callback:t}}=e,n=li(e.payload,ef);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Hi(fd.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Hi(fd.auth.generateLoginResponseV2,i);yield Wf(o),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Hf(e){let{payload:{callback:t}}=e,n=li(e.payload,tf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Hi(fd.auth.generateLoginResponseV2,e);yield Wf(i),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Jf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,nf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.preVerifyMFASMSForLogin,n,i);yield Bi(Hn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Yf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,of);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(fd.auth.verifyMFASMSForLogin,n,i),o=yield Hi(fd.auth.generateLoginResponseV2,e);yield Kf(o),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Qf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,af);yield Bi(Hn.setLoginState({loading:!0}));try{var o;const e=yield Hi(fd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Xf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,rf);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Hi(fd.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Hi(fd.auth.generateLoginResponseV2,o);yield Kf(a),yield Bi(Hn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Zf(){yield zo(Hn.requestAuthorize,mf),yield zo(Hn.requestAuthorizeSSR,Af),yield zo(Hn.requestHostedLoginAuthorize,kf),yield zo(Hn.handleHostedLoginCallback,Tf),yield zo(Hn.preLogin,Cf),yield zo(Hn.postLogin,Nf),yield zo(Hn.login,$f),yield zo(Hn.logout,Vf),yield zo(Hn.silentLogout,jf),yield zo(Hn.loginWithMfa,Ff),yield zo(Hn.recoverMfa,xf),yield zo(Hn.quickSmsPasswordlessPreLogin,Lf),yield zo(Hn.changePhoneNumberWithVerification,Pf),yield zo(Hn.verifyChangePhoneNumber,If),yield zo(Hn.passwordlessPreLogin,wf),yield zo(Hn.passwordlessPostLogin,Of),yield zo(Hn.verifyInviteToken,Ef),yield zo(Hn.webAuthnPrelogin,Uf),yield zo(Hn.webAuthnPostLogin,Mf),yield zo(Hn.webAuthnCreateNewDeviceSession,Rf),yield zo(Hn.webAuthnVerifyNewDeviceSession,_f),yield zo(Hn.afterAuthNavigation,sf),yield zo(Hn.getUserIP,hf),yield zo(Hn.preEnrollMFASMSForLogin,Gf),yield zo(Hn.enrollMFASMSForLogin,Bf),yield zo(Hn.preEnrollMFAWebAuthnForLogin,zf),yield zo(Hn.enrollMFAWebAuthnForLogin,qf),yield zo(Hn.enrollMFAAuthenticatorAppForLogin,Hf),yield zo(Hn.preVerifyMFASMSForLogin,Jf),yield zo(Hn.verifyMFASMSForLogin,Yf),yield zo(Hn.preVerifyMFAWebAuthnForLogin,Qf),yield zo(Hn.verifyMFAWebAuthnForLogin,Xf)}function*eg({payload:e}){e&&(yield Bi(Hn.setState({isLoading:!0})));const t=Id;yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*tg({payload:{callback:e}}){try{const{ip:t}=zd[0];yield Bi(Hn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*ng(){yield zo(Hn.requestAuthorize,eg),yield zo(Hn.afterAuthNavigation,sf),yield zo(Hn.getUserIP,tg)}const ig=["callback","samlVendor"],og=["callback","samlVendor"];function*ag(){try{var e,t;yield Bi(Hn.setSSOState({loading:!0}));const n=yield Hi(fd.auth.getSamlConfiguration),i=yield Hi(fd.auth.getOidcConfiguration),o=yield Hi(fd.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 Bi(Hn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSSOState({error:e.message,loading:!1}))}}function*rg({payload:e}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Bi(Hn.setSSOState({error:void 0,[n]:!0}));try{const i=yield bd(e[0]),o=yield Hi(fd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*lg({payload:e}){const{configFile:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Bi(Hn.setSSOState({error:void 0,[o]:!0}));try{const e=yield bd(t),a=yield Hi(fd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*sg({payload:e}){const{callback:t,samlVendor:n}=e,i=li(e,ig),o=yield Qi((e=>e.auth.ssoState.samlConfiguration)),a=I({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Bi(Hn.setSSOState({samlConfiguration:I({},o,a)})));if(yield Bi(Hn.setSSOState({error:void 0,[r]:!0})),e.type===Sd.Saml){var l,s;const e=yield Hi(fd.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=vd(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 Hi(fd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Bi(Hn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*cg({payload:{callback:e}={}}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration));try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.validateSamlDomain),yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*ug(){try{const e=yield Hi(fd.auth.getSamlRoles),t=yield Hi(fd.auth.getSamlRolesGroups);yield Bi(Hn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}function*dg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield zi(e.map((e=>Hi(fd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}(n)),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*yg({payload:{callback:e,id:t}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.deleteSamlGroup,{id:t}),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*fg({payload:{group:e,roleIds:t,callback:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(fd.auth.createSamlGroup,{group:e,roleIds:t}),yield ug(),yield Bi(Hn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*gg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Bi(Hn.setSSOState({loading:!0})),yield Hi(fd.auth.oidcPostLoginV2,t),yield Hi(pf),yield Bi(Hn.setSSOState({loading:!1}))}catch(e){var n;yield Bi(Hn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*pg(){yield Go(Hn.loadSSOConfigurations,ag),yield Go(Hn.saveSSOConfigurations,sg),yield Go(Hn.saveSSOConfigurationsFile,rg),yield Go(Hn.saveSSOConfigurationsFileWithCallback,lg),yield Go(Hn.validateSSODomain,cg),yield Go(Hn.loadSSOAuthorizationRoles,ug),yield Go(Hn.updateSSOAuthorizationRoles,dg),yield Go(Hn.deleteSamlGroup,yg),yield Go(Hn.createSamlGroup,fg),yield Go(Hn.oidcPostlogin,gg)}function*Sg(){yield Bi(Hn.setSSOState({loading:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:Rd,loading:!1,firstLoad:!1}))}function*vg({payload:e}){const t="saving";yield Bi(Hn.setSSOState({error:void 0,[t]:!0}));const n=I({},yield Qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Bi(Hn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*hg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=li(e,og),r=Md.samlConfiguration,l=I({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Bi(Hn.setSSOState({samlConfiguration:I({},r,l)})));yield Bi(Hn.setSSOState({error:void 0,[s]:!0})),yield yt(),l.acsUrl=null==_d||null==(t=_d.configuration)?void 0:t.acsUrl,l.spEntityId=null==_d||null==(n=_d.configuration)?void 0:n.spEntityId;const c=vd(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 yt(),yield Bi(Hn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*mg({payload:{callback:e}={}}){const t=Md.samlConfiguration;yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*bg(){yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Ag({payload:{callback:e,authorizationRoles:t}}){yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*kg(){yield Go(Hn.loadSSOConfigurations,Sg),yield Go(Hn.saveSSOConfigurations,hg),yield Go(Hn.saveSSOConfigurationsFile,vg),yield Go(Hn.validateSSODomain,mg),yield Go(Hn.loadSSOAuthorizationRoles,bg),yield Go(Hn.updateSSOAuthorizationRoles,Ag)}const Tg=["callback"],Pg=["callback","ssoConfigId"],Ig=["callback","ssoConfigId"];function*Lg(){try{return yield Hi(fd.auth.getOidcConfiguration)}catch(e){return null}}function*wg(){try{return yield Hi(fd.metadata.getSamlMetadata)}catch(e){return null}}function*Og(){try{yield Bi(Hn.setSSOLoader({key:pd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield zi([Hi(Lg),Hi(wg)]),n=yield Hi(fd.auth.getSSOConfigurations);yield Bi(Hn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Bi(Hn.setSSOError({key:pd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Bi(Hn.setSSOLoader({key:pd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Eg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=li(e,Tg),i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Hi(fd.auth.createSSOConfiguration,I({},n,{enabled:null!=(o=n.enabled)&&o}));yield Bi(Hn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Cg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bd(t),o=yield Hi(fd.auth.createSSOConfigurationByMetadata,{metadata:e});yield Bi(Hn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Dg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=li(e,Pg),o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(fd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Bi(Hn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Rg({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield bd(i),a=yield Hi(fd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Bi(Hn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*_g({payload:e}){yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.deleteSSOConfiguration,t),yield Bi(Hn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ug({payload:e}){const{callback:t,ssoConfigId:n}=e,i=li(e,Ig);yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(fd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?I({},t,{domains:[...t.domains,e]}):t));yield Bi(Hn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_DOMAIN,value:!1}))}}function*Mg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?I({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Bi(Hn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.DELETE_SSO_DOMAIN,value:!1}))}}function*Ng({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Bi(Hn.setSSOLoader({key:pd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?I({},e,{domains:e.domains.map((e=>e.id===n?I({},e,{validated:!0}):e))}):e));yield Bi(Hn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*$g({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(fd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?I({},e,{roleIds:n}):e));yield Bi(Hn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Bi(Hn.setSSOError({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Bi(Hn.setSSOLoader({key:pd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Fg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(t.map((e=>Hi(fd.auth.deleteSSOGroup,n,e)))),yield zi(e.map((e=>Hi(fd.auth.createSSOGroup,n,e))));const a=yield Hi(fd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?I({},e,{groups:a}):e));yield Bi(Hn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!1}))}}function*xg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield zi(t.map((t=>Hi(fd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:pd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:pd.SAVE_SSO_GROUPS,value:!1}))}}function*Vg(){yield Go(Hn.loadSSOConfigurationsV2,Og),yield Go(Hn.saveSSOConfigurationV2,Eg),yield Go(Hn.saveSSODomain,Ug),yield Go(Hn.deleteSSODomain,Mg),yield Go(Hn.validateSSODomainV2,Ng),yield Go(Hn.updateSSOConfiguration,Dg),yield Go(Hn.deleteSSOConfiguration,_g),yield Go(Hn.setSSOGroups,Fg),yield Go(Hn.updateSSOGroups,xg),yield Go(Hn.setSSODefaultRoles,$g),yield Go(Hn.saveSSOConfigurationByMetadata,Cg),yield Go(Hn.updateSSOConfigurationByMetadata,Rg)}const jg=["callback","profilePictureUrl"],Wg=["callback","profilePictureUrl"];function*Kg(){yield Bi(Hn.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 Hi.apply(void 0,[Ko,e,t,n].concat(o))}(3,2e3,fd.teams.getProfile),t=yield Qi((e=>e.auth.user));Hn.setUser(I({},t,e)),yield Bi(Hn.setProfileState({profile:e,loading:!1}))}catch(e){yield Bi(Hn.setProfileState({loading:!1,error:e.message}))}}function*Gg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,jg);yield Bi(Hn.setProfileState({saving:!0,error:null}));try{const e=yield Qi((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 Hi(fd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=I({},e,i,{profilePictureUrl:o}),r=yield Hi(fd.teams.updateProfile,a),l=yield Qi((e=>e.auth.user));yield Bi(Hn.setUser(I({},l,r))),yield Bi(Hn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield Bi(Hn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bg({payload:e}){yield Bi(Hn.setProfileState({loading:!0}));try{var t;yield Hi(fd.teams.changePassword,e),yield Bi(Hn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*zg(){yield zo(Hn.loadProfile,Kg),yield Go(Hn.saveProfile,Gg),yield Go(Hn.changePassword,Bg)}function*qg(){yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setUser(I({},Id,Pd))),yield Bi(Hn.setProfileState({loading:!1,profile:Pd}))}function*Hg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,Wg);yield Bi(Hn.setProfileState({saving:!0,error:null}));const o=Ld;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=I({},o.profile,i,{profilePictureUrl:a}),l=Id;yield yt(),yield Bi(Hn.setUser(I({},l,r))),yield Bi(Hn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Jg({payload:e}){var t;yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Yg(){yield zo(Hn.loadProfile,qg),yield Go(Hn.saveProfile,Hg),yield Go(Hn.changePassword,Jg)}const Qg=["callback"],Xg=["callback"],Zg=["callback"],ep=["deviceId","callback"],tp=["deviceId","callback"],np=["callback"],ip=["deviceId"],op=["deviceId"],ap=["callback"],rp=["deviceId"],lp=["callback"];function*sp(e){const{step:t}=yield Qi((e=>e.auth.mfaState));return{step:e.recoveryCode?Qt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*cp(){yield Bi(Hn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Hi(fd.auth.enrollMfa);yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message}))}}function*up(e){let{payload:{callback:t}}=e,n=li(e.payload,Qg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Qi((e=>e.auth.user)),i=yield Hi(fd.auth.verifyMfa,n),o=yield Hi(fd.auth.getMFADevices),a=yield sp(i);yield Bi(Hn.setMfaState(I({},a,{mfaDevices:o}))),yield Bi(Hn.setUser(I({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*dp(e){let{payload:{callback:t}}=e,n=li(e.payload,Xg);yield Bi(Hn.setMfaState({loading:!0}));try{const e=yield Hi(fd.auth.loginWithMfa,n),i={step:Qt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Bi(Hn.setMfaState(i)),yield Bi(Hn.setState({user:e})),yield Bi(Hn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*yp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;yield Hi(fd.auth.disableMfa,e);const n=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*fp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t,n;const i=yield Hi(fd.auth.preEnrollMFAWebAuthn),o=I({},i.options,{challenge:pt(i.options.challenge),user:I({},i.options.user,{id:pt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*gp(e){let{payload:{callback:t}}=e,n=li(e.payload,Zg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Hi(fd.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Hi(fd.auth.getMFADevices),a=yield sp(i);yield Bi(Hn.setMfaState(I({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*pp(e){let{payload:{deviceId:t,callback:n}}=e;li(e.payload,ep),yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(fd.auth.preDisableMFAWebAuthn,t),o=I({},e.options,{challenge:pt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>I({},e,{id:pt(e.id)})))});yield Bi(Hn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Sp(e){let{payload:{deviceId:t,callback:n}}=e,i=li(e.payload,tp);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Hi(fd.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*vp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;const n=yield Hi(fd.auth.preEnrollMFASMS,e);yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*hp(e){let{payload:{callback:t}}=e,n=li(e.payload,np);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Hi(fd.auth.enrollMFASMS,n),i=yield Hi(fd.auth.getMFADevices),o=yield sp(e);yield Bi(Hn.setMfaState(I({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,ip);yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(fd.auth.preDisableMFASMS,t);yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*bp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,op);yield Bi(Hn.setMfaState({saving:!0}));try{var i;yield Hi(fd.auth.disableMFASMS,t,n);const e=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Ap(){yield Bi(Hn.setMfaState({loading:!0}));try{yield Qi((e=>e.auth.user));const e=yield Hi(fd.auth.getMFADevices);yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message}))}}function*kp(){yield Bi(Hn.setMfaState({loading:!0}));try{const e=(yield Hi(fd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Bi(Hn.setMfaState({loading:!1,error:e.message}))}}function*Tp(){yield Go(Hn.enrollMfa,cp),yield Go(Hn.getMFADevices,Ap),yield Go(Hn.getMFAStrategies,kp),yield Go(Hn.verifyMfa,up),yield Go(Hn.disableMfa,yp),yield Go(Hn.verifyMfaAfterForce,dp),yield Go(Hn.preDisableMfaSms,mp),yield Go(Hn.disableMfaSms,bp),yield Go(Hn.preEnrollMfaSms,vp),yield Go(Hn.enrollMfaSms,hp),yield Go(Hn.preEnrollMfaWebAuthn,fp),yield Go(Hn.enrollMfaWebAuthn,gp),yield Go(Hn.preDisableMfaWebAuthn,pp),yield Go(Hn.disableMfaWebAuthn,Sp)}function*Pp(){yield Bi(Hn.setMfaState({saving:!0})),yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Ip({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield Bi(Hn.setMfaState(i)),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Lp(e){let{payload:{callback:t}}=e,n=li(e.payload,ap);yield Bi(Hn.setMfaState({loading:!0})),yield yt();const i=I({},n,{recoveryCode:"recoveryCode"}),o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Bi(Hn.setMfaState(o)),yield yt(),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*wp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({saving:!1,error:void 0,mfaDevices:I({},n,{authenticators:[]})})),yield Bi(Hn.setUser(I({},Id))),null==(t=e.callback)||t.call(e,!0)}function*Op(e){let{}=e,t=li(e.payload,rp);yield Bi(Hn.setMfaState({saving:!0}));try{var n;yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Bi(Hn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*Ep({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({loading:!1,error:void 0,mfaDevices:I({},n,{phones:[]})})),yield Bi(Hn.setUser(I({},Id))),null==(t=e.callback)||t.call(e,!0)}function*Cp({payload:e}){var t;yield Bi(Hn.setMfaState({saving:!0})),yield yt(),yield Bi(Hn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Dp(e){let{payload:{callback:t}}=e;li(e.payload,lp);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Qi((e=>e.auth.mfaState));yield Bi(Hn.setMfaState({saving:!0})),yield yt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:Qt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:I({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Bi(Hn.setMfaState(o)),yield Bi(Hn.setUser(I({},Id,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Rp(){yield Go(Hn.enrollMfa,Pp),yield Go(Hn.verifyMfa,Ip),yield Go(Hn.disableMfa,wp),yield Go(Hn.verifyMfaAfterForce,Lp),yield Go(Hn.preDisableMfaSms,Op),yield Go(Hn.disableMfaSms,Ep),yield Go(Hn.preEnrollMfaSms,Cp),yield Go(Hn.enrollMfaSms,Dp)}const _p=["callback"];function*Up({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(fd.auth.forgotPassword,e),yield Bi(Hn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*Mp(e){let{payload:{callback:t}}=e,n=li(e.payload,_p);yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(fd.auth.resetPassword,n),yield Bi(Hn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success})),null==t||t(!0)}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*Np({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{const t=yield Hi(fd.auth.loadPasswordConfig,e);yield Bi(Hn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message}))}}function*$p(){yield zo(Hn.forgotPassword,Up),yield zo(Hn.resetPassword,Mp),yield zo(Hn.loadPasswordConfig,Np)}let Fp;!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"}(Fp||(Fp={}));const xp=["callback","events"],Vp=["callback"],jp=["callback"];function*Wp({payload:{userId:e,token:t}}){yield Bi(Hn.setActivateState({loading:!0,step:Et.activating}));try{const{isAuthenticated:n}=yield Qi((e=>e.auth));n&&(yield Bi(Hn.silentLogout()));const i=yield Hi(fd.auth.getActivateAccountStrategy,{userId:e,token:t});yield Bi(Hn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Bi(Hn.setActivateState({loading:!1,step:Et.activatingForm})))}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Kp(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,xp);yield Bi(Hn.setActivateState({loading:!0}));try{const e=qo.onRedirectTo,{routes:a}=yield Qi((e=>e.auth)),r=yield Hi(fd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(df(r)){yield Bi(Hn.setActivateState({step:Et.success}));const t=yield gf(r);yield Bi(Hn.setState(t)),yield Xi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Bi(Hn.setActivateState({step:Et.success}));const{user:e,tenants:t}=yield Hi(fd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:qd.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield Bi(Hn.setTenantsState({tenants:t,loading:!1})),yield Bi(Hn.setState({user:e,isAuthenticated:!0})),yield Xi(1e3),yield sf(),yield Bi(Hn.resetActivateState())}null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Gp({payload:e}){const{callback:t}=e,n=li(e,Vp);yield Bi(Hn.setActivateStrategyState({loading:!0}));try{const e=yield Hi(fd.auth.getActivateAccountStrategy,n);yield Bi(Hn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Bi(Hn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Bp({payload:e}){const{callback:t}=e,n=li(e,jp);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.email})),yield Bi(Hn.setActivateState({loading:!0}));try{yield Hi(fd.auth.resendActivationEmail,n),yield Bi(Hn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message})),yield Bi(Hn.setTeamError({key:Fp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*zp(){yield zo(Hn.activateAccount,Kp),yield zo(Hn.preActivateAccount,Wp),yield zo(Hn.getActivateAccountStrategy,Gp),yield zo(Hn.resendActivationEmail,Bp)}function*qp({payload:e}){if(e.token&&e.userId)try{yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Hi(fd.auth.acceptInvitation,e),yield Bi(Hn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:_t.success}}))}catch(e){yield Bi(Hn.setAcceptInvitationState({step:_t.failed,error:e.message}))}else yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.invalid}))}function*Hp(){yield zo(Hn.acceptInvitation,qp)}var Jp,Yp=new Uint8Array(16);function Qp(){if(!Jp&&!(Jp="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 Jp(Yp)}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,Zp=function(e){return"string"==typeof e&&Xp.test(e)},eS=[],tS=0;tS<256;++tS)eS.push((tS+256).toString(16).substr(1));var nS=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qp)();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=(eS[e[t+0]]+eS[e[t+1]]+eS[e[t+2]]+eS[e[t+3]]+"-"+eS[e[t+4]]+eS[e[t+5]]+"-"+eS[e[t+6]]+eS[e[t+7]]+"-"+eS[e[t+8]]+eS[e[t+9]]+"-"+eS[e[t+10]]+eS[e[t+11]]+eS[e[t+12]]+eS[e[t+13]]+eS[e[t+14]]+eS[e[t+15]]).toLowerCase();if(!Zp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const iS=["callback"],oS=["roles"],aS=["callback"],rS=["callback","profileImage"],lS=["callback"],sS=["callback","userId"],cS=["callback"],uS=["callback"],dS=["callback"],yS=["callback"],fS=["callback"],gS=["callback"],pS=["callback"],SS=["callback","profileImage"],vS=["callback"],hS=["callback"],mS=["callback"],bS=["callback"],AS=["callback"],kS=["callback"],TS=()=>Qi((e=>e.auth.teamState));function*PS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield zi([Hi(fd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Bi(Hn.setTeamError({key:Fp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1}))}function*IS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!r})),yield Bi(Hn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield zi([Hi(fd.subTenants.loadAllUsers,I({},c)),Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield Bi(Hn.setTeamError({key:Fp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1}))}function*LS({payload:e}){yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield zi([Hi(fd.teams.loadAvailableRoles),Hi(fd.teams.loadAvailablePermissions)]);yield Bi(Hn.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 Bi(Hn.setTeamError({key:Fp.ROLES_AND_PERMISSIONS,value:t.message}))}yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0}))}function*wS({payload:e}){const{callback:t}=e,n=li(e,iS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Hi(fd.teams.addUser,n),{roles:o}=e,a=I({},li(e,oS),{roleIds:o.map((e=>e.id))});null==t||t(a),yield Bi(Hn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*OS({payload:e}){const{callback:t}=e,n=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Bi(Hn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Hi(fd.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield Bi(Hn.loadUsers(r)),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*ES({payload:e}){const{callback:t}=e,n=li(e,aS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Hi(fd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Bi(Hn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*CS({payload:e}){const{callback:t}=e,n=li(e,rS),{id:i}=n,o=yield TS(),a=o.users.find((e=>e.id===n.id));yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:i||""})),yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})})),yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?I({},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 Hi(fd.teams.updateUser,n);null==t||t(e),yield Bi(Hn.setTeamState({users:o.users.map((t=>t.id===e.id?I({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1}))}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?I({},e,a):e))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*DS({payload:e}){const{callback:t}=e,n=li(e,lS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(fd.teams.deleteUser,n),null==t||t(!0),yield Bi(Hn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*RS({payload:e}){const{callback:t,userId:n}=e,i=li(e,sS),o=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return I({},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 Bi(Hn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[I({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*_S({payload:e}){const{callback:t}=e,n=li(e,cS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(fd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Bi(Hn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*US({payload:e}){const{callback:t}=e,n=li(e,uS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Hi(fd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*MS({payload:e}){const{callback:t}=e,n=li(e,dS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*NS({payload:e}){const{callback:t}=e,n=li(e,yS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*$S({payload:e}){const{callback:t}=e,n=li(e,fS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(fd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*FS(){yield Bi(Hn.setTeamError({key:Fp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Hi(fd.teams.getInviteLinkConfiguration);yield Bi(Hn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield Bi(Hn.setTeamError({key:Fp.CONFIG_TOKEN_LINK,value:e.message}))}}function*xS(){yield Bi(Hn.setTeamError({key:Fp.GET_TOKEN_LINK,value:!1}));try{yield Hi(FS);const e=yield Hi(fd.teams.getInviteUserLink),{inviteTokenState:t}=yield TS();yield Bi(Hn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield Bi(Hn.setTeamError({key:Fp.GET_TOKEN_LINK,value:e.message}))}}function*VS({payload:{callback:e}}){yield Bi(Hn.setTeamError({key:Fp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield TS();try{const n=yield Hi(fd.teams.createInviteUserLink,{expiresInMinutes:43200});yield Bi(Hn.setTeamState({inviteTokenState:I({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield Bi(Hn.setTeamError({key:Fp.CREATE_TOKEN_LINK,value:t.message}))}}function*jS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield TS();yield Bi(Hn.setTeamError({key:Fp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Hi(fd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Bi(Hn.setTeamState({inviteTokenState:I({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield Bi(Hn.setTeamError({key:Fp.UPDATE_TOKEN_LINK,value:t.message}))}}function*WS({payload:e}){const{callback:t}=null!=e?e:{};yield Bi(Hn.setTeamError({key:Fp.DELETE_TOKEN_LINK,value:!1}));try{yield Hi(fd.teams.deleteInviteUserLink),yield Bi(Hn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Fp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*KS({payload:e}){yield Bi(Hn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*GS({payload:e}){const t=yield TS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*BS({payload:e}){yield Bi(Hn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*zS({payload:e}){const t=yield TS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*qS(){yield Bo(Hn.loadUsers,PS),yield Bo(Hn.loadAllSubTenantsUsers,IS),yield Bo(Hn.loadRoles,LS),yield Go(Hn.addUser,wS),yield Go(Hn.addUsersBulk,OS),yield Go(Hn.addUserToSubTenants,ES),yield Go(Hn.updateUser,CS),yield Go(Hn.setUserRolesForSubTenants,RS),yield Go(Hn.deleteUser,DS),yield Go(Hn.deleteUserFromSubTenants,_S),yield Go(Hn.resendActivationLink,US),yield Go(Hn.resendInvitationLink,MS),yield Go(Hn.resendInvitationEmail,NS),yield Go(Hn.resendInvitationLinkToAllSubTenants,$S),yield Go(Hn.getInvitationLink,xS),yield Go(Hn.createInvitationLink,VS),yield Go(Hn.updateInvitationLink,jS),yield Go(Hn.deleteInvitationLink,WS),yield Go(Hn.openAddUserDialog,KS),yield Go(Hn.closeAddUserDialog,GS),yield Go(Hn.openDeleteUserDialog,BS),yield Go(Hn.closeDeleteUserDialog,zS)}function*HS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield Bi(Hn.setTeamState({users:Vd,totalPages:2,totalItems:10,roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1})),null==r||r(Vd)}function*JS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield TS(),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 Bi(Hn.setTeamLoader({key:Fp.USERS,value:!r})),yield Bi(Hn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield yt(),yield Bi(Hn.setTeamState({allUsers:jd,totalPages:2,totalItems:10,roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.USERS,value:!1})),null==l||l(jd)}function*YS({payload:e}){var t;yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield Bi(Hn.setTeamState({roles:Ud,permissions:Nd})),yield Bi(Hn.setTeamLoader({key:Fp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Ud,permissions:Nd})}function*QS({payload:e}){const{callback:t}=e,n=li(e,gS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Fd,n,{id:`${nS()}`});null==t||t(o),yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*XS({payload:e}){const{callback:t}=e,n=li(e,pS),i=yield TS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Fd,n,{id:`${nS()}`});yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*ZS({payload:e}){var t;const{callback:n}=e,i=li(e,SS),{id:o}=i,a=yield TS(),r=a.users.find((e=>e.id===i.id));yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:o||""})),yield Bi(Hn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0})})),yield Bi(Hn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?I({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield yt();const l=I({},r,i);null==n||n(l),yield Bi(Hn.setTeamState({users:a.users.map((e=>e.id===l.id?I({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Bi(Hn.setTeamLoader({key:Fp.UPDATE_USER,value:!1}))}function*ev({payload:e}){const{callback:t}=e,n=li(e,vS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*tv({payload:e}){const{callback:t}=e,n=li(e,hS),i=yield TS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*nv({payload:e}){const{callback:t}=e,n=li(e,mS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_ACTIVATE_LINK,value:!1}))}function*iv({payload:e}){const{callback:t}=e,n=li(e,bS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*ov({payload:e}){const{callback:t}=e,n=li(e,AS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*av({payload:e}){const{callback:t}=e,n=li(e,kS);yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Fp.RESEND_INVITATION_LINK,value:!1}))}function*rv(){yield Bo(Hn.loadUsers,HS),yield Bo(Hn.loadAllSubTenantsUsers,JS),yield Bo(Hn.loadRoles,YS),yield Go(Hn.addUser,QS),yield Go(Hn.addUserToSubTenants,XS),yield Go(Hn.updateUser,ZS),yield Go(Hn.deleteUser,ev),yield Go(Hn.deleteUserFromSubTenants,tv),yield Go(Hn.resendActivationLink,nv),yield Go(Hn.resendInvitationLink,iv),yield Go(Hn.resendInvitationEmail,ov),yield Go(Hn.resendInvitationLinkToAllSubTenants,av),yield Go(Hn.openAddUserDialog,KS),yield Go(Hn.closeAddUserDialog,GS),yield Go(Hn.openDeleteUserDialog,BS),yield Go(Hn.closeDeleteUserDialog,zS)}const lv=["authorizationUrl"],sv=["events","url"];function*cv(){try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const e=yield Hi(fd.auth.getSocialLoginProviders);yield Bi(Hn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*uv(){try{const e=yield Qi((e=>e.root.context));yield Bi(Hn.setSocialLoginsState({loading:!0}));const t=(yield Hi(fd.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=li(t,lv);const o=Yo(e,null!=n?n:"");return I({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield Bi(Hn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield Bi(Hn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*dv(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,sv);try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Hi(fd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Hd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:qd.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Bi(Hn.setLoginState({email:e,isNewUser:r})),yield pf(),localStorage.removeItem("register-quick-login"),yield Bi(Hn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield Bi(Hn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*yv({payload:e}){yield Bi(Hn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*fv(){yield zo(Hn.loadSocialLoginsConfiguration,cv),yield zo(Hn.loadSocialLoginsConfigurationV2,uv),yield zo(Hn.loginViaSocialLogin,dv),yield Bo(Hn.setSocialLoginError,yv)}let gv;function*pv({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Qi((e=>e.auth.apiTokensState));try{let e,a;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Hi(fd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Hi(fd.auth.updateUserApiTokensData,{description:t}),yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Bi(Hn.setApiTokensError({key:gv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Sv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Qi((e=>e.auth.apiTokensState));try{let e,r;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield Hi(fd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Hi(fd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Bi(Hn.setApiTokensError({key:gv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*vv({payload:e}){const{apiTokensDataUser:t}=yield Qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),n?(yield Hi(fd.auth.deleteUserAccessToken,{id:e}),yield Bi(Hn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Hi(fd.auth.deleteUserApiToken,{tokenId:e}),yield Bi(Hn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:gv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}}function*hv({payload:e}){const{apiTokensDataTenant:t}=yield Qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),n?(yield Hi(fd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Hi(fd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:gv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}}function*mv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield zi([Hi(fd.auth.getUserApiTokensData),Hi(fd.auth.getTenantApiTokensData)]);yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*bv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Hi(fd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Hi(fd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Av({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Hi(fd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Hi(fd.auth.getTenantAccessTokensData))?n:[],l=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Bi(Hn.setApiTokensError({key:gv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*kv(){yield zo(Hn.loadApiTokens,mv),yield zo(Hn.loadUserApiTokens,bv),yield zo(Hn.loadTenantApiTokens,Av),yield Go(Hn.addUserApiToken,pv),yield Go(Hn.addTenantApiToken,Sv),yield Bo(Hn.deleteTenantApiToken,hv),yield Bo(Hn.deleteUserApiToken,vv)}function*Tv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState)),a=I({},kd,{description:t,roleIds:n,clientId:`CLIENT_ID_${nS()}`});yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Pv({payload:e}){yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!0})),yield Xi(200);const t=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Bi(Hn.setApiTokensLoader({key:gv.DELETE_API_TOKEN,value:!1}))}function*Iv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[Ad],i=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Lv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[Ad];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*wv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!0})));const n=[kd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:gv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Ov(){yield zo(Hn.loadApiTokens,Iv),yield zo(Hn.loadUserApiTokens,Lv),yield zo(Hn.loadTenantApiTokens,wv),yield Go(Hn.addTenantApiToken,Tv),yield Bo(Hn.deleteTenantApiToken,Pv)}function*Ev({payload:e}){try{var t;yield Bi(Hn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Hi(fd.accountSettings.updateSettings,I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Bi(Hn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Bi(Hn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Cv({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Hi(fd.accountSettings.getSettings);yield Bi(Hn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield Bi(Hn.setAccountSettingsState({loading:!1,error:e.message}))}}function*Dv(){yield zo(Hn.saveAccountSettings,Ev),yield zo(Hn.loadAccountSettings,Cv)}function*Rv({payload:e}){var t;yield Bi(Hn.setAccountSettingsState({loading:!0})),yield yt();const{accountSettingsState:n}=yield Qi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Bi(Hn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*_v({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield yt(),yield Bi(Hn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Uv(){yield zo(Hn.saveAccountSettings,Rv),yield zo(Hn.loadAccountSettings,_v)}function*Mv({payload:{tenantId:e,callback:t}}){yield Bi(Hn.setState({isLoading:!0}));try{yield Hi(fd.tenants.switchTenant,{tenantId:e}),yield Hi(pf),(null==t?void 0:t(!0))||(yield Bi(Hn.setState({isLoading:!1})))}catch(e){yield Bi(Hn.setState({isLoading:!1})),null==t||t(!1,e)}}function*Nv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getTenants);yield Bi(Hn.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 Bi(Hn.setTenantsState({loading:!1}))}}function*$v({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getSubTenants);yield Bi(Hn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Fv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(fd.tenants.getSubTenantsAsTree);yield Bi(Hn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*xv(){yield Go(Hn.loadTenants,Nv),yield Go(Hn.loadSubTenants,$v),yield Go(Hn.switchTenant,Mv),yield Go(Hn.loadSubTenantsTree,Fv)}function*Vv(){yield Bi(Hn.setTenantsState({loading:!0})),yield yt(),yield Bi(Hn.setTenantsState({tenants:Wd,loading:!1}))}function*jv(){yield Go(Hn.loadTenants,Vv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(gv||(gv={}));const Wv=["callback"],Kv=["callback"],Gv=["callback"],Bv=["callback"],zv=["callback"];function*qv({payload:e}){var t;yield Bi(Hn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield zi([Hi(fd.roles.getRoles),Hi(fd.roles.getPermissions),Hi(fd.roles.getPermissionCategories)]),[t,n,i]=e;yield Bi(Hn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*Hv(e){let{payload:{callback:t}}=e,n=li(e.payload,Wv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.addRole,n),i=yield Hi(fd.roles.getRoles);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Jv(e){let{payload:{callback:t}}=e,n=li(e.payload,Kv);yield Bi(Hn.setRolesState({saving:!0}));try{yield Hi(fd.roles.deleteRole,n),yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Yv(e){let{payload:{callback:t}}=e,n=li(e.payload,Gv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.updateRole,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Qv(e){let{payload:{callback:t}}=e,n=li(e.payload,Bv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.attachPermissionsToRole,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Xv(e){let{payload:{callback:t}}=e,n=li(e.payload,zv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(fd.roles.attachPermissionToRoles,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Zv(){yield zo(Hn.loadRolesAndPermissions,qv),yield Go(Hn.addRole,Hv),yield Go(Hn.deleteRole,Jv),yield Go(Hn.updateRole,Yv),yield Go(Hn.attachPermissionsToRole,Qv),yield Go(Hn.attachPermissionToRoles,Xv)}function*eh({payload:e}){var t;yield Bi(Hn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Bi(Hn.setRolesState({roles:Td,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*th(){yield zo(Hn.loadRolesAndPermissions,eh)}const nh=["callback"],ih=["callback"],oh=["callback"];function*ah(e){let{payload:{callback:t}}=e,n=li(e.payload,nh);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(fd.auth.resetPhoneNumber,n);yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield Bi(Hn.setLoginState({email:n.email}))}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*rh(e){let{payload:{callback:t}}=e,n=li(e.payload,ih);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(fd.auth.verifyResetPhoneNumber,n);yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*lh(e){let{payload:{callback:t}}=e,n=li(e.payload,oh);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Hi(fd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Bi(Hn.setLoginState({step:vt.loginWithSmsOtc})),yield Bi(Hn.passwordlessPreLogin({type:yr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Bi(Hn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*sh(){yield zo(Hn.resetPhoneNumber,ah),yield zo(Hn.verifyResetPhoneNumber,rh),yield zo(Hn.changePhoneNumber,lh)}function*ch(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCurrentUserSessions);yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*uh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getCurrentUserSession);yield Bi(Hn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*dh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.deleteSessionForUser,e),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*yh({payload:{callback:e,userId:t}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Bi(Hn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*fh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(fd.auth.deleteAllSessionsForUser),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*gh(){yield Bo(Hn.loadUserSessions,ch),yield Bo(Hn.deleteUserSession,dh),yield Bo(Hn.deleteAllUserSessions,fh),yield Bo(Hn.loadCurrentUserSession,uh),yield Go(Hn.revokeUserSessions,yh)}function*ph(){yield Bi(Hn.setSessionsState({loading:!0,error:null})),yield Bi(Hn.setSessionsState({sessions:Kd,loading:!1}))}function*Sh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const t=(yield Qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Bi(Hn.setSessionsState({sessions:t,loading:!1}))}function*vh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const e=Kd.filter((e=>e.current));yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}function*hh(){yield Bo(Hn.loadUserSessions,ph),yield Bo(Hn.deleteUserSession,Sh),yield Bo(Hn.deleteAllUserSessions,vh)}const mh=["callback"],bh=["callback"];function*Ah(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getSessionConfigurations);yield Bi(Hn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*kh({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=li(e,mh);yield Hi(fd.auth.createOrUpdateSessionConfigrations,n),yield Bi(Hn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Bi(Hn.setSessionsPolicyState({error:e,loading:!1}))}}function*Th(){yield zo(Hn.loadSessionsPolicy,Ah),yield Bo(Hn.createOrUpdateSessionsPolicy,kh)}function*Ph(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const e=yield Qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Gd}));yield Bi(Hn.setSessionsPolicyState(I({},e,{loading:!1})))}function*Ih({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=li(e,bh);null==t||t(!0),yield Bi(Hn.setSessionsPolicyState({configurations:n,loading:!1}))}function*Lh(){yield zo(Hn.loadSessionsPolicy,Ph),yield Bo(Hn.createOrUpdateSessionsPolicy,Ih)}const wh=["callback"],Oh=["callback"],Eh=["callback"],Ch=["callback"],Dh=["callback"],Rh=["callback"],_h=["callback"],Uh=["callback"],Mh=()=>Qi((e=>e.auth.restrictionsState.ipRestrictions)),Nh=()=>Qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*$h(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Hi(fd.auth.getDomainRestrictionsConfig),t=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Bi(Hn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Fh(e){let{payload:{callback:t}}=e,n=li(e.payload,wh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Nh();try{var o;yield Hi(fd.auth.createDomainRestriction,n);const e=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Bi(Hn.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 Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xh(e){let{payload:{callback:t}}=e,n=li(e.payload,Oh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Hi(fd.auth.updateDomainRestrictionConfig,n),i=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Vh({payload:{id:e}}){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Nh();try{var n;yield Hi(fd.auth.deleteDomainRestriction,e);const i=(yield Hi(fd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const jh=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:_n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Wh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Mh(),t=yield Hi(fd.auth.getIPRestrictionsConfig),n=jh({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Hi(fd.auth.getIPRestrictions,n);yield Bi(Hn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Kh(){try{const{valid:e}=yield Hi(fd.auth.testCurrentIpInAllowList);yield Bi(Hn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message}))}}function*Gh({payload:{callback:e}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Qi((e=>e.auth.userIp));yield zi([Hi(fd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Hi(fd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Mh(),i=jh(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Hi(fd.auth.getIPRestrictions,i);yield Bi(Hn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:_n.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Bh(e){let{payload:{callback:t}}=e,n=li(e.payload,Eh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Mh();try{var o,a;yield Hi(fd.auth.createIPRestriction,n);const e=yield Mh(),r=jh(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Hi(fd.auth.getIPRestrictions,r);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:_n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zh(e){let{payload:{callback:t}}=e,n=li(e.payload,Ch);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{yield Hi(fd.auth.updateIPRestrictionConfig,n);const e=yield Mh(),i=yield Hi(fd.auth.getIPRestrictionsConfig),o=jh(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Hi(fd.auth.getIPRestrictions,o);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qh({payload:{id:e,callback:t}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Mh();try{var i;yield Hi(fd.auth.deleteIPRestriction,e);const o=yield Mh(),a=jh(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Hi(fd.auth.getIPRestrictions,a);yield Kh(),yield Bi(Hn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hh(){yield zo(Hn.loadIpRestrictions,Wh),yield zo(Hn.loadEmailDomainRestrictions,$h),yield Go(Hn.saveIpRestriction,Bh),yield Go(Hn.saveIpRestrictionsConfig,zh),yield Go(Hn.deleteIpRestriction,qh),yield Go(Hn.checkIfUserIpValid,Kh),yield Go(Hn.addCurrentUserIpAndActivate,Gh),yield Go(Hn.saveEmailDomainRestriction,Fh),yield Go(Hn.saveEmailDomainRestrictionsConfig,xh),yield Go(Hn.deleteEmailDomainRestriction,Vh)}function*Jh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{restrictions:zd.filter((e=>e.strategy===Bd.strategy)),config:Bd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Yh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Mh(),t=zd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Bi(Hn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Qh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Dh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const r=yield Mh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Bi(Hn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:_n.ALLOW},restrictions:[...l,I({},a,{createdAt:new Date,updatedAt:new Date,id:nS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Xh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Rh);const r=yield Mh();yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{config:I({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Bi(Hn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Zh({payload:{id:e,callback:t}}){var n;yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Mh();yield Bi(Hn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:_n.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*em(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:_n.ALLOW}],config:{active:!0,listType:_n.ALLOW,blockPublicDomains:!1}}}))}function*tm(e){var t,n;let{payload:{callback:i}}=e,o=li(e.payload,_h);const a=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==i||i(!0),yield Bi(Hn.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)||[],I({},o,{id:Date.now().toString()})]},saving:!1}))}function*nm(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,Uh);const o=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==n||n(!0),yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||_n.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*im({payload:{id:e}}){var t,n;const i=yield Nh();yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),yield Bi(Hn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:_n.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*om(){yield zo(Hn.loadIpRestrictions,Jh),yield zo(Hn.loadEmailDomainRestrictions,em),yield Go(Hn.saveIpRestriction,Qh),yield Go(Hn.saveIpRestrictionsConfig,Xh),yield Go(Hn.deleteIpRestriction,Zh),yield Go(Hn.checkIfUserIpValid,Yh),yield Go(Hn.saveEmailDomainRestriction,tm),yield Go(Hn.saveEmailDomainRestrictionsConfig,nm),yield Go(Hn.deleteEmailDomainRestriction,im)}const am=["callback"],rm=["id"];function*lm(e){const{count:t}=yield Hi(fd.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*sm(){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(fd.directory.getConfigs),t=yield zi(e.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*cm(e){let{payload:{callback:t}}=e,n=li(e.payload,am);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(fd.directory.createConfiguration,n),i=yield Hi(fd.directory.getConfigs),o=yield zi(i.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*um(e){let{payload:{id:t}}=e,n=li(e.payload,rm);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(fd.directory.updateConfiguration,t,n);const e=yield Hi(fd.directory.getConfigs),i=yield zi(e.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*dm({payload:{id:e,callback:t}}){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(fd.directory.deleteConfiguration,e);const n=yield Hi(fd.directory.getConfigs),i=yield zi(n.map((e=>lm(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*ym(){yield zo(Hn.loadProvisionConnections,sm),yield Go(Hn.createProvisionConnection,cm),yield Go(Hn.deleteProvisionConnection,dm),yield Go(Hn.updateProvisionConnection,um)}const fm=["callback","events"];function*gm(e){let{payload:{callback:t}}=e,n=li(e.payload,fm);yield Bi(Hn.setImpersonateState({loading:!0}));try{yield Hi(fd.impersonate.impersonate,n),yield Bi(Hn.setImpersonateState({step:Wn.success})),yield Bi(Hn.resetImpersonateState()),null==t||t(!0)}catch(e){yield Bi(Hn.setImpersonateState({loading:!1,error:e.message}))}}function*pm(){yield zo(Hn.impersonate,gm)}var Sm={sagas:function*(){yield zi([Hi(Zf),Hi(zp),Hi(Hp),Hi($p),Hi(sh),Hi(pg),Hi(Vg),Hi(zg),Hi(Tp),Hi(qS),Hi(fv),Hi(ey),Hi(kv),Hi(Oy),Hi(Dv),Hi(xv),Hi(Zv),Hi(gh),Hi(Th),Hi(Hh),Hi(ym),Hi(pm)])},mockSagas:function*(){yield zi([Hi(ng),Hi(kg),Hi(Yg),Hi(Rp),Hi(rv),Hi(Ov),Hi(jy),Hi(hh),Hi(Uv),Hi(jv),Hi(Lh),Hi(om),Hi(th)])},storeName:kt,initialState:jn,reducer:zn,actions:Hn};const vm=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),hm={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},mm={setAuditLogsState:vm("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:hm})},bm={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},Am={loading:!0},km={setAuditsMetadataState:vm("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:Am})},Tm={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},Pm={auditLogsState:hm,auditsMetadataState:Am},{reducer:Im,actions:Lm}=at({name:Pt,initialState:Pm,reducers:I({resetState:e=>I({},e,Pm),setState:(e,{payload:t})=>I({},e,t)},mm,km)}),wm=I({},Lm,bm,Tm),Om=e=>"createdAt"!==e.id,Em={total:20,data:Array.from(Array(5).keys()).map((e=>I({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`})))},Cm={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}]},Dm=()=>Qi((e=>e.auditLogs.auditLogsState)),Rm=()=>Qi((e=>e.auditLogs.auditsMetadataState));function*_m(){const e=yield Dm(),{columns:t}=yield Rm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});yield Bi(wm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield fd.audits.exportAudits(I({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Bi(wm.setAuditLogsState({isDownloadingCsv:!1}))}function*Um({payload:e}){yield Bi(wm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dm(),{columns:n}=yield Rm();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 Bi(wm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>I({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>I({},e,{[t.id]:t.value})),{});n||(yield Bi(wm.loadAuditsMetadata()));const{data:g,total:p}=yield Hi(fd.audits.getAudits,I({offset:c,count:s},y,f));yield Bi(wm.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Bi(wm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Mm(){yield Go(wm.exportAuditsCsv,_m),yield Go(wm.loadAuditLogs,Um)}function*Nm({payload:e}){yield Bi(wm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Dm(),{columns:n}=yield Rm();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 Bi(wm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Bi(wm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Em;let i=n.filter((e=>t=>e.filter(Om).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 Bi(wm.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 Bi(wm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*$m(){yield Go(wm.loadAuditLogs,Nm)}function*Fm(){yield Bi(wm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Hi(fd.metadata.getAuditsMetadata);yield Bi(wm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(wm.setAuditsMetadataState({error:e,loading:!1}))}}function*xm(){yield Go(wm.loadAuditsMetadata,Fm)}function*Vm(){yield Bi(wm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Cm;yield Bi(wm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(wm.setAuditsMetadataState({error:e,loading:!1}))}}function*jm(){yield Go(wm.loadAuditsMetadata,Vm)}var Wm={sagas:function*(){yield zi([Hi(Mm),Hi(xm)])},mockSagas:function*(){yield zi([Hi($m),Hi(jm)])},storeName:Pt,initialState:Pm,reducer:Im,actions:wm};const Km={total:0,offset:0,filter:"",sortBy:"createdAt",context:null,filters:[],rowsData:[],lastUpdated:new Date,isLoading:!0,isFetchMore:!1,totalToday:0,currentPage:0,headerProps:[],sortDirection:"desc",severeThisWeek:0,predefinedFilters:[],isDownloadingCsv:!1,virtualScroll:!1},{name:Gm,actions:Bm,reducer:zm}=at({name:"audits",initialState:Km,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=I({},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]})))}}}),qm=I({},Bm,{initData:it(`${Gm}/initData`),loadAudits:it(`${Gm}/loadAudits`),removeFilter:it(`${Gm}/removeFilter`),filterData:it(`${Gm}/filterData`),exportCSV:it(`${Gm}/exportCSV`),deleteAudits:it(`${Gm}/deleteAudits`)}),Hm=()=>Qi((e=>e[Gm]));function*Jm(){const{sortBy:e,sortDirection:t}=yield Hm();try{const n=yield Hi(fd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Bi(qm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Bi(qm.loadItemFailedAction(t))}}function*Ym(){try{const e=yield Hi(fd.metadata.getAuditsMetadata);yield Bi(qm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Bi(qm.loadItemFailedAction(t))}}const Qm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Xm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Hm(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Hm():{rowsData:[]};try{const e=Qm(t),{data:l,total:d}=yield Hi(fd.audits.getAudits,I({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Bi(qm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Bi(qm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Bi(qm.loadItemFailedAction(t))}}function*Zm(){yield Bi(qm.startLoading()),yield zi([Jm(),Ym(),Xm({payload:{onlyOneLoad:!1},type:""})]),yield Bi(qm.finishLoading())}function*eb({payload:e}){const{filters:t}=yield Hm(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Bi(qm.setFilterData(i))}function*tb({payload:e}){const{filters:t}=yield Hm();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield Bi(qm.setFilterData(i))}function*nb(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Hm(),a=Qm(e);yield Bi(qm.startDownloadingCsv());try{yield fd.audits.exportAudits(I({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 Bi(qm.stopDownloadingCsv())}}function*ib(){yield Bo(qm.initData,Zm),yield Bo(qm.removeFilter,eb),yield Bo(qm.filterData,tb),yield Bo([qm.loadAudits,qm.textSearch,qm.onPageChange],Xm),yield Bo([qm.setFilterData,qm.setDataSorting,qm.startRefresh],(()=>Xm({payload:{appendMode:!1},type:""}))),yield Bo(qm.exportCSV,nb)}const ob={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},ab={initData:()=>I({},ob),setConnectivityState:(e,{payload:t})=>I({},e,t),cleanWebhookTestData:e=>I({},e,{testResult:void 0}),cleanWebhookLogsData:e=>I({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return I({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>I({},e,{error:void 0}),cleanSlackData:e=>I({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>I({},e,{retryResult:I({},e.retryResult,t)})}},rb={loadSlackActions:it("connectivity/loadSlackActions"),loadDataAction:it("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:it("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:it("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:it("connectivity/loadScope"),deleteWebhookConfigAction:it("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:it("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:it("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},lb={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:sb,actions:cb}=at({name:Tt,initialState:lb,reducers:I({},ab)}),ub=I({},cb,rb),db={slack:fd.connectivity.getSlackConfiguration,email:fd.connectivity.getEmailConfiguration,sms:fd.connectivity.getSMSConfiguration,webhook:fd.connectivity.getWebhooksConfigurations,categories:fd.connectivity.getCategories,channelMap:fd.connectivity.getChannelMaps},yb={slack:fd.connectivity.postSlackConfiguration,email:fd.connectivity.postEmailConfiguration,sms:fd.connectivity.postSMSConfiguration,webhook:fd.connectivity.postWebhooksConfiguration},fb=["email","slack","sms","webhook"],gb={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"}},pb=["id"],Sb=["id","enabled"],vb=["categories","channelMap"];function*hb(e){return yield Hi(bb,{payload:{api:e},type:""})}function*mb({payload:e=fb}){yield Bi(ub.setConnectivityState({isLoading:!0}));try{const t=yield zi([...e.map(hb),yield bb({payload:{api:"categories"},type:""}),yield function*(){return(yield zi(e.map((function*(e){return yield bb({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield bb({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?I({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:gb[e[o]].events(i),active:gb[e[o]].isActive(i),platform:gb[e[o]].title,image:gb[e[o]].image}]}):n:I({},n,{[`${vb[o-e.length]}`]:i})),{list:[],webhook:n});yield Bi(ub.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Bi(ub.setConnectivityState({isLoading:!1}))}}function*bb({payload:{api:e,params:t}}){try{return yield Hi(db[e],t)}catch(e){return}}function*Ab(){try{yield Bi(ub.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Hi(fd.connectivity.getSlackChannels);yield Bi(ub.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Bi(ub.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*kb(e,t){const{connectivity:{list:n}}=yield Qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=gb[e].isActive(t);o!==i.active&&(yield Bi(ub.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*Tb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Qi((e=>e.connectivity));try{if(yield Bi(ub.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield zi([...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=li(e,pb);return n===t.id&&JSON.stringify(I({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Hi(yb.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Hi(fd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Qi(),{processIds:i}=yield Qi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield zi([...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 Hi("email"===t?fd.connectivity.postEmailConfiguration:fd.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=li(o,Sb);return yield zi([yield Hi("email"===t?fd.connectivity.patchEmailConfiguration:fd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Hi("email"===t?fd.connectivity.putEmailSubscriptions:fd.connectivity.putSMSSubscriptions,a,i,I({},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 Hi("email"===t?fd.connectivity.deleteEmailSubscriptions:fd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield bb({payload:{api:t},type:""});yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield kb(t,e)}else yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Hi(yb[e],t),!["sms","email"].includes(e)){const o=yield bb({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield kb(e,o),null==n||n(!0)}}catch(e){var o;yield Bi(ub.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Pb({payload:e}){try{yield fd.connectivity.postSlackCode(e)}catch{}yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1}))}function*Ib(){const{slackChannels:e}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Hi(fd.connectivity.getSlackScope);yield Bi(ub.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Bi(ub.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Lb({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({isSaving:!0})),yield Hi(fd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield bb({payload:{api:"webhook"},type:""});o&&(yield Bi(ub.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*wb({payload:e}){try{yield Bi(ub.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Hi(fd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Bi(ub.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Ob({payload:e}){try{const{statusCode:t}=yield Hi(fd.connectivity.postWebhookRetry,e);yield Bi(ub.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Bi(ub.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Eb({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Qi((e=>e.connectivity));try{yield Bi(ub.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Hi(fd.connectivity.getWebhookLog,e,n,t);yield Bi(ub.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield Bi(ub.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Cb={sagas:function*(){yield Go(ub.loadDataAction,mb),yield Bo(ub.loadSlackActions,Ab),yield Go(ub.postDataAction,Tb),yield Go(ub.postCodeAction,Pb),yield Go(ub.loadScope,Ib),yield Go(ub.deleteWebhookConfigAction,Lb),yield Go(ub.postWebhookTestAction,wb),yield Go(ub.postWebhookRetryAction,Ob),yield Bo(ub.loadWebhookLogsAction,Eb)},storeName:Tt,initialState:lb,reducer:sb,actions:ub};function Db(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}}function Rb(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function _b(e){return Rb(e,((e,t)=>I({},e,{loading:t.payload})))}function Ub(e){return Rb(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const Mb={loading:!1,error:null,fetching:!0,plans:[]},{actions:Nb,reducer:$b,name:Fb}=at({name:"subscriptions/plans",initialState:Mb,reducers:I({},Db())}),xb=I({loadPlans:it(`${Fb}/loadPlans`)},Nb),Vb={loading:!1,error:null,fetching:!0,config:null},jb=I({},Db()),{actions:Wb,reducer:Kb,name:Gb}=at({name:"subscriptions/config",initialState:Vb,reducers:jb}),Bb=I({loadPaymentConfiguration:it(`${Gb}/loadPaymentConfiguration`)},Wb),zb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},qb=I({},Db(),{setCancellationLoading:_b("cancellation"),setCancellationError:Ub("cancellation"),setRenewalLoading:_b("renewal"),setRenewalError:Ub("renewal")}),{reducer:Hb,actions:Jb,name:Yb}=at({name:"subscriptions/billing/subscription",initialState:zb,reducers:qb}),Qb=I({load:it(`${Yb}/loadSubscription`),cancelSubscription:it(`${Yb}/cancelSubscription`),renewSubscription:it(`${Yb}/renewSubscription`)},Jb),Xb={loading:!1,error:null,fetching:!0},Zb=I({},Db()),{reducer:eA,actions:tA,name:nA}=at({name:"subscriptions/billing/information",initialState:Xb,reducers:Zb}),iA=I({loadBillingInformation:it(`${nA}/loadBillingInformation`),cancelSubscription:Qb.cancelSubscription,renewSubscription:Qb.renewSubscription},tA),oA={loading:!1,error:null,fetching:!0},aA=I({},Db(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:rA,actions:lA,name:sA}=at({name:"subscriptions/billing/payment",initialState:oA,reducers:aA}),cA=I({loadPaymentMethod:it(`${sA}/loadPaymentMethod`),submitPaymentMethod:it(`${sA}/submitPaymentMethod`),submitPaymentMethodError:it(`${sA}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${sA}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${sA}/updateBillingDetails`,(e=>({payload:e})))},lA),uA={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},dA=I({},Db(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:yA,actions:fA,name:gA}=at({name:"subscriptions/billing/invoices",initialState:uA,reducers:dA}),pA=I({loadInvoices:it(`${gA}/loadInvoices`),downloadInvoice:it(`${gA}/downloadInvoice`,(e=>({payload:e})))},fA),SA={information:Xb,invoices:uA,paymentMethod:oA,subscription:zb},vA={invoices:pA,information:iA,paymentMethod:cA,subscription:Qb},hA=$e({invoices:yA,information:eA,paymentMethod:rA,subscription:Hb}),mA={fetching:!0,loading:!1,error:null,confirmed:!1},bA=I({},Db()),{actions:AA,reducer:kA,name:TA}=at({name:"subscriptions/checkout",initialState:mA,reducers:bA}),PA=I({loadCheckout:it(`${TA}/loadCheckout`),resetCheckout:it(`${TA}/resetCheckout`),submitCheckout:it(`${TA}/submitCheckout`),confirmCheckout:it(`${TA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${TA}/errorCheckout`,(e=>({payload:e})))},AA),IA={loading:!1,error:null,cardSetupIntentSecret:null},LA=I({},Db()),{reducer:wA,actions:OA,name:EA}=at({name:"subscriptions/stripe",initialState:IA,reducers:LA}),CA=I({loadCustomer:it(`${EA}/loadCustomer`),createCardSetupIntentSecret:it(`${EA}/createCardSetupIntentSecret`)},OA),DA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:RA,reducer:_A,name:UA}=at({name:"subscriptions/vendorPublicConfig",initialState:DA,reducers:I({},Db())}),MA=I({loadVendorPublicConfiguration:it(`${UA}/loadVendorPublicConfiguration`)},RA),NA={config:Vb,plans:Mb,checkout:mA,billing:SA,stripe:IA,vendorPublicConfig:DA},$A={config:Bb,billing:vA,plans:xb,checkout:PA,stripe:CA,vendorPublicConfig:MA},FA=$e({config:Kb,billing:hA,plans:$b,checkout:kA,stripe:wA,vendorPublicConfig:_A});let xA,VA,jA;function WA({policy:e}){return{policy:jA.AT_PERIOD_END}}function KA(e){switch(e){case Mu.ACTIVE:return VA.ACTIVE;case Mu.INCOMPLETE:return VA.INCOMPLETE;case Mu.CANCELED:return VA.CANCELED;case Mu.EXPIRED:return VA.EXPIRED;case Mu.TRIALING:return VA.TRIALING;default:return VA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(xA||(xA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(VA||(VA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(jA||(jA={}));const GA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Mu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},BA=[{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"}],zA=[{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:""}],qA=[{id:"id",externalId:"externalId",type:Nu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],HA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*JA(){yield Go(Qb.load,YA),yield Go(Qb.cancelSubscription,XA),yield Go(Qb.renewSubscription,ZA)}function*YA(){const e=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield ok(e)}function*QA(){yield Bi(Qb.setLoading(!0));try{const[e]=yield Hi(fd.subscriptions.getManagedSubscriptions);yield Bi(Qb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Bi(Qb.setError(e))}}function*XA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Qb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Mu.ACTIVE)try{yield Bi(Qb.setCancellationLoading(!0)),yield Hi(fd.subscriptions.cancelManagedSubscription,t),yield QA(),yield Bi(Qb.setCancellationLoading(!1))}catch(e){yield Bi(Qb.setCancellationError(e.message))}}function*ZA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Qb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===$u.AT_PERIOD_END)try{yield Bi(Qb.setRenewalLoading(!0)),yield Hi(fd.subscriptions.renewManagedSubscription,t),yield QA(),yield Bi(Qb.setRenewalLoading(!1))}catch(e){yield Bi(Qb.setCancellationError(e.message))}}function*ek(){yield Bi(Qb.setLoading(!0)),yield Xi(500),yield Bi(Qb.setState({subscription:GA,fetching:!1,loading:!1,error:null}))}function*tk(){yield Go(Qb.load,ek)}function*nk(){yield Go(iA.loadBillingInformation,ik)}function*ik(){yield function*(e){const t=yield Qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield ok(n,!1):yield Bi(iA.setError(t?"Not authorized":"Internal feature failure"))}()}function*ok(e,t){yield Bi(iA.setLoading(!0));try{var n,i;const o=yield Hi(fd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Hi(fd.subscriptions.getSubscriptionPlan,a):([,l]=yield zi([Hi(QA),Hi(fd.subscriptions.getSubscriptionPlan,a)]),s=yield Qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Bi(iA.setState(I({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?VA.ACTIVE:KA(s.status),cancellation:s.cancellation&&WA(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 Bi(iA.setError(e.message))}}function*ak(){yield function*(){var e,t;yield Bi(iA.setLoading(!0)),yield Xi(500),yield Bi(iA.setState({loading:!1,fetching:!1,summary:{subscriptionId:GA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Fu.Stripe,externallyManaged:!1,currentPlanId:BA[0].id,defaultPlanId:BA[0].id},plan:I({},BA[0],{price:null==(e=BA[0].price)?void 0:e.amount,currency:null==(t=BA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*rk(){yield Go(iA.loadBillingInformation,ak)}function*lk(){yield Go(cA.loadPaymentMethod,sk),yield Go(cA.submitPaymentMethod,uk),yield Go(cA.submitPaymentMethodError,dk),yield Go(cA.submitPaymentMethodSuccess,yk),yield Go(cA.updatePaymentMethodBillingDetails,ck)}function*sk(){yield Bi(cA.setLoading(!0));try{const e=(yield Hi(fd.subscriptions.getPaymentMethods))[0];yield Bi(cA.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Bi(cA.setError(e.message))}}function*ck({payload:e}){yield Bi(cA.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Hi(fd.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Hi(sk),null==o||o(!0)}catch(e){yield Bi(cA.setError(e.message)),null==o||o(!1)}yield Bi(cA.setLoading(!1))}function*uk(){yield Bi(cA.setLoading(!0))}function*dk({payload:e}){yield Bi(cA.setError(e))}function*yk(){yield Bi(cA.loadPaymentMethod())}function*fk(){yield Bi(cA.setLoading(!0)),yield Xi(500);const e=qA[0];yield Bi(cA.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*gk(){yield Go(cA.loadPaymentMethod,fk)}function*pk(){yield Go(pA.loadInvoices,Sk),yield Go(pA.downloadInvoice,vk)}function*Sk(){yield Bi(pA.setLoading(!0));try{const e=(yield Hi(fd.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 Bi(pA.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Bi(pA.setError(e.message))}}function*vk({payload:e}){yield Bi(pA.setInvoiceDownloadState({loading:!0,error:null}));try{yield Hi(fd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Bi(pA.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Bi(pA.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*hk(){yield Bi(pA.setLoading(!0)),yield Xi(500),yield Bi(pA.setState({loading:!1,fetching:!1,invoices:zA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Bi(pA.setLoading(!1))}function*mk(){yield Go(pA.loadInvoices,hk)}function*bk(){yield zi([Hi(nk),Hi(lk),Hi(pk),Hi(JA)])}function*Ak(){yield zi([Hi(rk),Hi(gk),Hi(mk),Hi(tk)])}function*kk(){yield Go(PA.loadCheckout,Tk),yield Go(PA.resetCheckout,Pk),yield Go(PA.submitCheckout,Ik),yield Go(PA.confirmCheckout,Lk),yield Go(PA.errorCheckout,Ok)}function*Tk(){yield Bi(PA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Pk(){yield Bi(PA.setState({loading:!1,error:null,confirmed:!1}))}function*Ik(){yield Bi(PA.setState({loading:!0,error:null}))}function*Lk({payload:{paymentMethodId:e,planId:t}}){const n=yield Qi((e=>e.subscriptions.billing.subscription.subscription)),i=yield Qi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Mu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Bi(PA.setState({loading:!0,error:null})),o&&a)return yield wk(),void(yield Bi(Qb.setState({subscription:I({},n,{status:Mu.ACTIVE})})));try{yield Hi(fd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield zi([ik(),sk(),Sk()]),yield wk()}catch(e){yield Bi(PA.setState({loading:!1,error:e.message}))}}else yield Bi(PA.setState({loading:!1,error:"Subscription not found"}))}function*wk(){yield Bi(PA.setState({loading:!1,error:null,confirmed:!0}))}function*Ok({payload:e}){yield Bi(PA.setState({loading:!1,error:e}))}function*Ek(){yield Go(PA.resetCheckout,Pk)}function*Ck(){yield Go(xb.loadPlans,Dk)}function*Dk(){yield Bi(xb.setLoading(!0));try{const e=(yield Hi(fd.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 Bi(xb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Bi(xb.setError(e.message))}}function*Rk(){yield Bi(xb.setLoading(!0)),yield Xi(500),yield Bi(xb.setState({fetching:!1,loading:!1,plans:BA.map((e=>{var t,n;return I({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*_k(){yield Go(xb.loadPlans,Rk)}function*Uk(){yield Go(Bb.loadPaymentConfiguration,Mk)}function*Mk(){yield Bi(Bb.setLoading(!0));try{(yield Hi(fd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Fu.Stripe))?yield function*(){yield Bi(Bb.setLoading(!0));try{const e=yield Hi(fd.subscriptions.getStripePaymentProviderConfiguration);yield Bi(Bb.setState({loading:!1,fetching:!1,config:{paymentProvider:xA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Bi(Bb.setError(e.message))}}():yield Bi(Bb.setError("Payment provider not configured"))}catch(e){yield Bi(Bb.setError(e.message))}}function*Nk(){yield Bi(Bb.setLoading(!0)),yield Xi(500),yield Bi(Bb.setState({loading:!1,fetching:!1,config:{paymentProvider:xA.STRIPE,apiKey:""}}))}function*$k(){yield Go(Bb.loadPaymentConfiguration,Nk)}function*Fk(){yield Go(CA.createCardSetupIntentSecret,xk)}function*xk({payload:e}){yield Bi(CA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Hi(fd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Bi(CA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Bi(CA.setError(e.message))}}function*Vk(){yield Go(MA.loadVendorPublicConfiguration,jk)}function*jk(){yield Bi(MA.setLoading(!0));try{const e=yield Hi(fd.subscriptions.getVendorPublicConfigurations);yield Bi(MA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Bi(MA.setError(e.message))}}function*Wk(){yield Bi(MA.setLoading(!0)),yield Xi(500),yield Bi(MA.setState({fetching:!1,loading:!1,vendorPublicConfig:HA}))}function*Kk(){yield Go(MA.loadVendorPublicConfiguration,Wk)}var Gk={sagas:function*(){yield zi([Hi(bk),Hi(kk),Hi(Ck),Hi(Uk),Hi(Fk),Hi(Vk)])},mockSagas:function*(){yield zi([Hi(Ak),Hi(Ek),Hi(_k),Hi($k),Hi(Kk)])},reducer:FA,actions:$A,initialState:NA,storeName:"subscriptions"},Bk={sagas:function*(){yield Go(ry.loadVendorPublicInfo,ly)},storeName:It,initialState:iy,reducer:oy,actions:ry};const{reducer:zk}=at({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(qo.setContext(t),I({},e,{context:t}))}}}),qk=(e,t,n=!1,i,o,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,g,p,S,v;n||a||qo.setContext(e.context);const t=Mo(),h=[...tt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=nt({middleware:h,preloadedState:{root:I({},e,{previewMode:n,urlStrategy:r}),[Sm.storeName]:I({},Sm.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},Sm.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Wm.storeName]:I({},Wm.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Wm.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Wm.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Gm]:I({},Km,null!=(v=null==o?void 0:o.audits)?v:{}),[Cb.storeName]:Cb.initialState,[Gk.storeName]:Gk.initialState,[Bk.storeName]:Bk.initialState},reducer:$e({root:zk,[Sm.storeName]:Sm.reducer,[Wm.storeName]:Wm.reducer,[Gm]:zm,[Cb.storeName]:Cb.reducer,[Gk.storeName]:Gk.reducer,[Bk.storeName]:Bk.reducer})});const m=function*(){yield zi([Hi(Sm.sagas),Hi(Wm.sagas),Hi(ib),Hi(Cb.sagas),Hi(Gk.sagas),Hi(Bk.sagas)])},b=function*(){yield zi([Hi(Sm.mockSagas),Hi(Wm.mockSagas),Hi(Gk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Hn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var Hk=n(714),Jk=n.n(Hk);function Yk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Qk(e){if(e.type)return e;if("#"===e.charAt(0))return Qk(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 Xk(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 Zk(e){if(0===e.indexOf("#"))return e;const{values:t}=Qk(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 eT(e,t){if(e=Qk(e),t=Yk(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 Xk(e)}function tT(e,t){if(e=Qk(e),t=Yk(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 Xk(e)}const nT=e=>{if(e)return{main:e,light:Zk(tT(e,.4)),dark:Zk(eT(e,.15)),hover:Zk(eT(e,.15)),active:Zk(eT(e,.2))}},iT=e=>{if(e)return{main:e,light:tT(e,.7),dark:eT(e,.2)}},oT=(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)?I({},t,{palette:{primary:I({},nT(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:I({},nT(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:I({},nT(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},iT(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},iT(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},iT(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},iT(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},aT={},rT={},lT={},sT={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 cT{constructor(){this._theme=aT,this._themeV2=rT,this._navigation=sT,this._localizations=lT}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new cT;return n.set(e),cT._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=Jk().all([null!=(t=sT)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Jk().all([null!=(i=aT)?i:{},oT(null==e?void 0:e.theme,aT)]),this._themeV2=Jk().all([null!=(o=rT)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Jk().all([null!=(r=lT)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=sT,this._theme=aT,this._themeV2=rT,this._localizations=lT}}}cT._instances={};var uT={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},dT=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},yT=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},fT=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 gT,pT,ST,vT,hT,mT,bT,AT,kT,TT,PT,IT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(gT||(gT={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(pT||(pT={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(ST||(ST={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(vT||(vT={})),function(e){e.Invoices="invoices"}(hT||(hT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(mT||(mT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(bT||(bT={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(AT||(AT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(kT||(kT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(TT||(TT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(PT||(PT={})),function(e){e.CLIENT_CREDENTIALS="clientCredentials",e.ACCESS_TOKEN="accessToken"}(IT||(IT={}));const LT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},wT={hidden:"hidden",edit:"edit"};var OT="6.69.0",ET=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(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(OT),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=w(E().mark((function e(){var t,n,i,o,a;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Xo,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:cT.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=uT,e.next=13;break;case 4:return e.prev=4,e.next=7,Zu();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=dT(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=I({},t,{contextOptions:I({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?I({},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:qk({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),P.setInstance(c,this)}var t,n,i,o;return T(e,[{key:"initContainers",value:(o=w(E().mark((function e(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;cT.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:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=w(E().mark((function e(){var t;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=w(E().mark((function e(t){var n;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,I({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}(),CT=function(){function e(){A(this,e)}return T(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(qo.setAccessToken(t),qo.setUser(I({},n,{accessToken:t})),o.store.dispatch(Hn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Hn.loadTenants())):(qo.setAccessToken(null),qo.setUser(null),o.store.dispatch(Hn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),DT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),RT=function(){function e(){A(this,e)}return T(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),_T=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},UT=function(){function e(t,n,i,o){A(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:qk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new ET(this.options,t,!0),cT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,fT(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}(),MT="modern",NT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[MT]},$T=function(){function e(t,n,i,o){A(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:qk({context:a},this,!0,void 0,void 0,!0),this.options=I({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new ET(this.options,t,!0),cT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,fT(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 FT(e,t){return FT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},FT(e,t)}function xT(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&&FT(e,t)}function VT(e){return VT="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},VT(e)}function jT(e,t){if(t&&("object"===VT(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 WT(e){return WT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WT(e)}function KT(){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 GT(e,t,n){return GT=KT()?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&&FT(o,n.prototype),o},GT.apply(null,arguments)}function BT(e){var t="function"==typeof Map?new Map:void 0;return BT=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 GT(e,arguments,WT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),FT(n,e)},BT(e)}function zT(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=WT(e);if(t){var o=WT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return jT(this,n)}}var qT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new ET(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){xT(n,e);var t=zT(n);function n(){var e;A(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 T(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=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=yT(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=yT(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=yT(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=yT(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=yT(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=yT(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}(BT(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}()}));